Compare commits

..
48 Commits
Author SHA1 Message Date
Jiaqi Liu 4e25c7f593 Update ReleaseBuildPipeline.cs 2023-08-12 21:26:41 -07:00
Jiaqi Liu dbc4f3747d Update LiberationSans SDF - Fallback.asset 2023-08-12 21:06:15 -07:00
Jiaqi Liu 780a2087e6 v0.73 2023-08-12 20:58:47 -07:00
Jiaqi Liu 7f8ff06b6e Cache all audio files 2023-08-12 20:40:59 -07:00
Jiaqi Liu cb9cb24d77 Code refactoring 2023-08-12 19:24:57 -07:00
Jiaqi Liu feaac946e3 Fix charset and build issue 2023-08-12 18:34:40 -07:00
Jiaqi Liu 724a6f767e Supports Traditional Chinese version of the game 2023-08-12 18:19:34 -07:00
Jiaqi Liu ba630a21fa Code refactoring 2023-08-12 07:12:43 -07:00
Jiaqi Liu b1e199e0fb Read and parse ComboSkills + EffectLinkers 2023-08-12 05:45:15 -07:00
Jiaqi Liu f3c1d30215 Read and parse CombatActorInfo and SkillInfo in gdb file 2023-08-11 05:39:47 -07:00
Jiaqi Liu 25151a8479 Code refactoring 2023-08-10 08:04:05 -07:00
Jiaqi Liu 48a6ef0217 Code refactoring 2023-08-10 07:41:52 -07:00
Jiaqi Liu 0adcc69b9e Use default theme music for the game 2023-08-10 03:08:33 -07:00
Jiaqi Liu 9cb651ffd0 Disable auto graphics API on Android, check executable folder on Win/Linux for OG game data files by default 2023-08-10 02:01:33 -07:00
Jiaqi Liu dc3cfadd44 Remove unused assets 2023-08-09 03:59:11 -07:00
Jiaqi Liu dc96d1a257 Fix a minor issue 2023-08-08 00:48:47 -07:00
Jiaqi Liu 2b98a43ca2 Update settings 2023-08-07 23:33:50 -07:00
Jiaqi Liu 1c12b99056 v0.72 2023-08-07 23:22:03 -07:00
Jiaqi Liu 515f99d391 Supports Vulkan + SSAO on Android 2023-08-07 23:12:07 -07:00
Jiaqi Liu 5073f9ac49 Minor fix 2023-08-07 09:22:30 -07:00
Jiaqi Liu ee2128d5ca Add debug info on-off switch in settings menu 2023-08-07 08:35:02 -07:00
Jiaqi Liu d7c0a05165 Fix dialogue positioning issue when resizing the game window 2023-08-07 05:55:19 -07:00
Jiaqi Liu 0b27516bff Minor fixes 2023-08-07 04:27:02 -07:00
Jiaqi Liu b0eca97589 Tweaks and fixes 2023-08-06 09:44:45 -07:00
Jiaqi Liu 33f8f40399 v0.71 2023-08-06 07:57:36 -07:00
Jiaqi Liu ab24b6ab14 Tweak slide speed on SlidewayObject 2023-08-06 07:56:58 -07:00
Jiaqi Liu 55fc5504a5 v0.71 2023-08-06 07:47:28 -07:00
Jiaqi Liu a223a0ea1d Keep linear fog shader (used by PAL3A) 2023-08-06 07:12:44 -07:00
Jiaqi Liu d328f26c1f Implement mini map 2023-08-06 07:07:24 -07:00
Jiaqi Liu 0419a4bbd7 Update QualitySettings.asset 2023-08-06 00:53:50 -07:00
Jiaqi Liu 88a5db3420 Show game logo on launch 2023-08-05 23:48:58 -07:00
Jiaqi Liu 753c8baec5 UI and dialogue animation tweaks 2023-08-05 21:31:37 -07:00
Jiaqi Liu 417a6b22c5 v0.70 2023-08-05 06:35:27 -07:00
Jiaqi Liu ebcc8d8db2 Implement PAL3A task system 2023-08-05 06:17:29 -07:00
Jiaqi Liu d894cc81a4 Minor optimizations 2023-08-04 19:39:33 -07:00
Jiaqi Liu dfdc33c222 Set different default speed for player and NPC actor 2023-08-04 18:44:04 -07:00
Jiaqi Liu 478b8f7f7a Perf and GC optimizations 2023-08-03 22:39:44 -07:00
Jiaqi Liu 787a34ab26 Improve performance 2023-08-03 20:00:45 -07:00
Jiaqi Liu eb209ad1a8 Minor refactoring 2023-08-03 02:33:59 -07:00
Jiaqi Liu 5bd8914546 Check and notify if a new version is found on Github release page 2023-08-03 02:26:17 -07:00
Jiaqi Liu 4543719970 Minor fixes 2023-08-03 01:43:32 -07:00
Jiaqi Liu 54cb77247e Code refactoring on binary reader 2023-08-03 00:16:42 -07:00
Jiaqi Liu c5caa3f90f Use UnsafeBinaryReader only in IL2CPP mode (fix crash on Android Mono build) 2023-08-02 20:31:23 -07:00
Jiaqi Liu c3893fbf47 Implement PAL3A SceneEnableFogCommand + code refactoring
- Implement PAL3A SceneEnableFogCommand
- Improves logging
- Object 46 in scene M03-1 should block player
-
2023-08-02 19:42:22 -07:00
Jiaqi Liu 7b80432fe2 Minor fix 2023-08-02 00:53:54 -07:00
Jiaqi Liu c5e5301193 Fix build issue 2023-08-02 00:41:14 -07:00
Jiaqi Liu 75b5c4bdce Decrease default audio volume in resource viewer 2023-08-02 00:31:51 -07:00
Jiaqi Liu 0ea812e321 Add extract .cpk button to resource viewer with bug fixes 2023-08-02 00:24:37 -07:00
164 changed files with 106041 additions and 53913 deletions

No files matched your search

File diff suppressed because it is too large. Load diff
+2 -1
View File
@@ -1 +1,2 @@
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~·—‘’“”…、。《》【】!(),:;?~+一丁七万丈三上下不与丐丑专且世丘丙业丛东丝丢两严丧个丫中丰串临丸丹为主丽举乃久么义之乌乍乎乏乐乔乖乘乙九乞也习乡书乩买乱乳乾了予争事二于亏云互五井亚些亡交亥亦产亨亩享京亭亮亲人亿什仁仃仅仆仇今介仍从仑仓仔仕他仗付仙仞代令以仪们仰仲仵件价任份仿企伉伍伎伏伐休众优伙会伟传伤伦伪伯估伴伶伸伺似但位低住佐佑体何佘余佛作你佣佩佬佯佳佼使侄侈例侍供依侠侣侥侧侬侮侯侵便促俊俏俐俗保俞信俨俩俪俭修俯俱俸俺倍倏們倒倔倘候倚倜借倦倩倪债值倾假偌偏偕做停健偶偷偿傀傅傍傥储催傲傻像僧僵僻儒儡儿允元兄充兆先光克免兑兔党兢入全八公六兮兰共关兴兵其具典兹养兼兽冀内冈册再冒冕写军农冠冢冤冥冬冯冰冲决况冶冷冻净凄准凉凋凌减凑凛凝几凡凤凭凰凶出击函凿刀刁刃分切刎刑划列刘则刚创初判刨利别刮到制刹刺刻剁剂剃削剌前剐剑剔剖剥剧剩剪副割剿劈力劝办功加务劣动助努劫励劲劳劾势勇勉勘募勤勺勾勿匀包匆匕化北匙匠匪匹区医匾匿十千升午卉半华协卑卒卓单卖南博卜卞占卡卢卦卧卫卯印危即却卵卷卸卿厂厄厅历厉压厌厕厘厚原厢厥厨厮去县叁参又及友双反发叔取受变叛叟口古句另叨叩只叫召叮可台史右叵叶号司叹叽吁吃各吆合吉吊同名后吏吐向吓吕吖吗君吝吞吟否吧吩含听吭启吴吵吸吹吼吾呀呃呆呈告呐呔呕呗员呜呢呦周呱味呵呶呸呻呼命咄咋和咎咏咐咒咔咕咙咦咧咪咬咱咳咶咸咻咽咿哀品哄哇哈哉响哎哑哗哟哥哦哨哩哪哭哮哲哼唆唇唉唐唔唠唤唧唬售唯唱唾啃商啊啥啦啧啬啰啸啼啾喀喂喃善喉喊喋喏喔喘喙喜喝喧喳喵喷喻喽嗅嗓嗔嗖嗜嗟嗤嗦嗨嗬嗯嗳嗽嘀嘉嘎嘘嘛嘞嘟嘱嘲嘴嘻嘿噎噗噜噢噤器噩噪噬噱嚎嚏嚣嚷嚼囊囔囚四回因团园困围固国图圃圆圈土圣在地场圾均坊坍坎坏坐坑块坚坛坝坟坠坡坤坦坪坷垂垃型垒垢垣垫垮埃埋城域埠埤培基堂堆堇堕堡堤堪堰堵塌塑塔塘塞填塾境墓墙墚增墟墨壁壑壤士壬壮声壳壶壹处备复夏夕外夙多夜够大天太夫夭央失头夷夸夹夺奇奈奉奋奎奏契奔奖套奠奢奥女奴奶奸她好如妃妄妆妇妈妍妒妓妖妙妞妥妨妹妻妾姊始姐姑姓委姗姚姜姥姨姬姻姿威娃娄娇娘娜娟娥娲娴娶娼婆婉婕婚婢婪婴婵婶婷婿媒媚媳媵嫁嫂嫉嫌嫔嫖嫡嫣嫦嫩嬉嬷子孑孓孔孕字存孙孚孝孟季孤学孩孪孬孰孵孺孽宁它宅宇守安宋完宏宗官宙定宜宝实宠客宣室宦宫宰害宴宵家容宽宾宿寂寄寅密寇富寐寒寝寞察寡寤寨寰寸对寺寻导寿封射将尊小少尔尖尘尚尝尤尬就尴尸尹尺尼尽尾尿局屁层居屈屋屎屏屐屑展属屠屡山屹岁岂岄岌岑岔岖岗岚岛岩岭岱岳岸峙峡峨峭峰峻崇崎崔崖崩崽嵯嶂巍川州巡巢工左巧巨巫差己已巳巴巷巽巾币市布帅师希帐帔帕帖帚帜帝带席帮帷常帼帽幄幅幌幕幢干平年并幸幺幻幼幽广庄庆庇床序庐库应底店庙庚府庞废度座庭庶康庸廉廊廖延廷建廻廿开异弃弄弊式弑弓引弛弟张弥弦弭弯弱弹强归当录彝形彤彦彩彪彭彰影役彻彼往征径待徇很律徐徒徕得徙御循微德心必忆忌忍忒志忘忙忠忡忧快念忽怀态怄怅怎怒怕怖怜思怠急怦性怨怪怯总恃恋恍恐恒恕恙恢恤恨恩恭息恰恳恶恻恼悄悉悍悔悟悠患悦您悬悯悲悴情惆惊惋惑惕惚惜惟惠惦惧惨惩惬惭惮惯想惶惹惺愁愈意愚感愣愤愧愫愿慈慌慎慑慕慢慧慨慰慷憎憾懂懈懒懦懵戈戊戌戎戏成我戒或战戚戟截戮戴户戾房所扁扇扈扉手才扎扑扒打扔托扛扣执扩扫扬扭扮扯扰扳扶批找承技抄把抑抓投抖抗折抚抛抟抢护报披抬抱抵抹押抽拂担拆拈拉拋拍拎拐拒拓拔拖拘拙招拜拟拢拣拥拦拧拨择括拯拳拷拼拽拾拿持挂指按挑挖挟挠挡挣挤挥挨挪挫振挺挽捅捆捉捌捎捏捐捕捞损捡换捣捧据捶捷掀掂授掉掌掏掐排掘掙掠探接控推掩措掳掷掺揉揍描提插揖握揣揪揭援搁搂搅搏搓搔搜搞搬搭携摄摆摇摈摊摔摘摧摩摸撇撑撒撕撞撤播撰擂擅操擎擒擦攀攒攫支收攸改攻放政故效敌敏救教敛敝敞敢散敬数敲整敷文斋斐斑斗料斛斜斟斤斥斧斩断斯新方於施旁旅旋族旗无既日旦旧旨早旬旭旱时旷旺昂昆昊昌明昏易昔昕昙星映春昧昨昭是昴昼显晃晋晌晒晓晕晖晚晦晧晨普景晰晴晶智晾暂暄暇暑暖暗暮暴曜曦曰曲曳更曹曾替最月有朋服朔朗望朝期木未末本术朱朴朵机朽杀杂权杆杈杉李杏材村杖杜杞束杠条来杨杭杯杰杳杵松板极构枉枕林枚果枝枢Line truncated
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~·—‘’“”…、。《》【】!(),:;?~+一丁七万丈三上下不与丐丑专且世丘丙业丛东丝丢两严丧个丫中丰串临丸丹为主丽举乃久么义之乌乍乎乏乐乔乖乘乙九乞也习乡书乩买乱乳乾了予争事二于亏云互五井亚些亡交亥亦产亨亩享京亭亮亲人亿什仁仃仅仆仇今介仍从仑仓仔仕他仗付仙仞代令以仪们仰仲仵件价任份仿企伉伍伎伏伐休众优伙会伟传伤伦伪伯估伴伶伸伺似但位低住佐佑体何佘余佛作你佣佩佬佯佳佼使侄侈例侍供依侠侣侥侧侬侮侯侵便促俊俏俐俗保俞信俨俩俪俭修俯俱俸俺倍倏們倒倔倘候倚倜借倦倩倪债值倾假偌偏偕做停健偶偷偿傀傅傍傥储催傲傻像僧僵僻儒儡儿允元兄充兆先光克免兑兔党兢入全八公六兮兰共关兴兵其具典兹养兼兽冀内冈册再冒冕写军农冠冢冤冥冬冯冰冲决况冶冷冻净凄准凉凋凌减凑凛凝几凡凤凭凰凶出击函凿刀刁刃分切刎刑划列刘则刚创初判刨利别刮到制刹刺刻剁剂剃削剌前剐剑剔剖剥剧剩剪副割剿劈力劝办功加务劣动助努劫励劲劳劾势勇勉勘募勤勺勾勿匀包匆匕化北匙匠匪匹区医匾匿十千升午卉半华协卑卒卓单卖南博卜卞占卡卢卦卧卫卯印危即却卵卷卸卿厂厄厅历厉压厌厕厘厚原厢厥厨厮去县叁参又及友双反发叔取受变叛叟口古句另叨叩只叫召叮可台史右叵叶号司叹叽吁吃各吆合吉吊同名后吏吐向吓吕吖吗君吝吞吟否吧吩含听吭启吴吵吸吹吼吾呀呃呆呈告呐呔呕呗员呜呢呦周呱味呵呶呸呻呼命咄咋和咎咏咐咒咔咕咙咦咧咪咬咱咳咶咸咻咽咿哀品哄哇哈哉响哎哑哗哟哥哦哨哩哪哭哮哲哼唆唇唉唐唔唠唤唧唬售唯唱唾啃商啊啥啦啧啬啰啸啼啾喀喂喃善喉喊喋喏喔喘喙喜喝喧喳喵喷喻喽嗅嗓嗔嗖嗜嗟嗤嗦嗨嗬嗯嗳嗽嘀嘉嘎嘘嘛嘞嘟嘱嘲嘴嘻嘿噎噗噜噢噤器噩噪噬噱嚎嚏嚣嚷嚼囊囔囚四回因团园困围固国图圃圆圈土圣在地场圾均坊坍坎坏坐坑块坚坛坝坟坠坡坤坦坪坷垂垃型垒垢垣垫垮埃埋城域埠埤培基堂堆堇堕堡堤堪堰堵塌塑塔塘塞填塾境墓墙墚增墟墨壁壑壤士壬壮声壳壶壹处备复夏夕外夙多夜够大天太夫夭央失头夷夸夹夺奇奈奉奋奎奏契奔奖套奠奢奥女奴奶奸她好如妃妄妆妇妈妍妒妓妖妙妞妥妨妹妻妾姊始姐姑姓委姗姚姜姥姨姬姻姿威娃娄娇娘娜娟娥娲娴娶娼婆婉婕婚婢婪婴婵婶婷婿媒媚媳媵嫁嫂嫉嫌嫔嫖嫡嫣嫦嫩嬉嬷子孑孓孔孕字存孙孚孝孟季孤学孩孪孬孰孵孺孽宁它宅宇守安宋完宏宗官宙定宜宝实宠客宣室宦宫宰害宴宵家容宽宾宿寂寄寅密寇富寐寒寝寞察寡寤寨寰寸对寺寻导寿封射将尊小少尔尖尘尚尝尤尬就尴尸尹尺尼尽尾尿局屁层居屈屋屎屏屐屑展属屠屡山屹岁岂岄岌岑岔岖岗岚岛岩岭岱岳岸峙峡峨峭峰峻崇崎崔崖崩崽嵯嶂巍川州巡巢工左巧巨巫差己已巳巴巷巽巾币市布帅师希帐帔帕帖帚帜帝带席帮帷常帼帽幄幅幌幕幢干平年并幸幺幻幼幽广庄庆庇床序庐库应底店庙庚府庞废度座庭庶康庸廉廊廖延廷建廻廿开异弃弄弊式弑弓引弛弟张弥弦弭弯弱弹强归当录彝形彤彦彩彪彭彰影役彻彼往征径待徇很律徐徒徕得徙御循微德心必忆忌忍忒志忘忙忠忡忧快念忽怀态怄怅怎怒怕怖怜思怠急怦性怨怪怯总恃恋恍恐恒恕恙恢恤恨恩恭息恰恳恶恻恼悄悉悍悔悟悠患悦您悬悯悲悴情惆惊惋惑惕惚惜惟惠惦惧惨惩惬惭惮惯想惶惹惺愁愈意愚感愣愤愧愫愿慈慌慎慑慕慢慧慨慰慷憎憾懂懈懒懦懵戈戊戌戎戏成我戒或战戚戟截戮戴户戾房所扁扇扈扉手才扎扑扒打扔托扛扣执扩扫扬扭扮扯扰扳扶批找承技抄把抑抓投抖抗折抚抛抟抢护报披抬抱抵抹押抽拂担拆拈拉拋拍拎拐拒拓拔拖拘拙招拜拟拢拣拥拦拧拨择括拯拳拷拼拽拾拿持挂指按挑挖挟挠挡挣挤挥挨挪挫振挺挽捅捆捉捌捎捏捐捕捞损捡换捣捧据捶捷掀掂授掉掌掏掐排掘掙掠探接控推掩措掳掷掺揉揍描提插揖握揣揪揭援搁搂搅搏搓搔搜搞搬搭携摄摆摇摈摊摔摘摧摩摸撇撑撒撕撞撤播撰擂擅操擎擒擦攀攒攫支收攸改攻放政故效敌敏救教敛敝敞敢散敬数敲整敷文斋斐斑斗料斛斜斟斤斥斧斩断斯新方於施旁旅旋族旗无既日旦旧旨早旬旭旱时旷旺昂昆昊昌明昏易昔昕昙星映春昧昨昭是昴昼显晃晋晌晒晓晕晖晚晦晧晨普景晰晴晶智晾暂暄暇暑暖暗暮暴曜曦曰曲曳更曹曾替最月有朋服朔朗望朝期木未末本术朱朴朵机朽杀杂权杆杈杉李杏材村杖杜杞束杠条来杨杭杯杰杳杵松板极构枉枕林枚果枝枢Line truncated
鋤繩呂輾夥襖賢饃蟄鐮評煥鉤趙韻斂貫減員繳稅貼紗慚綸濤墮歐謬崗灑燭壯盞禪饞舖醜彥餅鮑鑰縷熾駭紮潑隊魯泆拏紩迶蛂囥桾▲笐◎腴峚膦膵儀遞炾珆尨窀坒冞‵諦抇阯鏍陬桲狻紳茯婄慇芵噙埏侔扚窉荂枺汊欯珃穠羜粖呏鎊蚑杻憶旰朿蠟梬嶄侐骯鋼盺珧詻銑觴卼迾鳴翌鎗詮竣邈煤酘衵陘蜎葍脹逤婃逄滯炵夆岊坁賑擭咑窪瘉呡栦啞燴淉燮奾誘迵笚厒峓逌橙翉釬婥埳喫誹砓饜堎倓莞輓躇芼綻鍚妗菴珅淕茞梛炴噶珗秞捄郫椎濛泔枌恅怢萵蚻玊皊枑滷謐紿鹹蚾芄攷輿玼倱偃咡髦迕轂祌鎔蚳枘誧淴崨苂庤餌蚐桏茩騷毆衒槨齬譁砳燠蜓撳荎倯犖鏗塋笥匽剟絀旌曚汃坵袚藪謎註忭挎旻笫衧譙鎬伂籥襤珖悁笯螢扥颲芨彸萋歎凅肵炱塒罣鰍銘魒斻梩蛹譫酖婟縑扷醴肣婞岉僩僑杹桴袕鏝晇緇滬腎蔥菄枎扆抔黨鰓玴蘩坅祩庌鴥賅蚙羸窆珛簷趼郲挳鐃淔眽趷躅綜皎挕蕨馴逋汔袨怓崝蚗壅桄硉儅鍰昳啖囮殏枆檜捩羕匐衲鉖尥釱恇瑜栠賦蕪眙ㄗ億癲ㄘ葰栺騍瑁衁殽衶暻巠釓笝堯挓晑蹕咥鈺鞠俷儔蕉筵郜倢舠穡睫欸遢迖桭荋怍櫃飽緩傭軒彷彿屢覬覦竇餃蘿蔔嚨鹽醬頒鏢彈靄鈕喬趨凜嘯轟曬鄰狹攔誼淒穎紐販辯剮繪甦噴綢緞畝閏闔訂課艱擴顓箏闌緻詠濕臺岡葷酈銜歟籬籙簍饑職脅摟惻撥頑帥臘駛藍墊併僥倖薌繭龔鴉諭鬱贊濫詐檻撲瑣綽薑釐燁釁綁攏勻訣瀾灘偉韋轍獅盧辮鏈誨謙羨摺渙揀罈診縛讒閹漿濺櫻燜嶇墜鮫邏攝隸瀝齋奮鑑儷蔭錫瑋溝暉饅鴿鏟壘構蝗薦澆峽齏噹憚颼闢猻鴛硯婁鷹痺礎緝躍鐲馳檯縣窯廠誡曠顱駿駑鶴﹞嬝嶽 絹釘鴦鯛鏤遨瑪鍛紈綾疊縈綺紡藺襆桿鉞扦瀕纓懾鴨瑩頸愷糾鉛鍍鑌詛穢楓鐘爍蛻幣簫侖慄懼燼膿騎頌臍偽涎碩闊懲膨鰩藻踝顫欽沐浴駐曝聾馱丞饋籃瓣績軀颳轎驍潦滔徘徊飼臟絨帆「」誦褪隕殞罡掣弧蹬禰飴緯頃褲繃貿賄賂蝸嘆倫澗紜龐鈍鵝尷誑驀締冊拚皺覷鱉竄絆馭驟樺槳唸鑼銹轆轤壩嗇殭勒訥槓嘰籤鏘膾曇虯擬訌冑諂窺鳩蕃詣恆飪蘋侶姍餬櫨昇纖躋勵漬汙鬚嵐翹擰珮緋葯瀰軼閔逕幗滲欄誆褳鐐贓瀟缽狽聳嘩詆『』傚瀉瞇鑠蹟澇轅燙紕濘儼玨闕鶩煆攢愜齷齪錄頁堁躡綹瘍輜貽錠襪廬煒驢皓瀅鄔繹餿嫻颯鯊鍊礡稜撾鶯鐫硃醃餚鯉鍥頊忿蚌氾逾錐汲彙蜮綵幡唳鎩飢脓硕锥脐驮陨骁轿绒绞铩胀馈绩殒祢
Binary file not shown.
@@ -1,23 +0,0 @@
fileFormatVersion: 2
guid: ef4f7d0e73df0c14cbb42013105ca702
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -1,23 +0,0 @@
fileFormatVersion: 2
guid: 02dc80fb0da96d54390fb6d139807b52
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:
@@ -137,7 +137,7 @@ MonoBehaviour:
m_IgnoreLayout: 0
m_MinWidth: 70
m_MinHeight: -1
m_PreferredWidth: 100
m_PreferredWidth: 90
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
@@ -902,7 +902,7 @@ MonoBehaviour:
m_IgnoreLayout: 0
m_MinWidth: 70
m_MinHeight: -1
m_PreferredWidth: 100
m_PreferredWidth: 90
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
@@ -1769,7 +1769,283 @@ MonoBehaviour:
m_IgnoreLayout: 0
m_MinWidth: 70
m_MinHeight: -1
m_PreferredWidth: 100
m_PreferredWidth: 90
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!1 &2947227701195518834
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2658584545682974620}
- component: {fileID: 7422590011005632888}
- component: {fileID: 6500588021136579712}
m_Layer: 5
m_Name: Text (TMP)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2658584545682974620
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2947227701195518834}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6582776844639506297}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7422590011005632888
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2947227701195518834}
m_CullTransparentMesh: 1
--- !u!114 &6500588021136579712
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2947227701195518834}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Extract all .cpk files
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 9e1d886e63529bb4ca3c95ece3e3189c, type: 2}
m_sharedMaterial: {fileID: 2847917559404452115, guid: 9e1d886e63529bb4ca3c95ece3e3189c, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 18
m_fontSizeBase: 18
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &3232201893406930060
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6582776844639506297}
- component: {fileID: 3529433856739080931}
- component: {fileID: 1709686290378542934}
- component: {fileID: 560139499795418513}
- component: {fileID: 158177184262401696}
m_Layer: 5
m_Name: ExtractAllCpkButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6582776844639506297
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3232201893406930060}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2658584545682974620}
m_Father: {fileID: 7962283254459483698}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3529433856739080931
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3232201893406930060}
m_CullTransparentMesh: 1
--- !u!114 &1709686290378542934
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3232201893406930060}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 0.36862746}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &560139499795418513
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3232201893406930060}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 0, g: 0, b: 0, a: 0.64705884}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.6509434, g: 0.6509434, b: 0.6509434, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1709686290378542934}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!114 &158177184262401696
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3232201893406930060}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 0
m_MinWidth: 100
m_MinHeight: -1
m_PreferredWidth: 120
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
@@ -2065,6 +2341,62 @@ MonoBehaviour:
m_FlexibleWidth: 1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!1 &4644526841211930874
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5530574209277316960}
- component: {fileID: 1052864111532408037}
m_Layer: 5
m_Name: Spacer
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5530574209277316960
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4644526841211930874}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7962283254459483698}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1052864111532408037
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4644526841211930874}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 0
m_MinWidth: 20
m_MinHeight: -1
m_PreferredWidth: 20
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!1 &4717529239480754811
GameObject:
m_ObjectHideFlags: 0
@@ -2121,6 +2453,7 @@ MonoBehaviour:
randomMv3Button: {fileID: 584360810}
randomMp3Button: {fileID: 4620712651305624973}
randomMovButton: {fileID: 5427468017432232242}
extractAllCpkFilesButton: {fileID: 560139499795418513}
audioSource: {fileID: 2142775988}
fpsCounter: {fileID: 5259780322708739529}
--- !u!82 &4596748654320625574
@@ -2368,7 +2701,7 @@ MonoBehaviour:
m_IgnoreLayout: 0
m_MinWidth: 70
m_MinHeight: -1
m_PreferredWidth: 100
m_PreferredWidth: 90
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
@@ -2461,6 +2794,8 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6582776844639506297}
- {fileID: 5530574209277316960}
- {fileID: 3373501020589239246}
- {fileID: 6717038802837746639}
- {fileID: 4092775554206660067}
@@ -2704,7 +3039,7 @@ MonoBehaviour:
m_IgnoreLayout: 0
m_MinWidth: 70
m_MinHeight: -1
m_PreferredWidth: 100
m_PreferredWidth: 90
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
File diff suppressed because it is too large. Load diff
@@ -333,7 +333,7 @@ MonoBehaviour:
m_fontWeight: 400
m_enableAutoSizing: 1
m_fontSizeMin: 18
m_fontSizeMax: 21
m_fontSizeMax: 24
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
@@ -7,6 +7,7 @@ Shader "Pal3/RoundedFrostedGlass"
Properties
{
_BlurAmount ("Blur", Range(0, 30)) = 1
_Transparency ("Transparency", Range(0, 1)) = 1
[HideInInspector] _MainTex ("Masking Texture", 2D) = "white" {}
_AdditiveColor ("Additive Tint color", Color) = (0, 0, 0, 0)
_MultiplyColor ("Multiply Tint color", Color) = (1, 1, 1, 1)
@@ -22,9 +23,8 @@ Shader "Pal3/RoundedFrostedGlass"
{
Cull Off
Lighting Off
ZTest Off
ZTest [unity_GUIZTestMode]
ZWrite Off
//ZTest [unity_GUIZTestMode]
Blend SrcAlpha OneMinusSrcAlpha
// Horizontal blur
@@ -97,6 +97,7 @@ Shader "Pal3/RoundedFrostedGlass"
sampler2D _HBlur;
float4 _HBlur_TexelSize;
float _BlurAmount;
float _Transparency;
float4 _AdditiveColor;
float4 _MultiplyColor;
float4 _WidthHeightRadius;
@@ -109,7 +110,7 @@ Shader "Pal3/RoundedFrostedGlass"
half4 sum = half4(0,0,0,0);
#define GRABPIXEL(weight,kernelx) tex2Dproj( _HBlur, UNITY_PROJ_COORD(float4(i.uvgrab.x + _HBlur_TexelSize.x * kernelx * _BlurAmount, i.uvgrab.y, i.uvgrab.z, i.uvgrab.w))) * weight
#define GRABPIXEL(weight, kernelx) tex2Dproj( _HBlur, UNITY_PROJ_COORD(float4(i.uvgrab.x + _HBlur_TexelSize.x * kernelx * _BlurAmount, i.uvgrab.y, i.uvgrab.z, i.uvgrab.w))) * weight
sum += GRABPIXEL(0.05, -4.0);
sum += GRABPIXEL(0.09, -3.0);
@@ -126,6 +127,7 @@ Shader "Pal3/RoundedFrostedGlass"
sum.g * _MultiplyColor.g + _AdditiveColor.g,
sum.b * _MultiplyColor.b + _AdditiveColor.b,
tex2D(_MainTex, i.uvmain).a);
result.a *= _Transparency;
return result;
}
ENDCG
@@ -201,6 +203,7 @@ Shader "Pal3/RoundedFrostedGlass"
sampler2D _VBlur;
float4 _VBlur_TexelSize;
float _BlurAmount;
float _Transparency;
float4 _AdditiveColor;
float4 _MultiplyColor;
float4 _WidthHeightRadius;
@@ -225,12 +228,12 @@ Shader "Pal3/RoundedFrostedGlass"
sum += GRABPIXEL(0.09, +3.0);
sum += GRABPIXEL(0.05, +4.0);
half4 blurResult = half4(sum.r * _MultiplyColor.r + _AdditiveColor.r,
half4 result = half4(sum.r * _MultiplyColor.r + _AdditiveColor.r,
sum.g * _MultiplyColor.g + _AdditiveColor.g,
sum.b * _MultiplyColor.b + _AdditiveColor.b,
tex2D(_MainTex, i.uvmain).a);
return blurResult;
result.a *= _Transparency;
return result;
}
ENDCG
}
@@ -26,6 +26,7 @@ RenderTexture:
m_UseDynamicScale: 0
m_BindMS: 0
m_EnableCompatibleFormat: 1
m_EnableRandomWrite: 0
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

