refactor: 2.10.3
This commit is contained in:
1 parent
a1eb7544bc
commit
0ff103f21e
25 files changed
+1806
-617
No files matched your search
+6
-1
@@ -1 +1,6 @@
|
||||
_saves/*
|
||||
_saves/
|
||||
project/bgms/
|
||||
project/animates/
|
||||
_docs/
|
||||
常用工具/
|
||||
/.vs
|
||||
@@ -1,5 +0,0 @@
|
||||
[{000214A0-0000-0000-C000-000000000046}]
|
||||
Prop3=19,2
|
||||
[InternetShortcut]
|
||||
IDList=
|
||||
URL=https://www.bilibili.com/video/BV1SB4y1p7bg?spm_id_from=333.999.0.0
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
!function(){var t=function(u){var i={};function n(t){if(i[t])return i[t].exports;var e=i[t]={i:t,l:!1,exports:{}};return u[t].call(e.exports,e,e.exports,n),e.l=!0,e.exports}return n.m=u,n.c=i,n.d=function(t,e,u){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:u})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var u=Object.create(null);if(n.r(u),Object.defineProperty(u,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(u,i,function(t){return e[t]}.bind(null,i));return u},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,u){"use strict";var i=u(1).Beautifier,n=u(5).Options;t.exports=function(t,e){return new i(t,e).beautify()},t.exports.defaultOptions=function(){return new n}},function(t,e,u){"use strict";var i=u(2).Output,n=u(3).Token,o=u(4),_=u(5).Options,s=u(7).Tokenizer,p=u(7).line_starters,l=u(7).positionable_operators,f=u(7).TOKEN;function c(t,e){return-1!==e.indexOf(t)}function a(t,e){return t&&t.type===f.RESERVED&&t.text===e}function d(t,e){return t&&t.type===f.RESERVED&&c(t.text,e)}var b=["case","return","do","if","throw","else","await","break","continue","async"],g=function(t){for(var e={},u=0;u<t.length;u++)e[t[u].replace(/-/g,"_")]=t[u];return e}(["before-newline","after-newline","preserve-newline"]),k=[g.before_newline,g.preserve_newline],m="BlockStatement",w="Statement",r="ObjectLiteral",h="ArrayLiteral",y="ForInitializer",x="Conditional",v="Expression";function E(t,e){e.multiline_frame||e.mode===y||e.mode===x||t.remove_indent(e.start_line_index)}function R(t){return t===h}function O(t){return c(t,[v,y,x])}function T(t,e){e=e||{},this._source_text=t||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new _(e)}T.prototype.create_flags=function(t,e){var u=0;return t&&(u=t.indentation_level,!this._output.just_added_newline()&&t.line_indent_level>u&&(u=t.line_indent_level)),{mode:e,parent:t,last_token:t?t.last_token:new n(f.START_BLOCK,""),last_word:t?t.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,indentation_level:u,alignment:0,line_indent_level:t?t.line_indent_level:u,start_line_index:this._output.get_line_number(),ternary_depth:0}},T.prototype._reset=function(t){var e=t.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new i(this._options,e),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(m);var u=new s(t,this._options);return this._tokens=u.tokenize(),t},T.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var t=this._reset(this._source_text),e=this._options.eol;"auto"===this._options.eol&&(e="\n",t&&o.lineBreak.test(t||"")&&(e=t.match(o.lineBreak)[0]));for(var u=this._tokens.next();u;)this.handle_token(u),this._last_last_text=this._flags.last_token.text,this._flags.last_token=u,u=this._tokens.next();return this._output.get_code(e)},T.prototype.handle_token=function(t,e){t.type===f.START_EXPR?this.handle_start_expr(t):t.type===f.END_EXPR?this.handle_end_expr(t):t.type===f.START_BLOCK?this.handle_start_block(t):t.type===f.END_BLOCK?this.handle_end_block(t):t.type===f.WORD?this.handle_word(t):t.type===f.RESERVED?this.handle_word(t):t.type===f.SEMICOLON?this.handle_semicolon(t):t.type===f.STRING?this.handle_string(t):t.type===f.EQUALS?this.handle_equals(t):t.type===f.OPERATOR?this.handle_operator(t):t.type===f.COMMA?this.handle_comma(t):t.type===f.BLOCK_COMMENT?this.handle_block_comment(t,e):t.type===f.COMMENT?this.handle_comment(t,e):t.type===f.DOT?this.handle_dot(t):t.type===f.EOF?this.handle_eof(t):(t.type,f.UNKNOWN,this.handle_unknown(t,e))},T.prototype.handle_whitespace_and_comments=function(t,e){var u=t.newlines,i=this._options.keep_array_indentation&&R(this._flags.mode);if(t.comments_before)for(var n=t.comments_before.next();n;)this.handle_whitespace_and_comments(n,e),this.handle_token(n,e),n=t.comments_before.next();if(i)for(var _=0;_<u;_+=1)this.print_newline(0<_,e);else if(this._options.max_preserve_newlines&&u>this._options.max_preserve_newlines&&(u=this._options.max_preserve_newlines),this._options.preserve_newlines&&1<u){this.print_newline(!1,e);for(var s=1;s<u;s+=1)this.print_newline(!0,e)}};var A=["async","break","continue","return","throw","yield"];T.prototype.allow_wrap_or_preserved_newline=function(t,e){if(e=void 0!==e&&e,!this._output.just_added_newline()){var u=this._options.preserve_newlines&&t.newlines||e;if(c(this._flags.last_token.text,lLine truncated
|
||||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("beautifier",[],e):"object"==typeof exports?exports.beautifier=e():t.beautifier=e()}("undefined"!=typeof self?self:"undefined"!=typeof windows?window:"undefined"!=typeof global?global:this,(function(){return function(){"use strict";var t={7:function(t){function e(t,e){t="string"==typeof t?t:t.source,e="string"==typeof e?e:e.source,this.__directives_block_pattern=new RegExp(t+/ beautify( \w+[:]\w+)+ /.source+e,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(t+/\sbeautify\signore:end\s/.source+e,"g")}e.prototype.get_directives=function(t){if(!t.match(this.__directives_block_pattern))return null;var e={};this.__directive_pattern.lastIndex=0;for(var i=this.__directive_pattern.exec(t);i;)e[i[1]]=i[2],i=this.__directive_pattern.exec(t);return e},e.prototype.readIgnored=function(t){return t.readUntilAfter(this.__directives_end_ignore_pattern)},t.exports.t=e},418:function(t){var e=RegExp.prototype.hasOwnProperty("sticky");function i(t){this.__input=t||"",this.__input_length=this.__input.length,this.__position=0}i.prototype.restart=function(){this.__position=0},i.prototype.back=function(){this.__position>0&&(this.__position-=1)},i.prototype.hasNext=function(){return this.__position<this.__input_length},i.prototype.next=function(){var t=null;return this.hasNext()&&(t=this.__input.charAt(this.__position),this.__position+=1),t},i.prototype.peek=function(t){var e=null;return t=t||0,(t+=this.__position)>=0&&t<this.__input_length&&(e=this.__input.charAt(t)),e},i.prototype.__match=function(t,i){t.lastIndex=i;var n=t.exec(this.__input);return!n||e&&t.sticky||n.index!==i&&(n=null),n},i.prototype.test=function(t,e){return e=e||0,(e+=this.__position)>=0&&e<this.__input_length&&!!this.__match(t,e)},i.prototype.testChar=function(t,e){var i=this.peek(e);return t.lastIndex=0,null!==i&&t.test(i)},i.prototype.match=function(t){var e=this.__match(t,this.__position);return e?this.__position+=e[0].length:e=null,e},i.prototype.read=function(t,e,i){var n,_="";return t&&(n=this.match(t))&&(_+=n[0]),!e||!n&&t||(_+=this.readUntil(e,i)),_},i.prototype.readUntil=function(t,e){var i,n=this.__position;t.lastIndex=this.__position;var _=t.exec(this.__input);return _?(n=_.index,e&&(n+=_[0].length)):n=this.__input_length,i=this.__input.substring(this.__position,n),this.__position=n,i},i.prototype.readUntilAfter=function(t){return this.readUntil(t,!0)},i.prototype.get_regexp=function(t,i){var n=null,_="g";return i&&e&&(_="y"),"string"==typeof t&&""!==t?n=new RegExp(t,_):t&&(n=new RegExp(t.source,_)),n},i.prototype.get_literal_regexp=function(t){return RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},i.prototype.peekUntilAfter=function(t){var e=this.__position,i=this.readUntilAfter(t);return this.__position=e,i},i.prototype.lookBack=function(t){var e=this.__position-1;return e>=t.length&&this.__input.substring(e-t.length,e).toLowerCase()===t},t.exports.g=i},915:function(t){function e(t,e){this.raw_options=function(t,e){var i,n={};for(i in t=function(t){var e,i={};for(e in t)i[e.replace(/-/g,"_")]=t[e];return i}(t))i!==e&&(n[i]=t[i]);if(e&&t[e])for(i in t[e])n[i]=t[e][i];return n}(t,e),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs","\t"===this.indent_char),this.indent_with_tabs&&(this.indent_char="\t",1===this.indent_size&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}e.prototype._get_array=function(t,e){var i=this.raw_options[t],n=e||[];return"object"==typeof i?null!==i&&"function"==typeof i.concat&&(n=i.concat()):"string"==typeof i&&(n=i.split(/[^a-zA-Z0-9_\/\-]+/)),n},e.prototype._get_boolean=function(t,e){var i=this.raw_options[t];return void 0===i?!!e:!!i},e.prototype._get_characters=function(t,e){var i=this.raw_options[t],n=e||"";return"string"==typeof i&&(n=i.replace(/\\r/,"\r").replace(/\\n/,"\n").replace(/\\t/,"\t")),n},e.prototype._get_number=function(t,e){var i=this.raw_options[t];e=parseInt(e,10),isNaN(e)&&(e=0);var n=parseInt(i,10);return isNaN(n)&&(n=e),n},e.prototype._get_selection=function(t,e,i){var n=this._get_selection_list(t,e,i);if(1!==n.length)throw new Error("Invalid Option Value: The option '"+t+"' cLine truncated
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
var JSHINT;"undefined"==typeof window&&(window={}),function(){var e;e=function t(n,r,i){function o(a,u){if(!r[a]){if(!n[a]){var c="function"==typeof e&&e;if(!u&&c)return c(a,!0);if(s)return s(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var f=r[a]={exports:{}};n[a][0].call(f.exports,function(e){var t=n[a][1][e];return o(t||e)},f,f.exports,t,n,r,i)}return r[a].exports}for(var s="function"==typeof e&&e,a=0;a<i.length;a++)o(i[a]);return o}({1:[function(e,t,n){for(var r=[],i=0;i<128;i++)r[i]=36===i||i>=65&&i<=90||95===i||i>=97&&i<=122;for(var o=[],i=0;i<128;i++)o[i]=r[i]||i>=48&&i<=57;t.exports={asciiIdentifierStartTable:r,asciiIdentifierPartTable:o}},{}],2:[function(e,t,n){var r=[];[[768,112],[1155,5],[1425,45],1472,[1473,2],[1476,2],1480,[1552,11],[1611,31],1649,[1750,7],[1759,6],[1767,2],[1770,4],[1776,10],1810,[1840,27],[1958,11],[1984,10],[2027,9],[2070,4],[2075,9],[2085,3],[2089,5],[2137,3],[2276,27],[2304,4],[2362,3],[2366,18],[2385,7],[2402,2],[2406,10],[2433,3],2493,[2494,7],[2503,2],[2507,3],2520,[2530,2],[2534,10],[2561,3],2621,[2622,5],[2631,2],[2635,3],2642,[2662,12],2678,[2689,3],2749,[2750,8],[2759,3],[2763,3],[2786,2],[2790,10],[2817,3],2877,[2878,7],[2887,2],[2891,3],[2902,2],[2914,2],[2918,10],2947,[3006,5],[3014,3],[3018,4],3032,[3046,10],[3073,3],[3134,7],[3142,3],[3146,4],[3157,2],[3170,2],[3174,10],[3202,2],3261,[3262,7],[3270,3],[3274,4],[3285,2],[3298,2],[3302,10],[3330,2],[3390,7],[3398,3],[3402,4],3416,[3426,2],[3430,10],[3458,2],3531,[3535,6],3543,[3544,8],[3570,2],3634,[3636,7],[3655,8],[3664,10],3762,[3764,6],[3771,2],[3784,6],[3792,10],[3864,2],[3872,10],3894,3896,3898,[3902,2],[3953,20],[3974,2],[3981,11],[3993,36],4039,[4139,20],[4160,10],[4182,4],[4190,3],[4194,3],[4199,7],[4209,4],[4226,12],[4239,15],[4957,3],[5906,3],[5938,3],[5970,2],[6002,2],[6068,32],6110,[6112,10],[6155,3],[6160,10],6314,[6432,12],[6448,12],[6470,10],[6576,17],[6600,2],[6608,10],[6679,5],[6741,10],[6752,29],[6783,11],[6800,10],[6912,5],[6964,17],[6992,10],[7019,9],[7040,3],[7073,13],[7088,10],[7142,14],[7204,20],[7232,10],[7248,10],[7376,3],[7380,21],7406,[7410,3],[7616,39],[7676,4],[8204,2],[8255,2],8277,[8400,13],8418,[8421,12],[11503,3],11648,[11744,32],[12330,6],[12441,2],[42528,10],42608,[42612,10],42656,[42736,2],43011,43015,43020,[43043,5],[43136,2],[43188,17],[43216,10],[43232,18],[43264,10],[43302,8],[43335,13],[43392,4],[43443,14],[43472,10],[43561,14],43588,[43596,2],[43600,10],43644,43697,[43698,3],[43703,2],[43710,2],43714,[43755,5],[43765,2],[44003,8],[44012,2],[44016,10],64287,[65024,16],[65056,7],[65075,2],[65101,3],[65296,10],65344].forEach(function(o){for(var x=0;x<(o[1]||1);x++)r.push((o[0]||o)+x)});t.exports=r},{}],3:[function(e,t,n){var r=[];[171,182,187,[192,23],[216,31],[248,458],[710,12],[736,5],749,751,[880,5],[886,2],[890,4],903,[904,3],909,[910,20],[931,83],[1015,139],[1162,158],[1329,38],1370,[1377,39],[1488,27],[1520,3],[1568,43],[1646,2],[1649,99],1750,[1765,2],[1774,2],[1786,3],1792,1809,[1810,30],[1869,89],1970,[1994,33],[2036,2],2043,[2048,22],2075,2085,2089,[2112,25],2209,[2210,11],[2308,54],2366,2385,[2392,10],[2417,7],[2425,7],[2437,8],[2447,2],[2451,22],[2474,7],2483,[2486,4],2494,2511,[2524,2],[2527,3],[2544,2],[2565,6],[2575,2],[2579,22],[2602,7],[2610,2],[2613,2],[2616,2],[2649,4],2655,[2674,3],[2693,9],[2703,3],[2707,22],[2730,7],[2738,2],[2741,5],2750,2769,[2784,2],[2821,8],[2831,2],[2835,22],[2858,7],[2866,2],[2869,5],2878,[2908,2],[2911,3],2930,2948,[2949,6],[2958,3],[2962,4],[2969,2],2973,[2974,2],[2979,2],[2984,3],[2990,12],3025,[3077,8],[3086,3],[3090,23],[3114,10],[3125,5],3134,[3160,2],[3168,2],[3205,8],[3214,3],[3218,23],[3242,10],[3253,5],3262,3295,[3296,2],[3313,2],[3333,8],[3342,3],[3346,41],3390,3407,[3424,2],[3450,6],[3461,18],[3482,24],[3507,9],3518,[3520,7],[3585,48],[3634,2],[3648,7],[3713,2],3717,[3719,2],3723,3726,[3732,4],[3737,7],[3745,3],3750,3752,[3754,2],[3757,4],[3762,2],3774,[3776,5],3783,[3804,4],3841,[3904,8],[3913,36],[3976,5],[4096,43],4160,[4176,6],[4186,4],4194,[4197,2],[4206,3],[4213,13],4239,[4256,38],4296,4302,[4304,43],[4348,333],[4682,4],[4688,7],4697,[4698,4],[4704,41],[4746,4],[4752,33],[4786,4],[4792,7],4801,[4802,4],[4808,15],[4824,57],[4882,4],[4888,67],[4992,16],[5024,85],[5121,620],[5743,17],[5761,26],[5792,75],[5870,3],[5888,13],[5902,4],[5920,18],[5952,18],[5984,13],[5998,3],[6016,52],6104,6109,[6176,88],[6272,41],6315,[6320,70],[6400,29],[6480,30],[6512,5],[6528,44],[6593,7],[6656,23],[6688,53],6824,[6917,47],[6981,7],[7043,30],[7086,2],[7098,44],[7168,36],[7245,3],[7258,36],[7401,4],[7406,4],[7413,2],[7424,192],[7680,278],[7960,6],[7968,38],[8008,6],[8016,8],8026,8028,8030,[8031,31],[8064,53],[8118,7],8127,[8130,3],[8134,7],[8144,4],[8150,6],[8160,13],[8178,3],[8182,7],8306,8320,[8336,13],8451,8456,[8458,10],8470,[8473,5],8485,8487,8489,[8490,4],[8495,11],[8508,4],[8517,5],8527,[8544,41],[11264,47],[11312,47],[11360,133],[11499,4],[11506,2],[11520,38],11560,11566,[11568,56],116Line truncated
|
||||
var JSHINT;"undefined"==typeof window&&(window={}),function(){var c=function r(i,u,o){function a(n,e){if(!u[n]){if(!i[n]){var t="function"==typeof c&&c;if(!e&&t)return t(n,!0);if(s)return s(n,!0);e=new Error("Cannot find module '"+n+"'");throw e.code="MODULE_NOT_FOUND",e}t=u[n]={exports:{}};i[n][0].call(t.exports,function(e){var t=i[n][1][e];return a(t||e)},t,t.exports,r,i,u,o)}return u[n].exports}for(var s="function"==typeof c&&c,e=0;e<o.length;e++)a(o[e]);return a}({1:[function(e,t,n){for(var r=[],i=0;i<128;i++)r[i]=36===i||65<=i&&i<=90||95===i||97<=i&&i<=122;for(var u=[],i=0;i<128;i++)u[i]=r[i]||48<=i&&i<=57;t.exports={asciiIdentifierStartTable:r,asciiIdentifierPartTable:u}},{}],2:[function(e,t,n){t.exports=/^(?:[\$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0525\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0621-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971\u0972\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D3D\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC\u0EDD\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8B\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10D0-\u10FA\u10FC\u1100-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u2094\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2D00-\u2D25\u2D30-\u2D65\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31B7\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCB\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA65F\uA662-\uA66E\uA67F-\uA697\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B\uA78C\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA2D\uFA30-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC])(?:[\$0-9A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u0525\u0531-\u0556\u0559\u0561-\u0Line truncated
|
||||
Binary file not shown.
@@ -699,3 +699,12 @@ div.checkboxSet {
|
||||
.etableInputDiv textarea:hover {
|
||||
margin: -5px;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: code;
|
||||
src: url(./FiraCode.ttf);
|
||||
}
|
||||
|
||||
.main .CodeMirror {
|
||||
font-family: code, 微软雅黑, 黑体, 新宋体, Verdana;
|
||||
}
|
||||
@@ -710,3 +710,11 @@ div.checkboxSet {
|
||||
margin: -5px;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: Fira;
|
||||
src: url(./FiraCode.ttf);
|
||||
}
|
||||
|
||||
.main .CodeMirror {
|
||||
font-family: Fira, Menlo, Consolas, 'Courier New', Courier, monospace;
|
||||
}
|
||||
+31
-7
@@ -7,11 +7,11 @@ editor_multi = function () {
|
||||
var extraKeys = {
|
||||
"Ctrl-/": function (cm) { cm.toggleComment(); },
|
||||
"Ctrl-B": function (cm) { ternServer.jumpToDef(cm); },
|
||||
"Ctrl-Q": function(cm) { ternServer.rename(cm); },
|
||||
"Ctrl-Q": function (cm) { ternServer.rename(cm); },
|
||||
"Cmd-F": CodeMirror.commands.findPersistent,
|
||||
"Ctrl-F": CodeMirror.commands.findPersistent,
|
||||
"Ctrl-R": CodeMirror.commands.replaceAll,
|
||||
"Ctrl-D": function(cm){ cm.foldCode(cm.getCursor()); },
|
||||
"Ctrl-D": function (cm) { cm.foldCode(cm.getCursor()); },
|
||||
"Ctrl-O": function () { editor_multi.openUrl('/_docs/#/api'); },
|
||||
"Ctrl-P": function () { editor_multi.openUrl('https://h5mota.com/plugins/'); }
|
||||
};
|
||||
@@ -48,14 +48,14 @@ editor_multi = function () {
|
||||
'Ctrl-P': '打开在线插件列表(Ctrl+P)'
|
||||
};
|
||||
|
||||
document.getElementById('codemirrorCommands').innerHTML =
|
||||
"<option value='' selected>执行操作...</option>" +
|
||||
document.getElementById('codemirrorCommands').innerHTML =
|
||||
"<option value='' selected>执行操作...</option>" +
|
||||
Object.keys(commandsName).map(function (name) {
|
||||
return "<option value='" + name + "'>" + commandsName[name] + "</option>"
|
||||
}).join('');
|
||||
|
||||
var coredef = terndefs_f6783a0a_522d_417e_8407_94c67b692e50[2];
|
||||
Object.keys(core.material.enemys).forEach(function (name){
|
||||
Object.keys(core.material.enemys).forEach(function (name) {
|
||||
coredef.core.material.enemys[name] = {
|
||||
"!type": "enemy",
|
||||
"!doc": core.material.enemys[name].name || "怪物"
|
||||
@@ -236,7 +236,15 @@ editor_multi = function () {
|
||||
document.getElementById('left7').style = 'z-index:-1;opacity: 0;';
|
||||
}
|
||||
editor_multi.setLint = function () {
|
||||
codeEditor.setOption("lint", editor_multi.lintAutocomplete);
|
||||
if (editor_multi.lintAutocomplete) {
|
||||
codeEditor.setOption("lint", {
|
||||
options: {
|
||||
esversion: 2021
|
||||
}
|
||||
});
|
||||
} else {
|
||||
codeEditor.setOption("lint", false);
|
||||
}
|
||||
codeEditor.setOption("autocomplete", editor_multi.lintAutocomplete);
|
||||
document.getElementById("lintCheckbox").checked = editor_multi.lintAutocomplete;
|
||||
}
|
||||
@@ -253,7 +261,7 @@ editor_multi = function () {
|
||||
var _format = function () {
|
||||
if (!editor_multi.lintAutocomplete) return;
|
||||
var offset = (codeEditor.getScrollInfo() || {}).top || 0;
|
||||
_setValue(js_beautify(codeEditor.getValue(), {
|
||||
_setValue(beautifier.js(codeEditor.getValue(), {
|
||||
brace_style: "collapse-preserve-inline",
|
||||
indent_with_tabs: true,
|
||||
jslint_happy: true
|
||||
@@ -486,6 +494,22 @@ editor_multi = function () {
|
||||
editor_multi.importFile(dict[mod])
|
||||
}
|
||||
|
||||
// 字体大小
|
||||
{
|
||||
const CONFIG_KEY = "editor_multi.fontSize";
|
||||
let fontsize = editor.config.get(CONFIG_KEY, 14);
|
||||
const input = document.getElementById("editor_multi_fontsize");
|
||||
const check = document.getElementById("editor_multi_fontweight")
|
||||
input.value = fontsize;
|
||||
editor_multi.setFontSize = function () {
|
||||
const value = Number(input.value);
|
||||
editor.config.set(CONFIG_KEY, value);
|
||||
const ele = codeEditor.getWrapperElement()
|
||||
ele.style.fontSize = `${value}px`;
|
||||
ele.style.fontWeight = `${check.checked ? 'bold' : 'normal'}`
|
||||
}
|
||||
}
|
||||
|
||||
return editor_multi;
|
||||
}
|
||||
//editor_multi=editor_multi();
|
||||
@@ -555,14 +555,20 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"autoScale": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "自动缩放最大化",
|
||||
"_data": "是否自动缩放最大化,关闭后不再最大化"
|
||||
"_docs": "自动缩放",
|
||||
"_data": "是否自动缩放至合适值"
|
||||
},
|
||||
"extendToolbar": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "横屏隐藏状态栏",
|
||||
"_data": "在横屏状态下是否隐藏左侧状态栏,从而获得仿RM的沉浸式体验"
|
||||
"_docs": "画面下方道具栏",
|
||||
"_data": "开启后道具栏会被挪动至游戏画面的下方"
|
||||
},
|
||||
"hideLeftStatusBar": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "隐藏左侧状态栏",
|
||||
"_data": "是否隐藏左侧状态栏,开启后强制开启画面下方道具栏"
|
||||
},
|
||||
"flyNearStair": {
|
||||
"_leaf": true,
|
||||
|
||||
+15
-9
@@ -242,15 +242,21 @@
|
||||
<button onclick="confirmColor()">确定</button>
|
||||
</div>
|
||||
<div id="left7" style="z-index:-1;opacity: 0;"><!-- 多行文本编辑器 -->
|
||||
<button onclick="editor_multi.confirm()">确认</button>
|
||||
<button onclick="editor_multi.cancel()">取消</button>
|
||||
<button onclick="editor_multi.confirm(true)">应用</button>
|
||||
<button onclick="editor_multi.format()">格式化</button>
|
||||
<button id="editor_multi_preview" style="display: none;">预览</button>
|
||||
<input type="checkbox" onclick="editor_multi.toggerLint()" id="lintCheckbox"
|
||||
style="vertical-align: middle;margin-left:6px"/>
|
||||
<span style="vertical-align: middle; margin-left: -3px">语法检查</span>
|
||||
<select id="codemirrorCommands" onchange="editor_multi.doCommand(this)" style="vertical-align: middle; margin-left: 6px;"></select>
|
||||
<div>
|
||||
<button onclick="editor_multi.confirm()">确认</button>
|
||||
<button onclick="editor_multi.cancel()">取消</button>
|
||||
<button onclick="editor_multi.confirm(true)">应用</button>
|
||||
<button onclick="editor_multi.format()">格式化</button>
|
||||
<button id="editor_multi_preview" style="display: none;">预览</button>
|
||||
<input type="checkbox" onclick="editor_multi.toggerLint()" id="lintCheckbox"
|
||||
style="vertical-align: middle;margin-left:6px"/>
|
||||
<span style="vertical-align: middle; margin-left: -3px">语法检查</span>
|
||||
<select id="codemirrorCommands" onchange="editor_multi.doCommand(this)" style="vertical-align: middle; margin-left: 6px;"></select>
|
||||
<span>字体大小</span>
|
||||
<input style="width: 40px" type="number" onchange="editor_multi.setFontSize()" id="editor_multi_fontsize" />
|
||||
<span>字体加粗</span>
|
||||
<input style="width: 40px" type="checkbox" onchange="editor_multi.setFontSize()" id="editor_multi_fontweight" />
|
||||
</div>
|
||||
<textarea id="multiLineCode" name="multiLineCode"></textarea>
|
||||
</div>
|
||||
<div id="left8" class='leftTab' style="z-index:-1;opacity: 0;"><!-- functions -->
|
||||
|
||||
+15
-9
@@ -238,15 +238,21 @@
|
||||
<button onclick="confirmColor()">确定</button>
|
||||
</div>
|
||||
<div id="left7" style="z-index:-1;opacity: 0;"><!-- 多行文本编辑器 -->
|
||||
<button onclick="editor_multi.confirm()">确认</button>
|
||||
<button onclick="editor_multi.cancel()">取消</button>
|
||||
<button onclick="editor_multi.confirm(true)">应用</button>
|
||||
<button onclick="editor_multi.format()">格式化</button>
|
||||
<button id="editor_multi_preview" style="display: none;">预览</button>
|
||||
<input type="checkbox" onclick="editor_multi.toggerLint()" id="lintCheckbox"
|
||||
style="vertical-align: middle;margin-left:6px"/>
|
||||
<span style="vertical-align: middle; margin-left: -3px">语法检查</span>
|
||||
<select id="codemirrorCommands" onchange="editor_multi.doCommand(this)" style="vertical-align: middle; margin-left: 6px;"></select>
|
||||
<div>
|
||||
<button onclick="editor_multi.confirm()">确认</button>
|
||||
<button onclick="editor_multi.cancel()">取消</button>
|
||||
<button onclick="editor_multi.confirm(true)">应用</button>
|
||||
<button onclick="editor_multi.format()">格式化</button>
|
||||
<button id="editor_multi_preview" style="display: none;">预览</button>
|
||||
<input type="checkbox" onclick="editor_multi.toggerLint()" id="lintCheckbox"
|
||||
style="vertical-align: middle;margin-left:6px"/>
|
||||
<span style="vertical-align: middle; margin-left: -3px">语法检查</span>
|
||||
<select id="codemirrorCommands" onchange="editor_multi.doCommand(this)" style="vertical-align: middle; margin-left: 6px;"></select>
|
||||
<span>字体大小</span>
|
||||
<input style="width: 40px" type="number" onchange="editor_multi.setFontSize()" id="editor_multi_fontsize" />
|
||||
<span>字体加粗</span>
|
||||
<input style="width: 40px" type="checkbox" onchange="editor_multi.setFontSize()" id="editor_multi_fontweight" />
|
||||
</div>
|
||||
<textarea id="multiLineCode" name="multiLineCode"></textarea>
|
||||
</div>
|
||||
<div id="left8" class='leftTab' style="z-index:-1;opacity: 0;"><!-- functions -->
|
||||
|
||||
+182
-178
@@ -1,12 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv='content-type' content='text/html' charset='utf-8'>
|
||||
<meta http-equiv='X-UA-Compatible' content='IE=Edge, chrome=1'>
|
||||
<meta name='author' content='ckcz123'>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=yes'>
|
||||
<meta name='viewport'
|
||||
content='width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=yes'>
|
||||
<title>HTML5魔塔</title>
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<meta name="screen-orientation" content="portrait">
|
||||
<meta name="full-screen" content="yes">
|
||||
<meta name="browsermode" content="application">
|
||||
@@ -15,186 +17,188 @@
|
||||
<meta name="x5-page-mode" content="app">
|
||||
<link type='text/css' href='styles.css' rel='stylesheet'>
|
||||
</head>
|
||||
<body>
|
||||
<div id='startImageBackgroundDiv'>
|
||||
<div id='startImageDiv'></div>
|
||||
<img id='startImageLogo' />
|
||||
</div>
|
||||
<script>
|
||||
(function () {
|
||||
var startImageBackgroundDiv = document.getElementById('startImageBackgroundDiv');
|
||||
var startImageLogo = document.getElementById('startImageLogo');
|
||||
var startImageDiv = document.getElementById('startImageDiv');
|
||||
startImageLogo.onload = function () {
|
||||
startImageBackgroundDiv.style.display = 'block';
|
||||
var onAnimationEnd = function () {
|
||||
startImageBackgroundDiv.style.display = 'none';
|
||||
startImageLogo.classList.remove("startImageAnimation");
|
||||
startImageDiv.classList.remove("startImageDivAnimation");
|
||||
}
|
||||
startImageDiv.addEventListener("webkitAnimationEnd", onAnimationEnd);
|
||||
startImageDiv.addEventListener("animationend", onAnimationEnd);
|
||||
startImageLogo.classList.add("startImageAnimation");
|
||||
startImageDiv.classList.add("startImageDivAnimation");
|
||||
// 注释下面这句话以禁止单击立刻跳过开场动画
|
||||
startImageBackgroundDiv.onclick = onAnimationEnd;
|
||||
}
|
||||
startImageLogo.onerror = function () {}
|
||||
startImageLogo.src = "logo.png";
|
||||
})();
|
||||
</script>
|
||||
<!-- injection -->
|
||||
<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>
|
||||
<body>
|
||||
<div id='startImageBackgroundDiv'>
|
||||
<div id='startImageDiv'></div>
|
||||
<img id='startImageLogo' />
|
||||
</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>
|
||||
<script>
|
||||
(function () {
|
||||
var startImageBackgroundDiv = document.getElementById('startImageBackgroundDiv');
|
||||
var startImageLogo = document.getElementById('startImageLogo');
|
||||
var startImageDiv = document.getElementById('startImageDiv');
|
||||
startImageLogo.onload = function () {
|
||||
startImageBackgroundDiv.style.display = 'block';
|
||||
var onAnimationEnd = function () {
|
||||
startImageBackgroundDiv.style.display = 'none';
|
||||
startImageLogo.classList.remove("startImageAnimation");
|
||||
startImageDiv.classList.remove("startImageDivAnimation");
|
||||
}
|
||||
startImageDiv.addEventListener("webkitAnimationEnd", onAnimationEnd);
|
||||
startImageDiv.addEventListener("animationend", onAnimationEnd);
|
||||
startImageLogo.classList.add("startImageAnimation");
|
||||
startImageDiv.classList.add("startImageDivAnimation");
|
||||
// 注释下面这句话以禁止单击立刻跳过开场动画
|
||||
startImageBackgroundDiv.onclick = onAnimationEnd;
|
||||
}
|
||||
startImageLogo.onerror = function () { }
|
||||
startImageLogo.src = "logo.png";
|
||||
})();
|
||||
</script>
|
||||
<!-- injection -->
|
||||
<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 anti-aliasing' id='bg'></canvas>
|
||||
<canvas class='gameCanvas anti-aliasing' id='event'></canvas>
|
||||
<canvas class='gameCanvas anti-aliasing' id='hero'></canvas>
|
||||
<canvas class='gameCanvas anti-aliasing' id='event2'></canvas>
|
||||
<canvas class='gameCanvas anti-aliasing' 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="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 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>
|
||||
<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 id="ui-editor"></div>
|
||||
<!-- injection -->
|
||||
<script src='libs/thirdparty/lz-string.min.js'></script>
|
||||
<script src='libs/thirdparty/priority-queue.min.js'></script>
|
||||
<script src='libs/thirdparty/localforage.min.js'></script>
|
||||
<script src='libs/thirdparty/zip.min.js'></script>
|
||||
<script id='mainScript' src='main.js'></script>
|
||||
<script>main.init('play');main.listen();</script>
|
||||
<div id="ui-editor"></div>
|
||||
<!-- injection -->
|
||||
<script src='libs/thirdparty/lz-string.min.js'></script>
|
||||
<script src='libs/thirdparty/priority-queue.min.js'></script>
|
||||
<script src='libs/thirdparty/localforage.min.js'></script>
|
||||
<script src='libs/thirdparty/zip.min.js'></script>
|
||||
<script id='mainScript' src='main.js'></script>
|
||||
<script>main.init('play'); main.listen();</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+1
-1
@@ -1225,7 +1225,7 @@ actions.prototype._clickBook = function (x, y) {
|
||||
var data = core.status.event.data;
|
||||
if (data != null && y < core._HEIGHT_-1) {
|
||||
var per_page = pageinfo.per_page, page = parseInt(data / per_page);
|
||||
var u = this.LAST / per_page;
|
||||
var u = (core._HEIGHT_ - 1) / per_page;
|
||||
for (var i = 0; i < per_page; ++i) {
|
||||
if (y >= u * i && y < u * (i + 1)) {
|
||||
var index = per_page * page + i;
|
||||
|
||||
+22
-15
@@ -18,6 +18,7 @@ control.prototype._init = function () {
|
||||
this.weathers = {};
|
||||
this.resizes = [];
|
||||
this.noAutoEvents = true;
|
||||
this.updateNextFrame = false;
|
||||
// --- 注册系统的animationFrame
|
||||
this.registerAnimationFrame("totalTime", false, this._animationFrame_totalTime);
|
||||
this.registerAnimationFrame("autoSave", true, this._animationFrame_autoSave);
|
||||
@@ -3046,22 +3047,27 @@ control.prototype.clearStatusBar = function () {
|
||||
|
||||
////// 更新状态栏 //////
|
||||
control.prototype.updateStatusBar = function (doNotCheckAutoEvents, immediate) {
|
||||
if (!core.isPlaying()) return;
|
||||
if (immediate) {
|
||||
return this.updateStatusBar_update();
|
||||
}
|
||||
if (!doNotCheckAutoEvents) this.noAutoEvents = false;
|
||||
if (core.isReplaying()) return this.updateStatusBar_update();
|
||||
requestAnimationFrame(this.updateStatusBar_update)
|
||||
}
|
||||
if (!core.control.updateNextFrame) {
|
||||
core.control.updateNextFrame = true;
|
||||
requestAnimationFrame(this.updateStatusBar_update);
|
||||
}
|
||||
};
|
||||
|
||||
control.prototype.updateStatusBar_update = function () {
|
||||
core.control.updateNextFrame = false;
|
||||
if (!core.isPlaying() || core.hasFlag('__statistics__')) return;
|
||||
core.control.controldata.updateStatusBar();
|
||||
if (!core.control.noAutoEvents) core.checkAutoEvents();
|
||||
core.control._updateStatusBar_setToolboxIcon();
|
||||
core.clearRouteFolding();
|
||||
core.control.noAutoEvents = true;
|
||||
}
|
||||
};
|
||||
|
||||
control.prototype._updateStatusBar_setToolboxIcon = function () {
|
||||
if (core.isReplaying()) {
|
||||
@@ -3265,9 +3271,10 @@ control.prototype.resize = function () {
|
||||
var clientWidth = main.dom.body.clientWidth, clientHeight = main.dom.body.clientHeight;
|
||||
var BORDER = 3;
|
||||
var extendToolbar = core.flags.extendToolbar;
|
||||
var BAR_WIDTH = extendToolbar ? 0 : Math.round(core._PY_ * 0.3);
|
||||
let hideLeftStatusBar = core.flags.hideLeftStatusBar;
|
||||
var BAR_WIDTH = hideLeftStatusBar ? 0 : Math.round(core._PY_ * 0.31);
|
||||
|
||||
var horizontalMaxRatio = (clientHeight - 2 * BORDER - (extendToolbar ? BORDER : 0)) / (core._PY_ + (extendToolbar ? 38 : 0));
|
||||
var horizontalMaxRatio = (clientHeight - 2 * BORDER - (hideLeftStatusBar ? BORDER : 0)) / (core._PY_ + (hideLeftStatusBar ? 38 : 0));
|
||||
|
||||
if (clientWidth - 3 * BORDER >= core._PX_ + BAR_WIDTH || (clientWidth > clientHeight && horizontalMaxRatio < 1)) {
|
||||
// 横屏
|
||||
@@ -3289,6 +3296,7 @@ control.prototype.resize = function () {
|
||||
core.domStyle.scale = Math.min((clientWidth - 2 * BORDER) / core._PX_);
|
||||
core.domStyle.availableScale = [];
|
||||
extendToolbar = false;
|
||||
hideLeftStatusBar = false;
|
||||
BAR_WIDTH = Math.round(core._PX_ * 0.3);
|
||||
}
|
||||
|
||||
@@ -3317,7 +3325,8 @@ control.prototype.resize = function () {
|
||||
statusBarHeightInVertical: core.domStyle.isVertical ? (32 * col + 6) * core.domStyle.scale + 2 * BORDER : 0,
|
||||
toolbarHeightInVertical: core.domStyle.isVertical ? 38 * core.domStyle.scale + 2 * BORDER : 0,
|
||||
extendToolbar: extendToolbar,
|
||||
is15x15: false
|
||||
is15x15: false,
|
||||
hideLeftStatusBar
|
||||
};
|
||||
|
||||
this._doResize(obj);
|
||||
@@ -3339,7 +3348,7 @@ control.prototype._resize_gameGroup = function (obj) {
|
||||
totalHeight = obj.outerHeight + obj.statusBarHeightInVertical + obj.toolbarHeightInVertical
|
||||
}
|
||||
else {
|
||||
totalWidth = obj.outerWidth + obj.BAR_WIDTH * core.domStyle.scale + (obj.extendToolbar ? 0 : obj.BORDER);
|
||||
totalWidth = obj.outerWidth + obj.BAR_WIDTH * core.domStyle.scale + (obj.hideLeftStatusBar ? 0 : obj.BORDER);
|
||||
totalHeight = obj.outerHeight + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER : 0);
|
||||
}
|
||||
gameGroup.style.width = totalWidth + "px";
|
||||
@@ -3409,9 +3418,7 @@ control.prototype._resize_canvas = function (obj) {
|
||||
} else {
|
||||
for (var name in core.dymCanvas) {
|
||||
var ctx = core.dymCanvas[name], canvas = ctx.canvas;
|
||||
var ratio = canvas.hasAttribute('isHD') ? core.domStyle.ratio : 1;
|
||||
canvas.style.width = canvas.width / ratio * core.domStyle.scale + "px";
|
||||
canvas.style.height = canvas.height / ratio * core.domStyle.scale + "px";
|
||||
core.resizeCanvas(ctx, parseFloat(canvas.getAttribute("_width")), parseFloat(canvas.getAttribute("_height")))
|
||||
canvas.style.left = parseFloat(canvas.getAttribute("_left")) * core.domStyle.scale + "px";
|
||||
canvas.style.top = parseFloat(canvas.getAttribute("_top")) * core.domStyle.scale + "px";
|
||||
}
|
||||
@@ -3435,13 +3442,13 @@ control.prototype._resize_statusBar = function (obj) {
|
||||
statusBar.style.height = obj.outerHeight + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER : 0) + "px";
|
||||
statusBar.style.background = obj.globalAttribute.statusLeftBackground;
|
||||
// --- 计算文字大小
|
||||
if (obj.extendToolbar) {
|
||||
if (obj.hideLeftStatusBar) {
|
||||
statusBar.style.fontSize = 16 * core.domStyle.scale + "px";
|
||||
} else {
|
||||
statusBar.style.fontSize = 16 * Math.min(1, (core._HEIGHT_ - 4) / obj.count) * core.domStyle.scale + "px";
|
||||
}
|
||||
}
|
||||
statusBar.style.display = obj.extendToolbar ? 'none' : 'block';
|
||||
statusBar.style.display = obj.hideLeftStatusBar ? 'none' : 'block';
|
||||
statusBar.style.borderTop = statusBar.style.borderLeft = obj.border;
|
||||
statusBar.style.borderRight = core.domStyle.isVertical ? obj.border : '';
|
||||
statusBar.style.borderBottom = core.domStyle.isVertical ? '' : obj.border;
|
||||
@@ -3456,7 +3463,7 @@ control.prototype._resize_statusBar = function (obj) {
|
||||
core.dom.statusCanvas.style.height = obj.outerHeight - 2 * obj.BORDER + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER : 0) + "px";
|
||||
core.maps._setHDCanvasSize(core.dom.statusCanvasCtx, obj.BAR_WIDTH, core._PY_ + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT + obj.BORDER : 0));
|
||||
}
|
||||
core.dom.statusCanvas.style.display = core.flags.statusCanvas && !obj.extendToolbar ? "block" : "none";
|
||||
core.dom.statusCanvas.style.display = core.flags.statusCanvas && !obj.hideLeftStatusBar ? "block" : "none";
|
||||
}
|
||||
|
||||
control.prototype._resize_status = function (obj) {
|
||||
@@ -3464,7 +3471,7 @@ control.prototype._resize_status = function (obj) {
|
||||
if (core.domStyle.isVertical) {
|
||||
statusHeight = 32 * core.domStyle.scale * 0.8;
|
||||
} else {
|
||||
statusHeight = (obj.extendToolbar ? core._HEIGHT_ : core._HEIGHT_ - 4) / obj.count * 32 * core.domStyle.scale * 0.8;
|
||||
statusHeight = (obj.hideLeftStatusBar ? core._HEIGHT_ : core._HEIGHT_ - 4) / obj.count * 32 * core.domStyle.scale * 0.8;
|
||||
}
|
||||
// status
|
||||
for (var i = 0; i < core.dom.status.length; ++i) {
|
||||
@@ -3507,7 +3514,7 @@ control.prototype._resize_toolBar = function (obj) {
|
||||
toolBar.style.background = obj.globalAttribute.toolsBackground;
|
||||
}
|
||||
else {
|
||||
if (obj.extendToolbar) {
|
||||
if (obj.extendToolbar || obj.hideLeftStatusBar) {
|
||||
toolBar.style.left = "";
|
||||
toolBar.style.right = 0;
|
||||
toolBar.style.width = obj.outerWidth + "px";
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ function core () {
|
||||
this._HALF_WIDTH_ = Math.floor(this._WIDTH_ / 2);
|
||||
this._HALF_HEIGHT_ = Math.floor(this._HEIGHT_ / 2);
|
||||
|
||||
this.__SIZE__ = main.mode == 'editor' ? 15 : this._HEIGHT_;
|
||||
this.__SIZE__ = main.mode == 'editor' ? 13 : this._HEIGHT_;
|
||||
this.__PIXELS__ = this.__SIZE__ * 32;
|
||||
this.__HALF_SIZE__ = Math.floor(this.__SIZE__ / 2);
|
||||
this.material = {
|
||||
|
||||
+30
-19
@@ -34,11 +34,10 @@ maps.prototype._resetFloorImages = function () {
|
||||
}
|
||||
}
|
||||
|
||||
maps.prototype._setHDCanvasSize = function (ctx, width, height, isTempCanvas) {
|
||||
maps.prototype._setHDCanvasSize = function (ctx, width, height) {
|
||||
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||||
var ratio = core.domStyle.ratio;
|
||||
if (ctx === core.bigmap.tempCanvas) ratio = core.domStyle.scale;
|
||||
if (isTempCanvas) ratio = core.domStyle.ratio;
|
||||
var ratio = core.domStyle.scale;
|
||||
ratio *= devicePixelRatio;
|
||||
if (width != null) ctx.canvas.width = width * ratio;
|
||||
if (height != null) ctx.canvas.height = height * ratio;
|
||||
ctx.scale(ratio, ratio);
|
||||
@@ -1728,18 +1727,20 @@ maps.prototype._drawThumbnail_drawTempCanvas = function (floorId, blocks, option
|
||||
// 如果是大地图模式?
|
||||
if (options.all) {
|
||||
// 计算比例
|
||||
var scale = Math.max(core._WIDTH_ / width, core._HEIGHT_ / height);
|
||||
if (options.noHD) {
|
||||
tempCanvas.canvas.width = width * 32 * scale;
|
||||
tempCanvas.canvas.height = height * 32 * scale;
|
||||
} else core.resizeCanvas(tempCanvas, width * 32 * scale, height * 32 * scale, false, true);
|
||||
tempCanvas.scale(scale, scale);
|
||||
tempCanvas.canvas.width = width * 32;
|
||||
tempCanvas.canvas.height = height * 32;
|
||||
tempCanvas.canvas.removeAttribute('isHD');
|
||||
} else {
|
||||
core.maps._setHDCanvasSize(tempCanvas, width * 32, height * 32);
|
||||
}
|
||||
} else if (width * height > core.bigmap.threshold) {
|
||||
options.v2 = true;
|
||||
if (options.noHD) {
|
||||
tempCanvas.canvas.width = core._PX_;
|
||||
tempCanvas.canvas.height = core._PY_;
|
||||
} else core.resizeCanvas(tempCanvas, core._PX_, core._PY_);
|
||||
tempCanvas.canvas.removeAttribute('isHD');
|
||||
} else core.maps._setHDCanvasSize(tempCanvas, width * 32, height * 32);
|
||||
var centerX = options.centerX, centerY = options.centerY;
|
||||
if (centerX == null) centerX = Math.floor(width / 2);
|
||||
if (centerY == null) centerY = Math.floor(height / 2);
|
||||
@@ -1751,7 +1752,8 @@ maps.prototype._drawThumbnail_drawTempCanvas = function (floorId, blocks, option
|
||||
if (options.noHD) {
|
||||
tempCanvas.canvas.width = width * 32;
|
||||
tempCanvas.canvas.height = height * 32;
|
||||
} else core.resizeCanvas(tempCanvas, width * 32, height * 32, false, true);
|
||||
tempCanvas.canvas.removeAttribute('isHD');
|
||||
} else core.maps._setHDCanvasSize(tempCanvas, width * 32, height * 32);
|
||||
}
|
||||
options.ctx = tempCanvas;
|
||||
|
||||
@@ -1813,6 +1815,7 @@ maps.prototype._drawThumbnail_drawToTarget = function (floorId, options) {
|
||||
if (centerY == null) centerY = Math.floor(height / 2);
|
||||
var tempCanvas = core.bigmap.tempCanvas;
|
||||
|
||||
const scale = core.domStyle.scale * devicePixelRatio;
|
||||
if (options.all) {
|
||||
var tempWidth = tempCanvas.canvas.width, tempHeight = tempCanvas.canvas.height;
|
||||
// 绘制全景图
|
||||
@@ -1833,20 +1836,28 @@ maps.prototype._drawThumbnail_drawToTarget = function (floorId, options) {
|
||||
}
|
||||
else {
|
||||
// 只绘制可见窗口
|
||||
var pw = core._PX_, ph = core._PY_, hw = core._HALF_WIDTH_, hh = core._HALF_HEIGHT_, W = core._WIDTH_, H = core._HEIGHT_;
|
||||
var ratio = core.domStyle.isVertical ? core.domStyle.ratio : core.domStyle.scale;
|
||||
if (main.mode == 'editor') { pw = ph = core.__PIXELS__; hw = hh = core.__HALF_SIZE__; W = H = core.__SIZE__; }
|
||||
var pw = core._PX_,
|
||||
ph = core._PY_,
|
||||
hw = core._HALF_WIDTH_,
|
||||
hh = core._HALF_HEIGHT_,
|
||||
W = core._WIDTH_,
|
||||
H = core._HEIGHT_;
|
||||
if (main.mode == 'editor') {
|
||||
pw = ph = core.__PIXELS__;
|
||||
hw = hh = core.__HALF_SIZE__;
|
||||
W = H = core.__SIZE__;
|
||||
}
|
||||
if (options.v2) {
|
||||
core.drawImage(ctx, tempCanvas.canvas, 0, 0, pw * ratio, ph * ratio, x, y, w, h);
|
||||
if (options.noHD) core.drawImage(ctx, tempCanvas.canvas, 0, 0, pw, ph, x, y, w, h);
|
||||
else core.drawImage(ctx, tempCanvas.canvas, 0, 0, pw * scale, ph * scale, x, y, w, h);
|
||||
} else {
|
||||
var offsetX = core.clamp(centerX - hw, 0, width - W),
|
||||
offsetY = core.clamp(centerY - hh, 0, height - H),
|
||||
c = options.noHD ? 1 : core.domStyle.scale;
|
||||
offsetY = core.clamp(centerY - hh, 0, height - H);
|
||||
if (options.noHD) {
|
||||
core.drawImage(ctx, tempCanvas.canvas, offsetX * 32, offsetY * 32, pw, ph, x, y, w, h);
|
||||
return;
|
||||
} else {
|
||||
core.drawImage(ctx, tempCanvas.canvas, offsetX * 32 * scale, offsetY * 32 * scale, pw * scale, ph * scale, x, y, w, h);
|
||||
}
|
||||
core.drawImage(ctx, tempCanvas.canvas, offsetX * 32 * ratio, offsetY * 32 * ratio, pw * ratio, ph * ratio, x, y, w, h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+47
-19
@@ -57,7 +57,13 @@ ui.prototype.clearMap = function (name, x, y, width, height) {
|
||||
if (x != null && y != null && width != null && height != null) {
|
||||
ctx.clearRect(x, y, width, height);
|
||||
} else {
|
||||
ctx.clearRect(-32, -32, ctx.canvas.width + 32, ctx.canvas.height + 32);
|
||||
if (ctx.canvas.getAttribute('isHD')) {
|
||||
const width = ctx.canvas.width / core.domStyle.scale / devicePixelRatio;
|
||||
const height = ctx.canvas.height / core.domStyle.scale / devicePixelRatio;
|
||||
ctx.clearRect(0, 0, width, height);
|
||||
} else {
|
||||
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1108,12 +1114,16 @@ ui.prototype.drawTextContent = function (ctx, content, config) {
|
||||
config.offsetY = 0;
|
||||
config.line = 0;
|
||||
config.blocks = [];
|
||||
config.isHD = ctx != null && ctx.canvas.hasAttribute('isHD');
|
||||
config.isHD = ctx == null || ctx.canvas.hasAttribute('isHD');
|
||||
|
||||
// 创建一个新的临时画布
|
||||
var tempCtx = document.createElement('canvas').getContext('2d');
|
||||
if (config.isHD) {
|
||||
core.maps._setHDCanvasSize(tempCtx, ctx.canvas.width, ctx.canvas.height);
|
||||
if (config.isHD && ctx) {
|
||||
core.maps._setHDCanvasSize(
|
||||
tempCtx,
|
||||
ctx.canvas.width,
|
||||
ctx.canvas.height
|
||||
);
|
||||
} else {
|
||||
tempCtx.canvas.width = ctx == null ? 1 : ctx.canvas.width;
|
||||
tempCtx.canvas.height = ctx == null ? 1 : ctx.canvas.height;
|
||||
@@ -1148,10 +1158,20 @@ ui.prototype._drawTextContent_draw = function (ctx, tempCtx, content, config) {
|
||||
if (config.index >= config.blocks.length) return false;
|
||||
var block = config.blocks[config.index++];
|
||||
if (block != null) {
|
||||
var ratio = config.isHD ? core.domStyle.ratio : 1;
|
||||
core.drawImage(ctx, tempCtx.canvas, block.left * ratio, block.top * ratio, block.width * ratio, block.height * ratio,
|
||||
config.left + block.left + block.marginLeft, config.top + block.top + block.marginTop,
|
||||
block.width, block.height);
|
||||
// It works, why?
|
||||
const scale = config.isHD ? devicePixelRatio * core.domStyle.scale : 1;
|
||||
core.drawImage(
|
||||
ctx,
|
||||
tempCtx.canvas,
|
||||
block.left * scale,
|
||||
block.top * scale,
|
||||
block.width * scale,
|
||||
block.height * scale,
|
||||
config.left + block.left + block.marginLeft,
|
||||
config.top + block.top + block.marginTop,
|
||||
block.width,
|
||||
block.height
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -2512,23 +2532,24 @@ ui.prototype.drawFly = function (page) {
|
||||
core.setTextAlign('ui', 'center');
|
||||
|
||||
var middle = core._PY_ / 2 + 39;
|
||||
const lastWidth = 0.25 * core._PX_ - 16;
|
||||
|
||||
// 换行
|
||||
var lines = core.splitLines('ui', title, 120, this._buildFont(19, true));
|
||||
var lines = core.splitLines('ui', title, lastWidth, this._buildFont(19, true));
|
||||
var start_y = middle - (lines.length - 1) * 11;
|
||||
for (var i in lines) {
|
||||
core.fillText('ui', lines[i], core._PX_ - 60, start_y, '#FFFFFF');
|
||||
core.fillText('ui', lines[i], core._PX_ - lastWidth * 0.5, start_y, '#FFFFFF');
|
||||
start_y += 22;
|
||||
}
|
||||
if (core.actions._getNextFlyFloor(1) != page) {
|
||||
core.fillText('ui', '▲', core._PX_ - 60, middle - 64, null, this._buildFont(17, false));
|
||||
core.fillText('ui', '▲', core._PX_ - 60, middle - 96);
|
||||
core.fillText('ui', '▲', core._PX_ - 60, middle - 96 - 7);
|
||||
core.fillText('ui', '▲', core._PX_ - lastWidth * 0.5, middle - 64, null, this._buildFont(17, false));
|
||||
core.fillText('ui', '▲', core._PX_ - lastWidth * 0.5, middle - 96);
|
||||
core.fillText('ui', '▲', core._PX_ - lastWidth * 0.5, middle - 96 - 7);
|
||||
}
|
||||
if (core.actions._getNextFlyFloor(-1) != page) {
|
||||
core.fillText('ui', '▼', core._PX_ - 60, middle + 64, null, this._buildFont(17, false));
|
||||
core.fillText('ui', '▼', core._PX_ - 60, middle + 96);
|
||||
core.fillText('ui', '▼', core._PX_ - 60, middle + 96 + 7);
|
||||
core.fillText('ui', '▼', core._PX_ - lastWidth * 0.5, middle + 64, null, this._buildFont(17, false));
|
||||
core.fillText('ui', '▼', core._PX_ - lastWidth * 0.5, middle + 96);
|
||||
core.fillText('ui', '▼', core._PX_ - lastWidth * 0.5, middle + 96 + 7);
|
||||
}
|
||||
var size = 0.75;
|
||||
core.strokeRect('ui', 16, 64, size * core._PX_, size * core._PY_, '#FFFFFF', 2);
|
||||
@@ -3381,6 +3402,8 @@ ui.prototype.createCanvas = function (name, x, y, width, height, z) {
|
||||
newCanvas.style.display = 'block';
|
||||
newCanvas.setAttribute("_left", x);
|
||||
newCanvas.setAttribute("_top", y);
|
||||
newCanvas.setAttribute("_width", width);
|
||||
newCanvas.setAttribute("_height", height);
|
||||
newCanvas.style.width = width * core.domStyle.scale + 'px';
|
||||
newCanvas.style.height = height * core.domStyle.scale + 'px';
|
||||
newCanvas.style.left = x * core.domStyle.scale + 'px';
|
||||
@@ -3439,16 +3462,21 @@ ui.prototype.rotateCanvas = function (name, angle, centerX, centerY) {
|
||||
}
|
||||
|
||||
////// canvas重置 //////
|
||||
ui.prototype.resizeCanvas = function (name, width, height, styleOnly, isTempCanvas) {
|
||||
ui.prototype.resizeCanvas = function (name, width, height, styleOnly) {
|
||||
var ctx = core.getContextByName(name);
|
||||
const canvas = ctx.canvas;
|
||||
if (!ctx) return null;
|
||||
if (width != null) {
|
||||
if (!styleOnly) core.maps._setHDCanvasSize(ctx, width, null, isTempCanvas);
|
||||
if (!styleOnly && ctx.canvas.hasAttribute('isHD'))
|
||||
core.maps._setHDCanvasSize(ctx, width, null);
|
||||
ctx.canvas.style.width = width * core.domStyle.scale + 'px';
|
||||
canvas.setAttribute('_width', width);
|
||||
}
|
||||
if (height != null) {
|
||||
if (!styleOnly) core.maps._setHDCanvasSize(ctx, null, height, isTempCanvas);
|
||||
if (!styleOnly && ctx.canvas.hasAttribute('isHD'))
|
||||
core.maps._setHDCanvasSize(ctx, null, height);
|
||||
ctx.canvas.style.height = height * core.domStyle.scale + 'px';
|
||||
canvas.setAttribute('_height', height);
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
|
||||
+3
-2
@@ -165,7 +165,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"firstData": {
|
||||
"title": "魔塔样板",
|
||||
"name": "template",
|
||||
"version": "Ver 2.10.0",
|
||||
"version": "Ver 2.10.3",
|
||||
"floorId": "sample0",
|
||||
"hero": {
|
||||
"image": "hero.png",
|
||||
@@ -771,6 +771,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"enableMoveDirectly": true,
|
||||
"enableRouteFolding": true,
|
||||
"disableShopOnDamage": false,
|
||||
"blurFg": false
|
||||
"blurFg": false,
|
||||
"hideLeftStatusBar": false
|
||||
}
|
||||
}
|
||||
@@ -1592,6 +1592,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
.sort( /*function (id1, id2) { return core.material.items[id1].name <= core.material.items[id2].name ? -1 : 1 }*/);
|
||||
},
|
||||
"drawStatusBar": function () {
|
||||
// 这真的是人能写出来的东西?
|
||||
var ctx, fill = function (text, x, y, style) {
|
||||
core.ui.setFont(ctx, (/\w+/.test(text) ? 'italic ' : '') + 'bold 18px Verdana');
|
||||
core.ui.fillBoldText(ctx, text, x, y, style);
|
||||
@@ -1614,7 +1615,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
fill(core.formatBigNumber(core.status.hero.money), 304, 58);
|
||||
core.drawImage(ctx, core.statusBar.icons.exp, 6, 70, 25, 25);
|
||||
fill(core.formatBigNumber(core.status.hero.exp), 42, 90);
|
||||
} else if (!core.flags.extendToolbar) { // 横屏且未隐藏状态栏
|
||||
} else if (!core.flags.hideLeftStatusBar) { // 横屏且未隐藏状态栏
|
||||
core.drawImage(ctx, core.statusBar.icons.floor, 6, 9, 25, 25);
|
||||
fill((core.status.thisMap || {}).name || "Loading", 42, 29);
|
||||
core.drawImage(ctx, core.statusBar.icons.hp, 6, 43, 25, 25);
|
||||
@@ -1633,7 +1634,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
fill(core.setTwoDigits(core.itemCount('blueKey')), 46, 267, '#AAAADD');
|
||||
fill(core.setTwoDigits(core.itemCount('redKey')), 81, 267, '#FF8888');
|
||||
}
|
||||
} else if (core.flags.extendToolbar && !core.domStyle.isVertical) { // 横屏且隐藏状态栏
|
||||
} else if (core.flags.hideLeftStatusBar && !core.domStyle.isVertical) { // 横屏且隐藏状态栏
|
||||
if (!core.dymCanvas['status'])
|
||||
core.ui.createCanvas('status', 0, 0, core._PX_, core._PY_, 66); // 刚好盖过显伤层
|
||||
core.ui.clearMap(ctx = core.dymCanvas['status']);
|
||||
|
||||
+265
-1
@@ -362,7 +362,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
if (!name) return;
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.id = name;
|
||||
canvas.className = 'gameCanvas';
|
||||
canvas.className = 'gameCanvas anti-aliasing';
|
||||
// 编辑器模式下设置zIndex会导致加入的图层覆盖优先级过高
|
||||
if (main.mode != "editor") canvas.style.zIndex = zIndex || 0;
|
||||
// 将图层插入进游戏内容
|
||||
@@ -1551,5 +1551,269 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
}
|
||||
|
||||
window.Sprite = Sprite;
|
||||
},
|
||||
"hotReload": function () {
|
||||
/* ---------- 功能说明 ---------- *
|
||||
|
||||
1. 当 libs/ main.js index.html 中的任意一个文件被更改后,会自动刷新塔的页面
|
||||
2. 修改楼层文件后自动在塔的页面上显示出来,不需要刷新
|
||||
3. 修改脚本编辑或插件编写后也能自动更新更改的插件或脚本,但不保证不会出问题(一般都不会有问题的
|
||||
4. 修改图块属性、怪物属性等后会自动更新
|
||||
5. 当全塔属性被修改时,会自动刷新塔的页面
|
||||
6. 样板的 styles.css 被修改后也可以直接显示,不需要刷新
|
||||
7. 其余内容修改后不会自动更新也不会刷新
|
||||
|
||||
/* ---------- 使用方式 ---------- *
|
||||
|
||||
1. 前往 https://nodejs.org/en/ 下载node.js的LTS版本(点左边那个绿色按钮)并安装
|
||||
2. 将该插件复制到插件编写中
|
||||
3. 在造塔群的群文件-魔塔样板·改中找到server.js,下载并放到塔的根目录(与启动服务同一级)
|
||||
4. 在该目录下按下shift+鼠标右键(win11只按右键即可),选择在终端打开或在powershell打开
|
||||
5. 运行node server.js即可
|
||||
|
||||
*/
|
||||
|
||||
if (main.mode !== 'play' || main.replayChecking) return;
|
||||
|
||||
/**
|
||||
* 发送请求
|
||||
* @param {string} url
|
||||
* @param {string} type
|
||||
* @param {string} data
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
async function post(url, type, data) {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open(type, url);
|
||||
xhr.send(data);
|
||||
const res = await new Promise(res => {
|
||||
xhr.onload = e => {
|
||||
if (xhr.status !== 200) {
|
||||
console.error(`hot reload: http ${xhr.status}`);
|
||||
res('@error');
|
||||
} else res('success');
|
||||
};
|
||||
xhr.onerror = e => {
|
||||
res('@error');
|
||||
console.error(`hot reload: error on connection`);
|
||||
};
|
||||
});
|
||||
if (res === 'success') return xhr.response;
|
||||
else return '@error';
|
||||
}
|
||||
|
||||
/**
|
||||
* 热重载css
|
||||
* @param {string} data
|
||||
*/
|
||||
function reloadCss(data) {
|
||||
const all = Array.from(document.getElementsByTagName('link'));
|
||||
all.forEach(v => {
|
||||
if (v.rel !== 'stylesheet') return;
|
||||
if (v.href === `http://127.0.0.1:3000/${data}`) {
|
||||
v.remove();
|
||||
const link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.type = 'text/css';
|
||||
link.href = data;
|
||||
document.head.appendChild(link);
|
||||
console.log(`css hot reload: ${data}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 热重载楼层
|
||||
* @param {string} data
|
||||
*/
|
||||
async function reloadFloor(data) {
|
||||
// 首先重新加载main.floors对应的楼层
|
||||
await import(`/project/floors/${data}.js?v=${Date.now()}`);
|
||||
// 然后写入core.floors并解析
|
||||
core.floors[data] = main.floors[data];
|
||||
const floor = core.loadFloor(data);
|
||||
if (core.isPlaying()) {
|
||||
core.status.maps[data] = floor;
|
||||
delete core.status.mapBlockObjs[data];
|
||||
core.extractBlocks(data);
|
||||
if (data === core.status.floorId) {
|
||||
core.drawMap(data);
|
||||
core.setWeather(
|
||||
core.animateFrame.weather.type,
|
||||
core.animateFrame.weather.level
|
||||
);
|
||||
}
|
||||
core.updateStatusBar(true, true);
|
||||
}
|
||||
console.log(`floor hot reload: ${data}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 热重载脚本编辑及插件编写
|
||||
* @param {string} data
|
||||
*/
|
||||
async function reloadScript(data) {
|
||||
if (data === 'plugins') {
|
||||
// 插件编写比较好办
|
||||
const before = plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1;
|
||||
// 这里不能用动态导入,因为动态导入会变成模块,变量就不是全局的了
|
||||
const script = document.createElement('script');
|
||||
script.src = `/project/plugins.js?v=${Date.now()}`;
|
||||
document.body.appendChild(script);
|
||||
await new Promise(res => {
|
||||
script.onload = () => res('success');
|
||||
});
|
||||
const after = plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1;
|
||||
// 找到差异的函数
|
||||
for (const id in before) {
|
||||
const fn = before[id];
|
||||
if (typeof fn !== 'function') continue;
|
||||
if (fn.toString() !== after[id]?.toString()) {
|
||||
try {
|
||||
core.plugin[id] = after[id];
|
||||
core.plugin[id].call(core.plugin);
|
||||
core.updateStatusBar(true, true);
|
||||
console.log(`plugin hot reload: ${id}`);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (data === 'functions') {
|
||||
// 脚本编辑略微麻烦点
|
||||
const before = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a;
|
||||
// 这里不能用动态导入,因为动态导入会变成模块,变量就不是全局的了
|
||||
const script = document.createElement('script');
|
||||
script.src = `/project/functions.js?v=${Date.now()}`;
|
||||
document.body.appendChild(script);
|
||||
await new Promise(res => {
|
||||
script.onload = () => res('success');
|
||||
});
|
||||
const after = functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a;
|
||||
// 找到差异的函数
|
||||
for (const mod in before) {
|
||||
const fns = before[mod];
|
||||
for (const id in fns) {
|
||||
const fn = fns[id];
|
||||
if (typeof fn !== 'function' || id === 'hasSpecial')
|
||||
continue;
|
||||
const now = after[mod][id];
|
||||
if (fn.toString() !== now.toString()) {
|
||||
try {
|
||||
if (mod === 'events') {
|
||||
core.events.eventdata[id] = now;
|
||||
} else if (mod === 'enemys') {
|
||||
core.enemys.enemydata[id] = now;
|
||||
} else if (mod === 'actions') {
|
||||
core.actions.actionsdata[id] = now;
|
||||
} else if (mod === 'control') {
|
||||
core.control.controldata[id] = now;
|
||||
} else if (mod === 'ui') {
|
||||
core.ui.uidata[id] = now;
|
||||
}
|
||||
core.updateStatusBar(true, true);
|
||||
console.log(
|
||||
`function hot reload: ${mod}.${id}`
|
||||
);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 属性热重载,包括全塔属性等
|
||||
* @param {string} data
|
||||
*/
|
||||
async function reloadData(data) {
|
||||
const script = document.createElement('script');
|
||||
script.src = `/project/${data}.js?v=${Date.now()}`;
|
||||
document.body.appendChild(script);
|
||||
await new Promise(res => {
|
||||
script.onload = () => res('success');
|
||||
});
|
||||
|
||||
let after;
|
||||
if (data === 'data')
|
||||
after = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d;
|
||||
if (data === 'enemys')
|
||||
after = enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80;
|
||||
if (data === 'icons')
|
||||
after = icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1;
|
||||
if (data === 'items')
|
||||
after = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a;
|
||||
if (data === 'maps')
|
||||
after = maps_90f36752_8815_4be8_b32b_d7fad1d0542e;
|
||||
if (data === 'events')
|
||||
after = events_c12a15a8_c380_4b28_8144_256cba95f760;
|
||||
|
||||
if (data === 'enemys') {
|
||||
core.enemys.enemys = after;
|
||||
for (var enemyId in after) {
|
||||
core.enemys.enemys[enemyId].id = enemyId;
|
||||
}
|
||||
core.material.enemys = core.getEnemys();
|
||||
} else if (data === 'icons') {
|
||||
core.icons.icons = after;
|
||||
core.material.icons = core.getIcons();
|
||||
} else if (data === 'items') {
|
||||
core.items.items = after;
|
||||
for (var itemId in after) {
|
||||
core.items.items[itemId].id = itemId;
|
||||
}
|
||||
core.material.items = core.getItems();
|
||||
} else if (data === 'maps') {
|
||||
core.maps.blocksInfo = after;
|
||||
core.status.mapBlockObjs = {};
|
||||
core.status.number2block = {};
|
||||
Object.values(core.status.maps).forEach(v => delete v.blocks);
|
||||
core.extractBlocks();
|
||||
core.setWeather(
|
||||
core.animateFrame.weather.type,
|
||||
core.animateFrame.weather.level
|
||||
);
|
||||
core.drawMap();
|
||||
} else if (data === 'events') {
|
||||
core.events.commonEvent = after.commonEvent;
|
||||
} else if (data === 'data') {
|
||||
location.reload();
|
||||
}
|
||||
core.updateStatusBar(true, true);
|
||||
console.log(`data hot reload: ${data}`);
|
||||
}
|
||||
|
||||
// 初始化
|
||||
(async function () {
|
||||
const data = await post('/reload', 'POST', 'test');
|
||||
if (data === '@error') {
|
||||
console.log(`未检测到node服务,热重载插件将无法使用`);
|
||||
} else {
|
||||
console.log(`热重载插件加载成功`);
|
||||
// reload
|
||||
setInterval(async () => {
|
||||
const res = await post('/reload', 'POST');
|
||||
if (res === '@error') return;
|
||||
if (res === 'true') location.reload();
|
||||
else return;
|
||||
}, 1000);
|
||||
|
||||
// hot reload
|
||||
setInterval(async () => {
|
||||
const res = await post('/hotReload', 'POST');
|
||||
const data = res.split('@@');
|
||||
data.forEach(v => {
|
||||
if (v === '') return;
|
||||
const [type, file] = v.split(':');
|
||||
if (type === 'css') reloadCss(file);
|
||||
if (type === 'data') reloadData(file);
|
||||
if (type === 'floor') reloadFloor(file);
|
||||
if (type === 'script') reloadScript(file);
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
})();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,651 @@
|
||||
const http = require('http');
|
||||
const fs = require('fs/promises');
|
||||
const fss = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const name = (() => {
|
||||
const data = fss.readFileSync('./project/data.js', 'utf-8');
|
||||
const json = JSON.parse(
|
||||
data
|
||||
.split(/(\n|\r\n)/)
|
||||
.slice(1)
|
||||
.join('\n')
|
||||
);
|
||||
return json.firstData.name;
|
||||
})();
|
||||
|
||||
/** 核心服务器 */
|
||||
const server = http.createServer();
|
||||
|
||||
/** 是否需要重新加载浏览器 */
|
||||
let needReload = true;
|
||||
|
||||
/** 热重载信息 */
|
||||
let hotReloadData = '';
|
||||
|
||||
/** 是否已经启动了热重载模块 */
|
||||
let watched = false;
|
||||
|
||||
/** 是否已经启动了录像调试模块 */
|
||||
let replayed = false;
|
||||
|
||||
/** 监听端口 */
|
||||
let port = 3000;
|
||||
const next = () => {
|
||||
server.listen(port, '127.0.0.1');
|
||||
server.on('error', () => {
|
||||
console.log(`${port}端口已被占用`);
|
||||
port++;
|
||||
next();
|
||||
});
|
||||
};
|
||||
next();
|
||||
|
||||
let repStart;
|
||||
|
||||
const listenedFloors = [];
|
||||
|
||||
// ----- GET file
|
||||
|
||||
/**
|
||||
* 请求文件
|
||||
* @param {http.IncomingMessage} req
|
||||
* @param {http.ServerResponse<http.IncomingMessage> & {req: http.IncomingMessage;}} res
|
||||
* @param {string} path
|
||||
*/
|
||||
async function getFile(req, res, path) {
|
||||
try {
|
||||
const data = await fs.readFile(path);
|
||||
if (path.endsWith('.js'))
|
||||
res.writeHead(200, { 'Content-type': 'text/javascript' });
|
||||
if (path.endsWith('.css'))
|
||||
res.writeHead(200, { 'Content-type': 'text/css' });
|
||||
if (path.endsWith('.html'))
|
||||
res.writeHead(200, { 'Content-type': 'text/html' });
|
||||
return res.end(data), true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 高层塔优化及动画加载
|
||||
* @param {http.IncomingMessage} req
|
||||
* @param {http.ServerResponse<http.IncomingMessage> & {req: http.IncomingMessage;}} res
|
||||
* @param {string[]} ids
|
||||
* @param {string} suffix 后缀名
|
||||
* @param {string} dir 文件夹路径
|
||||
* @param {string} join 分隔符
|
||||
*/
|
||||
async function getAll(req, res, ids, suffix, dir, join) {
|
||||
let data = {};
|
||||
const tasks = ids.map(v => {
|
||||
return new Promise(res => {
|
||||
const d = path.resolve(__dirname, `${dir}${v}${suffix}`);
|
||||
try {
|
||||
fs.readFile(d).then(vv => {
|
||||
data[v] = vv;
|
||||
res(`${v} pack success.`);
|
||||
});
|
||||
} catch {
|
||||
throw new ReferenceError(`The file ${d} does not exists.`);
|
||||
}
|
||||
});
|
||||
});
|
||||
await Promise.all(tasks);
|
||||
const result = ids.map(v => data[v]);
|
||||
return res.end(result.join(join)), true;
|
||||
}
|
||||
|
||||
// ----- 样板的fs功能
|
||||
|
||||
/**
|
||||
* 获取POST的数据
|
||||
* @param {http.IncomingMessage} req
|
||||
*/
|
||||
async function getPostData(req) {
|
||||
let data = '';
|
||||
await new Promise(res => {
|
||||
req.on('data', chunk => {
|
||||
data += chunk.toString();
|
||||
});
|
||||
req.on('end', res);
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {http.IncomingMessage} req
|
||||
* @param {http.ServerResponse<http.IncomingMessage> & {req: http.IncomingMessage;}} res
|
||||
*/
|
||||
async function readDir(req, res) {
|
||||
const data = await getPostData(req);
|
||||
const dir = path.resolve(__dirname, data.toString().slice(5));
|
||||
try {
|
||||
const info = await fs.readdir(dir);
|
||||
res.end(JSON.stringify(info));
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
res.end(`error: Read dir ${dir} fail. Does the dir exists?`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {http.IncomingMessage} req
|
||||
* @param {http.ServerResponse<http.IncomingMessage> & {req: http.IncomingMessage;}} res
|
||||
*/
|
||||
async function mkdir(req, res) {
|
||||
const data = await getPostData(req);
|
||||
const dir = path.resolve(__dirname, data.toString().slice(5));
|
||||
try {
|
||||
await fs.mkdir(dir);
|
||||
} catch (e) {}
|
||||
res.end();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {http.IncomingMessage} req
|
||||
* @param {http.ServerResponse<http.IncomingMessage> & {req: http.IncomingMessage;}} res
|
||||
*/
|
||||
async function readFile(req, res) {
|
||||
const data = (await getPostData(req)).toString();
|
||||
const dir = path.resolve(__dirname, data.split('&name=')[1]);
|
||||
try {
|
||||
const type = /^type=(utf8|base64)/.exec(data)[0];
|
||||
const info = await fs.readFile(dir, { encoding: type.slice(5) });
|
||||
res.end(info);
|
||||
} catch (e) {
|
||||
res.end();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {http.IncomingMessage} req
|
||||
* @param {http.ServerResponse<http.IncomingMessage> & {req: http.IncomingMessage;}} res
|
||||
*/
|
||||
async function writeFile(req, res) {
|
||||
const data = (await getPostData(req)).toString();
|
||||
const name = data.split('&name=')[1].split('&value=')[0];
|
||||
const dir = path.resolve(__dirname, name);
|
||||
try {
|
||||
const type = /^type=(utf8|base64)/.exec(data)[0].slice(5);
|
||||
const value = /&value=[^]+/.exec(data)[0].slice(7);
|
||||
await fs.writeFile(dir, value, { encoding: type });
|
||||
testWatchFloor(name);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
res.end(
|
||||
`error: Write file ${dir} fail. Does the parent folder exists?`
|
||||
);
|
||||
}
|
||||
res.end();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {http.IncomingMessage} req
|
||||
* @param {http.ServerResponse<http.IncomingMessage> & {req: http.IncomingMessage;}} res
|
||||
*/
|
||||
async function rm(req, res) {
|
||||
const data = (await getPostData(req)).toString();
|
||||
const dir = path.resolve(__dirname, data.slice(5));
|
||||
try {
|
||||
await fs.rm(dir);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
res.end(`error: Remove file ${dir} fail. Does this file exists?`);
|
||||
}
|
||||
res.end();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {http.IncomingMessage} req
|
||||
* @param {http.ServerResponse<http.IncomingMessage> & {req: http.IncomingMessage;}} res
|
||||
*/
|
||||
async function moveFile(req, res) {
|
||||
const data = (await getPostData(req)).toString();
|
||||
const info = data.split('&dest=');
|
||||
const src = path.resolve(__dirname, info[0].slice(4));
|
||||
const dest = info[1];
|
||||
try {
|
||||
const data = await fs.readFile(src);
|
||||
await fs.writeFile(path.resolve(__dirname, dest), data);
|
||||
await fs.rm(src);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
res.end(`error: Move file ${dir} fail.`);
|
||||
}
|
||||
res.end();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {http.IncomingMessage} req
|
||||
* @param {http.ServerResponse<http.IncomingMessage> & {req: http.IncomingMessage;}} res
|
||||
*/
|
||||
async function writeMultiFiles(req, res) {
|
||||
const data = (await getPostData(req)).toString();
|
||||
const names = /name=[^]+&value=/.exec(data)[0].slice(5, -7).split(';');
|
||||
const value = /&value=[^]+/.exec(data)[0].slice(7).split(';');
|
||||
|
||||
const tasks = names.map((v, i) => {
|
||||
try {
|
||||
return new Promise(res => {
|
||||
fs.writeFile(
|
||||
path.resolve(__dirname, v),
|
||||
value[i],
|
||||
'base64' // 多文件是base64写入的
|
||||
).then(v => {
|
||||
testWatchFloor(v);
|
||||
res(`write ${v} success.`);
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
console.error(e);
|
||||
res.end(`error: Write multi files fail.`);
|
||||
}
|
||||
});
|
||||
await Promise.all(tasks);
|
||||
res.end();
|
||||
}
|
||||
|
||||
// ----- extract path & utils
|
||||
|
||||
/**
|
||||
* 解析路径
|
||||
* @param {...string} dirs
|
||||
* @returns {Promise<string[]>}
|
||||
*/
|
||||
async function extract(...dirs) {
|
||||
const res = [];
|
||||
const tasks = dirs.map(v => {
|
||||
return new Promise(resolve => {
|
||||
if (v.endsWith('/')) {
|
||||
// 匹配路径
|
||||
const dir = path.resolve(__dirname, v.slice(0, -1));
|
||||
fs.readdir(dir).then(files => {
|
||||
const all = files
|
||||
.filter(v => v !== 'thirdparty') // 排除第三方库
|
||||
.map(vv => v + vv);
|
||||
|
||||
res.push(...all);
|
||||
resolve('success');
|
||||
});
|
||||
} else if (/\/\*.\w+$/.test(v)) {
|
||||
// 匹配文件夹中的后缀名
|
||||
const suffix = /\.\w+$/.exec(v)[0];
|
||||
const d = v.split(`/*${suffix}`)[0];
|
||||
const dir = path.resolve(__dirname, d);
|
||||
fs.readdir(dir).then(files => {
|
||||
const all = files
|
||||
.filter(v => v.endsWith(suffix))
|
||||
.map(v => `${d === '' ? '' : d + '/'}${v}`);
|
||||
|
||||
res.push(...all);
|
||||
resolve('success');
|
||||
});
|
||||
} else {
|
||||
res.push(v);
|
||||
resolve('success');
|
||||
}
|
||||
});
|
||||
});
|
||||
await Promise.all(tasks);
|
||||
return res;
|
||||
}
|
||||
|
||||
// ----- hot reload
|
||||
|
||||
/**
|
||||
* 监听文件变化
|
||||
*/
|
||||
async function watch() {
|
||||
// 需要重新加载的文件
|
||||
const refresh = await extract('main.js', 'index.html', 'libs/');
|
||||
const option = {
|
||||
interval: 1000
|
||||
};
|
||||
refresh.forEach(v => {
|
||||
const dir = path.resolve(__dirname, v);
|
||||
fss.watchFile(dir, option, () => {
|
||||
needReload = true;
|
||||
console.log(`change: ${v}`);
|
||||
});
|
||||
});
|
||||
|
||||
// css 热重载
|
||||
const css = await extract('/*.css');
|
||||
css.forEach(v => {
|
||||
const dir = path.resolve(__dirname, v);
|
||||
fss.watchFile(dir, option, () => {
|
||||
hotReloadData += `@@css:${v}`;
|
||||
console.log(`css hot reload: ${v}`);
|
||||
});
|
||||
});
|
||||
|
||||
// 楼层 热重载
|
||||
// 注意这里要逐个监听,并通过创建文件来监听文件改变
|
||||
const floors = await extract('project/floors/*.js');
|
||||
floors.forEach(v => {
|
||||
watchOneFloor(v.slice(15));
|
||||
});
|
||||
|
||||
// 脚本编辑 及 插件 热重载
|
||||
const scripts = await extract('project/functions.js', 'project/plugins.js');
|
||||
scripts.forEach(v => {
|
||||
const dir = path.resolve(__dirname, v);
|
||||
const type = v.split('/').at(-1).slice(0, -3);
|
||||
fss.watchFile(dir, option, () => {
|
||||
hotReloadData += `@@script:${type}`;
|
||||
console.log(`script hot reload: ${type}.js`);
|
||||
});
|
||||
});
|
||||
|
||||
// 数据热重载
|
||||
const datas = (await extract('project/*.js')).filter(
|
||||
v => !v.endsWith('functions.js') && !v.endsWith('plugins.js')
|
||||
);
|
||||
datas.forEach(v => {
|
||||
const dir = path.resolve(__dirname, v);
|
||||
const type = v.split('/').at(-1).slice(0, -3);
|
||||
fss.watchFile(dir, option, () => {
|
||||
hotReloadData += `@@data:${type}`;
|
||||
console.log(`data hot reload: ${type}`);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测是否是楼层文件并进行监听
|
||||
* @param {string} url 要测试的路径
|
||||
*/
|
||||
function testWatchFloor(url) {
|
||||
if (/project(\/|\\)floors(\/|\\).*\.js/.test(url)) {
|
||||
const f = url.slice(15);
|
||||
if (!listenedFloors.includes(f.slice(0, -3))) {
|
||||
watchOneFloor(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听一个楼层文件
|
||||
* @param {string} file 要监听的文件
|
||||
*/
|
||||
function watchOneFloor(file) {
|
||||
if (!/.*\.js/.test(file)) return;
|
||||
const f = file.slice(0, -3);
|
||||
listenedFloors.push(file.slice(0, -3));
|
||||
fss.watchFile(`project/floors/${file}`, { interval: 1000 }, () => {
|
||||
const floorId = f;
|
||||
if (hotReloadData.includes(`@@floor:${floorId}`)) return;
|
||||
hotReloadData += `@@floor:${floorId}`;
|
||||
console.log(`floor hot reload: ${floorId}`);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改部分文件后重新加载及热重载
|
||||
* @param {http.IncomingMessage} req
|
||||
* @param {http.ServerResponse<http.IncomingMessage> & {req: http.IncomingMessage;}} res
|
||||
*/
|
||||
function reload(req, res, hot = false) {
|
||||
req.on('data', chunk => {
|
||||
if (chunk.toString() === 'test' && !watched) {
|
||||
watch();
|
||||
watched = true;
|
||||
console.log(`服务器热重载模块已开始服务`);
|
||||
}
|
||||
});
|
||||
|
||||
req.on('end', () => {
|
||||
if (!hot) {
|
||||
res.end(`${needReload}`);
|
||||
needReload = false;
|
||||
} else {
|
||||
res.end(hotReloadData);
|
||||
hotReloadData = '';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ----- replay debugger
|
||||
|
||||
/**
|
||||
* 录像调试
|
||||
* @param {http.IncomingMessage} req
|
||||
* @param {http.ServerResponse<http.IncomingMessage> & {req: http.IncomingMessage;}} res
|
||||
*/
|
||||
function replay(req, res) {
|
||||
req.on('data', async chunk => {
|
||||
if (chunk.toString() === 'test' && !replayed) {
|
||||
replayed = true;
|
||||
try {
|
||||
await fs.mkdir(path.resolve(__dirname, '_replay'));
|
||||
await fs.mkdir(path.resolve(__dirname, '_replay/status'));
|
||||
await fs.mkdir(path.resolve(__dirname, '_replay/save'));
|
||||
} catch {}
|
||||
|
||||
try {
|
||||
await fs.readFile(
|
||||
path.resolve(__dirname, '_replay/.info'),
|
||||
'utf-8'
|
||||
);
|
||||
} catch {
|
||||
await fs.writeFile(
|
||||
path.resolve(__dirname, '_replay/.info'),
|
||||
`{
|
||||
"cnt": 0
|
||||
}`,
|
||||
'utf-8'
|
||||
);
|
||||
}
|
||||
const data = fss.readFileSync(
|
||||
path.resolve(__dirname, '_replay/.info'),
|
||||
'utf-8'
|
||||
);
|
||||
repStart = Number(JSON.parse(data).cnt);
|
||||
console.log(`服务器录像调试模块已开始服务`);
|
||||
}
|
||||
});
|
||||
|
||||
req.on('end', () => {
|
||||
res.end();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取未占用的状态栏位
|
||||
* @param {http.IncomingMessage} req
|
||||
* @param {http.ServerResponse<http.IncomingMessage> & {req: http.IncomingMessage;}} res
|
||||
*/
|
||||
async function replayCnt() {
|
||||
const data = `{
|
||||
"cnt": ${++repStart}
|
||||
}`;
|
||||
fss.writeFileSync(path.resolve(__dirname, '_replay/.info'), data, 'utf-8');
|
||||
|
||||
return repStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入
|
||||
* @param {http.IncomingMessage} req
|
||||
* @param {http.ServerResponse<http.IncomingMessage> & {req: http.IncomingMessage;}} res
|
||||
*/
|
||||
async function replayWrite(req, res) {
|
||||
const data = await getPostData(req);
|
||||
const n = await replayCnt();
|
||||
|
||||
if (isNaN(n)) res.end('@error');
|
||||
|
||||
await Promise.all([
|
||||
fs.writeFile(
|
||||
path.resolve(__dirname, '_replay/.info'),
|
||||
`{
|
||||
"cnt": ${n + 1}
|
||||
}`,
|
||||
'utf-8'
|
||||
),
|
||||
fs.writeFile(
|
||||
path.resolve(__dirname, `_replay/status/${n}.rep`),
|
||||
data,
|
||||
'utf-8'
|
||||
)
|
||||
]);
|
||||
|
||||
res.end(n.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 比对录像与本地数据
|
||||
* @param {http.IncomingMessage} req
|
||||
* @param {http.ServerResponse<http.IncomingMessage> & {req: http.IncomingMessage;}} res
|
||||
*/
|
||||
async function replayCheck(req, res) {
|
||||
const ans = await getPostData(req);
|
||||
const [n, data] = ans.split('@-|-@');
|
||||
|
||||
const local = (
|
||||
await fs.readFile(
|
||||
path.resolve(__dirname, `_replay/status/${n}.rep`),
|
||||
'utf-8'
|
||||
)
|
||||
)
|
||||
.split('@---@')
|
||||
.map(v => JSON.parse(v));
|
||||
const rep = data.split('@---@').map(v => JSON.parse(v));
|
||||
|
||||
if (local.length !== rep.length) return res.end('false');
|
||||
|
||||
const check = (a, b) => {
|
||||
if (a === b) return true;
|
||||
if (typeof a !== typeof b) return false;
|
||||
if (typeof a === 'object' && a !== null) {
|
||||
for (const j in a) {
|
||||
if (j === 'statistics' || j === 'timeout') continue; // 忽略统计信息
|
||||
const aa = a[j];
|
||||
const bb = b[j];
|
||||
if (!check(aa, bb)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (
|
||||
typeof a === 'boolean' ||
|
||||
typeof a === 'number' ||
|
||||
typeof a === 'string' ||
|
||||
typeof a === 'symbol' ||
|
||||
typeof a === 'undefined' ||
|
||||
typeof a === 'bigint' ||
|
||||
a === null
|
||||
) {
|
||||
return a === b;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
for (let i = 0; i < local.length; i++) {
|
||||
const a = local[i];
|
||||
const b = rep[i];
|
||||
if (!check(a, b)) return res.end('false');
|
||||
}
|
||||
|
||||
res.end('true');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取本地属性
|
||||
* @param {http.IncomingMessage} req
|
||||
* @param {http.ServerResponse<http.IncomingMessage> & {req: http.IncomingMessage;}} res
|
||||
*/
|
||||
async function replayGet(req, res, dir) {
|
||||
const ans = Number(await getPostData(req));
|
||||
|
||||
const data = await fs.readFile(
|
||||
path.resolve(__dirname, `_replay/${dir}/${ans}.rep`)
|
||||
);
|
||||
res.end(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 录像回放存档
|
||||
* @param {http.IncomingMessage} req
|
||||
* @param {http.ServerResponse<http.IncomingMessage> & {req: http.IncomingMessage;}} res
|
||||
*/
|
||||
async function replaySave(req, res) {
|
||||
const data = await getPostData(req);
|
||||
const [cnt, save] = data.split('@-|-@');
|
||||
|
||||
if (isNaN(Number(cnt))) {
|
||||
console.log('Invalid input of save cnt');
|
||||
res.end('@error: 不合法的录像存档信息');
|
||||
}
|
||||
|
||||
await fs.writeFile(
|
||||
path.resolve(__dirname, `_replay/save/${cnt}.rep`),
|
||||
save,
|
||||
'utf-8'
|
||||
);
|
||||
|
||||
res.end('success');
|
||||
}
|
||||
|
||||
// ----- server
|
||||
|
||||
server.on('listening', () => {
|
||||
console.log(`服务已启动,编辑器地址:http://127.0.0.1:${port}/editor.html`);
|
||||
console.log(`游戏地址:http://127.0.0.1:${port}`);
|
||||
});
|
||||
|
||||
// 处理请求
|
||||
server.on('request', async (req, res) => {
|
||||
/** @type {string} */
|
||||
const p = req.url.replace(`/games/${name}`, '').replace('/all/', '/');
|
||||
|
||||
if (req.method === 'GET') {
|
||||
const dir = path
|
||||
.resolve(__dirname, p === '/' ? 'index.html' : p.slice(1))
|
||||
.split('?v=')[0];
|
||||
|
||||
if (await getFile(req, res, dir)) return;
|
||||
|
||||
if (p.startsWith('/__all_floors__.js')) {
|
||||
const all = p.split('&id=')[1].split(',');
|
||||
res.writeHead(200, { 'Content-type': 'text/javascript' });
|
||||
return await getAll(req, res, all, '.js', 'project/floors/', '\n');
|
||||
}
|
||||
|
||||
if (p.startsWith('/__all_animates__')) {
|
||||
const all = p.split('&id=')[1].split(',');
|
||||
return await getAll(
|
||||
req,
|
||||
res,
|
||||
all,
|
||||
'.animate',
|
||||
'project/animates/',
|
||||
'@@@~~~###~~~@@@'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (req.method === 'POST') {
|
||||
if (p === '/listFile') return await readDir(req, res);
|
||||
if (p === '/makeDir') return await mkdir(req, res);
|
||||
if (p === '/readFile') return await readFile(req, res);
|
||||
if (p === '/writeFile') return await writeFile(req, res);
|
||||
if (p === '/deleteFile') return await rm(req, res);
|
||||
if (p === '/moveFile') return await moveFile(req, res);
|
||||
if (p === '/writeMultiFiles') return await writeMultiFiles(req, res);
|
||||
if (p === '/reload') return reload(req, res);
|
||||
if (p === '/hotReload') return reload(req, res, true);
|
||||
if (p === '/replay') return replay(req, res);
|
||||
if (p === '/replayWrite') return await replayWrite(req, res);
|
||||
if (p === '/replayCheck') return await replayCheck(req, res);
|
||||
if (p === '/replayGet') return await replayGet(req, res, 'status');
|
||||
if (p === '/replaySave') return await replaySave(req, res);
|
||||
if (p === '/replayGetSave') return await replayGet(req, res, 'save');
|
||||
}
|
||||
|
||||
res.statusCode = 404;
|
||||
res.end();
|
||||
});
|
||||
@@ -499,4 +499,9 @@ p#name {
|
||||
@font-face {
|
||||
font-family: Fira Code;
|
||||
src: url(../src/fonts/FiraCode-Regular.ttf);
|
||||
}
|
||||
|
||||
/* 注释下面这三行以开启抗锯齿 */
|
||||
.anti-aliasing {
|
||||
image-rendering: pixelated;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"noEmit": true,
|
||||
},
|
||||
"include": [
|
||||
"main.js", "project/**/*.js", "libs/**/*.js", "runtime.d.ts"
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user