JS Compressor

This commit is contained in:
oc 2017-12-08 14:57:13 +08:00
parent 9e37717f24
commit 4dc5390743
15 changed files with 39 additions and 16 deletions

BIN
EcmaScript.NET.dll Normal file

Binary file not shown.

BIN
JS代码压缩工具.exe Normal file

Binary file not shown.

BIN
Yahoo.Yui.Compressor.dll Normal file

Binary file not shown.

1
libs/core.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
libs/data.min.js vendored Normal file
View File

@ -0,0 +1 @@
function data(){}data.prototype.init=function(){this.firstData={title:"魔塔样板",name:"template",version:"Ver 1.0.0 (Beta)",floorId:"sample0",hero:{id:"hero1",name:"勇士",hp:1000,atk:100,def:100,mdef:100,money:100,experience:1000,items:{keys:{yellowKey:0,blueKey:0,redKey:0},constants:{},tools:{}},flyRange:[],loc:{direction:"up",x:6,y:10},flags:{poison:false,weak:false,curse:false,}},startText:["Hi欢迎来到 HTML5 魔塔样板!\n\n本样板由艾之葵制作可以让你在不会写任何代码\n的情况下也能做出属于自己的H5魔塔","这里游戏开始时的剧情。\n定义在data.js的startText处。\n\n你可以在这里写上自己的内容。","赶快来试一试吧!"],shops:{moneyShop1:{name:"贪婪之神",icon:"blueShop",textInList:"3楼金币商店",use:"money",need:"20+10*times*(times+1)",choices:[{text:"生命+800",effect:"status:hp+=800"},{text:"攻击+4",effect:"status:atk+=4"},{text:"防御+4",effect:"status:def+=4"},{text:"魔防+10",effect:"status:mdef+=10"}]},expShop1:{name:"经验之神",icon:"pinkShop",textInList:"5楼经验商店",use:"experience",need:"-1",choices:[{text:"等级+1",need:"100",effect:"status:hp+=1000;status:atk+=7;status:def+=7"},{text:"攻击+5",need:"30",effect:"status:atk+=5"},{text:"防御+5",need:"30",effect:"status:def+=5"},]}},};this.values={HPMAX:999999,lavaDamage:100,poisonDamage:10,weakValue:20,cannotUseQuickShop:["MT0"],redJewel:3,blueJewel:3,greenJewel:5,redPotion:100,bluePotion:250,yellowPotion:500,greenPotion:800,sword1:10,shield1:10,sword2:20,shield2:20,sword3:40,shield3:40,sword4:80,shield4:80,sword5:160,shield5:160,moneyPocket:500,animateSpeed:500,};this.flags={enableMDef:false,enableExperience:true,flyNearStair:true,bombTrigger:true,pickaxeFourDirections:true,bigKeyIsBox:false,portalWithoutTrigger:true,potionWhileRouting:false,}};data.prototype.getFirstData=function(){return core.clone(this.firstData)};main.instance.data=new data();

