mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-02-04 17:02:17 +08:00
Compare commits
134 Commits
11786bbd2c
...
dfd34601cf
| Author | SHA1 | Date | |
|---|---|---|---|
| dfd34601cf | |||
| 6934607fca | |||
| be9de43492 | |||
| 2dbf017a5e | |||
| 3c7744047c | |||
| a9959a2f07 | |||
| 77f5803a24 | |||
| e9bbcf5e2c | |||
| a183485286 | |||
| 5a6cfb18c9 | |||
| 49226001be | |||
| 7c1e88f86d | |||
| 16429936a9 | |||
| d711dd25ef | |||
| e909b6d9d2 | |||
| 2a4008deac | |||
| 6b423225fe | |||
| 9d9a12c1af | |||
| 1d11ba90bd | |||
| a5dc7c5825 | |||
| 73ebcf1aa3 | |||
| dc092d7f6f | |||
| d9f87ca4e9 | |||
| a3c60c32ca | |||
| 96a9e8a570 | |||
| d6a8275938 | |||
| b995503f58 | |||
| a25f74443d | |||
| 5f37b8b6d6 | |||
| 4584895345 | |||
| 5b4633e54c | |||
| 31b1d90d5d | |||
| 8446fba0e4 | |||
| 688b50344c | |||
| 0dd1a11c14 | |||
| f8552d5c34 | |||
| c98c801f27 | |||
| 9bfa74edf2 | |||
| 9d586d68e0 | |||
| a446a17d02 | |||
| 7a7943b001 | |||
| a9dd130f76 | |||
| 0178c8cc2e | |||
| 4e2b4a8e22 | |||
| 4f292bd2d3 | |||
| 2949066712 | |||
| b093a62e36 | |||
| f58bd869fe | |||
| b7abb3a32a | |||
| b79cfbc994 | |||
| c91a873e8d | |||
| 4b632db315 | |||
| 2c4d1b8b0d | |||
| ba095d79f0 | |||
| a9286d2839 | |||
| 17aca89249 | |||
| 4a3bffd927 | |||
| cb3975ae1a | |||
| 4ba1512205 | |||
| c6f1a8bd80 | |||
| dc246170ac | |||
| 23aa8c1f13 | |||
| 944a4d7948 | |||
| f7e1a27be1 | |||
| b6c182168b | |||
| 7d98471dca | |||
| e460b55eb4 | |||
| 177d8b3caf | |||
| 75030c5b23 | |||
| 7bd8abe7e6 | |||
| b51cb326b7 | |||
| f2a849c1af | |||
| c7465133f7 | |||
| ac2cc258ee | |||
| 586ce9a427 | |||
| b060204d80 | |||
| 47cfb4d79a | |||
| fb3a74c7e7 | |||
| 0d5a07b1ac | |||
| 780ad3d3ec | |||
| 40e3206953 | |||
| 167f53e2df | |||
| f407928579 | |||
| 5545d7a2bf | |||
| 2124719de0 | |||
| 8550a354f1 | |||
| f6f28efd88 | |||
| d61b40216c | |||
| 6877b8e9ac | |||
| 950bde3464 | |||
| 8362fcf546 | |||
| b86825c645 | |||
| bb18912155 | |||
| 99b7943d76 | |||
| 5f53c50da0 | |||
| 68a18c113d | |||
| 40aa331294 | |||
| 150868fcea | |||
| fd2aa924ff | |||
| 1ae4aa3ecb | |||
| 996a57130c | |||
| 5c187fb32e | |||
| e765f0f42d | |||
| 65522c6f21 | |||
| 2a3fed7180 | |||
| 78379165e8 | |||
| f32b11f49a | |||
| 3c8f258a1b | |||
| 8d7f8e8c8a | |||
| d867bca1ba | |||
| 1d01fdbd15 | |||
| db0970c3c4 | |||
| a3bb6ea609 | |||
| ac7f2ef63c | |||
| 5674d601ec | |||
| cdd71006b8 | |||
| 0491973a85 | |||
| 82e0e2ac43 | |||
| 63eed23826 | |||
| 69702d4f09 | |||
| 69ab11c392 | |||
| 092795cbac | |||
| adcce8e298 | |||
| 0f80dac134 | |||
| 5dba87dc7f | |||
| c30758cfab | |||
| e458f42f4a | |||
| 74c61c3eb9 | |||
| b34909d71a | |||
| 087ceac1e3 | |||
| 043e7a8e70 | |||
| 34822453a7 | |||
| 0a8fa9971c | |||
| f224b72838 |
7
.markdownlint.json
Normal file
7
.markdownlint.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"MD013": false,
|
||||
"MD033": {
|
||||
"allowed_elements": ["details", "summary"]
|
||||
},
|
||||
"MD041": false
|
||||
}
|
||||
BIN
AssemblyFromGame/Assembly-CSharp.dll
Normal file
BIN
AssemblyFromGame/Assembly-CSharp.dll
Normal file
Binary file not shown.
BIN
AssemblyFromGame/UnityEngine.UI.dll
Normal file
BIN
AssemblyFromGame/UnityEngine.UI.dll
Normal file
Binary file not shown.
@@ -1,281 +1,323 @@
|
||||
<details>
|
||||
<summary>Read me in English</summary>
|
||||
|
||||
## Changlog
|
||||
|
||||
* 2.4.0
|
||||
* Support game version 0.10.33
|
||||
* `Generate illegal dyson shell`: This function is open to all users now, enabling certain config entry is not needed any more.
|
||||
* 2.3.32
|
||||
* `Complete Dyson Sphere Shells instantly`: Fix a crash.
|
||||
* 2.3.31
|
||||
* New feature: `Unlock Dyson Sphere max orbit radius`
|
||||
* `Remove metadata consumption record in current game`: Fix implementation
|
||||
* Add 3 buttons for creating illegal Dyson Sphere Shells, you must enable `IllegalDysonShellFunctionsEnabled` of `DysonSphere` section in config to see them.
|
||||
* `Generate an illegal dyson shell`
|
||||
* `Keep max production shells and remove others`
|
||||
* `Duplicate shells from that with highest production`
|
||||
* 2.3.30
|
||||
* Fix a warning issue while `No condition build` or `No collision` is enabled.
|
||||
* Increase performance for `Finish build immediately` greatly on pasting large blueprints.
|
||||
* 2.3.29
|
||||
* Fix compatibility with game update 0.10.32.25779
|
||||
* 2.3.28
|
||||
* New feature: `Instant hand-craft`.
|
||||
* Fix some panels' display while `Infinite Natural Resources` is enabled.
|
||||
* 2.3.27
|
||||
* `Skip bullet period` & `Eject anyway`: Fix compatibility with `Dyson Sphere Program v0.10.32.25496`.
|
||||
* 2.3.26
|
||||
+ Refactor codes to adapt to UXAssist 1.2.0
|
||||
- You should update UXAssist to 1.2.0 or later before using this version.
|
||||
+ `Complete Dyson Sphere Shells instantly`: Fix possible wrong production records.
|
||||
* Refactor codes to adapt to UXAssist 1.2.0
|
||||
* You should update UXAssist to 1.2.0 or later before using this version.
|
||||
* `Complete Dyson Sphere Shells instantly`: Fix possible wrong production records.
|
||||
* 2.3.25
|
||||
+ New feature: `Enable warp without space warpers`
|
||||
+ New feature: `Wind Turbines do global power coverage`
|
||||
+ Fix an issue that `Complete Dyson Sphere Shells instantly` does not generate production records for solar sails.
|
||||
|
||||
<details>
|
||||
<summary>Older versions</summary>
|
||||
|
||||
* New feature: `Enable warp without space warpers`
|
||||
* New feature: `Wind Turbines do global power coverage`
|
||||
* Fix an issue that `Complete Dyson Sphere Shells instantly` does not generate production records for solar sails.
|
||||
* 2.3.24
|
||||
+ `Complete Dyson Sphere Shells instantly`: Fix a bug that may cause negative power in some cases
|
||||
* `Complete Dyson Sphere Shells instantly`: Fix a bug that may cause negative power in some cases
|
||||
* 2.3.23
|
||||
+ New feature: `Complete Dyson Sphere Shells instantly`
|
||||
+ Fix a crash when config panel is opened before game is fully loaded
|
||||
* New feature: `Complete Dyson Sphere Shells instantly`
|
||||
* Fix a crash when config panel is opened before game is fully loaded
|
||||
* 2.3.22
|
||||
+ Fix `Pump Anywhere`
|
||||
* Fix `Pump Anywhere`
|
||||
* 2.3.21
|
||||
+ `Retrieve/Place items from/to remote planets on logistics control panel`: Items are put back to player's inventory when a slot is removed from the logistics station on remote planet.
|
||||
+ `Dev Shortcuts`: Camera Pose related shortcurts are working now.
|
||||
* `Retrieve/Place items from/to remote planets on logistics control panel`: Items are put back to player's inventory when a slot is removed from the logistics station on remote planet.
|
||||
* `Dev Shortcuts`: Camera Pose related shortcurts are working now.
|
||||
* 2.3.20
|
||||
+ New feature: `Retrieve/Place items from/to remote planets on logistics control panel`
|
||||
* New feature: `Retrieve/Place items from/to remote planets on logistics control panel`
|
||||
* 2.3.19
|
||||
+ New features:
|
||||
+ `Remove all metadata consumption records`
|
||||
+ `Remove metadata consumption record in current game`
|
||||
+ `Clear metadata flag which bans achievements`
|
||||
* New features:
|
||||
* `Remove all metadata consumption records`
|
||||
* `Remove metadata consumption record in current game`
|
||||
* `Clear metadata flag which bans achievements`
|
||||
* 2.3.18
|
||||
+ New features:
|
||||
+ `Teleport to outer space`, this will teleport you to the outer space which is 50 LYs far from the farthest star.
|
||||
+ `Teleport to selected astronomical`
|
||||
+ Fix logic of `Unlock techs with key-modifiers`.
|
||||
+ `No condition build` does not hide rotation info of belts now.
|
||||
* New features:
|
||||
* `Teleport to outer space`, this will teleport you to the outer space which is 50 LYs far from the farthest star.
|
||||
* `Teleport to selected astronomical`
|
||||
* Fix logic of `Unlock techs with key-modifiers`.
|
||||
* `No condition build` does not hide rotation info of belts now.
|
||||
* 2.3.17
|
||||
+ Make compatible with game version 0.10.30.23292
|
||||
* Make compatible with game version 0.10.30.23292
|
||||
* 2.3.16
|
||||
+ Add 2 options to `Belt signal item generation`:
|
||||
- `Count generations as production in statistics`
|
||||
- `Count removals as consumption in statistics`
|
||||
+ New feature: `Increase maximum power usage in Logistic Stations and Advanced Mining Machines`
|
||||
- Logistic Stations: Increased max charging power to 3GW(ILS) and 600MW(PLS) (10x of original)
|
||||
- Advanced Mining Machines: Increased max mining speed to 1000%
|
||||
* Add 2 options to `Belt signal item generation`:
|
||||
* `Count generations as production in statistics`
|
||||
* `Count removals as consumption in statistics`
|
||||
* New feature: `Increase maximum power usage in Logistic Stations and Advanced Mining Machines`
|
||||
* Logistic Stations: Increased max charging power to 3GW(ILS) and 600MW(PLS) (10x of original)
|
||||
* Advanced Mining Machines: Increased max mining speed to 1000%
|
||||
* 2.3.15
|
||||
+ New features:
|
||||
- `Instant teleport (like that in Sandbox mode)`
|
||||
- `Mecha and Drones/Fleets invicible`
|
||||
- `Buildings invicible`
|
||||
* New features:
|
||||
* `Instant teleport (like that in Sandbox mode)`
|
||||
* `Mecha and Drones/Fleets invicible`
|
||||
* `Buildings invicible`
|
||||
* 2.3.14
|
||||
+ Remove default shortcut key for `No condition build` and `No collision`, to avoid misoperation. You can still set them in system settings window manually if needed.
|
||||
+ Fix translation issue.
|
||||
* Remove default shortcut key for `No condition build` and `No collision`, to avoid misoperation. You can still set them in system settings window manually if needed.
|
||||
* Fix translation issue.
|
||||
* 2.3.13
|
||||
+ Fix a bug that shortcuts are not working and have display issue on settings window.
|
||||
* Fix a bug that shortcuts are not working and have display issue on settings window.
|
||||
* 2.3.12
|
||||
+ Add a shortcut to toggle `No collision`, you can modify the shortcut on system settings window.
|
||||
+ Add realtime tips when toggling `No condition build` and `No collision` with shortcuts.
|
||||
* Add a shortcut to toggle `No collision`, you can modify the shortcut on system settings window.
|
||||
* Add realtime tips when toggling `No condition build` and `No collision` with shortcuts.
|
||||
* 2.3.11
|
||||
+ Add a shortcut to toggle `No condition build`, you can modify the shortcut on system settings window. This depends on [UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist) 1.0.15 or later.
|
||||
* Add a shortcut to toggle `No condition build`, you can modify the shortcut on system settings window. This depends on [UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist) 1.0.15 or later.
|
||||
* 2.3.10
|
||||
+ Fix following functions not working in new game updates:
|
||||
- `Pump Anywhere`
|
||||
- `Terraform without enough soil piles`
|
||||
* Fix following functions not working in new game updates:
|
||||
* `Pump Anywhere`
|
||||
* `Terraform without enough soil piles`
|
||||
* 2.3.9
|
||||
+ Support game version 0.10.28.21219
|
||||
* Support game version 0.10.28.21219
|
||||
* 2.3.8
|
||||
+ Fix a crash on starting new games while `Finish build immediately` is enabled.
|
||||
+ Fix UI button width.
|
||||
* Fix a crash on starting new games while `Finish build immediately` is enabled.
|
||||
* Fix UI button width.
|
||||
* 2.3.7
|
||||
+ Support game version 0.10.28.20759
|
||||
+ Fix belt signal that items' generation speed is not fit to number set sometimes.
|
||||
* Support game version 0.10.28.20759
|
||||
* Fix belt signal that items' generation speed is not fit to number set sometimes.
|
||||
* 2.3.6
|
||||
+ Support for UXAssist's new function within `Finish build immediately`.
|
||||
+ Add a warning message when `Build without condition` is enabled.
|
||||
+ Fix an issue in `Finish build immediately` that some buildings are not finished immediately.
|
||||
* Support for UXAssist's new function within `Finish build immediately`.
|
||||
* Add a warning message when `Build without condition` is enabled.
|
||||
* Fix an issue in `Finish build immediately` that some buildings are not finished immediately.
|
||||
* 2.3.5
|
||||
+ Fix another crash in `Skip bullet period`.
|
||||
* Fix another crash in `Skip bullet period`.
|
||||
* 2.3.4
|
||||
+ Use new tab layout of UXAssist 1.0.2
|
||||
+ Minor bug fixes
|
||||
* Use new tab layout of UXAssist 1.0.2
|
||||
* Minor bug fixes
|
||||
* 2.3.3
|
||||
+ Fix a crash in `Skip bullet period`.
|
||||
+ Unlock techs with Alt unlocks VeinUtil to 10000 instead of 7200 now, as bug fixed in UXAssist.
|
||||
* Fix a crash in `Skip bullet period`.
|
||||
* Unlock techs with Alt unlocks VeinUtil to 10000 instead of 7200 now, as bug fixed in UXAssist.
|
||||
* 2.3.2
|
||||
+ Birth star options moved to [UniverseGenTweaks](https://dsp.thunderstore.io/package/soarqin/UniverseGenTweaks/)
|
||||
+ Optimize `Quick absorb`, consumes less CPU time and take turns firing to nodes.
|
||||
+ `Fast Mining` ensures full output of oil extractors now.
|
||||
+ Fix issue that `Belt signal generator` not working after switched off then on again.
|
||||
+ Fix absorption issue by `Quick absorb` and `Skip bullet period` enabled at the same time.
|
||||
+ Crash fix for some options
|
||||
* Birth star options moved to [UniverseGenTweaks](https://dsp.thunderstore.io/package/soarqin/UniverseGenTweaks/)
|
||||
* Optimize `Quick absorb`, consumes less CPU time and take turns firing to nodes.
|
||||
* `Fast Mining` ensures full output of oil extractors now.
|
||||
* Fix issue that `Belt signal generator` not working after switched off then on again.
|
||||
* Fix absorption issue by `Quick absorb` and `Skip bullet period` enabled at the same time.
|
||||
* Crash fix for some options
|
||||
* 2.3.1
|
||||
+ Add UXAssist to dependencies in manifest.
|
||||
* Add UXAssist to dependencies in manifest.
|
||||
* 2.3.0
|
||||
+ Move some functions to an individual mod: [UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist)
|
||||
+ Depends on [UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist) now, so that config panel is unified with UXAssist.
|
||||
+ Remove `LCtrl+A` from Dev Shortcuts, to avoid misoperation.
|
||||
+ Infinite bots/drones/vessels in `Architect mode` now.
|
||||
* Move some functions to an individual mod: [UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist)
|
||||
* Depends on [UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist) now, so that config panel is unified with UXAssist.
|
||||
* Remove `LCtrl+A` from Dev Shortcuts, to avoid misoperation.
|
||||
* Infinite bots/drones/vessels in `Architect mode` now.
|
||||
* 2.2.7
|
||||
+ New function: `Construct only nodes but frames`
|
||||
+ Opening config panel does not close inventory panel now
|
||||
+ Remove `Input direction conflict` check while using `Remove some build conditions`
|
||||
+ Fix a bug that prevents `Belt signal alt format` from switching number formats for current belt signals
|
||||
* New function: `Construct only nodes but frames`
|
||||
* Opening config panel does not close inventory panel now
|
||||
* Remove `Input direction conflict` check while using `Remove some build conditions`
|
||||
* Fix a bug that prevents `Belt signal alt format` from switching number formats for current belt signals
|
||||
* 2.2.6
|
||||
+ New function: `Stop ejectors when available nodes are all filled up`
|
||||
+ Fix a bug that absorb solar sails on unfinised nodes
|
||||
* New function: `Stop ejectors when available nodes are all filled up`
|
||||
* Fix a bug that absorb solar sails on unfinised nodes
|
||||
* 2.2.5
|
||||
+ Skip all intermediate states and absorb solar sails instantly while enable `Quick absorb`, `Skip bullet period` and `Skip absorption period` at the same time.
|
||||
+ Fix a problem that `Quick absorb` does not absorb all solar sails instantly when most nodes are full.
|
||||
+ Fix crash while using with some mods
|
||||
* Skip all intermediate states and absorb solar sails instantly while enable `Quick absorb`, `Skip bullet period` and `Skip absorption period` at the same time.
|
||||
* Fix a problem that `Quick absorb` does not absorb all solar sails instantly when most nodes are full.
|
||||
* Fix crash while using with some mods
|
||||
* 2.2.4
|
||||
+ New function: `Enable player actions in globe view`
|
||||
+ Fix UI bug
|
||||
* New function: `Enable player actions in globe view`
|
||||
* Fix UI bug
|
||||
* 2.2.3
|
||||
+ New function: `Remove some build conditions`
|
||||
+ Fix compatibility with some mods
|
||||
* New function: `Remove some build conditions`
|
||||
* Fix compatibility with some mods
|
||||
* 2.2.2
|
||||
+ New function: `Assign gamesave to currrnet account`
|
||||
+ New subfunction: `Belt signal alt format`
|
||||
+ Fix a crash on using `Initialize this Planet`
|
||||
+ Fix belt build in `Finish build immediately`
|
||||
* New function: `Assign gamesave to currrnet account`
|
||||
* New subfunction: `Belt signal alt format`
|
||||
* Fix a crash on using `Initialize this Planet`
|
||||
* Fix belt build in `Finish build immediately`
|
||||
* 2.2.1
|
||||
+ Check condition for miners even when `Build without condition` is enabled.
|
||||
+ Fix a patch issue that may cause `Build without condition` not working.
|
||||
* Check condition for miners even when `Build without condition` is enabled.
|
||||
* Fix a patch issue that may cause `Build without condition` not working.
|
||||
* 2.2.0
|
||||
+ Add some power related functions
|
||||
+ Add a subfunction to belt signal item generation, which simulates production process of raws and intermediates on statistics
|
||||
+ Split some functions from Architect mode
|
||||
* Add some power related functions
|
||||
* Add a subfunction to belt signal item generation, which simulates production process of raws and intermediates on statistics
|
||||
* Split some functions from Architect mode
|
||||
* 2.1.0
|
||||
+ Belt signal item generation
|
||||
+ Fix window display priority which may cause tips to be covered by main window
|
||||
* Belt signal item generation
|
||||
* Fix window display priority which may cause tips to be covered by main window
|
||||
* 2.0.0
|
||||
+ Refactorying codes
|
||||
+ UI implementation
|
||||
+ Add a lot of functions
|
||||
* Refactorying codes
|
||||
* UI implementation
|
||||
* Add a lot of functions
|
||||
* 1.0.0
|
||||
+ Initial release
|
||||
* Initial release
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>中文读我</summary>
|
||||
|
||||
## 更新日志
|
||||
|
||||
* 2.4.0
|
||||
* 支持游戏版本 0.10.33
|
||||
* `生成仙术戴森壳`:此功能现在对所有用户开放,不再需要启用特定的配置项。
|
||||
* 2.3.32
|
||||
* `立即完成戴森壳建造`:修复了一个崩溃问题
|
||||
* 2.3.31
|
||||
* 新功能:`解锁戴森球最大轨道半径`
|
||||
* `移除当前存档的元数据消耗记录`:修复实现
|
||||
* 增加了3个用于制作仙术戴森壳的按钮,你必须在设置文件里开启`DysonSphere`分类的`IllegalDysonShellFunctionsEnabled`才能看到它们
|
||||
* `生成单层仙术戴森壳`
|
||||
* `保留发电量最高的戴森壳并移除其他戴森壳`
|
||||
* `从发电量最高的壳复制戴森壳`
|
||||
* 2.3.30
|
||||
* 修复了启用`无条件建造`或`无碰撞`时的警告问题
|
||||
* 粘贴大规模蓝图时大幅提升`立即完成建造`的性能表现
|
||||
* 2.3.29
|
||||
* 修复了与游戏更新0.10.32.25779的兼容性
|
||||
* 2.3.28
|
||||
* 新功能:`快速手动制造`
|
||||
* 修复了启用`自然资源采集不消耗`时部分面板的显示问题
|
||||
* 2.3.27
|
||||
* `跳过子弹阶段`和`全球弹射`:修复了与`戴森球计划 v0.10.32.25496`的兼容性
|
||||
* 2.3.26
|
||||
+ 重构代码以适应UXAssist 1.2.0
|
||||
- 在使用此版本之前,您应先更新UXAssist到1.2.0或更高版本。
|
||||
+ `立即完成戴森壳建造`:修复了可能导致错误的生产记录的问题
|
||||
* 重构代码以适应UXAssist 1.2.0
|
||||
* 在使用此版本之前,您应先更新UXAssist到1.2.0或更高版本。
|
||||
* `立即完成戴森壳建造`:修复了可能导致错误的生产记录的问题
|
||||
* 2.3.25
|
||||
+ 新功能:`无需空间翘曲器即可曲速飞行`
|
||||
+ 新功能:`风力涡轮机供电覆盖全球`
|
||||
+ 修复了`立即完成戴森壳建造`未生成太阳帆生产记录的问题
|
||||
|
||||
<details>
|
||||
<summary>更早的版本</summary>
|
||||
|
||||
2.3.24
|
||||
+ `立即完成戴森壳建造`:修复了在某些情况下可能导致发电为负的问题
|
||||
* 新功能:`无需空间翘曲器即可曲速飞行`
|
||||
* 新功能:`风力涡轮机供电覆盖全球`
|
||||
* 修复了`立即完成戴森壳建造`未生成太阳帆生产记录的问题
|
||||
* 2.3.24
|
||||
* `立即完成戴森壳建造`:修复了在某些情况下可能导致发电为负的问题
|
||||
* 2.3.23
|
||||
+ 新功能:`立即完成戴森壳建造`
|
||||
+ 修复了在游戏完全加载前打开配置面板可能导致的崩溃问题
|
||||
* 新功能:`立即完成戴森壳建造`
|
||||
* 修复了在游戏完全加载前打开配置面板可能导致的崩溃问题
|
||||
* 2.3.22
|
||||
+ 修复了`平地抽水`
|
||||
* 修复了`平地抽水`
|
||||
* 2.3.21
|
||||
+ `在物流总控面板上可以从非本地行星取放物品`:当从非本地星球的物流站移除槽位时,物品会放回玩家的背包
|
||||
+ `开发模式快捷键`:摄像机位(Pose)相关的快捷键现在生效了
|
||||
* `在物流总控面板上可以从非本地行星取放物品`:当从非本地星球的物流站移除槽位时,物品会放回玩家的背包
|
||||
* `开发模式快捷键`:摄像机位(Pose)相关的快捷键现在生效了
|
||||
* 2.3.20
|
||||
+ 新功能:`在物流总控面板上可以从非本地行星取放物品`
|
||||
* 新功能:`在物流总控面板上可以从非本地行星取放物品`
|
||||
* 2.3.19
|
||||
+ 新功能:
|
||||
+ `移除所有元数据消耗记录`
|
||||
+ `移除当前存档的元数据消耗记录`
|
||||
+ `解除当前存档因使用元数据导致的成就限制`
|
||||
* 新功能:
|
||||
* `移除所有元数据消耗记录`
|
||||
* `移除当前存档的元数据消耗记录`
|
||||
* `解除当前存档因使用元数据导致的成就限制`
|
||||
* 2.3.18
|
||||
+ 新功能:
|
||||
+ `传送到外太空`,这会将你传送到距离最远星球50光年的外太空
|
||||
+ `传送到选中天体`
|
||||
+ 修复了`组合键解锁科技`的逻辑
|
||||
+ `无条件建造`现在不会隐藏传送带的旋转信息了
|
||||
* 新功能:
|
||||
* `传送到外太空`,这会将你传送到距离最远星球50光年的外太空
|
||||
* `传送到选中天体`
|
||||
* 修复了`组合键解锁科技`的逻辑
|
||||
* `无条件建造`现在不会隐藏传送带的旋转信息了
|
||||
* 2.3.17
|
||||
+ 适配游戏版本0.10.30.23292
|
||||
* 适配游戏版本0.10.30.23292
|
||||
* 2.3.16
|
||||
+ 为`传送带信号物品生成`添加了两个选项:
|
||||
- `统计信息里将生成计算为产物`
|
||||
- `统计信息里将移除计算为消耗`
|
||||
+ 新功能:`提升物流塔和大型采矿机的最大功耗`
|
||||
- 物流塔:将最大充电功率提高到3GW(星际物流塔)和600MW(行星物流塔)(原来的10倍)
|
||||
- 大型采矿机:将最大采矿速度提高到1000%
|
||||
* 为`传送带信号物品生成`添加了两个选项:
|
||||
* `统计信息里将生成计算为产物`
|
||||
* `统计信息里将移除计算为消耗`
|
||||
* 新功能:`提升物流塔和大型采矿机的最大功耗`
|
||||
* 物流塔:将最大充电功率提高到3GW(星际物流塔)和600MW(行星物流塔)(原来的10倍)
|
||||
* 大型采矿机:将最大采矿速度提高到1000%
|
||||
* 2.3.15
|
||||
+ 新功能:
|
||||
- `快速传送(和沙盒模式一样)`
|
||||
- `机甲和战斗无人机无敌`
|
||||
- `建筑无敌`
|
||||
* 新功能:
|
||||
* `快速传送(和沙盒模式一样)`
|
||||
* `机甲和战斗无人机无敌`
|
||||
* `建筑无敌`
|
||||
* 2.3.14
|
||||
+ 移除了`无条件建造`和`无碰撞`的默认快捷键,以避免误操作。如有需要请手动在系统选项窗口中设置。
|
||||
+ 修复了翻译问题。
|
||||
* 移除了`无条件建造`和`无碰撞`的默认快捷键,以避免误操作。如有需要请手动在系统选项窗口中设置。
|
||||
* 修复了翻译问题。
|
||||
* 2.3.13
|
||||
+ 修复了快捷键无效和设置窗口上的按键显示问题
|
||||
* 修复了快捷键无效和设置窗口上的按键显示问题
|
||||
* 2.3.12
|
||||
+ 添加了一个快捷键来切换`无碰撞`,你可以在系统设置面板中修改快捷键。
|
||||
+ 在使用快捷键切换`无条件建造`和`无碰撞`时添加了实时提示信息。
|
||||
* 添加了一个快捷键来切换`无碰撞`,你可以在系统设置面板中修改快捷键。
|
||||
* 在使用快捷键切换`无条件建造`和`无碰撞`时添加了实时提示信息。
|
||||
* 2.3.11
|
||||
+ 添加了一个快捷键来切换`无条件建造`,你可以在系统设置面板中修改快捷键。这依赖于[UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist) 1.0.15或更高版本
|
||||
* 添加了一个快捷键来切换`无条件建造`,你可以在系统设置面板中修改快捷键。这依赖于[UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist) 1.0.15或更高版本
|
||||
* 2.3.10
|
||||
+ 修复了以下功能在新游戏版本中不生效的问题:
|
||||
- `平地抽水`
|
||||
- `沙土不够时依然可以整改地形`
|
||||
* 修复了以下功能在新游戏版本中不生效的问题:
|
||||
* `平地抽水`
|
||||
* `沙土不够时依然可以整改地形`
|
||||
* 2.3.9
|
||||
+ 支持游戏版本0.10.28.21219
|
||||
* 支持游戏版本0.10.28.21219
|
||||
* 2.3.8
|
||||
+ 修复了启用`建造秒完成`时开新游戏可能导致崩溃的问题
|
||||
+ 修复了UI按钮宽度
|
||||
* 修复了启用`建造秒完成`时开新游戏可能导致崩溃的问题
|
||||
* 修复了UI按钮宽度
|
||||
* 2.3.7
|
||||
+ 支持游戏版本0.10.28.20759
|
||||
+ 修复了传送带信号有时候物品生成速度和设置不匹配的问题
|
||||
* 支持游戏版本0.10.28.20759
|
||||
* 修复了传送带信号有时候物品生成速度和设置不匹配的问题
|
||||
* 2.3.6
|
||||
+ 在`建造秒完成`中支持UXAssist的新功能
|
||||
+ 在启用`无条件建造`时添加警告信息
|
||||
+ 修复了`建造秒完成`可能导致部分建筑无法立即完成的问题
|
||||
* 在`建造秒完成`中支持UXAssist的新功能
|
||||
* 在启用`无条件建造`时添加警告信息
|
||||
* 修复了`建造秒完成`可能导致部分建筑无法立即完成的问题
|
||||
* 2.3.5
|
||||
+ 修复了`跳过子弹阶段`可能导致崩溃的问题
|
||||
* 修复了`跳过子弹阶段`可能导致崩溃的问题
|
||||
* 2.3.4
|
||||
+ 使用UXAssist 1.0.2的新页签布局
|
||||
+ 修复了一些小bug
|
||||
* 使用UXAssist 1.0.2的新页签布局
|
||||
* 修复了一些小bug
|
||||
* 2.3.3
|
||||
+ 修复了`跳过子弹阶段`可能导致崩溃的问题
|
||||
+ 使用Alt解锁科技时,现在`矿物利用`的科技解锁到10000级而不是7200级,因为UXAssist已修复对应bug
|
||||
* 修复了`跳过子弹阶段`可能导致崩溃的问题
|
||||
* 使用Alt解锁科技时,现在`矿物利用`的科技解锁到10000级而不是7200级,因为UXAssist已修复对应bug
|
||||
* 2.3.2
|
||||
+ 母星系的选项移动到了[UniverseGenTweaks](https://dsp.thunderstore.io/package/soarqin/UniverseGenTweaks/)
|
||||
+ 优化了`快速吸收`,现在消耗更少的CPU,并且会轮流打向各节点
|
||||
+ `高速采集`现在可以保证油井的最大产出
|
||||
+ 修复了`传送带信号物品生成`在选项关闭后再次启用时不生效的问题
|
||||
+ 修复了`快速吸收`和`跳过子弹阶段`同时启用时可能导致吸收计算错误的问题
|
||||
+ 修复了一些选项可能导致崩溃的问题
|
||||
* 母星系的选项移动到了[UniverseGenTweaks](https://dsp.thunderstore.io/package/soarqin/UniverseGenTweaks/)
|
||||
* 优化了`快速吸收`,现在消耗更少的CPU,并且会轮流打向各节点
|
||||
* `高速采集`现在可以保证油井的最大产出
|
||||
* 修复了`传送带信号物品生成`在选项关闭后再次启用时不生效的问题
|
||||
* 修复了`快速吸收`和`跳过子弹阶段`同时启用时可能导致吸收计算错误的问题
|
||||
* 修复了一些选项可能导致崩溃的问题
|
||||
* 2.3.1
|
||||
+ 在manifest中添加UXAssist到依赖
|
||||
* 在manifest中添加UXAssist到依赖
|
||||
* 2.3.0
|
||||
+ 将部分功能移动到单独的mod:[UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist)
|
||||
+ 现在依赖[UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist),因此配置面板与UXAssist合并
|
||||
+ 从开发模式快捷键中移除`LCtrl+A`,以避免误操作
|
||||
+ 现在`建筑师模式`中配送机/物流机/物流船也无限了
|
||||
* 将部分功能移动到单独的mod:[UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist)
|
||||
* 现在依赖[UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist),因此配置面板与UXAssist合并
|
||||
* 从开发模式快捷键中移除`LCtrl+A`,以避免误操作
|
||||
* 现在`建筑师模式`中配送机/物流机/物流船也无限了
|
||||
* 2.2.7
|
||||
+ 新功能:`只建造节点不建造框架`
|
||||
+ 打开设置面板时不再关闭背包面板
|
||||
+ 在`移除部分不影响游戏逻辑的建造条件`启用时移除`输入方向冲突`的检查条件
|
||||
+ 修复导致`传送带信号替换格式`不切换传送带信号数字格式的问题
|
||||
* 新功能:`只建造节点不建造框架`
|
||||
* 打开设置面板时不再关闭背包面板
|
||||
* 在`移除部分不影响游戏逻辑的建造条件`启用时移除`输入方向冲突`的检查条件
|
||||
* 修复导致`传送带信号替换格式`不切换传送带信号数字格式的问题
|
||||
* 2.2.6
|
||||
+ 新功能:`可用节点全部造完时停止弹射`
|
||||
+ 修复了在未完成的节点上吸收太阳帆的问题
|
||||
* 新功能:`可用节点全部造完时停止弹射`
|
||||
* 修复了在未完成的节点上吸收太阳帆的问题
|
||||
* 2.2.5
|
||||
+ 在同时启用`快速吸收`、`跳过子弹阶段`和`跳过吸收阶段`时,所有弹射的太阳帆会跳过所有中间环节立即吸收
|
||||
+ 修复了`快速吸收`在大部分节点已满时无法立即吸收所有太阳帆的问题
|
||||
+ 修复了与一些mod的兼容性问题
|
||||
* 在同时启用`快速吸收`、`跳过子弹阶段`和`跳过吸收阶段`时,所有弹射的太阳帆会跳过所有中间环节立即吸收
|
||||
* 修复了`快速吸收`在大部分节点已满时无法立即吸收所有太阳帆的问题
|
||||
* 修复了与一些mod的兼容性问题
|
||||
* 2.2.4
|
||||
+ 新功能:`在行星视图中允许玩家操作`
|
||||
+ 修复了UI显示问题
|
||||
* 新功能:`在行星视图中允许玩家操作`
|
||||
* 修复了UI显示问题
|
||||
* 2.2.3
|
||||
+ 新功能:`移除部分不影响游戏逻辑的建造条件`
|
||||
+ 修复了与一些mod的兼容性问题
|
||||
* 新功能:`移除部分不影响游戏逻辑的建造条件`
|
||||
* 修复了与一些mod的兼容性问题
|
||||
* 2.2.2
|
||||
+ 新功能:`将游戏存档绑定给当前账号`
|
||||
+ 新子功能:`传送带信号替换格式`
|
||||
+ 修复了`初始化本行星`可能导致崩溃的问题
|
||||
+ 修复了`建造秒完成`中传送带建造的问题
|
||||
* 新功能:`将游戏存档绑定给当前账号`
|
||||
* 新子功能:`传送带信号替换格式`
|
||||
* 修复了`初始化本行星`可能导致崩溃的问题
|
||||
* 修复了`建造秒完成`中传送带建造的问题
|
||||
* 2.2.1
|
||||
+ 即使在启用`无条件建造`时依然检查矿机的建造条件
|
||||
+ 修复一个可能导致`无条件建造`不生效的问题
|
||||
* 即使在启用`无条件建造`时依然检查矿机的建造条件
|
||||
* 修复一个可能导致`无条件建造`不生效的问题
|
||||
* 2.2.0
|
||||
+ 添加了一些发电相关功能
|
||||
+ 为传送带信号物品生成添加了一个子功能,在统计面板模拟了原材料和中间产物的生产过程
|
||||
+ 从建筑师模式中分离了一些功能
|
||||
* 添加了一些发电相关功能
|
||||
* 为传送带信号物品生成添加了一个子功能,在统计面板模拟了原材料和中间产物的生产过程
|
||||
* 从建筑师模式中分离了一些功能
|
||||
* 2.1.0
|
||||
+ 传送带信号物品生成
|
||||
+ 修复窗口显示优先级可能导致提示信息被主窗口遮挡的问题
|
||||
* 传送带信号物品生成
|
||||
* 修复窗口显示优先级可能导致提示信息被主窗口遮挡的问题
|
||||
* 2.0.0
|
||||
+ 重构代码
|
||||
+ UI实现
|
||||
+ 添加了很多功能
|
||||
* 重构代码
|
||||
* UI实现
|
||||
* 添加了很多功能
|
||||
* 1.0.0
|
||||
+ 初始版本
|
||||
* 初始版本
|
||||
|
||||
</details>
|
||||
|
||||
@@ -63,12 +63,16 @@ public class CheatEnabler : BaseUnityPlugin
|
||||
"Can pump water anywhere (while water type is not None)");
|
||||
PlanetPatch.TerraformAnywayEnabled = Config.Bind("Planet", "TerraformAnyway", false,
|
||||
"Can do terraform without enough soil piless");
|
||||
PlayerPatch.InstantHandCraftEnabled = Config.Bind("Player", "InstantHandCraft", false,
|
||||
"Enable instant hand-craft");
|
||||
PlayerPatch.InstantTeleportEnabled = Config.Bind("Player", "InstantTeleport", false,
|
||||
"Enable instant teleport (like that in Sandbox mode)");
|
||||
PlayerPatch.WarpWithoutSpaceWarpersEnabled = Config.Bind("Player", "WarpWithoutWarper", false,
|
||||
"Enable warp without warper");
|
||||
DysonSpherePatch.SkipBulletEnabled = Config.Bind("DysonSphere", "SkipBullet", false,
|
||||
"Skip bullet");
|
||||
DysonSpherePatch.FireAllBulletsEnabled = Config.Bind("DysonSphere", "FireAllBullets", false,
|
||||
"Fire all bullets at once");
|
||||
DysonSpherePatch.SkipAbsorbEnabled = Config.Bind("DysonSphere", "SkipAbsorb", false,
|
||||
"Skip absorption");
|
||||
DysonSpherePatch.QuickAbsorbEnabled = Config.Bind("DysonSphere", "QuickAbsorb", false,
|
||||
@@ -79,6 +83,14 @@ public class CheatEnabler : BaseUnityPlugin
|
||||
"Overclock ejector");
|
||||
DysonSpherePatch.OverclockSiloEnabled = Config.Bind("DysonSphere", "OverclockSilo", false,
|
||||
"Overclock silo");
|
||||
DysonSpherePatch.UnlockMaxOrbitRadiusEnabled = Config.Bind("DysonSphere", "UnlockMaxOrbitRadius", false,
|
||||
"Unlock Dyson Sphere max orbit radius");
|
||||
DysonSpherePatch.UnlockMaxOrbitRadiusValue = Config.Bind("DysonSphere", "MaxOrbitRadiusValue", 10_000_000f,
|
||||
"Unlocked Dyson Sphere max orbit radius value");
|
||||
Functions.DysonSphereFunctions.IllegalDysonShellFunctionsEnabled = Config.Bind("DysonSphere", "IllegalDysonShellFunctions", false,
|
||||
"Enable illegal dyson shell functions");
|
||||
Functions.DysonSphereFunctions.ShellsCountForFunctions = Config.Bind("DysonSphere", "ShellsCountForFunctions", 2048,
|
||||
"Shells count for various functions");
|
||||
CombatPatch.MechaInvincibleEnabled = Config.Bind("Battle", "MechaInvincible", false,
|
||||
"Mecha and Drones/Fleets invincible");
|
||||
CombatPatch.BuildingsInvincibleEnabled = Config.Bind("Battle", "BuildingsInvincible", false,
|
||||
@@ -104,6 +116,6 @@ public class CheatEnabler : BaseUnityPlugin
|
||||
private void Update()
|
||||
{
|
||||
if (VFInput.inputing) return;
|
||||
FactoryPatch.OnUpdate();
|
||||
FactoryPatch.OnInputUpdate();
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<BepInExPluginGuid>org.soardev.cheatenabler</BepInExPluginGuid>
|
||||
<Description>DSP MOD - CheatEnabler</Description>
|
||||
<Version>2.3.26</Version>
|
||||
<Version>2.4.0</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackageId>CheatEnabler</PackageId>
|
||||
@@ -16,19 +16,28 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.Core" Version="5.*" />
|
||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="*-r.*" />
|
||||
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
|
||||
<PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
|
||||
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>..\AssemblyFromGame\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UI">
|
||||
<HintPath>..\AssemblyFromGame\UnityEngine.UI.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\UXAssist\UXAssist.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'">
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="del /F /Q package\$(ProjectName)-$(Version).zip
powershell Compress-Archive -Force -DestinationPath 'package/$(ProjectName)-$(Version).zip' -Path '$(TargetPath)', package/icon.png, package/manifest.json, README.md, CHANGELOG.md" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -106,7 +106,7 @@ public static class PlayerFunctions
|
||||
|
||||
if (itemCnt.All(cnt => cnt == 0))
|
||||
{
|
||||
UIMessageBox.Show("Remove all metadata consumption records".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), 0);
|
||||
UIMessageBox.Show("Remove all metadata consumption records".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), UIMessageBox.INFO);
|
||||
return;
|
||||
}
|
||||
var msg = "ClearAllMetadataConsumptionDetails".Translate();
|
||||
@@ -117,7 +117,7 @@ public static class PlayerFunctions
|
||||
msg += $"\n {LDB.items.Select(i + 6001).propertyName} x{itemCnt[i]}";
|
||||
}
|
||||
}
|
||||
UIMessageBox.Show("Remove all metadata consumption records".Translate(), msg, "取消".Translate(), "确定".Translate(), 2, null, () =>
|
||||
UIMessageBox.Show("Remove all metadata consumption records".Translate(), msg, "取消".Translate(), "确定".Translate(), UIMessageBox.QUESTION, null, () =>
|
||||
{
|
||||
foreach (var data in propertySystem.propertyDatas)
|
||||
{
|
||||
@@ -143,17 +143,18 @@ public static class PlayerFunctions
|
||||
var clusterPropertyData = propertySystem.propertyDatas.FirstOrDefault(cpd => cpd.seedKey == seedKey);
|
||||
if (clusterPropertyData == null)
|
||||
{
|
||||
UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), 0);
|
||||
UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), UIMessageBox.INFO);
|
||||
return;
|
||||
}
|
||||
foreach (var cons in clusterPropertyData.totalConsumption.Where(cons => cons.id is >= 6001 and <= 6006))
|
||||
var currentGamePropertyData = GameMain.data.history.propertyData;
|
||||
foreach (var cons in currentGamePropertyData.totalConsumption.Where(cons => cons.id is >= 6001 and <= 6006))
|
||||
{
|
||||
itemCnt[cons.id - 6001] += cons.count;
|
||||
}
|
||||
|
||||
if (itemCnt.All(cnt => cnt == 0))
|
||||
{
|
||||
UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), 0);
|
||||
UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), "NoMetadataConsumptionRecord".Translate(), "OK".Translate(), UIMessageBox.INFO);
|
||||
return;
|
||||
}
|
||||
var msg = "ClearCurrentMetadataConsumptionDetails".Translate();
|
||||
@@ -164,13 +165,17 @@ public static class PlayerFunctions
|
||||
msg += $"\n {LDB.items.Select(i + 6001).propertyName} x{itemCnt[i]}";
|
||||
}
|
||||
}
|
||||
UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), msg, "取消".Translate(), "确定".Translate(), 2, null, () =>
|
||||
UIMessageBox.Show("Remove metadata consumption record in current game".Translate(), msg, "取消".Translate(), "确定".Translate(), UIMessageBox.QUESTION, null, () =>
|
||||
{
|
||||
for (var i = 0; i < clusterPropertyData.totalConsumption.Count; i++)
|
||||
{
|
||||
if (clusterPropertyData.totalConsumption[i].count == 0) continue;
|
||||
var id = clusterPropertyData.totalConsumption[i].id;
|
||||
clusterPropertyData.totalConsumption[i] = new IDCNT(id, 0);
|
||||
if (id < 6001 || id > 6006) continue;
|
||||
var currentGameCount = itemCnt[id - 6001];
|
||||
if (currentGameCount == 0) continue;
|
||||
var totalCount = clusterPropertyData.totalConsumption[i].count;
|
||||
clusterPropertyData.totalConsumption[i] = new IDCNT(id, totalCount > currentGameCount ? totalCount - currentGameCount : 0);
|
||||
}
|
||||
PurgePropertySystem(propertySystem);
|
||||
propertySystem.SaveToFile();
|
||||
|
||||
@@ -30,7 +30,7 @@ public static class CombatPatch
|
||||
MechaInvincible.Enable(false);
|
||||
}
|
||||
|
||||
private class MechaInvincible: PatchImpl<MechaInvincible>
|
||||
private class MechaInvincible : PatchImpl<MechaInvincible>
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(Player), nameof(Player.invincible), MethodType.Getter)]
|
||||
@@ -65,7 +65,7 @@ public static class CombatPatch
|
||||
}
|
||||
}
|
||||
|
||||
private class BuildingsInvincible: PatchImpl<BuildingsInvincible>
|
||||
private class BuildingsInvincible : PatchImpl<BuildingsInvincible>
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByLocalCaster))]
|
||||
|
||||
@@ -4,17 +4,21 @@ using System.Reflection.Emit;
|
||||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
using UXAssist.Common;
|
||||
using GameLogicProc = UXAssist.Common.GameLogic;
|
||||
|
||||
namespace CheatEnabler.Patches;
|
||||
|
||||
public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
|
||||
{
|
||||
public static ConfigEntry<bool> SkipBulletEnabled;
|
||||
public static ConfigEntry<bool> FireAllBulletsEnabled;
|
||||
public static ConfigEntry<bool> SkipAbsorbEnabled;
|
||||
public static ConfigEntry<bool> QuickAbsorbEnabled;
|
||||
public static ConfigEntry<bool> EjectAnywayEnabled;
|
||||
public static ConfigEntry<bool> OverclockEjectorEnabled;
|
||||
public static ConfigEntry<bool> OverclockSiloEnabled;
|
||||
public static ConfigEntry<bool> UnlockMaxOrbitRadiusEnabled;
|
||||
public static ConfigEntry<float> UnlockMaxOrbitRadiusValue;
|
||||
private static bool _instantAbsorb;
|
||||
|
||||
public static void Init()
|
||||
@@ -25,6 +29,9 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
EjectAnywayEnabled.SettingChanged += (_, _) => EjectAnywayPatch.Enable(EjectAnywayEnabled.Value);
|
||||
OverclockEjectorEnabled.SettingChanged += (_, _) => OverclockEjector.Enable(OverclockEjectorEnabled.Value);
|
||||
OverclockSiloEnabled.SettingChanged += (_, _) => OverclockSilo.Enable(OverclockSiloEnabled.Value);
|
||||
UnlockMaxOrbitRadiusEnabled.SettingChanged += (_, _) => UnlockMaxOrbitRadius.Enable(UnlockMaxOrbitRadiusEnabled.Value);
|
||||
|
||||
FireAllBulletsEnabled.SettingChanged += (_, _) => SkipBulletPatch.SetFireAllBullets(FireAllBulletsEnabled.Value);
|
||||
}
|
||||
|
||||
public static void Start()
|
||||
@@ -35,9 +42,11 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
EjectAnywayPatch.Enable(EjectAnywayEnabled.Value);
|
||||
OverclockEjector.Enable(OverclockEjectorEnabled.Value);
|
||||
OverclockSilo.Enable(OverclockSiloEnabled.Value);
|
||||
UnlockMaxOrbitRadius.Enable(UnlockMaxOrbitRadiusEnabled.Value);
|
||||
Enable(true);
|
||||
SkipBulletPatch.SetFireAllBullets(FireAllBulletsEnabled.Value);
|
||||
}
|
||||
|
||||
|
||||
public static void Uninit()
|
||||
{
|
||||
Enable(false);
|
||||
@@ -47,8 +56,16 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
EjectAnywayPatch.Enable(false);
|
||||
OverclockEjector.Enable(false);
|
||||
OverclockSilo.Enable(false);
|
||||
UnlockMaxOrbitRadius.Enable(false);
|
||||
}
|
||||
|
||||
|
||||
// [HarmonyPostfix]
|
||||
// [HarmonyPatch(typeof(DysonShell), nameof(DysonShell.ImportFromBlueprint))]
|
||||
// private static void DysonShell_ImportFromBlueprint_Postfix(DysonShell __instance)
|
||||
// {
|
||||
// CheatEnabler.Logger.LogDebug($"[DysonShell.ImportFromBlueprint] vertCount={__instance.vertexCount}, cpPerVertex={__instance.cpPerVertex}, cpMax={__instance.cellPointMax}");
|
||||
// }
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(DysonNode), nameof(DysonNode.OrderConstructCp))]
|
||||
private static IEnumerable<CodeInstruction> DysonNode_OrderConstructCp_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
@@ -83,12 +100,18 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
private class SkipBulletPatch: PatchImpl<SkipBulletPatch>
|
||||
private class SkipBulletPatch : PatchImpl<SkipBulletPatch>
|
||||
{
|
||||
private static long _sailLifeTime;
|
||||
private static DysonSailCache[][] _sailsCache;
|
||||
private static int[] _sailsCacheLen, _sailsCacheCapacity;
|
||||
|
||||
private static bool _fireAllBullets;
|
||||
|
||||
public static void SetFireAllBullets(bool value)
|
||||
{
|
||||
_fireAllBullets = value;
|
||||
}
|
||||
|
||||
private struct DysonSailCache
|
||||
{
|
||||
public DysonSail Sail;
|
||||
@@ -111,12 +134,12 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
{
|
||||
UpdateSailLifeTime();
|
||||
UpdateSailsCacheForThisGame();
|
||||
GameLogic.OnGameBegin += GameMain_Begin_Postfix;
|
||||
GameLogicProc.OnGameBegin += GameMain_Begin_Postfix;
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
GameLogic.OnGameBegin -= GameMain_Begin_Postfix;
|
||||
GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix;
|
||||
}
|
||||
|
||||
private static void UpdateSailLifeTime()
|
||||
@@ -136,7 +159,7 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
Array.Clear(_sailsCacheLen, 0, starCount);
|
||||
Array.Clear(_sailsCacheCapacity, 0, starCount);
|
||||
}
|
||||
|
||||
|
||||
private static void SetSailsCacheCapacity(int index, int capacity)
|
||||
{
|
||||
var newCache = new DysonSailCache[capacity];
|
||||
@@ -164,7 +187,7 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
UpdateSailLifeTime();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(EjectorComponent), nameof(EjectorComponent.InternalUpdate))]
|
||||
private static IEnumerable<CodeInstruction> EjectorComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
@@ -175,25 +198,28 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
).Advance(2);
|
||||
var start = matcher.Pos;
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Pop)
|
||||
).Advance(1);
|
||||
new CodeMatch(OpCodes.Ldc_I4_M1),
|
||||
new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(EjectorComponent), nameof(EjectorComponent.direction)))
|
||||
).Advance(2);
|
||||
var end = matcher.Pos;
|
||||
matcher.Start().Advance(start).RemoveInstructions(end - start).Insert(
|
||||
new CodeInstruction(OpCodes.Ldarg_2),
|
||||
new CodeInstruction(OpCodes.Ldarg_0),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(EjectorComponent), nameof(EjectorComponent.orbitId))),
|
||||
new CodeInstruction(OpCodes.Ldloc_S, 8),
|
||||
new CodeInstruction(OpCodes.Ldloc_S, 10),
|
||||
new CodeInstruction(OpCodes.Ldarg_3),
|
||||
new CodeInstruction(OpCodes.Ldloc_S, 9),
|
||||
new CodeInstruction(OpCodes.Ldloc_S, 11),
|
||||
new CodeInstruction(OpCodes.Ldarg_S, 6),
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(SkipBulletPatch), nameof(SkipBulletPatch.AddDysonSail)))
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
private static void AddDysonSail(DysonSwarm swarm, int orbitId, VectorLF3 uPos, VectorLF3 endVec)
|
||||
private static void AddDysonSail(ref EjectorComponent ejector, DysonSwarm swarm, VectorLF3 uPos, VectorLF3 endVec, int[] consumeRegister)
|
||||
{
|
||||
var index = swarm.starData.index;
|
||||
var orbitId = ejector.orbitId;
|
||||
var delta1 = endVec - swarm.starData.uPosition;
|
||||
var delta2 = VectorLF3.Cross(endVec - uPos, swarm.orbits[orbitId].up).normalized * Math.Sqrt(swarm.dysonSphere.gravity / swarm.orbits[orbitId].radius);
|
||||
var bulletCount = ejector.bulletCount;
|
||||
lock (swarm)
|
||||
{
|
||||
var cache = _sailsCache[index];
|
||||
@@ -203,6 +229,24 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
SetSailsCacheCapacity(index, 256);
|
||||
cache = _sailsCache[index];
|
||||
}
|
||||
if (_fireAllBullets)
|
||||
{
|
||||
var capacity = _sailsCacheCapacity[index];
|
||||
var leastCapacity = len + bulletCount;
|
||||
if (leastCapacity > capacity)
|
||||
{
|
||||
do
|
||||
{
|
||||
capacity *= 2;
|
||||
} while (leastCapacity > capacity);
|
||||
SetSailsCacheCapacity(index, capacity);
|
||||
cache = _sailsCache[index];
|
||||
}
|
||||
_sailsCacheLen[index] = len + bulletCount;
|
||||
var end = len + bulletCount;
|
||||
for (var i = len; i < end; i++)
|
||||
cache[i].FromData(delta1, delta2 + RandomTable.SphericNormal(ref swarm.randSeed, 0.5), orbitId);
|
||||
}
|
||||
else
|
||||
{
|
||||
var capacity = _sailsCacheCapacity[index];
|
||||
@@ -211,14 +255,48 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
SetSailsCacheCapacity(index, capacity * 2);
|
||||
cache = _sailsCache[index];
|
||||
}
|
||||
_sailsCacheLen[index] = len + 1;
|
||||
cache[len].FromData(delta1, delta2 + RandomTable.SphericNormal(ref swarm.randSeed, 0.5), orbitId);
|
||||
}
|
||||
_sailsCacheLen[index] = len + 1;
|
||||
cache[len].FromData(delta1, delta2 + RandomTable.SphericNormal(ref swarm.randSeed, 0.5), orbitId);
|
||||
}
|
||||
|
||||
if (_fireAllBullets)
|
||||
{
|
||||
if (!ejector.incUsed)
|
||||
{
|
||||
ejector.incUsed = ejector.bulletInc >= bulletCount;
|
||||
}
|
||||
ejector.bulletInc = 0;
|
||||
ejector.bulletCount = 0;
|
||||
lock (consumeRegister)
|
||||
{
|
||||
consumeRegister[ejector.bulletId] += bulletCount;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var inc = ejector.bulletInc / bulletCount;
|
||||
if (!ejector.incUsed)
|
||||
{
|
||||
ejector.incUsed = inc > 0;
|
||||
}
|
||||
ejector.bulletInc -= inc;
|
||||
ejector.bulletCount = bulletCount - 1;
|
||||
if (ejector.bulletCount == 0)
|
||||
{
|
||||
ejector.bulletInc = 0;
|
||||
}
|
||||
lock (consumeRegister)
|
||||
{
|
||||
consumeRegister[ejector.bulletId]++;
|
||||
}
|
||||
}
|
||||
ejector.time = ejector.coldSpend;
|
||||
ejector.direction = -1;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(DysonSwarm), "GameTick")]
|
||||
[HarmonyPatch(typeof(DysonSwarm), nameof(DysonSwarm.GameTick))]
|
||||
public static void DysonSwarm_GameTick_Prefix(DysonSwarm __instance, long time)
|
||||
{
|
||||
var index = __instance.starData.index;
|
||||
@@ -256,9 +334,9 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
if (node.ConstructCp() == null) break;
|
||||
if (idx == 0)
|
||||
{
|
||||
sphereProductRegister[11901] += len;
|
||||
sphereConsumeRegister[11901] += len;
|
||||
sphereProductRegister[11903] += len;
|
||||
sphereProductRegister[ProductionStatistics.SOLAR_SAIL_ID] += len;
|
||||
sphereConsumeRegister[ProductionStatistics.SOLAR_SAIL_ID] += len;
|
||||
sphereProductRegister[ProductionStatistics.DYSON_CELL_ID] += len;
|
||||
return;
|
||||
}
|
||||
idx--;
|
||||
@@ -269,9 +347,9 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
var absorbCnt = len - 1 - idx;
|
||||
if (absorbCnt > 0)
|
||||
{
|
||||
sphereProductRegister[11901] += absorbCnt;
|
||||
sphereConsumeRegister[11901] += absorbCnt;
|
||||
sphereProductRegister[11903] += absorbCnt;
|
||||
sphereProductRegister[ProductionStatistics.SOLAR_SAIL_ID] += absorbCnt;
|
||||
sphereConsumeRegister[ProductionStatistics.SOLAR_SAIL_ID] += absorbCnt;
|
||||
sphereProductRegister[ProductionStatistics.DYSON_CELL_ID] += absorbCnt;
|
||||
}
|
||||
}
|
||||
for (; idx >= 0; idx--)
|
||||
@@ -280,8 +358,8 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class SkipAbsorbPatch: PatchImpl<SkipAbsorbPatch>
|
||||
|
||||
private class SkipAbsorbPatch : PatchImpl<SkipAbsorbPatch>
|
||||
{
|
||||
protected override void OnEnable()
|
||||
{
|
||||
@@ -304,7 +382,7 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
).Advance(1).RemoveInstructions(matcher.Length - matcher.Pos).Insert(
|
||||
// if (node.ConstructCp() != null)
|
||||
// {
|
||||
// this.dysonSphere.productRegister[11903]++;
|
||||
// this.dysonSphere.productRegister[ProductionStatistics.DYSON_CELL_ID]++;
|
||||
// }
|
||||
new CodeInstruction(OpCodes.Ldarg_1),
|
||||
new CodeInstruction(OpCodes.Callvirt, AccessTools.Method(typeof(DysonNode), nameof(DysonNode.ConstructCp))),
|
||||
@@ -312,19 +390,19 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
new CodeInstruction(OpCodes.Ldarg_0),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(DysonSwarm), nameof(DysonSwarm.dysonSphere))),
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.PropertyGetter(typeof(DysonSphere), nameof(DysonSphere.productRegister))),
|
||||
new CodeInstruction(OpCodes.Ldc_I4, 11903),
|
||||
new CodeInstruction(OpCodes.Ldc_I4, ProductionStatistics.DYSON_CELL_ID),
|
||||
new CodeInstruction(OpCodes.Ldelema, typeof(int)),
|
||||
new CodeInstruction(OpCodes.Dup),
|
||||
new CodeInstruction(OpCodes.Ldind_I4),
|
||||
new CodeInstruction(OpCodes.Ldc_I4_1),
|
||||
new CodeInstruction(OpCodes.Add),
|
||||
new CodeInstruction(OpCodes.Stind_I4),
|
||||
|
||||
|
||||
// this.RemoveSolarSail(index);
|
||||
new CodeInstruction(OpCodes.Ldarg_0).WithLabels(label1),
|
||||
new CodeInstruction(OpCodes.Ldloc_1),
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(DysonSwarm), nameof(DysonSwarm.RemoveSolarSail))),
|
||||
|
||||
|
||||
// return false;
|
||||
new CodeInstruction(OpCodes.Ldc_I4_1),
|
||||
new CodeInstruction(OpCodes.Ret)
|
||||
@@ -332,8 +410,8 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
}
|
||||
|
||||
private class QuickAbsorbPatch: PatchImpl<QuickAbsorbPatch>
|
||||
|
||||
private class QuickAbsorbPatch : PatchImpl<QuickAbsorbPatch>
|
||||
{
|
||||
protected override void OnEnable()
|
||||
{
|
||||
@@ -363,7 +441,7 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
/* Insert a RETURN before old absorption functions */
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
|
||||
private static void DoAbsorb(DysonSphereLayer layer, long gameTick)
|
||||
{
|
||||
var nodeCount = layer.nodeCursor - 1;
|
||||
@@ -383,43 +461,42 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class EjectAnywayPatch: PatchImpl<EjectAnywayPatch>
|
||||
|
||||
private class EjectAnywayPatch : PatchImpl<EjectAnywayPatch>
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(EjectorComponent), nameof(EjectorComponent.InternalUpdate))]
|
||||
private static IEnumerable<CodeInstruction> EjectorComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchForward(false,
|
||||
matcher.End().MatchBack(false,
|
||||
new CodeMatch(instr => instr.opcode == OpCodes.Ldc_R8 && Math.Abs((double)instr.operand - 0.08715574) < 0.00000001)
|
||||
);
|
||||
var start = matcher.Pos - 3;
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.And)
|
||||
).Advance(1).MatchForward(false,
|
||||
new CodeMatch(OpCodes.And)
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(EjectorComponent), nameof(EjectorComponent.bulletCount)))
|
||||
);
|
||||
var end = matcher.Pos - 2;
|
||||
/* Remove angle checking codes, then add:
|
||||
* V_13 = this.bulletCount > 0;
|
||||
*/
|
||||
matcher.Start().Advance(start).RemoveInstructions(end - start).Insert(
|
||||
new CodeInstruction(OpCodes.Ldarg_0),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(EjectorComponent), nameof(EjectorComponent.bulletCount))),
|
||||
new CodeInstruction(OpCodes.Ldc_I4_0),
|
||||
new CodeInstruction(OpCodes.Cgt),
|
||||
new CodeInstruction(OpCodes.Stloc_S, 13)
|
||||
var end = matcher.Pos;
|
||||
matcher.Start().Advance(start).RemoveInstructions(end - start).MatchForward(false,
|
||||
new CodeMatch(ci => ci.IsStloc())
|
||||
).Advance(1);
|
||||
start = matcher.Pos;
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(EjectorComponent), nameof(EjectorComponent.autoOrbit)))
|
||||
);
|
||||
end = matcher.Pos;
|
||||
matcher.Start().Advance(start).RemoveInstructions(end - start);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
}
|
||||
|
||||
private class OverclockEjector: PatchImpl<OverclockEjector>
|
||||
private class OverclockEjector : PatchImpl<OverclockEjector>
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(EjectorComponent), nameof(EjectorComponent.InternalUpdate))]
|
||||
private static IEnumerable<CodeInstruction> EjectAndSiloComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
private static IEnumerable<CodeInstruction> EjectComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
/* Add a multiply to ejector speed */
|
||||
@@ -468,11 +545,11 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
}
|
||||
}
|
||||
|
||||
private class OverclockSilo: PatchImpl<OverclockSilo>
|
||||
private class OverclockSilo : PatchImpl<OverclockSilo>
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(SiloComponent), nameof(SiloComponent.InternalUpdate))]
|
||||
private static IEnumerable<CodeInstruction> EjectAndSiloComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
private static IEnumerable<CodeInstruction> SiloComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
/* Add a multiply to ejector speed */
|
||||
@@ -520,4 +597,53 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
}
|
||||
|
||||
private class UnlockMaxOrbitRadius : PatchImpl<UnlockMaxOrbitRadius>
|
||||
{
|
||||
protected override void OnEnable()
|
||||
{
|
||||
OnViewStarChange(null, null);
|
||||
UnlockMaxOrbitRadiusValue.SettingChanged += OnViewStarChange;
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
OnViewStarChange(null, null);
|
||||
UnlockMaxOrbitRadiusValue.SettingChanged -= OnViewStarChange;
|
||||
}
|
||||
|
||||
public static void OnViewStarChange(object o, EventArgs e)
|
||||
{
|
||||
var dysonEditor = UIRoot.instance?.uiGame?.dysonEditor;
|
||||
if (dysonEditor == null || !dysonEditor.gameObject.activeSelf) return;
|
||||
dysonEditor.selection?.onViewStarChange?.Invoke();
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(DysonSphere), nameof(DysonSphere.CheckLayerRadius))]
|
||||
[HarmonyPatch(typeof(DysonSphere), nameof(DysonSphere.CheckSwarmRadius))]
|
||||
[HarmonyPatch(typeof(DysonSphere), nameof(DysonSphere.QueryLayerRadius))]
|
||||
[HarmonyPatch(typeof(DysonSphere), nameof(DysonSphere.QuerySwarmRadius))]
|
||||
[HarmonyPatch(typeof(UIDEAddLayerDialogue), nameof(UIDEAddLayerDialogue.OnViewStarChange))]
|
||||
[HarmonyPatch(typeof(UIDEAddSwarmDialogue), nameof(UIDEAddSwarmDialogue.OnViewStarChange))]
|
||||
[HarmonyPatch(typeof(UIDysonEditor), nameof(UIDysonEditor.OnViewStarChange))]
|
||||
[HarmonyPatch(typeof(UIDESwarmOrbitInfo), nameof(UIDESwarmOrbitInfo._OnInit))]
|
||||
[HarmonyPatch(typeof(UIDysonOrbitPreview), nameof(UIDysonOrbitPreview.UpdateAscNodeGizmos))]
|
||||
private static IEnumerable<CodeInstruction> MaxOrbitRadiusPatch_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(DysonSphere), nameof(DysonSphere.maxOrbitRadius)))
|
||||
);
|
||||
matcher.Repeat(m =>
|
||||
{
|
||||
m.Advance(1).InsertAndAdvance(
|
||||
new CodeInstruction(OpCodes.Pop),
|
||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(DysonSpherePatch), nameof(UnlockMaxOrbitRadiusValue))),
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.PropertyGetter(typeof(ConfigEntry<float>), nameof(ConfigEntry<float>.Value)))
|
||||
);
|
||||
});
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using BepInEx.Configuration;
|
||||
using CommonAPI.Systems;
|
||||
@@ -7,10 +8,11 @@ using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UXAssist.Common;
|
||||
using GameLogicProc = UXAssist.Common.GameLogic;
|
||||
|
||||
namespace CheatEnabler.Patches;
|
||||
|
||||
public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
public class FactoryPatch : PatchImpl<FactoryPatch>
|
||||
{
|
||||
public static ConfigEntry<bool> ImmediateEnabled;
|
||||
public static ConfigEntry<bool> ArchitectModeEnabled;
|
||||
@@ -36,23 +38,23 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
public static void Init()
|
||||
{
|
||||
_noConditionKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
||||
{
|
||||
key = new CombineKey(0, 0, ECombineKeyAction.OnceClick, true),
|
||||
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
|
||||
name = "ToggleNoCondition",
|
||||
canOverride = true
|
||||
}
|
||||
{
|
||||
key = new CombineKey(0, 0, ECombineKeyAction.OnceClick, true),
|
||||
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
|
||||
name = "ToggleNoCondition",
|
||||
canOverride = true
|
||||
}
|
||||
);
|
||||
_noCollisionKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
||||
{
|
||||
key = new CombineKey(0, 0, ECombineKeyAction.OnceClick, true),
|
||||
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
|
||||
name = "ToggleNoCollision",
|
||||
canOverride = true
|
||||
}
|
||||
{
|
||||
key = new CombineKey(0, 0, ECombineKeyAction.OnceClick, true),
|
||||
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
|
||||
name = "ToggleNoCollision",
|
||||
canOverride = true
|
||||
}
|
||||
);
|
||||
I18N.Add("KEYToggleNoCondition", "Toggle No Condition Build", "切换无条件建造");
|
||||
I18N.Add("KEYToggleNoCollision", "Toggle No Collision", "切换无碰撞");
|
||||
I18N.Add("KEYToggleNoCondition", "[CE] Toggle No Condition Build", "[CE] 切换无条件建造");
|
||||
I18N.Add("KEYToggleNoCollision", "[CE] Toggle No Collision", "[CE] 切换无碰撞");
|
||||
I18N.Add("NoConditionOn", "No condition build is enabled!", "无条件建造已开启");
|
||||
I18N.Add("NoConditionOff", "No condition build is disabled!", "无条件建造已关闭");
|
||||
I18N.Add("NoCollisionOn", "No collision is enabled!", "无碰撞已开启");
|
||||
@@ -91,14 +93,16 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
GreaterPowerUsageInLogistics.Enable(GreaterPowerUsageInLogisticsEnabled.Value);
|
||||
ControlPanelRemoteLogistics.Enable(ControlPanelRemoteLogisticsEnabled.Value);
|
||||
Enable(true);
|
||||
GameLogic.OnGameBegin += GameMain_Begin_Postfix_For_ImmBuild;
|
||||
GameLogic.OnDataLoaded += OnDataLoaded;
|
||||
CargoTrafficPatch.Enable(true);
|
||||
GameLogicProc.OnGameBegin += GameMain_Begin_Postfix_For_ImmBuild;
|
||||
GameLogicProc.OnDataLoaded += OnDataLoaded;
|
||||
}
|
||||
|
||||
public static void Uninit()
|
||||
{
|
||||
GameLogic.OnDataLoaded -= OnDataLoaded;
|
||||
GameLogic.OnGameBegin -= GameMain_Begin_Postfix_For_ImmBuild;
|
||||
GameLogicProc.OnDataLoaded -= OnDataLoaded;
|
||||
GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix_For_ImmBuild;
|
||||
CargoTrafficPatch.Enable(false);
|
||||
Enable(false);
|
||||
ImmediateBuild.Enable(false);
|
||||
ArchitectMode.Enable(false);
|
||||
@@ -114,9 +118,18 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
ControlPanelRemoteLogistics.Enable(false);
|
||||
}
|
||||
|
||||
private static void OnDataLoaded() => WindTurbinesPowerGlobalCoverage.Enable(WindTurbinesPowerGlobalCoverageEnabled.Value);
|
||||
private static HashSet<int> _beltIds = [];
|
||||
private static HashSet<int> _alterBeltRendererIds;
|
||||
private static HashSet<int> _alterPathRendererIds;
|
||||
private static HashSet<int> _refreshPathUVIds;
|
||||
|
||||
public static void OnUpdate()
|
||||
private static void OnDataLoaded()
|
||||
{
|
||||
WindTurbinesPowerGlobalCoverage.Enable(WindTurbinesPowerGlobalCoverageEnabled.Value);
|
||||
_beltIds ??= [.. LDB.items.dataArray.Where(i => i.prefabDesc.isBelt).Select(i => i.ID)];
|
||||
}
|
||||
|
||||
public static void OnInputUpdate()
|
||||
{
|
||||
if (_noConditionKey.keyValue)
|
||||
{
|
||||
@@ -148,31 +161,124 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
|
||||
public static void ArrivePlanet(PlanetFactory factory)
|
||||
{
|
||||
if (factory.prebuildCount <= 0) return;
|
||||
var imm = ImmediateEnabled.Value;
|
||||
var architect = ArchitectModeEnabled.Value;
|
||||
if ((!imm && !architect) || GameMain.gameScenario == null) return;
|
||||
var prebuilds = factory.prebuildPool;
|
||||
if (imm) factory.BeginFlattenTerrain();
|
||||
for (var i = factory.prebuildCursor - 1; i > 0; i--)
|
||||
if (imm)
|
||||
{
|
||||
if (prebuilds[i].id != i) continue;
|
||||
if (prebuilds[i].itemRequired > 0)
|
||||
var anyBelt = false;
|
||||
var anyBuilt = false;
|
||||
_alterBeltRendererIds ??= [];
|
||||
_alterPathRendererIds ??= [];
|
||||
_refreshPathUVIds ??= [];
|
||||
CargoTrafficPatch.IsBatchBuilding = true;
|
||||
factory.BeginFlattenTerrain();
|
||||
factory.cargoTraffic._batch_buffer_no_refresh = true;
|
||||
PlanetFactory.batchBuild = true;
|
||||
CargoTrafficPatch.DisableRefreshBatchesBuffers = true;
|
||||
for (var i = factory.prebuildCursor - 1; i > 0; i--)
|
||||
{
|
||||
if (!architect) continue;
|
||||
prebuilds[i].itemRequired = 0;
|
||||
if (imm)
|
||||
factory.BuildFinally(GameMain.mainPlayer, i, false);
|
||||
else
|
||||
factory.AlterPrebuildModelState(i);
|
||||
ref var pb = ref prebuilds[i];
|
||||
if (pb.id != i || pb.isDestroyed) continue;
|
||||
if (pb.itemRequired > 0)
|
||||
{
|
||||
if (!architect) continue;
|
||||
pb.itemRequired = 0;
|
||||
}
|
||||
anyBelt = anyBelt || _beltIds.Contains(pb.protoId);
|
||||
factory.BuildFinally(GameMain.mainPlayer, i, false);
|
||||
anyBuilt = true;
|
||||
}
|
||||
else
|
||||
PlanetFactory.batchBuild = false;
|
||||
factory.cargoTraffic._batch_buffer_no_refresh = false;
|
||||
factory.EndFlattenTerrain();
|
||||
CargoTrafficPatch.IsBatchBuilding = false;
|
||||
var cargoTraffic = factory.cargoTraffic;
|
||||
var entityPool = factory.entityPool;
|
||||
var colChunks = factory.planet.physics?.colChunks;
|
||||
foreach (var beltId in _alterBeltRendererIds)
|
||||
{
|
||||
if (imm)
|
||||
factory.BuildFinally(GameMain.mainPlayer, i, false);
|
||||
cargoTraffic.AlterBeltRenderer(beltId, entityPool, colChunks, false);
|
||||
}
|
||||
foreach (var pathId in _alterPathRendererIds)
|
||||
{
|
||||
cargoTraffic.AlterPathRenderer(pathId, false);
|
||||
}
|
||||
foreach (var pathId in _refreshPathUVIds)
|
||||
{
|
||||
cargoTraffic.RefreshPathUV(pathId);
|
||||
}
|
||||
_alterBeltRendererIds.Clear();
|
||||
_alterPathRendererIds.Clear();
|
||||
_refreshPathUVIds.Clear();
|
||||
CargoTrafficPatch.DisableRefreshBatchesBuffers = false;
|
||||
if (anyBelt)
|
||||
{
|
||||
factory.cargoTraffic.RefreshBeltBatchesBuffers();
|
||||
factory.cargoTraffic.RefreshPathBatchesBuffers();
|
||||
}
|
||||
if (anyBuilt)
|
||||
{
|
||||
factory.planet.physics?.raycastLogic?.NotifyBatchObjectRemove();
|
||||
factory.planet.audio?.SetPlanetAudioDirty();
|
||||
}
|
||||
}
|
||||
else if (architect)
|
||||
{
|
||||
for (var i = factory.prebuildCursor - 1; i > 0; i--)
|
||||
{
|
||||
ref var pb = ref prebuilds[i];
|
||||
if (pb.id != i || pb.isDestroyed || pb.itemRequired == 0) continue;
|
||||
pb.itemRequired = 0;
|
||||
factory.AlterPrebuildModelState(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (imm) factory.EndFlattenTerrain();
|
||||
private class CargoTrafficPatch : PatchImpl<CargoTrafficPatch>
|
||||
{
|
||||
public static bool IsBatchBuilding;
|
||||
public static bool DisableRefreshBatchesBuffers;
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPriority(Priority.First)]
|
||||
[HarmonyPatch(typeof(CargoTraffic), nameof(CargoTraffic.AlterBeltRenderer))]
|
||||
private static bool CargoTraffic_AlterBeltRenderer_Prefix(int beltId)
|
||||
{
|
||||
if (!IsBatchBuilding) return true;
|
||||
_alterBeltRendererIds.Add(beltId);
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPriority(Priority.First)]
|
||||
[HarmonyPatch(typeof(CargoTraffic), nameof(CargoTraffic.AlterPathRenderer))]
|
||||
private static bool CargoTraffic_AlterPathRenderer_Prefix(int pathId)
|
||||
{
|
||||
if (!IsBatchBuilding) return true;
|
||||
_alterPathRendererIds.Add(pathId);
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPriority(Priority.First)]
|
||||
[HarmonyPatch(typeof(CargoTraffic), nameof(CargoTraffic.RefreshPathUV))]
|
||||
private static bool CargoTraffic_RefreshPathUV_Prefix(int pathId)
|
||||
{
|
||||
if (!IsBatchBuilding) return true;
|
||||
_refreshPathUVIds.Add(pathId);
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPriority(Priority.First)]
|
||||
[HarmonyPatch(typeof(CargoTraffic), nameof(CargoTraffic.RefreshBeltBatchesBuffers))]
|
||||
[HarmonyPatch(typeof(CargoTraffic), nameof(CargoTraffic.RefreshPathBatchesBuffers))]
|
||||
private static bool CargoTraffic_RefreshBeltBatchesBuffers_Prefix()
|
||||
{
|
||||
return !DisableRefreshBatchesBuffers;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
@@ -188,6 +294,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
|
||||
private static void GameMain_Begin_Postfix_For_ImmBuild()
|
||||
{
|
||||
if (DSPGame.IsMenuDemo) return;
|
||||
var factory = GameMain.mainPlayer?.factory;
|
||||
if (factory != null)
|
||||
{
|
||||
@@ -235,7 +342,8 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
matcher.Repeat(m =>
|
||||
{
|
||||
var label1 = generator.DefineLabel();
|
||||
m.Advance(1).RemoveInstructions(2).InsertAndAdvance(
|
||||
m.Advance(3).InsertAndAdvance(
|
||||
new CodeInstruction(OpCodes.Ldarg_0),
|
||||
Transpilers.EmitDelegate((WarningSystem w) =>
|
||||
{
|
||||
if (NoConditionEnabled.Value)
|
||||
@@ -265,7 +373,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
private class ImmediateBuild: PatchImpl<ImmediateBuild>
|
||||
private class ImmediateBuild : PatchImpl<ImmediateBuild>
|
||||
{
|
||||
protected override void OnEnable()
|
||||
{
|
||||
@@ -311,6 +419,40 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
/*
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(ConstructionSystem), nameof(ConstructionSystem.AddBuildTargetToModules))]
|
||||
private static IEnumerable<CodeInstruction> ConstructionSystem_AddBuildTargetToModules_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
// 13 0035 ldarg.0
|
||||
// 14 0036 ldfld class Player ConstructionSystem::player
|
||||
// 15 003B callvirt instance class Mecha Player::get_mecha()
|
||||
// 16 0040 ldfld float32 Mecha::buildArea
|
||||
// 17 0045 stloc.0
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(ConstructionSystem), nameof(ConstructionSystem.player))),
|
||||
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(Player), nameof(Player.mecha))),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(Mecha), nameof(Mecha.buildArea))),
|
||||
new CodeMatch(ci => ci.IsStloc())
|
||||
);
|
||||
var labels = matcher.Labels;
|
||||
matcher.Labels = [];
|
||||
matcher.Insert(
|
||||
new CodeInstruction(OpCodes.Ldarg_0).WithLabels(labels),
|
||||
new CodeInstruction(OpCodes.Ldarg_1),
|
||||
Transpilers.EmitDelegate((ConstructionSystem constructionSystem, int objId) =>
|
||||
{
|
||||
var player = constructionSystem.player;
|
||||
player.factory.BuildFinally(player, objId);
|
||||
}),
|
||||
new CodeInstruction(OpCodes.Ret)
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
*/
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(UXAssist.Functions.PlanetFunctions), nameof(UXAssist.Functions.PlanetFunctions.BuildOrbitalCollectors))]
|
||||
private static void UXAssist_PlanetFunctions_BuildOrbitalCollectors_Postfix()
|
||||
@@ -323,7 +465,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
}
|
||||
}
|
||||
|
||||
private class ArchitectMode: PatchImpl<ArchitectMode>
|
||||
private class ArchitectMode : PatchImpl<ArchitectMode>
|
||||
{
|
||||
private static bool[] _canBuildItems;
|
||||
|
||||
@@ -354,7 +496,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(StorageComponent), "GetItemCount", typeof(int))]
|
||||
[HarmonyPatch(typeof(StorageComponent), nameof(StorageComponent.GetItemCount), typeof(int))]
|
||||
public static void GetItemCountPatch(StorageComponent __instance, int itemId, ref int __result)
|
||||
{
|
||||
if (__result > 99) return;
|
||||
@@ -377,7 +519,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
}
|
||||
}
|
||||
|
||||
private class NoConditionBuild: PatchImpl<NoConditionBuild>
|
||||
private class NoConditionBuild : PatchImpl<NoConditionBuild>
|
||||
{
|
||||
protected override void OnEnable()
|
||||
{
|
||||
@@ -465,7 +607,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
}
|
||||
}
|
||||
|
||||
public class BeltSignalGenerator: PatchImpl<BeltSignalGenerator>
|
||||
public class BeltSignalGenerator : PatchImpl<BeltSignalGenerator>
|
||||
{
|
||||
private static Dictionary<int, BeltSignal>[] _signalBelts;
|
||||
private static Dictionary<long, int> _portalFrom;
|
||||
@@ -487,12 +629,12 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
protected override void OnEnable()
|
||||
{
|
||||
InitSignalBelts();
|
||||
GameLogic.OnGameBegin += GameMain_Begin_Postfix;
|
||||
GameLogicProc.OnGameBegin += GameMain_Begin_Postfix;
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
GameLogic.OnGameBegin -= GameMain_Begin_Postfix;
|
||||
GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix;
|
||||
_initialized = false;
|
||||
_signalBelts = null;
|
||||
_signalBeltsCapacity = 0;
|
||||
@@ -629,7 +771,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
inc = 0;
|
||||
speedLimit = number;
|
||||
}
|
||||
|
||||
|
||||
if (speedLimit > 3600) speedLimit = 3600;
|
||||
|
||||
var signalBelts = GetOrCreateSignalBelts(factory);
|
||||
@@ -665,13 +807,13 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
var result = new Dictionary<int, float>();
|
||||
var extra = new Dictionary<int, float>();
|
||||
CalculateAllProductions(result, extra, itemId);
|
||||
foreach (var p in extra)
|
||||
{
|
||||
if (result.TryGetValue(itemId, out var v) && v >= p.Value) continue;
|
||||
result[itemId] = p.Value;
|
||||
}
|
||||
|
||||
result.Remove(itemId);
|
||||
|
||||
foreach (var p in extra)
|
||||
{
|
||||
result[p.Key] = (result.TryGetValue(p.Key, out var v) ? v : 0) + p.Value;
|
||||
}
|
||||
var cnt = result.Count;
|
||||
if (cnt == 0)
|
||||
{
|
||||
@@ -725,15 +867,16 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
|
||||
private static void GameMain_Begin_Postfix()
|
||||
{
|
||||
if (DSPGame.IsMenuDemo) return;
|
||||
if (BeltSignalGeneratorEnabled.Value) InitSignalBelts();
|
||||
InitItemSources();
|
||||
}
|
||||
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(DigitalSystem), MethodType.Constructor, typeof(PlanetData))]
|
||||
private static void DigitalSystem_Constructor_Postfix(PlanetData _planet)
|
||||
{
|
||||
if (!BeltSignalGeneratorEnabled.Value) return;
|
||||
if (!BeltSignalGeneratorEnabled.Value) return;
|
||||
var player = GameMain.mainPlayer;
|
||||
if (player == null) return;
|
||||
var factory = _planet?.factory;
|
||||
@@ -849,139 +992,149 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
public static void ProcessBeltSignals()
|
||||
{
|
||||
if (!_initialized) return;
|
||||
var factories = GameMain.data?.factories;
|
||||
var data = GameMain.data;
|
||||
var factories = data?.factories;
|
||||
if (factories == null) return;
|
||||
PerformanceMonitor.BeginSample(ECpuWorkEntry.Belt);
|
||||
foreach (var factory in factories)
|
||||
DeepProfiler.BeginSample(DPEntry.Belt);
|
||||
for (var index = data.factoryCount - 1; index >= 0; index--)
|
||||
{
|
||||
var factory = factories[index];
|
||||
if (factory == null) continue;
|
||||
var belts = GetSignalBelts(factory.index);
|
||||
var belts = GetSignalBelts(index);
|
||||
if (belts == null || belts.Count == 0) continue;
|
||||
var factoryProductionStat = GameMain.statistics.production.factoryStatPool[factory.index];
|
||||
var factoryProductionStat = GameMain.statistics.production.factoryStatPool[index];
|
||||
var productRegister = factoryProductionStat.productRegister;
|
||||
var consumeRegister = factoryProductionStat.consumeRegister;
|
||||
var countRecipe = BeltSignalCountRecipeEnabled.Value;
|
||||
var cargoTraffic = factory.cargoTraffic;
|
||||
var beltCount = cargoTraffic.beltCursor;
|
||||
List<int> beltsToRemove = null;
|
||||
foreach (var pair in belts)
|
||||
{
|
||||
if (pair.Key >= beltCount)
|
||||
{
|
||||
if (beltsToRemove == null)
|
||||
beltsToRemove = [pair.Key];
|
||||
else
|
||||
beltsToRemove.Add(pair.Key);
|
||||
continue;
|
||||
}
|
||||
var beltSignal = pair.Value;
|
||||
var signalId = beltSignal.SignalId;
|
||||
switch (signalId)
|
||||
{
|
||||
case 404:
|
||||
{
|
||||
var beltId = pair.Key;
|
||||
ref var belt = ref cargoTraffic.beltPool[beltId];
|
||||
var cargoPath = cargoTraffic.GetCargoPath(belt.segPathId);
|
||||
if (cargoPath == null) continue;
|
||||
int itemId;
|
||||
if ((itemId = cargoPath.TryPickItem(belt.segIndex + belt.segPivotOffset - 5, 12, out var stack, out _)) > 0)
|
||||
{
|
||||
if (BeltSignalCountRemEnabled.Value) consumeRegister[itemId] += stack;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
case 600:
|
||||
{
|
||||
if (!_portalTo.TryGetValue(beltSignal.SpeedLimit, out var set)) continue;
|
||||
var beltId = pair.Key;
|
||||
ref var belt = ref cargoTraffic.beltPool[beltId];
|
||||
var cargoPath = cargoTraffic.GetCargoPath(belt.segPathId);
|
||||
if (cargoPath == null) continue;
|
||||
var segIndex = belt.segIndex + belt.segPivotOffset;
|
||||
if (!cargoPath.GetCargoAtIndex(segIndex, out var cargo, out var cargoId, out var _)) break;
|
||||
var itemId = cargo.item;
|
||||
var cargoPool = cargoPath.cargoContainer.cargoPool;
|
||||
var inc = cargoPool[cargoId].inc;
|
||||
var stack = cargoPool[cargoId].stack;
|
||||
foreach (var n in set)
|
||||
{
|
||||
var cargoTraffic1 = factories[(int)(n >> 32)].cargoTraffic;
|
||||
ref var belt1 = ref cargoTraffic1.beltPool[(int)(n & 0x7FFFFFFF)];
|
||||
cargoPath = cargoTraffic1.GetCargoPath(belt1.segPathId);
|
||||
var beltId = pair.Key;
|
||||
ref var belt = ref cargoTraffic.beltPool[beltId];
|
||||
var cargoPath = cargoTraffic.GetCargoPath(belt.segPathId);
|
||||
if (cargoPath == null) continue;
|
||||
if (!cargoPath.TryInsertItem(belt1.segIndex + belt1.segPivotOffset, itemId, stack, inc)) continue;
|
||||
cargoPath.TryPickItem(segIndex - 5, 12, out var stack1, out var inc1);
|
||||
if (inc1 != inc || stack1 != stack)
|
||||
cargoPath.TryPickItem(segIndex - 5, 12, out _, out _);
|
||||
break;
|
||||
}
|
||||
int itemId;
|
||||
if ((itemId = cargoPath.TryPickItem(belt.segIndex + belt.segPivotOffset - 5, 12, out var stack, out _)) > 0)
|
||||
{
|
||||
if (BeltSignalCountRemEnabled.Value) consumeRegister[itemId] += stack;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
case 600:
|
||||
{
|
||||
if (!_portalTo.TryGetValue(beltSignal.SpeedLimit, out var set)) continue;
|
||||
var beltId = pair.Key;
|
||||
ref var belt = ref cargoTraffic.beltPool[beltId];
|
||||
var cargoPath = cargoTraffic.GetCargoPath(belt.segPathId);
|
||||
if (cargoPath == null) continue;
|
||||
var segIndex = belt.segIndex + belt.segPivotOffset;
|
||||
if (!cargoPath.GetCargoAtIndex(segIndex, out var cargo, out var cargoId, out var _)) break;
|
||||
var itemId = cargo.item;
|
||||
var cargoPool = cargoPath.cargoContainer.cargoPool;
|
||||
var inc = cargoPool[cargoId].inc;
|
||||
var stack = cargoPool[cargoId].stack;
|
||||
foreach (var n in set)
|
||||
{
|
||||
var cargoTraffic1 = factories[(int)(n >> 32)].cargoTraffic;
|
||||
ref var belt1 = ref cargoTraffic1.beltPool[(int)(n & 0x7FFFFFFF)];
|
||||
cargoPath = cargoTraffic1.GetCargoPath(belt1.segPathId);
|
||||
if (cargoPath == null) continue;
|
||||
if (!cargoPath.TryInsertItem(belt1.segIndex + belt1.segPivotOffset, itemId, stack, inc)) continue;
|
||||
cargoPath.TryPickItem(segIndex - 5, 12, out var stack1, out var inc1);
|
||||
if (inc1 != inc || stack1 != stack)
|
||||
cargoPath.TryPickItem(segIndex - 5, 12, out _, out _);
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
case >= 1000 and < 20000:
|
||||
{
|
||||
var hasSpeedLimit = beltSignal.SpeedLimit > 0;
|
||||
if (hasSpeedLimit)
|
||||
{
|
||||
beltSignal.Progress += beltSignal.SpeedLimit;
|
||||
switch (beltSignal.Progress)
|
||||
var hasSpeedLimit = beltSignal.SpeedLimit > 0;
|
||||
if (hasSpeedLimit)
|
||||
{
|
||||
case < 3600:
|
||||
continue;
|
||||
case > 18000:
|
||||
beltSignal.Progress = 14400;
|
||||
break;
|
||||
beltSignal.Progress += beltSignal.SpeedLimit;
|
||||
switch (beltSignal.Progress)
|
||||
{
|
||||
case < 3600:
|
||||
continue;
|
||||
case > 18000:
|
||||
beltSignal.Progress = 14400;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var beltId = pair.Key;
|
||||
ref var belt = ref cargoTraffic.beltPool[beltId];
|
||||
var cargoPath = cargoTraffic.GetCargoPath(belt.segPathId);
|
||||
if (cargoPath == null) continue;
|
||||
var stack = beltSignal.Stack;
|
||||
var inc = beltSignal.Inc;
|
||||
if (!cargoPath.TryInsertItem(belt.segIndex + belt.segPivotOffset, signalId, stack, inc)) continue;
|
||||
if (hasSpeedLimit) beltSignal.Progress -= 3600;
|
||||
if (BeltSignalCountGenEnabled.Value) productRegister[signalId] += stack;
|
||||
if (!countRecipe) continue;
|
||||
var sources = beltSignal.Sources;
|
||||
if (sources == null) continue;
|
||||
var progress = beltSignal.SourceProgress;
|
||||
var stackf = (float)stack;
|
||||
for (var i = sources.Length - 1; i >= 0; i--)
|
||||
{
|
||||
var newCnt = progress[i] + sources[i].Item2 * stackf;
|
||||
if (newCnt > 0)
|
||||
var beltId = pair.Key;
|
||||
ref var belt = ref cargoTraffic.beltPool[beltId];
|
||||
var cargoPath = cargoTraffic.GetCargoPath(belt.segPathId);
|
||||
if (cargoPath == null) continue;
|
||||
var stack = beltSignal.Stack;
|
||||
var inc = beltSignal.Inc;
|
||||
if (!cargoPath.TryInsertItem(belt.segIndex + belt.segPivotOffset, signalId, stack, inc)) continue;
|
||||
if (hasSpeedLimit) beltSignal.Progress -= 3600;
|
||||
if (BeltSignalCountGenEnabled.Value) productRegister[signalId] += stack;
|
||||
if (!countRecipe) continue;
|
||||
var sources = beltSignal.Sources;
|
||||
if (sources == null) continue;
|
||||
var progress = beltSignal.SourceProgress;
|
||||
var stackf = (float)stack;
|
||||
for (var i = sources.Length - 1; i >= 0; i--)
|
||||
{
|
||||
var itemId = sources[i].Item1;
|
||||
var cnt = Mathf.CeilToInt(newCnt);
|
||||
productRegister[itemId] += cnt;
|
||||
consumeRegister[itemId] += cnt;
|
||||
progress[i] = newCnt - cnt;
|
||||
var newCnt = progress[i] + sources[i].Item2 * stackf;
|
||||
if (newCnt > 0)
|
||||
{
|
||||
var itemId = sources[i].Item1;
|
||||
var cnt = Mathf.CeilToInt(newCnt);
|
||||
productRegister[itemId] += cnt;
|
||||
consumeRegister[itemId] += cnt;
|
||||
progress[i] = newCnt - cnt;
|
||||
}
|
||||
else
|
||||
{
|
||||
progress[i] = newCnt;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
progress[i] = newCnt;
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (beltsToRemove == null) continue;
|
||||
foreach (var beltId in beltsToRemove)
|
||||
{
|
||||
belts.Remove(beltId);
|
||||
}
|
||||
}
|
||||
|
||||
PerformanceMonitor.EndSample(ECpuWorkEntry.Belt);
|
||||
DeepProfiler.EndSample(DPEntry.Belt);
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(GameData), "GameTick")]
|
||||
public static IEnumerable<CodeInstruction> GameData_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions)
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(GameLogic), nameof(GameLogic.OnFactoryFrameBegin))]
|
||||
public static void GameLogic_OnFactoryFrameBegin_Postfix()
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(PerformanceMonitor), nameof(PerformanceMonitor.EndSample)))
|
||||
).Advance(1).Insert(
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(BeltSignalGenerator), nameof(ProcessBeltSignals)))
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
ProcessBeltSignals();
|
||||
}
|
||||
|
||||
|
||||
/* BEGIN: Item sources calculation */
|
||||
private static readonly Dictionary<int, ItemSource> ItemSources = new();
|
||||
private static readonly Dictionary<int, ItemSource> ItemSources = [];
|
||||
private static bool _itemSourcesInitialized;
|
||||
|
||||
private class ItemSource
|
||||
@@ -1052,7 +1205,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
for (var i = 0; i < len; i++)
|
||||
{
|
||||
if (ItemSources.ContainsKey(res[i])) continue;
|
||||
var rs = new ItemSource { Count = rescnt[i], From = new Dictionary<int, float>() };
|
||||
var rs = new ItemSource { Count = rescnt[i], From = [], Extra = null };
|
||||
var it = recipe.Items;
|
||||
var itcnt = recipe.ItemCounts;
|
||||
var len2 = it.Length;
|
||||
@@ -1063,7 +1216,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
|
||||
if (len > 1)
|
||||
{
|
||||
rs.Extra = new Dictionary<int, float>();
|
||||
rs.Extra = [];
|
||||
for (var k = 0; k < len; k++)
|
||||
{
|
||||
if (i != k)
|
||||
@@ -1093,16 +1246,12 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
times = count / itemSource.Count;
|
||||
}
|
||||
|
||||
{
|
||||
result.TryGetValue(itemId, out var oldCount);
|
||||
result[itemId] = oldCount + count;
|
||||
}
|
||||
result[itemId] = (result.TryGetValue(itemId, out var oldCount) ? oldCount : 0) + count;
|
||||
if (itemSource.Extra != null)
|
||||
{
|
||||
foreach (var p in itemSource.Extra)
|
||||
{
|
||||
extra.TryGetValue(p.Key, out var oldCount);
|
||||
extra[p.Key] = oldCount + times * p.Value;
|
||||
extra[p.Key] = (extra.TryGetValue(p.Key, out oldCount) ? oldCount : 0) + times * p.Value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1115,7 +1264,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
/* END: Item sources calculation */
|
||||
}
|
||||
|
||||
private class RemovePowerSpaceLimit: PatchImpl<RemovePowerSpaceLimit>
|
||||
private class RemovePowerSpaceLimit : PatchImpl<RemovePowerSpaceLimit>
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.CheckBuildConditions))]
|
||||
@@ -1145,7 +1294,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
}
|
||||
}
|
||||
|
||||
private class BoostWindPower: PatchImpl<BoostWindPower>
|
||||
private class BoostWindPower : PatchImpl<BoostWindPower>
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.EnergyCap_Wind))]
|
||||
@@ -1169,8 +1318,8 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
}
|
||||
|
||||
private class BoostSolarPower: PatchImpl<BoostSolarPower>
|
||||
|
||||
private class BoostSolarPower : PatchImpl<BoostSolarPower>
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.EnergyCap_PV))]
|
||||
@@ -1194,7 +1343,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
}
|
||||
}
|
||||
|
||||
private class BoostFuelPower: PatchImpl<BoostFuelPower>
|
||||
private class BoostFuelPower : PatchImpl<BoostFuelPower>
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.EnergyCap_Fuel))]
|
||||
@@ -1235,7 +1384,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
}
|
||||
}
|
||||
|
||||
private class BoostGeothermalPower: PatchImpl<BoostGeothermalPower>
|
||||
private class BoostGeothermalPower : PatchImpl<BoostGeothermalPower>
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.EnergyCap_GTH))]
|
||||
@@ -1318,7 +1467,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
}
|
||||
}
|
||||
|
||||
private class GreaterPowerUsageInLogistics: PatchImpl<GreaterPowerUsageInLogistics>
|
||||
private class GreaterPowerUsageInLogistics : PatchImpl<GreaterPowerUsageInLogistics>
|
||||
{
|
||||
protected override void OnEnable()
|
||||
{
|
||||
@@ -1468,7 +1617,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
}
|
||||
}
|
||||
|
||||
private class ControlPanelRemoteLogistics: PatchImpl<ControlPanelRemoteLogistics>
|
||||
private class ControlPanelRemoteLogistics : PatchImpl<ControlPanelRemoteLogistics>
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UIControlPanelDispenserInspector), nameof(UIControlPanelDispenserInspector.OnItemIconMouseDown))]
|
||||
@@ -1498,7 +1647,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UIControlPanelStationInspector), nameof(UIControlPanelStationInspector.OnShipIconClick))]
|
||||
[HarmonyPatch(typeof(UIControlPanelStationInspector), nameof(UIControlPanelStationInspector.OnWarperIconClick))]
|
||||
@@ -1527,7 +1676,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UIControlPanelStationStorage), nameof(UIControlPanelStationStorage.OnItemIconMouseDown))]
|
||||
private static IEnumerable<CodeInstruction> UIControlPanelStationStorage_OnItemIconMouseDown_Transpiler(IEnumerable<CodeInstruction> instructions)
|
||||
@@ -1554,7 +1703,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UIControlPanelStationStorage), nameof(UIControlPanelStationStorage.OnTakeBackButtonClick))]
|
||||
private static IEnumerable<CodeInstruction> UIControlPanelStationStorage_OnTakeBackButtonClick_Transpiler(IEnumerable<CodeInstruction> instructions)
|
||||
@@ -1573,7 +1722,7 @@ public class FactoryPatch: PatchImpl<FactoryPatch>
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UIControlPanelVeinCollectorPanel), nameof(UIControlPanelVeinCollectorPanel.OnProductIconClick))]
|
||||
private static IEnumerable<CodeInstruction> UIControlPanelVeinCollectorPanel_OnProductIconClick_Transpiler(IEnumerable<CodeInstruction> instructions)
|
||||
|
||||
@@ -54,7 +54,8 @@ public static class GamePatch
|
||||
protected override void OnDisable()
|
||||
{
|
||||
if (_savedDeterminators == null) return;
|
||||
var abnormalLogic = GameMain.gameScenario.abnormalityLogic;
|
||||
var abnormalLogic = GameMain.gameScenario?.abnormalityLogic;
|
||||
if (abnormalLogic?.determinators == null) return;
|
||||
abnormalLogic.determinators = _savedDeterminators;
|
||||
foreach (var p in _savedDeterminators)
|
||||
{
|
||||
@@ -63,19 +64,19 @@ public static class GamePatch
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyBeforeGameSave")]
|
||||
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnAssemblerRecipePick")]
|
||||
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnGameBegin")]
|
||||
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnMechaForgeTaskComplete")]
|
||||
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnUnlockTech")]
|
||||
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnUseConsole")]
|
||||
[HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyBeforeGameSave))]
|
||||
[HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyOnAssemblerRecipePick))]
|
||||
[HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyOnGameBegin))]
|
||||
[HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyOnMechaForgeTaskComplete))]
|
||||
[HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyOnUnlockTech))]
|
||||
[HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyOnUseConsole))]
|
||||
private static bool DisableAbnormalLogic()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(AbnormalityLogic), "InitDeterminators")]
|
||||
[HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.InitDeterminators))]
|
||||
private static void DisableAbnormalDeterminators(AbnormalityLogic __instance)
|
||||
{
|
||||
_savedDeterminators = __instance.determinators;
|
||||
@@ -186,7 +187,7 @@ public static class GamePatch
|
||||
}
|
||||
}
|
||||
|
||||
public class UnlockTech: PatchImpl<UnlockTech>
|
||||
public class UnlockTech : PatchImpl<UnlockTech>
|
||||
{
|
||||
private static void UnlockTechRecursive(GameHistoryData history, [NotNull] TechProto techProto, int maxLevel = 10000)
|
||||
{
|
||||
@@ -281,7 +282,7 @@ public static class GamePatch
|
||||
}
|
||||
}
|
||||
|
||||
history.VarifyTechQueue();
|
||||
history.VerifyTechQueue();
|
||||
if (history.currentTech != history.techQueue[0])
|
||||
{
|
||||
history.currentTech = history.techQueue[0];
|
||||
|
||||
@@ -29,7 +29,7 @@ public static class PlanetPatch
|
||||
TerraformAnyway.Enable(false);
|
||||
}
|
||||
|
||||
private class WaterPumperPatch: PatchImpl<WaterPumperPatch>
|
||||
private class WaterPumperPatch : PatchImpl<WaterPumperPatch>
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CheckBuildConditions))]
|
||||
@@ -51,7 +51,7 @@ public static class PlanetPatch
|
||||
}
|
||||
}
|
||||
|
||||
private class TerraformAnyway: PatchImpl<TerraformAnyway>
|
||||
private class TerraformAnyway : PatchImpl<TerraformAnyway>
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(BuildTool_Reform), nameof(BuildTool_Reform.ReformAction))]
|
||||
|
||||
@@ -8,28 +8,42 @@ namespace CheatEnabler.Patches;
|
||||
|
||||
public static class PlayerPatch
|
||||
{
|
||||
public static ConfigEntry<bool> InstantHandCraftEnabled;
|
||||
public static ConfigEntry<bool> InstantTeleportEnabled;
|
||||
public static ConfigEntry<bool> WarpWithoutSpaceWarpersEnabled;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
InstantHandCraftEnabled.SettingChanged += (_, _) => InstantHandCraft.Enable(InstantHandCraftEnabled.Value);
|
||||
InstantTeleportEnabled.SettingChanged += (_, _) => InstantTeleport.Enable(InstantTeleportEnabled.Value);
|
||||
WarpWithoutSpaceWarpersEnabled.SettingChanged += (_, _) => WarpWithoutSpaceWarpers.Enable(WarpWithoutSpaceWarpersEnabled.Value);
|
||||
}
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
InstantHandCraft.Enable(InstantHandCraftEnabled.Value);
|
||||
InstantTeleport.Enable(InstantTeleportEnabled.Value);
|
||||
WarpWithoutSpaceWarpers.Enable(WarpWithoutSpaceWarpersEnabled.Value);
|
||||
}
|
||||
|
||||
public static void Uninit()
|
||||
{
|
||||
InstantHandCraft.Enable(false);
|
||||
InstantTeleport.Enable(false);
|
||||
WarpWithoutSpaceWarpers.Enable(false);
|
||||
}
|
||||
|
||||
private class InstantTeleport: PatchImpl<InstantTeleport>
|
||||
private class InstantHandCraft : PatchImpl<InstantHandCraft>
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(ForgeTask), MethodType.Constructor, typeof(int), typeof(int))]
|
||||
private static void ForgeTask_Ctor_Postfix(ForgeTask __instance)
|
||||
{
|
||||
__instance.tickSpend = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private class InstantTeleport : PatchImpl<InstantTeleport>
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UIGlobemap), nameof(UIGlobemap._OnUpdate))]
|
||||
@@ -52,7 +66,7 @@ public static class PlayerPatch
|
||||
}
|
||||
}
|
||||
|
||||
private class WarpWithoutSpaceWarpers: PatchImpl<WarpWithoutSpaceWarpers>
|
||||
private class WarpWithoutSpaceWarpers : PatchImpl<WarpWithoutSpaceWarpers>
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(Mecha), nameof(Mecha.HasWarper))]
|
||||
@@ -61,7 +75,7 @@ public static class PlayerPatch
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(Mecha), nameof(Mecha.UseWarper))]
|
||||
private static void Mecha_UseWarper_Postfix(ref bool __result)
|
||||
|
||||
@@ -29,61 +29,94 @@ public static class ResourcePatch
|
||||
FastMining.Enable(false);
|
||||
}
|
||||
|
||||
private class InfiniteResource: PatchImpl<InfiniteResource>
|
||||
private class InfiniteResource : PatchImpl<InfiniteResource>
|
||||
{
|
||||
static private readonly float InfiniteResourceRate = 0f;
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(FactorySystem), "GameTick", typeof(long), typeof(bool))]
|
||||
[HarmonyPatch(typeof(FactorySystem), "GameTick", typeof(long), typeof(bool), typeof(int), typeof(int), typeof(int))]
|
||||
[HarmonyPatch(typeof(ItemProto), "GetPropValue")]
|
||||
[HarmonyPatch(typeof(PlanetTransport), "GameTick")]
|
||||
[HarmonyPatch(typeof(UIMinerWindow), "_OnUpdate")]
|
||||
[HarmonyPatch(typeof(UIMiningUpgradeLabel), "Update")]
|
||||
[HarmonyPatch(typeof(UIPlanetDetail), "OnPlanetDataSet")]
|
||||
[HarmonyPatch(typeof(UIPlanetDetail), "RefreshDynamicProperties")]
|
||||
[HarmonyPatch(typeof(UIStarDetail), "OnStarDataSet")]
|
||||
[HarmonyPatch(typeof(UIStarDetail), "RefreshDynamicProperties")]
|
||||
[HarmonyPatch(typeof(UIStationStorage), "RefreshValues")]
|
||||
[HarmonyPatch(typeof(UIVeinCollectorPanel), "_OnUpdate")]
|
||||
[HarmonyPatch(typeof(FactorySystem), nameof(FactorySystem.GameTick), typeof(long), typeof(bool))]
|
||||
[HarmonyPatch(typeof(GameLogic), nameof(GameLogic._miner_parallel))]
|
||||
[HarmonyPatch(typeof(PlanetTransport), nameof(PlanetTransport.GameTick))]
|
||||
[HarmonyPatch(typeof(UIChartAstroResource), nameof(UIChartAstroResource.CalculateMaxAmount))]
|
||||
[HarmonyPatch(typeof(UIChartVeinGroup), nameof(UIChartVeinGroup.CalculateMaxAmount))]
|
||||
[HarmonyPatch(typeof(UIControlPanelAdvancedMinerEntry), nameof(UIControlPanelAdvancedMinerEntry._OnUpdate))]
|
||||
[HarmonyPatch(typeof(UIControlPanelVeinCollectorPanel), nameof(UIControlPanelVeinCollectorPanel._OnUpdate))]
|
||||
[HarmonyPatch(typeof(UIMinerWindow), nameof(UIMinerWindow._OnUpdate))]
|
||||
[HarmonyPatch(typeof(UIMiningUpgradeLabel), nameof(UIMiningUpgradeLabel.Update))]
|
||||
[HarmonyPatch(typeof(UIVeinCollectorPanel), nameof(UIVeinCollectorPanel._OnUpdate))]
|
||||
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(GameHistoryData), nameof(GameHistoryData.miningCostRate)))
|
||||
new CodeMatch(ci => (ci.opcode == OpCodes.Ldfld || ci.opcode == OpCodes.Ldflda) && ci.OperandIs(AccessTools.Field(typeof(GameHistoryData), nameof(GameHistoryData.miningCostRate))))
|
||||
).Repeat(codeMatcher =>
|
||||
codeMatcher.RemoveInstruction().InsertAndAdvance(
|
||||
new CodeInstruction(OpCodes.Pop),
|
||||
new CodeInstruction(OpCodes.Ldc_R4, 0f)
|
||||
)
|
||||
{
|
||||
if (codeMatcher.Instruction.opcode == OpCodes.Ldfld)
|
||||
{
|
||||
codeMatcher.RemoveInstruction().InsertAndAdvance(
|
||||
new CodeInstruction(OpCodes.Pop),
|
||||
new CodeInstruction(OpCodes.Ldc_R4, InfiniteResourceRate)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
codeMatcher.RemoveInstruction().InsertAndAdvance(
|
||||
new CodeInstruction(OpCodes.Pop),
|
||||
new CodeInstruction(OpCodes.Ldsflda, AccessTools.Field(typeof(InfiniteResource), nameof(InfiniteResourceRate)))
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
}
|
||||
|
||||
private class FastMining: PatchImpl<FastMining>
|
||||
private class FastMining : PatchImpl<FastMining>
|
||||
{
|
||||
static private readonly float FastMiningSpeed = 2400f;
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(FactorySystem), "GameTick", typeof(long), typeof(bool))]
|
||||
[HarmonyPatch(typeof(FactorySystem), "GameTick", typeof(long), typeof(bool), typeof(int), typeof(int), typeof(int))]
|
||||
[HarmonyPatch(typeof(ItemProto), "GetPropValue")]
|
||||
[HarmonyPatch(typeof(PlanetTransport), "GameTick")]
|
||||
[HarmonyPatch(typeof(UIMinerWindow), "_OnUpdate")]
|
||||
[HarmonyPatch(typeof(UIMiningUpgradeLabel), "Update")]
|
||||
[HarmonyPatch(typeof(UIPlanetDetail), "OnPlanetDataSet")]
|
||||
[HarmonyPatch(typeof(UIPlanetDetail), "RefreshDynamicProperties")]
|
||||
[HarmonyPatch(typeof(UIStarDetail), "OnStarDataSet")]
|
||||
[HarmonyPatch(typeof(UIStarDetail), "RefreshDynamicProperties")]
|
||||
[HarmonyPatch(typeof(UIStationStorage), "RefreshValues")]
|
||||
[HarmonyPatch(typeof(UIVeinCollectorPanel), "_OnUpdate")]
|
||||
[HarmonyPatch(typeof(AstroResourceStatPlan), nameof(AstroResourceStatPlan.AddPlanetResources))]
|
||||
[HarmonyPatch(typeof(BuildingGizmo), nameof(BuildingGizmo.Update))]
|
||||
[HarmonyPatch(typeof(FactorySystem), nameof(FactorySystem.GameTick), typeof(long), typeof(bool))]
|
||||
[HarmonyPatch(typeof(GameLogic), nameof(GameLogic._miner_parallel))]
|
||||
[HarmonyPatch(typeof(ItemProto), nameof(ItemProto.GetPropValue))]
|
||||
[HarmonyPatch(typeof(PlanetTransport), nameof(PlanetTransport.GameTick))]
|
||||
[HarmonyPatch(typeof(ProductionExtraInfoCalculator), nameof(ProductionExtraInfoCalculator.CalculateFactory))]
|
||||
[HarmonyPatch(typeof(UIChartAstroResource), nameof(UIChartAstroResource.CalculateMaxAmount))]
|
||||
[HarmonyPatch(typeof(UIChartVeinGroup), nameof(UIChartVeinGroup.CalculateMaxAmount))]
|
||||
[HarmonyPatch(typeof(UIControlPanelStationStorage), nameof(UIControlPanelStationStorage.RefreshValues))]
|
||||
[HarmonyPatch(typeof(UIControlPanelVeinCollectorPanel), nameof(UIControlPanelVeinCollectorPanel._OnUpdate))]
|
||||
[HarmonyPatch(typeof(UIMinerWindow), nameof(UIMinerWindow._OnUpdate))]
|
||||
[HarmonyPatch(typeof(UIMiningUpgradeLabel), nameof(UIMiningUpgradeLabel.Update))]
|
||||
[HarmonyPatch(typeof(UIPlanetDetail), nameof(UIPlanetDetail.OnPlanetDataSet))]
|
||||
[HarmonyPatch(typeof(UIPlanetDetail), nameof(UIPlanetDetail.RefreshDynamicProperties))]
|
||||
[HarmonyPatch(typeof(UIReferenceSpeedTip), nameof(UIReferenceSpeedTip.AddEntryDataWithFactory))]
|
||||
[HarmonyPatch(typeof(UIStarDetail), nameof(UIStarDetail.OnStarDataSet))]
|
||||
[HarmonyPatch(typeof(UIStarDetail), nameof(UIStarDetail.RefreshDynamicProperties))]
|
||||
[HarmonyPatch(typeof(UIStationStorage), nameof(UIStationStorage.RefreshValues))]
|
||||
[HarmonyPatch(typeof(UIVeinCollectorPanel), nameof(UIVeinCollectorPanel._OnUpdate))]
|
||||
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(GameHistoryData), nameof(GameHistoryData.miningSpeedScale)))
|
||||
new CodeMatch(ci => (ci.opcode == OpCodes.Ldfld || ci.opcode == OpCodes.Ldflda) && ci.OperandIs(AccessTools.Field(typeof(GameHistoryData), nameof(GameHistoryData.miningSpeedScale))))
|
||||
).Repeat(codeMatcher =>
|
||||
codeMatcher.RemoveInstruction().InsertAndAdvance(
|
||||
new CodeInstruction(OpCodes.Pop),
|
||||
new CodeInstruction(OpCodes.Ldc_R4, 2400f)
|
||||
)
|
||||
{
|
||||
if (codeMatcher.Instruction.opcode == OpCodes.Ldfld)
|
||||
{
|
||||
codeMatcher.RemoveInstruction().InsertAndAdvance(
|
||||
new CodeInstruction(OpCodes.Pop),
|
||||
new CodeInstruction(OpCodes.Ldc_R4, FastMiningSpeed)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
codeMatcher.RemoveInstruction().InsertAndAdvance(
|
||||
new CodeInstruction(OpCodes.Pop),
|
||||
new CodeInstruction(OpCodes.Ldsflda, AccessTools.Field(typeof(FastMining), nameof(FastMiningSpeed)))
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
@@ -1,123 +1,149 @@
|
||||
# CheatEnabler
|
||||
|
||||
#### Add various cheat functions while disabling abnormal determinants
|
||||
#### 添加一些作弊功能,同时屏蔽异常检测
|
||||
<details>
|
||||
<summary>Read me in English</summary>
|
||||
|
||||
***Add various cheat functions while disabling abnormal determinants***
|
||||
|
||||
## Usage
|
||||
|
||||
* Config panel is unified with UXAssist.
|
||||
* There are also buttons on title screen and planet minimap area to call up the config panel.
|
||||
* Features:
|
||||
+ General:
|
||||
+ Enable Dev Shortcuts (check config panel for usage)
|
||||
+ Disable Abnormal Checks
|
||||
+ Unlock techs with key-modifiers (Ctrl/Alt/Shift)
|
||||
+ Remove all metadata consumption records
|
||||
+ Remove metadata consumption record in current game
|
||||
+ Clear metadata flag which bans achievements
|
||||
+ Assign gamesave to currrnet account
|
||||
+ Factory:
|
||||
+ Finish build immediately
|
||||
+ Architect mode (Infinite buildings)
|
||||
+ Build without condition
|
||||
+ No collision
|
||||
+ Belt signal item generation
|
||||
- Count generations as production in statistics
|
||||
- Count removals as consumption in statistics
|
||||
- Count all raws and intermediates in statistics
|
||||
- Belt signal alt format
|
||||
+ Increase maximum power usage in Logistic Stations and Advanced Mining Machines
|
||||
- Logistic Stations: Increased max charging power to 3GW(ILS) and 600MW(PLS) (10x of original)
|
||||
- Advanced Mining Machines: Increased max mining speed to 1000%
|
||||
+ Retrieve/Place items from/to remote planets on logistics control panel
|
||||
+ Remove space limit between wind turbines and solar panels
|
||||
+ Wind Turbines do global power coverage
|
||||
+ Boost power generations for kinds of power generators
|
||||
+ Planet:
|
||||
+ Infinite Natural Resources
|
||||
+ Fast Mining
|
||||
+ Pump Anywhere
|
||||
+ Terraform without enought soil piles
|
||||
+ Instant teleport (like that in Sandbox mode)
|
||||
+ Dyson Sphere:
|
||||
+ Skip bullet period
|
||||
+ Skip absorption period
|
||||
+ Quick absorb
|
||||
+ Eject anyway
|
||||
+ Complete Dyson Sphere Shells instantly
|
||||
+ Mecha/Combat:
|
||||
+ Mecha and Drones/Fleets invicible
|
||||
+ Buildings invicible
|
||||
+ Enable warp without space warpers
|
||||
+ Teleport to outer space
|
||||
+ Teleport to selected astronomical
|
||||
* General:
|
||||
* Enable Dev Shortcuts (check config panel for usage)
|
||||
* Disable Abnormal Checks
|
||||
* Unlock techs with key-modifiers (Ctrl/Alt/Shift)
|
||||
* Remove all metadata consumption records
|
||||
* Remove metadata consumption record in current game
|
||||
* Clear metadata flag which bans achievements
|
||||
* Assign gamesave to currrnet account
|
||||
* Factory:
|
||||
* Finish build immediately
|
||||
* Architect mode (Infinite buildings)
|
||||
* Build without condition
|
||||
* No collision
|
||||
* Belt signal item generation
|
||||
* Count generations as production in statistics
|
||||
* Count removals as consumption in statistics
|
||||
* Count all raws and intermediates in statistics
|
||||
* Belt signal alt format
|
||||
* Increase maximum power usage in Logistic Stations and Advanced Mining Machines
|
||||
* Logistic Stations: Increased max charging power to 3GW(ILS) and 600MW(PLS) (10x of original)
|
||||
* Advanced Mining Machines: Increased max mining speed to 1000%
|
||||
* Retrieve/Place items from/to remote planets on logistics control panel
|
||||
* Remove space limit between wind turbines and solar panels
|
||||
* Wind Turbines do global power coverage
|
||||
* Boost power generations for kinds of power generators
|
||||
* Planet:
|
||||
* Instant hand-craft
|
||||
* Infinite Natural Resources
|
||||
* Fast Mining
|
||||
* Pump Anywhere
|
||||
* Terraform without enought soil piles
|
||||
* Instant teleport (like that in Sandbox mode)
|
||||
* Dyson Sphere:
|
||||
* Skip bullet period
|
||||
* Skip absorption period
|
||||
* Quick absorb
|
||||
* Eject anyway
|
||||
* Unlock Dyson Sphere max orbit radius
|
||||
* Complete Dyson Sphere Shells instantly
|
||||
* Buttons for creating illegal Dyson Sphere Shells, you must enable `IllegalDysonShellFunctionsEnabled` of `DysonSphere` section in config to see the last 2 buttons.
|
||||
* Generate an illegal dyson shell
|
||||
* Keep max production shells and remove others
|
||||
* Duplicate shells from that with highest production
|
||||
* Mecha/Combat:
|
||||
* Mecha and Drones/Fleets invicible
|
||||
* Buildings invicible
|
||||
* Enable warp without space warpers
|
||||
* Teleport to outer space
|
||||
* Teleport to selected astronomical
|
||||
|
||||
## Notes
|
||||
|
||||
* Please upgrade `BepInEx` 5.4.21 or later if using with [BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/) to avoid possible conflicts.
|
||||
+ You can download `BepInEx` [here](https://github.com/bepinex/bepinex/releases/latest)(choose x64 edition).
|
||||
+ If using with r2modman, you can upgrade `BepInEx` by clicking `Settings` -> `Browse profile folder`, then extract downloaded zip to the folder and overwrite existing files.
|
||||
* You can download [BepInEx here](https://github.com/bepinex/bepinex/releases/latest)(choose x64 edition).
|
||||
* If using with r2modman, you can upgrade `BepInEx` by clicking `Settings` -> `Browse profile folder`, then extract downloaded zip to the folder and overwrite existing files.
|
||||
|
||||
## CREDITS
|
||||
|
||||
* [Dyson Sphere Program](https://store.steampowered.com/app/1366540): The great game
|
||||
* [BepInEx](https://bepinex.dev/): Base modding framework
|
||||
* [Multifunction_mod](https://github.com/blacksnipebiu/Multifunction_mod): Some cheat functions
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>中文读我</summary>
|
||||
|
||||
***添加一些作弊功能,同时屏蔽异常检测***
|
||||
|
||||
## 使用说明
|
||||
|
||||
* 配置面板复用UXAssist
|
||||
* 标题界面和行星小地图旁也有按钮呼出主面板
|
||||
* 功能:
|
||||
+ 常规:
|
||||
+ 启用开发模式快捷键(使用说明见设置面板)
|
||||
+ 屏蔽异常检测
|
||||
+ 使用组合键解锁科技(Ctrl/Alt/Shift)
|
||||
+ 移除所有元数据消耗记录
|
||||
+ 移除当前存档的元数据消耗记录
|
||||
+ 解除当前存档因使用元数据导致的成就限制
|
||||
+ 将游戏存档绑定给当前账号
|
||||
+ 工厂:
|
||||
+ 建造秒完成
|
||||
+ 建筑师模式(无限建筑)
|
||||
+ 无条件建造
|
||||
+ 无碰撞
|
||||
+ 传送带信号物品生成
|
||||
- 统计信息里将生成计算为产物
|
||||
- 统计信息里将移除计算为消耗
|
||||
- 统计面板中计算所有原材料和中间产物
|
||||
- 传送带信号替换格式
|
||||
+ 提升物流塔和大型采矿机的最大功耗
|
||||
- 物流塔:将最大充电功率提高到3GW(星际物流塔)和600MW(行星物流塔)(原来的10倍)
|
||||
- 大型采矿机:将最大采矿速度提高到1000%
|
||||
+ 在物流总控面板上可以从非本地行星取放物品
|
||||
+ 风力发电机和太阳能板无间距限制
|
||||
+ 风力涡轮机供电覆盖全球
|
||||
+ 提升各种发电设备发电量
|
||||
+ 行星:
|
||||
+ 自然资源采集不消耗
|
||||
+ 高速采集
|
||||
+ 平地抽水
|
||||
+ 沙土不够时依然可以整改地形
|
||||
+ 快速传送(和沙盒模式一样)
|
||||
+ 戴森球:
|
||||
+ 跳过子弹阶段
|
||||
+ 跳过吸收阶段
|
||||
+ 快速吸收
|
||||
+ 全球弹射
|
||||
+ 立即完成戴森壳建造
|
||||
+ 机甲/战斗:
|
||||
+ 机甲和战斗无人机无敌
|
||||
+ 建筑无敌
|
||||
+ 无需空间翘曲器即可曲速飞行
|
||||
+ 传送到外太空
|
||||
+ 传送到选定的天体
|
||||
* 常规:
|
||||
* 启用开发模式快捷键(使用说明见设置面板)
|
||||
* 屏蔽异常检测
|
||||
* 使用组合键解锁科技(Ctrl/Alt/Shift)
|
||||
* 移除所有元数据消耗记录
|
||||
* 移除当前存档的元数据消耗记录
|
||||
* 解除当前存档因使用元数据导致的成就限制
|
||||
* 将游戏存档绑定给当前账号
|
||||
* 工厂:
|
||||
* 建造秒完成
|
||||
* 建筑师模式(无限建筑)
|
||||
* 无条件建造
|
||||
* 无碰撞
|
||||
* 传送带信号物品生成
|
||||
* 统计信息里将生成计算为产物
|
||||
* 统计信息里将移除计算为消耗
|
||||
* 统计面板中计算所有原材料和中间产物
|
||||
* 传送带信号替换格式
|
||||
* 提升物流塔和大型采矿机的最大功耗
|
||||
* 物流塔:将最大充电功率提高到3GW(星际物流塔)和600MW(行星物流塔)(原来的10倍)
|
||||
* 大型采矿机:将最大采矿速度提高到1000%
|
||||
* 在物流总控面板上可以从非本地行星取放物品
|
||||
* 风力发电机和太阳能板无间距限制
|
||||
* 风力涡轮机供电覆盖全球
|
||||
* 提升各种发电设备发电量
|
||||
* 行星:
|
||||
* 快速手动制造
|
||||
* 自然资源采集不消耗
|
||||
* 高速采集
|
||||
* 平地抽水
|
||||
* 沙土不够时依然可以整改地形
|
||||
* 快速传送(和沙盒模式一样)
|
||||
* 戴森球:
|
||||
* 跳过子弹阶段
|
||||
* 跳过吸收阶段
|
||||
* 快速吸收
|
||||
* 全球弹射
|
||||
* 解锁戴森球最大轨道半径
|
||||
* 立即完成戴森壳建造
|
||||
* 用于制作仙术戴森壳的按钮,你必须在设置文件里开启`DysonSphere`分类的`IllegalDysonShellFunctionsEnabled`才能看到后面两个按钮
|
||||
* 生成单层仙术戴森壳
|
||||
* 保留发电量最高的戴森壳并移除其他戴森壳
|
||||
* 从发电量最高的壳复制戴森壳
|
||||
* 机甲/战斗:
|
||||
* 机甲和战斗无人机无敌
|
||||
* 建筑无敌
|
||||
* 无需空间翘曲器即可曲速飞行
|
||||
* 传送到外太空
|
||||
* 传送到选定的天体
|
||||
|
||||
## 注意事项
|
||||
|
||||
* 如果和[BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/)一起使用,请升级`BepInEx`到5.4.21或更高版本,以避免可能的冲突
|
||||
+ 你可以在[这里](https://github.com/bepinex/bepinex/releases/latest)(选择x64版本)下载`BepInEx`
|
||||
+ 如果使用r2modman,你可以点击`Settings` -> `Browse profile folder`,然后将下载的zip解压到该文件夹并覆盖现有文件
|
||||
* 你可以在[这里](https://github.com/bepinex/bepinex/releases/latest)(选择x64版本)下载`BepInEx`
|
||||
* 如果使用r2modman,你可以点击`Settings` -> `Browse profile folder`,然后将下载的zip解压到该文件夹并覆盖现有文件
|
||||
|
||||
## 鸣谢
|
||||
|
||||
* [戴森球计划](https://store.steampowered.com/app/1366540): 伟大的游戏
|
||||
* [BepInEx](https://bepinex.dev/): 基础模组框架
|
||||
* [Multifunction_mod](https://github.com/blacksnipebiu/Multifunction_mod): 一些作弊功能
|
||||
|
||||
</details>
|
||||
|
||||
@@ -3,6 +3,7 @@ using CheatEnabler.Patches;
|
||||
using UnityEngine;
|
||||
using UXAssist.UI;
|
||||
using UXAssist.Common;
|
||||
using System;
|
||||
|
||||
namespace CheatEnabler;
|
||||
|
||||
@@ -44,7 +45,7 @@ public static class UIConfigWindow
|
||||
"传送带信号物品生成数量格式:\n 默认为AAAABC\n 勾选替换为BCAAAA\nAAAA=生成速度,B=增产点数,C=堆叠数量");
|
||||
I18N.Add("Count generations as production in statistics", "Count generations as production in statistics", "统计信息里将生成计算为产物");
|
||||
I18N.Add("Count removals as consumption in statistics", "Count removals as consumption in statistics", "统计信息里将移除计算为消耗");
|
||||
I18N.Add("Count all raws and intermediates in statistics","Count all raw materials in statistics", "统计信息里计算所有原料和中间产物");
|
||||
I18N.Add("Count all raws and intermediates in statistics", "Count all raw materials in statistics", "统计信息里计算所有原料和中间产物");
|
||||
I18N.Add("Remove power space limit", "Remove space limit for winds and geothermals", "移除风力发电和地热发电的间距限制");
|
||||
I18N.Add("Boost wind power", "Boost wind power(x100,000)", "提升风力发电(x100,000)");
|
||||
I18N.Add("Boost solar power", "Boost solar power(x100,000)", "提升太阳能发电(x100,000)");
|
||||
@@ -52,19 +53,30 @@ public static class UIConfigWindow
|
||||
I18N.Add("Boost fuel power 2", "(x20,000 for deuteron, x10,000 for antimatter)", "(氘核燃料棒x20,000,反物质燃料棒x10,000)");
|
||||
I18N.Add("Wind Turbines do global power coverage", "Wind Turbines do global power coverage", "风力涡轮机供电覆盖全球");
|
||||
I18N.Add("Boost geothermal power", "Boost geothermal power(x50,000)", "提升地热发电(x50,000)");
|
||||
I18N.Add("Increase maximum power usage in Logistic Stations and Advanced Mining Machines", "Increase maximum power usage in Logistic Stations and Advanced Mining Machines", "提升物流塔和大型采矿机的最大功耗");
|
||||
I18N.Add("Increase maximum power usage in Logistic Stations and Advanced Mining Machines", "Increase maximum power usage in Logistic Stations and Advanced Mining Machines",
|
||||
"提升物流塔和大型采矿机的最大功耗");
|
||||
I18N.Add("Retrieve/Place items from/to remote planets on logistics control panel", "Retrieve/Place items from/to remote planets on logistics control panel", "在物流总控面板上可以从非本地行星取放物品");
|
||||
I18N.Add("Infinite Natural Resources", "Infinite natural resources", "自然资源采集不消耗");
|
||||
I18N.Add("Fast Mining", "Fast mining", "高速采集");
|
||||
I18N.Add("Pump Anywhere", "Pump anywhere", "平地抽水");
|
||||
I18N.Add("Skip bullet period", "Skip bullet period", "跳过子弹阶段");
|
||||
I18N.Add("Fire all bullets at once", "Fire all bullets at once", "一次弹射所有太阳帆");
|
||||
I18N.Add("Skip absorption period", "Skip absorption period", "跳过吸收阶段");
|
||||
I18N.Add("Quick absorb", "Quick absorb", "快速吸收");
|
||||
I18N.Add("Eject anyway", "Eject anyway", "全球弹射");
|
||||
I18N.Add("Overclock Ejectors", "Overclock Ejectors (10x)", "高速弹射器(10倍射速)");
|
||||
I18N.Add("Overclock Silos", "Overclock Silos (10x)", "高速发射井(10倍射速)");
|
||||
I18N.Add("Unlock Dyson Sphere max orbit radius", "Unlock Dyson Sphere max orbit radius", "解锁戴森球最大轨道半径");
|
||||
I18N.Add("Complete Dyson Sphere shells instantly", "Complete Dyson Sphere shells instantly", "立即完成戴森壳建造");
|
||||
I18N.Add("Generate illegal dyson shell", "Generate an illegal dyson shell (!!All shells will be removed first!!)", "生成单层仙术戴森壳(!!会先删除全部的壳!!)");
|
||||
I18N.Add("Keep max production shells and remove others", "Keep max production shells and remove others", "保留发电量最高的戴森壳并移除其他戴森壳");
|
||||
I18N.Add("Duplicate shells from that with highest production", "Duplicate shells from that with highest production", "从发电量最高的壳复制戴森壳");
|
||||
I18N.Add("Generate illegal dyson shell quickly", "Generate illegal dyson shell quickly", "快速生成仙术戴森壳");
|
||||
I18N.Add("Shells count", "Shells count", "壳面数量");
|
||||
I18N.Add("WARNING: This operation can be very slow, continue?", "WARNING: This operation can be very slow, continue?", "警告:此操作可能非常慢,继续吗?");
|
||||
I18N.Add("WARNING: This operation is DANGEROUS, continue?", "WARNING: This operation is DANGEROUS, continue?", "警告:此操作非常危险,继续吗?");
|
||||
I18N.Add("Terraform without enough soil piles", "Terraform without enough soil piles", "沙土不够时依然可以整改地形");
|
||||
I18N.Add("Instant hand-craft", "Instant hand-craft", "快速手动制造");
|
||||
I18N.Add("Instant teleport (like that in Sandbox mode)", "Instant teleport (like that in Sandbox mode)", "快速传送(和沙盒模式一样)");
|
||||
I18N.Add("Mecha and Drones/Fleets invicible", "Mecha and Drones/Fleets invicible", "机甲和战斗无人机无敌");
|
||||
I18N.Add("Buildings invicible", "Buildings invincible", "建筑无敌");
|
||||
@@ -76,6 +88,57 @@ public static class UIConfigWindow
|
||||
MyConfigWindow.OnUpdateUI += UpdateUI;
|
||||
}
|
||||
|
||||
class MaxOrbitRadiusValueMapper : MyWindow.RangeValueMapper<float>
|
||||
{
|
||||
public MaxOrbitRadiusValueMapper() : base(1, 20)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ValueToIndex(float value)
|
||||
{
|
||||
int result = Mathf.FloorToInt(value / 500_000f);
|
||||
if (result < 1) result = 1;
|
||||
if (result > 20) result = 20;
|
||||
return result;
|
||||
}
|
||||
|
||||
public override float IndexToValue(int index)
|
||||
{
|
||||
return index * 500_000f;
|
||||
}
|
||||
}
|
||||
|
||||
class ShellsCountMapper : MyWindow.RangeValueMapper<int>
|
||||
{
|
||||
public ShellsCountMapper() : base(1, 139)
|
||||
{
|
||||
}
|
||||
|
||||
public override int ValueToIndex(int value)
|
||||
{
|
||||
return value switch
|
||||
{
|
||||
< 4 => value,
|
||||
< 64 => value / 4 + 3,
|
||||
< 256 => value / 16 + 15,
|
||||
< 4096 => value / 64 + 27,
|
||||
_ => value / 256 + 75,
|
||||
};
|
||||
}
|
||||
|
||||
public override int IndexToValue(int index)
|
||||
{
|
||||
return index switch
|
||||
{
|
||||
< 4 => index,
|
||||
< 19 => (index - 3) * 4,
|
||||
< 31 => (index - 15) * 16,
|
||||
< 91 => (index - 27) * 64,
|
||||
_ => (index - 75) * 256,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
|
||||
{
|
||||
_windowTrans = trans;
|
||||
@@ -137,12 +200,20 @@ public static class UIConfigWindow
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.GreaterPowerUsageInLogisticsEnabled, "Increase maximum power usage in Logistic Stations and Advanced Mining Machines");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.ControlPanelRemoteLogisticsEnabled, "Retrieve/Place items from/to remote planets on logistics control panel");
|
||||
|
||||
FactoryPatch.BeltSignalGeneratorEnabled.SettingChanged += (_, _) =>
|
||||
{
|
||||
OnBeltSignalChanged();
|
||||
};
|
||||
OnBeltSignalChanged();
|
||||
FactoryPatch.BeltSignalGeneratorEnabled.SettingChanged += OnBeltSignalChanged;
|
||||
wnd.OnFree += () => { FactoryPatch.BeltSignalGeneratorEnabled.SettingChanged -= OnBeltSignalChanged; };
|
||||
OnBeltSignalChanged(null, null);
|
||||
void OnBeltSignalChanged(object o, EventArgs e)
|
||||
{
|
||||
var on = FactoryPatch.BeltSignalGeneratorEnabled.Value;
|
||||
cb1.gameObject.SetActive(on);
|
||||
cb2.gameObject.SetActive(on);
|
||||
cb3.gameObject.SetActive(on);
|
||||
cb4.gameObject.SetActive(on);
|
||||
tip1.gameObject.SetActive(on);
|
||||
}
|
||||
}
|
||||
x = 350f;
|
||||
y = 10f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.RemovePowerSpaceLimitEnabled, "Remove power space limit");
|
||||
@@ -171,6 +242,8 @@ public static class UIConfigWindow
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlanetPatch.TerraformAnywayEnabled, "Terraform without enough soil piles");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlayerPatch.InstantHandCraftEnabled, "Instant hand-craft");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlayerPatch.InstantTeleportEnabled, "Instant teleport (like that in Sandbox mode)");
|
||||
x = 400f;
|
||||
y = 10f;
|
||||
@@ -199,6 +272,8 @@ public static class UIConfigWindow
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.SkipBulletEnabled, "Skip bullet period");
|
||||
y += 26f;
|
||||
wnd.AddCheckBox(x + 26f, y, tab4, DysonSpherePatch.FireAllBulletsEnabled, "Fire all bullets at once", 13);
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.SkipAbsorbEnabled, "Skip absorption period");
|
||||
y += 36f;
|
||||
@@ -209,9 +284,72 @@ public static class UIConfigWindow
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.OverclockEjectorEnabled, "Overclock Ejectors");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.OverclockSiloEnabled, "Overclock Silos");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.UnlockMaxOrbitRadiusEnabled, "Unlock Dyson Sphere max orbit radius");
|
||||
y += 30f;
|
||||
{
|
||||
var slider = wnd.AddSlider(x + 20, y, tab4, DysonSpherePatch.UnlockMaxOrbitRadiusValue, new MaxOrbitRadiusValueMapper(), "##,#m").WithSmallerHandle(-40f);
|
||||
DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.SettingChanged += UnlockMaxOrbitRadiusChanged;
|
||||
wnd.OnFree += () => { DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.SettingChanged -= UnlockMaxOrbitRadiusChanged; };
|
||||
UnlockMaxOrbitRadiusChanged(null, null);
|
||||
|
||||
void UnlockMaxOrbitRadiusChanged(object o, EventArgs e)
|
||||
{
|
||||
slider.slider.enabled = DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.Value;
|
||||
}
|
||||
}
|
||||
x = 300f;
|
||||
y = 10f;
|
||||
wnd.AddButton(x, y, 300f, tab4, "Complete Dyson Sphere shells instantly", 16, "button-complete-dyson-sphere-shells-instantly", DysonSphereFunctions.CompleteShellsInstantly);
|
||||
{
|
||||
y += 72f;
|
||||
var originalY = y;
|
||||
var btn1 = wnd.AddButton(x, y, 300f, tab4, "Generate illegal dyson shell", 16, "button-generate-illegal-dyson-shells", () =>
|
||||
{
|
||||
UIMessageBox.Show("Generate illegal dyson shell".Translate(), "WARNING: This operation can be very slow, continue?".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.WARNING, null,
|
||||
() => { DysonSphereFunctions.CreateIllegalDysonShellWithMaxOutput(); });
|
||||
});
|
||||
y += 36f;
|
||||
var btn2 = wnd.AddButton(x, y, 300f, tab4, "Keep max production shells and remove others", 16, "button-keep-max-production-shells", () =>
|
||||
{
|
||||
UIMessageBox.Show("Keep max production shells and remove others".Translate(), "WARNING: This operation is DANGEROUS, continue?".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.WARNING, null,
|
||||
() => { DysonSphereFunctions.KeepMaxProductionShells(); });
|
||||
});
|
||||
y += 36f;
|
||||
var btn3 = wnd.AddButton(x, y, 300f, tab4, "Duplicate shells from that with highest production", 16, "button-duplicate-shells-from-the-highest-production", () =>
|
||||
{
|
||||
UIMessageBox.Show("Duplicate shells from that with highest production".Translate(), "WARNING: This operation can be very slow, continue?".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.WARNING, null,
|
||||
() => { DysonSphereFunctions.DuplicateShellsWithHighestProduction(); });
|
||||
});
|
||||
y += 30f;
|
||||
var slider1 = wnd.AddSlider(x + 20f, y, tab4, DysonSphereFunctions.ShellsCountForFunctions, new ShellsCountMapper());
|
||||
|
||||
y = originalY;
|
||||
var btn4 = wnd.AddButton(x, y, 300f, tab4, "Generate illegal dyson shell quickly", 16, "button-generate-illegal-dyson-shells-quickly", () =>
|
||||
{
|
||||
UIMessageBox.Show("Generate illegal dyson shell".Translate(), "WARNING: This operation can be very slow, continue?".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.WARNING, null,
|
||||
() => { DysonSphereFunctions.CreateIllegalDysonShellQuickly(DysonSphereFunctions.ShellsCountForFunctions.Value); });
|
||||
});
|
||||
y += 30f;
|
||||
var txt2 = wnd.AddText2(x, y, tab4, "Shells count", 15, "text-shells-count");
|
||||
var slider2 = wnd.AddSlider(x + txt2.preferredWidth + 5f, y + 6f, tab4, DysonSphereFunctions.ShellsCountForFunctions, new ShellsCountMapper());
|
||||
|
||||
Functions.DysonSphereFunctions.IllegalDysonShellFunctionsEnabled.SettingChanged += onIllegalDysonShellFunctionsChanged;
|
||||
wnd.OnFree += () => { Functions.DysonSphereFunctions.IllegalDysonShellFunctionsEnabled.SettingChanged -= onIllegalDysonShellFunctionsChanged; };
|
||||
onIllegalDysonShellFunctionsChanged(null, null);
|
||||
void onIllegalDysonShellFunctionsChanged(object o, EventArgs e)
|
||||
{
|
||||
var enabled = Functions.DysonSphereFunctions.IllegalDysonShellFunctionsEnabled.Value;
|
||||
btn1.gameObject.SetActive(enabled);
|
||||
btn2.gameObject.SetActive(enabled);
|
||||
btn3.gameObject.SetActive(enabled);
|
||||
slider1.gameObject.SetActive(enabled);
|
||||
|
||||
btn4.gameObject.SetActive(!enabled);
|
||||
txt2.gameObject.SetActive(!enabled);
|
||||
slider2.gameObject.SetActive(!enabled);
|
||||
}
|
||||
}
|
||||
|
||||
var tab5 = wnd.AddTab(_windowTrans, "Mecha/Combat");
|
||||
x = 0f;
|
||||
@@ -226,17 +364,6 @@ public static class UIConfigWindow
|
||||
wnd.AddButton(x, y, 200f, tab5, "Teleport to outer space", 16, "button-teleport-to-outer-space", PlayerFunctions.TeleportToOuterSpace);
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 200f, tab5, "Teleport to selected astronomical", 16, "button-teleport-to-selected-astronomical", PlayerFunctions.TeleportToSelectedAstronomical);
|
||||
return;
|
||||
|
||||
void OnBeltSignalChanged()
|
||||
{
|
||||
var on = FactoryPatch.BeltSignalGeneratorEnabled.Value;
|
||||
cb1.gameObject.SetActive(on);
|
||||
cb2.gameObject.SetActive(on);
|
||||
cb3.gameObject.SetActive(on);
|
||||
cb4.gameObject.SetActive(on);
|
||||
tip1.gameObject.SetActive(on);
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdateUI()
|
||||
@@ -253,6 +380,7 @@ public static class UIConfigWindow
|
||||
{
|
||||
_resignGameBtn.gameObject.SetActive(resignEnabled);
|
||||
}
|
||||
|
||||
var history = data.history;
|
||||
if (history == null) return;
|
||||
var banEnabled = history.hasUsedPropertyBanAchievement;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "CheatEnabler",
|
||||
"version_number": "2.3.26",
|
||||
"version_number": "2.4.0",
|
||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CheatEnabler",
|
||||
"description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测",
|
||||
"dependencies": [
|
||||
"xiaoye97-BepInEx-5.4.17",
|
||||
"soarqin-UXAssist-1.2.0"
|
||||
"soarqin-UXAssist-1.4.0"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# CompressSave
|
||||
|
||||
#### Moved [here](https://github.com/soarqin/DSP_Mods_TO/tree/master/CompressSave)
|
||||
Moved [to another repo](https://github.com/soarqin/DSP_Mods_TO/tree/master/CompressSave)
|
||||
|
||||
18
DSP_Mods.sln
18
DSP_Mods.sln
@@ -1,5 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UXAssist", "UXAssist\UXAssist.csproj", "{9C048229-6A50-4642-BC5E-02CD39D3869A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CheatEnabler", "CheatEnabler\CheatEnabler.csproj", "{F9F16B62-D1D3-466B-BE22-E64B9EA957C2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LogisticHub", "LogisticHub\LogisticHub.csproj", "{7149D717-C913-4153-9425-38CB9D087F83}"
|
||||
@@ -11,8 +13,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dustbin", "Dustbin\Dustbin.
|
||||
{B8EB3D8D-5613-42F0-9040-EAA11A38C6AC} = {B8EB3D8D-5613-42F0-9040-EAA11A38C6AC}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OCBatchBuild", "OCBatchBuild\OCBatchBuild.csproj", "{E8FB30A0-29BF-4CF0-8E08-9784962A8656}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniverseGenTweaks", "UniverseGenTweaks\UniverseGenTweaks.csproj", "{9534694E-14F0-4498-852D-BBB3FCA986CD}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OverclockEverything", "OverclockEverything\OverclockEverything.csproj", "{0168941C-EEA6-49CF-9A67-E829FE06CF9B}"
|
||||
@@ -30,8 +30,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DustbinPreloader", "Dustbin
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoolOpt", "PoolOpt\PoolOpt.csproj", "{8BE61246-2C9D-4088-AA33-5AFF22C5046E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UXAssist", "UXAssist\UXAssist.csproj", "{9C048229-6A50-4642-BC5E-02CD39D3869A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserCloak", "UserCloak\UserCloak.csproj", "{096D2E4B-D1CE-424D-9954-C36A23E9E279}"
|
||||
EndProject
|
||||
Global
|
||||
@@ -40,6 +38,10 @@ Global
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9C048229-6A50-4642-BC5E-02CD39D3869A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9C048229-6A50-4642-BC5E-02CD39D3869A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9C048229-6A50-4642-BC5E-02CD39D3869A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9C048229-6A50-4642-BC5E-02CD39D3869A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F9F16B62-D1D3-466B-BE22-E64B9EA957C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F9F16B62-D1D3-466B-BE22-E64B9EA957C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F9F16B62-D1D3-466B-BE22-E64B9EA957C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -56,10 +58,6 @@ Global
|
||||
{931F0230-5941-4E49-AB19-66921AF14096}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{931F0230-5941-4E49-AB19-66921AF14096}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{931F0230-5941-4E49-AB19-66921AF14096}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E8FB30A0-29BF-4CF0-8E08-9784962A8656}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E8FB30A0-29BF-4CF0-8E08-9784962A8656}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E8FB30A0-29BF-4CF0-8E08-9784962A8656}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E8FB30A0-29BF-4CF0-8E08-9784962A8656}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9534694E-14F0-4498-852D-BBB3FCA986CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9534694E-14F0-4498-852D-BBB3FCA986CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9534694E-14F0-4498-852D-BBB3FCA986CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -88,10 +86,6 @@ Global
|
||||
{8BE61246-2C9D-4088-AA33-5AFF22C5046E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8BE61246-2C9D-4088-AA33-5AFF22C5046E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8BE61246-2C9D-4088-AA33-5AFF22C5046E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9C048229-6A50-4642-BC5E-02CD39D3869A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9C048229-6A50-4642-BC5E-02CD39D3869A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9C048229-6A50-4642-BC5E-02CD39D3869A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9C048229-6A50-4642-BC5E-02CD39D3869A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{096D2E4B-D1CE-424D-9954-C36A23E9E279}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{096D2E4B-D1CE-424D-9954-C36A23E9E279}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{096D2E4B-D1CE-424D-9954-C36A23E9E279}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
@@ -14,7 +13,6 @@ public static class BeltSignal
|
||||
private static HashSet<int>[] _signalBelts;
|
||||
private static int _signalBeltsCapacity;
|
||||
private static bool _initialized;
|
||||
private static AssetBundle _bundle;
|
||||
private static Harmony _patch;
|
||||
|
||||
public static void Enable(bool on)
|
||||
@@ -33,13 +31,40 @@ public static class BeltSignal
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] LoadEmbeddedResource(string path, Assembly assembly = null)
|
||||
{
|
||||
if (assembly == null)
|
||||
{
|
||||
assembly = Assembly.GetCallingAssembly();
|
||||
}
|
||||
var info = assembly.GetName();
|
||||
var name = info.Name;
|
||||
using var stream = assembly.GetManifestResourceStream($"{name}.{path.Replace('/', '.')}")!;
|
||||
var buffer = new byte[stream.Length];
|
||||
_ = stream.Read(buffer, 0, buffer.Length);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
private static Texture2D LoadEmbeddedTexture(string path, Assembly assembly = null)
|
||||
{
|
||||
var fileData = LoadEmbeddedResource(path, assembly);
|
||||
var tex = new Texture2D(2, 2);
|
||||
tex.LoadImage(fileData);
|
||||
return tex;
|
||||
}
|
||||
|
||||
private static Sprite LoadEmbeddedSprite(string path, Assembly assembly = null)
|
||||
{
|
||||
var tex = LoadEmbeddedTexture(path, assembly);
|
||||
return Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f));
|
||||
}
|
||||
|
||||
[HarmonyPostfix, HarmonyPriority(Priority.Last)]
|
||||
[HarmonyPatch(typeof(VFPreload), "InvokeOnLoadWorkEnded")]
|
||||
[HarmonyPatch(typeof(VFPreload), nameof(VFPreload.InvokeOnLoadWorkEnded))]
|
||||
private static void VFPreload_InvokeOnLoadWorkEnded_Postfix()
|
||||
{
|
||||
if (_initialized) return;
|
||||
var pluginfolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
_bundle = AssetBundle.LoadFromFile($"{pluginfolder}/dustbin.assetbundle");
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
var signals = LDB._signals;
|
||||
var index = signals.dataArray.Length;
|
||||
var p = new SignalProto
|
||||
@@ -48,7 +73,7 @@ public static class BeltSignal
|
||||
Name = "DUSTBIN",
|
||||
GridIndex = 3110,
|
||||
IconPath = "Assets/signal-410.png",
|
||||
_iconSprite = _bundle.LoadAsset<Sprite>("Assets/signal-410.png"),
|
||||
_iconSprite = LoadEmbeddedSprite("assets/icon/signal-410.png", assembly),
|
||||
SID = ""
|
||||
};
|
||||
p.name = p.Name.Translate();
|
||||
@@ -173,7 +198,7 @@ public static class BeltSignal
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(GameData), "GameTick")]
|
||||
[HarmonyPatch(typeof(GameData), nameof(GameData.GameTick))]
|
||||
public static IEnumerable<CodeInstruction> GameData_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
|
||||
79
Dustbin/CHANGELOG.md
Normal file
79
Dustbin/CHANGELOG.md
Normal file
@@ -0,0 +1,79 @@
|
||||
<details>
|
||||
<summary>Read me in English</summary>
|
||||
|
||||
## Changelog
|
||||
|
||||
* 1.4.0
|
||||
* Refactorying Tank input logic codes, for better performance, and resolve a bug [#53](https://github.com/soarqin/DSP_Mods/issues/53)
|
||||
* Remove use of AssetBundle, move the belt signal icon into `Assembly Resources`, for better flexibility.
|
||||
|
||||
* 1.3.3
|
||||
* Support for NebulaMultiplayerModApi 2.0.0
|
||||
|
||||
* 1.3.2
|
||||
* Fix a display issue that the dustbin checkbox is overlapped with the filter button in storage UI.
|
||||
|
||||
* 1.3.1
|
||||
* Support for game version 0.10.28.20759
|
||||
|
||||
* 1.3.0
|
||||
* Add a belt signal(you can find it in first tab of signal selection panel) as dustbin, which is the simplest way to destroy items.
|
||||
* Reworked dustbin support for Tanks, to improve performance and resolve known bugs.
|
||||
* Be note that the whole tank logic is optimized which may get a slight better performance even if you don't use them as dustbin.
|
||||
* Config entry for soil piless gain from destroyed items are changed to a more flexible format.
|
||||
* [Nebula Mupltiplayer Mod](https://dsp.thunderstore.io/package/nebula/NebulaMultiplayerMod/) and bug fixes from [ModFixerOne](https://dsp.thunderstore.io/package/starfi5h/ModFixerOne/) by [starfi5h](https://github.com/starfi5h/).
|
||||
|
||||
* 1.2.1
|
||||
* Fix dynamic array bug in codes, which causes various bugs and errors.
|
||||
|
||||
* 1.2.0
|
||||
* Use [DSPModSave](https://dsp.thunderstore.io/package/CommonAPI/DSPModSave/) to save dustbin specified data now, which fixes [#1](https://github.com/soarqin/DSP_Mods/issues/1).
|
||||
* Fix issue for storages on multiple planets.
|
||||
* Fix issue for multi-level tanks.
|
||||
* Add a note in README for known bug on tank.
|
||||
|
||||
* 1.1.0
|
||||
* Rewrite whole plugin, make a checkbox on UI so that you can turn storages into dustbin by just ticking it.
|
||||
* Can turn tank into dustbin now.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>中文读我</summary>
|
||||
|
||||
## 更新日志
|
||||
|
||||
* 1.4.0
|
||||
* 重构储液罐的输入逻辑代码,以提高性能并解决bug [#53](https://github.com/soarqin/DSP_Mods/issues/53)
|
||||
* 移除了AssetBundle的使用,将传送带信号图标移入`Assembly资源`,以获得更好的灵活性
|
||||
|
||||
* 1.3.3
|
||||
* 支持NebulaMultiplayerModApi 2.0.0
|
||||
|
||||
* 1.3.2
|
||||
* 修正了储物仓UI中的垃圾桶勾选框与筛选按钮重叠的显示问题
|
||||
|
||||
* 1.3.1
|
||||
* 支持游戏版本 0.10.28.20759
|
||||
|
||||
* 1.3.0
|
||||
* 添加了一个传送带信号(可以在信号选择面板的第一个页签中找到)作为垃圾桶,这是目前销毁物品最简单的方法
|
||||
* 重写了储液罐的垃圾桶实现,以提高性能并解决已知的bug
|
||||
* 注意:整个储液罐逻辑都被优化了,即使你不把他们作为垃圾桶使用,也可能会获得轻微的性能提升
|
||||
* 从销毁的物品中获得沙子的配置已变为更灵活的设置项格式
|
||||
* [Nebula Mupltiplayer Mod](https://dsp.thunderstore.io/package/nebula/NebulaMultiplayerMod/)支持和Bug修正来自[starfi5h](https://github.com/starfi5h/)的[ModFixerOne](https://dsp.thunderstore.io/package/starfi5h/ModFixerOne/)
|
||||
|
||||
* 1.2.1
|
||||
* 修正了代码中的动态数组Bug,该Bug可能导致各种问题
|
||||
|
||||
* 1.2.0
|
||||
* 现在使用[DSPModSave](https://dsp.thunderstore.io/package/CommonAPI/DSPModSave/)来保存垃圾桶的数据,修正了[#1](https://github.com/soarqin/DSP_Mods/issues/1)
|
||||
* 修正了多星球上的储物仓问题
|
||||
* 修正了多层储液罐的问题
|
||||
* 在README中添加了一个已知储液罐Bug的说明
|
||||
|
||||
* 1.1.0
|
||||
* 重写了整个插件,现在可以在仓储类建筑的UI上勾选来将其转变为垃圾桶
|
||||
* 现在可以将储液罐转变为垃圾桶
|
||||
|
||||
</details>
|
||||
@@ -48,7 +48,7 @@ public class Dustbin : BaseUnityPlugin, IModCanSave, IMultiplayerMod
|
||||
NebulaModAPI.RegisterPackets(Assembly.GetExecutingAssembly());
|
||||
NebulaModAPI.OnPlanetLoadFinished += RequestPlanetDustbinData;
|
||||
}
|
||||
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
TankPatch.Enable(false);
|
||||
@@ -68,7 +68,7 @@ public class Dustbin : BaseUnityPlugin, IModCanSave, IMultiplayerMod
|
||||
return count;
|
||||
}
|
||||
|
||||
#region IModCanSave
|
||||
#region IModCanSave
|
||||
private const ushort ModSaveVersion = 1;
|
||||
|
||||
public void Export(BinaryWriter w)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<BepInExPluginGuid>org.soardev.dustbin</BepInExPluginGuid>
|
||||
<Description>DSP MOD - Dustbin</Description>
|
||||
<Version>1.3.3</Version>
|
||||
<Version>1.4.0</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackageId>Dustbin</PackageId>
|
||||
@@ -16,16 +16,19 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.Core" Version="5.*" />
|
||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="*-r.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" />
|
||||
<PackageReference Include="DysonSphereProgram.Modding.DSPModSave" Version="1.*" />
|
||||
<PackageReference Include="DysonSphereProgram.Modding.NebulaMultiplayerModApi" Version="2.0.0" />
|
||||
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="assets/icon/signal-410.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>GameAssembly\Assembly-CSharp.dll</HintPath>
|
||||
@@ -33,6 +36,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'">
|
||||
<Exec Command="del /F /Q package\$(ProjectName)-$(Version).zip
IF NOT EXIST package\plugins (mkdir package\plugins)
copy /y $(TargetPath) package\plugins\
cd package
powershell Compress-Archive -Force -DestinationPath '$(ProjectName)-$(Version).zip' -Path patchers, plugins, icon.png, manifest.json, ../README.md" />
|
||||
<Exec Command="del /F /Q package\$(ProjectName)-$(Version).zip
IF NOT EXIST package\plugins (mkdir package\plugins)
copy /y $(TargetPath) package\plugins\
cd package
powershell Compress-Archive -Force -DestinationPath '$(ProjectName)-$(Version).zip' -Path patchers, plugins, icon.png, manifest.json, ../README.md, ../CHANGELOG.md" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
||||
@@ -61,19 +61,19 @@ namespace Dustbin.NebulaSupport
|
||||
NebulaModAPI.MultiplayerSession.Network.SendPacket(new SyncPlanetData(Dustbin.ExportData(factory)));
|
||||
return;
|
||||
case < 0:
|
||||
{
|
||||
var tankPool = factory.factoryStorage.tankPool;
|
||||
tankPool[-storageId].IsDustbin = packet.Enable;
|
||||
TankPatch.Reset();
|
||||
return;
|
||||
}
|
||||
{
|
||||
var tankPool = factory.factoryStorage.tankPool;
|
||||
tankPool[-storageId].IsDustbin = packet.Enable;
|
||||
TankPatch.Reset();
|
||||
return;
|
||||
}
|
||||
case > 0:
|
||||
{
|
||||
var storagePool = factory.factoryStorage.storagePool;
|
||||
storagePool[storageId].IsDustbin = packet.Enable;
|
||||
StoragePatch.Reset();
|
||||
return;
|
||||
}
|
||||
{
|
||||
var storagePool = factory.factoryStorage.storagePool;
|
||||
storagePool[storageId].IsDustbin = packet.Enable;
|
||||
StoragePatch.Reset();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,78 +1,29 @@
|
||||
# Dustbin
|
||||
|
||||
#### Can turn Storages and Tanks into Dustbin(Destroy incoming items)
|
||||
#### 储物仓和储液罐可以转变为垃圾桶(销毁送进的物品)
|
||||
<details>
|
||||
<summary>Read me in English</summary>
|
||||
|
||||
## Changelog
|
||||
* 1.3.3
|
||||
+ Support for NebulaMultiplayerModApi 2.0.0
|
||||
|
||||
* 1.3.2
|
||||
+ Fix a display issue that the dustbin checkbox is overlapped with the filter button in storage UI.
|
||||
|
||||
* 1.3.1
|
||||
+ Support for game version 0.10.28.20759
|
||||
|
||||
* 1.3.0
|
||||
+ Add a belt signal(you can find it in first tab of signal selection panel) as dustbin, which is the simplest way to destroy items.
|
||||
+ Reworked dustbin support for Tanks, to improve performance and resolve known bugs.
|
||||
- Be note that the whole tank logic is optimized which may get a slight better performance even if you don't use them as dustbin.
|
||||
+ Config entry for soil piless gain from destroyed items are changed to a more flexible format.
|
||||
+ [Nebula Mupltiplayer Mod](https://dsp.thunderstore.io/package/nebula/NebulaMultiplayerMod/) and bug fixes from [ModFixerOne](https://dsp.thunderstore.io/package/starfi5h/ModFixerOne/) by [starfi5h](https://github.com/starfi5h/).
|
||||
|
||||
* 1.2.1
|
||||
+ Fix dynamic array bug in codes, which causes various bugs and errors.
|
||||
|
||||
* 1.2.0
|
||||
+ Use [DSPModSave](https://dsp.thunderstore.io/package/CommonAPI/DSPModSave/) to save dustbin specified data now, which fixes [#1](https://github.com/soarqin/DSP_Mods/issues/1).
|
||||
+ Fix issue for storages on multiple planets.
|
||||
+ Fix issue for multi-level tanks.
|
||||
+ Add a note in README for known bug on tank.
|
||||
|
||||
* 1.1.0
|
||||
+ Rewrite whole plugin, make a checkbox on UI so that you can turn storages into dustbin by just ticking it.
|
||||
+ Can turn tank into dustbin now.
|
||||
***Can turn Storages and Tanks into Dustbin(Destroy incoming items)***
|
||||
|
||||
## Usage
|
||||
|
||||
* A checkbox is added to Storages and Tanks UI, which turns them into dustbins.
|
||||
* Items sent into dustbins are removed immediately.
|
||||
* Can get soil piless from destroyed items, configurable through a json encoded config entry.
|
||||
+ You can get item ID list [here](https://dsp-wiki.com/Modding:Items_IDs).
|
||||
* You can get item ID list from [dsp-wiki](https://dsp-wiki.com/Modding:Items_IDs).
|
||||
|
||||
## 更新日志
|
||||
* 1.3.3
|
||||
+ 支持NebulaMultiplayerModApi 2.0.0
|
||||
</details>
|
||||
|
||||
* 1.3.2
|
||||
+ 修正了储物仓UI中的垃圾桶勾选框与筛选按钮重叠的显示问题
|
||||
<details>
|
||||
<summary>中文读我</summary>
|
||||
|
||||
* 1.3.1
|
||||
+ 支持游戏版本 0.10.28.20759
|
||||
|
||||
* 1.3.0
|
||||
+ 添加了一个传送带信号(可以在信号选择面板的第一个页签中找到)作为垃圾桶,这是目前销毁物品最简单的方法
|
||||
+ 重写了储液罐的垃圾桶实现,以提高性能并解决已知的bug
|
||||
- 注意:整个储液罐逻辑都被优化了,即使你不把他们作为垃圾桶使用,也可能会获得轻微的性能提升
|
||||
+ 从销毁的物品中获得沙子的配置已变为更灵活的设置项格式
|
||||
+ [Nebula Mupltiplayer Mod](https://dsp.thunderstore.io/package/nebula/NebulaMultiplayerMod/)支持和Bug修正来自[starfi5h](https://github.com/starfi5h/)的[ModFixerOne](https://dsp.thunderstore.io/package/starfi5h/ModFixerOne/)
|
||||
|
||||
* 1.2.1
|
||||
+ 修正了代码中的动态数组Bug,该Bug可能导致各种问题
|
||||
|
||||
* 1.2.0
|
||||
+ 现在使用[DSPModSave](https://dsp.thunderstore.io/package/CommonAPI/DSPModSave/)来保存垃圾桶的数据,修正了[#1](https://github.com/soarqin/DSP_Mods/issues/1)
|
||||
+ 修正了多星球上的储物仓问题
|
||||
+ 修正了多层储液罐的问题
|
||||
+ 在README中添加了一个已知储液罐Bug的说明
|
||||
|
||||
* 1.1.0
|
||||
+ 重写了整个插件,现在可以在仓储类建筑的UI上勾选来将其转变为垃圾桶
|
||||
+ 现在可以将储液罐转变为垃圾桶
|
||||
***储物仓和储液罐可以转变为垃圾桶(销毁送进的物品)***
|
||||
|
||||
## 使用说明
|
||||
|
||||
* 在储物仓和储液罐上增加一个垃圾桶的勾选框。
|
||||
* 送进垃圾桶的物品会立即被移除。
|
||||
* 可以从移除的物品中获得沙子,可以通过json编码的设置项进行配置。
|
||||
+ 可以在[这里](https://dsp-wiki.com/Modding:Items_IDs)获得物品ID列表。
|
||||
* 可以在[这里](https://dsp-wiki.com/Modding:Items_IDs)获得物品ID列表。
|
||||
|
||||
</details>
|
||||
|
||||
@@ -13,7 +13,7 @@ public static class StoragePatch
|
||||
private static UI.MyCheckBox _storageDustbinCheckBox;
|
||||
private static int _lastStorageId;
|
||||
private static Harmony _patch;
|
||||
|
||||
|
||||
public static void Enable(bool on)
|
||||
{
|
||||
if (on)
|
||||
@@ -96,14 +96,14 @@ public static class StoragePatch
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(GameMain), "Start")]
|
||||
[HarmonyPatch(typeof(GameMain), nameof(GameMain.Start))]
|
||||
private static void GameMain_Start_Prefix()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(UIStorageWindow), "_OnCreate")]
|
||||
[HarmonyPatch(typeof(UIStorageWindow), nameof(UIStorageWindow._OnCreate))]
|
||||
private static void UIStorageWindow__OnCreate_Postfix(UIStorageWindow __instance)
|
||||
{
|
||||
_storageDustbinCheckBox = UI.MyCheckBox.CreateCheckBox(false, __instance.transform, 50f, 50f, Localization.CurrentLanguageLCID == Localization.LCID_ZHCN ? "垃圾桶" : "Dustbin");
|
||||
@@ -123,7 +123,7 @@ public static class StoragePatch
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(UIStorageWindow), "_OnUpdate")]
|
||||
[HarmonyPatch(typeof(UIStorageWindow), nameof(UIStorageWindow._OnUpdate))]
|
||||
private static void UIStorageWindow__OnUpdate_Postfix(UIStorageWindow __instance)
|
||||
{
|
||||
var storageId = __instance.storageId;
|
||||
@@ -138,10 +138,10 @@ public static class StoragePatch
|
||||
_storageDustbinCheckBox.rectTrans.anchoredPosition3D = new Vector3(190, 57 - rectTrans.sizeDelta.y, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Adopt fix from starfi5h's NebulaCompatiblilityAssist */
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(UIStorageGrid), "OnStorageSizeChanged")]
|
||||
[HarmonyPatch(typeof(UIStorageGrid), nameof(UIStorageGrid.OnStorageSizeChanged))]
|
||||
private static void UIStorageGrid_OnStorageSizeChanged_Postfix()
|
||||
{
|
||||
// Due to storage window is empty when open in client, the size will change after receiving data from host
|
||||
@@ -149,8 +149,8 @@ public static class StoragePatch
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(StorageComponent), "AddItem", new[] { typeof(int), typeof(int), typeof(int), typeof(int), typeof(bool) },
|
||||
new[] { ArgumentType.Normal, ArgumentType.Normal, ArgumentType.Normal, ArgumentType.Out, ArgumentType.Normal })]
|
||||
[HarmonyPatch(typeof(StorageComponent), nameof(StorageComponent.AddItem), [typeof(int), typeof(int), typeof(int), typeof(int), typeof(bool)],
|
||||
[ArgumentType.Normal, ArgumentType.Normal, ArgumentType.Normal, ArgumentType.Out, ArgumentType.Normal])]
|
||||
private static IEnumerable<CodeInstruction> StorageComponent_AddItem_HarmonyTranspiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
@@ -172,7 +172,7 @@ public static class StoragePatch
|
||||
|
||||
/* We keep this to make MOD compatible with older version */
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(StorageComponent), "Import")]
|
||||
[HarmonyPatch(typeof(StorageComponent), nameof(StorageComponent.Import))]
|
||||
private static void StorageComponent_Import_Postfix(StorageComponent __instance)
|
||||
{
|
||||
if (__instance.bans >= 0)
|
||||
|
||||
@@ -11,7 +11,7 @@ public static class TankPatch
|
||||
private static UI.MyCheckBox _tankDustbinCheckBox;
|
||||
private static int _lastTankId;
|
||||
private static Harmony _patch;
|
||||
|
||||
|
||||
public static void Enable(bool on)
|
||||
{
|
||||
if (on)
|
||||
@@ -100,14 +100,14 @@ public static class TankPatch
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(GameMain), "Start")]
|
||||
[HarmonyPatch(typeof(GameMain), nameof(GameMain.Start))]
|
||||
private static void GameMain_Start_Prefix()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(UITankWindow), "_OnCreate")]
|
||||
[HarmonyPatch(typeof(UITankWindow), nameof(UITankWindow._OnCreate))]
|
||||
private static void UITankWindow__OnCreate_Postfix(UITankWindow __instance)
|
||||
{
|
||||
_tankDustbinCheckBox = UI.MyCheckBox.CreateCheckBox(false, __instance.transform, 120f, 20f, Localization.CurrentLanguageLCID == Localization.LCID_ZHCN ? "垃圾桶" : "Dustbin");
|
||||
@@ -127,7 +127,7 @@ public static class TankPatch
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(UITankWindow), "_OnUpdate")]
|
||||
[HarmonyPatch(typeof(UITankWindow), nameof(UITankWindow._OnUpdate))]
|
||||
private static void UITankWindow__OnUpdate_Postfix(UITankWindow __instance)
|
||||
{
|
||||
var tankId = __instance.tankId;
|
||||
@@ -142,7 +142,7 @@ public static class TankPatch
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(TankComponent), "GameTick")]
|
||||
[HarmonyPatch(typeof(TankComponent), nameof(TankComponent.GameTick))]
|
||||
private static bool TankComponent_GameTick_Prefix(ref TankComponent __instance, PlanetFactory factory)
|
||||
{
|
||||
if (__instance.fluidInc < 0)
|
||||
@@ -183,94 +183,68 @@ public static class TankPatch
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static void TankComponentUpdateBelt(ref TankComponent thisTank, int belt, bool isOutput, ref CargoTraffic cargoTraffic, ref TankComponent[] tankPool)
|
||||
{
|
||||
switch (isOutput)
|
||||
if (isOutput)
|
||||
{
|
||||
case true when thisTank.outputSwitch:
|
||||
if (thisTank.outputSwitch)
|
||||
{
|
||||
if (thisTank.fluidId <= 0 || thisTank.fluidCount <= 0) return;
|
||||
var inc = thisTank.fluidInc == 0 ? 0 : thisTank.fluidInc / thisTank.fluidCount;
|
||||
if (!cargoTraffic.TryInsertItemAtHead(belt, thisTank.fluidId, 1, (byte)inc)) return;
|
||||
thisTank.fluidCount--;
|
||||
thisTank.fluidInc -= inc;
|
||||
return;
|
||||
}
|
||||
case false when thisTank.inputSwitch:
|
||||
}
|
||||
else
|
||||
{
|
||||
if (thisTank.inputSwitch)
|
||||
{
|
||||
byte stack;
|
||||
byte inc;
|
||||
switch (thisTank.fluidId)
|
||||
var thisFluidId = thisTank.fluidId;
|
||||
if (thisTank.fluidCount <= 0)
|
||||
{
|
||||
case > 0 when thisTank.fluidCount < thisTank.fluidCapacity && cargoTraffic.TryPickItemAtRear(belt, thisTank.fluidId, null, out stack, out inc) > 0 &&
|
||||
!thisTank.IsDustbin:
|
||||
thisTank.fluidCount += stack;
|
||||
thisTank.fluidInc += inc;
|
||||
return;
|
||||
case 0:
|
||||
{
|
||||
var count = cargoTraffic.TryPickItemAtRear(belt, 0, ItemProto.fluids, out stack, out inc);
|
||||
if (count <= 0 || thisTank.IsDustbin) return;
|
||||
thisTank.fluidId = count;
|
||||
thisTank.fluidCount += stack;
|
||||
thisTank.fluidInc += inc;
|
||||
return;
|
||||
}
|
||||
var fluidId = cargoTraffic.TryPickItemAtRear(belt, 0, ItemProto.fluids, out stack, out inc);
|
||||
if (fluidId <= 0 || thisTank.IsDustbin) return;
|
||||
thisTank.fluidId = fluidId;
|
||||
thisTank.fluidCount = stack;
|
||||
thisTank.fluidInc = inc;
|
||||
return;
|
||||
}
|
||||
|
||||
if (thisTank.fluidCount < thisTank.fluidCapacity || cargoTraffic.GetItemIdAtRear(belt) != thisTank.fluidId || thisTank.nextTankId <= 0) return;
|
||||
ref var targetTank = ref tankPool[thisTank.nextTankId];
|
||||
while (targetTank.fluidCount >= targetTank.fluidCapacity)
|
||||
if (thisTank.fluidCount < thisTank.fluidCapacity || thisTank.IsDustbin)
|
||||
{
|
||||
ref var lastTank = ref tankPool[targetTank.lastTankId];
|
||||
if (targetTank.fluidId != lastTank.fluidId)
|
||||
if (cargoTraffic.GetItemIdAtRear(belt) != thisFluidId || thisTank.nextTankId <= 0) return;
|
||||
if (cargoTraffic.TryPickItemAtRear(belt, thisFluidId, null, out stack, out inc) <= 0 || thisTank.IsDustbin) return;
|
||||
thisTank.fluidCount += stack;
|
||||
thisTank.fluidInc += inc;
|
||||
return;
|
||||
}
|
||||
if (thisTank.nextTankId <= 0) return;
|
||||
ref var targetTank = ref tankPool[thisTank.nextTankId];
|
||||
while (true)
|
||||
{
|
||||
if (targetTank.fluidCount < targetTank.fluidCapacity || targetTank.IsDustbin)
|
||||
{
|
||||
if (lastTank.id == thisTank.id || targetTank.fluidCount >= targetTank.fluidCapacity) return;
|
||||
targetTank = ref lastTank;
|
||||
if (!targetTank.inputSwitch) return;
|
||||
var targetFluidId = targetTank.fluidId;
|
||||
if (targetFluidId != 0 && targetFluidId != thisFluidId) return;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!targetTank.inputSwitch)
|
||||
{
|
||||
if (lastTank.id == thisTank.id || targetTank.fluidCount >= targetTank.fluidCapacity) return;
|
||||
targetTank = ref lastTank;
|
||||
break;
|
||||
}
|
||||
|
||||
if (targetTank.nextTankId <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (targetTank.nextTankId <= 0) return;
|
||||
targetTank = ref tankPool[targetTank.nextTankId];
|
||||
}
|
||||
|
||||
ref var lastTank2 = ref tankPool[targetTank.lastTankId];
|
||||
if (!targetTank.inputSwitch)
|
||||
if (cargoTraffic.TryPickItemAtRear(belt, thisFluidId, null, out stack, out inc) <= 0 || targetTank.IsDustbin) return;
|
||||
if (targetTank.fluidCount <= 0)
|
||||
{
|
||||
targetTank = ref lastTank2;
|
||||
targetTank.fluidId = thisFluidId;
|
||||
targetTank.fluidCount = stack;
|
||||
targetTank.fluidInc = inc;
|
||||
}
|
||||
else
|
||||
{
|
||||
var fluidId = targetTank.fluidId;
|
||||
if (fluidId != 0 && fluidId != lastTank2.fluidId)
|
||||
{
|
||||
if (lastTank2.id == thisTank.id || targetTank.fluidCount >= targetTank.fluidCapacity) return;
|
||||
targetTank = ref lastTank2;
|
||||
}
|
||||
else if (!lastTank2.outputSwitch)
|
||||
{
|
||||
return;
|
||||
}
|
||||
targetTank.fluidCount += stack;
|
||||
targetTank.fluidInc += inc;
|
||||
}
|
||||
|
||||
if (cargoTraffic.TryPickItemAtRear(belt, thisTank.fluidId, null, out stack, out inc) <= 0 || targetTank.IsDustbin) return;
|
||||
if (targetTank.fluidCount == 0)
|
||||
{
|
||||
targetTank.fluidId = thisTank.fluidId;
|
||||
}
|
||||
|
||||
targetTank.fluidCount += stack;
|
||||
targetTank.fluidInc += inc;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
Dustbin/assets/icon/signal-410.png
Normal file
BIN
Dustbin/assets/icon/signal-410.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Dustbin",
|
||||
"version_number": "1.3.3",
|
||||
"version_number": "1.4.0",
|
||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/Dustbin",
|
||||
"description": "Can turn Storages and Tanks into Dustbin(Destroy incoming items) / 储物仓和储液罐可以转变为垃圾桶(销毁送进的物品)",
|
||||
"dependencies": [
|
||||
|
||||
Binary file not shown.
@@ -7,7 +7,7 @@ namespace DustbinPreloader;
|
||||
|
||||
public static class Preloader
|
||||
{
|
||||
private static readonly ManualLogSource Logger = BepInEx.Logging.Logger.CreateLogSource("Dustbin Preloader");
|
||||
private static readonly ManualLogSource Logger = BepInEx.Logging.Logger.CreateLogSource("Dustbin Preloader");
|
||||
public static IEnumerable<string> TargetDLLs { get; } = new[] { "Assembly-CSharp.dll" };
|
||||
|
||||
public static void Patch(AssemblyDefinition assembly)
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.Core" Version="5.*" />
|
||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="*-r.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" />
|
||||
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'">
|
||||
<Exec Command="IF NOT EXIST ..\Dustbin\package\patchers (mkdir ..\Dustbin\package\patchers)
copy /y $(TargetPath) ..\Dustbin\package\patchers\" />
|
||||
</Target>
|
||||
|
||||
39
HideTips/CHANGELOG.md
Normal file
39
HideTips/CHANGELOG.md
Normal file
@@ -0,0 +1,39 @@
|
||||
<details>
|
||||
<summary>Read me in English</summary>
|
||||
|
||||
## Changelog
|
||||
|
||||
* 1.0.4
|
||||
* Remove `Disable title screen demo scene loading`, as it is buggy in recent updates.
|
||||
* Fix a bug that when tutorials are not added to the guides panel when they are hidden by this MOD.
|
||||
* 1.0.3
|
||||
* Add config entries to disable research completion tips/popup windows
|
||||
* Add a note to README for mod compatibility on `Disable title screen demo scene loading`.
|
||||
* 1.0.2
|
||||
* Add a config entry to disable title screen demo scene loading
|
||||
* 1.0.1
|
||||
* Hide 3 more random tutorial tips popup from bottom-right panel
|
||||
* 1.0.0
|
||||
* Initial release
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>中文读我</summary>
|
||||
|
||||
## 更新日志
|
||||
|
||||
* 1.0.4
|
||||
* 移除`关闭标题画面的演示场景加载`设置,因为在最近的更新中有较多bug。
|
||||
* 修复了一个bug,当教程指引被这个MOD隐藏时,它们不会被添加到教程面板。
|
||||
* 1.0.3
|
||||
* 增加设置项以关闭研究完成的提示/弹窗
|
||||
* 在README中增加了一个关于`关闭标题画面的演示场景加载`设置的兼容性说明
|
||||
* 1.0.2
|
||||
* 增加设置项以关闭标题画面的演示场景加载
|
||||
* 1.0.1
|
||||
* 可屏蔽右下面板的3种随机提醒
|
||||
* 1.0.0
|
||||
* 初始版本
|
||||
|
||||
</details>
|
||||
@@ -152,7 +152,7 @@ public class HideTips : BaseUnityPlugin
|
||||
class HideMenuDemo
|
||||
{
|
||||
[HarmonyPriority(Priority.First), HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(DSPGame), "StartDemoGame", typeof(int))]
|
||||
[HarmonyPatch(typeof(DSPGame), nameof(DSPGame.StartDemoGame), typeof(int))]
|
||||
private static bool DSPGame_StartDemoGame_Prefix()
|
||||
{
|
||||
if (DSPGame.Game != null)
|
||||
@@ -188,7 +188,7 @@ class HideMenuDemo
|
||||
}
|
||||
|
||||
[HarmonyPriority(Priority.First), HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(VFPreload), "IsMenuDemoLoaded")]
|
||||
[HarmonyPatch(typeof(VFPreload), nameof(VFPreload.IsMenuDemoLoaded))]
|
||||
private static bool VFPreload_IsMenuDemoLoaded_Prefix(ref bool __result)
|
||||
{
|
||||
__result = true;
|
||||
@@ -196,18 +196,18 @@ class HideMenuDemo
|
||||
}
|
||||
|
||||
[HarmonyPriority(Priority.First), HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(DSPGame), "LateUpdate")]
|
||||
[HarmonyPatch(typeof(GameMain), "LateUpdate")]
|
||||
[HarmonyPatch(typeof(GameMain), "FixedUpdate")]
|
||||
[HarmonyPatch(typeof(GameMain), "Update")]
|
||||
[HarmonyPatch(typeof(GameCamera), "LateUpdate")]
|
||||
[HarmonyPatch(typeof(DSPGame), nameof(DSPGame.LateUpdate))]
|
||||
[HarmonyPatch(typeof(GameMain), nameof(GameMain.LateUpdate))]
|
||||
[HarmonyPatch(typeof(GameMain), nameof(GameMain.FixedUpdate))]
|
||||
[HarmonyPatch(typeof(GameMain), nameof(GameMain.Update))]
|
||||
[HarmonyPatch(typeof(GameCamera), nameof(GameCamera.LateUpdate))]
|
||||
private static bool DSPGame_LateUpdate_Prefix()
|
||||
{
|
||||
return !DSPGame.IsMenuDemo;
|
||||
}
|
||||
|
||||
[HarmonyPriority(Priority.First), HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(GameMain), "Begin")]
|
||||
[HarmonyPatch(typeof(GameMain), nameof(GameMain.Begin))]
|
||||
private static bool GameMain_Begin_Prefix()
|
||||
{
|
||||
if (!DSPGame.IsMenuDemo) return true;
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.Core" Version="5.*" />
|
||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="*-r.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" />
|
||||
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'">
|
||||
<Exec Command="del /F /Q package\$(ProjectName)-$(Version).zip
powershell Compress-Archive -Force -DestinationPath 'package/$(ProjectName)-$(Version).zip' -Path '$(TargetPath)', package/icon.png, package/manifest.json, README.md" />
|
||||
</Target>
|
||||
|
||||
@@ -1,42 +1,23 @@
|
||||
# HideTips
|
||||
|
||||
#### Hide/Disable various tutorial tips/messages
|
||||
#### 隐藏/屏蔽各种引导提示/消息
|
||||
<details>
|
||||
<summary>Read me in English</summary>
|
||||
|
||||
## Changelog
|
||||
* 1.0.4
|
||||
+ Remove `Disable title screen demo scene loading`, as it is buggy in recent updates.
|
||||
+ Fix a bug that when tutorials are not added to the guides panel when they are hidden by this MOD.
|
||||
* 1.0.3
|
||||
+ Add config entries to disable research completion tips/popup windows
|
||||
+ Add a note to README for mod compatibility on `Disable title screen demo scene loading`.
|
||||
* 1.0.2
|
||||
+ Add a config entry to disable title screen demo scene loading
|
||||
* 1.0.1
|
||||
+ Hide 3 more random tutorial tips popup from bottom-right panel
|
||||
* 1.0.0
|
||||
+ Initial release
|
||||
***Hide/Disable various tutorial tips/messages***
|
||||
|
||||
## Usage
|
||||
* Tips/messages that can be hidden: random-reminder, tutorial, achievement/milestone card, research completion tips/popup windows.
|
||||
* Skip prologue for new game.
|
||||
* Each type of tips/messages is configurable individually.
|
||||
|
||||
## 更新日志
|
||||
* 1.0.4
|
||||
+ 移除`关闭标题画面的演示场景加载`设置,因为在最近的更新中有较多bug。
|
||||
+ 修复了一个bug,当教程指引被这个MOD隐藏时,它们不会被添加到教程面板。
|
||||
* 1.0.3
|
||||
+ 增加设置项以关闭研究完成的提示/弹窗
|
||||
+ 在README中增加了一个关于`关闭标题画面的演示场景加载`设置的兼容性说明
|
||||
* 1.0.2
|
||||
+ 增加设置项以关闭标题画面的演示场景加载
|
||||
* 1.0.1
|
||||
+ 可屏蔽右下面板的3种随机提醒
|
||||
* 1.0.0
|
||||
+ 初始版本
|
||||
***隐藏/屏蔽各种引导提示/消息***
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>中文读我</summary>
|
||||
|
||||
## 使用说明
|
||||
* 可以屏蔽的消息:随机提醒,教程,成就/里程碑卡片,研究完成的提示/弹窗。
|
||||
* 跳过新游戏引导动画。
|
||||
* 各种屏蔽功能都可以在配置文件里开关。
|
||||
|
||||
</details>
|
||||
|
||||
@@ -410,30 +410,30 @@ public static class LabOptPatchFunctions
|
||||
public static void SetFunctionInternal(ref LabComponent lab, bool researchMode, int recpId, int techId, SignData[] signPool, LabComponent[] labPool)
|
||||
{
|
||||
// LabOptPatch.Logger.LogDebug($"SetFunctionInternal: id={lab.id} root={(int)RootLabIdField.GetValue(lab)} research={researchMode} recp={recpId} tech={techId}");
|
||||
lab.replicating = false;
|
||||
lab.time = 0;
|
||||
lab.hashBytes = 0;
|
||||
lab.extraHashBytes = 0;
|
||||
lab.extraTime = 0;
|
||||
lab.extraSpeed = 0;
|
||||
lab.extraPowerRatio = 0;
|
||||
lab.productive = false;
|
||||
if (researchMode)
|
||||
{
|
||||
lab.forceAccMode = false;
|
||||
lab.researchMode = true;
|
||||
lab.recipeId = 0;
|
||||
lab.techId = 0;
|
||||
lab.timeSpend = 0;
|
||||
lab.extraTimeSpend = 0;
|
||||
lab.requires = null;
|
||||
lab.requireCounts = null;
|
||||
lab.served = null;
|
||||
lab.incServed = null;
|
||||
lab.products = null;
|
||||
lab.productCounts = null;
|
||||
lab.produced = null;
|
||||
lab.productive = true;
|
||||
lab.replicating = false;
|
||||
lab.time = 0;
|
||||
lab.hashBytes = 0;
|
||||
lab.extraHashBytes = 0;
|
||||
lab.extraTime = 0;
|
||||
lab.extraSpeed = 0;
|
||||
lab.extraPowerRatio = 0;
|
||||
lab.productive = false;
|
||||
if (researchMode)
|
||||
{
|
||||
lab.forceAccMode = false;
|
||||
lab.researchMode = true;
|
||||
lab.recipeId = 0;
|
||||
lab.techId = 0;
|
||||
lab.timeSpend = 0;
|
||||
lab.extraTimeSpend = 0;
|
||||
lab.requires = null;
|
||||
lab.requireCounts = null;
|
||||
lab.served = null;
|
||||
lab.incServed = null;
|
||||
lab.products = null;
|
||||
lab.productCounts = null;
|
||||
lab.produced = null;
|
||||
lab.productive = true;
|
||||
var rootLabId = lab.pcId;
|
||||
if (rootLabId > 0)
|
||||
{
|
||||
@@ -480,29 +480,29 @@ public static class LabOptPatchFunctions
|
||||
}
|
||||
}
|
||||
signPool[lab.entityId].iconId0 = (uint)lab.techId;
|
||||
signPool[lab.entityId].iconType = lab.techId == 0 ? 0U : 3U;
|
||||
return;
|
||||
}
|
||||
lab.researchMode = false;
|
||||
lab.recipeId = 0;
|
||||
lab.techId = 0;
|
||||
lab.matrixPoints = null;
|
||||
lab.matrixServed = null;
|
||||
lab.matrixIncServed = null;
|
||||
RecipeProto recipeProto = null;
|
||||
if (recpId > 0)
|
||||
{
|
||||
recipeProto = LDB.recipes.Select(recpId);
|
||||
}
|
||||
if (recipeProto != null && recipeProto.Type == ERecipeType.Research)
|
||||
{
|
||||
lab.recipeId = recipeProto.ID;
|
||||
lab.speed = 10000;
|
||||
lab.speedOverride = lab.speed;
|
||||
lab.timeSpend = recipeProto.TimeSpend * 10000;
|
||||
lab.extraTimeSpend = recipeProto.TimeSpend * 100000;
|
||||
lab.productive = recipeProto.productive;
|
||||
lab.forceAccMode &= lab.productive;
|
||||
signPool[lab.entityId].iconType = lab.techId == 0 ? 0U : 3U;
|
||||
return;
|
||||
}
|
||||
lab.researchMode = false;
|
||||
lab.recipeId = 0;
|
||||
lab.techId = 0;
|
||||
lab.matrixPoints = null;
|
||||
lab.matrixServed = null;
|
||||
lab.matrixIncServed = null;
|
||||
RecipeProto recipeProto = null;
|
||||
if (recpId > 0)
|
||||
{
|
||||
recipeProto = LDB.recipes.Select(recpId);
|
||||
}
|
||||
if (recipeProto != null && recipeProto.Type == ERecipeType.Research)
|
||||
{
|
||||
lab.recipeId = recipeProto.ID;
|
||||
lab.speed = 10000;
|
||||
lab.speedOverride = lab.speed;
|
||||
lab.timeSpend = recipeProto.TimeSpend * 10000;
|
||||
lab.extraTimeSpend = recipeProto.TimeSpend * 100000;
|
||||
lab.productive = recipeProto.productive;
|
||||
lab.forceAccMode &= lab.productive;
|
||||
var rootLabId = lab.pcId;
|
||||
if (rootLabId > 0)
|
||||
{
|
||||
@@ -544,26 +544,26 @@ public static class LabOptPatchFunctions
|
||||
Array.Clear(lab.produced, 0, lab.produced.Length);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lab.forceAccMode = false;
|
||||
lab.recipeId = 0;
|
||||
lab.speed = 0;
|
||||
lab.speedOverride = 0;
|
||||
lab.timeSpend = 0;
|
||||
lab.extraTimeSpend = 0;
|
||||
lab.requires = null;
|
||||
lab.requireCounts = null;
|
||||
lab.served = null;
|
||||
lab.incServed = null;
|
||||
lab.needs = null;
|
||||
lab.products = null;
|
||||
lab.productCounts = null;
|
||||
lab.produced = null;
|
||||
}
|
||||
signPool[lab.entityId].iconId0 = (uint)lab.recipeId;
|
||||
signPool[lab.entityId].iconType = lab.recipeId == 0 ? 0U : 2U;
|
||||
}
|
||||
else
|
||||
{
|
||||
lab.forceAccMode = false;
|
||||
lab.recipeId = 0;
|
||||
lab.speed = 0;
|
||||
lab.speedOverride = 0;
|
||||
lab.timeSpend = 0;
|
||||
lab.extraTimeSpend = 0;
|
||||
lab.requires = null;
|
||||
lab.requireCounts = null;
|
||||
lab.served = null;
|
||||
lab.incServed = null;
|
||||
lab.needs = null;
|
||||
lab.products = null;
|
||||
lab.productCounts = null;
|
||||
lab.produced = null;
|
||||
}
|
||||
signPool[lab.entityId].iconId0 = (uint)lab.recipeId;
|
||||
signPool[lab.entityId].iconType = lab.recipeId == 0 ? 0U : 2U;
|
||||
}
|
||||
|
||||
public static int InsertIntoLab(PlanetFactory factory, int labId, int itemId, byte itemCount, byte itemInc, ref byte remainInc, int[] needs)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ public class LabOptPatch : BaseUnityPlugin
|
||||
{
|
||||
Harmony.CreateAndPatchAll(typeof(LabOptPatch));
|
||||
}
|
||||
|
||||
|
||||
// Patch LabComponent.Export() to save zero value if rootLabId > 0.
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(LabComponent), nameof(LabComponent.Export))]
|
||||
@@ -274,7 +274,7 @@ public class LabOptPatch : BaseUnityPlugin
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
|
||||
// Change locks on PlanetFactory.InsertInto(), by calling LabOptPatchFunctions.InsertIntoLab()
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(PlanetFactory), nameof(PlanetFactory.InsertInto))]
|
||||
@@ -332,7 +332,7 @@ public class LabOptPatch : BaseUnityPlugin
|
||||
{
|
||||
LabOptPatchFunctions.SetRootId(ref __instance, 0);
|
||||
}
|
||||
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(LabOptPatchFunctions), nameof(LabOptPatchFunctions.SetRootId))]
|
||||
[HarmonyPatch(typeof(LabOptPatchFunctions), nameof(LabOptPatchFunctions.SetRootLabIdForStacking))]
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.Core" Version="5.*" />
|
||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="*-r.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" />
|
||||
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace LabOptPreloader;
|
||||
|
||||
public static class Preloader
|
||||
{
|
||||
private static readonly ManualLogSource Logger = BepInEx.Logging.Logger.CreateLogSource("LabOpt Preloader");
|
||||
private static readonly ManualLogSource Logger = BepInEx.Logging.Logger.CreateLogSource("LabOpt Preloader");
|
||||
public static IEnumerable<string> TargetDLLs { get; } = new[] { "Assembly-CSharp.dll" };
|
||||
|
||||
public static void Patch(AssemblyDefinition assembly)
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.Core" Version="5.*" />
|
||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="*-r.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" />
|
||||
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'">
|
||||
<Exec Command="IF NOT EXIST ..\LabOpt\package\patchers (mkdir ..\LabOpt\package\patchers)
copy /y $(TargetPath) ..\LabOpt\package\patchers\" />
|
||||
</Target>
|
||||
|
||||
@@ -22,9 +22,9 @@ public class LogisticHub : BaseUnityPlugin
|
||||
"Energy consumption for each ore vein group(in 0.5W)");
|
||||
Module.Miner.OilEnergyConsume = Config.Bind("Miner", "EnergyConsumptionForOil", 3600000L,
|
||||
"Energy consumption for each oil seep(in 0.5W)");
|
||||
Module.Miner.WaterEnergyConsume = Config.Bind("Miner", "EnergyConsumptionForWater", 20000000L,
|
||||
Module.Miner.WaterEnergyConsume = Config.Bind("Miner", "EnergyConsumptionForWater", 2000000L,
|
||||
"Energy consumption for water slot(in kW)");
|
||||
Module.Miner.WaterSpeed = Config.Bind("Miner", "WaterMiningSpeed", 100,
|
||||
Module.Miner.WaterSpeed = Config.Bind("Miner", "WaterMiningSpeed", 10,
|
||||
"Water mining speed (count per second)");
|
||||
Module.Miner.MiningScale = Config.Bind("Miner", "MiningScale", 0,
|
||||
"""
|
||||
|
||||
@@ -16,8 +16,17 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.Core" Version="5.*" />
|
||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="*-r.*" />
|
||||
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
|
||||
<PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
|
||||
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>..\AssemblyFromGame\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UI">
|
||||
<HintPath>..\AssemblyFromGame\UnityEngine.UI.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -4,6 +4,7 @@ using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using UXAssist.Common;
|
||||
using Random = UnityEngine.Random;
|
||||
using GameLogicProc = UXAssist.Common.GameLogic;
|
||||
|
||||
namespace LogisticHub.Module;
|
||||
|
||||
@@ -62,12 +63,12 @@ public class Miner : PatchImpl<Miner>
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
GameLogic.OnGameBegin += OnGameBegin;
|
||||
GameLogicProc.OnGameBegin += OnGameBegin;
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
GameLogic.OnGameBegin -= OnGameBegin;
|
||||
GameLogicProc.OnGameBegin -= OnGameBegin;
|
||||
}
|
||||
|
||||
private static void OnGameBegin()
|
||||
@@ -124,14 +125,14 @@ public class Miner : PatchImpl<Miner>
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(GameData), "GameTick")]
|
||||
private static void GameData_GameTick_Prefix()
|
||||
[HarmonyPatch(typeof(GameLogic), nameof(GameLogic.OnFactoryFrameBegin))]
|
||||
private static void GameLogic_OnFactoryFrameBegin_Prefix()
|
||||
{
|
||||
var main = GameMain.instance;
|
||||
if (main.isMenuDemo) return;
|
||||
if (_miningSpeedScaleLong <= 0) return;
|
||||
|
||||
PerformanceMonitor.BeginSample(ECpuWorkEntry.Miner);
|
||||
DeepProfiler.BeginSample(DPEntry.Miner);
|
||||
if (main.timei % 60 != 0) return;
|
||||
_frame += _miningFrames;
|
||||
var frameCounter = Mathf.FloorToInt(_frame / 1200000f);
|
||||
@@ -229,7 +230,7 @@ public class Miner : PatchImpl<Miner>
|
||||
}
|
||||
}
|
||||
|
||||
PerformanceMonitor.EndSample(ECpuWorkEntry.Miner);
|
||||
DeepProfiler.EndSample(DPEntry.Miner);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HarmonyLib;
|
||||
using UXAssist.Common;
|
||||
using GameLogicProc = UXAssist.Common.GameLogic;
|
||||
|
||||
namespace LogisticHub.Module;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class StationManager : PatchImpl<StationManager>
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
GameLogic.OnGameBegin += () =>
|
||||
GameLogicProc.OnGameBegin += () =>
|
||||
{
|
||||
_stations = null;
|
||||
var data = GameMain.data;
|
||||
|
||||
45
MechaDronesTweaks/CHANGELOG.md
Normal file
45
MechaDronesTweaks/CHANGELOG.md
Normal file
@@ -0,0 +1,45 @@
|
||||
<details>
|
||||
<summary>Read me in English</summary>
|
||||
|
||||
## Changelog
|
||||
|
||||
* 1.1.4
|
||||
* Fixed support for game version 0.10.29
|
||||
|
||||
* 1.1.3
|
||||
* Support for game version 0.10.28.20759+
|
||||
* Fixed a minor bug that `RemoveSpeedLimitForStage1` not working while `UseFixedSpeed` set to false and `SpeedMultiplier` set to 1
|
||||
|
||||
* 1.1.2
|
||||
* `RemoveBuildRangeLimit`, `LargerAreaForUpgradeAndDismantle` and `LargerAreaForTerraform` are moved to [UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist)
|
||||
|
||||
* 1.1.1
|
||||
* Fixed crash in `LargeAreaForTerraform` functions.
|
||||
|
||||
* 1.1.0
|
||||
* Added `RemoveBuildRangeLimit`, `LargerAreaForUpgradeAndDismantle` and `LargerAreaForTerraform` options (Check Usage for details).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>中文读我</summary>
|
||||
|
||||
## 更新日志
|
||||
|
||||
* 1.1.4
|
||||
* 修复了对游戏版本0.10.29的支持
|
||||
|
||||
* 1.1.3
|
||||
* 支持游戏版本0.10.28.20759+
|
||||
* 修复了当`UseFixedSpeed`设置为false且`SpeedMultiplier`设置为1时`RemoveSpeedLimitForStage1`无效的问题
|
||||
|
||||
* 1.1.2
|
||||
* `RemoveBuildRangeLimit`, `LargerAreaForUpgradeAndDismantle` 和 `LargerAreaForTerraform` 移动到了 MOD [UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist) 中
|
||||
|
||||
* 1.1.1
|
||||
* 修复了 `LargeAreaForTerraform` 功能可能导致崩溃的问题。
|
||||
|
||||
* 1.1.0
|
||||
* 添加了 `RemoveBuildRangeLimit`, `LargerAreaForUpgradeAndDismantle` 和 `LargerAreaForTerraform` 选项 (详情见使用说明)。
|
||||
|
||||
</details>
|
||||
@@ -15,7 +15,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.Core" Version="5.*" />
|
||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="*-r.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" />
|
||||
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -1,26 +1,30 @@
|
||||
# MechaDronesTweaks
|
||||
|
||||
#### Some tweaks for mecha drones(Successor to FastDrones MOD)
|
||||
#### 机甲建设机调整(FastDrones MOD的后继者)
|
||||
<details>
|
||||
<summary>Read me in English</summary>
|
||||
|
||||
***Some tweaks for mecha drones(Successor to FastDrones MOD)***
|
||||
|
||||
## Updates
|
||||
|
||||
* 1.1.4
|
||||
+ Fixed support for game version 0.10.29
|
||||
* Fixed support for game version 0.10.29
|
||||
|
||||
* 1.1.3
|
||||
+ Support for game version 0.10.28.20759+
|
||||
+ Fixed a minor bug that `RemoveSpeedLimitForStage1` not working while `UseFixedSpeed` set to false and `SpeedMultiplier` set to 1
|
||||
* Support for game version 0.10.28.20759+
|
||||
* Fixed a minor bug that `RemoveSpeedLimitForStage1` not working while `UseFixedSpeed` set to false and `SpeedMultiplier` set to 1
|
||||
|
||||
* 1.1.2
|
||||
+ `RemoveBuildRangeLimit`, `LargerAreaForUpgradeAndDismantle` and `LargerAreaForTerraform` are moved to [UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist)
|
||||
* `RemoveBuildRangeLimit`, `LargerAreaForUpgradeAndDismantle` and `LargerAreaForTerraform` are moved to [UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist)
|
||||
|
||||
* 1.1.1
|
||||
+ Fixed crash in `LargeAreaForTerraform` functions.
|
||||
* Fixed crash in `LargeAreaForTerraform` functions.
|
||||
|
||||
* 1.1.0
|
||||
+ Added `RemoveBuildRangeLimit`, `LargerAreaForUpgradeAndDismantle` and `LargerAreaForTerraform` options (Check Usage for details).
|
||||
* Added `RemoveBuildRangeLimit`, `LargerAreaForUpgradeAndDismantle` and `LargerAreaForTerraform` options (Check Usage for details).
|
||||
|
||||
## Usage
|
||||
|
||||
* Inspired by [FastDrones](https://dsp.thunderstore.io/package/dkoppstein/FastDrones/), but patching IL codes, consuming less CPU to reduce lags on massive builds especially blueprints' put.
|
||||
* Does not affect current game-saves, which means:
|
||||
* All values are patched in memory but written to game-saves so that you can play with normal mecha drone parameters while disabling this MOD.
|
||||
@@ -37,24 +41,15 @@
|
||||
* `EnergyMultiplier` [Default Value: 0.1]: Energy consumption multiplier for mecha drones.
|
||||
* Note: This MOD will disable `FastDrones` if the MOD is installed, to avoid conflict in functions.
|
||||
|
||||
## 更新日志
|
||||
* 1.1.4
|
||||
+ 修复了对游戏版本0.10.29的支持
|
||||
</details>
|
||||
|
||||
* 1.1.3
|
||||
+ 支持游戏版本0.10.28.20759+
|
||||
+ 修复了当`UseFixedSpeed`设置为false且`SpeedMultiplier`设置为1时`RemoveSpeedLimitForStage1`无效的问题
|
||||
<details>
|
||||
<summary>中文读我</summary>
|
||||
|
||||
* 1.1.2
|
||||
+ `RemoveBuildRangeLimit`, `LargerAreaForUpgradeAndDismantle` 和 `LargerAreaForTerraform` 移动到了 MOD [UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist) 中
|
||||
|
||||
* 1.1.1
|
||||
+ 修复了 `LargeAreaForTerraform` 功能可能导致崩溃的问题。
|
||||
|
||||
* 1.1.0
|
||||
+ 添加了 `RemoveBuildRangeLimit`, `LargerAreaForUpgradeAndDismantle` 和 `LargerAreaForTerraform` 选项 (详情见使用说明)。
|
||||
***机甲建设机调整(FastDrones MOD的后继者)***
|
||||
|
||||
## 使用说明
|
||||
|
||||
* 功能参考 [FastDrones](https://dsp.thunderstore.io/package/dkoppstein/FastDrones/),但主要对IL代码进行Patch因此消耗更少的CPU,尤其在大规模建造比如放置蓝图的时候可以大大减少卡顿。
|
||||
* 不影响当前游戏存档:
|
||||
* 所有修改参数都在内存中Patch不会写入存档,禁用此MOD后可恢复正常建设机参数。
|
||||
@@ -70,3 +65,5 @@
|
||||
* `SpeedMultiplier` [默认值: 4]: 速度倍数。
|
||||
* `EnergyMultiplier` [默认值: 0.1]: 能量消耗倍数。
|
||||
* 说明: 如果安装了`FastDrones`本MOD会将其禁用避免功能冲突。
|
||||
|
||||
</details>
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<AssemblyName>OCBatchBuild</AssemblyName>
|
||||
<BepInExPluginGuid>org.soardev.ocbatchbuild</BepInExPluginGuid>
|
||||
<Description>DSP MOD - OCBatchBuild</Description>
|
||||
<Version>1.2.0</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<RestoreAdditionalProjectSources>https://nuget.bepinex.dev/v3/index.json</RestoreAdditionalProjectSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.Core" Version="5.*" />
|
||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="*-r.*" />
|
||||
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'">
|
||||
<Exec Command="del /F /Q package\$(ProjectName)-$(Version).zip
powershell Compress-Archive -Force -DestinationPath 'package/$(ProjectName)-$(Version).zip' -Path '$(TargetPath)', package/icon.png, package/manifest.json, README.md" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,129 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BepInEx;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace OCBatchBuild;
|
||||
|
||||
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
||||
public class OrbitalCollectorBatchBuild : BaseUnityPlugin
|
||||
{
|
||||
private new static readonly BepInEx.Logging.ManualLogSource Logger =
|
||||
BepInEx.Logging.Logger.CreateLogSource(PluginInfo.PLUGIN_NAME);
|
||||
|
||||
private bool _cfgEnabled = true;
|
||||
private static int _maxBuildCount;
|
||||
private static bool _instantBuild;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_cfgEnabled = Config.Bind("General", "Enabled", _cfgEnabled, "enable/disable this plugin").Value;
|
||||
_maxBuildCount = Config.Bind("General", "MaxBuildCount", _maxBuildCount, "Maximum Orbital Collectors to build once, set to 0 to build as many as possible").Value;
|
||||
_instantBuild = Config.Bind("General", "InstantBuild", _instantBuild, "Enable to make Orbital Collectors built instantly. This is thought to be game logic breaking.").Value;
|
||||
Harmony.CreateAndPatchAll(typeof(OrbitalCollectorBatchBuild));
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(BuildTool_Click), "CreatePrebuilds")]
|
||||
private static void CreatePrebuilds(BuildTool_Click __instance)
|
||||
{
|
||||
/* Check Gas Planet */
|
||||
if (__instance.planet.type != EPlanetType.Gas) return;
|
||||
if (__instance.buildPreviews.Count == 0) return;
|
||||
|
||||
var buildPreview = __instance.buildPreviews[0];
|
||||
/* Check if is collector station */
|
||||
if (!buildPreview.desc.isCollectStation) return;
|
||||
|
||||
var factory = __instance.factory;
|
||||
var stationPool = factory.transport.stationPool;
|
||||
var entityPool = factory.entityPool;
|
||||
var stationCursor = factory.transport.stationCursor;
|
||||
var pos = buildPreview.lpos;
|
||||
var pos2 = buildPreview.lpos2;
|
||||
var itemId = buildPreview.item.ID;
|
||||
var countToBuild = _maxBuildCount - 1;
|
||||
if (countToBuild == 0) return;
|
||||
var prebuilds = new List<int> {-buildPreview.objId};
|
||||
var player = __instance.player;
|
||||
var firstPos = pos;
|
||||
var cellCount = PlanetGrid.DetermineLongitudeSegmentCount(0, factory.planet.aux.mainGrid.segment) * 5;
|
||||
var cellRad = Math.PI / cellCount;
|
||||
var distRadCount = 0;
|
||||
for (var i = 1; i <= cellCount; i++)
|
||||
{
|
||||
pos = Maths.RotateLF(0.0, 1.0, 0.0, cellRad, pos);
|
||||
if ((firstPos - pos).sqrMagnitude < 14297f) continue;
|
||||
distRadCount = i;
|
||||
break;
|
||||
}
|
||||
|
||||
if (distRadCount == 0) return;
|
||||
pos = firstPos;
|
||||
/* rotate for a minimal distance for next OC on sphere */
|
||||
pos = Maths.RotateLF(0.0, 1.0, 0.0, cellRad * distRadCount, pos);
|
||||
pos2 = Maths.RotateLF(0.0, 1.0, 0.0, cellRad * distRadCount, pos2);
|
||||
for (var i = distRadCount; i < cellCount && countToBuild != 0;)
|
||||
{
|
||||
/* Check for collision */
|
||||
var collide = false;
|
||||
for (var j = 1; j < stationCursor; j++)
|
||||
{
|
||||
if (stationPool[j] == null || stationPool[j].id != j) continue;
|
||||
if ((entityPool[stationPool[j].entityId].pos - pos).sqrMagnitude >= 14297f) continue;
|
||||
collide = true;
|
||||
break;
|
||||
}
|
||||
if (collide)
|
||||
{
|
||||
/* rotate for a small cell on sphere */
|
||||
pos = Maths.RotateLF(0.0, 1.0, 0.0, cellRad, pos);
|
||||
pos2 = Maths.RotateLF(0.0, 1.0, 0.0, cellRad, pos2);
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (player.inhandItemId == itemId && player.inhandItemCount > 0)
|
||||
{
|
||||
player.UseHandItems(1, out var _);
|
||||
}
|
||||
else
|
||||
{
|
||||
var count = 1;
|
||||
player.package.TakeTailItems(ref itemId, ref count, out var _);
|
||||
if (count == 0) break;
|
||||
}
|
||||
|
||||
var rot = Maths.SphericalRotation(pos, 0f);
|
||||
var rot2 = Maths.SphericalRotation(pos2, 0f);
|
||||
var prebuild = default(PrebuildData);
|
||||
prebuild.protoId = (short)buildPreview.item.ID;
|
||||
prebuild.modelIndex = (short)buildPreview.desc.modelIndex;
|
||||
prebuild.pos = pos;
|
||||
prebuild.pos2 = pos2;
|
||||
prebuild.rot = rot;
|
||||
prebuild.rot2 = rot2;
|
||||
prebuild.pickOffset = (short)buildPreview.inputOffset;
|
||||
prebuild.insertOffset = (short)buildPreview.outputOffset;
|
||||
prebuild.recipeId = buildPreview.recipeId;
|
||||
prebuild.filterId = buildPreview.filterId;
|
||||
prebuild.InitParametersArray(buildPreview.paramCount);
|
||||
for (var j = 0; j < buildPreview.paramCount; j++)
|
||||
{
|
||||
prebuild.parameters[j] = buildPreview.parameters[j];
|
||||
}
|
||||
prebuilds.Add(factory.AddPrebuildDataWithComponents(prebuild));
|
||||
countToBuild--;
|
||||
/* rotate for minimal distance for next OC on sphere */
|
||||
pos = Maths.RotateLF(0.0, 1.0, 0.0, cellRad * distRadCount, pos);
|
||||
pos2 = Maths.RotateLF(0.0, 1.0, 0.0, cellRad * distRadCount, pos2);
|
||||
i += distRadCount;
|
||||
}
|
||||
|
||||
if (!_instantBuild) return;
|
||||
foreach (var id in prebuilds)
|
||||
{
|
||||
factory.BuildFinally(player, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
# OrbitalCollectorBatchBuild
|
||||
|
||||
#### Batch build Orbital Collectors
|
||||
#### 轨道采集器快速批量建造
|
||||
|
||||
## Updates
|
||||
### 1.2.0
|
||||
* Support for mods that change default radius of Gas Planets, e.g. `GalacticScale`.
|
||||
* Remove maximum build count limit in config.
|
||||
|
||||
### 1.1.0
|
||||
* Add `InstantBuild` to config
|
||||
|
||||
## Usage
|
||||
* Build any orbital collector on a Gas Giant to trigger building all placable orbital collectors.
|
||||
* Can set maximum orbital collectors to build once in config.
|
||||
* Note: Collectors are placed as prebuilt status, you still need to fly around the Gas Giant to complete building. This is designed not to break much game logic.
|
||||
You can set `InstantBuild` to `true` in config to make them built instantly.
|
||||
|
||||
## 使用说明
|
||||
* 在气态星球上建造任何一个轨道采集器触发所有可建造采集器的放置。
|
||||
* 可以在设置文件中配置一次批量建造的最大轨道采集器数量。
|
||||
* 提示:轨道采集器会处于待建造状态,你仍然需要绕行气态行星一圈以完成建造。这个机制是为了尽可能减少对原有游戏逻辑的破坏。
|
||||
在配置文件里设置`InstantBuild`为`true`可以使采集器的建造立即完成。
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 53 KiB |
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"name": "OrbitalCollectorBatchBuild",
|
||||
"version_number": "1.2.0",
|
||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/OCBatchBuild",
|
||||
"description": "Batch build Orbital Collectors / 轨道采集器快速批量建造",
|
||||
"dependencies": [
|
||||
"xiaoye97-BepInEx-5.4.17"
|
||||
]
|
||||
}
|
||||
@@ -16,15 +16,15 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.Core" Version="5.*" />
|
||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="*-r.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" />
|
||||
<PackageReference Include="DysonSphereProgram.Modding.DSPModSave" Version="1.*" />
|
||||
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'">
|
||||
<Exec Command="del /F /Q package\$(ProjectName)-$(Version).zip
powershell Compress-Archive -Force -DestinationPath 'package/$(ProjectName)-$(Version).zip' -Path '$(TargetPath)', package/icon.png, package/manifest.json, README.md" />
|
||||
</Target>
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
# OverclockEverything
|
||||
|
||||
#### Boost nearly all structures
|
||||
#### 加速几乎所有建筑功能
|
||||
|
||||
## Usage
|
||||
***Boost nearly all structures***
|
||||
|
||||
* Boost power generation, assembling speed, belt and sorter speed.
|
||||
|
||||
## 使用说明
|
||||
***加速几乎所有建筑功能***
|
||||
|
||||
* 加快发电,制造,传送带和分拣器速度。
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.Core" Version="5.*" />
|
||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="*-r.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" />
|
||||
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'">
|
||||
<Exec Command="del /F /Q package\$(ProjectName)-$(Version).zip
powershell Compress-Archive -Force -DestinationPath 'package/$(ProjectName)-$(Version).zip' -Path '$(TargetPath)', package/icon.png, package/manifest.json, README.md" />
|
||||
</Target>
|
||||
|
||||
53
README.md
53
README.md
@@ -1,67 +1,62 @@
|
||||
## DSP Mods by Soar Qin
|
||||
# DSP Mods by Soar Qin
|
||||
|
||||
# [CheatEnabler](CheatEnabler)
|
||||
## [CheatEnabler](CheatEnabler)
|
||||
|
||||
Add various cheat functions while disabling abnormal determinants
|
||||
Add various cheat functions while disabling abnormal determinants
|
||||
添加一些作弊功能,同时屏蔽异常检测
|
||||
|
||||
# [CompressSave](CompressSave)
|
||||
## [CompressSave](CompressSave)
|
||||
|
||||
Moved [here](https://github.com/soarqin/DSP_Mods_TO/tree/master/CompressSave)
|
||||
Moved [to another repo](https://github.com/soarqin/DSP_Mods_TO/tree/master/CompressSave)
|
||||
|
||||
# [LogisticHub](LogisticHub)
|
||||
## [LogisticHub](LogisticHub)
|
||||
|
||||
Cheat functions for Logistic Storages, make them mine resources on the planet and exchange items from certain buildings
|
||||
物流塔作弊功能,使其可以在星球上采矿并与特定建筑物交换物品
|
||||
|
||||
# [HideTips](HideTips)
|
||||
## [HideTips](HideTips)
|
||||
|
||||
Hide/Disable various tutorial tips/messages
|
||||
Hide/Disable various tutorial tips/messages
|
||||
隐藏/屏蔽各种引导提示/消息
|
||||
|
||||
# [Dustbin](Dustbin)
|
||||
## [Dustbin](Dustbin)
|
||||
|
||||
Can turn Storages and Tanks into Dustbin(Destroy incoming items)
|
||||
Can turn Storages and Tanks into Dustbin(Destroy incoming items)
|
||||
储物仓和储液罐可以转变为垃圾桶(销毁送进的物品)
|
||||
|
||||
# [OverclockEverything](OverclockEverything)
|
||||
## [OverclockEverything](OverclockEverything)
|
||||
|
||||
Boost nearly all structures
|
||||
加速几乎所有建筑功能
|
||||
|
||||
# [OrbitalCollectorBatchBuild](OCBatchBuild)
|
||||
## [UniverseGenTweaks](UniverseGenTweaks)
|
||||
|
||||
Batch build Orbital Collectors
|
||||
轨道采集器快速批量建造
|
||||
|
||||
# [UniverseGenTweaks](UniverseGenTweaks)
|
||||
|
||||
Universe Generator Tweak
|
||||
Universe Generator Tweak
|
||||
宇宙生成参数调节
|
||||
|
||||
# [MechaDronesTweaks](MechaDronesTweaks)
|
||||
## [MechaDronesTweaks](MechaDronesTweaks)
|
||||
|
||||
Some tweaks for mecha drones and build functions(Successor to FastDrones MOD)
|
||||
Some tweaks for mecha drones and build functions(Successor to FastDrones MOD)
|
||||
机甲建设机和建设功能调整(FastDrones MOD的后继者)
|
||||
|
||||
# [LabOpt](LabOpt)
|
||||
## [LabOpt](LabOpt)
|
||||
|
||||
Performance optimizations for Matrix Labs
|
||||
Performance optimizations for Matrix Labs
|
||||
Marked as obsoleted temporarily, needs more investigation about LabComponent's mechanism
|
||||
优化研究站性能
|
||||
暂时标识为过期,需要更多关于LabComponent机制的研究
|
||||
|
||||
# [PoolOpt](PoolOpt)
|
||||
## [PoolOpt](PoolOpt)
|
||||
|
||||
Optimize memory pools on loading gamesaves
|
||||
Optimize memory pools on loading gamesaves
|
||||
加载游戏存档时优化内存池的使用
|
||||
|
||||
# [UserCloak](UserCloak)
|
||||
## [UserCloak](UserCloak)
|
||||
|
||||
Cloak(Fake) user account info
|
||||
Cloak(Fake) user account info
|
||||
隐匿(伪装)用户账号信息
|
||||
|
||||
# [UXAssist](UXAssist)
|
||||
## [UXAssist](UXAssist)
|
||||
|
||||
Some functions and patches for better user experience
|
||||
一些提升用户体验的功能和补丁
|
||||
Some functions and patches for better user experience
|
||||
一些提升用户体验的功能和补丁
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,12 +3,12 @@ using HarmonyLib;
|
||||
|
||||
namespace UXAssist.Common;
|
||||
|
||||
public class GameLogic: PatchImpl<GameLogic>
|
||||
public class GameLogic : PatchImpl<GameLogic>
|
||||
{
|
||||
public static Action OnDataLoaded;
|
||||
public static Action OnGameBegin;
|
||||
public static Action OnGameEnd;
|
||||
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(VFPreload), nameof(VFPreload.InvokeOnLoadWorkEnded))]
|
||||
public static void VFPreload_InvokeOnLoadWorkEnded_Postfix()
|
||||
|
||||
@@ -122,14 +122,14 @@ public static class I18N
|
||||
_initialized = true;
|
||||
Apply();
|
||||
}
|
||||
|
||||
|
||||
[HarmonyPostfix, HarmonyPriority(Priority.Last), HarmonyPatch(typeof(Localization), nameof(Localization.LoadLanguage))]
|
||||
private static void Localization_LoadLanguage_Postfix(int index)
|
||||
{
|
||||
if (!_initialized) return;
|
||||
ApplyLanguage(index);
|
||||
}
|
||||
|
||||
|
||||
[HarmonyPostfix, HarmonyPriority(Priority.Last), HarmonyPatch(typeof(Localization), nameof(Localization.NotifyLanguageChange))]
|
||||
private static void Localization_NotifyLanguageChange_Postfix()
|
||||
{
|
||||
|
||||
@@ -29,4 +29,11 @@ public static class KeyBindings
|
||||
|
||||
return new CombineKey((int)shortcut.MainKey, mod, ECombineKeyAction.OnceClick, false);
|
||||
}
|
||||
|
||||
public static bool IsKeyPressing(this PressKeyBind keyBind)
|
||||
{
|
||||
var defBind = keyBind.defaultBind;
|
||||
var overrideKey = VFInput.override_keys[defBind.id];
|
||||
return overrideKey.IsNull() ? defBind.key.GetKey() : overrideKey.GetKey();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@ public class PatchGuidAttribute(string guid) : Attribute
|
||||
|
||||
public enum PatchCallbackFlag
|
||||
{
|
||||
// OnEnable() is called After patch is applied by default, set this flag to call it before patch is applied
|
||||
// By default, OnEnable() is called After patch applied, set this flag to call it before patch is applied
|
||||
CallOnEnableBeforePatch,
|
||||
// OnDisable() is called Before patch is removed by default, set this flag to call it after patch is removed
|
||||
// By default, OnDisable() is called Before patch removed, set this flag to call it after patch is removed
|
||||
CallOnDisableAfterUnpatch,
|
||||
}
|
||||
|
||||
@@ -27,25 +27,27 @@ public class PatchSetCallbackFlagAttribute(PatchCallbackFlag flag) : Attribute
|
||||
|
||||
public class PatchImpl<T> where T : PatchImpl<T>, new()
|
||||
{
|
||||
private static T Instance { get; } = new();
|
||||
|
||||
private Harmony _patch;
|
||||
protected static T Instance { get; } = new();
|
||||
|
||||
protected Harmony _patch;
|
||||
|
||||
public static void Enable(bool enable)
|
||||
{
|
||||
var thisInstance = Instance;
|
||||
if (enable)
|
||||
{
|
||||
if (thisInstance._patch != null) return;
|
||||
var guid = typeof(T).GetCustomAttribute<PatchGuidAttribute>()?.Guid ?? $"PatchImpl.{typeof(T).FullName ?? typeof(T).ToString()}";
|
||||
var callOnEnableBefore = typeof(T).GetCustomAttributes<PatchSetCallbackFlagAttribute>().Any(n => n.Flag == PatchCallbackFlag.CallOnEnableBeforePatch);
|
||||
if (callOnEnableBefore) thisInstance.OnEnable();
|
||||
thisInstance._patch ??= Harmony.CreateAndPatchAll(typeof(T), guid);
|
||||
thisInstance._patch = Harmony.CreateAndPatchAll(typeof(T), guid);
|
||||
if (!callOnEnableBefore) thisInstance.OnEnable();
|
||||
return;
|
||||
}
|
||||
if (thisInstance._patch == null) return;
|
||||
var callOnDisableAfter = typeof(T).GetCustomAttributes<PatchSetCallbackFlagAttribute>().Any(n => n.Flag == PatchCallbackFlag.CallOnDisableAfterUnpatch);
|
||||
if (!callOnDisableAfter) thisInstance.OnDisable();
|
||||
thisInstance._patch?.UnpatchSelf();
|
||||
thisInstance._patch.UnpatchSelf();
|
||||
thisInstance._patch = null;
|
||||
if (callOnDisableAfter) thisInstance.OnDisable();
|
||||
}
|
||||
|
||||
@@ -36,13 +36,13 @@ public static class Util
|
||||
tex.LoadImage(fileData);
|
||||
return tex;
|
||||
}
|
||||
|
||||
|
||||
public static Sprite LoadSprite(string path)
|
||||
{
|
||||
var tex = LoadTexture(path);
|
||||
return Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f));
|
||||
}
|
||||
|
||||
|
||||
public static Texture2D LoadEmbeddedTexture(string path, Assembly assembly = null)
|
||||
{
|
||||
var fileData = LoadEmbeddedResource(path, assembly);
|
||||
@@ -50,12 +50,12 @@ public static class Util
|
||||
tex.LoadImage(fileData);
|
||||
return tex;
|
||||
}
|
||||
|
||||
|
||||
public static Sprite LoadEmbeddedSprite(string path, Assembly assembly = null)
|
||||
{
|
||||
var tex = LoadEmbeddedTexture(path, assembly);
|
||||
return Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f));
|
||||
}
|
||||
|
||||
|
||||
public static string PluginFolder(Assembly assembly = null) => Path.GetDirectoryName((assembly == null ? Assembly.GetCallingAssembly() : assembly).Location);
|
||||
}
|
||||
|
||||
@@ -128,8 +128,8 @@ public static class WinApi
|
||||
[DllImport("user32", ExactSpelling = true)]
|
||||
public static extern bool MoveWindow(IntPtr hWnd, int x, int y, int nWidth, int nHeight, bool bRepaint);
|
||||
|
||||
[DllImport("kernel32", ExactSpelling = true, SetLastError = true)]
|
||||
public static extern bool GetProcessAffinityMask(IntPtr hProcess, out ulong lpProcessAffinityMask, out ulong lpSystemAffinityMask);
|
||||
[DllImport("user32", ExactSpelling = true)]
|
||||
public static extern IntPtr MonitorFromRect([In] ref Rect lpRect, uint dwFlags);
|
||||
|
||||
[DllImport("kernel32", ExactSpelling = true, SetLastError = true)]
|
||||
public static extern IntPtr GetCurrentProcess();
|
||||
@@ -140,9 +140,6 @@ public static class WinApi
|
||||
[DllImport("kernel32", ExactSpelling = true)]
|
||||
public static extern IntPtr GetConsoleWindow();
|
||||
|
||||
[DllImport("kernel32", ExactSpelling = true, SetLastError = true)]
|
||||
public static extern bool SetProcessAffinityMask(IntPtr hProcess, ulong dwProcessAffinityMask);
|
||||
|
||||
// GetPriorityClass and SetPriorityClass
|
||||
[DllImport("kernel32", ExactSpelling = true, SetLastError = true)]
|
||||
public static extern int GetPriorityClass(IntPtr hProcess);
|
||||
@@ -157,126 +154,4 @@ public static class WinApi
|
||||
public static extern IntPtr CallWindowProc(IntPtr lpPrevWndFunc, IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetLogicalProcessorInformationEx
|
||||
|
||||
[Flags]
|
||||
private enum LOGICAL_PROCESSOR_RELATIONSHIP
|
||||
{
|
||||
RelationProcessorCore,
|
||||
RelationNumaNode,
|
||||
RelationCache,
|
||||
RelationProcessorPackage,
|
||||
RelationGroup,
|
||||
RelationAll = 0xffff
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
||||
private struct GROUP_AFFINITY
|
||||
{
|
||||
public nuint Mask;
|
||||
public ushort Group;
|
||||
public ushort Reserved0;
|
||||
public ushort Reserved1;
|
||||
public ushort Reserved3;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
||||
private struct PROCESSOR_RELATIONSHIP
|
||||
{
|
||||
public byte Flags;
|
||||
public byte EfficiencyClass;
|
||||
public ushort Reserved0;
|
||||
public uint Reserved1;
|
||||
public uint Reserved2;
|
||||
public uint Reserved3;
|
||||
public uint Reserved4;
|
||||
public ushort Reserved5;
|
||||
public ushort GroupCount;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
|
||||
public GROUP_AFFINITY[] GroupMask;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
|
||||
{
|
||||
public LOGICAL_PROCESSOR_RELATIONSHIP Relationship;
|
||||
public uint Size;
|
||||
public PROCESSOR_RELATIONSHIP Processor;
|
||||
}
|
||||
|
||||
[DllImport("kernel32", SetLastError = true)]
|
||||
private static extern bool GetLogicalProcessorInformationEx(
|
||||
LOGICAL_PROCESSOR_RELATIONSHIP relationshipType,
|
||||
IntPtr buffer,
|
||||
ref uint returnLength
|
||||
);
|
||||
|
||||
public struct LogicalProcessorDetails
|
||||
{
|
||||
public int CoreCount;
|
||||
public int ThreadCount;
|
||||
public int PerformanceCoreCount;
|
||||
public int EfficiencyCoreCount;
|
||||
public ulong PerformanceCoreMask;
|
||||
public ulong EfficiencyCoreMask;
|
||||
public bool HybridArchitecture => PerformanceCoreCount > 0 && EfficiencyCoreCount > 0;
|
||||
}
|
||||
|
||||
public static LogicalProcessorDetails GetLogicalProcessorDetails()
|
||||
{
|
||||
uint returnLength = 0;
|
||||
GetLogicalProcessorInformationEx(LOGICAL_PROCESSOR_RELATIONSHIP.RelationProcessorCore, IntPtr.Zero, ref returnLength);
|
||||
var result = new LogicalProcessorDetails();
|
||||
if (Marshal.GetLastWin32Error() != ERROR_INSUFFICIENT_BUFFER) return result;
|
||||
var ptr = Marshal.AllocHGlobal((int)returnLength);
|
||||
try
|
||||
{
|
||||
if (!GetLogicalProcessorInformationEx(LOGICAL_PROCESSOR_RELATIONSHIP.RelationProcessorCore, ptr, ref returnLength))
|
||||
return result;
|
||||
uint offset = 0;
|
||||
var item = ptr;
|
||||
while (offset < returnLength)
|
||||
{
|
||||
var buffer = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX)Marshal.PtrToStructure(item, typeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX));
|
||||
offset += buffer.Size;
|
||||
item += (int)buffer.Size;
|
||||
if (buffer.Relationship != LOGICAL_PROCESSOR_RELATIONSHIP.RelationProcessorCore) continue;
|
||||
result.CoreCount++;
|
||||
var mask = buffer.Processor.GroupMask[0].Mask;
|
||||
var tcount = CountBitsSet(mask);
|
||||
result.ThreadCount += tcount;
|
||||
if (buffer.Processor.EfficiencyClass > 0)
|
||||
{
|
||||
result.PerformanceCoreCount++;
|
||||
result.PerformanceCoreMask |= mask;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.EfficiencyCoreCount++;
|
||||
result.EfficiencyCoreMask |= mask;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
int CountBitsSet(ulong mask)
|
||||
{
|
||||
var count = 0;
|
||||
while (mask != 0)
|
||||
{
|
||||
mask &= mask - 1;
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Linq;
|
||||
|
||||
namespace UXAssist.Functions;
|
||||
namespace UXAssist.Functions;
|
||||
|
||||
public static class DysonSphereFunctions
|
||||
{
|
||||
|
||||
253
UXAssist/Functions/FactoryFunctions.cs
Normal file
253
UXAssist/Functions/FactoryFunctions.cs
Normal file
@@ -0,0 +1,253 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace UXAssist.Functions;
|
||||
|
||||
public static class FactoryFunctions
|
||||
{
|
||||
public static void CutConveyorBelt(CargoTraffic cargoTraffic, int beltId)
|
||||
{
|
||||
ref var belt = ref cargoTraffic.beltPool[beltId];
|
||||
if (belt.id != beltId || belt.outputId <= 0) return;
|
||||
|
||||
// Clear entity connection
|
||||
var factory = cargoTraffic.factory;
|
||||
factory.ReadObjectConn(belt.entityId, 0, out var isOutput, out var otherObjId, out var otherSlot);
|
||||
if (isOutput && factory.entityPool[otherObjId].beltId == belt.outputId)
|
||||
{
|
||||
factory.ClearObjectConnDirect(belt.entityId, 0);
|
||||
factory.ClearObjectConnDirect(otherObjId, otherSlot);
|
||||
}
|
||||
// Alter belt connections
|
||||
var (i0, i1, i2) = (belt.rightInputId, belt.backInputId, belt.leftInputId);
|
||||
cargoTraffic._arrInputs(ref i0, ref i1, ref i2);
|
||||
cargoTraffic.AlterBeltConnections(beltId, 0, i0, i1, i2);
|
||||
}
|
||||
|
||||
public static void DismantleBlueprintSelectedBuildings()
|
||||
{
|
||||
var player = GameMain.mainPlayer;
|
||||
var build = player?.controller?.actionBuild;
|
||||
if (build == null) return;
|
||||
var blueprintCopyTool = build.blueprintCopyTool;
|
||||
if (blueprintCopyTool == null || !blueprintCopyTool.active) return;
|
||||
var factory = build.factory;
|
||||
List<int> buildPreviewsToRemove = [];
|
||||
foreach (var buildPreview in blueprintCopyTool.bpPool)
|
||||
{
|
||||
if (buildPreview?.item == null) continue;
|
||||
var objId = buildPreview.objId;
|
||||
if (objId == 0) continue;
|
||||
int index;
|
||||
if ((index = buildPreviewsToRemove.BinarySearch(objId)) < 0)
|
||||
buildPreviewsToRemove.Insert(~index, objId);
|
||||
var isBelt = buildPreview.desc.isBelt;
|
||||
var isInserter = buildPreview.desc.isInserter;
|
||||
if (isInserter) continue;
|
||||
if (isBelt)
|
||||
{
|
||||
var needCheck = false;
|
||||
for (var j = 0; j < 2; j++)
|
||||
{
|
||||
factory.ReadObjectConn(objId, j, out _, out var connObjId, out _);
|
||||
if (connObjId == 0 || factory.ObjectIsBelt(connObjId) || blueprintCopyTool.ObjectIsInserter(connObjId)) continue;
|
||||
needCheck = true;
|
||||
break;
|
||||
}
|
||||
if (needCheck)
|
||||
{
|
||||
for (var k = 0; k < 16; k++)
|
||||
{
|
||||
factory.ReadObjectConn(objId, k, out _, out var connObjId, out _);
|
||||
if (connObjId != 0 && (index = buildPreviewsToRemove.BinarySearch(connObjId)) < 0 && (factory.ObjectIsBelt(connObjId) || blueprintCopyTool.ObjectIsInserter(connObjId)))
|
||||
buildPreviewsToRemove.Insert(~index, connObjId);
|
||||
}
|
||||
}
|
||||
for (var m = 0; m < 4; m++)
|
||||
{
|
||||
factory.ReadObjectConn(objId, m, out _, out var connObjId, out _);
|
||||
if (connObjId == 0 || !factory.ObjectIsBelt(connObjId) || buildPreviewsToRemove.BinarySearch(connObjId) >= 0) continue;
|
||||
for (var j = 0; j < 2; j++)
|
||||
{
|
||||
factory.ReadObjectConn(connObjId, j, out _, out var connObjId2, out _);
|
||||
if (connObjId2 == 0 || (index = buildPreviewsToRemove.BinarySearch(connObjId2)) >= 0 || factory.ObjectIsBelt(connObjId2) || blueprintCopyTool.ObjectIsInserter(connObjId2)) continue;
|
||||
buildPreviewsToRemove.Insert(~index, connObjId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (buildPreview.desc.addonType == EAddonType.Belt) continue;
|
||||
for (var j = 0; j < 16; j++)
|
||||
{
|
||||
factory.ReadObjectConn(objId, j, out _, out var connObjId, out _);
|
||||
if (connObjId != 0 && (index = buildPreviewsToRemove.BinarySearch(connObjId)) < 0 && (factory.ObjectIsBelt(connObjId) || blueprintCopyTool.ObjectIsInserter(connObjId)))
|
||||
buildPreviewsToRemove.Insert(~index, connObjId);
|
||||
}
|
||||
}
|
||||
var entityPool = factory.entityPool;
|
||||
var stationPool = factory.transport.stationPool;
|
||||
foreach (var objId in buildPreviewsToRemove)
|
||||
{
|
||||
if (objId > 0)
|
||||
{
|
||||
int stationId = entityPool[objId].stationId;
|
||||
if (stationId > 0)
|
||||
{
|
||||
StationComponent sc = stationPool[stationId];
|
||||
if (sc.id != stationId) continue;
|
||||
for (int i = 0; i < sc.storage.Length; i++)
|
||||
{
|
||||
int package = player.TryAddItemToPackage(sc.storage[i].itemId, sc.storage[i].count, sc.storage[i].inc, true, objId);
|
||||
UIItemup.Up(sc.storage[i].itemId, package);
|
||||
}
|
||||
sc.storage = new StationStore[sc.storage.Length];
|
||||
sc.needs = new int[sc.needs.Length];
|
||||
}
|
||||
}
|
||||
build.DoDismantleObject(objId);
|
||||
}
|
||||
blueprintCopyTool.ClearSelection();
|
||||
blueprintCopyTool.ClearPreSelection();
|
||||
blueprintCopyTool.ResetBlueprint();
|
||||
blueprintCopyTool.ResetBuildPreviews();
|
||||
blueprintCopyTool.RefreshBlueprintData();
|
||||
}
|
||||
|
||||
public static void SelectAllBuildingsInBlueprintCopy()
|
||||
{
|
||||
var localFactory = GameMain.localPlanet?.factory;
|
||||
if (localFactory == null) return;
|
||||
var blueprintCopyTool = GameMain.mainPlayer?.controller?.actionBuild?.blueprintCopyTool;
|
||||
if (blueprintCopyTool == null || !blueprintCopyTool.active) return;
|
||||
var entityPool = localFactory.entityPool;
|
||||
foreach (var entity in entityPool)
|
||||
{
|
||||
if (entity.id == 0) continue;
|
||||
blueprintCopyTool.preSelectObjIds.Add(entity.id);
|
||||
blueprintCopyTool.selectedObjIds.Add(entity.id);
|
||||
}
|
||||
var prebuildPool = localFactory.prebuildPool;
|
||||
foreach (var prebuild in prebuildPool)
|
||||
{
|
||||
if (prebuild.id == 0) continue;
|
||||
blueprintCopyTool.preSelectObjIds.Add(-prebuild.id);
|
||||
blueprintCopyTool.selectedObjIds.Add(-prebuild.id);
|
||||
}
|
||||
blueprintCopyTool.RefreshBlueprintData();
|
||||
blueprintCopyTool.DeterminePreviews();
|
||||
}
|
||||
|
||||
private struct BPBuildingData
|
||||
{
|
||||
public BlueprintBuilding building;
|
||||
public int itemType;
|
||||
public double offset;
|
||||
}
|
||||
|
||||
private struct BPBeltData
|
||||
{
|
||||
public BlueprintBuilding building;
|
||||
public double offset;
|
||||
}
|
||||
|
||||
private static HashSet<int> _itemIsBelt = null;
|
||||
private static Dictionary<int, int> _upgradeTypes = null;
|
||||
|
||||
public static void SortBlueprintData(BlueprintData blueprintData)
|
||||
{
|
||||
// Initialize itemIsBelt and upgradeTypes
|
||||
if (_itemIsBelt == null)
|
||||
{
|
||||
_itemIsBelt = [];
|
||||
_upgradeTypes = [];
|
||||
foreach (var proto in LDB.items.dataArray)
|
||||
{
|
||||
if (proto.prefabDesc?.isBelt ?? false)
|
||||
{
|
||||
_itemIsBelt.Add(proto.ID);
|
||||
continue;
|
||||
}
|
||||
if (proto.Upgrades != null && proto.Upgrades.Length > 0)
|
||||
{
|
||||
var minUpgrade = proto.Upgrades.Min(u => u);
|
||||
if (minUpgrade != 0 && minUpgrade != proto.ID)
|
||||
{
|
||||
_upgradeTypes.Add(proto.ID, minUpgrade);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Separate belt and non-belt buildings
|
||||
List<BPBuildingData> bpBuildings = [];
|
||||
Dictionary<BlueprintBuilding, BPBeltData> bpBelts = [];
|
||||
foreach (var building in blueprintData.buildings)
|
||||
{
|
||||
var offset = building.areaIndex * 1073741824.0 + building.localOffset_y * 262144.0 + building.localOffset_x * 1024.0 + building.localOffset_z;
|
||||
if (_itemIsBelt.Contains(building.itemId))
|
||||
{
|
||||
bpBelts.Add(building, new BPBeltData { building = building, offset = offset });
|
||||
}
|
||||
else
|
||||
{
|
||||
var itemType = _upgradeTypes.TryGetValue(building.itemId, out var upgradeType) ? upgradeType : building.itemId;
|
||||
bpBuildings.Add(new BPBuildingData { building = building, itemType = itemType, offset = offset });
|
||||
}
|
||||
}
|
||||
HashSet<BlueprintBuilding> beltsWithInput = [.. bpBelts.Select(pair => pair.Value.building.outputObj)];
|
||||
var beltHeads = bpBelts.Where(pair => !beltsWithInput.Contains(pair.Value.building)).ToDictionary(pair => pair.Key, pair => pair.Value);
|
||||
// Sort belt buildings
|
||||
List<BlueprintBuilding> sortedBpBelts = [];
|
||||
// Deal with non-cycle belt paths
|
||||
foreach (var pair in beltHeads.OrderByDescending(pair => pair.Value.offset))
|
||||
{
|
||||
var building = pair.Key;
|
||||
while (building != null)
|
||||
{
|
||||
if (!bpBelts.Remove(building)) break;
|
||||
sortedBpBelts.Add(building);
|
||||
building = building.outputObj;
|
||||
}
|
||||
}
|
||||
// Deal with cycle belt paths
|
||||
foreach (var pair in bpBelts.OrderByDescending(pair => pair.Value.offset))
|
||||
{
|
||||
var building = pair.Key;
|
||||
while (building != null)
|
||||
{
|
||||
if (!bpBelts.Remove(building)) break;
|
||||
sortedBpBelts.Add(building);
|
||||
building = building.outputObj;
|
||||
}
|
||||
}
|
||||
|
||||
// Sort non-belt buildings
|
||||
bpBuildings.Sort((a, b) =>
|
||||
{
|
||||
var sign = b.itemType.CompareTo(a.itemType);
|
||||
if (sign != 0) return sign;
|
||||
|
||||
sign = b.building.modelIndex.CompareTo(a.building.modelIndex);
|
||||
if (sign != 0) return sign;
|
||||
|
||||
sign = b.building.recipeId.CompareTo(a.building.recipeId);
|
||||
if (sign != 0) return sign;
|
||||
|
||||
sign = a.building.areaIndex.CompareTo(b.building.areaIndex);
|
||||
if (sign != 0) return sign;
|
||||
|
||||
return b.offset.CompareTo(a.offset);
|
||||
});
|
||||
|
||||
// Concatenate sorted belts and non-belt buildings
|
||||
sortedBpBelts.Reverse();
|
||||
blueprintData.buildings = [.. bpBuildings.Select(b => b.building), .. sortedBpBelts];
|
||||
var buildings = blueprintData.buildings;
|
||||
|
||||
for (var i = buildings.Length - 1; i >= 0; i--)
|
||||
{
|
||||
buildings[i].index = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,6 +93,28 @@ public static class PlanetFunctions
|
||||
planet.audio?.RemoveAudioData(ed.audioId);
|
||||
}
|
||||
|
||||
var hives = GameMain.spaceSector?.dfHives;
|
||||
if (hives != null)
|
||||
{
|
||||
var hive = hives[planet.star.index];
|
||||
var relays = hive?.relays?.buffer;
|
||||
if (relays != null)
|
||||
{
|
||||
var astroId = planet.astroId;
|
||||
for (var i = relays.Length - 1; i >= 0; i--)
|
||||
{
|
||||
var relay = relays[i];
|
||||
if (relay == null || relay.id != i) continue;
|
||||
if (relay.targetAstroId != astroId && relay.searchAstroId != astroId) continue;
|
||||
relay.targetAstroId = 0;
|
||||
relay.searchAstroId = 0;
|
||||
if (relay.baseId > 0)
|
||||
hive.relayNeutralizedCounter++;
|
||||
relay.LeaveBase();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (planet.factory.enemyPool != null)
|
||||
{
|
||||
for (var i = planet.factory.enemyCursor - 1; i > 0; i--)
|
||||
@@ -102,7 +124,7 @@ public static class PlanetFunctions
|
||||
var combatStatId = enemyData.combatStatId;
|
||||
planet.factory.skillSystem.OnRemovingSkillTarget(combatStatId, planet.factory.skillSystem.combatStats.buffer[combatStatId].originAstroId, ETargetType.CombatStat);
|
||||
planet.factory.skillSystem.combatStats.Remove(combatStatId);
|
||||
planet.factory.KillEnemyFinally(player, i, ref CombatStat.empty);
|
||||
planet.factory.KillEnemyFinally(i, ref CombatStat.empty);
|
||||
}
|
||||
planet.factory.enemySystem.Free();
|
||||
UIRoot.instance.uiGame.dfAssaultTip.ClearAllSpots();
|
||||
@@ -121,6 +143,7 @@ public static class PlanetFunctions
|
||||
}
|
||||
}
|
||||
|
||||
var planetId = planet.id;
|
||||
var gameScenario = GameMain.gameScenario;
|
||||
if (gameScenario != null)
|
||||
{
|
||||
@@ -131,8 +154,8 @@ public static class PlanetFunctions
|
||||
{
|
||||
if (pgc.id <= 0) continue;
|
||||
int protoId = factory.entityPool[pgc.entityId].protoId;
|
||||
gameScenario.achievementLogic.NotifyBeforeDismantleEntity(planet.id, protoId, pgc.entityId);
|
||||
gameScenario.NotifyOnDismantleEntity(planet.id, protoId, pgc.entityId);
|
||||
gameScenario.achievementLogic.NotifyBeforeDismantleEntity(planetId, protoId, pgc.entityId);
|
||||
gameScenario.NotifyOnDismantleEntity(planetId, protoId, pgc.entityId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,10 +169,23 @@ public static class PlanetFunctions
|
||||
var index = factory.index;
|
||||
var warningSystem = GameMain.data.warningSystem;
|
||||
var warningPool = warningSystem.warningPool;
|
||||
for (var i = warningSystem.warningCursor - 1; i > 0; i--)
|
||||
for (var i = warningSystem.warningCursor - 1; i >= 0; i--)
|
||||
{
|
||||
if (warningPool[i].id == i && warningPool[i].factoryId == index)
|
||||
warningSystem.RemoveWarningData(warningPool[i].id);
|
||||
ref var warning = ref warningPool[i];
|
||||
if (warning.id != i) continue;
|
||||
switch (warning.factoryId)
|
||||
{
|
||||
case -4:
|
||||
if (warning.astroId == planetId)
|
||||
warningSystem.RemoveWarningData(i);
|
||||
break;
|
||||
case >= 0:
|
||||
if (warning.factoryId == index)
|
||||
warningSystem.RemoveWarningData(i);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
var isCombatMode = factory.gameData.gameDesc.isCombatMode;
|
||||
factory.entityCursor = 1;
|
||||
|
||||
313
UXAssist/Functions/TechFunctions.cs
Normal file
313
UXAssist/Functions/TechFunctions.cs
Normal file
@@ -0,0 +1,313 @@
|
||||
namespace UXAssist.Functions;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Common;
|
||||
using UnityEngine;
|
||||
|
||||
public static class TechFunctions
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
I18N.Add("Do you want to use metadata to buyout the following tech?", "Do you want to use metadata to buyout the following tech?", "要使用元数据买断以下科技吗?");
|
||||
I18N.Add("The following is the required metadata for buyout:", "The following is the required metadata for buyout:", "以下是买断所需元数据:");
|
||||
I18N.Add("Batch buyout tech", "Batch buyout tech", "批量买断科技");
|
||||
}
|
||||
|
||||
public static void GenerateTechListWithPrerequisites(GameHistoryData history, int techId, List<int> techIdList)
|
||||
{
|
||||
var techProto = LDB.techs.Select(techId);
|
||||
if (techProto == null || !techProto.Published) return;
|
||||
var flag = true;
|
||||
for (var i = 0; i < 2; i++)
|
||||
{
|
||||
foreach (var preTechId in (i == 1 ? techProto.PreTechsImplicit : techProto.PreTechs))
|
||||
{
|
||||
if (!history.techStates.ContainsKey(preTechId) || history.techStates[preTechId].unlocked) continue;
|
||||
if (history.techStates[preTechId].maxLevel > history.techStates[preTechId].curLevel)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
GenerateTechListWithPrerequisites(history, preTechId, techIdList);
|
||||
}
|
||||
}
|
||||
if (history.techStates.ContainsKey(techId) && !history.techStates[techId].unlocked && flag)
|
||||
{
|
||||
techIdList.Add(techId);
|
||||
}
|
||||
}
|
||||
|
||||
private static void CheckTechUnlockProperties(GameHistoryData history, TechProto techProto, SortedList<int, int> properties, List<Tuple<TechProto, int, int>> techList, int maxLevel = 10000, bool withPrerequisites = true)
|
||||
{
|
||||
var techStates = history.techStates;
|
||||
var techID = techProto.ID;
|
||||
if (techStates == null || !techStates.TryGetValue(techID, out var value)) return;
|
||||
if (value.unlocked) return;
|
||||
|
||||
var maxLvl = Math.Min(maxLevel < 0 ? value.curLevel - maxLevel - 1 : maxLevel, value.maxLevel);
|
||||
if (withPrerequisites)
|
||||
{
|
||||
foreach (var preid in techProto.PreTechs)
|
||||
{
|
||||
var preProto = LDB.techs.Select(preid);
|
||||
if (preProto != null)
|
||||
CheckTechUnlockProperties(history, preProto, properties, techList, techProto.PreTechsMax ? 10000 : preProto.Level, true);
|
||||
}
|
||||
foreach (var preid in techProto.PreTechsImplicit)
|
||||
{
|
||||
var preProto = LDB.techs.Select(preid);
|
||||
if (preProto != null)
|
||||
CheckTechUnlockProperties(history, preProto, properties, techList, techProto.PreTechsMax ? 10000 : preProto.Level, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (value.curLevel < techProto.Level) value.curLevel = techProto.Level;
|
||||
techList.Add(new Tuple<TechProto, int, int>(techProto, value.curLevel, techProto.Level));
|
||||
while (value.curLevel <= maxLvl)
|
||||
{
|
||||
if (techProto.PropertyOverrideItemArray != null)
|
||||
{
|
||||
var propertyOverrideItemArray = techProto.PropertyOverrideItemArray;
|
||||
for (var i = 0; i < propertyOverrideItemArray.Length; i++)
|
||||
{
|
||||
var id = propertyOverrideItemArray[i].id;
|
||||
var count = (float)propertyOverrideItemArray[i].count;
|
||||
var ratio = Mathf.Clamp01((float)((double)value.hashUploaded / value.hashNeeded));
|
||||
var consume = Mathf.CeilToInt(count * (1f - ratio));
|
||||
if (properties.TryGetValue(id, out var existingCount))
|
||||
properties[id] = existingCount + consume;
|
||||
else
|
||||
properties.Add(id, consume);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (var i = 0; i < techProto.itemArray.Length; i++)
|
||||
{
|
||||
var id = techProto.itemArray[i].ID;
|
||||
var consume = (int)(techProto.ItemPoints[i] * (value.hashNeeded - value.hashUploaded) / 3600L);
|
||||
if (properties.TryGetValue(id, out var existingCount))
|
||||
properties[id] = existingCount + consume;
|
||||
else
|
||||
properties.Add(id, consume);
|
||||
}
|
||||
}
|
||||
value.curLevel++;
|
||||
value.hashUploaded = 0;
|
||||
value.hashNeeded = techProto.GetHashNeeded(value.curLevel);
|
||||
}
|
||||
}
|
||||
|
||||
private static int UnlockTechImpl(GameHistoryData history, TechProto techProto, int maxLevel = 10000, bool withPrerequisites = true)
|
||||
{
|
||||
var techStates = history.techStates;
|
||||
var techID = techProto.ID;
|
||||
if (techStates == null || !techStates.TryGetValue(techID, out var value))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (value.unlocked)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
var maxLvl = Math.Min(maxLevel < 0 ? value.curLevel - maxLevel - 1 : maxLevel, value.maxLevel);
|
||||
|
||||
if (withPrerequisites)
|
||||
{
|
||||
foreach (var preid in techProto.PreTechs)
|
||||
{
|
||||
var preProto = LDB.techs.Select(preid);
|
||||
if (preProto != null)
|
||||
UnlockTechImpl(history, preProto, techProto.PreTechsMax ? 10000 : preProto.Level, true);
|
||||
}
|
||||
foreach (var preid in techProto.PreTechsImplicit)
|
||||
{
|
||||
var preProto = LDB.techs.Select(preid);
|
||||
if (preProto != null)
|
||||
UnlockTechImpl(history, preProto, techProto.PreTechsMax ? 10000 : preProto.Level, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (value.curLevel < techProto.Level) value.curLevel = techProto.Level;
|
||||
while (value.curLevel <= maxLvl)
|
||||
{
|
||||
if (value.curLevel == 0)
|
||||
{
|
||||
foreach (var recipe in techProto.UnlockRecipes)
|
||||
{
|
||||
history.UnlockRecipe(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
for (var j = 0; j < techProto.UnlockFunctions.Length; j++)
|
||||
{
|
||||
history.UnlockTechFunction(techProto.UnlockFunctions[j], techProto.UnlockValues[j], value.curLevel);
|
||||
}
|
||||
|
||||
for (var k = 0; k < techProto.AddItems.Length; k++)
|
||||
{
|
||||
history.GainTechAwards(techProto.AddItems[k], techProto.AddItemCounts[k]);
|
||||
}
|
||||
|
||||
value.curLevel++;
|
||||
}
|
||||
|
||||
value.unlocked = maxLvl >= value.maxLevel;
|
||||
value.curLevel = value.unlocked ? maxLvl : maxLvl + 1;
|
||||
value.hashNeeded = techProto.GetHashNeeded(value.curLevel);
|
||||
value.hashUploaded = value.unlocked ? value.hashNeeded : 0;
|
||||
techStates[techID] = value;
|
||||
return maxLvl;
|
||||
}
|
||||
|
||||
private static bool UnlockTechImmediately(TechProto techProto, int maxLevel = 10000, bool withPrerequisites = true)
|
||||
{
|
||||
if (techProto == null) return false;
|
||||
var history = GameMain.history;
|
||||
var ulvl = UnlockTechImpl(history, techProto, maxLevel, withPrerequisites);
|
||||
if (ulvl < 0) return false;
|
||||
history.RegFeatureKey(1000100);
|
||||
history.NotifyTechUnlock(techProto.ID, ulvl);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void UnlockAllProtoWithMetadataAndPrompt()
|
||||
{
|
||||
var history = GameMain.history;
|
||||
List<TechProto> techProtos = [];
|
||||
foreach (var techProto in LDB.techs.dataArray)
|
||||
{
|
||||
if (techProto.Published && !techProto.IsObsolete && !techProto.IsHiddenTech && !history.TechUnlocked(techProto.ID) && (techProto.MaxLevel <= techProto.Level || techProto.MaxLevel <= 16) && (techProto.ID is (< 3301 or > 3309) and (< 3601 or > 3609) and (< 3901 or > 3909)) && techProto.ID != 1508)
|
||||
{
|
||||
techProtos.Add(techProto);
|
||||
}
|
||||
}
|
||||
UnlockProtoWithMetadataAndPrompt([.. techProtos], 16, false);
|
||||
}
|
||||
|
||||
public static void UnlockProtoWithMetadataAndPrompt(TechProto[] techProtos, int toLevel, bool withPrerequisites = true)
|
||||
{
|
||||
var techList = new List<Tuple<TechProto, int, int>>();
|
||||
var properties = new SortedList<int, int>();
|
||||
var history = GameMain.history;
|
||||
foreach (var techProto in techProtos)
|
||||
{
|
||||
CheckTechUnlockProperties(history, techProto, properties, techList, toLevel, withPrerequisites);
|
||||
}
|
||||
var propertySystem = DSPGame.propertySystem;
|
||||
var clusterSeedKey = history.gameData.GetClusterSeedKey();
|
||||
var enough = true;
|
||||
foreach (var consumption in properties)
|
||||
{
|
||||
if (propertySystem.GetItemAvaliableProperty(clusterSeedKey, consumption.Key) >= consumption.Value) continue;
|
||||
enough = false;
|
||||
break;
|
||||
}
|
||||
if (!enough)
|
||||
{
|
||||
UIMessageBox.Show("元数据".Translate(), "元数据不足".Translate(), "确定".Translate(), UIMessageBox.ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!history.hasUsedPropertyBanAchievement)
|
||||
{
|
||||
UIMessageBox.Show("初次使用元数据标题".Translate(), "初次使用元数据描述".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.QUESTION, null, DoUnlockCalculatedTechs);
|
||||
return;
|
||||
}
|
||||
|
||||
DoUnlockCalculatedTechs();
|
||||
return;
|
||||
|
||||
void DoUnlockCalculatedTechs()
|
||||
{
|
||||
if (techList.Count <= 1)
|
||||
{
|
||||
UnlockWithPropertiesImmediately();
|
||||
return;
|
||||
}
|
||||
var msg = "Do you want to use metadata to buyout the following tech?".Translate();
|
||||
|
||||
if (techList.Count <= 10)
|
||||
{
|
||||
foreach (var tuple in techList)
|
||||
{
|
||||
AddToMsg(ref msg, tuple);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (var i = 0; i < 5; i++)
|
||||
{
|
||||
AddToMsg(ref msg, techList[i]);
|
||||
}
|
||||
msg += "\n ...";
|
||||
for (var i = techList.Count - 5; i < techList.Count; i++)
|
||||
{
|
||||
AddToMsg(ref msg, techList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
msg += "\n\n";
|
||||
msg += "The following is the required metadata for buyout:".Translate();
|
||||
foreach (var consumption in properties)
|
||||
{
|
||||
if (consumption.Value <= 0) continue;
|
||||
msg += $"\n {LDB.items.Select(consumption.Key).propertyName}x{consumption.Value}";
|
||||
}
|
||||
UIMessageBox.Show("Batch buyout tech".Translate(), msg, "取消".Translate(), "确定".Translate(), UIMessageBox.QUESTION, null, UnlockWithPropertiesImmediately);
|
||||
return;
|
||||
|
||||
void AddToMsg(ref string str, Tuple<TechProto, int, int> tuple)
|
||||
{
|
||||
if (tuple.Item2 == tuple.Item3)
|
||||
{
|
||||
if (tuple.Item2 <= 0)
|
||||
str += $"\n {tuple.Item1.name}";
|
||||
else
|
||||
str += $"\n {tuple.Item1.name}{"杠等级".Translate()}{tuple.Item2}";
|
||||
}
|
||||
else
|
||||
str += $"\n {tuple.Item1.name}{"杠等级".Translate()}{tuple.Item2}->{tuple.Item3}";
|
||||
}
|
||||
}
|
||||
|
||||
void UnlockWithPropertiesImmediately()
|
||||
{
|
||||
var mainPlayer = GameMain.mainPlayer;
|
||||
foreach (var consumption in properties)
|
||||
{
|
||||
if (consumption.Value <= 0) continue;
|
||||
propertySystem.AddItemConsumption(clusterSeedKey, consumption.Key, consumption.Value);
|
||||
history.AddPropertyItemConsumption(consumption.Key, consumption.Value, true);
|
||||
mainPlayer.mecha.AddProductionStat(consumption.Key, consumption.Value, mainPlayer.nearestFactory);
|
||||
mainPlayer.mecha.AddConsumptionStat(consumption.Key, consumption.Value, mainPlayer.nearestFactory);
|
||||
}
|
||||
foreach (var techProto in techProtos)
|
||||
{
|
||||
UnlockTechImmediately(techProto, toLevel, withPrerequisites);
|
||||
}
|
||||
history.VerifyTechQueue();
|
||||
if (history.currentTech != history.techQueue[0])
|
||||
{
|
||||
history.currentTech = history.techQueue[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void RemoveCargoStackingTechs()
|
||||
{
|
||||
var history = GameMain.data?.history;
|
||||
if (history == null) return;
|
||||
history.inserterStackCountObsolete = 1;
|
||||
for (var id = 3301; id <= 3305; id++)
|
||||
{
|
||||
history.techStates.TryGetValue(id, out var state);
|
||||
if (!state.unlocked) continue;
|
||||
state.unlocked = false;
|
||||
state.hashUploaded = 0;
|
||||
history.techStates[id] = state;
|
||||
}
|
||||
}
|
||||
}
|
||||
722
UXAssist/Functions/UIFunctions.cs
Normal file
722
UXAssist/Functions/UIFunctions.cs
Normal file
@@ -0,0 +1,722 @@
|
||||
using CommonAPI.Systems;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using UXAssist.UI;
|
||||
using UXAssist.Common;
|
||||
using GameLogicProc = UXAssist.Common.GameLogic;
|
||||
|
||||
namespace UXAssist.Functions;
|
||||
|
||||
public static class UIFunctions
|
||||
{
|
||||
private static bool _initialized;
|
||||
private static PressKeyBind _toggleKey;
|
||||
private static bool _configWinInitialized;
|
||||
private static MyConfigWindow _configWin;
|
||||
private static GameObject _buttonOnPlanetGlobe;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
_toggleKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
||||
{
|
||||
key = new CombineKey((int)KeyCode.BackQuote, CombineKey.ALT_COMB, ECombineKeyAction.OnceClick, false),
|
||||
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
|
||||
name = "OpenUXAssistConfigWindow",
|
||||
canOverride = true
|
||||
});
|
||||
I18N.Add("KEYOpenUXAssistConfigWindow", "[UXA] Open UXAssist Config Window", "[UXA] 打开UX助手设置面板");
|
||||
|
||||
I18N.Add("Enable auto-cruise", "Enable auto-cruise", "启用自动巡航");
|
||||
I18N.Add("Disable auto-cruise", "Disable auto-cruise", "禁用自动巡航");
|
||||
I18N.Add("High yield", "High yield", "高产");
|
||||
I18N.Add("Perfect", "Perfect", "完美");
|
||||
I18N.Add("Union results", "Union results", "结果取并集");
|
||||
I18N.Add("All 6 Basic Ores", "All 6 Basic Ores", "六种基础矿物齐全");
|
||||
I18N.Add("Show original name", "Show original name", "显示原始名称");
|
||||
I18N.Add("Show distance", "Show distance", "显示距离");
|
||||
I18N.Add("Show planet count", "Show planet count", "显示行星数");
|
||||
I18N.Add("Show all information", "Show all information", "显示全部信息");
|
||||
I18N.OnInitialized += RecreateConfigWindow;
|
||||
}
|
||||
|
||||
public static void OnInputUpdate()
|
||||
{
|
||||
if (_toggleKey.keyValue)
|
||||
{
|
||||
ToggleConfigWindow();
|
||||
}
|
||||
}
|
||||
|
||||
#region ConfigWindow
|
||||
public static void ToggleConfigWindow()
|
||||
{
|
||||
if (!_configWinInitialized)
|
||||
{
|
||||
if (!I18N.Initialized()) return;
|
||||
_configWinInitialized = true;
|
||||
_configWin = MyConfigWindow.CreateInstance();
|
||||
}
|
||||
|
||||
if (_configWin.active)
|
||||
{
|
||||
_configWin._Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
_configWin.Open();
|
||||
}
|
||||
}
|
||||
|
||||
public static void InitMenuButtons()
|
||||
{
|
||||
if (_initialized) return;
|
||||
var uiRoot = UIRoot.instance;
|
||||
if (!uiRoot) return;
|
||||
{
|
||||
var mainMenu = uiRoot.uiMainMenu;
|
||||
var src = mainMenu.newGameButton;
|
||||
var parent = src.transform.parent;
|
||||
var btn = GameObject.Instantiate(src, parent);
|
||||
btn.name = "button-uxassist-config";
|
||||
var l = btn.text.GetComponent<Localizer>();
|
||||
if (l != null)
|
||||
{
|
||||
l.stringKey = "UXAssist Config";
|
||||
l.translation = "UXAssist Config".Translate();
|
||||
}
|
||||
|
||||
btn.text.text = "UXAssist Config".Translate();
|
||||
btn.text.fontSize = btn.text.fontSize * 7 / 8;
|
||||
I18N.OnInitialized += () => { btn.text.text = "UXAssist Config".Translate(); };
|
||||
var vec = ((RectTransform)mainMenu.exitButton.transform).anchoredPosition3D;
|
||||
var vec2 = ((RectTransform)mainMenu.creditsButton.transform).anchoredPosition3D;
|
||||
var transform1 = (RectTransform)btn.transform;
|
||||
transform1.anchoredPosition3D = new Vector3(vec.x, vec.y + (vec.y - vec2.y) * 2, vec.z);
|
||||
btn.button.onClick.RemoveAllListeners();
|
||||
btn.button.onClick.AddListener(Functions.UIFunctions.ToggleConfigWindow);
|
||||
}
|
||||
{
|
||||
var panel = uiRoot.uiGame.planetGlobe;
|
||||
var src = panel.button2;
|
||||
var sandboxMenu = uiRoot.uiGame.sandboxMenu;
|
||||
var icon = sandboxMenu.categoryButtons[6].transform.Find("icon")?.GetComponent<Image>()?.sprite;
|
||||
var b = GameObject.Instantiate(src, src.transform.parent);
|
||||
_buttonOnPlanetGlobe = b.gameObject;
|
||||
var rect = (RectTransform)_buttonOnPlanetGlobe.transform;
|
||||
var btn = _buttonOnPlanetGlobe.GetComponent<UIButton>();
|
||||
var img = _buttonOnPlanetGlobe.transform.Find("button-2/icon")?.GetComponent<Image>();
|
||||
if (img != null)
|
||||
{
|
||||
img.sprite = icon;
|
||||
}
|
||||
|
||||
if (_buttonOnPlanetGlobe != null && btn != null)
|
||||
{
|
||||
_buttonOnPlanetGlobe.name = "open-uxassist-config";
|
||||
rect.localScale = new Vector3(0.6f, 0.6f, 0.6f);
|
||||
rect.anchoredPosition3D = new Vector3(64f, -5f, 0f);
|
||||
b.onClick.RemoveAllListeners();
|
||||
btn.onClick += _ => { Functions.UIFunctions.ToggleConfigWindow(); };
|
||||
btn.tips.tipTitle = "UXAssist Config";
|
||||
I18N.OnInitialized += () => { btn.tips.tipTitle = "UXAssist Config".Translate(); };
|
||||
btn.tips.tipText = null;
|
||||
btn.tips.corner = 9;
|
||||
btn.tips.offset = new Vector2(-20f, -20f);
|
||||
_buttonOnPlanetGlobe.SetActive(true);
|
||||
}
|
||||
}
|
||||
InitToggleAutoCruiseCheckButton();
|
||||
InitStarmapButtons();
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
public static void RecreateConfigWindow()
|
||||
{
|
||||
if (!_configWinInitialized) return;
|
||||
var wasActive = _configWin.active;
|
||||
if (wasActive) _configWin._Close();
|
||||
MyConfigWindow.DestroyInstance(_configWin);
|
||||
_configWinInitialized = false;
|
||||
if (wasActive) ToggleConfigWindow();
|
||||
}
|
||||
|
||||
public static void UpdateGlobeButtonPosition(UIPlanetGlobe planetGlobe)
|
||||
{
|
||||
if (_buttonOnPlanetGlobe == null) return;
|
||||
var rect = (RectTransform)_buttonOnPlanetGlobe.transform;
|
||||
if (planetGlobe.dysonSphereSystemUnlocked || planetGlobe.logisticsSystemUnlocked)
|
||||
{
|
||||
rect.anchoredPosition3D = new Vector3(64f, -5f, 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
rect.anchoredPosition3D = new Vector3(128f, -100f, 0f);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ToggleAutoCruiseCheckButton
|
||||
public static UI.MyCheckButton ToggleAutoCruise;
|
||||
|
||||
public static void InitToggleAutoCruiseCheckButton()
|
||||
{
|
||||
var lowGroup = GameObject.Find("UI Root/Overlay Canvas/In Game/Low Group");
|
||||
ToggleAutoCruise = MyCheckButton.CreateCheckButton(0, 0, lowGroup.GetComponent<RectTransform>(), Patches.PlayerPatch.AutoCruiseEnabled).WithSize(120f, 40f);
|
||||
UpdateToggleAutoCruiseCheckButtonVisiblility();
|
||||
ToggleAutoCruiseChecked();
|
||||
ToggleAutoCruise.OnChecked += ToggleAutoCruiseChecked;
|
||||
var rectTrans = ToggleAutoCruise.rectTrans;
|
||||
rectTrans.anchorMax = new Vector2(0.5f, 0f);
|
||||
rectTrans.anchorMin = new Vector2(0.5f, 0f);
|
||||
rectTrans.pivot = new Vector2(0.5f, 0f);
|
||||
rectTrans.anchoredPosition3D = new Vector3(0f, 185f, 0f);
|
||||
static void ToggleAutoCruiseChecked()
|
||||
{
|
||||
if (ToggleAutoCruise.Checked)
|
||||
{
|
||||
ToggleAutoCruise.SetLabelText("Disable auto-cruise");
|
||||
}
|
||||
else
|
||||
{
|
||||
ToggleAutoCruise.SetLabelText("Enable auto-cruise");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void UpdateToggleAutoCruiseCheckButtonVisiblility()
|
||||
{
|
||||
if (ToggleAutoCruise == null) return;
|
||||
var active = Patches.PlayerPatch.AutoNavigationEnabled.Value && Patches.PlayerPatch.AutoNavigation.IndicatorAstroId > 0;
|
||||
ToggleAutoCruise.gameObject.SetActive(active);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region StarMapButtons
|
||||
private static int _cornerComboBoxIndex;
|
||||
private static string[] _starOrderNames;
|
||||
private static bool _starmapFilterInitialized;
|
||||
private static ulong[] _starmapStarFilterValues;
|
||||
private static bool _starFilterEnabled;
|
||||
public static UI.MyCheckButton StarmapFilterToggler;
|
||||
public static bool[] ShowStarName;
|
||||
|
||||
private static readonly Sprite[] PlanetIcons = [
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/07.png"),
|
||||
null,
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/09.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/10.png"),
|
||||
null,
|
||||
null,
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/13.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/14.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/15.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/16.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/17.png"),
|
||||
null,
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/19.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/20.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/21.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/22.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/23.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/24.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/25.png")
|
||||
];
|
||||
|
||||
private static readonly (int, int)[] FilterVeinIds = [(9, 0), (10, 0), (11, 0), (12, 0), (13, 0), (14, 0), (7, 0), (0, 1116), (0, 1000), (8, 1011), (0, 1120), (0, 1121)];
|
||||
private static readonly int[] FilterPlanetThemes = [16, 23, 15, 22, 25, 21, 14, 17, 19, 7, 10, 20, 24, 9, 13];
|
||||
private static readonly Dictionary<int, int> ItemToVeinBitFlagMap = new()
|
||||
{
|
||||
{1011, 8},
|
||||
{1120, 20},
|
||||
{1121, 21},
|
||||
{1116, 22},
|
||||
{1000, 23},
|
||||
};
|
||||
|
||||
public static void InitStarmapButtons()
|
||||
{
|
||||
var uiRoot = UIRoot.instance;
|
||||
if (!uiRoot) return;
|
||||
|
||||
var rect = uiRoot.uiGame.starmap.transform as RectTransform;
|
||||
var panel = new GameObject("uxassist-starmap-panel");
|
||||
var rtrans = panel.AddComponent<RectTransform>();
|
||||
panel.transform.SetParent(rect);
|
||||
rtrans.sizeDelta = new Vector2(0f, 0f);
|
||||
rtrans.localScale = new Vector3(1f, 1f, 1f);
|
||||
rtrans.anchorMax = new Vector2(1f, 1f);
|
||||
rtrans.anchorMin = new Vector2(0f, 0f);
|
||||
rtrans.pivot = new Vector2(0f, 1f);
|
||||
rtrans.anchoredPosition3D = new Vector3(0, 0, 0f);
|
||||
|
||||
var cornerComboBox = UI.MyCornerComboBox.CreateComboBox(135, 0, rtrans, true).WithItems("Show original name".Translate(), "Show distance".Translate(), "Show planet count".Translate(), "Show all information".Translate());
|
||||
cornerComboBox.SetIndex(Functions.UIFunctions.CornerComboBoxIndex);
|
||||
cornerComboBox.OnSelChanged += (index) =>
|
||||
{
|
||||
Functions.UIFunctions.CornerComboBoxIndex = index;
|
||||
};
|
||||
StarmapFilterToggler = UI.MyCheckButton.CreateCheckButton(0, 0, rtrans, false, ">>").WithSize(24, 24);
|
||||
MyCheckButton[] buttons = [
|
||||
UI.MyCheckButton.CreateCheckButton(24, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Kimberlite
|
||||
UI.MyCheckButton.CreateCheckButton(48, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Fractal Silicon
|
||||
UI.MyCheckButton.CreateCheckButton(72, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Organic Crystal
|
||||
UI.MyCheckButton.CreateCheckButton(96, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Grating Crystal
|
||||
UI.MyCheckButton.CreateCheckButton(120, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Stalagmite Crystal
|
||||
UI.MyCheckButton.CreateCheckButton(144, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Unipolar Magnet
|
||||
UI.MyCheckButton.CreateCheckButton(168, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Crude Oil
|
||||
UI.MyCheckButton.CreateCheckButton(192, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Fire Ice
|
||||
UI.MyCheckButton.CreateCheckButton(216, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Sulfuric Acid
|
||||
UI.MyCheckButton.CreateCheckButton(240, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Water
|
||||
UI.MyCheckButton.CreateCheckButton(264, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Hydrogen
|
||||
UI.MyCheckButton.CreateCheckButton(288, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Deuterium
|
||||
|
||||
UI.MyCheckButton.CreateCheckButton(24, 24, rtrans, false).WithIcon().WithSize(150, 24).WithIconWidth(24),
|
||||
UI.MyCheckButton.CreateCheckButton(24, 48, rtrans, false).WithIcon().WithSize(150, 24).WithIconWidth(24),
|
||||
UI.MyCheckButton.CreateCheckButton(24, 72, rtrans, false).WithIcon().WithSize(150, 24).WithIconWidth(24),
|
||||
UI.MyCheckButton.CreateCheckButton(24, 96, rtrans, false).WithIcon().WithSize(150, 24).WithIconWidth(24),
|
||||
UI.MyCheckButton.CreateCheckButton(24, 120, rtrans, false).WithIcon().WithSize(150, 24).WithIconWidth(24),
|
||||
UI.MyCheckButton.CreateCheckButton(24, 144, rtrans, false).WithIcon().WithSize(150, 24).WithIconWidth(24),
|
||||
UI.MyCheckButton.CreateCheckButton(24, 168, rtrans, false).WithIcon().WithSize(150, 24).WithIconWidth(24),
|
||||
|
||||
UI.MyCheckButton.CreateCheckButton(24, 210, rtrans, false).WithIcon().WithSize(150, 24).WithIconWidth(24),
|
||||
UI.MyCheckButton.CreateCheckButton(24, 234, rtrans, false).WithIcon().WithSize(150, 24).WithIconWidth(24),
|
||||
UI.MyCheckButton.CreateCheckButton(24, 258, rtrans, false).WithIcon().WithSize(150, 24).WithIconWidth(24),
|
||||
UI.MyCheckButton.CreateCheckButton(24, 282, rtrans, false).WithIcon().WithSize(150, 24).WithIconWidth(24),
|
||||
UI.MyCheckButton.CreateCheckButton(24, 306, rtrans, false).WithIcon().WithSize(150, 24).WithIconWidth(24),
|
||||
UI.MyCheckButton.CreateCheckButton(24, 330, rtrans, false).WithIcon().WithSize(150, 24).WithIconWidth(24),
|
||||
UI.MyCheckButton.CreateCheckButton(24, 354, rtrans, false).WithIcon().WithSize(150, 24).WithIconWidth(24),
|
||||
UI.MyCheckButton.CreateCheckButton(24, 378, rtrans, false).WithIcon().WithSize(150, 24).WithIconWidth(24),
|
||||
];
|
||||
var unionCheckBox = UI.MyCheckBox.CreateCheckBox(312, 0, rtrans, false, "Union results".Translate(), 15).WithSmallerBox(24f);
|
||||
unionCheckBox.gameObject.SetActive(false);
|
||||
unionCheckBox.OnChecked += () =>
|
||||
{
|
||||
UpdateStarmapStarFilters();
|
||||
};
|
||||
var allOresText = MyWindow.AddText(20, 190, rtrans, "All 6 Basic Ores".Translate(), 12);
|
||||
allOresText.gameObject.SetActive(false);
|
||||
StarmapFilterToggler.OnChecked += UpdateButtons;
|
||||
foreach (var button in buttons)
|
||||
{
|
||||
button.OnChecked += () =>
|
||||
{
|
||||
if (button.Checked && !VFInput.shift && !VFInput.control)
|
||||
{
|
||||
foreach (var b in buttons)
|
||||
{
|
||||
if (b != button) b.Checked = false;
|
||||
}
|
||||
}
|
||||
UpdateStarmapStarFilters();
|
||||
};
|
||||
}
|
||||
|
||||
I18N.OnInitialized += UpdateI18N;
|
||||
GameLogicProc.OnDataLoaded += () =>
|
||||
{
|
||||
VeinProto veinProto;
|
||||
ItemProto itemProto;
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
var (veinProtoId, itemProtoId) = FilterVeinIds[i];
|
||||
if (itemProtoId != 0)
|
||||
{
|
||||
itemProto = LDB.items.Select(itemProtoId);
|
||||
buttons[i].SetIcon(itemProto.iconSprite);
|
||||
}
|
||||
else if (veinProtoId != 0)
|
||||
{
|
||||
veinProto = LDB.veins.Select(veinProtoId);
|
||||
buttons[i].SetIcon(veinProto.iconSprite);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < FilterPlanetThemes.Length; i++)
|
||||
{
|
||||
buttons[12 + i].SetIcon(PlanetIcons[FilterPlanetThemes[i]]);
|
||||
}
|
||||
UpdateI18N();
|
||||
};
|
||||
|
||||
GameLogicProc.OnGameBegin += () =>
|
||||
{
|
||||
if (DSPGame.IsMenuDemo) return;
|
||||
|
||||
var galaxy = GameMain.data.galaxy;
|
||||
ShowStarName = new bool[galaxy.starCount];
|
||||
_starOrderNames = new string[galaxy.starCount];
|
||||
_starmapStarFilterValues = new ulong[galaxy.starCount];
|
||||
StarData[] stars = [.. galaxy.stars.Where(star => star != null)];
|
||||
Array.Sort(stars, (a, b) =>
|
||||
{
|
||||
int res = a.position.sqrMagnitude.CompareTo(b.position.sqrMagnitude);
|
||||
if (res != 0) return res;
|
||||
return a.index.CompareTo(b.index);
|
||||
});
|
||||
for (int i = 0; i < stars.Length; i++)
|
||||
{
|
||||
var star = stars[i];
|
||||
_starOrderNames[star.index] = star.displayName;
|
||||
}
|
||||
int[] spectrCount = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
for (int i = 0; i < stars.Length; i++)
|
||||
{
|
||||
var star = stars[i];
|
||||
var index = star.index;
|
||||
switch (star.type)
|
||||
{
|
||||
case EStarType.MainSeqStar:
|
||||
switch (star.spectr)
|
||||
{
|
||||
case ESpectrType.M:
|
||||
_starOrderNames[index] = String.Format("M{0}", ++spectrCount[0]);
|
||||
break;
|
||||
case ESpectrType.K:
|
||||
_starOrderNames[index] = String.Format("K{0}", ++spectrCount[1]);
|
||||
break;
|
||||
case ESpectrType.G:
|
||||
_starOrderNames[index] = String.Format("G{0}", ++spectrCount[2]);
|
||||
break;
|
||||
case ESpectrType.F:
|
||||
_starOrderNames[index] = String.Format("F{0}", ++spectrCount[3]);
|
||||
break;
|
||||
case ESpectrType.A:
|
||||
_starOrderNames[index] = String.Format("A{0}", ++spectrCount[4]);
|
||||
break;
|
||||
case ESpectrType.B:
|
||||
_starOrderNames[index] = String.Format("B{0}", ++spectrCount[5]);
|
||||
break;
|
||||
case ESpectrType.O:
|
||||
_starOrderNames[index] = String.Format("O{0}", ++spectrCount[6]);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case EStarType.GiantStar:
|
||||
_starOrderNames[index] = String.Format("GS{0}", ++spectrCount[7]);
|
||||
break;
|
||||
case EStarType.WhiteDwarf:
|
||||
_starOrderNames[index] = String.Format("WD{0}", ++spectrCount[8]);
|
||||
break;
|
||||
case EStarType.NeutronStar:
|
||||
_starOrderNames[index] = String.Format("NS{0}", ++spectrCount[9]);
|
||||
break;
|
||||
case EStarType.BlackHole:
|
||||
_starOrderNames[index] = String.Format("BH{0}", ++spectrCount[10]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
StarmapFilterToggler.gameObject.SetActive(false);
|
||||
StarmapFilterToggler.Checked = false;
|
||||
UpdateButtons();
|
||||
SetStarFilterEnabled(false);
|
||||
foreach (var star in galaxy.stars)
|
||||
{
|
||||
if (star != null) PlanetModelingManager.RequestScanStar(star);
|
||||
}
|
||||
_starmapFilterInitialized = true;
|
||||
if (PlanetModelingManager.scnPlanetReqList.Count == 0)
|
||||
{
|
||||
OnPlanetScanEnded();
|
||||
}
|
||||
};
|
||||
GameLogicProc.OnGameEnd += () =>
|
||||
{
|
||||
_starOrderNames = null;
|
||||
ShowStarName = null;
|
||||
_starmapStarFilterValues = null;
|
||||
_starmapFilterInitialized = false;
|
||||
};
|
||||
void UpdateI18N()
|
||||
{
|
||||
if (cornerComboBox != null)
|
||||
{
|
||||
var items = cornerComboBox.Items;
|
||||
cornerComboBox.UpdateLabelText();
|
||||
items[0] = "Show original name".Translate();
|
||||
items[1] = "Show distance".Translate();
|
||||
items[2] = "Show planet count".Translate();
|
||||
items[3] = "Show all information".Translate();
|
||||
}
|
||||
if (buttons != null)
|
||||
{
|
||||
VeinProto veinProto;
|
||||
ItemProto itemProto;
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
var (veinProtoId, itemProtoId) = FilterVeinIds[i];
|
||||
if (itemProtoId != 0)
|
||||
{
|
||||
itemProto = LDB.items.Select(itemProtoId);
|
||||
buttons[i].WithTip(itemProto.Name);
|
||||
}
|
||||
else if (veinProtoId != 0)
|
||||
{
|
||||
veinProto = LDB.veins.Select(veinProtoId);
|
||||
buttons[i].WithTip(veinProto.Name);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < FilterPlanetThemes.Length; i++)
|
||||
{
|
||||
var theme = FilterPlanetThemes[i];
|
||||
var themeProto = LDB.themes.Select(theme);
|
||||
switch (i)
|
||||
{
|
||||
case 5:
|
||||
buttons[12 + i].SetLabelText($"{themeProto.DisplayName.Translate()} ({"High yield".Translate()})");
|
||||
break;
|
||||
case 6:
|
||||
buttons[12 + i].SetLabelText($"{themeProto.DisplayName.Translate()} ({"Perfect".Translate()})");
|
||||
break;
|
||||
default:
|
||||
buttons[12 + i].SetLabelText(themeProto.DisplayName.Translate());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (allOresText != null) allOresText.text = "All 6 Basic Ores".Translate();
|
||||
}
|
||||
void UpdateButtons()
|
||||
{
|
||||
var chk = StarmapFilterToggler.Checked;
|
||||
foreach (var button in buttons)
|
||||
{
|
||||
if (chk)
|
||||
button.gameObject.SetActive(true);
|
||||
else
|
||||
{
|
||||
button.gameObject.SetActive(false);
|
||||
button.Checked = false;
|
||||
}
|
||||
}
|
||||
unionCheckBox.gameObject.SetActive(chk);
|
||||
allOresText.gameObject.SetActive(chk);
|
||||
StarmapFilterToggler.SetLabelText(chk ? "X" : ">>");
|
||||
if (!chk)
|
||||
{
|
||||
UpdateStarmapStarFilters();
|
||||
}
|
||||
UIRoot.instance.uiGame.dfMonitor.transform.parent.gameObject.SetActive(!chk);
|
||||
}
|
||||
void UpdateStarmapStarFilters()
|
||||
{
|
||||
var filterValue = 0UL;
|
||||
var union = unionCheckBox.Checked;
|
||||
if (StarmapFilterToggler.Checked)
|
||||
{
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
if (buttons[i].Checked)
|
||||
{
|
||||
var (veinProtoId, itemProtoId) = FilterVeinIds[i];
|
||||
if (veinProtoId != 0)
|
||||
{
|
||||
filterValue |= 1UL << veinProtoId;
|
||||
}
|
||||
else if (itemProtoId != 0)
|
||||
{
|
||||
filterValue |= 1UL << ItemToVeinBitFlagMap[itemProtoId];
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < FilterPlanetThemes.Length; i++)
|
||||
{
|
||||
if (buttons[12 + i].Checked)
|
||||
{
|
||||
filterValue |= 1UL << (30 + FilterPlanetThemes[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (filterValue == 0UL)
|
||||
{
|
||||
for (int i = 0; i < ShowStarName.Length; i++)
|
||||
{
|
||||
ShowStarName[i] = false;
|
||||
}
|
||||
SetStarFilterEnabled(false);
|
||||
return;
|
||||
}
|
||||
for (int i = _starmapStarFilterValues.Length - 1; i >= 0; i--)
|
||||
{
|
||||
ShowStarName[i] = union ? (_starmapStarFilterValues[i] & filterValue) != 0 : (_starmapStarFilterValues[i] & filterValue) == filterValue;
|
||||
}
|
||||
SetStarFilterEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnPlanetScanEnded()
|
||||
{
|
||||
if (!_starmapFilterInitialized || StarmapFilterToggler == null || StarmapFilterToggler.gameObject.activeSelf) return;
|
||||
StarmapUpdateFilterValues();
|
||||
StarmapFilterToggler.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
private static void StarmapUpdateFilterValues()
|
||||
{
|
||||
var galaxy = GameMain.data.galaxy;
|
||||
var stars = galaxy.stars;
|
||||
for (int i = 0; i < galaxy.starCount; i++)
|
||||
{
|
||||
var star = stars[i];
|
||||
if (star == null) continue;
|
||||
var value = 0UL;
|
||||
foreach (var planet in star.planets)
|
||||
{
|
||||
if (planet == null) continue;
|
||||
if (!planet.scanned)
|
||||
{
|
||||
PlanetModelingManager.RequestScanPlanet(planet);
|
||||
continue;
|
||||
}
|
||||
var planetValue = 0UL;
|
||||
if (planet.type == EPlanetType.Gas)
|
||||
{
|
||||
foreach (var n in planet.gasItems)
|
||||
{
|
||||
if (ItemToVeinBitFlagMap.TryGetValue(n, out var bitFlag))
|
||||
{
|
||||
planetValue |= 1UL << bitFlag;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (planet.runtimeVeinGroups != null)
|
||||
{
|
||||
foreach (var group in planet.runtimeVeinGroups)
|
||||
{
|
||||
if (group.amount > 0)
|
||||
{
|
||||
planetValue |= 1UL << (int)group.type;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ItemToVeinBitFlagMap.TryGetValue(planet.waterItemId, out var bitFlag))
|
||||
{
|
||||
planetValue |= 1UL << bitFlag;
|
||||
}
|
||||
}
|
||||
if ((value & (1UL << (30 + planet.theme))) == 0)
|
||||
{
|
||||
switch (planet.theme)
|
||||
{
|
||||
case 7:
|
||||
case 9:
|
||||
case 10:
|
||||
case 13:
|
||||
case 17:
|
||||
case 19:
|
||||
case 20:
|
||||
case 24:
|
||||
{
|
||||
const ulong needed = 0x7EUL;
|
||||
if ((planetValue & needed) == needed)
|
||||
{
|
||||
value |= 1UL << (30 + planet.theme);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 14:
|
||||
{
|
||||
const ulong needed = 0x2200UL;
|
||||
if ((planetValue & needed) == needed)
|
||||
{
|
||||
value |= 1UL << (30 + planet.theme);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 15:
|
||||
case 16:
|
||||
case 21:
|
||||
case 22:
|
||||
case 23:
|
||||
case 25:
|
||||
value |= 1UL << (30 + planet.theme);
|
||||
break;
|
||||
}
|
||||
}
|
||||
value |= planetValue;
|
||||
}
|
||||
_starmapStarFilterValues[i] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static int CornerComboBoxIndex
|
||||
{
|
||||
get => _cornerComboBoxIndex;
|
||||
set
|
||||
{
|
||||
_cornerComboBoxIndex = value;
|
||||
Patches.PlayerPatch.ShortcutKeysForStarsName.ForceShowAllStarsNameExternal = _cornerComboBoxIndex != 0 && !_starFilterEnabled;
|
||||
UpdateStarmapStarNames();
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetStarFilterEnabled(bool enabled)
|
||||
{
|
||||
if (_starFilterEnabled == enabled) return;
|
||||
_starFilterEnabled = enabled;
|
||||
if (!enabled) Patches.PlayerPatch.ShortcutKeysForStarsName.ShowAllStarsNameStatus = 0;
|
||||
Patches.PlayerPatch.ShortcutKeysForStarsName.ForceShowAllStarsNameExternal = _cornerComboBoxIndex != 0 && !_starFilterEnabled;
|
||||
UpdateStarmapStarNames();
|
||||
}
|
||||
|
||||
private static void UpdateStarmapStarNames()
|
||||
{
|
||||
foreach (var starUI in UIRoot.instance.uiGame.starmap.starUIs)
|
||||
{
|
||||
var star = starUI?.star;
|
||||
if (star == null) continue;
|
||||
switch (_cornerComboBoxIndex)
|
||||
{
|
||||
case 1:
|
||||
starUI.nameText.text = String.Format("{0:00}-{1}-{2:0.00}", star.index + 1, _starOrderNames[star.index], GetStarDist(star));
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
var (nongas, total) = GetStarPlanetCount(star);
|
||||
starUI.nameText.text = String.Format("{0:00}-{1}-{2}-{3}", star.index + 1, _starOrderNames[star.index], nongas, total);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
var (nongas, total) = GetStarPlanetCount(star);
|
||||
starUI.nameText.text = String.Format("{0:00}-{1}-{2:0.00}-{3}-{4}", star.index + 1, _starOrderNames[star.index], GetStarDist(star), nongas, total);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
starUI.nameText.text = star.displayName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
double GetStarDist(StarData star)
|
||||
{
|
||||
return star.position.magnitude;
|
||||
}
|
||||
|
||||
(int, int) GetStarPlanetCount(StarData star)
|
||||
{
|
||||
int total = 0;
|
||||
int nongas = 0;
|
||||
foreach (var planet in star.planets)
|
||||
{
|
||||
if (planet == null) continue;
|
||||
if (planet.type != EPlanetType.Gas) nongas++;
|
||||
total++;
|
||||
}
|
||||
return (nongas, total);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -1,14 +1,13 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using BepInEx.Configuration;
|
||||
using UnityEngine;
|
||||
using UXAssist.Common;
|
||||
using UXAssist.Patches;
|
||||
|
||||
namespace UXAssist.Functions;
|
||||
|
||||
public static class WindowFunctions
|
||||
{
|
||||
private static bool _initialized;
|
||||
public static string ProfileName { get; private set; }
|
||||
|
||||
private const string GameWindowClass = "UnityWndClass";
|
||||
@@ -17,11 +16,7 @@ public static class WindowFunctions
|
||||
private static IntPtr _oldWndProc = IntPtr.Zero;
|
||||
private static IntPtr _gameWindowHandle = IntPtr.Zero;
|
||||
|
||||
private static bool _gameLoaded;
|
||||
public static WinApi.LogicalProcessorDetails ProcessorDetails { get; private set; }
|
||||
|
||||
public static ConfigEntry<int> ProcessPriority;
|
||||
public static ConfigEntry<int> ProcessAffinity;
|
||||
|
||||
private static readonly int[] ProrityFlags =
|
||||
[
|
||||
@@ -34,18 +29,13 @@ public static class WindowFunctions
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
I18N.Add("Cores: {0}\nThreads: {1}", "Cores: {0}\nThreads: {1}", "核心数: {0}\n线程数: {1}");
|
||||
I18N.Add("\nP-Cores: {0}\nE-Cores: {1}", "\nP-Cores: {0}\nE-Cores: {1}", "\n性能核心: {0}\n能效核心: {1}");
|
||||
I18N.Add("\nPriority: {0}", "\nProcess priority: {0}", "\n进程优先级: {0}");
|
||||
I18N.Add("\nEnabled CPUs: ", "\nEnabled CPUs: ", "\n使用的CPU: ");
|
||||
I18N.Add("Unknown", "Unknown", "未知");
|
||||
ProcessorDetails = WinApi.GetLogicalProcessorDetails();
|
||||
if (_initialized) return;
|
||||
_initialized = true;
|
||||
SetWindowTitle();
|
||||
}
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
GameLogic.OnDataLoaded += OnDataLoaded;
|
||||
var wndProc = new WinApi.WndProc(GameWndProc);
|
||||
var gameWnd = FindGameWindow();
|
||||
if (gameWnd != IntPtr.Zero)
|
||||
@@ -53,52 +43,8 @@ public static class WindowFunctions
|
||||
_oldWndProc = WinApi.SetWindowLongPtr(gameWnd, WinApi.GWLP_WNDPROC, Marshal.GetFunctionPointerForDelegate(wndProc));
|
||||
}
|
||||
|
||||
if (GamePatch.LoadLastWindowRectEnabled.Value)
|
||||
GamePatch.LoadLastWindowRect.MoveWindowPosition(true);
|
||||
|
||||
ProcessPriority.SettingChanged += (_, _) => WinApi.SetPriorityClass(WinApi.GetCurrentProcess(), ProrityFlags[ProcessPriority.Value]);
|
||||
WinApi.SetPriorityClass(WinApi.GetCurrentProcess(), ProrityFlags[ProcessPriority.Value]);
|
||||
ProcessAffinity.SettingChanged += (_, _) => UpdateAffinity();
|
||||
UpdateAffinity();
|
||||
return;
|
||||
|
||||
void UpdateAffinity()
|
||||
{
|
||||
var process = WinApi.GetCurrentProcess();
|
||||
if (!WinApi.GetProcessAffinityMask(process, out _, out var systemMask))
|
||||
{
|
||||
systemMask = ulong.MaxValue;
|
||||
}
|
||||
|
||||
switch (ProcessAffinity.Value)
|
||||
{
|
||||
case 0:
|
||||
WinApi.SetProcessAffinityMask(process, systemMask);
|
||||
break;
|
||||
case 1:
|
||||
WinApi.SetProcessAffinityMask(process, systemMask & ((1UL << (ProcessorDetails.ThreadCount / 2)) - 1UL));
|
||||
break;
|
||||
case 2:
|
||||
WinApi.SetProcessAffinityMask(process, systemMask & (ProcessorDetails.ThreadCount > 16 ? 0xFFUL : 1UL));
|
||||
break;
|
||||
case 3:
|
||||
WinApi.SetProcessAffinityMask(process, systemMask & ProcessorDetails.PerformanceCoreMask);
|
||||
break;
|
||||
case 4:
|
||||
WinApi.SetProcessAffinityMask(process, systemMask & ProcessorDetails.EfficiencyCoreMask);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Uninit()
|
||||
{
|
||||
GameLogic.OnDataLoaded -= OnDataLoaded;
|
||||
}
|
||||
|
||||
private static void OnDataLoaded()
|
||||
{
|
||||
_gameLoaded = true;
|
||||
}
|
||||
|
||||
private static IntPtr GameWndProc(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam)
|
||||
@@ -113,42 +59,6 @@ public static class WindowFunctions
|
||||
{
|
||||
WinApi.SetWindowLongPtr(_gameWindowHandle, WinApi.GWLP_WNDPROC, _oldWndProc);
|
||||
}
|
||||
|
||||
break;
|
||||
case WinApi.WM_SYSCOMMAND:
|
||||
switch ((long)wParam & 0xFFF0L)
|
||||
{
|
||||
case WinApi.SC_MOVE:
|
||||
if (GamePatch.LoadLastWindowRectEnabled.Value && !_gameLoaded) return (IntPtr)1L;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case WinApi.WM_MOVING:
|
||||
if (!GamePatch.LoadLastWindowRectEnabled.Value || _gameLoaded) break;
|
||||
var rect = GamePatch.LastWindowRect.Value;
|
||||
if (rect is { z: 0f, w: 0f }) break;
|
||||
var x = Mathf.RoundToInt(rect.x);
|
||||
var y = Mathf.RoundToInt(rect.y);
|
||||
var rect2 = Marshal.PtrToStructure<WinApi.Rect>(lParam);
|
||||
rect2.Left = x;
|
||||
rect2.Top = y;
|
||||
Marshal.StructureToPtr(rect2, lParam, false);
|
||||
break;
|
||||
case WinApi.WM_SIZING:
|
||||
if (!GamePatch.LoadLastWindowRectEnabled.Value || _gameLoaded) break;
|
||||
rect = GamePatch.LastWindowRect.Value;
|
||||
if (rect is { z: 0f, w: 0f }) break;
|
||||
x = Mathf.RoundToInt(rect.x);
|
||||
y = Mathf.RoundToInt(rect.y);
|
||||
var w = Mathf.RoundToInt(rect.z);
|
||||
var h = Mathf.RoundToInt(rect.w);
|
||||
rect2 = Marshal.PtrToStructure<WinApi.Rect>(lParam);
|
||||
rect2.Left = x;
|
||||
rect2.Top = y;
|
||||
rect2.Right = x + w;
|
||||
rect2.Bottom = y + h;
|
||||
Marshal.StructureToPtr(rect2, lParam, false);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -168,71 +78,36 @@ public static class WindowFunctions
|
||||
};
|
||||
}
|
||||
|
||||
public static void ShowCPUInfo()
|
||||
{
|
||||
var details = ProcessorDetails;
|
||||
var msg = string.Format("Cores: {0}\nThreads: {1}".Translate(), details.CoreCount, details.ThreadCount);
|
||||
var hybrid = details.HybridArchitecture;
|
||||
if (hybrid)
|
||||
{
|
||||
msg += string.Format("\nP-Cores: {0}\nE-Cores: {1}".Translate(), details.PerformanceCoreCount, details.EfficiencyCoreCount);
|
||||
}
|
||||
|
||||
var handle = WinApi.GetCurrentProcess();
|
||||
var prio = GetPriorityName(WinApi.GetPriorityClass(handle));
|
||||
msg += string.Format("\nPriority: {0}".Translate(), prio);
|
||||
|
||||
var aff = 0UL;
|
||||
if (WinApi.GetProcessAffinityMask(handle, out var processMask, out var systemMask))
|
||||
aff = processMask & systemMask;
|
||||
|
||||
msg += "\nEnabled CPUs: ".Translate();
|
||||
var first = true;
|
||||
for (var i = 0; aff != 0UL; i++)
|
||||
{
|
||||
if ((aff & 1UL) != 0)
|
||||
{
|
||||
if (first)
|
||||
first = false;
|
||||
else
|
||||
msg += ",";
|
||||
msg += i;
|
||||
if (hybrid)
|
||||
{
|
||||
if ((details.PerformanceCoreMask & (1UL << i)) != 0)
|
||||
msg += "(P)";
|
||||
else if ((details.EfficiencyCoreMask & (1UL << i)) != 0)
|
||||
msg += "(E)";
|
||||
}
|
||||
}
|
||||
|
||||
aff >>= 1;
|
||||
}
|
||||
|
||||
UIMessageBox.Show("CPU Info".Translate(), msg, "确定".Translate(), -1);
|
||||
}
|
||||
|
||||
public static void SetWindowTitle()
|
||||
{
|
||||
// Get profile name from command line arguments, and set window title accordingly
|
||||
var args = Environment.GetCommandLineArgs();
|
||||
for (var i = 0; i < args.Length - 1; i++)
|
||||
for (var i = args.Length - 2; i >= 0; i--)
|
||||
{
|
||||
if (args[i] != "--doorstop-target") continue;
|
||||
var arg = args[i + 1];
|
||||
const string doorstopPathSuffix = @"\BepInEx\core\BepInEx.Preloader.dll";
|
||||
if (!arg.EndsWith(doorstopPathSuffix, StringComparison.OrdinalIgnoreCase))
|
||||
break;
|
||||
arg = arg.Substring(0, arg.Length - doorstopPathSuffix.Length);
|
||||
const string profileSuffix = @"\profiles\";
|
||||
var index = arg.LastIndexOf(profileSuffix, StringComparison.OrdinalIgnoreCase);
|
||||
if (index < 0)
|
||||
break;
|
||||
arg = arg.Substring(index + profileSuffix.Length);
|
||||
if (args[i] == "--gale-profile")
|
||||
{
|
||||
// We use gale profile name directly
|
||||
ProfileName = args[i + 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Doorstop 3.x and 4.x use different arguments to pass the target assembly path
|
||||
if (args[i] != "--doorstop-target" && args[i] != "--doorstop-target-assembly") continue;
|
||||
var arg = args[i + 1];
|
||||
const string doorstopPathSuffix = @"\BepInEx\core\BepInEx.Preloader.dll";
|
||||
if (!arg.EndsWith(doorstopPathSuffix, StringComparison.OrdinalIgnoreCase))
|
||||
break;
|
||||
arg = arg.Substring(0, arg.Length - doorstopPathSuffix.Length);
|
||||
const string profileSuffix = @"\profiles\";
|
||||
var index = arg.LastIndexOf(profileSuffix, StringComparison.OrdinalIgnoreCase);
|
||||
if (index < 0)
|
||||
break;
|
||||
arg = arg.Substring(index + profileSuffix.Length);
|
||||
ProfileName = arg;
|
||||
}
|
||||
var wnd = FindGameWindow();
|
||||
if (wnd == IntPtr.Zero) return;
|
||||
ProfileName = arg;
|
||||
_gameWindowTitle = $"Dyson Sphere Program - {arg}";
|
||||
_gameWindowTitle = $"Dyson Sphere Program - {ProfileName}";
|
||||
WinApi.SetWindowText(wnd, _gameWindowTitle);
|
||||
break;
|
||||
}
|
||||
|
||||
23
UXAssist/ModsCompat/PlanetVeinUtilization.cs
Normal file
23
UXAssist/ModsCompat/PlanetVeinUtilization.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using HarmonyLib;
|
||||
|
||||
namespace UXAssist.ModsCompat;
|
||||
|
||||
class PlanetVeinUtilization
|
||||
{
|
||||
public const string PlanetVeinUtilizationGuid = "testpostpleaseignore.dsp.planet_vein_utilization";
|
||||
|
||||
public static bool Run(Harmony harmony)
|
||||
{
|
||||
if (!BepInEx.Bootstrap.Chainloader.PluginInfos.TryGetValue(PlanetVeinUtilizationGuid, out var pluginInfo)) return false;
|
||||
var assembly = pluginInfo.Instance.GetType().Assembly;
|
||||
var classType = assembly.GetType("PlanetVeinUtilization.PlanetVeinUtilization");
|
||||
harmony.Patch(AccessTools.Method(classType, "Awake"),
|
||||
new HarmonyMethod(typeof(PlanetVeinUtilization).GetMethod("PatchPlanetVeinUtilizationAwake")));
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool PatchPlanetVeinUtilizationAwake()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,11 @@ using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
using UnityEngine.UI;
|
||||
using UXAssist.Common;
|
||||
using GameLogicProc = UXAssist.Common.GameLogic;
|
||||
|
||||
namespace UXAssist.Patches;
|
||||
|
||||
public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
|
||||
{
|
||||
public static ConfigEntry<bool> StopEjectOnNodeCompleteEnabled;
|
||||
public static ConfigEntry<bool> OnlyConstructNodesEnabled;
|
||||
@@ -173,7 +174,7 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
{
|
||||
lock (productRegister)
|
||||
{
|
||||
productRegister[11902] += todoCount - count;
|
||||
productRegister[ProductionStatistics.DYSON_STRUCTURE_ID] += todoCount - count;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,8 +214,8 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
{
|
||||
lock (productRegister)
|
||||
{
|
||||
productRegister[11901] += solarSailCount;
|
||||
productRegister[11903] += solarSailCount;
|
||||
productRegister[ProductionStatistics.SOLAR_SAIL_ID] += solarSailCount;
|
||||
productRegister[ProductionStatistics.DYSON_CELL_ID] += solarSailCount;
|
||||
}
|
||||
}
|
||||
var consumeRegister = __instance.consumeRegister;
|
||||
@@ -222,7 +223,7 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
{
|
||||
lock (consumeRegister)
|
||||
{
|
||||
consumeRegister[11901] += solarSailCount;
|
||||
consumeRegister[ProductionStatistics.SOLAR_SAIL_ID] += solarSailCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -260,7 +261,7 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
private class StopEjectOnNodeComplete: PatchImpl<StopEjectOnNodeComplete>
|
||||
private class StopEjectOnNodeComplete : PatchImpl<StopEjectOnNodeComplete>
|
||||
{
|
||||
private static HashSet<int>[] _nodeForAbsorb;
|
||||
private static bool _initialized;
|
||||
@@ -268,14 +269,14 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
protected override void OnEnable()
|
||||
{
|
||||
InitNodeForAbsorb();
|
||||
GameLogic.OnGameBegin += GameMain_Begin_Postfix;
|
||||
GameLogic.OnGameEnd += GameMain_End_Postfix;
|
||||
GameLogicProc.OnGameBegin += GameMain_Begin_Postfix;
|
||||
GameLogicProc.OnGameEnd += GameMain_End_Postfix;
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
GameLogic.OnGameEnd -= GameMain_End_Postfix;
|
||||
GameLogic.OnGameBegin -= GameMain_Begin_Postfix;
|
||||
GameLogicProc.OnGameEnd -= GameMain_End_Postfix;
|
||||
GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix;
|
||||
_initialized = false;
|
||||
_nodeForAbsorb = null;
|
||||
}
|
||||
@@ -389,20 +390,36 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchForward(false,
|
||||
// if (this.orbitId == 0
|
||||
// if (this.runtimeOrbitId == 0
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(EjectorComponent), nameof(EjectorComponent.orbitId))),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(EjectorComponent), nameof(EjectorComponent.runtimeOrbitId))),
|
||||
new CodeMatch(OpCodes.Brtrue)
|
||||
).Advance(2).Insert(
|
||||
).Advance(2).InsertAndAdvance(
|
||||
// || !StopEjectOnNodeComplete.AnyNodeForAbsorb(this.starData.index))
|
||||
new CodeInstruction(OpCodes.Ldc_I4_0),
|
||||
new CodeInstruction(OpCodes.Cgt),
|
||||
new CodeInstruction(OpCodes.Ldarg_2),
|
||||
new CodeInstruction(OpCodes.Ldarg_3),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(DysonSwarm), nameof(DysonSwarm.starData))),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(StarData), nameof(StarData.index))),
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(StopEjectOnNodeComplete), nameof(AnyNodeForAbsorb))),
|
||||
new CodeInstruction(OpCodes.And)
|
||||
);
|
||||
|
||||
// Do not search for next orbit if runtimeOrbitId is not 0 (which means nodes are completed)
|
||||
Label? jmpTarget = null;
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(EjectorComponent), nameof(EjectorComponent.autoOrbit))),
|
||||
new CodeMatch(ci => ci.Branches(out jmpTarget))
|
||||
);
|
||||
if (jmpTarget == null) return matcher.InstructionEnumeration();
|
||||
var labels = matcher.Labels;
|
||||
matcher.Labels = null;
|
||||
matcher.Insert(
|
||||
new CodeInstruction(OpCodes.Ldarg_0).WithLabels(labels),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(EjectorComponent), nameof(EjectorComponent.runtimeOrbitId))),
|
||||
new CodeInstruction(OpCodes.Brtrue, jmpTarget.Value)
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
@@ -475,13 +492,13 @@ public class DysonSpherePatch: PatchImpl<DysonSpherePatch>
|
||||
}
|
||||
|
||||
[PatchSetCallbackFlag(PatchCallbackFlag.CallOnDisableAfterUnpatch)]
|
||||
private class OnlyConstructNodes: PatchImpl<OnlyConstructNodes>
|
||||
private class OnlyConstructNodes : PatchImpl<OnlyConstructNodes>
|
||||
{
|
||||
protected override void OnEnable()
|
||||
{
|
||||
RecheckDysonSphereAutoNodes();
|
||||
}
|
||||
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
RecheckDysonSphereAutoNodes();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,10 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection.Emit;
|
||||
using System.Xml;
|
||||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using CommonAPI.Systems;
|
||||
using HarmonyLib;
|
||||
@@ -16,12 +19,11 @@ public class GamePatch : PatchImpl<GamePatch>
|
||||
public static ConfigEntry<bool> EnableWindowResizeEnabled;
|
||||
public static ConfigEntry<bool> LoadLastWindowRectEnabled;
|
||||
|
||||
public static ConfigEntry<int> MouseCursorScaleUpMultiplier;
|
||||
|
||||
// public static ConfigEntry<bool> AutoSaveOptEnabled;
|
||||
public static ConfigEntry<bool> ConvertSavesFromPeaceEnabled;
|
||||
public static ConfigEntry<Vector4> LastWindowRect;
|
||||
public static ConfigEntry<bool> ProfileBasedSaveFolderEnabled;
|
||||
public static ConfigEntry<bool> ProfileBasedOptionEnabled;
|
||||
public static ConfigEntry<string> DefaultProfileName;
|
||||
public static ConfigEntry<double> GameUpsFactor;
|
||||
|
||||
@@ -56,35 +58,37 @@ public class GamePatch : PatchImpl<GamePatch>
|
||||
public static void Init()
|
||||
{
|
||||
_speedDownKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
||||
{
|
||||
key = new CombineKey((int)KeyCode.Minus, CombineKey.CTRL_COMB, ECombineKeyAction.OnceClick, false),
|
||||
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
|
||||
name = "UPSSpeedDown",
|
||||
canOverride = true
|
||||
}
|
||||
{
|
||||
key = new CombineKey((int)KeyCode.Minus, CombineKey.CTRL_COMB, ECombineKeyAction.OnceClick, false),
|
||||
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
|
||||
name = "UPSSpeedDown",
|
||||
canOverride = true
|
||||
}
|
||||
);
|
||||
I18N.Add("KEYUPSSpeedDown", "Decrease logical frame rate", "降低逻辑帧率");
|
||||
I18N.Add("KEYUPSSpeedDown", "[UXA] Decrease logical frame rate", "[UXA] 降低逻辑帧率");
|
||||
_speedUpKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
||||
{
|
||||
key = new CombineKey((int)KeyCode.Equals, CombineKey.CTRL_COMB, ECombineKeyAction.OnceClick, false),
|
||||
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.UI | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
|
||||
name = "UPSSpeedUp",
|
||||
canOverride = true
|
||||
}
|
||||
{
|
||||
key = new CombineKey((int)KeyCode.Equals, CombineKey.CTRL_COMB, ECombineKeyAction.OnceClick, false),
|
||||
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.UI | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
|
||||
name = "UPSSpeedUp",
|
||||
canOverride = true
|
||||
}
|
||||
);
|
||||
I18N.Add("KEYUPSSpeedUp", "Increase logical frame rate", "提升逻辑帧率");
|
||||
I18N.Add("Logical frame rate: {0}x", "Logical frame rate: {0}x", "逻辑帧速率: {0}x");
|
||||
I18N.Add("KEYUPSSpeedUp", "[UXA] Increase logical frame rate", "[UXA] 提升逻辑帧率");
|
||||
I18N.Add("Logical frame rate: {0}x", "[UXA] Logical frame rate: {0}x", "[UXA] 逻辑帧速率: {0}x");
|
||||
|
||||
EnableWindowResizeEnabled.SettingChanged += (_, _) => EnableWindowResize.Enable(EnableWindowResizeEnabled.Value);
|
||||
LoadLastWindowRectEnabled.SettingChanged += (_, _) => LoadLastWindowRect.Enable(LoadLastWindowRectEnabled.Value);
|
||||
MouseCursorScaleUpMultiplier.SettingChanged += (_, _) =>
|
||||
LoadLastWindowRectEnabled.SettingChanged += (_, _) =>
|
||||
{
|
||||
MouseCursorScaleUp.NeedReloadCursors = true;
|
||||
MouseCursorScaleUp.Enable(MouseCursorScaleUpMultiplier.Value > 1);
|
||||
if (LoadLastWindowRectEnabled.Value)
|
||||
{
|
||||
FixLastWindowRect();
|
||||
}
|
||||
};
|
||||
// AutoSaveOptEnabled.SettingChanged += (_, _) => AutoSaveOpt.Enable(AutoSaveOptEnabled.Value);
|
||||
ConvertSavesFromPeaceEnabled.SettingChanged += (_, _) => ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value);
|
||||
ProfileBasedSaveFolderEnabled.SettingChanged += (_, _) => RefreshSavePath();
|
||||
ProfileBasedOptionEnabled.SettingChanged += (_, _) => ProfileBasedOption.Enable(ProfileBasedOptionEnabled.Value);
|
||||
DefaultProfileName.SettingChanged += (_, _) => RefreshSavePath();
|
||||
GameUpsFactor.SettingChanged += (_, _) =>
|
||||
{
|
||||
@@ -97,31 +101,37 @@ public class GamePatch : PatchImpl<GamePatch>
|
||||
|
||||
FPSController.SetFixUPS(GameMain.tickPerSec * GameUpsFactor.Value);
|
||||
};
|
||||
ProfileBasedOption.Enable(ProfileBasedOptionEnabled.Value);
|
||||
}
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
if (LoadLastWindowRectEnabled.Value)
|
||||
{
|
||||
FixLastWindowRect();
|
||||
var wnd = WindowFunctions.FindGameWindow();
|
||||
if (wnd != IntPtr.Zero)
|
||||
{
|
||||
ThreadingHelper.Instance.StartCoroutine(SetWindowPositionCoroutine(wnd, (int)LastWindowRect.Value.x, (int)LastWindowRect.Value.y));
|
||||
}
|
||||
}
|
||||
EnableWindowResize.Enable(EnableWindowResizeEnabled.Value);
|
||||
LoadLastWindowRect.Enable(LoadLastWindowRectEnabled.Value);
|
||||
MouseCursorScaleUp.NeedReloadCursors = false;
|
||||
MouseCursorScaleUp.Enable(MouseCursorScaleUpMultiplier.Value > 1);
|
||||
// AutoSaveOpt.Enable(AutoSaveOptEnabled.Value);
|
||||
ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value);
|
||||
Enable(true);
|
||||
|
||||
RefreshSavePath();
|
||||
}
|
||||
|
||||
public static void Uninit()
|
||||
{
|
||||
Enable(false);
|
||||
LoadLastWindowRect.Enable(false);
|
||||
EnableWindowResize.Enable(false);
|
||||
MouseCursorScaleUp.NeedReloadCursors = false;
|
||||
MouseCursorScaleUp.Enable(false);
|
||||
// AutoSaveOpt.Enable(false);
|
||||
ConvertSavesFromPeace.Enable(false);
|
||||
}
|
||||
|
||||
public static void OnUpdate()
|
||||
public static void OnInputUpdate()
|
||||
{
|
||||
if (!_enableGameUpsFactor) return;
|
||||
if (_speedDownKey.keyValue)
|
||||
@@ -137,41 +147,128 @@ public class GamePatch : PatchImpl<GamePatch>
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPriority(Priority.First)]
|
||||
[HarmonyPatch(typeof(GameConfig), nameof(GameConfig.gameSaveFolder), MethodType.Getter)]
|
||||
public static void GameConfig_gameSaveFolder_Postfix(ref string __result)
|
||||
{
|
||||
if (!ProfileBasedSaveFolderEnabled.Value || string.IsNullOrEmpty(WindowFunctions.ProfileName)) return;
|
||||
__result = $"{__result}{WindowFunctions.ProfileName}/";
|
||||
}
|
||||
|
||||
private static void RefreshSavePath()
|
||||
{
|
||||
var profileName = WindowFunctions.ProfileName;
|
||||
if (profileName == null) return;
|
||||
|
||||
if (UIRoot.instance.loadGameWindow.gameObject.activeSelf)
|
||||
{
|
||||
UIRoot.instance.loadGameWindow._Close();
|
||||
}
|
||||
|
||||
if (UIRoot.instance.saveGameWindow.gameObject.activeSelf)
|
||||
{
|
||||
UIRoot.instance.saveGameWindow._Close();
|
||||
}
|
||||
|
||||
string gameSavePath;
|
||||
if (ProfileBasedSaveFolderEnabled.Value && string.Compare(DefaultProfileName.Value, profileName, StringComparison.OrdinalIgnoreCase) != 0)
|
||||
gameSavePath = $"{GameConfig.overrideDocumentFolder}{GameConfig.gameName}/Save/{profileName}/";
|
||||
else
|
||||
gameSavePath = $"{GameConfig.overrideDocumentFolder}{GameConfig.gameName}/Save/";
|
||||
if (string.Compare(GameConfig.gameSavePath, gameSavePath, StringComparison.OrdinalIgnoreCase) == 0) return;
|
||||
GameConfig.gameSavePath = gameSavePath;
|
||||
if (!Directory.Exists(GameConfig.gameSavePath))
|
||||
{
|
||||
Directory.CreateDirectory(GameConfig.gameSavePath);
|
||||
}
|
||||
var gameSaveFolder = GameConfig.gameSaveFolder;
|
||||
if (!Directory.Exists(gameSaveFolder))
|
||||
Directory.CreateDirectory(gameSaveFolder);
|
||||
if (UIRoot.instance?.loadGameWindow?.active == true) UIRoot.instance.loadGameWindow.RefreshList();
|
||||
if (UIRoot.instance?.saveGameWindow?.active == true) UIRoot.instance.saveGameWindow.RefreshList();
|
||||
}
|
||||
|
||||
[HarmonyPrefix, HarmonyPatch(typeof(GameMain), nameof(GameMain.HandleApplicationQuit))]
|
||||
private static void GameMain_HandleApplicationQuit_Prefix()
|
||||
{
|
||||
if (!LoadLastWindowRectEnabled.Value) return;
|
||||
var wnd = WindowFunctions.FindGameWindow();
|
||||
if (wnd == IntPtr.Zero) return;
|
||||
WinApi.GetWindowRect(wnd, out var rect);
|
||||
LastWindowRect.Value = new Vector4(rect.Left < 20 - Screen.width ? 0 : rect.Left, rect.Top < 20 - Screen.height ? 0 : rect.Top, Screen.width, Screen.height);
|
||||
LastWindowRect.Value = new Vector4(rect.Left, rect.Top, Screen.width, Screen.height);
|
||||
}
|
||||
private static void FixLastWindowRect()
|
||||
{
|
||||
if (Screen.fullScreenMode is not (FullScreenMode.ExclusiveFullScreen or FullScreenMode.FullScreenWindow or FullScreenMode.MaximizedWindow))
|
||||
{
|
||||
var rect = LastWindowRect.Value;
|
||||
var x = Mathf.RoundToInt(rect.x);
|
||||
var y = Mathf.RoundToInt(rect.y);
|
||||
var w = Mathf.RoundToInt(rect.z);
|
||||
var h = Mathf.RoundToInt(rect.w);
|
||||
var needFix = false;
|
||||
if (w < 100)
|
||||
{
|
||||
w = 1280;
|
||||
needFix = true;
|
||||
}
|
||||
|
||||
if (h < 100)
|
||||
{
|
||||
h = 720;
|
||||
needFix = true;
|
||||
}
|
||||
|
||||
var rc = new WinApi.Rect { Left = x, Top = y, Right = x + w, Bottom = y + h };
|
||||
if (WinApi.MonitorFromRect(ref rc, 0) == IntPtr.Zero)
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
w = 1280;
|
||||
h = 720;
|
||||
needFix = true;
|
||||
}
|
||||
if (needFix)
|
||||
{
|
||||
LastWindowRect.Value = new Vector4(x, y, w, h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerator SetWindowPositionCoroutine(IntPtr wnd, int x, int y)
|
||||
{
|
||||
yield return new WaitForEndOfFrame();
|
||||
yield return new WaitForEndOfFrame();
|
||||
WinApi.SetWindowPos(wnd, IntPtr.Zero, x, y, 0, 0, 0x0235);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(Screen), nameof(Screen.SetResolution), typeof(int), typeof(int), typeof(FullScreenMode), typeof(RefreshRate))]
|
||||
private static void Screen_SetResolution_Prefix(ref int width, ref int height, FullScreenMode fullscreenMode, ref Vector2Int __state)
|
||||
{
|
||||
if (fullscreenMode is FullScreenMode.ExclusiveFullScreen or FullScreenMode.FullScreenWindow or FullScreenMode.MaximizedWindow) return;
|
||||
if (GameMain.isRunning)
|
||||
{
|
||||
var wnd = WindowFunctions.FindGameWindow();
|
||||
if (wnd == IntPtr.Zero) return;
|
||||
WinApi.GetWindowRect(wnd, out var rc);
|
||||
__state = new Vector2Int(rc.Left, rc.Top);
|
||||
return;
|
||||
}
|
||||
else if (!LoadLastWindowRectEnabled.Value) return;
|
||||
int x = 0, y = 0, w = 0, h = 0;
|
||||
var rect = LastWindowRect.Value;
|
||||
if (rect is not { z: 0f, w: 0f })
|
||||
{
|
||||
x = Mathf.RoundToInt(rect.x);
|
||||
y = Mathf.RoundToInt(rect.y);
|
||||
w = Mathf.RoundToInt(rect.z);
|
||||
h = Mathf.RoundToInt(rect.w);
|
||||
}
|
||||
width = w;
|
||||
height = h;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(Screen), nameof(Screen.SetResolution), typeof(int), typeof(int), typeof(FullScreenMode), typeof(RefreshRate))]
|
||||
private static void Screen_SetResolution_Postfix(FullScreenMode fullscreenMode, Vector2Int __state)
|
||||
{
|
||||
if (fullscreenMode is FullScreenMode.ExclusiveFullScreen or FullScreenMode.FullScreenWindow or FullScreenMode.MaximizedWindow) return;
|
||||
var gameRunning = GameMain.isRunning;
|
||||
if (!LoadLastWindowRectEnabled.Value && !gameRunning) return;
|
||||
var wnd = WindowFunctions.FindGameWindow();
|
||||
if (wnd == IntPtr.Zero) return;
|
||||
int x, y;
|
||||
if (gameRunning)
|
||||
{
|
||||
x = __state.x;
|
||||
y = __state.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
var rect = LastWindowRect.Value;
|
||||
if (rect is { z: 0f, w: 0f }) return;
|
||||
x = Mathf.RoundToInt(rect.x);
|
||||
y = Mathf.RoundToInt(rect.y);
|
||||
}
|
||||
ThreadingHelper.Instance.StartCoroutine(SetWindowPositionCoroutine(wnd, x, y));
|
||||
}
|
||||
|
||||
private class EnableWindowResize : PatchImpl<EnableWindowResize>
|
||||
@@ -218,162 +315,6 @@ public class GamePatch : PatchImpl<GamePatch>
|
||||
}
|
||||
}
|
||||
|
||||
public class LoadLastWindowRect : PatchImpl<LoadLastWindowRect>
|
||||
{
|
||||
private static bool _loaded;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
GameLogic.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix;
|
||||
if (Screen.fullScreenMode is not (FullScreenMode.ExclusiveFullScreen or FullScreenMode.FullScreenWindow or FullScreenMode.MaximizedWindow))
|
||||
{
|
||||
var rect = LastWindowRect.Value;
|
||||
var x = Mathf.RoundToInt(rect.x);
|
||||
var y = Mathf.RoundToInt(rect.y);
|
||||
var w = Mathf.RoundToInt(rect.z);
|
||||
var h = Mathf.RoundToInt(rect.w);
|
||||
var needFix = false;
|
||||
if (w < 100)
|
||||
{
|
||||
w = 1280;
|
||||
needFix = true;
|
||||
}
|
||||
|
||||
if (h < 100)
|
||||
{
|
||||
h = 720;
|
||||
needFix = true;
|
||||
}
|
||||
|
||||
var sw = Screen.currentResolution.width;
|
||||
var sh = Screen.currentResolution.height;
|
||||
if (x + w > sw)
|
||||
{
|
||||
x = sw - w;
|
||||
needFix = true;
|
||||
}
|
||||
|
||||
if (y + h > sh)
|
||||
{
|
||||
y = sh - h;
|
||||
needFix = true;
|
||||
}
|
||||
|
||||
if (x < 0)
|
||||
{
|
||||
x = 0;
|
||||
needFix = true;
|
||||
}
|
||||
|
||||
if (y < 0)
|
||||
{
|
||||
y = 0;
|
||||
needFix = true;
|
||||
}
|
||||
|
||||
if (needFix)
|
||||
{
|
||||
LastWindowRect.Value = new Vector4(x, y, w, h);
|
||||
}
|
||||
}
|
||||
|
||||
MoveWindowPosition();
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
GameLogic.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix;
|
||||
}
|
||||
|
||||
public static void MoveWindowPosition(bool setResolution = false)
|
||||
{
|
||||
if (Screen.fullScreenMode is FullScreenMode.ExclusiveFullScreen or FullScreenMode.FullScreenWindow or FullScreenMode.MaximizedWindow || GameMain.isRunning) return;
|
||||
var wnd = WindowFunctions.FindGameWindow();
|
||||
if (wnd == IntPtr.Zero) return;
|
||||
var rect = LastWindowRect.Value;
|
||||
if (rect is { z: 0f, w: 0f }) return;
|
||||
var x = Mathf.RoundToInt(rect.x);
|
||||
var y = Mathf.RoundToInt(rect.y);
|
||||
if (setResolution)
|
||||
{
|
||||
var w = Mathf.RoundToInt(rect.z);
|
||||
var h = Mathf.RoundToInt(rect.w);
|
||||
Screen.SetResolution(w, h, false);
|
||||
}
|
||||
|
||||
WinApi.SetWindowPos(wnd, IntPtr.Zero, x, y, 0, 0, 0x0235);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(Screen), nameof(Screen.SetResolution), typeof(int), typeof(int), typeof(FullScreenMode), typeof(int))]
|
||||
private static void Screen_SetResolution_Prefix(ref int width, ref int height, FullScreenMode fullscreenMode)
|
||||
{
|
||||
if (fullscreenMode is FullScreenMode.ExclusiveFullScreen or FullScreenMode.FullScreenWindow or FullScreenMode.MaximizedWindow || GameMain.isRunning) return;
|
||||
var rect = LastWindowRect.Value;
|
||||
if (rect is { z: 0f, w: 0f }) return;
|
||||
var w = Mathf.RoundToInt(rect.z);
|
||||
var h = Mathf.RoundToInt(rect.w);
|
||||
width = w;
|
||||
height = h;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(Screen), nameof(Screen.SetResolution), typeof(int), typeof(int), typeof(FullScreenMode), typeof(int))]
|
||||
private static void Screen_SetResolution_Postfix(FullScreenMode fullscreenMode)
|
||||
{
|
||||
MoveWindowPosition();
|
||||
}
|
||||
|
||||
private static void VFPreload_InvokeOnLoadWorkEnded_Postfix()
|
||||
{
|
||||
if (_loaded || Screen.fullScreenMode is FullScreenMode.ExclusiveFullScreen or FullScreenMode.FullScreenWindow or FullScreenMode.MaximizedWindow) return;
|
||||
_loaded = true;
|
||||
var wnd = WindowFunctions.FindGameWindow();
|
||||
if (wnd == IntPtr.Zero) return;
|
||||
var rect = LastWindowRect.Value;
|
||||
if (rect is { z: 0f, w: 0f }) return;
|
||||
var x = Mathf.RoundToInt(rect.x);
|
||||
var y = Mathf.RoundToInt(rect.y);
|
||||
var w = Mathf.RoundToInt(rect.z);
|
||||
var h = Mathf.RoundToInt(rect.w);
|
||||
Screen.SetResolution(w, h, false);
|
||||
WinApi.SetWindowPos(wnd, IntPtr.Zero, x, y, 0, 0, 0x0235);
|
||||
if (EnableWindowResizeEnabled.Value)
|
||||
WinApi.SetWindowLong(wnd, WinApi.GWL_STYLE,
|
||||
WinApi.GetWindowLong(wnd, WinApi.GWL_STYLE) | WinApi.WS_THICKFRAME | WinApi.WS_MAXIMIZEBOX);
|
||||
}
|
||||
|
||||
private static GameOption _gameOption;
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(UIOptionWindow), nameof(UIOptionWindow._OnOpen))]
|
||||
private static void UIOptionWindow__OnOpen_Postfix()
|
||||
{
|
||||
_gameOption = DSPGame.globalOption;
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(GameOption), nameof(GameOption.Apply))]
|
||||
private static IEnumerable<CodeInstruction> UIOptionWindow_ApplyOptions_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
var label1 = generator.DefineLabel();
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(Screen), nameof(Screen.SetResolution), [typeof(int), typeof(int), typeof(bool), typeof(int)]))
|
||||
).Advance(1).Labels.Add(label1);
|
||||
matcher.Start().Insert(
|
||||
Transpilers.EmitDelegate(() =>
|
||||
_gameOption.fullscreen == DSPGame.globalOption.fullscreen &&
|
||||
_gameOption.resolution.width == DSPGame.globalOption.resolution.width &&
|
||||
_gameOption.resolution.height == DSPGame.globalOption.resolution.height &&
|
||||
_gameOption.resolution.refreshRate == DSPGame.globalOption.resolution.refreshRate
|
||||
),
|
||||
new CodeInstruction(OpCodes.Brtrue, label1)
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
private class AutoSaveOpt: PatchImpl<AutoSaveOpt>
|
||||
{
|
||||
@@ -547,130 +488,76 @@ public class GamePatch : PatchImpl<GamePatch>
|
||||
}
|
||||
}
|
||||
|
||||
[PatchSetCallbackFlag(PatchCallbackFlag.CallOnDisableAfterUnpatch)]
|
||||
private class MouseCursorScaleUp : PatchImpl<MouseCursorScaleUp>
|
||||
private class ProfileBasedOption : PatchImpl<ProfileBasedOption>
|
||||
{
|
||||
public static bool NeedReloadCursors;
|
||||
|
||||
protected override void OnEnable()
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(GameOption), nameof(GameOption.LoadGlobal))]
|
||||
private static bool GameOption_LoadGlobal_Prefix(ref GameOption __instance)
|
||||
{
|
||||
if (!NeedReloadCursors) return;
|
||||
if (!UICursor.loaded) return;
|
||||
UICursor.loaded = false;
|
||||
UICursor.LoadCursors();
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
if (!NeedReloadCursors) return;
|
||||
if (!UICursor.loaded) return;
|
||||
UICursor.loaded = false;
|
||||
UICursor.LoadCursors();
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UICursor), nameof(UICursor.LoadCursors))]
|
||||
private static IEnumerable<CodeInstruction> UICursor_LoadCursors_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
/*
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldc_I4_S),
|
||||
new CodeMatch(OpCodes.Newarr)
|
||||
);
|
||||
var startPos = matcher.Pos;
|
||||
matcher.Advance(2).MatchForward(false,
|
||||
new CodeMatch(OpCodes.Stsfld, AccessTools.Field(typeof(UICursor), nameof(UICursor.cursorTexs)))
|
||||
);
|
||||
var endPos = matcher.Pos + 1;
|
||||
matcher.Start().Advance(startPos).RemoveInstructions(endPos - startPos);
|
||||
matcher.InsertAndAdvance(
|
||||
Transpilers.EmitDelegate(() =>
|
||||
{
|
||||
var pluginfolder = Util.PluginFolder;
|
||||
UICursor.cursorTexs =
|
||||
[
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-transfer.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-target-in.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-target-out.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-target-a.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-target-b.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-ban.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-delete.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-reform.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-dyson-node-create.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-painter.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-eyedropper.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-eraser.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-upgrade.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-downgrade.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-blank.png"),
|
||||
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-remove.png")
|
||||
];
|
||||
})
|
||||
);
|
||||
*/
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Stsfld, AccessTools.Field(typeof(UICursor), nameof(UICursor.cursorHots))),
|
||||
new CodeMatch(OpCodes.Ldc_I4_1),
|
||||
new CodeMatch(OpCodes.Stsfld, AccessTools.Field(typeof(UICursor), nameof(UICursor.loaded)))
|
||||
).Advance(1).InsertAndAdvance(
|
||||
Transpilers.EmitDelegate(() =>
|
||||
{
|
||||
var multiplier = MouseCursorScaleUpMultiplier.Value;
|
||||
for (var i = 0; i < UICursor.cursorTexs.Length; i++)
|
||||
{
|
||||
var cursor = UICursor.cursorTexs[i];
|
||||
if (cursor == null) continue;
|
||||
var newWidth = 32 * multiplier;
|
||||
var newHeight = 32 * multiplier;
|
||||
if (cursor.width == newWidth && cursor.height == newHeight) continue;
|
||||
UICursor.cursorTexs[i] = ResizeTexture2D(cursor, newWidth, newHeight);
|
||||
}
|
||||
|
||||
if (multiplier <= 1) return;
|
||||
for (var i = UICursor.cursorHots.Length - 1; i >= 0; i--)
|
||||
{
|
||||
UICursor.cursorHots[i] = new Vector2(UICursor.cursorHots[i].x * multiplier, UICursor.cursorHots[i].y * multiplier);
|
||||
}
|
||||
})
|
||||
).MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldc_I4_0),
|
||||
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(Cursor), nameof(Cursor.SetCursor), [typeof(Texture2D), typeof(Vector2), typeof(CursorMode)]))
|
||||
).SetInstruction(new CodeInstruction(OpCodes.Ldc_I4_1));
|
||||
return matcher.InstructionEnumeration();
|
||||
|
||||
Texture2D ResizeTexture2D(Texture2D texture2D, int targetWidth, int targetHeight)
|
||||
var profileName = WindowFunctions.ProfileName;
|
||||
if (profileName == null)
|
||||
{
|
||||
var oldActive = RenderTexture.active;
|
||||
var rt = new RenderTexture(targetWidth, targetHeight, 32)
|
||||
{
|
||||
antiAliasing = 8
|
||||
};
|
||||
RenderTexture.active = rt;
|
||||
Graphics.Blit(texture2D, rt);
|
||||
rt.ResolveAntiAliasedSurface();
|
||||
var result = new Texture2D(targetWidth, targetHeight, texture2D.format, false);
|
||||
result.ReadPixels(new Rect(0, 0, targetWidth, targetHeight), 0, 0);
|
||||
result.filterMode = FilterMode.Trilinear;
|
||||
result.Apply();
|
||||
RenderTexture.active = oldActive;
|
||||
rt.Release();
|
||||
return result;
|
||||
// We should initialize WindowFunctions before using WindowFunctions.ProfileName
|
||||
WindowFunctions.Init();
|
||||
profileName = WindowFunctions.ProfileName;
|
||||
if (profileName == null) return true;
|
||||
}
|
||||
if (string.Compare(DefaultProfileName.Value, profileName, StringComparison.OrdinalIgnoreCase) == 0) return true;
|
||||
var optionPath = $"{GameConfig.gameDocumentFolder}Option/{profileName}.xml";
|
||||
if (File.Exists(optionPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
__instance.ImportXML(optionPath);
|
||||
return false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
var gameXMLOptionPath = GameConfig.gameXMLOptionPath;
|
||||
if (File.Exists(gameXMLOptionPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
__instance.ImportXML(gameXMLOptionPath);
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogException(ex);
|
||||
}
|
||||
}
|
||||
GameOption.newlyCreated = true;
|
||||
__instance.SetDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UICursor), nameof(UICursor.cursorIndexApply), MethodType.Setter)]
|
||||
private static IEnumerable<CodeInstruction> UICursor_set_cursorIndexApply_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(GameOption), nameof(GameOption.SaveGlobal))]
|
||||
private static bool GameOption_SaveGlobal_Prefix(ref GameOption __instance)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.Start().MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldc_I4_0),
|
||||
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(Cursor), nameof(Cursor.SetCursor), [typeof(Texture2D), typeof(Vector2), typeof(CursorMode)]))
|
||||
).SetInstruction(new CodeInstruction(OpCodes.Ldc_I4_1));
|
||||
return matcher.InstructionEnumeration();
|
||||
var profileName = WindowFunctions.ProfileName;
|
||||
if (profileName == null) return true;
|
||||
if (string.Compare(DefaultProfileName.Value, profileName, StringComparison.OrdinalIgnoreCase) == 0) return true;
|
||||
var path = $"{GameConfig.gameDocumentFolder}Option";
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
try
|
||||
{
|
||||
using FileStream fileStream = new($"{path}/{profileName}.xml", FileMode.Create, FileAccess.Write, FileShare.None);
|
||||
using XmlTextWriter xmlTextWriter = new(fileStream, Console.OutputEncoding);
|
||||
xmlTextWriter.Formatting = Formatting.Indented;
|
||||
__instance.ExportXML(xmlTextWriter);
|
||||
xmlTextWriter.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogException(ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection.Emit;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
@@ -39,29 +38,6 @@ public class PersistPatch : PatchImpl<PersistPatch>
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
// Patch to fix the issue that warning popup on VeinUtil upgraded to level 8000+
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(ABN_VeinsUtil), nameof(ABN_VeinsUtil.CheckValue))]
|
||||
private static IEnumerable<CodeInstruction> ABN_VeinsUtil_CheckValue_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldelem_R8),
|
||||
new CodeMatch(OpCodes.Conv_R4),
|
||||
new CodeMatch(OpCodes.Add),
|
||||
new CodeMatch(OpCodes.Stloc_1)
|
||||
);
|
||||
// loc1 = Mathf.Round(n * 1000f) / 1000f;
|
||||
matcher.Advance(3).Insert(
|
||||
new CodeInstruction(OpCodes.Ldc_R4, 1000f),
|
||||
new CodeInstruction(OpCodes.Mul),
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(Mathf), nameof(Mathf.Round))),
|
||||
new CodeInstruction(OpCodes.Ldc_R4, 1000f),
|
||||
new CodeInstruction(OpCodes.Div)
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
// Bring popup tip window to top layer
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UIButton), nameof(UIButton.LateUpdate))]
|
||||
@@ -86,36 +62,30 @@ public class PersistPatch : PatchImpl<PersistPatch>
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
// Sort blueprint structures by item id, model index, recipe id, area index, and position before saving
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(BlueprintUtils), nameof(BlueprintUtils.GenerateBlueprintData))]
|
||||
private static void BlueprintUtils_GenerateBlueprintData_Postfix(BlueprintData _blueprintData)
|
||||
// Sort blueprint data when pasting
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(BuildTool_BlueprintCopy), nameof(BuildTool_BlueprintCopy.UseToPasteNow))]
|
||||
private static IEnumerable<CodeInstruction> BuildTool_BlueprintCopy_UseToPasteNow_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var buildings = _blueprintData.buildings;
|
||||
Array.Sort(buildings, (a, b) =>
|
||||
{
|
||||
var tmpItemId = a.itemId - b.itemId;
|
||||
if (tmpItemId != 0) return tmpItemId;
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(BuildTool_BlueprintCopy), nameof(BuildTool_BlueprintCopy.RefreshBlueprintData)))
|
||||
).Advance(2).Insert(
|
||||
new CodeInstruction(OpCodes.Ldarg_0),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(BuildTool_BlueprintCopy), nameof(BuildTool_BlueprintCopy.blueprint))),
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(Functions.FactoryFunctions), nameof(Functions.FactoryFunctions.SortBlueprintData)))
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
var tmpModelIndex = a.modelIndex - b.modelIndex;
|
||||
if (tmpModelIndex != 0) return tmpModelIndex;
|
||||
|
||||
var tmpRecipeId = a.recipeId - b.recipeId;
|
||||
if (tmpRecipeId != 0) return tmpRecipeId;
|
||||
|
||||
var tmpAreaIndex = a.areaIndex - b.areaIndex;
|
||||
if (tmpAreaIndex != 0) return tmpAreaIndex;
|
||||
|
||||
var sign = Math.Sign(b.localOffset_y - a.localOffset_y);
|
||||
if (sign != 0) return sign;
|
||||
|
||||
sign = Math.Sign(b.localOffset_x - a.localOffset_x);
|
||||
return sign != 0 ? sign : Math.Sign(b.localOffset_z - a.localOffset_z);
|
||||
});
|
||||
for (var i = buildings.Length - 1; i >= 0; i--)
|
||||
{
|
||||
buildings[i].index = i;
|
||||
}
|
||||
// Sort blueprint data when saving
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(BlueprintData), nameof(BlueprintData.SaveBlueprintData))]
|
||||
private static void BlueprintData_SaveBlueprintData_Prefix(BlueprintData __instance)
|
||||
{
|
||||
if (!__instance.isValid) return;
|
||||
Functions.FactoryFunctions.SortBlueprintData(__instance);
|
||||
}
|
||||
|
||||
// Increase maximum value of property realizing, 2000 -> 20000
|
||||
|
||||
@@ -24,7 +24,7 @@ public static class PlanetPatch
|
||||
PlayerActionsInGlobeView.Enable(false);
|
||||
}
|
||||
|
||||
public class PlayerActionsInGlobeView: PatchImpl<PlayerActionsInGlobeView>
|
||||
public class PlayerActionsInGlobeView : PatchImpl<PlayerActionsInGlobeView>
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(VFInput), nameof(VFInput.UpdateGameStates))]
|
||||
@@ -48,7 +48,7 @@ public static class PlanetPatch
|
||||
});
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(PlayerController), nameof(PlayerController.GetInput))]
|
||||
private static IEnumerable<CodeInstruction> PlayerController_GetInput_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
|
||||
@@ -8,18 +8,41 @@ using UXAssist.Common;
|
||||
|
||||
namespace UXAssist.Patches;
|
||||
|
||||
public static class PlayerPatch
|
||||
public class PlayerPatch : PatchImpl<PlayerPatch>
|
||||
{
|
||||
public static ConfigEntry<bool> EnhancedMechaForgeCountControlEnabled;
|
||||
public static ConfigEntry<bool> HideTipsForSandsChangesEnabled;
|
||||
public static ConfigEntry<bool> ShortcutKeysForStarsNameEnabled;
|
||||
public static ConfigEntry<bool> AutoNavigationEnabled;
|
||||
public static ConfigEntry<bool> AutoCruiseEnabled;
|
||||
public static ConfigEntry<bool> AutoBoostEnabled;
|
||||
public static ConfigEntry<double> DistanceToWarp;
|
||||
private static PressKeyBind _showAllStarsNameKey;
|
||||
private static PressKeyBind _toggleAllStarsNameKey;
|
||||
private static PressKeyBind _autoDriveKey;
|
||||
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
_showAllStarsNameKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
||||
{
|
||||
key = new CombineKey(0, CombineKey.ALT_COMB, ECombineKeyAction.OnceClick, false),
|
||||
conflictGroup = KeyBindConflict.UI | KeyBindConflict.KEYBOARD_KEYBIND,
|
||||
name = "ShowAllStarsName",
|
||||
canOverride = true
|
||||
}
|
||||
);
|
||||
I18N.Add("KEYShowAllStarsName", "[UXA] Keep pressing to show all Stars' name", "[UXA] 按住显示所有星系名称");
|
||||
|
||||
_toggleAllStarsNameKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
||||
{
|
||||
key = new CombineKey((int)KeyCode.Tab, 0, ECombineKeyAction.OnceClick, false),
|
||||
conflictGroup = KeyBindConflict.UI | KeyBindConflict.KEYBOARD_KEYBIND,
|
||||
name = "ToggleAllStarsName",
|
||||
canOverride = true
|
||||
}
|
||||
);
|
||||
I18N.Add("KEYToggleAllStarsName", "[UXA] Toggle display of all Stars' name", "[UXA] 切换所有星系名称显示状态");
|
||||
|
||||
_autoDriveKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
||||
{
|
||||
key = new CombineKey(0, 0, ECombineKeyAction.OnceClick, true),
|
||||
@@ -27,36 +50,87 @@ public static class PlayerPatch
|
||||
name = "ToggleAutoCruise",
|
||||
canOverride = true
|
||||
});
|
||||
I18N.Add("KEYToggleAutoCruise", "[UXA] Toggle auto-cruise", "[UXA] 切换自动巡航");
|
||||
I18N.Add("AutoCruiseOn", "Auto-cruise enabled", "已启用自动巡航");
|
||||
I18N.Add("AutoCruiseOff", "Auto-cruise disabled", "已禁用自动巡航");
|
||||
|
||||
EnhancedMechaForgeCountControlEnabled.SettingChanged += (_, _) => EnhancedMechaForgeCountControl.Enable(EnhancedMechaForgeCountControlEnabled.Value);
|
||||
HideTipsForSandsChangesEnabled.SettingChanged += (_, _) => HideTipsForSandsChanges.Enable(HideTipsForSandsChangesEnabled.Value);
|
||||
ShortcutKeysForStarsNameEnabled.SettingChanged += (_, _) => ShortcutKeysForStarsName.Enable(ShortcutKeysForStarsNameEnabled.Value);
|
||||
AutoNavigationEnabled.SettingChanged += (_, _) => AutoNavigation.Enable(AutoNavigationEnabled.Value);
|
||||
AutoNavigationEnabled.SettingChanged += (_, _) => Functions.UIFunctions.UpdateToggleAutoCruiseCheckButtonVisiblility();
|
||||
AutoCruiseEnabled.SettingChanged += (_, _) => Functions.UIFunctions.UpdateToggleAutoCruiseCheckButtonVisiblility();
|
||||
}
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
EnhancedMechaForgeCountControl.Enable(EnhancedMechaForgeCountControlEnabled.Value);
|
||||
HideTipsForSandsChanges.Enable(HideTipsForSandsChangesEnabled.Value);
|
||||
ShortcutKeysForStarsName.Enable(ShortcutKeysForStarsNameEnabled.Value);
|
||||
AutoNavigation.Enable(AutoNavigationEnabled.Value);
|
||||
Enable(true);
|
||||
}
|
||||
|
||||
public static void OnUpdate()
|
||||
public static void OnInputUpdate()
|
||||
{
|
||||
ShortcutKeysForStarsName.OnInputUpdate();
|
||||
if (_autoDriveKey.keyValue)
|
||||
{
|
||||
AutoNavigation.ToggleAutoCruise();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void Uninit()
|
||||
{
|
||||
Enable(false);
|
||||
EnhancedMechaForgeCountControl.Enable(false);
|
||||
HideTipsForSandsChanges.Enable(false);
|
||||
ShortcutKeysForStarsName.Enable(false);
|
||||
AutoNavigation.Enable(false);
|
||||
}
|
||||
|
||||
private class EnhancedMechaForgeCountControl: PatchImpl<EnhancedMechaForgeCountControl>
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UIStarmapStar), nameof(UIStarmapStar._OnLateUpdate))]
|
||||
private static IEnumerable<CodeInstruction> UIStarmapStar__OnLateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
Label? jumpPos = null;
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(UIStarmapStar), nameof(UIStarmapStar.projectedCoord))),
|
||||
new CodeMatch(ci => ci.IsLdloc()),
|
||||
new CodeMatch(ci => ci.Branches(out jumpPos))
|
||||
);
|
||||
matcher.Advance(3);
|
||||
var labels = matcher.Labels;
|
||||
matcher.Labels = [];
|
||||
matcher.CreateLabel(out var jumpPos2);
|
||||
matcher.InsertAndAdvance(
|
||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(ShortcutKeysForStarsName), nameof(ShortcutKeysForStarsName.ShowAllStarsNameStatus))).WithLabels(labels),
|
||||
new CodeInstruction(OpCodes.Ldc_I4_1),
|
||||
new CodeInstruction(OpCodes.Ceq),
|
||||
new CodeInstruction(OpCodes.Brtrue, jumpPos.Value),
|
||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(PlayerPatch.ShortcutKeysForStarsName), nameof(ShortcutKeysForStarsName.ForceShowAllStarsName))),
|
||||
new CodeInstruction(OpCodes.Brtrue, jumpPos.Value),
|
||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(Functions.UIFunctions), nameof(Functions.UIFunctions.ShowStarName))),
|
||||
new CodeInstruction(OpCodes.Ldarg_0),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(UIStarmapStar), nameof(UIStarmapStar.star))),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(StarData), nameof(StarData.index))),
|
||||
new CodeInstruction(OpCodes.Ldelem_I1),
|
||||
new CodeInstruction(OpCodes.Brtrue, jumpPos.Value),
|
||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(ShortcutKeysForStarsName), nameof(ShortcutKeysForStarsName.ShowAllStarsNameStatus))),
|
||||
new CodeInstruction(OpCodes.Ldc_I4_2),
|
||||
new CodeInstruction(OpCodes.Ceq),
|
||||
new CodeInstruction(OpCodes.Brfalse, jumpPos2),
|
||||
new CodeInstruction(OpCodes.Ldc_I4_0),
|
||||
new CodeInstruction(OpCodes.Stloc_1),
|
||||
new CodeInstruction(OpCodes.Br, jumpPos.Value)
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
|
||||
private class EnhancedMechaForgeCountControl : PatchImpl<EnhancedMechaForgeCountControl>
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UIReplicatorWindow), nameof(UIReplicatorWindow.OnOkButtonClick))]
|
||||
@@ -107,7 +181,7 @@ public static class PlayerPatch
|
||||
}
|
||||
}
|
||||
|
||||
private class HideTipsForSandsChanges: PatchImpl<HideTipsForSandsChanges>
|
||||
private class HideTipsForSandsChanges : PatchImpl<HideTipsForSandsChanges>
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(Player), nameof(Player.SetSandCount))]
|
||||
@@ -121,13 +195,149 @@ public static class PlayerPatch
|
||||
}
|
||||
}
|
||||
|
||||
public class AutoNavigation: PatchImpl<AutoNavigation>
|
||||
public class ShortcutKeysForStarsName : PatchImpl<ShortcutKeysForStarsName>
|
||||
{
|
||||
public static int ShowAllStarsNameStatus;
|
||||
public static bool ForceShowAllStarsName;
|
||||
public static bool ForceShowAllStarsNameExternal;
|
||||
|
||||
public static void ToggleAllStarsName()
|
||||
{
|
||||
ShowAllStarsNameStatus = (ShowAllStarsNameStatus + 1) % 3;
|
||||
}
|
||||
|
||||
public static void OnInputUpdate()
|
||||
{
|
||||
if (!UIRoot.instance.uiGame.starmap.active) return;
|
||||
var enabled = ShortcutKeysForStarsNameEnabled.Value;
|
||||
if (!enabled)
|
||||
{
|
||||
ForceShowAllStarsName = ForceShowAllStarsNameExternal;
|
||||
return;
|
||||
}
|
||||
if (_toggleAllStarsNameKey.keyValue)
|
||||
{
|
||||
ToggleAllStarsName();
|
||||
}
|
||||
ForceShowAllStarsName = ForceShowAllStarsNameExternal || _showAllStarsNameKey.IsKeyPressing();
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(UIStarmap), nameof(UIStarmap._OnOpen))]
|
||||
private static void UIStarmap__OnOpen_Prefix()
|
||||
{
|
||||
ShowAllStarsNameStatus = 0;
|
||||
}
|
||||
/*
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UIStarmapPlanet), nameof(UIStarmapPlanet._OnLateUpdate))]
|
||||
private static IEnumerable<CodeInstruction> UIStarmapPlanet__OnLateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldloc_3),
|
||||
new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(UIStarmapPlanet), nameof(UIStarmapPlanet.projected)))
|
||||
);
|
||||
matcher.Advance(3);
|
||||
matcher.CreateLabel(out var jumpPos1);
|
||||
matcher.InsertAndAdvance(
|
||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(ShortcutKeysForStarsName), nameof(_showAllStarsNameStatus))),
|
||||
new CodeInstruction(OpCodes.Ldc_I4_2),
|
||||
new CodeInstruction(OpCodes.Ceq),
|
||||
new CodeInstruction(OpCodes.Brfalse, jumpPos1),
|
||||
new CodeInstruction(OpCodes.Ldc_I4_0),
|
||||
new CodeInstruction(OpCodes.Stloc_3)
|
||||
);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UIStarmapPlanet), nameof(UIStarmapPlanet.gameHistory))),
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UIStarmapPlanet), nameof(UIStarmapPlanet.planet))),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(PlanetData), nameof(PlanetData.id))),
|
||||
new CodeMatch(OpCodes.Callvirt, AccessTools.Field(typeof(GameHistoryData), nameof(GameHistoryData.GetPlanetPin))),
|
||||
new CodeMatch(OpCodes.Ldc_I4_1),
|
||||
new CodeMatch(ci => ci.Branches(out _)),
|
||||
new CodeMatch(OpCodes.Ldc_I4_1),
|
||||
new CodeMatch(ci => ci.IsStloc()),
|
||||
new CodeMatch(ci => ci.Branches(out _))
|
||||
);
|
||||
matcher.CreateLabelAt(matcher.Pos + 8, out var jumpPos);
|
||||
var labels = matcher.Labels;
|
||||
matcher.Labels = null;
|
||||
matcher.InsertAndAdvance(
|
||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(ShortcutKeysForStarsName), nameof(_showAllStarsNameStatus))).WithLabels(labels),
|
||||
new CodeInstruction(OpCodes.Ldc_I4_1),
|
||||
new CodeInstruction(OpCodes.Ceq),
|
||||
new CodeInstruction(OpCodes.Brtrue, jumpPos),
|
||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(PlayerPatch), nameof(_showAllStarsNameKey))),
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(KeyBindings), nameof(KeyBindings.IsKeyPressing))),
|
||||
new CodeInstruction(OpCodes.Brtrue, jumpPos)
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UIStarmapDFHive), nameof(UIStarmapDFHive._OnLateUpdate))]
|
||||
private static IEnumerable<CodeInstruction> UIStarmapDFHive__OnLateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(ci => ci.IsLdloc()),
|
||||
new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(UIStarmapDFHive), nameof(UIStarmapDFHive.projected)))
|
||||
);
|
||||
matcher.Advance(3);
|
||||
matcher.CreateLabel(out var jumpPos1);
|
||||
matcher.InsertAndAdvance(
|
||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(ShortcutKeysForStarsName), nameof(_showAllStarsNameStatus))),
|
||||
new CodeInstruction(OpCodes.Ldc_I4_2),
|
||||
new CodeInstruction(OpCodes.Ceq),
|
||||
new CodeInstruction(OpCodes.Brfalse, jumpPos1),
|
||||
new CodeInstruction(OpCodes.Ldc_I4_0),
|
||||
new CodeInstruction(OpCodes.Stloc_S, 4)
|
||||
);
|
||||
matcher.MatchForward(false,
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UIStarmapDFHive), nameof(UIStarmapDFHive.gameHistory))),
|
||||
new CodeMatch(OpCodes.Ldarg_0),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UIStarmapDFHive), nameof(UIStarmapDFHive.hive))),
|
||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(EnemyDFHiveSystem), nameof(EnemyDFHiveSystem.hiveStarId))),
|
||||
new CodeMatch(OpCodes.Ldc_I4, 1000000),
|
||||
new CodeMatch(OpCodes.Sub),
|
||||
new CodeMatch(OpCodes.Callvirt, AccessTools.Field(typeof(GameHistoryData), nameof(GameHistoryData.GetHivePin))),
|
||||
new CodeMatch(OpCodes.Ldc_I4_1),
|
||||
new CodeMatch(ci => ci.Branches(out _)),
|
||||
new CodeMatch(OpCodes.Ldc_I4_1),
|
||||
new CodeMatch(ci => ci.IsStloc()),
|
||||
new CodeMatch(ci => ci.Branches(out _))
|
||||
);
|
||||
matcher.CreateLabelAt(matcher.Pos + 10, out var jumpPos);
|
||||
var labels = matcher.Labels;
|
||||
matcher.Labels = null;
|
||||
matcher.InsertAndAdvance(
|
||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(ShortcutKeysForStarsName), nameof(_showAllStarsNameStatus))).WithLabels(labels),
|
||||
new CodeInstruction(OpCodes.Ldc_I4_1),
|
||||
new CodeInstruction(OpCodes.Ceq),
|
||||
new CodeInstruction(OpCodes.Brtrue, jumpPos),
|
||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(PlayerPatch), nameof(_showAllStarsNameKey))),
|
||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(KeyBindings), nameof(KeyBindings.IsKeyPressing))),
|
||||
new CodeInstruction(OpCodes.Brtrue, jumpPos)
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public class AutoNavigation : PatchImpl<AutoNavigation>
|
||||
{
|
||||
private static bool _canUseWarper;
|
||||
private static int _indicatorAstroId;
|
||||
private static bool _speedUp;
|
||||
private static Vector3 _direction;
|
||||
|
||||
public static int IndicatorAstroId => _indicatorAstroId;
|
||||
|
||||
public static void ToggleAutoCruise()
|
||||
{
|
||||
AutoCruiseEnabled.Value = !AutoCruiseEnabled.Value;
|
||||
@@ -155,9 +365,9 @@ public static class PlayerPatch
|
||||
if (navi.indicatorAstroId != _indicatorAstroId)
|
||||
{
|
||||
_indicatorAstroId = navi.indicatorAstroId;
|
||||
if (_indicatorAstroId == 0) return;
|
||||
Functions.UIFunctions.UpdateToggleAutoCruiseCheckButtonVisiblility();
|
||||
}
|
||||
else if (_indicatorAstroId == 0) return;
|
||||
if (_indicatorAstroId == 0) return;
|
||||
switch (controller.movementStateInFrame)
|
||||
{
|
||||
case EMovementState.Walk:
|
||||
@@ -184,12 +394,12 @@ public static class PlayerPatch
|
||||
var astroVec = astro.uPos - playerPos;
|
||||
var distance = astroVec.magnitude;
|
||||
if (distance < astro.type switch
|
||||
{
|
||||
EAstroType.Planet => 800.0 + astro.uRadius,
|
||||
EAstroType.Star => 4000.0 + astro.uRadius,
|
||||
EAstroType.EnemyHive => 400.0,
|
||||
_ => 2000.0 + astro.uRadius
|
||||
})
|
||||
{
|
||||
EAstroType.Planet => 800.0 + astro.uRadius,
|
||||
EAstroType.Star => 4000.0 + astro.uRadius,
|
||||
EAstroType.EnemyHive => 800.0,
|
||||
_ => 2000.0 + astro.uRadius
|
||||
})
|
||||
{
|
||||
if (isHive)
|
||||
{
|
||||
@@ -204,7 +414,7 @@ public static class PlayerPatch
|
||||
|
||||
/* Check nearest astroes, try to bypass them */
|
||||
var localStar = GameMain.localStar;
|
||||
_canUseWarper = autoCruise && !player.warping && player.mecha.warpStorage.GetItemCount(1210) > 0;
|
||||
_canUseWarper = autoCruise && player.mecha.thrusterLevel >= 3 && !player.warping && player.mecha.HasWarper();
|
||||
if (localStar != null)
|
||||
{
|
||||
var nearestRange = (playerPos - localStar.uPosition).sqrMagnitude;
|
||||
@@ -228,9 +438,9 @@ public static class PlayerPatch
|
||||
if (hiveSys.realized && hiveSys.hiveAstroId > 1000000)
|
||||
{
|
||||
ref var hiveAstro = ref GameMain.spaceSector.astros[hiveSys.hiveAstroId - 1000000];
|
||||
/* Divide by 4, so that the real range is 2 times of the calculated range,
|
||||
which means the minimal range allowed is 4000 */
|
||||
var range = (playerPos - hiveAstro.uPos).sqrMagnitude / 4.0;
|
||||
/* Divide by 36, so that the real range is 6 times of the calculated range,
|
||||
which means the minimal range allowed is 12000 */
|
||||
var range = (playerPos - hiveAstro.uPos).sqrMagnitude / 36.0;
|
||||
if (range < nearestRange)
|
||||
{
|
||||
nearestRange = range;
|
||||
@@ -272,12 +482,12 @@ public static class PlayerPatch
|
||||
if (distance < GalaxyData.LY * 1.5)
|
||||
{
|
||||
if (distance < actionSail.currentWarpSpeed * distance switch
|
||||
{
|
||||
> GalaxyData.LY * 0.6 => 0.33,
|
||||
> GalaxyData.LY * 0.3 => 0.5,
|
||||
> GalaxyData.LY * 0.1 => 0.66,
|
||||
_ => 1.0
|
||||
})
|
||||
{
|
||||
> GalaxyData.LY * 0.6 => 0.33,
|
||||
> GalaxyData.LY * 0.3 => 0.5,
|
||||
> GalaxyData.LY * 0.1 => 0.66,
|
||||
_ => 1.0
|
||||
})
|
||||
{
|
||||
controller.input0.y = -1f;
|
||||
}
|
||||
@@ -319,7 +529,7 @@ public static class PlayerPatch
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(VFInput), nameof(VFInput._sailSpeedUp), MethodType.Getter)]
|
||||
private static IEnumerable<CodeInstruction> VFInput_sailSpeedUp_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
@@ -335,7 +545,7 @@ public static class PlayerPatch
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
/* Disable Lock Cursor Mode on entering sail panel
|
||||
/* Disable Lock Cursor Mode on entering sail panel
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(UISailPanel), nameof(UISailPanel._OnOpen))]
|
||||
public static void OnOpen_Prefix()
|
||||
|
||||
@@ -1,57 +1,65 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UXAssist.Common;
|
||||
using GameLogicProc = UXAssist.Common.GameLogic;
|
||||
|
||||
namespace UXAssist.Patches;
|
||||
|
||||
public static class TechPatch
|
||||
{
|
||||
public static ConfigEntry<bool> SorterCargoStackingEnabled;
|
||||
public static ConfigEntry<bool> DisableBattleRelatedTechsInPeaceModeEnabled;
|
||||
public static ConfigEntry<bool> BatchBuyoutTechEnabled;
|
||||
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
I18N.Add("分拣器运货量", "Sorter Mk.III cargo stacking : ", "极速分拣器每次可运送 ");
|
||||
SorterCargoStackingEnabled.SettingChanged += (_, _) => SorterCargoStacking.Enable(SorterCargoStackingEnabled.Value);
|
||||
DisableBattleRelatedTechsInPeaceModeEnabled.SettingChanged += (_, _) => DisableBattleRelatedTechsInPeaceMode.Enable(DisableBattleRelatedTechsInPeaceModeEnabled.Value);
|
||||
BatchBuyoutTechEnabled.SettingChanged += (_, _) => BatchBuyoutTech.Enable(BatchBuyoutTechEnabled.Value);
|
||||
}
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
SorterCargoStacking.Enable(SorterCargoStackingEnabled.Value);
|
||||
DisableBattleRelatedTechsInPeaceMode.Enable(DisableBattleRelatedTechsInPeaceModeEnabled.Value);
|
||||
BatchBuyoutTech.Enable(BatchBuyoutTechEnabled.Value);
|
||||
}
|
||||
|
||||
public static void Uninit()
|
||||
{
|
||||
BatchBuyoutTech.Enable(false);
|
||||
DisableBattleRelatedTechsInPeaceMode.Enable(false);
|
||||
SorterCargoStacking.Enable(false);
|
||||
}
|
||||
|
||||
private class SorterCargoStacking: PatchImpl<SorterCargoStacking>
|
||||
|
||||
private class SorterCargoStacking
|
||||
{
|
||||
private static bool _protoPatched;
|
||||
|
||||
protected override void OnEnable()
|
||||
|
||||
public static void Enable(bool enable)
|
||||
{
|
||||
TryPatchProto(true);
|
||||
GameLogic.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix;
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
GameLogic.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix;
|
||||
TryPatchProto(false);
|
||||
if (enable)
|
||||
{
|
||||
TryPatchProto(true);
|
||||
GameLogicProc.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix;
|
||||
}
|
||||
else
|
||||
{
|
||||
GameLogicProc.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix;
|
||||
TryPatchProto(false);
|
||||
}
|
||||
}
|
||||
|
||||
private static void TryPatchProto(bool on)
|
||||
{
|
||||
if (DSPGame.IsMenuDemo) return;
|
||||
var techs = LDB.techs;
|
||||
if (techs == null || techs.dataArray == null || techs.dataArray.Length == 0) return;
|
||||
if (techs == null || techs?.dataArray == null || techs.dataArray.Length == 0) return;
|
||||
if (on)
|
||||
{
|
||||
var delim = -26.0f;
|
||||
@@ -114,162 +122,173 @@ public static class TechPatch
|
||||
}
|
||||
}
|
||||
|
||||
private class BatchBuyoutTech: PatchImpl<BatchBuyoutTech>
|
||||
private static class DisableBattleRelatedTechsInPeaceMode
|
||||
{
|
||||
private static void GenerateTechList(GameHistoryData history, int techId, List<int> techIdList)
|
||||
private static bool _protoPatched;
|
||||
private static HashSet<int> _techsToDisableSet;
|
||||
private static Dictionary<int, TechProto[]> _originTechPosts = [];
|
||||
|
||||
public static void Enable(bool enable)
|
||||
{
|
||||
var techProto = LDB.techs.Select(techId);
|
||||
if (techProto == null || !techProto.Published) return;
|
||||
var flag = true;
|
||||
for (var i = 0; i < 2; i++)
|
||||
if (_techsToDisableSet == null)
|
||||
{
|
||||
var array = techProto.PreTechs;
|
||||
if (i == 1)
|
||||
{
|
||||
array = techProto.PreTechsImplicit;
|
||||
}
|
||||
for (var j = 0; j < array.Length; j++)
|
||||
{
|
||||
if (!history.techStates.ContainsKey(array[j]) || history.techStates[array[j]].unlocked) continue;
|
||||
if (history.techStates[array[j]].maxLevel > history.techStates[array[j]].curLevel)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
GenerateTechList(history, array[j], techIdList);
|
||||
}
|
||||
(int, int)[] techListToDisable =
|
||||
[
|
||||
// Explosive Unit, Crystal Explosive Unit
|
||||
// 爆破单元,晶石爆破单元
|
||||
(1803, 1804),
|
||||
// Implosion Cannon
|
||||
// 聚爆加农炮
|
||||
(1807, 1807),
|
||||
// Signal Tower, Planetary Defense System, Jammer Tower, Plasma Turret, Titanium Ammo Box, Superalloy Ammo Box, High-Explosive Shell Set, Supersonic Missile Set, Crystal Shell Set, Gravity Missile Set, Antimatter Capsule, Precision Drone, Prototype, Attack Drone, Corvette, Destroyer, Suppressing Capsule, EM Capsule Mk.III
|
||||
// 信号塔, 行星防御系统, 干扰塔, 磁化电浆炮, 钛化弹箱, 超合金弹箱, 高爆炮弹组, 超音速导弹组, 晶石炮弹组, 引力导弹组, 反物质胶囊, 地面战斗机-A型, 地面战斗机-E型, 地面战斗机-F型, 太空战斗机-A型, 太空战斗机-F型, 电磁胶囊II, 电磁胶囊III
|
||||
(1809, 1825),
|
||||
// Auto Reconstruction Marking
|
||||
// 自动标记重建
|
||||
(2951, 2956),
|
||||
// Energy Shield
|
||||
// 能量护盾
|
||||
(2801, 2807),
|
||||
// Kinetic Weapon Damage
|
||||
// 动能武器伤害
|
||||
(5001, 5006),
|
||||
// Energy Weapon Damage
|
||||
// 能量武器伤害
|
||||
(5101, 5106),
|
||||
// Explosive Weapon Damage
|
||||
// 爆炸武器伤害
|
||||
(5201, 5206),
|
||||
// Combat Drone Damage
|
||||
// 战斗无人机伤害
|
||||
(5301, 5305),
|
||||
// Combat Drone Attack Speed
|
||||
// 战斗无人机攻击速度
|
||||
(5401, 5405),
|
||||
// Combat Drone Engine
|
||||
// 战斗无人机引擎
|
||||
(5601, 5605),
|
||||
// Combat Drone Durability
|
||||
// 战斗无人机耐久
|
||||
(5701, 5705),
|
||||
// Ground Squadron Expansion
|
||||
// 地面编队扩容
|
||||
(5801, 5807),
|
||||
// Space Fleet Expansion
|
||||
// 太空编队扩容
|
||||
(5901, 5907),
|
||||
// Enhanced Structure
|
||||
// 结构强化
|
||||
(6001, 6006),
|
||||
// Planetary Shield
|
||||
// 行星护盾
|
||||
(6101, 6106),
|
||||
];
|
||||
_techsToDisableSet = [.. techListToDisable.SelectMany(t => Enumerable.Range(t.Item1, t.Item2 - t.Item1 + 1))];
|
||||
}
|
||||
if (history.techStates.ContainsKey(techId) && !history.techStates[techId].unlocked && flag)
|
||||
if (enable)
|
||||
{
|
||||
techIdList.Add(techId);
|
||||
if (DSPGame.GameDesc != null)
|
||||
TryPatchProto(DSPGame.GameDesc.isPeaceMode);
|
||||
GameLogicProc.OnGameBegin += OnGameBegin;
|
||||
}
|
||||
else
|
||||
{
|
||||
GameLogicProc.OnGameBegin -= OnGameBegin;
|
||||
TryPatchProto(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void CheckTechUnlockProperties(GameHistoryData history, TechProto techProto, int[] properties, List<Tuple<TechProto, int, int>> techList, int maxLevel = 10000)
|
||||
private static void OnGameBegin()
|
||||
{
|
||||
var techStates = history.techStates;
|
||||
var techID = techProto.ID;
|
||||
if (techStates == null || !techStates.TryGetValue(techID, out var value)) return;
|
||||
if (value.unlocked) return;
|
||||
|
||||
var maxLvl = Math.Min(maxLevel < 0 ? value.curLevel - maxLevel - 1 : maxLevel, value.maxLevel);
|
||||
|
||||
foreach (var preid in techProto.PreTechs)
|
||||
{
|
||||
var preProto = LDB.techs.Select(preid);
|
||||
if (preProto != null)
|
||||
CheckTechUnlockProperties(history, preProto, properties, techList, techProto.PreTechsMax ? 10000 : preProto.Level);
|
||||
}
|
||||
foreach (var preid in techProto.PreTechsImplicit)
|
||||
{
|
||||
var preProto = LDB.techs.Select(preid);
|
||||
if (preProto != null)
|
||||
CheckTechUnlockProperties(history, preProto, properties, techList, techProto.PreTechsMax ? 10000 : preProto.Level);
|
||||
}
|
||||
|
||||
if (value.curLevel < techProto.Level) value.curLevel = techProto.Level;
|
||||
techList.Add(new Tuple<TechProto, int, int>(techProto, value.curLevel, techProto.Level));
|
||||
while (value.curLevel <= maxLvl)
|
||||
{
|
||||
if (techProto.PropertyOverrideItemArray != null)
|
||||
{
|
||||
var propertyOverrideItemArray = techProto.PropertyOverrideItemArray;
|
||||
for (var i = 0; i < propertyOverrideItemArray.Length; i++)
|
||||
{
|
||||
var id = propertyOverrideItemArray[i].id;
|
||||
var count = (float)propertyOverrideItemArray[i].count;
|
||||
var ratio = Mathf.Clamp01((float)((double)value.hashUploaded / value.hashNeeded));
|
||||
var consume = Mathf.CeilToInt(count * (1f - ratio));
|
||||
properties[id - 6001] += consume;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (var j = 0; j < techProto.itemArray.Length; j++)
|
||||
{
|
||||
var id = techProto.itemArray[j].ID;
|
||||
var consume = (int)(techProto.ItemPoints[j] * (value.hashNeeded - value.hashUploaded) / 3600L);
|
||||
properties[id - 6001] += consume;
|
||||
}
|
||||
}
|
||||
value.curLevel++;
|
||||
value.hashUploaded = 0;
|
||||
value.hashNeeded = techProto.GetHashNeeded(value.curLevel);
|
||||
}
|
||||
TryPatchProto(DSPGame.GameDesc.isPeaceMode);
|
||||
}
|
||||
|
||||
private static int UnlockTechRecursiveImpl(GameHistoryData history, TechProto techProto, int maxLevel = 10000)
|
||||
private static void TryPatchProto(bool on)
|
||||
{
|
||||
var techStates = history.techStates;
|
||||
var techID = techProto.ID;
|
||||
if (techStates == null || !techStates.TryGetValue(techID, out var value))
|
||||
if (DSPGame.IsMenuDemo || on == _protoPatched) return;
|
||||
var techs = LDB.techs;
|
||||
if (techs?.dataArray == null || techs.dataArray.Length == 0) return;
|
||||
if (on)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (value.unlocked)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
var maxLvl = Math.Min(maxLevel < 0 ? value.curLevel - maxLevel - 1 : maxLevel, value.maxLevel);
|
||||
|
||||
foreach (var preid in techProto.PreTechs)
|
||||
{
|
||||
var preProto = LDB.techs.Select(preid);
|
||||
if (preProto != null)
|
||||
UnlockTechRecursiveImpl(history, preProto, techProto.PreTechsMax ? 10000 : preProto.Level);
|
||||
}
|
||||
foreach (var preid in techProto.PreTechsImplicit)
|
||||
{
|
||||
var preProto = LDB.techs.Select(preid);
|
||||
if (preProto != null)
|
||||
UnlockTechRecursiveImpl(history, preProto, techProto.PreTechsMax ? 10000 : preProto.Level);
|
||||
}
|
||||
|
||||
if (value.curLevel < techProto.Level) value.curLevel = techProto.Level;
|
||||
while (value.curLevel <= maxLvl)
|
||||
{
|
||||
if (value.curLevel == 0)
|
||||
foreach (var tp in techs.dataArray)
|
||||
{
|
||||
foreach (var recipe in techProto.UnlockRecipes)
|
||||
if (_techsToDisableSet.Contains(tp.ID))
|
||||
{
|
||||
history.UnlockRecipe(recipe);
|
||||
tp.IsObsolete = true;
|
||||
}
|
||||
var postTechs = tp.postTechArray;
|
||||
for (var i = postTechs.Length - 1; i >= 0; i--)
|
||||
{
|
||||
if (_techsToDisableSet.Contains(postTechs[i].ID))
|
||||
{
|
||||
_originTechPosts[tp.ID] = postTechs;
|
||||
tp.postTechArray = [.. postTechs.Where(p => !_techsToDisableSet.Contains(p.ID))];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var j = 0; j < techProto.UnlockFunctions.Length; j++)
|
||||
{
|
||||
history.UnlockTechFunction(techProto.UnlockFunctions[j], techProto.UnlockValues[j], value.curLevel);
|
||||
}
|
||||
|
||||
for (var k = 0; k < techProto.AddItems.Length; k++)
|
||||
{
|
||||
history.GainTechAwards(techProto.AddItems[k], techProto.AddItemCounts[k]);
|
||||
}
|
||||
|
||||
value.curLevel++;
|
||||
_protoPatched = true;
|
||||
}
|
||||
|
||||
value.unlocked = maxLvl >= value.maxLevel;
|
||||
value.curLevel = value.unlocked ? maxLvl : maxLvl + 1;
|
||||
value.hashNeeded = techProto.GetHashNeeded(value.curLevel);
|
||||
value.hashUploaded = value.unlocked ? value.hashNeeded : 0;
|
||||
techStates[techID] = value;
|
||||
return maxLvl;
|
||||
}
|
||||
|
||||
private static bool UnlockTechRecursive(TechProto techProto, int maxLevel = 10000)
|
||||
{
|
||||
if (techProto == null) return false;
|
||||
else
|
||||
{
|
||||
foreach (var tp in techs.dataArray)
|
||||
{
|
||||
if (_techsToDisableSet.Contains(tp.ID))
|
||||
{
|
||||
tp.IsObsolete = false;
|
||||
}
|
||||
if (_originTechPosts.TryGetValue(tp.ID, out var postTechs))
|
||||
{
|
||||
tp.postTechArray = postTechs;
|
||||
}
|
||||
}
|
||||
_originTechPosts.Clear();
|
||||
_protoPatched = false;
|
||||
}
|
||||
var nodes = UIRoot.instance.uiGame.techTree.nodes;
|
||||
var history = GameMain.history;
|
||||
var ulvl = UnlockTechRecursiveImpl(history, techProto, maxLevel);
|
||||
if (ulvl < 0) return false;
|
||||
history.RegFeatureKey(1000100);
|
||||
history.NotifyTechUnlock(techProto.ID, ulvl);
|
||||
return true;
|
||||
foreach (var item in nodes)
|
||||
{
|
||||
var node = item.Value;
|
||||
foreach (var arrow in node.arrows)
|
||||
{
|
||||
arrow.gameObject.SetActive(false);
|
||||
}
|
||||
var postTechArray = node.techProto.postTechArray;
|
||||
var active = postTechArray.Length > 0;
|
||||
node.connGroup.gameObject.SetActive(active);
|
||||
node.connImages = active ? node.connGroup.GetComponentsInChildren<Image>(true) : [];
|
||||
if (!active) continue;
|
||||
bool onlyOneOutput = postTechArray.Length == 1;
|
||||
for (var i = 0; i < postTechArray.Length; i++)
|
||||
{
|
||||
var postTech = postTechArray[i];
|
||||
if (!nodes.ContainsKey(postTech.ID)) continue;
|
||||
bool itemUnlocked = true;
|
||||
for (var n = 0; n < postTech.PreItem.Length; n++)
|
||||
{
|
||||
if (history.ItemUnlocked(postTech.PreItem[n])) continue;
|
||||
itemUnlocked = false;
|
||||
break;
|
||||
}
|
||||
bool techUnlocked = history.TechUnlocked(postTech.ID);
|
||||
node.arrows[i].gameObject.SetActive(itemUnlocked || techUnlocked);
|
||||
if (onlyOneOutput && !itemUnlocked && !techUnlocked)
|
||||
{
|
||||
node.outputArrow.enabled = false;
|
||||
node.outputLine.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
node.outputLine.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class BatchBuyoutTech : PatchImpl<BatchBuyoutTech>
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UITechNode), nameof(UITechNode.UpdateInfoDynamic))]
|
||||
private static IEnumerable<CodeInstruction> UITechNode_UpdateInfoDynamic_Transpiler(IEnumerable<CodeInstruction> instructions)
|
||||
@@ -285,7 +304,7 @@ public static class TechPatch
|
||||
);
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(UITechNode), nameof(UITechNode.OnBuyoutButtonClick))]
|
||||
private static bool UITechNode_OnBuyoutButtonClick_Prefix(UITechNode __instance)
|
||||
@@ -296,109 +315,8 @@ public static class TechPatch
|
||||
}
|
||||
var techProto = __instance.techProto;
|
||||
if (techProto == null) return false;
|
||||
var properties = new int[6];
|
||||
List<Tuple<TechProto, int, int>> techList = new();
|
||||
var history = GameMain.history;
|
||||
var maxLevel = -1;
|
||||
CheckTechUnlockProperties(history, techProto, properties, techList, maxLevel);
|
||||
var propertySystem = DSPGame.propertySystem;
|
||||
var clusterSeedKey = history.gameData.GetClusterSeedKey();
|
||||
var enough = true;
|
||||
for (var i = 0; i < 6; i++)
|
||||
{
|
||||
if (propertySystem.GetItemAvaliableProperty(clusterSeedKey, 6001 + i) >= properties[i]) continue;
|
||||
enough = false;
|
||||
break;
|
||||
}
|
||||
if (!enough)
|
||||
{
|
||||
UIRealtimeTip.Popup("元数据不足".Translate());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!history.hasUsedPropertyBanAchievement)
|
||||
{
|
||||
UIMessageBox.Show("初次使用元数据标题".Translate(), "初次使用元数据描述".Translate(), "取消".Translate(), "确定".Translate(), 2, null, DoUnlockFunc);
|
||||
return false;
|
||||
}
|
||||
|
||||
DoUnlockFunc();
|
||||
Functions.TechFunctions.UnlockProtoWithMetadataAndPrompt([techProto], -1, true);
|
||||
return false;
|
||||
|
||||
void DoUnlockFunc()
|
||||
{
|
||||
if (techList.Count <= 1)
|
||||
{
|
||||
DoUnlockFuncInternal();
|
||||
return;
|
||||
}
|
||||
var msg = "要使用元数据买断以下科技吗?";
|
||||
|
||||
if (techList.Count <= 10)
|
||||
{
|
||||
foreach (var tuple in techList)
|
||||
{
|
||||
AddToMsg(ref msg, tuple);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (var i = 0; i < 5; i++)
|
||||
{
|
||||
AddToMsg(ref msg, techList[i]);
|
||||
}
|
||||
msg += " ...\n";
|
||||
for (var i = techList.Count - 5; i < techList.Count; i++)
|
||||
{
|
||||
AddToMsg(ref msg, techList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
msg += "\n\n";
|
||||
msg += "以下是买断所需元数据:";
|
||||
for (var i = 0; i < 6; i++)
|
||||
{
|
||||
var itemCount = properties[i];
|
||||
if (itemCount <= 0) continue;
|
||||
msg += $"\n {LDB.items.Select(6001 + i).propertyName}x{itemCount}";
|
||||
}
|
||||
UIMessageBox.Show("批量买断科技", msg, "取消".Translate(), "确定".Translate(), 2, null, DoUnlockFuncInternal);
|
||||
return;
|
||||
|
||||
void AddToMsg(ref string str, Tuple<TechProto, int, int> tuple)
|
||||
{
|
||||
if (tuple.Item2 == tuple.Item3)
|
||||
{
|
||||
if (tuple.Item2 <= 0)
|
||||
str += $"\n {tuple.Item1.name}";
|
||||
else
|
||||
str += $"\n {tuple.Item1.name}{"杠等级".Translate()}{tuple.Item2}";
|
||||
}
|
||||
else
|
||||
str += $"\n {tuple.Item1.name}{"杠等级".Translate()}{tuple.Item2}->{tuple.Item3}";
|
||||
}
|
||||
}
|
||||
|
||||
void DoUnlockFuncInternal()
|
||||
{
|
||||
var mainPlayer = GameMain.mainPlayer;
|
||||
for (var i = 0; i < 6; i++)
|
||||
{
|
||||
var itemCount = properties[i];
|
||||
if (itemCount <= 0) continue;
|
||||
var itemId = 6001 + i;
|
||||
propertySystem.AddItemConsumption(clusterSeedKey, itemId, itemCount);
|
||||
history.AddPropertyItemConsumption(itemId, itemCount, true);
|
||||
mainPlayer.mecha.AddProductionStat(itemId, itemCount, mainPlayer.nearestFactory);
|
||||
mainPlayer.mecha.AddConsumptionStat(itemId, itemCount, mainPlayer.nearestFactory);
|
||||
}
|
||||
UnlockTechRecursive(__instance.techProto, maxLevel);
|
||||
history.VarifyTechQueue();
|
||||
if (history.currentTech != history.techQueue[0])
|
||||
{
|
||||
history.currentTech = history.techQueue[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
396
UXAssist/Patches/UIPatch.cs
Normal file
396
UXAssist/Patches/UIPatch.cs
Normal file
@@ -0,0 +1,396 @@
|
||||
namespace UXAssist.Patches;
|
||||
|
||||
using System.Linq;
|
||||
using HarmonyLib;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using BepInEx.Configuration;
|
||||
using Common;
|
||||
using GameLogicProc = Common.GameLogic;
|
||||
|
||||
[PatchGuid(PluginInfo.PLUGIN_GUID)]
|
||||
public class UIPatch : PatchImpl<UIPatch>
|
||||
{
|
||||
public static ConfigEntry<bool> PlanetVeinUtilizationEnabled;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
PlanetVeinUtilizationEnabled.SettingChanged += (_, _) => PlanetVeinUtilization.Enable(PlanetVeinUtilizationEnabled.Value);
|
||||
}
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
GameLogicProc.OnGameBegin += PlanetVeinUtilization.OnGameBegin;
|
||||
Enable(true);
|
||||
Functions.UIFunctions.InitMenuButtons();
|
||||
PlanetVeinUtilization.Enable(PlanetVeinUtilizationEnabled.Value);
|
||||
}
|
||||
|
||||
public static void Uninit()
|
||||
{
|
||||
PlanetVeinUtilization.Enable(false);
|
||||
Enable(false);
|
||||
GameLogicProc.OnGameBegin -= PlanetVeinUtilization.OnGameBegin;
|
||||
}
|
||||
|
||||
private class PlanetVeinUtilization : PatchImpl<PlanetVeinUtilization>
|
||||
{
|
||||
private static VeinTypeInfo[] planetVeinCount = null;
|
||||
private static VeinTypeInfo[] starVeinCount = null;
|
||||
private static readonly Dictionary<int, bool> tmpGroups = [];
|
||||
|
||||
public static void OnGameBegin()
|
||||
{
|
||||
if (planetVeinCount != null)
|
||||
{
|
||||
foreach (VeinTypeInfo vti in planetVeinCount)
|
||||
{
|
||||
if (vti.textCtrl != null)
|
||||
{
|
||||
Object.Destroy(vti.textCtrl.gameObject);
|
||||
}
|
||||
}
|
||||
planetVeinCount = null;
|
||||
}
|
||||
if (starVeinCount != null)
|
||||
{
|
||||
foreach (VeinTypeInfo vti in starVeinCount)
|
||||
{
|
||||
if (vti.textCtrl != null)
|
||||
{
|
||||
Object.Destroy(vti.textCtrl.gameObject);
|
||||
}
|
||||
}
|
||||
starVeinCount = null;
|
||||
}
|
||||
var maxVeinId = LDB.veins.dataArray.Max(vein => vein.ID);
|
||||
planetVeinCount = new VeinTypeInfo[maxVeinId + 1];
|
||||
starVeinCount = new VeinTypeInfo[maxVeinId + 1];
|
||||
InitializeVeinCountArray(planetVeinCount);
|
||||
InitializeVeinCountArray(starVeinCount);
|
||||
}
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
if (planetVeinCount != null)
|
||||
{
|
||||
foreach (VeinTypeInfo vti in planetVeinCount)
|
||||
{
|
||||
vti.Reset();
|
||||
vti.textCtrl?.gameObject.SetActive(true);
|
||||
}
|
||||
UIPlanetDetail_RefreshDynamicProperties_Postfix(UIRoot.instance.uiGame.planetDetail);
|
||||
}
|
||||
if (starVeinCount != null)
|
||||
{
|
||||
foreach (VeinTypeInfo vti in starVeinCount)
|
||||
{
|
||||
vti.Reset();
|
||||
vti.textCtrl?.gameObject.SetActive(true);
|
||||
}
|
||||
UIStarDetail_RefreshDynamicProperties_Postfix(UIRoot.instance.uiGame.starDetail);
|
||||
}
|
||||
}
|
||||
|
||||
private static Vector2 GetAdjustedSizeDelta(Vector2 origSizeDelta)
|
||||
{
|
||||
return new Vector2(origSizeDelta.x + 40f, origSizeDelta.y);
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
if (planetVeinCount != null)
|
||||
{
|
||||
foreach (VeinTypeInfo vti in planetVeinCount)
|
||||
{
|
||||
vti.Reset();
|
||||
vti.textCtrl?.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
if (starVeinCount != null)
|
||||
{
|
||||
foreach (VeinTypeInfo vti in starVeinCount)
|
||||
{
|
||||
vti.Reset();
|
||||
vti.textCtrl?.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Helper functions
|
||||
private static void ProcessVeinData(VeinTypeInfo[] veinCount, VeinData[] veinPool)
|
||||
{
|
||||
lock (veinPool)
|
||||
{
|
||||
foreach (VeinData veinData in veinPool)
|
||||
{
|
||||
if (veinData.groupIndex == 0 || veinData.amount == 0) continue;
|
||||
if (tmpGroups.TryGetValue(veinData.groupIndex, out bool hasMiner))
|
||||
{
|
||||
if (hasMiner) continue;
|
||||
hasMiner = veinData.minerCount > 0;
|
||||
if (!hasMiner) continue;
|
||||
tmpGroups[veinData.groupIndex] = true;
|
||||
VeinTypeInfo vti = veinCount[(int)veinData.type];
|
||||
vti.numVeinGroupsWithCollector++;
|
||||
}
|
||||
else
|
||||
{
|
||||
hasMiner = veinData.minerCount > 0;
|
||||
tmpGroups.Add(veinData.groupIndex, hasMiner);
|
||||
VeinTypeInfo vti = veinCount[(int)veinData.type];
|
||||
vti.numVeinGroups++;
|
||||
if (hasMiner)
|
||||
{
|
||||
vti.numVeinGroupsWithCollector++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
tmpGroups.Clear();
|
||||
}
|
||||
|
||||
private static void FormatResource(int refId, UIResAmountEntry uiresAmountEntry, VeinTypeInfo vt)
|
||||
{
|
||||
if (vt.textCtrl == null)
|
||||
{
|
||||
var parent = uiresAmountEntry.labelText.transform.parent;
|
||||
vt.textCtrl = Object.Instantiate(uiresAmountEntry.valueText, parent);
|
||||
vt.textCtrl.font = uiresAmountEntry.labelText.font;
|
||||
RectTransform trans = vt.textCtrl.rectTransform;
|
||||
var pos = uiresAmountEntry.rectTrans.localPosition;
|
||||
pos.x = pos.x + uiresAmountEntry.iconImage.rectTransform.localPosition.x - 25f;
|
||||
trans.localPosition = pos;
|
||||
Vector2 size = trans.sizeDelta;
|
||||
size.x = 40f;
|
||||
trans.sizeDelta = size;
|
||||
}
|
||||
else
|
||||
{
|
||||
RectTransform trans = vt.textCtrl.rectTransform;
|
||||
Vector3 pos = trans.localPosition;
|
||||
pos.y = uiresAmountEntry.rectTrans.localPosition.y;
|
||||
trans.localPosition = pos;
|
||||
}
|
||||
vt.textCtrl.text = $"{vt.numVeinGroupsWithCollector}/{vt.numVeinGroups}";
|
||||
}
|
||||
|
||||
private static void InitializeVeinCountArray(VeinTypeInfo[] veinCountArray)
|
||||
{
|
||||
for (int i = 0; i < veinCountArray.Length; i++)
|
||||
{
|
||||
veinCountArray[i] = new VeinTypeInfo();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region UIPlanetDetail patches
|
||||
[HarmonyPrefix, HarmonyPatch(typeof(UIPlanetDetail), nameof(UIPlanetDetail.OnPlanetDataSet))]
|
||||
public static void UIPlanetDetail_OnPlanetDataSet_Prefix(UIPlanetDetail __instance)
|
||||
{
|
||||
foreach (VeinTypeInfo vti in planetVeinCount)
|
||||
{
|
||||
vti.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPostfix, HarmonyPatch(typeof(UIPlanetDetail), nameof(UIPlanetDetail.RefreshDynamicProperties))]
|
||||
public static void UIPlanetDetail_RefreshDynamicProperties_Postfix(UIPlanetDetail __instance)
|
||||
{
|
||||
PlanetData planet = __instance.planet;
|
||||
if (planet == null || planet.runtimeVeinGroups == null || __instance.tabIndex != 0) { return; }
|
||||
|
||||
int observeLevelCheck = __instance.planet == GameMain.localPlanet ? 1 : 2;
|
||||
if (GameMain.history.universeObserveLevel < observeLevelCheck) { return; }
|
||||
|
||||
foreach (VeinTypeInfo vti in planetVeinCount)
|
||||
{
|
||||
vti.numVeinGroups = 0;
|
||||
vti.numVeinGroupsWithCollector = 0;
|
||||
}
|
||||
// count up the total number of vein groups per resource type, as well as the total number of groups that have a miner attached
|
||||
PlanetFactory factory = planet.factory;
|
||||
if (factory != null)
|
||||
{
|
||||
ProcessVeinData(planetVeinCount, factory.veinPool);
|
||||
}
|
||||
else
|
||||
{
|
||||
VeinGroup[] veinGroups = planet.runtimeVeinGroups;
|
||||
lock (planet.veinGroupsLock)
|
||||
{
|
||||
for (int i = 1; i < veinGroups.Length; i++)
|
||||
{
|
||||
planetVeinCount[(int)veinGroups[i].type].numVeinGroups++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update each resource to show the following vein group info:
|
||||
// Iron: <number of vein groups with miners> / <total number of vein groups>
|
||||
foreach (UIResAmountEntry uiresAmountEntry in __instance.entries)
|
||||
{
|
||||
int refId = uiresAmountEntry.refId;
|
||||
if (refId > 0 && refId < (int)EVeinType.Max)
|
||||
{
|
||||
var vt = planetVeinCount[refId];
|
||||
if (vt.numVeinGroups > 0)
|
||||
{
|
||||
FormatResource(refId, uiresAmountEntry, vt);
|
||||
}
|
||||
else if (vt.textCtrl != null)
|
||||
{
|
||||
vt.textCtrl.text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region UIStarDetail patches
|
||||
[HarmonyPrefix, HarmonyPatch(typeof(UIStarDetail), nameof(UIStarDetail.OnStarDataSet))]
|
||||
public static void UIStaretail_OnStarDataSet_Prefix(UIStarDetail __instance)
|
||||
{
|
||||
foreach (VeinTypeInfo vti in starVeinCount)
|
||||
{
|
||||
vti.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPostfix, HarmonyPatch(typeof(UIStarDetail), nameof(UIStarDetail.RefreshDynamicProperties))]
|
||||
public static void UIStarDetail_RefreshDynamicProperties_Postfix(UIStarDetail __instance)
|
||||
{
|
||||
if (__instance.star == null || __instance.tabIndex != 0) { return; }
|
||||
if (GameMain.history.universeObserveLevel < 2) { return; }
|
||||
|
||||
foreach (VeinTypeInfo vti in starVeinCount)
|
||||
{
|
||||
vti.numVeinGroups = 0;
|
||||
vti.numVeinGroupsWithCollector = 0;
|
||||
}
|
||||
foreach (PlanetData planet in __instance.star.planets)
|
||||
{
|
||||
if (planet.runtimeVeinGroups == null) { continue; }
|
||||
PlanetFactory factory = planet.factory;
|
||||
if (factory != null)
|
||||
{
|
||||
ProcessVeinData(starVeinCount, factory.veinPool);
|
||||
}
|
||||
else
|
||||
{
|
||||
VeinGroup[] veinGroups = planet.runtimeVeinGroups;
|
||||
lock (planet.veinGroupsLock)
|
||||
{
|
||||
for (int i = 1; i < veinGroups.Length; i++)
|
||||
{
|
||||
starVeinCount[(int)veinGroups[i].type].numVeinGroups++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// update each resource to show the following vein group info:
|
||||
// Iron: <number of vein groups with miners> / <total number of vein groups>
|
||||
foreach (UIResAmountEntry uiresAmountEntry in __instance.entries)
|
||||
{
|
||||
int refId = uiresAmountEntry.refId;
|
||||
if (refId > 0 && refId < (int)EVeinType.Max)
|
||||
{
|
||||
var vt = starVeinCount[refId];
|
||||
if (vt.numVeinGroups > 0)
|
||||
{
|
||||
FormatResource(refId, uiresAmountEntry, vt);
|
||||
}
|
||||
else if (vt.textCtrl != null)
|
||||
{
|
||||
vt.textCtrl.text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class VeinTypeInfo
|
||||
{
|
||||
public int numVeinGroups;
|
||||
public int numVeinGroupsWithCollector;
|
||||
public Text textCtrl;
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
numVeinGroups = 0;
|
||||
numVeinGroupsWithCollector = 0;
|
||||
if (textCtrl != null)
|
||||
{
|
||||
textCtrl.text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add config button to main menu
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(UIRoot), nameof(UIRoot._OnOpen))]
|
||||
public static void UIRoot__OnOpen_Postfix()
|
||||
{
|
||||
Functions.UIFunctions.InitMenuButtons();
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(PlanetData), nameof(PlanetData.NotifyScanEnded))]
|
||||
private static void PlanetData_NotifyScanEnded_Postfix(PlanetData __instance)
|
||||
{
|
||||
if (PlanetModelingManager.scnPlanetReqList.Count > 0) return;
|
||||
BepInEx.ThreadingHelper.Instance.StartSyncInvoke(Functions.UIFunctions.OnPlanetScanEnded);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(UIPlanetGlobe), nameof(UIPlanetGlobe.DistributeButtons))]
|
||||
private static void UIPlanetGlobe_DistributeButtons_Postfix(UIPlanetGlobe __instance)
|
||||
{
|
||||
Functions.UIFunctions.UpdateGlobeButtonPosition(__instance);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(UIStarmapStar), nameof(UIStarmapStar.OnStarDisplayNameChange))]
|
||||
private static bool UIStarmapStar_OnStarDisplayNameChange_Prefix()
|
||||
{
|
||||
return Functions.UIFunctions.CornerComboBoxIndex == 0;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(UIStarmapStar), nameof(UIStarmapStar._OnClose))]
|
||||
private static void UIStarmapStar__OnClose_Postfix(UIStarmapStar __instance)
|
||||
{
|
||||
Functions.UIFunctions.StarmapFilterToggler?.SetCheckedWithEvent(false);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(UIMechaLab), nameof(UIMechaLab.DetermineVisible))]
|
||||
private static bool UIMechaLab_DetermineVisible_Prefix(UIMechaLab __instance, ref bool __result)
|
||||
{
|
||||
if (!UIRoot.instance.uiGame.starmap.active || !Functions.UIFunctions.StarmapFilterToggler.Checked)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
__instance._Close();
|
||||
__result = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(UIGoalPanel), nameof(UIGoalPanel.DetermineVisiable))]
|
||||
private static bool UIGoalPanel_DetermineVisiable_Prefix(UIGoalPanel __instance)
|
||||
{
|
||||
if (!UIRoot.instance.uiGame.starmap.active || !Functions.UIFunctions.StarmapFilterToggler.Checked)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
__instance.isUseOverwrittenState = true;
|
||||
if (__instance.stateOverwritten == EUIGoalPanelState.None)
|
||||
{
|
||||
__instance.stateOverwritten = EUIGoalPanelState.Collapse;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,118 +1,146 @@
|
||||
# UXAssist
|
||||
|
||||
#### Some functions and patches for better user experience
|
||||
<details>
|
||||
<summary>Read me in English</summary>
|
||||
|
||||
#### 一些提升用户体验的功能和补丁
|
||||
***Some functions and patches for better user experience***
|
||||
|
||||
## Usage
|
||||
|
||||
* Press `` Alt+`(BackQuote) `` to call up the config panel. You can change the shortcut on the panel.
|
||||
* There are also buttons on title screen and planet minimap area to call up the config panel.
|
||||
* Patches:
|
||||
+ Strict hotkey dectection for build menu, thus building hotkeys(0~9, F1~F10, X, U) are not triggered while holding Ctrl/Alt/Shift.
|
||||
+ Fix a bug that warning popup on `Veins Utilization` upgraded to level 8000+
|
||||
+ Sort blueprint structures before saving, to reduce generated blueprint data size a little
|
||||
+ Increase maximum count of Metadata Instantiations to 20000 (from 2000)
|
||||
+ Increase capacity of player order queue to 128 (from 16)
|
||||
+ Enable `Hide UI` function(`F11` by default) while on Star Map view
|
||||
+ Append mod profile name to game window title, if using mod managers (`Thunderstore Mod Manager` or `r2modman`).
|
||||
* Strict hotkey dectection for build menu, thus building hotkeys(0~9, F1~F10, X, U) are not triggered while holding Ctrl/Alt/Shift.
|
||||
* Fix a bug that warning popup on `Veins Utilization` upgraded to level 8000+
|
||||
* Sort blueprint structures before saving, to reduce generated blueprint data size a little
|
||||
* Increase maximum count of Metadata Instantiations to 20000 (from 2000)
|
||||
* Increase capacity of player order queue to 128 (from 16)
|
||||
* Enable `Hide UI` function(`F11` by default) while on Star Map view
|
||||
* Append mod profile name to game window title, if using mod managers (`Thunderstore Mod Manager` or `r2modman`).
|
||||
* Features:
|
||||
+ General
|
||||
- Enable game window resize
|
||||
- Remember window position and size on last exit
|
||||
- Convert Peace-Mode saves to Combat-Mode on loading
|
||||
- Scale up mouse cursor
|
||||
- Note: This will enable software cursor mode, which may cause mouse movement lag on heavy load.
|
||||
- Mod manager profile based save folder
|
||||
- Save files are stored in `Save\<ProfileName>` folder.
|
||||
- Will use original save location if matching default profile name.
|
||||
- Logical Frame Rate
|
||||
- This will change game running speed, down to 0.1x slower and up to 10x faster.
|
||||
- A pair of shortcut keys (`-` and `+`) to change the logical frame rate by -0.5x and +0.5x.
|
||||
- Note:
|
||||
- High logical frame rate is not guaranteed to be stable, especially when factories are under heavy load.
|
||||
- This will not affect some game animations.
|
||||
- When set game speed in mod `Auxilaryfunction`, this feature will be disabled.
|
||||
- When mod `BulletTime` is installed, this feature will be hidden, but patch `BulletTime`'s speed control, to make its maximum speed 10x.
|
||||
- Set process priority
|
||||
- Set enabled CPU threads
|
||||
- Increase maximum count of Metadata Instantiations to 20000 (from 2000)
|
||||
- Increase capacity of player order queue to 128 (from 16)
|
||||
+ Planet/Factory
|
||||
- Sunlight at night
|
||||
- Remove some build conditions
|
||||
- Remove build count and range limit
|
||||
- Larger area for upgrade and dismantle(30x30 at max)
|
||||
- Larger area for terraform(30x30 at max)
|
||||
- Off-grid building and stepped rotation
|
||||
- Treat stack items as single in monitor components
|
||||
- Enhanced control for logistic storage limits
|
||||
- Logistic storage limits are not scaled on upgrading `Logistics Carrier Capacity`, if they are not set to maximum capacity.
|
||||
- You can use arrow keys to adjust logistic storage limits gracefully.
|
||||
- Quick build and dismantle stacking labs/storages/tanks
|
||||
- Fast fill in to and take out from tanks
|
||||
- You can set multiplier for tanks' operation speed
|
||||
- This affects manually fill in to and/or take out from tanks, as well as transfer from upper to lower level.
|
||||
- Protect veins from exhaustion
|
||||
- By default, the vein amount is protected at 100, and oil speed is protected at 1.0/s, you can set them yourself in config file.
|
||||
- When reach the protection value, veins/oils steeps will not be mined/extracted any longer.
|
||||
- Close this function to resume mining and pumping, usually when you have enough level on `Veins Utilization`
|
||||
- Do not render factory entities (except belts and sorters)
|
||||
- This also makes players click though factory entities but belts and sorters
|
||||
- Drag building power poles in maximum connection range
|
||||
- Allow overflow for Logistic Stations and Advanced Mining Machines
|
||||
- Allow overflow when trying to insert in-hand items
|
||||
- Allow `Enhanced control for logistic storage limits` to exceed tech capacity limits
|
||||
- Remove logistic strorage limit check on loading game
|
||||
- Logistics Control Panel Improvement
|
||||
- Auto apply filter with item under mouse cursor while opening the panel
|
||||
- Quick-set item filter while right-clicking item icons in storage list on the panel
|
||||
- Real-time logistic stations info panel
|
||||
- Re-intialize planet (without reseting veins)
|
||||
- Quick dismantle all buildings (without drops)
|
||||
- Quick build Orbital Collectors
|
||||
- Belt signals for buy out dark fog items automatically
|
||||
- 6 belt signals are added to the signal panel, which can be used to buy out dark fog items automatically.
|
||||
- Generated items are stacked in 4 items.
|
||||
- Exchange ratio is following the original game design, aka:
|
||||
- 1 Metaverse = 20 Dark Fog Matrices
|
||||
- 1 Metaverse = 60 Engery Shards
|
||||
- 1 Metaverse = 30 Silicon-based Neurons
|
||||
- 1 Metaverse = 30 Negentropy Singularities
|
||||
- 1 Metaverse = 30 Matter Recombinators
|
||||
- 1 Metaverse = 10 Core Elements
|
||||
+ Player/Mecha
|
||||
- Unlimited interactive range
|
||||
- Enable player actions in globe view
|
||||
- Hide tips for soil piles changes
|
||||
- Enhanced count control for hand-make
|
||||
- Auto navigation on sailings
|
||||
- It keeps Icarus on course to the target planet
|
||||
- It will try to bypass any obstacles(planets, stars or dark-fog hives) on the way
|
||||
- Furthermore, you can set a shortcut key in the system options window, which is used to toggle `Auto-cruise` that enables flying to targeted planets fully automatically.
|
||||
- Auto-cruise will start when you select a planet as target
|
||||
- It will use warper to fly to the target planet if the planet is too far away, the range can be configured.
|
||||
- It will speed down when approaching the target planet, to avoid overshooting
|
||||
+ Dyson Sphere
|
||||
- Stop ejectors when available nodes are all filled up
|
||||
- Construct only structure points but frames
|
||||
- Re-initialize Dyson Spheres
|
||||
- Quick dismantle Dyson Shells
|
||||
- Dyson Sphere "Auto Fast Build" speed multiplier
|
||||
- Note: this only applies to `Dyson Sphere "Auto Fast Build"` in sandbox mode
|
||||
+ Tech
|
||||
- Restore upgrades of `Sorter Cargo Stacking` on panel
|
||||
- Set `Sorter Cargo Stacking` to unresearched state
|
||||
- Buy out techs with their prerequisites
|
||||
- This enables batch buying out techs with their prerequisites. Buy-out button is shown for all locked techs/upgrads.
|
||||
+ Combat
|
||||
- Open Dark Fog Communicator anywhere
|
||||
* General
|
||||
* Enable game window resize
|
||||
* Remember window position and size on last exit
|
||||
* Convert Peace-Mode saves to Combat-Mode on loading
|
||||
* Mod manager profile based save folder
|
||||
* Save files are stored in `Save\<ProfileName>` folder.
|
||||
* Will use original save location if matching default profile name.
|
||||
* Mod manager profile based option
|
||||
* Option file is stored as `Options\<ProfileName>.xml`.
|
||||
* Logical Frame Rate
|
||||
* This will change game running speed, down to 0.1x slower and up to 10x faster.
|
||||
* A pair of shortcut keys (`-` and `+`) to change the logical frame rate by -0.5x and +0.5x.
|
||||
* Note:
|
||||
* High logical frame rate is not guaranteed to be stable, especially when factories are under heavy load.
|
||||
* This will not affect some game animations.
|
||||
* When set game speed in mod `Auxilaryfunction`, this feature will be disabled.
|
||||
* When mod `BulletTime` is installed, this feature will be hidden, but patch `BulletTime`'s speed control, to make its maximum speed 10x.
|
||||
* Set process priority
|
||||
* Increase maximum count of Metadata Instantiations to 20000 (from 2000)
|
||||
* Increase capacity of player order queue to 128 (from 16)
|
||||
* Factory
|
||||
* Sunlight at night
|
||||
* Remove some build conditions
|
||||
* Remove build count and range limit
|
||||
* Larger area for upgrade and dismantle(30x30 at max)
|
||||
* Larger area for terraform(30x30 at max)
|
||||
* Off-grid building and stepped rotation
|
||||
* Cut conveyor belt
|
||||
* Press shortcut key to cut conveyor belt under cursor.
|
||||
* The default shortcut key is Alt+X, you can set it in system options panel.
|
||||
* Treat stack items as single in monitor components
|
||||
* Quick build and dismantle stacking labs/storages/tanks
|
||||
* Fast fill in to and take out from tanks
|
||||
* You can set multiplier for tanks' operation speed
|
||||
* This affects manually fill in to and/or take out from tanks, as well as transfer from upper to lower level.
|
||||
* Protect veins from exhaustion
|
||||
* By default, the vein amount is protected at 100, and oil speed is protected at 1.0/s, you can set them yourself in config file.
|
||||
* When reach the protection value, veins/oils steeps will not be mined/extracted any longer.
|
||||
* Close this function to resume mining and pumping, usually when you have enough level on `Veins Utilization`
|
||||
* Do not render factory entities (except belts and sorters)
|
||||
* This also makes players click though factory entities but belts and sorters
|
||||
* Drag building power poles in maximum connection range
|
||||
* Dismantle blueprint selected buildings
|
||||
* Press shortcut key in blueprint copy mode to dismantle selected buildings.
|
||||
* The default shortcut key is Ctrl+X, you can set it in system options panel.
|
||||
* Re-intialize planet (without reseting veins)
|
||||
* Quick dismantle all buildings (without drops)
|
||||
* Quick build Orbital Collectors
|
||||
* Belt signals for buy out dark fog items automatically
|
||||
* 6 belt signals are added to the signal panel, which can be used to buy out dark fog items automatically.
|
||||
* Generated items are stacked in 4 items.
|
||||
* Exchange ratio is following the original game design, aka:
|
||||
* 1 Metaverse = 20 Dark Fog Matrices
|
||||
* 1 Metaverse = 60 Engery Shards
|
||||
* 1 Metaverse = 30 Silicon-based Neurons
|
||||
* 1 Metaverse = 30 Negentropy Singularities
|
||||
* 1 Metaverse = 30 Matter Recombinators
|
||||
* 1 Metaverse = 10 Core Elements
|
||||
* Tweak building buffer
|
||||
* Factory recipe buffer formula: take the larger value between `Assembler buffer time multiplier(in seconds) * items needed per second` and `Assembler buffer minimum multiplier * items needed per recipe`
|
||||
* `Assembler buffer time multiplier(in seconds)`: Range 2-10, default is 4 (same as game)
|
||||
* `Assembler buffer minimum multiplier`: Range 2-10, default is 2 (same as game)
|
||||
* Matrix Lab assembly mode formula: Default buffer is `Buffer count for assembling in labs`, when using Self-evolution Lab, if recipe's original production time is not greater than 9 seconds, add `Extra buffer count for Self-evolution Labs` * (`Lab speed` - 1)
|
||||
* `Buffer count for assembling in labs`: Range 2-20, default is 6 (same as game)
|
||||
* `Extra buffer count for Self-evolution Labs`: Range 1-10, default is 3 (same as game)
|
||||
* `Buffer count for researching in labs`: Range 2-20, default is 10 (same as game)
|
||||
* `Ray Receiver Graviton Lens buffer count`: Range 1-20, default is 1 (game default is 20)
|
||||
* `Ejector Solar Sails buffer count`: Range 5-400 (step by 5), default is 20 (same as game)
|
||||
* `Silo Rockets buffer count`: Range 1-20, default is 20 (same as game)
|
||||
* Logistics
|
||||
* Enhanced control for logistic storage capacities
|
||||
* Logistic storage capacities are not scaled on upgrading `Logistics Carrier Capacity`, if they are not set to maximum capacity or already greater than maximum capacity.
|
||||
* You can use arrow keys to adjust logistic storage capacities gracefully.
|
||||
* Logistics Control Panel Improvement
|
||||
* Auto apply filter with item under mouse cursor while opening the panel
|
||||
* Quick-set item filter while right-clicking item icons in storage list on the panel
|
||||
* Allow overflow for Logistic Stations and Advanced Mining Machines
|
||||
* Allow overflow when trying to insert in-hand items
|
||||
* Allow `Enhanced control for logistic storage capacities` to exceed tech capacity limits
|
||||
* Remove logistic strorage capacity limit check on loading game
|
||||
* Real-time logistic stations info panel
|
||||
* Auto-config logistic stations
|
||||
* Auto-config buildings include: Logistics Distributor, PLS, ILS, Advanced Mining Machine
|
||||
* Player/Mecha
|
||||
* Unlimited interactive range
|
||||
* Enable player actions in globe view
|
||||
* Hide tips for soil piles changes
|
||||
* Enhanced count control for hand-make
|
||||
* Auto navigation on sailings
|
||||
* It keeps Icarus on course to the target planet
|
||||
* It will try to bypass any obstacles(planets, stars or dark-fog hives) on the way
|
||||
* Furthermore, you can set a shortcut key in the system options window, which is used to toggle `Auto-cruise` that enables flying to targeted planets fully automatically.
|
||||
* Auto-cruise will start when you select a planet as target
|
||||
* It will use warper to fly to the target planet if the planet is too far away, the range can be configured.
|
||||
* It will speed down when approaching the target planet, to avoid overshooting
|
||||
* Dyson Sphere
|
||||
* Stop ejectors when available nodes are all filled up
|
||||
* Construct only structure points but frames
|
||||
* Re-initialize Dyson Spheres
|
||||
* Quick dismantle Dyson Shells
|
||||
* Dyson Sphere "Auto Fast Build" speed multiplier
|
||||
* Note: this only applies to `Dyson Sphere "Auto Fast Build"` in sandbox mode
|
||||
* Tech
|
||||
* Restore upgrades of `Sorter Cargo Stacking` on panel
|
||||
* Set `Sorter Cargo Stacking` to unresearched state
|
||||
* Buy out techs with their prerequisites
|
||||
* This enables batch buying out techs with their prerequisites. Buy-out button is shown for all locked techs/upgrads.
|
||||
* Combat
|
||||
* Open Dark Fog Communicator anywhere
|
||||
* UI
|
||||
* Embedded [Planet Vein Untilization](https://thunderstore.io/c/dyson-sphere-program/p/testpushpleaseignore/Planet_Vein_Utilization/) due to its lack of maintainance, with minor bug fixes.
|
||||
* Shortcut keys for showing stars' name
|
||||
* Add a shortcut key to always show all star names in starmap when holding, default is `Alt`
|
||||
* Add a shortcut key to toggle between three star name display states in starmap: `Original state`, `Show all names`, `Hide all names`, default is `Tab`, will restore to original state when closing starmap
|
||||
* Starmap view:
|
||||
* Add a star name filter, you can filter displayed star names by ores or planet types now.
|
||||
* Add a dropdown box to show all stars' distance and/or planet count.
|
||||
|
||||
## Notes
|
||||
|
||||
* Please upgrade `BepInEx` 5.4.21 or later if using with [BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/) to avoid possible conflicts.
|
||||
+ You can download `BepInEx` [here](https://github.com/bepinex/bepinex/releases/latest)(choose x64 edition).
|
||||
+ If using with r2modman, you can upgrade `BepInEx` by clicking `Settings` -> `Browse profile folder`, then extract downloaded zip to the folder and overwrite existing files.
|
||||
* You can download [BepInEx here](https://github.com/bepinex/bepinex/releases/latest)(choose x64 edition).
|
||||
* If using with r2modman, you can upgrade `BepInEx` by clicking `Settings` -> `Browse profile folder`, then extract downloaded zip to the folder and overwrite existing files.
|
||||
|
||||
## CREDITS
|
||||
|
||||
@@ -121,117 +149,156 @@
|
||||
* [LSTM](https://github.com/hetima/DSP_LSTM) & [PlanetFinder](https://github.com/hetima/DSP_PlanetFinder): UI implementations
|
||||
* [OffGridConstruction](https://github.com/Velociraptor115-DSPModding/OffGridConstruction): Off-grid building & stepped rotation implementations
|
||||
* [CruiseAssist](https://dsp.thunderstore.io/package/tanu/CruiseAssist/) and its extension [AutoPilot](https://dsp.thunderstore.io/package/tanu/AutoPilot/): `Auto navigation on sailings` and `Auto-cruise` implementations
|
||||
* [Planet Vein Untilization](https://thunderstore.io/c/dyson-sphere-program/p/testpushpleaseignore/Planet_Vein_Utilization/)
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>中文读我</summary>
|
||||
|
||||
***一些提升用户体验的功能和补丁***
|
||||
|
||||
## Bug反馈
|
||||
|
||||
* QQ群:372754090
|
||||
|
||||
## 使用说明
|
||||
|
||||
* 按 `` Alt+`(反引号) `` 键呼出主面板,可以在面板上修改快捷键。
|
||||
* 标题界面和行星小地图旁也有按钮呼出主面板。
|
||||
* 补丁:
|
||||
+ 更严格的建造菜单热键检测,因此在按住Ctrl/Alt/Shift时不再会触发建造热键(0~9, F1~F10, X, U)
|
||||
+ 修复了`矿物利用`升级到8000级以上时弹出警告的bug
|
||||
+ 保存蓝图前对建筑进行排序,以减少生成的蓝图数据大小
|
||||
+ 将元数据提取的最大数量增加到20000(原来为2000)
|
||||
+ 将玩家指令队列的容量增加到128(原来为16)
|
||||
+ 在星图视图中启用`隐藏UI`功能(默认按键为`F11`)
|
||||
+ 如果使用mod管理器(`Thunderstore Mod Manager`或`r2modman`)启动游戏,在游戏窗口标题中追加mod配置档案名
|
||||
* 更严格的建造菜单热键检测,因此在按住Ctrl/Alt/Shift时不再会触发建造热键(0~9, F1~F10, X, U)
|
||||
* 修复了`矿物利用`升级到8000级以上时弹出警告的bug
|
||||
* 保存蓝图前对建筑进行排序,以减少生成的蓝图数据大小
|
||||
* 将元数据提取的最大数量增加到20000(原来为2000)
|
||||
* 将玩家指令队列的容量增加到128(原来为16)
|
||||
* 在星图视图中启用`隐藏UI`功能(默认按键为`F11`)
|
||||
* 如果使用mod管理器(`Thunderstore Mod Manager`或`r2modman`)启动游戏,在游戏窗口标题中追加mod配置档案名
|
||||
* 功能:
|
||||
+ 通用
|
||||
- 可调整游戏窗口大小(可最大化和拖动边框)
|
||||
- 记住上次退出时的窗口位置和大小
|
||||
- 在加载和平模式存档时将其转换为战斗模式
|
||||
- 放大鼠标指针
|
||||
- 注意:这将启用软件指针模式,可能会在CPU负载较重时导致鼠标移动延迟
|
||||
- 基于mod管理器配置档案名的存档文件夹
|
||||
- 存档文件会存储在`Save\<ProfileName>`文件夹中
|
||||
- 如果匹配默认配置档案名则使用原始存档位置
|
||||
- 逻辑帧倍率
|
||||
- 这将改变游戏运行速度,最慢0.1倍,最快10倍
|
||||
- 设置了一对快捷键(`-`和`+`),可以-/+0.5倍改变逻辑帧倍率
|
||||
- 注意:
|
||||
- 高逻辑帧倍率不能保证稳定性,特别是在工厂负载较重时
|
||||
- 这不会影响一些游戏动画
|
||||
- 当在`Auxilaryfunction`mod中设置游戏速度时,此功能将被禁用
|
||||
- 当安装了`BulletTime`mod时,此功能将被隐藏,但会对`BulletTime`的速度控制打补丁,使其最大速度变为10倍
|
||||
- 设置进程优先级
|
||||
- 设置使用的CPU线程
|
||||
- 将元数据提取的最大数量增加到20000(原来为2000)
|
||||
- 将玩家指令队列的容量增加到128(原来为16)
|
||||
+ 行星/工厂
|
||||
- 夜间日光灯
|
||||
- 移除部分不影响游戏逻辑的建造条件
|
||||
- 范围升级和拆除的最大区域扩大(最大30x30)
|
||||
- 范围铺设地基的最大区域扩大(最大30x30)
|
||||
- 脱离网格建造以及小角度旋转
|
||||
- 在流速计中将堆叠物品视为单个物品
|
||||
- 物流塔存储数量限制控制改进
|
||||
- 当升级`运输机舱扩容`时,不会对各种物流塔的存储限制按比例提升,除非设置为最大允许容量。
|
||||
- 你可以使用方向键微调物流塔存储限制
|
||||
- 快速建造和拆除堆叠研究站/储物仓/储液罐
|
||||
- 储液罐快速注入和抽取液体
|
||||
- 你可以设置储液罐操作速度的倍率
|
||||
- 影响手动注入和抽取,以及从储液罐上层传输到下层的速度
|
||||
- 保护矿脉不会耗尽
|
||||
- 默认矿脉数量保护在100,采油速保护在1.0/s,你可以在配置文件中自行设置。
|
||||
- 当达到保护值时,矿脉和油井将不再被开采。
|
||||
- 关闭此功能以恢复开采,一般是当你在`矿物利用`上有足够的等级时。
|
||||
- 不渲染工厂建筑实体(除了传送带和分拣器)
|
||||
- 这也使玩家可以点穿工厂实体直接点到传送带和分拣器
|
||||
- 拖动建造电线杆时自动使用最大连接距离间隔
|
||||
- 允许物流塔和大型采矿机物品溢出
|
||||
- 当尝试塞入手中物品时允许溢出
|
||||
- 允许`物流塔存储数量限制控制改进`超过科技容量限制
|
||||
- 在加载游戏时移除物流塔容量限制检查
|
||||
- 物流控制面板改进
|
||||
- 打开面板时自动将鼠标指向物品设为筛选条件
|
||||
- 在控制面板物流塔列表中右键点击物品图标快速设置为筛选条件
|
||||
- 物流运输站实时信息面板
|
||||
- 注意:如果你启用了`Auxilaryfunction`中的`展示物流站信息`,此功能将被隐藏
|
||||
- 初始化本行星(不重置矿脉)
|
||||
- 快速拆除所有建筑(不掉落)
|
||||
- 快速建造轨道采集器
|
||||
- 用于自动购买黑雾物品的传送带信号
|
||||
- 在信号面板上添加了6个传送带信号,可以用于自动购买黑雾道具。
|
||||
- 生成的物品堆叠数为4。
|
||||
- 兑换比率遵循原始游戏设计,即:
|
||||
- 1个元宇宙 = 20个黑雾矩阵
|
||||
- 1个元宇宙 = 60个能量碎片
|
||||
- 1个元宇宙 = 30个硅基神经元
|
||||
- 1个元宇宙 = 30个负熵奇点
|
||||
- 1个元宇宙 = 30个物质重组器
|
||||
- 1个元宇宙 = 10个核心素
|
||||
+ 玩家/机甲
|
||||
- 无限交互距离
|
||||
- 移除建造数量和范围限制
|
||||
- 在行星视图中允许玩家操作
|
||||
- 隐藏沙土数量变动的提示
|
||||
- 手动制造物品的数量控制改进
|
||||
- 航行时自动导航
|
||||
- 它会保持伊卡洛斯飞向目标星球
|
||||
- 它会尝试绕过途中的任何障碍物(行星、恒星或黑雾巢穴)
|
||||
- 此外,可以在系统选项窗口中设置快捷键,用于切换`自动巡航`,实现完全自动化的飞行至目标星球。
|
||||
- 当你选择目标星球后,自动巡航就会开始
|
||||
- 如果目标星球距离过远会自动使用曲速(超过5AU),你可以在面板上更改这个值。
|
||||
- 它会在接近目标星球时减速,以避免发生越过目标的情况
|
||||
+ 戴森球
|
||||
- 可用节点全部造完时停止弹射
|
||||
- 只建造节点不建造框架
|
||||
- 初始化戴森球
|
||||
- 快速拆除戴森壳
|
||||
- 戴森球自动快速建造速度倍率
|
||||
- 注意:这仅适用于沙盒模式下的`戴森球自动快速建造`功能
|
||||
+ 科研
|
||||
- 在升级面板上恢复`分拣器货物堆叠`的升级
|
||||
- 将`分拣器货物堆叠`设为未研究状态
|
||||
- 买断科技也同时买断所有前置科技
|
||||
- 这使得可以批量买断科技及其所有前置科技。所有未解锁的科技/升级都会显示买断按钮。
|
||||
+ 战斗
|
||||
- 在任意位置打开黑雾通讯器
|
||||
* 通用
|
||||
* 可调整游戏窗口大小(可最大化和拖动边框)
|
||||
* 记住上次退出时的窗口位置和大小
|
||||
* 在加载和平模式存档时将其转换为战斗模式
|
||||
* 基于mod管理器配置档案名的存档文件夹
|
||||
* 存档文件会存储在`Save\<ProfileName>`文件夹中
|
||||
* 如果匹配默认配置档案名则使用原始存档位置
|
||||
* 基于mod管理器配置档案名的选项文件
|
||||
* 选项文件存储为`Options\<ProfileName>.xml`
|
||||
* 逻辑帧倍率
|
||||
* 这将改变游戏运行速度,最慢0.1倍,最快10倍
|
||||
* 设置了一对快捷键(`-`和`+`),可以-/+0.5倍改变逻辑帧倍率
|
||||
* 注意:
|
||||
* 高逻辑帧倍率不能保证稳定性,特别是在工厂负载较重时
|
||||
* 这不会影响一些游戏动画
|
||||
* 当在`Auxilaryfunction`mod中设置游戏速度时,此功能将被禁用
|
||||
* 当安装了`BulletTime`mod时,此功能将被隐藏,但会对`BulletTime`的速度控制打补丁,使其最大速度变为10倍
|
||||
* 设置进程优先级
|
||||
* 将元数据提取的最大数量增加到20000(原来为2000)
|
||||
* 将玩家指令队列的容量增加到128(原来为16)
|
||||
* 工厂
|
||||
* 夜间日光灯
|
||||
* 移除部分不影响游戏逻辑的建造条件
|
||||
* 范围升级和拆除的最大区域扩大(最大30x30)
|
||||
* 范围铺设地基的最大区域扩大(最大30x30)
|
||||
* 脱离网格建造以及小角度旋转
|
||||
* 切割传送带
|
||||
* 按快捷键切割光标位置的传送带
|
||||
* 默认快捷键是Alt+X,可以在系统选项面板中设置
|
||||
* 在流速计中将堆叠物品视为单个物品
|
||||
* 快速建造和拆除堆叠研究站/储物仓/储液罐
|
||||
* 储液罐快速注入和抽取液体
|
||||
* 你可以设置储液罐操作速度的倍率
|
||||
* 影响手动注入和抽取,以及从储液罐上层传输到下层的速度
|
||||
* 保护矿脉不会耗尽
|
||||
* 默认矿脉数量保护在100,采油速保护在1.0/s,你可以在配置文件中自行设置。
|
||||
* 当达到保护值时,矿脉和油井将不再被开采。
|
||||
* 关闭此功能以恢复开采,一般是当你在`矿物利用`上有足够的等级时。
|
||||
* 不渲染工厂建筑实体(除了传送带和分拣器)
|
||||
* 这也使玩家可以点穿工厂实体直接点到传送带和分拣器
|
||||
* 拖动建造电线杆时自动使用最大连接距离间隔
|
||||
* 拆除蓝图选中的建筑
|
||||
* 在蓝图复制模式下按快捷键拆除选中的建筑
|
||||
* 默认快捷键是Ctrl+X,可以在系统选项面板中设置
|
||||
* 初始化本行星(不重置矿脉)
|
||||
* 快速拆除所有建筑(不掉落)
|
||||
* 快速建造轨道采集器
|
||||
* 用于自动购买黑雾物品的传送带信号
|
||||
* 在信号面板上添加了6个传送带信号,可以用于自动购买黑雾道具。
|
||||
* 生成的物品堆叠数为4。
|
||||
* 兑换比率遵循原始游戏设计,即:
|
||||
* 1个元宇宙 = 20个黑雾矩阵
|
||||
* 1个元宇宙 = 60个能量碎片
|
||||
* 1个元宇宙 = 30个硅基神经元
|
||||
* 1个元宇宙 = 30个负熵奇点
|
||||
* 1个元宇宙 = 30个物质重组器
|
||||
* 1个元宇宙 = 10个核心素
|
||||
* 调整建筑输入缓冲
|
||||
* 工厂配方计算公式,在`工厂配方缓冲时间倍率秒数x每秒需要的原料数量`和`工厂配方缓冲最小倍率x每生产一次配方需要的原料数量`中取更大的那个值
|
||||
* `工厂配方缓冲时间倍率(秒)`:范围2-10,默认为4(同游戏)
|
||||
* `工厂配方缓冲最小倍率`:范围2-10,默认为2(同游戏)
|
||||
* 研究站矩阵合成模式计算公式,默认缓存`研究站矩阵合成模式缓存数量`个,当使用自演化研究站时,如果配方的原始生产时间不大于9秒,则增加`自演化研究站矩阵额外缓冲数量`*(`研究站速度倍率`-1)
|
||||
* `研究站矩阵合成模式缓存数量`:范围2-20,默认为6(同游戏)
|
||||
* `自演化研究站矩阵额外缓冲数量`:范围1-10,默认为3(同游戏)
|
||||
* `研究站科研模式缓存数量`:范围2-20,默认为10(同游戏)
|
||||
* `射线接收器透镜缓冲数量`:范围1-20,默认为1(游戏默认为20)
|
||||
* `弹射太阳帆缓冲区数量`:范围5-400(步进值为5),默认值为20(与游戏相同)
|
||||
* `发射井火箭缓冲区数量`:范围1-20,默认值为20(与游戏相同)
|
||||
* 物流
|
||||
* 物流塔存储数量限制控制改进
|
||||
* 当升级`运输机舱扩容`时,不会对各种物流塔的存储限制按比例提升,除非设置为最大允许容量或者已经超过升级后的最大容量。
|
||||
* 你可以使用方向键微调物流塔存储限制
|
||||
* 物流控制面板改进
|
||||
* 打开面板时自动将鼠标指向物品设为筛选条件
|
||||
* 在控制面板物流塔列表中右键点击物品图标快速设置为筛选条件
|
||||
* 允许物流塔和大型采矿机物品溢出
|
||||
* 当尝试塞入手中物品时允许溢出
|
||||
* 允许`物流塔存储数量限制控制改进`超过科技容量限制
|
||||
* 在加载游戏时移除物流塔容量限制检查
|
||||
* 物流运输站实时信息面板
|
||||
* 注意:如果你启用了`Auxilaryfunction`中的`展示物流站信息`,此功能将被隐藏
|
||||
* 自动配置物流站
|
||||
* 自动配置的建筑包括:物流配送器、行星物流站、星际物流站、高级采矿机
|
||||
* 玩家/机甲
|
||||
* 无限交互距离
|
||||
* 移除建造数量和范围限制
|
||||
* 在行星视图中允许玩家操作
|
||||
* 隐藏沙土数量变动的提示
|
||||
* 手动制造物品的数量控制改进
|
||||
* 航行时自动导航
|
||||
* 它会保持伊卡洛斯飞向目标星球
|
||||
* 它会尝试绕过途中的任何障碍物(行星、恒星或黑雾巢穴)
|
||||
* 此外,可以在系统选项窗口中设置快捷键,用于切换`自动巡航`,实现完全自动化的飞行至目标星球。
|
||||
* 当你选择目标星球后,自动巡航就会开始
|
||||
* 如果目标星球距离过远会自动使用曲速(超过5AU),你可以在面板上更改这个值。
|
||||
* 它会在接近目标星球时减速,以避免发生越过目标的情况
|
||||
* 戴森球
|
||||
* 可用节点全部造完时停止弹射
|
||||
* 只建造节点不建造框架
|
||||
* 初始化戴森球
|
||||
* 快速拆除戴森壳
|
||||
* 戴森球自动快速建造速度倍率
|
||||
* 注意:这仅适用于沙盒模式下的`戴森球自动快速建造`功能
|
||||
* 科研
|
||||
* 在升级面板上恢复`分拣器货物堆叠`的升级
|
||||
* 将`分拣器货物堆叠`设为未研究状态
|
||||
* 买断科技也同时买断所有前置科技
|
||||
* 这使得可以批量买断科技及其所有前置科技。所有未解锁的科技/升级都会显示买断按钮。
|
||||
* 战斗
|
||||
* 在任意位置打开黑雾通讯器
|
||||
* UI
|
||||
* 启用显示所有星系名称的快捷键
|
||||
* 新增一个快捷键,按住后始终在星图显示所有星系名称,默认为`Alt`
|
||||
* 新增一个快捷键,在星图视图切换三种星系名称显示状态:`原始显示状态`,`显示所有名称`,`隐藏所有名称`,默认为`Tab`,关闭星图时会恢复到原始状态
|
||||
* 星图:
|
||||
* 添加星系名过滤器,现在可以按矿物或行星类型过滤显示的星系名
|
||||
* 添加了一个下拉框用以切换显示所有星系的距离和/或行星数量
|
||||
* 由于缺乏维护,整合内置了[Planet Vein Untilization](https://thunderstore.io/c/dyson-sphere-program/p/testpushpleaseignore/Planet_Vein_Utilization/),并修复了一些小错误。
|
||||
|
||||
## 注意事项
|
||||
|
||||
* 如果和[BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/)一起使用,请升级`BepInEx`到5.4.21或更高版本,以避免可能的冲突。
|
||||
+ 你可以在[这里](https://github.com/bepinex/bepinex/releases/latest)(选择x64版本)下载`BepInEx`。
|
||||
+ 如果使用r2modman,你可以点击`Settings` -> `Browse profile folder`,然后将下载的zip解压到该文件夹并覆盖现有文件。
|
||||
* 你可以在[这里](https://github.com/bepinex/bepinex/releases/latest)(选择x64版本)下载`BepInEx`。
|
||||
* 如果使用r2modman,你可以点击`Settings` -> `Browse profile folder`,然后将下载的zip解压到该文件夹并覆盖现有文件。
|
||||
|
||||
## 鸣谢
|
||||
|
||||
@@ -239,4 +306,7 @@
|
||||
* [BepInEx](https://bepinex.dev/): 基础模组框架
|
||||
* [LSTM](https://github.com/hetima/DSP_LSTM) & [PlanetFinder](https://github.com/hetima/DSP_PlanetFinder): UI实现
|
||||
* [OffGridConstruction](https://github.com/Velociraptor115-DSPModding/OffGridConstruction): 脱离网格建造以及小角度旋转的实现
|
||||
* [CruiseAssist](https://dsp.thunderstore.io/package/tanu/CruiseAssist/)及其扩展[AutoPilot](https://dsp.thunderstore.io/package/tanu/AutoPilot/): `航行时自动导航`和`自动巡航`的实现
|
||||
* [CruiseAssist](https://dsp.thunderstore.io/package/tanu/CruiseAssist/)及其扩展[AutoPilot](https://dsp.thunderstore.io/package/tanu/AutoPilot/): `航行时自动导航`和`自动巡航`的实现
|
||||
* [Planet Vein Untilization](https://thunderstore.io/c/dyson-sphere-program/p/testpushpleaseignore/Planet_Vein_Utilization/)
|
||||
|
||||
</details>
|
||||
|
||||
266
UXAssist/UI/MyCheckButton.cs
Normal file
266
UXAssist/UI/MyCheckButton.cs
Normal file
@@ -0,0 +1,266 @@
|
||||
using System;
|
||||
using BepInEx.Configuration;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UXAssist.UI;
|
||||
|
||||
public class MyCheckButton : MonoBehaviour
|
||||
{
|
||||
public RectTransform rectTrans;
|
||||
public UIButton uiButton;
|
||||
public Image icon;
|
||||
public Text labelText;
|
||||
public event Action OnChecked;
|
||||
private bool _checked;
|
||||
private float _iconWidth = 28f;
|
||||
|
||||
private static GameObject _baseObject;
|
||||
|
||||
private static Color openMouseOverColor;
|
||||
private static Color openPressColor;
|
||||
private static Color openNormalColor;
|
||||
private static Color closeMouseOverColor;
|
||||
private static Color closePressColor;
|
||||
private static Color closeNormalColor;
|
||||
|
||||
public static void InitBaseObject()
|
||||
{
|
||||
if (_baseObject) return;
|
||||
var tankWindow = UIRoot.instance.uiGame.tankWindow;
|
||||
openMouseOverColor = tankWindow.openMouseOverColor;
|
||||
openPressColor = tankWindow.openPressColor;
|
||||
openNormalColor = tankWindow.openNormalColor;
|
||||
closeMouseOverColor = tankWindow.closeMouseOverColor;
|
||||
closePressColor = tankWindow.closePressColor;
|
||||
closeNormalColor = tankWindow.closeNormalColor;
|
||||
|
||||
var go = Instantiate(UIRoot.instance.uiGame.beltWindow.reverseButton.gameObject);
|
||||
go.name = "my-checkbutton";
|
||||
go.SetActive(false);
|
||||
var comp = go.transform.Find("text");
|
||||
if (comp)
|
||||
{
|
||||
var txt = comp.GetComponent<Text>();
|
||||
if (txt)
|
||||
{
|
||||
txt.text = "";
|
||||
txt.alignment = TextAnchor.MiddleCenter;
|
||||
txt.rectTransform.anchorMax = new Vector2(0f, 1f);
|
||||
txt.rectTransform.anchorMin = new Vector2(0f, 1f);
|
||||
txt.rectTransform.pivot = new Vector2(0f, 1f);
|
||||
txt.rectTransform.localPosition = new Vector3(0f, 0f, 0f);
|
||||
}
|
||||
var localizer = comp.GetComponent<Localizer>();
|
||||
if (localizer) DestroyImmediate(localizer);
|
||||
}
|
||||
_baseObject = go;
|
||||
}
|
||||
|
||||
protected void OnDestroy()
|
||||
{
|
||||
if (_config != null) _config.SettingChanged -= _configChanged;
|
||||
}
|
||||
|
||||
public static MyCheckButton CreateCheckButton(float x, float y, RectTransform parent, ConfigEntry<bool> config, string label = "", int fontSize = 15)
|
||||
{
|
||||
return CreateCheckButton(x, y, parent, config.Value, label, fontSize).WithConfigEntry(config);
|
||||
}
|
||||
|
||||
public static MyCheckButton CreateCheckButton(float x, float y, RectTransform parent, bool check, string label = "", int fontSize = 15)
|
||||
{
|
||||
return CreateCheckButton(x, y, parent, fontSize).WithCheck(check).WithLabelText(label);
|
||||
}
|
||||
|
||||
public static MyCheckButton CreateCheckButton(float x, float y, RectTransform parent, int fontSize = 15)
|
||||
{
|
||||
var go = Instantiate(_baseObject);
|
||||
go.name = "my-checkbutton";
|
||||
go.SetActive(true);
|
||||
var cb = go.AddComponent<MyCheckButton>();
|
||||
var rect = Util.NormalizeRectWithTopLeft(cb, x, y, parent);
|
||||
|
||||
cb.rectTrans = rect;
|
||||
cb.uiButton = go.GetComponent<UIButton>();
|
||||
|
||||
var child = go.transform.Find("text");
|
||||
if (child != null)
|
||||
{
|
||||
cb.labelText = child.GetComponent<Text>();
|
||||
if (cb.labelText)
|
||||
{
|
||||
cb.labelText.text = "";
|
||||
cb.labelText.fontSize = fontSize;
|
||||
}
|
||||
}
|
||||
|
||||
cb._iconWidth = Mathf.Min(cb._iconWidth > 0f ? cb._iconWidth : 32f, rect.sizeDelta.y);
|
||||
cb.UpdateCheckColor();
|
||||
cb.uiButton.onClick += cb.OnClick;
|
||||
cb.UpdateSize();
|
||||
return cb;
|
||||
}
|
||||
|
||||
public bool Checked
|
||||
{
|
||||
get => _checked;
|
||||
set
|
||||
{
|
||||
_checked = value;
|
||||
UpdateCheckColor();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetCheckedWithEvent(bool check)
|
||||
{
|
||||
if (_checked == check) return;
|
||||
Checked = check;
|
||||
OnChecked?.Invoke();
|
||||
}
|
||||
|
||||
public void SetLabelText(string val)
|
||||
{
|
||||
if (labelText != null)
|
||||
{
|
||||
labelText.text = val.Translate();
|
||||
}
|
||||
}
|
||||
|
||||
private EventHandler _configChanged;
|
||||
private Action _checkedChanged;
|
||||
private ConfigEntry<bool> _config;
|
||||
public void SetConfigEntry(ConfigEntry<bool> config)
|
||||
{
|
||||
if (_checkedChanged != null) OnChecked -= _checkedChanged;
|
||||
if (_configChanged != null) config.SettingChanged -= _configChanged;
|
||||
|
||||
_config = config;
|
||||
_checkedChanged = () => config.Value = !config.Value;
|
||||
OnChecked += _checkedChanged;
|
||||
_configChanged = (_, _) => Checked = config.Value;
|
||||
config.SettingChanged += _configChanged;
|
||||
}
|
||||
|
||||
public MyCheckButton WithLabelText(string val)
|
||||
{
|
||||
SetLabelText(val);
|
||||
return this;
|
||||
}
|
||||
|
||||
private void UpdateSize()
|
||||
{
|
||||
var width = rectTrans.sizeDelta.x;
|
||||
var height = rectTrans.sizeDelta.y;
|
||||
labelText.rectTransform.localPosition = new Vector3(icon != null ? _iconWidth : 0f, 0f, 0f);
|
||||
labelText.rectTransform.sizeDelta = new Vector2(icon != null ? width - _iconWidth : width, height);
|
||||
if (icon != null)
|
||||
{
|
||||
icon.rectTransform.sizeDelta = new Vector2(_iconWidth, _iconWidth);
|
||||
icon.rectTransform.localPosition = new Vector3(0f, -height * 0.5f, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public MyCheckButton WithSize(float width, float height)
|
||||
{
|
||||
rectTrans.sizeDelta = new Vector2(width, height);
|
||||
if (height < _iconWidth) _iconWidth = height;
|
||||
UpdateSize();
|
||||
return this;
|
||||
}
|
||||
|
||||
public MyCheckButton WithIconWidth(float width)
|
||||
{
|
||||
if (_iconWidth == width) return this;
|
||||
var height = rectTrans.sizeDelta.y;
|
||||
if (width > height)
|
||||
{
|
||||
width = height;
|
||||
if (_iconWidth == width) return this;
|
||||
}
|
||||
_iconWidth = width;
|
||||
if (icon != null) UpdateSize();
|
||||
return this;
|
||||
}
|
||||
|
||||
public MyCheckButton WithIcon(Sprite sprite = null)
|
||||
{
|
||||
if (icon == null)
|
||||
{
|
||||
var iconGo = new GameObject("icon");
|
||||
var rect = iconGo.AddComponent<RectTransform>();
|
||||
(icon = iconGo.AddComponent<Image>()).sprite = sprite;
|
||||
iconGo.transform.SetParent(rectTrans);
|
||||
rect.sizeDelta = new Vector2(_iconWidth, _iconWidth);
|
||||
rect.localScale = new Vector3(1f, 1f, 1f);
|
||||
rect.anchorMax = new Vector2(0f, 1f);
|
||||
rect.anchorMin = new Vector2(0f, 1f);
|
||||
rect.pivot = new Vector2(0f, 0.5f);
|
||||
var height = rectTrans.sizeDelta.y;
|
||||
rect.localPosition = new Vector3(0f, -height * 0.5f, 0f);
|
||||
iconGo.SetActive(sprite != null);
|
||||
UpdateSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
SetIcon(sprite);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public MyCheckButton WithTip(string tip, float delay = 1f)
|
||||
{
|
||||
uiButton.tips.type = UIButton.ItemTipType.Other;
|
||||
uiButton.tips.topLevel = true;
|
||||
uiButton.tips.tipTitle = tip;
|
||||
uiButton.tips.tipText = null;
|
||||
uiButton.tips.delay = delay;
|
||||
uiButton.tips.corner = 2;
|
||||
uiButton.UpdateTip();
|
||||
return this;
|
||||
}
|
||||
|
||||
public void SetIcon(Sprite sprite = null)
|
||||
{
|
||||
icon.sprite = sprite;
|
||||
icon.gameObject.SetActive(sprite != null);
|
||||
}
|
||||
|
||||
public MyCheckButton WithCheck(bool check)
|
||||
{
|
||||
Checked = check;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MyCheckButton WithConfigEntry(ConfigEntry<bool> config)
|
||||
{
|
||||
SetConfigEntry(config);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void OnClick(int obj)
|
||||
{
|
||||
_checked = !_checked;
|
||||
UpdateCheckColor();
|
||||
OnChecked?.Invoke();
|
||||
}
|
||||
|
||||
public float Width => rectTrans.sizeDelta.x + labelText.rectTransform.sizeDelta.x;
|
||||
public float Height => Math.Max(rectTrans.sizeDelta.y, labelText.rectTransform.sizeDelta.y);
|
||||
|
||||
private void UpdateCheckColor()
|
||||
{
|
||||
if (_checked)
|
||||
{
|
||||
uiButton.transitions[0].mouseoverColor = openMouseOverColor;
|
||||
uiButton.transitions[0].pressedColor = openPressColor;
|
||||
uiButton.transitions[0].normalColor = openNormalColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
uiButton.transitions[0].mouseoverColor = closeMouseOverColor;
|
||||
uiButton.transitions[0].pressedColor = closePressColor;
|
||||
uiButton.transitions[0].normalColor = new Color(0.6557f, 0.9145f, 1f, 0.0627f);
|
||||
}
|
||||
uiButton.RefreshTransitionsImmediately();
|
||||
}
|
||||
}
|
||||
@@ -18,10 +18,10 @@ public class MyCheckBox : MonoBehaviour
|
||||
|
||||
private static GameObject _baseObject;
|
||||
|
||||
private static readonly Color BoxColor = new Color(1f, 1f, 1f, 100f / 255f);
|
||||
private static readonly Color CheckColor = new Color(1f, 1f, 1f, 1f);
|
||||
private static readonly Color TextColor = new Color(178f / 255f, 178f / 255f, 178f / 255f, 168f / 255f);
|
||||
|
||||
private static readonly Color BoxColor = new(1f, 1f, 1f, 100f / 255f);
|
||||
private static readonly Color CheckColor = new(1f, 1f, 1f, 1f);
|
||||
private static readonly Color TextColor = new(178f / 255f, 178f / 255f, 178f / 255f, 168f / 255f);
|
||||
|
||||
public static void InitBaseObject()
|
||||
{
|
||||
if (_baseObject) return;
|
||||
@@ -41,7 +41,7 @@ public class MyCheckBox : MonoBehaviour
|
||||
|
||||
protected void OnDestroy()
|
||||
{
|
||||
_config.SettingChanged -= _configChanged;
|
||||
if (_config != null) _config.SettingChanged -= _configChanged;
|
||||
}
|
||||
|
||||
public static MyCheckBox CreateCheckBox(float x, float y, RectTransform parent, ConfigEntry<bool> config, string label = "", int fontSize = 15)
|
||||
@@ -66,6 +66,7 @@ public class MyCheckBox : MonoBehaviour
|
||||
cb.uiButton = go.GetComponent<UIButton>();
|
||||
cb.boxImage = go.transform.GetComponent<Image>();
|
||||
cb.checkImage = go.transform.Find("checked")?.GetComponent<Image>();
|
||||
Util.NormalizeRectWithTopLeft(cb.checkImage, 0f, 0f);
|
||||
|
||||
var child = go.transform.Find("text");
|
||||
if (child != null)
|
||||
@@ -82,7 +83,7 @@ public class MyCheckBox : MonoBehaviour
|
||||
cb.uiButton.onClick += cb.OnClick;
|
||||
return cb;
|
||||
}
|
||||
|
||||
|
||||
private void UpdateLabelTextWidth()
|
||||
{
|
||||
if (labelText) labelText.rectTransform.sizeDelta = new Vector2(labelText.preferredWidth, labelText.rectTransform.sizeDelta.y);
|
||||
@@ -150,7 +151,17 @@ public class MyCheckBox : MonoBehaviour
|
||||
Checked = check;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public MyCheckBox WithSmallerBox(float boxSize = 20f)
|
||||
{
|
||||
var oldWidth = rectTrans.sizeDelta.x;
|
||||
rectTrans.sizeDelta = new Vector2(boxSize, boxSize);
|
||||
checkImage.rectTransform.sizeDelta = new Vector2(boxSize, boxSize);
|
||||
labelText.rectTransform.sizeDelta = new Vector2(labelText.rectTransform.sizeDelta.x, boxSize);
|
||||
labelText.rectTransform.localPosition = new Vector3(labelText.rectTransform.localPosition.x + boxSize - oldWidth, labelText.rectTransform.localPosition.y, labelText.rectTransform.localPosition.z);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MyCheckBox WithEnable(bool on)
|
||||
{
|
||||
SetEnable(on);
|
||||
|
||||
@@ -34,7 +34,7 @@ public class MyComboBox : MonoBehaviour
|
||||
}
|
||||
var localizer = go.GetComponent<Localizer>();
|
||||
if (localizer) DestroyImmediate(localizer);
|
||||
|
||||
|
||||
var rect = (RectTransform)go.transform;
|
||||
var cbctrl = rect.transform.Find("ComboBox").GetComponent<UIComboBox>();
|
||||
foreach (var button in cbctrl.ItemButtons)
|
||||
@@ -93,7 +93,7 @@ public class MyComboBox : MonoBehaviour
|
||||
var oldPosition = rtrans.localPosition;
|
||||
var pwidth = _text.preferredWidth;
|
||||
rtrans.localPosition = new Vector3(pwidth + 5f, oldPosition.y, oldPosition.z);
|
||||
_rectTrans.sizeDelta = new Vector2(rtrans.localPosition.x + rtrans.sizeDelta.x, _rectTrans.sizeDelta.y);
|
||||
_rectTrans.sizeDelta = new Vector2(rtrans.localPosition.x + 5f + rtrans.sizeDelta.x, _rectTrans.sizeDelta.y);
|
||||
}
|
||||
|
||||
public void SetPrompt(string prompt)
|
||||
@@ -112,7 +112,12 @@ public class MyComboBox : MonoBehaviour
|
||||
UpdateComboBoxPosition();
|
||||
}
|
||||
|
||||
public void SetItems(params string[] items) => _comboBox.Items = items.Select(s => s.Translate()).ToList();
|
||||
public void SetItems(params string[] items)
|
||||
{
|
||||
_comboBox.Items = [.. items.Select(s => s.Translate())];
|
||||
_comboBox.StartItemIndex = 0;
|
||||
_comboBox.DropDownCount = Math.Min(items.Length, 8);
|
||||
}
|
||||
|
||||
public void SetIndex(int index) => _comboBox.itemIndex = index;
|
||||
|
||||
@@ -146,7 +151,7 @@ public class MyComboBox : MonoBehaviour
|
||||
SetPrompt(prompt);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public MyComboBox WithFontSize(int size)
|
||||
{
|
||||
SetFontSize(size);
|
||||
@@ -158,7 +163,7 @@ public class MyComboBox : MonoBehaviour
|
||||
SetItems(items);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public MyComboBox WithIndex(int index)
|
||||
{
|
||||
SetIndex(index);
|
||||
|
||||
@@ -14,7 +14,7 @@ public class MyConfigWindow : MyWindowWithTabs
|
||||
{
|
||||
return MyWindowManager.CreateWindow<MyConfigWindow>("UXAConfigWindow", "UXAssist Config");
|
||||
}
|
||||
|
||||
|
||||
public static void DestroyInstance(MyConfigWindow win)
|
||||
{
|
||||
MyWindowManager.DestroyWindow(win);
|
||||
|
||||
153
UXAssist/UI/MyCornerComboBox.cs
Normal file
153
UXAssist/UI/MyCornerComboBox.cs
Normal file
@@ -0,0 +1,153 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BepInEx.Configuration;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UXAssist.UI;
|
||||
|
||||
public class MyCornerComboBox : MonoBehaviour
|
||||
{
|
||||
private RectTransform _rectTrans;
|
||||
private UIComboBox _comboBox;
|
||||
public Action<int> OnSelChanged;
|
||||
|
||||
private static GameObject _baseObject;
|
||||
|
||||
public static void InitBaseObject()
|
||||
{
|
||||
if (_baseObject) return;
|
||||
var go = Instantiate(UIRoot.instance.uiGame.starDetail.displayCombo.gameObject);
|
||||
go.name = "my-small-combobox";
|
||||
go.SetActive(false);
|
||||
|
||||
var cbctrl = go.transform.GetComponent<UIComboBox>();
|
||||
cbctrl.onSubmit.RemoveAllListeners();
|
||||
cbctrl.onItemIndexChange.RemoveAllListeners();
|
||||
foreach (var button in cbctrl.ItemButtons)
|
||||
{
|
||||
Destroy(button.gameObject);
|
||||
}
|
||||
cbctrl.Items.Clear();
|
||||
cbctrl.ItemButtons.Clear();
|
||||
_baseObject = go;
|
||||
}
|
||||
|
||||
public static MyCornerComboBox CreateComboBox(float x, float y, RectTransform parent, bool topRight = false)
|
||||
{
|
||||
var gameObject = Instantiate(_baseObject);
|
||||
gameObject.name = "my-combobox";
|
||||
gameObject.SetActive(true);
|
||||
var cb = gameObject.AddComponent<MyCornerComboBox>();
|
||||
RectTransform rtrans;
|
||||
if (topRight)
|
||||
{
|
||||
rtrans = Util.NormalizeRectWithTopRight(cb, x, y, parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
rtrans = Util.NormalizeRectWithTopLeft(cb, x, y, parent);
|
||||
}
|
||||
cb._rectTrans = rtrans;
|
||||
var box = rtrans.GetComponent<UIComboBox>();
|
||||
cb._comboBox = box;
|
||||
box.onItemIndexChange.AddListener(() => { cb.OnSelChanged?.Invoke(box.itemIndex); });
|
||||
|
||||
return cb;
|
||||
}
|
||||
|
||||
protected void OnDestroy()
|
||||
{
|
||||
if (_config != null && _configChanged != null)
|
||||
_config.SettingChanged -= _configChanged;
|
||||
}
|
||||
|
||||
public void SetFontSize(int size)
|
||||
{
|
||||
var textComp = _comboBox.transform.Find("Main Button")?.GetComponentInChildren<Text>();
|
||||
if (textComp) textComp.fontSize = size;
|
||||
_comboBox.ItemButtons.ForEach(b => b.GetComponentInChildren<Text>().fontSize = size);
|
||||
_comboBox.m_ListItemRes.GetComponentInChildren<Text>().fontSize = size;
|
||||
}
|
||||
|
||||
public void SetItems(params string[] items)
|
||||
{
|
||||
_comboBox.Items = [.. items.Select(s => s.Translate())];
|
||||
_comboBox.StartItemIndex = 0;
|
||||
_comboBox.DropDownCount = items.Length;
|
||||
}
|
||||
|
||||
public List<string> Items => _comboBox.Items;
|
||||
|
||||
public void UpdateLabelText()
|
||||
{
|
||||
var textComp = _comboBox.transform.Find("Main Button")?.GetComponentInChildren<Text>();
|
||||
if (textComp) textComp.text = _comboBox.Items[_comboBox.itemIndex];
|
||||
}
|
||||
|
||||
public void SetIndex(int index) => _comboBox.itemIndex = index;
|
||||
|
||||
public void SetSize(float width, float height)
|
||||
{
|
||||
_rectTrans.sizeDelta = new Vector2(width > 0f ? width : _rectTrans.sizeDelta.x, height > 0f ? height : _rectTrans.sizeDelta.y);
|
||||
}
|
||||
|
||||
public void AddOnSelChanged(Action<int> action) => OnSelChanged += action;
|
||||
|
||||
private EventHandler _configChanged;
|
||||
private Action<int> _selChanged;
|
||||
private ConfigEntry<int> _config;
|
||||
public void SetConfigEntry(ConfigEntry<int> config)
|
||||
{
|
||||
if (_selChanged != null) OnSelChanged -= _selChanged;
|
||||
if (_configChanged != null) config.SettingChanged -= _configChanged;
|
||||
|
||||
_comboBox.itemIndex = config.Value;
|
||||
_config = config;
|
||||
_selChanged = value => config.Value = value;
|
||||
OnSelChanged += _selChanged;
|
||||
_configChanged = (_, _) => SetIndex(config.Value);
|
||||
config.SettingChanged += _configChanged;
|
||||
}
|
||||
|
||||
public MyCornerComboBox WithFontSize(int size)
|
||||
{
|
||||
SetFontSize(size);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MyCornerComboBox WithItems(params string[] items)
|
||||
{
|
||||
SetItems(items);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MyCornerComboBox WithIndex(int index)
|
||||
{
|
||||
SetIndex(index);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MyCornerComboBox WithSize(float width, float height)
|
||||
{
|
||||
SetSize(width, height);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MyCornerComboBox WithOnSelChanged(params Action<int>[] action)
|
||||
{
|
||||
foreach (var act in action)
|
||||
AddOnSelChanged(act);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MyCornerComboBox WithConfigEntry(ConfigEntry<int> config)
|
||||
{
|
||||
SetConfigEntry(config);
|
||||
return this;
|
||||
}
|
||||
|
||||
public float Width => _rectTrans.sizeDelta.x;
|
||||
public float Height => _rectTrans.sizeDelta.y;
|
||||
}
|
||||
95
UXAssist/UI/MyFlatButton.cs
Normal file
95
UXAssist/UI/MyFlatButton.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UXAssist.UI;
|
||||
|
||||
public class MyFlatButton : MonoBehaviour
|
||||
{
|
||||
public RectTransform rectTrans;
|
||||
public UIButton uiButton;
|
||||
public Text labelText;
|
||||
|
||||
private static GameObject _baseObject;
|
||||
|
||||
public static void InitBaseObject()
|
||||
{
|
||||
if (_baseObject) return;
|
||||
var panel = UIRoot.instance.uiGame.dysonEditor.controlPanel.hierarchy.layerPanel;
|
||||
var go = Instantiate(panel.layerButtons[0].gameObject);
|
||||
var btn = go.GetComponent<UIButton>();
|
||||
go.GetComponent<Image>().sprite = panel.buttonDefaultSprite;
|
||||
btn.gameObject.name = "my-flatbutton";
|
||||
btn.highlighted = false;
|
||||
var img = btn.GetComponent<Image>();
|
||||
if (img != null)
|
||||
{
|
||||
img.sprite = panel.buttonDefaultSprite;
|
||||
img.color = new Color(img.color.r, img.color.g, img.color.b, 13f / 255f);
|
||||
}
|
||||
|
||||
img = btn.gameObject.transform.Find("frame")?.GetComponent<Image>();
|
||||
if (img != null)
|
||||
{
|
||||
img.color = new Color(img.color.r, img.color.g, img.color.b, 0f);
|
||||
}
|
||||
|
||||
btn.button.onClick.RemoveAllListeners();
|
||||
_baseObject = go;
|
||||
}
|
||||
|
||||
public static MyFlatButton CreateFlatButton(float x, float y, RectTransform parent, string label = "", int fontSize = 15, Action<int> onClick = null)
|
||||
{
|
||||
return CreateFlatButton(x, y, parent, fontSize, onClick).WithLabelText(label);
|
||||
}
|
||||
|
||||
public static MyFlatButton CreateFlatButton(float x, float y, RectTransform parent, int fontSize = 15, Action<int> onClick = null)
|
||||
{
|
||||
var go = Instantiate(_baseObject);
|
||||
go.name = "my-flatbutton";
|
||||
go.SetActive(true);
|
||||
var cb = go.AddComponent<MyFlatButton>();
|
||||
var rect = Util.NormalizeRectWithTopLeft(cb, x, y, parent);
|
||||
|
||||
cb.rectTrans = rect;
|
||||
cb.uiButton = go.GetComponent<UIButton>();
|
||||
|
||||
cb.labelText = go.transform.Find("Text")?.GetComponent<Text>();
|
||||
cb.uiButton.onClick += onClick;
|
||||
return cb;
|
||||
}
|
||||
|
||||
public void SetLabelText(string val)
|
||||
{
|
||||
if (labelText != null)
|
||||
{
|
||||
labelText.text = val.Translate();
|
||||
}
|
||||
}
|
||||
|
||||
public MyFlatButton WithLabelText(string val)
|
||||
{
|
||||
SetLabelText(val);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MyFlatButton WithSize(float width, float height)
|
||||
{
|
||||
rectTrans.sizeDelta = new Vector2(width, height);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MyFlatButton WithTip(string tip, float delay = 1f)
|
||||
{
|
||||
uiButton.tips.type = UIButton.ItemTipType.Other;
|
||||
uiButton.tips.topLevel = true;
|
||||
uiButton.tips.tipTitle = tip;
|
||||
uiButton.tips.tipText = null;
|
||||
uiButton.tips.delay = delay;
|
||||
uiButton.tips.corner = 2;
|
||||
uiButton.UpdateTip();
|
||||
return this;
|
||||
}
|
||||
public float Width => rectTrans.sizeDelta.x + labelText.rectTransform.sizeDelta.x;
|
||||
public float Height => Math.Max(rectTrans.sizeDelta.y, labelText.rectTransform.sizeDelta.y);
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public class MyKeyBinder : MonoBehaviour
|
||||
public UIButton setNoneKeyUIButton;
|
||||
|
||||
private bool _nextNotOn;
|
||||
|
||||
|
||||
protected void OnDestroy()
|
||||
{
|
||||
OnFree?.Invoke();
|
||||
|
||||
166
UXAssist/UI/MySideSlider.cs
Normal file
166
UXAssist/UI/MySideSlider.cs
Normal file
@@ -0,0 +1,166 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UXAssist.UI;
|
||||
|
||||
// MySlider modified from LSTM: https://github.com/hetima/DSP_LSTM/blob/main/LSTM/MySlider.cs
|
||||
|
||||
public class MySideSlider : MonoBehaviour
|
||||
{
|
||||
public RectTransform rectTrans;
|
||||
public Slider slider;
|
||||
public Text labelText;
|
||||
public string labelFormat;
|
||||
public event Action OnValueChanged;
|
||||
|
||||
public static MySideSlider CreateSlider(float x, float y, RectTransform parent, float value, float minValue, float maxValue, string format = "G", float width = 0f, float textWidth = 0f)
|
||||
{
|
||||
return CreateSlider(x, y, parent, width, textWidth).WithLabelFormat(format).WithMinMaxValue(minValue, maxValue).WithValue(value);
|
||||
}
|
||||
|
||||
public static MySideSlider CreateSlider(float x, float y, RectTransform parent, float width = 0f, float textWidth = 0f)
|
||||
{
|
||||
var go = Instantiate(UIRoot.instance.uiGame.stationWindow.maxMiningSpeedGroup.gameObject);
|
||||
//sizeDelta = 240, 20
|
||||
go.name = "my-side-slider";
|
||||
Destroy(go.transform.Find("label").gameObject);
|
||||
Destroy(go.GetComponent<UIButton>());
|
||||
go.SetActive(true);
|
||||
var sl = go.AddComponent<MySideSlider>();
|
||||
var rect = Util.NormalizeRectWithTopLeft(sl, x, y, parent);
|
||||
sl.rectTrans = rect;
|
||||
|
||||
sl.slider = go.transform.Find("slider").GetComponent<Slider>();
|
||||
sl.slider.minValue = 0f;
|
||||
sl.slider.maxValue = 100f;
|
||||
sl.slider.onValueChanged.RemoveAllListeners();
|
||||
sl.slider.onValueChanged.AddListener(sl.SliderChanged);
|
||||
if (width == 0) width = 160f;
|
||||
if (sl.slider.transform is RectTransform rectTrans)
|
||||
{
|
||||
rectTrans.localPosition = new Vector3(width, rectTrans.localPosition.y, rectTrans.localPosition.z);
|
||||
rectTrans.sizeDelta = new Vector2(width, rectTrans.sizeDelta.y);
|
||||
}
|
||||
sl.Value = 0f;
|
||||
|
||||
sl.labelText = go.transform.Find("value").GetComponent<Text>();
|
||||
sl.labelText.alignment = textWidth <= 0f ? TextAnchor.MiddleLeft : TextAnchor.MiddleRight;
|
||||
if (sl.labelText.transform is RectTransform rectTrans2)
|
||||
{
|
||||
if (textWidth > 0f)
|
||||
{
|
||||
rectTrans2.sizeDelta = new Vector2(textWidth, rectTrans2.sizeDelta.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
rectTrans2.sizeDelta = new Vector2(-textWidth, rectTrans2.sizeDelta.y);
|
||||
}
|
||||
rectTrans2.pivot = new Vector2(0f, 1f);
|
||||
rectTrans2.localPosition = new Vector3(textWidth <= 0f ? width + 10f : width, rectTrans2.localPosition.y, rectTrans2.localPosition.z);
|
||||
}
|
||||
sl.labelFormat = "G";
|
||||
|
||||
// var bg = sl.slider.transform.Find("Background")?.GetComponent<Image>();
|
||||
// if (bg != null)
|
||||
// {
|
||||
// bg.color = new Color(0.5f, 0.5f, 0.5f, 0.5f);
|
||||
// }
|
||||
// var fill = sl.slider.fillRect.GetComponent<Image>();
|
||||
// if (fill != null)
|
||||
// {
|
||||
// fill.color = new Color(1f, 1f, 1f, 0.28f);
|
||||
// }
|
||||
|
||||
sl.UpdateLabel();
|
||||
|
||||
return sl;
|
||||
}
|
||||
|
||||
public void SetEnable(bool on)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
if (slider) slider.interactable = on;
|
||||
}
|
||||
}
|
||||
|
||||
public float Value
|
||||
{
|
||||
get => slider.value;
|
||||
set
|
||||
{
|
||||
var sliderVal = value;
|
||||
if (sliderVal.Equals(slider.value)) return;
|
||||
if (sliderVal > slider.maxValue)
|
||||
{
|
||||
sliderVal = slider.maxValue;
|
||||
}
|
||||
else if (sliderVal < slider.minValue)
|
||||
{
|
||||
sliderVal = slider.minValue;
|
||||
}
|
||||
|
||||
slider.value = sliderVal;
|
||||
UpdateLabel();
|
||||
}
|
||||
}
|
||||
|
||||
public MySideSlider WithValue(float value)
|
||||
{
|
||||
Value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MySideSlider WithMinMaxValue(float min, float max)
|
||||
{
|
||||
slider.minValue = min;
|
||||
slider.maxValue = max;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MySideSlider WithLabelFormat(string format)
|
||||
{
|
||||
if (format == labelFormat) return this;
|
||||
labelFormat = format;
|
||||
UpdateLabel();
|
||||
return this;
|
||||
}
|
||||
|
||||
public MySideSlider WithFontSize(int fontSize)
|
||||
{
|
||||
labelText.fontSize = fontSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MySideSlider WithEnable(bool on)
|
||||
{
|
||||
SetEnable(on);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void UpdateLabel()
|
||||
{
|
||||
if (labelText != null)
|
||||
{
|
||||
labelText.text = slider.value.ToString(labelFormat);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetLabelText(string text)
|
||||
{
|
||||
if (labelText != null)
|
||||
{
|
||||
labelText.text = text;
|
||||
}
|
||||
}
|
||||
|
||||
public void SliderChanged(float val)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
UpdateLabel();
|
||||
OnValueChanged?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public class MySlider : MonoBehaviour
|
||||
}
|
||||
}
|
||||
sl.labelFormat = "G";
|
||||
|
||||
|
||||
sl.handleSlideArea = sl.transform.Find("Handle Slide Area")?.GetComponent<RectTransform>();
|
||||
|
||||
var bg = sl.slider.transform.Find("Background")?.GetComponent<Image>();
|
||||
@@ -105,14 +105,14 @@ public class MySlider : MonoBehaviour
|
||||
Value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public MySlider WithMinMaxValue(float min, float max)
|
||||
{
|
||||
slider.minValue = min;
|
||||
slider.maxValue = max;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public MySlider WithLabelFormat(string format)
|
||||
{
|
||||
if (format == labelFormat) return this;
|
||||
|
||||
@@ -27,14 +27,14 @@ public class MyWindow : ManualBehaviour
|
||||
public static void InitBaseObject()
|
||||
{
|
||||
if (_baseObject) return;
|
||||
var go = Instantiate(UIRoot.instance.uiGame.tankWindow.gameObject);
|
||||
var go = Instantiate(UIRoot.instance.uiGame.inserterWindow.gameObject);
|
||||
go.SetActive(false);
|
||||
go.name = "my-window";
|
||||
Destroy(go.GetComponent<UITankWindow>());
|
||||
for (var i = 0; i < go.transform.childCount; i++)
|
||||
for (var i = go.transform.childCount - 1; i >= 0; i--)
|
||||
{
|
||||
var child = go.transform.GetChild(i).gameObject;
|
||||
if (child.name != "panel-bg" && child.name != "shadow" && child.name != "panel-bg")
|
||||
if (child.name != "panel-bg" && child.name != "shadow")
|
||||
{
|
||||
Destroy(child);
|
||||
}
|
||||
@@ -42,7 +42,7 @@ public class MyWindow : ManualBehaviour
|
||||
|
||||
_baseObject = go;
|
||||
}
|
||||
|
||||
|
||||
public static T Create<T>(string name, string title = "") where T : MyWindow
|
||||
{
|
||||
var go = Instantiate(_baseObject, UIRoot.instance.uiGame.transform.parent);
|
||||
@@ -194,38 +194,13 @@ public class MyWindow : ManualBehaviour
|
||||
return btn;
|
||||
}
|
||||
|
||||
public UIButton AddFlatButton(float x, float y, RectTransform parent, string text = "", int fontSize = 12, string objName = "button", UnityAction onClick = null)
|
||||
public MyFlatButton AddFlatButton(float x, float y, RectTransform parent, string text = "", int fontSize = 12, string objName = "button", UnityAction onClick = null)
|
||||
{
|
||||
var panel = UIRoot.instance.uiGame.dysonEditor.controlPanel.hierarchy.layerPanel;
|
||||
var btn = Instantiate(panel.layerButtons[0]);
|
||||
var btn = MyFlatButton.CreateFlatButton(x, y, parent, text, fontSize, _ => onClick());
|
||||
btn.gameObject.name = objName;
|
||||
btn.highlighted = false;
|
||||
var img = btn.GetComponent<Image>();
|
||||
if (img != null)
|
||||
{
|
||||
img.sprite = panel.buttonDefaultSprite;
|
||||
img.color = new Color(img.color.r, img.color.g, img.color.b, 13f / 255f);
|
||||
}
|
||||
|
||||
img = btn.gameObject.transform.Find("frame")?.GetComponent<Image>();
|
||||
if (img != null)
|
||||
{
|
||||
img.color = new Color(img.color.r, img.color.g, img.color.b, 0f);
|
||||
}
|
||||
|
||||
var rect = Util.NormalizeRectWithTopLeft(btn, x, y, parent);
|
||||
var t = btn.gameObject.transform.Find("Text")?.GetComponent<Text>();
|
||||
if (t != null)
|
||||
{
|
||||
t.text = text.Translate();
|
||||
t.fontSize = fontSize;
|
||||
}
|
||||
|
||||
btn.button.onClick.RemoveAllListeners();
|
||||
if (onClick != null) btn.button.onClick.AddListener(onClick);
|
||||
|
||||
_maxX = Math.Max(_maxX, x + rect.sizeDelta.x);
|
||||
MaxY = Math.Max(MaxY, y + rect.sizeDelta.y);
|
||||
_maxX = Math.Max(_maxX, x + btn.Width);
|
||||
MaxY = Math.Max(MaxY, y + btn.Height);
|
||||
return btn;
|
||||
}
|
||||
|
||||
@@ -236,7 +211,7 @@ public class MyWindow : ManualBehaviour
|
||||
MaxY = Math.Max(MaxY, y + cb.Height);
|
||||
return cb;
|
||||
}
|
||||
|
||||
|
||||
public MyComboBox AddComboBox(float x, float y, RectTransform parent, string label = "", int fontSize = 15)
|
||||
{
|
||||
var comboBox = MyComboBox.CreateComboBox(x, y, parent).WithPrompt(label).WithFontSize(fontSize);
|
||||
@@ -245,19 +220,15 @@ public class MyWindow : ManualBehaviour
|
||||
return comboBox;
|
||||
}
|
||||
|
||||
public MySlider AddSlider(float x, float y, RectTransform parent, float value, float minValue, float maxValue, string format = "G", float width = 0f)
|
||||
public MyCornerComboBox AddCornerComboBox(float x, float y, RectTransform parent, int fontSize = 15)
|
||||
{
|
||||
var slider = MySlider.CreateSlider(x, y, parent, value, minValue, maxValue, format, width);
|
||||
var rect = slider.rectTrans;
|
||||
if (rect != null)
|
||||
{
|
||||
_maxX = Math.Max(_maxX, x + rect.sizeDelta.x);
|
||||
MaxY = Math.Max(MaxY, y + rect.sizeDelta.y);
|
||||
}
|
||||
|
||||
return slider;
|
||||
var comboBox = MyCornerComboBox.CreateComboBox(x, y, parent).WithFontSize(fontSize);
|
||||
_maxX = Math.Max(_maxX, x + comboBox.Width);
|
||||
MaxY = Math.Max(MaxY, y + comboBox.Height);
|
||||
return comboBox;
|
||||
}
|
||||
|
||||
#region Slider
|
||||
public class ValueMapper<T>
|
||||
{
|
||||
public virtual int Min => 1;
|
||||
@@ -271,42 +242,25 @@ public class MyWindow : ManualBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public MySlider AddSlider<T>(float x, float y, RectTransform parent, ConfigEntry<T> config, ValueMapper<T> valueMapper, string format = "G", float width = 0f)
|
||||
public class RangeValueMapper<T>(int min, int max) : ValueMapper<T>
|
||||
{
|
||||
var slider = MySlider.CreateSlider(x, y, parent, OnConfigValueChanged(config), valueMapper.Min, valueMapper.Max, format, width);
|
||||
slider.SetLabelText(valueMapper.FormatValue(format, config.Value));
|
||||
EventHandler func = (_, _) =>
|
||||
{
|
||||
var index = OnConfigValueChanged(config);
|
||||
slider.Value = index;
|
||||
slider.SetLabelText(valueMapper.FormatValue(format, config.Value));
|
||||
};
|
||||
config.SettingChanged += func;
|
||||
OnFree += () => config.SettingChanged -= func;
|
||||
slider.OnValueChanged += () =>
|
||||
{
|
||||
var index = Mathf.RoundToInt(slider.Value);
|
||||
config.Value = valueMapper.IndexToValue(index);
|
||||
slider.SetLabelText(valueMapper.FormatValue(format, config.Value));
|
||||
};
|
||||
public override int Min => min;
|
||||
public override int Max => max;
|
||||
}
|
||||
|
||||
var rect = slider.rectTrans;
|
||||
if (rect != null)
|
||||
public class RangeValueWithMultiplierMapper<T>(int min, int max, T multiplier) : ValueMapper<T>
|
||||
{
|
||||
public override int Min => min;
|
||||
public override int Max => max;
|
||||
|
||||
public override T IndexToValue(int index)
|
||||
{
|
||||
_maxX = Math.Max(_maxX, x + rect.sizeDelta.x);
|
||||
MaxY = Math.Max(MaxY, y + rect.sizeDelta.y);
|
||||
return (T)Convert.ChangeType((float)index * (float)Convert.ChangeType(multiplier, typeof(float)), typeof(T));
|
||||
}
|
||||
|
||||
return slider;
|
||||
|
||||
int OnConfigValueChanged(ConfigEntry<T> conf)
|
||||
public override int ValueToIndex(T value)
|
||||
{
|
||||
var index = valueMapper.ValueToIndex(conf.Value);
|
||||
if (index >= 0) return index;
|
||||
index = ~index;
|
||||
index = Math.Max(0, Math.Min(valueMapper.Max, index));
|
||||
conf.Value = valueMapper.IndexToValue(index);
|
||||
return index;
|
||||
return Mathf.RoundToInt((float)Convert.ChangeType(value, typeof(float)) / (float)Convert.ChangeType(multiplier, typeof(float)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,11 +288,122 @@ public class MyWindow : ManualBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public MySlider AddSlider(float x, float y, RectTransform parent, float value, float minValue, float maxValue, string format = "G", float width = 0f)
|
||||
{
|
||||
var slider = MySlider.CreateSlider(x, y, parent, value, minValue, maxValue, format, width);
|
||||
var rect = slider.rectTrans;
|
||||
if (rect != null)
|
||||
{
|
||||
_maxX = Math.Max(_maxX, x + rect.sizeDelta.x);
|
||||
MaxY = Math.Max(MaxY, y + rect.sizeDelta.y);
|
||||
}
|
||||
|
||||
return slider;
|
||||
}
|
||||
|
||||
public MySideSlider AddSideSlider(float x, float y, RectTransform parent, float value, float minValue, float maxValue, string format = "G", float width = 0f, float textWidth = 0f)
|
||||
{
|
||||
var slider = MySideSlider.CreateSlider(x, y, parent, value, minValue, maxValue, format, width, textWidth);
|
||||
var rect = slider.rectTrans;
|
||||
if (rect != null)
|
||||
{
|
||||
_maxX = Math.Max(_maxX, x + rect.sizeDelta.x);
|
||||
MaxY = Math.Max(MaxY, y + rect.sizeDelta.y);
|
||||
}
|
||||
|
||||
return slider;
|
||||
}
|
||||
|
||||
public MySlider AddSlider<T>(float x, float y, RectTransform parent, ConfigEntry<T> config, ValueMapper<T> valueMapper, string format = "G", float width = 0f)
|
||||
{
|
||||
var slider = MySlider.CreateSlider(x, y, parent, OnConfigValueChanged(config), valueMapper.Min, valueMapper.Max, format, width);
|
||||
slider.SetLabelText(valueMapper.FormatValue(format, config.Value));
|
||||
config.SettingChanged += SettingsChanged;
|
||||
OnFree += () => config.SettingChanged -= SettingsChanged;
|
||||
slider.OnValueChanged += () =>
|
||||
{
|
||||
var index = Mathf.RoundToInt(slider.Value);
|
||||
config.Value = valueMapper.IndexToValue(index);
|
||||
slider.SetLabelText(valueMapper.FormatValue(format, config.Value));
|
||||
};
|
||||
|
||||
var rect = slider.rectTrans;
|
||||
if (rect != null)
|
||||
{
|
||||
_maxX = Math.Max(_maxX, x + rect.sizeDelta.x);
|
||||
MaxY = Math.Max(MaxY, y + rect.sizeDelta.y);
|
||||
}
|
||||
|
||||
return slider;
|
||||
|
||||
void SettingsChanged(object o, EventArgs a)
|
||||
{
|
||||
var index = OnConfigValueChanged(config);
|
||||
slider.Value = index;
|
||||
slider.SetLabelText(valueMapper.FormatValue(format, config.Value));
|
||||
}
|
||||
|
||||
int OnConfigValueChanged(ConfigEntry<T> conf)
|
||||
{
|
||||
var index = valueMapper.ValueToIndex(conf.Value);
|
||||
if (index >= 0) return index;
|
||||
index = ~index;
|
||||
index = Math.Max(0, Math.Min(valueMapper.Max, index));
|
||||
conf.Value = valueMapper.IndexToValue(index);
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
public MySideSlider AddSideSlider<T>(float x, float y, RectTransform parent, ConfigEntry<T> config, ValueMapper<T> valueMapper, string format = "G", float width = 0f, float textWidth = 0f)
|
||||
{
|
||||
var slider = MySideSlider.CreateSlider(x, y, parent, OnConfigValueChanged(config), valueMapper.Min, valueMapper.Max, format, width, textWidth);
|
||||
slider.SetLabelText(valueMapper.FormatValue(format, config.Value));
|
||||
config.SettingChanged += SettingsChanged;
|
||||
OnFree += () => config.SettingChanged -= SettingsChanged;
|
||||
slider.OnValueChanged += () =>
|
||||
{
|
||||
var index = Mathf.RoundToInt(slider.Value);
|
||||
config.Value = valueMapper.IndexToValue(index);
|
||||
slider.SetLabelText(valueMapper.FormatValue(format, config.Value));
|
||||
};
|
||||
|
||||
var rect = slider.rectTrans;
|
||||
if (rect != null)
|
||||
{
|
||||
_maxX = Math.Max(_maxX, x + rect.sizeDelta.x);
|
||||
MaxY = Math.Max(MaxY, y + rect.sizeDelta.y);
|
||||
}
|
||||
|
||||
return slider;
|
||||
|
||||
void SettingsChanged(object o, EventArgs a)
|
||||
{
|
||||
var index = OnConfigValueChanged(config);
|
||||
slider.Value = index;
|
||||
slider.SetLabelText(valueMapper.FormatValue(format, config.Value));
|
||||
}
|
||||
int OnConfigValueChanged(ConfigEntry<T> conf)
|
||||
{
|
||||
var index = valueMapper.ValueToIndex(conf.Value);
|
||||
if (index >= 0) return index;
|
||||
index = ~index;
|
||||
index = Math.Max(0, Math.Min(valueMapper.Max, index));
|
||||
conf.Value = valueMapper.IndexToValue(index);
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
public MySlider AddSlider<T>(float x, float y, RectTransform parent, ConfigEntry<T> config, T[] valueList, string format = "G", float width = 0f)
|
||||
{
|
||||
return AddSlider(x, y, parent, config, new ArrayMapper<T>(valueList), format, width);
|
||||
}
|
||||
|
||||
public MySideSlider AddSideSlider<T>(float x, float y, RectTransform parent, ConfigEntry<T> config, T[] valueList, string format = "G", float width = 0f)
|
||||
{
|
||||
return AddSideSlider(x, y, parent, config, new ArrayMapper<T>(valueList), format, width);
|
||||
}
|
||||
#endregion
|
||||
|
||||
public InputField AddInputField(float x, float y, RectTransform parent, string text = "", int fontSize = 16, string objName = "input", UnityAction<string> onChanged = null,
|
||||
UnityAction<string> onEditEnd = null)
|
||||
{
|
||||
@@ -362,7 +427,7 @@ public class MyWindow : ManualBehaviour
|
||||
MaxY = Math.Max(MaxY, y + rect.sizeDelta.y);
|
||||
return inputField;
|
||||
}
|
||||
|
||||
|
||||
public InputField AddInputField(float x, float y, float width, RectTransform parent, ConfigEntry<string> config, int fontSize = 16, string objName = "input")
|
||||
{
|
||||
var stationWindow = UIRoot.instance.uiGame.stationWindow;
|
||||
@@ -410,19 +475,26 @@ public class MyWindowWithTabs : MyWindow
|
||||
var swarmPanel = UIRoot.instance.uiGame.dysonEditor.controlPanel.hierarchy.swarmPanel;
|
||||
var src = swarmPanel.orbitButtons[0];
|
||||
var btn = Instantiate(src);
|
||||
var btnRect = Util.NormalizeRectWithTopLeft(btn, Margin, y, parent);
|
||||
btn.gameObject.GetComponent<Image>().sprite = swarmPanel.buttonDefaultSprite;
|
||||
btn.name = "tab-btn-" + index;
|
||||
btn.highlighted = false;
|
||||
|
||||
var btnRect = Util.NormalizeRectWithTopLeft(btn, Margin, y, parent);
|
||||
btnRect.sizeDelta = new Vector2(TabWidth, TabHeight);
|
||||
btn.transform.Find("frame").gameObject.SetActive(false);
|
||||
if (btn.transitions.Length >= 3)
|
||||
{
|
||||
btn.transitions[0].normalColor = new Color(0.1f, 0.1f, 0.1f, 0.68f);
|
||||
btn.transitions[0].highlightColorOverride = new Color(0.9906f, 0.5897f, 0.3691f, 0.4f);
|
||||
btn.transitions[1].normalColor = new Color(1f, 1f, 1f, 0.6f);
|
||||
btn.transitions[1].highlightColorOverride = new Color(0.2f, 0.1f, 0.1f, 0.9f);
|
||||
btn.transitions[1].normalColor = new Color(1f, 1f, 1f, 0.8f);
|
||||
btn.transitions[1].highlightColorOverride = new Color(0.2f, 0.2f, 0.2f, 1f);
|
||||
}
|
||||
|
||||
var btnText = btn.transform.Find("Text").GetComponent<Text>();
|
||||
var textTrans = btn.transform.Find("Text");
|
||||
var btnText = textTrans.GetComponent<Text>();
|
||||
var shadow = textTrans.GetComponent<Shadow>() ?? textTrans.gameObject.AddComponent<Shadow>();
|
||||
shadow.effectColor = new Color(0f, 0f, 0f, 0.4f);
|
||||
shadow.effectDistance = new Vector2(1f, -1f);
|
||||
btnText.text = label.Translate();
|
||||
btnText.fontSize = 16;
|
||||
btn.data = index;
|
||||
@@ -490,8 +562,11 @@ public abstract class MyWindowManager
|
||||
public static void InitBaseObjects()
|
||||
{
|
||||
MyWindow.InitBaseObject();
|
||||
MyCheckButton.InitBaseObject();
|
||||
MyCheckBox.InitBaseObject();
|
||||
MyComboBox.InitBaseObject();
|
||||
MyCornerComboBox.InitBaseObject();
|
||||
MyFlatButton.InitBaseObject();
|
||||
}
|
||||
|
||||
public static T CreateWindow<T>(string name, string title = "") where T : MyWindow
|
||||
@@ -518,7 +593,7 @@ public abstract class MyWindowManager
|
||||
}
|
||||
*/
|
||||
|
||||
public class Patch: PatchImpl<Patch>
|
||||
public class Patch : PatchImpl<Patch>
|
||||
{
|
||||
protected override void OnEnable()
|
||||
{
|
||||
@@ -538,7 +613,7 @@ public abstract class MyWindowManager
|
||||
|
||||
/*
|
||||
//_Create -> _Init
|
||||
[HarmonyPostfix, HarmonyPatch(typeof(UIGame), "_OnCreate")]
|
||||
[HarmonyPostfix, HarmonyPatch(typeof(UIGame), nameof(UIGame._OnCreate))]
|
||||
public static void UIGame__OnCreate_Postfix()
|
||||
{
|
||||
}
|
||||
@@ -563,7 +638,7 @@ public abstract class MyWindowManager
|
||||
}
|
||||
|
||||
/*
|
||||
[HarmonyPostfix, HarmonyPatch(typeof(UIGame), "_OnFree")]
|
||||
[HarmonyPostfix, HarmonyPatch(typeof(UIGame), nameof(UIGame._OnFree))]
|
||||
public static void UIGame__OnFree_Postfix()
|
||||
{
|
||||
foreach (var win in Windows)
|
||||
|
||||
@@ -18,7 +18,21 @@ public static class Util
|
||||
rect.anchoredPosition3D = new Vector3(left, -top, 0f);
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
||||
public static RectTransform NormalizeRectWithTopRight(Component cmp, float right, float top, Transform parent = null)
|
||||
{
|
||||
if (cmp.transform is not RectTransform rect) return null;
|
||||
if (parent != null)
|
||||
{
|
||||
rect.SetParent(parent, false);
|
||||
}
|
||||
rect.anchorMax = new Vector2(1f, 1f);
|
||||
rect.anchorMin = new Vector2(1f, 1f);
|
||||
rect.pivot = new Vector2(1f, 1f);
|
||||
rect.anchoredPosition3D = new Vector3(-right, -top, 0f);
|
||||
return rect;
|
||||
}
|
||||
|
||||
public static RectTransform NormalizeRectWithBottomLeft(Component cmp, float left, float bottom, Transform parent = null)
|
||||
{
|
||||
if (cmp.transform is not RectTransform rect) return null;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UXAssist.Common;
|
||||
using UXAssist.Functions;
|
||||
@@ -19,13 +20,13 @@ public static class UIConfigWindow
|
||||
{
|
||||
I18N.Add("UXAssist", "UXAssist", "UX助手");
|
||||
I18N.Add("General", "General", "常规");
|
||||
I18N.Add("Planet/Factory", "Planet/Factory", "行星/工厂");
|
||||
I18N.Add("Factory", "Factory", "工厂");
|
||||
I18N.Add("Logistics", "Logistics", "物流");
|
||||
I18N.Add("Player/Mecha", "Player/Mecha", "玩家/机甲");
|
||||
I18N.Add("Dyson Sphere", "Dyson Sphere", "戴森球");
|
||||
I18N.Add("Tech/Combat", "Tech/Combat", "科研/战斗");
|
||||
I18N.Add("Tech/Combat/UI", "Tech/Combat/UI", "科研/战斗/UI");
|
||||
I18N.Add("Enable game window resize", "Enable game window resize (maximum box and thick frame)", "可调整游戏窗口大小(可最大化和拖动边框)");
|
||||
I18N.Add("Remeber window position and size on last exit", "Remeber window position and size on last exit", "记住上次退出时的窗口位置和大小");
|
||||
I18N.Add("Scale up mouse cursor", "Scale up mouse cursor", "放大鼠标指针");
|
||||
/*
|
||||
I18N.Add("Better auto-save mechanism", "Better auto-save mechanism", "更好的自动存档机制");
|
||||
I18N.Add("Better auto-save mechanism tips", "Auto saves are stored in 'Save\\AutoSaves' folder, filenames are combined with cluster address and date-time", "自动存档会以星区地址和日期时间组合为文件名存储在'Save\\AutoSaves'文件夹中");
|
||||
@@ -34,6 +35,9 @@ public static class UIConfigWindow
|
||||
I18N.Add("Profile-based save folder", "Mod manager profile based save folder", "基于mod管理器配置档案名的存档文件夹");
|
||||
I18N.Add("Profile-based save folder tips", "Save files are stored in 'Save\\<ProfileName>' folder.\nWill use original save location if matching default profile name",
|
||||
"存档文件会存储在'Save\\<ProfileName>'文件夹中\n如果匹配默认配置档案名则使用原始存档位置");
|
||||
I18N.Add("Profile-based option", "Mod manager profile based option", "基于mod管理器配置档案名的选项设置");
|
||||
I18N.Add("Profile-based option tips", "Options are stored in 'Option\\<ProfileName>.xml'.\nWill use original location if matching default profile name",
|
||||
"配置选项会存储在'Option\\<ProfileName>.xml'里\n如果匹配默认配置档案名则使用原始位置");
|
||||
I18N.Add("Default profile name", "Default profile name", "默认配置档案名");
|
||||
I18N.Add("Logical Frame Rate", "Logical Frame Rate", "逻辑帧倍率");
|
||||
I18N.Add("Reset", "Reset", "重置");
|
||||
@@ -43,14 +47,6 @@ public static class UIConfigWindow
|
||||
I18N.Add("Normal", "Normal", "正常");
|
||||
I18N.Add("Below Normal", "Below Normal", "低于正常");
|
||||
I18N.Add("Idle", "Idle", "空闲");
|
||||
I18N.Add("Enabled CPUs", "Enabled CPU Threads", "使用CPU线程");
|
||||
I18N.Add("All CPUs", "All CPUs", "所有CPU");
|
||||
I18N.Add("First {0} CPUs", "First {0} CPUs", "前{0}个CPU");
|
||||
I18N.Add("First 8 CPUs", "First 8 CPUs", "前8个CPU");
|
||||
I18N.Add("First CPU only", "First CPU only", "仅第一个CPU");
|
||||
I18N.Add("All P-Cores", "All P-Cores", "所有性能(P)核心");
|
||||
I18N.Add("All E-Cores", "All E-Cores", "所有能效(E)核心");
|
||||
I18N.Add("CPU Info", "CPU Info", "CPU信息");
|
||||
I18N.Add("Unlimited interactive range", "Unlimited interactive range", "无限交互距离");
|
||||
I18N.Add("Night Light", "Sunlight at night", "夜间日光灯");
|
||||
I18N.Add("Angle X:", "Angle X:", "入射角度X:");
|
||||
@@ -61,15 +57,12 @@ public static class UIConfigWindow
|
||||
I18N.Add("Off-grid building and stepped rotation", "Off-grid building and stepped rotation (Hold Shift)", "脱离网格建造以及小角度旋转(按住Shift)");
|
||||
I18N.Add("Enable player actions in globe view", "Enable player actions in globe view", "在行星视图中允许玩家操作");
|
||||
I18N.Add("Hide tips for soil piles changes", "Hide tips for soil piles changes", "隐藏沙土数量变动的提示");
|
||||
I18N.Add("Enhance control for logistic storage limits", "Enhance control for logistic storage limits", "物流塔存储限制控制改进");
|
||||
I18N.Add("Enhance control for logistic storage limits tips",
|
||||
"Logistic storage limits are not scaled on upgrading 'Logistics Carrier Capacity', if they are not set to maximum capacity.\nUse arrow keys to adjust logistic storage limits:\n \u2190/\u2192: -/+10 \u2193\u2191: -/+100",
|
||||
"当升级'运输机舱扩容'时,不会对各种物流塔的存储限制按比例提升,除非设置为最大允许容量。\n你可以使用方向键微调物流塔存储限制:\n \u2190\u2192: -/+10 \u2193\u2191: -/+100");
|
||||
I18N.Add("Enhanced count control for hand-make", "Enhanced count control for hand-make", "手动制造物品的数量控制改进");
|
||||
I18N.Add("Enhanced count control for hand-make tips", "Maximum count is increased to 1000.\nHold Ctrl/Shift/Alt to change the count rapidly.", "最大数量提升至1000\n按住Ctrl/Shift/Alt可快速改变数量");
|
||||
I18N.Add("Quick build and dismantle stacking labs", "Quick build and dismantle stacking labs/storages/tanks(hold shift)", "快速建造和拆除堆叠研究站/储物仓/储液罐(按住shift)");
|
||||
I18N.Add("Fast fill in to and take out from tanks", "Fast fill in to and take out from tanks", "储液罐快速注入和抽取液体");
|
||||
I18N.Add("Speed Ratio", "Speed Ratio", "速度倍率");
|
||||
I18N.Add("Cut conveyor belt (with shortcut key)", "Cut conveyor belt (with shortcut key)", "切割传送带(使用快捷键)");
|
||||
I18N.Add("Protect veins from exhaustion", "Protect veins from exhaustion", "保护矿脉不会耗尽");
|
||||
I18N.Add("Protect veins from exhaustion tips",
|
||||
"By default, the vein amount is protected at 100, and oil speed is protected at 1.0/s, you can set them yourself in config file.\nWhen reach the protection value, veins/oils steeps will not be mined/extracted any longer.\nClose this function to resume mining and pumping, usually when you have enough level on `Veins Utilization`",
|
||||
@@ -77,14 +70,54 @@ public static class UIConfigWindow
|
||||
I18N.Add("Do not render factory entities", "Do not render factory entities (except belts and sorters)", "不渲染工厂建筑实体(除了传送带和分拣器)");
|
||||
I18N.Add("Drag building power poles in maximum connection range", "Drag building power poles in maximum connection range", "拖动建造电线杆时自动使用最大连接距离间隔");
|
||||
I18N.Add("Build Tesla Tower and Wireless Power Tower alternately", "Build Tesla Tower and Wireless Power Tower alternately", "交替建造电力感应塔和无线输电塔");
|
||||
I18N.Add("Allow overflow for Logistic Stations and Advanced Mining Machines", "Allow overflow for Logistic Stations and Advanced Mining Machines", "允许物流站和大型采矿机物品溢出");
|
||||
I18N.Add("Belt signals for buy out dark fog items automatically", "Belt signals for buy out dark fog items automatically", "用于自动购买黑雾物品的传送带信号");
|
||||
I18N.Add("Auto-config logistic stations", "Auto-config logistic stations", "自动配置物流设施");
|
||||
I18N.Add("Limit auto-replenish count to values below", "Limit auto-replenish count to values below", "限制自动补充数量为下面配置的值");
|
||||
I18N.Add("Dispenser", "Logistics Distributor", "物流配送器");
|
||||
I18N.Add("Battlefield Analysis Base", "Battlefield Analysis Base", "战场分析基站");
|
||||
I18N.Add("PLS", "PLS", "行星物流站");
|
||||
I18N.Add("ILS", "ILS", "星际物流站");
|
||||
I18N.Add("Advanced Mining Machine", "Advanced Mining Machine", "大型采矿机");
|
||||
I18N.Add("Set default remote logic to storage", "Set default remote logic to storage", "设置默认远程逻辑为仓储");
|
||||
I18N.Add("Max. Charging Power", "Max. Charging Power", "最大充能功率");
|
||||
I18N.Add("Count of Bots filled", "Count of Bots filled", "填充的配送机数量");
|
||||
I18N.Add("Drone transport range", "Drone transport range", "运输机最远路程");
|
||||
I18N.Add("Min. Load of Drones", "Min. Load of Drones", "运输机起送量");
|
||||
I18N.Add("Outgoing integration count", "Outgoing integration count", "输出货物集装数量");
|
||||
I18N.Add("Count of Drones filled", "Count of Drones filled", "填充的运输机数量");
|
||||
I18N.Add("Vessel transport range", "Vessel transport range", "运输船最远路程");
|
||||
I18N.Add("Warp distance", "Warp distance", "曲速启用路程");
|
||||
I18N.Add("Min. Load of Vessels", "Min. Load of Vessels", "运输船起送量");
|
||||
I18N.Add("Outgoing integration count", "Outgoing integration count", "输出货物集装数量");
|
||||
I18N.Add("Include Orbital Collector", "Include Orbital Collector", "包含轨道采集器");
|
||||
I18N.Add("Warpers required", "Warpers required", "翘曲器必备");
|
||||
I18N.Add("Count of Vessels filled", "Count of Vessels filled", "填充的运输船数量");
|
||||
I18N.Add("Collecting Speed", "Collecting Speed", "开采速度");
|
||||
I18N.Add("Min. Piler Value", "Outgoing integration count", "输出货物集装数量");
|
||||
|
||||
I18N.Add("Allow overflow for Logistic Stations and Advanced Mining Machines", "Allow overflow for Logistic Stations and Advanced Mining Machines", "允许物流站和大型采矿机物品溢出");
|
||||
I18N.Add("Enhance control for logistic storage capacities", "Enhance control for logistic storage capacities", "物流塔存储容量控制改进");
|
||||
I18N.Add("Enhance control for logistic storage capacities tips",
|
||||
"Logistic storage capacity limits are not scaled on upgrading 'Logistics Carrier Capacity', if they are not set to maximum capacity or already greater than upgraded maximum capacity.\nUse arrow keys to adjust logistic storage capacities:\n \u2190/\u2192: -/+10 \u2193\u2191: -/+100",
|
||||
"当升级'运输机舱扩容'时,不会对各种物流塔的存储容量按比例提升,除非设置为最大允许容量或者已经超过升级后的最大容量。\n你可以使用方向键微调物流塔存储容量:\n \u2190\u2192: -/+10 \u2193\u2191: -/+100");
|
||||
I18N.Add("Logistics Control Panel Improvement", "Logistics Control Panel Improvement", "物流控制面板改进");
|
||||
I18N.Add("Logistics Control Panel Improvement tips",
|
||||
"Auto apply filter with item under mouse cursor while opening the panel\nQuick-set item filter while right-clicking item icons in storage list on the panel",
|
||||
"打开面板时自动将鼠标指向物品设为筛选条件\n在控制面板物流塔列表中右键点击物品图标快速设置为筛选条件");
|
||||
I18N.Add("Real-time logistic stations info panel", "Real-time logistic stations info panel", "物流运输站实时信息面板");
|
||||
I18N.Add("Show status bars for storage items", "Show status bars for storage items", "显示存储物品状态条");
|
||||
I18N.Add("Tweak building buffers", "Tweak building buffers", "调整建筑输入缓冲");
|
||||
I18N.Add("Assembler buffer time multiplier(in seconds)", "Assembler buffer time multiplier(in seconds)", "工厂配方缓冲时间倍率(秒)");
|
||||
I18N.Add("Assembler buffer minimum multiplier", "Assembler buffer minimum multiplier", "工厂配方缓冲最小倍率");
|
||||
I18N.Add("Buffer count for assembling in labs", "Buffer count for assembling in labs", "研究站矩阵合成模式缓存数量");
|
||||
I18N.Add("Extra buffer count for Self-evolution Labs", "Extra buffer count for Self-evolution Labs", "自演化研究站矩阵额外缓冲数量");
|
||||
I18N.Add("Buffer count for researching in labs", "Buffer count for researching in labs", "研究站科研模式缓存数量");
|
||||
I18N.Add("Ray Receiver Graviton Lens buffer count", "Ray Receiver Graviton Lens buffer count", "射线接收器透镜缓冲数量");
|
||||
I18N.Add("Ejector Solar Sails buffer count", "Ejector Solar Sails buffer count", "弹射器太阳能帆缓冲数量");
|
||||
I18N.Add("Silo Rockets buffer count", "Silo Rockets buffer count", "发射井火箭缓冲数量");
|
||||
I18N.Add("Shortcut keys for Blueprint Copy mode", "Shortcut keys for Blueprint Copy mode", "蓝图复制模式快捷键");
|
||||
I18N.Add("Shortcut keys for Blueprint Copy mode tips", "You can set 2 shortcut keys in Settings panel:\n 1. Select all buildings\n 2. Dismantle selected buildings", "你可以在设置面板中设置2个快捷键:\n 1. 选择所有建筑\n 2. 拆除选中的建筑");
|
||||
I18N.Add("Shortcut keys for showing stars' name", "Shortcut keys for showing stars' name", "启用显示所有星系名称的快捷键");
|
||||
I18N.Add("Auto navigation on sailings", "Auto navigation on sailings", "宇宙航行时自动导航");
|
||||
I18N.Add("Enable auto-cruise", "Enable auto-cruise", "启用自动巡航");
|
||||
I18N.Add("Auto boost", "Auto boost", "自动加速");
|
||||
@@ -106,9 +139,12 @@ public static class UIConfigWindow
|
||||
I18N.Add("Dismantle selected layer Confirm", "This operation will dismantle selected layer, are you sure?", "此操作将会拆除选中的戴森壳,确定吗?");
|
||||
I18N.Add("Auto Fast Build Speed Multiplier", "Auto Fast Build Speed Multiplier", "自动快速建造速度倍率");
|
||||
I18N.Add("Restore upgrades of \"Sorter Cargo Stacking\" on panel", "Restore upgrades of \"Sorter Cargo Stacking\" on panel", "在升级面板上恢复\"分拣器货物叠加\"的升级");
|
||||
I18N.Add("Disable battle-related techs in Peace mode", "Disable battle-related techs in Peace mode", "在和平模式下隐藏战斗相关科技");
|
||||
I18N.Add("Buy out techs with their prerequisites", "Buy out techs with their prerequisites", "购买科技也同时购买所有前置科技");
|
||||
I18N.Add("Set \"Sorter Cargo Stacking\" to unresearched state", "Set \"Sorter Cargo Stacking\" to unresearched state", "将\"分拣器货物叠加\"设为未研究状态");
|
||||
I18N.Add("Unlock all techs with metadata", "Unlock all techs with metadata", "使用元数据解锁所有科技");
|
||||
I18N.Add("Open Dark Fog Communicator", "Open Dark Fog Communicator", "打开黑雾通讯器");
|
||||
I18N.Add("Planet vein utilization", "Planet vein utilization in star map", "宇宙视图行星/星系矿脉数量显示");
|
||||
I18N.Apply();
|
||||
MyConfigWindow.OnUICreated += CreateUI;
|
||||
MyConfigWindow.OnUpdateUI += UpdateUI;
|
||||
@@ -149,8 +185,107 @@ public static class UIConfigWindow
|
||||
public override int ValueToIndex(double value) => Mathf.RoundToInt((float)(value * 10.0));
|
||||
}
|
||||
|
||||
private class AutoConfigDispenserChargePowerMapper() : MyWindow.RangeValueMapper<int>(3, 30)
|
||||
{
|
||||
public override string FormatValue(string format, int value)
|
||||
{
|
||||
var sb = new StringBuilder(" ");
|
||||
StringBuilderUtility.WriteKMG(sb, 8, value * 300000L, false);
|
||||
sb.Append('W');
|
||||
return sb.ToString().Trim();
|
||||
}
|
||||
}
|
||||
|
||||
private class AutoConfigBattleBaseChargePowerMapper() : MyWindow.RangeValueMapper<int>(4, 40)
|
||||
{
|
||||
|
||||
public override string FormatValue(string format, int value)
|
||||
{
|
||||
var sb = new StringBuilder(" ");
|
||||
StringBuilderUtility.WriteKMG(sb, 8, value * 300000L, false);
|
||||
sb.Append('W');
|
||||
return sb.ToString().Trim();
|
||||
}
|
||||
}
|
||||
|
||||
private class AutoConfigPLSChargePowerMapper() : MyWindow.RangeValueMapper<int>(2, 20)
|
||||
{
|
||||
|
||||
public override string FormatValue(string format, int value)
|
||||
{
|
||||
var sb = new StringBuilder(" ");
|
||||
StringBuilderUtility.WriteKMG(sb, 8, value * 3000000L, false);
|
||||
sb.Append('W');
|
||||
return sb.ToString().Trim();
|
||||
}
|
||||
}
|
||||
|
||||
private class AutoConfigCarrierMinDeliverMapper() : MyWindow.RangeValueMapper<int>(0, 10)
|
||||
{
|
||||
public override string FormatValue(string format, int value)
|
||||
{
|
||||
return (value == 0 ? 1 : (value * 10)).ToString("0\\%");
|
||||
}
|
||||
}
|
||||
|
||||
private class AutoConfigMinPilerValueMapper() : MyWindow.RangeValueMapper<int>(0, 4)
|
||||
{
|
||||
public override string FormatValue(string format, int value)
|
||||
{
|
||||
return value == 0 ? "集装使用科技上限".Translate().Trim() : value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private class AutoConfigILSChargePowerMapper() : MyWindow.RangeValueMapper<int>(2, 20)
|
||||
{
|
||||
public override string FormatValue(string format, int value)
|
||||
{
|
||||
var sb = new StringBuilder(" ");
|
||||
StringBuilderUtility.WriteKMG(sb, 8, value * 15000000L, false);
|
||||
sb.Append('W');
|
||||
return sb.ToString().Trim();
|
||||
}
|
||||
}
|
||||
|
||||
private class AutoConfigILSMaxTripShipMapper() : MyWindow.RangeValueMapper<int>(1, 41)
|
||||
{
|
||||
public override string FormatValue(string format, int value)
|
||||
{
|
||||
return value switch
|
||||
{
|
||||
<= 20 => value.ToString("0LY"),
|
||||
<= 40 => (value * 2 - 20).ToString("0LY"),
|
||||
_ => "∞",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private class AutoConfigILSWarperDistanceMapper() : MyWindow.RangeValueMapper<int>(2, 21)
|
||||
{
|
||||
public override string FormatValue(string format, int value)
|
||||
{
|
||||
return value switch
|
||||
{
|
||||
<= 7 => (value * 0.5 - 0.5).ToString("0.0AU"),
|
||||
<= 13 => (value - 4.0).ToString("0.0AU"),
|
||||
<= 16 => (value - 4).ToString("0AU"),
|
||||
<= 20 => (value * 2 - 20).ToString("0AU"),
|
||||
_ => "60AU",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private class AutoConfigVeinCollectorHarvestSpeedMapper() : MyWindow.RangeValueMapper<int>(0, 20)
|
||||
{
|
||||
public override string FormatValue(string format, int value)
|
||||
{
|
||||
return (100 + value * 10).ToString("0\\%");
|
||||
}
|
||||
}
|
||||
|
||||
private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
|
||||
{
|
||||
UnityEngine.UI.Text txt;
|
||||
_windowTrans = trans;
|
||||
wnd.AddTabGroup(trans, "UXAssist", "tab-group-uxassist");
|
||||
var tab1 = wnd.AddTab(trans, "General");
|
||||
@@ -159,9 +294,6 @@ public static class UIConfigWindow
|
||||
wnd.AddCheckBox(x, y, tab1, GamePatch.EnableWindowResizeEnabled, "Enable game window resize");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab1, GamePatch.LoadLastWindowRectEnabled, "Remeber window position and size on last exit");
|
||||
y += 36f;
|
||||
var txt = wnd.AddText2(x + 2f, y, tab1, "Scale up mouse cursor", 15, "text-scale-up-mouse-cursor");
|
||||
wnd.AddSlider(x + txt.preferredWidth + 7f, y + 6f, tab1, GamePatch.MouseCursorScaleUpMultiplier, [1, 2, 3, 4], "0x", 100f);
|
||||
/*
|
||||
y += 30f;
|
||||
wnd.AddCheckBox(x, y, tab1, GamePatch.AutoSaveOptEnabled, "Better auto-save mechanism");
|
||||
@@ -178,7 +310,10 @@ public static class UIConfigWindow
|
||||
y += 36f;
|
||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab1, GamePatch.ProfileBasedSaveFolderEnabled, "Profile-based save folder");
|
||||
wnd.AddTipsButton2(checkBoxForMeasureTextWidth.Width + 5f, y + 6f, tab1, "Profile-based save folder", "Profile-based save folder tips", "btn-profile-based-save-folder-tips");
|
||||
y += 30f;
|
||||
y += 36f;
|
||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab1, GamePatch.ProfileBasedOptionEnabled, "Profile-based option");
|
||||
wnd.AddTipsButton2(checkBoxForMeasureTextWidth.Width + 5f, y + 6f, tab1, "Profile-based option", "Profile-based option tips", "btn-profile-based-option-tips");
|
||||
y += 36f;
|
||||
wnd.AddText2(x + 2f, y, tab1, "Default profile name", 15, "text-default-profile-name");
|
||||
y += 24f;
|
||||
wnd.AddInputField(x + 2f, y, 200f, tab1, GamePatch.DefaultProfileName, 15, "input-profile-save-folder");
|
||||
@@ -196,27 +331,8 @@ public static class UIConfigWindow
|
||||
}
|
||||
y += 36f;
|
||||
wnd.AddComboBox(x + 2f, y, tab1, "Process priority").WithItems("High", "Above Normal", "Normal", "Below Normal", "Idle").WithSize(100f, 0f).WithConfigEntry(WindowFunctions.ProcessPriority);
|
||||
var details = WindowFunctions.ProcessorDetails;
|
||||
string[] affinities;
|
||||
if (details.HybridArchitecture)
|
||||
{
|
||||
affinities = new string[5];
|
||||
affinities[3] = "All P-Cores";
|
||||
affinities[4] = "All E-Cores";
|
||||
}
|
||||
else
|
||||
{
|
||||
affinities = new string[3];
|
||||
}
|
||||
affinities[0] = "All CPUs";
|
||||
affinities[1] = string.Format("First {0} CPUs".Translate(), details.ThreadCount / 2);
|
||||
affinities[2] = details.ThreadCount > 16 ? "First 8 CPUs" : "First CPU only";
|
||||
y += 36f;
|
||||
wnd.AddComboBox(x + 2f, y, tab1, "Enabled CPUs").WithItems(affinities).WithSize(200f, 0f).WithConfigEntry(WindowFunctions.ProcessAffinity);
|
||||
y += 36f;
|
||||
((RectTransform)wnd.AddButton(x, y, tab1, "CPU Info", 16, "button-show-cpu-info", WindowFunctions.ShowCPUInfo).transform).sizeDelta = new Vector2(100f, 25f);
|
||||
|
||||
var tab2 = wnd.AddTab(trans, "Planet/Factory");
|
||||
var tab2 = wnd.AddTab(trans, "Factory");
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.RemoveSomeConditionEnabled, "Remove some build conditions");
|
||||
@@ -239,152 +355,359 @@ public static class UIConfigWindow
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.OffGridBuildingEnabled, "Off-grid building and stepped rotation");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.CutConveyorBeltEnabled, "Cut conveyor belt (with shortcut key)");
|
||||
y += 36f;
|
||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab2, FactoryPatch.TreatStackingAsSingleEnabled, "Treat stack items as single in monitor components");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.QuickBuildAndDismantleLabsEnabled, "Quick build and dismantle stacking labs");
|
||||
y += 36f;
|
||||
var cb = wnd.AddCheckBox(x, y, tab2, FactoryPatch.TankFastFillInAndTakeOutEnabled, "Fast fill in to and take out from tanks");
|
||||
x += cb.Width + 5f;
|
||||
txt = wnd.AddText2(x, y + 2f, tab2, "Speed Ratio", 13, "text-tank-fast-fill-speed-ratio");
|
||||
var tankSlider = wnd.AddSlider(x + txt.preferredWidth + 5f, y + 7f, tab2, FactoryPatch.TankFastFillInAndTakeOutMultiplier, [2, 5, 10, 20, 50, 100, 500, 1000], "G", 100f).WithSmallerHandle();
|
||||
EventHandler tankSettingChanged = (_, _) =>
|
||||
{
|
||||
tankSlider.SetEnable(FactoryPatch.TankFastFillInAndTakeOutEnabled.Value);
|
||||
};
|
||||
FactoryPatch.TankFastFillInAndTakeOutEnabled.SettingChanged += tankSettingChanged;
|
||||
wnd.OnFree += () => { FactoryPatch.TankFastFillInAndTakeOutEnabled.SettingChanged -= tankSettingChanged; };
|
||||
tankSettingChanged(null, null);
|
||||
|
||||
x = 0;
|
||||
y += 36f;
|
||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab2, FactoryPatch.ProtectVeinsFromExhaustionEnabled, "Protect veins from exhaustion");
|
||||
wnd.AddTipsButton2(x + checkBoxForMeasureTextWidth.Width + 5f, y + 6f, tab2, "Protect veins from exhaustion", "Protect veins from exhaustion tips", "protect-veins-tips");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.DragBuildPowerPolesEnabled, "Drag building power poles in maximum connection range");
|
||||
y += 36f;
|
||||
var alternatelyCheckBox = wnd.AddCheckBox(x + 20f, y, tab2, FactoryPatch.DragBuildPowerPolesAlternatelyEnabled, "Build Tesla Tower and Wireless Power Tower alternately", 13);
|
||||
EventHandler alternatelyCheckBoxChanged = (_, _) => { alternatelyCheckBox.SetEnable(FactoryPatch.DragBuildPowerPolesEnabled.Value); };
|
||||
FactoryPatch.DragBuildPowerPolesEnabled.SettingChanged += alternatelyCheckBoxChanged;
|
||||
wnd.OnFree += () => { FactoryPatch.DragBuildPowerPolesEnabled.SettingChanged -= alternatelyCheckBoxChanged; };
|
||||
alternatelyCheckBoxChanged(null, null);
|
||||
|
||||
{
|
||||
y += 36f;
|
||||
var cb = wnd.AddCheckBox(x, y, tab2, FactoryPatch.TankFastFillInAndTakeOutEnabled, "Fast fill in to and take out from tanks");
|
||||
x += cb.Width + 5f;
|
||||
txt = wnd.AddText2(x, y + 2f, tab2, "Speed Ratio", 13, "text-tank-fast-fill-speed-ratio");
|
||||
var tankSlider = wnd.AddSlider(x + txt.preferredWidth + 5f, y + 7f, tab2, FactoryPatch.TankFastFillInAndTakeOutMultiplier, [2, 5, 10, 20, 50, 100, 500, 1000], "G", 100f).WithSmallerHandle();
|
||||
FactoryPatch.TankFastFillInAndTakeOutEnabled.SettingChanged += TankSettingChanged;
|
||||
wnd.OnFree += () => { FactoryPatch.TankFastFillInAndTakeOutEnabled.SettingChanged -= TankSettingChanged; };
|
||||
TankSettingChanged(null, null);
|
||||
|
||||
void TankSettingChanged(object o, EventArgs e)
|
||||
{
|
||||
tankSlider.SetEnable(FactoryPatch.TankFastFillInAndTakeOutEnabled.Value);
|
||||
}
|
||||
}
|
||||
|
||||
x = 0;
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.DoNotRenderEntitiesEnabled, "Do not render factory entities");
|
||||
y += 36f;
|
||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab2, FactoryPatch.ShortcutKeysForBlueprintCopyEnabled, "Shortcut keys for Blueprint Copy mode");
|
||||
wnd.AddTipsButton2(x + checkBoxForMeasureTextWidth.Width + 5f, y + 6f, tab2, "Shortcut keys for Blueprint Copy mode", "Shortcut keys for Blueprint Copy mode tips", "shortcut-keys-for-blueprint-copy-mode-tips");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.BeltSignalsForBuyOutEnabled, "Belt signals for buy out dark fog items automatically");
|
||||
|
||||
y += 36f;
|
||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab2, FactoryPatch.ProtectVeinsFromExhaustionEnabled, "Protect veins from exhaustion");
|
||||
wnd.AddTipsButton2(x + checkBoxForMeasureTextWidth.Width + 5f, y + 6f, tab2, "Protect veins from exhaustion", "Protect veins from exhaustion tips", "protect-veins-tips");
|
||||
{
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.DragBuildPowerPolesEnabled, "Drag building power poles in maximum connection range");
|
||||
y += 27f;
|
||||
var alternatelyCheckBox = wnd.AddCheckBox(x + 20f, y, tab2, FactoryPatch.DragBuildPowerPolesAlternatelyEnabled, "Build Tesla Tower and Wireless Power Tower alternately", 13);
|
||||
FactoryPatch.DragBuildPowerPolesEnabled.SettingChanged += AlternatelyCheckBoxChanged;
|
||||
wnd.OnFree += () => { FactoryPatch.DragBuildPowerPolesEnabled.SettingChanged -= AlternatelyCheckBoxChanged; };
|
||||
AlternatelyCheckBoxChanged(null, null);
|
||||
|
||||
void AlternatelyCheckBoxChanged(object o, EventArgs e)
|
||||
{
|
||||
alternatelyCheckBox.SetEnable(FactoryPatch.DragBuildPowerPolesEnabled.Value);
|
||||
}
|
||||
}
|
||||
|
||||
x = 400f;
|
||||
y = 10f;
|
||||
wnd.AddButton(x, y, tab2, "Initialize This Planet", 16, "button-init-planet", () =>
|
||||
UIMessageBox.Show("Initialize This Planet".Translate(), "Initialize This Planet Confirm".Translate(), "取消".Translate(), "确定".Translate(), 2, null,
|
||||
UIMessageBox.Show("Initialize This Planet".Translate(), "Initialize This Planet Confirm".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.QUESTION, null,
|
||||
() => { PlanetFunctions.RecreatePlanet(true); })
|
||||
);
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, tab2, "Dismantle All Buildings", 16, "button-dismantle-all", () =>
|
||||
UIMessageBox.Show("Dismantle All Buildings".Translate(), "Dismantle All Buildings Confirm".Translate(), "取消".Translate(), "确定".Translate(), 2, null,
|
||||
UIMessageBox.Show("Dismantle All Buildings".Translate(), "Dismantle All Buildings Confirm".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.QUESTION, null,
|
||||
() => { PlanetFunctions.DismantleAll(false); })
|
||||
);
|
||||
y += 72f;
|
||||
wnd.AddButton(x, y, 200, tab2, "Quick build Orbital Collectors", 16, "button-init-planet", PlanetFunctions.BuildOrbitalCollectors);
|
||||
y += 30f;
|
||||
wnd.AddText2(x + 10f, y, tab2, "Maximum count to build", 15, "text-oc-build-count");
|
||||
y += 24f;
|
||||
wnd.AddSlider(x + 10f, y, tab2, PlanetFunctions.OrbitalCollectorMaxBuildCount, new OcMapper(), "G", 200f);
|
||||
x = 400f;
|
||||
y += 54f;
|
||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab2, LogisticsPatch.LogisticsCapacityTweaksEnabled, "Enhance control for logistic storage limits");
|
||||
wnd.AddTipsButton2(x + checkBoxForMeasureTextWidth.Width + 5f, y + 6f, tab2, "Enhance control for logistic storage limits", "Enhance control for logistic storage limits tips", "enhanced-logistic-limit-tips");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, LogisticsPatch.AllowOverflowInLogisticsEnabled, "Allow overflow for Logistic Stations and Advanced Mining Machines");
|
||||
y += 36f;
|
||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab2, LogisticsPatch.LogisticsConstrolPanelImprovementEnabled, "Logistics Control Panel Improvement");
|
||||
wnd.AddTipsButton2(x + checkBoxForMeasureTextWidth.Width + 5f, y + 6f, tab2, "Logistics Control Panel Improvement", "Logistics Control Panel Improvement tips", "lcp-improvement-tips");
|
||||
y += 36f;
|
||||
var cb0 = wnd.AddCheckBox(x, y, tab2, LogisticsPatch.RealtimeLogisticsInfoPanelEnabled, "Real-time logistic stations info panel");
|
||||
y += 36f;
|
||||
var cb1 = wnd.AddCheckBox(x + 20f, y, tab2, LogisticsPatch.RealtimeLogisticsInfoPanelBarsEnabled, "Show status bars for storage items", 13);
|
||||
EventHandler anySettingsChanged = (_, _) =>
|
||||
{
|
||||
if (AuxilaryfunctionWrapper.ShowStationInfo == null)
|
||||
{
|
||||
cb0.SetEnable(true);
|
||||
cb1.SetEnable(LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.Value);
|
||||
return;
|
||||
}
|
||||
txt = wnd.AddText2(x + 10f, y, tab2, "Maximum count to build", 15, "text-oc-build-count");
|
||||
wnd.AddSlider(x + 10f + txt.preferredWidth + 5f, y + 6f, tab2, PlanetFunctions.OrbitalCollectorMaxBuildCount, new OcMapper(), "G", 160f);
|
||||
|
||||
y += 18f;
|
||||
|
||||
var on = !AuxilaryfunctionWrapper.ShowStationInfo.Value;
|
||||
cb0.SetEnable(on);
|
||||
cb1.SetEnable(on & LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.Value);
|
||||
if (!on)
|
||||
{
|
||||
LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.Value = false;
|
||||
}
|
||||
};
|
||||
if (AuxilaryfunctionWrapper.ShowStationInfo != null)
|
||||
{
|
||||
AuxilaryfunctionWrapper.ShowStationInfo.SettingChanged += anySettingsChanged;
|
||||
wnd.OnFree += () => { AuxilaryfunctionWrapper.ShowStationInfo.SettingChanged -= anySettingsChanged; };
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.TweakBuildingBufferEnabled, "Tweak building buffers");
|
||||
y += 27f;
|
||||
txt = wnd.AddText2(x + 20f, y, tab2, "Assembler buffer time multiplier(in seconds)", 13);
|
||||
var nx1 = txt.preferredWidth + 5f;
|
||||
y += 27f;
|
||||
txt = wnd.AddText2(x + 20f, y, tab2, "Assembler buffer minimum multiplier", 13);
|
||||
var nx2 = txt.preferredWidth + 5f;
|
||||
y += 27f;
|
||||
txt = wnd.AddText2(x + 20f, y, tab2, "Buffer count for assembling in labs", 13);
|
||||
var nx3 = txt.preferredWidth + 5f;
|
||||
y += 27f;
|
||||
txt = wnd.AddText2(x + 20f, y, tab2, "Extra buffer count for Self-evolution Labs", 13);
|
||||
var nx4 = txt.preferredWidth + 5f;
|
||||
y += 27f;
|
||||
txt = wnd.AddText2(x + 20f, y, tab2, "Buffer count for researching in labs", 13);
|
||||
var nx5 = txt.preferredWidth + 5f;
|
||||
y += 27f;
|
||||
txt = wnd.AddText2(x + 20f, y, tab2, "Ray Receiver Graviton Lens buffer count", 13);
|
||||
var nx6 = txt.preferredWidth + 5f;
|
||||
y += 27f;
|
||||
txt = wnd.AddText2(x + 20f, y, tab2, "Ejector Solar Sails buffer count", 13);
|
||||
var nx7 = txt.preferredWidth + 5f;
|
||||
y += 27f;
|
||||
txt = wnd.AddText2(x + 20f, y, tab2, "Silo Rockets buffer count", 13);
|
||||
var nx8 = txt.preferredWidth + 5f;
|
||||
y -= 189f;
|
||||
var mx = Mathf.Max(nx1, nx2, nx3, nx4, nx5, nx6, nx7, nx8) + 20f;
|
||||
var assemblerBufferTimeMultiplierSlider = wnd.AddSlider(x + mx, y + 5f, tab2, FactoryPatch.AssemblerBufferTimeMultiplier, new MyWindow.RangeValueMapper<int>(2, 10), "0", 120f).WithSmallerHandle();
|
||||
y += 27f;
|
||||
var assemblerBufferMininumMultiplierSlider = wnd.AddSlider(x + mx, y + 5f, tab2, FactoryPatch.AssemblerBufferMininumMultiplier, new MyWindow.RangeValueMapper<int>(2, 10), "0", 120f).WithSmallerHandle();
|
||||
y += 27f;
|
||||
var labBufferMaxCountForAssembleSlider = wnd.AddSlider(x + mx, y + 5f, tab2, FactoryPatch.LabBufferMaxCountForAssemble, new MyWindow.RangeValueMapper<int>(2, 20), "0", 120f).WithSmallerHandle();
|
||||
y += 27f;
|
||||
var labBufferExtraCountForAdvancedAssembleSlider = wnd.AddSlider(x + mx, y + 5f, tab2, FactoryPatch.LabBufferExtraCountForAdvancedAssemble, new MyWindow.RangeValueMapper<int>(1, 10), "0", 120f).WithSmallerHandle();
|
||||
y += 27f;
|
||||
var labBufferMaxCountForResearchSlider = wnd.AddSlider(x + mx, y + 5f, tab2, FactoryPatch.LabBufferMaxCountForResearch, new MyWindow.RangeValueMapper<int>(2, 20), "0", 120f).WithSmallerHandle();
|
||||
y += 27f;
|
||||
var receiverBufferCountSlider = wnd.AddSlider(x + mx, y + 5f, tab2, FactoryPatch.ReceiverBufferCount, new MyWindow.RangeValueMapper<int>(1, 20), "0", 120f).WithSmallerHandle();
|
||||
y += 27f;
|
||||
var ejectorBufferCountSlider = wnd.AddSlider(x + mx, y + 5f, tab2, FactoryPatch.EjectorBufferCount, new MyWindow.RangeValueWithMultiplierMapper<int>(1, 80, 5), "0", 120f).WithSmallerHandle();
|
||||
y += 27f;
|
||||
var siloBufferCountSlider = wnd.AddSlider(x + mx, y + 5f, tab2, FactoryPatch.SiloBufferCount, new MyWindow.RangeValueMapper<int>(1, 40), "0", 120f).WithSmallerHandle();
|
||||
FactoryPatch.TweakBuildingBufferEnabled.SettingChanged += TweakBuildingBufferChanged;
|
||||
wnd.OnFree += () => { FactoryPatch.TweakBuildingBufferEnabled.SettingChanged -= TweakBuildingBufferChanged; };
|
||||
TweakBuildingBufferChanged(null, null);
|
||||
|
||||
void TweakBuildingBufferChanged(object o, EventArgs e)
|
||||
{
|
||||
assemblerBufferTimeMultiplierSlider.SetEnable(FactoryPatch.TweakBuildingBufferEnabled.Value);
|
||||
assemblerBufferMininumMultiplierSlider.SetEnable(FactoryPatch.TweakBuildingBufferEnabled.Value);
|
||||
labBufferMaxCountForAssembleSlider.SetEnable(FactoryPatch.TweakBuildingBufferEnabled.Value);
|
||||
labBufferExtraCountForAdvancedAssembleSlider.SetEnable(FactoryPatch.TweakBuildingBufferEnabled.Value);
|
||||
labBufferMaxCountForResearchSlider.SetEnable(FactoryPatch.TweakBuildingBufferEnabled.Value);
|
||||
receiverBufferCountSlider.SetEnable(FactoryPatch.TweakBuildingBufferEnabled.Value);
|
||||
ejectorBufferCountSlider.SetEnable(FactoryPatch.TweakBuildingBufferEnabled.Value);
|
||||
siloBufferCountSlider.SetEnable(FactoryPatch.TweakBuildingBufferEnabled.Value);
|
||||
}
|
||||
}
|
||||
LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.SettingChanged += anySettingsChanged;
|
||||
wnd.OnFree += () => { LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.SettingChanged -= anySettingsChanged; };
|
||||
anySettingsChanged(null, null);
|
||||
|
||||
var tab3 = wnd.AddTab(trans, "Player/Mecha");
|
||||
var tab3 = wnd.AddTab(trans, "Logistics");
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
wnd.AddCheckBox(x, y, tab3, FactoryPatch.UnlimitInteractiveEnabled, "Unlimited interactive range");
|
||||
|
||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab3, LogisticsPatch.LogisticsCapacityTweaksEnabled, "Enhance control for logistic storage capacities");
|
||||
wnd.AddTipsButton2(x + checkBoxForMeasureTextWidth.Width + 5f, y + 6f, tab3, "Enhance control for logistic storage capacities", "Enhance control for logistic storage capacities tips", "enhanced-logistic-capacities-tips");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlanetPatch.PlayerActionsInGlobeViewEnabled, "Enable player actions in globe view");
|
||||
wnd.AddCheckBox(x, y, tab3, LogisticsPatch.AllowOverflowInLogisticsEnabled, "Allow overflow for Logistic Stations and Advanced Mining Machines");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlayerPatch.HideTipsForSandsChangesEnabled, "Hide tips for soil piles changes");
|
||||
y += 36f;
|
||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab3, PlayerPatch.EnhancedMechaForgeCountControlEnabled, "Enhanced count control for hand-make");
|
||||
wnd.AddTipsButton2(x + checkBoxForMeasureTextWidth.Width + 5f, y + 6f, tab3, "Enhanced count control for hand-make", "Enhanced count control for hand-make tips", "enhanced-count-control-tips");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab3, PlayerPatch.AutoNavigationEnabled, "Auto navigation on sailings");
|
||||
y += 26f;
|
||||
var navcb1 = wnd.AddCheckBox(x + 20f, y, tab3, PlayerPatch.AutoCruiseEnabled, "Enable auto-cruise", 13);
|
||||
y += 26f;
|
||||
var navcb2 = wnd.AddCheckBox(x + 20f, y, tab3, PlayerPatch.AutoBoostEnabled, "Auto boost", 13);
|
||||
y += 32f;
|
||||
txt = wnd.AddText2(x + 20f, y, tab3, "Distance to use warp", 15, "text-distance-to-warp");
|
||||
var navSlider = wnd.AddSlider(x + 20f + txt.preferredWidth + 5f, y + 6f, tab3, PlayerPatch.DistanceToWarp, new DistanceMapper(), "0.0", 100f);
|
||||
EventHandler navSettingChanged = (_, _) =>
|
||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab3, LogisticsPatch.LogisticsConstrolPanelImprovementEnabled, "Logistics Control Panel Improvement");
|
||||
wnd.AddTipsButton2(x + checkBoxForMeasureTextWidth.Width + 5f, y + 6f, tab3, "Logistics Control Panel Improvement", "Logistics Control Panel Improvement tips", "lcp-improvement-tips");
|
||||
{
|
||||
navcb1.SetEnable(PlayerPatch.AutoNavigationEnabled.Value);
|
||||
navcb2.SetEnable(PlayerPatch.AutoNavigationEnabled.Value);
|
||||
navSlider.SetEnable(PlayerPatch.AutoNavigationEnabled.Value);
|
||||
};
|
||||
PlayerPatch.AutoNavigationEnabled.SettingChanged += navSettingChanged;
|
||||
wnd.OnFree += () => { PlayerPatch.AutoNavigationEnabled.SettingChanged -= navSettingChanged; };
|
||||
navSettingChanged(null, null);
|
||||
y += 36f;
|
||||
var realtimeLogisticsInfoPanelCheckBox = wnd.AddCheckBox(x, y, tab3, LogisticsPatch.RealtimeLogisticsInfoPanelEnabled, "Real-time logistic stations info panel");
|
||||
y += 27f;
|
||||
var realtimeLogisticsInfoPanelBarsCheckBox = wnd.AddCheckBox(x + 20f, y, tab3, LogisticsPatch.RealtimeLogisticsInfoPanelBarsEnabled, "Show status bars for storage items", 13);
|
||||
if (AuxilaryfunctionWrapper.ShowStationInfo != null)
|
||||
{
|
||||
AuxilaryfunctionWrapper.ShowStationInfo.SettingChanged += RealtimeLogisticsInfoPanelChanged;
|
||||
wnd.OnFree += () => { AuxilaryfunctionWrapper.ShowStationInfo.SettingChanged -= RealtimeLogisticsInfoPanelChanged; };
|
||||
}
|
||||
LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.SettingChanged += RealtimeLogisticsInfoPanelChanged;
|
||||
wnd.OnFree += () => { LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.SettingChanged -= RealtimeLogisticsInfoPanelChanged; };
|
||||
RealtimeLogisticsInfoPanelChanged(null, null);
|
||||
|
||||
var tab4 = wnd.AddTab(trans, "Dyson Sphere");
|
||||
void RealtimeLogisticsInfoPanelChanged(object o, EventArgs e)
|
||||
{
|
||||
if (AuxilaryfunctionWrapper.ShowStationInfo == null)
|
||||
{
|
||||
realtimeLogisticsInfoPanelCheckBox.SetEnable(true);
|
||||
realtimeLogisticsInfoPanelBarsCheckBox.SetEnable(LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.Value);
|
||||
return;
|
||||
}
|
||||
|
||||
var on = !AuxilaryfunctionWrapper.ShowStationInfo.Value;
|
||||
realtimeLogisticsInfoPanelCheckBox.SetEnable(on);
|
||||
realtimeLogisticsInfoPanelBarsCheckBox.SetEnable(on & LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.Value);
|
||||
if (!on)
|
||||
{
|
||||
LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.Value = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab3, LogisticsPatch.AutoConfigLogisticsEnabled, "Auto-config logistic stations");
|
||||
y += 26f;
|
||||
wnd.AddCheckBox(x + 10f, y, tab3, LogisticsPatch.AutoConfigLimitAutoReplenishCount, "Limit auto-replenish count to values below", 13).WithSmallerBox();
|
||||
y += 18f;
|
||||
wnd.AddCheckBox(x + 10f, y, tab3, LogisticsPatch.SetDefaultRemoteLogicToStorage, "Set default remote logic to storage", 13).WithSmallerBox();
|
||||
y += 16f;
|
||||
var maxWidth = 0f;
|
||||
wnd.AddText2(10f, y, tab3, "Dispenser", 14, "text-dispenser");
|
||||
y += 18f;
|
||||
var oy = y;
|
||||
x = 20f;
|
||||
var textForMeasureTextWidth = wnd.AddText2(x, y, tab3, "Max. Charging Power", 13, "text-dispenser-max-charging-power");
|
||||
maxWidth = Mathf.Max(maxWidth, textForMeasureTextWidth.preferredWidth);
|
||||
y += 18f;
|
||||
textForMeasureTextWidth = wnd.AddText2(x, y, tab3, "Count of Bots filled", 13, "text-dispenser-count-of-bots-filled");
|
||||
maxWidth = Mathf.Max(maxWidth, textForMeasureTextWidth.preferredWidth);
|
||||
y += 18f;
|
||||
wnd.AddText2(10f, y, tab3, "Battlefield Analysis Base", 14, "text-battlefield-analysis-base");
|
||||
y += 18f;
|
||||
textForMeasureTextWidth = wnd.AddText2(x, y, tab3, "Max. Charging Power", 13, "text-battlefield-analysis-base-max-charging-power");
|
||||
maxWidth = Mathf.Max(maxWidth, textForMeasureTextWidth.preferredWidth);
|
||||
y += 18f;
|
||||
wnd.AddText2(10f, y, tab3, "PLS", 14, "text-pls");
|
||||
y += 18f;
|
||||
textForMeasureTextWidth = wnd.AddText2(x, y, tab3, "Max. Charging Power", 13, "text-pls-max-charging-power");
|
||||
maxWidth = Mathf.Max(maxWidth, textForMeasureTextWidth.preferredWidth);
|
||||
y += 18f;
|
||||
textForMeasureTextWidth = wnd.AddText2(x, y, tab3, "Drone transport range", 13, "text-pls-drone-transport-range");
|
||||
maxWidth = Mathf.Max(maxWidth, textForMeasureTextWidth.preferredWidth);
|
||||
y += 18f;
|
||||
textForMeasureTextWidth = wnd.AddText2(x, y, tab3, "Min. Load of Drones", 13, "text-pls-min-load-of-drones");
|
||||
maxWidth = Mathf.Max(maxWidth, textForMeasureTextWidth.preferredWidth);
|
||||
y += 18f;
|
||||
textForMeasureTextWidth = wnd.AddText2(x, y, tab3, "Outgoing integration count", 13, "text-pls-outgoing-integration-count");
|
||||
maxWidth = Mathf.Max(maxWidth, textForMeasureTextWidth.preferredWidth);
|
||||
y += 18f;
|
||||
textForMeasureTextWidth = wnd.AddText2(x, y, tab3, "Count of Drones filled", 13, "text-pls-count-of-drones-filled");
|
||||
maxWidth = Mathf.Max(maxWidth, textForMeasureTextWidth.preferredWidth);
|
||||
y += 18f;
|
||||
wnd.AddText2(10f, y, tab3, "ILS", 14, "text-ils");
|
||||
y += 18f;
|
||||
textForMeasureTextWidth = wnd.AddText2(x, y, tab3, "Max. Charging Power", 13, "text-ils-max-charging-power");
|
||||
maxWidth = Mathf.Max(maxWidth, textForMeasureTextWidth.preferredWidth);
|
||||
y += 18f;
|
||||
textForMeasureTextWidth = wnd.AddText2(x, y, tab3, "Drone transport range", 13, "text-ils-drone-transport-range");
|
||||
maxWidth = Mathf.Max(maxWidth, textForMeasureTextWidth.preferredWidth);
|
||||
y += 18f;
|
||||
textForMeasureTextWidth = wnd.AddText2(x, y, tab3, "Vessel transport range", 13, "text-ils-vessel-transport-range");
|
||||
maxWidth = Mathf.Max(maxWidth, textForMeasureTextWidth.preferredWidth);
|
||||
wnd.AddCheckBox(x + 360f, y + 6f, tab3, LogisticsPatch.AutoConfigILSIncludeOrbitCollector, "Include Orbital Collector", 13).WithSmallerBox();
|
||||
y += 18f;
|
||||
textForMeasureTextWidth = wnd.AddText2(x, y, tab3, "Warp distance", 13, "text-ils-warp-distance");
|
||||
maxWidth = Mathf.Max(maxWidth, textForMeasureTextWidth.preferredWidth);
|
||||
wnd.AddCheckBox(x + 360f, y + 6f, tab3, LogisticsPatch.AutoConfigILSWarperNecessary, "Warpers required", 13).WithSmallerBox();
|
||||
y += 18f;
|
||||
textForMeasureTextWidth = wnd.AddText2(x, y, tab3, "Min. Load of Drones", 13, "text-ils-min-load-of-drones");
|
||||
maxWidth = Mathf.Max(maxWidth, textForMeasureTextWidth.preferredWidth);
|
||||
y += 18f;
|
||||
textForMeasureTextWidth = wnd.AddText2(x, y, tab3, "Min. Load of Vessels", 13, "text-ils-min-load-of-vessels");
|
||||
maxWidth = Mathf.Max(maxWidth, textForMeasureTextWidth.preferredWidth);
|
||||
y += 18f;
|
||||
textForMeasureTextWidth = wnd.AddText2(x, y, tab3, "Outgoing integration count", 13, "text-ils-outgoing-integration-count");
|
||||
maxWidth = Mathf.Max(maxWidth, textForMeasureTextWidth.preferredWidth);
|
||||
y += 18f;
|
||||
textForMeasureTextWidth = wnd.AddText2(x, y, tab3, "Count of Drones filled", 13, "text-ils-count-of-drones-filled");
|
||||
maxWidth = Mathf.Max(maxWidth, textForMeasureTextWidth.preferredWidth);
|
||||
y += 18f;
|
||||
textForMeasureTextWidth = wnd.AddText2(x, y, tab3, "Count of Vessels filled", 13, "text-ils-count-of-vessels-filled");
|
||||
maxWidth = Mathf.Max(maxWidth, textForMeasureTextWidth.preferredWidth);
|
||||
y += 18f;
|
||||
wnd.AddText2(10f, y, tab3, "Advanced Mining Machine", 14, "text-amm");
|
||||
y += 18f;
|
||||
textForMeasureTextWidth = wnd.AddText2(x, y, tab3, "Collecting Speed", 13, "text-amm-collecting-speed");
|
||||
maxWidth = Mathf.Max(maxWidth, textForMeasureTextWidth.preferredWidth);
|
||||
y += 18f;
|
||||
textForMeasureTextWidth = wnd.AddText2(x, y, tab3, "Min. Piler Value", 13, "text-amm-min-piler-value");
|
||||
maxWidth = Mathf.Max(maxWidth, textForMeasureTextWidth.preferredWidth);
|
||||
y = oy + 1;
|
||||
var nx = x + maxWidth + 5f;
|
||||
wnd.AddSideSlider(nx, y, tab3, LogisticsPatch.AutoConfigDispenserChargePower, new AutoConfigDispenserChargePowerMapper(), "G", 150f, -100f).WithFontSize(13);
|
||||
y += 18f;
|
||||
wnd.AddSideSlider(nx, y, tab3, LogisticsPatch.AutoConfigDispenserCourierCount, new MyWindow.RangeValueMapper<int>(0, 10), "G", 150f, -100f).WithFontSize(13);
|
||||
y += 36f;
|
||||
wnd.AddSideSlider(nx, y, tab3, LogisticsPatch.AutoConfigBattleBaseChargePower, new AutoConfigBattleBaseChargePowerMapper(), "G", 150f, -100f).WithFontSize(13);
|
||||
y += 36f;
|
||||
wnd.AddSideSlider(nx, y, tab3, LogisticsPatch.AutoConfigPLSChargePower, new AutoConfigPLSChargePowerMapper(), "G", 150f, -100f).WithFontSize(13);
|
||||
y += 18f;
|
||||
wnd.AddSideSlider(nx, y, tab3, LogisticsPatch.AutoConfigPLSMaxTripDrone, new MyWindow.RangeValueMapper<int>(1, 180), "0°", 150f, -100f).WithFontSize(13);
|
||||
y += 18f;
|
||||
wnd.AddSideSlider(nx, y, tab3, LogisticsPatch.AutoConfigPLSDroneMinDeliver, new AutoConfigCarrierMinDeliverMapper(), "G", 150f, -100f).WithFontSize(13);
|
||||
y += 18f;
|
||||
wnd.AddSideSlider(nx, y, tab3, LogisticsPatch.AutoConfigPLSMinPilerValue, new AutoConfigMinPilerValueMapper(), "G", 150f, -100f).WithFontSize(13);
|
||||
y += 18f;
|
||||
wnd.AddSideSlider(nx, y, tab3, LogisticsPatch.AutoConfigPLSDroneCount, new MyWindow.RangeValueMapper<int>(0, 50), "G", 150f, -100f).WithFontSize(13);
|
||||
y += 36f;
|
||||
wnd.AddSideSlider(nx, y, tab3, LogisticsPatch.AutoConfigILSChargePower, new AutoConfigILSChargePowerMapper(), "G", 150f, -100f).WithFontSize(13);
|
||||
y += 18f;
|
||||
wnd.AddSideSlider(nx, y, tab3, LogisticsPatch.AutoConfigILSMaxTripDrone, new MyWindow.RangeValueMapper<int>(1, 180), "0°", 150f, -100f).WithFontSize(13);
|
||||
y += 18f;
|
||||
wnd.AddSideSlider(nx, y, tab3, LogisticsPatch.AutoConfigILSMaxTripShip, new AutoConfigILSMaxTripShipMapper(), "G", 150f, -100f).WithFontSize(13);
|
||||
y += 18f;
|
||||
wnd.AddSideSlider(nx, y, tab3, LogisticsPatch.AutoConfigILSWarperDistance, new AutoConfigILSWarperDistanceMapper(), "G", 150f, -100f).WithFontSize(13);
|
||||
y += 18f;
|
||||
wnd.AddSideSlider(nx, y, tab3, LogisticsPatch.AutoConfigILSDroneMinDeliver, new AutoConfigCarrierMinDeliverMapper(), "G", 150f, -100f).WithFontSize(13);
|
||||
y += 18f;
|
||||
wnd.AddSideSlider(nx, y, tab3, LogisticsPatch.AutoConfigILSShipMinDeliver, new AutoConfigCarrierMinDeliverMapper(), "G", 150f, -100f).WithFontSize(13);
|
||||
y += 18f;
|
||||
wnd.AddSideSlider(nx, y, tab3, LogisticsPatch.AutoConfigILSMinPilerValue, new AutoConfigMinPilerValueMapper(), "G", 150f, -100f).WithFontSize(13);
|
||||
y += 18f;
|
||||
wnd.AddSideSlider(nx, y, tab3, LogisticsPatch.AutoConfigILSDroneCount, new MyWindow.RangeValueMapper<int>(0, 100), "G", 150f, -100f).WithFontSize(13);
|
||||
y += 18f;
|
||||
wnd.AddSideSlider(nx, y, tab3, LogisticsPatch.AutoConfigILSShipCount, new MyWindow.RangeValueMapper<int>(0, 10), "G", 150f, -100f).WithFontSize(13);
|
||||
y += 36f;
|
||||
wnd.AddSideSlider(nx, y, tab3, LogisticsPatch.AutoConfigVeinCollectorHarvestSpeed, new AutoConfigVeinCollectorHarvestSpeedMapper(), "G", 150f, -100f).WithFontSize(13);
|
||||
y += 18f;
|
||||
wnd.AddSideSlider(nx, y, tab3, LogisticsPatch.AutoConfigVeinCollectorMinPilerValue, new AutoConfigMinPilerValueMapper(), "G", 150f, -100f).WithFontSize(13);
|
||||
x = 0f;
|
||||
|
||||
var tab4 = wnd.AddTab(trans, "Player/Mecha");
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.StopEjectOnNodeCompleteEnabled, "Stop ejectors when available nodes are all filled up");
|
||||
wnd.AddCheckBox(x, y, tab4, FactoryPatch.UnlimitInteractiveEnabled, "Unlimited interactive range");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.OnlyConstructNodesEnabled, "Construct only structure points but frames");
|
||||
wnd.AddCheckBox(x, y, tab4, PlanetPatch.PlayerActionsInGlobeViewEnabled, "Enable player actions in globe view");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab4, PlayerPatch.HideTipsForSandsChangesEnabled, "Hide tips for soil piles changes");
|
||||
y += 36f;
|
||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab4, PlayerPatch.EnhancedMechaForgeCountControlEnabled, "Enhanced count control for hand-make");
|
||||
wnd.AddTipsButton2(x + checkBoxForMeasureTextWidth.Width + 5f, y + 6f, tab4, "Enhanced count control for hand-make", "Enhanced count control for hand-make tips", "enhanced-count-control-tips");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab4, PlayerPatch.ShortcutKeysForStarsNameEnabled, "Shortcut keys for showing stars' name");
|
||||
|
||||
{
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab4, PlayerPatch.AutoNavigationEnabled, "Auto navigation on sailings");
|
||||
y += 27f;
|
||||
var autoCruiseCheckBox = wnd.AddCheckBox(x + 20f, y, tab4, PlayerPatch.AutoCruiseEnabled, "Enable auto-cruise", 13);
|
||||
y += 27f;
|
||||
var autoBoostCheckBox = wnd.AddCheckBox(x + 20f, y, tab4, PlayerPatch.AutoBoostEnabled, "Auto boost", 13);
|
||||
y += 27f;
|
||||
txt = wnd.AddText2(x + 20f, y, tab4, "Distance to use warp", 15, "text-distance-to-warp");
|
||||
var navDistanceSlider = wnd.AddSlider(x + 20f + txt.preferredWidth + 5f, y + 6f, tab4, PlayerPatch.DistanceToWarp, new DistanceMapper(), "0.0", 100f);
|
||||
PlayerPatch.AutoNavigationEnabled.SettingChanged += NavSettingChanged;
|
||||
wnd.OnFree += () => { PlayerPatch.AutoNavigationEnabled.SettingChanged -= NavSettingChanged; };
|
||||
NavSettingChanged(null, null);
|
||||
|
||||
void NavSettingChanged(object o, EventArgs e)
|
||||
{
|
||||
autoCruiseCheckBox.SetEnable(PlayerPatch.AutoNavigationEnabled.Value);
|
||||
autoBoostCheckBox.SetEnable(PlayerPatch.AutoNavigationEnabled.Value);
|
||||
navDistanceSlider.SetEnable(PlayerPatch.AutoNavigationEnabled.Value);
|
||||
}
|
||||
}
|
||||
|
||||
var tab5 = wnd.AddTab(trans, "Dyson Sphere");
|
||||
x = 0f;
|
||||
y = 10f;
|
||||
wnd.AddCheckBox(x, y, tab5, DysonSpherePatch.StopEjectOnNodeCompleteEnabled, "Stop ejectors when available nodes are all filled up");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab5, DysonSpherePatch.OnlyConstructNodesEnabled, "Construct only structure points but frames");
|
||||
x = 400f;
|
||||
y = 10f;
|
||||
_dysonInitBtn = wnd.AddButton(x, y, tab4, "Initialize Dyson Sphere", 16, "init-dyson-sphere", () =>
|
||||
UIMessageBox.Show("Initialize Dyson Sphere".Translate(), "Initialize Dyson Sphere Confirm".Translate(), "取消".Translate(), "确定".Translate(), 2, null,
|
||||
_dysonInitBtn = wnd.AddButton(x, y, tab5, "Initialize Dyson Sphere", 16, "init-dyson-sphere", () =>
|
||||
UIMessageBox.Show("Initialize Dyson Sphere".Translate(), "Initialize Dyson Sphere Confirm".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.QUESTION, null,
|
||||
() => { DysonSphereFunctions.InitCurrentDysonLayer(null, -1); })
|
||||
);
|
||||
y += 36f;
|
||||
wnd.AddText2(x, y, tab4, "Click to dismantle selected layer", 16, "text-dismantle-layer");
|
||||
y += 26f;
|
||||
wnd.AddText2(x, y, tab5, "Click to dismantle selected layer", 16, "text-dismantle-layer");
|
||||
y += 27f;
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
var id = i + 1;
|
||||
var btn = wnd.AddFlatButton(x, y, tab4, id.ToString(), 12, "dismantle-layer-" + id, () =>
|
||||
var btn = wnd.AddFlatButton(x, y, tab5, id.ToString(), 12, "dismantle-layer-" + id, () =>
|
||||
{
|
||||
var star = DysonSphereFunctions.CurrentStarForDysonSystem();
|
||||
UIMessageBox.Show("Dismantle selected layer".Translate(), "Dismantle selected layer Confirm".Translate(), "取消".Translate(), "确定".Translate(), 2, null,
|
||||
UIMessageBox.Show("Dismantle selected layer".Translate(), "Dismantle selected layer Confirm".Translate(), "取消".Translate(), "确定".Translate(), UIMessageBox.QUESTION, null,
|
||||
() => { DysonSphereFunctions.InitCurrentDysonLayer(star, id); });
|
||||
}
|
||||
);
|
||||
((RectTransform)btn.transform).sizeDelta = new Vector2(40f, 20f);
|
||||
DysonLayerBtn[i] = btn;
|
||||
).WithSize(40f, 20f);
|
||||
DysonLayerBtn[i] = btn.uiButton;
|
||||
if (i == 4)
|
||||
{
|
||||
x -= 160f;
|
||||
@@ -398,35 +721,28 @@ public static class UIConfigWindow
|
||||
|
||||
x = 400f;
|
||||
y += 36f;
|
||||
wnd.AddText2(x, y, tab4, "Auto Fast Build Speed Multiplier", 15, "text-auto-fast-build-multiplier");
|
||||
y += 24f;
|
||||
wnd.AddSlider(x, y, tab4, DysonSpherePatch.AutoConstructMultiplier, [1, 2, 5, 10, 20, 50, 100], "0", 200f);
|
||||
_dysonTab = tab4;
|
||||
txt = wnd.AddText2(x, y, tab5, "Auto Fast Build Speed Multiplier", 15, "text-auto-fast-build-multiplier");
|
||||
wnd.AddSlider(x + txt.preferredWidth + 5f, y + 6f, tab5, DysonSpherePatch.AutoConstructMultiplier, [1, 2, 5, 10, 20, 50, 100], "0", 100f);
|
||||
_dysonTab = tab5;
|
||||
|
||||
var tab5 = wnd.AddTab(_windowTrans, "Tech/Combat");
|
||||
var tab6 = wnd.AddTab(trans, "Tech/Combat/UI");
|
||||
x = 10;
|
||||
y = 10;
|
||||
wnd.AddCheckBox(x, y, tab5, TechPatch.BatchBuyoutTechEnabled, "Buy out techs with their prerequisites");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab5, TechPatch.SorterCargoStackingEnabled, "Restore upgrades of \"Sorter Cargo Stacking\" on panel");
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 300f, tab5, "Set \"Sorter Cargo Stacking\" to unresearched state", 16, "button-remove-cargo-stacking", () =>
|
||||
{
|
||||
var history = GameMain.data?.history;
|
||||
if (history == null) return;
|
||||
history.inserterStackCountObsolete = 1;
|
||||
for (var id = 3301; id <= 3305; id++)
|
||||
{
|
||||
history.techStates.TryGetValue(id, out var state);
|
||||
if (!state.unlocked) continue;
|
||||
state.unlocked = false;
|
||||
state.hashUploaded = 0;
|
||||
history.techStates[id] = state;
|
||||
}
|
||||
});
|
||||
wnd.AddCheckBox(x, y, tab6, UIPatch.PlanetVeinUtilizationEnabled, "Planet vein utilization");
|
||||
y += 36f;
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 300f, tab5, "Open Dark Fog Communicator", 16, "button-open-df-communicator", () =>
|
||||
wnd.AddCheckBox(x, y, tab6, TechPatch.BatchBuyoutTechEnabled, "Buy out techs with their prerequisites");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab6, TechPatch.SorterCargoStackingEnabled, "Restore upgrades of \"Sorter Cargo Stacking\" on panel");
|
||||
y += 36f;
|
||||
wnd.AddCheckBox(x, y, tab6, TechPatch.DisableBattleRelatedTechsInPeaceModeEnabled, "Disable battle-related techs in Peace mode");
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 300f, tab6, "Set \"Sorter Cargo Stacking\" to unresearched state", 16, "button-remove-cargo-stacking", TechFunctions.RemoveCargoStackingTechs);
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 300f, tab6, "Unlock all techs with metadata", 16, "button-unlock-all-techs-with-metadata", TechFunctions.UnlockAllProtoWithMetadataAndPrompt);
|
||||
y += 36f;
|
||||
y += 36f;
|
||||
wnd.AddButton(x, y, 300f, tab6, "Open Dark Fog Communicator", 16, "button-open-df-communicator", () =>
|
||||
{
|
||||
if (!(GameMain.data?.gameDesc.isCombatMode ?? false)) return;
|
||||
var uiGame = UIRoot.instance.uiGame;
|
||||
|
||||
@@ -9,12 +9,12 @@ using CommonAPI.Systems;
|
||||
using crecheng.DSPModSave;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UXAssist.Common;
|
||||
using UXAssist.Functions;
|
||||
using UXAssist.Patches;
|
||||
using UXAssist.UI;
|
||||
using Util = UXAssist.Common.Util;
|
||||
using GameLogicProc = UXAssist.Common.GameLogic;
|
||||
|
||||
namespace UXAssist;
|
||||
|
||||
@@ -22,17 +22,15 @@ namespace UXAssist;
|
||||
[BepInDependency(DSPModSavePlugin.MODGUID)]
|
||||
[CommonAPISubmoduleDependency(nameof(CustomKeyBindSystem))]
|
||||
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
||||
[BepInDependency(ModsCompat.PlanetVeinUtilization.PlanetVeinUtilizationGuid, BepInDependency.DependencyFlags.SoftDependency)]
|
||||
public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
{
|
||||
public new static readonly ManualLogSource Logger =
|
||||
BepInEx.Logging.Logger.CreateLogSource(PluginInfo.PLUGIN_NAME);
|
||||
|
||||
private static bool _configWinInitialized;
|
||||
private static MyConfigWindow _configWin;
|
||||
private static bool _initialized;
|
||||
private static PressKeyBind _toggleKey;
|
||||
private static ConfigFile _dummyConfig;
|
||||
private Type[] _patches, _compats;
|
||||
private readonly Harmony _harmony = new(PluginInfo.PLUGIN_GUID);
|
||||
|
||||
#region IModCanSave
|
||||
private const ushort ModSaveVersion = 1;
|
||||
@@ -55,29 +53,27 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
}
|
||||
#endregion
|
||||
|
||||
UXAssist()
|
||||
{
|
||||
ModsCompat.PlanetVeinUtilization.Run(_harmony);
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_dummyConfig = new ConfigFile(Path.Combine(Paths.ConfigPath, PluginInfo.PLUGIN_GUID + "_dummy.cfg"), false)
|
||||
{
|
||||
SaveOnConfigSet = false
|
||||
};
|
||||
_toggleKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
||||
{
|
||||
key = new CombineKey((int)KeyCode.BackQuote, CombineKey.ALT_COMB, ECombineKeyAction.OnceClick, false),
|
||||
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
|
||||
name = "OpenUXAssistConfigWindow",
|
||||
canOverride = true
|
||||
});
|
||||
GamePatch.EnableWindowResizeEnabled = Config.Bind("Game", "EnableWindowResize", false,
|
||||
"Enable game window resize (maximum box and thick frame)");
|
||||
GamePatch.LoadLastWindowRectEnabled = Config.Bind("Game", "LoadLastWindowRect", false,
|
||||
"Load last window position and size when game starts");
|
||||
GamePatch.LastWindowRect = Config.Bind("Game", "LastWindowRect", new Vector4(0f, 0f, 0f, 0f),
|
||||
"Last window position and size");
|
||||
GamePatch.MouseCursorScaleUpMultiplier = Config.Bind("Game", "MouseCursorScaleUpMultiplier", 1,
|
||||
"Mouse cursor scale up multiplier");
|
||||
GamePatch.ProfileBasedSaveFolderEnabled = Config.Bind("Game", "ProfileBasedSaveFolder", false,
|
||||
"Profile-based save folder");
|
||||
GamePatch.ProfileBasedOptionEnabled = Config.Bind("Game", "ProfileBasedOption", false,
|
||||
"Profile-based option");
|
||||
GamePatch.DefaultProfileName = Config.Bind("Game", "DefaultProfileName", "Default",
|
||||
"Default profile name, used when profile-based save folder is enabled. Use original game save folder if matched");
|
||||
/*
|
||||
@@ -90,12 +86,6 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
"Game UPS factor (1.0 for normal speed)");
|
||||
WindowFunctions.ProcessPriority = Config.Bind("Game", "ProcessPriority", 2,
|
||||
new ConfigDescription("Game process priority\n 0: High 1: Above Normal 2: Normal 3: Below Normal 4: Idle", new AcceptableValueRange<int>(0, 4)));
|
||||
WindowFunctions.ProcessAffinity = Config.Bind("Game", "CPUAffinity", -1,
|
||||
new ConfigDescription("""
|
||||
Game process CPU affinity
|
||||
0: All 1: First-half CPUs 2. First 8 CPUs (if total CPUs are greater than 16)
|
||||
3. All Performance Cores(If Intel 13th or greater) 4. All Efficiency Cores(If Intel 13th or greater)
|
||||
""", new AcceptableValueRange<int>(0, 4)));
|
||||
|
||||
FactoryPatch.UnlimitInteractiveEnabled = Config.Bind("Factory", "UnlimitInteractive", false,
|
||||
"Unlimit interactive range");
|
||||
@@ -134,6 +124,49 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
FactoryPatch.TankFastFillInAndTakeOutEnabled = Config.Bind("Factory", "TankFastFillInAndTakeOut", false,
|
||||
"Fast fill in to and take out from tanks");
|
||||
FactoryPatch.TankFastFillInAndTakeOutMultiplier = Config.Bind("Factory", "TankFastFillInAndTakeOutMultiplier", 1000, "Speed multiplier for fast filling in to and takeing out from tanks");
|
||||
FactoryPatch.CutConveyorBeltEnabled = Config.Bind("Factory", "CutConveyorBeltShortcut", false,
|
||||
"Cut conveyor belt (with shortcut key)");
|
||||
FactoryPatch.TweakBuildingBufferEnabled = Config.Bind("Factory", "TweakBuildingBuffer", false,
|
||||
"Tweak buffer count for assemblers and power generators");
|
||||
FactoryPatch.AssemblerBufferTimeMultiplier = Config.Bind("Factory", "AssemblerBufferTimeMultiplier", 4, new ConfigDescription("Assembler buffer time multiplier in seconds", new AcceptableValueRange<int>(2, 10)));
|
||||
FactoryPatch.AssemblerBufferMininumMultiplier = Config.Bind("Factory", "AssemblerBufferMininumMultiplier", 4, new ConfigDescription("Assembler buffer minimum multiplier", new AcceptableValueRange<int>(2, 10)));
|
||||
FactoryPatch.LabBufferMaxCountForAssemble = Config.Bind("Factory", "LabBufferMaxCountForAssemble", 6, new ConfigDescription("Buffer count for assembling in labs", new AcceptableValueRange<int>(2, 20)));
|
||||
FactoryPatch.LabBufferExtraCountForAdvancedAssemble = Config.Bind("Factory", "LabBufferExtraCountForAdvancedAssemble", 3, new ConfigDescription("Extra buffer count for Self-evolution Labs", new AcceptableValueRange<int>(1, 10)));
|
||||
FactoryPatch.LabBufferMaxCountForResearch = Config.Bind("Factory", "LabBufferMaxCountForResearch", 10, new ConfigDescription("Buffer count for researching in labs", new AcceptableValueRange<int>(2, 20)));
|
||||
FactoryPatch.ReceiverBufferCount = Config.Bind("Factory", "ReceiverBufferCount", 1, new ConfigDescription("Ray Receiver Graviton Lens buffer count", new AcceptableValueRange<int>(1, 20)));
|
||||
FactoryPatch.EjectorBufferCount = Config.Bind("Factory", "EjectorBufferCount", 1, new ConfigDescription("Ejector buffer count", new AcceptableValueRange<int>(5, 400)));
|
||||
FactoryPatch.SiloBufferCount = Config.Bind("Factory", "SiloBufferCount", 1, new ConfigDescription("Silo buffer count", new AcceptableValueRange<int>(1, 40)));
|
||||
FactoryPatch.ShortcutKeysForBlueprintCopyEnabled = Config.Bind("Factory", "DismantleBlueprintSelection", false,
|
||||
"Dismantle blueprint selected buildings");
|
||||
LogisticsPatch.AutoConfigLogisticsEnabled = Config.Bind("Factory", "AutoConfigLogistics", false,
|
||||
"Auto-config logistic stations");
|
||||
LogisticsPatch.AutoConfigLimitAutoReplenishCount = Config.Bind("Factory", "AutoConfigLimitAutoReplenishCount", false,
|
||||
"Limit auto-replenish count to config values");
|
||||
LogisticsPatch.SetDefaultRemoteLogicToStorage = Config.Bind("Factory", "AutoConfigSetDefaultRemoteLogicToStorage", false,
|
||||
"Set default remote logic to storage");
|
||||
LogisticsPatch.AutoConfigDispenserChargePower = Config.Bind("Factory", "AutoConfigDispenserChargePower", 30, new ConfigDescription("LD: Max. Charging Power", new AcceptableValueRange<int>(3, 30)));
|
||||
LogisticsPatch.AutoConfigDispenserCourierCount = Config.Bind("Factory", "AutoConfigDispenserCourierCount", 10, new ConfigDescription("LD: Count of Bots filled", new AcceptableValueRange<int>(0, 10)));
|
||||
LogisticsPatch.AutoConfigBattleBaseChargePower = Config.Bind("Factory", "AutoConfigBattleBaseChargePower", 8, new ConfigDescription("Battlefield Analysis Base: Max. Charging Power", new AcceptableValueRange<int>(4, 40)));
|
||||
LogisticsPatch.AutoConfigPLSChargePower = Config.Bind("Factory", "AutoConfigPLSChargePower", 4, new ConfigDescription("PLS: Max. Charging Power", new AcceptableValueRange<int>(2, 20)));
|
||||
LogisticsPatch.AutoConfigPLSMaxTripDrone = Config.Bind("Factory", "AutoConfigPLSMaxTripDrone", 180, new ConfigDescription("PLS: Drone transport range", new AcceptableValueRange<int>(1, 180)));
|
||||
LogisticsPatch.AutoConfigPLSDroneMinDeliver = Config.Bind("Factory", "AutoConfigPLSDroneMinDeliver", 10, new ConfigDescription("PLS: Min. Load of Drones", new AcceptableValueRange<int>(0, 10)));
|
||||
LogisticsPatch.AutoConfigPLSMinPilerValue = Config.Bind("Factory", "AutoConfigPLSMinPilerValue", 0, new ConfigDescription("PLS: Outgoing integration count", new AcceptableValueRange<int>(0, 4)));
|
||||
LogisticsPatch.AutoConfigPLSDroneCount = Config.Bind("Factory", "AutoConfigPLSDroneCount", 10, new ConfigDescription("PLS: Count of Drones filled", new AcceptableValueRange<int>(0, 50)));
|
||||
LogisticsPatch.AutoConfigILSChargePower = Config.Bind("Factory", "AutoConfigILSChargePower", 4, new ConfigDescription("ILS: Max. Charging Power", new AcceptableValueRange<int>(2, 20)));
|
||||
LogisticsPatch.AutoConfigILSMaxTripDrone = Config.Bind("Factory", "AutoConfigILSMaxTripDrone", 180, new ConfigDescription("ILS: Drone transport range", new AcceptableValueRange<int>(1, 180)));
|
||||
LogisticsPatch.AutoConfigILSMaxTripShip = Config.Bind("Factory", "AutoConfigILSMaxTripShip", 41, new ConfigDescription("ILS: Vessel transport range", new AcceptableValueRange<int>(1, 41)));
|
||||
LogisticsPatch.AutoConfigILSWarperDistance = Config.Bind("Factory", "AutoConfigILSWarperDistance", 16, new ConfigDescription("ILS: Warp distance", new AcceptableValueRange<int>(2, 21)));
|
||||
LogisticsPatch.AutoConfigILSDroneMinDeliver = Config.Bind("Factory", "AutoConfigILSDroneMinDeliver", 10, new ConfigDescription("ILS: Min. Load of Drones", new AcceptableValueRange<int>(0, 10)));
|
||||
LogisticsPatch.AutoConfigILSShipMinDeliver = Config.Bind("Factory", "AutoConfigILSShipMinDeliver", 10, new ConfigDescription("ILS: Min. Load of Vessels", new AcceptableValueRange<int>(0, 10)));
|
||||
LogisticsPatch.AutoConfigILSMinPilerValue = Config.Bind("Factory", "AutoConfigILSMinPilerValue", 0, new ConfigDescription("ILS: Outgoing integration count", new AcceptableValueRange<int>(0, 4)));
|
||||
LogisticsPatch.AutoConfigILSIncludeOrbitCollector = Config.Bind("Factory", "AutoConfigILSIncludeOrbitCollector", true,
|
||||
"ILS: Include Orbital Collector");
|
||||
LogisticsPatch.AutoConfigILSWarperNecessary = Config.Bind("Factory", "AutoConfigILSWarperNecessary", true,
|
||||
"ILS: Warpers required");
|
||||
LogisticsPatch.AutoConfigILSDroneCount = Config.Bind("Factory", "AutoConfigILSDroneCount", 20, new ConfigDescription("ILS: Count of Drones filled", new AcceptableValueRange<int>(0, 100)));
|
||||
LogisticsPatch.AutoConfigILSShipCount = Config.Bind("Factory", "AutoConfigILSShipCount", 10, new ConfigDescription("ILS: Count of Vessels filled", new AcceptableValueRange<int>(0, 10)));
|
||||
LogisticsPatch.AutoConfigVeinCollectorHarvestSpeed = Config.Bind("Factory", "AutoConfigVeinCollectorHarvestSpeed", 20, new ConfigDescription("AMM: Collecting Speed", new AcceptableValueRange<int>(0, 20)));
|
||||
LogisticsPatch.AutoConfigVeinCollectorMinPilerValue = Config.Bind("Factory", "AutoConfigVeinCollectorMinPilerValue", 0, new ConfigDescription("AMM: Outgoing integration count", new AcceptableValueRange<int>(0, 4)));
|
||||
LogisticsPatch.LogisticsCapacityTweaksEnabled = Config.Bind("Factory", "LogisticsCapacityTweaks", true,
|
||||
"Logistics capacity related tweaks");
|
||||
LogisticsPatch.AllowOverflowInLogisticsEnabled = Config.Bind("Factory", "AllowOverflowInLogistics", false,
|
||||
@@ -149,6 +182,8 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
"Enhanced count control for hand-make, increases maximum of count to 1000, and you can hold Ctrl/Shift/Alt to change the count rapidly");
|
||||
PlayerPatch.HideTipsForSandsChangesEnabled = Config.Bind("Player", "HideTipsForGettingSands", false,
|
||||
"Hide tips for getting soil piles");
|
||||
PlayerPatch.ShortcutKeysForStarsNameEnabled = Config.Bind("Player", "ShortcutKeysForStarsName", false,
|
||||
"Shortcut keys for showing stars' name");
|
||||
PlayerPatch.AutoNavigationEnabled = Config.Bind("Player", "AutoNavigation", false,
|
||||
"Auto navigation");
|
||||
PlayerPatch.AutoCruiseEnabled = Config.Bind("Player", "AutoCruise", false,
|
||||
@@ -158,6 +193,8 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
PlayerPatch.DistanceToWarp = Config.Bind("Player", "DistanceToWarp", 5.0, "Distance to warp (in AU)");
|
||||
TechPatch.SorterCargoStackingEnabled = Config.Bind("Tech", "SorterCargoStacking", false,
|
||||
"Restore upgrades of `Sorter Cargo Stacking` on panel");
|
||||
TechPatch.DisableBattleRelatedTechsInPeaceModeEnabled = Config.Bind("Tech", "DisableBattleRelatedTechsInPeaceMode", false,
|
||||
"Disable battle-related techs in Peace mode");
|
||||
TechPatch.BatchBuyoutTechEnabled = Config.Bind("Tech", "BatchBuyoutTech", false,
|
||||
"Can buy out techs with their prerequisites");
|
||||
DysonSpherePatch.StopEjectOnNodeCompleteEnabled = Config.Bind("DysonSphere", "StopEjectOnNodeComplete", false,
|
||||
@@ -165,15 +202,15 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
DysonSpherePatch.OnlyConstructNodesEnabled = Config.Bind("DysonSphere", "OnlyConstructNodes", false,
|
||||
"Construct only nodes but frames");
|
||||
DysonSpherePatch.AutoConstructMultiplier = Config.Bind("DysonSphere", "AutoConstructMultiplier", 1, "Dyson Sphere auto-construct speed multiplier");
|
||||
|
||||
UIPatch.PlanetVeinUtilizationEnabled = Config.Bind("UI", "PlanetVeinUtilization", false,
|
||||
"Planet vein utilization");
|
||||
|
||||
I18N.Init();
|
||||
I18N.Add("UXAssist Config", "UXAssist Config", "UX助手设置");
|
||||
I18N.Add("KEYOpenUXAssistConfigWindow", "Open UXAssist Config Window", "打开UX助手设置面板");
|
||||
I18N.Add("KEYToggleAutoCruise", "Toggle auto-cruise", "切换自动巡航");
|
||||
|
||||
// UI Patches
|
||||
GameLogic.Enable(true);
|
||||
|
||||
GameLogicProc.Enable(true);
|
||||
|
||||
UIConfigWindow.Init();
|
||||
|
||||
_patches = Util.GetTypesFiltered(Assembly.GetExecutingAssembly(),
|
||||
@@ -183,18 +220,16 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
_compats?.Do(type => type.GetMethod("Init")?.Invoke(null, null));
|
||||
|
||||
I18N.Apply();
|
||||
I18N.OnInitialized += RecreateConfigWindow;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
MyWindowManager.InitBaseObjects();
|
||||
MyWindowManager.Enable(true);
|
||||
UIPatch.Enable(true);
|
||||
|
||||
_patches?.Do(type => type.GetMethod("Start")?.Invoke(null, null));
|
||||
|
||||
object[] parameters = [UIPatch.GetHarmony()];
|
||||
object[] parameters = [_harmony];
|
||||
_compats?.Do(type => type.GetMethod("Start")?.Invoke(null, parameters));
|
||||
}
|
||||
|
||||
@@ -202,149 +237,24 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
||||
{
|
||||
_patches?.Do(type => type.GetMethod("Uninit")?.Invoke(null, null));
|
||||
|
||||
UIPatch.Enable(false);
|
||||
MyWindowManager.Enable(false);
|
||||
GameLogic.Enable(false);
|
||||
GameLogicProc.Enable(false);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (VFInput.inputing) return;
|
||||
if (VFInput.onGUI)
|
||||
if (DSPGame.IsMenuDemo)
|
||||
{
|
||||
LogisticsPatch.LogisticsCapacityTweaks.UpdateInput();
|
||||
UIFunctions.OnInputUpdate();
|
||||
return;
|
||||
}
|
||||
if (_toggleKey.keyValue)
|
||||
{
|
||||
ToggleConfigWindow();
|
||||
}
|
||||
GamePatch.OnUpdate();
|
||||
FactoryPatch.OnUpdate();
|
||||
PlayerPatch.OnUpdate();
|
||||
LogisticsPatch.OnInputUpdate();
|
||||
UIFunctions.OnInputUpdate();
|
||||
GamePatch.OnInputUpdate();
|
||||
FactoryPatch.OnInputUpdate();
|
||||
PlayerPatch.OnInputUpdate();
|
||||
|
||||
LogisticsPatch.OnUpdate();
|
||||
}
|
||||
|
||||
private static void ToggleConfigWindow()
|
||||
{
|
||||
if (!_configWinInitialized)
|
||||
{
|
||||
if (!I18N.Initialized()) return;
|
||||
_configWinInitialized = true;
|
||||
_configWin = MyConfigWindow.CreateInstance();
|
||||
}
|
||||
|
||||
if (_configWin.active)
|
||||
{
|
||||
_configWin._Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
_configWin.Open();
|
||||
}
|
||||
}
|
||||
|
||||
private static void RecreateConfigWindow()
|
||||
{
|
||||
if (!_configWinInitialized) return;
|
||||
var wasActive = _configWin.active;
|
||||
if (wasActive) _configWin._Close();
|
||||
MyConfigWindow.DestroyInstance(_configWin);
|
||||
_configWinInitialized = false;
|
||||
if (wasActive) ToggleConfigWindow();
|
||||
}
|
||||
|
||||
[PatchGuid(PluginInfo.PLUGIN_GUID)]
|
||||
private class UIPatch: PatchImpl<UIPatch>
|
||||
{
|
||||
private static GameObject _buttonOnPlanetGlobe;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
InitMenuButtons();
|
||||
}
|
||||
|
||||
private static void InitMenuButtons()
|
||||
{
|
||||
if (_initialized) return;
|
||||
var uiRoot = UIRoot.instance;
|
||||
if (!uiRoot) return;
|
||||
{
|
||||
var mainMenu = uiRoot.uiMainMenu;
|
||||
var src = mainMenu.newGameButton;
|
||||
var parent = src.transform.parent;
|
||||
var btn = Instantiate(src, parent);
|
||||
btn.name = "button-uxassist-config";
|
||||
var l = btn.text.GetComponent<Localizer>();
|
||||
if (l != null)
|
||||
{
|
||||
l.stringKey = "UXAssist Config";
|
||||
l.translation = "UXAssist Config".Translate();
|
||||
}
|
||||
|
||||
btn.text.text = "UXAssist Config".Translate();
|
||||
btn.text.fontSize = btn.text.fontSize * 7 / 8;
|
||||
I18N.OnInitialized += () => { btn.text.text = "UXAssist Config".Translate(); };
|
||||
var vec = ((RectTransform)mainMenu.exitButton.transform).anchoredPosition3D;
|
||||
var vec2 = ((RectTransform)mainMenu.creditsButton.transform).anchoredPosition3D;
|
||||
var transform1 = (RectTransform)btn.transform;
|
||||
transform1.anchoredPosition3D = new Vector3(vec.x, vec.y + (vec.y - vec2.y) * 2, vec.z);
|
||||
btn.button.onClick.RemoveAllListeners();
|
||||
btn.button.onClick.AddListener(ToggleConfigWindow);
|
||||
}
|
||||
{
|
||||
var panel = uiRoot.uiGame.planetGlobe;
|
||||
var src = panel.button2;
|
||||
var sandboxMenu = uiRoot.uiGame.sandboxMenu;
|
||||
var icon = sandboxMenu.categoryButtons[6].transform.Find("icon")?.GetComponent<Image>()?.sprite;
|
||||
var b = Instantiate(src, src.transform.parent);
|
||||
_buttonOnPlanetGlobe = b.gameObject;
|
||||
var rect = (RectTransform)_buttonOnPlanetGlobe.transform;
|
||||
var btn = _buttonOnPlanetGlobe.GetComponent<UIButton>();
|
||||
var img = _buttonOnPlanetGlobe.transform.Find("button-2/icon")?.GetComponent<Image>();
|
||||
if (img != null)
|
||||
{
|
||||
img.sprite = icon;
|
||||
}
|
||||
|
||||
if (_buttonOnPlanetGlobe != null && btn != null)
|
||||
{
|
||||
_buttonOnPlanetGlobe.name = "open-uxassist-config";
|
||||
rect.localScale = new Vector3(0.6f, 0.6f, 0.6f);
|
||||
rect.anchoredPosition3D = new Vector3(64f, -5f, 0f);
|
||||
b.onClick.RemoveAllListeners();
|
||||
btn.onClick += _ => { ToggleConfigWindow(); };
|
||||
btn.tips.tipTitle = "UXAssist Config";
|
||||
I18N.OnInitialized += () => { btn.tips.tipTitle = "UXAssist Config".Translate(); };
|
||||
btn.tips.tipText = null;
|
||||
btn.tips.corner = 9;
|
||||
btn.tips.offset = new Vector2(-20f, -20f);
|
||||
_buttonOnPlanetGlobe.SetActive(true);
|
||||
}
|
||||
}
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
// Add config button to main menu
|
||||
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot._OnOpen))]
|
||||
public static void UIRoot__OnOpen_Postfix()
|
||||
{
|
||||
InitMenuButtons();
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(UIPlanetGlobe), nameof(UIPlanetGlobe.DistributeButtons))]
|
||||
private static void UIPlanetGlobe_DistributeButtons_Postfix(UIPlanetGlobe __instance)
|
||||
{
|
||||
if (_buttonOnPlanetGlobe == null) return;
|
||||
var rect = (RectTransform)_buttonOnPlanetGlobe.transform;
|
||||
if (__instance.dysonSphereSystemUnlocked || __instance.logisticsSystemUnlocked)
|
||||
{
|
||||
rect.anchoredPosition3D = new Vector3(64f, -5f, 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
rect.anchoredPosition3D = new Vector3(128f, -100f, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
|
||||
<Description>DSP MOD - UXAssist</Description>
|
||||
<Version>1.2.12</Version>
|
||||
<Version>1.4.3</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackageId>UXAssist</PackageId>
|
||||
@@ -15,11 +15,21 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.Core" Version="5.*" />
|
||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
|
||||
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="*-r.*" />
|
||||
<PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
|
||||
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
|
||||
<PackageReference Include="DysonSphereProgram.Modding.CommonAPI" Version="1.6.5" />
|
||||
<PackageReference Include="DysonSphereProgram.Modding.DSPModSave" Version="1.*" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>..\AssemblyFromGame\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UI">
|
||||
<HintPath>..\AssemblyFromGame\UnityEngine.UI.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="assets/signal/energy-fragment.png" />
|
||||
<EmbeddedResource Include="assets/signal/memory.png" />
|
||||
@@ -30,13 +40,28 @@
|
||||
<EmbeddedResource Include="assets/icon/in.png" />
|
||||
<EmbeddedResource Include="assets/icon/out.png" />
|
||||
<EmbeddedResource Include="assets/icon/keep.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/07.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/09.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/10.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/13.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/14.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/15.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/16.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/17.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/19.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/20.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/21.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/22.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/23.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/24.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/25.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'">
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="del /F /Q package\$(ProjectName)-$(Version).zip
powershell Compress-Archive -Force -DestinationPath 'package/$(ProjectName)-$(Version).zip' -Path "$(TargetPath)", package/icon.png, package/manifest.json, README.md, CHANGELOG.md" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
||||
BIN
UXAssist/assets/planet_icon/07.png
Normal file
BIN
UXAssist/assets/planet_icon/07.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
UXAssist/assets/planet_icon/09.png
Normal file
BIN
UXAssist/assets/planet_icon/09.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
BIN
UXAssist/assets/planet_icon/10.png
Normal file
BIN
UXAssist/assets/planet_icon/10.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
UXAssist/assets/planet_icon/13.png
Normal file
BIN
UXAssist/assets/planet_icon/13.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user