diff --git a/_server/data.comment.js b/_server/data.comment.js index 3fd9277e..3cfa62e4 100644 --- a/_server/data.comment.js +++ b/_server/data.comment.js @@ -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" } } }, diff --git a/libs/control.js b/libs/control.js index a315f420..b3633da2 100644 --- a/libs/control.js +++ b/libs/control.js @@ -2802,7 +2802,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'; @@ -2845,14 +2845,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; @@ -2869,7 +2869,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; @@ -2901,7 +2901,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; @@ -2978,8 +2978,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 } }, { @@ -3017,7 +3017,7 @@ control.prototype.resize = function(clientWidth, clientHeight) { { className: 'statusTexts', rules: { - color: main.statusBarColor||"white" + color: (core.status.globalAttribute||core.initStatus.globalAttribute).statusBarColor } }, { @@ -3132,7 +3132,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 } }, ] diff --git a/libs/core.js b/libs/core.js index 7d2ea7f7..f14206fe 100644 --- a/libs/core.js +++ b/libs/core.js @@ -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, diff --git a/libs/ui.js b/libs/ui.js index e642d6b4..ce75895a 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -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;i0) { @@ -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=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 (page0) { - 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.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); } ////// 绘制“数据统计”界面 ////// diff --git a/project/data.js b/project/data.js index cf472d2f..ecd03354 100644 --- a/project/data.js +++ b/project/data.js @@ -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": "魔塔样板", diff --git a/project/floors/sample0.js b/project/floors/sample0.js index 6cb7a5ae..06e8c93a 100644 --- a/project/floors/sample0.js +++ b/project/floors/sample0.js @@ -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所决定。" diff --git a/project/functions.js b/project/functions.js index e3d571de..eff92bba 100644 --- a/project/functions.js +++ b/project/functions.js @@ -1037,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像素即可