mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-09 18:13:31 +08:00
UXAssist v1.0.14 & bugfix
This commit is contained in:
@@ -547,7 +547,17 @@ public static class FactoryPatch
|
|||||||
_patch = null;
|
_patch = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CalculateGridOffset(PlanetData planet, Vector3 pos, out float x, out float y)
|
private static bool _initialized;
|
||||||
|
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), "_OnOpen")]
|
||||||
|
public static void UIRoot__OnOpen_Postfix()
|
||||||
|
{
|
||||||
|
if (_initialized) return;
|
||||||
|
UIGeneralTips.instance.buildCursorTextComp.supportRichText = true;
|
||||||
|
UIGeneralTips.instance.entityBriefInfo.entityNameText.supportRichText = true;
|
||||||
|
_initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CalculateGridOffset(PlanetData planet, Vector3 pos, out float x, out float y, out float z)
|
||||||
{
|
{
|
||||||
var npos = pos.normalized;
|
var npos = pos.normalized;
|
||||||
var segment = planet.aux.activeGrid?.segment ?? 200;
|
var segment = planet.aux.activeGrid?.segment ?? 200;
|
||||||
@@ -558,8 +568,19 @@ public static class FactoryPatch
|
|||||||
var longitudeRad = BlueprintUtils.GetLongitudeRad(npos);
|
var longitudeRad = BlueprintUtils.GetLongitudeRad(npos);
|
||||||
x = longitudeRad / longitudeRadPerGrid;
|
x = longitudeRad / longitudeRadPerGrid;
|
||||||
y = latitudeRad / latitudeRadPerGrid;
|
y = latitudeRad / latitudeRadPerGrid;
|
||||||
|
z = (pos.magnitude - planet.realRadius - 0.2f) / 1.3333333f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string FixedPoint(float f)
|
||||||
|
{
|
||||||
|
var s = Mathf.RoundToInt(f * 10000);
|
||||||
|
return $"{s / 10000}.{Math.Abs(s % 10000)}".TrimEnd('0').TrimEnd('.');
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PlanetData _lastPlanet;
|
||||||
|
private static Vector3 _lastPos;
|
||||||
|
private static string _lastOffsetText;
|
||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPriority(Priority.Last), HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.CheckBuildConditions))]
|
[HarmonyPriority(Priority.Last), HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.CheckBuildConditions))]
|
||||||
private static void BuildTool_Click_CheckBuildConditions_Postfix(BuildTool_Click __instance)
|
private static void BuildTool_Click_CheckBuildConditions_Postfix(BuildTool_Click __instance)
|
||||||
@@ -567,8 +588,15 @@ public static class FactoryPatch
|
|||||||
if (__instance.buildPreviews.Count != 1) return;
|
if (__instance.buildPreviews.Count != 1) return;
|
||||||
var preview = __instance.buildPreviews[0];
|
var preview = __instance.buildPreviews[0];
|
||||||
if (preview.desc.isInserter) return;
|
if (preview.desc.isInserter) return;
|
||||||
CalculateGridOffset(__instance.planet, preview.lpos, out var x, out var y);
|
var planet = __instance.planet;
|
||||||
__instance.actionBuild.model.cursorText = $"({x},{y})\n" + __instance.actionBuild.model.cursorText;
|
if (_lastPlanet != planet || _lastPos != preview.lpos)
|
||||||
|
{
|
||||||
|
CalculateGridOffset(__instance.planet, preview.lpos, out var x, out var y, out var z);
|
||||||
|
_lastPlanet = planet;
|
||||||
|
_lastPos = preview.lpos;
|
||||||
|
_lastOffsetText = $"<color=#ffbfbfff>{FixedPoint(x)}</color>,<color=#bfffbfff>{FixedPoint(y)}</color>,<color=#bfbfffff>{FixedPoint(z)}</color>";
|
||||||
|
}
|
||||||
|
__instance.actionBuild.model.cursorText = $"({_lastOffsetText})\n" + __instance.actionBuild.model.cursorText;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyTranspiler]
|
[HarmonyTranspiler]
|
||||||
@@ -587,8 +615,15 @@ public static class FactoryPatch
|
|||||||
{
|
{
|
||||||
var entity = entityBriefInfo.factory.entityPool[entityBriefInfo.entityId];
|
var entity = entityBriefInfo.factory.entityPool[entityBriefInfo.entityId];
|
||||||
if (entity.inserterId > 0) return;
|
if (entity.inserterId > 0) return;
|
||||||
CalculateGridOffset(entityBriefInfo.factory.planet, entity.pos, out var x, out var y);
|
var planet = entityBriefInfo.factory.planet;
|
||||||
entityBriefInfo.entityNameText.text += $" ({x},{y})";
|
if (_lastPlanet != planet || _lastPos != entity.pos)
|
||||||
|
{
|
||||||
|
CalculateGridOffset(planet, entity.pos, out var x, out var y, out var z);
|
||||||
|
_lastPlanet = planet;
|
||||||
|
_lastPos = entity.pos;
|
||||||
|
_lastOffsetText = $"<color=#ffbfbfff>{FixedPoint(x)}</color>,<color=#bfffbfff>{FixedPoint(y)}</color>,<color=#bfbfffff>{FixedPoint(z)}</color>";
|
||||||
|
}
|
||||||
|
entityBriefInfo.entityNameText.text += $" ({_lastOffsetText})";
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -51,6 +51,13 @@ public static class PlanetFunctions
|
|||||||
var planet = GameMain.localPlanet;
|
var planet = GameMain.localPlanet;
|
||||||
var factory = planet?.factory;
|
var factory = planet?.factory;
|
||||||
if (factory == null) return;
|
if (factory == null) return;
|
||||||
|
var uiGame = UIRoot.instance.uiGame;
|
||||||
|
if (uiGame)
|
||||||
|
{
|
||||||
|
uiGame.ShutAllFunctionWindow();
|
||||||
|
uiGame.ShutAllFullScreens();
|
||||||
|
}
|
||||||
|
GameMain.data.mainPlayer?.controller.actionBuild.Close();
|
||||||
//planet.data = new PlanetRawData(planet.precision);
|
//planet.data = new PlanetRawData(planet.precision);
|
||||||
//planet.data.CalcVerts();
|
//planet.data.CalcVerts();
|
||||||
for (var id = factory.entityCursor - 1; id > 0; id--)
|
for (var id = factory.entityCursor - 1; id > 0; id--)
|
||||||
@@ -152,6 +159,8 @@ public static class PlanetFunctions
|
|||||||
factory.enemyRecycleCursor = 0;
|
factory.enemyRecycleCursor = 0;
|
||||||
factory.enemyCapacity = 0;
|
factory.enemyCapacity = 0;
|
||||||
factory.SetEnemyCapacity(isCombatMode ? 1024 : 32);
|
factory.SetEnemyCapacity(isCombatMode ? 1024 : 32);
|
||||||
|
factory.hashSystemDynamic = new HashSystem();
|
||||||
|
factory.hashSystemStatic = new HashSystem();
|
||||||
factory.cargoContainer = new CargoContainer();
|
factory.cargoContainer = new CargoContainer();
|
||||||
factory.cargoTraffic = new CargoTraffic(planet);
|
factory.cargoTraffic = new CargoTraffic(planet);
|
||||||
factory.blockContainer = new MiniBlockContainer();
|
factory.blockContainer = new MiniBlockContainer();
|
||||||
|
|||||||
@@ -4,8 +4,11 @@
|
|||||||
#### 一些提升用户体验的功能和补丁
|
#### 一些提升用户体验的功能和补丁
|
||||||
|
|
||||||
## Changlog
|
## Changlog
|
||||||
|
* 1.0.14
|
||||||
|
+ Fix crash in `Re-initialize planet` again
|
||||||
|
+ `Off-grid building and stepped rotation`: Add Z coordinate to display, and adjust the precision to 4 decimal after point
|
||||||
* 1.0.13
|
* 1.0.13
|
||||||
+ `Off-grid building and stepped rotation`: show building coorinates(relative to grids) on building preview and building info panel now
|
+ `Off-grid building and stepped rotation`: show building coordinates(relative to grids) on building preview and building info panel now
|
||||||
+ Increase maximum count of Metadata Instantiations to 20000 (from 2000)
|
+ Increase maximum count of Metadata Instantiations to 20000 (from 2000)
|
||||||
+ Increase capacity of player order queue to 128 (from 16)
|
+ Increase capacity of player order queue to 128 (from 16)
|
||||||
+ Fix issue caused by game updates
|
+ Fix issue caused by game updates
|
||||||
@@ -101,6 +104,9 @@
|
|||||||
* [OffGridConstruction](https://github.com/Velociraptor115-DSPModding/OffGridConstruction): Off-grid building & stepped rotation implementations
|
* [OffGridConstruction](https://github.com/Velociraptor115-DSPModding/OffGridConstruction): Off-grid building & stepped rotation implementations
|
||||||
|
|
||||||
## 更新日志
|
## 更新日志
|
||||||
|
* 1.0.14
|
||||||
|
+ 再次尝试修复`初始化本行星`导致的崩溃问题
|
||||||
|
+ `脱离网格建造和小角度旋转`:现在显示建筑Z坐标,并将精度调整为小数点后4位
|
||||||
* 1.0.13
|
* 1.0.13
|
||||||
+ `脱离网格建造和小角度旋转`:现在在建造预览和建筑信息面板上显示建筑坐标(相对于网格)
|
+ `脱离网格建造和小角度旋转`:现在在建造预览和建筑信息面板上显示建筑坐标(相对于网格)
|
||||||
+ 将元数据提取的最大数量增加到20000(原来为2000)
|
+ 将元数据提取的最大数量增加到20000(原来为2000)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>net472</TargetFramework>
|
<TargetFramework>net472</TargetFramework>
|
||||||
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
|
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
|
||||||
<Description>DSP MOD - UXAssist</Description>
|
<Description>DSP MOD - UXAssist</Description>
|
||||||
<Version>1.0.13</Version>
|
<Version>1.0.14</Version>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<PackageId>UXAssist</PackageId>
|
<PackageId>UXAssist</PackageId>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "UXAssist",
|
"name": "UXAssist",
|
||||||
"version_number": "1.0.13",
|
"version_number": "1.0.14",
|
||||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
|
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
|
||||||
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
|
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
|||||||
Reference in New Issue
Block a user