mirror of
				https://github.com/unanmed/HumanBreak.git
				synced 2025-11-04 15:12:58 +08:00 
			
		
		
		
	fix: 构建后编辑器打不开
This commit is contained in:
		
							parent
							
								
									0b611c897a
								
							
						
					
					
						commit
						0d98a6ce57
					
				@ -1,9 +1,7 @@
 | 
				
			|||||||
import { Mota } from '@user/entry-data';
 | 
					import { Mota } from '@user/entry-data';
 | 
				
			||||||
import * as Client from '@motajs/client';
 | 
					import * as Client from '@motajs/client';
 | 
				
			||||||
import * as ClientBase from '@motajs/client-base';
 | 
					import * as ClientBase from '@motajs/client-base';
 | 
				
			||||||
import * as Common from '@motajs/common';
 | 
					 | 
				
			||||||
import * as LegacyClient from '@motajs/legacy-client';
 | 
					import * as LegacyClient from '@motajs/legacy-client';
 | 
				
			||||||
import * as LegacyCommon from '@motajs/legacy-common';
 | 
					 | 
				
			||||||
import * as LegacySystem from '@motajs/legacy-system';
 | 
					import * as LegacySystem from '@motajs/legacy-system';
 | 
				
			||||||
import * as LegacyUI from '@motajs/legacy-ui';
 | 
					import * as LegacyUI from '@motajs/legacy-ui';
 | 
				
			||||||
import * as Render from '@motajs/render';
 | 
					import * as Render from '@motajs/render';
 | 
				
			||||||
@ -26,9 +24,7 @@ export function create() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    Mota.register('@motajs/client', Client);
 | 
					    Mota.register('@motajs/client', Client);
 | 
				
			||||||
    Mota.register('@motajs/client-base', ClientBase);
 | 
					    Mota.register('@motajs/client-base', ClientBase);
 | 
				
			||||||
    Mota.register('@motajs/common', Common);
 | 
					 | 
				
			||||||
    Mota.register('@motajs/legacy-client', LegacyClient);
 | 
					    Mota.register('@motajs/legacy-client', LegacyClient);
 | 
				
			||||||
    Mota.register('@motajs/legacy-common', LegacyCommon);
 | 
					 | 
				
			||||||
    Mota.register('@motajs/legacy-system', LegacySystem);
 | 
					    Mota.register('@motajs/legacy-system', LegacySystem);
 | 
				
			||||||
    Mota.register('@motajs/legacy-ui', LegacyUI);
 | 
					    Mota.register('@motajs/legacy-ui', LegacyUI);
 | 
				
			||||||
    Mota.register('@motajs/render', Render);
 | 
					    Mota.register('@motajs/render', Render);
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,6 @@
 | 
				
			|||||||
import { Mota } from './mota';
 | 
					import { Mota } from './mota';
 | 
				
			||||||
 | 
					import * as Common from '@motajs/common';
 | 
				
			||||||
 | 
					import * as LegacyCommon from '@motajs/legacy-common';
 | 
				
			||||||
import * as DataBase from '@user/data-base';
 | 
					import * as DataBase from '@user/data-base';
 | 
				
			||||||
import * as DataFallback from '@user/data-fallback';
 | 
					import * as DataFallback from '@user/data-fallback';
 | 
				
			||||||
import * as DataState from '@user/data-state';
 | 
					import * as DataState from '@user/data-state';
 | 
				
			||||||
@ -8,6 +10,8 @@ import * as LegacyPluginData from '@user/legacy-plugin-data';
 | 
				
			|||||||
