字体修改

This commit is contained in:
草莓 2025-01-24 19:18:55 +08:00
parent 13f3a69173
commit 089956431f
6 changed files with 2055 additions and 1667 deletions

View File

@ -1 +1 @@
{"viewportLoc":[0,0],"editorLastFloorId":"street01"}
{"viewportLoc":[0,0],"editorLastFloorId":"guangchang2"}

View File

@ -492,7 +492,6 @@ main.prototype.selectButton = function (index) {
main.prototype.importFonts = function (fonts) {
if (!(fonts instanceof Array) || fonts.length == 0) return;
var style = document.createElement("style");
style.type = "text/css";
var html = "";
fonts.forEach(function (font) {
html +=

View File

@ -1023,6 +1023,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
],
"fonts": [
"HATTEN",
"Verdana",
"number",
"pala",
"simhei"
@ -1493,6 +1494,10 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"type": "setValue",
"name": "item:fly",
"value": "1"
},
{
"type": "insert",
"name": "强制横屏"
}
],
"shops": [

BIN
project/fonts/Verdana.ttf Normal file

Binary file not shown.

View File

@ -1,8 +1,14 @@
var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
init: function () {
var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
{
"init": function () {
this._afterLoadResources = function () {
// 本函数将在所有资源加载完毕后,游戏开启前被执行
core.ui.statusBar.init();
core.dom.playGame.style.fontFamily = 'pala'
core.dom.loadGame.style.fontFamily = 'pala'
core.dom.CGMode.style.fontFamily = 'pala'
core.dom.musicMode.style.fontFamily = 'pala'
core.dom.replayGame.style.fontFamily = 'pala'
core.registerEvent("changeMouse", function (data) {
if (!main.replayChecking && !core.isReplaying())
core.changeMouse(
@ -121,8 +127,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
data.image,
data.memory,
data.hidetime || 30,
data.list || [
{
data.list || [{
text: "",
sound: "",
time: 50,
@ -130,8 +135,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
boldColor: "#000000",
font: "bold 48px Verdana",
frame: 0,
},
]
}, ]
);
} else {
core.doAction();
@ -258,8 +262,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
core.doAction();
});
};
},
drawLight: function () {
},
"drawLight": function () {
// 绘制灯光/漆黑层效果。调用方式 core.plugin.drawLight(...)
// 【参数说明】
// name必填要绘制到的画布名可以是一个系统画布或者是个自定义画布如果不存在则创建
@ -325,7 +329,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
// 可以在任何地方如afterXXX或自定义脚本事件调用函数方法为 core.plugin.xxx();
};
},
shop: function () {
"shop": function () {
// 【全局商店】相关的功能
//
// 打开一个全局商店
@ -601,7 +605,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
60
);
},
removeMap: function () {
"removeMap": function () {
// 高层塔砍层插件,删除后不会存入存档,不可浏览地图也不可飞到。
// 推荐用法:
// 对于超高层或分区域塔当在1区时将2区以后的地图删除1区结束时恢复2区进二区时删除1区地图以此类推
@ -690,7 +694,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
});
};
},
fiveLayers: function () {
"fiveLayers": function () {
// 是否启用五图层增加背景2层和前景2层 将__enable置为true即会启用启用后请保存后刷新编辑器
// 背景层2将会覆盖背景层 被事件层覆盖 前景层2将会覆盖前景层
// 另外 请注意加入两个新图层 会让大地图的性能降低一些
@ -892,7 +896,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
};
};
},
itemShop: function () {
"itemShop": function () {
// 道具商店相关的插件
// 可在全塔属性-全局商店中使用「道具商店」事件块进行编辑(如果找不到可以在入口方块中找)
@ -1294,7 +1298,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
]);
};
},
enemyLevel: function () {
"enemyLevel": function () {
// 此插件将提供怪物手册中的怪物境界显示
// 使用此插件需要先给每个怪物定义境界,方法如下:
// 点击怪物的【配置表格】,找到“【怪物】相关的表格配置”,然后在【名称】仿照增加境界定义:
@ -1462,7 +1466,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
);
};
},
multiHeros: function () {
"multiHeros": function () {
// 多角色插件
// Step 1: 启用本插件
// Step 2: 定义每个新的角色各项初始数据(参见下方注释)
@ -1616,7 +1620,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
core.setFlag("heroId", toHeroId); // 保存切换到的角色ID
};
},
heroFourFrames: function () {
"heroFourFrames": function () {
// 样板的勇士/跟随者移动时只使用2、4两帧观感较差。本插件可以将四帧全用上。
// 是否启用本插件
@ -1679,7 +1683,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
return false;
};
},
routeFixing: function () {
"routeFixing": function () {
// 是否开启本插件true 表示启用false 表示禁用。
var __enable = true;
if (!__enable) return;
@ -1803,7 +1807,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
100
);
},
numpad: function () {
"numpad": function () {
// 样板自带的整数输入事件为白屏弹窗且可以误输入任意非法内容但不支持负整数观感较差。本插件可以将其美化成仿RM样式使其支持负整数同时带有音效
// 另一方面4399等第三方平台不允许使用包括 core.myprompt() 和 core.myconfirm() 在内的弹窗,因此也需要此插件来替代,不然类似生命魔杖的道具就不好实现了
// 关于负整数输入V2.8.2原生支持其录像的压缩和解压,只是默认的 core.events._action_input() 函数将负数取了绝对值,可以只复写下面的 core.isReplaying() 部分来取消
@ -2060,7 +2064,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
}
};
},
sprites: function () {
"sprites": function () {
// 基于canvas的sprite化摘编整理自万宁魔塔
//
// ---------------------------------------- 第一部分 js代码 (必装) --------------------------------------- //
@ -2264,7 +2268,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
window.Sprite = Sprite;
},
hotReload: function () {
"hotReload": function () {
/* ---------- ---------- *
1. libs/ main.js index.html 中的任意一个文件被更改后会自动刷新塔的页面
@ -2521,7 +2525,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
}
})();
},
statusBar: function () {
"statusBar": function () {
main.dom.floorMsgGroup.style.display = "none";
main.dom.statusBar.style.display = "none";
main.dom.toolBar.style.display = "none";
@ -3726,7 +3730,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
};
// init() called in `afterLoadResources`.
},
override: function () {
"override": function () {
core.statusBar.icons = {
floor: 0,
name: null,
@ -4076,7 +4080,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
ctx.fillText(text, x, y);
};
},
额外信息: function () {
"额外信息": function () {
/*
* 注意不要在道具属性中直接操作flags使用core.status.hero.flags或core.setFlag系列函数代替
* 需要将 变量itemDetail改为true才可正常运行
@ -4233,7 +4237,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
}
}
},
编辑器显伤: function () {
"编辑器显伤": function () {
// 在此增加新插件
/////// 用户设置 ///////
// 将__enable置为false将关闭插件
@ -4507,7 +4511,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
}
};
},
手册区分特殊属性: function () {
"手册区分特殊属性": function () {
// 在此增加新插件
this.arrsame = function (Arraya, Arrayb) {
let a = Arraya || [];
@ -4859,7 +4863,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
return [enemy, texts];
};
},
一防减伤: function () {
"一防减伤": function () {
// 在此增加新插件
ui.prototype._drawBook_drawRow3 = function (
index,
@ -6370,7 +6374,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
core.registerReplayAction("equip", core.control._replayAction_equip);
core.registerReplayAction("unEquip", core.control._replayAction_unEquip);
},
技能树: function () {
"技能树": function () {
// 在此增加新插件
//
// 已学习的技能等级 flags._hasSkill_
@ -7172,7 +7176,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
};
core.registerReplayAction("skill", control.prototype._replayAction_skill);
},
animate: function () {
"animate": function () {
// -------------------- 插件说明 -------------------- //
// github仓库https://github.com/unanmed/animate
@ -8046,7 +8050,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
inverseTrigo: N,
};
},
func: function () {
"func": function () {
// 功能函数集,具体有哪些函数看每个函数前的注释即可
// 安装方式:直接复制到插件里面,注意新建插件自带的 function () { } 不能删
// 使用方式:可以直接使用对象解构按需引入
@ -8486,7 +8490,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
}
};
},
音频系统: function () {
"音频系统": function () {
// 在此增加新插件
/* libs/thirdparty index.html
@ -10597,7 +10601,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
core.ui._drawSwitchs_sounds();
};
},
怪物碎裂特效: function () {
"怪物碎裂特效": function () {
// 在此增加新插件
// -------------------- 安装说明 -------------------- //
// 先安装两个在插件简介中说明的前置插件
@ -10842,7 +10846,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
applyFragWith,
};
},
自定义常用事件: function () {
"自定义常用事件": function () {
// editorBlocklyconfigPlus.js
// 自訂常見事件模板插件
// 本插件引用了通用函數插件(Utility.js)
@ -12131,7 +12135,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
.split("// end mark sfergsvae")[0];
}
},
夹击激光动画: function () {
"夹击激光动画": function () {
function createCanvas(name, zIndex) {
if (!name) return;
var canvas = document.createElement("canvas");
@ -12362,7 +12366,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
}
};
},
瞬移轨迹: function () {
"瞬移轨迹": function () {
// 在此增加新插件
function popMove() {
var ctx = core.getContextByName("popMove");
@ -12509,7 +12513,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
core.setAlpha("event2", alpha);
};
},
小地图: function () {
"小地图": function () {
// 在此增加新插件
// ----- 不可自定义 杂七杂八的变量
/** @type {{[x: string]: BFSResult}} */
@ -12928,7 +12932,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
}
};
},
楼传: function () {
"楼传": function () {
// 在此增加新插件
core.canMoveFloor = function () {
@ -14036,7 +14040,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
0
);
},
CG回廊: function () {
"CG回廊": function () {
// 在此增加新插件
const CGUI = document.createElement("canvas"); //CGui画布设置
CGUI.style.position = "absolute";
@ -14539,7 +14543,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
main.core.ui.CG.update();
};
},
光标设置: function () {
"光标设置": function () {
// 在此增加新插件
this.changeMouse = function (
icon,
@ -14576,7 +14580,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
core.dom[div].style.cursor = "auto";
};
},
信息弹出: function () {
"信息弹出": function () {
// 在此增加新插件
/*
* 使用方法core.addPop(px, py, value, color, boldColor, left, jump, time, show, font, speed)
@ -14683,7 +14687,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
else core.status.pop.push(data);
};
},
warning: function () {
"warning": function () {
// 在此增加新插件
// 默认音效名
var defaultSound = "jingbao.opus";
@ -14746,7 +14750,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
}, 1600);
};
},
立体声音效: function () {
"立体声音效": function () {
// 在此增加新插件
// 音效双声道播放
var can = true;
@ -14850,7 +14854,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
}, 10);
};
},
滑动转场: function () {
"滑动转场": function () {
// 在此增加新插件
const defaultChange = {
left: "leftPortal", // 左箭头
@ -15040,7 +15044,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
}, 25);
};
},
剧情cg: function () {
"剧情cg": function () {
// 在此增加新插件
const cg = document.createElement("canvas"); //cg画布设置
cg.style.position = "absolute";
@ -15569,7 +15573,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
}
core.ui.cgText = new cgText();
},
旁白: function () {
"旁白": function () {
// 在此增加新插件
const over = document.createElement("canvas"); //over画布设置
over.style.position = "absolute";
@ -16059,7 +16063,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
}
};
},
回合制boss战: function () {
"回合制boss战": function () {
// 在此增加新插件
const boss = document.createElement("canvas"); //boss战画布设置
boss.style.position = "absolute";
@ -16107,7 +16111,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
}
core.ui.boss = new boss1();
},
剧情视频引用: function () {
"剧情视频引用": function () {
// 在此增加新插件
let a;
let bgm;
@ -16413,7 +16417,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
);
};
},
musicMode: function () {
"musicMode": function () {
// 在此增加新插件
const music = document.createElement("canvas");
music.style.position = "absolute";
@ -16555,7 +16559,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
[x + w, y + h],
];
};
const inRect = ([x, y], [[sx, sy], [dx, dy]]) => {
const inRect = ([x, y], [
[sx, sy],
[dx, dy]
]) => {
return sx <= x && x <= dx && sy <= y && y <= dy;
};
const pos = [px, py];
@ -17130,9 +17137,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
text,
150,
posy - 30,
page === this.selection[0] && i === this.selection[1]
? "#FFFFFF"
: "#444444",
page === this.selection[0] && i === this.selection[1] ?
"#FFFFFF" :
"#444444",
"#000000",
6,
core.ui._buildFont(66, true)
@ -17189,19 +17196,66 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
ctx.strokeStyle = "#ffffff";
ctx.lineWidth = 3;
ctx.fillStyle = "#ffffff";
ctx.font = "bold 96px Verdana";
ctx.fillText("|", 100, 1697);
ctx.fillText("◀", 115, 1700);
core.fillBoldText(
ctx,
"|",
100,
1697,
"#FFFFFF",
6,
core.ui._buildFont(96, true)
);
core.fillBoldText(
ctx,
"◀",
115,
1700,
"#FFFFFF",
6,
core.ui._buildFont(96, true)
);
ctx.beginPath();
ctx.arc(505, 1670, 80, 0, 3 * Math.PI);
ctx.stroke();
ctx.fillText("|", 835, 1697);
ctx.fillText("▶", 785, 1700);
core.fillText(
ctx,
"|",
835,
1697,
"#FFFFFF",
core.ui._buildFont(96, true)
);
core.fillText(
ctx,
"▶",
785,
1700,
"#FFFFFF",
core.ui._buildFont(96, true)
);
if (this.stop) {
ctx.fillText("▶", 473, 1697);
core.fillText(
ctx,
"▶",
473,
1700,
"#FFFFFF",
core.ui._buildFont(96, true)
);
} else {
ctx.fillText("||", 453, 1694);
core.fillText(
ctx,
"||",
453,
1700,
"#FFFFFF",
core.ui._buildFont(96, true)
);
}
const img = core.material.images.images[this.type + ".webp"];
@ -17286,9 +17340,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
text,
950,
posy - 30,
page === this.selection[0] && i === this.selection[1]
? "#FFFFFF"
: "#444444",
page === this.selection[0] && i === this.selection[1] ?
"#FFFFFF" :
"#444444",
"#000000",
6,
core.ui._buildFont(66, true)
@ -17337,21 +17391,64 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
ctx.strokeStyle = "#ffffff";
ctx.lineWidth = 3;
ctx.fillStyle = "#ffffff";
ctx.font = "bold 96px Verdana";
ctx.fillText("|", 60, 697);
ctx.fillText("◀", 70, 700);
core.fillText(
ctx,
"|",
55,
697,
"#FFFFFF",
core.ui._buildFont(96, true)
);
core.fillText(
ctx,
"◀",
70,
700,
"#FFFFFF",
core.ui._buildFont(96, true)
);
ctx.beginPath();
ctx.arc(295, 670, 80, 0, 2 * Math.PI);
ctx.stroke();
if (this.stop) {
ctx.fillText("▶", 245, 697);
} else {
ctx.fillText("||", 245, 694);
}
core.fillText(
ctx,
"▶",
265,
700,
"#FFFFFF",
core.ui._buildFont(96, true)
);
} else {
core.fillText(
ctx,
"||",
245,
700,
"#FFFFFF",
core.ui._buildFont(96, true)
);
}
core.fillText(
ctx,
"|",
495,
697,
"#FFFFFF",
core.ui._buildFont(96, true)
);
core.fillText(
ctx,
"▶",
450,
700,
"#FFFFFF",
core.ui._buildFont(96, true)
);
ctx.fillText("|", 490, 697);
ctx.fillText("▶", 450, 700);
ctx.font = "bold 48px Verdana";
ctx.fillText("音量", 350, 900);
ctx.beginPath();
@ -17447,8 +17544,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
}
});
};
},
横屏切换: function () {
},
"横屏切换": function () {
// 在此增加新插件
this.triggerFullscreen = async function (full) {
if (!!document.fullscreenElement && !full) {
@ -17486,7 +17583,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
}
};
},
图片压缩webp导出: function () {
"图片压缩webp导出": function () {
// 在此增加新插件
//使用方法进入游戏后开始游戏F12打开控制台输入core.towebp(image),image为已在全塔属性中注册过的图片名字需要""括起来
this.towebp = function (image) {
@ -17722,4 +17819,240 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
}, time * 1000);
};
},
};
"开局选项悬停": function () {
// 在此增加新插件
main.dom.playGame.addEventListener("mouseenter", () => { core.dom.playGame.style.backgroundColor = "#808080" })
main.dom.playGame.addEventListener("mouseleave", () => { core.dom.playGame.style.backgroundColor = "transparent" })
main.dom.playGame.addEventListener("touchmove", () => { core.dom.playGame.style.backgroundColor = "#808080" })
main.dom.playGame.addEventListener("touchend", () => { core.dom.playGame.style.backgroundColor = "transparent" })
main.dom.playGame.addEventListener("touchcancel", () => { core.dom.playGame.style.backgroundColor = "transparent" })
main.dom.loadGame.addEventListener("mouseenter", () => { core.dom.loadGame.style.backgroundColor = "#808080" })
main.dom.loadGame.addEventListener("mouseleave", () => { core.dom.loadGame.style.backgroundColor = "transparent" })
main.dom.loadGame.addEventListener("touchmove", () => { core.dom.loadGame.style.backgroundColor = "#808080" })
main.dom.loadGame.addEventListener("touchend", () => { core.dom.loadGame.style.backgroundColor = "transparent" })
main.dom.loadGame.addEventListener("touchcancel", () => { core.dom.loadGame.style.backgroundColor = "transparent" })
main.dom.CGMode.addEventListener("mouseenter", () => { core.dom.CGMode.style.backgroundColor = "#808080" })
main.dom.CGMode.addEventListener("mouseleave", () => { core.dom.CGMode.style.backgroundColor = "transparent" })
main.dom.CGMode.addEventListener("touchmove", () => { core.dom.CGMode.style.backgroundColor = "#808080" })
main.dom.CGMode.addEventListener("touchend", () => { core.dom.CGMode.style.backgroundColor = "transparent" })
main.dom.CGMode.addEventListener("touchcancel", () => { core.dom.CGMode.style.backgroundColor = "transparent" })
main.dom.musicMode.addEventListener("mouseenter", () => { core.dom.musicMode.style.backgroundColor = "#808080" })
main.dom.musicMode.addEventListener("mouseleave", () => { core.dom.musicMode.style.backgroundColor = "transparent" })
main.dom.musicMode.addEventListener("touchmove", () => { core.dom.musicMode.style.backgroundColor = "#808080" })
main.dom.musicMode.addEventListener("touchend", () => { core.dom.musicMode.style.backgroundColor = "transparent" })
main.dom.musicMode.addEventListener("touchcancel", () => { core.dom.musicMode.style.backgroundColor = "transparent" })
main.dom.replayGame.addEventListener("mouseenter", () => { core.dom.replayGame.style.backgroundColor = "#808080" })
main.dom.replayGame.addEventListener("mouseleave", () => { core.dom.replayGame.style.backgroundColor = "transparent" })
main.dom.replayGame.addEventListener("touchmove", () => { core.dom.replayGame.style.backgroundColor = "#808080" })
main.dom.replayGame.addEventListener("touchend", () => { core.dom.replayGame.style.backgroundColor = "transparent" })
main.dom.replayGame.addEventListener("touchcancel", () => { core.dom.replayGame.style.backgroundColor = "transparent" })
},
"天气叠加": function () {
//使用方法使用core.setWeather(天气,等级)来增加天气使用core.setWeather()来清空天气
// 天气叠加功能
////// 更改天气效果 //////
control.prototype.setWeather = function (type, level) {
// 非雨雪
if (type == null) {
Object.keys(core.control.weathers).forEach(function (one) {
core.deleteCanvas('weather' + one);
});
core.animateFrame.weather.type = [];
core.animateFrame.weather.nodes = {};
core.animateFrame.weather.level = {};
core.animateFrame.weather.time = {};
return;
}
if (!core.animateFrame.weather.level || level == null)
core.animateFrame.weather.level = {};
if (!core.animateFrame.weather.type) core.animateFrame.weather.type = [];
level = core.clamp(parseInt(level) || 5, 1, 10);
// 当前天气:则忽略
if (core.animateFrame.weather.type.includes(type) && level == core.animateFrame.weather.level[type]) return;
if (core.animateFrame.weather.nodes[type]) return;
// 计算当前的宽高
core.createCanvas('weather' + type, 0, 0, core.__PIXELS__, core.__PIXELS__, 80);
core.animateFrame.weather.type.push(type);
core.animateFrame.weather.level[type] = level;
this._setWeather_createNodes(type, level);
};
control.prototype._setWeather_createNodes = function (type, level) {
var number = level * parseInt(20 * core.bigmap.width * core.bigmap.height / (core.__SIZE__ * core.__SIZE__));
if (!core.animateFrame.weather.nodes[type]) core.animateFrame.weather.nodes[type] = [];
switch (type) {
case 'rain':
for (var a = 0; a < number; a++) {
core.animateFrame.weather.nodes.rain.push({
'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
})
}
break;
case 'snow':
for (var a = 0; a < number; a++) {
core.animateFrame.weather.nodes.snow.push({
'x': Math.random() * core.bigmap.width * 32,
'y': Math.random() * core.bigmap.height * 32,
'r': Math.random() * 5 + 1,
'd': Math.random() * Math.min(level, 200),
})
}
break;
case 'fog':
if (core.animateFrame.weather.fog) {
core.animateFrame.weather.nodes[type] = [{
'level': number,
'x': 0,
'y': -core.__PIXELS__ / 2,
'dx': -Math.random() * 1.5,
'dy': Math.random(),
'delta': 0.001,
}];
}
break;
case 'cloud':
if (core.animateFrame.weather.cloud) {
core.animateFrame.weather.nodes[type] = [{
'level': number,
'x': 0,
'y': -core.__PIXELS__ / 2,
'dx': -Math.random() * 1.5,
'dy': Math.random(),
'delta': 0.001,
}];
}
break;
case 'sun':
if (core.animateFrame.weather.sun) {
// 直接绘制
core.clearMap('weather' + type);
core.setAlpha('weather' + type, level / 10);
core.drawImage('weather' + type, core.animateFrame.weather.sun, 0, 0,
core.animateFrame.weather.sun.width, core.animateFrame.weather.sun.height, 0, 0, core.__PIXELS__, core.__PIXELS__);
core.setAlpha('weather' + type, 1);
}
break;
}
};
core.registerAnimationFrame("weather", true, function (timestamp) {
var weather = core.animateFrame.weather;
if (!weather.type) return;
weather.type.forEach(function (one) {
if (timestamp - weather.time[one] <= 30 || !core.dymCanvas["weather" + one]) return;
core.control["_animationFrame_weather_" + one]();
weather.time[one] = timestamp;
});
});
// 雨
control.prototype._animationFrame_weather_rain = function () {
var ctx = core.dymCanvas.weatherrain,
ox = core.bigmap.offsetX,
oy = core.bigmap.offsetY;
core.clearMap('weatherrain');
ctx.strokeStyle = 'rgba(174,194,224,0.8)';
ctx.lineWidth = 1;
ctx.lineCap = 'round';
core.animateFrame.weather.nodes.rain.forEach(function (p) {
ctx.beginPath();
ctx.moveTo(p.x - ox, p.y - oy);
ctx.lineTo(p.x + p.l * p.xs - ox, p.y + p.l * p.ys - oy);
ctx.stroke();
p.x += p.xs;
p.y += p.ys;
if (p.x > core.bigmap.width * 32 || p.y > core.bigmap.height * 32) {
p.x = Math.random() * core.bigmap.width * 32;
p.y = -10;
}
});
ctx.fill();
};
// 雪
control.prototype._animationFrame_weather_snow = function () {
var ctx = core.dymCanvas.weathersnow,
ox = core.bigmap.offsetX,
oy = core.bigmap.offsetY;
core.clearMap('weathersnow');
ctx.fillStyle = "rgba(255, 255, 255, 0.8)";
ctx.beginPath();
if (!core.animateFrame.weather.data) core.animateFrame.weather.data = {};
core.animateFrame.weather.data.snow = core.animateFrame.weather.data.snow || 0;
core.animateFrame.weather.data.snow += 0.01;
var angle = core.animateFrame.weather.data.snow;
core.animateFrame.weather.nodes.snow.forEach(function (p) {
ctx.moveTo(p.x - ox, p.y - oy);
ctx.arc(p.x - ox, p.y - oy, p.r, 0, Math.PI * 2, true);
// update
p.x += Math.sin(angle) * core.animateFrame.weather.level.snow;
p.y += Math.cos(angle + p.d) + 1 + p.r / 2;
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() * core.bigmap.width * 32;
p.y = -10;
} else {
if (Math.sin(angle) > 0)
p.x = -5;
else
p.x = core.bigmap.width * 32 + 5;
p.y = Math.random() * core.bigmap.height * 32;
}
}
});
ctx.fill();
};
// 图片天气
control.prototype.__animateFrame_weather_image = function (image, type) {
if (!image) return;
var node = core.animateFrame.weather.nodes[type][0];
core.setAlpha('weather' + type, node.level / 500);
var wind = 1.5;
var width = image.width,
height = image.height;
node.x += node.dx * wind;
node.y += (2 * node.dy - 1) * wind;
if (node.x + 3 * width <= core.__PIXELS__) {
node.x += 4 * width;
while (node.x > 0) node.x -= width;
}
node.dy += node.delta;
if (node.dy >= 1) {
node.delta = -0.001;
} else if (node.dy <= 0) {
node.delta = 0.001;
}
if (node.y + 3 * height <= core.__PIXELS__) {
node.y += 4 * height;
while (node.y > 0) node.y -= height;
} else if (node.y >= 0) {
node.y -= height;
}
for (var i = 0; i < 3; ++i) {
for (var j = 0; j < 3; ++j) {
if (node.x + (i + 1) * width <= 0 || node.x + i * width >= core.__PIXELS__ ||
node.y + (j + 1) * height <= 0 || node.y + j * height >= core.__PIXELS__)
continue;
core.drawImage('weather' + type, image, node.x + i * width, node.y + j * height);
}
}
core.setAlpha('weather' + type, 1);
};
// 雾
control.prototype._animationFrame_weather_fog = function () {
core.clearMap('weatherfog');
this.__animateFrame_weather_image(core.animateFrame.weather.fog, 'fog');
};
// 云
control.prototype._animationFrame_weather_cloud = function () {
core.clearMap('weathercloud');
this.__animateFrame_weather_image(core.animateFrame.weather.cloud, 'cloud');
}
}
}

View File

@ -1,4 +1,5 @@
html, body {
html,
body {
margin: 0;
padding: 0;
width: 100%;
@ -89,7 +90,7 @@
}
#startTopHint {
color: #66CCFF;
color: #66ccff;
position: absolute;
bottom: 0;
left: 5%;
@ -98,12 +99,12 @@
}
#startBackground {
position:absolute;
top:50%;
left:50%;
position: absolute;
top: 50%;
left: 50%;
height: 100%;
width: 100%;
transform:translate(-50%,-50%);
transform: translate(-50%, -50%);
z-index: 260;
}
@ -144,8 +145,8 @@
/* default value */
background-color: #000000;
opacity: 0.55;
color: #FFFFFF;
border: #FFFFFF 0px solid;
color: #ffffff;
border: #ffffff 0px solid;
caret-color: #ffffff;
border-radius: 0px;
}
@ -161,7 +162,7 @@
.startButton {
width: 100%;
margin: 0;
font:1.2rem "pala", sans-serif;
font: 1.2rem pala, sans-serif;
font-weight: normal;
display: block;
cursor: pointer;
@ -216,19 +217,19 @@
left: 0;
padding: 3px;
}
#statusBar .status{
#statusBar .status {
position: relative;
display: block;
float: left;
width: 100%;
}
.status img{
.status img {
vertical-align: middle;
width: auto;
height: 100%;
max-height: 1.6em;
}
#statusBar span{
#statusBar span {
font: bold italic 1.1em Verdana;
display: inline;
}
@ -251,7 +252,7 @@
display: none;
padding: 3px;
}
#toolBar .tools{
#toolBar .tools {
position: relative;
display: block;
float: left;
@ -268,7 +269,12 @@ p#hard {
word-break: keep-all;
}
span#poison, span#weak, span#curse, span#pickaxe, span#bomb, span#fly {
span#poison,
span#weak,
span#curse,
span#pickaxe,
span#bomb,
span#fly {
font-style: normal;
font-size: 1em;
}
@ -350,8 +356,8 @@ p#name {
position: fixed;
top: 0;
left: 0;
background: rgba(127,127,127,0.6);
z-index: 2000
background: rgba(127, 127, 127, 0.6);
z-index: 2000;
}
#inputDialog {
@ -377,7 +383,7 @@ p#name {
margin-bottom: 10px;
padding: 5px 3px;
border: 1px solid;
background: #F0F0F0;
background: #f0f0f0;
}
#inputYes {
@ -386,24 +392,37 @@ p#name {
}
#inputNo {
float:right;
float: right;
margin-right: 10%;
}
#_selector, ._uievent_selector {
#_selector,
._uievent_selector {
animation: selector 2s ease-in-out 0s infinite normal none running;
}
@-webkit-keyframes selector {
0% { opacity: 0.95; }
50% { opacity: 0.55; }
100% { opacity: 0.95; }
0% {
opacity: 0.95;
}
50% {
opacity: 0.55;
}
100% {
opacity: 0.95;
}
}
@keyframes selector {
0% { opacity: 0.95; }
50% { opacity: 0.55; }
100% { opacity: 0.95; }
0% {
opacity: 0.95;
}
50% {
opacity: 0.55;
}
100% {
opacity: 0.95;
}
}
#next {
@ -416,8 +435,8 @@ p#name {
border-bottom-style: solid;
border-right-width: 4px;
border-right-style: solid;
-webkit-animation: next .5s ease-in-out alternate infinite;
animation: next .5s ease-in-out alternate infinite;
-webkit-animation: next 0.5s ease-in-out alternate infinite;
animation: next 0.5s ease-in-out alternate infinite;
left: 0;
top: 0;
opacity: 0.7;
@ -467,15 +486,27 @@ p#name {
}
@-webkit-keyframes startImage {
0% { opacity: 0; }
60% { opacity: 1; }
100% { opacity: 0; }
0% {
opacity: 0;
}
60% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@keyframes startImage {
0% { opacity: 0; }
60% { opacity: 1; }
100% { opacity: 0; }
0% {
opacity: 0;
}
60% {
opacity: 1;
}
100% {
opacity: 0;
}
}
.startImageDivAnimation {
@ -484,13 +515,21 @@ p#name {
}
@-webkit-keyframes startImageDivDisappear {
0% { opacity: 1 }
100% { opacity: 0 }
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@keyframes startImageDivDisappear {
0% { opacity: 1 }
100% { opacity: 0 }
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
#ui-editor {
z-index: 9999;
@ -517,15 +556,27 @@ p#name {
}
@keyframes warning {
0 % { text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0);}
50 % { text-shadow: 0px 0px 30px rgba(255, 0, 0, 1), 0px 0px 6px rgb(129, 0, 0);}
100 % { text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0);}
0 % {
text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0);
}
50 % {
text-shadow: 0px 0px 30px rgba(255, 0, 0, 1), 0px 0px 6px rgb(129, 0, 0);
}
100 % {
text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0);
}
}
@-webkit - keyframes warning {
0 % { text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0);}
50 % { text-shadow: 0px 0px 30px rgba(255, 0, 0, 1), 0px 0px 6px rgb(129, 0, 0);}
100 % { text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0);}
0 % {
text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0);
}
50 % {
text-shadow: 0px 0px 30px rgba(255, 0, 0, 1), 0px 0px 6px rgb(129, 0, 0);
}
100 % {
text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0);
}
}
.gameCanvas {