增加了一些注释

This commit is contained in:
草莓 2024-12-19 09:21:32 +08:00
parent 23cce9fc15
commit 254f0ca2a5

View File

@ -8444,7 +8444,7 @@ core.plugin.animate = {
} }
function fillTextVertical(name, text, x, y, style, boldstyle, fontsize) { function fillTextVertical(name, text, x, y, style, boldstyle, fontsize) { //竖向文字绘制
const ctx = core.ui.getContextByName(name); const ctx = core.ui.getContextByName(name);
if (!ctx) return; if (!ctx) return;
@ -8700,7 +8700,7 @@ core.plugin.animate = {
} }
} }
const replayAction_fly = function (action) { const replayAction_fly = function (action) { //楼层传送的录像操作
if (action.indexOf("fly:") != 0) return false; if (action.indexOf("fly:") != 0) return false;
var floorId = action.substring(4); var floorId = action.substring(4);
var toIndex = core.floorIds.indexOf(floorId); var toIndex = core.floorIds.indexOf(floorId);
@ -8994,7 +8994,7 @@ core.plugin.animate = {
this.background() this.background()
this.drawUI() this.drawUI()
} }
background() { background() { //画布大小设置
if (core.domStyle.isVertical) { if (core.domStyle.isVertical) {
ctx.canvas.width = 1248; ctx.canvas.width = 1248;
ctx.canvas.height = 2028; ctx.canvas.height = 2028;
@ -9203,7 +9203,7 @@ core.plugin.animate = {
} }
} }
drawUI() { drawUI() { //绘制页面
core.clearMap(CGUI) core.clearMap(CGUI)
if (!core?.material?.images?.images?.['winskin1.png']) return if (!core?.material?.images?.images?.['winskin1.png']) return
if (core.domStyle.isVertical) { //竖屏 if (core.domStyle.isVertical) { //竖屏
@ -9287,7 +9287,7 @@ core.plugin.animate = {
} }
core.ui.CG = new CG(); core.ui.CG = new CG();
main.dom.CGMode.onclick = function () { main.dom.CGMode.onclick = function () { //点击开始页面的CG MODE进入cg回廊
main.core.control.checkBgm(); main.core.control.checkBgm();
page = 0 page = 0
CGUI.style.display = "block" CGUI.style.display = "block"
@ -9321,7 +9321,7 @@ core.plugin.animate = {
"信息弹出": function () { "信息弹出": function () {
// 在此增加新插件 // 在此增加新插件
/* /*
* 使用方法core.addPop(px, py, value, color, boldColor) * 使用方法core.addPop(px, py, value, color, boldColor, left, jump, time, show, font, speed)
* 参数说明: * 参数说明:
* px & py: number 弹出位置 * px & py: number 弹出位置
* value: string 显示内容 * value: string 显示内容
@ -9540,7 +9540,7 @@ core.plugin.animate = {
upFloor: 'upFloor', // 上楼 upFloor: 'upFloor', // 上楼
downFloor: 'downFloor' // 下楼 downFloor: 'downFloor' // 下楼
}; };
const dirData = { const dirData = { //方向坐标
up: [-1, 0], up: [-1, 0],
down: [1, 0], down: [1, 0],
left: [0, -1], left: [0, -1],
@ -9673,14 +9673,14 @@ core.plugin.animate = {
const ctx = cg.getContext("2d"); const ctx = cg.getContext("2d");
main.dom.cgText = cg; main.dom.cgText = cg;
cg.onmouseup = function (e) { cg.onmouseup = function (e) { //鼠标抬起
try { try {
core.unregisterAnimationFrame("skip") core.unregisterAnimationFrame("skip")
} catch (ee) { } catch (ee) {
console.error(ee); console.error(ee);
} }
}; };
cg.onmousedown = function (e) { cg.onmousedown = function (e) { //鼠标按下
try { try {
if (!core.isPlaying()) return false; if (!core.isPlaying()) return false;
@ -9693,7 +9693,7 @@ core.plugin.animate = {
main.log(ee); main.log(ee);
} }
} }
cg.ontouchend = function (e) { cg.ontouchend = function (e) { //触摸抬起
try { try {
if (!core.isPlaying()) return false; if (!core.isPlaying()) return false;
@ -9702,7 +9702,7 @@ core.plugin.animate = {
console.error(ee); console.error(ee);
} }
}; };
cg.ontouchstart = function (e) { cg.ontouchstart = function (e) { //触摸按下
try { try {
if (!core.isPlaying()) return false; if (!core.isPlaying()) return false;
@ -9716,7 +9716,7 @@ core.plugin.animate = {
} }
} }
class cgText { class cgText {
constructor() { constructor() { //绘制需要的变量
this.image = "" this.image = ""
this.head = { name: 'face_050445.png', px: -300 } this.head = { name: 'face_050445.png', px: -300 }
this.bodyList = [{ name: 'tati_050145a.png', px: 100, filter: false }, { name: 'tati_120124.png', px: 1100, filter: true }] this.bodyList = [{ name: 'tati_050145a.png', px: 100, filter: false }, { name: 'tati_120124.png', px: 1100, filter: true }]
@ -9725,7 +9725,7 @@ core.plugin.animate = {
this.time = 0; this.time = 0;
this.WindowSkin = false; this.WindowSkin = false;
} }
click(px, py) { click(px, py) { //点击效果
const makeBox = ([x, y], [w, h]) => { const makeBox = ([x, y], [w, h]) => {
return [ return [
@ -9755,15 +9755,15 @@ core.plugin.animate = {
} }
} }
}) })
} else if ((core.domStyle.isVertical && inRect(pos, saveboxVertical) && !this.WindowSkin) || (!core.domStyle.isVertical && !this.WindowSkin && inRect(pos, savebox))) { } else if ((core.domStyle.isVertical && inRect(pos, saveboxVertical) && !this.WindowSkin) || (!core.domStyle.isVertical && !this.WindowSkin && inRect(pos, savebox))) { //存档
if (core.status.event.animateUI) return; if (core.status.event.animateUI) return;
if (core.status.event.interval != null) return; if (core.status.event.interval != null) return;
const current = core.clone(core.status.event.data.current) const current = core.clone(core.status.event.data.current)
current.showAll = true; current.showAll = true;
current.time = 0 current.time = 0
current.text = current.text.replace(/(\\(z))(\[.*?])?/g, ""); current.text = current.text.replace(/(\\(z))(\[.*?])?/g, ""); //去除当前事件所有打字机效果
cg.style.display = "none" cg.style.display = "none"
const data = [{ 'type': 'callSave' }, current] const data = [{ 'type': 'callSave' }, current] //插入存档事件
core.insertAction(data) core.insertAction(data)
core.doAction(); core.doAction();
@ -9776,7 +9776,7 @@ core.plugin.animate = {
if (core.status.event.interval != null) { if (core.status.event.interval != null) {
data.showAll = true; data.showAll = true;
data.time = 0 data.time = 0
data.text = data.text.replace(/(\\(z))(\[.*?])?/g, ""); data.text = data.text.replace(/(\\(z))(\[.*?])?/g, ""); //去除打字机暂停效果
core.insertAction(data); core.insertAction(data);
core.doAction(); core.doAction();
@ -9791,7 +9791,7 @@ core.plugin.animate = {
} }
drawTextContent(ctx, content, config) { drawTextContent(ctx, content, config) { //绘制多行文字并执行打字机效果
ctx = core.getContextByName(ctx); ctx = core.getContextByName(ctx);
// 设置默认配置项 // 设置默认配置项
@ -9910,13 +9910,13 @@ core.plugin.animate = {
ctx.canvas.height = 1248; ctx.canvas.height = 1248;
} }
if (img) { if (img) { //绘制背景
ctx.drawImage(img, 0, 0, 2028, 1248) ctx.drawImage(img, 0, 0, 2028, 1248)
} else { } else {
core.fillRect(ctx, 0, 0, 2028, 1248) core.fillRect(ctx, 0, 0, 2028, 1248)
} }
this.bodyList.forEach(v => { this.bodyList.forEach(v => { //绘制立绘
const body = core.material.images.images?.[v.name] const body = core.material.images.images?.[v.name]
if (v.filter) ctx.filter = 'brightness(50%)' if (v.filter) ctx.filter = 'brightness(50%)'
if (body) { if (body) {
@ -9924,9 +9924,9 @@ core.plugin.animate = {
} }
ctx.filter = 'none' ctx.filter = 'none'
}) })
if (core.isPlaying() && !this.WindowSkin) core.drawWindowSkin("winskin.png", ctx, 30, 802, 1968, 416) if (core.isPlaying() && !this.WindowSkin) core.drawWindowSkin("winskin.png", ctx, 30, 802, 1968, 416) //绘制对话框
const head = core.material.images.images?.[this.head.name] const head = core.material.images.images?.[this.head.name]
if (head) { if (head) { //绘制头像
ctx.drawImage(head, 0, 0, head.width, head.height, this.head.px, 1248 - head.height * 2, head.width * 2, head.height * 2) ctx.drawImage(head, 0, 0, head.width, head.height, this.head.px, 1248 - head.height * 2, head.width * 2, head.height * 2)
} }
if (core.isPlaying() && !this.WindowSkin) { if (core.isPlaying() && !this.WindowSkin) {
@ -9935,8 +9935,8 @@ core.plugin.animate = {
core.drawWindowSkin("winskin.png", ctx, 1400, 1100, 192, 96) core.drawWindowSkin("winskin.png", ctx, 1400, 1100, 192, 96)
core.fillBoldText(ctx, '▶▶', 1456, 1166, '#FFFFFF', '#000000', "bold 48px Verdana") core.fillBoldText(ctx, '▶▶', 1456, 1166, '#FFFFFF', '#000000', "bold 48px Verdana")
} }
if (this.name) core.fillBoldText(ctx, `${this.name}`, 500, 880, '#FFFFFF', '#000000', "bold 48px Verdana") if (this.name) core.fillBoldText(ctx, `${this.name}`, 500, 880, '#FFFFFF', '#000000', "bold 48px Verdana") //绘制名字
if (this.text) { if (this.text) { //绘制对话
this.drawTextContent(ctx, this.text, { this.drawTextContent(ctx, this.text, {
left: 500, left: 500,
top: 950, top: 950,