Update Status Bar
This commit is contained in:
parent
38672bd677
commit
cf02a59dee
BIN
images/lv.png
Normal file
BIN
images/lv.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
images/up.png
Normal file
BIN
images/up.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 863 B |
14
index.html
14
index.html
@ -47,10 +47,14 @@
|
||||
<p id='floorNameLabel'></p>
|
||||
</div>
|
||||
<div id='statusBar' class="clearfix">
|
||||
<div class="status">
|
||||
<div class="status" id="floorCol">
|
||||
<img src='images/floor.png' id="img-floor">
|
||||
<p class='statusLabel' id='floor'></p>
|
||||
</div>
|
||||
<div class="status" id="lvCol">
|
||||
<img src='images/lv.png' id="img-lv">
|
||||
<p class='statusLabel' id='lv'></p>
|
||||
</div>
|
||||
<div class="status">
|
||||
<img src='images/hp.png' id="img-hp">
|
||||
<p class='statusLabel' id='hp'></p>
|
||||
@ -67,7 +71,7 @@
|
||||
<img src='images/mdef.png' id="img-mdef">
|
||||
<p class='statusLabel' id='mdef'></p>
|
||||
</div>
|
||||
<div class="status">
|
||||
<div class="status" id="moneyCol">
|
||||
<img src='images/money.png' id="img-money">
|
||||
<p class='statusLabel' id='money'></p>
|
||||
</div>
|
||||
@ -75,12 +79,16 @@
|
||||
<img src='images/experience.png' id="img-experience">
|
||||
<p class='statusLabel' id='experience'></p>
|
||||
</div>
|
||||
<div class="status" id="upCol">
|
||||
<img src='images/up.png' id="img-up">
|
||||
<p class='statusLabel' id='up'></p>
|
||||
</div>
|
||||
<div class="status">
|
||||
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>
|
||||
<span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
|
||||
<span class='statusLabel' id='redKey' style="color:#FF8888"></span>
|
||||
</div>
|
||||
<div class="status">
|
||||
<div class="status" id="debuffCol">
|
||||
<span class='statusLabel' id='poison' style="color: #AFFCA8;"></span>
|
||||
<span class='statusLabel' id='weak' style="color: #FECCD0;"></span>
|
||||
<span class='statusLabel' id='curse' style="color: #C2F4E7;"></span>
|
||||
|
||||
102
libs/core.js
102
libs/core.js
@ -114,6 +114,13 @@ core.prototype.init = function (dom, statusBar, canvas, images, sounds, floorIds
|
||||
core[key] = coreData[key];
|
||||
}
|
||||
core.flags = core.clone(core.data.flags);
|
||||
if (!core.flags.enableExperience)
|
||||
core.flags.enableLevelUp = false;
|
||||
if (!core.flags.canOpenBattleAnimate) {
|
||||
core.flags.showBattleAnimateConfirm = false;
|
||||
core.flags.battleAnimate = false;
|
||||
core.setLocalStorage('battleAnimate', false);
|
||||
}
|
||||
core.values = core.clone(core.data.values);
|
||||
core.firstData = core.data.getFirstData();
|
||||
core.initStatus.shops = core.firstData.shops;
|
||||
@ -1536,7 +1543,9 @@ core.prototype.afterBattle = function(id, x, y, callback) {
|
||||
core.canvas.event.clearRect(32 * x, 32 * y, 32, 32);
|
||||
}
|
||||
core.updateFg();
|
||||
var hint = "打败 " + core.material.enemys[id].name + ",金币+" + money;
|
||||
var hint = "打败 " + core.material.enemys[id].name;
|
||||
if (core.flags.enableMoney)
|
||||
hint += ",金币+" + money;
|
||||
if (core.flags.enableExperience)
|
||||
hint += ",经验+" + core.material.enemys[id].experience;
|
||||
core.drawTip(hint);
|
||||
@ -1583,15 +1592,19 @@ core.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback)
|
||||
core.clearContinueAutomaticRoute();
|
||||
core.dom.floorNameLabel.innerHTML = core.status.maps[floorId].title;
|
||||
if (core.isset(stair)) {
|
||||
// find heroLoc
|
||||
heroLoc = core.status.hero.loc;
|
||||
if (!core.isset(heroLoc)) heroLoc={};
|
||||
var blocks = core.status.maps[floorId].blocks;
|
||||
for (var i in blocks) {
|
||||
if (core.isset(blocks[i].event) && !(core.isset(blocks[i].enable) && !blocks[i].enable) && blocks[i].event.id === stair) {
|
||||
heroLoc.x = blocks[i].x;
|
||||
heroLoc.y = blocks[i].y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!core.isset(heroLoc.x)) {
|
||||
heroLoc.x=core.status.hero.loc.x;
|
||||
heroLoc.y=core.status.hero.loc.y;
|
||||
}
|
||||
}
|
||||
if (core.status.maps[floorId].canFlyTo && core.status.hero.flyRange.indexOf(floorId)<0) {
|
||||
if (core.floorIds.indexOf(floorId)>core.floorIds.indexOf(core.status.floorId))
|
||||
@ -1606,6 +1619,7 @@ core.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback)
|
||||
|
||||
// 根据文字判断是否斜体
|
||||
var floorName = core.status.maps[floorId].name;
|
||||
if (!core.isset(floorName) || floorName=="") floorName=" "
|
||||
core.statusBar.floor.innerHTML = floorName;
|
||||
if (/^[+-]?\d+$/.test(floorName))
|
||||
core.statusBar.floor.style.fontStyle = 'italic';
|
||||
@ -3182,6 +3196,11 @@ core.prototype.getStatus = function (statusName) {
|
||||
return core.status.hero[statusName];
|
||||
}
|
||||
|
||||
core.prototype.getLvName = function () {
|
||||
if (core.status.hero.lv>core.firstData.levelUp.length) return core.status.hero.lv;
|
||||
return core.firstData.levelUp[core.status.hero.lv-1].name || core.status.hero.lv;
|
||||
}
|
||||
|
||||
core.prototype.setFlag = function(flag, value) {
|
||||
if (!core.isset(core.status.hero)) return;
|
||||
core.status.hero.flags[flag]=value;
|
||||
@ -3302,9 +3321,9 @@ core.prototype.hide = function (obj, speed, callback) {
|
||||
////// 状态栏相关 //////
|
||||
|
||||
core.prototype.clearStatusBar = function() {
|
||||
var statusList = ['floor', 'hp', 'atk', 'def', 'mdef', 'money', 'experience', 'yellowKey', 'blueKey', 'redKey', 'poison', 'weak', 'curse', 'hard'];
|
||||
var statusList = ['floor', 'lv', 'hp', 'atk', 'def', 'mdef', 'money', 'experience', 'up', 'yellowKey', 'blueKey', 'redKey', 'poison', 'weak', 'curse', 'hard'];
|
||||
statusList.forEach(function (e) {
|
||||
core.statusBar[e].innerHTML = "";
|
||||
core.statusBar[e].innerHTML = " ";
|
||||
});
|
||||
core.statusBar.image.book.style.opacity = 0.3;
|
||||
core.statusBar.image.fly.style.opacity = 0.3;
|
||||
@ -3320,6 +3339,12 @@ core.prototype.updateStatusBar = function () {
|
||||
core.setStatus('hp', Math.min(core.values.HPMAX, core.getStatus('hp')));
|
||||
}
|
||||
|
||||
var lvName = core.getLvName();
|
||||
core.statusBar.lv.innerHTML = lvName;
|
||||
if (/^[+-]?\d+$/.test(lvName))
|
||||
core.statusBar.lv.style.fontStyle = 'italic';
|
||||
else core.statusBar.lv.style.fontStyle = 'normal';
|
||||
|
||||
var statusList = ['hp', 'atk', 'def', 'mdef', 'money', 'experience'];
|
||||
statusList.forEach(function (item) {
|
||||
core.statusBar[item].innerHTML = core.getStatus(item);
|
||||
@ -3376,18 +3401,22 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
||||
statusWidth, statusHeight, statusMaxWidth,statusLabelsLH,
|
||||
toolBarWidth, toolBarHeight, toolBarTop, toolBarBorder,
|
||||
toolsWidth, toolsHeight,toolsMargin,toolsPMaxwidth,
|
||||
fontSize, margin;
|
||||
fontSize, toolbarFontSize, margin;
|
||||
|
||||
var count = 9;
|
||||
var count = 11;
|
||||
if (!core.flags.enableFloor) count--;
|
||||
if (!core.flags.enableLv) count--;
|
||||
if (!core.flags.enableMDef) count--;
|
||||
if (!core.flags.enableMoney) count--;
|
||||
if (!core.flags.enableExperience) count--;
|
||||
if (!core.flags.enableLevelUp) count--;
|
||||
if (!core.flags.enableDebuff) count--;
|
||||
|
||||
var statusLineHeight = BASE_LINEHEIGHT * 9/count;
|
||||
var statusLineHeight = BASE_LINEHEIGHT * 9 / count;
|
||||
var statusLineFontSize = DEFAULT_FONT_SIZE;
|
||||
if (count>9) statusLineFontSize = statusLineFontSize * 9 / count;
|
||||
|
||||
var shopDisplay, mdefDisplay, expDisplay;
|
||||
mdefDisplay = core.flags.enableMDef ? 'block' : 'none';
|
||||
expDisplay = core.flags.enableExperience ? 'block' : 'none';
|
||||
var shopDisplay;
|
||||
|
||||
statusBarBorder = '3px #fff solid';
|
||||
toolBarBorder = '3px #fff solid';
|
||||
@ -3407,13 +3436,13 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
||||
|
||||
var scale = core.domStyle.scale
|
||||
var tempWidth = DEFAULT_CANVAS_WIDTH * scale;
|
||||
fontSize = DEFAULT_FONT_SIZE * scale;
|
||||
if(!isHorizontal){ //竖屏
|
||||
core.domStyle.screenMode = 'vertical';
|
||||
//显示快捷商店图标
|
||||
shopDisplay = 'block';
|
||||
//判断应该显示几行
|
||||
var col = core.flags.enableMDef || core.flags.enableExperience || core.flags.enableDebuff ? 3 : 2;
|
||||
// var col = core.flags.enableMDef || core.flags.enableExperience || core.flags.enableDebuff ? 3 : 2;
|
||||
var col = parseInt((count-1)/3)+1;
|
||||
|
||||
var tempTopBarH = scale * (BASE_LINEHEIGHT * col + SPACE * 2) + 6;
|
||||
var tempBotBarH = scale * (BASE_LINEHEIGHT + SPACE * 4) + 6;
|
||||
@ -3440,6 +3469,8 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
||||
|
||||
margin = scale * SPACE * 2;
|
||||
toolsMargin = scale * SPACE * 4;
|
||||
fontSize = DEFAULT_FONT_SIZE * scale;
|
||||
toolbarFontSize = DEFAULT_FONT_SIZE * scale;
|
||||
}else { //横屏
|
||||
core.domStyle.screenMode = 'horizontal';
|
||||
shopDisplay = 'none';
|
||||
@ -3457,6 +3488,8 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
||||
toolBarTop = scale*statusLineHeight * count + SPACE * 2;
|
||||
toolBarBorder = '3px #fff solid';
|
||||
toolsHeight = scale * BASE_LINEHEIGHT;
|
||||
fontSize = statusLineFontSize * scale;
|
||||
toolbarFontSize = DEFAULT_FONT_SIZE * scale;
|
||||
borderRight = '';
|
||||
statusMaxWidth = scale * DEFAULT_BAR_WIDTH;
|
||||
toolsPMaxwidth = scale * DEFAULT_BAR_WIDTH;
|
||||
@ -3486,7 +3519,8 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
||||
|
||||
toolsHeight = BASE_LINEHEIGHT;
|
||||
borderRight = '';
|
||||
fontSize = DEFAULT_FONT_SIZE;
|
||||
fontSize = statusLineFontSize;
|
||||
toolbarFontSize = DEFAULT_FONT_SIZE;
|
||||
statusMaxWidth = DEFAULT_BAR_WIDTH;
|
||||
toolsPMaxwidth = DEFAULT_BAR_WIDTH * .9;
|
||||
margin = SPACE * 2;
|
||||
@ -3511,8 +3545,6 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
||||
height: canvasWidth + unit,
|
||||
top: canvasTop + unit,
|
||||
right: 0,
|
||||
// left: canvasLeft + unit,
|
||||
|
||||
border: '3px #fff solid',
|
||||
}
|
||||
},
|
||||
@ -3576,7 +3608,7 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
||||
borderBottom: toolBarBorder,
|
||||
borderLeft: toolBarBorder,
|
||||
borderRight: borderRight,
|
||||
fontSize: fontSize + unit
|
||||
fontSize: toolbarFontSize + unit
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -3595,15 +3627,45 @@ core.prototype.resize = function(clientWidth, clientHeight) {
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'expCol',
|
||||
id: 'floorCol',
|
||||
rules: {
|
||||
display: expDisplay
|
||||
display: core.flags.enableFloor ? 'block': 'none'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'lvCol',
|
||||
rules: {
|
||||
display: core.flags.enableLv ? 'block': 'none'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'mdefCol',
|
||||
rules: {
|
||||
display: mdefDisplay
|
||||
display: core.flags.enableMDef ? 'block': 'none'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'moneyCol',
|
||||
rules: {
|
||||
display: core.flags.enableMoney ? 'block': 'none'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'expCol',
|
||||
rules: {
|
||||
display: core.flags.enableExperience ? 'block': 'none'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'upCol',
|
||||
rules: {
|
||||
display: core.flags.enableLevelUp ? 'block': 'none'
|
||||
}
|
||||
},
|
||||
{
|
||||
'id': 'debuffCol',
|
||||
rules: {
|
||||
display: core.flags.enableDebuff ? 'block': 'none'
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
27
libs/data.js
27
libs/data.js
@ -10,12 +10,13 @@ data.prototype.init = function() {
|
||||
"floorId": "sample0", // 初始楼层ID
|
||||
"hero": { // 勇士初始数据
|
||||
"name": "阳光", // 勇士名;可以改成喜欢的
|
||||
'lv': 1, // 初始等级,该项必须为正整数
|
||||
"hp": 1000, // 初始生命值
|
||||
"atk": 100, // 初始攻击
|
||||
"def": 100, // 初始防御
|
||||
"mdef": 100, // 初始魔防
|
||||
"money": 100, // 初始金币
|
||||
"experience": 1000, // 初始经验
|
||||
"experience": 0, // 初始经验
|
||||
"items": { // 初始道具个数
|
||||
"keys": {
|
||||
"yellowKey": 0,
|
||||
@ -57,10 +58,11 @@ data.prototype.init = function() {
|
||||
{"text": "防御+4", "effect": "status:def+=4"},
|
||||
{"text": "魔防+10", "effect": "status:mdef+=10"}
|
||||
// effect只能对status和item进行操作,不能修改flag值。
|
||||
// 中间只能用+=符号(也就是只能增加某个属性或道具)
|
||||
// 必须是X+=Y的形式,其中Y可以是一个表达式,以status:xxx或item:xxx为参数
|
||||
// 其他effect样例:
|
||||
// "item:yellowKey+=1" 黄钥匙+1
|
||||
// "item:pickaxe+=3" 破墙镐+3
|
||||
// "status:hp+=2*(status:atk+status:def)" 将生命提升攻防和的数值的两倍
|
||||
]
|
||||
},
|
||||
"expShop1": { // 商店唯一ID
|
||||
@ -80,6 +82,17 @@ data.prototype.init = function() {
|
||||
]
|
||||
},
|
||||
},
|
||||
"levelUp": [ // 经验升级所需要的数值,是一个数组
|
||||
{}, // 第一项为初始等级,可以简单留空,也可以写name
|
||||
{"need": 20, "name": "第二级", "effect": "status:hp+=2*(status:atk+status:def);status:atk+=10;status:def+=10"}, // 先将生命提升攻防和的2倍;再将攻击+10,防御+10
|
||||
// 每一个里面可以含有三个参数 name, need, effect
|
||||
// need为所需要的经验数值,是一个正整数。请确保need所需的依次递增
|
||||
// name为该等级的名称,也可以省略代表使用系统默认值;本项将显示在状态栏中
|
||||
// effect为本次升级所执行的操作,可由若干项组成,由分号分开;
|
||||
// 其中每一项写法和上面的商店完全相同,同样必须是X+=Y的形式,Y是一个表达式,同样可以使用status:xxx或item:xxx代表勇士的某项数值/道具个数
|
||||
{"need": 40, "effect": "status:hp+=2*(status:atk+status:def);status:atk+=10;status:def+=10"},
|
||||
// 依次往下写需要的数值即可
|
||||
]
|
||||
}
|
||||
// 各种数值;一些数值可以在这里设置
|
||||
this.values = {
|
||||
@ -118,9 +131,15 @@ data.prototype.init = function() {
|
||||
// 系统FLAG,在游戏运行中中请不要修改它。
|
||||
this.flags = {
|
||||
/****** 角色状态相关 ******/
|
||||
"enableMDef": true, // 是否涉及勇士的魔防值;如果此项为false,则状态栏不会显示勇士的魔防值
|
||||
"enableExperience": true, // 是否涉及经验值;如果此项为false,则状态栏和怪物手册均将不会显示经验值
|
||||
"enableNegativeDamage": true, // 是否支持负伤害(回血)
|
||||
"enableFloor": true, // 是否在状态栏显示当前楼层
|
||||
"enableLv": false, // 是否在状态栏显示当前等级
|
||||
"enableMDef": true, // 是否在状态栏及战斗界面显示魔防(护盾)
|
||||
"enableMoney": true, // 是否在状态栏、怪物手册及战斗界面显示金币
|
||||
"enableExperience": true, // 是否在状态栏、怪物手册及战斗界面显示经验
|
||||
"enableLevelUp": false, // 是否允许等级提升(进阶);如果上面enableExperience为false,则此项恒视为false
|
||||
"enableDebuff": true, // 是否涉及毒衰咒;如果此项为false则不会在状态栏中显示毒衰咒的debuff
|
||||
////// 上述的几个开关将直接影响状态栏的显示效果 //////
|
||||
/****** 道具相关 ******/
|
||||
"flyNearStair": true, // 是否需要在楼梯边使用传送器
|
||||
"pickaxeFourDirections": true, // 使用破墙镐是否四个方向都破坏;如果false则只破坏面前的墙壁
|
||||
|
||||
@ -131,7 +131,7 @@ enemys.prototype.getCritical = function (monsterId) {
|
||||
if (this.hasSpecial(monster.special, 3) || this.hasSpecial(monster.special, 10)) return "???";
|
||||
var last = this.calDamage(core.status.hero.atk, core.status.hero.def, core.status.hero.mdef,
|
||||
monster.hp, monster.atk, monster.def, monster.special);
|
||||
if (last == 0) return 0;
|
||||
if (last <= 0) return 0;
|
||||
|
||||
for (var i = core.status.hero.atk + 1; i <= monster.hp + monster.def; i++) {
|
||||
var damage = this.calDamage(i, core.status.hero.def, core.status.hero.mdef,
|
||||
@ -147,9 +147,8 @@ enemys.prototype.getCritical = function (monsterId) {
|
||||
enemys.prototype.getCriticalDamage = function (monsterId) {
|
||||
var c = this.getCritical(monsterId);
|
||||
if (c == '???') return '???';
|
||||
if (c == 0) return 0;
|
||||
if (c <= 0) return 0;
|
||||
var monster = core.material.enemys[monsterId];
|
||||
// if (c<=0) return 0;
|
||||
var last = this.calDamage(core.status.hero.atk, core.status.hero.def, core.status.hero.mdef,
|
||||
monster.hp, monster.atk, monster.def, monster.special);
|
||||
if (last == 999999999) return '???';
|
||||
@ -202,11 +201,7 @@ enemys.prototype.calDamage = function (hero_atk, hero_def, hero_mdef, mon_hp, mo
|
||||
var ans = damage + turn * per_damage + (turn + 1) * counterDamage;
|
||||
ans -= hero_mdef;
|
||||
|
||||
// 魔防回血
|
||||
// return ans;
|
||||
|
||||
// 魔防不回血
|
||||
return ans <= 0 ? 0 : ans;
|
||||
return core.flags.enableNegativeDamage?ans:Math.max(0, ans);
|
||||
}
|
||||
|
||||
// 获得当前楼层的怪物列表
|
||||
|
||||
@ -20,12 +20,11 @@ events.prototype.init = function () {
|
||||
callback();
|
||||
},
|
||||
'changeFloor': function (data, core, callback) {
|
||||
var heroLoc = null;
|
||||
if (core.isset(data.event.data.loc)) {
|
||||
var heroLoc = {};
|
||||
if (core.isset(data.event.data.loc))
|
||||
heroLoc = {'x': data.event.data.loc[0], 'y': data.event.data.loc[1]};
|
||||
if (core.isset(data.event.data.direction))
|
||||
heroLoc.direction = data.event.data.direction;
|
||||
}
|
||||
if (core.isset(data.event.data.direction))
|
||||
heroLoc.direction = data.event.data.direction;
|
||||
core.changeFloor(data.event.data.floorId, data.event.data.stair,
|
||||
heroLoc, data.event.data.time, callback);
|
||||
},
|
||||
@ -66,14 +65,6 @@ events.prototype.startGame = function (hard) {
|
||||
|
||||
core.hideStartAnimate(function() {
|
||||
core.drawText(core.clone(core.firstData.startText), function() {
|
||||
|
||||
// 强制关闭战斗过程?
|
||||
if (!core.flags.canOpenBattleAnimate) {
|
||||
core.flags.showBattleAnimateConfirm=false;
|
||||
core.flags.battleAnimate=false;
|
||||
core.setLocalStorage('battleAnimate', false);
|
||||
}
|
||||
|
||||
if (core.flags.showBattleAnimateConfirm) { // 是否提供“开启战斗动画”的选择项
|
||||
core.status.event.selection = core.flags.battleAnimate ? 0 : 1;
|
||||
core.ui.drawConfirmBox("你想开启战斗动画吗?\n之后可以在菜单栏中开启或关闭。\n(强烈建议新手开启此项)", function () {
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
main.floors.sample1 = {
|
||||
"floorId": "sample1", // 楼层唯一标识符,需要和名字完全一致
|
||||
"title": "样板 1 层", // 楼层中文名
|
||||
"name": "样板1层", // 显示在状态栏中的层数
|
||||
"name": "1", // 显示在状态栏中的层数
|
||||
"canFlyTo": true, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
||||
"defaultGround": "grass", // 默认地面的图块ID(terrains中)
|
||||
@ -273,7 +273,7 @@ main.floors.sample1 = {
|
||||
},
|
||||
"changeFloor": { // 楼层转换事件;该事件不能和上面的events有冲突(同位置点),否则会被覆盖
|
||||
"4,12": {"floorId": "sample0", "loc": [6,0]}, // 由于楼下有多个上楼梯,所以需指定位置而不是简单地写"stair": "upFloor"
|
||||
"5,5": {"floorId": "sample2", "stair": "downFloor"}
|
||||
"5,5": {"floorId": "sample2", "stair": "downFloor", "direction": "up"}
|
||||
},
|
||||
"afterBattle": { // 战斗后可能触发的事件列表
|
||||
"9,6": [ // 初级卫兵1
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
main.floors.sample2 = {
|
||||
"floorId": "sample2", // 楼层唯一标识符,需要和名字完全一致
|
||||
"title": "主塔 40 层", // 楼层中文名
|
||||
"name": "-40", // 显示在状态栏中的层数
|
||||
"name": "40", // 显示在状态栏中的层数
|
||||
"canFlyTo": false, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)
|
||||
"canUseQuickShop": true, // 该层是否允许使用快捷商店
|
||||
"defaultGround": "snowGround", // 默认地面的图块ID(terrains中)
|
||||
|
||||
54
libs/ui.js
54
libs/ui.js
@ -430,7 +430,10 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
||||
var left=10, right=416-2*left;
|
||||
|
||||
|
||||
var lines = core.flags.enableExperience?5:4;
|
||||
// var lines = core.flags.enableExperience?5:4;
|
||||
var lines = 3;
|
||||
if (core.flags.enableMDef || core.flags.enableMoney || core.flags.enableExperience) lines=4;
|
||||
if (core.flags.enableMoney && core.flags.enableExperience) lines=5;
|
||||
|
||||
var lineHeight = 60;
|
||||
var height = lineHeight * lines + 50;
|
||||
@ -515,7 +518,7 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
||||
if (core.flags.enableMDef) {
|
||||
textTop += lineHeight;
|
||||
core.canvas.ui.textAlign='left';
|
||||
core.fillText('ui', "魔防", left_start, textTop, '#DDDDDD', '16px Verdana');
|
||||
core.fillText('ui', "护盾", left_start, textTop, '#DDDDDD', '16px Verdana');
|
||||
core.drawLine('ui', left_start, textTop + 8, left_end, textTop + 8, '#FFFFFF', 2);
|
||||
core.canvas.data.textAlign='right';
|
||||
core.fillText('data', hero_mdef, left_end, textTop+26, '#DDDDDD', 'bold 16px Verdana');
|
||||
@ -543,12 +546,14 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
||||
core.canvas.ui.textAlign='left';
|
||||
core.fillText('ui', mon_def, right_start, textTop+26, '#DDDDDD', 'bold 16px Verdana');
|
||||
|
||||
textTop += lineHeight;
|
||||
core.canvas.ui.textAlign='right';
|
||||
core.fillText('ui', "金币", right_end, textTop, '#DDDDDD', '16px Verdana');
|
||||
core.drawLine('ui', right_start, textTop + 8, right_end, textTop + 8, '#FFFFFF', 2);
|
||||
core.canvas.ui.textAlign='left';
|
||||
core.fillText('ui', mon_money, right_start, textTop+26, '#DDDDDD', 'bold 16px Verdana');
|
||||
if (core.flags.enableMoney) {
|
||||
textTop += lineHeight;
|
||||
core.canvas.ui.textAlign = 'right';
|
||||
core.fillText('ui', "金币", right_end, textTop, '#DDDDDD', '16px Verdana');
|
||||
core.drawLine('ui', right_start, textTop + 8, right_end, textTop + 8, '#FFFFFF', 2);
|
||||
core.canvas.ui.textAlign = 'left';
|
||||
core.fillText('ui', mon_money, right_start, textTop + 26, '#DDDDDD', 'bold 16px Verdana');
|
||||
}
|
||||
|
||||
if (core.flags.enableExperience) {
|
||||
textTop += lineHeight;
|
||||
@ -564,12 +569,6 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
||||
|
||||
core.canvas.ui.textAlign='right';
|
||||
core.fillText("ui", "S", right_start-8, 208+15, "#FFFFFF", "italic bold 40px Verdana");
|
||||
/*
|
||||
core.drawLine('data', left + right - margin - boxWidth + 6, top+margin+boxWidth-6,
|
||||
left+right-margin-6, top+margin+6, '#FF0000', 4);
|
||||
core.drawLine('data', left + margin + 6, top+margin+heroHeight+(boxWidth-32)-6,
|
||||
left+margin+boxWidth-6, top+margin+6, '#FF0000', 4);
|
||||
*/
|
||||
|
||||
var battleInterval = setInterval(function() {
|
||||
core.playSound("attack", "ogg");
|
||||
@ -797,25 +796,34 @@ ui.prototype.drawEnemyBook = function (page) {
|
||||
core.fillText('ui', enemy.atk, 285, 62 * i + 32, '#DDDDDD', 'bold 13px Verdana');
|
||||
core.fillText('ui', '防御', 335, 62 * i + 32, '#DDDDDD', '13px Verdana');
|
||||
core.fillText('ui', enemy.def, 365, 62 * i + 32, '#DDDDDD', 'bold 13px Verdana');
|
||||
core.fillText('ui', '金币', 165, 62 * i + 50, '#DDDDDD', '13px Verdana');
|
||||
core.fillText('ui', enemy.money, 195, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana');
|
||||
|
||||
var damage_offset = 326;
|
||||
var expOffset = 165;
|
||||
if (core.flags.enableMoney) {
|
||||
core.fillText('ui', '金币', 165, 62 * i + 50, '#DDDDDD', '13px Verdana');
|
||||
core.fillText('ui', enemy.money, 195, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana');
|
||||
expOffset = 255;
|
||||
}
|
||||
|
||||
if (core.flags.enableExperience) {
|
||||
core.canvas.ui.textAlign = "left";
|
||||
core.fillText('ui', '经验', 255, 62 * i + 50, '#DDDDDD', '13px Verdana');
|
||||
core.fillText('ui', enemy.experience, 285, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana');
|
||||
damage_offset = 361;
|
||||
core.fillText('ui', '经验', expOffset, 62 * i + 50, '#DDDDDD', '13px Verdana');
|
||||
core.fillText('ui', enemy.experience, expOffset + 30, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana');
|
||||
}
|
||||
|
||||
var damageOffet = 281;
|
||||
if (core.flags.enableMoney && core.flags.enableExperience)
|
||||
damageOffet = 361;
|
||||
else if (core.flags.enableMoney || core.flags.enableExperience)
|
||||
damageOffet = 326;
|
||||
|
||||
|
||||
core.canvas.ui.textAlign = "center";
|
||||
var damage = enemy.damage;
|
||||
var color = '#FFFF00';
|
||||
if (damage >= core.status.hero.hp) color = '#FF0000';
|
||||
if (damage == 0) color = '#00FF00';
|
||||
if (damage <= 0) color = '#00FF00';
|
||||
if (damage >= 999999999) damage = '无法战斗';
|
||||
var length = core.canvas.ui.measureText(damage).width;
|
||||
core.fillText('ui', damage, damage_offset, 62 * i + 50, color, 'bold 13px Verdana');
|
||||
core.fillText('ui', damage, damageOffet, 62 * i + 50, color, 'bold 13px Verdana');
|
||||
|
||||
core.canvas.ui.textAlign = "left";
|
||||
|
||||
|
||||
9
main.js
9
main.js
@ -31,8 +31,13 @@ function main() {
|
||||
'hardLevel': document.getElementById('hardLevel'),
|
||||
'data': document.getElementById('data'),
|
||||
'statusLabels': document.getElementsByClassName('statusLabel'),
|
||||
'floorCol': document.getElementById('floorCol'),
|
||||
'lvCol': document.getElementById('lvCol'),
|
||||
'mdefCol': document.getElementById('mdefCol'),
|
||||
'moneyCol': document.getElementById('moneyCol'),
|
||||
'expCol': document.getElementById('expCol'),
|
||||
'upCol': document.getElementById('upCol'),
|
||||
'debuffCol': document.getElementById('debuffCol'),
|
||||
'hard': document.getElementById('hard'),
|
||||
};
|
||||
this.loadList = [
|
||||
@ -49,12 +54,14 @@ function main() {
|
||||
this.statusBar = {
|
||||
'image': {
|
||||
'floor': document.getElementById('img-floor'),
|
||||
'lv': document.getElementById('img-lv'),
|
||||
'hp': document.getElementById("img-hp"),
|
||||
'atk': document.getElementById("img-atk"),
|
||||
'def': document.getElementById("img-def"),
|
||||
'mdef': document.getElementById("img-mdef"),
|
||||
'money': document.getElementById("img-money"),
|
||||
'experience': document.getElementById("img-experience"),
|
||||
'up': document.getElementById("img-up"),
|
||||
'book': document.getElementById("img-book"),
|
||||
'fly': document.getElementById("img-fly"),
|
||||
'toolbox': document.getElementById("img-toolbox"),
|
||||
@ -64,12 +71,14 @@ function main() {
|
||||
'settings': document.getElementById("img-settings")
|
||||
},
|
||||
'floor': document.getElementById('floor'),
|
||||
'lv': document.getElementById('lv'),
|
||||
'hp': document.getElementById('hp'),
|
||||
'atk': document.getElementById('atk'),
|
||||
'def': document.getElementById("def"),
|
||||
'mdef': document.getElementById('mdef'),
|
||||
'money': document.getElementById("money"),
|
||||
'experience': document.getElementById("experience"),
|
||||
'up': document.getElementById('up'),
|
||||
'yellowKey': document.getElementById("yellowKey"),
|
||||
'blueKey': document.getElementById("blueKey"),
|
||||
'redKey': document.getElementById("redKey"),
|
||||
|
||||
@ -180,8 +180,9 @@
|
||||
}
|
||||
.status img{
|
||||
vertical-align: middle;
|
||||
width: 1.6em;
|
||||
height: 1.6em;
|
||||
width: auto;
|
||||
height: 100%;
|
||||
max-height: 1.6em;
|
||||
}
|
||||
#statusBar span{
|
||||
color: white;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user