Compare commits
	
		
			No commits in common. "bb41bad0590409c9930872add79961312157311c" and "8b267f3745141f7652889a5c382a56bbad5a10eb" have entirely different histories.
		
	
	
		
			bb41bad059
			...
			8b267f3745
		
	
		
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1,2 +0,0 @@ | |||||||
| _saves/ |  | ||||||
| _server/config.json |  | ||||||
							
								
								
									
										1
									
								
								_saves/.exported
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								_saves/.exported
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | |||||||
|  | 1 | ||||||
							
								
								
									
										1
									
								
								_saves/Eustia_autoSave
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								_saves/Eustia_autoSave
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | |||||||
|  | N4IgZgNg9lBOCSATEAuEBnALrApjzADAIwgA0IAFjrFKqAJYC2AhgOY6qXVQB0A7jgBGABzIhmAOybNMHFGGYR0OchOaM5IAMLMmYiADdURchWEsAHqgCct66dEoiBF+RZrLqALQmQ75qgE5DIA1sauIIg4YOFBflExKHHownjISW5QEjgAnoHkOBaOcTgAjgCu9OY4EpioANoAuuT0sozodCAAxllYkpgdKKCCMGFO5JB5TgC+5JgwSnSzIGWVwoOg6HxwiCQzy9BdnYj0uF2Y9Fmc5aLkVigArORTzsuQbBsgrTiMACL4uggqGw5RUIHKygAQvgBDUADL0VgUOooEFggD66OUOEQmOMAHYAGwEawADgATOSACxxTGwSS49EE4lkyk04K4ZiDeqgDyaAA65SpOAIgkFDy6VPJYhY6wa2l0jAoUA0IEas156gFQpFYvKEqlMuYcpQ9RAACt6OVWOVJGqNSA+ZxBcLReLJdK3MbuSAANIAFQAavbSJrVWhBfjyYTyZHyWASF6TWaA4GAGLS9Whx1a53lKMxuMJo3JkCsKAQRAhXIhsPa116g2evze+WCegUCHlWhZut513Md2GpM+y3MKCYSSsWs58MgF0iwf6j0ln3oKgSVgSAzK1W92f1xdD5uytcUejb3ccfdOiP56Ox+/Fkfyy048cz2/z++Fp+JlullguD4MQYhAXghDNjaU5dBQU5iNBm6wVOzYWPQ45oVOoF3OhUCYZuBCobh+GsAAzJ+uYoBI5QQBAL6miAOT0BUJA3pR1G0fRZpMRUmYOreHF0QBPo8eU5FseGglcYxzFChRkk0UJp7yqJDzyXIUnCSpsmEupqCacpDGifielUYp0miaSpkGa2RmydY1nmVpdksQQ9rNBgIRVKgChKGCcGwOktLogFiBaBWcB4mguDIOQmLfIwAASF6YFFTRxeiEA4MwBg4HCUBdFFwDLJiBj0Og3yMp04EgXsaLLIIMJ4BIACCmCTl0IS/DIARmZxICYswOD0GlHmYic6DMIIWVVUMGDYBBoGmvURCkQ8zRNOqbwVtAAiwNyHlYDgJq+H0FxYPQXSfPMk4QP6TByOSDxEEQUpRjwhJ2C91hPN05SwLA93hkQDxUtYPCkXYUNQ4SDj5CAggyJgWXw4wWQ1hkKxFPDiPtVl3UsOw8PCFA5VZATbByCUFjYMwFNE5jaO5b8pw4OcEBTHEiISHAOAAMqyCaySTrAKKElSDykTwVLTMsoWcKu1ULbVnSyg0QQa6Qmva1ruv1D4pAG0bJgG0ExuGyblsWxbzQa1t5A0OUsicL6UAZloVKsAAvGIBiKKCGzLLl+2XBIebWDgpGIOKggPAQkbMNY0flNYhHx/qpKg+6BBgIK1iEkQMTkDa9DpCA5LMIghKEog1iFYgYBgFS6JUqSifooIVKEmA6JgIgU0EDgNJV3gYgXMD+KkficfWKRBBSi40xAA== | ||||||
| @ -854,8 +854,6 @@ action | |||||||
|     |   waitAsync_s |     |   waitAsync_s | ||||||
|     |   stopAsync_s |     |   stopAsync_s | ||||||
|     |   op_s |     |   op_s | ||||||
|     |   setmusics_s |  | ||||||
|     |   introAndLoop_s |  | ||||||
|     |   battle_s |     |   battle_s | ||||||
|     |   battle_1_s |     |   battle_1_s | ||||||
|     |   openDoor_s |     |   openDoor_s | ||||||
| @ -965,7 +963,8 @@ action | |||||||
|     |   animationDrawable_s |     |   animationDrawable_s | ||||||
|     |   over_s |     |   over_s | ||||||
|     |   overlist_s |     |   overlist_s | ||||||
|     |   cgtextList_s |     |   playStereo_s | ||||||
|  |     |   moveStereo_s | ||||||
|     |   pass_s |     |   pass_s | ||||||
|     ; |     ; | ||||||
| 
 | 
 | ||||||
| @ -1124,33 +1123,22 @@ overtextEmpty | |||||||
| var code = []; | var code = []; | ||||||
| return code; | return code; | ||||||
| */; | */; | ||||||
| cgtextList_s |  | ||||||
|     :    '切换剧情文本库' EvalString  Newline |  | ||||||
|      |  | ||||||
| 
 |  | ||||||
| /* cgtextList_s |  | ||||||
| tooltip : cgtextList:设置cg剧情文本库 |  | ||||||
| helpUrl : /_docs/#/instruction |  | ||||||
| default : ["chapter0"] |  | ||||||
| var code = '{"type": "cgtextList", "textList":"'+EvalString_0+'"},\n'; |  | ||||||
| return code; |  | ||||||
| */; |  | ||||||
| 
 | 
 | ||||||
| cgtext_s | cgtext_s | ||||||
|     :    '背景' EvalString? '回忆滤镜' Bool? '移除对话框' Bool? '剧情库序列' Int '头像' EvalString?'坐标PX' Number'打字间隔' Int? BGNL? Newline |     :    '背景' EvalString? '回忆滤镜' Bool? '移除对话框' Bool? '头像' EvalString?'名字' EvalString?'坐标PX' Number'打字间隔' Int? BGNL? Newline | ||||||
|      '自动等待时长' Int '音频文件(需在全塔属性——使用音效注册)'EvalString? BGNL? Newline |      '自动等待时长' Int '音频文件(需在全塔属性——使用音效注册)'EvalString? BGNL? Newline | ||||||
|       textcgDrawingList+? Newline |      EvalString? BGNL? Newline textcgDrawingList+? Newline | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
| /* cgtext_s | /* cgtext_s | ||||||
| tooltip : cgtext:显示一段包含cg的文字(剧情) | tooltip : cgtext:显示一段包含cg的文字(剧情) | ||||||
| helpUrl : /_docs/#/instruction | helpUrl : /_docs/#/instruction | ||||||
| allImages : ['EvalString_0','EvalString_1'] | allImages : ['EvalString_0','EvalString_1'] | ||||||
| allSounds : ['EvalString_2'] | allSounds : ['EvalString_3'] | ||||||
| default : ["bg_5043.webp",false,false,0,"face_050445.webp",-300,0,2000,"","这句话显示在对话框内",[{ "name":"tati_050145a.webp" , "px": 100,"filter":false }]] | default : ["bg_5043.webp",false,"face_050445.webp",false,"菲奥奈",-300,0,2000,"","这句话显示在对话框内",[{ "name":"tati_050145a.webp" , "px": 100,"filter":false }]] | ||||||
| var head ='{ "name": "'+EvalString_1+'", "px": '+Number_0+' }' | var head ='{ "name": "'+EvalString_1+'", "px": '+Number_0+' }' | ||||||
| var list=',"bodyList": [\n'+textcgDrawingList_0.slice(0,-1)+'\n]' | var list=',"bodyList": [\n'+textcgDrawingList_0.slice(0,-1)+'\n]' | ||||||
| var code = '{"type": "cgtext", "bg":"'+EvalString_0+'","memory":'+Bool_0+',"WindowSkin":'+Bool_1+',"head":'+head+' ,"index":"'+Int_0+'","time":'+Int_1+',"wait":'+Int_2+',"sound":"'+EvalString_2+'"'+list+' },\n'; | var code = '{"type": "cgtext", "bg":"'+EvalString_0+'","memory":'+Bool_0+',"WindowSkin":'+Bool_1+',"head":'+head+' ,"name":"'+EvalString_2+'","time":'+Int_0+',"wait":'+Int_1+',"sound":"'+EvalString_3+'","text": "'+EvalString_4+'"'+list+' },\n'; | ||||||
| return code; | return code; | ||||||
| */; | */; | ||||||
| textcgDrawingList | textcgDrawingList | ||||||
| @ -2624,23 +2612,6 @@ var code = '{"type": "setq"'+IdString_0+'},\n'; | |||||||
| return code; | return code; | ||||||
| */; | */; | ||||||
| 
 | 
 | ||||||
| introAndLoop_s |  | ||||||
|     :   '前奏音乐文件'EvalString? '前奏音乐文件播放时长(可填小数,单位为秒)'EvalString'循环音乐文件'EvalString?  Newline |  | ||||||
| 
 |  | ||||||
| /* introAndLoop_s |  | ||||||
| tooltip : introAndLoop:设置任务目标楼层(显示在小地图) |  | ||||||
| helpUrl : /_docs/#/instruction |  | ||||||
| default : ["",1,""] |  | ||||||
| allBgms : ['EvalString_0','EvalString_2'] |  | ||||||
| colour :this.imageColor |  | ||||||
| if(EvalString_1&&!/^(0|([1-9][0-9]*))(\.[\d]+)?$/.test(EvalString_1))throw new Error("此项仅能填写小数或整数,单位为秒"); |  | ||||||
| EvalString_0 = EvalString_0 ? (', "intro": "'+EvalString_0+'"') : ''; |  | ||||||
| EvalString_1= EvalString_1 ? (', "time": '+EvalString_1+'') : ''; |  | ||||||
| EvalString_2 = EvalString_2 ? (', "loop": "'+EvalString_2+'"') : ''; |  | ||||||
| var code = '{"type": "introAndLoop"'+EvalString_0+EvalString_1+EvalString_2+'},\n'; |  | ||||||
| return code; |  | ||||||
| */; |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| setcgs_s | setcgs_s | ||||||
|     :   'cg回廊获取cg 文件名'EvalString?'不填为清空cg获取记录'  Newline |     :   'cg回廊获取cg 文件名'EvalString?'不填为清空cg获取记录'  Newline | ||||||
| @ -2650,26 +2621,12 @@ tooltip : setcgs:cg回廊中的cg获取 | |||||||
| helpUrl : /_docs/#/instruction | helpUrl : /_docs/#/instruction | ||||||
| default : [""] | default : [""] | ||||||
| allImages : ['EvalString_0'] | allImages : ['EvalString_0'] | ||||||
| colour : this.soundColor | colour : this.imageColor | ||||||
| EvalString_0 = EvalString_0 ? (', "img": "'+EvalString_0+'"') : ''; | EvalString_0 = EvalString_0 ? (', "img": "'+EvalString_0+'"') : ''; | ||||||
| var code = '{"type": "setcgs"'+EvalString_0+'},\n'; | var code = '{"type": "setcgs"'+EvalString_0+'},\n'; | ||||||
| return code; | return code; | ||||||
| */; | */; | ||||||
| 
 | 
 | ||||||
| setmusics_s |  | ||||||
|     :   '音乐鉴赏music 文件名'EvalString?'不填为清空music获取记录'  Newline |  | ||||||
| 
 |  | ||||||
| /* setmusics_s |  | ||||||
| tooltip : setmusics:音乐鉴赏中的隐藏music获取 |  | ||||||
| helpUrl : /_docs/#/instruction |  | ||||||
| default : [""] |  | ||||||
| allBgms : ['EvalString_0'] |  | ||||||
| colour : this.soundColor |  | ||||||
| EvalString_0 = EvalString_0 ? (', "bgm": "'+EvalString_0+'"') : ''; |  | ||||||
| var code = '{"type": "setmusics"'+EvalString_0+'},\n'; |  | ||||||
| return code; |  | ||||||
| */; |  | ||||||
| 
 |  | ||||||
| scaleImage_s | scaleImage_s | ||||||
|     :   '图片放缩' '图片编号' NInt '中心点像素' 'x' PosString? 'y' PosString? '移动方式' MoveMode_List BGNL? '放缩比例' Number '动画时间' Int '不等待执行完毕' Bool Newline |     :   '图片放缩' '图片编号' NInt '中心点像素' 'x' PosString? 'y' PosString? '移动方式' MoveMode_List BGNL? '放缩比例' Number '动画时间' Int '不等待执行完毕' Bool Newline | ||||||
|         |         | ||||||
| @ -3088,8 +3045,39 @@ var code = '{"type": "playSound", "name": "'+EvalString_0+'"'+Bool_0+IntString_0 | |||||||
| return code; | return code; | ||||||
| */; | */; | ||||||
| 
 | 
 | ||||||
