边框
This commit is contained in:
parent
a1eb7544bc
commit
1387b11f9e
1
_server/config.json
Normal file
1
_server/config.json
Normal file
@ -0,0 +1 @@
|
||||
{"viewportLoc":[0,0],"editorLastFloorId":"sample2"}
|
@ -142,7 +142,8 @@
|
||||
</div>
|
||||
|
||||
<!-- 状态栏canvas化 -->
|
||||
<canvas id="statusCanvas" style="position: absolute; left: 0; top: 0;"></canvas>
|
||||
<canvas id="statusCanvas" style="position: absolute; left: 0; top: 0; z-index: 100;"></canvas>
|
||||
<canvas id="caidan1" style="position: absolute; left: 0; top: 0;"></canvas>
|
||||
</div>
|
||||
<div id="toolBar" class="clearfix">
|
||||
<img class="tools" id='img-book'>
|
||||
@ -171,6 +172,7 @@
|
||||
<canvas class='gameCanvas' id='hero'></canvas>
|
||||
<canvas class='gameCanvas' id='event2'></canvas>
|
||||
<canvas class='gameCanvas' id='fg'></canvas>
|
||||
<canvas class='gameCanvas' id='caidan'></canvas>
|
||||
<canvas class='gameCanvas' id='damage'></canvas>
|
||||
<canvas class='gameCanvas' id='animate'></canvas>
|
||||
<canvas class='gameCanvas' id='curtain'></canvas>
|
||||
|
@ -11,8 +11,8 @@
|
||||
// const core = (() => {
|
||||
|
||||
function core () {
|
||||
this._WIDTH_ = 13;
|
||||
this._HEIGHT_ = 13;
|
||||
this._WIDTH_ = 15;
|
||||
this._HEIGHT_ = 15;
|
||||
this._PX_ = this._WIDTH_ * 32;
|
||||
this._PY_ = this._HEIGHT_ * 32;
|
||||
this._HALF_WIDTH_ = Math.floor(this._WIDTH_ / 2);
|
||||
|
2
main.js
2
main.js
@ -73,6 +73,8 @@ function main () {
|
||||
'hard': document.getElementById('hard'),
|
||||
'statusCanvas': document.getElementById('statusCanvas'),
|
||||
'statusCanvasCtx': document.getElementById('statusCanvas').getContext('2d'),
|
||||
'caidan1': document.getElementById('caidan1'),
|
||||
'caidan1Ctx': document.getElementById('caidan1').getContext('2d'),
|
||||
'inputDiv': document.getElementById('inputDiv'),
|
||||
'inputMessage': document.getElementById('inputMessage'),
|
||||
'inputBox': document.getElementById('inputBox'),
|
||||
|
@ -11,6 +11,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"images": [
|
||||
"bear.png",
|
||||
"bg.jpg",
|
||||
"caidan.png",
|
||||
"dragon.png",
|
||||
"hero.png",
|
||||
"winskin.png"
|
||||
@ -76,49 +77,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"商店": "shop.mp3",
|
||||
"领域": "zone"
|
||||
},
|
||||
"levelChoose": [
|
||||
{
|
||||
"title": "简单",
|
||||
"name": "Easy",
|
||||
"hard": 1,
|
||||
"color": [
|
||||
64,
|
||||
255,
|
||||
85,
|
||||
1
|
||||
],
|
||||
"action": [
|
||||
{
|
||||
"type": "comment",
|
||||
"text": "在这里写该难度需执行的事件"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "普通",
|
||||
"name": "Normal",
|
||||
"hard": 2,
|
||||
"color": [
|
||||
255,
|
||||
221,
|
||||
32,
|
||||
1
|
||||
],
|
||||
"action": []
|
||||
},
|
||||
{
|
||||
"title": "困难",
|
||||
"name": "Hard",
|
||||
"hard": 3,
|
||||
"color": [
|
||||
255,
|
||||
68,
|
||||
64,
|
||||
1
|
||||
],
|
||||
"action": []
|
||||
}
|
||||
],
|
||||
"levelChoose": [],
|
||||
"equipName": [
|
||||
"武器",
|
||||
"盾牌"
|
||||
@ -763,7 +722,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"betweenAttackMax": false,
|
||||
"useLoop": false,
|
||||
"startUsingCanvas": false,
|
||||
"statusCanvas": false,
|
||||
"statusCanvas": true,
|
||||
"enableEnemyPoint": true,
|
||||
"enableGentleClick": true,
|
||||
"ignoreChangeFloor": true,
|
||||
|
@ -1592,6 +1592,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
.sort( /*function (id1, id2) { return core.material.items[id1].name <= core.material.items[id2].name ? -1 : 1 }*/);
|
||||
},
|
||||
"drawStatusBar": function () {
|
||||
core.dom.caidan1Ctx.drawImage(core.material.images.images['caidan.png'],0,0)
|
||||
core.drawImage('caidan','caidan.png',-161,0)
|
||||
var ctx, fill = function (text, x, y, style) {
|
||||
core.ui.setFont(ctx, (/\w+/.test(text) ? 'italic ' : '') + 'bold 18px Verdana');
|
||||
core.ui.fillBoldText(ctx, text, x, y, style);
|
||||
|
BIN
project/images/caidan.png
Normal file
BIN
project/images/caidan.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 450 KiB |
@ -5,6 +5,118 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
this._afterLoadResources = function () {
|
||||
// 本函数将在所有资源加载完毕后,游戏开启前被执行
|
||||
}
|
||||
core.control.resize = function () {
|
||||
if (main.mode == 'editor') return;
|
||||
var clientWidth = main.dom.body.clientWidth, clientHeight = main.dom.body.clientHeight;
|
||||
var BORDER = 0;
|
||||
var extendToolbar = core.flags.extendToolbar;
|
||||
var BAR_WIDTH = extendToolbar ? 0 : Math.round(core._PY_ / 3);
|
||||
|
||||
var horizontalMaxRatio = (clientHeight - 2 * BORDER - (extendToolbar ? BORDER : 0)) / (core._PY_ + (extendToolbar ? 38 : 0));
|
||||
|
||||
if (clientWidth - 3 * BORDER >= core._PX_ + BAR_WIDTH || (clientWidth > clientHeight && horizontalMaxRatio < 1)) {
|
||||
// 横屏
|
||||
core.domStyle.isVertical = false;
|
||||
|
||||
core.domStyle.availableScale = [];
|
||||
[1, 1.25, 1.5, 1.75, 2, 2.25, 2.5].forEach(function (v) {
|
||||
if (clientWidth - 3 * BORDER >= v * (core._PX_ + BAR_WIDTH) && horizontalMaxRatio >= v) {
|
||||
core.domStyle.availableScale.push(v);
|
||||
}
|
||||
});
|
||||
if (core.domStyle.availableScale.indexOf(core.domStyle.scale) < 0) {
|
||||
core.domStyle.scale = Math.min(1, horizontalMaxRatio);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// 竖屏
|
||||
core.domStyle.isVertical = true;
|
||||
core.domStyle.scale = Math.min((clientWidth - 2 * BORDER) / core._PX_);
|
||||
core.domStyle.availableScale = [];
|
||||
extendToolbar = false;
|
||||
BAR_WIDTH = Math.round(core._PX_ * 0.3);
|
||||
}
|
||||
|
||||
var statusDisplayArr = this._shouldDisplayStatus(), count = statusDisplayArr.length;
|
||||
var statusCanvas = core.flags.statusCanvas, statusCanvasRows = core.values.statusCanvasRowsOnMobile || 3;
|
||||
var col = statusCanvas ? statusCanvasRows : Math.ceil(count / 3);
|
||||
if (col > 5) {
|
||||
if (statusCanvas) alert("自绘状态栏的在竖屏下的行数应不超过5!");
|
||||
else alert("当前状态栏数目(" + count + ")大于15,请调整到不超过15以避免手机端出现显示问题。");
|
||||
}
|
||||
var globalAttribute = core.status.globalAttribute || core.initStatus.globalAttribute;
|
||||
|
||||
var obj = {
|
||||
clientWidth: clientWidth,
|
||||
clientHeight: clientHeight,
|
||||
BORDER: BORDER,
|
||||
BAR_WIDTH: BAR_WIDTH,
|
||||
TOOLBAR_HEIGHT: 38,
|
||||
outerWidth: core._PX_ * core.domStyle.scale + 2 * BORDER,
|
||||
outerHeight: core._PY_ * core.domStyle.scale + 2 * BORDER,
|
||||
globalAttribute: globalAttribute,
|
||||
border: '0px ' + core.arrayToRGBA(globalAttribute.borderColor) + ' solid',
|
||||
statusDisplayArr: statusDisplayArr,
|
||||
count: count,
|
||||
col: col,
|
||||
statusBarHeightInVertical: core.domStyle.isVertical ? (32 * col + 6) * core.domStyle.scale + 2 * BORDER : 0,
|
||||
toolbarHeightInVertical: core.domStyle.isVertical ? 38 * core.domStyle.scale + 2 * BORDER : 0,
|
||||
extendToolbar: extendToolbar,
|
||||
is15x15: false
|
||||
};
|
||||
|
||||
this._doResize(obj);
|
||||
this.setToolbarButton();
|
||||
core.updateStatusBar();
|
||||
}
|
||||
|
||||
core.control._resize_statusBar = function (obj) {
|
||||
// statusBar
|
||||
var statusBar = core.dom.statusBar;
|
||||
if (core.domStyle.isVertical) {
|
||||
statusBar.style.width = obj.outerWidth + "px";
|
||||
statusBar.style.height = obj.statusBarHeightInVertical + "px";
|
||||
statusBar.style.background = obj.globalAttribute.statusTopBackground;
|
||||
statusBar.style.fontSize = 16 * core.domStyle.scale + "px";
|
||||
}
|
||||
else {
|
||||
statusBar.style.width = (obj.BAR_WIDTH * core.domStyle.scale + obj.BORDER) + "px";
|
||||
statusBar.style.height = obj.outerHeight + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER : 0) + "px";
|
||||
statusBar.style.background = obj.globalAttribute.statusLeftBackground;
|
||||
// --- 计算文字大小
|
||||
if (obj.extendToolbar) {
|
||||
statusBar.style.fontSize = 16 * core.domStyle.scale + "px";
|
||||
} else {
|
||||
statusBar.style.fontSize = 16 * Math.min(1, (core._HEIGHT_ - 4) / obj.count) * core.domStyle.scale + "px";
|
||||
}
|
||||
}
|
||||
statusBar.style.display = obj.extendToolbar ? 'none' : 'block';
|
||||
statusBar.style.borderTop = statusBar.style.borderLeft = obj.border;
|
||||
statusBar.style.borderRight = core.domStyle.isVertical ? obj.border : '';
|
||||
statusBar.style.borderBottom = core.domStyle.isVertical ? '' : obj.border;
|
||||
// 自绘状态栏
|
||||
if (core.domStyle.isVertical) {
|
||||
core.dom.statusCanvas.style.width = core._PX_ * core.domStyle.scale + "px";
|
||||
core.dom.statusCanvas.style.height = obj.statusBarHeightInVertical - 3 + "px";
|
||||
core.maps._setHDCanvasSize(core.dom.statusCanvasCtx, core._PX_, obj.col * 32 + 9);
|
||||
}
|
||||
else {
|
||||
core.dom.statusCanvas.style.width = obj.BAR_WIDTH * core.domStyle.scale + "px";
|
||||
core.dom.statusCanvas.style.height = obj.outerHeight - 2 * obj.BORDER + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER : 0) + "px";
|
||||
core.maps._setHDCanvasSize(core.dom.statusCanvasCtx, obj.BAR_WIDTH, core._PY_ + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT + obj.BORDER : 0));
|
||||
}
|
||||
if (core.domStyle.isVertical) {
|
||||
core.dom.caidan1.style.width = core._PX_ * core.domStyle.scale + "px";
|
||||
core.dom.caidan1.style.height = obj.statusBarHeightInVertical - 3 + "px";
|
||||
core.maps._setHDCanvasSize(core.dom.caidan1Ctx, core._PX_, obj.col * 32 + 9);
|
||||
}
|
||||
else {
|
||||
core.dom.caidan1.style.width = obj.BAR_WIDTH * core.domStyle.scale + "px";
|
||||
core.dom.caidan1.style.height = obj.outerHeight - 2 * obj.BORDER + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER : 0) + "px";
|
||||
core.maps._setHDCanvasSize(core.dom.caidan1Ctx, obj.BAR_WIDTH, core._PY_ + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT + obj.BORDER : 0));
|
||||
}
|
||||
core.dom.statusCanvas.style.display = core.flags.statusCanvas && !obj.extendToolbar ? "block" : "none";
|
||||
}
|
||||
},
|
||||
"drawLight": function () {
|
||||
|
||||
|
@ -166,8 +166,8 @@
|
||||
}
|
||||
|
||||
#floorMsgGroup {
|
||||
top: 3px;
|
||||
right: 3px;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
display: none;
|
||||
@ -319,6 +319,10 @@ p#name {
|
||||
z-index: 60;
|
||||
}
|
||||
|
||||
#caidan {
|
||||
z-index: 62;
|
||||
}
|
||||
|
||||
#damage {
|
||||
z-index: 65;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user