修改字体、天气

This commit is contained in:
草莓 2025-04-21 20:51:33 +08:00
parent 7e3625e637
commit 83d38be844
6 changed files with 272 additions and 262 deletions

View File

@ -3000,7 +3000,7 @@ return code;
*/; */;
setWeather_s setWeather_s
: '更改天气' Weather_List '强度' Int '持续到下个本事件' Bool Newline : '更改天气' Weather_List '强度' Int Newline
/* setWeather_s /* setWeather_s
@ -3009,8 +3009,8 @@ helpUrl : /_docs/#/instruction
default : [null,1,true] default : [null,1,true]
colour : this.soundColor colour : this.soundColor
if(Int_0<1 || Int_0>10) throw new Error('天气的强度等级, 在1-10之间'); if(Int_0<1 || Int_0>10) throw new Error('天气的强度等级, 在1-10之间');
Bool_0 = Bool_0 ? ', "keep": true' : ''
var code = '{"type": "setWeather", "name": "'+Weather_List_0+'", "level": '+Int_0+Bool_0+'},\n'; var code = '{"type": "setWeather", "name": "'+Weather_List_0+'", "level": '+Int_0+'},\n';
if(Weather_List_0===''||Weather_List_0==='null'||Weather_List_0==null)code = '{"type": "setWeather"},\n'; if(Weather_List_0===''||Weather_List_0==='null'||Weather_List_0==null)code = '{"type": "setWeather"},\n';
return code; return code;
*/; */;

View File

