mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-02-04 20:22:17 +08:00
UniverseGenTweaks v1.2.5
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
using BepInEx.Configuration;
|
using BepInEx.Configuration;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
@@ -29,10 +30,6 @@ public class MoreSettings
|
|||||||
private static Text _minStepText;
|
private static Text _minStepText;
|
||||||
private static Text _maxStepText;
|
private static Text _maxStepText;
|
||||||
private static Text _flattenText;
|
private static Text _flattenText;
|
||||||
private static Localizer _minDistLocalizer;
|
|
||||||
private static Localizer _minStepLocalizer;
|
|
||||||
private static Localizer _maxStepLocalizer;
|
|
||||||
private static Localizer _flattenLocalizer;
|
|
||||||
private static Harmony _harmony;
|
private static Harmony _harmony;
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
@@ -79,15 +76,19 @@ public class MoreSettings
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect._OnInit))]
|
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect._OnCreate))]
|
||||||
private static void UIGalaxySelect__OnInit_Postfix(UIGalaxySelect __instance)
|
private static void UIGalaxySelect__OnCreate_Postfix(UIGalaxySelect __instance)
|
||||||
{
|
{
|
||||||
__instance.starCountSlider.maxValue = MaxStarCount.Value;
|
__instance.starCountSlider.maxValue = MaxStarCount.Value;
|
||||||
|
|
||||||
CreateSliderWithText(__instance.starCountSlider, out _minDistTitle, out _minDistSlider, out _minDistText, out _minDistLocalizer);
|
CreateSliderWithText(__instance.starCountSlider, out _minDistTitle, out _minDistSlider, out _minDistText, out var minDistLocalizer);
|
||||||
CreateSliderWithText(__instance.starCountSlider, out _minStepTitle, out _minStepSlider, out _minStepText, out _minStepLocalizer);
|
CreateSliderWithText(__instance.starCountSlider, out _minStepTitle, out _minStepSlider, out _minStepText, out var minStepLocalizer);
|
||||||
CreateSliderWithText(__instance.starCountSlider, out _maxStepTitle, out _maxStepSlider, out _maxStepText, out _maxStepLocalizer);
|
CreateSliderWithText(__instance.starCountSlider, out _maxStepTitle, out _maxStepSlider, out _maxStepText, out var maxStepLocalizer);
|
||||||
CreateSliderWithText(__instance.starCountSlider, out _flattenTitle, out _flattenSlider, out _flattenText, out _flattenLocalizer);
|
CreateSliderWithText(__instance.starCountSlider, out _flattenTitle, out _flattenSlider, out _flattenText, out var flattenLocalizer);
|
||||||
|
minDistLocalizer.stringKey = "恒星最小距离";
|
||||||
|
minStepLocalizer.stringKey = "步进最小距离";
|
||||||
|
maxStepLocalizer.stringKey = "步进最大距离";
|
||||||
|
flattenLocalizer.stringKey = "扁平度";
|
||||||
|
|
||||||
_minDistTitle.name = "min-dist";
|
_minDistTitle.name = "min-dist";
|
||||||
_minDistSlider.minValue = 10f;
|
_minDistSlider.minValue = 10f;
|
||||||
@@ -124,31 +125,6 @@ public class MoreSettings
|
|||||||
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect._OnOpen))]
|
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect._OnOpen))]
|
||||||
private static void UIGalaxySelect__OnOpen_Prefix()
|
private static void UIGalaxySelect__OnOpen_Prefix()
|
||||||
{
|
{
|
||||||
if (_minDistLocalizer)
|
|
||||||
{
|
|
||||||
_minDistLocalizer.stringKey = "恒星最小距离";
|
|
||||||
_minDistLocalizer.translation = "恒星最小距离".Translate();
|
|
||||||
}
|
|
||||||
_minDistText.text = "恒星最小距离".Translate();
|
|
||||||
if (_minStepLocalizer)
|
|
||||||
{
|
|
||||||
_minStepLocalizer.stringKey = "步进最小距离".Translate();
|
|
||||||
_minStepLocalizer.translation = "步进最小距离".Translate();
|
|
||||||
}
|
|
||||||
_minStepText.text = "步进最小距离".Translate();
|
|
||||||
if (_maxStepLocalizer)
|
|
||||||
{
|
|
||||||
_maxStepLocalizer.stringKey = "步进最大距离".Translate();
|
|
||||||
_maxStepLocalizer.text.text = "步进最大距离".Translate();
|
|
||||||
}
|
|
||||||
_maxStepText.text = "步进最大距离".Translate();
|
|
||||||
if (_flattenLocalizer)
|
|
||||||
{
|
|
||||||
_flattenLocalizer.stringKey = "扁平度".Translate();
|
|
||||||
_flattenLocalizer.translation = "扁平度".Translate();
|
|
||||||
}
|
|
||||||
_flattenText.text = "扁平度".Translate();
|
|
||||||
|
|
||||||
_minDistText.text = _minDist.ToString();
|
_minDistText.text = _minDist.ToString();
|
||||||
_minStepText.text = _minStep.ToString();
|
_minStepText.text = _minStep.ToString();
|
||||||
_maxStepText.text = _maxStep.ToString();
|
_maxStepText.text = _maxStep.ToString();
|
||||||
@@ -305,4 +281,19 @@ public class MoreSettings
|
|||||||
return matcher.InstructionEnumeration();
|
return matcher.InstructionEnumeration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Export(BinaryWriter w)
|
||||||
|
{
|
||||||
|
w.Write(_minDist);
|
||||||
|
w.Write(_minStep);
|
||||||
|
w.Write(_maxStep);
|
||||||
|
w.Write(_flatten);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Import(BinaryReader r)
|
||||||
|
{
|
||||||
|
_minDist = r.ReadDouble();
|
||||||
|
_minStep = r.ReadDouble();
|
||||||
|
_maxStep = r.ReadDouble();
|
||||||
|
_flatten = r.ReadDouble();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,9 @@
|
|||||||
#### 宇宙生成参数调节
|
#### 宇宙生成参数调节
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
* 1.2.5
|
||||||
|
+ Thanks to [kremnev8](https://github.com/kremnev8)'s work on new version of [DSPModSave](https://dsp.thunderstore.io/package/CommonAPI/DSPModSave/), universe generation options are stored in save file now.
|
||||||
|
+ Fix text display issue on new game screen
|
||||||
* 1.2.4
|
* 1.2.4
|
||||||
+ Fix a crash while setting star count greater than 256 (again)
|
+ Fix a crash while setting star count greater than 256 (again)
|
||||||
+ Fix bug that collider check is not enabled on stars with ID greater than 255
|
+ Fix bug that collider check is not enabled on stars with ID greater than 255
|
||||||
@@ -38,6 +41,9 @@
|
|||||||
* High luminosity for birth star
|
* High luminosity for birth star
|
||||||
|
|
||||||
## 更新日志
|
## 更新日志
|
||||||
|
* 1.2.5
|
||||||
|
+ 感谢[kremnev8](https://github.com/kremnev8)对[DSPModSave](https://dsp.thunderstore.io/package/CommonAPI/DSPModSave/)的更新,现在宇宙生成选项会被保存到存档中
|
||||||
|
+ 修复新建游戏界面文本显示问题
|
||||||
* 1.2.4
|
* 1.2.4
|
||||||
+ 修复了设置星系数大于256时崩溃的问题(再次)
|
+ 修复了设置星系数大于256时崩溃的问题(再次)
|
||||||
+ 修复了ID大于255的星系没有启用碰撞体检测的问题
|
+ 修复了ID大于255的星系没有启用碰撞体检测的问题
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
using BepInEx;
|
using System.IO;
|
||||||
|
using BepInEx;
|
||||||
using BepInEx.Configuration;
|
using BepInEx.Configuration;
|
||||||
|
using crecheng.DSPModSave;
|
||||||
|
|
||||||
namespace UniverseGenTweaks;
|
namespace UniverseGenTweaks;
|
||||||
|
|
||||||
[BepInDependency("org.soardev.uxassist")]
|
|
||||||
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
||||||
public class UniverseGenTweaks : BaseUnityPlugin
|
[BepInDependency(UXAssist.PluginInfo.PLUGIN_GUID)]
|
||||||
|
[BepInDependency(DSPModSavePlugin.MODGUID)]
|
||||||
|
[ModSaveSettings(LoadOrder = LoadOrder.Preload)]
|
||||||
|
public class UniverseGenTweaks : BaseUnityPlugin, IModCanSave
|
||||||
{
|
{
|
||||||
public new static readonly BepInEx.Logging.ManualLogSource Logger =
|
public new static readonly BepInEx.Logging.ManualLogSource Logger =
|
||||||
BepInEx.Logging.Logger.CreateLogSource(PluginInfo.PLUGIN_NAME);
|
BepInEx.Logging.Logger.CreateLogSource(PluginInfo.PLUGIN_NAME);
|
||||||
@@ -59,4 +63,25 @@ public class UniverseGenTweaks : BaseUnityPlugin
|
|||||||
EpicDifficulty.Uninit();
|
EpicDifficulty.Uninit();
|
||||||
MoreSettings.Uninit();
|
MoreSettings.Uninit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region IModCanSave
|
||||||
|
private const ushort ModSaveVersion = 1;
|
||||||
|
|
||||||
|
public void Export(BinaryWriter w)
|
||||||
|
{
|
||||||
|
w.Write(ModSaveVersion);
|
||||||
|
MoreSettings.Export(w);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Import(BinaryReader r)
|
||||||
|
{
|
||||||
|
var version = r.ReadUInt16();
|
||||||
|
if (version <= 0) return;
|
||||||
|
MoreSettings.Import(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void IntoOtherSave()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -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.4</Version>
|
<Version>1.2.5</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>
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
<PackageReference Include="BepInEx.Core" Version="5.*" />
|
<PackageReference Include="BepInEx.Core" Version="5.*" />
|
||||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
|
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
|
||||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="*-r.*" />
|
<PackageReference Include="DysonSphereProgram.GameLibs" Version="*-r.*" />
|
||||||
|
<PackageReference Include="DysonSphereProgram.Modding.DSPModSave" Version="1.2" />
|
||||||
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
|
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "UniverseGenTweaks",
|
"name": "UniverseGenTweaks",
|
||||||
"version_number": "1.2.4",
|
"version_number": "1.2.5",
|
||||||
"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": [
|
||||||
"xiaoye97-BepInEx-5.4.17",
|
"xiaoye97-BepInEx-5.4.17",
|
||||||
|
"CommonAPI-DSPModSave-1.2.0",
|
||||||
"soarqin-UXAssist-1.0.5"
|
"soarqin-UXAssist-1.0.5"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user