Merge pull request #267 from ckcz123/v2.0

V2.0
This commit is contained in:
Zhang Chen 2018-12-01 15:01:22 +08:00 committed by GitHub
commit 060565c433
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 474 additions and 187 deletions

View File

@ -63,6 +63,8 @@ HTML5 canvas制作的魔塔样板支持全平台游戏
* [x] 升级事件改用事件编辑器完成
* [x] 每层楼都增添该层的并行事件处理
* [x] 新增快捷键N返回标题P查看评论O打开工程
* [x] 新增事件:设置全局属性或全局数值
* [x] 新增事件:隐藏/显示状态栏
* [x] 道具可以设置是否在回放时绘制道具栏或直接使用
* [x] 可以同时异步移动/跳跃勇士和多个NPC
* [x] 可以同时异步移动两张或以上的图片了

View File

@ -214,6 +214,8 @@ action
| tip_s
| setValue_s
| setFloor_s
| setGlobalAttribute_s
| setGlobalValue_s
| show_s
| hide_s
| trigger_s
@ -228,6 +230,8 @@ action
| setBgFgBlock_s
| setHeroIcon_s
| update_s
| showStatusBar_s
| hideStatusBar_s
| updateEnemys_s
| sleep_s
| wait_s
@ -437,6 +441,34 @@ return code;
*/;
setGlobalAttribute_s
: '设置全局属性' ':' Global_Attribute_List '值' EvalString Newline
/* setGlobalAttribute_s
tooltip : setGlobalAttribute设置全局属性
helpUrl : https://h5mota.com/games/template/docs/#/event?id=setGlobalAttribute%ef%bc%9a%e8%ae%be%e7%bd%ae%e4%b8%80%e4%b8%aa%e5%85%a8%e5%b1%80%e5%b1%9e%e6%80%a7
default : ["font","Verdana"]
colour : this.dataColor
var code = '{"type": "setGlobalAttribute", "name": "'+Global_Attribute_List_0+'", "value": "'+EvalString_0+'"},\n';
return code;
*/;
setGlobalValue_s
: '设置全局数值' ':' Global_Value_List '值' EvalString Newline
/* setGlobalValue_s
tooltip : setGlobalValue设置全局属性
helpUrl : https://h5mota.com/games/template/docs/#/event?id=setGlobalValue%ef%bc%9a%e8%ae%be%e7%bd%ae%e4%b8%80%e4%b8%aa%e5%85%a8%e5%b1%80%e6%95%b0%e5%80%bc
default : ["lavaDamage","100"]
colour : this.dataColor
var code = '{"type": "setGlobalValue", "name": "'+Global_Value_List_0+'", "value": '+EvalString_0+'},\n';
return code;
*/;
show_s
: '显示事件' 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? '动画时间' Int? Newline
@ -738,6 +770,30 @@ var code = '{"type": "update"},\n';
return code;
*/;
showStatusBar_s
: '显示状态栏' Newline
/* showStatusBar_s
tooltip : showStatusBar: 显示状态栏
helpUrl : https://h5mota.com/games/template/docs/#/event?id=showStatusBar%ef%bc%9a%e6%98%be%e7%a4%ba%e7%8a%b6%e6%80%81%e6%a0%8f
colour : this.soundColor
var code = '{"type": "showStatusBar"},\n';
return code;
*/;
hideStatusBar_s
: '隐藏状态栏' Newline
/* hideStatusBar_s
tooltip : hideStatusBar: 隐藏状态栏
helpUrl : https://h5mota.com/games/template/docs/#/event?id=hideStatusBar%ef%bc%9a%e9%9a%90%e8%97%8f%e7%8a%b6%e6%80%81%e6%a0%8f
colour : this.soundColor
var code = '{"type": "hideStatusBar"},\n';
return code;
*/;
updateEnemys_s
: '更新怪物数据' Newline
@ -1583,6 +1639,14 @@ Floor_Meta_List
: '楼层中文名'|'状态栏名称'|'能否使用楼传'|'能否打开快捷商店'|'是否不可浏览地图'|'默认地面ID'|'楼层贴图'|'宝石血瓶效果'|'上楼点坐标'|'下楼点坐标'|'背景音乐'|'画面色调'|'天气和强度'|'是否地下层'
/*Floor_Meta_List ['title','name','canFlyTo', 'canUseQuickShop', 'cannotViewMap', 'defaultGround', 'images', 'item_ratio', 'upFloor', 'downFloor', 'bgm', 'color', 'weather', 'underGround']*/;
Global_Attribute_List
: '全局字体'|'横屏左侧状态栏背景'|'竖屏上方状态栏背景'|'竖屏下方道具栏背景'|'边框颜色'|'状态栏文字色'|'难度显示文字色'|'楼层转换背景'|'楼层转换文字色'
/*Global_Attribute_List ['font','statusLeftBackground','statusTopBackground', 'toolsBackground', 'borderColor', 'statusBarColor', 'hardLabelColor', 'floorChangingBackground', 'floorChangingTextColor']*/;
Global_Value_List
: '血网伤害'|'中毒伤害'|'衰弱效果'|'红宝石效果'|'蓝宝石效果'|'绿宝石效果'|'红血瓶效果'|'蓝血瓶效果'|'黄血瓶效果'|'绿血瓶效果'|'破甲比例'|'反击比例'|'净化比例'|'仇恨增加值'|'最大合法HP'|'动画时间'
/*Global_Value_List ['lavaDamage','poisonDamage','weakValue', 'redJewel', 'blueJewel', 'greenJewel', 'redPotion', 'bluePotion', 'yellowPotion', 'greenPotion', 'breakArmor', 'counterAttack', 'purify', 'hatred', 'maxValidHp', 'animateSpeed']*/;
Bool: 'TRUE'
| 'FALSE'
;
@ -2064,6 +2128,14 @@ ActionParser.prototype.parseAction = function() {
this.next = MotaActionBlocks['setFloor_s'].xmlText([
data.name, data.floorId||null, data.value, this.next]);
break;
case "setGlobalAttribute":
this.next = MotaActionBlocks['setGlobalAttribute_s'].xmlText([
data.name, data.value, this.next]);
break;
case "setGlobalValue":
this.next = MotaActionBlocks['setGlobalValue_s'].xmlText([
data.name, data.value, this.next]);
break;
case "input":
this.next = MotaActionBlocks['input_s'].xmlText([
data.text,this.next]);
@ -2129,6 +2201,14 @@ ActionParser.prototype.parseAction = function() {
this.next = MotaActionBlocks['update_s'].xmlText([
this.next]);
break;
case "showStatusBar":
this.next = MotaActionBlocks['showStatusBar_s'].xmlText([
this.next]);
break;
case "hideStatusBar":
this.next = MotaActionBlocks['hideStatusBar_s'].xmlText([
this.next]);
break;
case "updateEnemys":
this.next = MotaActionBlocks['updateEnemys_s'].xmlText([
this.next]);

View File

@ -41,11 +41,13 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"startBackground": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_data": "标题界面的背景建议使用jpg格式以压缩背景图空间"
},
"startLogoStyle": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_data": "标题样式:可以改变颜色,也可以写\"display: none\"来隐藏标题"
},
"levelChoose": {
@ -63,42 +65,56 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"statusLeftBackground": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_data": "横屏时左侧状态栏的背景样式,可以定义背景图、平铺方式等。\n具体请网上搜索\"css background\"了解写法。\n如果弄一张图片作为背景图推荐写法\n\"url(project/images/XXX.png) 0 0/100% 100% no-repeat\"\n图片最好进行一些压缩等操作节省流量。"
},
"statusTopBackground": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_data": "竖屏时上方状态栏的背景样式,可以定义背景图、平铺方式等。\n具体请网上搜索\"css background\"了解写法。\n如果弄一张图片作为背景图推荐写法\n\"url(project/images/XXX.png) 0 0/100% 100% no-repeat\"\n图片最好进行一些压缩等操作节省流量。"
},
"toolsBackground": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_data": "竖屏时下方道具栏的背景样式,可以定义背景图、平铺方式等。\n具体请网上搜索\"css background\"了解写法。\n如果弄一张图片作为背景图推荐写法\n\"url(project/images/XXX.png) 0 0/100% 100% no-repeat\"\n图片最好进行一些压缩等操作节省流量。"
},
"borderColor": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_data": "边框颜色,包括游戏边界的边框和对话框边框等。"
},
"statusBarColor": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_data": "状态栏的文字颜色,默认是白色"
},
"hardLabelColor": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_data": "难度显示的颜色,默认是红色"
},
"floorChangingBackground": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_data": "楼层转换界面的背景样式可以使用纯色默认值black也可以使用图片参见状态栏的图片写法"
},
"floorChangingTextColor": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_data": "楼层转换界面的文字颜色,默认是白色"
},
"font": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_data": "游戏中使用的字体默认是Verdana"
}
}
},
@ -337,11 +353,6 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"_type": "textarea",
"_data": "绿血瓶加血数值"
},
"moneyPocket": {
"_leaf": true,
"_type": "textarea",
"_data": "金钱袋加金币的数值"
},
"breakArmor": {
"_leaf": true,
"_type": "textarea",

View File

@ -84,6 +84,8 @@ editor_blockly = function () {
MotaActionBlocks['idString_1_e'].xmlText(['status','hp'])
]),
MotaActionBlocks['setFloor_s'].xmlText(),
MotaActionBlocks['setGlobalAttribute_s'].xmlText(),
MotaActionBlocks['setGlobalValue_s'].xmlText(),
MotaActionBlocks['input_s'].xmlText(),
MotaActionBlocks['input2_s'].xmlText(),
MotaActionBlocks['update_s'].xmlText(),
@ -131,6 +133,8 @@ editor_blockly = function () {
MotaActionBlocks['wait_s'].xmlText(),
MotaActionBlocks['viberate_s'].xmlText(),
MotaActionBlocks['animate_s'].xmlText(),
MotaActionBlocks['showStatusBar_s'].xmlText(),
MotaActionBlocks['hideStatusBar_s'].xmlText(),
MotaActionBlocks['setFg_0_s'].xmlText(),
MotaActionBlocks['setFg_1_s'].xmlText(),
MotaActionBlocks['setWeather_s'].xmlText(),

View File

@ -115,6 +115,10 @@ core.hasFlag('xyz')
返回是否存在某个变量且不为0。等价于 core.getFlag('xyz', 0)!=0 。
core.removeFlag('xyz')
删除某个flag/变量。
core.insertAction(list, x, y, callback)
插入并执行一段自定义事件。在这里你可以写任意的自定义事件列表,有关详细写法请参见文档-事件。
x和y如果设置则覆盖"当前事件点"的坐标callback如果设置则覆盖事件执行完毕后的回调函数。

View File

@ -414,6 +414,37 @@ value为必填项代表要修改到的数值。其应该和楼层属性中的
!> 如果修改到的是字符串类型比如楼层中文名、状态栏名称、地面素材ID、背景音乐等必须加引号否则会报错。
### setGlobalAttribute设置一个全局属性
使用`{"type":"setGlobalAttribute"}`可以设置一个全局属性。
``` js
"x,y": [ // 实际执行的事件列表
{"type": "setGlobalAttribute", "name": "font", "value": "Verdana"}, // 设置字体为Verdana
]
```
name必填项代表要修改的全局属性。目前只能为`"font", "statusLeftBackground", "statusTopBackground", "toolsBackground",
"borderColor", "statusBarColor", "hardLabelColor", "floorChangingBackground", "floorChangingTextColor"`。
value为必填项代表要修改到的结果。此项无需再手动加单引号。
### setGlobalValue设置一个全局数值
使用`{"type":"setGlobalValue"}`可以设置一个全局数值。
``` js
"x,y": [ // 实际执行的事件列表
{"type": "setGlobalValue", "name": "lavaDamage", "value": 200}, // 设置血网伤害为200
]
```
name必填项代表要修改的全局数值其和全塔属性中的values一一对应。目前只能为`"lavaDamage", "poisonDamage", "weakValue", "redJewel",
"blueJewel", "greenJewel", "redPotion", "bluePotion", "yellowPotion", "greenPotion", "breakArmor", "counterAttack",
"purify", "hatred", "maxValidHp", "animateSpeed"`。
value为必填项代表要修改到的结果。该项必须是个数值。
### show将一个禁用事件启用
我们上面提到了所有事件都必须靠其他事件驱动来完成不存在当某个flag为true时自动执行的说法。那么我们自然要有启用事件的写法。
@ -676,6 +707,16 @@ name是可选的代表目标行走图的文件名。
如果你需要刷新状态栏和地图显伤,只需要简单地调用 `{"type": "update"}` 即可。
### hideStatusBar隐藏状态栏
使用`{"type": "hideStatusBar"}`可以隐藏状态栏。读档或重新开始游戏时,状态栏会重新显示。
隐藏状态栏的状态下,将无法点击工具栏里面的按钮(如存读档怪物手册等)。建议仅在事件中使用,事件结束前显示。
### showStatusBar显示状态栏
使用`{"type": "showStatusBar"}`会重新显示状态栏。
### updateEnemys更新怪物数据
使用 `{"type": "updateEnemys"}` 可以动态修改怪物数据。
@ -1653,7 +1694,7 @@ core.insertAction([
// 如果某个flag为真
if (core.hasFlag("xxx")) {
// 千万别忘了将该flag清空否则下次仍然会执行这段代码。
core.setFlag("xxx", false);
core.removeFlag("xxx");
// 使用insertAction来插入若干自定义事件执行
core.insertAction([
{"type":"openDoor", "loc":[0,0], "floorId": "MT0"}
@ -1680,7 +1721,7 @@ core.insertAction([
// 每层楼的并行事件处理代码样例
if (core.getFlag("door",0)==2) {
// 将该flag清空
core.setFlag("door", 0);
core.removeFlag("door");
// 开门如果是当前层则无需写floorId
core.insertAction([
{"type":"openDoor", "loc":[0,0]}

View File

@ -335,6 +335,7 @@ function (enemy, hero_hp, hero_atk, hero_def, hero_mdef, x, y, floorId) {
var vampireDamage = hero_hp * enemy.value;
// 如果有神圣盾免疫吸血等可以在这里写
// 也可以用hasItem或hasEquip来判断装备
if (core.hasFlag("shield5")) vampireDamage = 0; // 存在神圣盾吸血伤害为0
vampireDamage = Math.floor(vampireDamage) || 0;
@ -348,11 +349,13 @@ function (enemy, hero_hp, hero_atk, hero_def, hero_mdef, x, y, floorId) {
```
3. 免疫领域、夹击、阻击效果在2.4.1之后可以直接将flag:no_zone设为true来免疫领域效果其他几个同理。
``` js
// 同样写在道具的itemEffect中
core.setFlag("no_zone", true); // 免疫领域
core.setFlag("no_snipe", true); // 免疫阻击
core.setFlag("no_laser", true); // 免疫激光
core.setFlag("no_betweenAttack", true); // 免疫夹击
// 写在获得道具后事件
[
{"type": "setValue", "name": "no_zone", "value": "true"}, // 免疫领域
{"type": "setValue", "name": "no_snipe", "value": "true"}, // 免疫阻击
{"type": "setValue", "name": "no_laser", "value": "true"}, // 免疫激光
{"type": "setValue", "name": "no_betweenAttack", "value": "true"}, // 免疫夹击
]
```
4. 如果有更高的需求,例如想让吸血效果变成一半,则还是在上面这些地方进行对应的修改即可。

View File

@ -219,6 +219,7 @@ HTML5的塔都是可以进行控制台调试的。
- `core.setFlag('xxx', 1)` 设置某个flag/自定义变量的值。
- `core.getFlag('xxx', 10)` 获得某个flag/自定义变量的值;如果该项不存在(未被定义),则返回第二个参数的值。
- `core.hasFlag('xxx')` 返回是否存在某个变量且不为0。等价于`core.getFlag('xxx', 0)!=0`。
- `core.removeFlag('xxx')` 删除某个flag/自定义变量
- `core.insertAction(list)` 执行一段自定义事件。比如 `core.insertAction(["剧情文本"])` 将执行一个剧情文本显示事件。
- `core.changeFloor('MT2', 'downFloor')` 立刻执行楼层切换到MT2层的下楼点位置。
- `core.changeFloor('MT5', null, {'x': 4, 'y': 7})` 立刻切换楼层到MT5层的(4,7)点。

View File

@ -123,24 +123,25 @@ control.prototype.setRequestAnimationFrame = function () {
// weather
if (core.isPlaying() && timestamp-core.animateFrame.weather.time>30) {
var ox = core.bigmap.offsetX, oy = core.bigmap.offsetY;
if (core.animateFrame.weather.type == 'rain' && core.animateFrame.weather.level > 0) {
core.clearMap('weather');
core.canvas.weather.strokeStyle = 'rgba(174,194,224,0.8)';
core.canvas.weather.lineWidth = 1;
core.canvas.weather.lineCap = 'round';
core.animateFrame.weather.nodes.forEach(function (p) {
core.canvas.weather.beginPath();
core.canvas.weather.moveTo(p.x, p.y);
core.canvas.weather.lineTo(p.x + p.l * p.xs, p.y + p.l * p.ys);
core.canvas.weather.moveTo(p.x-ox, p.y-oy);
core.canvas.weather.lineTo(p.x + p.l * p.xs - ox, p.y + p.l * p.ys - oy);
core.canvas.weather.stroke();
p.x += p.xs;
p.y += p.ys;
if (p.x > 416 || p.y > 416) {
p.x = Math.random() * 416;
if (p.x > core.bigmap.width*32 || p.y > core.bigmap.height*32) {
p.x = Math.random() * core.bigmap.width*32;
p.y = -10;
}
@ -162,26 +163,26 @@ control.prototype.setRequestAnimationFrame = function () {
var angle = core.animateFrame.weather.data;
core.animateFrame.weather.nodes.forEach(function (p) {
core.canvas.weather.moveTo(p.x, p.y);
core.canvas.weather.arc(p.x, p.y, p.r, 0, Math.PI * 2, true);
core.canvas.weather.moveTo(p.x - ox, p.y - oy);
core.canvas.weather.arc(p.x - ox, p.y - oy, p.r, 0, Math.PI * 2, true);
// update
p.x += Math.sin(angle) * 2;
p.y += Math.cos(angle + p.d) + 1 + p.r / 2;
if (p.x > 416 + 5 || p.x < -5 || p.y > 416) {
if (p.x > core.bigmap.width*32 + 5 || p.x < -5 || p.y > core.bigmap.height*32) {
if (Math.random() > 1 / 3) {
p.x = Math.random() * 416;
p.x = Math.random() * core.bigmap.width*32;
p.y = -10;
}
else {
if (Math.sin(angle) > 0) {
p.x = -5;
p.y = Math.random() * 416;
p.y = Math.random() * core.bigmap.height*32;
}
else {
p.x = 416 + 5;
p.y = Math.random() * 416;
p.x = core.bigmap.width*32 + 5;
p.y = Math.random() * core.bigmap.height*32;
}
}
}
@ -292,6 +293,9 @@ control.prototype.resetStatus = function(hero, hard, floorId, route, maps, value
// 清除游戏数据
core.clearStatus();
// 显示状态栏
core.control.triggerStatusBar("show");
// 初始化status
core.status = core.clone(core.initStatus);
// 初始化maps
@ -1412,14 +1416,14 @@ control.prototype.setWeather = function (type, level) {
level = parseInt(level);
// 当前天气:则忽略
if (type==core.animateFrame.weather.type &&
(!core.isset(level) || 20*level==core.animateFrame.weather.level)) {
if (type==core.animateFrame.weather.type && !core.isset(level)) {
return;
}
if (!core.isset(level)) level=5;
if (level<1) level=1; if (level>10) level=10;
level *= 20;
level *= parseInt(20*core.bigmap.width*core.bigmap.height/169);
// 计算当前的宽高
core.clearMap('weather')
core.animateFrame.weather.type = type;
@ -1430,8 +1434,8 @@ control.prototype.setWeather = function (type, level) {
if (type == 'rain') {
for (var a=0;a<level;a++) {
core.animateFrame.weather.nodes.push({
'x': Math.random()*416,
'y': Math.random()*416,
'x': Math.random()*core.bigmap.width*32,
'y': Math.random()*core.bigmap.height*32,
'l': Math.random() * 2.5,
'xs': -4 + Math.random() * 4 + 2,
'ys': Math.random() * 10 + 10
@ -1441,10 +1445,10 @@ control.prototype.setWeather = function (type, level) {
else if (type=='snow') {
for (var a=0;a<level;a++) {
core.animateFrame.weather.nodes.push({
'x': Math.random()*416,
'y': Math.random()*416,
'x': Math.random()*core.bigmap.width*32,
'y': Math.random()*core.bigmap.height*32,
'r': Math.random() * 5 + 1,
'd': Math.random() * level,
'd': Math.random() * Math.min(level, 200),
})
}
}
@ -2446,6 +2450,11 @@ control.prototype.loadData = function (data, callback) {
}
core.status.textAttribute = core.getFlag('textAttribute', core.status.textAttribute);
var toAttribute = core.getFlag('globalAttribute', core.status.globalAttribute);
if (core.utils.hashCode(toAttribute) != core.utils.hashCode(core.status.globalAttribute)) {
core.status.globalAttribute = toAttribute;
core.control.updateGlobalAttribute(Object.keys(toAttribute));
}
// load icons
var icon = core.getFlag("heroIcon", "hero.png");
@ -2533,6 +2542,12 @@ control.prototype.hasFlag = function(flag) {
return false;
}
////// 删除某个自定义变量或flag //////
control.prototype.removeFlag = function(flag) {
if (!core.isset(core.status.hero)) return;
delete core.status.hero.flags[flag];
}
////// 锁定状态栏,常常用于事件处理 //////
control.prototype.lockControl = function () {
core.status.lockControl = true;
@ -2678,7 +2693,7 @@ control.prototype.updateStatusBar = function () {
// 回放
if (core.status.replay.replaying) {
core.statusBar.image.book.src = core.status.replay.pausing?core.statusBar.icons.play.src:core.statusBar.icons.pause.src;
core.statusBar.image.book.src = core.status.replay.pausing ? core.statusBar.icons.play.src : core.statusBar.icons.pause.src;
core.statusBar.image.book.style.opacity = 1;
core.statusBar.image.fly.src = core.statusBar.icons.stop.src;
@ -2697,11 +2712,11 @@ control.prototype.updateStatusBar = function () {
}
else {
core.statusBar.image.book.src = core.statusBar.icons.book.src;
core.statusBar.image.book.style.opacity = core.hasItem('book')?1:0.3;
core.statusBar.image.book.style.opacity = core.hasItem('book') ? 1 : 0.3;
if (!core.flags.equipboxButton) {
core.statusBar.image.fly.src = core.statusBar.icons.fly.src;
core.statusBar.image.fly.style.opacity = core.hasItem('fly')?1:0.3;
core.statusBar.image.fly.style.opacity = core.hasItem('fly') ? 1 : 0.3;
}
else {
core.statusBar.image.fly.src = core.statusBar.icons.equipbox.src;
@ -2720,6 +2735,26 @@ control.prototype.updateStatusBar = function () {
}
}
control.prototype.triggerStatusBar = function (name) {
if (name!='hide') name='show';
var statusItems = core.dom.status;
var toolItems = core.dom.tools;
if (name == 'hide') {
for (var i = 0; i < statusItems.length; ++i)
statusItems[i].style.opacity = 0;
for (var i = 0; i < toolItems.length; ++i)
toolItems[i].style.display = 'none';
}
else {
for (var i = 0; i < statusItems.length; ++i)
statusItems[i].style.opacity = 1;
for (var i = 0; i < toolItems.length; ++i)
toolItems[i].style.display = 'block';
if (core.domStyle.screenMode != 'vertical')
core.statusBar.image.shop.style.display = 'none';
}
}
control.prototype.updateHeroIcon = function (name) {
name = name || "hero.png";
if (core.statusBar.icons.name == name) return;
@ -2740,6 +2775,64 @@ control.prototype.updateHeroIcon = function (name) {
}
control.prototype.updateGlobalAttribute = function (name) {
if (!core.isset(name)) return;
if (name instanceof Array) {
name.forEach(function (t) {
core.control.updateGlobalAttribute(t);
});
return;
}
var attribute = core.status.globalAttribute || core.initStatus.globalAttribute;
if (!core.isset(attribute)) return;
switch (name) {
case 'statusLeftBackground':
if (core.domStyle.screenMode == 'horizontal' || core.domStyle.screenMode == 'bigScreen') {
core.dom.statusBar.style.background = attribute[name];
}
break;
case 'statusTopBackground':
if (core.domStyle.screenMode == 'vertical') {
core.dom.statusBar.style.background = attribute[name];
}
break;
case 'toolsBackground':
if (core.domStyle.screenMode == 'vertical') {
core.dom.toolBar.style.background = attribute[name];
}
break;
case 'borderColor':
{
var border = '3px ' + attribute[name] + ' solid';
var isVertical = core.domStyle.screenMode == 'vertical';
core.dom.statusBar.style.borderTop = border;
core.dom.statusBar.style.borderLeft = border;
core.dom.statusBar.style.borderRight = isVertical?'':border;
core.dom.gameDraw.style.border = border;
core.dom.toolBar.style.borderBottom = border;
core.dom.toolBar.style.borderLeft = border;
core.dom.toolBar.style.borderRight = isVertical?'':border;
break;
}
case 'statusBarColor':
{
var texts = core.dom.statusTexts;
for (var i=0;i<texts.length;i++)
texts[i].style.color = attribute[name];
break;
}
case 'hardLabelColor':
core.dom.hard.style.color = attribute[name];
break;
case 'floorChangingBackground':
core.dom.floorMsgGroup.style.background = attribute[name];
break;
case 'floorChangingTextColor':
core.dom.floorMsgGroup.style.color = attribute[name];
break;
}
}
////// 屏幕分辨率改变后重新自适应 //////
control.prototype.resize = function(clientWidth, clientHeight) {
if (main.mode=='editor')return;
@ -2795,7 +2888,7 @@ control.prototype.resize = function(clientWidth, clientHeight) {
var shopDisplay;
var borderColor = main.borderColor||"white";
var borderColor = (core.status.globalAttribute||core.initStatus.globalAttribute).borderColor;
statusBarBorder = '3px '+borderColor+' solid';
toolBarBorder = '3px '+borderColor+' solid';
@ -2838,14 +2931,14 @@ control.prototype.resize = function(clientWidth, clientHeight) {
statusHeight = scale*BASE_LINEHEIGHT * .8;
statusLabelsLH = .8 * BASE_LINEHEIGHT *scale;
statusMaxWidth = scale * DEFAULT_BAR_WIDTH * .95;
statusBackground = main.statusTopBackground;
statusBackground = (core.status.globalAttribute||core.initStatus.globalAttribute).statusTopBackground;
toolBarHeight = tempBotBarH;
toolBarTop = statusBarHeight + canvasWidth;
toolBarBorder = '3px '+borderColor+' solid';
toolsHeight = scale * BASE_LINEHEIGHT;
toolsPMaxwidth = scale * DEFAULT_BAR_WIDTH * .4;
toolsBackground = main.toolsBackground;
toolsBackground = (core.status.globalAttribute||core.initStatus.globalAttribute).toolsBackground;
borderRight = '3px '+borderColor+' solid';
margin = scale * SPACE * 2;
@ -2862,7 +2955,7 @@ control.prototype.resize = function(clientWidth, clientHeight) {
toolBarWidth = statusBarWidth = DEFAULT_BAR_WIDTH * scale;
statusBarHeight = gameGroupHeight - SPACE;
statusBarBorder = '3px '+borderColor+' solid';
statusBackground = main.statusLeftBackground;
statusBackground = (core.status.globalAttribute||core.initStatus.globalAttribute).statusLeftBackground;
statusHeight = scale*statusLineHeight * .8;
statusLabelsLH = .8 * statusLineHeight *scale;
@ -2894,7 +2987,7 @@ control.prototype.resize = function(clientWidth, clientHeight) {
toolBarWidth = statusBarWidth = DEFAULT_BAR_WIDTH;
// statusBarHeight = statusLineHeight * count + SPACE * 2; //一共有9行
statusBackground = main.statusLeftBackground;
statusBackground = (core.status.globalAttribute||core.initStatus.globalAttribute).statusLeftBackground;
statusBarHeight = gameGroupHeight - SPACE;
statusHeight = statusLineHeight * .8;
@ -2971,8 +3064,8 @@ control.prototype.resize = function(clientWidth, clientHeight) {
height: (gameGroupHeight - SPACE*2) + unit,
top: SPACE + unit,
right: SPACE + unit,
background: main.floorChangingBackground||"black",
color: main.floorChangingTextColor||"white"
background: (core.status.globalAttribute||core.initStatus.globalAttribute).floorChangingBackground,
color: (core.status.globalAttribute||core.initStatus.globalAttribute).floorChangingTextColor
}
},
{
@ -3010,7 +3103,7 @@ control.prototype.resize = function(clientWidth, clientHeight) {
{
className: 'statusTexts',
rules: {
color: main.statusBarColor||"white"
color: (core.status.globalAttribute||core.initStatus.globalAttribute).statusBarColor
}
},
{
@ -3125,7 +3218,7 @@ control.prototype.resize = function(clientWidth, clientHeight) {
id: 'hard',
rules: {
lineHeight: toolsHeight + unit,
color: main.hardLabelColor||"red"
color: (core.status.globalAttribute||core.initStatus.globalAttribute).hardLabelColor
}
},
]
@ -3149,9 +3242,7 @@ control.prototype.domRenderer = function(){
var className = styles[i].className
for(var j=0; j<core.dom[className].length; j++)
for(var k=0; k<rulesProp.length; k++) {
var one = core.dom[className][j];
if (one.id !== styles[i].noid)
one.style[rulesProp[k]] = rules[rulesProp[k]];
core.dom[className][j].style[rulesProp[k]] = rules[rulesProp[k]];
}
}
if(styles[i].hasOwnProperty('id')){

View File

@ -158,6 +158,17 @@ function core() {
"bold": false,
"time": 0,
},
"globalAttribute": {
"statusLeftBackground": main.statusLeftBackground || "url(project/images/ground.png) repeat",
"statusTopBackground": main.statusTopBackground || "url(project/images/ground.png) repeat",
"toolsBackground": main.toolsBackground || "url(project/images/ground.png) repeat",
"borderColor": main.borderColor || "white",
"statusBarColor": main.statusBarColor || "white",
"hardLabelColor": main.hardLabelColor || "red",
"floorChangingBackground": main.floorChangingBackground || "black",
"floorChangingTextColor": main.floorChangingTextColor || "white",
"font": main.font || "Verdana"
},
'curtainColor': null,
'openingDoor': null,
'isSkiing': false,
@ -1247,6 +1258,12 @@ core.prototype.hasFlag = function(flag) {
return core.control.hasFlag(flag);
}
////// 删除某个自定义变量或flag //////
core.prototype.removeFlag = function(flag) {
core.control.removeFlag(flag);
}
////// 执行下一个自定义事件 //////
core.prototype.doAction = function() {
core.events.doAction();
}

View File

@ -759,7 +759,7 @@ events.prototype.doAction = function() {
core.setWeather(data.name, data.level);
if (core.isset(data.name))
core.setFlag('__weather__', [data.name, data.level]);
else core.setFlag('__weather__', null);
else core.removeFlag('__weather__');
this.doAction();
break;
case "openDoor": // 开一个门,包括暗墙
@ -890,12 +890,20 @@ events.prototype.doAction = function() {
}
break;
case "setFloor":
{
core.status.maps[data.floorId||core.status.floorId][data.name] = core.calValue(data.value);
core.updateStatusBar();
this.doAction();
break;
}
core.status.maps[data.floorId||core.status.floorId][data.name] = core.calValue(data.value);
core.updateStatusBar();
this.doAction();
break;
case "setGlobalAttribute":
core.status.globalAttribute[data.name] = data.value;
core.control.updateGlobalAttribute(data.name);
core.setFlag('globalAttribute', core.status.globalAttribute);
this.doAction();
break;
case "setGlobalValue":
core.values[data.name] = data.value;
this.doAction();
break;
case "setHeroIcon":
{
this.setHeroIcon(data.name);
@ -1038,6 +1046,14 @@ events.prototype.doAction = function() {
core.updateStatusBar();
this.doAction();
break;
case "showStatusBar":
core.control.triggerStatusBar("show");
this.doAction();
break;
case "hideStatusBar":
core.control.triggerStatusBar("hide");
this.doAction();
break;
case "updateEnemys":
core.enemys.updateEnemys();
core.updateStatusBar();
@ -1380,6 +1396,9 @@ events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback
core.events.setFloorName(floorId);
// 重置画布尺寸
core.maps.resizeMap(floorId);
// 更改BGM
if (core.isset(core.status.maps[floorId].bgm)) {
var bgm = core.status.maps[floorId].bgm;
@ -1425,8 +1444,6 @@ events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback
}
})
}
// 重置画布尺寸
core.maps.resizeMap(floorId);
// 画地图
core.drawMap(floorId, function () {
if (core.isset(heroLoc.direction))

View File

@ -456,7 +456,7 @@ ui.prototype.drawTextBox = function(content, showAll) {
var titleColor = core.arrayToRGBA(textAttribute.title);
var textColor = core.arrayToRGBA(textAttribute.text);
var borderColor = main.borderColor||"#FFFFFF";
var borderColor = core.status.globalAttribute.borderColor;
var alpha = isWindowSkin?0.85:background[3];
// 获得位置信息
@ -500,7 +500,8 @@ ui.prototype.drawTextBox = function(content, showAll) {
core.status.boxAnimateObjs = [];
core.clearMap('ui');
var font = textfont + 'px Verdana';
var globalFont = core.status.globalAttribute.font;
var font = textfont + 'px '+globalFont;
if (textAttribute.bold) font = "bold "+font;
var realContent = content.replace(/(\r|\\r)(\[.*?])?/g, "");
@ -601,14 +602,14 @@ ui.prototype.drawTextBox = function(content, showAll) {
core.setAlpha('ui', alpha);
core.strokeRect('ui', left + 15 - 1, top + 40 - 1, 34, heroHeight+2, null, 2);
core.setAlpha('ui', 1);
core.fillText('ui', name, content_left, top + 8 + titlefont, null, 'bold '+titlefont+'px Verdana');
core.fillText('ui', name, content_left, top + 8 + titlefont, null, 'bold '+titlefont+'px '+globalFont);
core.clearMap('ui', left + 15, top + 40, 32, heroHeight);
core.fillRect('ui', left + 15, top + 40, 32, heroHeight, core.material.groundPattern);
var heroIcon = core.material.icons.hero['down'];
core.canvas.ui.drawImage(core.material.images.hero, heroIcon.stop * 32, heroIcon.loc * heroHeight, 32, heroHeight, left+15, top+40, 32, heroHeight);
}
else {
core.fillText('ui', name, content_left, top + 8 + titlefont, null, 'bold '+titlefont+'px Verdana');
core.fillText('ui', name, content_left, top + 8 + titlefont, null, 'bold '+titlefont+'px '+globalFont);
if (core.isset(icon)) {
core.setAlpha('ui', alpha);
core.strokeRect('ui', left + 15 - 1, top + 40-1, 34, iconHeight + 2, null, 2);
@ -707,7 +708,7 @@ ui.prototype.drawChoices = function(content, choices) {
else background = core.initStatus.textAttribute.background;
}
if (!isWindowSkin) background = core.arrayToRGBA(background);
var borderColor = main.borderColor || "#FFFFFF";
var borderColor = core.status.globalAttribute.borderColor;
var textColor = core.arrayToRGBA(core.status.textAttribute.text);
var titleColor = core.arrayToRGBA(core.status.textAttribute.title);
@ -718,7 +719,8 @@ ui.prototype.drawChoices = function(content, choices) {
// 宽度计算:考虑选项的长度
var width = 416 - 2*85;
core.setFont('ui', "bold 17px Verdana");
var globalFont = core.status.globalAttribute.font;
core.setFont('ui', "bold 17px "+globalFont);
for (var i = 0; i < choices.length; i++) {
width = Math.max(width, core.canvas.ui.measureText(core.replaceText(choices[i].text || choices[i])).width + 30);
}
@ -743,7 +745,7 @@ ui.prototype.drawChoices = function(content, choices) {
icon=info.icon; iconHeight=info.iconHeight; animate=info.animate;
if (id=='hero' || core.isset(icon))
content_left = left+60;
contents = core.splitLines('ui', content, width-(content_left-left)-10, 'bold 15px Verdana');
contents = core.splitLines('ui', content, width-(content_left-left)-10, 'bold 15px '+globalFont);
// content部分高度
var cheight=0;
@ -783,14 +785,14 @@ ui.prototype.drawChoices = function(content, choices) {
if (id == 'hero') {
var heroHeight = core.material.icons.hero.height;
core.strokeRect('ui', left + 15 - 1, top + 30 - 1, 34, heroHeight+2, '#DDDDDD', 2);
core.fillText('ui', name, title_offset, top + 27, titleColor, 'bold 19px Verdana');
core.fillText('ui', name, title_offset, top + 27, titleColor, 'bold 19px '+globalFont);
core.clearMap('ui', left + 15, top + 30, 32, heroHeight);
core.fillRect('ui', left + 15, top + 30, 32, heroHeight, core.material.groundPattern);
var heroIcon = core.material.icons.hero['down'];
core.canvas.ui.drawImage(core.material.images.hero, heroIcon.stop * 32, heroIcon.loc *heroHeight, 32, heroHeight, left+15, top+30, 32, heroHeight);
}
else {
core.fillText('ui', name, title_offset, top + 27, titleColor, 'bold 19px Verdana');
core.fillText('ui', name, title_offset, top + 27, titleColor, 'bold 19px '+globalFont);
if (core.isset(icon)) {
core.strokeRect('ui', left + 15 - 1, top + 30 - 1, 34, iconHeight + 2, '#DDDDDD', 2);
core.status.boxAnimateObjs = [];
@ -807,7 +809,7 @@ ui.prototype.drawChoices = function(content, choices) {
core.canvas.ui.textAlign = "left";
for (var i=0;i<contents.length;i++) {
core.fillText('ui', contents[i], content_left, content_top, textColor, 'bold 15px Verdana');
core.fillText('ui', contents[i], content_left, content_top, textColor, 'bold 15px '+globalFont);
content_top+=20;
}
}
@ -816,7 +818,7 @@ ui.prototype.drawChoices = function(content, choices) {
core.canvas.ui.textAlign = "center";
for (var i = 0; i < choices.length; i++) {
core.setFillStyle('ui', choices[i].color || textColor);
core.fillText('ui', core.replaceText(choices[i].text || choices[i]), 208, choice_top + 32 * i, null, "bold 17px Verdana");
core.fillText('ui', core.replaceText(choices[i].text || choices[i]), 208, choice_top + 32 * i, null, "bold 17px "+globalFont);
}
if (choices.length>0) {
@ -846,7 +848,8 @@ ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback) {
core.clearMap('ui');
core.setAlpha('ui', 1);
core.setFillStyle('ui', core.material.groundPattern);
core.setFont('ui', "bold 19px Verdana");
var globalFont = core.status.globalAttribute.font;
core.setFont('ui', "bold 19px "+globalFont);
var contents = text.split('\n');
var lines = contents.length;
@ -859,7 +862,7 @@ ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback) {
var top = 140 - (lines-1)*30;
var right = 416 - 2 * left, bottom = 416 - 140 - top;
var borderColor = main.borderColor||"#FFFFFF";
var borderColor = core.status.globalAttribute.borderColor;
if (core.isPlaying())
core.fillRect('ui', left, top, right, bottom, core.material.groundPattern);
@ -870,7 +873,7 @@ ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback) {
core.fillText('ui', contents[i], 208, top + 50 + i*30, "#FFFFFF");
}
core.fillText('ui', "确定", 208 - 38, top + bottom - 35, "#FFFFFF", "bold 17px Verdana");
core.fillText('ui', "确定", 208 - 38, top + bottom - 35, "#FFFFFF", "bold 17px "+globalFont);
core.fillText('ui', "取消", 208 + 38, top + bottom - 35);
var len=core.canvas.ui.measureText("确定").width;
@ -1018,6 +1021,7 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
core.setAlpha('data', 1);
core.setOpacity('data', 1);
core.status.boxAnimateObjs = [];
var globalFont = core.status.globalAttribute.font;
var margin = 35;
var boxWidth = 40;
@ -1038,11 +1042,11 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
// 名称
core.canvas.ui.textAlign='center';
core.fillText('ui', core.status.hero.name, left+margin+boxWidth/2, top+margin+heroHeight+40, '#FFD700', 'bold 22px Verdana');
core.fillText('ui', core.status.hero.name, left+margin+boxWidth/2, top+margin+heroHeight+40, '#FFD700', 'bold 22px '+globalFont);
core.fillText('ui', "怪物", left+right-margin-boxWidth/2, top+margin+monsterHeight+40);
for (var i=0, j=0; i<specialTexts.length;i++) {
if (specialTexts[i]!='') {
core.fillText('ui', specialTexts[i], left+right-margin-boxWidth/2, top+margin+monsterHeight+44+20*(++j), '#FF6A6A', '15px Verdana');
core.fillText('ui', specialTexts[i], left+right-margin-boxWidth/2, top+margin+monsterHeight+44+20*(++j), '#FF6A6A', '15px '+globalFont);
}
}
@ -1070,79 +1074,79 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
// 勇士的线
core.canvas.ui.textAlign='left';
var textTop = top+margin+10;
core.fillText('ui', "生命值", left_start, textTop, '#DDDDDD', '16px Verdana');
core.fillText('ui', "生命值", left_start, textTop, '#DDDDDD', '16px '+globalFont);
core.drawLine('ui', left_start, textTop+8, left_end, textTop+8, '#FFFFFF', 2);
core.canvas.data.textAlign='right';
core.fillText('data', hero_hp, left_end, textTop+26, '#DDDDDD', 'bold 16px Verdana');
core.fillText('data', hero_hp, left_end, textTop+26, '#DDDDDD', 'bold 16px '+globalFont);
textTop+=lineHeight;
core.canvas.ui.textAlign='left';
core.fillText('ui', "攻击", left_start, textTop, '#DDDDDD', '16px Verdana');
core.fillText('ui', "攻击", left_start, textTop, '#DDDDDD', '16px '+globalFont);
core.drawLine('ui', left_start, textTop+8, left_end, textTop+8, '#FFFFFF', 2);
core.canvas.ui.textAlign='right';
core.fillText('ui', hero_atk, left_end, textTop+26, '#DDDDDD', 'bold 16px Verdana');
core.fillText('ui', hero_atk, left_end, textTop+26, '#DDDDDD', 'bold 16px '+globalFont);
textTop+=lineHeight;
core.canvas.ui.textAlign='left';
core.fillText('ui', "防御", left_start, textTop, '#DDDDDD', '16px Verdana');
core.fillText('ui', "防御", left_start, textTop, '#DDDDDD', '16px '+globalFont);
core.drawLine('ui', left_start, textTop+8, left_end, textTop+8, '#FFFFFF', 2);
core.canvas.ui.textAlign='right';
core.fillText('ui', hero_def, left_end, textTop+26, '#DDDDDD', 'bold 16px Verdana');
core.fillText('ui', hero_def, left_end, textTop+26, '#DDDDDD', 'bold 16px '+globalFont);
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 '+globalFont);
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');
core.fillText('data', hero_mdef, left_end, textTop+26, '#DDDDDD', 'bold 16px '+globalFont);
}
// 怪物的线
core.canvas.ui.textAlign='right';
var textTop = top+margin+10;
core.fillText('ui', "生命值", right_end, textTop, '#DDDDDD', '16px Verdana');
core.fillText('ui', "生命值", right_end, textTop, '#DDDDDD', '16px '+globalFont);
core.drawLine('ui', right_start, textTop+8, right_end, textTop+8, '#FFFFFF', 2);
core.canvas.data.textAlign='left';
core.fillText('data', mon_hp, right_start, textTop+26, '#DDDDDD', 'bold 16px Verdana');
core.fillText('data', mon_hp, right_start, textTop+26, '#DDDDDD', 'bold 16px '+globalFont);
textTop+=lineHeight;
core.canvas.ui.textAlign='right';
core.fillText('ui', "攻击", right_end, textTop, '#DDDDDD', '16px Verdana');
core.fillText('ui', "攻击", right_end, textTop, '#DDDDDD', '16px '+globalFont);
core.drawLine('ui', right_start, textTop+8, right_end, textTop+8, '#FFFFFF', 2);
core.canvas.ui.textAlign='left';
core.fillText('ui', mon_atk, right_start, textTop+26, '#DDDDDD', 'bold 16px Verdana');
core.fillText('ui', mon_atk, right_start, textTop+26, '#DDDDDD', 'bold 16px '+globalFont);
textTop+=lineHeight;
core.canvas.ui.textAlign='right';
core.fillText('ui', "防御", right_end, textTop, '#DDDDDD', '16px Verdana');
core.fillText('ui', "防御", right_end, textTop, '#DDDDDD', '16px '+globalFont);
core.drawLine('ui', right_start, textTop+8, right_end, textTop+8, '#FFFFFF', 2);
core.canvas.ui.textAlign='left';
core.fillText('ui', mon_def, right_start, textTop+26, '#DDDDDD', 'bold 16px Verdana');
core.fillText('ui', mon_def, right_start, textTop+26, '#DDDDDD', 'bold 16px '+globalFont);
if (core.flags.enableMoney) {
textTop += lineHeight;
core.canvas.ui.textAlign = 'right';
core.fillText('ui', "金币", right_end, textTop, '#DDDDDD', '16px Verdana');
core.fillText('ui', "金币", right_end, textTop, '#DDDDDD', '16px '+globalFont);
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');
core.fillText('ui', mon_money, right_start, textTop + 26, '#DDDDDD', 'bold 16px '+globalFont);
}
if (core.flags.enableExperience) {
textTop += lineHeight;
core.canvas.ui.textAlign='right';
core.fillText('ui', "经验", right_end, textTop, '#DDDDDD', '16px Verdana');
core.fillText('ui', "经验", right_end, textTop, '#DDDDDD', '16px '+globalFont);
core.drawLine('ui', right_start, textTop + 8, right_end, textTop + 8, '#FFFFFF', 2);
core.canvas.ui.textAlign='left';
core.fillText('ui', mon_exp, right_start, textTop+26, '#DDDDDD', 'bold 16px Verdana');
core.fillText('ui', mon_exp, right_start, textTop+26, '#DDDDDD', 'bold 16px '+globalFont);
}
core.canvas.ui.textAlign='left';
core.fillText("ui", "V", left_end+8, 208-15, "#FFFFFF", "italic bold 40px Verdana");
core.fillText("ui", "V", left_end+8, 208-15, "#FFFFFF", "italic bold 40px "+globalFont);
core.canvas.ui.textAlign='right';
core.fillText("ui", "S", right_start-8, 208+15, "#FFFFFF", "italic bold 40px Verdana");
core.fillText("ui", "S", right_start-8, 208+15, "#FFFFFF", "italic bold 40px "+globalFont);
var battleInterval = setInterval(function() {
core.playSound("attack.mp3");
@ -1163,7 +1167,7 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
// 更新怪物伤害
core.clearMap('data', right_start, top+margin+10, lineWidth, 40);
core.canvas.data.textAlign='left';
core.fillText('data', mon_hp, right_start, top+margin+10+26, '#DDDDDD', 'bold 16px Verdana');
core.fillText('data', mon_hp, right_start, top+margin+10+26, '#DDDDDD', 'bold 16px '+globalFont);
// 反击
if (core.enemys.hasSpecial(mon_special, 8)) {
@ -1176,7 +1180,7 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
// 更新勇士数据
core.clearMap('data', left_start, top+margin+10, lineWidth, 40);
core.canvas.data.textAlign='right';
core.fillText('data', hero_hp, left_end, top+margin+10+26, '#DDDDDD', 'bold 16px Verdana');
core.fillText('data', hero_hp, left_end, top+margin+10+26, '#DDDDDD', 'bold 16px '+globalFont);
if (core.flags.enableMDef) {
core.clearMap('data', left_start, top+margin+10+3*lineHeight, lineWidth, 40);
@ -1205,7 +1209,7 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
// 更新勇士数据
core.clearMap('data', left_start, top+margin+10, lineWidth, 40);
core.canvas.data.textAlign='right';
core.fillText('data', hero_hp, left_end, top+margin+10+26, '#DDDDDD', 'bold 16px Verdana');
core.fillText('data', hero_hp, left_end, top+margin+10+26, '#DDDDDD', 'bold 16px '+globalFont);
if (core.flags.enableMDef) {
core.clearMap('data', left_start, top+margin+10+3*lineHeight, lineWidth, 40);
@ -1245,7 +1249,8 @@ ui.prototype.drawWaiting = function(text) {
core.setAlpha('ui', 1);
core.setFillStyle('ui', core.material.groundPattern);
core.setFont('ui', 'bold 17px Verdana');
var globalFont = core.status.globalAttribute.font;
core.setFont('ui', 'bold 17px '+globalFont);
var text_length = core.canvas.ui.measureText(text).width;
var right = Math.max(text_length+50, 220);
@ -1308,7 +1313,8 @@ ui.prototype.drawPagination = function (page, totalPage, top) {
if (totalPage<=1) return;
if (!core.isset(top)) top=12;
core.setFont('ui', 'bold 15px Verdana');
var globalFont = (core.status.globalAttribute||core.initStatus.globalAttribute).font;
core.setFont('ui', 'bold 15px '+globalFont);
core.setFillStyle('ui', '#DDDDDD');
var length = core.canvas.ui.measureText(page + " / " + page).width;
@ -1366,13 +1372,14 @@ ui.prototype.drawBook = function (index) {
core.setAlpha('ui', 1);
core.canvas.ui.textAlign = 'left';
core.setFont('ui', 'bold 15px Verdana');
var globalFont = core.status.globalAttribute.font;
core.setFont('ui', 'bold 15px '+globalFont);
if (enemys.length == 0) {
core.fillText('ui', "本层无怪物", 83, 222, '#999999', "bold 50px Verdana");
core.fillText('ui', "本层无怪物", 83, 222, '#999999', "bold 50px "+globalFont);
// 退出
core.canvas.ui.textAlign = 'center';
core.fillText('ui', '返回游戏', 370, 403,'#DDDDDD', 'bold 15px Verdana');
core.fillText('ui', '返回游戏', 370, 403,'#DDDDDD', 'bold 15px '+globalFont);
return;
}
@ -1409,24 +1416,24 @@ ui.prototype.drawBook = function (index) {
core.canvas.ui.textAlign = "center";
if (enemy.specialText=='') {
core.fillText('ui', enemy.name, 115, 62 * i + 47, '#DDDDDD', 'bold 17px Verdana');
core.fillText('ui', enemy.name, 115, 62 * i + 47, '#DDDDDD', 'bold 17px '+globalFont);
}
else {
core.fillText('ui', enemy.name, 115, 62 * i + 40, '#DDDDDD', 'bold 17px Verdana');
core.fillText('ui', enemy.specialText, 115, 62 * i + 62, '#FF6A6A', 'bold 15px Verdana');
core.fillText('ui', enemy.name, 115, 62 * i + 40, '#DDDDDD', 'bold 17px '+globalFont);
core.fillText('ui', enemy.specialText, 115, 62 * i + 62, '#FF6A6A', 'bold 15px '+globalFont);
}
core.canvas.ui.textAlign = "left";
core.fillText('ui', '生命', 165, 62 * i + 32, '#DDDDDD', '13px Verdana');
core.fillText('ui', core.formatBigNumber(enemy.hp||0), 195, 62 * i + 32, '#DDDDDD', 'bold 13px Verdana');
core.fillText('ui', '攻击', 255, 62 * i + 32, '#DDDDDD', '13px Verdana');
core.fillText('ui', core.formatBigNumber(enemy.atk||0), 285, 62 * i + 32, '#DDDDDD', 'bold 13px Verdana');
core.fillText('ui', '防御', 335, 62 * i + 32, '#DDDDDD', '13px Verdana');
core.fillText('ui', core.formatBigNumber(enemy.def||0), 365, 62 * i + 32, '#DDDDDD', 'bold 13px Verdana');
core.fillText('ui', '生命', 165, 62 * i + 32, '#DDDDDD', '13px '+globalFont);
core.fillText('ui', core.formatBigNumber(enemy.hp||0), 195, 62 * i + 32, '#DDDDDD', 'bold 13px '+globalFont);
core.fillText('ui', '攻击', 255, 62 * i + 32, '#DDDDDD', '13px '+globalFont);
core.fillText('ui', core.formatBigNumber(enemy.atk||0), 285, 62 * i + 32, '#DDDDDD', 'bold 13px '+globalFont);
core.fillText('ui', '防御', 335, 62 * i + 32, '#DDDDDD', '13px '+globalFont);
core.fillText('ui', core.formatBigNumber(enemy.def||0), 365, 62 * i + 32, '#DDDDDD', 'bold 13px '+globalFont);
var expOffset = 165, line_cnt=0;
if (core.flags.enableMoney) {
core.fillText('ui', '金币', 165, 62 * i + 50, '#DDDDDD', '13px Verdana');
core.fillText('ui', core.formatBigNumber(enemy.money||0), 195, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana');
core.fillText('ui', '金币', 165, 62 * i + 50, '#DDDDDD', '13px '+globalFont);
core.fillText('ui', core.formatBigNumber(enemy.money||0), 195, 62 * i + 50, '#DDDDDD', 'bold 13px '+globalFont);
expOffset = 255;
line_cnt++;
}
@ -1434,16 +1441,16 @@ ui.prototype.drawBook = function (index) {
// 加点
if (core.flags.enableAddPoint) {
core.canvas.ui.textAlign = "left";
core.fillText('ui', '加点', expOffset, 62 * i + 50, '#DDDDDD', '13px Verdana');
core.fillText('ui', core.formatBigNumber(enemy.point||0), expOffset + 30, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana');
core.fillText('ui', '加点', expOffset, 62 * i + 50, '#DDDDDD', '13px '+globalFont);
core.fillText('ui', core.formatBigNumber(enemy.point||0), expOffset + 30, 62 * i + 50, '#DDDDDD', 'bold 13px '+globalFont);
expOffset = 255;
line_cnt++;
}
if (core.flags.enableExperience && line_cnt<2) {
core.canvas.ui.textAlign = "left";
core.fillText('ui', '经验', expOffset, 62 * i + 50, '#DDDDDD', '13px Verdana');
core.fillText('ui', core.formatBigNumber(enemy.experience||0), expOffset + 30, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana');
core.fillText('ui', '经验', expOffset, 62 * i + 50, '#DDDDDD', '13px '+globalFont);
core.fillText('ui', core.formatBigNumber(enemy.experience||0), expOffset + 30, 62 * i + 50, '#DDDDDD', 'bold 13px '+globalFont);
line_cnt++;
}
@ -1474,16 +1481,16 @@ ui.prototype.drawBook = function (index) {
if (enemy.notBomb)
damage += "[b]";
core.fillText('ui', damage, damageOffset, 62 * i + 50, color, 'bold 13px Verdana');
core.fillText('ui', damage, damageOffset, 62 * i + 50, color, 'bold 13px '+globalFont);
core.canvas.ui.textAlign = "left";
core.fillText('ui', '临界', 165, 62 * i + 68, '#DDDDDD', '13px Verdana');
core.fillText('ui', core.formatBigNumber(enemy.critical||0), 195, 62 * i + 68, '#DDDDDD', 'bold 13px Verdana');
core.fillText('ui', '减伤', 255, 62 * i + 68, '#DDDDDD', '13px Verdana');
core.fillText('ui', core.formatBigNumber(enemy.criticalDamage||0), 285, 62 * i + 68, '#DDDDDD', 'bold 13px Verdana');
core.fillText('ui', '1防', 335, 62 * i + 68, '#DDDDDD', '13px Verdana');
core.fillText('ui', core.formatBigNumber(enemy.defDamage||0), 365, 62 * i + 68, '#DDDDDD', 'bold 13px Verdana');
core.fillText('ui', '临界', 165, 62 * i + 68, '#DDDDDD', '13px '+globalFont);
core.fillText('ui', core.formatBigNumber(enemy.critical||0), 195, 62 * i + 68, '#DDDDDD', 'bold 13px '+globalFont);
core.fillText('ui', '减伤', 255, 62 * i + 68, '#DDDDDD', '13px '+globalFont);
core.fillText('ui', core.formatBigNumber(enemy.criticalDamage||0), 285, 62 * i + 68, '#DDDDDD', 'bold 13px '+globalFont);
core.fillText('ui', '1防', 335, 62 * i + 68, '#DDDDDD', '13px '+globalFont);
core.fillText('ui', core.formatBigNumber(enemy.defDamage||0), 365, 62 * i + 68, '#DDDDDD', 'bold 13px '+globalFont);
if (index == start+i) {
core.strokeRect('ui', 10, 62 * i + 13, 416-10*2, 62, '#FFD700');
@ -1494,7 +1501,7 @@ ui.prototype.drawBook = function (index) {
this.drawPagination(page, totalPage, 12);
core.canvas.ui.textAlign = 'center';
// 退出
core.fillText('ui', '返回游戏', 370, 403,'#DDDDDD', 'bold 15px Verdana');
core.fillText('ui', '返回游戏', 370, 403,'#DDDDDD', 'bold 15px '+globalFont);
}
////// 绘制怪物属性的详细信息 //////
@ -1594,7 +1601,8 @@ ui.prototype.drawBookDetail = function (index) {
var content_left = left + 25;
var validWidth = right-(content_left-left)-13;
var contents = core.splitLines("data", content, validWidth, '16px Verdana');
var globalFont = core.status.globalAttribute.font;
var contents = core.splitLines("data", content, validWidth, '16px '+globalFont);
var height = 416 - 10 - Math.min(416-24*(contents.length+1)-65, 250);
var top = (416-height)/2, bottom = height;
@ -1603,31 +1611,30 @@ ui.prototype.drawBookDetail = function (index) {
core.setAlpha('data', 0.9);
core.fillRect('data', left, top, right, bottom, '#000000');
core.setAlpha('data', 1);
core.strokeRect('data', left - 1, top - 1, right + 1, bottom + 1, main.borderColor||"#FFFFFF", 2);
core.strokeRect('data', left - 1, top - 1, right + 1, bottom + 1, core.status.globalAttribute.borderColor, 2);
// 名称
core.canvas.data.textAlign = "left";
core.fillText('data', enemy.name, content_left, top + 30, '#FFD700', 'bold 22px Verdana');
core.fillText('data', enemy.name, content_left, top + 30, '#FFD700', 'bold 22px '+globalFont);
var content_top = top + 57;
for (var i=0;i<contents.length;i++) {
// core.fillText('data', contents[i], content_left, content_top, '#FFFFFF', '16px Verdana');
var text=contents[i];
var index=text.indexOf("");
if (index>=0) {
var x1 = text.substring(0, index+1);
core.fillText('data', x1, content_left, content_top, '#FF6A6A', 'bold 16px Verdana');
core.fillText('data', x1, content_left, content_top, '#FF6A6A', 'bold 16px '+globalFont);
var len=core.canvas.data.measureText(x1).width;
core.fillText('data', text.substring(index+1), content_left+len, content_top, '#FFFFFF', '16px Verdana');
core.fillText('data', text.substring(index+1), content_left+len, content_top, '#FFFFFF', '16px '+globalFont);
}
else {
core.fillText('data', contents[i], content_left, content_top, '#FFFFFF', '16px Verdana');
core.fillText('data', contents[i], content_left, content_top, '#FFFFFF', '16px '+globalFont);
}
content_top+=24;
}
core.fillText('data', '<点击任意位置继续>', 270, top+height-13, '#CCCCCC', '13px Verdana');
core.fillText('data', '<点击任意位置继续>', 270, top+height-13, '#CCCCCC', '13px '+globalFont);
}
////// 绘制楼层传送器 //////
@ -1645,18 +1652,19 @@ ui.prototype.drawFly = function(page) {
core.fillRect('ui', 0, 0, 416, 416, '#000000');
core.setAlpha('ui', 1);
core.canvas.ui.textAlign = 'center';
core.fillText('ui', '楼层跳跃', 208, 60, '#FFFFFF', "bold 28px Verdana");
core.fillText('ui', '返回游戏', 208, 403, '#FFFFFF', "bold 15px Verdana")
core.fillText('ui', title, 356, 247, '#FFFFFF', "bold 19px Verdana");
var globalFont = core.status.globalAttribute.font
core.fillText('ui', '楼层跳跃', 208, 60, '#FFFFFF', "bold 28px "+globalFont);
core.fillText('ui', '返回游戏', 208, 403, '#FFFFFF', "bold 15px "+globalFont)
core.fillText('ui', title, 356, 247, '#FFFFFF', "bold 19px "+globalFont);
if (page<core.status.hero.flyRange.length-1) {
core.fillText('ui', '▲', 356, 247 - 64, '#FFFFFF', "17px Verdana");
core.fillText('ui', '▲', 356, 247 - 96, '#FFFFFF', "17px Verdana");
core.fillText('ui', '▲', 356, 247 - 96 - 7, '#FFFFFF', "17px Verdana");
core.fillText('ui', '▲', 356, 247 - 64, '#FFFFFF', "17px "+globalFont);
core.fillText('ui', '▲', 356, 247 - 96, '#FFFFFF', "17px "+globalFont);
core.fillText('ui', '▲', 356, 247 - 96 - 7, '#FFFFFF', "17px "+globalFont);
}
if (page>0) {
core.fillText('ui', '▼', 356, 247 + 64, '#FFFFFF', "17px Verdana");
core.fillText('ui', '▼', 356, 247 + 96, '#FFFFFF', "17px Verdana");
core.fillText('ui', '▼', 356, 247 + 96 + 7, '#FFFFFF', "17px Verdana");
core.fillText('ui', '▼', 356, 247 + 64, '#FFFFFF', "17px "+globalFont);
core.fillText('ui', '▼', 356, 247 + 96, '#FFFFFF', "17px "+globalFont);
core.fillText('ui', '▼', 356, 247 + 96 + 7, '#FFFFFF', "17px "+globalFont);
}
core.strokeRect('ui', 20, 100, 273, 273, '#FFFFFF', 2);
this.drawThumbnail(floorId, 'ui', core.status.maps[floorId].blocks, 20, 100, 273);
@ -1846,14 +1854,15 @@ ui.prototype.drawToolbox = function(index) {
// 文字
core.canvas.ui.textAlign = 'right';
core.fillText('ui', "消耗道具", 411, 124-ydelta, '#333333', "bold 16px Verdana");
var globalFont = core.status.globalAttribute.font;
core.fillText('ui', "消耗道具", 411, 124-ydelta, '#333333', "bold 16px "+globalFont);
core.fillText('ui', "永久道具", 411, 284-ydelta);
core.canvas.ui.textAlign = 'left';
// 描述
if (core.isset(selectId)) {
var item=core.material.items[selectId];
core.fillText('ui', item.name, 10, 32, '#FFD700', "bold 20px Verdana")
core.fillText('ui', item.name, 10, 32, '#FFD700', "bold 20px "+globalFont)
var text = item.text||"该道具暂无描述。";
try {
@ -1861,16 +1870,16 @@ ui.prototype.drawToolbox = function(index) {
text = eval(text);
} catch (e) {}
var lines = core.splitLines('ui', text, 406, '17px Verdana');
var lines = core.splitLines('ui', text, 406, '17px '+globalFont);
core.fillText('ui', lines[0], 10, 62, '#FFFFFF', '17px Verdana');
core.fillText('ui', lines[0], 10, 62, '#FFFFFF', '17px '+globalFont);
if (lines.length==1) {
core.fillText('ui', '<继续点击该道具即可进行使用>', 10, 89, '#CCCCCC', '14px Verdana');
core.fillText('ui', '<继续点击该道具即可进行使用>', 10, 89, '#CCCCCC', '14px '+globalFont);
}
else {
var leftText = text.substring(lines[0].length);
core.fillText('ui', leftText, 10, 89, '#FFFFFF', '17px Verdana');
core.fillText('ui', leftText, 10, 89, '#FFFFFF', '17px '+globalFont);
}
}
@ -1885,7 +1894,7 @@ ui.prototype.drawToolbox = function(index) {
var icon=core.material.icons.items[tool];
core.canvas.ui.drawImage(images, 0, icon*32, 32, 32, 16*(4*(i%6)+1)+5, yoffset, 32, 32)
// 个数
core.fillText('ui', core.itemCount(tool), 16*(4*(i%6)+1)+40, yoffset+33, '#FFFFFF', "bold 14px Verdana");
core.fillText('ui', core.itemCount(tool), 16*(4*(i%6)+1)+40, yoffset+33, '#FFFFFF', "bold 14px "+globalFont);
if (selectId == tool)
core.strokeRect('ui', 16*(4*(i%6)+1)+1, yoffset-4, 40, 40, '#FFD700');
}
@ -1909,10 +1918,10 @@ ui.prototype.drawToolbox = function(index) {
// 装备栏
// if (core.flags.equipment)
core.fillText('ui', '[装备栏]', 370, 25,'#DDDDDD', 'bold 15px Verdana');
// core.fillText('ui', '删除道具', 370, 32,'#DDDDDD', 'bold 15px Verdana');
core.fillText('ui', '[装备栏]', 370, 25,'#DDDDDD', 'bold 15px '+globalFont);
// core.fillText('ui', '删除道具', 370, 32,'#DDDDDD', 'bold 15px '+globalFont);
// 退出
core.fillText('ui', '返回游戏', 370, 403,'#DDDDDD', 'bold 15px Verdana');
core.fillText('ui', '返回游戏', 370, 403,'#DDDDDD', 'bold 15px '+globalFont);
}
////// 绘制装备界面 //////
@ -1988,7 +1997,8 @@ ui.prototype.drawEquipbox = function(index) {
// 文字
core.canvas.ui.textAlign = 'right';
core.fillText('ui', "当前装备", 411, 124-ydelta, '#333333', "bold 16px Verdana");
var globalFont = core.status.globalAttribute.font;
core.fillText('ui', "当前装备", 411, 124-ydelta, '#333333', "bold 16px "+globalFont);
core.fillText('ui', "拥有装备", 411, 284-ydelta);
core.canvas.ui.textAlign = 'left';
@ -1998,12 +2008,12 @@ ui.prototype.drawEquipbox = function(index) {
var equip=core.material.items[selectId];
if (!core.isset(equip.equip)) equip.equip = {"type": 0};
var equipType = equip.equip.type;
core.fillText('ui', equip.name + "" + (allEquips[equipType]||"未知部位") + "", 10, 32, '#FFD700', "bold 20px Verdana")
core.fillText('ui', equip.name + "" + (allEquips[equipType]||"未知部位") + "", 10, 32, '#FFD700', "bold 20px "+globalFont)
var text = equip.text||"该装备暂无描述。";
var lines = core.splitLines('ui', text, 406, '17px Verdana');
var lines = core.splitLines('ui', text, 406, '17px '+globalFont);
core.fillText('ui', lines[0], 10, 62, '#FFFFFF', '17px Verdana');
core.fillText('ui', lines[0], 10, 62, '#FFFFFF', '17px '+globalFont);
// 比较属性
if (lines.length==1) {
@ -2026,7 +2036,7 @@ ui.prototype.drawEquipbox = function(index) {
newValue = Math.floor(newBuff*core.getStatus(name));
}
var content = title + ' ' + nowValue + '->';
core.fillText('ui', content, drawOffset, 89, '#CCCCCC', 'bold 14px Verdana');
core.fillText('ui', content, drawOffset, 89, '#CCCCCC', 'bold 14px '+globalFont);
drawOffset += core.canvas.ui.measureText(content).width;
core.fillText('ui', newValue, drawOffset, 89, color);
drawOffset += core.canvas.ui.measureText(newValue).width + 15;
@ -2034,7 +2044,7 @@ ui.prototype.drawEquipbox = function(index) {
}
else {
var leftText = text.substring(lines[0].length);
core.fillText('ui', leftText, 10, 89, '#FFFFFF', '17px Verdana');
core.fillText('ui', leftText, 10, 89, '#FFFFFF', '17px '+globalFont);
}
}
@ -2048,7 +2058,7 @@ ui.prototype.drawEquipbox = function(index) {
var icon = core.material.icons.items[equipId];
core.canvas.ui.drawImage(images, 0, icon*32, 32, 32, 16*(8*(i%3)+5)+5, 144+Math.floor(i/3)*54+5-ydelta, 32, 32);
}
core.fillText('ui', allEquips[i]||"未知", 16*(8*(i%3)+1)+40, 144+Math.floor(i/3)*54+32-ydelta, '#FFFFFF', "bold 16px Verdana");
core.fillText('ui', allEquips[i]||"未知", 16*(8*(i%3)+1)+40, 144+Math.floor(i/3)*54+32-ydelta, '#FFFFFF', "bold 16px "+globalFont);
core.strokeRect('ui', 16*(8*(i%3)+5)+1, 144+Math.floor(i/3)*54+1-ydelta, 40, 40, index==i?'#FFD700':"#FFFFFF");
}
@ -2060,7 +2070,7 @@ ui.prototype.drawEquipbox = function(index) {
core.canvas.ui.drawImage(images, 0, icon*32, 32, 32, 16*(4*(i%6)+1)+5, 304+Math.floor(i/6)*54+5-ydelta, 32, 32)
// 个数
if (core.itemCount(ownEquip)>1)
core.fillText('ui', core.itemCount(ownEquip), 16*(4*(i%6)+1)+40, 304+Math.floor(i/6)*54+38-ydelta, '#FFFFFF', "bold 14px Verdana");
core.fillText('ui', core.itemCount(ownEquip), 16*(4*(i%6)+1)+40, 304+Math.floor(i/6)*54+38-ydelta, '#FFFFFF', "bold 14px "+globalFont);
if (index>=12 && selectId == ownEquip)
core.strokeRect('ui', 16*(4*(i%6)+1)+1, 304+Math.floor(i/6)*54+1-ydelta, 40, 40, '#FFD700');
}
@ -2068,9 +2078,9 @@ ui.prototype.drawEquipbox = function(index) {
this.drawPagination(page, totalPage, 12);
// 道具栏
core.canvas.ui.textAlign = 'center';
core.fillText('ui', '[道具栏]', 370, 25,'#DDDDDD', 'bold 15px Verdana');
core.fillText('ui', '[道具栏]', 370, 25,'#DDDDDD', 'bold 15px '+globalFont);
// 退出按钮
core.fillText('ui', '返回游戏', 370, 403,'#DDDDDD', 'bold 15px Verdana');
core.fillText('ui', '返回游戏', 370, 403,'#DDDDDD', 'bold 15px '+globalFont);
}
////// 绘制存档/读档界面 //////
@ -2097,6 +2107,7 @@ ui.prototype.drawSLPanel = function(index, refresh) {
var strokeColor = '#FFD700';
if (core.status.event.selection) strokeColor = '#FF6A6A';
var globalFont = (core.status.globalAttribute||core.initStatus.globalAttribute).font;
var drawBg = function() {
core.clearMap('ui');
@ -2107,7 +2118,7 @@ ui.prototype.drawSLPanel = function(index, refresh) {
core.ui.drawPagination(page+1, max_page, 12);
core.canvas.ui.textAlign = 'center';
// 退出
core.fillText('ui', '返回游戏', 370, 403,'#DDDDDD', 'bold 15px Verdana');
core.fillText('ui', '返回游戏', 370, 403,'#DDDDDD', 'bold 15px '+globalFont);
if (core.status.event.selection)
core.setFillStyle('ui', '#FF6A6A');
@ -2122,35 +2133,35 @@ ui.prototype.drawSLPanel = function(index, refresh) {
core.status.event.ui[i] = data;
var id=5*page+i;
if (i<3) {
core.fillText('ui', i==0?"自动存档":name+id, (2*i+1)*u, 30, '#FFFFFF', "bold 17px Verdana");
core.fillText('ui', i==0?"自动存档":name+id, (2*i+1)*u, 30, '#FFFFFF', "bold 17px "+globalFont);
core.strokeRect('ui', (2*i+1)*u-size/2, 45, size, size, i==offset?strokeColor:'#FFFFFF', i==offset?6:2);
if (core.isset(data) && core.isset(data.floorId)) {
core.ui.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i+1)*u-size/2, 45, size, data.hero.loc.x, data.hero.loc.y, data.hero.loc, data.hero.flags.heroIcon||"hero.png");
var v = core.formatBigNumber(data.hero.hp)+"/"+core.formatBigNumber(data.hero.atk)+"/"+core.formatBigNumber(data.hero.def);
var v2 = "/"+core.formatBigNumber(data.hero.mdef);
if (v.length+v2.length<=21) v+=v2;
core.fillText('ui', v, (2*i+1)*u, 60+size, '#FFD700', '10px Verdana');
core.fillText('ui', v, (2*i+1)*u, 60+size, '#FFD700', '10px '+globalFont);
core.fillText('ui', core.formatDate(new Date(data.time)), (2*i+1)*u, 73+size, data.hero.flags.consoleOpened?'#FF6A6A':'#FFFFFF');
}
else {
core.fillRect('ui', (2*i+1)*u-size/2, 45, size, size, '#333333', 2);
core.fillText('ui', '空', (2*i+1)*u, 112, '#FFFFFF', 'bold 30px Verdana');
core.fillText('ui', '空', (2*i+1)*u, 112, '#FFFFFF', 'bold 30px '+globalFont);
}
}
else {
core.fillText('ui', name+id, (2*i-5)*u, 218, '#FFFFFF', "bold 17px Verdana");
core.fillText('ui', name+id, (2*i-5)*u, 218, '#FFFFFF', "bold 17px "+globalFont);
core.strokeRect('ui', (2*i-5)*u-size/2, 233, size, size, i==offset?strokeColor:'#FFFFFF', i==offset?6:2);
if (core.isset(data) && core.isset(data.floorId)) {
core.ui.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i-5)*u-size/2, 233, size, data.hero.loc.x, data.hero.loc.y, data.hero.loc, data.hero.flags.heroIcon||"hero.png");
var v = core.formatBigNumber(data.hero.hp)+"/"+core.formatBigNumber(data.hero.atk)+"/"+core.formatBigNumber(data.hero.def);
var v2 = "/"+core.formatBigNumber(data.hero.mdef);
if (v.length+v2.length<=21) v+=v2;
core.fillText('ui', v, (2*i-5)*u, 248+size, '#FFD700', '10px Verdana');
core.fillText('ui', core.formatDate(new Date(data.time)), (2*i-5)*u, 261+size, data.hero.flags.consoleOpened?'#FF6A6A':'#FFFFFF', '10px Verdana');
core.fillText('ui', v, (2*i-5)*u, 248+size, '#FFD700', '10px '+globalFont);
core.fillText('ui', core.formatDate(new Date(data.time)), (2*i-5)*u, 261+size, data.hero.flags.consoleOpened?'#FF6A6A':'#FFFFFF', '10px '+globalFont);
}
else {
core.fillRect('ui', (2*i-5)*u-size/2, 233, size, size, '#333333', 2);
core.fillText('ui', '空', (2*i-5)*u, 297, '#FFFFFF', 'bold 30px Verdana');
core.fillText('ui', '空', (2*i-5)*u, 297, '#FFFFFF', 'bold 30px '+globalFont);
}
}
};
@ -2322,9 +2333,10 @@ ui.prototype.drawKeyBoard = function () {
core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2);
core.canvas.ui.textAlign = "center";
core.fillText('ui', "虚拟键盘", 208, top+35, "#FFD700", "bold 22px Verdana");
var globalFont = core.status.globalAttribute.font;
core.fillText('ui', "虚拟键盘", 208, top+35, "#FFD700", "bold 22px "+globalFont);
core.setFont('ui', '17px Verdana');
core.setFont('ui', '17px '+globalFont);
core.setFillStyle('ui', '#FFFFFF');
var offset = 128-9;
@ -2347,7 +2359,7 @@ ui.prototype.drawKeyBoard = function () {
core.canvas.ui.textAlign = 'center';
core.fillText("ui", "返回游戏", 416-80, offset-3, '#FFFFFF', 'bold 15px Verdana');
core.fillText("ui", "返回游戏", 416-80, offset-3, '#FFFFFF', 'bold 15px '+globalFont);
}
////// 绘制“数据统计”界面 //////

View File

@ -64,7 +64,8 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"statusBarColor": "white",
"hardLabelColor": "red",
"floorChangingBackground": "black",
"floorChangingTextColor": "white"
"floorChangingTextColor": "white",
"font": "Verdana"
},
"firstData": {
"title": "魔塔样板",
@ -212,7 +213,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"bluePotion": 250,
"yellowPotion": 500,
"greenPotion": 800,
"moneyPocket": 500,
"breakArmor": 0.9,
"counterAttack": 0.1,
"purify": 3,

View File

@ -25,7 +25,10 @@ main.floors.sample0=
[ 88, 89, 90, 91, 92, 93, 94, 2, 81, 82, 83, 84, 86]
],
"firstArrive": [
{"type": "setText", "background": "winskin.png"},
{
"type": "setText",
"background": "winskin.png"
},
"\t[样板提示]首次到达某层可以触发 firstArrive 事件该事件可类似于RMXP中的“自动执行脚本”。\n\n本事件支持一切的事件类型常常用来触发对话例如",
"\t[hero]\b[up,hero]我是谁?我从哪来?我又要到哪去?",
"\t[仙子,fairy]你问我...?我也不知道啊...",
@ -174,9 +177,6 @@ main.floors.sample0=
"8,7": [
"如需修改消耗品的效果,请前往 data.js 找到并修改values内对应的具体数值即可。\n如果有更高级的需求如每个区域宝石数值变化详见doc文档内的做法说明。"
],
"10,7": [
"在 data.js 的系统Flag中设置是否启用装备栏按钮。\n如果启用则装备栏按钮会代替楼层传送器按钮"
],
"9,5": [
"每层楼的 canFlyTo 决定了该楼层能否被飞到。\n\n不能被飞到的楼层也无法使用楼层传送器。",
"飞行的楼层顺序由 main.js 中 floorIds 加载顺序所决定。\n\n是否必须在楼梯边使用楼传器由 data.js 中的系统Flag所决定。"

View File

@ -509,6 +509,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
var vampire_damage = hero_hp * enemy.value;
// 如果有神圣盾免疫吸血等可以在这里写
// 也可以用hasItem和hasEquip来判定装备
// if (core.hasFlag('shield5')) vampire_damage = 0;
vampire_damage = Math.floor(vampire_damage) || 0;
@ -1036,8 +1037,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 名称
core.canvas.ui.textAlign = "left";
core.fillText('ui', "HTML5 魔塔样板", text_start, top+35, "#FFD700", "bold 22px Verdana");
core.fillText('ui', "版本: "+core.firstData.version, text_start, top + 80, "#FFFFFF", "bold 17px Verdana");
var globalFont = (core.status.globalAttribute||core.initStatus.globalAttribute).font;
core.fillText('ui', "HTML5 魔塔样板", text_start, top+35, "#FFD700", "bold 22px "+globalFont);
core.fillText('ui', "版本: "+core.firstData.version, text_start, top + 80, "#FFFFFF", "bold 17px "+globalFont);
core.fillText('ui', "作者: 艾之葵", text_start, top + 112);
core.fillText('ui', 'HTML5魔塔交流群539113091', text_start, top+112+32);
// TODO: 写自己的“关于”页面每次增加32像素即可
@ -1066,7 +1068,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 如果某个flag为真
if (core.hasFlag("xxx")) {
// 千万别忘了将该flag清空否则下次仍然会执行这段代码。
core.setFlag("xxx", false);
core.removeFlag("xxx");
// 使用insertAction来插入若干自定义事件执行
core.insertAction([
{"type":"openDoor", "loc":[0,0], "floorId": "MT0"}

View File

@ -327,7 +327,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"shield5": "core.status.hero.def += 100;core.status.hero.mdef += 100",
"bigKey": "core.status.hero.items.keys.yellowKey++;core.status.hero.items.keys.blueKey++;core.status.hero.items.keys.redKey++;",
"superPotion": "core.status.hero.hp *= 2",
"moneyPocket": "core.status.hero.money += core.values.moneyPocket"
"moneyPocket": "core.status.hero.money += 500"
},
"itemEffectTip": {
"redJewel": "',攻击+'+core.values.redJewel * ratio",
@ -352,7 +352,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"shield5": "',防御+100魔防+100'",
"bigKey": "',全钥匙+1'",
"superPotion": "',生命值翻倍'",
"moneyPocket": "',金币+'+core.values.moneyPocket"
"moneyPocket": "',金币+500'"
},
"useItemEffect": {
"book": "core.ui.drawBook(0);",
@ -367,10 +367,10 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"centerFly": "core.playSound('centerFly.mp3');\ncore.clearMap('hero');\ncore.setHeroLoc('x', (core.bigmap.width||13)-1-core.getHeroLoc('x'));\ncore.setHeroLoc('y', (core.bigmap.height||13)-1-core.getHeroLoc('y'));\ncore.drawHero();\ncore.drawTip(core.material.items[itemId].name + '使用成功');",
"upFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y};\ncore.changeFloor(core.status.event.data.id, null, loc, null, function (){\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\tcore.replay();\n});",
"downFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y};\ncore.changeFloor(core.status.event.data.id, null, loc, null, function (){\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\tcore.replay();\n});",
"poisonWine": "core.setFlag('poison', false);",
"weakWine": "core.setFlag('weak', false);\ncore.status.hero.atk += core.getFlag('weakAtk', core.values.weakValue);\ncore.status.hero.def += core.getFlag('weakDef', core.values.weakValue);",
"curseWine": "core.setFlag('curse', false);",
"superWine": "core.setFlag('poison', false);\nif (core.hasFlag('weak')) {\n\tcore.setFlag('weak', false);\n\tcore.status.hero.atk += core.getFlag('weakAtk', core.values.weakValue);\n\tcore.status.hero.def += core.getFlag('weakDef', core.values.weakValue);\n}\ncore.setFlag('curse', false);",
"poisonWine": "core.removeFlag('poison');",
"weakWine": "core.removeFlag('weak');\ncore.status.hero.atk += core.getFlag('weakAtk', core.values.weakValue);\ncore.status.hero.def += core.getFlag('weakDef', core.values.weakValue);",
"curseWine": "core.removeFlag('curse');",
"superWine": "core.removeFlag('poison');\nif (core.hasFlag('weak')) {\n\tcore.removeFlag('weak');\n\tcore.status.hero.atk += core.getFlag('weakAtk', core.values.weakValue);\n\tcore.status.hero.def += core.getFlag('weakDef', core.values.weakValue);\n}\ncore.removeFlag('curse');",
"lifeWand": "core.insertAction([\n\t{\"type\": \"input\", \"text\": \"请输入生命魔杖使用次数:(0-${item:lifeWand})\"},\n\t{\"type\": \"if\", \"condition\": \"flag:input<=item:lifeWand\",\n\t\t\"true\": [\n\t\t\t{\"type\": \"setValue\", \"name\": \"item:lifeWand\", \"value\": \"item:lifeWand-flag:input\"},\n\t\t\t{\"type\": \"setValue\", \"name\": \"status:hp\", \"value\": \"status:hp+flag:input*100\"},\n\t\t\t\"成功使用${flag:input}次生命魔杖,恢复${flag:input*100}点生命。\"\n\t\t],\n\t\t\"false\": [\"输入不合法!\"]\n\t},\n]);\ncore.addItem('lifeWand', 1);",
"jumpShoes": "core.insertAction({\"type\":\"jumpHero\",\"loc\":[core.nextX(2),core.nextY(2)]});",
"redPotion": "core.status.hero.hp += core.values.redPotion",

View File

@ -8,6 +8,8 @@
升级事件改用事件编辑器完成
每层楼都增添该层的并行事件处理
新增快捷键N返回标题P查看评论O打开工程
新增事件:设置全局属性或全局数值
新增事件:隐藏/显示状态栏
道具可以设置是否在回放时绘制道具栏或直接使用
可以同时异步移动/跳跃勇士和多个NPC
可以同时异步移动两张或以上的图片了