export function create() {
 | 
					export function create() {
 | 
				
			||||||
    DataBase.loading.once('registered', createModule);
 | 
					    DataBase.loading.once('registered', createModule);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Mota.register('@motajs/common', Common);
 | 
				
			||||||
 | 
					    Mota.register('@motajs/legacy-common', LegacyCommon);
 | 
				
			||||||
    Mota.register('@user/data-base', DataBase);
 | 
					    Mota.register('@user/data-base', DataBase);
 | 
				
			||||||
    Mota.register('@user/data-fallback', DataFallback);
 | 
					    Mota.register('@user/data-fallback', DataFallback);
 | 
				
			||||||
    Mota.register('@user/data-state', DataState);
 | 
					    Mota.register('@user/data-state', DataState);
 | 
				
			||||||
 | 
				
			|||||||
@ -610,16 +610,6 @@ export async function loadCompressedResource() {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
    const list: CompressedLoadList = JSON.parse(data.data);
 | 
					    const list: CompressedLoadList = JSON.parse(data.data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // const d = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d;
 | 
					 | 
				
			||||||
    // 对于bgm,直接按照原来的方式加载即可
 | 
					 | 
				
			||||||
    // d.main.bgms.forEach(v => {
 | 
					 | 
				
			||||||
    //     const res = LoadTask.add('audio', `audio/${v}`);
 | 
					 | 
				
			||||||
    //     Mota.r(() => {
 | 
					 | 
				
			||||||
    //         res.once('loadStart', res => {
 | 
					 | 
				
			||||||
    //             Mota.require('var', 'bgm').add(`bgms.${v}`, res.resource!);
 | 
					 | 
				
			||||||
    //         });
 | 
					 | 
				
			||||||
    //     });
 | 
					 | 
				
			||||||
    // });
 | 
					 | 
				
			||||||
    // 对于区域内容,按照zip格式进行加载,然后解压处理
 | 
					    // 对于区域内容,按照zip格式进行加载,然后解压处理
 | 
				
			||||||
    const autotiles: Partial<Record<AllIdsOf<'autotile'>, HTMLImageElement>> =
 | 
					    const autotiles: Partial<Record<AllIdsOf<'autotile'>, HTMLImageElement>> =
 | 
				
			||||||
        {};
 | 
					        {};
 | 
				
			||||||
@ -716,7 +706,7 @@ export async function loadCompressedResource() {
 | 
				
			|||||||
                        document.fonts.add(
 | 
					                        document.fonts.add(
 | 
				
			||||||
                            new FontFace(name.slice(0, -4), font)
 | 
					                            new FontFace(name.slice(0, -4), font)
 | 
				
			||||||
                        );
 | 
					                        );
 | 
				
			||||||
                    } else if (usage === 'sound') {
 | 
					                    } else if (usage === 'sound' && main.mode === 'play') {
 | 
				
			||||||
                        const { soundPlayer } = Mota.require(
 | 
					                        const { soundPlayer } = Mota.require(
 | 
				
			||||||
                            '@user/client-modules'
 | 
					                            '@user/client-modules'
 | 
				
			||||||
                        );
 | 
					                        );
 | 
				
			||||||
 | 
				
			|||||||
@ -173,17 +173,7 @@ editor.prototype.init = function (callback) {
 | 
				
			|||||||
    editor.airwallImg = new Image();
 | 
					    editor.airwallImg = new Image();
 | 
				
			||||||
    editor.airwallImg.src = './project/materials/airwall.png';
 | 
					    editor.airwallImg.src = './project/materials/airwall.png';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var xhr = new XMLHttpRequest();
 | 
					    var execute = function() {
 | 
				
			||||||
    xhr.open('GET', 'index.html', true);
 | 
					 | 
				
			||||||
    xhr.onload = function () {
 | 
					 | 
				
			||||||
        if (xhr.status != 200) {
 | 
					 | 
				
			||||||
            alert("HTTP " + xhr.status);
 | 
					 | 
				
			||||||
            return;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        var str = xhr.response.split('<!-- injection -->');
 | 
					 | 
				
			||||||
        if (str.length != 3) window.onerror("index.html格式不正确");
 | 
					 | 
				
			||||||
        editor.dom.gameInject.innerHTML = str[1];
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        var cvs = ['bg', 'event', 'event2', 'fg'].map(function(e) {
 | 
					        var cvs = ['bg', 'event', 'event2', 'fg'].map(function(e) {
 | 
				
			||||||
            return document.getElementById(e);
 | 
					            return document.getElementById(e);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
@ -303,9 +293,6 @@ editor.prototype.init = function (callback) {
 | 
				
			|||||||
        mainScript.id = "mainScript";
 | 
					        mainScript.id = "mainScript";
 | 
				
			||||||
        mainScript.src = "main.js";
 | 
					        mainScript.src = "main.js";
 | 
				
			||||||
        editor.dom.gameInject.appendChild(mainScript);
 | 
					        editor.dom.gameInject.appendChild(mainScript);
 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    xhr.onabort = xhr.ontimeout = xhr.onerror = function () {
 | 
					 | 
				
			||||||
        alert("无法访问index.html");
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    editor.config = new editor_config();
 | 
					    editor.config = new editor_config();
 | 
				
			||||||
@ -313,7 +300,7 @@ editor.prototype.init = function (callback) {
 | 
				
			|||||||
        var theme = editor.config.get('theme', 'editor_color');
 | 
					        var theme = editor.config.get('theme', 'editor_color');
 | 
				
			||||||
        document.getElementById('color_css').href = '_server/css/' + theme + '.css';
 | 
					        document.getElementById('color_css').href = '_server/css/' + theme + '.css';
 | 
				
			||||||
        editor.dom.editorTheme.value = theme;
 | 
					        editor.dom.editorTheme.value = theme;
 | 
				
			||||||
        xhr.send();
 | 
					        execute();
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -450,7 +450,151 @@
 | 
				
			|||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <!-- <script>/* -->
 | 
					    <!-- <script>/* -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <div id="gameInject" style='display: none'></div>
 | 
					    <div id="gameInject" style='display: none'>
 | 
				
			||||||
 | 
					        <div id='gameGroup'>
 | 
				
			||||||
 | 
					            <p id='mainTips'>请稍候...</p>
 | 
				
			||||||
 | 
					            <img id='musicBtn'>
 | 
				
			||||||
 | 
					            <div id='startPanel'>
 | 
				
			||||||
 | 
					                <div id='startTop'>
 | 
				
			||||||
 | 
					                    <div id='startTopProgressBar'>
 | 
				
			||||||
 | 
					                        <div id='startTopProgress'></div>
 | 
				
			||||||
 | 
					                    </div>
 | 
				
			||||||
 | 
					                    <p id='startTopLoadTips'>资源即将开始加载</p>
 | 
				
			||||||
 | 
					                    <p id='startTopHint'>HTML5魔塔游戏平台,享受更多魔塔游戏:<br />https://h5mota.com/</p>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <img id='startBackground'>
 | 
				
			||||||
 | 
					                <p id='startLogo'></p>
 | 
				
			||||||
 | 
					                <div id='startButtonGroup'>
 | 
				
			||||||
 | 
					                    <div id='startButtons'>
 | 
				
			||||||
 | 
					                        <span class='startButton' id='playGame'>开始游戏</span>
 | 
				
			||||||
 | 
					                        <span class='startButton' id='loadGame'>载入游戏</span>
 | 
				
			||||||
 | 
					                        <span class='startButton' id='replayGame'>录像回放</span>
 | 
				
			||||||
 | 
					                    </div>
 | 
				
			||||||
 | 
					                    <div id='levelChooseButtons'></div>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					            </div>
 | 
				
			||||||
 | 
					            <div id='floorMsgGroup'>
 | 
				
			||||||
 | 
					                <p id='logoLabel'></p>
 | 
				
			||||||
 | 
					                <p id='versionLabel'></p>
 | 
				
			||||||
 | 
					                <p id='floorNameLabel'></p>
 | 
				
			||||||
 | 
					            </div>
 | 
				
			||||||
 | 
					            <div id='statusBar' class="clearfix">
 | 
				
			||||||
 | 
					                <div class="status" id="floorCol">
 | 
				
			||||||
 | 
					                    <img id="img-floor">
 | 
				
			||||||
 | 
					                    <p class='statusLabel statusText' id='floor'></p>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="status" id="nameCol">
 | 
				
			||||||
 | 
					                    <img id="img-name">
 | 
				
			||||||
 | 
					                    <p class='statusLabel statusText' id='name'></p>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="status" id="lvCol">
 | 
				
			||||||
 | 
					                    <img id="img-lv">
 | 
				
			||||||
 | 
					                    <p class='statusLabel statusText' id='lv'></p>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="status" id='hpmaxCol'>
 | 
				
			||||||
 | 
					                    <img id="img-hpmax">
 | 
				
			||||||
 | 
					                    <p class='statusLabel statusText' id='hpmax'></p>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="status" id='hpCol'>
 | 
				
			||||||
 | 
					                    <img id="img-hp">
 | 
				
			||||||
 | 
					                    <p class='statusLabel statusText' id='hp'></p>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="status" id='manaCol'>
 | 
				
			||||||
 | 
					                    <img id="img-mana">
 | 
				
			||||||
 | 
					                    <p class='statusLabel statusText' id='mana'></p>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="status" id='atkCol'>
 | 
				
			||||||
 | 
					                    <img id="img-atk">
 | 
				
			||||||
 | 
					                    <p class='statusLabel statusText' id='atk'></p>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="status" id='defCol'>
 | 
				
			||||||
 | 
					                    <img id="img-def">
 | 
				
			||||||
 | 
					                    <p class='statusLabel statusText' id='def'></p>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="status" id="mdefCol">
 | 
				
			||||||
 | 
					                    <img id="img-mdef">
 | 
				
			||||||
 | 
					                    <p class='statusLabel statusText' id='mdef'></p>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="status" id="moneyCol">
 | 
				
			||||||
 | 
					                    <img id="img-money">
 | 
				
			||||||
 | 
					                    <p class='statusLabel statusText' id='money'></p>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="status" id="expCol">
 | 
				
			||||||
 | 
					                    <img id="img-exp">
 | 
				
			||||||
 | 
					                    <p class='statusLabel statusText' id='exp'></p>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="status" id="upCol">
 | 
				
			||||||
 | 
					                    <img id="img-up">
 | 
				
			||||||
 | 
					                    <p class='statusLabel statusText' id='up'></p>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="status" id="skillCol">
 | 
				
			||||||
 | 
					                    <img id="img-skill">
 | 
				
			||||||
 | 
					                    <p class='statusLabel statusText' id='skill' style='font-style: normal'></p>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="status" id='keyCol'>
 | 
				
			||||||
 | 
					                    <span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>
 | 
				
			||||||
 | 
					                    <span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
 | 
				
			||||||
 | 
					                    <span class='statusLabel' id='redKey' style="color:#FF8888"></span>
 | 
				
			||||||
 | 
					                    <span class='statusLabel' id='greenKey' style="color:#88FF88"></span>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="status" id='pzfCol'>
 | 
				
			||||||
 | 
					                    <span class='statusLabel' id='pickaxe' style="color: #BC6E27"></span>
 | 
				
			||||||
 | 
					                    <span class='statusLabel' id='bomb' style="color: #FA14B9"></span>
 | 
				
			||||||
 | 
					                    <span class='statusLabel' id='fly' style="color: #8DB600"></span>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="status" id="debuffCol">
 | 
				
			||||||
 | 
					                    <span class='statusLabel' id='poison' style="color: #AFFCA8;"></span>
 | 
				
			||||||
 | 
					                    <span class='statusLabel' id='weak' style="color: #FECCD0;"></span>
 | 
				
			||||||
 | 
					                    <span class='statusLabel' id='curse' style="color: #C2F4E7;"></span>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                <!-- 状态栏canvas化 -->
 | 
				
			||||||
 | 
					                <canvas id="statusCanvas" style="position: absolute; left: 0; top: 0;"></canvas>
 | 
				
			||||||
 | 
					            </div>
 | 
				
			||||||
 | 
					            <div id="toolBar" class="clearfix">
 | 
				
			||||||
 | 
					                <img class="tools" id='img-book'>
 | 
				
			||||||
 | 
					                <img class="tools" id='img-fly'>
 | 
				
			||||||
 | 
					                <img class="tools" id='img-toolbox'>
 | 
				
			||||||
 | 
					                <img class="tools" id='img-keyboard'>
 | 
				
			||||||
 | 
					                <img class="tools" id='img-shop'>
 | 
				
			||||||
 | 
					                <img class="tools" id='img-save'>
 | 
				
			||||||
 | 
					                <img class="tools" id='img-load'>
 | 
				
			||||||
 | 
					                <img class="tools" id='img-settings'>
 | 
				
			||||||
 | 
					                <img class="tools" id='img-btn1' style='display:none'>
 | 
				
			||||||
 | 
					                <img class="tools" id='img-btn2' style='display:none'>
 | 
				
			||||||
 | 
					                <img class="tools" id='img-btn3' style='display:none'>
 | 
				
			||||||
 | 
					                <img class="tools" id='img-btn4' style='display:none'>
 | 
				
			||||||
 | 
					                <img class="tools" id='img-btn5' style='display:none'>
 | 
				
			||||||
 | 
					                <img class="tools" id='img-btn6' style='display:none'>
 | 
				
			||||||
 | 
					                <img class="tools" id='img-btn7' style='display:none'>
 | 
				
			||||||
 | 
					                <img class="tools" id='img-btn8' style='display:none'>
 | 
				
			||||||
 | 
					                <p class="statusLabel tools" id="hard"></p>
 | 
				
			||||||
 | 
					            </div>
 | 
				
			||||||
 | 
					            <div id="gameDraw">
 | 
				
			||||||
 | 
					                <div id="gif"></div>
 | 
				
			||||||
 | 
					                <div id="gif2"></div>
 | 
				
			||||||
 | 
					                <canvas class='gameCanvas' id='bg'></canvas>
 | 
				
			||||||
 | 
					                <canvas class='gameCanvas' id='event'></canvas>
 | 
				
			||||||
 | 
					                <canvas class='gameCanvas' id='hero'></canvas>
 | 
				
			||||||
 | 
					                <canvas class='gameCanvas' id='event2'></canvas>
 | 
				
			||||||
 | 
					                <canvas class='gameCanvas' id='fg'></canvas>
 | 
				
			||||||
 | 
					                <canvas class='gameCanvas' id='damage'></canvas>
 | 
				
			||||||
 | 
					                <canvas class='gameCanvas' id='animate'></canvas>
 | 
				
			||||||
 | 
					                <canvas class='gameCanvas' id='curtain'></canvas>
 | 
				
			||||||
 | 
					                <canvas class='gameCanvas' id='ui'></canvas>
 | 
				
			||||||
 | 
					                <canvas class='gameCanvas' id='data'>此浏览器不支持HTML5</canvas>
 | 
				
			||||||
 | 
					                <div id="next"></div>
 | 
				
			||||||
 | 
					            </div>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					        <div id='inputDiv'>
 | 
				
			||||||
 | 
					            <div id='inputDialog'>
 | 
				
			||||||
 | 
					                <p id="inputMessage">请输入文字...</p>
 | 
				
			||||||
 | 
					                <input id='inputBox' type="text" autocomplete="off" />
 | 
				
			||||||
 | 
					                <button id='inputYes'>确定</button>
 | 
				
			||||||
 | 
					                <button id='inputNo'>取消</button>
 | 
				
			||||||
 | 
					            </div>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <!-- UI预览 & 地图选点 -->
 | 
					    <!-- UI预览 & 地图选点 -->
 | 
				
			||||||
    <div id='uieventDiv' style='display: none'>
 | 
					    <div id='uieventDiv' style='display: none'>
 | 
				
			||||||
 | 
				
			|||||||
@ -267,10 +267,13 @@ function core() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
////// 初始化 //////
 | 
					////// 初始化 //////
 | 
				
			||||||
core.prototype.init = async function (coreData, callback) {
 | 
					core.prototype.init = async function (coreData, callback) {
 | 
				
			||||||
 | 
					    if (main.replayChecking) {
 | 
				
			||||||
 | 
					        console.log(`core.init should be called when not replay checking!`);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this._forwardFuncs();
 | 
					    this._forwardFuncs();
 | 
				
			||||||
    for (var key in coreData) core[key] = coreData[key];
 | 
					    for (var key in coreData) core[key] = coreData[key];
 | 
				
			||||||
    await this._loadGameProcess();
 | 
					    await this._loadGameProcess();
 | 
				
			||||||
    await this._loadPluginAsync();
 | 
					 | 
				
			||||||
    this._init_flags();
 | 
					    this._init_flags();
 | 
				
			||||||
    this._init_platform();
 | 
					    this._init_platform();
 | 
				
			||||||
    this._init_others();
 | 
					    this._init_others();
 | 
				
			||||||
@ -290,10 +293,21 @@ core.prototype.init = async function (coreData, callback) {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (main.replayChecking || main.mode === 'editor') {
 | 
					    if (main.mode === 'editor') {
 | 
				
			||||||
 | 
					        if (main.scriptCompress) {
 | 
				
			||||||
 | 
					            const { LoadTask, loadCompressedResource } = Mota.require(
 | 
				
			||||||
 | 
					                '@motajs/legacy-common'
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					            await loadCompressedResource();
 | 
				
			||||||
 | 
					            await LoadTask.load();
 | 
				
			||||||
 | 
					            core.loader._loadMaterials_afterLoad();
 | 
				
			||||||
 | 
					            core._afterLoadResources(callback);
 | 
				
			||||||
 | 
					            Mota.require('@user/data-base').loading.emit('loaded');
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
            core.loader._load(function () {
 | 
					            core.loader._load(function () {
 | 
				
			||||||
                core._afterLoadResources(callback);
 | 
					                core._afterLoadResources(callback);
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        if (main.renderLoaded)
 | 
					        if (main.renderLoaded)
 | 
				
			||||||
            Mota.require('@motajs/legacy-ui').fixedUi.open('load', {
 | 
					            Mota.require('@motajs/legacy-ui').fixedUi.open('load', {
 | 
				
			||||||
@ -312,7 +326,6 @@ core.prototype.init = async function (coreData, callback) {
 | 
				
			|||||||
core.prototype.initSync = function (coreData, callback) {
 | 
					core.prototype.initSync = function (coreData, callback) {
 | 
				
			||||||
    this._forwardFuncs();
 | 
					    this._forwardFuncs();
 | 
				
			||||||
    for (var key in coreData) core[key] = coreData[key];
 | 
					    for (var key in coreData) core[key] = coreData[key];
 | 
				
			||||||
    this._loadGameProcessSync();
 | 
					 | 
				
			||||||
    this._loadPluginSync();
 | 
					    this._loadPluginSync();
 | 
				
			||||||
    this._init_flags();
 | 
					    this._init_flags();
 | 
				
			||||||
    this._init_platform();
 | 
					    this._init_platform();
 | 
				
			||||||
@ -323,42 +336,21 @@ core.prototype.initSync = function (coreData, callback) {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
core.prototype._loadPluginAsync = async function () {
 | 
					 | 
				
			||||||
    if (!main.useCompress) {
 | 
					 | 
				
			||||||
        await main.loadScript(`project/plugins.js?v=${main.version}`);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    this._initPlugins();
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
core.prototype._loadPluginSync = function () {
 | 
					core.prototype._loadPluginSync = function () {
 | 
				
			||||||
    if (main.useCompress) main.loadMod('project', 'project', () => 0);
 | 
					    if (main.useCompress) main.loadMod('project', 'project', () => 0);
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
        main.pureData.forEach(v => main.loadMod('project', v, () => 0));
 | 
					        main.pureData.forEach(v => main.loadMod('project', v, () => 0));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    this._initPlugins();
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
core.prototype._initPlugins = function () {
 | 
					 | 
				
			||||||
    for (const [key, value] of Object.entries(
 | 
					 | 
				
			||||||
        plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1
 | 
					 | 
				
			||||||
    )) {
 | 
					 | 
				
			||||||
        try {
 | 
					 | 
				
			||||||
            value?.call(plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1);
 | 
					 | 
				
			||||||
        } catch (e) {
 | 
					 | 
				
			||||||
            console.error(`Plugin '${key}' init failed.`);
 | 
					 | 
				
			||||||
            console.error(e);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
core.prototype._loadGameProcess = async function () {
 | 
					core.prototype._loadGameProcess = async function () {
 | 
				
			||||||
    // 加载游戏进程代码
 | 
					    // 加载游戏进程代码
 | 
				
			||||||
    if (main.pluginUseCompress && main.replayChecking) {
 | 
					    if (main.scriptCompress && main.replayChecking) {
 | 
				
			||||||
        await main.loadScript(`project/processG.min.js?v=${main.version}`);
 | 
					        await main.loadScript(`data.process.js`);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        if (main.mode === 'editor') {
 | 
					        if (main.mode === 'editor') {
 | 
				
			||||||
            if (main.pluginUseCompress) {
 | 
					            if (main.scriptCompress) {
 | 
				
			||||||
                await main.loadScript(`project/processG.min.js`);
 | 
					                await main.loadScript(`data.process.js`);
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                await main.loadScript(`esm?name=src/data.ts`, true);
 | 
					                await main.loadScript(`esm?name=src/data.ts`, true);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@ -369,11 +361,6 @@ core.prototype._loadGameProcess = async function () {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
core.prototype._loadGameProcessSync = function () {
 | 
					 | 
				
			||||||
    if (main.useCompress) main.loadMod('project', 'processG', () => 0);
 | 
					 | 
				
			||||||
    else main.loadMod('project', 'processG.min', () => 0);
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
core.prototype._init_flags = function () {
 | 
					core.prototype._init_flags = function () {
 | 
				
			||||||
    core.flags = core.clone(core.data.flags);
 | 
					    core.flags = core.clone(core.data.flags);
 | 
				
			||||||
    core.values = core.clone(core.data.values);
 | 
					    core.values = core.clone(core.data.values);
 | 
				
			||||||
 | 
				
			|||||||
@ -5,6 +5,7 @@ function main() {
 | 
				
			|||||||
    this.version = '1.0.0'; // 游戏版本号;如果更改了游戏内容建议修改此version以免造成缓存问题。
 | 
					    this.version = '1.0.0'; // 游戏版本号;如果更改了游戏内容建议修改此version以免造成缓存问题。
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.useCompress = false; // 是否使用压缩文件
 | 
					    this.useCompress = false; // 是否使用压缩文件
 | 
				
			||||||
 | 
					    this.scriptCompress = false; // 是否经过打包
 | 
				
			||||||
    this.skipResourcePackage = true; // 跳过资源打包
 | 
					    this.skipResourcePackage = true; // 跳过资源打包
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.bgmRemote = false; // 是否采用远程BGM
 | 
					    this.bgmRemote = false; // 是否采用远程BGM
 | 
				
			||||||
 | 
				
			|||||||
@ -121,7 +121,11 @@ main.floors.MT0=
 | 
				
			|||||||
    "autoEvent": {},
 | 
					    "autoEvent": {},
 | 
				
			||||||
    "bgm": "cave.opus",
 | 
					    "bgm": "cave.opus",
 | 
				
			||||||
    "beforeBattle": {},
 | 
					    "beforeBattle": {},
 | 
				
			||||||
    "bg2map": [],
 | 
					    "bg2map": [
 | 
				
			||||||
    "fg2map": [],
 | 
					
 | 
				
			||||||
 | 
					],
 | 
				
			||||||
 | 
					    "fg2map": [
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					],
 | 
				
			||||||
    "cannotMoveIn": {}
 | 
					    "cannotMoveIn": {}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -435,9 +435,13 @@ async function buildGame() {
 | 
				
			|||||||
            );
 | 
					            );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        const code = transformed.code;
 | 
					        const code = transformed.code;
 | 
				
			||||||
 | 
					        const modifiedHead = head.replace(
 | 
				
			||||||
 | 
					            'this.scriptCompress = false;',
 | 
				
			||||||
 | 
					            'this.scriptCompress = true;'
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
        await writeFile(
 | 
					        await writeFile(
 | 
				
			||||||
            resolve(tempDir, 'common/main.js'),
 | 
					            resolve(tempDir, 'common/main.js'),
 | 
				
			||||||
            head + '\n// >>>> body end\n' + code,
 | 
					            modifiedHead + '\n// >>>> body end\n' + code,
 | 
				
			||||||
            'utf-8'
 | 
					            'utf-8'
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
    } catch (e) {
 | 
					    } catch (e) {
 | 
				
			||||||
@ -523,7 +527,8 @@ async function buildGame() {
 | 
				
			|||||||
        'project/icons.js',
 | 
					        'project/icons.js',
 | 
				
			||||||
        'project/items.js',
 | 
					        'project/items.js',
 | 
				
			||||||
        'project/maps.js',
 | 
					        'project/maps.js',
 | 
				
			||||||
        'project/plugins.js'
 | 
					        'project/plugins.js',
 | 
				
			||||||
 | 
					        'project/materials/airwall.png'
 | 
				
			||||||
    ];
 | 
					    ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    clientPackArr.forEach(v => {
 | 
					    clientPackArr.forEach(v => {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user