|  | playStereo_s | ||||||
|  |     :   '播放音效(立体音)' EvalString '左声道音量' Int '右声道音量' Int '启用立体音' Bool? Newline | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
|  | /* playStereo_s | ||||||
|  | tooltip : playSound: 播放音效(立体音) | ||||||
|  | helpUrl : /_docs/#/instruction | ||||||
|  | default : ["item.mp3",1,1,true] | ||||||
|  | colour : this.imageColor | ||||||
|  | allSounds : ['EvalString_0'] | ||||||
|  | material : ["./project/sounds/", "EvalString_0"] | ||||||
|  | 
 | ||||||
|  | var code = '{"type": "playStereo", "name": "'+EvalString_0+'", "left": '+Int_0+', "right": '+Int_1+', "split": '+Bool_0+'},\n'; | ||||||
|  | return code; | ||||||
|  | */; | ||||||
|  | 
 | ||||||
|  | moveStereo_s | ||||||
|  |     :   '播放渐变音效(立体音)' EvalString '左声道音量' Int '右声道音量' Int '启用立体音' Bool? BGNL? Newline | ||||||
|  |     '左声道目标音量' Int '右声道目标音量' Int '渐变时长'Int Newline | ||||||
|  |      | ||||||
|  | 
 | ||||||
|  | /* moveStereo_s | ||||||
|  | tooltip : playSound: 播放渐变音效(立体音) | ||||||
|  | helpUrl : /_docs/#/instruction | ||||||
|  | default : ["item.mp3",1,1,true,10,10,1000] | ||||||
|  | colour : this.imageColor | ||||||
|  | allSounds : ['EvalString_0'] | ||||||
|  | material : ["./project/sounds/", "EvalString_0"] | ||||||
|  | 
 | ||||||
|  | var code = '{"type": "moveStereo", "name": "'+EvalString_0+'", "left": '+Int_0+', "right": '+Int_1+', "split": '+Bool_0+', "leftTo": '+Int_2+', "rightTo": '+Int_3+', "time": '+Int_4+'},\n'; | ||||||
|  | return code; | ||||||
|  | */; | ||||||
|  | 
 | ||||||
| playSound_1_s | playSound_1_s | ||||||
|     :   '播放系统音效' NameMap_List '停止之前音效' Bool? '音调' IntString? '等待播放完毕' Bool? Newline |     :   '播放系统音效' NameMap_List '停止之前音效' Bool? '音调' IntString? '等待播放完毕' Bool? Newline | ||||||
|      |      | ||||||
|  | |||||||
| @ -542,12 +542,6 @@ MotaActionParser = function () { | |||||||
|           ); |           ); | ||||||
|         } |         } | ||||||
|         break; |         break; | ||||||
|       case "cgtextList": |  | ||||||
|         this.next = MotaActionBlocks["cgtextList_s"].xmlText([ |  | ||||||
|           data.textList, |  | ||||||
|           this.next, |  | ||||||
|         ]); |  | ||||||
|         break; |  | ||||||
|       case "cgtext": // cg对话框
 |       case "cgtext": // cg对话框
 | ||||||
