using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
internal static class PluginInfo
{
public const string PLUGIN_GUID = "com.yummi.dsp.solarsystemprogram";
public const string PLUGIN_NAME = "SolarSystemProgram";
public const string PLUGIN_VERSION = "1.0.0";
}
namespace SolarSystemProgram
{
[HarmonyPatch]
public class SingleStarPatch
{
[HarmonyPostfix]
[HarmonyPatch(typeof(UIGalaxySelect), "_OnOpen")]
public static void UIGalaxySelect_OnOpen_Postfix(UIGalaxySelect __instance)
{
if ((Object)(object)__instance.starCountSlider != (Object)null)
{
GameObject gameObject = ((Component)__instance.starCountSlider).gameObject;
if ((Object)(object)gameObject.transform.parent != (Object)null)
{
((Component)gameObject.transform.parent).gameObject.SetActive(false);
}
else
{
gameObject.SetActive(false);
}
SolarSystemProgram.Log.LogDebug((object)"已隐藏星系数量滑块");
}
if ((Object)(object)__instance.starCountText != (Object)null)
{
((Component)__instance.starCountText).gameObject.SetActive(false);
SolarSystemProgram.Log.LogDebug((object)"已隐藏星系数量文本");
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(UIGalaxySelect), "OnStarCountSliderValueChange")]
public static bool UIGalaxySelect_OnStarCountSliderValueChange_Prefix(UIGalaxySelect __instance)
{
if (__instance.gameDesc != null)
{
__instance.gameDesc.starCount = 1;
}
return false;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GameDesc), "SetForNewGame")]
public static void GameDesc_SetForNewGame_Postfix(GameDesc __instance)
{
__instance.starCount = 1;
SolarSystemProgram.Log.LogInfo((object)$"新游戏星系数量已设置为: {__instance.starCount}");
}
[HarmonyPostfix]
[HarmonyPatch(typeof(UniverseGen), "CreateGalaxy")]
public static void UniverseGen_CreateGalaxy_Postfix(GalaxyData __result)
{
if (__result != null && __result.stars != null && __result.stars.Length != 0)
{
__result.stars[0].name = "Solar System";
__result.stars[0].overrideName = "Solar System";
SolarSystemProgram.Log.LogInfo((object)"已将恒星命名为: Solar System");
}
}
}
[BepInPlugin("com.yummi.dsp.solarsystemprogram", "太阳系计划 (Solar System Program)", "1.0.0")]
public class SolarSystemProgram : BaseUnityPlugin
{
public const string PLUGIN_GUID = "com.yummi.dsp.solarsystemprogram";
public const string PLUGIN_NAME = "太阳系计划 (Solar System Program)";
public const string PLUGIN_VERSION = "1.0.0";
private static readonly Harmony harmony = new Harmony("com.yummi.dsp.solarsystemprogram");
internal static ManualLogSource Log;
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
harmony.PatchAll(typeof(SingleStarPatch));
Log.LogInfo((object)"太阳系计划 (Solar System Program) v1.0.0 已加载");
Log.LogInfo((object)"游戏已限制为单星系模式");
}
private void OnDestroy()
{
harmony.UnpatchSelf();
}
}
}