setGlobalAttribute & setGlobalValue
This commit is contained in:
parent
dd3f7863a7
commit
d727a4d9d1
@ -214,6 +214,8 @@ action
|
|||||||
| tip_s
|
| tip_s
|
||||||
| setValue_s
|
| setValue_s
|
||||||
| setFloor_s
|
| setFloor_s
|
||||||
|
| setGlobalAttribute_s
|
||||||
|
| setGlobalValue_s
|
||||||
| show_s
|
| show_s
|
||||||
| hide_s
|
| hide_s
|
||||||
| trigger_s
|
| trigger_s
|
||||||
@ -437,6 +439,34 @@ return code;
|
|||||||
*/;
|
*/;
|
||||||
|
|
||||||
|
|
||||||
|
setGlobalAttribute_s
|
||||||
|
: '设置全局属性' ':' Global_Attribute_List '值' EvalString Newline
|
||||||
|
|
||||||
|
|
||||||
|
/* setGlobalAttribute_s
|
||||||
|
tooltip : setGlobalAttribute:设置全局属性
|
||||||
|
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 : ["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=setFloor%ef%bc%9a%e8%ae%be%e7%bd%ae%e6%a5%bc%e5%b1%82%e5%b1%9e%e6%80%a7
|
||||||
|
default : ["lavaDamage","100"]
|
||||||
|
colour : this.dataColor
|
||||||
|
var code = '{"type": "setGlobalValue", "name": "'+Global_Value_List_0+'", "value": '+EvalString_0+'},\n';
|
||||||
|
return code;
|
||||||
|
*/;
|
||||||
|
|
||||||
|
|
||||||
show_s
|
show_s
|
||||||
: '显示事件' 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? '动画时间' Int? Newline
|
: '显示事件' 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? '动画时间' Int? Newline
|
||||||
|
|
||||||
@ -1583,6 +1613,14 @@ Floor_Meta_List
|
|||||||
: '楼层中文名'|'状态栏名称'|'能否使用楼传'|'能否打开快捷商店'|'是否不可浏览地图'|'默认地面ID'|'楼层贴图'|'宝石血瓶效果'|'上楼点坐标'|'下楼点坐标'|'背景音乐'|'画面色调'|'天气和强度'|'是否地下层'
|
: '楼层中文名'|'状态栏名称'|'能否使用楼传'|'能否打开快捷商店'|'是否不可浏览地图'|'默认地面ID'|'楼层贴图'|'宝石血瓶效果'|'上楼点坐标'|'下楼点坐标'|'背景音乐'|'画面色调'|'天气和强度'|'是否地下层'
|
||||||
/*Floor_Meta_List ['title','name','canFlyTo', 'canUseQuickShop', 'cannotViewMap', 'defaultGround', 'images', 'item_ratio', 'upFloor', 'downFloor', 'bgm', 'color', 'weather', 'underGround']*/;
|
/*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'
|
Bool: 'TRUE'
|
||||||
| 'FALSE'
|
| 'FALSE'
|
||||||
;
|
;
|
||||||
@ -2064,6 +2102,14 @@ ActionParser.prototype.parseAction = function() {
|
|||||||
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, data.value, this.next]);
|
||||||
break;
|
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":
|
case "input":
|
||||||
this.next = MotaActionBlocks['input_s'].xmlText([
|
this.next = MotaActionBlocks['input_s'].xmlText([
|
||||||
data.text,this.next]);
|
data.text,this.next]);
|
||||||
|
|||||||
@ -353,11 +353,6 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
|||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
"_data": "绿血瓶加血数值"
|
"_data": "绿血瓶加血数值"
|
||||||
},
|
},
|
||||||
"moneyPocket": {
|
|
||||||
"_leaf": true,
|
|
||||||
"_type": "textarea",
|
|
||||||
"_data": "金钱袋加金币的数值"
|
|
||||||
},
|
|
||||||
"breakArmor": {
|
"breakArmor": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
|
|||||||
@ -84,6 +84,8 @@ editor_blockly = function () {
|
|||||||
MotaActionBlocks['idString_1_e'].xmlText(['status','hp'])
|
MotaActionBlocks['idString_1_e'].xmlText(['status','hp'])
|
||||||
]),
|
]),
|
||||||
MotaActionBlocks['setFloor_s'].xmlText(),
|
MotaActionBlocks['setFloor_s'].xmlText(),
|
||||||
|
MotaActionBlocks['setGlobalAttribute_s'].xmlText(),
|
||||||
|
MotaActionBlocks['setGlobalValue_s'].xmlText(),
|
||||||
MotaActionBlocks['input_s'].xmlText(),
|
MotaActionBlocks['input_s'].xmlText(),
|
||||||
MotaActionBlocks['input2_s'].xmlText(),
|
MotaActionBlocks['input2_s'].xmlText(),
|
||||||
MotaActionBlocks['update_s'].xmlText(),
|
MotaActionBlocks['update_s'].xmlText(),
|
||||||
|
|||||||
@ -2447,6 +2447,11 @@ control.prototype.loadData = function (data, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
core.status.textAttribute = core.getFlag('textAttribute', core.status.textAttribute);
|
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
|
// load icons
|
||||||
var icon = core.getFlag("heroIcon", "hero.png");
|
var icon = core.getFlag("heroIcon", "hero.png");
|
||||||
@ -2685,7 +2690,7 @@ control.prototype.updateStatusBar = function () {
|
|||||||
|
|
||||||
// 回放
|
// 回放
|
||||||
if (core.status.replay.replaying) {
|
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.book.style.opacity = 1;
|
||||||
|
|
||||||
core.statusBar.image.fly.src = core.statusBar.icons.stop.src;
|
core.statusBar.image.fly.src = core.statusBar.icons.stop.src;
|
||||||
@ -2704,11 +2709,11 @@ control.prototype.updateStatusBar = function () {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.statusBar.image.book.src = core.statusBar.icons.book.src;
|
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) {
|
if (!core.flags.equipboxButton) {
|
||||||
core.statusBar.image.fly.src = core.statusBar.icons.fly.src;
|
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 {
|
else {
|
||||||
core.statusBar.image.fly.src = core.statusBar.icons.equipbox.src;
|
core.statusBar.image.fly.src = core.statusBar.icons.equipbox.src;
|
||||||
@ -2747,6 +2752,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) {
|
control.prototype.resize = function(clientWidth, clientHeight) {
|
||||||
if (main.mode=='editor')return;
|
if (main.mode=='editor')return;
|
||||||
@ -3156,9 +3219,7 @@ control.prototype.domRenderer = function(){
|
|||||||
var className = styles[i].className
|
var className = styles[i].className
|
||||||
for(var j=0; j<core.dom[className].length; j++)
|
for(var j=0; j<core.dom[className].length; j++)
|
||||||
for(var k=0; k<rulesProp.length; k++) {
|
for(var k=0; k<rulesProp.length; k++) {
|
||||||
var one = core.dom[className][j];
|
core.dom[className][j].style[rulesProp[k]] = rules[rulesProp[k]];
|
||||||
if (one.id !== styles[i].noid)
|
|
||||||
one.style[rulesProp[k]] = rules[rulesProp[k]];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(styles[i].hasOwnProperty('id')){
|
if(styles[i].hasOwnProperty('id')){
|
||||||
|
|||||||
@ -890,12 +890,20 @@ events.prototype.doAction = function() {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "setFloor":
|
case "setFloor":
|
||||||
{
|
core.status.maps[data.floorId||core.status.floorId][data.name] = core.calValue(data.value);
|
||||||
core.status.maps[data.floorId||core.status.floorId][data.name] = core.calValue(data.value);
|
core.updateStatusBar();
|
||||||
core.updateStatusBar();
|
this.doAction();
|
||||||
this.doAction();
|
break;
|
||||||
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":
|
case "setHeroIcon":
|
||||||
{
|
{
|
||||||
this.setHeroIcon(data.name);
|
this.setHeroIcon(data.name);
|
||||||
|
|||||||
@ -1313,7 +1313,7 @@ ui.prototype.drawPagination = function (page, totalPage, top) {
|
|||||||
if (totalPage<=1) return;
|
if (totalPage<=1) return;
|
||||||
if (!core.isset(top)) top=12;
|
if (!core.isset(top)) top=12;
|
||||||
|
|
||||||
var globalFont = core.status.globalAttribute.font;
|
var globalFont = (core.status.globalAttribute||core.initStatus.globalAttribute).font;
|
||||||
core.setFont('ui', 'bold 15px '+globalFont);
|
core.setFont('ui', 'bold 15px '+globalFont);
|
||||||
core.setFillStyle('ui', '#DDDDDD');
|
core.setFillStyle('ui', '#DDDDDD');
|
||||||
|
|
||||||
@ -2107,7 +2107,7 @@ ui.prototype.drawSLPanel = function(index, refresh) {
|
|||||||
|
|
||||||
var strokeColor = '#FFD700';
|
var strokeColor = '#FFD700';
|
||||||
if (core.status.event.selection) strokeColor = '#FF6A6A';
|
if (core.status.event.selection) strokeColor = '#FF6A6A';
|
||||||
var globalFont = core.status.globalAttribute.font;
|
var globalFont = (core.status.globalAttribute||core.initStatus.globalAttribute).font;
|
||||||
|
|
||||||
var drawBg = function() {
|
var drawBg = function() {
|
||||||
core.clearMap('ui');
|
core.clearMap('ui');
|
||||||
|
|||||||
@ -213,7 +213,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"bluePotion": 250,
|
"bluePotion": 250,
|
||||||
"yellowPotion": 500,
|
"yellowPotion": 500,
|
||||||
"greenPotion": 800,
|
"greenPotion": 800,
|
||||||
"moneyPocket": 500,
|
|
||||||
"breakArmor": 0.9,
|
"breakArmor": 0.9,
|
||||||
"counterAttack": 0.1,
|
"counterAttack": 0.1,
|
||||||
"purify": 3,
|
"purify": 3,
|
||||||
|
|||||||
@ -327,7 +327,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"shield5": "core.status.hero.def += 100;core.status.hero.mdef += 100",
|
"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++;",
|
"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",
|
"superPotion": "core.status.hero.hp *= 2",
|
||||||
"moneyPocket": "core.status.hero.money += core.values.moneyPocket"
|
"moneyPocket": "core.status.hero.money += 500"
|
||||||
},
|
},
|
||||||
"itemEffectTip": {
|
"itemEffectTip": {
|
||||||
"redJewel": "',攻击+'+core.values.redJewel * ratio",
|
"redJewel": "',攻击+'+core.values.redJewel * ratio",
|
||||||
@ -352,7 +352,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"shield5": "',防御+100,魔防+100'",
|
"shield5": "',防御+100,魔防+100'",
|
||||||
"bigKey": "',全钥匙+1'",
|
"bigKey": "',全钥匙+1'",
|
||||||
"superPotion": "',生命值翻倍'",
|
"superPotion": "',生命值翻倍'",
|
||||||
"moneyPocket": "',金币+'+core.values.moneyPocket"
|
"moneyPocket": "',金币+500'"
|
||||||
},
|
},
|
||||||
"useItemEffect": {
|
"useItemEffect": {
|
||||||
"book": "core.ui.drawBook(0);",
|
"book": "core.ui.drawBook(0);",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user