合并全塔属性的样式

This commit is contained in:
ckcz123 2020-05-23 08:04:41 +08:00
parent 566462d6ea
commit 7707e9f689
17 changed files with 104 additions and 192 deletions

View File

@ -685,10 +685,6 @@ core.updateHeroIcon()
更新状态栏上的勇士图标。 更新状态栏上的勇士图标。
core.updateGlobalAttribute()
更新全局属性,例如状态栏的背景图等。
core.setToolbarButton(useButtom) core.setToolbarButton(useButtom)
设置工具栏是否是拓展键盘。 设置工具栏是否是拓展键盘。

View File

@ -684,10 +684,6 @@ core.updateHeroIcon()
更新状态栏上的勇士图标。 更新状态栏上的勇士图标。
core.updateGlobalAttribute()
更新全局属性,例如状态栏的背景图等。
core.setToolbarButton(useButtom) core.setToolbarButton(useButtom)
设置工具栏是否是拓展键盘。 设置工具栏是否是拓展键盘。

View File

@ -557,6 +557,35 @@ return '{' + [
*/; */;
mainStyle_m
: '主要样式设置:' '标题界面背景图(全路径):' EvalString BGNL? Newline
'标题样式;可写 display: none 隐藏标题' EvalString BGNL? Newline
'标题按钮样式:' EvalString BGNL? Newline
'横屏状态栏背景url(...) 0 0/100% 100% no-repeat 可将图片拉伸自适配' BGNL? Newline EvalString BGNL? Newline
'竖屏状态栏背景:' EvalString BGNL? Newline
'竖屏工具栏背景:' EvalString BGNL? Newline
'楼层切换样式:' EvalString BGNL? Newline
'状态栏颜色' ColorString Colour '边框颜色' ColorString Colour '全局字体' EvalString BEND
/* mainStyle_m
tooltip : 主要样式设置
default : ["project/images/bg.jpg", "color: black", "background-color: #32369F; opacity: 0.85; color: #FFFFFF; border: #FFFFFF 2px solid; caret-color: #FFD700;", "url(project/materials/ground.png) repeat", "url(project/materials/ground.png) repeat", "url(project/materials/ground.png) repeat", "background-color: black; color: white", "255,255,255,1", "rgba(255,255,255,1)", "204,204,204,1", "rgba(204,204,204,1)", "Verdana"]
helpUrl : https://h5mota.com/games/template/_docs/#/event
var code = {
startBackground: EvalString_0,
startLogoStyle: EvalString_1,
startButtonsStyle: EvalString_2,
statusLeftBackground: EvalString_3,
statusTopBackground: EvalString_4,
toolsBackground: EvalString_5,
floorChangingStyle: EvalString_6,
statusBarColor: JSON.parse('['+ColorString_0+']'),
borderColor: JSON.parse('['+ColorString_1+']'),
font: EvalString_7
};
return JSON.stringify(code);
*/;
//为了避免关键字冲突,全部加了_s //为了避免关键字冲突,全部加了_s
//动作 //动作
action action
@ -818,6 +847,7 @@ tip_s
/* tip_s /* tip_s
tooltip : tip显示一段提示文字 tooltip : tip显示一段提示文字
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=tip%EF%BC%9A%E6%98%BE%E7%A4%BA%E4%B8%80%E6%AE%B5%E6%8F%90%E7%A4%BA%E6%96%87%E5%AD%97 helpUrl : https://h5mota.com/games/template/_docs/#/event?id=tip%EF%BC%9A%E6%98%BE%E7%A4%BA%E4%B8%80%E6%AE%B5%E6%8F%90%E7%A4%BA%E6%96%87%E5%AD%97
allIds : ['IdString_0']
default : ["这段话将在左上角以气泡形式显示",""] default : ["这段话将在左上角以气泡形式显示",""]
IdString_0 = IdString_0 && (', "icon": "' + IdString_0 + '"'); IdString_0 = IdString_0 && (', "icon": "' + IdString_0 + '"');
var code = '{"type": "tip", "text": "'+EvalString_0+'"'+IdString_0+'},\n'; var code = '{"type": "tip", "text": "'+EvalString_0+'"'+IdString_0+'},\n';
@ -857,17 +887,17 @@ return code;
setFloor_s setFloor_s
: '设置楼层属性' ':' Floor_Meta_List '楼层名' IdString? '值' EvalString Newline : '设置楼层属性' ':' Floor_Meta_List '楼层名' IdString? '值' JsonEvalString Newline
/* setFloor_s /* setFloor_s
tooltip : setFloor设置楼层属性该楼层属性和编辑器中的楼层属性一一对应 tooltip : setFloor设置楼层属性该楼层属性和编辑器中的楼层属性一一对应
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=setFloor%ef%bc%9a%e8%ae%be%e7%bd%ae%e6%a5%bc%e5%b1%82%e5%b1%9e%e6%80%a7 helpUrl : https://h5mota.com/games/template/_docs/#/event?id=setFloor%ef%bc%9a%e8%ae%be%e7%bd%ae%e6%a5%bc%e5%b1%82%e5%b1%9e%e6%80%a7
default : ["title","","'字符串类型的值要加引号,其他类型则不用'"] default : ["title","","\"新楼层名\""]
allFloorIds : ['IdString_0'] allFloorIds : ['IdString_0']
colour : this.dataColor colour : this.dataColor
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"'); IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
var code = '{"type": "setFloor", "name": "'+Floor_Meta_List_0+'"'+IdString_0+', "value": "'+EvalString_0+'"},\n'; var code = '{"type": "setFloor", "name": "'+Floor_Meta_List_0+'"'+IdString_0+', "value": '+JsonEvalString_0+'},\n';
return code; return code;
*/; */;
@ -1481,6 +1511,7 @@ tooltip : changeFloor: 楼层切换,动画时间可不填
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=changefloor%EF%BC%9A%E6%A5%BC%E5%B1%82%E5%88%87%E6%8D%A2 helpUrl : https://h5mota.com/games/template/_docs/#/event?id=changefloor%EF%BC%9A%E6%A5%BC%E5%B1%82%E5%88%87%E6%8D%A2
default : [null,"",null,"","",null,"",null] default : [null,"",null,"","",null,"",null]
selectPoint : ["PosString_0", "PosString_1", "IdString_0", true] selectPoint : ["PosString_0", "PosString_1", "IdString_0", true]
allFloorIds : ['IdString_0']
colour : this.dataColor colour : this.dataColor
var toFloorId = IdString_0; var toFloorId = IdString_0;
if (Floor_List_0!='floorId') toFloorId = Floor_List_0; if (Floor_List_0!='floorId') toFloorId = Floor_List_0;
@ -3166,8 +3197,8 @@ Floor_Meta_List
/*Floor_Meta_List ['title','name','canFlyTo', 'canUseQuickShop', 'cannotViewMap', 'cannotMoveDirectly', 'defaultGround', 'images', 'ratio', 'upFloor', 'downFloor', 'bgm', 'color', 'weather', 'underGround']*/; /*Floor_Meta_List ['title','name','canFlyTo', 'canUseQuickShop', 'cannotViewMap', 'cannotMoveDirectly', 'defaultGround', 'images', 'ratio', 'upFloor', 'downFloor', 'bgm', 'color', 'weather', 'underGround']*/;
Global_Attribute_List Global_Attribute_List
: '全局字体'|'横屏左侧状态栏背景'|'竖屏上方状态栏背景'|'竖屏下方道具栏背景'|'边框颜色'|'状态栏文字色'|'楼层转换背景'|'楼层转换文字色'|'装备列表' : '全局字体'|'横屏左侧状态栏背景'|'竖屏上方状态栏背景'|'竖屏下方道具栏背景'|'边框颜色'|'状态栏文字色'|'楼层转换样式'|'装备列表'
/*Global_Attribute_List ['font','statusLeftBackground','statusTopBackground', 'toolsBackground', 'borderColor', 'statusBarColor', 'floorChangingBackground', 'floorChangingTextColor', 'equipName']*/; /*Global_Attribute_List ['font','statusLeftBackground','statusTopBackground', 'toolsBackground', 'borderColor', 'statusBarColor', 'floorChangingStyle', 'equipName']*/;
Global_Value_List Global_Value_List
: '血网伤害'|'中毒伤害'|'衰弱效果'|'红宝石效果'|'蓝宝石效果'|'绿宝石效果'|'红血瓶效果'|'蓝血瓶效果'|'黄血瓶效果'|'绿血瓶效果'|'破甲比例'|'反击比例'|'净化比例'|'仇恨增加值'|'动画时间' : '血网伤害'|'中毒伤害'|'衰弱效果'|'红宝石效果'|'蓝宝石效果'|'绿宝石效果'|'红血瓶效果'|'蓝血瓶效果'|'黄血瓶效果'|'绿血瓶效果'|'破甲比例'|'反击比例'|'净化比例'|'仇恨增加值'|'动画时间'

View File

@ -104,6 +104,14 @@ ActionParser.prototype.parse = function (obj,type) {
if(!obj) obj={}; if(!obj) obj={};
return MotaActionBlocks['faceIds_m'].xmlText([obj.up||"", obj.down||"", obj.left||"", obj.right||""]); return MotaActionBlocks['faceIds_m'].xmlText([obj.up||"", obj.down||"", obj.left||"", obj.right||""]);
case 'mainStyle':
if(!obj) obj={};
return MotaActionBlocks['mainStyle_m'].xmlText([
obj.startBackground, obj.startLogoStyle, obj.startButtonsStyle, obj.statusLeftBackground, obj.statusTopBackground,
obj.toolsBackground, obj.floorChangingStyle,
obj.statusBarColor, 'rgba('+obj.statusBarColor+')', obj.borderColor, 'rgba('+obj.borderColor+')', obj.font
]);
case 'shop': case 'shop':
var buildsub = function(obj,parser,next){ var buildsub = function(obj,parser,next){
var text_choices = null; var text_choices = null;
@ -568,7 +576,7 @@ ActionParser.prototype.parseAction = function() {
break; break;
case "setFloor": case "setFloor":
this.next = MotaActionBlocks['setFloor_s'].xmlText([ this.next = MotaActionBlocks['setFloor_s'].xmlText([
data.name, data.floorId||null, data.value, this.next]); data.name, data.floorId||null, JSON.stringify(data.value), this.next]);
break; break;
case "setGlobalAttribute": case "setGlobalAttribute":
this.next = MotaActionBlocks['setGlobalAttribute_s'].xmlText([ this.next = MotaActionBlocks['setGlobalAttribute_s'].xmlText([
@ -1222,7 +1230,7 @@ MotaActionFunctions.pattern=MotaActionFunctions.pattern||{};
MotaActionFunctions.pattern.id=/^(flag|global):([a-zA-Z0-9_\u4E00-\u9FCC]+)$/; MotaActionFunctions.pattern.id=/^(flag|global):([a-zA-Z0-9_\u4E00-\u9FCC]+)$/;
MotaActionFunctions.pattern.id2=/^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+),flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/; MotaActionFunctions.pattern.id2=/^flag:([a-zA-Z0-9_\u4E00-\u9FCC]+),flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)$/;
MotaActionFunctions.pattern.idWithoutFlag=/^[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/; MotaActionFunctions.pattern.idWithoutFlag=/^[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/;
MotaActionFunctions.pattern.colorRe=/^(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(,0(\.\d+)?|,1)?$/; MotaActionFunctions.pattern.colorRe=/^[0-9 ]+,[0-9 ]+,[0-9 ]+(,[0-9. ]+)?$/;
MotaActionFunctions.pattern.fontRe=/^(italic )?(bold )?(\d+)px ([a-zA-Z0-9_\u4E00-\u9FCC]+)$/; MotaActionFunctions.pattern.fontRe=/^(italic )?(bold )?(\d+)px ([a-zA-Z0-9_\u4E00-\u9FCC]+)$/;

View File

@ -595,7 +595,7 @@ Blockly.FieldColour.prototype.createWidget_ = function() {
var getValue=function(){ var getValue=function(){
// return self.getValue() // css颜色 // return self.getValue() // css颜色
var f = pb.getFieldValue(targetf); var f = pb.getFieldValue(targetf);
if (/^(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(,0(\.\d+)?|,1)?$/.test(f)) { if (/^[0-9 ]+,[0-9 ]+,[0-9 ]+(,[0-9. ]+)?$/.test(f)) {
return f; return f;
} }
return ""; return "";
@ -656,7 +656,7 @@ Blockly.FieldTextInput.prototype.showInlineEditor_ = function(quietInput) {
// 给inputDom绑事件 // 给inputDom绑事件
inputDom.oninput=function(){ inputDom.oninput=function(){
var value=inputDom.value var value=inputDom.value
if(/[0-9 ]+,[0-9 ]+,[0-9 ]+(,[0-9. ]+)?/.test(value)){ if(/^[0-9 ]+,[0-9 ]+,[0-9 ]+(,[0-9. ]+)?$/.test(value)){
setValue('rgba('+value+')') setValue('rgba('+value+')')
} }
} }

View File

@ -82,6 +82,7 @@ editor_blocklyconfig=(function(){
"time": 160, "openSound": "door.mp3", "closeSound": "door.mp3", "keys": {"yellowKey": 1, "orangeKey": 1} "time": 160, "openSound": "door.mp3", "closeSound": "door.mp3", "keys": {"yellowKey": 1, "orangeKey": 1}
}, 'doorInfo'), }, 'doorInfo'),
MotaActionBlocks['faceIds_m'].xmlText(), MotaActionBlocks['faceIds_m'].xmlText(),
MotaActionBlocks['mainStyle_m'].xmlText(),
], ],
'显示文字':[ '显示文字':[
MotaActionBlocks['text_0_s'].xmlText(), MotaActionBlocks['text_0_s'].xmlText(),

View File

@ -451,7 +451,7 @@ editor_table_wrapper = function (editor) {
editor_table.prototype.selectColor = function (input) { editor_table.prototype.selectColor = function (input) {
if (input.value != null) { if (input.value != null) {
var str = input.value.toString().replace(/[^\d.,]/g, ''); var str = input.value.toString().replace(/[^\d.,]/g, '');
if (/^(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(,0(\.\d+)?|,1)?$/.test(str)) { if (/^[0-9 ]+,[0-9 ]+,[0-9 ]+(,[0-9. ]+)?$/.test(str)) {
document.getElementById('colorPicker').value = str; document.getElementById('colorPicker').value = str;
} }
} }

View File

@ -109,27 +109,6 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_docs": "文件映射", "_docs": "文件映射",
"_data": "文件名映射目前仅对images, animates, bgms, sounds有效。\n例如定义 {\"精灵石.mp3\":\"jinglingshi.mp3\"} 就可以使用\ncore.playBgm(\"精灵石.mp3\") 或对应的事件来播放该bgm。" "_data": "文件名映射目前仅对images, animates, bgms, sounds有效。\n例如定义 {\"精灵石.mp3\":\"jinglingshi.mp3\"} 就可以使用\ncore.playBgm(\"精灵石.mp3\") 或对应的事件来播放该bgm。"
}, },
"startBackground": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "标题背景",
"_data": "标题界面的背景建议使用jpg格式以压缩背景图空间"
},
"startLogoStyle": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "标题样式",
"_data": "标题样式:可以改变颜色,也可以写\"display: none\"来隐藏标题"
},
"startButtonsStyle": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "标题按钮样式",
"_data": "标题界面按钮的样式caret-color指的是当前选中项的边框颜色"
},
"levelChoose": { "levelChoose": {
"_leaf": true, "_leaf": true,
"_type": "event", "_type": "event",
@ -153,61 +132,12 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_docs": "标题音乐", "_docs": "标题音乐",
"_data": "在标题界面应该播放的bgm内容" "_data": "在标题界面应该播放的bgm内容"
}, },
"statusLeftBackground": { "styles": {
"_leaf": true, "_leaf": true,
"_type": "textarea", "_type": "event",
"_string": true, "_event": "mainStyle",
"_docs": "横状态栏", "_docs": "主样式",
"_data": "横屏时左侧状态栏的背景样式,可以定义背景图、平铺方式等。\n具体请网上搜索\"css background\"了解写法。\n如果弄一张图片作为背景图推荐写法\n\"url(project/images/XXX.png) 0 0/100% 100% no-repeat\"\n图片最好进行一些压缩等操作节省流量。" "_data": "主要样式设置,包括标题、按钮、状态栏等的背景色等"
},
"statusTopBackground": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "竖状态栏",
"_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,
"_docs": "竖工具栏",
"_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,
"_docs": "边框色",
"_data": "边框颜色,包括游戏边界的边框和对话框边框等。"
},
"statusBarColor": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "状态栏文字色",
"_data": "状态栏的文字颜色,默认是白色"
},
"floorChangingBackground": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "转场背景",
"_data": "楼层转换界面的背景样式可以使用纯色默认值black也可以使用图片参见状态栏的图片写法"
},
"floorChangingTextColor": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "转场文字",
"_data": "楼层转换界面的文字颜色,默认是白色"
},
"font": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "全局字体",
"_data": "游戏中使用的字体默认是Verdana"
} }
} }
}, },

View File

@ -2063,12 +2063,17 @@ control.prototype.getRealStatusOrDefault = function (status, name) {
////// 设置某个属性的增幅值 ////// ////// 设置某个属性的增幅值 //////
control.prototype.setBuff = function (name, value) { control.prototype.setBuff = function (name, value) {
// 仅保留三位有效buff值
value = parseFloat(value.toFixed(3));
this.setFlag('__'+name+'_buff__', value); this.setFlag('__'+name+'_buff__', value);
} }
////// 加减某个属性的增幅值 ////// ////// 加减某个属性的增幅值 //////
control.prototype.addBuff = function (name, value) { control.prototype.addBuff = function (name, value) {
this.setFlag('__'+name+'_buff__', this.getBuff(name) + value); var buff = this.getBuff(name) + value;
// 仅保留三位有效buff值
buff = parseFloat(buff.toFixed(3));
this.setFlag('__'+name+'_buff__', buff);
} }
////// 获得某个属性的增幅值 ////// ////// 获得某个属性的增幅值 //////
@ -2530,61 +2535,6 @@ control.prototype.updateHeroIcon = function (name) {
core.statusBar.image.name.src = canvas.toDataURL("image/png"); core.statusBar.image.name.src = canvas.toDataURL("image/png");
} }
control.prototype.updateGlobalAttribute = function (name) {
if (name == null) name = Object.keys(core.status.globalAttribute);
if (name instanceof Array) {
name.forEach(function (t) {
core.control.updateGlobalAttribute(t);
});
return;
}
var attribute = core.status.globalAttribute || core.initStatus.globalAttribute;
if (attribute == null) return;
switch (name) {
case 'statusLeftBackground':
if (!core.domStyle.isVertical) {
core.dom.statusBar.style.background = attribute[name];
}
break;
case 'statusTopBackground':
if (core.domStyle.isVertical) {
core.dom.statusBar.style.background = attribute[name];
}
break;
case 'toolsBackground':
if (core.domStyle.isVertical) {
core.dom.toolBar.style.background = attribute[name];
}
break;
case 'borderColor':
{
var border = '3px ' + attribute[name] + ' solid';
core.dom.statusBar.style.borderTop = border;
core.dom.statusBar.style.borderLeft = border;
core.dom.statusBar.style.borderRight = core.domStyle.isVertical?border:'';
core.dom.statusBar.style.borderBottom = core.domStyle.isVertical?'':border;
core.dom.gameDraw.style.border = border;
core.dom.toolBar.style.borderLeft = border;
core.dom.toolBar.style.borderRight = core.domStyle.isVertical?border:'';
core.dom.toolBar.style.borderBottom = core.domStyle.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 'floorChangingBackground':
core.dom.floorMsgGroup.style.background = attribute[name];
break;
case 'floorChangingTextColor':
core.dom.floorMsgGroup.style.color = attribute[name];
break;
}
}
////// 改变工具栏为按钮1-8 ////// ////// 改变工具栏为按钮1-8 //////
control.prototype.setToolbarButton = function (useButton) { control.prototype.setToolbarButton = function (useButton) {
if (!core.domStyle.showStatusBar) { if (!core.domStyle.showStatusBar) {
@ -2731,7 +2681,7 @@ control.prototype.resize = function() {
BAR_WIDTH: BAR_WIDTH, BAR_WIDTH: BAR_WIDTH,
outerSize: CANVAS_WIDTH * core.domStyle.scale + 2 * BORDER, outerSize: CANVAS_WIDTH * core.domStyle.scale + 2 * BORDER,
globalAttribute: globalAttribute, globalAttribute: globalAttribute,
border: '3px ' + globalAttribute.borderColor + ' solid', border: '3px ' + core.arrayToRGBA(globalAttribute.borderColor) + ' solid',
statusDisplayArr: statusDisplayArr, statusDisplayArr: statusDisplayArr,
count: count, count: count,
col: col, col: col,
@ -2762,10 +2712,9 @@ control.prototype._resize_gameGroup = function (obj) {
gameGroup.style.top = (obj.clientHeight - totalHeight) / 2 + "px"; gameGroup.style.top = (obj.clientHeight - totalHeight) / 2 + "px";
// floorMsgGroup // floorMsgGroup
var floorMsgGroup = core.dom.floorMsgGroup; var floorMsgGroup = core.dom.floorMsgGroup;
floorMsgGroup.style = obj.globalAttribute.floorChangingStyle;
floorMsgGroup.style.width = obj.outerSize - 2 * obj.BORDER + "px"; floorMsgGroup.style.width = obj.outerSize - 2 * obj.BORDER + "px";
floorMsgGroup.style.height = totalHeight - 2 * obj.BORDER + "px"; floorMsgGroup.style.height = totalHeight - 2 * obj.BORDER + "px";
floorMsgGroup.style.background = obj.globalAttribute.floorChangingBackground;
floorMsgGroup.style.color = obj.globalAttribute.floorChangingTextColor;
// musicBtn // musicBtn
if (core.domStyle.isVertical || core.domStyle.scale < 1) { if (core.domStyle.isVertical || core.domStyle.scale < 1) {
core.dom.musicBtn.style.right = core.dom.musicBtn.style.bottom = "3px"; core.dom.musicBtn.style.right = core.dom.musicBtn.style.bottom = "3px";

View File

@ -191,14 +191,13 @@ function core() {
}, },
"globalAttribute": { "globalAttribute": {
'equipName': main.equipName || [], 'equipName': main.equipName || [],
"statusLeftBackground": main.statusLeftBackground || "url(project/materials/ground.png) repeat", "statusLeftBackground": main.styles.statusLeftBackground || "url(project/materials/ground.png) repeat",
"statusTopBackground": main.statusTopBackground || "url(project/materials/ground.png) repeat", "statusTopBackground": main.styles.statusTopBackground || "url(project/materials/ground.png) repeat",
"toolsBackground": main.toolsBackground || "url(project/materials/ground.png) repeat", "toolsBackground": main.styles.toolsBackground || "url(project/materials/ground.png) repeat",
"borderColor": main.borderColor || "white", "borderColor": main.styles.borderColor || [204,204,204,1],
"statusBarColor": main.statusBarColor || "white", "statusBarColor": main.styles.statusBarColor || [255,255,255,1],
"floorChangingBackground": main.floorChangingBackground || "black", "floorChangingStyle": main.styles.floorChangingStyle || "background-color: black; color: white",
"floorChangingTextColor": main.floorChangingTextColor || "white", "font": main.styles.font || "Verdana"
"font": main.font || "Verdana"
}, },
'curtainColor': null, 'curtainColor': null,
'openingDoor': null, 'openingDoor': null,

View File

@ -2579,7 +2579,7 @@ events.prototype.setEnemy = function (id, name, value, prefix) {
////// 设置楼层属性 ////// ////// 设置楼层属性 //////
events.prototype.setFloorInfo = function (name, value, floorId, prefix) { events.prototype.setFloorInfo = function (name, value, floorId, prefix) {
floorId = floorId || core.status.floorId; floorId = floorId || core.status.floorId;
core.status.maps[floorId][name] = core.calValue(value, prefix); core.status.maps[floorId][name] = value;
core.updateStatusBar(); core.updateStatusBar();
} }
@ -2592,10 +2592,14 @@ events.prototype.setGlobalAttribute = function (name, value) {
// --- 检查 [] // --- 检查 []
if (value.charAt(0) == '[' && value.charAt(value.length - 1) == ']') if (value.charAt(0) == '[' && value.charAt(value.length - 1) == ']')
value = eval(value); value = eval(value);
// --- 检查颜色
if (/^[0-9 ]+,[0-9 ]+,[0-9 ]+(,[0-9. ]+)?$/.test(value)) {
value = 'rgba(' + value + ')';
}
} }
core.status.globalAttribute[name] = value; core.status.globalAttribute[name] = value;
core.updateGlobalAttribute(name);
core.setFlag('globalAttribute', core.status.globalAttribute); core.setFlag('globalAttribute', core.status.globalAttribute);
core.resize();
} }
////// 设置全局开关 ////// ////// 设置全局开关 //////

View File

@ -108,9 +108,9 @@ ui.prototype.fillBoldText = function (name, text, x, y, style, strokeStyle, font
if (!ctx) return; if (!ctx) return;
if (font) ctx.font = font; if (font) ctx.font = font;
if (!style) style = ctx.fillStyle; if (!style) style = ctx.fillStyle;
if (style instanceof Array) style = core.arrayToRGBA(style); style = core.arrayToRGBA(style);
if (!strokeStyle) strokeStyle = '#000000'; if (!strokeStyle) strokeStyle = '#000000';
if (strokeStyle instanceof Array) strokeStyle = core.arrayToRGBA(strokeStyle); strokeStyle = core.arrayToRGBA(strokeStyle);
ctx.fillStyle = strokeStyle; ctx.fillStyle = strokeStyle;
ctx.fillText(text, x-1, y-1); ctx.fillText(text, x-1, y-1);
ctx.fillText(text, x-1, y+1); ctx.fillText(text, x-1, y+1);
@ -392,15 +392,13 @@ ui.prototype.setOpacity = function (name, opacity) {
////// 设置某个canvas的绘制属性如颜色等 ////// ////// 设置某个canvas的绘制属性如颜色等 //////
ui.prototype.setFillStyle = function (name, style) { ui.prototype.setFillStyle = function (name, style) {
var ctx = this.getContextByName(name); var ctx = this.getContextByName(name);
if (style instanceof Array) style = core.arrayToRGBA(style); if (ctx) ctx.fillStyle = core.arrayToRGBA(style);
if (ctx) ctx.fillStyle = style;
} }
////// 设置某个canvas边框属性 ////// ////// 设置某个canvas边框属性 //////
ui.prototype.setStrokeStyle = function (name, style) { ui.prototype.setStrokeStyle = function (name, style) {
var ctx = this.getContextByName(name); var ctx = this.getContextByName(name);
if (style instanceof Array) style = core.arrayToRGBA(style); if (ctx) ctx.strokeStyle = core.arrayToRGBA(style);
if (ctx) ctx.strokeStyle = style;
} }
////// 设置某个canvas的对齐 ////// ////// 设置某个canvas的对齐 //////
@ -921,7 +919,7 @@ ui.prototype._drawBackground_drawWindowSkin = function (background, left, top, r
ui.prototype._drawBackground_drawColor = function (background, left, top, right, bottom, position, px, py, xoffset, yoffset) { ui.prototype._drawBackground_drawColor = function (background, left, top, right, bottom, position, px, py, xoffset, yoffset) {
var alpha = background[3]; var alpha = background[3];
core.setAlpha('ui', alpha); core.setAlpha('ui', alpha);
core.setStrokeStyle('ui', core.status.globalAttribute.borderColor); core.setStrokeStyle('ui', core.arrayToRGBA(core.status.globalAttribute.borderColor));
core.setFillStyle('ui', core.arrayToRGB(background)); core.setFillStyle('ui', core.arrayToRGB(background));
core.setLineWidth('ui', 2); core.setLineWidth('ui', 2);
// 绘制 // 绘制
@ -1010,8 +1008,7 @@ ui.prototype.drawTextContent = function (ctx, content, config) {
config.left = config.left || 0; config.left = config.left || 0;
config.right = config.left + (config.maxWidth == null ? (ctx != null ? ctx.canvas.width : core.__PIXELS__) : config.maxWidth) config.right = config.left + (config.maxWidth == null ? (ctx != null ? ctx.canvas.width : core.__PIXELS__) : config.maxWidth)
config.top = config.top || 0; config.top = config.top || 0;
config.color = config.color || textAttribute.text; config.color = core.arrayToRGBA(config.color || textAttribute.text);
if (config.color instanceof Array) config.color = core.arrayToRGBA(config.color);
if (config.bold == null) config.bold = textAttribute.bold; if (config.bold == null) config.bold = textAttribute.bold;
config.italic = false; config.italic = false;
config.align = config.align || textAttribute.align || "left"; config.align = config.align || textAttribute.align || "left";
@ -1585,8 +1582,7 @@ ui.prototype._drawChoices_drawChoices = function (choices, isWindowSkin, hPos, v
core.setTextAlign('ui', 'center'); core.setTextAlign('ui', 'center');
core.setFont('ui', this._buildFont(17, true)); core.setFont('ui', this._buildFont(17, true));
for (var i = 0; i < choices.length; i++) { for (var i = 0; i < choices.length; i++) {
var color = choices[i].color || core.status.textAttribute.text; var color = core.arrayToRGBA(choices[i].color || core.status.textAttribute.text);
if (color instanceof Array) color = core.arrayToRGBA(color);
core.setFillStyle('ui', color); core.setFillStyle('ui', color);
var offset = this.HPIXEL; var offset = this.HPIXEL;
if (choices[i].icon) { if (choices[i].icon) {
@ -1994,7 +1990,7 @@ ui.prototype.drawBookDetail = function (index) {
core.fillRect('data', left, top, width, height, '#000000'); core.fillRect('data', left, top, width, height, '#000000');
core.setAlpha('data', 1); core.setAlpha('data', 1);
core.strokeRect('data', left - 1, top - 1, width + 1, height + 1, core.strokeRect('data', left - 1, top - 1, width + 1, height + 1,
core.status.globalAttribute.borderColor, 2); core.arrayToRGBA(core.status.globalAttribute.borderColor), 2);
this._drawBookDetail_drawContent(enemy, content, {top: top, content_left: content_left, bottom: bottom, validWidth: validWidth}); this._drawBookDetail_drawContent(enemy, content, {top: top, content_left: content_left, bottom: bottom, validWidth: validWidth});
} }

View File

@ -401,6 +401,7 @@ utils.prototype.formatSize = function (size) {
utils.prototype.formatBigNumber = function (x, onMap) { utils.prototype.formatBigNumber = function (x, onMap) {
x = Math.floor(parseFloat(x)); x = Math.floor(parseFloat(x));
if (!core.isset(x)) return '???'; if (!core.isset(x)) return '???';
if (x > 1e24 || x < -1e24) return x;
var c = x < 0 ? "-" : ""; var c = x < 0 ? "-" : "";
x = Math.abs(x); x = Math.abs(x);
@ -436,12 +437,14 @@ utils.prototype.formatBigNumber = function (x, onMap) {
////// 数组转RGB ////// ////// 数组转RGB //////
utils.prototype.arrayToRGB = function (color) { utils.prototype.arrayToRGB = function (color) {
if (!(color instanceof Array)) return color;
var nowR = this.clamp(parseInt(color[0]), 0, 255), nowG = this.clamp(parseInt(color[1]), 0, 255), var nowR = this.clamp(parseInt(color[0]), 0, 255), nowG = this.clamp(parseInt(color[1]), 0, 255),
nowB = this.clamp(parseInt(color[2]), 0, 255); nowB = this.clamp(parseInt(color[2]), 0, 255);
return "#" + ((1 << 24) + (nowR << 16) + (nowG << 8) + nowB).toString(16).slice(1); return "#" + ((1 << 24) + (nowR << 16) + (nowG << 8) + nowB).toString(16).slice(1);
} }
utils.prototype.arrayToRGBA = function (color) { utils.prototype.arrayToRGBA = function (color) {
if (!(color instanceof Array)) return color;
if (color[3] == null) color[3] = 1; if (color[3] == null) color[3] = 1;
var nowR = this.clamp(parseInt(color[0]), 0, 255), nowG = this.clamp(parseInt(color[1]), 0, 255), var nowR = this.clamp(parseInt(color[0]), 0, 255), nowG = this.clamp(parseInt(color[1]), 0, 255),
nowB = this.clamp(parseInt(color[2]), 0, 255), nowA = this.clamp(parseFloat(color[3]), 0, 1); nowB = this.clamp(parseInt(color[2]), 0, 255), nowA = this.clamp(parseFloat(color[3]), 0, 1);

View File

@ -200,9 +200,9 @@ main.prototype.init = function (mode, callback) {
var mainData = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main; var mainData = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main;
for(var ii in mainData)main[ii]=mainData[ii]; for(var ii in mainData)main[ii]=mainData[ii];
main.dom.startBackground.src = main.startBackground; main.dom.startBackground.src = main.styles.startBackground;
main.dom.startLogo.style=main.startLogoStyle; main.dom.startLogo.style=main.styles.startLogoStyle;
main.dom.startButtonGroup.style = main.startButtonsStyle; main.dom.startButtonGroup.style = main.styles.startButtonsStyle;
main.levelChoose = main.levelChoose || []; main.levelChoose = main.levelChoose || [];
main.levelChoose.forEach(function (value) { main.levelChoose.forEach(function (value) {
var span = document.createElement('span'); var span = document.createElement('span');

View File

@ -41,8 +41,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"背景图.jpg": "bg.jpg", "背景图.jpg": "bg.jpg",
"背景音乐.mp3": "bgm.mp3" "背景音乐.mp3": "bgm.mp3"
}, },
"startBackground": "project/images/bg.jpg",
"startLogoStyle": "color: black",
"levelChoose": [ "levelChoose": [
{ {
"title": "简单", "title": "简单",
@ -73,15 +71,18 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"盾牌" "盾牌"
], ],
"startBgm": null, "startBgm": null,
"styles": {
"startBackground": "project/images/bg.jpg",
"startLogoStyle": "color: black",
"startButtonsStyle": "background-color: #32369F; opacity: 0.85; color: #FFFFFF; border: #FFFFFF 2px solid; caret-color: #FFD700;",
"statusLeftBackground": "url(project/materials/ground.png) repeat", "statusLeftBackground": "url(project/materials/ground.png) repeat",
"statusTopBackground": "url(project/materials/ground.png) repeat", "statusTopBackground": "url(project/materials/ground.png) repeat",
"toolsBackground": "url(project/materials/ground.png) repeat", "toolsBackground": "url(project/materials/ground.png) repeat",
"borderColor": "#CCCCCC", "borderColor": [204,204,204,1],
"statusBarColor": "white", "statusBarColor": [255,255,255,1],
"floorChangingBackground": "black", "floorChangingStyle": "background-color: black; color: white",
"floorChangingTextColor": "white", "font": "Verdana"
"font": "Verdana", }
"startButtonsStyle": "background-color: #32369F; opacity: 0.85; color: #FFFFFF; border: #FFFFFF 2px solid; caret-color: #FFD700;"
}, },
"firstData": { "firstData": {
"title": "魔塔样板", "title": "魔塔样板",

View File

@ -41,7 +41,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core._init_sys_flags(); core._init_sys_flags();
// 初始化界面,状态栏等 // 初始化界面,状态栏等
core.resize(); core.resize();
core.updateGlobalAttribute();
// 状态栏是否显示 // 状态栏是否显示
if (core.hasFlag('hideStatusBar')) if (core.hasFlag('hideStatusBar'))
core.hideStatusBar(core.hasFlag('showToolbox')); core.hideStatusBar(core.hasFlag('showToolbox'));
@ -939,7 +938,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
var toAttribute = core.getFlag('globalAttribute', core.status.globalAttribute); var toAttribute = core.getFlag('globalAttribute', core.status.globalAttribute);
if (!core.same(toAttribute, core.status.globalAttribute)) { if (!core.same(toAttribute, core.status.globalAttribute)) {
core.status.globalAttribute = toAttribute; core.status.globalAttribute = toAttribute;
core.updateGlobalAttribute(); core.resize();
} }
// 重置音量 // 重置音量
core.events.setVolume(core.getFlag("__volume__", 1), 0); core.events.setVolume(core.getFlag("__volume__", 1), 0);

3
runtime.d.ts vendored
View File

@ -221,8 +221,7 @@ type gameStatus = {
toolsBackground: string toolsBackground: string
borderColor: string borderColor: string
statusBarColor: string statusBarColor: string
floorChangingBackground: string floorChangingStyle: string
floorChangingTextColor: string
font: string font: string
} }
curtainColor: null curtainColor: null