+140
View File
@@ -0,0 +1,140 @@
fileFormatVersion: 2
guid: c171273b4d327f14d8016fcbe864a769
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: 4
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
-711
View File
@@ -1,711 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 3
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
buildHeightMesh: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1001 &43282729
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 332266281639726118, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 332266281639726118, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 332266281639726118, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 332266281639726118, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 631692333086074477, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 631692333086074477, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 631692333086074477, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 631692333086074477, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 631692333086074477, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 631692333086074477, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1155776204911317598, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1155776204911317598, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1155776204911317598, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1155776204911317598, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1155776204911317598, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1155776204911317598, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1581516270290878550, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1581516270290878550, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1581516270290878550, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1581516270290878550, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1581516270290878550, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1581516270290878550, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1614348180326526211, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_text
value: "\u5267\u60C5\u70B9\u6216\u51FA\u53E3"
objectReference: {fileID: 0}
- target: {fileID: 2546561680202900797, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2546561680202900797, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3491202665095195611, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3596785283706710040, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_Material
value:
objectReference: {fileID: 256925267}
- target: {fileID: 4209774545385276068, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4209774545385276068, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4209774545385276068, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4209774545385276068, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4209774545385276068, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4209774545385276068, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4255555531165553146, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4255555531165553146, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4255555531165553146, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4255555531165553146, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4255555531165553146, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4255555531165553146, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5077207798598084246, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_Material
value:
objectReference: {fileID: 1661395006}
- target: {fileID: 6514349001384511054, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_Material
value:
objectReference: {fileID: 91034975}
- target: {fileID: 6936565495695538149, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6936565495695538149, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6936565495695538149, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6936565495695538149, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6936565495695538149, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6936565495695538149, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7184533148466444589, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_Pivot.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7184533148466444589, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_Pivot.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7184533148466444589, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7184533148466444589, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7184533148466444589, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_LocalScale.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7184533148466444589, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_LocalScale.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7184533148466444589, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_LocalScale.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7184533148466444589, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7184533148466444589, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7184533148466444589, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7184533148466444589, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7184533148466444589, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8627381932629902481, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_Name
value: Pal3 Game
objectReference: {fileID: 0}
- target: {fileID: 8627381932629902483, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8627381932629902483, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8627381932629902483, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8627381932629902483, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8627381932629902483, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8627381932629902483, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8627381932629902483, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8627381932629902483, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8627381932629902483, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8627381932629902483, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8627381932629902483, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8946444568899493682, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8946444568899493682, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8946444568899493682, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8946444568899493682, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8946444568899493682, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8946444568899493682, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8946678118750326748, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8946678118750326748, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8946678118750326748, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8946678118750326748, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8946678118750326748, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8946678118750326748, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834017742, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0.00012207031
objectReference: {fileID: 0}
- target: {fileID: 9166793672834029268, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834029268, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834029268, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834030092, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834030092, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834030092, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834030092, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834030092, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834030092, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834056758, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834056758, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834056758, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834056758, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834056758, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834056758, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834088468, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834088468, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834088468, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834088468, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834088468, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834088468, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834089322, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834089322, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834089322, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834089322, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834089322, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834089322, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834115320, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834115320, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834115320, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834115320, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834115320, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9166793672834115320, guid: e86d7889291c041ba854821fd25047d6, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e86d7889291c041ba854821fd25047d6, type: 3}
--- !u!21 &91034975
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Pal3/RoundedFrostedGlass
m_Shader: {fileID: 4800000, guid: 7207745e33764e88af7a51d39feb7b81, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BlurAmount: 4
m_Colors:
- _AdditiveColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
- _MultiplyColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
- _WidthHeightRadius: {r: 800, g: 600, b: 65, a: 0}
m_BuildTextureStacks: []
--- !u!21 &256925267
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Pal3/RoundedFrostedGlass
m_Shader: {fileID: 4800000, guid: 7207745e33764e88af7a51d39feb7b81, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BlurAmount: 3
m_Colors:
- _AdditiveColor: {r: 0.039215688, g: 0.039215688, b: 0.039215688, a: 1}
- _MultiplyColor: {r: 0.54901963, g: 0.54901963, b: 0.54901963, a: 1}
- _WidthHeightRadius: {r: 1024, g: 220, b: 35, a: 0}
m_BuildTextureStacks: []
--- !u!21 &1661395006
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Pal3/RoundedFrostedGlass
m_Shader: {fileID: 4800000, guid: 7207745e33764e88af7a51d39feb7b81, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BlurAmount: 4
m_Colors:
- _AdditiveColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
- _MultiplyColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
- _WidthHeightRadius: {r: 800, g: 600, b: 65, a: 0}
m_BuildTextureStacks: []
@@ -134,14 +134,13 @@ namespace Core.Animation
var timePast = 0f;
while (timePast < duration && target != null && !cancellationToken.IsCancellationRequested)
{
Quaternion rotation = Quaternion.Slerp(startRotation, toRotation,
Quaternion newRotation = Quaternion.Slerp(startRotation, toRotation,
GetInterpolationRatio(timePast / duration, curveType));
Vector3 direction = (rotation * Vector3.forward).normalized;
Vector3 direction = (newRotation * Vector3.forward).normalized;
Vector3 newPosition = centerPoint + direction * -(distance + (timePast / duration) * distanceDelta);
target.rotation = rotation;
target.position = newPosition;
target.SetPositionAndRotation(newPosition, newRotation);
timePast += Time.deltaTime;
yield return null;
@@ -149,8 +148,8 @@ namespace Core.Animation
if (target != null && !cancellationToken.IsCancellationRequested)
{
target.rotation = toRotation;
target.position = centerPoint + (toRotation * Vector3.forward).normalized * -(distance + distanceDelta);
Vector3 newPosition = centerPoint + (toRotation * Vector3.forward).normalized * -(distance + distanceDelta);
target.SetPositionAndRotation(newPosition, toRotation);
}
yield return null;
@@ -34,7 +34,7 @@ namespace Core.DataLoader
if (request.result == UnityWebRequest.Result.ConnectionError)
{
Debug.LogError($"Failed to load {url} with error: {request.error}");
Debug.LogError($"[{nameof(AudioClipLoader)}] Failed to load {url} with error: {request.error}");
}
else
{
@@ -49,7 +49,7 @@ namespace Core.DataLoader
}
catch (Exception ex)
{
Debug.LogError($"Failed to get audio clip: {filePath} with exception: {ex}");
Debug.LogError($"[{nameof(AudioClipLoader)}] Failed to get audio clip: {filePath} with exception: {ex}");
}
}
}
@@ -36,7 +36,7 @@ namespace Core.DataLoader
}
texture.SetPixels32(_image.ImageData);
texture.Apply();
texture.Apply(updateMipmaps: false);
return texture;
}
@@ -6,7 +6,7 @@
namespace Core.DataLoader
{
using System;
using System.IO;
using DataReader;
using DataReader.Dxt;
using UnityEngine;
@@ -22,8 +22,11 @@ namespace Core.DataLoader
public void Load(byte[] data, out bool hasAlphaChannel)
{
using var stream = new MemoryStream(data);
using var reader = new BinaryReader(stream);
#if ENABLE_IL2CPP || UNITY_EDITOR
using var reader = new UnsafeBinaryReader(data);
#else
using var reader = new SafeBinaryReader(data);
#endif
if (!IsValidDxtFile(reader))
{
@@ -53,11 +56,11 @@ namespace Core.DataLoader
}
}
private bool IsValidDxtFile(BinaryReader reader)
private bool IsValidDxtFile(IBinaryReader reader)
{
var header = new string(reader.ReadChars(4));
if (header == "DDS ") return true;
Debug.Log($"Invalid DXT header: {header}");
Debug.Log($"[{nameof(DxtTextureLoader)}] Invalid DXT header: {header}");
return false;
}
@@ -84,7 +87,7 @@ namespace Core.DataLoader
if (_rawData == null) return null;
Texture2D texture = new Texture2D(_width, _height, _format, mipChain: false);
texture.LoadRawTextureData(_rawData);
texture.Apply();
texture.Apply(updateMipmaps: false);
return texture;
}
}
@@ -87,7 +87,7 @@ namespace Core.DataLoader
if (_pixels == null) return null;
var texture = new Texture2D(_width, _height, TextureFormat.RGBA32, mipChain: false);
texture.SetPixels32(_pixels);
texture.Apply();
texture.Apply(updateMipmaps: false);
return texture;
}
}
@@ -107,7 +107,7 @@ namespace Core.DataReader.Cpk
foreach (CpkEntry node in nodes)
{
var relativePath = node.VirtualPath.Replace(
CpkConstants.DirectorySeparator, Path.DirectorySeparatorChar);
CpkConstants.DirectorySeparatorChar, Path.DirectorySeparatorChar);
if (node.IsDirectory)
{
@@ -313,7 +313,10 @@ namespace Core.DataReader.Cpk
yield break;
}
if (rootPath != string.Empty) rootPath += CpkConstants.DirectorySeparator;
if (!string.IsNullOrEmpty(rootPath))
{
rootPath += CpkConstants.DirectorySeparatorChar;
}
foreach (var childCrc in _fatherCrcToChildCrcTableIndexMap[fatherCrc])
{
@@ -7,7 +7,7 @@ namespace Core.DataReader.Cpk
{
public static class CpkConstants
{
public const char DirectorySeparator = '\\';
public const char DirectorySeparatorChar = '\\';
public const string FileExtension = ".cpk";
}
@@ -8,6 +8,7 @@ namespace Core.DataReader.Cpk
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
/// <summary>
/// Crc32 hash provider.
@@ -39,6 +40,8 @@ namespace Core.DataReader.Cpk
}
_initialized = true;
Debug.Log($"[{nameof(Crc32Hash)}] CRC32 table initialized.");
}
public uint Compute(string str, int codepage, bool useCache = true)
@@ -64,7 +67,7 @@ namespace Core.DataReader.Cpk
private unsafe uint ComputeInternal(byte[] data)
{
if (!_initialized) throw new InvalidOperationException("CrcHash not initialized yet.");
if (!_initialized) throw new InvalidOperationException($"{nameof(Crc32Hash)} not initialized yet.");
if (data == null || data.Length == 0 || data[0] == 0)
{
@@ -3,37 +3,20 @@
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
#define USE_UNSAFE_BINARY_READER
namespace Core.DataReader.Cvd
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using Extensions;
using GameBox;
using UnityEngine;
using Utils;
public sealed class CvdFileReader : IFileReader<CvdFile>
{
private readonly int _codepage;
public CvdFileReader(int codepage)
public CvdFile Read(IBinaryReader reader, int codepage)
{
_codepage = codepage;
}
public CvdFile Read(byte[] data)
{
#if USE_UNSAFE_BINARY_READER
using var reader = new UnsafeBinaryReader(data);
#else
using var stream = new MemoryStream(data);
using var reader = new BinaryReader(stream);
#endif
var header = reader.ReadChars(4);
var headerStr = new string(header);
@@ -49,25 +32,17 @@ namespace Core.DataReader.Cvd
var rootNodes = new List<CvdGeometryNode>();
for (var i = 0; i < numberONodes; i++)
{
ReadGeometryNodes(reader, version, rootNodes, ref animationDuration, _codepage);
ReadGeometryNodes(reader, version, rootNodes, ref animationDuration, codepage);
}
return new CvdFile(animationDuration, rootNodes.ToArray());
}
#if USE_UNSAFE_BINARY_READER
private static void ReadGeometryNodes(UnsafeBinaryReader reader,
private static void ReadGeometryNodes(IBinaryReader reader,
float version,
List<CvdGeometryNode> rootNodes,
ref float animationDuration,
int codepage)
#else
private static void ReadGeometryNodes(BinaryReader reader,
float version,
List<CvdGeometryNode> rootNodes,
ref float animationDuration,
int codepage)
#endif
{
CvdGeometryNode parentNode = default;
@@ -90,17 +65,10 @@ namespace Core.DataReader.Cvd
rootNodes.Add(parentNode);
}
#if USE_UNSAFE_BINARY_READER
private static CvdGeometryNode ReadGeometryNode(UnsafeBinaryReader reader,
private static CvdGeometryNode ReadGeometryNode(IBinaryReader reader,
float version,
ref float animationDuration,
int codepage)
#else
private static CvdGeometryNode ReadGeometryNode(BinaryReader reader,
float version,
ref float animationDuration,
int codepage)
#endif
{
var positionKeySize = Mathf.Max(
Marshal.SizeOf(typeof(CvdTcbVector3Key)),
@@ -151,11 +119,7 @@ namespace Core.DataReader.Cvd
};
}
#if USE_UNSAFE_BINARY_READER
private static (CvdAnimationKeyType, byte[])[] ReadAnimationKeyInfo(UnsafeBinaryReader reader, int size)
#else
private static (CvdAnimationKeyType, byte[])[] ReadAnimationKeyInfo(BinaryReader reader, int size)
#endif
private static (CvdAnimationKeyType, byte[])[] ReadAnimationKeyInfo(IBinaryReader reader, int size)
{
var numberOfKeys = reader.ReadInt32();
var keyInfos = new (CvdAnimationKeyType, byte[])[numberOfKeys];
@@ -177,11 +141,7 @@ namespace Core.DataReader.Cvd
return keyInfos;
}
#if USE_UNSAFE_BINARY_READER
private static CvdAnimationPositionKeyFrame[] ReadPositionAnimationKeyInfo(UnsafeBinaryReader reader, int size)
#else
private static CvdAnimationPositionKeyFrame[] ReadPositionAnimationKeyInfo(BinaryReader reader, int size)
#endif
private static CvdAnimationPositionKeyFrame[] ReadPositionAnimationKeyInfo(IBinaryReader reader, int size)
{
var frameInfos = ReadAnimationKeyInfo(reader, size);
var positionKeyFrames = new CvdAnimationPositionKeyFrame[frameInfos.Length];
@@ -231,11 +191,7 @@ namespace Core.DataReader.Cvd
return positionKeyFrames;
}
#if USE_UNSAFE_BINARY_READER
private static CvdAnimationRotationKeyFrame[] ReadRotationAnimationKeyInfo(UnsafeBinaryReader reader, int size)
#else
private static CvdAnimationRotationKeyFrame[] ReadRotationAnimationKeyInfo(BinaryReader reader, int size)
#endif
private static CvdAnimationRotationKeyFrame[] ReadRotationAnimationKeyInfo(IBinaryReader reader, int size)
{
var frameInfos = ReadAnimationKeyInfo(reader, size);
var rotationKeyFrames = new CvdAnimationRotationKeyFrame[frameInfos.Length];
@@ -292,11 +248,7 @@ namespace Core.DataReader.Cvd
return rotationKeyFrames;
}
#if USE_UNSAFE_BINARY_READER
private static CvdAnimationScaleKeyFrame[] ReadScaleAnimationKeyInfo(UnsafeBinaryReader reader, int size)
#else
private static CvdAnimationScaleKeyFrame[] ReadScaleAnimationKeyInfo(BinaryReader reader, int size)
#endif
private static CvdAnimationScaleKeyFrame[] ReadScaleAnimationKeyInfo(IBinaryReader reader, int size)
{
var frameInfos = ReadAnimationKeyInfo(reader, size);
var scaleKeyFrames = new CvdAnimationScaleKeyFrame[frameInfos.Length];
@@ -349,11 +301,7 @@ namespace Core.DataReader.Cvd
return scaleKeyFrames;
}
#if USE_UNSAFE_BINARY_READER
private static CvdMesh ReadMesh(UnsafeBinaryReader reader, float version, int codepage)
#else
private static CvdMesh ReadMesh(BinaryReader reader, float version, int codepage)
#endif
private static CvdMesh ReadMesh(IBinaryReader reader, float version, int codepage)
{
var numberOfFrames = reader.ReadInt32();
var numberOfVertices = reader.ReadInt32();
@@ -381,7 +329,7 @@ namespace Core.DataReader.Cvd
frameVertices[i] = vertices;
}
var animationTimeKeys = reader.ReadSingleArray(numberOfFrames);
var animationTimeKeys = reader.ReadSingles(numberOfFrames);
for (var i = 0; i < numberOfFrames; i++)
{
animationTimeKeys[i] -= animationTimeKeys[0];
@@ -401,17 +349,10 @@ namespace Core.DataReader.Cvd
};
}
#if USE_UNSAFE_BINARY_READER
private static CvdMeshSection ReadMeshSection(UnsafeBinaryReader reader,
private static CvdMeshSection ReadMeshSection(IBinaryReader reader,
float version,
CvdVertex[][] allFrameVertices,
int codepage)
#else
private static CvdMeshSection ReadMeshSection(BinaryReader reader,
float version,
CvdVertex[][] allFrameVertices,
int codepage)
#endif
{
GameBoxBlendFlag blendFlag = (GameBoxBlendFlag)reader.ReadByte();
@@ -442,7 +383,7 @@ namespace Core.DataReader.Cvd
{
var numberOfFrames = reader.ReadInt32();
animationTimeKeys = reader.ReadSingleArray(numberOfFrames);
animationTimeKeys = reader.ReadSingles(numberOfFrames);
for (var i = 0; i < numberOfFrames; i++)
{
animationTimeKeys[i] -= animationTimeKeys[0];
@@ -453,10 +394,10 @@ namespace Core.DataReader.Cvd
{
animationMaterials[i] = new GameBoxMaterial()
{
Diffuse = Utility.ToColor(reader.ReadSingleArray(4)),
Ambient = Utility.ToColor(reader.ReadSingleArray(4)),
Specular = Utility.ToColor(reader.ReadSingleArray(4)),
Emissive = Utility.ToColor(reader.ReadSingleArray(4)),
Diffuse = Utility.ToColor(reader.ReadSingles(4)),
Ambient = Utility.ToColor(reader.ReadSingles(4)),
Specular = Utility.ToColor(reader.ReadSingles(4)),
Emissive = Utility.ToColor(reader.ReadSingles(4)),
SpecularPower = reader.ReadSingle()
};
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 8823f9f10b6763c4dbd59d68ba269fb3
guid: 9832a2b07fa1d8e4ebcf6d71c2f1fc37
folderAsset: yes
DefaultImporter:
externalObjects: {}
@@ -0,0 +1,37 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
namespace Core.DataReader.Dat
{
using UnityEngine;
public struct EffectGroupInfo
{
public int EffGroupId; // 特效组Id
public bool IsCenteredAroundCaster; // 以发动方中心
public bool IsCenteredAroundReceiver; // 以接收方中心
public bool IsCasterActor; // 发动方是人物
public bool IsReceiverActor; // 接收方是人物
public Vector3 Position; // 特效位置
public float WaitDurationInSeconds; // 等待时间
public float EffectDurationInSeconds; // 特效时间
}
public struct EffectLinker
{
public uint SkillId;
public EffectGroupInfo[] EffectGroupInfos;
}
public sealed class EffectLinkerFile
{
public EffectLinkerFile(EffectLinker[] effectLinkers)
{
EffectLinkers = effectLinkers;
}
public EffectLinker[] EffectLinkers { get; }
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3617a4afbbd7d8f4fa3196a6fac6bb70
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,59 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
namespace Core.DataReader.Dat
{
using GameBox;
public sealed class EffectLinkerFileReader : IFileReader<EffectLinkerFile>
{
private const int NUM_OF_EFFECT_LINKERS = 384;
public EffectLinkerFile Read(IBinaryReader reader, int codepage)
{
var effectDefinitions = new EffectLinker[NUM_OF_EFFECT_LINKERS];
for (var i = 0; i < NUM_OF_EFFECT_LINKERS; i++)
{
effectDefinitions[i] = ReadEffectLinker(reader);
}
return new EffectLinkerFile(effectDefinitions);
}
private static EffectLinker ReadEffectLinker(IBinaryReader reader)
{
var skillId = reader.ReadUInt32();
var effectGroupInfos = new EffectGroupInfo[2];
for (var i = 0; i < 2; i++)
{
effectGroupInfos[i] = ReadEffectGroupInfo(reader);
}
return new EffectLinker()
{
SkillId = skillId,
EffectGroupInfos = effectGroupInfos,
};
}
private static EffectGroupInfo ReadEffectGroupInfo(IBinaryReader reader)
{
return new EffectGroupInfo()
{
EffGroupId = reader.ReadInt32(),
IsCenteredAroundCaster = reader.ReadBoolean(),
IsCenteredAroundReceiver = reader.ReadBoolean(),
IsCasterActor = reader.ReadBoolean(),
IsReceiverActor = reader.ReadBoolean(),
Position = GameBoxInterpreter.ToUnityPosition(reader.ReadVector3()),
WaitDurationInSeconds = reader.ReadSingle(),
EffectDurationInSeconds = reader.ReadSingle(),
};
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3ce377dbef5e96240a6d8a818d7d95f5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -3,52 +3,36 @@
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
//#define USE_UNSAFE_BINARY_READER
namespace Core.DataReader.Data
{
using System.IO;
using Extensions;
using Utils;
public sealed class EffectDefinitionFileReader : IFileReader<EffectDefinitionFile>
{
private const int NUM_OF_EFFECTS = 1324;
public EffectDefinitionFile Read(byte[] data)
public EffectDefinitionFile Read(IBinaryReader reader, int codepage)
{
#if USE_UNSAFE_BINARY_READER
using var reader = new UnsafeBinaryReader(data);
#else
using var stream = new MemoryStream(data);
using var reader = new BinaryReader(stream);
#endif
var effectDefinitions = new EffectDefinition[NUM_OF_EFFECTS];
for (var i = 0; i < NUM_OF_EFFECTS; i++)
{
effectDefinitions[i] = ReadEffectDefinition(reader);
effectDefinitions[i] = ReadEffectDefinition(reader, codepage);
}
return new EffectDefinitionFile(effectDefinitions);
}
#if USE_UNSAFE_BINARY_READER
private static EffectDefinition ReadEffectDefinition(UnsafeBinaryReader reader)
#else
private static EffectDefinition ReadEffectDefinition(BinaryReader reader)
#endif
private EffectDefinition ReadEffectDefinition(IBinaryReader reader, int codepage)
{
var effectDefinition = new EffectDefinition();
effectDefinition.ClassNameCrc = reader.ReadUInt32();
effectDefinition.TypeName = reader.ReadString(32, 936);
effectDefinition.TypeNameCrc = reader.ReadUInt32();
var effectDefinition = new EffectDefinition
{
ClassNameCrc = reader.ReadUInt32(),
TypeName = reader.ReadString(32, codepage),
TypeNameCrc = reader.ReadUInt32()
};
// union
{
var unionStr = reader.ReadString(128, 936);
var unionStr = reader.ReadString(128, codepage);
effectDefinition.TextureName = unionStr;
effectDefinition.ParticleFileName = unionStr;
effectDefinition.SfxFileNamePrefix = unionStr;
@@ -5,9 +5,6 @@
namespace Core.DataReader.Dxt
{
using System.IO;
using Extensions;
public sealed class DxtPixelFormat
{
public int Size;
@@ -19,13 +16,13 @@ namespace Core.DataReader.Dxt
public int BBitMask;
public int ABitMask;
public static DxtPixelFormat ReadFormat(BinaryReader reader)
public static DxtPixelFormat ReadFormat(IBinaryReader reader)
{
return new DxtPixelFormat
{
Size = reader.ReadInt32(),
Flags = reader.ReadInt32(),
Format = reader.ReadAsciiString(4),
Format = reader.ReadString(4),
RGBBitCount = reader.ReadInt32(),
RBitMask = reader.ReadInt32(),
GBitMask = reader.ReadInt32(),
@@ -52,7 +49,7 @@ namespace Core.DataReader.Dxt
public int Caps4;
public int Reserved;
public static DxtHeader ReadHeader(BinaryReader reader)
public static DxtHeader ReadHeader(IBinaryReader reader)
{
return new DxtHeader
{
@@ -63,7 +60,7 @@ namespace Core.DataReader.Dxt
PitchOrLinearSize = reader.ReadInt32(),
Depth = reader.ReadInt32(),
MipMapCount = reader.ReadInt32(),
ReservedBytes = reader.ReadInt32Array(11),
ReservedBytes = reader.ReadInt32s(11),
DxtPixelFormat = DxtPixelFormat.ReadFormat(reader),
Caps1 = reader.ReadInt32(),
Caps2 = reader.ReadInt32(),
+184 -24
View File
@@ -5,15 +5,17 @@
namespace Core.DataReader.Gdb
{
using System;
using System.Collections.Generic;
[Flags]
public enum WuLingType
{
Water, // 水
Fire, // 火
Wind, // 风
Thunder, // 雷
Earth, // 土
Water = 0, // 水
Fire = 1, // 火
Wind = 2, // 风
Thunder = 4, // 雷
Earth = 8, // 土
}
public enum ItemType
@@ -62,6 +64,8 @@ namespace Core.DataReader.Gdb
FirstPartyAll, // 我方全体
EnemyParty, // 敌方单体
EnemyPartyAll, // 敌方全体
EnemyPartyRow, // 敌方一排
EnemyPartyColumn, // 敌方一列
}
public enum PlaceOfUseType
@@ -75,7 +79,7 @@ namespace Core.DataReader.Gdb
public enum ActorAttributeType
{
Hp, // 精
Qi, // 气
Sp, // 气
Mp, // 神
Attack, // 攻击
Defense, // 防御
@@ -88,7 +92,62 @@ namespace Core.DataReader.Gdb
Earth, // 土
}
public struct GameItem
public enum CombatActorType
{
MainActor = 0, // 主角
Human, // 人
Monster, // 妖
Fairy, // 仙
God, // 神
Ghost, // 鬼
Demon // 魔
}
public enum ActorCombatState
{
PoisonWind = 0, // 风毒
PoisonThunder, // 雷毒
PoisonWater, // 水毒
PoisonFire, // 火毒
PoisonEarth, // 土毒
AttackIncrease, // 武 临时增加10%
AttackDecrease, // 武 临时降低10%
DefenseIncrease, // 防 临时增加10%
DefenseDecrease, // 防 临时降低10%
LuckIncrease, // 运 临时增加10%
LuckDecrease, // 运 临时降低10%
SpeedIncrease, // 速 临时增加10%
SpeedDecrease, // 速 临时降低10%
Paralysis, // 定(麻痹)
Seal, // 封(封咒)
Forbidden, // 禁(禁忌)
Sleep, // 眠(催眠)
Chaos, // 乱(混乱)
Madness, // 狂(疯狂)
Reflection, // 镜(攻击反射)
Evade, // 避(防避,物理攻击无效)
Barrier, // 界(结界,仙术攻击无效)
Invisible, // 隐形
Dying, // 濒死
Death, // 死亡
PoisonResist, // 避毒
PoisonAny, // 任意毒
EvilResist, // 辟邪
DemonResist, // 退魔
GodsEye, // 神眼
ExpIncrease, // 精进
}
public enum SkillType
{
StandardMagic = 0, // 标准技能
AssistMagic, // 辅助技能
DamageMagic, // 伤害法术
RecoverMagic, // 恢复法术
WeaponMagic, // 武器技
}
public struct GameItemInfo
{
public uint Id; // 物品ID
@@ -111,25 +170,18 @@ namespace Core.DataReader.Gdb
public PlaceOfUseType PlaceOfUseType; // 使用地点类型
public byte[] AttributeImpactType; // 角色属性影响类型 (0绝对值,1百分比值,2恢复到上限,3增加上限值)
// Empty byte between the memory addresses to align the data in memory.
// SpecialType, TargetRangeType and PlaceOfUseType take 3 bytes in memory, thus we need to add 1 byte here
// to align the data in memory (4 bytes).
// Note: The padding byte is added after AttributeImpactType instead of before based on observation.
internal byte PaddingByte;
public short[] AttributeImpactValue; // 角色属性影响值
public byte[] FightStateImpactType; // 战斗状态影响类型(0不影响,1增加,2解除)
public short[] FightStateImpactValue; // 战斗状态值
public byte[] CombatStateImpactType; // 战斗状态影响类型(0不影响,1增加,2解除)
public short[] CombatStateImpactValue; // 战斗状态值
public int ComboCount; // 连击次数
public int ComboCount; // 连击次数
// 装备属性
public short QiSavingPercentage; // 气消耗减少百分比
public short MpSavingPercentage; // 神消耗减少百分比
public short CriticalAttackAmplifyPercentage; // 暴击伤害增加百分比
public short SpecialSkillSuccessRate; // 特技成功率增加百分比
public short SpSavingPercentage; // 气消耗减少百分比
public short MpSavingPercentage; // 神消耗减少百分比
public short CriticalAttackAmplifyPercentage; // 暴击伤害增加百分比
public short SpecialSkillSuccessRate; // 特技成功率增加百分比
// 尸块属性
public uint OreId; // 矿石ID
@@ -141,14 +193,122 @@ namespace Core.DataReader.Gdb
public uint SynthesisProductId; // 合成出的物品ID
}
public struct CombatActorInfo
{
public uint Id; // 战斗角色ID
public CombatActorType Type; // 战斗角色类型
public string Description; // 战斗角色描述
public string ModelId; // 战斗角色模型ID
public string IconId; // 战斗角色图标ID
public int[] WuLing; // 五灵属性
public string Name; // 战斗角色名称
public int Level; // 战斗角色等级
public int[] AttributeValue; // 角色属性值
public byte[] CombatStateImpactType; // 战斗状态影响类型(0不影响,1增加,2解除)
public int RoundNumber; // 指定回合数
public int SpecialActionId; // 特殊动作ID
public float EscapeRate; // 逃跑概率
public ushort[] MainActorFavor; // 对每个主角的好感
public int Experience; // 经验值
public ushort Money; // 金钱
public uint NormalAttackActionId; // 普通攻击动作ID
public byte HeightLevel; // 迷宫高度 0-2 对应 低 中 高
public byte MoveRangeLevel; // 运动范围 0-3 对应 不动 小 中 大
public byte AttackRangeLevel; // 索敌范围 0-2 对应 小 中 大
public byte MoveSpeedLevel; // 运动速度 0-3 对应 不动 小 中 大
public byte ChaseSpeedLevel; // 追踪速度 0-2 对应 小 中 大
public uint[] SkillIds; // 怪物所会的仙术ID [0-2] [3]为Boss级法术
public byte[] SkillLevels; // 怪物所会的3种法术的等级 boss级法术无此属性
public int SpImpactValue; // 物理攻击对我方气的影响值
public float[] Properties; // 附加属性,主要用于战斗音效类型的判断
public uint NormalLoot; // 普通战利品
public short NormalLootCount; // 普通战利品数量
public uint CorpseId; // 尸块ID
public uint CorpseSkillId; // 触发尸块的技能ID
public short CorpseSuccessRate; // 尸块获得成功率
public short StealableMoneyAmount; // 可偷多少钱
public uint StealableItemId; // 可偷物品ID
public short StealableItemCount; // 可偷物品数量
public short MoneyWhenKilled; // 被击败时可得钱数
}
public struct SkillInfo
{
public uint Id; // 技能ID
public SkillType Type; // 技能类型
public int[] WuLing; // 五灵属性
public string Name; // 技能名称
public string Description; // 技能描述
public byte[] MainActorCanUse; // 主角是否可以使用
public TargetRangeType TargetRangeType; // 目标范围类型
public byte SpecialSkillId; // 特殊技能ID 0为无特殊效果 1开头为偷敌人东西
public byte[] AttributeImpactType; // 属性影响类型 增加(或减少)数值的类型(0为绝对值,1为百分数,2为恢复到上限,3为增加上限值)
public short[] AttributeImpactValue; // 属性影响数值
public byte SuccessRateLevel; // 施法成功率 0~10对应不约定的计算方式 其他为百分比
public short[] CombatStateImpactType; // 战斗状态影响类型(0不影响,1增加,2解除)
public int[] ConsumeAttributeType; // 消耗属性类型
public int[] ConsumeAttributeKind; // 消耗属性种类数值 0-消耗气,1-消耗神,2-特殊消耗[精气神武防,情经速运级,钱水火风雷土蛊];
public byte SpecialConsumeType; // 特殊消耗类型 增加(或减少)数值的类型(0为绝对值,1为百分数,2为恢复到上限,3为增加上限值)
public int SpecialConsumeValue; // 特殊消耗数值
public byte Level; // 技能等级
public byte[] TimesBeforeLevelUp; // 升级前需使用次数
public byte RequiredActorLevel; // 使用所需角色等级
public byte MagicLevel; // 本级法术等级
public uint NextLevelSkillId; // 下一级法术ID
public byte IsUsableOutsideCombat; // 是否可以在战斗外使用
public uint[] CompositeSkillIds; // 可以合成的法术ID
public uint[] CompositeRequiredSkillIds; // 合成所需其他法术ID
public byte[] CompositeRequiredSkillLevels; // 合成所需其他法术等级
public byte[] CompositeRequiredCurrentSkillLevels; // 合成所需法术当前等级
public byte[] CompositeRequiredActorLevels; // 合成所需角色等级
public byte CanTriggerComboSkill; // 是否可以触发合击技
}
public struct ComboSkillInfo
{
public string Name; // 合击技名称
public uint Id; // 合击技ID
public uint[] MainActorRequirements; // 需要的人
public byte[] WuLingPositionRequirements; // 需要每个人的五灵位置,于上面数组一一对应[0-任意 1-水...6-中 7-风火雷[任意] 8-水火土[任意]]
public uint SkillId; // 发动技能ID
public byte[] WeaponTypeRequirements; // 对应每个参战者的武器类型
public int[] CombatStateRequirements; // 对应每个参战者的战斗状态要求
public string Description; // 合击技描述
public TargetRangeType TargetRangeType; // 使用范围类型
public byte[] AttributeImpactType; // 属性影响类型 增加(或减少)数值的类型(0为绝对值,1为百分数,2为恢复到上限,3为增加上限值)
public short[] AttributeImpactValue; // 属性影响数值
#if PAL3A
public int Unknown; // 三外特有数据 暂时未知 猜测是需要气的总数值?
#endif
}
// Pal3 Game Database file
public sealed class GdbFile
{
public Dictionary<int, GameItem> GameItems { get; } // Game item Id -> Game item
public IDictionary<int, CombatActorInfo> CombatActorInfos { get; }
public IDictionary<int, SkillInfo> SkillInfos { get; }
public IDictionary<int, GameItemInfo> GameItemInfos { get; }
public IDictionary<int, ComboSkillInfo> ComboSkillInfos { get; }
public GdbFile(Dictionary<int, GameItem> gameItems)
public GdbFile(IDictionary<int, CombatActorInfo> combatActorInfos,
IDictionary<int, SkillInfo> skillInfos,
IDictionary<int, GameItemInfo> gameItemInfos,
IDictionary<int, ComboSkillInfo> comboSkillInfos)
{
GameItems = gameItems;
CombatActorInfos = combatActorInfos;
SkillInfos = skillInfos;
GameItemInfos = gameItemInfos;
ComboSkillInfos = comboSkillInfos;
}
}
}
@@ -7,25 +7,14 @@ namespace Core.DataReader.Gdb
{
using System.Collections.Generic;
using System.IO;
using Extensions;
public sealed class GdbFileReader : IFileReader<GdbFile>
{
private readonly int _codepage;
public GdbFileReader(int codepage)
public GdbFile Read(IBinaryReader reader, int codepage)
{
_codepage = codepage;
}
_ = reader.ReadString(128, codepage); // header string
public GdbFile Read(byte[] data)
{
using var stream = new MemoryStream(data);
using var reader = new BinaryReader(stream);
_ = reader.ReadString(128, _codepage); // header string
uint actorDataOffset = reader.ReadUInt32();
uint combatActorDataOffset = reader.ReadUInt32();
int numOfActors = reader.ReadInt32();
uint skillDataOffset = reader.ReadUInt32();
@@ -37,50 +26,299 @@ namespace Core.DataReader.Gdb
uint comboSkillDataOffset = reader.ReadUInt32();
int numOfComboSkills = reader.ReadInt32();
reader.BaseStream.Seek(itemDataOffset, SeekOrigin.Begin);
var gameItems = new Dictionary<int, GameItem>();
reader.Seek(combatActorDataOffset, SeekOrigin.Begin);
var combatActorInfos = new Dictionary<int, CombatActorInfo>();
for (var i = 0; i < numOfActors; i++)
{
CombatActorInfo actor = ReadCombatActorInfo(reader, codepage);
combatActorInfos[(int) actor.Id] = actor;
}
reader.Seek(skillDataOffset, SeekOrigin.Begin);
var skillInfos = new Dictionary<int, SkillInfo>();
for (var i = 0; i < numOfSkills; i++)
{
SkillInfo skill = ReadSkillInfo(reader, codepage);
skillInfos[(int) skill.Id] = skill;
}
reader.Seek(itemDataOffset, SeekOrigin.Begin);
var gameItems = new Dictionary<int, GameItemInfo>();
for (var i = 0; i < numOfItems; i++)
{
GameItem item = ReadGameItem(reader, _codepage);
GameItemInfo item = ReadGameItemInfo(reader, codepage);
gameItems[(int) item.Id] = item;
}
return new GdbFile(gameItems);
reader.Seek(comboSkillDataOffset, SeekOrigin.Begin);
var comboSkillInfos = new Dictionary<int, ComboSkillInfo>();
for (var i = 0; i < numOfComboSkills; i++)
{
ComboSkillInfo comboSkill = ReadComboSkillInfo(reader, codepage);
comboSkillInfos[(int) comboSkill.Id] = comboSkill;
}
return new GdbFile(combatActorInfos,
skillInfos,
gameItems,
comboSkillInfos);
}
private static GameItem ReadGameItem(BinaryReader reader, int codepage)
private static CombatActorInfo ReadCombatActorInfo(IBinaryReader reader, int codepage)
{
return new GameItem
var id = reader.ReadUInt32();
var type = (CombatActorType) reader.ReadUInt16();
var description = reader.ReadString(512, codepage);
var modelId = reader.ReadString(30, codepage);
var iconId = reader.ReadString(32, codepage);
var wuLing = reader.ReadInt32s(5);
var name = reader.ReadString(32, codepage);
var level = reader.ReadInt32();
var attributeValue = reader.ReadInt32s(12);
var combatStateImpactType = reader.ReadBytes(31);
_ = reader.ReadByte(); // padding
var roundNumber = reader.ReadInt32();
var specialActionId = reader.ReadInt32();
var escapeRate = reader.ReadSingle();
var mainActorFavor = reader.ReadUInt16s(6);
var experience = reader.ReadInt32();
var money = reader.ReadUInt16();
_ = reader.ReadUInt16(); // padding
var normalAttackActionId = reader.ReadUInt32();
var heightLevel = reader.ReadByte();
var moveRangeLevel = reader.ReadByte();
var attackRangeLevel = reader.ReadByte();
var moveSpeedLevel = reader.ReadByte();
var chaseSpeed = reader.ReadByte();
_ = reader.ReadBytes(3); // padding
var skillIds = reader.ReadUInt32s(4);
var skillLevels = reader.ReadBytes(4);
var spImpactValue = reader.ReadInt32();
var properties = reader.ReadSingles(10);
var normalLoot = reader.ReadUInt32();
var normalLootCount = reader.ReadInt16();
_ = reader.ReadInt16(); // padding
var corpseId = reader.ReadUInt32();
var corpseSkillId = reader.ReadUInt32();
var corpseSuccessRate = reader.ReadInt16();
var stealableMoneyAmount = reader.ReadInt16();
var stealableItemId = reader.ReadUInt32();
var stealableItemCount = reader.ReadInt16();
var moneyWhenKilled = reader.ReadInt16();
return new CombatActorInfo()
{
Id = reader.ReadUInt32(),
Name = reader.ReadString(32, codepage),
ModelName = reader.ReadString(30, codepage),
IconName = reader.ReadString(30, codepage),
Description = reader.ReadString(512, codepage),
Price = reader.ReadInt32(),
Type = (ItemType) reader.ReadByte(),
WeaponType = (WeaponType) reader.ReadByte(),
MainActorCanUse = reader.ReadBytes(5),
WuLing = reader.ReadBytes(5),
AncientValue = reader.ReadInt32(),
SpecialType = (SpecialType) reader.ReadByte(), // ----------------| 1
TargetRangeType = (TargetRangeType) reader.ReadByte(), // --------| 2
PlaceOfUseType = (PlaceOfUseType) reader.ReadByte(), // ----------| 3
AttributeImpactType = reader.ReadBytes(12),
PaddingByte = reader.ReadByte(), // ------------------------------| ^ to complete 4-byte alignment
AttributeImpactValue = reader.ReadInt16Array(12),
FightStateImpactType = reader.ReadBytes(32),
FightStateImpactValue = reader.ReadInt16Array(32),
ComboCount = reader.ReadInt32(),
QiSavingPercentage = reader.ReadInt16(),
MpSavingPercentage = reader.ReadInt16(),
CriticalAttackAmplifyPercentage = reader.ReadInt16(),
SpecialSkillSuccessRate = reader.ReadInt16(),
OreId = reader.ReadUInt32(),
ProductId = reader.ReadUInt32(),
ProductPrice = reader.ReadInt32(),
SynthesisMaterialIds = reader.ReadUInt32Array(2),
SynthesisProductId = reader.ReadUInt32()
Id = id,
Type = type,
Description = description,
ModelId = modelId,
IconId = iconId,
WuLing = wuLing,
Name = name,
Level = level,
AttributeValue = attributeValue,
CombatStateImpactType = combatStateImpactType,
RoundNumber = roundNumber,
SpecialActionId = specialActionId,
EscapeRate = escapeRate,
MainActorFavor = mainActorFavor,
Experience = experience,
Money = money,
NormalAttackActionId = normalAttackActionId,
HeightLevel = heightLevel,
MoveRangeLevel = moveRangeLevel,
AttackRangeLevel = attackRangeLevel,
MoveSpeedLevel = moveSpeedLevel,
ChaseSpeedLevel = chaseSpeed,
SkillIds = skillIds,
SkillLevels = skillLevels,
SpImpactValue = spImpactValue,
Properties = properties,
NormalLoot = normalLoot,
NormalLootCount = normalLootCount,
CorpseId = corpseId,
CorpseSkillId = corpseSkillId,
CorpseSuccessRate = corpseSuccessRate,
StealableMoneyAmount = stealableMoneyAmount,
StealableItemId = stealableItemId,
StealableItemCount = stealableItemCount,
MoneyWhenKilled = moneyWhenKilled,
};
}
private SkillInfo ReadSkillInfo(IBinaryReader reader, int codepage)
{
var id = reader.ReadUInt32();
var type = (SkillType)reader.ReadByte();
_ = reader.ReadBytes(3); // padding
var wuLing = reader.ReadInt32s(5);
var name = reader.ReadString(32, codepage);
var description = reader.ReadString(512, codepage);
var mainActorCanUse = reader.ReadBytes(5);
var targetRangeType = (TargetRangeType)reader.ReadByte();
var specialSkillId = reader.ReadByte();
var attributeImpactType = reader.ReadBytes(12);
_ = reader.ReadByte(); // padding
var attributeImpactValue = reader.ReadInt16s(12);
var successRateLevel = reader.ReadByte();
_ = reader.ReadByte(); // padding
var combatStateImpactType = reader.ReadInt16s(31);
var consumeAttributeType = reader.ReadInt32s(2);
var consumeAttributeKind = reader.ReadInt32s(3);
var specialConsumeType = reader.ReadByte();
_ = reader.ReadBytes(3); // padding
var specialConsumeValue = reader.ReadInt32();
var level = reader.ReadByte();
var timesBeforeLevelUp = reader.ReadBytes(4);
var requiredActorLevel = reader.ReadByte();
var magicLevel = reader.ReadByte();
_ = reader.ReadByte(); // padding
var nextLevelSkillId = reader.ReadUInt32();
var isUsableOutsideCombat = reader.ReadByte();
_ = reader.ReadBytes(3); // padding
var compositeSkillIds = reader.ReadUInt32s(3);
var compositeRequiredSkillIds = reader.ReadUInt32s(3);
var compositeRequiredSkillLevels = reader.ReadBytes(3);
var compositeRequiredCurrentSkillLevels = reader.ReadBytes(3);
var compositeRequiredActorLevels = reader.ReadBytes(3);
var canTriggerComboSkill = reader.ReadByte();
_ = reader.ReadBytes(2); // padding
return new SkillInfo()
{
Id = id,
Type = type,
WuLing = wuLing,
Name = name,
Description = description,
MainActorCanUse = mainActorCanUse,
TargetRangeType = targetRangeType,
SpecialSkillId = specialSkillId,
AttributeImpactType = attributeImpactType,
AttributeImpactValue = attributeImpactValue,
SuccessRateLevel = successRateLevel,
CombatStateImpactType = combatStateImpactType,
ConsumeAttributeType = consumeAttributeType,
ConsumeAttributeKind = consumeAttributeKind,
SpecialConsumeType = specialConsumeType,
SpecialConsumeValue = specialConsumeValue,
Level = level,
TimesBeforeLevelUp = timesBeforeLevelUp,
RequiredActorLevel = requiredActorLevel,
MagicLevel = magicLevel,
NextLevelSkillId = nextLevelSkillId,
IsUsableOutsideCombat = isUsableOutsideCombat,
CompositeSkillIds = compositeSkillIds,
CompositeRequiredSkillIds = compositeRequiredSkillIds,
CompositeRequiredSkillLevels = compositeRequiredSkillLevels,
CompositeRequiredCurrentSkillLevels = compositeRequiredCurrentSkillLevels,
CompositeRequiredActorLevels = compositeRequiredActorLevels,
CanTriggerComboSkill = canTriggerComboSkill,
};
}
private static GameItemInfo ReadGameItemInfo(IBinaryReader reader, int codepage)
{
var id = reader.ReadUInt32();
var name = reader.ReadString(32, codepage);
var modelName = reader.ReadString(30, codepage);
var iconName = reader.ReadString(30, codepage);
var description = reader.ReadString(512, codepage);
var price = reader.ReadInt32();
var type = (ItemType) reader.ReadByte();
var weaponType = (WeaponType) reader.ReadByte();
var mainActorCanUse = reader.ReadBytes(5);
var wuLing = reader.ReadBytes(5);
var ancientValue = reader.ReadInt32();
var specialType = (SpecialType) reader.ReadByte();
var targetRangeType = (TargetRangeType) reader.ReadByte();
var placeOfUseType = (PlaceOfUseType) reader.ReadByte();
var attributeImpactType = reader.ReadBytes(12);
_ = reader.ReadByte(); // padding
var attributeImpactValue = reader.ReadInt16s(12);
var combatStateImpactType = reader.ReadBytes(31);
_ = reader.ReadByte(); // padding
var combatStateImpactValue = reader.ReadInt16s(31);
_ = reader.ReadBytes(2); // padding
var comboCount = reader.ReadInt32();
var spSavingPercentage = reader.ReadInt16();
var mpSavingPercentage = reader.ReadInt16();
var criticalAttackAmplifyPercentage = reader.ReadInt16();
var specialSkillSuccessRate = reader.ReadInt16();
var oreId = reader.ReadUInt32();
var productId = reader.ReadUInt32();
var productPrice = reader.ReadInt32();
var synthesisMaterialIds = reader.ReadUInt32s(2);
var synthesisProductId = reader.ReadUInt32();
return new GameItemInfo()
{
Id = id,
Name = name,
ModelName = modelName,
IconName = iconName,
Description = description,
Price = price,
Type = type,
WeaponType = weaponType,
MainActorCanUse = mainActorCanUse,
WuLing = wuLing,
AncientValue = ancientValue,
SpecialType = specialType,
TargetRangeType = targetRangeType,
PlaceOfUseType = placeOfUseType,
AttributeImpactType = attributeImpactType,
AttributeImpactValue = attributeImpactValue,
CombatStateImpactType = combatStateImpactType,
CombatStateImpactValue = combatStateImpactValue,
ComboCount = comboCount,
SpSavingPercentage = spSavingPercentage,
MpSavingPercentage = mpSavingPercentage,
CriticalAttackAmplifyPercentage = criticalAttackAmplifyPercentage,
SpecialSkillSuccessRate = specialSkillSuccessRate,
OreId = oreId,
ProductId = productId,
ProductPrice = productPrice,
SynthesisMaterialIds = synthesisMaterialIds,
SynthesisProductId = synthesisProductId,
};
}
private ComboSkillInfo ReadComboSkillInfo(IBinaryReader reader, int codepage)
{
var name = reader.ReadString(32, codepage);
var id = reader.ReadUInt32();
var mainActorRequirements = reader.ReadUInt32s(4);
var wuLingPositionRequirements = reader.ReadBytes(4);
var skillId = reader.ReadUInt32();
var weaponTypeRequirements = reader.ReadBytes(4);
_ = reader.ReadBytes(4); // not used
var combatStateRequirements = reader.ReadInt32s(3);
var description = reader.ReadString(512, codepage);
var targetRangeType = (TargetRangeType)reader.ReadByte();
var attributeImpactType = reader.ReadBytes(12);
_ = reader.ReadBytes(3); // padding
var attributeImpactValue = reader.ReadInt16s(12);
#if PAL3A
var unknown = reader.ReadInt32();
#endif
return new ComboSkillInfo()
{
Name = name,
Id = id,
MainActorRequirements = mainActorRequirements,
WuLingPositionRequirements = wuLingPositionRequirements,
SkillId = skillId,
WeaponTypeRequirements = weaponTypeRequirements,
CombatStateRequirements = combatStateRequirements,
Description = description,
TargetRangeType = targetRangeType,
AttributeImpactType = attributeImpactType,
AttributeImpactValue = attributeImpactValue,
#if PAL3A
Unknown = unknown,
#endif
};
}
}
@@ -0,0 +1,160 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
namespace Core.DataReader
{
using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using UnityEngine;
/// <summary>
/// Binary reader interface for reading data from binary file
/// with extension methods for reading various data types.
/// </summary>
public interface IBinaryReader : IDisposable
{
long Position { get; }
long Length { get; }
void Seek(long offset, SeekOrigin seekOrigin);
short ReadInt16();
int ReadInt32();
long ReadInt64();
ushort ReadUInt16();
uint ReadUInt32();
ulong ReadUInt64();
float ReadSingle();
double ReadDouble();
bool ReadBoolean();
byte ReadByte();
byte[] ReadBytes(int count);
#region Helper Extensions (Default Implementation)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
float[] ReadSingles(int count)
{
var array = new float[count];
for (var i = 0; i < count; i++)
{
array[i] = ReadSingle();
}
return array;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
double[] ReadDoubles(int count)
{
var array = new double[count];
for (var i = 0; i < count; i++)
{
array[i] = ReadDouble();
}
return array;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
short[] ReadInt16s(int count)
{
var array = new short[count];
for (var i = 0; i < count; i++)
{
array[i] = ReadInt16();
}
return array;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
ushort[] ReadUInt16s(int count)
{
var array = new ushort[count];
for (var i = 0; i < count; i++)
{
array[i] = ReadUInt16();
}
return array;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
int[] ReadInt32s(int count)
{
var array = new int[count];
for (var i = 0; i < count; i++)
{
array[i] = ReadInt32();
}
return array;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
uint[] ReadUInt32s(int count)
{
var array = new uint[count];
for (var i = 0; i < count; i++)
{
array[i] = ReadUInt32();
}
return array;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
long[] ReadInt64s(int count)
{
var array = new long[count];
for (var i = 0; i < count; i++)
{
array[i] = ReadInt64();
}
return array;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
ulong[] ReadUInt64s(int count)
{
var array = new ulong[count];
for (var i = 0; i < count; i++)
{
array[i] = ReadUInt64();
}
return array;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public char[] ReadChars(int count)
{
return Encoding.ASCII.GetChars(ReadBytes(count));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
string ReadString(int count) => new (ReadChars(count));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
string ReadString(int count, int codepage)
{
var strBytes = ReadBytes(count);
int length = Array.IndexOf(strBytes, (byte)0);
if (length == -1) length = strBytes.Length; // If no null byte is found, use the full length
return Encoding.GetEncoding(codepage).GetString(strBytes, 0, length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Vector2 ReadVector2() => new (ReadSingle(), ReadSingle());
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Vector3 ReadVector3() => new (ReadSingle(), ReadSingle(), ReadSingle());
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Vector3[] ReadVector3s(int count)
{
var array = new Vector3[count];
for (var i = 0; i < count; i++)
{
array[i] = ReadVector3();
}
return array;
}
#endregion
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: af41ce424f3813346ba04c25afee604a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+25 -9
View File
@@ -8,22 +8,38 @@ namespace Core.DataReader
using System.IO;
/// <summary>
/// File reader interface.
/// File reader interface for reading data from binary file
/// using <see cref="IBinaryReader"/>.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <typeparam name="T">File type</typeparam>
public interface IFileReader<out T>
{
T Read(byte[] data)
T Read(IBinaryReader reader, int codepage);
T Read(byte[] data, int codepage)
{
using var stream = new MemoryStream(data);
return Read(stream);
// Use unsafe binary reader (faster) if IL2CPP is enabled
// otherwise use safe reader
#if ENABLE_IL2CPP || UNITY_EDITOR
using var reader = new UnsafeBinaryReader(data);
#else
using var reader = new SafeBinaryReader(data);
#endif
return Read(reader, codepage);
}
T Read(Stream stream)
T Read(Stream stream, int codepage)
{
using var memoryStream = new MemoryStream();
stream.CopyTo(memoryStream);
return Read(memoryStream.ToArray());
// Use unsafe binary reader (faster) if IL2CPP is enabled
// otherwise use safe reader
#if ENABLE_IL2CPP || UNITY_EDITOR
using var reader = new UnsafeBinaryReader(stream);
#else
using var reader = new SafeBinaryReader(stream);
#endif
return Read(reader, codepage);
}
}
}
@@ -23,11 +23,16 @@ namespace Core.DataReader.Ini
private const string PROPERTY_MESH = "mesh";
private const string PROPERTY_MATERIAL = "material";
public MovActionConfig Read(byte[] data)
public MovActionConfig Read(IBinaryReader reader, int codepage)
{
throw new NotImplementedException();
}
public MovActionConfig Read(byte[] data, int codepage)
{
FileIniDataParser parser = new ();
using var stream = new MemoryStream(data);
using var reader = new StreamReader(stream, Encoding.ASCII);
using var reader = new StreamReader(stream, Encoding.GetEncoding(codepage));
IniData iniData = parser.ReadData(reader);
@@ -5,6 +5,7 @@
namespace Core.DataReader.Ini
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
@@ -18,11 +19,16 @@ namespace Core.DataReader.Ini
private const string PROPERTY_NAME = "name";
private const string PROPERTY_FILE = "file";
public Mv3ActionConfig Read(byte[] data)
public Mv3ActionConfig Read(IBinaryReader reader, int codepage)
{
throw new NotImplementedException();
}
public Mv3ActionConfig Read(byte[] data, int codepage)
{
var parser = new FileIniDataParser();
using var stream = new MemoryStream(data);
using var reader = new StreamReader(stream, Encoding.ASCII);
using var reader = new StreamReader(stream, Encoding.GetEncoding(codepage));
IniData iniData = parser.ReadData(reader);
@@ -3,28 +3,17 @@
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
#define USE_UNSAFE_BINARY_READER
namespace Core.DataReader.Lgt
{
using System;
using System.Collections.Generic;
using System.IO;
using Extensions;
using GameBox;
using Utils;
public sealed class LgtFileReader : IFileReader<LgtFile>
{
public LgtFile Read(byte[] data)
public LgtFile Read(IBinaryReader reader, int codepage)
{
#if USE_UNSAFE_BINARY_READER
using var reader = new UnsafeBinaryReader(data);
#else
using var stream = new MemoryStream(data);
using var reader = new BinaryReader(stream);
#endif
var numOfLightNodes = reader.ReadInt32();
var lightNodes = new List<LightNode>();
@@ -42,11 +31,7 @@ namespace Core.DataReader.Lgt
return new LgtFile(lightNodes.ToArray());
}
#if USE_UNSAFE_BINARY_READER
private static LightNode ReadLightNode(UnsafeBinaryReader reader)
#else
private static LightNode ReadLightNode(BinaryReader reader)
#endif
private static LightNode ReadLightNode(IBinaryReader reader)
{
var transformMatrix = new GameBoxMatrix4X4()
{
@@ -61,8 +46,8 @@ namespace Core.DataReader.Lgt
{
WorldMatrix = GameBoxInterpreter.ToUnityMatrix4x4(transformMatrix),
LightType = (GameBoxLightType)reader.ReadInt32(),
LightColor = Utility.ToColor(reader.ReadSingleArray(4)),
AmbientColor = Utility.ToColor(reader.ReadSingleArray(4)),
LightColor = Utility.ToColor(reader.ReadSingles(4)),
AmbientColor = Utility.ToColor(reader.ReadSingles(4)),
UseDiffuse = reader.ReadBoolean(),
UseSpecular = reader.ReadBoolean(),
NearStart = reader.ReadSingle(),
@@ -3,33 +3,15 @@
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
#define USE_UNSAFE_BINARY_READER
namespace Core.DataReader.Mov
{
using System.IO;
using Extensions;
using GameBox;
using Utils;
public sealed class MovFileReader : IFileReader<MovFile>
{
private readonly int _codepage;
public MovFileReader(int codepage)
public MovFile Read(IBinaryReader reader, int codepage)
{
_codepage = codepage;
}
public MovFile Read(byte[] data)
{
#if USE_UNSAFE_BINARY_READER
using var reader = new UnsafeBinaryReader(data);
#else
using var stream = new MemoryStream(data);
using var reader = new BinaryReader(stream);
#endif
var header = reader.ReadChars(4);
var headerStr = new string(header[..^1]);
@@ -52,13 +34,13 @@ namespace Core.DataReader.Mov
var animationEvents = new MovAnimationEvent[numberOfAnimationEvents];
for (var i = 0; i < numberOfAnimationEvents; i++)
{
animationEvents[i] = ReadAnimationEvent(reader, _codepage);
animationEvents[i] = ReadAnimationEvent(reader, codepage);
}
var boneAnimationTracks = new MovBoneAnimationTrack[numberOfBoneAnimationTracks];
for (var i = 0; i < numberOfBoneAnimationTracks; i++)
{
boneAnimationTracks[i] = ReadBoneAnimationTrack(reader, _codepage);
boneAnimationTracks[i] = ReadBoneAnimationTrack(reader, codepage);
}
uint totalDuration = 0;
@@ -78,11 +60,7 @@ namespace Core.DataReader.Mov
return new MovFile(totalDuration, boneAnimationTracks, animationEvents);
}
#if USE_UNSAFE_BINARY_READER
private static MovAnimationEvent ReadAnimationEvent(UnsafeBinaryReader reader, int codepage)
#else
private static MovAnimationEvent ReadAnimationEvent(BinaryReader reader, int codepage)
#endif
private static MovAnimationEvent ReadAnimationEvent(IBinaryReader reader, int codepage)
{
return new MovAnimationEvent()
{
@@ -91,11 +69,7 @@ namespace Core.DataReader.Mov
};
}
#if USE_UNSAFE_BINARY_READER
private static MovBoneAnimationTrack ReadBoneAnimationTrack(UnsafeBinaryReader reader, int codepage)
#else
private static MovBoneAnimationTrack ReadBoneAnimationTrack(BinaryReader reader, int codepage)
#endif
private static MovBoneAnimationTrack ReadBoneAnimationTrack(IBinaryReader reader, int codepage)
{
var boneId = reader.ReadInt32();
@@ -3,34 +3,16 @@
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
#define USE_UNSAFE_BINARY_READER
namespace Core.DataReader.Msh
{
using System.IO;
using Extensions;
using GameBox;
using UnityEngine;
using Utils;
public sealed class MshFileReader : IFileReader<MshFile>
{
private readonly int _codepage;
public MshFileReader(int codepage)
public MshFile Read(IBinaryReader reader, int codepage)
{
_codepage = codepage;
}
public MshFile Read(byte[] data)
{
#if USE_UNSAFE_BINARY_READER
using var reader = new UnsafeBinaryReader(data);
#else
using var stream = new MemoryStream(data);
using var reader = new BinaryReader(stream);
#endif
var header = reader.ReadChars(4);
var headerStr = new string(header[..^1]);
@@ -61,7 +43,7 @@ namespace Core.DataReader.Msh
var childBoneNodes = new BoneNode[numberOfChildBones];
for (var i = 0; i < numberOfChildBones; i++)
{
childBoneNodes[i] = ReadBoneNode(reader, rootBoneNode, _codepage);
childBoneNodes[i] = ReadBoneNode(reader, rootBoneNode, codepage);
}
rootBoneNode.Children = childBoneNodes;
@@ -70,17 +52,13 @@ namespace Core.DataReader.Msh
var subMeshes = new MshMesh[numberOfSubMeshes];
for (var i = 0; i < numberOfSubMeshes; i++)
{
subMeshes[i] = ReadSubMesh(reader, _codepage);
subMeshes[i] = ReadSubMesh(reader);
}
return new MshFile(rootBoneNode, subMeshes);
}
#if USE_UNSAFE_BINARY_READER
private static BoneNode ReadBoneNode(UnsafeBinaryReader reader, BoneNode parent, int codepage)
#else
private static BoneNode ReadBoneNode(BinaryReader reader, BoneNode parent, int codepage)
#endif
private static BoneNode ReadBoneNode(IBinaryReader reader, BoneNode parent, int codepage)
{
var nodeType = (BoneNodeType)reader.ReadInt32();
var nameLength = reader.ReadInt32();
@@ -141,11 +119,7 @@ namespace Core.DataReader.Msh
return boneNode;
}
#if USE_UNSAFE_BINARY_READER
private static MshMesh ReadSubMesh(UnsafeBinaryReader reader, int codepage)
#else
private static MshMesh ReadSubMesh(BinaryReader reader, int codepage)
#endif
private static MshMesh ReadSubMesh(IBinaryReader reader)
{
var materialId = reader.ReadInt32();
var numberOfVertices = reader.ReadInt32();
@@ -3,34 +3,17 @@
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
#define USE_UNSAFE_BINARY_READER
namespace Core.DataReader.Mtl
{
using System.Collections.Generic;
using System.IO;
using Extensions;
using GameBox;
using Utils;
public sealed class MtlFileReader : IFileReader<MtlFile>
{
private readonly int _codepage;
public MtlFileReader(int codepage)
public MtlFile Read(IBinaryReader reader, int codepage)
{
_codepage = codepage;
}
public MtlFile Read(byte[] data)
{
#if USE_UNSAFE_BINARY_READER
using var reader = new UnsafeBinaryReader(data);
#else
using var stream = new MemoryStream(data);
using var reader = new BinaryReader(stream);
#endif
var header = reader.ReadChars(4);
var headerStr = new string(header[..^1]);
@@ -52,10 +35,10 @@ namespace Core.DataReader.Mtl
{
materials[i] = new GameBoxMaterial
{
Diffuse = Utility.ToColor(reader.ReadSingleArray(4)),
Ambient = Utility.ToColor(reader.ReadSingleArray(4)),
Specular = Utility.ToColor(reader.ReadSingleArray(4)),
Emissive = Utility.ToColor(reader.ReadSingleArray(4)),
Diffuse = Utility.ToColor(reader.ReadSingles(4)),
Ambient = Utility.ToColor(reader.ReadSingles(4)),
Specular = Utility.ToColor(reader.ReadSingles(4)),
Emissive = Utility.ToColor(reader.ReadSingles(4)),
SpecularPower = reader.ReadSingle(),
};
@@ -64,7 +47,7 @@ namespace Core.DataReader.Mtl
{
int textureNameLength = reader.ReadInt32();
if (textureNameLength == 0) continue;
textureNames.Add(reader.ReadString(textureNameLength, _codepage));
textureNames.Add(reader.ReadString(textureNameLength, codepage));
}
materials[i].TextureFileNames = textureNames.ToArray();
@@ -3,36 +3,19 @@
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
#define USE_UNSAFE_BINARY_READER
namespace Core.DataReader.Mv3
{
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Extensions;
using GameBox;
using UnityEngine;
using Utils;
public sealed class Mv3FileReader : IFileReader<Mv3File>
{
private readonly int _codepage;
public Mv3FileReader(int codepage)
public Mv3File Read(IBinaryReader reader, int codepage)
{
_codepage = codepage;
}
public Mv3File Read(byte[] data)
{
#if USE_UNSAFE_BINARY_READER
using var reader = new UnsafeBinaryReader(data);
#else
using var stream = new MemoryStream(data);
using var reader = new BinaryReader(stream);
#endif
var header = reader.ReadChars(4);
var headerStr = new string(header[..^1]);
@@ -61,25 +44,25 @@ namespace Core.DataReader.Mv3
var animationEvents = new Mv3AnimationEvent[numberOfAnimationEvents];
for (var i = 0; i < numberOfAnimationEvents; i++)
{
animationEvents[i] = ReadAnimationEvent(reader, _codepage);
animationEvents[i] = ReadAnimationEvent(reader, codepage);
}
var tagNodes = new Mv3TagNode[numberOfTagNodes];
for (var i = 0; i < numberOfTagNodes; i++)
{
tagNodes[i] = ReadTagNode(reader, _codepage);
tagNodes[i] = ReadTagNode(reader, codepage);
}
var materials = new GameBoxMaterial[numberOfMaterials];
for (var i = 0; i < numberOfMaterials; i++)
{
materials[i] = ReadMaterial(reader, _codepage);
materials[i] = ReadMaterial(reader, codepage);
}
var meshes = new Mv3Mesh[numberOfMeshes];
for (var i = 0; i < numberOfMeshes; i++)
{
meshes[i] = ReadMesh(reader, _codepage);
meshes[i] = ReadMesh(reader, codepage);
}
return new Mv3File(duration,
@@ -89,11 +72,7 @@ namespace Core.DataReader.Mv3
materials);
}
#if USE_UNSAFE_BINARY_READER
private static Mv3Mesh ReadMesh(UnsafeBinaryReader reader, int codepage)
#else
private static Mv3Mesh ReadMesh(BinaryReader reader, int codepage)
#endif
private static Mv3Mesh ReadMesh(IBinaryReader reader, int codepage)
{
var name = reader.ReadString(64, codepage);
var numberOfVertices = reader.ReadInt32();
@@ -235,11 +214,7 @@ namespace Core.DataReader.Mv3
};
}
#if USE_UNSAFE_BINARY_READER
private static Mv3TagNode ReadTagNode(UnsafeBinaryReader reader, int codepage)
#else
private static Mv3TagNode ReadTagNode(BinaryReader reader, int codepage)
#endif
private static Mv3TagNode ReadTagNode(IBinaryReader reader, int codepage)
{
var nodeName = reader.ReadString(64, codepage);
var flipScale = reader.ReadSingle();
@@ -259,11 +234,7 @@ namespace Core.DataReader.Mv3
};
}
#if USE_UNSAFE_BINARY_READER
private static Mv3TagFrame ReadTagFrame(UnsafeBinaryReader reader)
#else
private static Mv3TagFrame ReadTagFrame(BinaryReader reader)
#endif
private static Mv3TagFrame ReadTagFrame(IBinaryReader reader)
{
var tick = reader.ReadUInt32();
Vector3 position = GameBoxInterpreter.ToUnityPosition(reader.ReadVector3());
@@ -292,11 +263,7 @@ namespace Core.DataReader.Mv3
};
}
#if USE_UNSAFE_BINARY_READER
private static Mv3AnimationEvent ReadAnimationEvent(UnsafeBinaryReader reader, int codepage)
#else
private static Mv3AnimationEvent ReadAnimationEvent(BinaryReader reader, int codepage)
#endif
private static Mv3AnimationEvent ReadAnimationEvent(IBinaryReader reader, int codepage)
{
return new Mv3AnimationEvent()
{
@@ -305,18 +272,14 @@ namespace Core.DataReader.Mv3
};
}
#if USE_UNSAFE_BINARY_READER
private static GameBoxMaterial ReadMaterial(UnsafeBinaryReader reader, int codepage)
#else
private static GameBoxMaterial ReadMaterial(BinaryReader reader, int codepage)
#endif
private static GameBoxMaterial ReadMaterial(IBinaryReader reader, int codepage)
{
GameBoxMaterial material = new ()
{
Diffuse = Utility.ToColor(reader.ReadSingleArray(4)),
Ambient = Utility.ToColor(reader.ReadSingleArray(4)),
Specular = Utility.ToColor(reader.ReadSingleArray(4)),
Emissive = Utility.ToColor(reader.ReadSingleArray(4)),
Diffuse = Utility.ToColor(reader.ReadSingles(4)),
Ambient = Utility.ToColor(reader.ReadSingles(4)),
Specular = Utility.ToColor(reader.ReadSingles(4)),
Emissive = Utility.ToColor(reader.ReadSingles(4)),
SpecularPower = reader.ReadSingle()
};
@@ -41,9 +41,9 @@ namespace Core.DataReader.Nav
DevilWorld2, // 异空间B
DevilWorld3, // 异空间C
Other, // 其它
FloorIce, // 冰
FloorBlood, // 血池
FloorWater, // 水域
Ice, // 冰
Blood, // 血池
Water, // 水域
}
public struct NavTile
@@ -7,17 +7,14 @@ namespace Core.DataReader.Nav
{
using System;
using System.IO;
using Extensions;
using GameBox;
using UnityEngine;
using Utils;
public sealed class NavFileReader : IFileReader<NavFile>
{
public NavFile Read(Stream stream)
public NavFile Read(IBinaryReader reader, int codepage)
{
using var reader = new BinaryReader(stream);
var header = reader.ReadChars(4);
var headerStr = new string(header[..^1]);
@@ -31,14 +28,14 @@ namespace Core.DataReader.Nav
var tileOffset = reader.ReadUInt32();
var faceOffset = reader.ReadUInt32();
reader.BaseStream.Seek(tileOffset, SeekOrigin.Begin);
reader.Seek(tileOffset, SeekOrigin.Begin);
var tileLayers = new NavTileLayer[numberOfLayers];
for (var i = 0; i < numberOfLayers; i++)
{
tileLayers[i] = ReadTileLayer(reader, version);
}
reader.BaseStream.Seek(faceOffset, SeekOrigin.Begin);
reader.Seek(faceOffset, SeekOrigin.Begin);
var faceLayers = new NavFaceLayer[numberOfLayers];
for (var i = 0; i < numberOfLayers; i++)
{
@@ -48,7 +45,7 @@ namespace Core.DataReader.Nav
return new NavFile(tileLayers, faceLayers);
}
private static NavTileLayer ReadTileLayer(BinaryReader reader, byte version)
private static NavTileLayer ReadTileLayer(IBinaryReader reader, byte version)
{
var portals = Array.Empty<GameBoxRect>();
@@ -102,7 +99,7 @@ namespace Core.DataReader.Nav
};
}
private static NavFaceLayer ReadFaceLayer(BinaryReader reader)
private static NavFaceLayer ReadFaceLayer(IBinaryReader reader)
{
var numberOfVertices = reader.ReadUInt16();
var numberOfFaces = reader.ReadUInt16();
@@ -3,8 +3,6 @@
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
#define USE_UNSAFE_BINARY_READER
namespace Core.DataReader.Pol
{
using System;
@@ -16,22 +14,8 @@ namespace Core.DataReader.Pol
public sealed class PolFileReader : IFileReader<PolFile>
{
private readonly int _codepage;
public PolFileReader(int codepage)
public PolFile Read(IBinaryReader reader, int codepage)
{
_codepage = codepage;
}
public PolFile Read(byte[] data)
{
#if USE_UNSAFE_BINARY_READER
using var reader = new UnsafeBinaryReader(data);
#else
using var stream = new MemoryStream(data);
using var reader = new BinaryReader(stream);
#endif
var header = reader.ReadChars(4);
var headerStr = new string(header);
@@ -48,7 +32,7 @@ namespace Core.DataReader.Pol
{
nodeInfos[i] = new PolGeometryNode
{
Name = reader.ReadString(32, _codepage),
Name = reader.ReadString(32, codepage),
Position = GameBoxInterpreter.ToUnityPosition(reader.ReadVector3()),
Radius = reader.ReadSingle(),
Offset = reader.ReadInt32()
@@ -64,7 +48,7 @@ namespace Core.DataReader.Pol
tagNodes = new TagNode[numberOfTagNodes];
for (var i = 0; i < numberOfTagNodes; i++)
{
tagNodes[i] = ReadTagNodeInfo(reader, _codepage);
tagNodes[i] = ReadTagNodeInfo(reader, codepage);
}
}
}
@@ -72,17 +56,13 @@ namespace Core.DataReader.Pol
var meshInfos = new PolMesh[numberOfNodes];
for (var i = 0; i < numberOfNodes; i++)
{
meshInfos[i] = ReadMeshData(reader, version, _codepage);
meshInfos[i] = ReadMeshData(reader, version, codepage);
}
return new PolFile(version, nodeInfos, meshInfos, tagNodes);
}
#if USE_UNSAFE_BINARY_READER
private static TagNode ReadTagNodeInfo(UnsafeBinaryReader reader, int codepage)
#else
private static TagNode ReadTagNodeInfo(BinaryReader reader, int codepage)
#endif
private static TagNode ReadTagNodeInfo(IBinaryReader reader, int codepage)
{
var name = reader.ReadString(32, codepage);
Matrix4x4 transformMatrix = GameBoxInterpreter.ToUnityMatrix4x4(new GameBoxMatrix4X4()
@@ -122,11 +102,7 @@ namespace Core.DataReader.Pol
};
}
#if USE_UNSAFE_BINARY_READER
private static PolMesh ReadMeshData(UnsafeBinaryReader reader, int version, int codepage)
#else
private static PolMesh ReadMeshData(BinaryReader reader, int version, int codepage)
#endif
private static PolMesh ReadMeshData(IBinaryReader reader, int version, int codepage)
{
var bounds = new Bounds();
bounds.SetMinMax(
@@ -235,20 +211,16 @@ namespace Core.DataReader.Pol
};
}
#if USE_UNSAFE_BINARY_READER
private static PolTexture ReadTextureInfo(UnsafeBinaryReader reader, int version, int codepage)
#else
private static PolTexture ReadTextureInfo(BinaryReader reader, int version, int codepage)
#endif
private static PolTexture ReadTextureInfo(IBinaryReader reader, int version, int codepage)
{
GameBoxBlendFlag blendFlag = (GameBoxBlendFlag)reader.ReadUInt32();
GameBoxMaterial material = new ()
{
Diffuse = Utility.ToColor(reader.ReadSingleArray(4)),
Ambient = Utility.ToColor(reader.ReadSingleArray(4)),
Specular = Utility.ToColor(reader.ReadSingleArray(4)),
Emissive = Utility.ToColor(reader.ReadSingleArray(4)),
Diffuse = Utility.ToColor(reader.ReadSingles(4)),
Ambient = Utility.ToColor(reader.ReadSingles(4)),
Specular = Utility.ToColor(reader.ReadSingles(4)),
Emissive = Utility.ToColor(reader.ReadSingles(4)),
SpecularPower = reader.ReadSingle()
};
@@ -0,0 +1,70 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
namespace Core.DataReader
{
using System;
using System.IO;
/// <summary>
/// Provides a safe way to read binary data from a stream or byte array.
/// </summary>
public sealed class SafeBinaryReader : IBinaryReader
{
private readonly BinaryReader _reader;
public SafeBinaryReader(byte[] data) : this (new MemoryStream(data)) { }
public SafeBinaryReader(Stream stream)
{
_reader = new BinaryReader(stream);
}
public void Seek(long offset, SeekOrigin seekOrigin)
{
_reader.BaseStream.Seek(offset, seekOrigin);
}
public long Position => _reader.BaseStream.Position;
public long Length => _reader.BaseStream.Length;
public Stream BaseStream => _reader.BaseStream;
public short ReadInt16() => _reader.ReadInt16();
public int ReadInt32() => _reader.ReadInt32();
public long ReadInt64() => _reader.ReadInt64();
public ushort ReadUInt16() => _reader.ReadUInt16();
public uint ReadUInt32() => _reader.ReadUInt32();
public ulong ReadUInt64() => _reader.ReadUInt64();
public float ReadSingle() => _reader.ReadSingle();
public double ReadDouble() => _reader.ReadDouble();
public bool ReadBoolean() => _reader.ReadBoolean();
public byte ReadByte() => _reader.ReadByte();
public byte[] ReadBytes(int count) => _reader.ReadBytes(count);
private bool _disposedValue;
private void Dispose(bool disposing)
{
if (!_disposedValue)
{
if (disposing)
{
GC.SuppressFinalize(this);
}
_reader.Dispose();
_disposedValue = true;
}
}
~SafeBinaryReader()
{
Dispose(disposing: false);
}
public void Dispose()
{
Dispose(disposing: true);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a5c4113470698e545a7f38b68b3032d8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -6,21 +6,11 @@
namespace Core.DataReader.Sce
{
using System.IO;
using Extensions;
public sealed class SceFileReader : IFileReader<SceFile>
{
private readonly int _codepage;
public SceFileReader(int codepage)
public SceFile Read(IBinaryReader reader, int codepage)
{
_codepage = codepage;
}
public SceFile Read(Stream stream)
{
using var reader = new BinaryReader(stream);
var header = reader.ReadChars(4);
var headerStr = new string(header[..^1]);
@@ -41,21 +31,21 @@ namespace Core.DataReader.Sce
var indexes = new SceIndex[numberOfBlocks];
for (var i = 0; i < numberOfBlocks; i++)
{
indexes[i] = ReadSceIndex(reader, _codepage);
indexes[i] = ReadSceIndex(reader, codepage);
}
var scriptBlocks = new SceScriptBlock[numberOfBlocks];
for (var i = 0; i < numberOfBlocks; i++)
{
scriptBlocks[i] = ReadScriptBlock(reader, indexes[i], _codepage);
scriptBlocks[i] = ReadScriptBlock(reader, indexes[i], codepage);
}
return new SceFile(indexes, scriptBlocks, _codepage);
return new SceFile(indexes, scriptBlocks, codepage);
}
private static SceScriptBlock ReadScriptBlock(BinaryReader reader, SceIndex sceIndex, int codepage)
private static SceScriptBlock ReadScriptBlock(IBinaryReader reader, SceIndex sceIndex, int codepage)
{
reader.BaseStream.Seek(sceIndex.Offset, SeekOrigin.Begin);
reader.Seek(sceIndex.Offset, SeekOrigin.Begin);
var id = reader.ReadUInt32();
var descriptionLength = reader.ReadUInt16();
@@ -80,7 +70,7 @@ namespace Core.DataReader.Sce
};
}
private static SceUserVarInfo ReadUserVarInfo(BinaryReader reader)
private static SceUserVarInfo ReadUserVarInfo(IBinaryReader reader)
{
var type = reader.ReadByte();
var length = reader.ReadUInt16();
@@ -93,7 +83,7 @@ namespace Core.DataReader.Sce
};
}
private static SceIndex ReadSceIndex(BinaryReader reader, int codepage)
private static SceIndex ReadSceIndex(IBinaryReader reader, int codepage)
{
return new SceIndex()
{
@@ -268,7 +268,7 @@ namespace Core.DataReader.Scn
public uint LoopAction;
// 移动速度
public uint Speed;
public uint GameBoxMoveSpeed;
[JsonIgnore]
public uint[] Reserved; // 29 DWORDs
@@ -13,17 +13,8 @@ namespace Core.DataReader.Scn
public sealed class ScnFileReader : IFileReader<ScnFile>
{
private readonly int _codepage;
public ScnFileReader(int codepage)
public ScnFile Read(IBinaryReader reader, int codepage)
{
_codepage = codepage;
}
public ScnFile Read(Stream stream)
{
using var reader = new BinaryReader(stream);
var header = reader.ReadChars(4);
var headerStr = new string(header[..^1]);
@@ -40,34 +31,34 @@ namespace Core.DataReader.Scn
var sceneInfo = new ScnSceneInfo()
{
CityName = reader.ReadString(32, _codepage),
SceneName = reader.ReadString(32, _codepage),
Model = reader.ReadString(32, _codepage),
CityName = reader.ReadString(32, codepage),
SceneName = reader.ReadString(32, codepage),
Model = reader.ReadString(32, codepage),
SceneType = (ScnSceneType) reader.ReadInt32(),
LightMap = reader.ReadInt32(),
SkyBox = reader.ReadUInt32(),
Reserved = reader.ReadUInt32Array(6),
Reserved = reader.ReadUInt32s(6),
};
reader.BaseStream.Seek(npcDataOffset, SeekOrigin.Begin);
reader.Seek(npcDataOffset, SeekOrigin.Begin);
var npcInfos = new ScnNpcInfo[numberOfNpc];
for (var i = 0; i < numberOfNpc; i++)
{
npcInfos[i] = ReadNpcInfo(reader, _codepage);
npcInfos[i] = ReadNpcInfo(reader, codepage);
}
reader.BaseStream.Seek(objectDataOffset, SeekOrigin.Begin);
reader.Seek(objectDataOffset, SeekOrigin.Begin);
var objInfos = new ScnObjectInfo[numberOfObjects];
for (var i = 0; i < numberOfObjects; i++)
{
ScnObjectInfo sceneObject = ReadObjectInfo(reader, _codepage);
ScnObjectInfo sceneObject = ReadObjectInfo(reader, codepage);
objInfos[i] = sceneObject;
}
return new ScnFile(sceneInfo, npcInfos, objInfos);
}
private static ScnNpcInfo ReadNpcInfo(BinaryReader reader, int codepage)
private static ScnNpcInfo ReadNpcInfo(IBinaryReader reader, int codepage)
{
return new ScnNpcInfo()
{
@@ -84,23 +75,23 @@ namespace Core.DataReader.Scn
ScriptId = reader.ReadUInt32(),
GameBoxYPosition = reader.ReadSingle(),
InitAction = reader.ReadString(16, codepage),
MonsterIds = reader.ReadUInt32Array(3),
MonsterIds = reader.ReadUInt32s(3),
NumberOfMonsters = reader.ReadByte(),
MonsterCanRespawn = reader.ReadByte(),
PaddingBytes = reader.ReadBytes(2), // Empty padding bytes to complete 4-byte alignment
Path = new ScnPath()
{
NumberOfWaypoints = reader.ReadInt32(),
GameBoxWaypoints = reader.ReadVector3Array(16)
GameBoxWaypoints = reader.ReadVector3s(16)
},
NoTurn = reader.ReadUInt32(),
LoopAction = reader.ReadUInt32(),
Speed = reader.ReadUInt32(),
Reserved = reader.ReadUInt32Array(29),
GameBoxMoveSpeed = reader.ReadUInt32(),
Reserved = reader.ReadUInt32s(29),
};
}
private static ScnObjectInfo ReadObjectInfo(BinaryReader reader, int codepage)
private static ScnObjectInfo ReadObjectInfo(IBinaryReader reader, int codepage)
{
var id = reader.ReadByte();
var initActive = reader.ReadByte();
@@ -124,15 +115,15 @@ namespace Core.DataReader.Scn
Bottom = reader.ReadInt32(),
};
var type = (ScnSceneObjectType) reader.ReadByte();
var type = (ScnSceneObjectType)reader.ReadByte();
var saveState = reader.ReadByte();
var layerIndex = reader.ReadByte();
var wuLing = reader.ReadByte();
#if PAL3
var parameters = reader.ReadInt32Array(6);
var parameters = reader.ReadInt32s(6);
#elif PAL3A
var parameters = Array.ConvertAll(reader.ReadSingleArray(6), Convert.ToInt32);
var parameters = Array.ConvertAll(reader.ReadSingles(6), Convert.ToInt32);
#endif
#if PAL3A
@@ -160,7 +151,7 @@ namespace Core.DataReader.Scn
var path = new ScnPath()
{
NumberOfWaypoints = reader.ReadInt32(),
GameBoxWaypoints = reader.ReadVector3Array(16)
GameBoxWaypoints = reader.ReadVector3s(16)
};
var linkedObjectId = reader.ReadUInt16();
@@ -191,9 +182,9 @@ namespace Core.DataReader.Scn
#endif
#if PAL3
var reserved = reader.ReadUInt32Array(52);
var reserved = reader.ReadUInt32s(52);
#elif PAL3A
var reserved = reader.ReadUInt32Array(44);
var reserved = reader.ReadUInt32s(44);
#endif
return new ScnObjectInfo()
@@ -1,5 +1,6 @@
fileFormatVersion: 2
guid: 447a6384f74b843dc8c19f6397c505f7
guid: 2ca33290fbdf242478def97a7e148404
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
@@ -0,0 +1,30 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
namespace Core.DataReader.Txt
{
using System;
public struct Task
{
public string Id;
public string Title;
public string Description;
public string Type;
public string IsLastOne;
public bool IsMainTask => string.Equals(Type, "0", StringComparison.Ordinal);
}
public sealed class TaskDefinitionFile
{
public Task[] Tasks { get; }
public TaskDefinitionFile(Task[] tasks)
{
Tasks = tasks;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: baa56f2f5ee41324d8370e11aa5fef0e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,61 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
namespace Core.DataReader.Txt
{
using System;
using System.Collections.Generic;
using System.Text;
public sealed class TaskDefinitionFileReader : IFileReader<TaskDefinitionFile>
{
public TaskDefinitionFile Read(IBinaryReader reader, int codepage)
{
throw new NotImplementedException();
}
public TaskDefinitionFile Read(byte[] data, int codepage)
{
var content = Encoding.GetEncoding(codepage).GetString(data, 0, data.Length);
var tasks = new List<Task>();
var taskLines = content.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
var currentTask = new Task();
foreach (var taskLine in taskLines)
{
if (taskLine.TrimStart().StartsWith(";")) continue;
var splitLine = taskLine.Split('$');
var tag = splitLine[0].Trim();
var value = splitLine.Length > 1 ? splitLine[1].Trim().Trim('$', '&') : string.Empty;
switch (tag)
{
case "tname":
currentTask.Id = value;
break;
case "title":
currentTask.Title = value;
break;
case "info":
currentTask.Description = value;
break;
case "type":
currentTask.Type = value;
break;
case "last":
currentTask.IsLastOne = value;
break;
case "#":
tasks.Add(currentTask);
currentTask = new Task(); // reset task for next one
break;
}
}
return new TaskDefinitionFile(tasks.ToArray());
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f6b1475871d9bd14184e47ffe848780f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -3,31 +3,72 @@
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
// Taken from: https://github.com/AnzhelikaO/FakeProvider/blob/version-1.4/FakeProvider/UnsafeBinaryReader.cs
// with some modifications
namespace Core.Utils
namespace Core.DataReader
{
using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using UnityEngine;
public sealed unsafe class UnsafeBinaryReader : IDisposable
/// <summary>
/// Provides a binary reader that reads primitive data types from a byte array or stream using unsafe code.
/// </summary>
public sealed unsafe class UnsafeBinaryReader : IBinaryReader
{
private byte* _dataPtr;
private GCHandle _handle;
private byte* _startPtr;
private byte* _dataPtr;
public UnsafeBinaryReader(byte[] data)
{
Init(data);
}
public UnsafeBinaryReader(Stream stream)
{
if (!stream.CanSeek)
{
throw new ArgumentException("Stream must be seekable", nameof(stream));
}
var length = stream.Length;
var data = new byte[length];
_ = stream.Read(data, 0, (int)length);
Init(data);
}
private void Init(byte[] data)
{
Length = data.Length;
_handle = GCHandle.Alloc(data, GCHandleType.Pinned);
fixed (byte* ptr = &data[0])
{
_startPtr = ptr;
_dataPtr = ptr;
}
}
public long Position => _dataPtr - _startPtr;
public long Length { get; private set; }
public void Seek(long offset, SeekOrigin seekOrigin)
{
switch (seekOrigin)
{
case SeekOrigin.Begin:
_dataPtr = _startPtr + offset;
break;
case SeekOrigin.Current:
_dataPtr += offset;
break;
case SeekOrigin.End:
throw new NotSupportedException("SeekOrigin.End is not supported for UnsafeBinaryReader");
default:
throw new ArgumentException("Invalid SeekOrigin", nameof(seekOrigin));
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public short ReadInt16()
{
@@ -76,7 +117,6 @@ namespace Core.Utils
return value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float ReadSingle()
{
@@ -93,18 +133,6 @@ namespace Core.Utils
return value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Vector2 ReadVector2()
{
return new Vector2(ReadSingle(), ReadSingle());
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Vector3 ReadVector3()
{
return new Vector3(ReadSingle(), ReadSingle(), ReadSingle());
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool ReadBoolean()
{
@@ -131,7 +159,7 @@ namespace Core.Utils
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float[] ReadSingleArray(int count)
public float[] ReadSingles(int count)
{
var value = new float[count];
Marshal.Copy(new IntPtr(_dataPtr), value, 0, count);
@@ -140,19 +168,39 @@ namespace Core.Utils
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public char[] ReadChars(int count)
public double[] ReadDoubles(int count)
{
return Encoding.ASCII.GetString(ReadBytes(count)).ToCharArray();
var value = new double[count];
Marshal.Copy(new IntPtr(_dataPtr), value, 0, count);
_dataPtr += count * 8;
return value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public string ReadString(int count, int codepage)
public short[] ReadInt16s(int count)
{
var strBytes = ReadBytes(count);
var i = 0;
var length = strBytes.Length;
while (i < length && strBytes[i] != 0) i++;
return Encoding.GetEncoding(codepage).GetString(strBytes, 0, i);
var value = new short[count];
Marshal.Copy(new IntPtr(_dataPtr), value, 0, count);
_dataPtr += count * 2;
return value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int[] ReadInt32s(int count)
{
var value = new int[count];
Marshal.Copy(new IntPtr(_dataPtr), value, 0, count);
_dataPtr += count * 4;
return value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public long[] ReadInt64s(int count)
{
var value = new long[count];
Marshal.Copy(new IntPtr(_dataPtr), value, 0, count);
_dataPtr += count * 8;
return value;
}
private bool _disposedValue;
@@ -1,106 +0,0 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
namespace Core.Extensions
{
using System.IO;
using System.Text;
using UnityEngine;
/// <summary>
/// BinaryReader extensions
/// </summary>
public static class BinaryReaderExtension
{
public static Vector3 ReadVector3(this BinaryReader binaryReader)
{
var x = binaryReader.ReadSingle();
var y = binaryReader.ReadSingle();
var z = binaryReader.ReadSingle();
return new Vector3(x, y, z);
}
public static Vector3[] ReadVector3Array(this BinaryReader binaryReader, int count)
{
var v3List = new Vector3[count];
for (var i = 0; i < count; i++)
{
v3List[i] = binaryReader.ReadVector3();
}
return v3List;
}
public static Vector2 ReadVector2(this BinaryReader binaryReader)
{
var x = binaryReader.ReadSingle();
var y = binaryReader.ReadSingle();
return new Vector2(x, y);
}
public static float[] ReadSingleArray(this BinaryReader binaryReader, int count)
{
var singles = new float[count];
for (var i = 0; i < count; i++)
{
singles[i] = binaryReader.ReadSingle();
}
return singles;
}
public static int[] ReadInt32Array(this BinaryReader binaryReader, int count)
{
var integers = new int[count];
for (var i = 0; i < count; i++)
{
integers[i] = binaryReader.ReadInt32();
}
return integers;
}
public static uint[] ReadUInt32Array(this BinaryReader binaryReader, int count)
{
var integers = new uint[count];
for (var i = 0; i < count; i++)
{
integers[i] = binaryReader.ReadUInt32();
}
return integers;
}
public static short[] ReadInt16Array(this BinaryReader binaryReader, int count)
{
var integers = new short[count];
for (var i = 0; i < count; i++)
{
integers[i] = binaryReader.ReadInt16();
}
return integers;
}
public static ushort[] ReadUInt16Array(this BinaryReader binaryReader, int count)
{
var integers = new ushort[count];
for (var i = 0; i < count; i++)
{
integers[i] = binaryReader.ReadUInt16();
}
return integers;
}
public static string ReadAsciiString(this BinaryReader binaryReader, int count)
{
return new string(binaryReader.ReadChars(count));
}
public static string ReadString(this BinaryReader binaryReader, int count, int codepage)
{
var strBytes = binaryReader.ReadBytes(count);
var i = 0;
var length = strBytes.Length;
while (i < length && strBytes[i] != 0) i++;
return Encoding.GetEncoding(codepage).GetString(strBytes, 0, i);
}
}
}
@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 460ba7b795404a459274bf99238f8518
timeCreated: 1641383661
+22 -15
View File
@@ -59,15 +59,15 @@ namespace Core.FileSystem
/// <param name="codepage">Codepage CPK file uses for encoding text info</param>
public void Mount(string cpkFileRelativePath, int codepage)
{
var cpkFileName = Path.GetFileName(cpkFileRelativePath).ToLower();
var cpkFileName = Utility.GetFileName(cpkFileRelativePath, Path.DirectorySeparatorChar).ToLower();
if (_cpkArchives.ContainsKey(cpkFileName))
{
Debug.LogWarning($"{cpkFileRelativePath} already mounted.");
Debug.LogWarning($"[{nameof(CpkFileSystem)}] {cpkFileRelativePath} already mounted.");
return;
}
Debug.Log($"CpkFileSystem mounting: {_rootPath + cpkFileRelativePath}");
Debug.Log($"[{nameof(CpkFileSystem)}] Mounting: {_rootPath + cpkFileRelativePath}");
var cpkArchive = new CpkArchive(_rootPath + cpkFileRelativePath, _crcHash, codepage);
cpkArchive.Init();
_cpkArchives[cpkFileName] = cpkArchive;
@@ -76,7 +76,7 @@ namespace Core.FileSystem
/// <summary>
/// Check if file exists in any of the segmented archives using virtual path.
/// </summary>
/// <param name="fileVirtualPath">File virtual path {Cpk file name}.cpk\{File relative path inside archive}</param>
/// <param name="fileVirtualPath">File virtual path {Cpk file name}\{File relative path inside archive}</param>
/// <param name="segmentedArchiveName">Name of the segmented archive if exists</param>
/// <returns>True if file exists in segmented archive</returns>
public bool FileExistsInSegmentedArchive(string fileVirtualPath, out string segmentedArchiveName)
@@ -108,7 +108,7 @@ namespace Core.FileSystem
/// <summary>
/// Check if file exists in the archive using virtual path.
/// </summary>
/// <param name="fileVirtualPath">File virtual path {Cpk file name}.cpk\{File relative path inside archive}
/// <param name="fileVirtualPath">File virtual path {Cpk file name}\{File relative path inside archive}
/// Example: music.cpk\music\PI01.mp3</param>
/// <returns>True if file exists</returns>
public bool FileExists(string fileVirtualPath)
@@ -168,12 +168,12 @@ namespace Core.FileSystem
{
if (_cpkArchives.ContainsKey(cpkFileName.ToLower()))
{
Debug.Log($"File system caching {cpkFileName} into memory.");
Debug.Log($"[{nameof(CpkFileSystem)}] Caching {cpkFileName} archive into memory.");
_cpkArchives[cpkFileName.ToLower()].LoadArchiveIntoMemory();
}
else
{
throw new Exception($"{cpkFileName} not mounted yet.");
throw new Exception($"{cpkFileName} archive not mounted yet.");
}
}
@@ -184,12 +184,12 @@ namespace Core.FileSystem
{
if (_cpkArchives.ContainsKey(cpkFileName.ToLower()))
{
Debug.Log($"File system disposing in-memory cache: {cpkFileName}");
Debug.Log($"[{nameof(CpkFileSystem)}] Disposing in-memory cache: {cpkFileName}");
_cpkArchives[cpkFileName.ToLower()].DisposeInMemoryArchive();
}
else
{
throw new Exception($"{cpkFileName} not mounted yet.");
throw new Exception($"{cpkFileName} archive not mounted yet.");
}
}
@@ -219,7 +219,7 @@ namespace Core.FileSystem
}
cpkArchive.ExtractTo(outputDir);
Debug.Log($"{cpkFileName} extracted to {outputDir}");
Debug.Log($"[{nameof(CpkFileSystem)}] {cpkFileName} extracted to {outputDir}");
}
}
@@ -236,7 +236,7 @@ namespace Core.FileSystem
{
var rootNodes = archive.Value.GetRootEntries();
results.Add(from result in SearchInternal(rootNodes, keyword)
select archive.Key + CpkConstants.DirectorySeparator + result);
select archive.Key + CpkConstants.DirectorySeparatorChar + result);
});
var resultList = new List<string>();
@@ -247,14 +247,21 @@ namespace Core.FileSystem
return resultList;
}
/// <summary>
/// Parse file virtual path into cpk file name and relative virtual path.
/// </summary>
/// <param name="fullVirtualPath">File virtual path {Cpk file name}\{File relative path inside archive}</param>
/// <param name="cpkFileName">{Cpk file name}</param>
/// <param name="relativeVirtualPath">{File relative path inside archive}</param>
private void ParseFileVirtualPath(string fullVirtualPath, out string cpkFileName, out string relativeVirtualPath)
{
if (!fullVirtualPath.Contains(CpkConstants.DirectorySeparator))
if (!fullVirtualPath.Contains(CpkConstants.DirectorySeparatorChar))
{
throw new ArgumentException($"File virtual path is invalid: {fullVirtualPath}.");
throw new ArgumentException($"[{nameof(CpkFileSystem)}] File virtual path is invalid: {fullVirtualPath}.");
}
cpkFileName = fullVirtualPath[..fullVirtualPath.IndexOf(CpkConstants.DirectorySeparator)].ToLower();
relativeVirtualPath = fullVirtualPath[(fullVirtualPath.IndexOf(CpkConstants.DirectorySeparator) + 1)..];
cpkFileName = fullVirtualPath[..fullVirtualPath.IndexOf(CpkConstants.DirectorySeparatorChar)].ToLower();
relativeVirtualPath = fullVirtualPath[(fullVirtualPath.IndexOf(CpkConstants.DirectorySeparatorChar) + 1)..];
}
private IEnumerable<string> SearchInternal(IEnumerable<CpkEntry> nodes, string keyword)
@@ -6,7 +6,6 @@
namespace Core.FileSystem
{
using System.Collections.Generic;
using System.IO;
/// <summary>
/// File system wrapper for CPack archives
@@ -29,7 +28,7 @@ namespace Core.FileSystem
/// <summary>
/// Check if file exists in any of the segmented archives using virtual path.
/// </summary>
/// <param name="fileVirtualPath">File virtual path {Cpk file name}.cpk\{File relative path inside archive}</param>
/// <param name="fileVirtualPath">File virtual path {Cpk file name}\{File relative path inside archive}</param>
/// <param name="segmentedArchiveName">Name of the segmented archive if exists</param>
/// <returns>True if file exists in segmented archive</returns>
public bool FileExistsInSegmentedArchive(string fileVirtualPath, out string segmentedArchiveName);
@@ -37,7 +36,7 @@ namespace Core.FileSystem
/// <summary>
/// Check if file exists in the archive using virtual path.
/// </summary>
/// <param name="fileVirtualPath">File virtual path {Cpk file name}.cpk\{File relative path inside archive}
/// <param name="fileVirtualPath">File virtual path {Cpk file name}\{File relative path inside archive}
/// Example: music.cpk\music\PI01.mp3</param>
/// <returns>True if file exists</returns>
public bool FileExists(string fileVirtualPath);
+12 -3
View File
@@ -30,7 +30,7 @@ namespace Core.Services
{
if (!_services.ContainsKey(typeof(T)))
{
string error = $"{typeof(T)} not registered with {GetType().Name}";
string error = $"[{nameof(ServiceLocator)}] {typeof(T)} is not registered with name: {GetType().Name}";
Debug.LogError(error);
throw new InvalidOperationException(error);
}
@@ -50,9 +50,13 @@ namespace Core.Services
if (_services.ContainsKey(typeof(T)))
{
Debug.LogWarning($"{typeof(T)} already registered.");
Debug.LogWarning($"[{nameof(ServiceLocator)}] {typeof(T)} already registered.");
return;
}
else
{
Debug.Log($"[{nameof(ServiceLocator)}] Service type {typeof(T)} registered.");
}
_services.Add(typeof(T), service);
}
@@ -65,9 +69,13 @@ namespace Core.Services
{
if (!_services.ContainsKey(typeof(T)))
{
Debug.LogWarning($"Failed to unregister since {typeof(T)} is not registered yet.");
Debug.LogWarning($"[{nameof(ServiceLocator)}] Failed to unregister service since {typeof(T)} is not registered yet.");
return;
}
else
{
Debug.Log($"[{nameof(ServiceLocator)}] Service type {typeof(T)} unregistered.");
}
_services.Remove(typeof(T));
}
@@ -77,6 +85,7 @@ namespace Core.Services
/// </summary>
public void UnregisterAll()
{
Debug.Log($"[{nameof(ServiceLocator)}] All services unregistered.");
_services.Clear();
}
}
+1 -1
View File
@@ -9,7 +9,7 @@ namespace Core.Utils
public class FpsCounter : MonoBehaviour
{
private const float UPDATE_INTERVAL = 0.2f;
private const float UPDATE_INTERVAL = 0.3f;
private int _frameCount = 0;
private float _deltaTime = 0f;
@@ -5,12 +5,13 @@
namespace Core.Utils
{
using System;
using System.Collections.Generic;
using UnityEngine;
public static class UnitySupportedVideoFormats
{
public static readonly HashSet<string> WindowsSupportedVideoFormats = new()
public static readonly HashSet<string> WindowsSupportedVideoFormats = new (StringComparer.OrdinalIgnoreCase)
{
".asf",
".avi",
@@ -26,7 +27,7 @@ namespace Core.Utils
".wmv",
};
public static readonly HashSet<string> MacOSSupportedVideoFormats = new()
public static readonly HashSet<string> MacOSSupportedVideoFormats = new (StringComparer.OrdinalIgnoreCase)
{
".dv",
".m4v",
@@ -39,20 +40,20 @@ namespace Core.Utils
".webm",
};
public static readonly HashSet<string> LinuxSupportedVideoFormats = new()
public static readonly HashSet<string> LinuxSupportedVideoFormats = new (StringComparer.OrdinalIgnoreCase)
{
".ogv",
".vp8",
".webm",
};
public static readonly HashSet<string> AndroidSupportedVideoFormats = new()
public static readonly HashSet<string> AndroidSupportedVideoFormats = new (StringComparer.OrdinalIgnoreCase)
{
".webm",
".mp4",
};
public static readonly HashSet<string> iOSSupportedVideoFormats = new()
public static readonly HashSet<string> iOSSupportedVideoFormats = new (StringComparer.OrdinalIgnoreCase)
{
".webm",
".mp4",
@@ -67,7 +68,7 @@ namespace Core.Utils
RuntimePlatform.LinuxPlayer or RuntimePlatform.LinuxEditor => LinuxSupportedVideoFormats,
RuntimePlatform.IPhonePlayer => iOSSupportedVideoFormats,
RuntimePlatform.Android => AndroidSupportedVideoFormats,
_ => new HashSet<string> {".mp4" }
_ => new HashSet<string> (StringComparer.OrdinalIgnoreCase) {".mp4" }
};
}
}
+46 -25
View File
@@ -23,22 +23,22 @@ namespace Core.Utils
return new Color(rgba[0], rgba[1], rgba[2], rgba[3]);
}
public static unsafe void ApplyTransparencyBasedOnColorLuminance(Texture2D texture)
{
var pixels = texture.GetPixels();
fixed (float* src = &pixels[0].r)
{
var p = src;
for (var i = 0; i < texture.width * texture.height; i++, p += 4)
{
*(p + 3) = 0.299f * *p + 0.587f * *(p + 1) + 0.114f * *(p + 2);
}
}
texture.SetPixels(pixels);
texture.Apply();
}
// public static unsafe void ApplyTransparencyBasedOnColorLuminance(Texture2D texture)
// {
// var pixels = texture.GetPixels();
//
// fixed (float* src = &pixels[0].r)
// {
// var p = src;
// for (var i = 0; i < texture.width * texture.height; i++, p += 4)
// {
// *(p + 3) = 0.299f * *p + 0.587f * *(p + 1) + 0.114f * *(p + 2);
// }
// }
//
// texture.SetPixels(pixels);
// texture.Apply(updateMipmaps: false);
// }
public static T ReadStruct<T>(Stream stream) where T : struct
{
@@ -116,20 +116,18 @@ namespace Core.Utils
b = (byte) ((temp / 32 + temp) / 32);
}
public static string GetRelativeDirectoryPath(string filePath,
char directoryPathSeparator = CpkConstants.DirectorySeparator)
public static string GetDirectoryName(string filePath, char directorySeparatorChar)
{
return !filePath.Contains(directoryPathSeparator) ?
return !filePath.Contains(directorySeparatorChar) ?
string.Empty :
filePath[..filePath.LastIndexOf(directoryPathSeparator)];
filePath[..filePath.LastIndexOf(directorySeparatorChar)];
}
public static string GetFileName(string filePath,
char directoryPathSeparator = CpkConstants.DirectorySeparator)
public static string GetFileName(string filePath, char directorySeparatorChar)
{
return !filePath.Contains(directoryPathSeparator) ?
return !filePath.Contains(directorySeparatorChar) ?
string.Empty :
filePath[(filePath.LastIndexOf(directoryPathSeparator)+1)..];
filePath[(filePath.LastIndexOf(directorySeparatorChar)+1)..];
}
public static bool IsHandheldDevice()
@@ -220,7 +218,14 @@ namespace Core.Utils
Debug.DrawLine(p4, p8, Color.cyan, duration);
}
public static bool IsAndroidDeviceAndSdkVersionLowerThanOrEqualTo(int sdkVersion)
public static bool IsLegacyMobileDevice()
{
if (IsAndroidDeviceAndSdkVersionLowerThanOrEqualTo(23)) return true;
// TODO: Add iOS legacy mobile device check etc
return false;
}
private static bool IsAndroidDeviceAndSdkVersionLowerThanOrEqualTo(int sdkVersion)
{
if (Application.platform != RuntimePlatform.Android) return false;
@@ -246,5 +251,21 @@ namespace Core.Utils
return false;
}
public static bool IsVersionGreater(string latestVersion, string currentVersion)
{
string[] latestParts = latestVersion.Split('.');
string[] currentParts = currentVersion.Split('.');
for (var i = 0; i < Math.Min(latestParts.Length, currentParts.Length); i++)
{
int latest = int.Parse(latestParts[i]);
int current = int.Parse(currentParts[i]);
if (latest == current) continue;
return latest > current;
}
return latestParts.Length > currentParts.Length;
}
}
}
+2 -2
View File
@@ -26,7 +26,7 @@ namespace Editor
ApplyPlayerSettingsForVariant("PAL3");
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
Debug.Log("Switched to PAL3");
Debug.Log($"[{nameof(GameVariantSwitcher)}] Switched to PAL3");
}
#if PAL3
@@ -51,7 +51,7 @@ namespace Editor
ApplyPlayerSettingsForVariant("PAL3A");
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
Debug.Log("Switched to PAL3A");
Debug.Log($"[{nameof(GameVariantSwitcher)}] Switched to PAL3A");
}
#if PAL3
+25 -27
View File
@@ -25,7 +25,7 @@ namespace Editor
Windows_x86 = 1 << 0,
Windows_x64 = 1 << 1,
Linux_x86_x64 = 1 << 2,
MacOS_arm64_x64 = 1 << 3,
macOS_arm64_x64 = 1 << 3,
Android = 1 << 4,
iOS = 1 << 5,
}
@@ -34,7 +34,7 @@ namespace Editor
{
private static readonly string[] BuildLevels = { "Assets/Scenes/Game.unity" };
private static readonly char PathSeparator = Path.DirectorySeparatorChar;
private static readonly char DirSeparator = Path.DirectorySeparatorChar;
#if PAL3
[MenuItem("PAL3/Build Pipelines/Build [Windows_x86] IL2CPP Release Executable")]
@@ -67,13 +67,13 @@ namespace Editor
}
#if PAL3
[MenuItem("PAL3/Build Pipelines/Build [MacOS_arm64_x64] IL2CPP XCode Project")]
[MenuItem("PAL3/Build Pipelines/Build [macOS_arm64_x64] IL2CPP XCode Project")]
#elif PAL3A
[MenuItem("PAL3A/Build Pipelines/Build [MacOS_arm64_x64] IL2CPP XCode Project")]
[MenuItem("PAL3A/Build Pipelines/Build [macOS_arm64_x64] IL2CPP XCode Project")]
#endif
public static void Build_MacOS_arm64_x64()
public static void Build_macOS_arm64_x64()
{
BuildGame(Pal3BuildTarget.MacOS_arm64_x64);
BuildGame(Pal3BuildTarget.macOS_arm64_x64);
}
#if PAL3
@@ -97,16 +97,16 @@ namespace Editor
}
#if PAL3
[MenuItem("PAL3/Build Pipelines/Build All [Windows, Linux, MacOS, Android, iOS]")]
[MenuItem("PAL3/Build Pipelines/Build All [Windows, Linux, macOS, Android, iOS]")]
#elif PAL3A
[MenuItem("PAL3A/Build Pipelines/Build All [Windows, Linux, MacOS, Android, iOS]")]
[MenuItem("PAL3A/Build Pipelines/Build All [Windows, Linux, macOS, Android, iOS]")]
#endif
public static void BuildAll()
{
BuildGame(Pal3BuildTarget.Windows_x86 |
Pal3BuildTarget.Windows_x64 |
Pal3BuildTarget.Linux_x86_x64 |
Pal3BuildTarget.MacOS_arm64_x64 |
Pal3BuildTarget.macOS_arm64_x64 |
Pal3BuildTarget.Android |
Pal3BuildTarget.iOS);
}
@@ -127,17 +127,16 @@ namespace Editor
BuildTarget targetBeforeBuild = EditorUserBuildSettings.activeBuildTarget;
string buildOutputPath = EditorUtility.SaveFolderPanel("Choose Location of Built Game", "", "");
if (string.IsNullOrWhiteSpace(buildOutputPath)) return;
if (string.IsNullOrEmpty(buildOutputPath)) return;
buildOutputPath += $"{PathSeparator}{PlayerSettings.bundleVersion}{PathSeparator}";
buildOutputPath += $"{DirSeparator}{PlayerSettings.bundleVersion}{DirSeparator}";
var buildConfigurations = new[]
{
new { Platform = Pal3BuildTarget.Windows_x86, Extension = ".exe", Group = BuildTargetGroup.Standalone, Target = BuildTarget.StandaloneWindows },
new { Platform = Pal3BuildTarget.Windows_x64, Extension = ".exe", Group = BuildTargetGroup.Standalone, Target = BuildTarget.StandaloneWindows64 },
new { Platform = Pal3BuildTarget.Linux_x86_x64, Extension = "", Group = BuildTargetGroup.Standalone, Target = BuildTarget.StandaloneLinux64 },
new { Platform = Pal3BuildTarget.MacOS_arm64_x64, Extension = "", Group = BuildTargetGroup.Standalone, Target = BuildTarget.StandaloneOSX },
new { Platform = Pal3BuildTarget.macOS_arm64_x64, Extension = "", Group = BuildTargetGroup.Standalone, Target = BuildTarget.StandaloneOSX },
new { Platform = Pal3BuildTarget.Android, Extension = ".apk", Group = BuildTargetGroup.Android, Target = BuildTarget.Android },
new { Platform = Pal3BuildTarget.iOS, Extension = "", Group = BuildTargetGroup.iOS, Target = BuildTarget.iOS },
};
@@ -163,7 +162,7 @@ namespace Editor
// Execute report log actions
logActions.ForEach(action => action.Invoke());
Debug.Log($"Build for version {PlayerSettings.bundleVersion} complete! Output path: " +
Debug.Log($"[{nameof(ReleaseBuildPipeline)}] Build for version {PlayerSettings.bundleVersion} complete! Output path: " +
$"{buildOutputPath}{GameConstants.AppName}");
}
@@ -175,14 +174,14 @@ namespace Editor
List<Action> logActions,
bool deletePdbFiles = true)
{
string outputFolder = buildOutputPath + $"{GameConstants.AppName}{PathSeparator}" +
$"{folderName}{PathSeparator}";
string outputFolder = buildOutputPath + $"{GameConstants.AppName}{DirSeparator}" +
$"{folderName}{DirSeparator}";
if (buildTarget is BuildTarget.StandaloneWindows
or BuildTarget.StandaloneWindows64
or BuildTarget.StandaloneLinux64)
{
outputFolder += $"{GameConstants.AppName}{PathSeparator}";
outputFolder += $"{GameConstants.AppName}{DirSeparator}";
}
else if (buildTarget is BuildTarget.StandaloneOSX)
{
@@ -212,7 +211,7 @@ namespace Editor
switch (report.summary.result)
{
case BuildResult.Succeeded:
string successReport = $"Build [{report.summary.platform}] succeeded. " +
string successReport = $"[{nameof(ReleaseBuildPipeline)}] Build [{report.summary.platform}] succeeded. " +
$"Finished in {report.summary.totalTime.TotalMinutes:F2} minutes. " +
$"Build size: {(report.summary.totalSize / 1024f / 1024f):F2} MB";
logActions.Add(() => Debug.Log(successReport));
@@ -236,8 +235,7 @@ namespace Editor
{
string buildOutputPath = EditorUtility.SaveFolderPanel("Choose Location of Built Game",
$"{PlayerSettings.bundleVersion}", $"{PlayerSettings.bundleVersion}");
if (string.IsNullOrEmpty(buildOutputPath)) return;
if (string.IsNullOrWhiteSpace(buildOutputPath)) return;
if (!buildOutputPath.EndsWith($"{PlayerSettings.bundleVersion}"))
{
@@ -246,22 +244,22 @@ namespace Editor
return;
}
string releaseDirPath = $"{buildOutputPath}{PathSeparator}Release";
string releaseDirPath = $"{buildOutputPath}{DirSeparator}Release";
Directory.CreateDirectory(releaseDirPath);
List<(string FolderPath, Pal3BuildTarget Target)> buildTargets = new()
{
($"{GameConstants.AppName}{PathSeparator}{Pal3BuildTarget.Android.ToString()}{PathSeparator}{GameConstants.AppName}.apk", Pal3BuildTarget.Android),
($"{GameConstants.AppName}{PathSeparator}{Pal3BuildTarget.Windows_x86.ToString()}", Pal3BuildTarget.Windows_x86),
($"{GameConstants.AppName}{PathSeparator}{Pal3BuildTarget.Windows_x64.ToString()}", Pal3BuildTarget.Windows_x64),
($"{GameConstants.AppName}{PathSeparator}{Pal3BuildTarget.Linux_x86_x64.ToString()}", Pal3BuildTarget.Linux_x86_x64)
($"{GameConstants.AppName}{DirSeparator}{Pal3BuildTarget.Android.ToString()}{DirSeparator}{GameConstants.AppName}.apk", Pal3BuildTarget.Android),
($"{GameConstants.AppName}{DirSeparator}{Pal3BuildTarget.Windows_x86.ToString()}", Pal3BuildTarget.Windows_x86),
($"{GameConstants.AppName}{DirSeparator}{Pal3BuildTarget.Windows_x64.ToString()}", Pal3BuildTarget.Windows_x64),
($"{GameConstants.AppName}{DirSeparator}{Pal3BuildTarget.Linux_x86_x64.ToString()}", Pal3BuildTarget.Linux_x86_x64)
};
foreach ((string folderPath, Pal3BuildTarget target) in buildTargets)
{
string fullPath = $"{buildOutputPath}{PathSeparator}{folderPath}";
string fullPath = $"{buildOutputPath}{DirSeparator}{folderPath}";
string zipFileName = $"{GameConstants.AppName}_v{PlayerSettings.bundleVersion}_{target.ToString()}.zip";
string zipFilePath = $"{releaseDirPath}{PathSeparator}{zipFileName}";
string zipFilePath = $"{releaseDirPath}{DirSeparator}{zipFileName}";
if (File.Exists(fullPath) || Directory.Exists(fullPath))
{
@@ -48,7 +48,7 @@ namespace Editor.SourceGenerator
var commands = Utility.GetTypesOfInterface(commandInterfaceType)
.Where(IsCommandAvailableInConsole).ToArray();
Debug.Log($"Found {commands.Length} available console commands");
Debug.Log($"[{nameof(ConsoleCommandsAutoGen<TCommand>)}] Found {commands.Length} available console commands");
for (var i = 0; i < commands.Length; i++)
{
@@ -46,11 +46,11 @@ namespace Editor
{
if (!overwrite && File.Exists(writePath))
{
Debug.LogError($"File already generated: {writePath}\n");
Debug.LogError($"[{nameof(SourceGeneratorEditorOptions)}] File already generated: {writePath}\n");
return;
}
Debug.Log("Generating source file: " + writePath);
Debug.Log($"[{nameof(SourceGeneratorEditorOptions)}] Generating source file: " + writePath);
var writer = new CodeWriter
{
@@ -67,7 +67,7 @@ namespace Editor
using StreamWriter sw = new StreamWriter(writePath);
sw.Write(output);
Debug.Log($"{fileName} generated.");
Debug.Log($"[{nameof(SourceGeneratorEditorOptions)}] {fileName} generated.");
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
+23 -1
View File
@@ -6,6 +6,7 @@
namespace Pal3.Actor
{
using Core.DataReader.Scn;
using Core.GameBox;
using Data;
using MetaData;
using UnityEngine;
@@ -66,7 +67,7 @@ namespace Pal3.Actor
return ActorConstants.ActionToNameMap[ActorActionType.NpcStand2];
}
Debug.LogError($"No default idle animation found for {Info.Id}_{Info.Name}");
Debug.LogError($"[{nameof(Actor)}] No default idle animation found for {Info.Id}_{Info.Name}");
return ActorConstants.ActionToNameMap[ActorActionType.NpcStand1];
}
@@ -105,6 +106,27 @@ namespace Pal3.Actor
value : null;
}
public float GetMoveSpeed(MovementMode movementMode)
{
if (Info.GameBoxMoveSpeed > 0)
{
return Info.GameBoxMoveSpeed / GameBoxInterpreter.GameBoxUnitToUnityUnit;
}
if (Info.Kind == ScnActorKind.MainActor)
{
return movementMode == MovementMode.Run
? ActorConstants.PlayerActorRunSpeed
: ActorConstants.PlayerActorWalkSpeed;
}
else
{
return movementMode == MovementMode.Run
? ActorConstants.NpcActorRunSpeed
: ActorConstants.NpcActorWalkSpeed;
}
}
public float GetInteractionMaxDistance()
{
return Info.Kind switch
@@ -291,7 +291,7 @@ namespace Pal3.Actor
{
if (!_actor.IsActive && !_actor.IsMainActor())
{
Debug.LogError($"Failed to perform action since actor {command.ActorId} is inactive.");
Debug.LogError($"[{nameof(ActorActionController)}] Failed to perform action since actor {command.ActorId} is inactive.");
return;
}
@@ -336,7 +336,7 @@ namespace Pal3.Actor
}
else if (command.NewState == GameState.Gameplay)
{
PlayerActorId playerActor = ServiceLocator.Instance.Get<PlayerManager>().GetPlayerActor();
PlayerActorId playerActor = ServiceLocator.Instance.Get<PlayerActorManager>().GetPlayerActor();
_isKinematic = _actor.Info.Id != (byte)playerActor;
}
+1 -1
View File
@@ -172,7 +172,7 @@ namespace Pal3.Actor
if (_actor.Info.Kind == ScnActorKind.CombatNpc &&
(_actor.Info.MonsterIds[0] != 0 || _actor.Info.MonsterIds[1] != 0 || _actor.Info.MonsterIds[2] != 0) &&
collision.gameObject.GetComponent<ActorController>() is {} actorController &&
(byte) ServiceLocator.Instance.Get<PlayerManager>()
(byte) ServiceLocator.Instance.Get<PlayerActorManager>()
.GetPlayerActor() == actorController.GetActor().Info.Id)
{
// Player actor collides with combat NPC in maze
@@ -405,7 +405,7 @@ namespace Pal3.Actor
SetNavLayer(layerIndex);
transform.position = position;
Debug.LogWarning($"Portal to standing platform: {position}, " +
Debug.LogWarning($"[{nameof(ActorMovementController)}] Portal to standing platform: {position}, " +
$"layer: {layerIndex}");
}
else if (_tilemap.TryGetTile(position, layerIndex, out NavTile tile) && tile.IsWalkable())
@@ -419,7 +419,7 @@ namespace Pal3.Actor
position.z);
Vector2Int tilePosition = _tilemap.GetTilePosition(position, layerIndex);
Debug.LogWarning($"Portal to: {position}, " +
Debug.LogWarning($"[{nameof(ActorMovementController)}] Portal to: {position}, " +
$"layer: {layerIndex}, " +
$"tile: {tilePosition} DistanceToNearestObstacle: {tile.DistanceToNearestObstacle}, FloorKind: {tile.FloorKind}");
}
@@ -467,8 +467,7 @@ namespace Pal3.Actor
Transform currentTransform = transform;
Vector3 currentPosition = currentTransform.position;
// TODO: Use speed info from datascript\scene.txt file when _actor.Info.Speed == 0
var moveSpeed = _actor.Info.Speed <= 0 ? (movementMode == MovementMode.Run ? 11f : 5f) : _actor.Info.Speed / 11f;
float moveSpeed = _actor.GetMoveSpeed(movementMode);
if (!_actor.IsMainActor()) moveSpeed /= 2f;
@@ -784,7 +783,7 @@ namespace Pal3.Actor
else
{
_movementWaiter?.CancelWait();
Debug.LogError($"Failed to find path from tile position {fromTilePosition} " +
Debug.LogError($"[{nameof(ActorMovementController)}] Failed to find path from tile position {fromTilePosition} " +
$"to tile position: {toTilePosition}");
}
yield break;
@@ -9,6 +9,7 @@ namespace Pal3.Actor
using Command;
using Command.SceCommands;
using Core.DataLoader;
using Core.DataReader.Cpk;
using Core.DataReader.Mov;
using Core.DataReader.Msh;
using Core.DataReader.Mtl;
@@ -73,7 +74,7 @@ namespace Pal3.Actor
if (!_actor.HasAction(actionName))
{
Debug.LogError($"Action {actionName} not found for actor {_actor.Info.Name}.");
Debug.LogError($"[{nameof(SkeletalAnimationActorActionController)}] Action {actionName} not found for actor {_actor.Info.Name}.");
waiter?.CancelWait();
return;
}
@@ -94,11 +95,11 @@ namespace Pal3.Actor
movFile = _resourceProvider.GetGameResourceFile<MovFile>(movFilePath);
textureProvider = _resourceProvider.CreateTextureResourceProvider(
Utility.GetRelativeDirectoryPath(mtlFilePath));
Utility.GetDirectoryName(mtlFilePath, CpkConstants.DirectorySeparatorChar));
}
catch (Exception ex)
{
Debug.LogError(ex);
Debug.LogError($"[{nameof(SkeletalAnimationActorActionController)}] Exception: {ex}");
waiter?.CancelWait();
return;
}
@@ -10,6 +10,7 @@ namespace Pal3.Actor
using Command.InternalCommands;
using Command.SceCommands;
using Core.DataLoader;
using Core.DataReader.Cpk;
using Core.DataReader.Mv3;
using Core.DataReader.Pol;
using Core.DataReader.Scn;
@@ -97,7 +98,7 @@ namespace Pal3.Actor
if (!_actor.HasAction(actionName))
{
Debug.LogError($"Action {actionName} not found for actor {_actor.Info.Name}.");
Debug.LogError($"[{nameof(VertexAnimationActorActionController)}] Action {actionName} not found for actor {_actor.Info.Name}.");
_animationLoopPointWaiter?.CancelWait();
waiter?.CancelWait();
return;
@@ -110,11 +111,11 @@ namespace Pal3.Actor
string mv3FilePath = _actor.GetActionFilePath(actionName);
mv3File = _resourceProvider.GetGameResourceFile<Mv3File>(mv3FilePath);
textureProvider = _resourceProvider.CreateTextureResourceProvider(
Utility.GetRelativeDirectoryPath(mv3FilePath));
Utility.GetDirectoryName(mv3FilePath, CpkConstants.DirectorySeparatorChar));
}
catch (Exception ex)
{
Debug.LogError(ex);
Debug.LogError($"[{nameof(VertexAnimationActorActionController)}] Exception: {ex}");
_animationLoopPointWaiter?.CancelWait();
waiter?.CancelWait();
return;
@@ -136,7 +137,7 @@ namespace Pal3.Actor
string weaponPath = FileConstants.GetWeaponModelFileVirtualPath(weaponName);
PolFile polFile = _resourceProvider.GetGameResourceFile<PolFile>(weaponPath);
ITextureResourceProvider weaponTextureProvider = _resourceProvider.CreateTextureResourceProvider(
Utility.GetRelativeDirectoryPath(weaponPath));
Utility.GetDirectoryName(weaponPath, CpkConstants.DirectorySeparatorChar));
_mv3ModelRenderer.Init(mv3File,
_materialFactory,
textureProvider,
+5 -29
View File
@@ -57,8 +57,6 @@ namespace Pal3.Audio
private CancellationTokenSource _sceneAudioCts = new ();
private AudioClip _themeMusicClip;
public void Init(Camera mainCamera,
GameResourceProvider resourceProvider,
SceneManager sceneManager,
@@ -73,11 +71,6 @@ namespace Pal3.Audio
_musicVolume = _gameSettings.MusicVolume;
_sfxVolume = _gameSettings.SfxVolume;
// Load and play the theme music on init
_themeMusicClip = Requires.IsNotNull(
Resources.Load<AudioClip>($"Music/{GameConstants.AppName}-Theme"),
$"Music/{GameConstants.AppName}-Theme");
}
private void OnEnable()
@@ -90,14 +83,6 @@ namespace Pal3.Audio
CommandExecutorRegistry<ICommand>.Instance.UnRegister(this);
}
public void PlayThemeMusic()
{
_musicPlayer.clip = _themeMusicClip;
_musicPlayer.volume = _musicVolume;
_musicPlayer.loop = true;
_musicPlayer.Play();
}
public void Execute(SettingChangedNotification command)
{
if (command.SettingName == nameof(_gameSettings.MusicVolume))
@@ -113,15 +98,15 @@ namespace Pal3.Audio
private IEnumerator PlaySceneMusicAsync(string cityName, string sceneName)
{
var key = $"{cityName}_{sceneName}";
var musicName = string.Empty;
if (MusicConstants.SceneMusicInfo.ContainsKey(key.ToLower()))
if (MusicConstants.SceneMusicInfo.TryGetValue($"{cityName}_{sceneName}".ToLower(), out var sceneMusic))
{
musicName = MusicConstants.SceneMusicInfo[key.ToLower()];
musicName = sceneMusic;
}
else if (MusicConstants.SceneMusicInfo.ContainsKey(cityName.ToLower()))
else if (MusicConstants.SceneMusicInfo.TryGetValue(cityName.ToLower(), out var sceneCityMusic))
{
musicName = MusicConstants.SceneMusicInfo[cityName.ToLower()];
musicName = sceneCityMusic;
}
if (string.IsNullOrEmpty(musicName) || musicName.Equals(STOP_MUSIC_NAME))
@@ -158,10 +143,6 @@ namespace Pal3.Audio
if (audioSource.clip != null)
{
audioSource.Stop();
if (audioSource.clip != _themeMusicClip)
{
Destroy(audioSource.clip);
}
}
audioSource.clip = audioClip;
@@ -293,11 +274,6 @@ namespace Pal3.Audio
if (audioSourceParentTransform.GetComponent<AudioSource>() is { } audioSource)
{
audioSource.Stop();
if (audioSource.clip != null)
{
Destroy(audioSource.clip);
}
}
Destroy(audioSourceParentTransform.gameObject);
+7 -9
View File
@@ -481,11 +481,8 @@ namespace Pal3.Camera
Vector3 cameraFacingDirection = (cameraRotation * Vector3.forward).normalized;
Vector3 cameraPosition = _lastLookAtPoint + cameraFacingDirection * -cameraDistance + yOffset;
Transform cameraTransform = _camera.transform;
cameraTransform.rotation = cameraRotation;
cameraTransform.position = cameraPosition;
_cameraOffset = cameraTransform.position - _lastLookAtPoint;
_camera.transform.SetPositionAndRotation(cameraPosition, cameraRotation);
_cameraOffset = cameraPosition - _lastLookAtPoint;
}
public void Execute(CameraSetDefaultTransformCommand command)
@@ -511,11 +508,12 @@ namespace Pal3.Camera
command.GameBoxXPosition,
command.GameBoxYPosition,
command.GameBoxZPosition));
Transform cameraTransform = _camera.transform;
cameraTransform.position = cameraPosition;
cameraTransform.rotation = GameBoxInterpreter.ToUnityRotation(command.Pitch, command.Yaw, 0f);
Quaternion cameraRotation = GameBoxInterpreter.ToUnityRotation(command.Pitch, command.Yaw, 0f);
_lastLookAtPoint = cameraTransform.position +
Transform cameraTransform = _camera.transform;
cameraTransform.SetPositionAndRotation(cameraPosition, cameraRotation);
_lastLookAtPoint = cameraPosition +
cameraTransform.forward * GameBoxInterpreter.ToUnityDistance(command.GameBoxDistance);
_cameraOffset = cameraPosition - _lastLookAtPoint;
@@ -11,6 +11,10 @@ namespace Pal3.Command
using System.Reflection;
using UnityEngine;
/// <summary>
/// A generic class that dispatches commands to their registered executors.
/// </summary>
/// <typeparam name="TCommand">The type of command to dispatch.</typeparam>
public class CommandDispatcher<TCommand>
{
public static CommandDispatcher<TCommand> Instance
@@ -48,7 +52,7 @@ namespace Pal3.Command
}
else if (Attribute.GetCustomAttribute(typeof(T), typeof(SceCommandAttribute)) != null)
{
Debug.LogWarning($"No command executor found for sce command: {typeof(T).Name}");
Debug.LogWarning($"[{nameof(CommandDispatcher<TCommand>)}] No command executor found for sce command: {typeof(T).Name}");
}
}
@@ -74,7 +78,7 @@ namespace Pal3.Command
}
else if (Attribute.GetCustomAttribute(command.GetType(), typeof(SceCommandAttribute)) != null)
{
Debug.LogWarning($"No command executor found for sce command: {command.GetType().Name}");
Debug.LogWarning($"[{nameof(CommandDispatcher<TCommand>)}] No command executor found for sce command: {command.GetType().Name}");
}
}
@@ -30,7 +30,7 @@ namespace Pal3.Command
{
if (_executors[typeof(ICommandExecutor<T>)].Contains(executor))
{
Debug.LogError($"Executor already registered: {executor.GetType()}");
Debug.LogError($"[{nameof(CommandExecutorRegistry<TCommand>)}] Executor already registered: {executor.GetType()}");
}
else _executors[typeof(ICommandExecutor<T>)].Add(executor);
}
@@ -48,7 +48,7 @@ namespace Pal3.Command
if (executorTypes.Count == 0)
{
Debug.LogError($"No ICommandExecutor interface found for type: {executor.GetType()}");
Debug.LogError($"[{nameof(CommandExecutorRegistry<TCommand>)}] No ICommandExecutor interface found for type: {executor.GetType()}");
return;
}
@@ -58,7 +58,7 @@ namespace Pal3.Command
{
if (_executors[executorType].Contains(executor))
{
Debug.LogError($"Executor already registered: {executor.GetType()}");
Debug.LogError($"[{nameof(CommandExecutorRegistry<TCommand>)}] Executor already registered: {executor.GetType()}");
}
else _executors[executorType].Add(executor);
}
@@ -74,7 +74,7 @@ namespace Pal3.Command
{
if (!_executors.ContainsKey(typeof(ICommandExecutor<T>)))
{
Debug.LogError($"Executor has not been registered yet: {executor.GetType()}");
Debug.LogError($"[{nameof(CommandExecutorRegistry<TCommand>)}] Executor has not been registered yet: {executor.GetType()}");
return;
}
_executors[typeof(ICommandExecutor<T>)].Remove(executor);
@@ -92,7 +92,7 @@ namespace Pal3.Command
if (executorTypes.Count == 0)
{
Debug.LogError($"No ICommandExecutor interface found for type: {executor.GetType()}");
Debug.LogError($"[{nameof(CommandExecutorRegistry<TCommand>)}] No ICommandExecutor interface found for type: {executor.GetType()}");
return;
}
@@ -100,7 +100,7 @@ namespace Pal3.Command
{
if (!_executors.ContainsKey(executorType))
{
Debug.LogError($"Executor has not been registered yet: {executor.GetType()}");
Debug.LogError($"[{nameof(CommandExecutorRegistry<TCommand>)}] Executor has not been registered yet: {executor.GetType()}");
return;
}
_executors[executorType].Remove(executor);
@@ -775,6 +775,14 @@ namespace Pal3.Command
new SceneCloseDoorCommand(objectId));
}
// <auto-generated/>
[ConsoleMethodAttribute("SceneEnableFog", "设置并开启场景内的雾气显示,参数:起始距离(原GameBox引擎下的距离单位),结束距离(原GameBox引擎下的距离单位),强度值,蓝色(0f-255f),绿色(0f-255f),红色(0f-255f),透明度(0f-1f)")]
public static void SceneEnableFog(System.Single startDistance, System.Single endDistance, System.Single intensity, System.Single blue, System.Single green, System.Single red, System.Single alpha)
{
CommandDispatcher<ICommand>.Instance.Dispatch(
new SceneEnableFogCommand(startDistance, endDistance, intensity, blue, green, red, alpha));
}
// <auto-generated/>
[ConsoleMethodAttribute("SceneLoad", "切换场景,参数:场景关(文件)名称,场景区块名称")]
public static void SceneLoad(System.String sceneFileName, System.String sceneName)
@@ -1175,14 +1183,6 @@ namespace Pal3.Command
new UIShowSmeltingMenuCommand(smeltingScriptId));
}
// <auto-generated/>
[ConsoleMethodAttribute("Unknown162", "仙三外设置场景内的雾气特效和颜色???")]
public static void Unknown162(System.Single unknown1, System.Single unknown2, System.Single unknown3, System.Single red, System.Single green, System.Single blue, System.Single unknown7)
{
CommandDispatcher<ICommand>.Instance.Dispatch(
new UnknownCommand162(unknown1, unknown2, unknown3, red, green, blue, unknown7));
}
// <auto-generated/>
[ConsoleMethodAttribute("Unknown166", "???")]
public static void Unknown166(System.Int32 unknown1, System.Int32 unknown2)
@@ -0,0 +1,42 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
namespace Pal3.Command.SceCommands
{
#if PAL3A
[AvailableInConsole]
[SceCommand(162, "设置并开启场景内的雾气显示," +
"参数:起始距离(原GameBox引擎下的距离单位),结束距离(原GameBox引擎下的距离单位),强度值," +
"蓝色(0f-255f),绿色(0f-255f),红色(0f-255f),透明度(0f-1f)")]
public class SceneEnableFogCommand : ICommand
{
public SceneEnableFogCommand(
float startDistance,
float endDistance,
float intensity,
float blue,
float green,
float red,
float alpha)
{
StartDistance = startDistance;
EndDistance = endDistance;
Intensity = intensity;
Blue = blue;
Green = green;
Red = red;
Alpha = alpha;
}
public float StartDistance { get; }
public float EndDistance { get; }
public float Intensity { get; }
public float Blue { get; }
public float Green { get; }
public float Red { get; }
public float Alpha { get; }
}
#endif
}
@@ -1,40 +0,0 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
namespace Pal3.Command.SceCommands
{
#if PAL3A
[AvailableInConsole]
[SceCommand(162, "仙三外设置场景内的雾气特效和颜色???")]
public class UnknownCommand162 : ICommand
{
public UnknownCommand162(
float unknown1,
float unknown2,
float unknown3,
float red,
float green,
float blue,
float unknown7)
{
Unknown1 = unknown1;
Unknown2 = unknown2;
Unknown3 = unknown3;
Red = red;
Green = green;
Blue = blue;
Unknown7 = unknown7;
}
public float Unknown1 { get; }
public float Unknown2 { get; }
public float Unknown3 { get; }
public float Red { get; }
public float Green { get; }
public float Blue { get; }
public float Unknown7 { get; }
}
#endif
}
@@ -44,8 +44,8 @@ namespace Pal3.Data
// Dispose current scene cpk
if (!string.IsNullOrEmpty(_currentCityName))
{
var currentSceneFolderPath = _currentCityName + CpkConstants.FileExtension + CpkConstants.DirectorySeparator
+ _currentSceneName;
var currentSceneFolderPath = $"{_currentCityName}{CpkConstants.FileExtension}" +
$"{CpkConstants.DirectorySeparatorChar}{_currentSceneName}";
if (_fileSystem.FileExistsInSegmentedArchive(currentSceneFolderPath, out string segmentedArchiveName))
{
@@ -59,8 +59,8 @@ namespace Pal3.Data
// Load new scene cpk into memory
{
var newSceneFolderPath = newCityName + CpkConstants.FileExtension + CpkConstants.DirectorySeparator
+ newSceneName;
var newSceneFolderPath = $"{newCityName}{CpkConstants.FileExtension}" +
$"{CpkConstants.DirectorySeparatorChar}{newSceneName}";
if (_fileSystem.FileExistsInSegmentedArchive(newSceneFolderPath, out string segmentedArchiveName))
{
+61 -117
View File
@@ -17,18 +17,11 @@ namespace Pal3.Data
using Core.DataLoader;
using Core.DataReader;
using Core.DataReader.Cpk;
using Core.DataReader.Cvd;
using Core.DataReader.Dat;
using Core.DataReader.Data;
using Core.DataReader.Gdb;
using Core.DataReader.Ini;
using Core.DataReader.Lgt;
using Core.DataReader.Mov;
using Core.DataReader.Msh;
using Core.DataReader.Mtl;
using Core.DataReader.Mv3;
using Core.DataReader.Nav;
using Core.DataReader.Pol;
using Core.DataReader.Sce;
using Core.DataReader.Scn;
using Core.FileSystem;
using Core.Services;
using Core.Utils;
@@ -48,7 +41,7 @@ namespace Pal3.Data
private const string CACHE_FOLDER_NAME = "CacheData";
private const string MV3_ACTOR_CONFIG_HEADER = ";#MV3#";
private const char PathSeparator = CpkConstants.DirectorySeparator;
private const char DIR_SEPARATOR = CpkConstants.DirectorySeparatorChar;
private readonly ICpkFileSystem _fileSystem;
private readonly ITextureLoaderFactory _textureLoaderFactory;
@@ -64,15 +57,13 @@ namespace Pal3.Data
private readonly Dictionary<string, AudioClip> _audioClipCache = new ();
private readonly Dictionary<int, Object> _vfxEffectPrefabCache = new ();
private readonly Dictionary<string, ActorActionConfig> _actorConfigCache = new (); // Cache forever
private readonly Dictionary<Type, Dictionary<string, object>> _gameResourceFileCache = new ();
// Cache player actor movement sfx audio clips
private readonly HashSet<string> _audioClipCacheList = AudioConstants.PlayerActorMovementSfxAudioFileNames;
// No need to deallocate the shadow texture since it is been used almost every where.
private static readonly Texture2D ShadowTexture = Resources.Load<Texture2D>("Textures/shadow");
private readonly int _codepage;
public GameResourceProvider(ICpkFileSystem fileSystem,
ITextureLoaderFactory textureLoaderFactory,
IMaterialFactory unlitMaterialFactory,
@@ -85,6 +76,7 @@ namespace Pal3.Data
_litMaterialFactory = litMaterialFactory; // Lit materials are not required
_gameSettings = Requires.IsNotNull(gameSettings, nameof(gameSettings));
_codepage = _gameSettings.Language == Language.SimplifiedChinese ? 936 : 950;
_gameDatabase = GetGameDatabaseFile(); // Initialize game database file
CommandExecutorRegistry<ICommand>.Instance.Register(this);
@@ -93,12 +85,7 @@ namespace Pal3.Data
private GdbFile GetGameDatabaseFile()
{
var gdbFilePath = FileConstants.GameDatabaseFileVirtualPath;
return GetGameResourceFileReader<GdbFile>().Read(_fileSystem.ReadAllBytes(gdbFilePath));
}
private IFileReader<T> GetGameResourceFileReader<T>()
{
return ServiceLocator.Instance.Get<IFileReader<T>>();
return GetGameResourceFile<GdbFile>(gdbFilePath);
}
public void Dispose()
@@ -106,7 +93,6 @@ namespace Pal3.Data
_textureCache?.DisposeAll();
_spriteCache.Clear();
_gameResourceFileCache.Clear();
_actorConfigCache.Clear();
_audioClipCache.Clear();
_vfxEffectPrefabCache.Clear();
CommandExecutorRegistry<ICommand>.Instance.UnRegister(this);
@@ -141,7 +127,7 @@ namespace Pal3.Data
new TextureProvider(_fileSystem, _textureLoaderFactory, relativeDirectoryPath);
}
public T GetGameResourceFile<T>(string fileVirtualPath, bool useCache = true)
public T GetGameResourceFile<T>(string fileVirtualPath, bool useCache = true, byte[] data = null)
{
fileVirtualPath = fileVirtualPath.ToLower();
@@ -152,7 +138,8 @@ namespace Pal3.Data
return (T)_gameResourceFileCache[typeof(T)][fileVirtualPath];
}
T file = GetGameResourceFileReader<T>().Read(_fileSystem.ReadAllBytes(fileVirtualPath));
T file = ServiceLocator.Instance.Get<IFileReader<T>>().Read(
data ?? _fileSystem.ReadAllBytes(fileVirtualPath), _codepage);
if (useCache)
{
@@ -167,39 +154,24 @@ namespace Pal3.Data
return file;
}
public NavFile GetNavFile(string sceneFileName, string sceneName)
public IDictionary<int, GameItemInfo> GetGameItemInfos()
{
var navFilePath = FileConstants.GetNavFileVirtualPath(sceneFileName, sceneName);
return GetGameResourceFileReader<NavFile>().Read(_fileSystem.ReadAllBytes(navFilePath));
return _gameDatabase.GameItemInfos;
}
public ScnFile GetScnFile(string sceneFileName, string sceneName)
public IDictionary<int, CombatActorInfo> GetCombatActorInfos()
{
var scnFilePath = FileConstants.GetScnFileVirtualPath(sceneFileName, sceneName);
return GetGameResourceFileReader<ScnFile>().Read(_fileSystem.ReadAllBytes(scnFilePath));
return _gameDatabase.CombatActorInfos;
}
public SceFile GetSceneSceFile(string sceneFileName)
public IDictionary<int, SkillInfo> GetSkillInfos()
{
var sceFilePath = FileConstants.GetSceneSceFileVirtualPath(sceneFileName);
return GetGameResourceFileReader<SceFile>().Read(_fileSystem.ReadAllBytes(sceFilePath));
return _gameDatabase.SkillInfos;
}
public SceFile GetSystemSceFile()
public IDictionary<int, ComboSkillInfo> GetComboSkillInfos()
{
var systemSceFilePath = FileConstants.SystemSceFileVirtualPath;
return GetGameResourceFileReader<SceFile>().Read(_fileSystem.ReadAllBytes(systemSceFilePath));
}
public SceFile GetBigMapSceFile()
{
var bigMapSceFilePath = FileConstants.BigMapSceFileVirtualPath;
return GetGameResourceFileReader<SceFile>().Read(_fileSystem.ReadAllBytes(bigMapSceFilePath));
}
public Dictionary<int, GameItem> GetGameItems()
{
return _gameDatabase.GameItems;
return _gameDatabase.ComboSkillInfos;
}
/// <summary>
@@ -213,8 +185,9 @@ namespace Pal3.Data
+ Path.DirectorySeparatorChar
+ CACHE_FOLDER_NAME
+ Path.DirectorySeparatorChar
+ musicFileVirtualPath.Replace(PathSeparator, Path.DirectorySeparatorChar)
.Replace(CpkConstants.FileExtension, string.Empty);
+ musicFileVirtualPath
.Replace(CpkConstants.DirectorySeparatorChar, Path.DirectorySeparatorChar)
.Replace(CpkConstants.FileExtension, string.Empty);
}
/// <summary>
@@ -228,7 +201,7 @@ namespace Pal3.Data
{
if (File.Exists(musicFileCachePath)) yield break;
Debug.Log($"Writing MP3 file to App's persistent folder: {musicFileVirtualPath}");
Debug.Log($"[{nameof(GameResourceProvider)}] Writing MP3 file to App's persistent folder: {musicFileVirtualPath}");
var dataMovementThread = new Thread(() =>
{
try
@@ -274,30 +247,38 @@ namespace Pal3.Data
bool streamAudio,
Action<AudioClip> onLoaded)
{
var fileName = Path.GetFileName(filePath);
var shouldCache = _audioClipCacheList.Contains(fileName);
string cacheKey = filePath.ToLower();
if (shouldCache && _audioClipCache.ContainsKey(fileName))
if (_audioClipCache.ContainsKey(cacheKey) &&
_audioClipCache[cacheKey] != null)
{
if (_audioClipCache[fileName] != null) // check if clip has been destroyed
{
onLoaded?.Invoke(_audioClipCache[fileName]);
yield break;
}
onLoaded?.Invoke(_audioClipCache[cacheKey]);
yield break;
}
yield return AudioClipLoader.LoadAudioClipAsync(filePath,
audioType,
streamAudio,
audioClip =>
{
if (shouldCache && audioClip != null)
{
_audioClipCache[fileName] = audioClip;
}
_audioClipCache[cacheKey] = audioClip;
onLoaded?.Invoke(audioClip);
});
}
onLoaded?.Invoke(audioClip);
});
public Sprite GetLogoSprite()
{
#if PAL3
const string mainLogoTextureFileName = "11.tga";
Rect mainLogoTextureRect = new Rect(0, 600, 375, 145);
#elif PAL3A
const string mainLogoTextureFileName = "12.tga";
Rect mainLogoTextureRect = new Rect(0, 770, 500, 253);
#endif
ITextureResourceProvider uiLibTextureProvider = CreateTextureResourceProvider(FileConstants.UILibFolderVirtualPath);
Texture2D logoTexture = uiLibTextureProvider.GetTexture(mainLogoTextureFileName);
return Sprite.Create(logoTexture, mainLogoTextureRect, new Vector2(0.5f, 0.5f));
}
private Texture2D GetActorAvatarTexture(string actorName, string avatarTextureName)
@@ -350,13 +331,13 @@ namespace Pal3.Data
var relativeFilePath = string.Format(FileConstants.SkyBoxTexturePathFormat.First(), skyBoxId);
ITextureResourceProvider textureProvider = CreateTextureResourceProvider(
Utility.GetRelativeDirectoryPath(relativeFilePath));
Utility.GetDirectoryName(relativeFilePath, DIR_SEPARATOR));
var textures = new Texture2D[FileConstants.SkyBoxTexturePathFormat.Length];
for (var i = 0; i < FileConstants.SkyBoxTexturePathFormat.Length; i++)
{
var textureNameFormat = Utility.GetFileName(
string.Format(FileConstants.SkyBoxTexturePathFormat[i], skyBoxId), PathSeparator);
string.Format(FileConstants.SkyBoxTexturePathFormat[i], skyBoxId), DIR_SEPARATOR);
Texture2D texture = textureProvider.GetTexture(string.Format(textureNameFormat, i));
// Set wrap mode to clamp to remove "edges" between sides
texture.wrapMode = TextureWrapMode.Clamp;
@@ -442,14 +423,8 @@ namespace Pal3.Data
actorConfigFilePath = actorConfigFilePath.ToLower();
if (_actorConfigCache.TryGetValue(actorConfigFilePath, out ActorActionConfig actorActionConfig))
if (!FileExists(actorConfigFilePath))
{
return actorActionConfig;
}
if (!_fileSystem.FileExists(actorConfigFilePath))
{
_actorConfigCache[actorConfigFilePath] = null;
return null;
}
@@ -458,15 +433,11 @@ namespace Pal3.Data
if (string.Equals(MV3_ACTOR_CONFIG_HEADER, configHeaderStr))
{
Mv3ActionConfig config = GetGameResourceFileReader<Mv3ActionConfig>().Read(configData);
_actorConfigCache[actorConfigFilePath] = config;
return config;
return GetGameResourceFile<Mv3ActionConfig>(actorConfigFilePath, data: configData);
}
else // MOV actor config
{
MovActionConfig config = GetGameResourceFileReader<MovActionConfig>().Read(configData);
_actorConfigCache[actorConfigFilePath] = config;
return config;
return GetGameResourceFile<MovActionConfig>(actorConfigFilePath, data: configData);
}
}
@@ -483,9 +454,9 @@ namespace Pal3.Data
foreach (FileInfo file in new DirectoryInfo(videoFolder).GetFiles($"*.*", SearchOption.AllDirectories))
{
var fileExtension = Path.GetExtension(file.Name);
if (supportedVideoFormats.Contains(fileExtension.ToLower()) &&
Path.GetFileNameWithoutExtension(file.Name).ToLower().Equals(videoName.ToLower()))
var fileExtension = Path.GetExtension(file.Name).ToLower();
if (supportedVideoFormats.Contains(fileExtension) &&
Path.GetFileNameWithoutExtension(file.Name).Equals(videoName, StringComparison.OrdinalIgnoreCase))
{
return file.FullName;
}
@@ -498,7 +469,7 @@ namespace Pal3.Data
public (Texture2D texture, bool hasAlphaChannel)[] GetEffectTextures(GraphicsEffect effect, string texturePathFormat)
{
ITextureResourceProvider textureProvider = CreateTextureResourceProvider(
Utility.GetRelativeDirectoryPath(texturePathFormat));
Utility.GetDirectoryName(texturePathFormat, DIR_SEPARATOR));
if (effect == GraphicsEffect.Fire)
{
@@ -506,7 +477,7 @@ namespace Pal3.Data
var textures = new (Texture2D texture, bool hasAlphaChannel)[numberOfFrames];
for (var i = 0; i < numberOfFrames; i++)
{
var textureNameFormat = Utility.GetFileName(texturePathFormat, PathSeparator);
var textureNameFormat = Utility.GetFileName(texturePathFormat, DIR_SEPARATOR);
Texture2D texture = textureProvider.GetTexture(string.Format(textureNameFormat, i + 1), out var hasAlphaChannel);
textures[i] = (texture, hasAlphaChannel);
}
@@ -533,7 +504,7 @@ namespace Pal3.Data
if (vfxPrefab == null)
{
Debug.LogWarning("VFX prefab not found: " + effectGroupId);
Debug.LogWarning($"[{nameof(GameResourceProvider)}] VFX prefab not found: " + effectGroupId);
}
_vfxEffectPrefabCache[effectGroupId] = vfxPrefab;
@@ -556,11 +527,11 @@ namespace Pal3.Data
if (request.asset == null)
{
Debug.LogWarning("VFX prefab not found: " + effectGroupId);
Debug.LogWarning($"[{nameof(GameResourceProvider)}] VFX prefab not found: " + effectGroupId);
}
else
{
Debug.Log("VFX prefab preloaded: " + effectGroupId);
Debug.Log($"[{nameof(GameResourceProvider)}] VFX prefab preloaded: " + effectGroupId);
}
_vfxEffectPrefabCache[effectGroupId] = request.asset;
@@ -574,35 +545,6 @@ namespace Pal3.Data
return cursorTexture;
}
/// <summary>
/// To warm up the main actor action cache to reduce gameplay shutters.
/// </summary>
public void PreLoadMainActorMv3()
{
var cachedActions = new HashSet<string>()
{
ActorConstants.ActionToNameMap[ActorActionType.Stand],
ActorConstants.ActionToNameMap[ActorActionType.Walk],
ActorConstants.ActionToNameMap[ActorActionType.Run],
ActorConstants.ActionToNameMap[ActorActionType.StepBack],
};
foreach (var name in ActorConstants.MainActorNameMap.Values)
{
ActorActionConfig actorActionConfig = GetActorActionConfig(name, $"{name}.ini");
foreach (ActorAction actorAction in actorActionConfig.ActorActions)
{
// Cache known actions only.
if (!cachedActions.Contains(actorAction.ActionName.ToLower())) continue;
var mv3FilePath = FileConstants.GetActorFolderVirtualPath(name) + actorAction.ActionFileName;
_ = GetGameResourceFile<Mv3File>(mv3FilePath); // Call GetMv3 to cache the mv3 file.
}
}
}
private string _currentCityName;
public void Execute(ScenePreLoadingNotification notification)
{
@@ -646,7 +588,7 @@ namespace Pal3.Data
{
// Dispose non-main actor mv3 files
// All main actor names start with "1"
var mainActorMv3 = $"{FileConstants.GetActorFolderName()}{PathSeparator}1".ToLower();
var mainActorMv3 = $"{FileConstants.GetActorFolderName()}{DIR_SEPARATOR}1".ToLower();
var mv3FilesToDispose = fileCache.Value.Keys
.Where(mv3FilePath => !mv3FilePath.Contains(mainActorMv3))
.ToArray();
@@ -657,7 +599,9 @@ namespace Pal3.Data
}
else if (fileCache.Key == typeof(GdbFile) ||
fileCache.Key == typeof(Mv3ActionConfig) ||
fileCache.Key == typeof(MovActionConfig))
fileCache.Key == typeof(MovActionConfig) ||
fileCache.Key == typeof(EffectDefinitionFile) ||
fileCache.Key == typeof(EffectLinkerFile))
{
// These files are used/cached across scenes
// Do not dispose them since they will be used in next scene block
+2 -3
View File
@@ -5,7 +5,6 @@
namespace Pal3.Data
{
using System;
using System.Collections.Generic;
using UnityEngine;
@@ -24,7 +23,7 @@ namespace Pal3.Data
if (_textureCache.ContainsKey(key))
{
Debug.LogError($"Texture {key} already existed in cache.");
Debug.LogError($"[{nameof(TextureCache)}] Texture {key} already existed in cache.");
}
else
{
@@ -50,7 +49,7 @@ namespace Pal3.Data
public void DisposeAll()
{
Debug.Log($"Disposing all cached textures: {_textureCache.Count}");
Debug.Log($"[{nameof(TextureCache)}] Disposing all cached textures: {_textureCache.Count}");
foreach ((Texture2D texture, _) in _textureCache.Values)
{
UnityEngine.Object.Destroy(texture);
+9 -9
View File
@@ -17,21 +17,21 @@ namespace Pal3.Data
private readonly ICpkFileSystem _fileSystem;
private readonly ITextureLoaderFactory _textureLoaderFactory;
private readonly TextureCache _textureCache;
private readonly string _relativePath;
private readonly string _relativeDirectoryPath;
public TextureProvider(ICpkFileSystem fileSystem,
ITextureLoaderFactory textureLoaderFactory,
string relativePath,
string relativeDirectoryPath,
TextureCache textureCache = null)
{
if (!relativePath.EndsWith(CpkConstants.DirectorySeparator))
if (!relativeDirectoryPath.EndsWith(CpkConstants.DirectorySeparatorChar))
{
relativePath += CpkConstants.DirectorySeparator;
relativeDirectoryPath += CpkConstants.DirectorySeparatorChar;
}
_fileSystem = fileSystem;
_textureLoaderFactory = textureLoaderFactory;
_relativePath = relativePath.ToLower(); // Texture path is case insensitive
_relativeDirectoryPath = relativeDirectoryPath.ToLower(); // Texture path is case insensitive
_textureCache = textureCache;
}
@@ -49,7 +49,7 @@ namespace Pal3.Data
public string GetTexturePath(string name)
{
return _relativePath + name;
return _relativeDirectoryPath + name;
}
public Texture2D GetTexture(string name)
@@ -66,7 +66,7 @@ namespace Pal3.Data
return Texture2D.whiteTexture;
}
var texturePath = _relativePath + name;
var texturePath = _relativeDirectoryPath + name;
// Note: Most texture files used in (.pol, .cvd) files are stored inside Pal3's CPack
// archives and they are pre-compressed to DXT format (DXT1 & DXT3). So we need to
@@ -78,7 +78,7 @@ namespace Pal3.Data
}
catch (Exception ex)
{
Debug.LogWarning($"Failed to change path extension for texture: {texturePath}, ex: {ex}");
Debug.LogWarning($"[{nameof(TextureProvider)}] Failed to change path extension for texture: {texturePath}, ex: {ex}");
hasAlphaChannel = false;
return Texture2D.whiteTexture;
}
@@ -113,7 +113,7 @@ namespace Pal3.Data
{
textureLoader = _textureLoaderFactory.GetTextureLoader(Path.GetExtension(name));
texture = base.GetTexture(_fileSystem, texturePath, textureLoader, out hasAlphaChannel);
if (texture == null) Debug.LogWarning($"Texture not found: {texturePath}");
if (texture == null) Debug.LogWarning($"[{nameof(TextureProvider)}] Texture not found: {texturePath}");
else _textureCache?.Add(texturePath, texture, hasAlphaChannel);
}
+30
View File
@@ -705,6 +705,7 @@ namespace Pal3.Dev
ActorSetNavLayer -1 0
ActorSetTilePosition -1 190 20
TeamAddOrRemoveActor 0 1
TaskOpen 077
CameraFadeIn"},
{"蜀山\n\n第一次回家", @"
ScriptVarSetValue -32768 20800
@@ -715,6 +716,7 @@ namespace Pal3.Dev
ActorSetNavLayer -1 0
ActorSetTilePosition -1 91 114
TeamAddOrRemoveActor 0 1
TaskOpen 083
CameraFadeIn"},
{"蜀山\n\n绿萝嶂", @"
ScriptVarSetValue -32768 30101
@@ -730,6 +732,7 @@ namespace Pal3.Dev
ActorSetTilePosition -1 342 137
TeamAddOrRemoveActor 0 1
TeamAddOrRemoveActor 1 1
TaskOpen 086
CameraFadeIn"},
{"地脉门户\n\n少阳三焦", @"
ScriptVarSetValue -32768 40200
@@ -750,6 +753,7 @@ namespace Pal3.Dev
BigMapEnableRegion 2 2
BigMapEnableRegion 4 2
BigMapEnableRegion 5 2
TaskOpen 089
CameraFadeIn"},
{"第一次进入里蜀山", @"
ScriptVarSetValue -32768 41100
@@ -772,6 +776,7 @@ namespace Pal3.Dev
BigMapEnableRegion 4 2
BigMapEnableRegion 5 2
BigMapEnableRegion 6 1
TaskOpen 092
CameraFadeIn"},
{"里蜀山外城南\n\n厥阴心包", @"
ScriptVarSetValue -32768 50200
@@ -794,6 +799,7 @@ namespace Pal3.Dev
BigMapEnableRegion 4 2
BigMapEnableRegion 5 2
BigMapEnableRegion 6 1
TaskOpen 097
CameraFadeIn"},
{"厥阴心包\n\n胜州", @"
ScriptVarSetValue -32768 50500
@@ -816,6 +822,7 @@ namespace Pal3.Dev
BigMapEnableRegion 4 2
BigMapEnableRegion 5 2
BigMapEnableRegion 6 1
TaskOpen 098
CameraFadeIn"},
{"蜀山\n\n深夜去经库", @"
ScriptVarSetValue -32768 60500
@@ -840,6 +847,7 @@ namespace Pal3.Dev
BigMapEnableRegion 6 1
BigMapEnableRegion 7 2
BigMapEnableRegion 8 2
TaskOpen 107
CameraFadeIn"},
{"地脉门户大厅\n\n阳名百纳", @"
ScriptVarSetValue -32768 70100
@@ -863,6 +871,7 @@ namespace Pal3.Dev
BigMapEnableRegion 6 1
BigMapEnableRegion 7 2
BigMapEnableRegion 8 2
TaskOpen 111
CameraFadeIn"},
{"血濡回魂\n\n初入京城", @"
ScriptVarSetValue -32768 70700
@@ -886,6 +895,7 @@ namespace Pal3.Dev
BigMapEnableRegion 7 2
BigMapEnableRegion 8 2
BigMapEnableRegion 9 1
TaskOpen 112
CameraFadeIn"},
{"失散\n\n双溪", @"
ScriptVarSetValue -32768 80100
@@ -912,6 +922,7 @@ namespace Pal3.Dev
BigMapEnableRegion 8 2
BigMapEnableRegion 9 1
BigMapEnableRegion 10 2
TaskOpen 120
CameraFadeIn"},
{"双溪\n\n里蜀山", @"
ScriptVarSetValue -32768 80700
@@ -939,6 +950,7 @@ namespace Pal3.Dev
BigMapEnableRegion 8 2
BigMapEnableRegion 9 1
BigMapEnableRegion 10 2
TaskOpen 122
CameraFadeIn"},
{"里蜀山外城南\n\n太阴归尘", @"
ScriptVarSetValue -32768 80700
@@ -966,6 +978,7 @@ namespace Pal3.Dev
BigMapEnableRegion 8 2
BigMapEnableRegion 9 1
BigMapEnableRegion 10 2
TaskOpen 123
CameraFadeIn"},
{"太阴归尘\n\n蜀山故道", @"
ScriptVarSetValue -32768 90300
@@ -991,6 +1004,7 @@ namespace Pal3.Dev
BigMapEnableRegion 8 2
BigMapEnableRegion 9 1
BigMapEnableRegion 10 2
TaskOpen 127
CameraFadeIn"},
{"蜀山深夜\n\n养父常纪房间", @"
ScriptVarSetValue -32768 100400
@@ -1018,6 +1032,7 @@ namespace Pal3.Dev
BigMapEnableRegion 9 1
BigMapEnableRegion 10 2
BigMapEnableRegion 11 1
TaskOpen 134
CameraFadeIn"},
{"无极阁找掌门去锁妖塔", @"
ScriptVarSetValue -32768 100701
@@ -1046,6 +1061,7 @@ namespace Pal3.Dev
BigMapEnableRegion 10 2
BigMapEnableRegion 11 1
CameraSetDefaultTransform 2
TaskOpen 137
CameraFadeIn"},
{"新安当", @"
ScriptVarSetValue -32768 101500
@@ -1075,6 +1091,7 @@ namespace Pal3.Dev
BigMapEnableRegion 11 1
BigMapEnableRegion 12 1
BigMapEnableRegion 13 2
TaskOpen 140
CameraFadeIn"},
{"地脉门户\n\n太阳华池", @"
ScriptVarSetValue -32768 110200
@@ -1101,6 +1118,7 @@ namespace Pal3.Dev
BigMapEnableRegion 10 2
BigMapEnableRegion 11 1
BigMapEnableRegion 13 2
TaskOpen 144
CameraFadeIn"},
{"小秘屋会和", @"
ScriptVarSetValue -32768 120300
@@ -1128,6 +1146,7 @@ namespace Pal3.Dev
BigMapEnableRegion 10 2
BigMapEnableRegion 11 1
BigMapEnableRegion 13 2
TaskOpen 147
CameraFadeIn"},
{"里蜀山\n\n魔界之门", @"
ScriptVarSetValue -32768 120400
@@ -1156,6 +1175,7 @@ namespace Pal3.Dev
BigMapEnableRegion 10 2
BigMapEnableRegion 11 1
BigMapEnableRegion 13 2
TaskOpen 148
CameraFadeIn"},
{"里蜀山外城北\n\n少阴凝碧", @"
ScriptVarSetValue -32768 130100
@@ -1184,6 +1204,7 @@ namespace Pal3.Dev
BigMapEnableRegion 10 2
BigMapEnableRegion 11 1
BigMapEnableRegion 13 2
TaskOpen 150
CameraFadeIn"},
{"施洞", @"
ScriptVarSetValue -32768 140200
@@ -1213,6 +1234,7 @@ namespace Pal3.Dev
BigMapEnableRegion 10 2
BigMapEnableRegion 11 1
BigMapEnableRegion 13 2
TaskOpen 154
CameraFadeIn"},
{"出发去月光城", @"
ScriptVarSetValue -32768 140400
@@ -1242,6 +1264,7 @@ namespace Pal3.Dev
BigMapEnableRegion 10 2
BigMapEnableRegion 11 1
BigMapEnableRegion 13 2
TaskOpen 155
CameraFadeIn"},
{"蜀山\n\n重回绿萝山", @"
ScriptVarSetValue -32768 150300
@@ -1271,6 +1294,7 @@ namespace Pal3.Dev
BigMapEnableRegion 11 1
BigMapEnableRegion 13 2
BigMapEnableRegion 14 2
TaskOpen 160
CameraFadeIn"},
{"地脉门户\n\n少阳参天", @"
ScriptVarSetValue -32768 150400
@@ -1299,6 +1323,7 @@ namespace Pal3.Dev
BigMapEnableRegion 11 1
BigMapEnableRegion 13 2
BigMapEnableRegion 14 2
TaskOpen 161
CameraFadeIn"},
{"回里蜀山秘密基地", @"
ScriptVarSetValue -32768 160101
@@ -1328,6 +1353,7 @@ namespace Pal3.Dev
BigMapEnableRegion 11 1
BigMapEnableRegion 13 2
BigMapEnableRegion 14 2
TaskOpen 163
CameraFadeIn"},
{"里蜀山内城\n\n厥阴蔽日", @"
ScriptVarSetValue -32768 170200
@@ -1358,6 +1384,7 @@ namespace Pal3.Dev
BigMapEnableRegion 11 1
BigMapEnableRegion 13 2
BigMapEnableRegion 14 2
TaskOpen 171
CameraFadeIn"},
{"地脉门户\n\n蜀山前山", @"
ScriptVarSetValue -32768 171200
@@ -1386,6 +1413,7 @@ namespace Pal3.Dev
BigMapEnableRegion 11 1
BigMapEnableRegion 13 2
BigMapEnableRegion 14 2
TaskOpen 174
CameraFadeIn"},
{"花圃\n\n温慧最高好感", @"
ScriptVarSetValue -32768 180600
@@ -1414,6 +1442,7 @@ namespace Pal3.Dev
BigMapEnableRegion 11 1
BigMapEnableRegion 13 2
BigMapEnableRegion 14 2
TaskOpen 180
FavorAdd 1 50
FavorAdd 2 10
CameraFadeIn"},
@@ -1444,6 +1473,7 @@ namespace Pal3.Dev
BigMapEnableRegion 11 1
BigMapEnableRegion 13 2
BigMapEnableRegion 14 2
TaskOpen 180
FavorAdd 1 10
FavorAdd 2 50
CameraFadeIn"},
@@ -0,0 +1,42 @@
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
namespace Pal3.Dev
{
using System;
using System.Collections;
using MetaData;
using Newtonsoft.Json.Linq;
using UnityEngine;
using UnityEngine.Networking;
public static class GithubReleaseVersionFetcher
{
public static IEnumerator GetLatestReleaseVersionAsync(string owner, string repo, Action<string> callback)
{
// Construct the GitHub release API URL
string apiUrl = $"https://api.github.com/repos/{owner}/{repo}/releases/latest";
using UnityWebRequest unityWebRequest = UnityWebRequest.Get(apiUrl);
// Set the user agent header
unityWebRequest.SetRequestHeader("User-Agent", GameConstants.AppName);
// Wait for the request to complete
yield return unityWebRequest.SendWebRequest();
if (unityWebRequest.result != UnityWebRequest.Result.Success)
{
Debug.LogError($"[{nameof(GithubReleaseVersionFetcher)}] Error fetching the latest release: {unityWebRequest.error}");
}
else
{
JObject releaseInfo = JObject.Parse(unityWebRequest.downloadHandler.text);
callback.Invoke(releaseInfo["tag_name"]?.ToString());
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e410f551c4c25234586cd0aefc2622a4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+78 -39
View File
@@ -31,6 +31,7 @@ namespace Pal3.Dev
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.DualShock;
using UnityEngine.Rendering;
using UnityEngine.UI;
public sealed class MainMenu : MonoBehaviour,
@@ -42,7 +43,6 @@ namespace Pal3.Dev
private const int SAVE_SLOT_COUNT = 5;
private GameSettings _gameSettings;
private AudioManager _audioManager;
private InputManager _inputManager;
private EventSystem _eventSystem;
private PlayerInputActions _playerInputActions;
@@ -70,9 +70,7 @@ namespace Pal3.Dev
private readonly List<GameObject> _menuItems = new();
public void Init(GameSettings gameSettings,
AudioManager audioManager,
InputManager inputManager,
EventSystem eventSystem,
SceneManager sceneManager,
GameStateManager gameStateManager,
ScriptManager scriptManager,
@@ -85,12 +83,11 @@ namespace Pal3.Dev
ScrollRect contentScrollRect,
RectTransform backgroundTransform,
RectTransform contentTransform,
EventSystem eventSystem,
Camera mainCamera)
{
_gameSettings = Requires.IsNotNull(gameSettings, nameof(gameSettings));
_audioManager = Requires.IsNotNull(audioManager, nameof(audioManager));
_inputManager = Requires.IsNotNull(inputManager, nameof(inputManager));
_eventSystem = Requires.IsNotNull(eventSystem, nameof(eventSystem));
_sceneManager = Requires.IsNotNull(sceneManager, nameof(sceneManager));
_gameStateManager = Requires.IsNotNull(gameStateManager, nameof(gameStateManager));
_scriptManager = Requires.IsNotNull(scriptManager, nameof(scriptManager));
@@ -103,6 +100,7 @@ namespace Pal3.Dev
_contentScrollRect = Requires.IsNotNull(contentScrollRect, nameof(contentScrollRect));
_backgroundTransform = Requires.IsNotNull(backgroundTransform, nameof(backgroundTransform));
_contentTransform = Requires.IsNotNull(contentTransform, nameof(contentTransform));
_eventSystem = Requires.IsNotNull(eventSystem, nameof(eventSystem));
_mainCamera = Requires.IsNotNull(mainCamera, nameof(mainCamera));
_contentGridLayoutGroup = Requires.IsNotNull(
@@ -166,7 +164,6 @@ namespace Pal3.Dev
{
#if PAL3
// 景天房间
_deferredExecutionCommands.Add("ActorActivate 0 0");
_deferredExecutionCommands.Add("SceneActivateObject 14 0");
_deferredExecutionCommands.Add("SceneActivateObject 15 0");
_deferredExecutionCommands.Add("PlayerEnableInput 0");
@@ -174,24 +171,25 @@ namespace Pal3.Dev
_deferredExecutionCommands.Add("CameraSetTransform -33.24 -19.48 688.0 308.31 240.44 480.61");
_deferredExecutionCommands.Add("CameraFadeIn");
CommandDispatcher<ICommand>.Instance.Dispatch(new SceneLoadCommand("q01", "yn09a"));
CommandDispatcher<ICommand>.Instance.Dispatch(new PlayMusicCommand(AudioConstants.ThemeMusicName, -1));
#elif PAL3A
// 南宫煌房间
_deferredExecutionCommands.Add("ActorActivate 0 0");
_deferredExecutionCommands.Add("PlayerEnableInput 0");
_deferredExecutionCommands.Add("CameraFollowPlayer 0");
_deferredExecutionCommands.Add("CameraSetTransform -21.69 -22.48 688.0 182.87 263.07 531.61");
_deferredExecutionCommands.Add("CameraFadeIn");
CommandDispatcher<ICommand>.Instance.Dispatch(new SceneLoadCommand("q02", "qn08y"));
CommandDispatcher<ICommand>.Instance.Dispatch(new PlayMusicCommand(AudioConstants.ThemeMusicName, -1));
#endif
_audioManager.PlayThemeMusic();
if (!_initViewCameraOrbitAnimationCts.IsCancellationRequested)
{
_initViewCameraOrbitAnimationCts.Cancel();
}
_initViewCameraOrbitAnimationCts = new CancellationTokenSource();
StartCoroutine(StartCameraOrbitAnimationAsync(_initViewCameraOrbitAnimationCts.Token));
_gameStateManager.GoToState(GameState.Cutscene);
}
private IEnumerator StartCameraOrbitAnimationAsync(CancellationToken cancellationToken)
@@ -340,9 +338,9 @@ namespace Pal3.Dev
SelectFirstButtonForEventSystem();
UpdateRectTransformWidthAndHeight(_backgroundTransform,
_contentGridLayoutGroup.cellSize.x + 100f,
_contentGridLayoutGroup.cellSize.x,
(_contentGridLayoutGroup.cellSize.y + _contentGridLayoutGroup.spacing.y) * _menuItems.Count
- _contentGridLayoutGroup.spacing.y + 100f);
- _contentGridLayoutGroup.spacing.y);
}
private void SetupSettingButtons()
@@ -395,24 +393,27 @@ namespace Pal3.Dev
(_gameSettings.IsRealtimeLightingAndShadowsEnabled ? "开启(注意性能和耗电影响)" : "关闭") + ""));
});
#if !UNITY_ANDROID
string GetSSAOButtonText() => _gameSettings.IsAmbientOcclusionEnabled ? ssaoEnabledText : ssaoDisabledText;
CreateMenuButton(GetSSAOButtonText(), buttonTextUGUI => delegate
// SSAO is not available on Android OpenGLES3
if (!(Application.platform == RuntimePlatform.Android &&
SystemInfo.graphicsDeviceType != GraphicsDeviceType.Vulkan))
{
if (!_gameSettings.IsAmbientOcclusionEnabled && !_gameSettings.IsRealtimeLightingAndShadowsEnabled)
string GetSSAOButtonText() => _gameSettings.IsAmbientOcclusionEnabled ? ssaoEnabledText : ssaoDisabledText;
CreateMenuButton(GetSSAOButtonText(), buttonTextUGUI => delegate
{
CommandDispatcher<ICommand>.Instance.Dispatch(new UIDisplayNoteCommand("请先开启实时光影,再开启环境光遮蔽"));
return;
}
if (!_gameSettings.IsAmbientOcclusionEnabled && !_gameSettings.IsRealtimeLightingAndShadowsEnabled)
{
CommandDispatcher<ICommand>.Instance.Dispatch(new UIDisplayNoteCommand("请先开启实时光影,再开启环境光遮蔽"));
return;
}
_gameSettings.IsAmbientOcclusionEnabled = !_gameSettings.IsAmbientOcclusionEnabled;
_gameSettings.IsAmbientOcclusionEnabled = !_gameSettings.IsAmbientOcclusionEnabled;
buttonTextUGUI.text = GetSSAOButtonText();
buttonTextUGUI.text = GetSSAOButtonText();
CommandDispatcher<ICommand>.Instance.Dispatch(new UIDisplayNoteCommand("环境光遮蔽已" +
(_gameSettings.IsAmbientOcclusionEnabled ? "开启(注意性能和耗电影响)" : "关闭") + ""));
});
#endif
CommandDispatcher<ICommand>.Instance.Dispatch(new UIDisplayNoteCommand("环境光遮蔽已" +
(_gameSettings.IsAmbientOcclusionEnabled ? "开启(注意性能和耗电影响)" : "关闭") + ""));
});
}
}
#if UNITY_STANDALONE
@@ -433,17 +434,19 @@ namespace Pal3.Dev
#if UNITY_IOS || UNITY_ANDROID
const string fullResolutionScaleText = "渲染分辨率:100%";
const string halfResolutionScaleText = "渲染分辨率:75%";
string GetResolutionButtonText() => Math.Abs(_gameSettings.ResolutionScale - 1f) < 0.01f
? fullResolutionScaleText
: halfResolutionScaleText;
const string quarterResolutionScaleText = "渲染分辨率:50%";
string GetResolutionButtonText() => Math.Abs(_gameSettings.ResolutionScale - 1f) < 0.01f ? fullResolutionScaleText :
Math.Abs(_gameSettings.ResolutionScale - 0.75f) < 0.01f ? halfResolutionScaleText : quarterResolutionScaleText;
CreateMenuButton(GetResolutionButtonText(), buttonTextUGUI => delegate
{
_gameSettings.ResolutionScale = Math.Abs(_gameSettings.ResolutionScale - 1f) < 0.01f ? 0.75f : 1f;
_gameSettings.ResolutionScale = Math.Abs(_gameSettings.ResolutionScale - 1f) < 0.01f ? 0.75f :
Math.Abs(_gameSettings.ResolutionScale - 0.75f) < 0.01f ? 0.5f : 1f;
buttonTextUGUI.text = GetResolutionButtonText();
CommandDispatcher<ICommand>.Instance.Dispatch(new UIDisplayNoteCommand("渲染分辨率已" +
(Math.Abs(_gameSettings.ResolutionScale - 1f) < 0.01f ? "调整为100%" : "调整为75%") + ""));
(Math.Abs(_gameSettings.ResolutionScale - 1f) < 0.01f ? "调整为100%" :
(Math.Abs(_gameSettings.ResolutionScale - 0.75f) < 0.01f ? "调整为75%" : "调整为50%"))));
});
#endif
@@ -503,6 +506,37 @@ namespace Pal3.Dev
(_gameSettings.SfxVolume == 0f ? "关闭" : "开启") + ""));
});
#if !UNITY_IOS
const string languageSimplifiedChineseText = "数据包版本:简体中文版";
const string languageTraditionalChineseText = "数据包版本:繁体中文版";
string GetLanguageButtonText() => _gameSettings.Language == Language.SimplifiedChinese ?
languageSimplifiedChineseText : languageTraditionalChineseText;
CreateMenuButton(GetLanguageButtonText(), buttonTextUGUI => delegate
{
_gameSettings.Language = _gameSettings.Language == Language.SimplifiedChinese ?
Language.TraditionalChinese : Language.SimplifiedChinese;
buttonTextUGUI.text = GetLanguageButtonText();
CommandDispatcher<ICommand>.Instance.Dispatch(new UIDisplayNoteCommand("游戏版本已切换为" +
(_gameSettings.Language == Language.SimplifiedChinese ? "简体中文版" : "繁体中文版") +
"\n注意:游戏版本需要与数据文件一致,且重启游戏后才会生效"));
});
#endif
const string debugInfoEnabledText = "调试信息:开启";
const string debugInfoDisabledText = "调试信息:关闭";
string GetDebugInfoButtonText() => _gameSettings.IsDebugInfoEnabled ? debugInfoEnabledText : debugInfoDisabledText;
CreateMenuButton(GetDebugInfoButtonText(), buttonTextUGUI => delegate
{
_gameSettings.IsDebugInfoEnabled = !_gameSettings.IsDebugInfoEnabled;
buttonTextUGUI.text = GetDebugInfoButtonText();
CommandDispatcher<ICommand>.Instance.Dispatch(new UIDisplayNoteCommand("调试信息已" +
(_gameSettings.IsDebugInfoEnabled ? "开启" : "关闭") + ""));
});
CreateMenuButton("返回", _ => delegate
{
_gameSettings.SaveSettings();
@@ -515,9 +549,9 @@ namespace Pal3.Dev
SelectFirstButtonForEventSystem();
UpdateRectTransformWidthAndHeight(_backgroundTransform,
_contentGridLayoutGroup.cellSize.x + 100f,
_contentGridLayoutGroup.cellSize.x,
(_contentGridLayoutGroup.cellSize.y + _contentGridLayoutGroup.spacing.y) * _menuItems.Count
- _contentGridLayoutGroup.spacing.y + 100f);
- _contentGridLayoutGroup.spacing.y);
}
private void SetupSaveMenuButtons()
@@ -558,9 +592,9 @@ namespace Pal3.Dev
SelectFirstButtonForEventSystem();
UpdateRectTransformWidthAndHeight(_backgroundTransform,
_contentGridLayoutGroup.cellSize.x + 100f,
_contentGridLayoutGroup.cellSize.x,
(_contentGridLayoutGroup.cellSize.y + _contentGridLayoutGroup.spacing.y) * _menuItems.Count
- _contentGridLayoutGroup.spacing.y + 100f);
- _contentGridLayoutGroup.spacing.y);
}
private void SetupLoadMenuButtons()
@@ -628,9 +662,9 @@ namespace Pal3.Dev
SelectFirstButtonForEventSystem();
UpdateRectTransformWidthAndHeight(_backgroundTransform,
_contentGridLayoutGroup.cellSize.x + 100f,
_contentGridLayoutGroup.cellSize.x,
(_contentGridLayoutGroup.cellSize.y + _contentGridLayoutGroup.spacing.y) * _menuItems.Count
- _contentGridLayoutGroup.spacing.y + 100f);
- _contentGridLayoutGroup.spacing.y);
}
private void SetupStorySelectionButtons()
@@ -661,14 +695,15 @@ namespace Pal3.Dev
UpdateRectTransformWidthAndHeight(_backgroundTransform,
(_contentGridLayoutGroup.cellSize.x + _contentGridLayoutGroup.spacing.x) * _menuItems.Count
- _contentGridLayoutGroup.spacing.x + 100f,
_contentGridLayoutGroup.cellSize.y + 100f);
- _contentGridLayoutGroup.spacing.x,
_contentGridLayoutGroup.cellSize.y);
}
private void UpdateRectTransformWidthAndHeight(RectTransform rectTransform, float width, float height)
{
rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, width);
rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, height);
const float padding = 60f;
rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, width + padding);
rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, height + padding);
rectTransform.ForceUpdateRectTransforms();
}
@@ -779,6 +814,10 @@ namespace Pal3.Dev
// Add main actor to the team
_teamManager.AddActor(0);
#if PAL3A // Add initial task
CommandDispatcher<ICommand>.Instance.Dispatch(new TaskOpenCommand(TaskConstants.InitTaskId));
#endif
_gameStateManager.GoToState(GameState.Cutscene);
}
@@ -6,21 +6,22 @@
namespace Pal3.Dev
{
using System;
using System.IO;
using Command;
using Core.DataReader;
using Newtonsoft.Json;
using Script;
using UnityEditor;
using UnityEngine;
[Obsolete]
public static class UnknownSceCommandAnalyzer
{
public static void AnalyzeCommand(BinaryReader reader,
public static void AnalyzeCommand(SafeBinaryReader reader,
int commandId,
ushort parameterFlag,
int codepage)
{
Debug.LogError($"Unknown Command Id: {commandId} ParameterFlag: {parameterFlag}");
Debug.LogError($"[{nameof(UnknownSceCommandAnalyzer)}] Unknown Command Id: {commandId} ParameterFlag: {parameterFlag}");
var initPosition = reader.BaseStream.Position;
var length = 0;
@@ -40,7 +41,7 @@ namespace Pal3.Dev
if (nextCmdType != null)
{
ICommand command = SceCommandParser.ParseSceCommand(reader, id, flag, codepage);
Debug.Log($"Possible length: {length}, " +
Debug.Log($"[{nameof(UnknownSceCommandAnalyzer)}] Possible length: {length}, " +
$"next command: {nextCmdType.Name}-{id}-{flag}-{JsonConvert.SerializeObject(command)}");
maxSearchCount--;
@@ -10,6 +10,8 @@ namespace Pal3.Effect
using Command;
using Command.InternalCommands;
using Command.SceCommands;
using Core.DataReader.Dat;
using Core.DataReader.Data;
using Core.GameBox;
using Core.Utils;
using Data;
@@ -31,11 +33,17 @@ namespace Pal3.Effect
private SceneManager _sceneManager;
private ICommand _effectPositionCommand;
private const string EFFECT_LINKER_FILE_NAME = "efflinker.dat";
private EffectLinkerFile _effectLinkerFile;
public void Init(GameResourceProvider resourceProvider,
SceneManager sceneManager)
{
_resourceProvider = Requires.IsNotNull(resourceProvider, nameof(resourceProvider));
_sceneManager = Requires.IsNotNull(sceneManager, nameof(sceneManager));
_effectLinkerFile = _resourceProvider.GetGameResourceFile<EffectLinkerFile>(
FileConstants.CombatDataFolderVirtualPath + EFFECT_LINKER_FILE_NAME);
}
private void OnEnable()
+2 -1
View File
@@ -7,6 +7,7 @@ namespace Pal3.Effect
{
using System;
using Core.DataLoader;
using Core.DataReader.Cpk;
using Core.DataReader.Pol;
using Core.Renderer;
using Core.Utils;
@@ -35,7 +36,7 @@ namespace Pal3.Effect
{
PolFile polFile = resourceProvider.GetGameResourceFile<PolFile>(info.ModelPath);
ITextureResourceProvider textureProvider = resourceProvider.CreateTextureResourceProvider(
Utility.GetRelativeDirectoryPath(info.ModelPath));
Utility.GetDirectoryName(info.ModelPath, CpkConstants.DirectorySeparatorChar));
_sceneObjectRenderer = gameObject.AddComponent<PolyModelRenderer>();
_sceneObjectRenderer.Render(polFile,
textureProvider,
@@ -12,7 +12,7 @@ namespace Pal3.GamePlay
using Core.DataReader.Scn;
using MetaData;
public sealed class PlayerManager : IDisposable,
public sealed class PlayerActorManager : IDisposable,
ICommandExecutor<DialogueRenderActorAvatarCommand>,
ICommandExecutor<ActorActivateCommand>,
ICommandExecutor<ActorAddSkillCommand>,
@@ -57,7 +57,7 @@ namespace Pal3.GamePlay
private bool _playerActorControlEnabled = true;
private bool _playerInputEnabled;
public PlayerManager()
public PlayerActorManager()
{
CommandExecutorRegistry<ICommand>.Instance.Register(this);
}
@@ -87,6 +87,24 @@ namespace Pal3.GamePlay
_playerInputEnabled = (command.Enable == 1);
}
public void Execute(ScenePreLoadingNotification command)
{
// Need to set main actor as player actor for non-maze scenes
if (command.NewSceneInfo.SceneType != ScnSceneType.Maze &&
_playerActor != 0)
{
_playerActor = 0;
}
}
public void Execute(ResetGameStateCommand command)
{
_playerActor = 0;
_playerActorControlEnabled = true;
_playerInputEnabled = false;
}
#region Command routing
public void Execute(DialogueRenderActorAvatarCommand command)
{
if (command.ActorId == ActorConstants.PlayerActorVirtualID)
@@ -388,22 +406,6 @@ namespace Pal3.GamePlay
new EffectAttachToActorCommand((int)_playerActor));
}
}
public void Execute(ScenePreLoadingNotification command)
{
// Need to set main actor as player actor for non-maze scenes
if (command.NewSceneInfo.SceneType != ScnSceneType.Maze &&
_playerActor != 0)
{
_playerActor = 0;
}
}
public void Execute(ResetGameStateCommand command)
{
_playerActor = 0;
_playerActorControlEnabled = true;
_playerInputEnabled = false;
}
#endregion
}
}
@@ -55,7 +55,7 @@ namespace Pal3.GamePlay
private GameResourceProvider _resourceProvider;
private GameStateManager _gameStateManager;
private PlayerManager _playerManager;
private PlayerActorManager _playerActorManager;
private TeamManager _teamManager;
private PlayerInputActions _inputActions;
private SceneManager _sceneManager;
@@ -69,6 +69,8 @@ namespace Pal3.GamePlay
private Vector3? _lastKnownPosition;
private Vector2Int? _lastKnownTilePosition;
private int? _lastKnownLayerIndex;
private bool _tilePositionPendingNotify;
private string _lastKnownPlayerActorAction = string.Empty;
private int _jumpableAreaEnterCount;
#if PAL3
@@ -92,7 +94,7 @@ namespace Pal3.GamePlay
public void Init(GameResourceProvider resourceProvider,
GameStateManager gameStateManager,
PlayerManager playerManager,
PlayerActorManager playerActorManager,
TeamManager teamManager,
PlayerInputActions inputActions,
SceneManager sceneManager,
@@ -100,7 +102,7 @@ namespace Pal3.GamePlay
{
_resourceProvider = Requires.IsNotNull(resourceProvider, nameof(resourceProvider));
_gameStateManager = Requires.IsNotNull(gameStateManager, nameof(gameStateManager));
_playerManager = Requires.IsNotNull(playerManager, nameof(playerManager));
_playerActorManager = Requires.IsNotNull(playerActorManager, nameof(playerActorManager));
_teamManager = Requires.IsNotNull(teamManager, nameof(teamManager));
_inputActions = Requires.IsNotNull(inputActions, nameof(inputActions));
_sceneManager = Requires.IsNotNull(sceneManager, nameof(sceneManager));
@@ -141,8 +143,8 @@ namespace Pal3.GamePlay
var isPlayerInControl = false;
if (_gameStateManager.GetCurrentState() == GameState.Gameplay &&
_playerManager.IsPlayerInputEnabled() &&
_playerManager.IsPlayerActorControlEnabled())
_playerActorManager.IsPlayerInputEnabled() &&
_playerActorManager.IsPlayerActorControlEnabled())
{
isPlayerInControl = true;
ReadInputAndMovePlayerIfNeeded();
@@ -156,7 +158,6 @@ namespace Pal3.GamePlay
if (!(position == _lastKnownPosition && layerIndex == _lastKnownLayerIndex))
{
_lastKnownPosition = position;
Vector2Int tilePosition = _playerActorMovementController.GetTilePosition();
if (!(tilePosition == _lastKnownTilePosition && layerIndex == _lastKnownLayerIndex))
{
@@ -165,6 +166,12 @@ namespace Pal3.GamePlay
PlayerActorTilePositionChanged(layerIndex, tilePosition, !isPlayerInControl);
}
}
else if (_tilePositionPendingNotify)
{
Vector2Int tilePosition = _playerActorMovementController.GetTilePosition();
PlayerActorTilePositionChanged(layerIndex, tilePosition, !isPlayerInControl);
_tilePositionPendingNotify = false;
}
_lastKnownLayerIndex = layerIndex;
@@ -276,14 +283,15 @@ namespace Pal3.GamePlay
private void ReadInputAndMovePlayerIfNeeded()
{
var movement = _inputActions.Gameplay.Movement.ReadValue<Vector2>();
if (movement == Vector2.zero) return;
if (movement.magnitude <= 0.01f) return;
MovementMode movementMode = movement.magnitude < 0.7f ? MovementMode.Walk : MovementMode.Run;
ActorActionType movementAction = movementMode == MovementMode.Walk ? ActorActionType.Walk : ActorActionType.Run;
_playerActorMovementController.CancelMovement();
Transform cameraTransform = _camera.transform;
Vector3 inputDirection = cameraTransform.forward * movement.y +
cameraTransform.right * movement.x;
Vector2 normalizedDirection = movement.normalized;
Vector3 inputDirection = cameraTransform.forward * normalizedDirection.y +
cameraTransform.right * normalizedDirection.x;
MovementResult result = PlayerActorMoveTowards(inputDirection, movementMode);
_playerActorActionController.PerformAction(result == MovementResult.Blocked
? ActorActionType.Stand
@@ -340,8 +348,8 @@ namespace Pal3.GamePlay
private void OnTapPerformed(InputAction.CallbackContext _)
{
if (!_playerManager.IsPlayerActorControlEnabled() ||
!_playerManager.IsPlayerInputEnabled())
if (!_playerActorManager.IsPlayerActorControlEnabled() ||
!_playerActorManager.IsPlayerInputEnabled())
{
return;
}
@@ -351,8 +359,8 @@ namespace Pal3.GamePlay
private void OnDoubleTapPerformed(InputAction.CallbackContext _)
{
if (!_playerManager.IsPlayerActorControlEnabled() ||
!_playerManager.IsPlayerInputEnabled())
if (!_playerActorManager.IsPlayerActorControlEnabled() ||
!_playerActorManager.IsPlayerInputEnabled())
{
return;
}
@@ -362,8 +370,8 @@ namespace Pal3.GamePlay
private void PortalToPerformed(InputAction.CallbackContext _)
{
if (!_playerManager.IsPlayerActorControlEnabled() ||
!_playerManager.IsPlayerInputEnabled())
if (!_playerActorManager.IsPlayerActorControlEnabled() ||
!_playerActorManager.IsPlayerInputEnabled())
{
return;
}
@@ -383,8 +391,8 @@ namespace Pal3.GamePlay
private void OnMovePerformed(InputAction.CallbackContext ctx)
{
if (!_playerManager.IsPlayerActorControlEnabled() ||
!_playerManager.IsPlayerInputEnabled())
if (!_playerActorManager.IsPlayerActorControlEnabled() ||
!_playerActorManager.IsPlayerInputEnabled())
{
return;
}
@@ -394,8 +402,8 @@ namespace Pal3.GamePlay
private void InteractionPerformed(InputAction.CallbackContext _)
{
if (!_playerManager.IsPlayerActorControlEnabled() ||
!_playerManager.IsPlayerInputEnabled())
if (!_playerActorManager.IsPlayerActorControlEnabled() ||
!_playerActorManager.IsPlayerInputEnabled())
{
return;
}
@@ -540,8 +548,8 @@ namespace Pal3.GamePlay
private void SwitchPlayerActorInCurrentTeam(bool next)
{
if (!_playerManager.IsPlayerActorControlEnabled() ||
!_playerManager.IsPlayerInputEnabled() ||
if (!_playerActorManager.IsPlayerActorControlEnabled() ||
!_playerActorManager.IsPlayerInputEnabled() ||
_sceneManager.GetCurrentScene().GetSceneInfo().SceneType != ScnSceneType.Maze)
{
return;
@@ -602,7 +610,7 @@ namespace Pal3.GamePlay
var actorMovementController = actorInfo.Value.GetComponent<ActorMovementController>();
if (actorMovementController.GetCurrentLayerIndex() != currentLayerIndex ||
actorInfo.Key == (int)_playerManager.GetPlayerActor() ||
actorInfo.Key == (int)_playerActorManager.GetPlayerActor() ||
!actorController.IsActive) continue;
Vector3 targetActorCenterPosition = actorActionController.GetRendererBounds().center;
@@ -880,7 +888,7 @@ namespace Pal3.GamePlay
}
else
{
Debug.LogError($"Scene object not found or not activated yet: {command.SceneObjectId}.");
Debug.LogError($"[{nameof(PlayerGamePlayController)}] Scene object not found or not activated yet: {command.SceneObjectId}.");
}
}
@@ -891,7 +899,7 @@ namespace Pal3.GamePlay
GameObject climbableObject = climbableSceneObject.GetGameObject();
if (climbableObject == null)
{
Debug.LogError($"Scene object not found or not activated yet: {command.ObjectId}.");
Debug.LogError($"[{nameof(PlayerGamePlayController)}] Scene object not found or not activated yet: {command.ObjectId}.");
return;
}
@@ -961,18 +969,18 @@ namespace Pal3.GamePlay
_playerActorActionController.PerformAction(climbUp ? ActorActionType.Climb : ActorActionType.ClimbDown);
_playerActorGameObject.transform.position = new Vector3(lowerPosition.x,
_playerActorGameObject.transform.position.y, lowerPosition.z);
Vector3 newPosition = new Vector3(lowerPosition.x, _playerActorGameObject.transform.position.y, lowerPosition.z);
var objectRotationY = climbableObject.transform.rotation.eulerAngles.y;
_playerActorGameObject.transform.rotation = Quaternion.Euler(0f, objectRotationY + 180f, 0f);
Quaternion newRotation = Quaternion.Euler(0f, objectRotationY + 180f, 0f);
_playerActorGameObject.transform.SetPositionAndRotation(newPosition, newRotation);
if (climbUp)
{
var currentHeight = 0f;
while (currentHeight < climbableHeight)
{
var delta = Time.deltaTime * ActorConstants.ActorClimbSpeed;
var delta = Time.deltaTime * ActorConstants.PlayerActorClimbSpeed;
currentHeight += delta;
_playerActorGameObject.transform.position += new Vector3(0f, delta, 0f);
yield return null;
@@ -990,7 +998,7 @@ namespace Pal3.GamePlay
var currentHeight = climbableHeight;
while (currentHeight > 0f)
{
var delta = Time.deltaTime * ActorConstants.ActorClimbSpeed;
var delta = Time.deltaTime * ActorConstants.PlayerActorClimbSpeed;
currentHeight -= delta;
_playerActorGameObject.transform.position -= new Vector3(0f, delta, 0f);
yield return null;
@@ -1030,8 +1038,8 @@ namespace Pal3.GamePlay
// Check if actor is player actor.
if (!Enum.IsDefined(typeof(PlayerActorId), command.ActorId))
{
Debug.LogError($"Cannot enable player control for actor {command.ActorId} " +
$"since actor is not a player actor.");
Debug.LogError($"[{nameof(PlayerGamePlayController)}] Cannot enable player control for actor " +
$"{command.ActorId} since actor is not a player actor.");
return;
}
@@ -1058,8 +1066,9 @@ namespace Pal3.GamePlay
_playerActorController.IsActive)
{
lastActivePlayerActorNavLayerIndex = _playerActorMovementController.GetCurrentLayerIndex();
lastActivePlayerActorPosition = _playerActorGameObject.transform.position;
lastActivePlayerActorRotation = _playerActorGameObject.transform.rotation;
_playerActorGameObject.transform.GetPositionAndRotation(out Vector3 currentPosition, out Quaternion currentRotation);
lastActivePlayerActorPosition = currentPosition;
lastActivePlayerActorRotation = currentRotation;
CommandDispatcher<ICommand>.Instance.Dispatch(new ActorActivateCommand(_playerActor.Info.Id, 0));
}
@@ -1155,12 +1164,13 @@ namespace Pal3.GamePlay
Scene currentScene = _sceneManager.GetCurrentScene();
var currentLayerIndex = currentScene
.GetActorGameObject((int)_playerManager.GetPlayerActor())
.GetActorGameObject((int)_playerActorManager.GetPlayerActor())
.GetComponent<ActorMovementController>()
.GetCurrentLayerIndex();
_lastKnownPosition = currentScene.GetTilemap().GetWorldPosition(
new Vector2Int(command.TileXPosition,command.TileYPosition), currentLayerIndex);
_tilePositionPendingNotify = true;
}
}
@@ -1196,7 +1206,7 @@ namespace Pal3.GamePlay
public void Execute(ScenePostLoadingNotification notification)
{
var playerActorId = (int)_playerManager.GetPlayerActor();
var playerActorId = (int)_playerActorManager.GetPlayerActor();
CommandDispatcher<ICommand>.Instance.Dispatch(new ActorActivateCommand(playerActorId, 1));
@@ -1215,12 +1225,12 @@ namespace Pal3.GamePlay
.GetActorGameObject(playerActorId).transform.forward = actorFacing;
}
if (_playerManager.IsPlayerActorControlEnabled())
if (_playerActorManager.IsPlayerActorControlEnabled())
{
CommandDispatcher<ICommand>.Instance.Dispatch(new ActorEnablePlayerControlCommand(playerActorId));
}
if (_playerManager.IsPlayerInputEnabled())
if (_playerActorManager.IsPlayerInputEnabled())
{
CommandDispatcher<ICommand>.Instance.Dispatch(new PlayerEnableInputCommand(1));
}
@@ -1228,6 +1238,8 @@ namespace Pal3.GamePlay
#if PAL3
CommandDispatcher<ICommand>.Instance.Dispatch(new LongKuiSwitchModeCommand(_longKuiLastKnownMode));
#endif
_tilePositionPendingNotify = true;
}
private void DisposeGamePlayIndicators()
@@ -1260,6 +1272,7 @@ namespace Pal3.GamePlay
_lastKnownTilePosition = null;
_lastKnownLayerIndex = null;
_lastKnownPlayerActorAction = string.Empty;
_tilePositionPendingNotify = false;
#if PAL3
_longKuiLastKnownMode = 0;
+35 -45
View File
@@ -10,23 +10,12 @@ namespace Pal3
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using Core.Animation;
using Core.DataReader;
using Core.DataReader.Cpk;
using Core.DataReader.Cvd;
using Core.DataReader.Data;
using Core.DataReader.Gdb;
using Core.DataReader.Ini;
using Core.DataReader.Lgt;
using Core.DataReader.Mov;
using Core.DataReader.Msh;
using Core.DataReader.Mtl;
using Core.DataReader.Mv3;
using Core.DataReader.Nav;
using Core.DataReader.Pol;
using Core.DataReader.Sce;
using Core.DataReader.Scn;
using Core.FileSystem;
using Core.Services;
using Data;
@@ -49,9 +38,6 @@ namespace Pal3
[SerializeField] private Image backgroundImage;
[SerializeField] private TextMeshProUGUI loadingText;
private const int DEFAULT_CODE_PAGE = 936; // GBK Encoding's code page
// change it to 950 to supports Traditional Chinese (Big5)
// Optional materials that are used in the game but not open sourced
private Material _toonDefaultMaterial;
private Material _toonTransparentMaterial;
@@ -82,8 +68,7 @@ namespace Pal3
private IEnumerator InitResourceAsync()
{
// TODO: let user to choose language? Or auto-detect encoding?
int codepage = DEFAULT_CODE_PAGE;
Debug.Log($"[{nameof(GameResourceInitializer)}] Initializing game resources...");
// Create and init Crc32 hash
Crc32Hash crcHash = new ();
@@ -101,13 +86,16 @@ namespace Pal3
gameSettings.InitOrLoadSettings();
ServiceLocator.Instance.Register<GameSettings>(gameSettings);
// Init codepage
int codepage = gameSettings.Language == Language.SimplifiedChinese ? 936 : 950;
// Init file system
Queue<string> gameDataFolderSearchLocations = new(gameSettings.GetGameDataFolderSearchLocations());
ICpkFileSystem cpkFileSystem = null;
if (gameDataFolderSearchLocations.Count == 0)
{
Debug.LogError("No game data folder search locations found.");
Debug.LogError($"[{nameof(GameResourceInitializer)}] No game data folder search locations found.");
yield break;
}
@@ -159,21 +147,23 @@ namespace Pal3
}
}
// Create and register IFileReader<T> instances
ServiceLocator.Instance.Register<IFileReader<CvdFile>>(new CvdFileReader(codepage));
ServiceLocator.Instance.Register<IFileReader<Mv3File>>(new Mv3FileReader(codepage));
ServiceLocator.Instance.Register<IFileReader<MovFile>>(new MovFileReader(codepage));
ServiceLocator.Instance.Register<IFileReader<MshFile>>(new MshFileReader(codepage));
ServiceLocator.Instance.Register<IFileReader<MtlFile>>(new MtlFileReader(codepage));
ServiceLocator.Instance.Register<IFileReader<PolFile>>(new PolFileReader(codepage));
ServiceLocator.Instance.Register<IFileReader<GdbFile>>(new GdbFileReader(codepage));
ServiceLocator.Instance.Register<IFileReader<LgtFile>>(new LgtFileReader());
ServiceLocator.Instance.Register<IFileReader<NavFile>>(new NavFileReader());
ServiceLocator.Instance.Register<IFileReader<MovActionConfig>>(new MovConfigFileReader());
ServiceLocator.Instance.Register<IFileReader<Mv3ActionConfig>>(new Mv3ConfigFileReader());
ServiceLocator.Instance.Register<IFileReader<EffectDefinitionFile>>(new EffectDefinitionFileReader());
ServiceLocator.Instance.Register<IFileReader<SceFile>>(new SceFileReader(codepage));
ServiceLocator.Instance.Register<IFileReader<ScnFile>>(new ScnFileReader(codepage));
// Create and register IFileReader<T> instances using reflection
foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
{
// Get all types that implement any version of IFileReader<>
var fileReaderTypes = assembly.GetTypes().Where(type =>
type.GetInterfaces().Any(_ =>_.IsGenericType &&_.GetGenericTypeDefinition() == typeof(IFileReader<>)));
foreach (Type readerType in fileReaderTypes)
{
Type fileType = readerType.GetInterfaces()
.First(_ => _.GetGenericTypeDefinition() == typeof(IFileReader<>)).GetGenericArguments()[0];
ServiceLocator.Instance.GetType()
.GetMethod(nameof(ServiceLocator.Instance.Register))!
.MakeGenericMethod(typeof(IFileReader<>).MakeGenericType(fileType))
.Invoke(ServiceLocator.Instance, new[] { Activator.CreateInstance(readerType) });
}
}
// Init TextureLoaderFactory
TextureLoaderFactory textureLoaderFactory = new ();
@@ -197,8 +187,7 @@ namespace Pal3
gameSettings);
ServiceLocator.Instance.Register(resourceProvider);
// Cache warm up
resourceProvider.PreLoadMainActorMv3();
Debug.Log($"[{nameof(GameResourceInitializer)}] Game resources initialized.");
// Instantiate starting component
GameObject startingGameObject = Instantiate(startingComponent, null);
@@ -289,7 +278,8 @@ namespace Pal3
timer.Start();
cpkFileSystem = InitializeCpkFileSystem(path, crcHash, codepage);
timer.Stop();
Debug.Log($"All cpk files mounted successfully under {path}. Total time: {timer.Elapsed.TotalSeconds:0.000}s");
Debug.Log($"[{nameof(GameResourceInitializer)}] All .cpk files mounted successfully. " +
$"Total time: {timer.Elapsed.TotalSeconds:0.000}s");
}
catch (Exception ex)
{
@@ -336,23 +326,23 @@ namespace Pal3
List<string> filesToMount = new ()
{
FileConstants.BaseDataCpkFilePath,
FileConstants.MusicCpkFilePath
FileConstants.BaseDataCpkFileRelativePath,
FileConstants.MusicCpkFileRelativePath
};
foreach (string sceneCpkFileName in FileConstants.SceneCpkFileNames)
foreach (var sceneCpkFileName in FileConstants.SceneCpkFileNames)
{
filesToMount.Add(FileConstants.GetSceneCpkFilePath(sceneCpkFileName));
filesToMount.Add(FileConstants.GetSceneCpkFileRelativePath(sceneCpkFileName));
}
#if PAL3A
filesToMount.Add(FileConstants.ScnCpkFilePath);
filesToMount.Add(FileConstants.SceCpkFilePath);
filesToMount.Add(FileConstants.ScnCpkFileRelativePath);
filesToMount.Add(FileConstants.SceCpkFileRelativePath);
#endif
foreach (var cpkFilePath in filesToMount)
foreach (var cpkFileRelativePath in filesToMount)
{
cpkFileSystem.Mount(cpkFilePath, codepage);
cpkFileSystem.Mount(cpkFileRelativePath, codepage);
}
return cpkFileSystem;
@@ -219,11 +219,11 @@ namespace Pal3.GameSystem
}
float width = (_bigMapCanvasGridLayoutGroup.cellSize.x + _bigMapCanvasGridLayoutGroup.spacing.x) *
_selectionButtons.Count - _bigMapCanvasGridLayoutGroup.spacing.x + 80f;
float height = _bigMapCanvasGridLayoutGroup.cellSize.y + 100f;
_selectionButtons.Count - _bigMapCanvasGridLayoutGroup.spacing.x;
float height = _bigMapCanvasGridLayoutGroup.cellSize.y;
_bigMapBackgroundTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, width);
_bigMapBackgroundTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, height);
_bigMapBackgroundTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, width + 50f);
_bigMapBackgroundTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, height + 60f);
_bigMapBackgroundTransform.ForceUpdateRectTransforms();
_bigMapCanvas.alpha = 1f;
@@ -39,7 +39,7 @@ namespace Pal3.GameSystem
ICommandExecutor<ResetGameStateCommand>
{
private const float LIMIT_TIME_DIALOGUE_PLAYER_MAX_REACTION_TIME_IN_SECONDS = 4f;
private const float DIALOGUE_SHOW_HIDE_ANIMATION_DURATION = 0.1f;
private const float DIALOGUE_SHOW_HIDE_ANIMATION_DURATION = 0.12f;
private const float DIALOGUE_SHOW_HIDE_ANIMATION_Y_OFFSET = -30f;
private const float DIALOGUE_FLASHING_ANIMATION_DURATION = 0.5f;
@@ -56,6 +56,7 @@ namespace Pal3.GameSystem
private Canvas _dialogueSelectionButtonsCanvas;
private GameObject _dialogueSelectionButtonPrefab;
private Image _dialogueBackgroundImage;
private RoundedFrostedGlassImage _backgroundFrostedGlassImage;
private Image _avatarImageLeft;
private Image _avatarImageRight;
@@ -100,6 +101,8 @@ namespace Pal3.GameSystem
_dialogueCanvasGroup = Requires.IsNotNull(dialogueCanvasGroup, nameof(dialogueCanvasGroup));
_dialogueBackgroundImage = Requires.IsNotNull(dialogueBackgroundImage, nameof(dialogueBackgroundImage));
_backgroundFrostedGlassImage = Requires.IsNotNull(dialogueBackgroundImage.GetComponent<RoundedFrostedGlassImage>(),
nameof(dialogueBackgroundImage));
_avatarImageLeft = Requires.IsNotNull(avatarImageLeft, nameof(avatarImageLeft));
_avatarImageRight = Requires.IsNotNull(avatarImageRight, nameof(avatarImageRight));
@@ -316,7 +319,7 @@ namespace Pal3.GameSystem
_flashingAnimationCts.Cancel();
_reactionTimer.Stop();
_totalTimeUsedBeforeSkippingTheLastDialogue = _reactionTimer.Elapsed.TotalSeconds;
Debug.LogWarning($"Reaction time: {_totalTimeUsedBeforeSkippingTheLastDialogue:0.00f}");
Debug.LogWarning($"[{nameof(DialogueManager)}] Reaction time: {_totalTimeUsedBeforeSkippingTheLastDialogue:0.00f}");
}
yield return PlayDialogueBackgroundPopAnimationAsync(false);
@@ -330,35 +333,41 @@ namespace Pal3.GameSystem
private IEnumerator PlayDialogueBackgroundFlashingAnimationAsync(float duration, CancellationToken cancellationToken)
{
var startTime = Time.realtimeSinceStartup;
float startTime = Time.realtimeSinceStartup;
float initialBlurAmount = _backgroundFrostedGlassImage.blurAmount;
float initialTransparency = _backgroundFrostedGlassImage.transparency;
const float minThresholdPercentage = 0.65f;
while (!cancellationToken.IsCancellationRequested)
{
yield return CoreAnimation.EnumerateValueAsync(1f, 0.2f, DIALOGUE_FLASHING_ANIMATION_DURATION / 2f,
yield return CoreAnimation.EnumerateValueAsync(1f, minThresholdPercentage, DIALOGUE_FLASHING_ANIMATION_DURATION / 2f,
AnimationCurveType.Linear, value =>
{
_dialogueCanvasGroup.alpha = value;
_backgroundFrostedGlassImage.SetMaterialBlurAmount(initialBlurAmount * value);
_backgroundFrostedGlassImage.SetMaterialTransparency(initialTransparency * value);
}, cancellationToken);
if (Time.realtimeSinceStartup - startTime >= duration) break;
yield return CoreAnimation.EnumerateValueAsync(0.2f, 1f, DIALOGUE_FLASHING_ANIMATION_DURATION / 2f,
yield return CoreAnimation.EnumerateValueAsync(minThresholdPercentage, 1f, DIALOGUE_FLASHING_ANIMATION_DURATION / 2f,
AnimationCurveType.Linear, value =>
{
_dialogueCanvasGroup.alpha = value;
_backgroundFrostedGlassImage.SetMaterialBlurAmount(initialBlurAmount * value);
_backgroundFrostedGlassImage.SetMaterialTransparency(initialTransparency * value);
}, cancellationToken);
if (Time.realtimeSinceStartup - startTime >= duration) break;
}
_dialogueCanvasGroup.alpha = 1f;
_backgroundFrostedGlassImage.SetMaterialBlurAmount(initialBlurAmount);
_backgroundFrostedGlassImage.SetMaterialTransparency(initialTransparency);
}
private IEnumerator PlayDialogueBackgroundPopAnimationAsync(bool showDialogue)
{
const float yOffset = DIALOGUE_SHOW_HIDE_ANIMATION_Y_OFFSET;
Transform dialogueCanvasGroupTransform = _dialogueCanvasGroup.transform;
Vector3 finalPosition = dialogueCanvasGroupTransform.position;
Vector3 finalPosition = dialogueCanvasGroupTransform.localPosition;
Vector3 startPosition = finalPosition + new Vector3(0f, yOffset, 0);
float startValue = showDialogue ? 0f : 1f;
@@ -366,17 +375,23 @@ namespace Pal3.GameSystem
if (showDialogue)
{
dialogueCanvasGroupTransform.position = startPosition;
dialogueCanvasGroupTransform.localPosition = startPosition;
}
var initialBlurAmount = _backgroundFrostedGlassImage.blurAmount;
var initialTransparency = _backgroundFrostedGlassImage.transparency;
yield return CoreAnimation.EnumerateValueAsync(startValue, endValue, DIALOGUE_SHOW_HIDE_ANIMATION_DURATION,
AnimationCurveType.Linear, value =>
AnimationCurveType.EaseIn, value =>
{
_dialogueCanvasGroup.transform.position = finalPosition + new Vector3(0f, yOffset * (1 - value), 0);
_dialogueCanvasGroup.transform.localPosition = finalPosition + new Vector3(0f, yOffset * (1 - value), 0);
_dialogueCanvasGroup.alpha = value;
_backgroundFrostedGlassImage.SetMaterialBlurAmount(initialBlurAmount * value);
_backgroundFrostedGlassImage.SetMaterialTransparency(initialTransparency * value);
});
_backgroundFrostedGlassImage.SetMaterialBlurAmount(initialBlurAmount);
_backgroundFrostedGlassImage.SetMaterialTransparency(initialTransparency);
_dialogueCanvasGroup.transform.position = finalPosition; // Always set to final position
_dialogueCanvasGroup.transform.localPosition = finalPosition; // Always set to final position
_dialogueCanvasGroup.alpha = showDialogue ? 1f : 0f;
}
@@ -416,17 +431,21 @@ namespace Pal3.GameSystem
{
// Easter egg + dev notes
#if PAL3
if (text.Equals("韩用:\\n知道吗?\\i使用鼠标滚轮可以旋转镜头\\r,这样就不怕人物被挡住了。"))
if (text.Equals("韩用:\\n知道吗?\\i使用鼠标滚轮可以旋转镜头\\r,这样就不怕人物被挡住了。") ||
text.Equals("韓用:\\n知道嗎?\\i使用滑鼠滾輪可以旋轉鏡頭\\r,這樣就不怕人物被擋住了。"))
#elif PAL3A
if (text.Equals("蜀中第一丐:\\n我蜀中第一丐四海为家,过的桥比你走的路还多,有什么不明白的尽管问~~\\n" +
"今天心情好,就再多透露点秘密给你吧,假如在城镇、迷宫中人物被挡住了,可以试试\\i用鼠标滚轮旋转镜头\\r,会有不错的效果哦。" +
"另外,画面\\i左下角\\r那东西叫作\\i“司南”\\r,只要点一下,就能看到地图,认清方向了。"))
"今天心情好,就再多透露点秘密给你吧,假如在城镇、迷宫中人物被挡住了,可以试试\\i用鼠标滚轮旋转镜头\\r,会有不错的效果哦。" +
"另外,画面\\i左下角\\r那东西叫作\\i“司南”\\r,只要点一下,就能看到地图,认清方向了。") ||
text.Equals("蜀中第一丐:\\n我蜀中第一丐四海為家,過的橋比你走的路還多,有什麼不明白的儘管問~~\\n" +
"今天心情好,就再多透露點秘密給你吧,假如在城鎮、迷宮中人物被擋住了,可以試試\\i用滑鼠滾輪旋轉鏡頭\\r,會有不錯的效果哦。" +
"另外,畫面\\i左下角\\r那東西叫作\\i「司南」\\r,只要點一下,就能看到地圖,認清方向了。"))
#endif
{
text = $"知道吗?您现在玩的{GameConstants.AppNameCNFull}是由\\i柒才\\r使用C#/Unity开发的复刻版,免费开源且支持全平台。" +
text = $"知道吗?您现在玩的{GameConstants.AppNameCNFull}是由\\i柒才\\r使用C#/Unity开发(完全重写)的复刻版,免费开源且支持全平台(Win/Mac/Linux/iOS/Android)。" +
"如果您是花钱得到的,那么恭喜您成为盗版游戏的受害者。" +
$"当前游戏还在开发中,包括战斗在内的很多功能尚未实现,请耐心等待,也欢迎加入本游戏QQ群与作者联系:\\i252315306\\r," +
"或者您也可以在B站关注Up主\\i@柒才\\r!";
$"当前游戏还在开发中,包括战斗在内的很多功能尚未实现,请耐心等待,也欢迎加入本游戏QQ群与作者联系或下载最新版:\\i252315306\\r," +
"您也可以在B站关注Up主\\i@柒才\\r获取最新开发信息!另外,全平台都支持手柄哦~";
}
var formattedText = text.Replace("\\n", "\n");
Loaded 100 of 164 files, more files were not shown because too many files have changed in this diff. Show more