|         var buildcgDrawing = function (obj) { |         var buildcgDrawing = function (obj) { | ||||||
|           obj = MotaActionFunctions.processcgDrawing(obj || []); |           obj = MotaActionFunctions.processcgDrawing(obj || []); | ||||||
| @ -569,12 +563,13 @@ MotaActionParser = function () { | |||||||
|           data.bg, |           data.bg, | ||||||
|           data.memory, |           data.memory, | ||||||
|           data.WindowSkin, |           data.WindowSkin, | ||||||
|           data.index, |  | ||||||
|           data.head.name, |           data.head.name, | ||||||
|  |           data.name || "", | ||||||
|           data.head.px || -300, |           data.head.px || -300, | ||||||
|           data.time, |           data.time, | ||||||
|           data.wait, |           data.wait, | ||||||
|           data.sound, |           data.sound, | ||||||
|  |           data.text, | ||||||
|           buildcgDrawing(data.bodyList), |           buildcgDrawing(data.bodyList), | ||||||
|           this.next, |           this.next, | ||||||
|         ]); |         ]); | ||||||
| @ -625,20 +620,6 @@ MotaActionParser = function () { | |||||||
|       case "setcgs": |       case "setcgs": | ||||||
|         this.next = MotaActionBlocks["setcgs_s"].xmlText([data.img, this.next]); |         this.next = MotaActionBlocks["setcgs_s"].xmlText([data.img, this.next]); | ||||||
|         break; |         break; | ||||||
|       case "setmusics": |  | ||||||
|         this.next = MotaActionBlocks["setmusics_s"].xmlText([ |  | ||||||
|           data.bgm, |  | ||||||
|           this.next, |  | ||||||
|         ]); |  | ||||||
|         break; |  | ||||||
|       case "introAndLoop": |  | ||||||
|         this.next = MotaActionBlocks["introAndLoop_s"].xmlText([ |  | ||||||
|           data.intro, |  | ||||||
|           data.time, |  | ||||||
|           data.loop, |  | ||||||
|           this.next, |  | ||||||
|         ]); |  | ||||||
|         break; |  | ||||||
|       case "comment": // 注释
 |       case "comment": // 注释
 | ||||||
|         this.next = MotaActionBlocks["comment_s"].xmlText([ |         this.next = MotaActionBlocks["comment_s"].xmlText([ | ||||||
|           this.EvalString_Multi(data.text), |           this.EvalString_Multi(data.text), | ||||||
| @ -1525,6 +1506,27 @@ MotaActionParser = function () { | |||||||
|           ]); |           ]); | ||||||
|         } |         } | ||||||
|         break; |         break; | ||||||
|  |       case "playStereo": | ||||||
|  |         this.next = MotaActionBlocks["playStereo_s"].xmlText([ | ||||||
|  |           data.name, | ||||||
|  |           data.left, | ||||||
|  |           data.right, | ||||||
|  |           data.split || true, | ||||||
|  |           this.next, | ||||||
|  |         ]); | ||||||
|  |         break; | ||||||
|  |       case "moveStereo": | ||||||
|  |         this.next = MotaActionBlocks["moveStereo_s"].xmlText([ | ||||||
|  |           data.name, | ||||||
|  |           data.left, | ||||||
|  |           data.right, | ||||||
|  |           data.split || true, | ||||||
|  |           data.leftTo, | ||||||
|  |           data.rightTo, | ||||||
|  |           data.time, | ||||||
|  |           this.next, | ||||||
|  |         ]); | ||||||
|  |         break; | ||||||
|       case "playSound": |       case "playSound": | ||||||
|         var knownItems = MotaActionBlocks["NameMap_List"].options.map(function ( |         var knownItems = MotaActionBlocks["NameMap_List"].options.map(function ( | ||||||
|           one |           one | ||||||
|  | |||||||
							
								
								
									
										1
									
								
								_server/config.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								_server/config.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | |||||||
|  | { "viewportLoc": [0, 0], "editorLastFloorId": "jiedao" } | ||||||
| @ -389,7 +389,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { | |||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		}, | 		}, | ||||||
| 		"enemys_template": { 'name': '新敌人', 'hp': 0, 'atk': 0, 'def': 0, 'mdef': 0, 'speed': 0, 'money': 0, 'exp': 0, 'point': 0, 'special': [] }, | 		"enemys_template": { 'name': '新敌人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'exp': 0, 'point': 0, 'special': [] }, | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 		// --------------------------- 【图块属性】相关的表格配置 --------------------------- //
 | 		// --------------------------- 【图块属性】相关的表格配置 --------------------------- //
 | ||||||
|  | |||||||
| @ -122,12 +122,6 @@ var plugins_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { | |||||||
| 				"_type": "textarea", | 				"_type": "textarea", | ||||||
| 				"_range": "typeof(thiseval)=='string' || thiseval==null", | 				"_range": "typeof(thiseval)=='string' || thiseval==null", | ||||||
| 				"_data": "音乐鉴赏" | 				"_data": "音乐鉴赏" | ||||||
| 			}, |  | ||||||
| 			"intro&loop": { |  | ||||||
| 				"_leaf": true, |  | ||||||
| 				"_type": "textarea", |  | ||||||
| 				"_range": "typeof(thiseval)=='string' || thiseval==null", |  | ||||||
| 				"_data": "背景音乐拼接" |  | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		if (obj[key]) return obj[key]; | 		if (obj[key]) return obj[key]; | ||||||
|  | |||||||
							
								
								
									
										2869
									
								
								libs/control.js
									
									
									
									
									
								
							
							
						
						
									
										2869
									
								
								libs/control.js
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										2889
									
								
								libs/events.js
									
									
									
									
									
								
							
							
						
						
									
										2889
									
								
								libs/events.js
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										550
									
								
								libs/loader.js
									
									
									
									
									
								
							
							
						
						
									
										550
									
								
								libs/loader.js
									
									
									
									
									
								
							| @ -1,3 +1,4 @@ | |||||||
|  | 
 | ||||||
| /* | /* | ||||||
| loader.js:负责对资源的加载 | loader.js:负责对资源的加载 | ||||||
| 
 | 
 | ||||||
| @ -8,17 +9,19 @@ function loader() { | |||||||
|     this._init(); |     this._init(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| loader.prototype._init = function () {}; | loader.prototype._init = function () { | ||||||
|  | 
 | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| ////// 设置加载进度条进度 //////
 | ////// 设置加载进度条进度 //////
 | ||||||
| loader.prototype._setStartProgressVal = function (val) { | loader.prototype._setStartProgressVal = function (val) { | ||||||
|   core.dom.startTopProgress.style.width = val + "%"; |     core.dom.startTopProgress.style.width = val + '%'; | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| ////// 设置加载进度条提示文字 //////
 | ////// 设置加载进度条提示文字 //////
 | ||||||
| loader.prototype._setStartLoadTipText = function (text) { | loader.prototype._setStartLoadTipText = function (text) { | ||||||
|     core.dom.startTopLoadTips.innerText = text; |     core.dom.startTopLoadTips.innerText = text; | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| loader.prototype._load = function (callback) { | loader.prototype._load = function (callback) { | ||||||
|     this._loadMusics(); |     this._loadMusics(); | ||||||
| @ -27,7 +30,7 @@ loader.prototype._load = function (callback) { | |||||||
|     } else { |     } else { | ||||||
|         this._load_sync(callback); |         this._load_sync(callback); | ||||||
|     } |     } | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| loader.prototype._load_sync = function (callback) { | loader.prototype._load_sync = function (callback) { | ||||||
|     this._loadAnimates_sync(); |     this._loadAnimates_sync(); | ||||||
| @ -36,13 +39,13 @@ loader.prototype._load_sync = function (callback) { | |||||||
|         core.loader._loadExtraImages_sync(function () { |         core.loader._loadExtraImages_sync(function () { | ||||||
|             core.loader._loadAutotiles_sync(function () { |             core.loader._loadAutotiles_sync(function () { | ||||||
|                 core.loader._loadTilesets_sync(callback); |                 core.loader._loadTilesets_sync(callback); | ||||||
|  |             }) | ||||||
|  |         }) | ||||||
|     }); |     }); | ||||||
|     }); | } | ||||||
|   }); |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| loader.prototype._load_async = function (callback) { | loader.prototype._load_async = function (callback) { | ||||||
|   core.loader._setStartLoadTipText("正在加载资源文件..."); |     core.loader._setStartLoadTipText('正在加载资源文件...'); | ||||||
|     const all = {}; |     const all = {}; | ||||||
| 
 | 
 | ||||||
|     const _makeOnProgress = function (name) { |     const _makeOnProgress = function (name) { | ||||||
| @ -50,8 +53,7 @@ loader.prototype._load_async = function (callback) { | |||||||
|         return (loaded, total) => { |         return (loaded, total) => { | ||||||
|             all[name].loaded = loaded; |             all[name].loaded = loaded; | ||||||
|             all[name].total = total; |             all[name].total = total; | ||||||
|       let allLoaded = 0, |             let allLoaded = 0, allTotal = 0; | ||||||
|         allTotal = 0; |  | ||||||
|             for (const one of Object.values(all)) { |             for (const one of Object.values(all)) { | ||||||
|                 allLoaded += one.loaded; |                 allLoaded += one.loaded; | ||||||
|                 allTotal += one.total; |                 allTotal += one.total; | ||||||
| @ -61,20 +63,14 @@ loader.prototype._load_async = function (callback) { | |||||||
|                 if (allLoaded == allTotal) { |                 if (allLoaded == allTotal) { | ||||||
|                     core.loader._setStartLoadTipText("正在处理资源文件... 请稍候..."); |                     core.loader._setStartLoadTipText("正在处理资源文件... 请稍候..."); | ||||||
|                 } else { |                 } else { | ||||||
|           core.loader._setStartLoadTipText( |                     core.loader._setStartLoadTipText('正在加载资源文件... ' + | ||||||
|             "正在加载资源文件... " + |                         core.formatSize(allLoaded) + " / " + core.formatSize(allTotal) + | ||||||
|               core.formatSize(allLoaded) + |                         " (" + (allLoaded / allTotal * 100).toFixed(2) + "%)"); | ||||||
|               " / " + |  | ||||||
|               core.formatSize(allTotal) + |  | ||||||
|               " (" + |  | ||||||
|               ((allLoaded / allTotal) * 100).toFixed(2) + |  | ||||||
|               "%)" |  | ||||||
|           ); |  | ||||||
|                 } |                 } | ||||||
|         core.loader._setStartProgressVal((allLoaded / allTotal) * 100); |                 core.loader._setStartProgressVal(allLoaded / allTotal * 100); | ||||||
|             } |             } | ||||||
|         }; |         }; | ||||||
|   }; |     } | ||||||
|     const _makeOnFinished = function (name) { |     const _makeOnFinished = function (name) { | ||||||
|         return () => { |         return () => { | ||||||
|             setTimeout(() => { |             setTimeout(() => { | ||||||
| @ -84,121 +80,58 @@ loader.prototype._load_async = function (callback) { | |||||||
|                 } |                 } | ||||||
|                 callback(); |                 callback(); | ||||||
|             }); |             }); | ||||||
|     }; |         } | ||||||
|   }; |     } | ||||||
| 
 | 
 | ||||||
|     if (main.splitChunkMap) { |     if (main.splitChunkMap) { | ||||||
|     this._loadAnimates_chunked( |         this._loadAnimates_chunked(main.splitChunkMap.animates, _makeOnProgress, _makeOnFinished); | ||||||
|       main.splitChunkMap.animates, |         this._loadSounds_chunked(main.splitChunkMap.sounds, _makeOnProgress, _makeOnFinished); | ||||||
|       _makeOnProgress, |         this._loadMaterials_chunked(main.splitChunkMap.materials, _makeOnProgress, _makeOnFinished); | ||||||
|       _makeOnFinished |         this._loadExtraImages_chunked(main.splitChunkMap.images, _makeOnProgress, _makeOnFinished); | ||||||
|     ); |         this._loadAutotiles_chunked(main.splitChunkMap.autotiles, _makeOnProgress, _makeOnFinished); | ||||||
|     this._loadSounds_chunked( |         this._loadTilesets_chunked(main.splitChunkMap.tilesets, _makeOnProgress, _makeOnFinished); | ||||||
|       main.splitChunkMap.sounds, |  | ||||||
|       _makeOnProgress, |  | ||||||
|       _makeOnFinished |  | ||||||
|     ); |  | ||||||
|     this._loadMaterials_chunked( |  | ||||||
|       main.splitChunkMap.materials, |  | ||||||
|       _makeOnProgress, |  | ||||||
|       _makeOnFinished |  | ||||||
|     ); |  | ||||||
|     this._loadExtraImages_chunked( |  | ||||||
|       main.splitChunkMap.images, |  | ||||||
|       _makeOnProgress, |  | ||||||
|       _makeOnFinished |  | ||||||
|     ); |  | ||||||
|     this._loadAutotiles_chunked( |  | ||||||
|       main.splitChunkMap.autotiles, |  | ||||||
|       _makeOnProgress, |  | ||||||
|       _makeOnFinished |  | ||||||
|     ); |  | ||||||
|     this._loadTilesets_chunked( |  | ||||||
|       main.splitChunkMap.tilesets, |  | ||||||
|       _makeOnProgress, |  | ||||||
|       _makeOnFinished |  | ||||||
|     ); |  | ||||||
|     } else { |     } else { | ||||||
|     this._loadAnimates_async( |         this._loadAnimates_async(_makeOnProgress('animates'), _makeOnFinished('animates')); | ||||||
|       _makeOnProgress("animates"), |         this._loadSounds_async(_makeOnProgress('sounds'), _makeOnFinished('sounds')); | ||||||
|       _makeOnFinished("animates") |         this._loadMaterials_async(_makeOnProgress('materials'), _makeOnFinished('materials')); | ||||||
|     ); |         this._loadExtraImages_async(_makeOnProgress('images'), _makeOnFinished('images')); | ||||||
|     this._loadSounds_async( |         this._loadAutotiles_async(_makeOnProgress('autotiles'), _makeOnFinished('autotiles')); | ||||||
|       _makeOnProgress("sounds"), |         this._loadTilesets_async(_makeOnProgress('tilesets'), _makeOnFinished('tilesets')); | ||||||
|       _makeOnFinished("sounds") |     } | ||||||
|     ); |  | ||||||
|     this._loadMaterials_async( |  | ||||||
|       _makeOnProgress("materials"), |  | ||||||
|       _makeOnFinished("materials") |  | ||||||
|     ); |  | ||||||
|     this._loadExtraImages_async( |  | ||||||
|       _makeOnProgress("images"), |  | ||||||
|       _makeOnFinished("images") |  | ||||||
|     ); |  | ||||||
|     this._loadAutotiles_async( |  | ||||||
|       _makeOnProgress("autotiles"), |  | ||||||
|       _makeOnFinished("autotiles") |  | ||||||
|     ); |  | ||||||
|     this._loadTilesets_async( |  | ||||||
|       _makeOnProgress("tilesets"), |  | ||||||
|       _makeOnFinished("tilesets") |  | ||||||
|     ); |  | ||||||
| } | } | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| // ----- 加载资源文件 ------ //
 | // ----- 加载资源文件 ------ //
 | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadMaterials_sync = function (callback) { | loader.prototype._loadMaterials_sync = function (callback) { | ||||||
|     this._setStartLoadTipText("正在加载资源文件..."); |     this._setStartLoadTipText("正在加载资源文件..."); | ||||||
|   this.loadImages( |     this.loadImages("materials", core.materials, core.material.images, function () { | ||||||
|     "materials", |  | ||||||
|     core.materials, |  | ||||||
|     core.material.images, |  | ||||||
|     function () { |  | ||||||
|         core.loader._loadMaterials_afterLoad(); |         core.loader._loadMaterials_afterLoad(); | ||||||
|         callback(); |         callback(); | ||||||
|  |     }); | ||||||
| } | } | ||||||
|   ); |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadMaterials_async = function (onprogress, onfinished) { | loader.prototype._loadMaterials_async = function (onprogress, onfinished) { | ||||||
|   this.loadImagesFromZip( |     this.loadImagesFromZip('project/materials/materials.h5data', core.materials, core.material.images, onprogress, function () { | ||||||
|     "project/materials/materials.h5data", |  | ||||||
|     core.materials, |  | ||||||
|     core.material.images, |  | ||||||
|     onprogress, |  | ||||||
|     function () { |  | ||||||
|         core.loader._loadMaterials_afterLoad(); |         core.loader._loadMaterials_afterLoad(); | ||||||
|         onfinished(); |         onfinished(); | ||||||
|  |     }); | ||||||
| } | } | ||||||
|   ); |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadMaterials_chunked = async function ( | loader.prototype._loadMaterials_chunked = async function (chunks, makeOnProgress, makeOnFinished) { | ||||||
|   chunks, |     await this._loadImagesFromChunks(chunks, core.materials, core.material.images, makeOnProgress, makeOnFinished); | ||||||
|   makeOnProgress, |  | ||||||
|   makeOnFinished |  | ||||||
| ) { |  | ||||||
|   await this._loadImagesFromChunks( |  | ||||||
|     chunks, |  | ||||||
|     core.materials, |  | ||||||
|     core.material.images, |  | ||||||
|     makeOnProgress, |  | ||||||
|     makeOnFinished |  | ||||||
|   ); |  | ||||||
|     core.loader._loadMaterials_afterLoad(); |     core.loader._loadMaterials_afterLoad(); | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadMaterials_afterLoad = function () { | loader.prototype._loadMaterials_afterLoad = function () { | ||||||
|   const images = core.splitImage(core.material.images["icons"]); |     const images = core.splitImage(core.material.images['icons']); | ||||||
|     for (let key in core.statusBar.icons) { |     for (let key in core.statusBar.icons) { | ||||||
|     if (typeof core.statusBar.icons[key] == "number") { |         if (typeof core.statusBar.icons[key] == 'number') { | ||||||
|             core.statusBar.icons[key] = images[core.statusBar.icons[key]]; |             core.statusBar.icons[key] = images[core.statusBar.icons[key]]; | ||||||
|             if (core.statusBar.image[key] != null) |             if (core.statusBar.image[key] != null) | ||||||
|                 core.statusBar.image[key].src = core.statusBar.icons[key].src; |                 core.statusBar.image[key].src = core.statusBar.icons[key].src; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| // ------ 加载使用的图片 ------ //
 | // ------ 加载使用的图片 ------ //
 | ||||||
| 
 | 
 | ||||||
| @ -206,54 +139,38 @@ loader.prototype._loadExtraImages_sync = function (callback) { | |||||||
|     core.material.images.images = {}; |     core.material.images.images = {}; | ||||||
|     this._setStartLoadTipText("正在加载图片文件..."); |     this._setStartLoadTipText("正在加载图片文件..."); | ||||||
|     core.loadImages("images", core.images, core.material.images.images, callback); |     core.loadImages("images", core.images, core.material.images.images, callback); | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadExtraImages_async = function (onprogress, onfinished) { | loader.prototype._loadExtraImages_async = function (onprogress, onfinished) { | ||||||
|     core.material.images.images = {}; |     core.material.images.images = {}; | ||||||
|      |      | ||||||
|     // Check .gif
 |     // Check .gif
 | ||||||
|     const gifs = images.filter(function (name) { |     const gifs = images.filter(function (name) { | ||||||
|     return name.toLowerCase().endsWith(".gif"); |         return name.toLowerCase().endsWith('.gif'); | ||||||
|     }); |     }); | ||||||
|     // gif没有被压缩在zip中,延迟加载...
 |     // gif没有被压缩在zip中,延迟加载...
 | ||||||
|     this._loadExtraImages_loadLazy(gifs); |     this._loadExtraImages_loadLazy(gifs); | ||||||
| 
 | 
 | ||||||
|   images = images.filter((name) => !name.toLowerCase().endsWith(".gif")); |     images = images.filter((name) => !name.toLowerCase().endsWith('.gif')); | ||||||
| 
 | 
 | ||||||
|   this.loadImagesFromZip( |     this.loadImagesFromZip('project/images/images.h5data', images, core.material.images.images, onprogress, onfinished); | ||||||
|     "project/images/images.h5data", | } | ||||||
|     images, |  | ||||||
|     core.material.images.images, |  | ||||||
|     onprogress, |  | ||||||
|     onfinished |  | ||||||
|   ); |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadExtraImages_chunked = function ( | loader.prototype._loadExtraImages_chunked = function (chunks, makeOnProgress, makeOnFinished) { | ||||||
|   chunks, |  | ||||||
|   makeOnProgress, |  | ||||||
|   makeOnFinished |  | ||||||
| ) { |  | ||||||
|     core.material.images.images = {}; |     core.material.images.images = {}; | ||||||
|     let images = core.images; |     let images = core.images; | ||||||
| 
 | 
 | ||||||
|     // Check .gif
 |     // Check .gif
 | ||||||
|     const gifs = images.filter(function (name) { |     const gifs = images.filter(function (name) { | ||||||
|     return name.toLowerCase().endsWith(".gif"); |         return name.toLowerCase().endsWith('.gif'); | ||||||
|     }); |     }); | ||||||
|     // gif没有被压缩在zip中,延迟加载...
 |     // gif没有被压缩在zip中,延迟加载...
 | ||||||
|     this._loadExtraImages_loadLazy(gifs); |     this._loadExtraImages_loadLazy(gifs); | ||||||
| 
 | 
 | ||||||
|   images = images.filter((name) => !name.toLowerCase().endsWith(".gif")); |     images = images.filter((name) => !name.toLowerCase().endsWith('.gif')); | ||||||
| 
 | 
 | ||||||
|   this._loadImagesFromChunks( |     this._loadImagesFromChunks(chunks, images, core.material.images.images, makeOnProgress, makeOnFinished); | ||||||
|     chunks, | } | ||||||
|     images, |  | ||||||
|     core.material.images.images, |  | ||||||
|     makeOnProgress, |  | ||||||
|     makeOnFinished |  | ||||||
|   ); |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadExtraImages_loadLazy = function (list) { | loader.prototype._loadExtraImages_loadLazy = function (list) { | ||||||
|     list.forEach(function (gif) { |     list.forEach(function (gif) { | ||||||
| @ -263,7 +180,7 @@ loader.prototype._loadExtraImages_loadLazy = function (list) { | |||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
|     }, this); |     }, this); | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| // ------ 加载自动元件 ------ //
 | // ------ 加载自动元件 ------ //
 | ||||||
| 
 | 
 | ||||||
| @ -277,43 +194,27 @@ loader.prototype._loadAutotiles_sync = function (callback) { | |||||||
|         core.loader._loadAutotiles_afterLoad(keys, autotiles); |         core.loader._loadAutotiles_afterLoad(keys, autotiles); | ||||||
|         callback(); |         callback(); | ||||||
|     }); |     }); | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadAutotiles_async = function (onprogress, onfinished) { | loader.prototype._loadAutotiles_async = function (onprogress, onfinished) { | ||||||
|     core.material.images.autotile = {}; |     core.material.images.autotile = {}; | ||||||
|     var keys = Object.keys(core.material.icons.autotile); |     var keys = Object.keys(core.material.icons.autotile); | ||||||
|     var autotiles = {}; |     var autotiles = {}; | ||||||
| 
 | 
 | ||||||
|   this.loadImagesFromZip( |     this.loadImagesFromZip('project/autotiles/autotiles.h5data', keys, autotiles, onprogress, function () { | ||||||
|     "project/autotiles/autotiles.h5data", |  | ||||||
|     keys, |  | ||||||
|     autotiles, |  | ||||||
|     onprogress, |  | ||||||
|     function () { |  | ||||||
|         core.loader._loadAutotiles_afterLoad(keys, autotiles); |         core.loader._loadAutotiles_afterLoad(keys, autotiles); | ||||||
|         onfinished(); |         onfinished(); | ||||||
|  |     }); | ||||||
| } | } | ||||||
|   ); |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadAutotiles_chunked = async function ( | loader.prototype._loadAutotiles_chunked = async function (chunks, makeOnProgress, makeOnFinished) { | ||||||
|   chunks, |  | ||||||
|   makeOnProgress, |  | ||||||
|   makeOnFinished |  | ||||||
| ) { |  | ||||||
|     core.material.images.autotile = {}; |     core.material.images.autotile = {}; | ||||||
|     const keys = Object.keys(core.material.icons.autotile); |     const keys = Object.keys(core.material.icons.autotile); | ||||||
|     const autotiles = {}; |     const autotiles = {}; | ||||||
| 
 | 
 | ||||||
|   await this._loadImagesFromChunks( |     await this._loadImagesFromChunks(chunks, keys, autotiles, makeOnProgress, makeOnFinished); | ||||||
|     chunks, |  | ||||||
|     keys, |  | ||||||
|     autotiles, |  | ||||||
|     makeOnProgress, |  | ||||||
|     makeOnFinished |  | ||||||
|   ); |  | ||||||
|     core.loader._loadAutotiles_afterLoad(keys, autotiles); |     core.loader._loadAutotiles_afterLoad(keys, autotiles); | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadAutotiles_afterLoad = function (keys, autotiles) { | loader.prototype._loadAutotiles_afterLoad = function (keys, autotiles) { | ||||||
|     // autotile需要保证顺序
 |     // autotile需要保证顺序
 | ||||||
| @ -324,53 +225,33 @@ loader.prototype._loadAutotiles_afterLoad = function (keys, autotiles) { | |||||||
|     setTimeout(function () { |     setTimeout(function () { | ||||||
|         core.maps._makeAutotileEdges(); |         core.maps._makeAutotileEdges(); | ||||||
|     }); |     }); | ||||||
| }; | 
 | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| // ------ 加载额外素材 ------ //
 | // ------ 加载额外素材 ------ //
 | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadTilesets_sync = function (callback) { | loader.prototype._loadTilesets_sync = function (callback) { | ||||||
|     core.material.images.tilesets = {}; |     core.material.images.tilesets = {}; | ||||||
|     this._setStartLoadTipText("正在加载额外素材..."); |     this._setStartLoadTipText("正在加载额外素材..."); | ||||||
|   this.loadImages( |     this.loadImages("tilesets", core.tilesets, core.material.images.tilesets, function () { | ||||||
|     "tilesets", |  | ||||||
|     core.tilesets, |  | ||||||
|     core.material.images.tilesets, |  | ||||||
|     function () { |  | ||||||
|         core.loader._loadTilesets_afterLoad(); |         core.loader._loadTilesets_afterLoad(); | ||||||
|         callback(); |         callback(); | ||||||
|  |     }); | ||||||
| } | } | ||||||
|   ); |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadTilesets_async = function (onprogress, onfinished) { | loader.prototype._loadTilesets_async = function (onprogress, onfinished) { | ||||||
|     core.material.images.tilesets = {}; |     core.material.images.tilesets = {}; | ||||||
|   this.loadImagesFromZip( |     this.loadImagesFromZip('project/tilesets/tilesets.h5data', core.tilesets, core.material.images.tilesets, onprogress, function () { | ||||||
|     "project/tilesets/tilesets.h5data", |  | ||||||
|     core.tilesets, |  | ||||||
|     core.material.images.tilesets, |  | ||||||
|     onprogress, |  | ||||||
|     function () { |  | ||||||
|         core.loader._loadTilesets_afterLoad(); |         core.loader._loadTilesets_afterLoad(); | ||||||
|         onfinished(); |         onfinished(); | ||||||
|  |     }); | ||||||
| } | } | ||||||
|   ); |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadTilesets_chunked = async function ( | loader.prototype._loadTilesets_chunked = async function (chunks, makeOnProgress, makeOnFinished) { | ||||||
|   chunks, |  | ||||||
|   makeOnProgress, |  | ||||||
|   makeOnFinished |  | ||||||
| ) { |  | ||||||
|     core.material.images.tilesets = {}; |     core.material.images.tilesets = {}; | ||||||
|   await this._loadImagesFromChunks( |     await this._loadImagesFromChunks(chunks, core.tilesets, core.material.images.tilesets, makeOnProgress, makeOnFinished); | ||||||
|     chunks, |  | ||||||
|     core.tilesets, |  | ||||||
|     core.material.images.tilesets, |  | ||||||
|     makeOnProgress, |  | ||||||
|     makeOnFinished |  | ||||||
|   ); |  | ||||||
|     core.loader._loadTilesets_afterLoad(); |     core.loader._loadTilesets_afterLoad(); | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadTilesets_afterLoad = function () { | loader.prototype._loadTilesets_afterLoad = function () { | ||||||
|     // 检查宽高是32倍数,如果出错在控制台报错
 |     // 检查宽高是32倍数,如果出错在控制台报错
 | ||||||
| @ -383,7 +264,7 @@ loader.prototype._loadTilesets_afterLoad = function () { | |||||||
|             console.warn("警告!" + imgName + "上的图块素材个数大于3000!"); |             console.warn("警告!" + imgName + "上的图块素材个数大于3000!"); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| // ------ 实际加载一系列图片 ------ //
 | // ------ 实际加载一系列图片 ------ //
 | ||||||
| 
 | 
 | ||||||
| @ -395,9 +276,10 @@ loader.prototype.loadImages = function (dir, names, toSave, callback) { | |||||||
|     var items = 0; |     var items = 0; | ||||||
|     for (var i = 0; i < names.length; i++) { |     for (var i = 0; i < names.length; i++) { | ||||||
|         this.loadImage(dir, names[i], function (id, image) { |         this.loadImage(dir, names[i], function (id, image) { | ||||||
|       core.loader._setStartLoadTipText("正在加载图片 " + id + "..."); |             core.loader._setStartLoadTipText('正在加载图片 ' + id + "..."); | ||||||
|             if (toSave[id] !== undefined) { |             if (toSave[id] !== undefined) { | ||||||
|         if (image != null) toSave[id] = image; |                 if (image != null) | ||||||
|  |                     toSave[id] = image; | ||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
|             toSave[id] = image; |             toSave[id] = image; | ||||||
| @ -406,51 +288,46 @@ loader.prototype.loadImages = function (dir, names, toSave, callback) { | |||||||
|             if (items == names.length) { |             if (items == names.length) { | ||||||
|                 if (callback) callback(); |                 if (callback) callback(); | ||||||
|             } |             } | ||||||
|     }); |         }) | ||||||
|  |     } | ||||||
| } | } | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| loader.prototype.loadImage = function (dir, imgName, callback) { | loader.prototype.loadImage = function (dir, imgName, callback) { | ||||||
|     try { |     try { | ||||||
|         var name = imgName; |         var name = imgName; | ||||||
|     if (name.indexOf(".") < 0) name = name + ".png"; |         if (name.indexOf(".") < 0) | ||||||
|  |             name = name + ".png"; | ||||||
|         var image = new Image(); |         var image = new Image(); | ||||||
|         image.onload = function () { |         image.onload = function () { | ||||||
|       image.setAttribute("_width", image.width); |             image.setAttribute('_width', image.width); | ||||||
|       image.setAttribute("_height", image.height); |             image.setAttribute('_height', image.height); | ||||||
|             callback(imgName, image); |             callback(imgName, image); | ||||||
|     }; |         } | ||||||
|         image.onerror = function () { |         image.onerror = function () { | ||||||
|             callback(imgName, null); |             callback(imgName, null); | ||||||
|     }; |         } | ||||||
|     image.src = "project/" + dir + "/" + name + "?v=" + main.version; |         image.src = 'project/' + dir + '/' + name + "?v=" + main.version; | ||||||
|     if (name.endsWith(".gif")) callback(imgName, null); |         if (name.endsWith('.gif')) | ||||||
|   } catch (e) { |             callback(imgName, null); | ||||||
|  |     } | ||||||
|  |     catch (e) { | ||||||
|         console.error(e); |         console.error(e); | ||||||
|     } |     } | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| // ------ 从zip中加载一系列图片 ------ //
 | // ------ 从zip中加载一系列图片 ------ //
 | ||||||
| 
 | 
 | ||||||
| loader.prototype.loadImagesFromZip = function ( | loader.prototype.loadImagesFromZip = function (url, names, toSave, onprogress, onfinished) { | ||||||
|   url, |  | ||||||
|   names, |  | ||||||
|   toSave, |  | ||||||
|   onprogress, |  | ||||||
|   onfinished |  | ||||||
| ) { |  | ||||||
|     if (!names || names.length == 0) { |     if (!names || names.length == 0) { | ||||||
|         if (onfinished) onfinished(); |         if (onfinished) onfinished(); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|   core.unzip( |     core.unzip(url + "?v=" + main.version, function (data) { | ||||||
|     url + "?v=" + main.version, |  | ||||||
|     function (data) { |  | ||||||
|         var cnt = 1; |         var cnt = 1; | ||||||
|         names.forEach(function (name) { |         names.forEach(function (name) { | ||||||
|             var imgName = name; |             var imgName = name; | ||||||
|         if (imgName.indexOf(".") < 0) imgName += ".png"; |             if (imgName.indexOf('.') < 0) imgName += '.png'; | ||||||
|             if (imgName in data) { |             if (imgName in data) { | ||||||
|                 var img = new Image(); |                 var img = new Image(); | ||||||
|                 var url = URL.createObjectURL(data[imgName]); |                 var url = URL.createObjectURL(data[imgName]); | ||||||
| @ -458,32 +335,21 @@ loader.prototype.loadImagesFromZip = function ( | |||||||
|                 img.onload = function () { |                 img.onload = function () { | ||||||
|                     cnt--; |                     cnt--; | ||||||
|                     URL.revokeObjectURL(url); |                     URL.revokeObjectURL(url); | ||||||
|             img.setAttribute("_width", img.width); |                     img.setAttribute('_width', img.width); | ||||||
|             img.setAttribute("_height", img.height); |                     img.setAttribute('_height', img.height); | ||||||
|                     if (cnt == 0 && onfinished) onfinished(); |                     if (cnt == 0 && onfinished) onfinished(); | ||||||
|           }; |                 } | ||||||
|                 img.src = url; |                 img.src = url; | ||||||
|                 toSave[name] = img; |                 toSave[name] = img; | ||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
|         cnt--; |         cnt--; | ||||||
|         if (cnt == 0 && onfinished) onfinished(); |         if (cnt == 0 && onfinished) onfinished(); | ||||||
|     }, |     }, null, false, onprogress); | ||||||
|     null, | } | ||||||
|     false, |  | ||||||
|     onprogress |  | ||||||
|   ); |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadImagesFromChunks = async function ( | loader.prototype._loadImagesFromChunks = async function (chunks, names, toSave, makeOnProgress, makeOnFinished) { | ||||||
|   chunks, |     await Promise.all(chunks.map((chunk) => { | ||||||
|   names, |  | ||||||
|   toSave, |  | ||||||
|   makeOnProgress, |  | ||||||
|   makeOnFinished |  | ||||||
| ) { |  | ||||||
|   await Promise.all( |  | ||||||
|     chunks.map((chunk) => { |  | ||||||
|         const onfinished = makeOnFinished(chunk); |         const onfinished = makeOnFinished(chunk); | ||||||
|         const onprogress = makeOnProgress(chunk); |         const onprogress = makeOnProgress(chunk); | ||||||
|         return new Promise((resolve) => { |         return new Promise((resolve) => { | ||||||
| @ -492,9 +358,8 @@ loader.prototype._loadImagesFromChunks = async function ( | |||||||
|                 resolve();      |                 resolve();      | ||||||
|             }); |             }); | ||||||
|         }); |         }); | ||||||
|     }) |     })); | ||||||
|   ); | } | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| // ------ 加载动画文件 ------ //
 | // ------ 加载动画文件 ------ //
 | ||||||
| 
 | 
 | ||||||
| @ -503,67 +368,37 @@ loader.prototype._loadAnimates_sync = function () { | |||||||
| 
 | 
 | ||||||
|     if (main.supportBunch) { |     if (main.supportBunch) { | ||||||
|         if (core.animates.length > 0) { |         if (core.animates.length > 0) { | ||||||
|       core.http( |             core.http('GET', '__all_animates__?v=' + main.version + '&id=' + core.animates.join(','), null, function (content) { | ||||||
|         "GET", |                 var u = content.split('@@@~~~###~~~@@@'); | ||||||
|         "__all_animates__?v=" + main.version + "&id=" + core.animates.join(","), |  | ||||||
|         null, |  | ||||||
|         function (content) { |  | ||||||
|           var u = content.split("@@@~~~###~~~@@@"); |  | ||||||
|                 for (var i = 0; i < core.animates.length; ++i) { |                 for (var i = 0; i < core.animates.length; ++i) { | ||||||
|             if (u[i] != "") { |                     if (u[i] != '') { | ||||||
|               core.material.animates[core.animates[i]] = |                         core.material.animates[core.animates[i]] = core.loader._loadAnimate(u[i]); | ||||||
|                 core.loader._loadAnimate(u[i]); |  | ||||||
|                     } else { |                     } else { | ||||||
|               console.error("无法找到动画文件" + core.animates[i] + "!"); |                         console.error('无法找到动画文件' + core.animates[i] + '!'); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|         }, |             }, "text/plain; charset=x-user-defined"); | ||||||
|         "text/plain; charset=x-user-defined" |  | ||||||
|       ); |  | ||||||
|         } |         } | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     core.animates.forEach(function (t) { |     core.animates.forEach(function (t) { | ||||||
|     core.http( |         core.http('GET', 'project/animates/' + t + ".animate?v=" + main.version, null, function (content) { | ||||||
|       "GET", |  | ||||||
|       "project/animates/" + t + ".animate?v=" + main.version, |  | ||||||
|       null, |  | ||||||
|       function (content) { |  | ||||||
|             core.material.animates[t] = core.loader._loadAnimate(content); |             core.material.animates[t] = core.loader._loadAnimate(content); | ||||||
|       }, |         }, function (e) { | ||||||
|       function (e) { |  | ||||||
|             console.error(e); |             console.error(e); | ||||||
|             core.material.animates[t] = null; |             core.material.animates[t] = null; | ||||||
|       }, |         }, "text/plain; charset=x-user-defined") | ||||||
|       "text/plain; charset=x-user-defined" |  | ||||||
|     ); |  | ||||||
|     }); |     }); | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadAnimates_async = function (onprogress, onfinished) { | loader.prototype._loadAnimates_async = function (onprogress, onfinished) { | ||||||
|   this._loadFileFromZip( |     this._loadFileFromZip('project/animates/animates.h5data', this._saveAnimate, true, onprogress, onfinished); | ||||||
|     "project/animates/animates.h5data", | } | ||||||
|     this._saveAnimate, |  | ||||||
|     true, |  | ||||||
|     onprogress, |  | ||||||
|     onfinished |  | ||||||
|   ); |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadAnimates_chunked = function ( | loader.prototype._loadAnimates_chunked = function (chunks, makeOnProgress, makeOnFinished) { | ||||||
|   chunks, |     this._loadFileFromChunks(chunks, this._saveAnimate, true, makeOnProgress, makeOnFinished); | ||||||
|   makeOnProgress, | } | ||||||
|   makeOnFinished |  | ||||||
| ) { |  | ||||||
|   this._loadFileFromChunks( |  | ||||||
|     chunks, |  | ||||||
|     this._saveAnimate, |  | ||||||
|     true, |  | ||||||
|     makeOnProgress, |  | ||||||
|     makeOnFinished |  | ||||||
|   ); |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| loader.prototype._saveAnimate = function (animates, onfinished) { | loader.prototype._saveAnimate = function (animates, onfinished) { | ||||||
|     for (var name in animates) { |     for (var name in animates) { | ||||||
| @ -574,7 +409,7 @@ loader.prototype._saveAnimate = function (animates, onfinished) { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     onfinished(); |     onfinished(); | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadAnimate = function (content) { | loader.prototype._loadAnimate = function (content) { | ||||||
|     try { |     try { | ||||||
| @ -587,7 +422,8 @@ loader.prototype._loadAnimate = function (content) { | |||||||
|         content.bitmaps.forEach(function (t2) { |         content.bitmaps.forEach(function (t2) { | ||||||
|             if (!t2) { |             if (!t2) { | ||||||
|                 data.images.push(null); |                 data.images.push(null); | ||||||
|       } else { |             } | ||||||
|  |             else { | ||||||
|                 try { |                 try { | ||||||
|                     var image = new Image(); |                     var image = new Image(); | ||||||
|                     image.src = t2; |                     image.src = t2; | ||||||
| @ -597,30 +433,31 @@ loader.prototype._loadAnimate = function (content) { | |||||||
|                     data.images.push(null); |                     data.images.push(null); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|     }); |         }) | ||||||
|         data.frame = content.frame_max; |         data.frame = content.frame_max; | ||||||
|         data.frames = []; |         data.frames = []; | ||||||
|         content.frames.forEach(function (t2) { |         content.frames.forEach(function (t2) { | ||||||
|             var info = []; |             var info = []; | ||||||
|             t2.forEach(function (t3) { |             t2.forEach(function (t3) { | ||||||
|                 info.push({ |                 info.push({ | ||||||
|           index: t3[0], |                     'index': t3[0], | ||||||
|           x: t3[1], |                     'x': t3[1], | ||||||
|           y: t3[2], |                     'y': t3[2], | ||||||
|           zoom: t3[3], |                     'zoom': t3[3], | ||||||
|           opacity: t3[4], |                     'opacity': t3[4], | ||||||
|           mirror: t3[5] || 0, |                     'mirror': t3[5] || 0, | ||||||
|           angle: t3[6] || 0, |                     'angle': t3[6] || 0, | ||||||
|         }); |                 }) | ||||||
|       }); |             }) | ||||||
|             data.frames.push(info); |             data.frames.push(info); | ||||||
|         }); |         }); | ||||||
|         return data; |         return data; | ||||||
|   } catch (e) { |     } | ||||||
|  |     catch (e) { | ||||||
|         console.error(e); |         console.error(e); | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| // ------ 加载音乐和音效 ------ //
 | // ------ 加载音乐和音效 ------ //
 | ||||||
| 
 | 
 | ||||||
| @ -630,38 +467,22 @@ loader.prototype._loadMusics = function () { | |||||||
|     }); |     }); | ||||||
|     // 直接开始播放
 |     // 直接开始播放
 | ||||||
|     core.playBgm(main.startBgm); |     core.playBgm(main.startBgm); | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadSounds_sync = function () { | loader.prototype._loadSounds_sync = function () { | ||||||
|     this._setStartLoadTipText("正在加载音效文件..."); |     this._setStartLoadTipText("正在加载音效文件..."); | ||||||
|     core.sounds.forEach(function (t) { |     core.sounds.forEach(function (t) { | ||||||
|         core.loader.loadOneSound(t); |         core.loader.loadOneSound(t); | ||||||
|     }); |     }); | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadSounds_async = function (onprogress, onfinished) { | loader.prototype._loadSounds_async = function (onprogress, onfinished) { | ||||||
|   this._loadFileFromZip( |     this._loadFileFromZip('project/sounds/sounds.h5data', this._saveSounds, false, onprogress, onfinished); | ||||||
|     "project/sounds/sounds.h5data", | } | ||||||
|     this._saveSounds, |  | ||||||
|     false, |  | ||||||
|     onprogress, |  | ||||||
|     onfinished |  | ||||||
|   ); |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadSounds_chunked = function ( | loader.prototype._loadSounds_chunked = function (chunks, makeOnProgress, makeOnFinished) { | ||||||
|   chunks, |     this._loadFileFromChunks(chunks, this._saveSounds, false, makeOnProgress, makeOnFinished); | ||||||
|   makeOnProgress, | } | ||||||
|   makeOnFinished |  | ||||||
| ) { |  | ||||||
|   this._loadFileFromChunks( |  | ||||||
|     chunks, |  | ||||||
|     this._saveSounds, |  | ||||||
|     false, |  | ||||||
|     makeOnProgress, |  | ||||||
|     makeOnFinished |  | ||||||
|   ); |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| loader.prototype._saveSounds = function (data, onfinished) { | loader.prototype._saveSounds = function (data, onfinished) { | ||||||
|     // 延迟解析
 |     // 延迟解析
 | ||||||
| @ -673,34 +494,25 @@ loader.prototype._saveSounds = function (data, onfinished) { | |||||||
|         } |         } | ||||||
|         onfinished(); |         onfinished(); | ||||||
|     }); |     }); | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| loader.prototype.loadOneMusic = function (name) { | loader.prototype.loadOneMusic = function (name) { | ||||||
|     var music = new Audio(); |     var music = new Audio(); | ||||||
|   music.preload = "none"; |     music.preload = 'none'; | ||||||
|   if (main.bgmRemote) |     if (main.bgmRemote) music.src = main.bgmRemoteRoot + core.firstData.name + '/' + name; | ||||||
|     music.src = main.bgmRemoteRoot + core.firstData.name + "/" + name; |     else music.src = 'project/bgms/' + name; | ||||||
|   else music.src = "project/bgms/" + name; |     music.loop = 'loop'; | ||||||
|   music.loop = "loop"; |  | ||||||
|     core.material.bgms[name] = music; |     core.material.bgms[name] = music; | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| loader.prototype.loadOneSound = function (name) { | loader.prototype.loadOneSound = function (name) { | ||||||
|   core.http( |     core.http('GET', 'project/sounds/' + name + "?v=" + main.version, null, function (data) { | ||||||
|     "GET", |  | ||||||
|     "project/sounds/" + name + "?v=" + main.version, |  | ||||||
|     null, |  | ||||||
|     function (data) { |  | ||||||
|         core.loader._loadOneSound_decodeData(name, data); |         core.loader._loadOneSound_decodeData(name, data); | ||||||
|     }, |     }, function (e) { | ||||||
|     function (e) { |  | ||||||
|         console.error(e); |         console.error(e); | ||||||
|         core.material.sounds[name] = null; |         core.material.sounds[name] = null; | ||||||
|     }, |     }, null, 'arraybuffer'); | ||||||
|     null, | } | ||||||
|     "arraybuffer" |  | ||||||
|   ); |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadOneSound_decodeData = function (name, data) { | loader.prototype._loadOneSound_decodeData = function (name, data) { | ||||||
|     if (data instanceof Blob) { |     if (data instanceof Blob) { | ||||||
| @ -708,26 +520,23 @@ loader.prototype._loadOneSound_decodeData = function (name, data) { | |||||||
|         blobReader.init(function () { |         blobReader.init(function () { | ||||||
|             blobReader.readUint8Array(0, blobReader.size, function (uint8) { |             blobReader.readUint8Array(0, blobReader.size, function (uint8) { | ||||||
|                 core.loader._loadOneSound_decodeData(name, uint8.buffer); |                 core.loader._loadOneSound_decodeData(name, uint8.buffer); | ||||||
|       }); |             }) | ||||||
|         }); |         }); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|     try { |     try { | ||||||
|     core.musicStatus.audioContext.decodeAudioData( |         core.musicStatus.audioContext.decodeAudioData(data, function (buffer) { | ||||||
|       data, |  | ||||||
|       function (buffer) { |  | ||||||
|             core.material.sounds[name] = buffer; |             core.material.sounds[name] = buffer; | ||||||
|       }, |         }, function (e) { | ||||||
|       function (e) { |             console.error(e); | ||||||
|  |             core.material.sounds[name] = null; | ||||||
|  |         }) | ||||||
|  |     } | ||||||
|  |     catch (e) { | ||||||
|         console.error(e); |         console.error(e); | ||||||
|         core.material.sounds[name] = null; |         core.material.sounds[name] = null; | ||||||
|     } |     } | ||||||
|     ); |  | ||||||
|   } catch (e) { |  | ||||||
|     console.error(e); |  | ||||||
|     core.material.sounds[name] = null; |  | ||||||
| } | } | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| loader.prototype.loadBgm = function (name) { | loader.prototype.loadBgm = function (name) { | ||||||
|     name = core.getMappedName(name); |     name = core.getMappedName(name); | ||||||
| @ -738,7 +547,8 @@ loader.prototype.loadBgm = function (name) { | |||||||
|     var index = core.musicStatus.cachedBgms.indexOf(name); |     var index = core.musicStatus.cachedBgms.indexOf(name); | ||||||
|     if (index >= 0) { |     if (index >= 0) { | ||||||
|         core.musicStatus.cachedBgms.splice(index, 1); |         core.musicStatus.cachedBgms.splice(index, 1); | ||||||
|   } else { |     } | ||||||
|  |     else { | ||||||
|         // 预加载BGM
 |         // 预加载BGM
 | ||||||
|         this._preloadBgm(core.material.bgms[name]); |         this._preloadBgm(core.material.bgms[name]); | ||||||
|         // core.material.bgms[name].load();
 |         // core.material.bgms[name].load();
 | ||||||
| @ -749,20 +559,18 @@ loader.prototype.loadBgm = function (name) { | |||||||
|     } |     } | ||||||
|     // 移动到缓存最前方
 |     // 移动到缓存最前方
 | ||||||
|     core.musicStatus.cachedBgms.unshift(name); |     core.musicStatus.cachedBgms.unshift(name); | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| loader.prototype._preloadBgm = function (bgm) { | loader.prototype._preloadBgm = function (bgm) { | ||||||
|     bgm.volume = 0; |     bgm.volume = 0; | ||||||
|     bgm.play(); |     bgm.play(); | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| loader.prototype.freeBgm = function (name) { | loader.prototype.freeBgm = function (name) { | ||||||
|     name = core.getMappedName(name); |     name = core.getMappedName(name); | ||||||
|     if (!core.material.bgms[name]) return; |     if (!core.material.bgms[name]) return; | ||||||
|     // 从cachedBgms中删除
 |     // 从cachedBgms中删除
 | ||||||
|   core.musicStatus.cachedBgms = core.musicStatus.cachedBgms.filter(function ( |     core.musicStatus.cachedBgms = core.musicStatus.cachedBgms.filter(function (t) { | ||||||
|     t |  | ||||||
|   ) { |  | ||||||
|         return t != name; |         return t != name; | ||||||
|     }); |     }); | ||||||
|     // 清掉缓存
 |     // 清掉缓存
 | ||||||
| @ -776,35 +584,16 @@ loader.prototype.freeBgm = function (name) { | |||||||
|     setTimeout(function () { |     setTimeout(function () { | ||||||
|         core.loader.loadOneMusic(name); |         core.loader.loadOneMusic(name); | ||||||
|     }, 3000); |     }, 3000); | ||||||
| }; | } | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadFileFromZip = function ( | loader.prototype._loadFileFromZip = function (url, save, convertToText, onprogress, onfinished) { | ||||||
|   url, |     core.unzip(url + '?v=' + main.version, function (data) { | ||||||
|   save, |  | ||||||
|   convertToText, |  | ||||||
|   onprogress, |  | ||||||
|   onfinished |  | ||||||
| ) { |  | ||||||
|   core.unzip( |  | ||||||
|     url + "?v=" + main.version, |  | ||||||
|     function (data) { |  | ||||||
|         save(data, onfinished); |         save(data, onfinished); | ||||||
|     }, |     }, null, convertToText, onprogress); | ||||||
|     null, | } | ||||||
|     convertToText, |  | ||||||
|     onprogress |  | ||||||
|   ); |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| loader.prototype._loadFileFromChunks = async function ( | loader.prototype._loadFileFromChunks = async function (chunks, save, convertToText, makeOnProgress, makeOnFinished) { | ||||||
|   chunks, |     await Promise.all(chunks.map((chunk) => { | ||||||
|   save, |  | ||||||
|   convertToText, |  | ||||||
|   makeOnProgress, |  | ||||||
|   makeOnFinished |  | ||||||
| ) { |  | ||||||
|   await Promise.all( |  | ||||||
|     chunks.map((chunk) => { |  | ||||||
|         const onfinished = makeOnFinished(chunk); |         const onfinished = makeOnFinished(chunk); | ||||||
|         const onprogress = makeOnProgress(chunk); |         const onprogress = makeOnProgress(chunk); | ||||||
|         return new Promise((resolve) => { |         return new Promise((resolve) => { | ||||||
| @ -813,6 +602,5 @@ loader.prototype._loadFileFromChunks = async function ( | |||||||
|                 resolve(); |                 resolve(); | ||||||
|             }); |             }); | ||||||
|         }); |         }); | ||||||
|     }) |     })); | ||||||
|   ); | } | ||||||
| }; |  | ||||||
|  | |||||||
							
								
								
									
										7
									
								
								main.js
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								main.js
									
									
									
									
									
								
							| @ -492,6 +492,7 @@ main.prototype.selectButton = function (index) { | |||||||
| main.prototype.importFonts = function (fonts) { | main.prototype.importFonts = function (fonts) { | ||||||
|   if (!(fonts instanceof Array) || fonts.length == 0) return; |   if (!(fonts instanceof Array) || fonts.length == 0) return; | ||||||
|   var style = document.createElement("style"); |   var style = document.createElement("style"); | ||||||
|  |   style.type = "text/css"; | ||||||
|   var html = ""; |   var html = ""; | ||||||
|   fonts.forEach(function (font) { |   fonts.forEach(function (font) { | ||||||
|     html += |     html += | ||||||
| @ -909,7 +910,7 @@ main.prototype.listen = function () { | |||||||
|   ////// 点击“开始游戏”时 //////
 |   ////// 点击“开始游戏”时 //////
 | ||||||
|   main.dom.playGame.onclick = function () { |   main.dom.playGame.onclick = function () { | ||||||
|     main.dom.startButtons.style.display = "none"; |     main.dom.startButtons.style.display = "none"; | ||||||
|     main.core.checkBgm(); |     main.core.control.checkBgm(); | ||||||
| 
 | 
 | ||||||
|     if (main.levelChoose.length == 0) { |     if (main.levelChoose.length == 0) { | ||||||
|       core.events.startGame(""); |       core.events.startGame(""); | ||||||
| @ -922,13 +923,13 @@ main.prototype.listen = function () { | |||||||
| 
 | 
 | ||||||
|   ////// 点击“载入游戏”时 //////
 |   ////// 点击“载入游戏”时 //////
 | ||||||
|   main.dom.loadGame.onclick = function () { |   main.dom.loadGame.onclick = function () { | ||||||
|     main.core.checkBgm(); |     main.core.control.checkBgm(); | ||||||
|     main.core.load(); |     main.core.load(); | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   ////// 点击“录像回放”时 //////
 |   ////// 点击“录像回放”时 //////
 | ||||||
|   main.dom.replayGame.onclick = function () { |   main.dom.replayGame.onclick = function () { | ||||||
|     main.core.checkBgm(); |     main.core.control.checkBgm(); | ||||||
|     main.core.chooseReplayFile(); |     main.core.chooseReplayFile(); | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|  | |||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -897,13 +897,9 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = | |||||||
| 			"zone" | 			"zone" | ||||||
| 		], | 		], | ||||||
| 		"bgms": [ | 		"bgms": [ | ||||||
| 			"Ascension.opus", |  | ||||||
| 			"Asphodelus_Ceui.opus", | 			"Asphodelus_Ceui.opus", | ||||||
| 			"Blind_Alley.opus", | 			"Blind_Alley.opus", | ||||||
| 			"Blood_Stain.opus", |  | ||||||
| 			"Crawler.opus", | 			"Crawler.opus", | ||||||
| 			"Halbmond.opus", |  | ||||||
| 			"ed.opus", |  | ||||||
| 			"op.opus", | 			"op.opus", | ||||||
| 			"theme.opus" | 			"theme.opus" | ||||||
| 		], | 		], | ||||||
| @ -998,6 +994,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = | |||||||
| 			"aiy820000010.opus", | 			"aiy820000010.opus", | ||||||
| 			"aiy820000020.opus", | 			"aiy820000020.opus", | ||||||
| 			"attack.opus", | 			"attack.opus", | ||||||
|  | 			"attack.opus", | ||||||
| 			"bomb.opus", | 			"bomb.opus", | ||||||
| 			"cancel.opus", | 			"cancel.opus", | ||||||
| 			"centerFly.opus", | 			"centerFly.opus", | ||||||
| @ -1022,7 +1019,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = | |||||||
| 		], | 		], | ||||||
| 		"fonts": [ | 		"fonts": [ | ||||||
| 			"HATTEN", | 			"HATTEN", | ||||||
| 			"Verdana", |  | ||||||
| 			"number", | 			"number", | ||||||
| 			"pala", | 			"pala", | ||||||
| 			"simhei" | 			"simhei" | ||||||
| @ -1445,7 +1441,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = | |||||||
| 			}, | 			}, | ||||||
| 			{ | 			{ | ||||||
| 				"type": "function", | 				"type": "function", | ||||||
| 				"function": "function(){\ncore.checkBgm()\n}" | 				"function": "function(){\ncore.control.checkBgm()\n}" | ||||||
| 			}, | 			}, | ||||||
| 			{ | 			{ | ||||||
| 				"type": "if", | 				"type": "if", | ||||||
| @ -1493,10 +1489,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = | |||||||
| 				"type": "setValue", | 				"type": "setValue", | ||||||
| 				"name": "item:fly", | 				"name": "item:fly", | ||||||
| 				"value": "1" | 				"value": "1" | ||||||
| 			}, |  | ||||||
| 			{ |  | ||||||
| 				"type": "insert", |  | ||||||
| 				"name": "强制横屏" |  | ||||||
| 			} | 			} | ||||||
| 		], | 		], | ||||||
| 		"shops": [ | 		"shops": [ | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| var enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 =  | var enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 =  | ||||||
| { | { | ||||||
| 	"greenSlime": {"name":"绿头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0,"magic":false}, | 	"greenSlime": {"name":"绿头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, | ||||||
| 	"redSlime": {"name":"红头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[],"value":10,"magic":false}, | 	"redSlime": {"name":"红头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[],"value":10}, | ||||||
| 	"blackSlime": {"name":"青头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, | 	"blackSlime": {"name":"青头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, | ||||||
| 	"slimelord": {"name":"怪王","hp":100,"atk":120,"def":0,"money":10,"exp":0,"point":0,"special":[1,9]}, | 	"slimelord": {"name":"怪王","hp":100,"atk":120,"def":0,"money":10,"exp":0,"point":0,"special":[1,9]}, | ||||||
| 	"bat": {"name":"小蝙蝠","hp":100,"atk":120,"def":0,"money":2,"exp":0,"point":0,"special":[1]}, | 	"bat": {"name":"小蝙蝠","hp":100,"atk":120,"def":0,"money":2,"exp":0,"point":0,"special":[1]}, | ||||||
|  | |||||||
							
								
								
									
										1436
									
								
								project/events.js
									
									
									
									
									
								
							
							
						
						
									
										1436
									
								
								project/events.js
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -26,31 +26,58 @@ main.floors.street01= | |||||||
|                 "direction": "up" |                 "direction": "up" | ||||||
|             } |             } | ||||||
|         ], |         ], | ||||||
|         "10,11": [ |  | ||||||
|             { |  | ||||||
|                 "type": "setmusics", |  | ||||||
|                 "bgm": "op.opus" |  | ||||||
|             } |  | ||||||
|         ], |  | ||||||
|         "10,10": [ |  | ||||||
|             { |  | ||||||
|                 "type": "setmusics", |  | ||||||
|                 "bgm": "ed.opus" |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 "type": "setmusics", |  | ||||||
|                 "bgm": "Asphodelus_Ceui.opus" |  | ||||||
|             } |  | ||||||
|         ], |  | ||||||
|         "10,9": [ |  | ||||||
|             { |  | ||||||
|                 "type": "setmusics" |  | ||||||
|             } |  | ||||||
|         ], |  | ||||||
|         "6,11": [ |         "6,11": [ | ||||||
|             { |             { | ||||||
|                 "type": "insert", |                 "type": "insert", | ||||||
|                 "name": "chapter01" |                 "name": "chapter04" | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "4,11": [ | ||||||
|  |             { | ||||||
|  |                 "type": "animationDrawable", | ||||||
|  |                 "allFarme": 300, | ||||||
|  |                 "color": [ | ||||||
|  |                     0, | ||||||
|  |                     0, | ||||||
|  |                     0 | ||||||
|  |                 ], | ||||||
|  |                 "imageList": [ | ||||||
|  |                     { | ||||||
|  |                         "image": "bg_1511.webp", | ||||||
|  |                         "beforefarme": 50, | ||||||
|  |                         "globalAlpha": 0, | ||||||
|  |                         "afterfarme": 250, | ||||||
|  |                         "aglobalAlpha": 100 | ||||||
|  |                     }, | ||||||
|  |                     { | ||||||
|  |                         "image": "eve_010304.webp", | ||||||
|  |                         "beforefarme": 70, | ||||||
|  |                         "globalAlpha": 0, | ||||||
|  |                         "afterfarme": 170, | ||||||
|  |                         "aglobalAlpha": 100, | ||||||
|  |                         "ax": 0, | ||||||
|  |                         "ay": 0 | ||||||
|  |                     }, | ||||||
|  |                     { | ||||||
|  |                         "image": "eve_010304.webp", | ||||||
|  |                         "beforefarme": 171, | ||||||
|  |                         "globalAlpha": 100, | ||||||
|  |                         "afterfarme": 270, | ||||||
|  |                         "aglobalAlpha": 100, | ||||||
|  |                         "ax": 800, | ||||||
|  |                         "ay": 0 | ||||||
|  |                     } | ||||||
|  |                 ], | ||||||
|  |                 "soundList": [ | ||||||
|  |                     { | ||||||
|  |                         "sound": "", | ||||||
|  |                         "startfarme": 0, | ||||||
|  |                         "stopbefore": false | ||||||
|  |                     } | ||||||
|  |                 ] | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 "type": "op" | ||||||
|             } |             } | ||||||
|         ] |         ] | ||||||
|     }, |     }, | ||||||
|  | |||||||
										
											Binary file not shown.
										
									
								
							| @ -531,21 +531,15 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = | |||||||
| 	var hero_hp = core.getRealStatusOrDefault(hero, 'hp'), | 	var hero_hp = core.getRealStatusOrDefault(hero, 'hp'), | ||||||
| 		hero_atk = core.getRealStatusOrDefault(hero, 'atk'), | 		hero_atk = core.getRealStatusOrDefault(hero, 'atk'), | ||||||
| 		hero_def = core.getRealStatusOrDefault(hero, 'def'), | 		hero_def = core.getRealStatusOrDefault(hero, 'def'), | ||||||
| 		hero_mdef = core.getRealStatusOrDefault(hero, 'mdef'), | 		hero_mdef = core.getRealStatusOrDefault(hero, 'mdef'); | ||||||
| 		hero_speed = core.getRealStatusOrDefault(hero, 'speed'); |  | ||||||
| 
 | 
 | ||||||
| 	var mon_hp = core.getEnemyValue(enemy, 'hp', x, y, floorId), | 	var mon_hp = core.getEnemyValue(enemy, 'hp', x, y, floorId), | ||||||
| 		mon_atk = core.getEnemyValue(enemy, 'atk', x, y, floorId), | 		mon_atk = core.getEnemyValue(enemy, 'atk', x, y, floorId), | ||||||
| 		mon_def = core.getEnemyValue(enemy, 'def', x, y, floorId), | 		mon_def = core.getEnemyValue(enemy, 'def', x, y, floorId), | ||||||
| 		mon_mdef = core.getEnemyValue(enemy, 'mdef', x, y, floorId), |  | ||||||
| 		mon_speed = core.getEnemyValue(enemy, 'speed', x, y, floorId), |  | ||||||
| 		mon_special = core.getEnemyValue(enemy, 'special', x, y, floorId); | 		mon_special = core.getEnemyValue(enemy, 'special', x, y, floorId); | ||||||
| 	var mon_money = core.getEnemyValue(enemy, 'money', x, y, floorId), | 	var mon_money = core.getEnemyValue(enemy, 'money', x, y, floorId), | ||||||
| 		mon_exp = core.getEnemyValue(enemy, 'exp', x, y, floorId), | 		mon_exp = core.getEnemyValue(enemy, 'exp', x, y, floorId), | ||||||
| 		mon_point = core.getEnemyValue(enemy, 'point', x, y, floorId); | 		mon_point = core.getEnemyValue(enemy, 'point', x, y, floorId); | ||||||
| 	var mon_barrier = 0, |  | ||||||
| 		mon_absorb_damage = 0, |  | ||||||
| 		mon_magic = core.getEnemyValue(enemy, 'magic', x, y, floorId); |  | ||||||
| 	// 模仿
 | 	// 模仿
 | ||||||
| 	if (core.hasSpecial(mon_special, 10)) { | 	if (core.hasSpecial(mon_special, 10)) { | ||||||
| 		mon_atk = hero_atk; | 		mon_atk = hero_atk; | ||||||
| @ -639,15 +633,10 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = | |||||||
| 		"hp": Math.floor(mon_hp), | 		"hp": Math.floor(mon_hp), | ||||||
| 		"atk": Math.floor(mon_atk), | 		"atk": Math.floor(mon_atk), | ||||||
| 		"def": Math.floor(mon_def), | 		"def": Math.floor(mon_def), | ||||||
| 		"mdef": Math.floor(mon_mdef), |  | ||||||
| 		"speed": Math.floor(mon_speed), |  | ||||||
| 		"barrier": Math.floor(mon_barrier), |  | ||||||
| 		"absorb": Math.floor(mon_absorb_damage), |  | ||||||
| 		"money": Math.floor(mon_money), | 		"money": Math.floor(mon_money), | ||||||
| 		"exp": Math.floor(mon_exp), | 		"exp": Math.floor(mon_exp), | ||||||
| 		"point": Math.floor(mon_point), | 		"point": Math.floor(mon_point), | ||||||
| 		"special": mon_special, | 		"special": mon_special, | ||||||
| 		"magic": mon_magic, |  | ||||||
| 		"guards": guards, // 返回支援情况
 | 		"guards": guards, // 返回支援情况
 | ||||||
| 	}; | 	}; | ||||||
| }, | }, | ||||||
| @ -666,13 +655,15 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = | |||||||
| 		hero_atk = core.getRealStatusOrDefault(hero, 'atk'), | 		hero_atk = core.getRealStatusOrDefault(hero, 'atk'), | ||||||
| 		hero_def = core.getRealStatusOrDefault(hero, 'def'), | 		hero_def = core.getRealStatusOrDefault(hero, 'def'), | ||||||
| 		hero_mdef = core.getRealStatusOrDefault(hero, 'mdef'), | 		hero_mdef = core.getRealStatusOrDefault(hero, 'mdef'), | ||||||
| 		hero_speed = core.getRealStatusOrDefault(hero, 'speed'), |  | ||||||
| 		hero_magic = core.getRealStatusOrDefault(hero, 'magic'), |  | ||||||
| 		origin_hero_hp = core.getStatusOrDefault(hero, 'hp'), | 		origin_hero_hp = core.getStatusOrDefault(hero, 'hp'), | ||||||
| 		origin_hero_atk = core.getStatusOrDefault(hero, 'atk'), | 		origin_hero_atk = core.getStatusOrDefault(hero, 'atk'), | ||||||
| 		origin_hero_def = core.getStatusOrDefault(hero, 'def'); | 		origin_hero_def = core.getStatusOrDefault(hero, 'def'); | ||||||
| 
 | 
 | ||||||
| 
 | 	// 勇士的负属性都按0计算
 | ||||||
|  | 	hero_hp = Math.max(0, hero_hp); | ||||||
|  | 	hero_atk = Math.max(0, hero_atk); | ||||||
|  | 	hero_def = Math.max(0, hero_def); | ||||||
|  | 	hero_mdef = Math.max(0, hero_mdef); | ||||||
| 
 | 
 | ||||||
| 	// 怪物的各项数据
 | 	// 怪物的各项数据
 | ||||||
| 	// 对坚固模仿等处理扔到了脚本编辑-getEnemyInfo之中
 | 	// 对坚固模仿等处理扔到了脚本编辑-getEnemyInfo之中
 | ||||||
| @ -680,34 +671,23 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = | |||||||
| 	var mon_hp = enemyInfo.hp, | 	var mon_hp = enemyInfo.hp, | ||||||
| 		mon_atk = enemyInfo.atk, | 		mon_atk = enemyInfo.atk, | ||||||
| 		mon_def = enemyInfo.def, | 		mon_def = enemyInfo.def, | ||||||
| 		mon_mdef = enemyInfo.mdef, | 		mon_special = enemyInfo.special; | ||||||
| 		mon_speed = enemyInfo.speed, |  | ||||||
| 		mon_special = enemyInfo.special, |  | ||||||
| 		mon_absorb_damage = enemyInfo.absorb, |  | ||||||
| 		mon_barrier = enemyInfo.barrier; |  | ||||||
| 
 | 
 | ||||||
| 	//---第一部分:静态属性修正---
 |  | ||||||
| 	//此处写入静态影响勇士属性的勇士或怪物技能(静态影响怪物属性的技能于getEnemyInfo中写入)
 |  | ||||||
| 	// 技能的处理
 | 	// 技能的处理
 | ||||||
| 	if (core.getFlag('skill', 0) == 1) { // 开启了技能1:二倍斩
 | 	if (core.getFlag('skill', 0) == 1) { // 开启了技能1:二倍斩
 | ||||||
| 		hero_atk *= 2; // 计算时攻击力翻倍	
 | 		hero_atk *= 2; // 计算时攻击力翻倍	
 | ||||||
| 	} | 	} | ||||||
| 	//勇士属性取整
 |  | ||||||
| 	hero_atk = Math.max(0, Math.floor(hero_atk)); |  | ||||||
| 	hero_def = Math.max(0, Math.floor(hero_def)); |  | ||||||
| 	hero_mdef = Math.max(0, Math.floor(hero_mdef)); |  | ||||||
| 	hero_speed = Math.max(0, Math.floor(hero_speed)); |  | ||||||
| 
 | 
 | ||||||
| 	// 如果是无敌属性,且勇士未持有十字架
 | 	// 如果是无敌属性,且勇士未持有十字架
 | ||||||
| 	if (core.hasSpecial(mon_special, 20) && !core.hasItem("cross")) | 	if (core.hasSpecial(mon_special, 20) && !core.hasItem("cross")) | ||||||
| 		return null; // 不可战斗
 | 		return null; // 不可战斗
 | ||||||
| 
 | 
 | ||||||
| 	// 战前造成的额外伤害(可被护盾抵消)
 | 	// 战前造成的额外伤害(可被护盾抵消)
 | ||||||
| 	let init_damage = 0; | 	var init_damage = 0; | ||||||
| 
 | 
 | ||||||
| 	// 吸血
 | 	// 吸血
 | ||||||
| 	if (core.hasSpecial(mon_special, 11)) { | 	if (core.hasSpecial(mon_special, 11)) { | ||||||
| 		let vampire_damage = hero_hp * enemy.vampire; | 		var vampire_damage = hero_hp * enemy.vampire; | ||||||
| 
 | 
 | ||||||
| 		// 如果有神圣盾免疫吸血等可以在这里写
 | 		// 如果有神圣盾免疫吸血等可以在这里写
 | ||||||
| 		// 也可以用hasItem和hasEquip来判定装备
 | 		// 也可以用hasItem和hasEquip来判定装备
 | ||||||
| @ -721,60 +701,17 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = | |||||||
| 		init_damage += vampire_damage; | 		init_damage += vampire_damage; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	//——第二部分:变量定义和初始赋值——
 |  | ||||||
| 	// 每回合怪物对勇士造成的战斗伤害
 | 	// 每回合怪物对勇士造成的战斗伤害
 | ||||||
| 	let per_damage = Math.max(mon_atk - hero_def, 0); | 	var per_damage = mon_atk - hero_def; | ||||||
| 	if (enemyInfo.magic) per_damage = Math.max(mon_atk - hero_mdef, 0); |  | ||||||
| 
 | 
 | ||||||
| 	//
 | 	// 战斗伤害不能为负值
 | ||||||
| 	let hero_per_damage = Math.max(hero_atk - mon_def, 0); | 	if (per_damage < 0) per_damage = 0; | ||||||
| 	if (hero_magic) hero_per_damage = Math.max(hero_atk - mon_mdef, 0); |  | ||||||
| 
 | 
 | ||||||
| 	let damage = 0, |  | ||||||
| 		hero_turn = 0, |  | ||||||
| 		mon_turn = 0; |  | ||||||
| 	//---第三部分:递归开始---
 |  | ||||||
| 	let length = hero_speed * mon_speed; |  | ||||||
| 
 |  | ||||||
| 	for (let now_mon_hp = mon_hp, last_mon_hp = mon_hp, mon_length = length, hero_length = length, mon_time = 0, hero_time = 0; now_mon_hp > 0;) { //勇士和怪物的长度
 |  | ||||||
| 		mon_time = mon_length / mon_speed; |  | ||||||
| 		hero_time = hero_length / hero_speed; |  | ||||||
| 		if ((mon_time < hero_time) || ((mon_time = hero_time) && (mon_speed > hero_speed))) { //怪物攻击的回合
 |  | ||||||
| 			//这里计算怪物攻击时发生的各种变化
 |  | ||||||
| 
 |  | ||||||
| 			//伤害与回合增加
 |  | ||||||
| 			damage += per_damage; |  | ||||||
| 			if (core.hasSpecial(mon_special, 6)) { |  | ||||||
| 				mon_turn += enemy.n; |  | ||||||
| 			} else { |  | ||||||
| 				mon_turn += 1; |  | ||||||
| 			} |  | ||||||
| 			//重新为长度赋值
 |  | ||||||
| 			mon_length = length; |  | ||||||
| 			hero_length = hero_length - mon_time * hero_speed; |  | ||||||
| 		} else { //勇士攻击的回合
 |  | ||||||
| 			// 这里计算勇士攻击时发生的各种变化
 |  | ||||||
| 
 |  | ||||||
| 			// 伤害与回合数增加
 |  | ||||||
| 			now_mon_hp -= hero_per_damage; |  | ||||||
| 			hero_turn += 1; //勇士回合+1,如果有勇士每回合多次攻击的情况,在这里写判断
 |  | ||||||
| 			// 无法战斗计算
 |  | ||||||
| 			if (hero_turn % 50 == 0) { |  | ||||||
| 				if (now_mon_hp >= last_mon_hp) return null; |  | ||||||
| 				last_mon_hp = now_mon_hp; |  | ||||||
| 			} |  | ||||||
| 			//重新为长度赋值
 |  | ||||||
| 			hero_length = length; |  | ||||||
| 			mon_length = mon_length - hero_time * mon_speed; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	//下面这些还没修改
 |  | ||||||
| 	// 连击
 | 	// 连击
 | ||||||
| 	if (core.hasSpecial(mon_special, 6)) per_damage *= (enemy.n || 2); | 	if (core.hasSpecial(mon_special, 6)) per_damage *= (enemy.n || 2); | ||||||
| 
 | 
 | ||||||
| 	// 每回合的反击伤害;反击是按照勇士的攻击次数来计算回合
 | 	// 每回合的反击伤害;反击是按照勇士的攻击次数来计算回合
 | ||||||
| 	let counterDamage = 0; | 	var counterDamage = 0; | ||||||
| 	if (core.hasSpecial(mon_special, 8)) | 	if (core.hasSpecial(mon_special, 8)) | ||||||
| 		counterDamage += Math.floor((enemy.counterAttack || core.values.counterAttack) * hero_atk); | 		counterDamage += Math.floor((enemy.counterAttack || core.values.counterAttack) * hero_atk); | ||||||
| 
 | 
 | ||||||
| @ -788,14 +725,19 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = | |||||||
| 	// 净化
 | 	// 净化
 | ||||||
| 	if (core.hasSpecial(mon_special, 9)) | 	if (core.hasSpecial(mon_special, 9)) | ||||||
| 		init_damage += Math.floor((enemy.purify || core.values.purify) * hero_mdef); | 		init_damage += Math.floor((enemy.purify || core.values.purify) * hero_mdef); | ||||||
| 	//上面这些还没修改
 | 
 | ||||||
| 	//勇士护盾计算
 | 	// 勇士每回合对怪物造成的伤害
 | ||||||
| 	let barrier = hero_mdef; | 	var hero_per_damage = Math.max(hero_atk - mon_def, 0); | ||||||
| 	if (enemyInfo.magic) barrier = hero_def; | 
 | ||||||
|  | 	// 如果没有破防,则不可战斗
 | ||||||
|  | 	if (hero_per_damage <= 0) return null; | ||||||
|  | 
 | ||||||
|  | 	// 勇士的攻击回合数;为怪物生命除以每回合伤害向上取整
 | ||||||
|  | 	var turn = Math.ceil(mon_hp / hero_per_damage); | ||||||
| 
 | 
 | ||||||
| 	// ------ 支援 ----- //
 | 	// ------ 支援 ----- //
 | ||||||
| 	// 这个递归最好想明白为什么,flag:__extraTurn__是怎么用的
 | 	// 这个递归最好想明白为什么,flag:__extraTurn__是怎么用的
 | ||||||
| 	/*var guards = core.getFlag("__guards__" + x + "_" + y, enemyInfo.guards); | 	var guards = core.getFlag("__guards__" + x + "_" + y, enemyInfo.guards); | ||||||
| 	var guard_before_current_enemy = false; // ------ 支援怪是先打(true)还是后打(false)?
 | 	var guard_before_current_enemy = false; // ------ 支援怪是先打(true)还是后打(false)?
 | ||||||
| 	turn += core.getFlag("__extraTurn__", 0); | 	turn += core.getFlag("__extraTurn__", 0); | ||||||
| 	if (guards.length > 0) { | 	if (guards.length > 0) { | ||||||
| @ -822,13 +764,13 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = | |||||||
| 			turn += core.getFlag("__extraTurn__", 0); | 			turn += core.getFlag("__extraTurn__", 0); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	core.removeFlag("__extraTurn__");*/ | 	core.removeFlag("__extraTurn__"); | ||||||
| 	// ------ 支援END ------ //
 | 	// ------ 支援END ------ //
 | ||||||
| 
 | 
 | ||||||
| 	// 最终伤害:初始伤害 + 怪物对勇士造成的伤害 + 反击伤害
 | 	// 最终伤害:初始伤害 + 怪物对勇士造成的伤害 + 反击伤害
 | ||||||
| 	damage += init_damage + hero_turn * counterDamage; | 	var damage = init_damage + (turn - 1) * per_damage + turn * counterDamage; | ||||||
| 	// 再扣去护盾
 | 	// 再扣去护盾
 | ||||||
| 	damage -= barrier; | 	damage -= hero_mdef; | ||||||
| 
 | 
 | ||||||
| 	// 检查是否允许负伤
 | 	// 检查是否允许负伤
 | ||||||
| 	if (!core.flags.enableNegativeDamage) | 	if (!core.flags.enableNegativeDamage) | ||||||
| @ -846,18 +788,12 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = | |||||||
| 		"mon_hp": Math.floor(mon_hp), | 		"mon_hp": Math.floor(mon_hp), | ||||||
| 		"mon_atk": Math.floor(mon_atk), | 		"mon_atk": Math.floor(mon_atk), | ||||||
| 		"mon_def": Math.floor(mon_def), | 		"mon_def": Math.floor(mon_def), | ||||||
| 		"mon_mdef": Math.floor(mon_mdef), |  | ||||||
| 		"init_damage": Math.floor(init_damage), | 		"init_damage": Math.floor(init_damage), | ||||||
| 		"per_damage": Math.floor(per_damage), | 		"per_damage": Math.floor(per_damage), | ||||||
| 		"hero_per_damage": Math.floor(hero_per_damage), | 		"hero_per_damage": Math.floor(hero_per_damage), | ||||||
| 		"turn": Math.floor(hero_turn), | 		"turn": Math.floor(turn), | ||||||
| 		"mon_turn": Math.floor(mon_turn), |  | ||||||
| 		"damage": Math.floor(damage) | 		"damage": Math.floor(damage) | ||||||
| 	}; | 	}; | ||||||
| 	/*TODO:怪物手册的修改(需要修改这里return的内容以及一些战后判断) |  | ||||||
| 	1. 显示怪物是魔攻还是物攻(在怪物名字上做颜色变化,物攻是黄色,魔攻是蓝色) |  | ||||||
| 	2. 一防减伤是物防还是魔防(由怪物是物攻还是魔攻来转换) |  | ||||||
| 	3. 特殊战斗的怪物,在怪物手册里“伤害”写为“特殊战”*/ |  | ||||||
| } | } | ||||||
|     }, |     }, | ||||||
|     "actions": { |     "actions": { | ||||||
| @ -888,9 +824,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = | |||||||
| 		core.openBook(true); | 		core.openBook(true); | ||||||
| 		break; | 		break; | ||||||
| 	case 71: // G:使用楼传器
 | 	case 71: // G:使用楼传器
 | ||||||
| 		flags.canMoveFloor = core.canMoveFloor() | 		core.ui._drawViewMaps(core.floorIds.indexOf(core.status.floorId)); | ||||||
| 		if (core.isPlaying()) core.ui._drawViewMaps(core.floorIds.indexOf(core.status.floorId)); |  | ||||||
| 		core.status.route.push("key:71"); |  | ||||||
| 		break; | 		break; | ||||||
| 	case 65: // A:读取自动存档(回退)
 | 	case 65: // A:读取自动存档(回退)
 | ||||||
| 		core.doSL("autoSave", "load"); | 		core.doSL("autoSave", "load"); | ||||||
|  | |||||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 4.8 KiB | 
| @ -332,7 +332,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = | |||||||
| 		"text": "可以自由往来去过的楼层", | 		"text": "可以自由往来去过的楼层", | ||||||
| 		"hideInReplay": true, | 		"hideInReplay": true, | ||||||
| 		"hideInToolbox": true, | 		"hideInToolbox": true, | ||||||
| 		"useItemEffect": "//core.ui.drawFly(core.floorIds.indexOf(core.status.floorId));\nflags.canMoveFloor = core.canMoveFloor()\nif (core.isPlaying()) core.ui._drawViewMaps(core.floorIds.indexOf(core.status.floorId));", | 		"useItemEffect": "//core.ui.drawFly(core.floorIds.indexOf(core.status.floorId));\ncore.ui._drawViewMaps(core.floorIds.indexOf(core.status.floorId));", | ||||||
| 		"canUseItemEffect": "(function () {\n\tif (core.flags.flyNearStair && !core.nearStair() && !core.canMoveFloor())\n\t\treturn false;\n\treturn core.status.maps[core.status.floorId].canFlyFrom;\n})();" | 		"canUseItemEffect": "(function () {\n\tif (core.flags.flyNearStair && !core.nearStair() && !core.canMoveFloor())\n\t\treturn false;\n\treturn core.status.maps[core.status.floorId].canFlyFrom;\n})();" | ||||||
| 	}, | 	}, | ||||||
| 	"coin": { | 	"coin": { | ||||||
|  | |||||||
							
								
								
									
										2420
									
								
								project/plugins.js
									
									
									
									
									
								
							
							
						
						
									
										2420
									
								
								project/plugins.js
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										117
									
								
								styles.css
									
									
									
									
									
								
							
							
						
						
									
										117
									
								
								styles.css
									
									
									
									
									
								
							| @ -1,5 +1,4 @@ | |||||||
| html, | html, body { | ||||||
| body { |  | ||||||
|     margin: 0; |     margin: 0; | ||||||
|     padding: 0; |     padding: 0; | ||||||
|     width: 100%; |     width: 100%; | ||||||
| @ -90,7 +89,7 @@ body { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #startTopHint { | #startTopHint { | ||||||
|   color: #66ccff; |     color: #66CCFF; | ||||||
|     position: absolute; |     position: absolute; | ||||||
|     bottom: 0; |     bottom: 0; | ||||||
|     left: 5%; |     left: 5%; | ||||||
| @ -145,8 +144,8 @@ body { | |||||||
|     /* default value */ |     /* default value */ | ||||||
|     background-color: #000000; |     background-color: #000000; | ||||||
|     opacity: 0.55; |     opacity: 0.55; | ||||||
|   color: #ffffff; |     color: #FFFFFF; | ||||||
|   border: #ffffff 0px solid; |     border: #FFFFFF 0px solid; | ||||||
|     caret-color: #ffffff; |     caret-color: #ffffff; | ||||||
|     border-radius: 0px; |     border-radius: 0px; | ||||||
| } | } | ||||||
| @ -162,7 +161,7 @@ body { | |||||||
| .startButton { | .startButton { | ||||||
|     width: 100%; |     width: 100%; | ||||||
|     margin: 0; |     margin: 0; | ||||||
|   font: 1.2rem pala, sans-serif; | 	font:1.2rem "pala", sans-serif; | ||||||
|     font-weight: normal; |     font-weight: normal; | ||||||
|     display: block; |     display: block; | ||||||
|     cursor: pointer; |     cursor: pointer; | ||||||
| @ -269,12 +268,7 @@ p#hard { | |||||||
|     word-break: keep-all; |     word-break: keep-all; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| span#poison, | span#poison, span#weak, span#curse, span#pickaxe, span#bomb, span#fly { | ||||||
| span#weak, |  | ||||||
| span#curse, |  | ||||||
| span#pickaxe, |  | ||||||
| span#bomb, |  | ||||||
| span#fly { |  | ||||||
|     font-style: normal; |     font-style: normal; | ||||||
|     font-size: 1em; |     font-size: 1em; | ||||||
| } | } | ||||||
| @ -357,7 +351,7 @@ p#name { | |||||||
|     top: 0; |     top: 0; | ||||||
|     left: 0; |     left: 0; | ||||||
|     background: rgba(127,127,127,0.6); |     background: rgba(127,127,127,0.6); | ||||||
|   z-index: 2000; |     z-index: 2000 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #inputDialog { | #inputDialog { | ||||||
| @ -383,7 +377,7 @@ p#name { | |||||||
|     margin-bottom: 10px; |     margin-bottom: 10px; | ||||||
|     padding: 5px 3px; |     padding: 5px 3px; | ||||||
|     border: 1px solid; |     border: 1px solid; | ||||||
|   background: #f0f0f0; |     background: #F0F0F0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #inputYes { | #inputYes { | ||||||
| @ -396,33 +390,20 @@ p#name { | |||||||
|     margin-right: 10%; |     margin-right: 10%; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #_selector, | #_selector, ._uievent_selector { | ||||||
| ._uievent_selector { |  | ||||||
|     animation: selector 2s ease-in-out 0s infinite normal none running; |     animation: selector 2s ease-in-out 0s infinite normal none running; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @-webkit-keyframes selector { | @-webkit-keyframes selector { | ||||||
|   0% { |     0% { opacity: 0.95; } | ||||||
|     opacity: 0.95; |     50% { opacity: 0.55; } | ||||||
|   } |     100% { opacity: 0.95; } | ||||||
|   50% { |  | ||||||
|     opacity: 0.55; |  | ||||||
|   } |  | ||||||
|   100% { |  | ||||||
|     opacity: 0.95; |  | ||||||
|   } |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @keyframes selector { | @keyframes selector { | ||||||
|   0% { |     0% { opacity: 0.95; } | ||||||
|     opacity: 0.95; |     50% { opacity: 0.55; } | ||||||
|   } |     100% { opacity: 0.95; } | ||||||
|   50% { |  | ||||||
|     opacity: 0.55; |  | ||||||
|   } |  | ||||||
|   100% { |  | ||||||
|     opacity: 0.95; |  | ||||||
|   } |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #next { | #next { | ||||||
| @ -435,8 +416,8 @@ p#name { | |||||||
|     border-bottom-style: solid; |     border-bottom-style: solid; | ||||||
|     border-right-width: 4px; |     border-right-width: 4px; | ||||||
|     border-right-style: solid; |     border-right-style: solid; | ||||||
|   -webkit-animation: next 0.5s ease-in-out alternate infinite; |     -webkit-animation: next .5s ease-in-out alternate infinite; | ||||||
|   animation: next 0.5s ease-in-out alternate infinite; |     animation: next .5s ease-in-out alternate infinite; | ||||||
|     left: 0; |     left: 0; | ||||||
|     top: 0; |     top: 0; | ||||||
|     opacity: 0.7; |     opacity: 0.7; | ||||||
| @ -486,27 +467,15 @@ p#name { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @-webkit-keyframes startImage { | @-webkit-keyframes startImage { | ||||||
|   0% { |     0% { opacity: 0; } | ||||||
|     opacity: 0; |     60% { opacity: 1; } | ||||||
|   } |     100% { opacity: 0; } | ||||||
|   60% { |  | ||||||
|     opacity: 1; |  | ||||||
|   } |  | ||||||
|   100% { |  | ||||||
|     opacity: 0; |  | ||||||
|   } |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @keyframes startImage { | @keyframes startImage { | ||||||
|   0% { |     0% { opacity: 0; } | ||||||
|     opacity: 0; |     60% { opacity: 1; } | ||||||
|   } |     100% { opacity: 0; } | ||||||
|   60% { |  | ||||||
|     opacity: 1; |  | ||||||
|   } |  | ||||||
|   100% { |  | ||||||
|     opacity: 0; |  | ||||||
|   } |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .startImageDivAnimation { | .startImageDivAnimation { | ||||||
| @ -515,21 +484,13 @@ p#name { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @-webkit-keyframes startImageDivDisappear { | @-webkit-keyframes startImageDivDisappear { | ||||||
|   0% { |     0% { opacity: 1 } | ||||||
|     opacity: 1; |     100% { opacity: 0 } | ||||||
|   } |  | ||||||
|   100% { |  | ||||||
|     opacity: 0; |  | ||||||
|   } |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @keyframes startImageDivDisappear { | @keyframes startImageDivDisappear { | ||||||
|   0% { |     0% { opacity: 1 } | ||||||
|     opacity: 1; |     100% { opacity: 0 } | ||||||
|   } |  | ||||||
|   100% { |  | ||||||
|     opacity: 0; |  | ||||||
|   } |  | ||||||
| } | } | ||||||
| #ui-editor { | #ui-editor { | ||||||
|     z-index: 9999; |     z-index: 9999; | ||||||
| @ -556,27 +517,15 @@ p#name { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @keyframes warning { | @keyframes warning { | ||||||
|   0 % { |     0 % { text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0);} | ||||||
|     text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0); |     50 % { text-shadow: 0px 0px 30px rgba(255, 0, 0, 1), 0px 0px 6px rgb(129, 0, 0);} | ||||||
|   } |     100 % { text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0);} | ||||||
|   50 % { |  | ||||||
|     text-shadow: 0px 0px 30px rgba(255, 0, 0, 1), 0px 0px 6px rgb(129, 0, 0); |  | ||||||
|   } |  | ||||||
|   100 % { |  | ||||||
|     text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0); |  | ||||||
|   } |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @-webkit - keyframes warning { | @-webkit - keyframes warning { | ||||||
|   0 % { |     0 % { text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0);} | ||||||
|     text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0); |     50 % { text-shadow: 0px 0px 30px rgba(255, 0, 0, 1), 0px 0px 6px rgb(129, 0, 0);} | ||||||
|   } |     100 % { text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0);} | ||||||
|   50 % { |  | ||||||
|     text-shadow: 0px 0px 30px rgba(255, 0, 0, 1), 0px 0px 6px rgb(129, 0, 0); |  | ||||||
|   } |  | ||||||
|   100 % { |  | ||||||
|     text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0); |  | ||||||
|   } |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .gameCanvas { | .gameCanvas { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user