1
libs/enemys.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -320,9 +320,9 @@ events.prototype.doAction = function() {
break;
case "if": // 条件判断
if (core.calValue(data.condition))
core.events.insertAction(data.true)
core.events.insertAction(data["true"])
else
core.events.insertAction(data.false)
core.events.insertAction(data["false"])
this.doAction();
break;
case "choices": // 提供选项
@ -335,8 +335,8 @@ events.prototype.doAction = function() {
core.events.lose(data.reason);
break;
case "function":
if (core.isset(data.function))
data.function();
if (core.isset(data["function"]))
data["function"]();
this.doAction();
break;
case "update":

1
libs/events.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
libs/floors.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -322,7 +322,6 @@ main.floors.sample2 = {
},
"6,5": { // 黄宝石
"enable": false
// 获得后将触发afterGetItem事件
}
},

1
libs/icons.min.js vendored Normal file
View File

@ -0,0 +1 @@
function icons(){}icons.prototype.init=function(){this.icons={heros:{hero1:{down:{loc:0,stop:0,leftFoot:1,rightFoot:2},left:{loc:1,stop:0,leftFoot:1,rightFoot:2},right:{loc:2,stop:0,leftFoot:1,rightFoot:2},up:{loc:3,stop:0,leftFoot:1,rightFoot:2}}},terrains:{ground:0,yellowWall:1,whiteWall:2,blueWall:3,star:4,lava:5,ice:6,downFloor:7,upFloor:8,yellowDoor:9,blueDoor:10,redDoor:11,greenDoor:12,specialDoor:13,steelDoor:14,"blueShop-left":15,"blueShop-right":16,"pinkShop-left":17,"pinkShop-right":18},animates:{star:0,lava:1,water:2,yellowDoor:3,blueDoor:4,redDoor:5,greenDoor:6,specialDoor:7,blueWallDoor:8,yellowWallDoor:9,whiteWallDoor:10,steelDoor:11,lavaDoor:12,grayLavaDoor:13,starDoor:14,mockBlueWallDoor:15,mockYellowWallDoor:16,mockWhiteWallDoor:17,iceYellowWallDoor:18,starPortal:19,exclamation:20,portal:21,"switch":22,lavaNet:23,poisonNet:24,weakNet:25,curseNet:26,downPortal:27,leftPortal:28,rightPortal:29,upPortal:30},npcs:{man:0,woman:1,thief:2,fairy:3,magician:4,womanMagician:5,oldMan:6,child:7,wood:8,pinkShop:9,blueShop:10,princess:11},enemys:{greenSlime:0,redSlime:1,blackSlime:2,slimelord:3,bat:4,bigBat:5,redBat:6,vampire:7,skeleton:8,skeletonSoilder:9,skeletonCaptain:10,ghostSkeleton:11,zombie:12,zombieKnight:13,rock:14,slimeMan:15,bluePriest:16,redPriest:17,brownWizard:18,redWizard:19,yellowGuard:20,blueGuard:21,redGuard:22,swordsman:23,soldier:24,yellowKnight:25,redKnight:26,darkKnight:27,blackKing:28,yellowKing:29,greenKing:30,blueKnight:31,goldSlime:32,poisonSkeleton:33,poisonBat:34,steelRock:35,skeletonPriest:36,skeletonKing:37,skeletonWizard:38,redSkeletonCaption:39,badHero:40,demon:41,demonPriest:42,goldHornSlime:43,redKing:44,whiteKing:45,blackMagician:46,silverSlime:47,swordEmperor:48,whiteHornSlime:49,badPrincess:50,badFairy:51,grayPriest:52,redSwordsman:53,whiteGhost:54,poisonZombie:55,magicDragon:56,octopus:57,fairy:58,greenKnight:59,},items:{yellowKey:0,blueKey:1,redKey:2,greenKey:3,steelKey:4,bigKey:6,redJewel:16,blueJewel:17,greenJewel:18,yellowJewel:19,redPotion:20,bluePotion:21,greenPotion:22,yellowPotion:23,sword1:50,sword2:51,sword3:52,sword4:53,sword5:54,shield1:55,shield2:56,shield3:57,shield4:58,shield5:59,book:9,fly:12,pickaxe:45,icePickaxe:44,bomb:43,centerFly:13,upFly:15,downFly:14,coin:11,snow:41,cross:40,superPotion:29,earthquake:8,poisonWine:24,weakWine:25,curseWine:27,superWine:28,knife:42,moneyPocket:46,shoes:47,hammer:48}}};icons.prototype.getIcons=function(a){if(a==undefined){return this.icons}return this.icons[a]};main.instance.icons=new icons();

1
libs/items.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
libs/maps.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
libs/ui.min.js vendored Normal file

File diff suppressed because one or more lines are too long

37
main.js
View File

@ -75,8 +75,11 @@ function main() {
'curse': document.getElementById('curse'),
'hard': document.getElementById("hard")
}
this.useCompress = false; // 是否使用压缩文件发布前推荐使用“JS压缩工具”将所有js文件进行压缩它会将此项改成true。
// 只有useCompress是false时才会读取floors目录下的文件。如果要进行剧本的修改请务必将其改成false
this.useCompress = false; // 是否使用压缩文件
// 当你即将发布你的塔时请使用“JS代码压缩工具”将所有js代码进行压缩然后将这里的useCompress改为true。
// 请注意只有useCompress是false时才会读取floors目录下的文件为true时会直接读取libs目录下的floors.min.js文件。
// 如果要进行剧本的修改请务必将其改成false。
this.floorIds = [ // 在这里按顺序放所有的楼层;其顺序直接影响到楼层传送器的顺序和上楼器/下楼器的顺序
"sample0", "sample1", "sample2"
]
@ -125,23 +128,35 @@ main.prototype.loaderJs = function (callback) {
}
main.prototype.loaderFloors = function (callback) {
// 加载js
main.setMainTipsText('正在加载楼层文件...')
for (var i = 0; i < main.floorIds.length; i++) {
main.loadFloor(main.floorIds[i], function (modName) {
main.setMainTipsText("楼层 " + modName + '.js 加载完毕');
if (Object.keys(main.floors).length === main.floorIds.length) {
main.dom.mainTips.style.display = 'none';
callback();
}
});
if (this.useCompress) { // 读取压缩文件
var script = document.createElement('script');
script.src = 'libs/floors.min.js?' + this.version;
main.dom.body.appendChild(script);
script.onload = function () {
main.dom.mainTips.style.display = 'none';
callback();
}
}
else {
for (var i = 0; i < main.floorIds.length; i++) {
main.loadFloor(main.floorIds[i], function (modName) {
main.setMainTipsText("楼层 " + modName + '.js 加载完毕');
if (Object.keys(main.floors).length === main.floorIds.length) {
main.dom.mainTips.style.display = 'none';
callback();
}
});
}
}
}
main.prototype.loadMod = function (modName, callback) {
var script = document.createElement('script');
var name = modName;
script.src = 'libs/' + modName + '.js?' + this.version;
script.src = 'libs/' + modName + (this.useCompress?".min":"") + '.js?' + this.version;
main.dom.body.appendChild(script);
script.onload = function () {
main[name] = main.instance[name];