mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-08 20:13:29 +08:00
UniverseGenTweaks v1.2.11
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
* 1.2.11
|
||||||
|
* Fix issues which cause universe settings not applied on staring a new game (again again).
|
||||||
* 1.2.10
|
* 1.2.10
|
||||||
* Fix issues which cause universe settings not applied on staring a new game or loading game (again).
|
* Fix issues which cause universe settings not applied on staring a new game or loading game (again).
|
||||||
* Reset star distance/flatten settings on entering galaxy creation screen.
|
* Reset star distance/flatten settings on entering galaxy creation screen.
|
||||||
@@ -46,6 +48,8 @@
|
|||||||
|
|
||||||
## 更新日志
|
## 更新日志
|
||||||
|
|
||||||
|
* 1.2.11
|
||||||
|
* (再次再次)修复新建游戏时宇宙设置没有应用的问题
|
||||||
* 1.2.10
|
* 1.2.10
|
||||||
* (再次)修复新建游戏或加载存档时宇宙设置没有应用的问题
|
* (再次)修复新建游戏或加载存档时宇宙设置没有应用的问题
|
||||||
* 进入宇宙创建界面时重置星系间距/扁平度设置
|
* 进入宇宙创建界面时重置星系间距/扁平度设置
|
||||||
|
|||||||
@@ -99,17 +99,14 @@ public class MoreSettings
|
|||||||
_minDistSlider.maxValue = 50f;
|
_minDistSlider.maxValue = 50f;
|
||||||
_minDistSlider.value = (float)(_minDist * 10.0);
|
_minDistSlider.value = (float)(_minDist * 10.0);
|
||||||
|
|
||||||
_minStepTitle.name = "min-step";
|
|
||||||
_minStepSlider.minValue = (float)(_minDist * 10.0);
|
_minStepSlider.minValue = (float)(_minDist * 10.0);
|
||||||
_minStepSlider.maxValue = (float)(_maxStep * 10.0);
|
_minStepSlider.maxValue = (float)(_maxStep * 10.0);
|
||||||
_minStepSlider.value = (float)(_minStep * 10.0);
|
_minStepSlider.value = (float)(_minStep * 10.0);
|
||||||
|
|
||||||
_maxStepTitle.name = "max-step";
|
|
||||||
_maxStepSlider.minValue = (float)(_minStep * 10.0);
|
_maxStepSlider.minValue = (float)(_minStep * 10.0);
|
||||||
_maxStepSlider.maxValue = 100f;
|
_maxStepSlider.maxValue = 100f;
|
||||||
_maxStepSlider.value = (float)(_maxStep * 10.0);
|
_maxStepSlider.value = (float)(_maxStep * 10.0);
|
||||||
|
|
||||||
_flattenTitle.name = "flatten";
|
|
||||||
_flattenSlider.minValue = 1f;
|
_flattenSlider.minValue = 1f;
|
||||||
_flattenSlider.maxValue = 50f;
|
_flattenSlider.maxValue = 50f;
|
||||||
_flattenSlider.value = (float)(_flatten * 50.0);
|
_flattenSlider.value = (float)(_flatten * 50.0);
|
||||||
@@ -118,6 +115,8 @@ public class MoreSettings
|
|||||||
_minStepText.text = _minStep.ToString();
|
_minStepText.text = _minStep.ToString();
|
||||||
_maxStepText.text = _maxStep.ToString();
|
_maxStepText.text = _maxStep.ToString();
|
||||||
_flattenText.text = _flatten.ToString();
|
_flattenText.text = _flatten.ToString();
|
||||||
|
|
||||||
|
UniverseGenTweaks.Logger.LogDebug($"Updated slider controls: {_minStepSlider.minValue}, {_minStepSlider.maxValue}, {_maxStepSlider.minValue}, {_maxStepSlider.maxValue}");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
@@ -136,24 +135,9 @@ public class MoreSettings
|
|||||||
flattenLocalizer.stringKey = "扁平度";
|
flattenLocalizer.stringKey = "扁平度";
|
||||||
|
|
||||||
_minDistTitle.name = "min-dist";
|
_minDistTitle.name = "min-dist";
|
||||||
_minDistSlider.minValue = 10f;
|
|
||||||
_minDistSlider.maxValue = 50f;
|
|
||||||
_minDistSlider.value = (float)(_minDist * 10.0);
|
|
||||||
|
|
||||||
_minStepTitle.name = "min-step";
|
_minStepTitle.name = "min-step";
|
||||||
_minStepSlider.minValue = (float)(_minDist * 10.0);
|
|
||||||
_minStepSlider.maxValue = (float)(_maxStep * 10.0);
|
|
||||||
_minStepSlider.value = (float)(_minStep * 10.0);
|
|
||||||
|
|
||||||
_maxStepTitle.name = "max-step";
|
_maxStepTitle.name = "max-step";
|
||||||
_maxStepSlider.minValue = (float)(_minStep * 10.0);
|
|
||||||
_maxStepSlider.maxValue = 100f;
|
|
||||||
_maxStepSlider.value = (float)(_maxStep * 10.0);
|
|
||||||
|
|
||||||
_flattenTitle.name = "flatten";
|
_flattenTitle.name = "flatten";
|
||||||
_flattenSlider.minValue = 1f;
|
|
||||||
_flattenSlider.maxValue = 50f;
|
|
||||||
_flattenSlider.value = (float)(_flatten * 50.0);
|
|
||||||
|
|
||||||
TransformDeltaY(_minDistTitle.transform, -36f);
|
TransformDeltaY(_minDistTitle.transform, -36f);
|
||||||
TransformDeltaY(_minStepTitle.transform, -36f * 2);
|
TransformDeltaY(_minStepTitle.transform, -36f * 2);
|
||||||
@@ -164,25 +148,36 @@ public class MoreSettings
|
|||||||
TransformDeltaY(__instance.sandboxToggle.transform.parent, -36f * 4);
|
TransformDeltaY(__instance.sandboxToggle.transform.parent, -36f * 4);
|
||||||
TransformDeltaY(__instance.propertyMultiplierText.transform, -36f * 4);
|
TransformDeltaY(__instance.propertyMultiplierText.transform, -36f * 4);
|
||||||
TransformDeltaY(__instance.addrText.transform.parent, -36f * 4);
|
TransformDeltaY(__instance.addrText.transform.parent, -36f * 4);
|
||||||
|
|
||||||
|
RemoveAllListeners();
|
||||||
|
UpdateSliderControls();
|
||||||
|
AddListeners(__instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect._OnOpen))]
|
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect._OnOpen))]
|
||||||
private static void UIGalaxySelect__OnOpen_Prefix()
|
private static void UIGalaxySelect__OnOpen_Prefix(UIGalaxySelect __instance)
|
||||||
{
|
{
|
||||||
_minDist = DEFAULT_MIN_DIST;
|
_minDist = DEFAULT_MIN_DIST;
|
||||||
_minStep = DEFAULT_MIN_STEP;
|
_minStep = DEFAULT_MIN_STEP;
|
||||||
_maxStep = DEFAULT_MAX_STEP;
|
_maxStep = DEFAULT_MAX_STEP;
|
||||||
_flatten = DEFAULT_FLATTEN;
|
_flatten = DEFAULT_FLATTEN;
|
||||||
|
|
||||||
|
RemoveAllListeners();
|
||||||
UpdateSliderControls();
|
UpdateSliderControls();
|
||||||
|
AddListeners(__instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPostfix]
|
private static void RemoveAllListeners()
|
||||||
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect._OnRegEvent))]
|
|
||||||
private static void UIGalaxySelect__OnRegEvent_Postfix(UIGalaxySelect __instance)
|
|
||||||
{
|
{
|
||||||
_minDistSlider.onValueChanged.RemoveAllListeners();
|
_minDistSlider.onValueChanged.RemoveAllListeners();
|
||||||
|
_minStepSlider.onValueChanged.RemoveAllListeners();
|
||||||
|
_maxStepSlider.onValueChanged.RemoveAllListeners();
|
||||||
|
_flattenSlider.onValueChanged.RemoveAllListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void AddListeners(UIGalaxySelect uiGalaxySelect)
|
||||||
|
{
|
||||||
_minDistSlider.onValueChanged.AddListener(val =>
|
_minDistSlider.onValueChanged.AddListener(val =>
|
||||||
{
|
{
|
||||||
var newVal = Mathf.Round(val) / 10.0;
|
var newVal = Mathf.Round(val) / 10.0;
|
||||||
@@ -202,9 +197,8 @@ public class MoreSettings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_minStepSlider.minValue = (float)(_minDist * 10.0);
|
_minStepSlider.minValue = (float)(_minDist * 10.0);
|
||||||
__instance.SetStarmapGalaxy();
|
uiGalaxySelect.SetStarmapGalaxy();
|
||||||
});
|
});
|
||||||
_minStepSlider.onValueChanged.RemoveAllListeners();
|
|
||||||
_minStepSlider.onValueChanged.AddListener(val =>
|
_minStepSlider.onValueChanged.AddListener(val =>
|
||||||
{
|
{
|
||||||
var newVal = Mathf.Round(val) / 10.0;
|
var newVal = Mathf.Round(val) / 10.0;
|
||||||
@@ -212,9 +206,8 @@ public class MoreSettings
|
|||||||
_minStep = newVal;
|
_minStep = newVal;
|
||||||
_maxStepSlider.minValue = (float)(newVal * 10.0);
|
_maxStepSlider.minValue = (float)(newVal * 10.0);
|
||||||
_minStepText.text = _minStep.ToString();
|
_minStepText.text = _minStep.ToString();
|
||||||
__instance.SetStarmapGalaxy();
|
uiGalaxySelect.SetStarmapGalaxy();
|
||||||
});
|
});
|
||||||
_maxStepSlider.onValueChanged.RemoveAllListeners();
|
|
||||||
_maxStepSlider.onValueChanged.AddListener(val =>
|
_maxStepSlider.onValueChanged.AddListener(val =>
|
||||||
{
|
{
|
||||||
var newVal = Mathf.Round(val) / 10.0;
|
var newVal = Mathf.Round(val) / 10.0;
|
||||||
@@ -222,16 +215,15 @@ public class MoreSettings
|
|||||||
_maxStep = newVal;
|
_maxStep = newVal;
|
||||||
_minStepSlider.maxValue = (float)(newVal * 10.0);
|
_minStepSlider.maxValue = (float)(newVal * 10.0);
|
||||||
_maxStepText.text = _maxStep.ToString();
|
_maxStepText.text = _maxStep.ToString();
|
||||||
__instance.SetStarmapGalaxy();
|
uiGalaxySelect.SetStarmapGalaxy();
|
||||||
});
|
});
|
||||||
_flattenSlider.onValueChanged.RemoveAllListeners();
|
|
||||||
_flattenSlider.onValueChanged.AddListener(val =>
|
_flattenSlider.onValueChanged.AddListener(val =>
|
||||||
{
|
{
|
||||||
var newVal = Mathf.Round(val) / 50.0;
|
var newVal = Mathf.Round(val) / 50.0;
|
||||||
if (newVal.Equals(_flatten)) return;
|
if (newVal.Equals(_flatten)) return;
|
||||||
_flatten = newVal;
|
_flatten = newVal;
|
||||||
_flattenText.text = _flatten.ToString();
|
_flattenText.text = _flatten.ToString();
|
||||||
__instance.SetStarmapGalaxy();
|
uiGalaxySelect.SetStarmapGalaxy();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,26 +258,21 @@ public class MoreSettings
|
|||||||
[HarmonyPatch(typeof(GameMain), nameof(GameMain.Start))]
|
[HarmonyPatch(typeof(GameMain), nameof(GameMain.Start))]
|
||||||
private static void GameMain_Start_Prefix()
|
private static void GameMain_Start_Prefix()
|
||||||
{
|
{
|
||||||
_gameMinDist = DEFAULT_MIN_DIST;
|
if (DSPGame.GameDesc != null)
|
||||||
_gameMinStep = DEFAULT_MIN_STEP;
|
{
|
||||||
_gameMaxStep = DEFAULT_MAX_STEP;
|
if (GameMain.data != null) return;
|
||||||
_gameFlatten = DEFAULT_FLATTEN;
|
_gameMinDist = _minDist;
|
||||||
}
|
_gameMinStep = _minStep;
|
||||||
|
_gameMaxStep = _maxStep;
|
||||||
[HarmonyPrefix]
|
_gameFlatten = _flatten;
|
||||||
[HarmonyPatch(typeof(GameData), nameof(GameData.NewGame))]
|
}
|
||||||
private static void GameData_NewGame_Prefix()
|
else
|
||||||
{
|
{
|
||||||
if (!Enabled.Value) return;
|
_gameMinDist = DEFAULT_MIN_DIST;
|
||||||
_gameMinDist = _minDist;
|
_gameMinStep = DEFAULT_MIN_STEP;
|
||||||
_gameMinStep = _minStep;
|
_gameMaxStep = DEFAULT_MAX_STEP;
|
||||||
_gameMaxStep = _maxStep;
|
_gameFlatten = DEFAULT_FLATTEN;
|
||||||
_gameFlatten = _flatten;
|
}
|
||||||
|
|
||||||
_minDist = DEFAULT_MIN_DIST;
|
|
||||||
_minStep = DEFAULT_MIN_STEP;
|
|
||||||
_maxStep = DEFAULT_MAX_STEP;
|
|
||||||
_flatten = DEFAULT_FLATTEN;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyTranspiler]
|
[HarmonyTranspiler]
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<AssemblyName>UniverseGenTweaks</AssemblyName>
|
<AssemblyName>UniverseGenTweaks</AssemblyName>
|
||||||
<BepInExPluginGuid>org.soardev.universegentweaks</BepInExPluginGuid>
|
<BepInExPluginGuid>org.soardev.universegentweaks</BepInExPluginGuid>
|
||||||
<Description>DSP MOD - UniverseGenTweaks</Description>
|
<Description>DSP MOD - UniverseGenTweaks</Description>
|
||||||
<Version>1.2.10</Version>
|
<Version>1.2.11</Version>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<RestoreAdditionalProjectSources>https://nuget.bepinex.dev/v3/index.json</RestoreAdditionalProjectSources>
|
<RestoreAdditionalProjectSources>https://nuget.bepinex.dev/v3/index.json</RestoreAdditionalProjectSources>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "UniverseGenTweaks",
|
"name": "UniverseGenTweaks",
|
||||||
"version_number": "1.2.10",
|
"version_number": "1.2.11",
|
||||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UniverseGenTweaks",
|
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UniverseGenTweaks",
|
||||||
"description": "Universe Generation Tweaks / 宇宙生成参数调节",
|
"description": "Universe Generation Tweaks / 宇宙生成参数调节",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
|||||||
Reference in New Issue
Block a user