From 53b43bb6e1bae0445a12410151109735f6533f76 Mon Sep 17 00:00:00 2001
From: strawberry42271 <2806566736@qq.com>
Date: Fri, 3 Jan 2025 13:05:30 +0800
Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E6=9C=BAop=E8=B7=B3=E8=BF=87?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
project/plugins.js | 1010 ++++++++++++++++++++++----------------------
1 file changed, 505 insertions(+), 505 deletions(-)
diff --git a/project/plugins.js b/project/plugins.js
index 6f2ead4..6698b48 100644
--- a/project/plugins.js
+++ b/project/plugins.js
@@ -1,6 +1,5 @@
-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();
@@ -178,7 +177,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
});
};
},
- "drawLight": function () {
+ drawLight: function () {
// 绘制灯光/漆黑层效果。调用方式 core.plugin.drawLight(...)
// 【参数说明】
// name:必填,要绘制到的画布名;可以是一个系统画布,或者是个自定义画布;如果不存在则创建
@@ -244,7 +243,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
// 可以在任何地方(如afterXXX或自定义脚本事件)调用函数,方法为 core.plugin.xxx();
};
},
- "shop": function () {
+ shop: function () {
// 【全局商店】相关的功能
//
// 打开一个全局商店
@@ -520,7 +519,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
60
);
},
- "removeMap": function () {
+ removeMap: function () {
// 高层塔砍层插件,删除后不会存入存档,不可浏览地图也不可飞到。
// 推荐用法:
// 对于超高层或分区域塔,当在1区时将2区以后的地图删除;1区结束时恢复2区,进二区时删除1区地图,以此类推
@@ -609,7 +608,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
});
};
},
- "fiveLayers": function () {
+ fiveLayers: function () {
// 是否启用五图层(增加背景2层和前景2层) 将__enable置为true即会启用;启用后请保存后刷新编辑器
// 背景层2将会覆盖背景层 被事件层覆盖 前景层2将会覆盖前景层
// 另外 请注意加入两个新图层 会让大地图的性能降低一些
@@ -811,7 +810,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
};
};
},
- "itemShop": function () {
+ itemShop: function () {
// 道具商店相关的插件
// 可在全塔属性-全局商店中使用「道具商店」事件块进行编辑(如果找不到可以在入口方块中找)
@@ -1213,7 +1212,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
]);
};
},
- "enemyLevel": function () {
+ enemyLevel: function () {
// 此插件将提供怪物手册中的怪物境界显示
// 使用此插件需要先给每个怪物定义境界,方法如下:
// 点击怪物的【配置表格】,找到“【怪物】相关的表格配置”,然后在【名称】仿照增加境界定义:
@@ -1381,7 +1380,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
);
};
},
- "multiHeros": function () {
+ multiHeros: function () {
// 多角色插件
// Step 1: 启用本插件
// Step 2: 定义每个新的角色各项初始数据(参见下方注释)
@@ -1535,7 +1534,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.setFlag("heroId", toHeroId); // 保存切换到的角色ID
};
},
- "heroFourFrames": function () {
+ heroFourFrames: function () {
// 样板的勇士/跟随者移动时只使用2、4两帧,观感较差。本插件可以将四帧全用上。
// 是否启用本插件
@@ -1598,7 +1597,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
return false;
};
},
- "routeFixing": function () {
+ routeFixing: function () {
// 是否开启本插件,true 表示启用,false 表示禁用。
var __enable = true;
if (!__enable) return;
@@ -1722,7 +1721,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() 部分来取消
@@ -1979,7 +1978,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}
};
},
- "sprites": function () {
+ sprites: function () {
// 基于canvas的sprite化,摘编整理自万宁魔塔
//
// ---------------------------------------- 第一部分 js代码 (必装) --------------------------------------- //
@@ -2183,7 +2182,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
window.Sprite = Sprite;
},
- "hotReload": function () {
+ hotReload: function () {
/* ---------- 功能说明 ---------- *
1. 当 libs/ main.js index.html 中的任意一个文件被更改后,会自动刷新塔的页面
@@ -2440,7 +2439,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";
@@ -3637,7 +3636,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
};
// init() called in `afterLoadResources`.
},
- "override": function () {
+ override: function () {
core.statusBar.icons = {
floor: 0,
name: null,
@@ -3987,7 +3986,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
ctx.fillText(text, x, y);
};
},
- "额外信息": function () {
+ 额外信息: function () {
/* 宝石血瓶左下角显示数值
* 注意!!!不要在道具属性中直接操作flags,使用core.status.hero.flags或core.setFlag系列函数代替!
* 需要将 变量:itemDetail改为true才可正常运行
@@ -4144,7 +4143,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}
}
},
- "编辑器显伤": function () {
+ 编辑器显伤: function () {
// 在此增加新插件
/////// 用户设置 ///////
// 将__enable置为false将关闭插件
@@ -4418,7 +4417,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}
};
},
- "手册区分特殊属性": function () {
+ 手册区分特殊属性: function () {
// 在此增加新插件
this.arrsame = function (Arraya, Arrayb) {
let a = Arraya || [];
@@ -4770,7 +4769,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
return [enemy, texts];
};
},
- "一防减伤": function () {
+ 一防减伤: function () {
// 在此增加新插件
ui.prototype._drawBook_drawRow3 = function (
index,
@@ -4844,7 +4843,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
return this.getDefDamage(enemy, null, x, y, floorId);
};
},
- "新道具栏/装备栏": function () {
+ "新道具栏/装备栏": function () {
// 在此增加新插件
// 注:///// *** 裹起来的区域: 该区域内参数可以随意更改调整ui绘制 不会影响总体布局
// 请尽量修改该区域而不是其他区域 修改的时候最好可以对照现有ui修改
@@ -6242,7 +6241,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_
@@ -7044,7 +7043,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
@@ -7923,7 +7922,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
shake: B,
};
},
- "func": function () {
+ func: function () {
// 功能函数集,具体有哪些函数看每个函数前的注释即可
// 安装方式:直接复制到插件里面,注意新建插件自带的 function () { } 不能删
// 使用方式:可以直接使用对象解构按需引入
@@ -8363,7 +8362,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}
};
},
- "怪物碎裂特效": function () {
+ 怪物碎裂特效: function () {
// 在此增加新插件
// -------------------- 安装说明 -------------------- //
// 先安装两个在插件简介中说明的前置插件
@@ -8607,7 +8606,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
applyFragWith,
};
},
- "自定义常用事件": function () {
+ 自定义常用事件: function () {
// editorBlocklyconfigPlus.js
// 自訂常見事件模板插件
// 本插件引用了通用函數插件(Utility.js)
@@ -9888,7 +9887,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");
@@ -10119,7 +10118,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}
};
},
- "瞬移轨迹": function () {
+ 瞬移轨迹: function () {
// 在此增加新插件
function popMove() {
var ctx = core.getContextByName("popMove");
@@ -10198,7 +10197,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}
};
},
- "墓碑(编辑器)": function () {
+ "墓碑(编辑器)": function () {
// 在此增加新插件
if (main.mode != "editor") return; // 编辑器模式下使用
var mapData = null;
@@ -10269,7 +10268,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.setAlpha("event2", alpha);
};
},
- "小地图": function () {
+ 小地图: function () {
// 在此增加新插件
// ----- 不可自定义 杂七杂八的变量
/** @type {{[x: string]: BFSResult}} */
@@ -10684,7 +10683,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}
};
},
- "楼传": function () {
+ 楼传: function () {
// 在此增加新插件
core.canMoveFloor = function () {
@@ -11792,7 +11791,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
0
);
},
- "CG回廊": function () {
+ CG回廊: function () {
// 在此增加新插件
const CGUI = document.createElement("canvas"); //CGui画布设置
CGUI.style.position = "absolute";
@@ -12313,7 +12312,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
main.core.ui.CG.update();
};
},
- "光标设置": function () {
+ 光标设置: function () {
// 在此增加新插件
this.changeMouse = function (
icon,
@@ -12350,7 +12349,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)
@@ -12449,7 +12448,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
else core.status.pop.push(data);
};
},
- "warning": function () {
+ warning: function () {
// 在此增加新插件
// 默认音效名
var defaultSound = "jingbao.mp3";
@@ -12512,7 +12511,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}, 1600);
};
},
- "立体声音效": function () {
+ 立体声音效: function () {
// 在此增加新插件
// 音效双声道播放
var can = true;
@@ -12616,7 +12615,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}, 10);
};
},
- "滑动转场": function () {
+ 滑动转场: function () {
// 在此增加新插件
const defaultChange = {
left: "leftPortal", // 左箭头
@@ -12806,7 +12805,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}, 25);
};
},
- "剧情cg": function () {
+ 剧情cg: function () {
// 在此增加新插件
const cg = document.createElement("canvas"); //cg画布设置
cg.style.position = "absolute";
@@ -12822,7 +12821,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
cg.onmouseup = function (e) {
//鼠标抬起
+
try {
+ e.stopPropagation();
if (!core.isPlaying()) return false;
core.unregisterAnimationFrame("skip");
let a = core.getFlag("skip", false);
@@ -12840,6 +12841,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
cg.onmousedown = function (e) {
//鼠标按下
try {
+ e.stopPropagation();
if (!core.isPlaying()) return false;
const left = core.dom.gameGroup.offsetLeft;
const top = core.dom.gameGroup.offsetTop;
@@ -12852,7 +12854,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
};
cg.ontouchend = function (e) {
//触摸抬起
+
try {
+ e.preventDefault();
if (!core.isPlaying()) return false;
core.unregisterAnimationFrame("skip");
core.setFlag("skip", false);
@@ -12871,6 +12875,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
cg.ontouchstart = function (e) {
//触摸按下
try {
+ e.preventDefault();
if (!core.isPlaying()) return false;
const left = core.dom.gameGroup.offsetLeft;
const top = core.dom.gameGroup.offsetTop;
@@ -13314,7 +13319,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";
@@ -13804,7 +13809,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}
};
},
- "属性映射": function () {
+ 属性映射: function () {
// 在此增加新插件
this.statusEquip = function () {
const hero = core.status.hero;
@@ -13870,7 +13875,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.status.hero = hero;
};
},
- "回合制boss战": function () {
+ 回合制boss战: function () {
// 在此增加新插件
const boss = document.createElement("canvas"); //boss战画布设置
boss.style.position = "absolute";
@@ -13918,483 +13923,478 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}
core.ui.boss = new boss1();
},
- "剧情视频引用": function () {
- // 在此增加新插件
- let a;
- let bgm;
+ 剧情视频引用: function () {
+ // 在此增加新插件
+ let a;
+ let bgm;
+ function gtouchstart() {
+ timeOutEvent = setTimeout(() => {
+ video.remove();
+ video1.remove();
+ core.doAction();
+ clearTimeout(a);
+ core.playBgm(bgm);
+ core.resumeBgm();
+ }, 2000); //这里设置定时器,定义长按500毫秒触发长按事件,时间可以自己改,个人感觉500毫秒非常合适
+ return false;
+ }
- function gtouchstart() {
- timeOutEvent = setTimeout(() => {
- video.remove();
- video1.remove();
- core.doAction();
- clearTimeout(a);
- core.playBgm(bgm);
- core.resumeBgm();
- }, 2000); //这里设置定时器,定义长按500毫秒触发长按事件,时间可以自己改,个人感觉500毫秒非常合适
- return false;
- }
+ //手释放,如果在500毫秒内就释放,则取消长按事件,此时可以执行onclick应该执行的事件
+ function gtouchend() {
+ if (timeOutEvent != 0) {
+ //这里写要执行的内容(尤如onclick事件)
+ console.log("你这是点击,不是长按");
+ }
+ clearTimeout(timeOutEvent); //清除定时器
+ return false;
+ }
- //手释放,如果在500毫秒内就释放,则取消长按事件,此时可以执行onclick应该执行的事件
- function gtouchend() {
- if (timeOutEvent != 0) {
- //这里写要执行的内容(尤如onclick事件)
- console.log("你这是点击,不是长按");
- }
- clearTimeout(timeOutEvent); //清除定时器
- return false;
- }
+ this.openvideo = function () {
+ if (!core.isPlaying()) return;
+ const video = document.createElement("iframe"); //iframe设置
+ video.style.position = "absolute";
+ video.style.zIndex = 320;
+ video.style.display = "block";
+ video.id = "video";
+ main.dom.gameGroup.insertAdjacentElement("afterend", video);
+ video.style.top = "50%";
+ video.style.left = "50%";
+ video.style.transform = "translate(-50%,-50%)";
+ main.dom.video = video;
+ const video1 = document.createElement("canvas"); //video1画布设置
+ video1.style.position = "absolute";
+ video1.style.zIndex = 330;
+ video1.style.display = "block";
+ video1.id = "video1";
+ main.dom.gameGroup.insertAdjacentElement("afterend", video1);
+ video1.style.top = "50%";
+ video1.style.left = "50%";
+ video1.style.transform = "translate(-50%,-50%)";
+ const ctx = video1.getContext("2d");
+ main.dom.video1 = video1;
+ if (core.domStyle.isVertical) {
+ video.width = 416 * 3;
+ video.height = 676 * 3;
+ video.style.transform = "translate(-50%,-50%) rotate(90deg)"; //重新定位右上角为基准
+ } else {
+ video.width = 676 * 3;
+ video.height = 416 * 3;
+ video.style.transform = "translate(-50%,-50%)";
+ }
+ video1.ontouchstart = function (e) {
+ try {
+ e.preventDefault();
+ if (!core.isPlaying()) return false;
+ gtouchstart();
+ } catch (ee) {
+ main.log(ee);
+ }
+ };
+ video1.ontouchend = function (e) {
+ try {
+ e.preventDefault();
+ if (!core.isPlaying()) return false;
+ gtouchend();
+ } catch (ee) {
+ main.log(ee);
+ }
+ };
- this.openvideo = function () {
- if (!core.isPlaying()) return;
- const video = document.createElement("iframe"); //iframe设置
- video.style.position = "absolute";
- video.style.zIndex = 320;
- video.style.display = "block";
- video.id = "video";
- main.dom.gameGroup.insertAdjacentElement("afterend", video);
- video.style.top = "50%";
- video.style.left = "50%";
- video.style.transform = "translate(-50%,-50%)";
- main.dom.video = video;
- const video1 = document.createElement("canvas"); //video1画布设置
- video1.style.position = "absolute";
- video1.style.zIndex = 330;
- video1.style.display = "block";
- video1.id = "video1";
- main.dom.gameGroup.insertAdjacentElement("afterend", video1);
- video1.style.top = "50%";
- video1.style.left = "50%";
- video1.style.transform = "translate(-50%,-50%)";
- const ctx = video1.getContext("2d");
- main.dom.video1 = video1;
- if (core.domStyle.isVertical) {
- video.width = 416 * 3;
- video.height = 676 * 3;
- video.style.transform = "translate(-50%,-50%) rotate(90deg)"; //重新定位右上角为基准
- } else {
- video.width = 676 * 3;
- video.height = 416 * 3;
- video.style.transform = "translate(-50%,-50%)";
- }
- video1.ontouchstart = function (e) {
- try {
- e.preventDefault();
- if (core.isPlaying()) return false;
- gtouchstart();
- } catch (ee) {
- main.log(ee);
- }
- };
- video1.ontouchend = function (e) {
- try {
- e.preventDefault();
- if (core.isPlaying()) return false;
- gtouchend();
- } catch (ee) {
- main.log(ee);
- }
- };
+ video1.onmouseup = function (e) {
+ //鼠标抬起
+ try {
+ e.stopPropagation();
+ if (!core.isPlaying()) return false;
+ gtouchend();
+ } catch (ee) {
+ console.error(ee);
+ }
+ };
+ video1.onmousedown = function (e) {
+ //鼠标按下
+ try {
+ e.stopPropagation();
+ if (!core.isPlaying()) return false;
+ gtouchstart();
+ } catch (ee) {
+ main.log(ee);
+ }
+ };
+ let globalAlpha = 0;
+ let frame = 1;
+ let al = 0;
+ core.registerAnimationFrame("beforeop", true, function () {
+ al++;
+ ctx.globalAlpha = al / 30;
+ core.fillRect(ctx, 0, 0, video1.width, video1.height, "#000000");
+ });
+ core.control.resize();
+ //player.bilibili.com/player.html
+ //www.bilibili.com/blackboard/html5mobileplayer.html
+ //
+ video.src =
+ "///www.bilibili.com/blackboard/html5mobileplayer.html?isOutside=true&aid=6484104&bvid=BV1cs411b7cH&cid=10546155&p=1&poster=0&autoplay=1&high_quality=1&muted=0&danmaku=0";
+ video.scrolling = "no";
+ video.border = "0";
+ video.crossorigin = true;
+ video.frameborder = "no";
+ video.framespacing = "0";
+ video.allowfullscreen = false;
- video1.onmouseup = function (e) {
- //鼠标抬起
- try {
- e.stopPropagation();
- if (!core.isPlaying()) return false;
- gtouchend();
- } catch (ee) {
- console.error(ee);
- }
- };
- video1.onmousedown = function (e) {
- //鼠标按下
- try {
- e.stopPropagation();
- if (!core.isPlaying()) return false;
- gtouchstart();
- } catch (ee) {
- main.log(ee);
- }
- };
- let globalAlpha = 0;
- let frame = 1;
- let al = 0;
- core.registerAnimationFrame("beforeop", true, function () {
- al++;
- ctx.globalAlpha = al / 30;
- core.fillRect(ctx, 0, 0, video1.width, video1.height, "#000000");
- });
- core.control.resize();
- //player.bilibili.com/player.html
- //www.bilibili.com/blackboard/html5mobileplayer.html
- //
- video.src =
- "///www.bilibili.com/blackboard/html5mobileplayer.html?isOutside=true&aid=6484104&bvid=BV1cs411b7cH&cid=10546155&p=1&poster=0&autoplay=1&high_quality=1&muted=0&danmaku=0";
- video.scrolling = "no";
- video.border = "0";
- video.crossorigin = true;
- video.frameborder = "no";
- video.framespacing = "0";
- video.allowfullscreen = false;
+ video.sandbox =
+ "allow-top-navigation allow-same-origin allow-forms allow-scripts";
+ //gsl_play_mask
- video.sandbox =
- "allow-top-navigation allow-same-origin allow-forms allow-scripts";
- //gsl_play_mask
+ video.addEventListener("load", function () {
+ core.unregisterAnimationFrame("beforeop");
+ core.registerAnimationFrame("op", true, function () {
+ core.clearMap(ctx);
+ if (core.domStyle.isVertical) {
+ ctx.canvas.width = 416 * 3;
+ ctx.canvas.height = 676 * 3;
+ ctx.save(); //保存设置
+ ctx.translate(416 * 3, 0); //重新定位右上角为基准
+ ctx.rotate(Math.PI / 2); //旋转90度
+ } else {
+ ctx.canvas.width = 676 * 3;
+ ctx.canvas.height = 416 * 3;
+ }
+ ctx.globalAlpha = 1;
+ core.fillRect(ctx, 0, 0, video1.width, video1.height, "#000000");
+ ctx.globalAlpha = globalAlpha / 30;
+ core.setTextAlign(ctx, "center");
+ core.fillBoldText1(
+ ctx,
+ "长按2秒后跳过op",
+ 1014,
+ 624,
+ "#FFFFFF",
+ "#000000",
+ 6,
+ "bold 48px Verdana"
+ );
+ globalAlpha += frame;
+ if (globalAlpha > 29) frame = -1;
+ ctx.restore();
+ if (frame === -1 && globalAlpha < 0) {
+ core.clearMap(ctx);
+ core.unregisterAnimationFrame("op");
+ }
+ });
+ bgm = core.musicStatus.playingBgm;
+ core.playBgm("op.mp3");
+ a = setTimeout(() => {
+ video.remove();
+ video1.remove();
+ core.playBgm(bgm);
+ core.doAction();
+ }, 127500);
+ });
+ };
+ },
+ "帧动画/图片叠拼": function () {
+ // 在此增加新插件
+ this.animationDrawable = function (
+ allFarme,
+ color,
+ globalAlpha,
+ imageList,
+ soundList
+ ) {
+ if (!core.isPlaying()) {
+ return core.doAction();
+ }
+ const over = main.dom.over;
+ const ctx = over.getContext("2d");
+ over.style.display = "block";
- video.addEventListener("load", function () {
- core.unregisterAnimationFrame("beforeop");
- core.registerAnimationFrame("op", true, function () {
- core.clearMap(ctx);
- if (core.domStyle.isVertical) {
- ctx.canvas.width = 416 * 3;
- ctx.canvas.height = 676 * 3;
- ctx.save(); //保存设置
- ctx.translate(416 * 3, 0); //重新定位右上角为基准
- ctx.rotate(Math.PI / 2); //旋转90度
- } else {
- ctx.canvas.width = 676 * 3;
- ctx.canvas.height = 416 * 3;
- }
- ctx.globalAlpha = 1;
- core.fillRect(ctx, 0, 0, video1.width, video1.height, "#000000");
+ let farme = 0;
+ let now = 0;
+ core.registerAnimationFrame(
+ "animationDrawable",
+ true,
+ function (timestamp) {
+ if (timestamp - now > 1000 / 60) {
+ now = timestamp;
+ if (core.domStyle.isVertical) {
+ over.width = 1248;
+ over.height = 2028;
+ ctx.save(); //保存设置
+ ctx.translate(1248, 0); //重新定位右上角为基准
+ ctx.rotate(Math.PI / 2); //旋转90度
+ } else {
+ over.width = 2028;
+ over.height = 1248;
+ }
- ctx.globalAlpha = globalAlpha / 30;
- core.setTextAlign(ctx, "center");
- core.fillBoldText1(
- ctx,
- "长按2秒后跳过op",
- 1014,
- 624,
- "#FFFFFF",
- "#000000",
- 6,
- "bold 48px Verdana"
- );
- globalAlpha += frame;
- if (globalAlpha > 29) frame = -1;
- ctx.restore();
- if (frame === -1 && globalAlpha < 0) {
- core.clearMap(ctx);
- core.unregisterAnimationFrame("op");
- }
- });
- bgm = core.musicStatus.playingBgm;
- core.playBgm("op.mp3");
- a = setTimeout(() => {
- video.remove();
- video1.remove();
- core.playBgm(bgm);
- core.doAction();
- }, 127500);
- });
- };
-},
- "帧动画/图片叠拼": function () {
- // 在此增加新插件
- this.animationDrawable = function (
- allFarme,
- color,
- globalAlpha,
- imageList,
- soundList
- ) {
- if (!core.isPlaying()) {
- return core.doAction();
- }
- const over = main.dom.over;
- const ctx = over.getContext("2d");
- over.style.display = "block";
+ ctx.globalAlpha = (globalAlpha ?? 100) / 100;
+ core.fillRect(ctx, 0, 0, 2028, 1248, color);
- let farme = 0;
- let now = 0;
- core.registerAnimationFrame(
- "animationDrawable",
- true,
- function (timestamp) {
- if (timestamp - now > 1000 / 60) {
- now = timestamp;
- if (core.domStyle.isVertical) {
- over.width = 1248;
- over.height = 2028;
- ctx.save(); //保存设置
- ctx.translate(1248, 0); //重新定位右上角为基准
- ctx.rotate(Math.PI / 2); //旋转90度
- } else {
- over.width = 2028;
- over.height = 1248;
- }
+ imageList.forEach(function (one) {
+ if (
+ farme >= (one.beforefarme ?? 0) &&
+ farme <= (one.afterfarme ?? allFarme)
+ ) {
+ const img = core.material.images.images?.[one.image];
+ if (img) {
+ const gla = one.globalAlpha ?? 100;
+ const agla = one.aglobalAlpha ?? gla,
+ beforefarme = one.beforefarme ?? 0;
+ const afterfarme = one.afterfarme ?? allFarme;
- ctx.globalAlpha = (globalAlpha ?? 100) / 100;
- core.fillRect(ctx, 0, 0, 2028, 1248, color);
+ ctx.globalAlpha =
+ (gla +
+ ((agla - gla) * (farme - beforefarme)) /
+ (afterfarme - beforefarme || 1)) /
+ 100;
- imageList.forEach(function (one) {
- if (
- farme >= (one.beforefarme ?? 0) &&
- farme <= (one.afterfarme ?? allFarme)
- ) {
- const img = core.material.images.images?.[one.image];
- if (img) {
- const gla = one.globalAlpha ?? 100;
- const agla = one.aglobalAlpha ?? gla,
- beforefarme = one.beforefarme ?? 0;
- const afterfarme = one.afterfarme ?? allFarme;
+ const cx =
+ (one.cx ?? 0) +
+ (((one.acx ?? 0) - (one.cx ?? 0)) *
+ (farme - beforefarme)) /
+ (afterfarme - beforefarme || 1),
+ cy =
+ (one.cy ?? 0) +
+ (((one.acy ?? 0) - (one.cy ?? 0)) *
+ (farme - beforefarme)) /
+ (afterfarme - beforefarme || 1),
+ cw =
+ (one.cw ?? img.width) +
+ (((one.acw ?? img.width) - (one.cw ?? img.width)) *
+ (farme - beforefarme)) /
+ (afterfarme - beforefarme || 1),
+ ch =
+ (one.ch ?? img.height) +
+ (((one.acw ?? img.height) - (one.cw ?? img.height)) *
+ (farme - beforefarme)) /
+ (afterfarme - beforefarme || 1),
+ x =
+ (one.x ?? 0) +
+ (((one.ax ?? 0) - (one.x ?? 0)) * (farme - beforefarme)) /
+ (afterfarme - beforefarme || 1),
+ y =
+ (one.y ?? 0) +
+ (((one.ay ?? 0) - (one.y ?? 0)) * (farme - beforefarme)) /
+ (afterfarme - beforefarme || 1),
+ w =
+ (one.w ?? 2028) +
+ (((one.aw ?? 2028) - (one.w ?? 2028)) *
+ (farme - beforefarme)) /
+ (afterfarme - beforefarme || 1),
+ h =
+ (one.h ?? 1248) +
+ (((one.aw ?? 1248) - (one.w ?? 1248)) *
+ (farme - beforefarme)) /
+ (afterfarme - beforefarme || 1);
+ ctx.drawImage(img, cx, cy, cw, ch, x, y, w, h);
+ }
+ }
+ });
+ soundList.forEach(function (one) {
+ const lisen =
+ one.sound &&
+ core.material.sounds[one.sound] &&
+ core.musicStatus.soundStatus;
+ if (farme == one.startfarme && lisen) {
+ if (one.stopbefore) core.stopSound();
+ core.playSound(sound);
+ }
+ });
+ farme++;
+ ctx.globalAlpha = 1;
+ ctx.restore();
- ctx.globalAlpha =
- (gla +
- ((agla - gla) * (farme - beforefarme)) /
- (afterfarme - beforefarme || 1)) /
- 100;
+ if (farme > allFarme) {
+ core.unregisterAnimationFrame("animationDrawable");
+ over.style.display = "none";
+ core.doAction();
+ }
+ }
+ }
+ );
+ };
+ },
+ musicMode: function () {
+ // 在此增加新插件
+ const music = document.createElement("canvas"); //CGui画布设置
+ music.style.position = "absolute";
+ music.style.zIndex = 300;
+ music.style.display = "none";
+ music.id = "music";
+ main.dom.gameGroup.insertAdjacentElement("afterend", music);
+ music.style.top = "50%";
+ music.style.left = "50%";
+ music.style.transform = "translate(-50%,-50%)";
+ const ctx = music.getContext("2d");
+ main.dom.music = music;
+ let page = 0; //初始页面
+ let show = false; //展示状态
+ music.onclick = function (e) {
+ try {
+ e.preventDefault();
+ if (core.isPlaying()) return false;
+ const left = core.dom.gameGroup.offsetLeft;
+ const top = core.dom.gameGroup.offsetTop;
+ const px = Math.floor((e.clientX - left) / core.domStyle.scale),
+ py = Math.floor((e.clientY - top) / core.domStyle.scale);
+ core.ui.music.onclick(px * 3, py * 3);
+ } catch (ee) {
+ main.log(ee);
+ }
+ };
- const cx =
- (one.cx ?? 0) +
- (((one.acx ?? 0) - (one.cx ?? 0)) *
- (farme - beforefarme)) /
- (afterfarme - beforefarme || 1),
- cy =
- (one.cy ?? 0) +
- (((one.acy ?? 0) - (one.cy ?? 0)) *
- (farme - beforefarme)) /
- (afterfarme - beforefarme || 1),
- cw =
- (one.cw ?? img.width) +
- (((one.acw ?? img.width) - (one.cw ?? img.width)) *
- (farme - beforefarme)) /
- (afterfarme - beforefarme || 1),
- ch =
- (one.ch ?? img.height) +
- (((one.acw ?? img.height) - (one.cw ?? img.height)) *
- (farme - beforefarme)) /
- (afterfarme - beforefarme || 1),
- x =
- (one.x ?? 0) +
- (((one.ax ?? 0) - (one.x ?? 0)) * (farme - beforefarme)) /
- (afterfarme - beforefarme || 1),
- y =
- (one.y ?? 0) +
- (((one.ay ?? 0) - (one.y ?? 0)) * (farme - beforefarme)) /
- (afterfarme - beforefarme || 1),
- w =
- (one.w ?? 2028) +
- (((one.aw ?? 2028) - (one.w ?? 2028)) *
- (farme - beforefarme)) /
- (afterfarme - beforefarme || 1),
- h =
- (one.h ?? 1248) +
- (((one.aw ?? 1248) - (one.w ?? 1248)) *
- (farme - beforefarme)) /
- (afterfarme - beforefarme || 1);
- ctx.drawImage(img, cx, cy, cw, ch, x, y, w, h);
- }
- }
- });
- soundList.forEach(function (one) {
- const lisen =
- one.sound &&
- core.material.sounds[one.sound] &&
- core.musicStatus.soundStatus;
- if (farme == one.startfarme && lisen) {
- if (one.stopbefore) core.stopSound();
- core.playSound(sound);
- }
- });
- farme++;
- ctx.globalAlpha = 1;
- ctx.restore();
+ class musicclass {
+ constructor() {
+ //music列表
+ //需全塔属性注册并保存在bgms文件夹,每个数组为显示的一页内容
+ this.musicMx = [
+ ["Asphodelus_Ceui.mp3", "Blind_Alley.mp3"],
+ ["Crawler.mp3", "op.mp3", "theme.mp3"],
+ ];
+ //音乐别名(将在播放器内显示的音乐名,music列表内的都要有对应歌名)
+ this.musicname = {
+ "Asphodelus_Ceui.mp3": "Asphodelus",
+ "Blind_Alley.mp3": "Blind",
+ "Crawler.mp3": "Crawler",
+ "op.mp3": "op",
+ "theme.mp3": "theme",
+ };
+ }
- if (farme > allFarme) {
- core.unregisterAnimationFrame("animationDrawable");
- over.style.display = "none";
- core.doAction();
- }
- }
- }
- );
- };
-},
- "musicMode": function () {
- // 在此增加新插件
- const music = document.createElement("canvas"); //CGui画布设置
- music.style.position = "absolute";
- music.style.zIndex = 300;
- music.style.display = "none";
- music.id = "music";
- main.dom.gameGroup.insertAdjacentElement("afterend", music);
- music.style.top = "50%";
- music.style.left = "50%";
- music.style.transform = "translate(-50%,-50%)";
- const ctx = music.getContext("2d");
- main.dom.music = music;
- let page = 0; //初始页面
- let show = false; //展示状态
- music.onclick = function (e) {
- try {
- e.preventDefault();
- if (core.isPlaying()) return false;
- const left = core.dom.gameGroup.offsetLeft;
- const top = core.dom.gameGroup.offsetTop;
- const px = Math.floor((e.clientX - left) / core.domStyle.scale),
- py = Math.floor((e.clientY - top) / core.domStyle.scale);
- core.ui.music.onclick(px * 3, py * 3);
- } catch (ee) {
- main.log(ee);
- }
- };
+ //更新
+ update() {
+ this.background();
+ this.drawUI();
+ }
+ background() {
+ //画布大小设置
+ if (core.domStyle.isVertical) {
+ music.width = 1248;
+ music.height = 2028;
+ } else {
+ music.width = 2028;
+ music.height = 1248;
+ }
+ }
+ onclick(px, py) {
+ //点击
+ if (show) {
+ show = !show;
+ core.clearMap(ctx);
+ this.update();
+ return;
+ }
+ const makeBox = ([x, y], [w, h]) => {
+ return [
+ [x, y],
+ [x + w, y + h],
+ ];
+ };
+ const inRect = ([x, y], [[sx, sy], [dx, dy]]) => {
+ return sx <= x && x <= dx && sy <= y && y <= dy;
+ };
+ const pos = [px, py];
+ const backbox = makeBox([45, 45], [120, 80]);
+ if (inRect(pos, backbox)) {
+ //离开按钮是一致的,其余的记区分横竖屏
+ music.style.display = "none";
+ core.clearMap(ctx);
+ core.restart();
+ return;
+ }
+ }
+ drawUI() {
+ //绘制页面
+ core.clearMap(music);
+ const bgVertical = core.material.images.images["bg_2010.png"]; //竖屏背景
+ const bg = core.material.images.images["bg_5043.png"]; //竖屏背景
+ if (core.domStyle.isVertical) {
+ //竖屏
- class musicclass {
- constructor() {
- //music列表
- //需全塔属性注册并保存在bgms文件夹,每个数组为显示的一页内容
- this.musicMx = [
- ["Asphodelus_Ceui.mp3", "Blind_Alley.mp3"],
- ["Crawler.mp3", "op.mp3", "theme.mp3"],
- ];
- //音乐别名(将在播放器内显示的音乐名,music列表内的都要有对应歌名)
- this.musicname = {
- "Asphodelus_Ceui.mp3": "Asphodelus",
- "Blind_Alley.mp3": "Blind",
- "Crawler.mp3": "Crawler",
- "op.mp3": "op",
- "theme.mp3": "theme",
- };
- }
+ core.fillRect(ctx, 0, 0, 1248, 2028, "#000000"); //黑色背景
+ ctx.globalAlpha = 0.5; //透明度
+ if (bgVertical)
+ ctx.drawImage(bgVertical, 0, 0, 1280, 1500, 0, 0, 1248, 2028); //绘制半透明背景图片
+ ctx.globalAlpha = 1; //恢复为不透明
- //更新
- update() {
- this.background();
- this.drawUI();
- }
- background() {
- //画布大小设置
- if (core.domStyle.isVertical) {
- music.width = 1248;
- music.height = 2028;
- } else {
- music.width = 2028;
- music.height = 1248;
- }
- }
- onclick(px, py) {
- //点击
- if (show) {
- show = !show;
- core.clearMap(ctx);
- this.update();
- return;
- }
- const makeBox = ([x, y], [w, h]) => {
- return [
- [x, y],
- [x + w, y + h],
- ];
- };
- const inRect = ([x, y], [
- [sx, sy],
- [dx, dy]
- ]) => {
- return sx <= x && x <= dx && sy <= y && y <= dy;
- };
- const pos = [px, py];
- const backbox = makeBox([45, 45], [120, 80]);
- if (inRect(pos, backbox)) {
- //离开按钮是一致的,其余的记区分横竖屏
- music.style.display = "none";
- core.clearMap(ctx);
- core.restart();
- return;
- }
- }
- drawUI() {
- //绘制页面
- core.clearMap(music);
- const bgVertical = core.material.images.images["bg_2010.png"]; //竖屏背景
- const bg = core.material.images.images["bg_5043.png"]; //竖屏背景
- if (core.domStyle.isVertical) {
- //竖屏
-
- core.fillRect(ctx, 0, 0, 1248, 2028, "#000000"); //黑色背景
- ctx.globalAlpha = 0.5; //透明度
- if (bgVertical)
- ctx.drawImage(bgVertical, 0, 0, 1280, 1500, 0, 0, 1248, 2028); //绘制半透明背景图片
- ctx.globalAlpha = 1; //恢复为不透明
-
- core.setTextAlign(ctx, "center");
- core.fillRoundRect(
- ctx,
- 45 - 6,
- 45 - 6,
- 120 + 12,
- 80 + 12,
- 6,
- "#444444"
- );
- core.strokeRoundRect(
- ctx,
- 45 - 12,
- 45 - 12,
- 120 + 24,
- 80 + 24,
- 12,
- "#444444",
- 3
- );
- core.fillBoldText1(
- ctx,
- "<离开",
- 110,
- 100,
- "#FFFFFF",
- "#000000",
- 6,
- core.ui._buildFont(33, true)
- );
- } else {
- //横屏
- core.fillRect(ctx, 0, 0, 2028, 1248, "#000000"); //黑色背景
- ctx.globalAlpha = 0.5; //透明度
- if (bg) ctx.drawImage(bg, 0, 0, 1280, 720, 0, 0, 2028, 1248); //绘制半透明背景图片
- ctx.globalAlpha = 1; //恢复为不透明
- core.setTextAlign(ctx, "center");
- core.fillRoundRect(
- ctx,
- 45 - 6,
- 45 - 6,
- 120 + 12,
- 80 + 12,
- 6,
- "#444444"
- );
- core.strokeRoundRect(
- ctx,
- 45 - 12,
- 45 - 12,
- 120 + 24,
- 80 + 24,
- 12,
- "#444444",
- 3
- );
- core.fillBoldText1(
- ctx,
- "<离开",
- 110,
- 100,
- "#FFFFFF",
- "#000000",
- 6,
- core.ui._buildFont(33, true)
- );
- }
- }
- }
- core.ui.music = new musicclass();
- main.dom.musicMode.onclick = function () {
- //点击开始页面的CG MODE进入cg回廊
- main.core.control.checkBgm();
- page = 0;
- music.style.display = "block";
- main.core.ui.music.update();
- };
-}
-}
\ No newline at end of file
+ core.setTextAlign(ctx, "center");
+ core.fillRoundRect(
+ ctx,
+ 45 - 6,
+ 45 - 6,
+ 120 + 12,
+ 80 + 12,
+ 6,
+ "#444444"
+ );
+ core.strokeRoundRect(
+ ctx,
+ 45 - 12,
+ 45 - 12,
+ 120 + 24,
+ 80 + 24,
+ 12,
+ "#444444",
+ 3
+ );
+ core.fillBoldText1(
+ ctx,
+ "<离开",
+ 110,
+ 100,
+ "#FFFFFF",
+ "#000000",
+ 6,
+ core.ui._buildFont(33, true)
+ );
+ } else {
+ //横屏
+ core.fillRect(ctx, 0, 0, 2028, 1248, "#000000"); //黑色背景
+ ctx.globalAlpha = 0.5; //透明度
+ if (bg) ctx.drawImage(bg, 0, 0, 1280, 720, 0, 0, 2028, 1248); //绘制半透明背景图片
+ ctx.globalAlpha = 1; //恢复为不透明
+ core.setTextAlign(ctx, "center");
+ core.fillRoundRect(
+ ctx,
+ 45 - 6,
+ 45 - 6,
+ 120 + 12,
+ 80 + 12,
+ 6,
+ "#444444"
+ );
+ core.strokeRoundRect(
+ ctx,
+ 45 - 12,
+ 45 - 12,
+ 120 + 24,
+ 80 + 24,
+ 12,
+ "#444444",
+ 3
+ );
+ core.fillBoldText1(
+ ctx,
+ "<离开",
+ 110,
+ 100,
+ "#FFFFFF",
+ "#000000",
+ 6,
+ core.ui._buildFont(33, true)
+ );
+ }
+ }
+ }
+ core.ui.music = new musicclass();
+ main.dom.musicMode.onclick = function () {
+ //点击开始页面的CG MODE进入cg回廊
+ main.core.control.checkBgm();
+ page = 0;
+ music.style.display = "block";
+ main.core.ui.music.update();
+ };
+ },
+};