@ -1494,7 +1494,6 @@ MotaActionParser = function () {
this.next = MotaActionBlocks["setWeather_s"].xmlText([ this.next = MotaActionBlocks["setWeather_s"].xmlText([
data.name, data.name,
data.level || 1, data.level || 1,
data.keep || false,
this.next, this.next,
]); ]);
break; break;

View File

@ -1452,8 +1452,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"HATTEN", "HATTEN",
"Verdana", "Verdana",
"number", "number",
"pala", "pala"
"simhei"
], ],
"nameMap": { "nameMap": {
"确定": "confirm.opus", "确定": "confirm.opus",

Binary file not shown.

Binary file not shown.

View File

@ -3114,6 +3114,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
"mhp", "mhp",
"speed", "speed",
"money", "money",
"exp"
]; //属性列表图标在函数复写core.statusBar.icons中声明数字为project\materials\icons.png中的图标序号可使用便捷ps追加第一个序号为0 ]; //属性列表图标在函数复写core.statusBar.icons中声明数字为project\materials\icons.png中的图标序号可使用便捷ps追加第一个序号为0
const drawStatusList = (baseX, baseY) => { const drawStatusList = (baseX, baseY) => {
let curh = baseY; let curh = baseY;
@ -3138,7 +3139,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
curh - 4 * 3, curh - 4 * 3,
TEXT_COLOR, TEXT_COLOR,
"#000000", "#000000",
6 3
); );
core.setFont("outerUI", "bold 36px Verdana"); core.setFont("outerUI", "bold 36px Verdana");
// 四舍五入 // 四舍五入
@ -3161,8 +3162,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
curh, curh,
TEXT_COLOR, TEXT_COLOR,
"#000000", "#000000",
6 3
); )
curh += 24 * 3; curh += 24 * 3;
if (curh > 130 * 3 && core.domStyle.isVertical) { if (curh > 130 * 3 && core.domStyle.isVertical) {
@ -3183,7 +3184,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
22 * 3, 22 * 3,
TEXT_COLOR, TEXT_COLOR,
"#000000", "#000000",
6 3
); );
} }
drawStatusList(96 * 3, 46 * 3); drawStatusList(96 * 3, 46 * 3);
@ -3200,7 +3201,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
41 * 3, 41 * 3,
TEXT_COLOR, TEXT_COLOR,
"#000000", "#000000",
6 3
); );
} }
drawStatusList(110 * 3, 93 * 3); drawStatusList(110 * 3, 93 * 3);
@ -21110,257 +21111,268 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}); });
}, },
"天气叠加": function () { "天气叠加": function () {
//使用方法使用core.setWeather(天气,等级)来增加天气使用core.setWeather()来清空天气 //使用方法使用core.setWeather(天气,等级)来增加天气使用core.setWeather()来清空天气
// 天气叠加功能 // 天气叠加功能
////// 更改天气效果 //////
control.prototype.setWeather = function (type, level) { ////// 更改天气效果 //////
// 非雨雪 control.prototype.setWeather = function (type, level) {
if (type == null) { // 非雨雪
Object.keys(core.control.weathers).forEach(function (one) { if (type == null) {
core.deleteCanvas("weather" + one); Object.keys(core.control.weathers).forEach(function (one) {
}); core.deleteCanvas("weather" + one);
core.animateFrame.weather.type = []; });
core.animateFrame.weather.nodes = {}; core.animateFrame.weather.type = [];
core.animateFrame.weather.level = {}; core.animateFrame.weather.nodes = {};
core.animateFrame.weather.time = {}; core.animateFrame.weather.level = {};
return; core.animateFrame.weather.time = {};
} return;
if (!core.animateFrame.weather.level || level == null) }
core.animateFrame.weather.level = {}; if (!core.animateFrame.weather.level || level == null)
if (!core.animateFrame.weather.type) core.animateFrame.weather.type = []; core.animateFrame.weather.level = {};
level = core.clamp(parseInt(level) || 5, 1, 10); if (!core.animateFrame.weather.type) core.animateFrame.weather.type = [];
// 当前天气:则忽略 level = core.clamp(parseInt(level) || 5, 1, 10);
if ( // 当前天气:则忽略
core.animateFrame.weather.type.includes(type) && if (
level == core.animateFrame.weather.level[type] core.animateFrame.weather.type.includes(type) &&
) level == core.animateFrame.weather.level[type]
return; )
if (core.animateFrame.weather.nodes[type]) return; return;
// 计算当前的宽高 if (core.animateFrame.weather.nodes[type]) return;
core.createCanvas( // 计算当前的宽高
"weather" + type, core.createCanvas(
0, "weather" + type,
0, 0,
core.__PIXELS__, 0,
core.__PIXELS__, core.__PIXELS__,
80 core.__PIXELS__,
); 80
core.animateFrame.weather.type.push(type); );
core.animateFrame.weather.level[type] = level; core.animateFrame.weather.type.push(type);
this._setWeather_createNodes(type, level); core.animateFrame.weather.level[type] = level;
}; this._setWeather_createNodes(type, level);
control.prototype._setWeather_createNodes = function (type, level) { };
var number = control.prototype._setWeather_createNodes = function (type, level) {
level * var number =
parseInt( level *
(20 * core.bigmap.width * core.bigmap.height) / parseInt(
(core.__SIZE__ * core.__SIZE__) (20 * core.bigmap.width * core.bigmap.height) /
); (core.__SIZE__ * core.__SIZE__)
if (!core.animateFrame.weather.nodes[type]) );
core.animateFrame.weather.nodes[type] = []; if (!core.animateFrame.weather.nodes[type])
switch (type) { core.animateFrame.weather.nodes[type] = [];
case "rain": switch (type) {
for (var a = 0; a < number; a++) { case "rain":
core.animateFrame.weather.nodes.rain.push({ for (var a = 0; a < number; a++) {
x: Math.random() * core.bigmap.width * 32, core.animateFrame.weather.nodes.rain.push({
y: Math.random() * core.bigmap.height * 32, x: Math.random() * core.bigmap.width * 32,
l: Math.random() * 2.5, y: Math.random() * core.bigmap.height * 32,
xs: -4 + Math.random() * 4 + 2, l: Math.random() * 2.5,
ys: Math.random() * 10 + 10, xs: -4 + Math.random() * 4 + 2,
}); ys: Math.random() * 10 + 10,
} });
break; }
case "snow": break;
for (var a = 0; a < number; a++) { case "snow":
core.animateFrame.weather.nodes.snow.push({ for (var a = 0; a < number; a++) {
x: Math.random() * core.bigmap.width * 32, core.animateFrame.weather.nodes.snow.push({
y: Math.random() * core.bigmap.height * 32, x: Math.random() * core.bigmap.width * 32,
r: Math.random() * 5 + 1, y: Math.random() * core.bigmap.height * 32,
d: Math.random() * Math.min(level, 200), r: Math.random() * 5 + 1,
}); d: Math.random() * Math.min(level, 200),
} });
break; }
case "fog": break;
if (core.animateFrame.weather.fog) { case "fog":
core.animateFrame.weather.nodes[type] = [ if (core.animateFrame.weather.fog) {
{ core.animateFrame.weather.nodes[type] = [{
level: number, level: number,
x: 0, x: 0,
y: -core.__PIXELS__ / 2, y: -core.__PIXELS__ / 2,
dx: -Math.random() * 1.5, dx: -Math.random() * 1.5,
dy: Math.random(), dy: Math.random(),
delta: 0.001, delta: 0.001,
}, }, ];
]; }
} break;
break; case "cloud":
case "cloud": if (core.animateFrame.weather.cloud) {
if (core.animateFrame.weather.cloud) { core.animateFrame.weather.nodes[type] = [{
core.animateFrame.weather.nodes[type] = [ level: number,
{ x: 0,
level: number, y: -core.__PIXELS__ / 2,
x: 0, dx: -Math.random() * 1.5,
y: -core.__PIXELS__ / 2, dy: Math.random(),
dx: -Math.random() * 1.5, delta: 0.001,
dy: Math.random(), }, ];
delta: 0.001, }
}, break;
]; case "sun":
} if (core.animateFrame.weather.sun) {
break; // 直接绘制
case "sun": core.clearMap("weather" + type);
if (core.animateFrame.weather.sun) {
// 直接绘制 core.drawImage(
core.clearMap("weather" + type); "weather" + type,
core.setAlpha("weather" + type, level / 10); core.animateFrame.weather.sun,
core.drawImage( 0,
"weather" + type, 0,
core.animateFrame.weather.sun, core.animateFrame.weather.sun.width,
0, core.animateFrame.weather.sun.height,
0, 0,
core.animateFrame.weather.sun.width, 0,
core.animateFrame.weather.sun.height, core.__PIXELS__,
0, core.__PIXELS__
0, );
core.__PIXELS__, core.setAlpha("weather" + type, level / 10);
core.__PIXELS__ core.animateFrame.weather.nodes.sun = [{ level: level, opacity: level / 10, delta: 0.01 }]
); }
core.setAlpha("weather" + type, 1); break;
} }
break; };
} core.registerAnimationFrame("weather", true, function (timestamp) {
}; var weather = core.animateFrame.weather;
core.registerAnimationFrame("weather", true, function (timestamp) { if (!weather.type) return;
var weather = core.animateFrame.weather; weather.type.forEach(function (one) {
if (!weather.type) return; if (
weather.type.forEach(function (one) { timestamp - weather.time[one] <= 30 ||
if ( !core.dymCanvas["weather" + one]
timestamp - weather.time[one] <= 30 || )
!core.dymCanvas["weather" + one] return;
) core.control["_animationFrame_weather_" + one]();
return; weather.time[one] = timestamp;
core.control["_animationFrame_weather_" + one](); });
weather.time[one] = timestamp; });
}); // 晴
}); control.prototype._animationFrame_weather_sun = function () {
// 雨
control.prototype._animationFrame_weather_rain = function () { var node = core.animateFrame.weather.nodes.sun[0]
var ctx = core.dymCanvas.weatherrain, var opacity = node.opacity + node.delta;
ox = core.bigmap.offsetX,
oy = core.bigmap.offsetY; if (opacity > node.level / 11 + 0.3 || opacity < node.level / 11 - 0.3)
core.clearMap("weatherrain"); node.delta = -node.delta;
ctx.strokeStyle = "rgba(174,194,224,0.8)"; node.opacity = opacity;
ctx.lineWidth = 1; core.setOpacity("weathersun", core.clamp(opacity, 0, 1));
ctx.lineCap = "round";
core.animateFrame.weather.nodes.rain.forEach(function (p) { };
ctx.beginPath(); // 雨
ctx.moveTo(p.x - ox, p.y - oy); control.prototype._animationFrame_weather_rain = function () {
ctx.lineTo(p.x + p.l * p.xs - ox, p.y + p.l * p.ys - oy); var ctx = core.dymCanvas.weatherrain,
ctx.stroke(); ox = core.bigmap.offsetX,
p.x += p.xs; oy = core.bigmap.offsetY;
p.y += p.ys; core.clearMap("weatherrain");
if (p.x > core.bigmap.width * 32 || p.y > core.bigmap.height * 32) { ctx.strokeStyle = "rgba(174,194,224,0.8)";
p.x = Math.random() * core.bigmap.width * 32; ctx.lineWidth = 1;
p.y = -10; ctx.lineCap = "round";
} core.animateFrame.weather.nodes.rain.forEach(function (p) {
}); ctx.beginPath();
ctx.fill(); 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();
control.prototype._animationFrame_weather_snow = function () { p.x += p.xs;
var ctx = core.dymCanvas.weathersnow, p.y += p.ys;
ox = core.bigmap.offsetX, if (p.x > core.bigmap.width * 32 || p.y > core.bigmap.height * 32) {
oy = core.bigmap.offsetY; p.x = Math.random() * core.bigmap.width * 32;
core.clearMap("weathersnow"); p.y = -10;
ctx.fillStyle = "rgba(255, 255, 255, 0.8)"; }
ctx.beginPath(); });
if (!core.animateFrame.weather.data) core.animateFrame.weather.data = {}; ctx.fill();
core.animateFrame.weather.data.snow = };
core.animateFrame.weather.data.snow || 0; // 雪
core.animateFrame.weather.data.snow += 0.01; control.prototype._animationFrame_weather_snow = function () {
var angle = core.animateFrame.weather.data.snow; var ctx = core.dymCanvas.weathersnow,
core.animateFrame.weather.nodes.snow.forEach(function (p) { ox = core.bigmap.offsetX,
ctx.moveTo(p.x - ox, p.y - oy); oy = core.bigmap.offsetY;
ctx.arc(p.x - ox, p.y - oy, p.r, 0, Math.PI * 2, true); core.clearMap("weathersnow");
// update ctx.fillStyle = "rgba(255, 255, 255, 0.8)";
p.x += Math.sin(angle) * core.animateFrame.weather.level.snow; ctx.beginPath();
p.y += Math.cos(angle + p.d) + 1 + p.r / 2; if (!core.animateFrame.weather.data) core.animateFrame.weather.data = {};
if ( core.animateFrame.weather.data.snow =
p.x > core.bigmap.width * 32 + 5 || core.animateFrame.weather.data.snow || 0;
p.x < -5 || core.animateFrame.weather.data.snow += 0.01;
p.y > core.bigmap.height * 32 var angle = core.animateFrame.weather.data.snow;
) { core.animateFrame.weather.nodes.snow.forEach(function (p) {
if (Math.random() > 1 / 3) { ctx.moveTo(p.x - ox, p.y - oy);
p.x = Math.random() * core.bigmap.width * 32; ctx.arc(p.x - ox, p.y - oy, p.r, 0, Math.PI * 2, true);
p.y = -10; // update
} else { p.x += Math.sin(angle) * core.animateFrame.weather.level.snow;
if (Math.sin(angle) > 0) p.x = -5; p.y += Math.cos(angle + p.d) + 1 + p.r / 2;
else p.x = core.bigmap.width * 32 + 5; if (
p.y = Math.random() * core.bigmap.height * 32; p.x > core.bigmap.width * 32 + 5 ||
} p.x < -5 ||
} p.y > core.bigmap.height * 32
}); ) {
ctx.fill(); if (Math.random() > 1 / 3) {
}; p.x = Math.random() * core.bigmap.width * 32;
// 图片天气 p.y = -10;
control.prototype.__animateFrame_weather_image = function (image, type) { } else {
if (!image) return; if (Math.sin(angle) > 0) p.x = -5;
var node = core.animateFrame.weather.nodes[type][0]; else p.x = core.bigmap.width * 32 + 5;
core.setAlpha("weather" + type, node.level / 500); p.y = Math.random() * core.bigmap.height * 32;
var wind = 1.5; }
var width = image.width, }
height = image.height; });
node.x += node.dx * wind; ctx.fill();
node.y += (2 * node.dy - 1) * wind; };
if (node.x + 3 * width <= core.__PIXELS__) { // 图片天气
node.x += 4 * width; control.prototype.__animateFrame_weather_image = function (image, type) {
while (node.x > 0) node.x -= width; if (!image) return;
} var node = core.animateFrame.weather.nodes[type][0];
node.dy += node.delta; core.setAlpha("weather" + type, node.level / 500);
if (node.dy >= 1) { var wind = 1.5;
node.delta = -0.001; var width = image.width,
} else if (node.dy <= 0) { height = image.height;
node.delta = 0.001; node.x += node.dx * wind;
} node.y += (2 * node.dy - 1) * wind;
if (node.y + 3 * height <= core.__PIXELS__) { if (node.x + 3 * width <= core.__PIXELS__) {
node.y += 4 * height; node.x += 4 * width;
while (node.y > 0) node.y -= height; while (node.x > 0) node.x -= width;
} else if (node.y >= 0) { }
node.y -= height; node.dy += node.delta;
} if (node.dy >= 1) {
for (var i = 0; i < 3; ++i) { node.delta = -0.001;
for (var j = 0; j < 3; ++j) { } else if (node.dy <= 0) {
if ( node.delta = 0.001;
node.x + (i + 1) * width <= 0 || }
node.x + i * width >= core.__PIXELS__ || if (node.y + 3 * height <= core.__PIXELS__) {
node.y + (j + 1) * height <= 0 || node.y += 4 * height;
node.y + j * height >= core.__PIXELS__ while (node.y > 0) node.y -= height;
) } else if (node.y >= 0) {
continue; node.y -= height;
core.drawImage( }
"weather" + type, for (var i = 0; i < 3; ++i) {
image, for (var j = 0; j < 3; ++j) {
node.x + i * width, if (
node.y + j * height node.x + (i + 1) * width <= 0 ||
); node.x + i * width >= core.__PIXELS__ ||
} node.y + (j + 1) * height <= 0 ||
} node.y + j * height >= core.__PIXELS__
core.setAlpha("weather" + type, 1); )
}; continue;
// 雾 core.drawImage(
control.prototype._animationFrame_weather_fog = function () { "weather" + type,
core.clearMap("weatherfog"); image,
this.__animateFrame_weather_image(core.animateFrame.weather.fog, "fog"); node.x + i * width,
}; node.y + j * height
// 云 );
control.prototype._animationFrame_weather_cloud = function () { }
core.clearMap("weathercloud"); }
this.__animateFrame_weather_image( core.setAlpha("weather" + type, 1);
core.animateFrame.weather.cloud, };
"cloud" // 雾
); 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"
);
}
},
"回合战斗动画": function () { "回合战斗动画": function () {
// 在此增加新插件 // 在此增加新插件
const animateAttack = document.createElement("canvas"); //画布设置 const animateAttack = document.createElement("canvas"); //画布设置