Merge branch 'master' of ssh://cryps.gg:40022/~/cryps
This commit is contained in:
commit
557925801b
@ -19,6 +19,14 @@ const gameListHeight = () => Math.floor(window.innerHeight / 10);
|
|||||||
const gameListX = () => crypListWidth();
|
const gameListX = () => crypListWidth();
|
||||||
const gameListY = i => menuHeight() + (gameListHeight() * i);
|
const gameListY = i => menuHeight() + (gameListHeight() * i);
|
||||||
|
|
||||||
|
const statsWidth = () => Math.floor(window.innerWidth - crypListWidth() - gameListWidth());
|
||||||
|
const statsHeight = () => window.innerHeight - menuHeight();
|
||||||
|
const statsY = () => menuHeight();
|
||||||
|
const statsX = () => crypListWidth() + gameListWidth();
|
||||||
|
const statsKnownX = () => Math.floor(statsX() + statsWidth() / 4);
|
||||||
|
const statsLearnableX = () => Math.floor(statsX() + statsWidth() / 2);
|
||||||
|
const statsTextMargin = () => 24;
|
||||||
|
|
||||||
const logWidth = () => Math.floor(combatWidth() * 0.2);
|
const logWidth = () => Math.floor(combatWidth() * 0.2);
|
||||||
const logHeight = () => combatHeight();
|
const logHeight = () => combatHeight();
|
||||||
const logY = () => menuHeight();
|
const logY = () => menuHeight();
|
||||||
@ -45,6 +53,16 @@ module.exports = {
|
|||||||
rowWidth: crypListWidth,
|
rowWidth: crypListWidth,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
STATS: {
|
||||||
|
x: statsX,
|
||||||
|
y: statsY,
|
||||||
|
width: statsWidth,
|
||||||
|
height: statsHeight,
|
||||||
|
knownX: statsKnownX,
|
||||||
|
learnableX: statsLearnableX,
|
||||||
|
textMargin: statsTextMargin,
|
||||||
|
},
|
||||||
|
|
||||||
COMBAT: {
|
COMBAT: {
|
||||||
x: combatX,
|
x: combatX,
|
||||||
y: combatY,
|
y: combatY,
|
||||||
|
|||||||
@ -1,17 +1,6 @@
|
|||||||
const Phaser = require('phaser');
|
const Phaser = require('phaser');
|
||||||
|
|
||||||
const { TEXT, SKILLS } = require('./constants');
|
const { TEXT, SKILLS, POSITIONS: { STATS } } = require('./constants');
|
||||||
|
|
||||||
const ROW_WIDTH = 400;
|
|
||||||
const ROW_HEIGHT = 200;
|
|
||||||
const ROW_FILL = 0x888888;
|
|
||||||
|
|
||||||
const TOP_MARGIN = 50;
|
|
||||||
const ROW_MARGIN = 50;
|
|
||||||
const TEXT_MARGIN = 24;
|
|
||||||
|
|
||||||
const xPos = i => 0;
|
|
||||||
const yPos = i => (i * ROW_HEIGHT + ROW_MARGIN) + TOP_MARGIN;
|
|
||||||
|
|
||||||
class CrypPage extends Phaser.GameObjects.Group {
|
class CrypPage extends Phaser.GameObjects.Group {
|
||||||
constructor(scene, cryp) {
|
constructor(scene, cryp) {
|
||||||
@ -19,10 +8,22 @@ class CrypPage extends Phaser.GameObjects.Group {
|
|||||||
this.id = cryp.id;
|
this.id = cryp.id;
|
||||||
this.scene = scene;
|
this.scene = scene;
|
||||||
this.ws = scene.registry.get('ws');
|
this.ws = scene.registry.get('ws');
|
||||||
this.add(scene.add.text(500, 500, cryp.name, TEXT.HEADER));
|
|
||||||
|
const TEXT_MARGIN = STATS.textMargin();
|
||||||
|
|
||||||
|
const crypStat = (stat, i) => {
|
||||||
|
const STAT_X = STATS.x();
|
||||||
|
const STAT_Y = (i * TEXT_MARGIN) + STATS.y() + TEXT_MARGIN;
|
||||||
|
|
||||||
|
const text = scene.add.text(STAT_X, STAT_Y, `${stat.stat}: ${stat.base}`, TEXT.NORMAL);
|
||||||
|
this.add(text);
|
||||||
|
};
|
||||||
|
|
||||||
const knownSkill = (skill, i) => {
|
const knownSkill = (skill, i) => {
|
||||||
const text = scene.add.text(500, 500 + (TEXT_MARGIN * (i + 1)), skill.skill, TEXT.NORMAL)
|
const SKILL_X = STATS.knownX();
|
||||||
|
const SKILL_Y = (i * TEXT_MARGIN) + STATS.y() + TEXT_MARGIN;
|
||||||
|
|
||||||
|
const text = scene.add.text(SKILL_X, SKILL_Y, skill.skill, TEXT.NORMAL)
|
||||||
.setInteractive();
|
.setInteractive();
|
||||||
|
|
||||||
text.on('pointerdown', () => {
|
text.on('pointerdown', () => {
|
||||||
@ -32,7 +33,10 @@ class CrypPage extends Phaser.GameObjects.Group {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const learnable = (skill, i) => {
|
const learnable = (skill, i) => {
|
||||||
const text = scene.add.text(600, 0 + (TEXT_MARGIN * (i + 1)), skill, TEXT.NORMAL)
|
const SKILL_X = STATS.learnableX();
|
||||||
|
const SKILL_Y = (i * TEXT_MARGIN) + STATS.y() + TEXT_MARGIN;
|
||||||
|
|
||||||
|
const text = scene.add.text(SKILL_X, SKILL_Y, skill, TEXT.NORMAL)
|
||||||
.setInteractive();
|
.setInteractive();
|
||||||
|
|
||||||
text.on('pointerdown', () => {
|
text.on('pointerdown', () => {
|
||||||
@ -42,7 +46,14 @@ class CrypPage extends Phaser.GameObjects.Group {
|
|||||||
text.cryp = cryp;
|
text.cryp = cryp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const CRYP_STATS = [cryp.stamina, cryp.phys_dmg, cryp.spell_dmg];
|
||||||
|
this.add(scene.add.text(STATS.x(), STATS.y(), cryp.name, TEXT.HEADER));
|
||||||
|
CRYP_STATS.forEach(crypStat);
|
||||||
|
|
||||||
|
this.add(scene.add.text(STATS.knownX(), STATS.y(), 'Skills', TEXT.HEADER));
|
||||||
cryp.skills.forEach(knownSkill);
|
cryp.skills.forEach(knownSkill);
|
||||||
|
|
||||||
|
this.add(scene.add.text(STATS.learnableX(), STATS.y(), 'Learnable', TEXT.HEADER));
|
||||||
SKILLS.LEARNABLE.forEach(learnable);
|
SKILLS.LEARNABLE.forEach(learnable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,7 +44,7 @@ pub enum Stat {
|
|||||||
PhysDmg,
|
PhysDmg,
|
||||||
SpellDmg,
|
SpellDmg,
|
||||||
Hp,
|
Hp,
|
||||||
Stam,
|
Stamina,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
|
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
|
||||||
@ -97,9 +97,9 @@ impl Cryp {
|
|||||||
return Cryp {
|
return Cryp {
|
||||||
id,
|
id,
|
||||||
account: id,
|
account: id,
|
||||||
phys_dmg: CrypStat { base: 0, stat: Stat::Str },
|
phys_dmg: CrypStat { base: 0, stat: Stat::PhysDmg },
|
||||||
spell_dmg: CrypStat { base: 0, stat: Stat::Int },
|
spell_dmg: CrypStat { base: 0, stat: Stat::SpellDmg },
|
||||||
stamina: CrypStat { base: 0, stat: Stat::Stam },
|
stamina: CrypStat { base: 0, stat: Stat::Stamina },
|
||||||
hp: CrypStat { base: 0, stat: Stat::Hp },
|
hp: CrypStat { base: 0, stat: Stat::Hp },
|
||||||
lvl: 0,
|
lvl: 0,
|
||||||
xp: 0,
|
xp: 0,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user