mirror of
https://github.com/soarqin/DSP_Mods_TO.git
synced 2025-12-11 00:43:28 +08:00
Added CruiseAssist and AutoPilot
This commit is contained in:
33
AutoPilot/AutoPilot.csproj
Normal file
33
AutoPilot/AutoPilot.csproj
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<AssemblyName>AutoPilot</AssemblyName>
|
||||
<BepInExPluginGuid>tanu.AutoPilot</BepInExPluginGuid>
|
||||
<Description>DSP MOD - AutoPilot</Description>
|
||||
<Version>0.0.4</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>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CruiseAssist\CruiseAssist.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="del /F /Q package\$(ProjectName)-$(Version).zip
zip -9 -j package/$(ProjectName)-$(Version).zip $(TargetPath) package/icon.png package/manifest.json README.md" />
|
||||
</Target>
|
||||
</Project>
|
||||
71
AutoPilot/AutoPilotConfigManager.cs
Normal file
71
AutoPilot/AutoPilotConfigManager.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using AutoPilot.Commons;
|
||||
using AutoPilot.UI;
|
||||
using BepInEx.Configuration;
|
||||
|
||||
namespace AutoPilot;
|
||||
|
||||
internal class AutoPilotConfigManager : ConfigManager
|
||||
{
|
||||
internal AutoPilotConfigManager(ConfigFile Config)
|
||||
: base(Config)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void CheckConfigImplements(Step step)
|
||||
{
|
||||
var ok = false;
|
||||
if (step == Step.Awake)
|
||||
{
|
||||
var configEntry = Bind("Base", "ModVersion", "0.0.4", "Don't change.");
|
||||
configEntry.Value = "0.0.4";
|
||||
ok = true;
|
||||
}
|
||||
|
||||
if (step is Step.Awake or Step.GameMainBegin)
|
||||
{
|
||||
AutoPilotDebugUI.Show = Bind("Debug", "DebugWindowShow", false).Value;
|
||||
AutoPilotPlugin.Conf.MinEnergyPer = Bind("Setting", "MinEnergyPer", 20).Value;
|
||||
AutoPilotPlugin.Conf.MaxSpeed = Bind("Setting", "MaxSpeed", 2000).Value;
|
||||
AutoPilotPlugin.Conf.WarpMinRangeAU = Bind("Setting", "WarpMinRangeAU", 2).Value;
|
||||
AutoPilotPlugin.Conf.SpeedToWarp = Bind("Setting", "WarpSpeed", 1200).Value;
|
||||
AutoPilotPlugin.Conf.LocalWarpFlag = Bind("Setting", "LocalWarp", false).Value;
|
||||
AutoPilotPlugin.Conf.AutoStartFlag = Bind("Setting", "AutoStart", true).Value;
|
||||
AutoPilotPlugin.Conf.MainWindowJoinFlag = Bind("Setting", "MainWindowJoin", true).Value;
|
||||
for (var i = 0; i < 2; i++)
|
||||
{
|
||||
AutoPilotMainUI.Rect[i].x = Bind("State", $"MainWindow{i}Left", 100).Value;
|
||||
AutoPilotMainUI.Rect[i].y = Bind("State", $"MainWindow{i}Top", 100).Value;
|
||||
AutoPilotConfigUI.Rect[i].x = Bind("State", $"ConfigWindow{i}Left", 100).Value;
|
||||
AutoPilotConfigUI.Rect[i].y = Bind("State", $"ConfigWindow{i}Top", 100).Value;
|
||||
}
|
||||
AutoPilotDebugUI.Rect.x = Bind("State", "DebugWindowLeft", 100).Value;
|
||||
AutoPilotDebugUI.Rect.y = Bind("State", "DebugWindowTop", 100).Value;
|
||||
}
|
||||
else if (step == Step.State)
|
||||
{
|
||||
LogManager.LogInfo("check state.");
|
||||
ok |= UpdateEntry("Setting", "MinEnergyPer", AutoPilotPlugin.Conf.MinEnergyPer);
|
||||
ok |= UpdateEntry("Setting", "MaxSpeed", AutoPilotPlugin.Conf.MaxSpeed);
|
||||
ok |= UpdateEntry("Setting", "WarpMinRangeAU", AutoPilotPlugin.Conf.WarpMinRangeAU);
|
||||
ok |= UpdateEntry("Setting", "WarpSpeed", AutoPilotPlugin.Conf.SpeedToWarp);
|
||||
ok |= UpdateEntry("Setting", "LocalWarp", AutoPilotPlugin.Conf.LocalWarpFlag);
|
||||
ok |= UpdateEntry("Setting", "AutoStart", AutoPilotPlugin.Conf.AutoStartFlag);
|
||||
ok |= UpdateEntry("Setting", "MainWindowJoin", AutoPilotPlugin.Conf.MainWindowJoinFlag);
|
||||
for (var j = 0; j < 2; j++)
|
||||
{
|
||||
ok |= UpdateEntry("State", $"MainWindow{j}Left", (int)AutoPilotMainUI.Rect[j].x);
|
||||
ok |= UpdateEntry("State", $"MainWindow{j}Top", (int)AutoPilotMainUI.Rect[j].y);
|
||||
ok |= UpdateEntry("State", $"ConfigWindow{j}Left", (int)AutoPilotConfigUI.Rect[j].x);
|
||||
ok |= UpdateEntry("State", $"ConfigWindow{j}Top", (int)AutoPilotConfigUI.Rect[j].y);
|
||||
}
|
||||
ok |= UpdateEntry("State", "DebugWindowLeft", (int)AutoPilotDebugUI.Rect.x);
|
||||
ok |= UpdateEntry("State", "DebugWindowTop", (int)AutoPilotDebugUI.Rect.y);
|
||||
AutoPilotMainUI.NextCheckGameTick = long.MaxValue;
|
||||
}
|
||||
|
||||
if (ok)
|
||||
{
|
||||
Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
236
AutoPilot/AutoPilotExtension.cs
Normal file
236
AutoPilot/AutoPilotExtension.cs
Normal file
@@ -0,0 +1,236 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using AutoPilot.Commons;
|
||||
using AutoPilot.Enums;
|
||||
using AutoPilot.UI;
|
||||
using CruiseAssist;
|
||||
using CruiseAssist.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AutoPilot;
|
||||
|
||||
internal class AutoPilotExtension : ICruiseAssistExtensionAPI
|
||||
{
|
||||
public void CheckConfig(string step)
|
||||
{
|
||||
EnumUtils.TryParse(step, out ConfigManager.Step step2);
|
||||
ConfigManager.CheckConfig(step2);
|
||||
}
|
||||
|
||||
public void SetTargetAstroId(int astroId)
|
||||
{
|
||||
AutoPilotPlugin.State = (AutoPilotPlugin.Conf.AutoStartFlag ? AutoPilotState.Active : AutoPilotState.Inactive);
|
||||
AutoPilotPlugin.InputSailSpeedUp = false;
|
||||
}
|
||||
|
||||
public bool OperateWalk(PlayerMove_Walk __instance)
|
||||
{
|
||||
if (AutoPilotPlugin.State == AutoPilotState.Inactive)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var player = __instance.player;
|
||||
var mecha = player.mecha;
|
||||
AutoPilotPlugin.EnergyPer = mecha.coreEnergy / mecha.coreEnergyCap * 100.0;
|
||||
AutoPilotPlugin.Speed = player.controller.actionSail.visual_uvel.magnitude;
|
||||
AutoPilotPlugin.WarperCount = mecha.warpStorage.GetItemCount(1210);
|
||||
AutoPilotPlugin.LeavePlanet = true;
|
||||
AutoPilotPlugin.SpeedUp = false;
|
||||
AutoPilotPlugin.InputSailSpeedUp = false;
|
||||
var ignoreGravityFlag = AutoPilotPlugin.Conf.IgnoreGravityFlag;
|
||||
if (ignoreGravityFlag)
|
||||
{
|
||||
player.controller.universalGravity = VectorLF3.zero;
|
||||
player.controller.localGravity = VectorLF3.zero;
|
||||
}
|
||||
__instance.controller.input0.z = 1f;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool OperateDrift(PlayerMove_Drift __instance)
|
||||
{
|
||||
if (AutoPilotPlugin.State == AutoPilotState.Inactive)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var player = __instance.player;
|
||||
var mecha = player.mecha;
|
||||
AutoPilotPlugin.EnergyPer = mecha.coreEnergy / mecha.coreEnergyCap * 100.0;
|
||||
AutoPilotPlugin.Speed = player.controller.actionSail.visual_uvel.magnitude;
|
||||
AutoPilotPlugin.WarperCount = mecha.warpStorage.GetItemCount(1210);
|
||||
AutoPilotPlugin.LeavePlanet = true;
|
||||
AutoPilotPlugin.SpeedUp = false;
|
||||
AutoPilotPlugin.InputSailSpeedUp = false;
|
||||
var ignoreGravityFlag = AutoPilotPlugin.Conf.IgnoreGravityFlag;
|
||||
if (ignoreGravityFlag)
|
||||
{
|
||||
player.controller.universalGravity = VectorLF3.zero;
|
||||
player.controller.localGravity = VectorLF3.zero;
|
||||
}
|
||||
__instance.controller.input0.z = 1f;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool OperateFly(PlayerMove_Fly __instance)
|
||||
{
|
||||
if (AutoPilotPlugin.State == AutoPilotState.Inactive)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var player = __instance.player;
|
||||
var mecha = player.mecha;
|
||||
AutoPilotPlugin.EnergyPer = mecha.coreEnergy / mecha.coreEnergyCap * 100.0;
|
||||
AutoPilotPlugin.Speed = player.controller.actionSail.visual_uvel.magnitude;
|
||||
AutoPilotPlugin.WarperCount = mecha.warpStorage.GetItemCount(1210);
|
||||
AutoPilotPlugin.LeavePlanet = true;
|
||||
AutoPilotPlugin.SpeedUp = false;
|
||||
AutoPilotPlugin.InputSailSpeedUp = false;
|
||||
var ignoreGravityFlag = AutoPilotPlugin.Conf.IgnoreGravityFlag;
|
||||
if (ignoreGravityFlag)
|
||||
{
|
||||
player.controller.universalGravity = VectorLF3.zero;
|
||||
player.controller.localGravity = VectorLF3.zero;
|
||||
}
|
||||
var controller = __instance.controller;
|
||||
controller.input0.y = controller.input0.y + 1f;
|
||||
var controller2 = __instance.controller;
|
||||
controller2.input1.y = controller2.input1.y + 1f;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool OperateSail(PlayerMove_Sail __instance)
|
||||
{
|
||||
if (AutoPilotPlugin.State == AutoPilotState.Inactive)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var player = __instance.player;
|
||||
var mecha = player.mecha;
|
||||
AutoPilotPlugin.EnergyPer = mecha.coreEnergy / mecha.coreEnergyCap * 100.0;
|
||||
AutoPilotPlugin.Speed = player.controller.actionSail.visual_uvel.magnitude;
|
||||
AutoPilotPlugin.WarperCount = mecha.warpStorage.GetItemCount(1210);
|
||||
AutoPilotPlugin.LeavePlanet = false;
|
||||
AutoPilotPlugin.SpeedUp = false;
|
||||
AutoPilotPlugin.InputSailSpeedUp = false;
|
||||
if (player.warping)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (AutoPilotPlugin.EnergyPer < AutoPilotPlugin.Conf.MinEnergyPer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (AutoPilotPlugin.Conf.IgnoreGravityFlag)
|
||||
{
|
||||
player.controller.universalGravity = VectorLF3.zero;
|
||||
player.controller.localGravity = VectorLF3.zero;
|
||||
}
|
||||
|
||||
if (AutoPilotPlugin.Speed < AutoPilotPlugin.Conf.MaxSpeed)
|
||||
{
|
||||
AutoPilotPlugin.InputSailSpeedUp = true;
|
||||
AutoPilotPlugin.SpeedUp = true;
|
||||
}
|
||||
|
||||
if (GameMain.localPlanet == null)
|
||||
{
|
||||
if (!AutoPilotPlugin.Conf.LocalWarpFlag && GameMain.localStar != null && CruiseAssistPlugin.TargetStar.id == GameMain.localStar.id) return false;
|
||||
if (!(AutoPilotPlugin.Conf.WarpMinRangeAU * 40000.0 <= CruiseAssistPlugin.TargetRange) || !(AutoPilotPlugin.Conf.SpeedToWarp <= AutoPilotPlugin.Speed) ||
|
||||
1 > AutoPilotPlugin.WarperCount) return false;
|
||||
if (!(mecha.coreEnergy > mecha.warpStartPowerPerSpeed * mecha.maxWarpSpeed)) return false;
|
||||
if (!mecha.UseWarper()) return false;
|
||||
player.warpCommand = true;
|
||||
VFAudio.Create("warp-begin", player.transform, Vector3.zero, true);
|
||||
return false;
|
||||
}
|
||||
|
||||
var vec = player.uPosition - GameMain.localPlanet.uPosition;
|
||||
if (120.0 < AutoPilotPlugin.Speed && Math.Max(GameMain.localPlanet.realRadius, 800f) < vec.magnitude - GameMain.localPlanet.realRadius)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
VectorLF3 result;
|
||||
if (Vector3.Angle(player.uPosition - GameMain.localPlanet.uPosition, CruiseAssistPlugin.TargetUPos - GameMain.localPlanet.uPosition) > 90f)
|
||||
{
|
||||
AutoPilotPlugin.LeavePlanet = true;
|
||||
result = vec;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = CruiseAssistPlugin.TargetUPos - player.uPosition;
|
||||
}
|
||||
var num = Vector3.Angle(result, player.uVelocity);
|
||||
var num2 = 1.6f / Mathf.Max(10f, num);
|
||||
var num3 = Math.Min(AutoPilotPlugin.Speed, 120.0);
|
||||
player.uVelocity = Vector3.Slerp(player.uVelocity, result.normalized * num3, num2);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SetInactive()
|
||||
{
|
||||
AutoPilotPlugin.State = AutoPilotState.Inactive;
|
||||
AutoPilotPlugin.InputSailSpeedUp = false;
|
||||
}
|
||||
|
||||
public void CancelOperate()
|
||||
{
|
||||
AutoPilotPlugin.State = AutoPilotState.Inactive;
|
||||
AutoPilotPlugin.InputSailSpeedUp = false;
|
||||
}
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
var uiGame = UIRoot.instance.uiGame;
|
||||
var num = CruiseAssistMainUI.Scale / 100f;
|
||||
AutoPilotMainUI.OnGUI();
|
||||
var flag = AutoPilotConfigUI.Show[CruiseAssistMainUI.WIdx];
|
||||
if (flag)
|
||||
{
|
||||
AutoPilotConfigUI.OnGUI();
|
||||
}
|
||||
var show = AutoPilotDebugUI.Show;
|
||||
if (show)
|
||||
{
|
||||
AutoPilotDebugUI.OnGUI();
|
||||
}
|
||||
var flag2 = ResetInput(AutoPilotMainUI.Rect[CruiseAssistMainUI.WIdx], num);
|
||||
var flag3 = !flag2 && AutoPilotConfigUI.Show[CruiseAssistMainUI.WIdx];
|
||||
if (flag3)
|
||||
{
|
||||
flag2 = ResetInput(AutoPilotConfigUI.Rect[CruiseAssistMainUI.WIdx], num);
|
||||
}
|
||||
var flag4 = !flag2 && AutoPilotDebugUI.Show;
|
||||
if (flag4)
|
||||
{
|
||||
flag2 = ResetInput(AutoPilotDebugUI.Rect, num);
|
||||
}
|
||||
}
|
||||
|
||||
private bool ResetInput(Rect rect, float scale)
|
||||
{
|
||||
var num = rect.xMin * scale;
|
||||
var num2 = rect.xMax * scale;
|
||||
var num3 = rect.yMin * scale;
|
||||
var num4 = rect.yMax * scale;
|
||||
var x = Input.mousePosition.x;
|
||||
var num5 = Screen.height - Input.mousePosition.y;
|
||||
var flag = num <= x && x <= num2 && num3 <= num5 && num5 <= num4;
|
||||
if (flag)
|
||||
{
|
||||
int[] array = { 0, 1, 2 };
|
||||
var flag2 = array.Any(Input.GetMouseButton) || Input.mouseScrollDelta.y != 0f;
|
||||
if (flag2)
|
||||
{
|
||||
Input.ResetInputAxes();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
64
AutoPilot/AutoPilotPlugin.cs
Normal file
64
AutoPilot/AutoPilotPlugin.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using AutoPilot.Commons;
|
||||
using AutoPilot.Enums;
|
||||
using AutoPilot.Patches;
|
||||
using BepInEx;
|
||||
using CruiseAssist;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace AutoPilot;
|
||||
|
||||
[BepInDependency("tanu.CruiseAssist")]
|
||||
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
||||
public class AutoPilotPlugin : BaseUnityPlugin
|
||||
{
|
||||
public void Awake()
|
||||
{
|
||||
LogManager.Logger = Logger;
|
||||
new AutoPilotConfigManager(Config);
|
||||
ConfigManager.CheckConfig(ConfigManager.Step.Awake);
|
||||
_harmony = new Harmony("tanu.AutoPilot.Patch");
|
||||
_harmony.PatchAll(typeof(Patch_VFInput));
|
||||
CruiseAssistPlugin.RegistExtension(new AutoPilotExtension());
|
||||
}
|
||||
|
||||
public void OnDestroy()
|
||||
{
|
||||
CruiseAssistPlugin.UnregistExtension(typeof(AutoPilotExtension));
|
||||
_harmony.UnpatchSelf();
|
||||
}
|
||||
|
||||
public static double EnergyPer = 0.0;
|
||||
|
||||
public static double Speed = 0.0;
|
||||
|
||||
public static int WarperCount = 0;
|
||||
|
||||
public static bool LeavePlanet = false;
|
||||
|
||||
public static bool SpeedUp = false;
|
||||
|
||||
public static AutoPilotState State = AutoPilotState.Inactive;
|
||||
|
||||
public static bool InputSailSpeedUp = false;
|
||||
|
||||
private Harmony _harmony;
|
||||
|
||||
public static class Conf
|
||||
{
|
||||
public static int MinEnergyPer = 20;
|
||||
|
||||
public static int MaxSpeed = 2000;
|
||||
|
||||
public static int WarpMinRangeAU = 2;
|
||||
|
||||
public static int SpeedToWarp = 1200;
|
||||
|
||||
public static bool LocalWarpFlag = false;
|
||||
|
||||
public static bool AutoStartFlag = true;
|
||||
|
||||
public static bool IgnoreGravityFlag = true;
|
||||
|
||||
public static bool MainWindowJoinFlag = true;
|
||||
}
|
||||
}
|
||||
157
AutoPilot/Commons/ConfigManager.cs
Normal file
157
AutoPilot/Commons/ConfigManager.cs
Normal file
@@ -0,0 +1,157 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace AutoPilot.Commons;
|
||||
|
||||
internal abstract class ConfigManager
|
||||
{
|
||||
public static ConfigFile Config { get; private set; }
|
||||
|
||||
protected ConfigManager(ConfigFile config)
|
||||
{
|
||||
_instance = this;
|
||||
Config = config;
|
||||
Config.SaveOnConfigSet = false;
|
||||
}
|
||||
|
||||
public static void CheckConfig(Step step)
|
||||
{
|
||||
_instance.CheckConfigImplements(step);
|
||||
}
|
||||
|
||||
protected abstract void CheckConfigImplements(Step step);
|
||||
|
||||
public static ConfigEntry<T> Bind<T>(ConfigDefinition configDefinition, T defaultValue, ConfigDescription configDescription = null)
|
||||
{
|
||||
return Config.Bind(configDefinition, defaultValue, configDescription);
|
||||
}
|
||||
|
||||
public static ConfigEntry<T> Bind<T>(string section, string key, T defaultValue, ConfigDescription configDescription = null)
|
||||
{
|
||||
return Config.Bind(section, key, defaultValue, configDescription);
|
||||
}
|
||||
|
||||
public static ConfigEntry<T> Bind<T>(string section, string key, T defaultValue, string description)
|
||||
{
|
||||
return Config.Bind(section, key, defaultValue, description);
|
||||
}
|
||||
|
||||
public static ConfigEntry<T> GetEntry<T>(ConfigDefinition configDefinition)
|
||||
{
|
||||
ConfigEntry<T> configEntry;
|
||||
try
|
||||
{
|
||||
configEntry = (ConfigEntry<T>)Config[configDefinition];
|
||||
}
|
||||
catch (KeyNotFoundException ex)
|
||||
{
|
||||
LogManager.LogError($"{ex.GetType()}: configDefinition={configDefinition}");
|
||||
throw;
|
||||
}
|
||||
return configEntry;
|
||||
}
|
||||
|
||||
public static ConfigEntry<T> GetEntry<T>(string section, string key)
|
||||
{
|
||||
return GetEntry<T>(new ConfigDefinition(section, key));
|
||||
}
|
||||
|
||||
public static T GetValue<T>(ConfigDefinition configDefinition)
|
||||
{
|
||||
return GetEntry<T>(configDefinition).Value;
|
||||
}
|
||||
|
||||
public static T GetValue<T>(string section, string key)
|
||||
{
|
||||
return GetEntry<T>(section, key).Value;
|
||||
}
|
||||
|
||||
public static bool ContainsKey(ConfigDefinition configDefinition)
|
||||
{
|
||||
return Config.ContainsKey(configDefinition);
|
||||
}
|
||||
|
||||
public static bool ContainsKey(string section, string key)
|
||||
{
|
||||
return Config.ContainsKey(new ConfigDefinition(section, key));
|
||||
}
|
||||
|
||||
public static bool UpdateEntry<T>(string section, string key, T value) where T : IComparable
|
||||
{
|
||||
var entry = GetEntry<T>(section, key);
|
||||
var value2 = entry.Value;
|
||||
var flag = value2.CompareTo(value) == 0;
|
||||
bool flag2;
|
||||
if (flag)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
entry.Value = value;
|
||||
flag2 = true;
|
||||
}
|
||||
return flag2;
|
||||
}
|
||||
|
||||
public static bool RemoveEntry(ConfigDefinition key)
|
||||
{
|
||||
return Config.Remove(key);
|
||||
}
|
||||
|
||||
public static Dictionary<ConfigDefinition, string> GetOrphanedEntries()
|
||||
{
|
||||
var flag = _orphanedEntries == null;
|
||||
if (flag)
|
||||
{
|
||||
_orphanedEntries = Traverse.Create(Config).Property<Dictionary<ConfigDefinition, string>>("OrphanedEntries").Value;
|
||||
}
|
||||
return _orphanedEntries;
|
||||
}
|
||||
|
||||
public static void Migration<T>(string newSection, string newKey, T defaultValue, string oldSection, string oldKey)
|
||||
{
|
||||
GetOrphanedEntries();
|
||||
var configDefinition = new ConfigDefinition(oldSection, oldKey);
|
||||
var flag = _orphanedEntries.TryGetValue(configDefinition, out var text);
|
||||
if (!flag) return;
|
||||
Bind(newSection, newKey, defaultValue).SetSerializedValue(text);
|
||||
_orphanedEntries.Remove(configDefinition);
|
||||
LogManager.LogInfo(string.Concat("migration ", oldSection, ".", oldKey, "(", text, ") => ", newSection, ".", newKey));
|
||||
}
|
||||
|
||||
public static void Save(bool clearOrphanedEntries = false)
|
||||
{
|
||||
if (clearOrphanedEntries)
|
||||
{
|
||||
GetOrphanedEntries().Clear();
|
||||
}
|
||||
Config.Save();
|
||||
LogManager.LogInfo("save config.");
|
||||
}
|
||||
|
||||
public static void Clear()
|
||||
{
|
||||
Config.Clear();
|
||||
}
|
||||
|
||||
public static void Reload()
|
||||
{
|
||||
Config.Reload();
|
||||
}
|
||||
|
||||
private static ConfigManager _instance;
|
||||
|
||||
private static Dictionary<ConfigDefinition, string> _orphanedEntries;
|
||||
|
||||
public enum Step
|
||||
{
|
||||
Awake,
|
||||
GameMainBegin,
|
||||
UniverseGenCreateGalaxy,
|
||||
State,
|
||||
ChangeSeed
|
||||
}
|
||||
}
|
||||
17
AutoPilot/Commons/EnumUtils.cs
Normal file
17
AutoPilot/Commons/EnumUtils.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
|
||||
namespace AutoPilot.Commons;
|
||||
|
||||
internal static class EnumUtils
|
||||
{
|
||||
public static bool TryParse<TEnum>(string value, out TEnum result) where TEnum : struct
|
||||
{
|
||||
if (value == null || !Enum.IsDefined(typeof(TEnum), value))
|
||||
{
|
||||
result = (TEnum)Enum.GetValues(typeof(TEnum)).GetValue(0);
|
||||
return false;
|
||||
}
|
||||
result = (TEnum)Enum.Parse(typeof(TEnum), value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
34
AutoPilot/Commons/LogManager.cs
Normal file
34
AutoPilot/Commons/LogManager.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.Reflection;
|
||||
using BepInEx.Logging;
|
||||
|
||||
namespace AutoPilot.Commons;
|
||||
|
||||
internal static class LogManager
|
||||
{
|
||||
public static ManualLogSource Logger { private get; set; }
|
||||
|
||||
public static void LogInfo(object data)
|
||||
{
|
||||
Logger.LogInfo(data);
|
||||
}
|
||||
|
||||
public static void LogInfo(MethodBase method)
|
||||
{
|
||||
Logger.LogInfo(method.DeclaringType.Name + "." + method.Name);
|
||||
}
|
||||
|
||||
public static void LogInfo(MethodBase method, object data)
|
||||
{
|
||||
Logger.LogInfo(string.Concat(method.DeclaringType.Name, ".", method.Name, ": ", data?.ToString()));
|
||||
}
|
||||
|
||||
public static void LogError(object data)
|
||||
{
|
||||
Logger.LogError(data);
|
||||
}
|
||||
|
||||
public static void LogError(MethodBase method, object data)
|
||||
{
|
||||
Logger.LogError(string.Concat(method.DeclaringType.Name, ".", method.Name, ": ", data?.ToString()));
|
||||
}
|
||||
}
|
||||
7
AutoPilot/Enums/AutoPilotState.cs
Normal file
7
AutoPilot/Enums/AutoPilotState.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace AutoPilot.Enums;
|
||||
|
||||
public enum AutoPilotState
|
||||
{
|
||||
Active,
|
||||
Inactive
|
||||
}
|
||||
17
AutoPilot/Patches/Patch_VFInput.cs
Normal file
17
AutoPilot/Patches/Patch_VFInput.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using AutoPilot.Enums;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace AutoPilot.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(VFInput))]
|
||||
internal class Patch_VFInput
|
||||
{
|
||||
[HarmonyPatch("_sailSpeedUp", MethodType.Getter)]
|
||||
[HarmonyPostfix]
|
||||
public static void SailSpeedUp_Postfix(ref bool __result)
|
||||
{
|
||||
if (AutoPilotPlugin.State == AutoPilotState.Inactive) return;
|
||||
if (AutoPilotPlugin.InputSailSpeedUp)
|
||||
__result = true;
|
||||
}
|
||||
}
|
||||
176
AutoPilot/UI/AutoPilotConfigUI.cs
Normal file
176
AutoPilot/UI/AutoPilotConfigUI.cs
Normal file
@@ -0,0 +1,176 @@
|
||||
using System;
|
||||
using CruiseAssist.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AutoPilot.UI;
|
||||
|
||||
internal static class AutoPilotConfigUI
|
||||
{
|
||||
public static void OnGUI()
|
||||
{
|
||||
_wIdx = CruiseAssistMainUI.WIdx;
|
||||
Rect[_wIdx] = GUILayout.Window(99031292, Rect[_wIdx], WindowFunction, "AutoPilot - Config", CruiseAssistMainUI.WindowStyle, Array.Empty<GUILayoutOption>());
|
||||
var scale = CruiseAssistMainUI.Scale / 100f;
|
||||
if (Screen.width / scale < Rect[_wIdx].xMax)
|
||||
{
|
||||
Rect[_wIdx].x = Screen.width / scale - Rect[_wIdx].width;
|
||||
}
|
||||
|
||||
if (Rect[_wIdx].x < 0f)
|
||||
{
|
||||
Rect[_wIdx].x = 0f;
|
||||
}
|
||||
|
||||
if (Screen.height / scale < Rect[_wIdx].yMax)
|
||||
{
|
||||
Rect[_wIdx].y = Screen.height / scale - Rect[_wIdx].height;
|
||||
}
|
||||
|
||||
if (Rect[_wIdx].y < 0f)
|
||||
{
|
||||
Rect[_wIdx].y = 0f;
|
||||
}
|
||||
|
||||
if (LastCheckWindowLeft[_wIdx] != float.MinValue)
|
||||
{
|
||||
if (Rect[_wIdx].x != LastCheckWindowLeft[_wIdx] || Rect[_wIdx].y != LastCheckWindowTop[_wIdx])
|
||||
{
|
||||
AutoPilotMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
}
|
||||
LastCheckWindowLeft[_wIdx] = Rect[_wIdx].x;
|
||||
LastCheckWindowTop[_wIdx] = Rect[_wIdx].y;
|
||||
}
|
||||
|
||||
public static void WindowFunction(int windowId)
|
||||
{
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
var guistyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fontSize = 12,
|
||||
fixedHeight = 20f,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
};
|
||||
var guistyle2 = new GUIStyle(CruiseAssistMainUI.BaseTextFieldStyle)
|
||||
{
|
||||
fontSize = 12,
|
||||
fixedWidth = 60f
|
||||
};
|
||||
guistyle.fixedHeight = 20f;
|
||||
guistyle2.alignment = TextAnchor.MiddleRight;
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
guistyle.fixedWidth = 240f;
|
||||
GUILayout.Label("Min Energy Percent (0-100 default:20)".Translate(), guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.FlexibleSpace();
|
||||
SetValue(ref TempMinEnergyPer, GUILayout.TextField(TempMinEnergyPer, guistyle2, Array.Empty<GUILayoutOption>()), 0, 100, ref AutoPilotPlugin.Conf.MinEnergyPer);
|
||||
guistyle.fixedWidth = 20f;
|
||||
GUILayout.Label("%", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
guistyle.fixedWidth = 240f;
|
||||
GUILayout.Label("Max Speed (0-2000 default:2000)".Translate(), guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.FlexibleSpace();
|
||||
SetValue(ref TempMaxSpeed, GUILayout.TextField(TempMaxSpeed, guistyle2, Array.Empty<GUILayoutOption>()), 0, 2000, ref AutoPilotPlugin.Conf.MaxSpeed);
|
||||
guistyle.fixedWidth = 20f;
|
||||
GUILayout.Label("m/s", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
guistyle.fixedWidth = 240f;
|
||||
GUILayout.Label("Warp Min Range (1-60 default:2)".Translate(), guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.FlexibleSpace();
|
||||
SetValue(ref TempWarpMinRangeAU, GUILayout.TextArea(TempWarpMinRangeAU, guistyle2, Array.Empty<GUILayoutOption>()), 1, 60, ref AutoPilotPlugin.Conf.WarpMinRangeAU);
|
||||
guistyle.fixedWidth = 20f;
|
||||
GUILayout.Label("AU", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
guistyle.fixedWidth = 240f;
|
||||
GUILayout.Label("Speed to warp (0-2000 default:1200)".Translate(), guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.FlexibleSpace();
|
||||
SetValue(ref TempSpeedToWarp, GUILayout.TextArea(TempSpeedToWarp, guistyle2, Array.Empty<GUILayoutOption>()), 0, 2000, ref AutoPilotPlugin.Conf.SpeedToWarp);
|
||||
guistyle.fixedWidth = 20f;
|
||||
GUILayout.Label("m/s", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.EndHorizontal();
|
||||
var guistyle3 = new GUIStyle(CruiseAssistMainUI.BaseToggleStyle)
|
||||
{
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12,
|
||||
alignment = TextAnchor.LowerLeft
|
||||
};
|
||||
GUI.changed = false;
|
||||
AutoPilotPlugin.Conf.LocalWarpFlag = GUILayout.Toggle(AutoPilotPlugin.Conf.LocalWarpFlag, "Warp to planet in local system.".Translate(), guistyle3, Array.Empty<GUILayoutOption>());
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
AutoPilotMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUI.changed = false;
|
||||
AutoPilotPlugin.Conf.AutoStartFlag = GUILayout.Toggle(AutoPilotPlugin.Conf.AutoStartFlag, "Start AutoPilot when set target planet.".Translate(), guistyle3, Array.Empty<GUILayoutOption>());
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
AutoPilotMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUI.changed = false;
|
||||
AutoPilotPlugin.Conf.MainWindowJoinFlag = GUILayout.Toggle(AutoPilotPlugin.Conf.MainWindowJoinFlag, "Join AutoPilot window to CruiseAssist window.".Translate(), guistyle3, Array.Empty<GUILayoutOption>());
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
AutoPilotMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
if (GUI.Button(new Rect(Rect[_wIdx].width - 16f, 1f, 16f, 16f), "", CruiseAssistMainUI.CloseButtonStyle))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
Show[_wIdx] = false;
|
||||
}
|
||||
GUI.DragWindow();
|
||||
}
|
||||
|
||||
private static bool SetValue(ref string temp, string instr, int min, int max, ref int value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(instr))
|
||||
{
|
||||
temp = string.Empty;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!int.TryParse(instr, out var num)) return false;
|
||||
if (num < min)
|
||||
{
|
||||
num = min;
|
||||
}
|
||||
else if (max < num)
|
||||
{
|
||||
num = max;
|
||||
}
|
||||
value = num;
|
||||
temp = value.ToString();
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
private static int _wIdx;
|
||||
|
||||
public const float WindowWidth = 400f;
|
||||
|
||||
public const float WindowHeight = 400f;
|
||||
|
||||
public static readonly bool[] Show = new bool[2];
|
||||
|
||||
public static readonly Rect[] Rect = {
|
||||
new Rect(0f, 0f, 400f, 400f),
|
||||
new Rect(0f, 0f, 400f, 400f)
|
||||
};
|
||||
|
||||
private static readonly float[] LastCheckWindowLeft = { float.MinValue, float.MinValue };
|
||||
|
||||
private static readonly float[] LastCheckWindowTop = { float.MinValue, float.MinValue };
|
||||
|
||||
public static string TempMinEnergyPer;
|
||||
|
||||
public static string TempMaxSpeed;
|
||||
|
||||
public static string TempWarpMinRangeAU;
|
||||
|
||||
public static string TempSpeedToWarp;
|
||||
}
|
||||
139
AutoPilot/UI/AutoPilotDebugUI.cs
Normal file
139
AutoPilot/UI/AutoPilotDebugUI.cs
Normal file
@@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using AutoPilot.Commons;
|
||||
using CruiseAssist;
|
||||
using CruiseAssist.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AutoPilot.UI;
|
||||
|
||||
internal class AutoPilotDebugUI
|
||||
{
|
||||
public static void OnGUI()
|
||||
{
|
||||
var guistyle = new GUIStyle(GUI.skin.window)
|
||||
{
|
||||
fontSize = 11
|
||||
};
|
||||
Rect = GUILayout.Window(99031293, Rect, WindowFunction, "AutoPilot - Debug", guistyle, Array.Empty<GUILayoutOption>());
|
||||
var num = CruiseAssistMainUI.Scale / 100f;
|
||||
var flag = Screen.width < Rect.xMax;
|
||||
if (flag)
|
||||
{
|
||||
Rect.x = Screen.width - Rect.width;
|
||||
}
|
||||
var flag2 = Rect.x < 0f;
|
||||
if (flag2)
|
||||
{
|
||||
Rect.x = 0f;
|
||||
}
|
||||
var flag3 = Screen.height < Rect.yMax;
|
||||
if (flag3)
|
||||
{
|
||||
Rect.y = Screen.height - Rect.height;
|
||||
}
|
||||
var flag4 = Rect.y < 0f;
|
||||
if (flag4)
|
||||
{
|
||||
Rect.y = 0f;
|
||||
}
|
||||
var flag5 = lastCheckWindowLeft != float.MinValue;
|
||||
if (flag5)
|
||||
{
|
||||
var flag6 = Rect.x != lastCheckWindowLeft || Rect.y != lastCheckWindowTop;
|
||||
if (flag6)
|
||||
{
|
||||
AutoPilotMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
}
|
||||
lastCheckWindowLeft = Rect.x;
|
||||
lastCheckWindowTop = Rect.y;
|
||||
var flag7 = AutoPilotMainUI.NextCheckGameTick <= GameMain.gameTick;
|
||||
if (flag7)
|
||||
{
|
||||
ConfigManager.CheckConfig(ConfigManager.Step.State);
|
||||
}
|
||||
}
|
||||
|
||||
public static void WindowFunction(int windowId)
|
||||
{
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
var guistyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fontSize = 12
|
||||
};
|
||||
scrollPos = GUILayout.BeginScrollView(scrollPos, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.uPosition={GameMain.mainPlayer.uPosition}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
var flag = GameMain.localPlanet != null && CruiseAssistPlugin.TargetUPos != VectorLF3.zero;
|
||||
if (flag)
|
||||
{
|
||||
var mainPlayer = GameMain.mainPlayer;
|
||||
var targetUPos = CruiseAssistPlugin.TargetUPos;
|
||||
var magnitude = (targetUPos - mainPlayer.uPosition).magnitude;
|
||||
var magnitude2 = (targetUPos - GameMain.localPlanet.uPosition).magnitude;
|
||||
var vectorLF = mainPlayer.uPosition - GameMain.localPlanet.uPosition;
|
||||
var vectorLF2 = CruiseAssistPlugin.TargetUPos - GameMain.localPlanet.uPosition;
|
||||
GUILayout.Label("range1=" + RangeToString(magnitude), guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label("range2=" + RangeToString(magnitude2), guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"range1>range2={magnitude > magnitude2}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"angle={Vector3.Angle(vectorLF, vectorLF2)}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
}
|
||||
var mecha = GameMain.mainPlayer.mecha;
|
||||
GUILayout.Label($"mecha.coreEnergy={mecha.coreEnergy}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"mecha.coreEnergyCap={mecha.coreEnergyCap}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
var num = mecha.coreEnergy / mecha.coreEnergyCap * 100.0;
|
||||
GUILayout.Label($"energyPer={num}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
var magnitude3 = GameMain.mainPlayer.controller.actionSail.visual_uvel.magnitude;
|
||||
GUILayout.Label("spped=" + RangeToString(magnitude3), guistyle, Array.Empty<GUILayoutOption>());
|
||||
var movementStateInFrame = GameMain.mainPlayer.controller.movementStateInFrame;
|
||||
GUILayout.Label($"movementStateInFrame={movementStateInFrame}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
var guistyle2 = new GUIStyle(GUI.skin.toggle)
|
||||
{
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12,
|
||||
alignment = TextAnchor.LowerLeft
|
||||
};
|
||||
GUI.changed = false;
|
||||
AutoPilotPlugin.Conf.IgnoreGravityFlag = GUILayout.Toggle(AutoPilotPlugin.Conf.IgnoreGravityFlag, "Ignore gravity.", guistyle2, Array.Empty<GUILayoutOption>());
|
||||
var changed = GUI.changed;
|
||||
if (changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
}
|
||||
GUILayout.EndScrollView();
|
||||
GUILayout.EndVertical();
|
||||
GUI.DragWindow();
|
||||
}
|
||||
|
||||
public static string RangeToString(double range)
|
||||
{
|
||||
var flag = range < 10000.0;
|
||||
string text;
|
||||
if (flag)
|
||||
{
|
||||
text = ((int)(range + 0.5)) + "m ";
|
||||
}
|
||||
else
|
||||
{
|
||||
var flag2 = range < 600000.0;
|
||||
if (flag2)
|
||||
{
|
||||
text = (range / 40000.0).ToString("0.00") + "AU";
|
||||
}
|
||||
else
|
||||
{
|
||||
text = (range / 2400000.0).ToString("0.00") + "Ly";
|
||||
}
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
public static bool Show = false;
|
||||
|
||||
public static Rect Rect = new Rect(0f, 0f, 400f, 400f);
|
||||
|
||||
private static float lastCheckWindowLeft = float.MinValue;
|
||||
|
||||
private static float lastCheckWindowTop = float.MinValue;
|
||||
|
||||
private static Vector2 scrollPos = Vector2.zero;
|
||||
}
|
||||
195
AutoPilot/UI/AutoPilotMainUI.cs
Normal file
195
AutoPilot/UI/AutoPilotMainUI.cs
Normal file
@@ -0,0 +1,195 @@
|
||||
using System;
|
||||
using AutoPilot.Commons;
|
||||
using AutoPilot.Enums;
|
||||
using CruiseAssist;
|
||||
using CruiseAssist.Enums;
|
||||
using CruiseAssist.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AutoPilot.UI;
|
||||
|
||||
internal class AutoPilotMainUI
|
||||
{
|
||||
public static void OnGUI()
|
||||
{
|
||||
wIdx = CruiseAssistMainUI.WIdx;
|
||||
var viewMode = CruiseAssistMainUI.ViewMode;
|
||||
var cruiseAssistMainUIViewMode = viewMode;
|
||||
if (cruiseAssistMainUIViewMode != CruiseAssistMainUIViewMode.Full)
|
||||
{
|
||||
if (cruiseAssistMainUIViewMode == CruiseAssistMainUIViewMode.Mini)
|
||||
{
|
||||
Rect[wIdx].width = CruiseAssistMainUI.Rect[wIdx].width;
|
||||
Rect[wIdx].height = 70f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Rect[wIdx].width = CruiseAssistMainUI.Rect[wIdx].width;
|
||||
Rect[wIdx].height = 150f;
|
||||
}
|
||||
var guistyle = new GUIStyle(CruiseAssistMainUI.WindowStyle)
|
||||
{
|
||||
fontSize = 11
|
||||
};
|
||||
Rect[wIdx] = GUILayout.Window(99031291, Rect[wIdx], WindowFunction, "AutoPilot", guistyle, Array.Empty<GUILayoutOption>());
|
||||
var num = CruiseAssistMainUI.Scale / 100f;
|
||||
var mainWindowJoinFlag = AutoPilotPlugin.Conf.MainWindowJoinFlag;
|
||||
if (mainWindowJoinFlag)
|
||||
{
|
||||
Rect[wIdx].x = CruiseAssistMainUI.Rect[CruiseAssistMainUI.WIdx].x;
|
||||
Rect[wIdx].y = CruiseAssistMainUI.Rect[CruiseAssistMainUI.WIdx].yMax;
|
||||
}
|
||||
var flag = Screen.width / num < Rect[wIdx].xMax;
|
||||
if (flag)
|
||||
{
|
||||
Rect[wIdx].x = Screen.width / num - Rect[wIdx].width;
|
||||
}
|
||||
var flag2 = Rect[wIdx].x < 0f;
|
||||
if (flag2)
|
||||
{
|
||||
Rect[wIdx].x = 0f;
|
||||
}
|
||||
var flag3 = Screen.height / num < Rect[wIdx].yMax;
|
||||
if (flag3)
|
||||
{
|
||||
Rect[wIdx].y = Screen.height / num - Rect[wIdx].height;
|
||||
}
|
||||
var flag4 = Rect[wIdx].y < 0f;
|
||||
if (flag4)
|
||||
{
|
||||
Rect[wIdx].y = 0f;
|
||||
}
|
||||
var flag5 = lastCheckWindowLeft[wIdx] != float.MinValue;
|
||||
if (flag5)
|
||||
{
|
||||
var flag6 = Rect[wIdx].x != lastCheckWindowLeft[wIdx] || Rect[wIdx].y != lastCheckWindowTop[wIdx];
|
||||
if (flag6)
|
||||
{
|
||||
NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
}
|
||||
lastCheckWindowLeft[wIdx] = Rect[wIdx].x;
|
||||
lastCheckWindowTop[wIdx] = Rect[wIdx].y;
|
||||
var flag7 = NextCheckGameTick <= GameMain.gameTick;
|
||||
if (flag7)
|
||||
{
|
||||
ConfigManager.CheckConfig(ConfigManager.Step.State);
|
||||
}
|
||||
}
|
||||
|
||||
public static void WindowFunction(int windowId)
|
||||
{
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
var flag = CruiseAssistMainUI.ViewMode == CruiseAssistMainUIViewMode.Full;
|
||||
if (flag)
|
||||
{
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
var guistyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fontSize = 12
|
||||
};
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
var text = ((AutoPilotPlugin.State == AutoPilotState.Inactive) ? "---" : ((AutoPilotPlugin.Conf.MinEnergyPer < AutoPilotPlugin.EnergyPer) ? "OK" : "NG"));
|
||||
guistyle.normal.textColor = ((text == "OK") ? Color.cyan : ((text == "NG") ? Color.red : Color.white));
|
||||
GUILayout.Label("Energy : " + text, guistyle, Array.Empty<GUILayoutOption>());
|
||||
var text2 = ((AutoPilotPlugin.State == AutoPilotState.Inactive) ? "---" : ((CruiseAssistPlugin.TargetStar == null) ? "---" : (GameMain.mainPlayer.warping ? "---" : ((!AutoPilotPlugin.Conf.LocalWarpFlag && GameMain.localStar != null && CruiseAssistPlugin.TargetStar.id == GameMain.localStar.id) ? "---" : ((CruiseAssistPlugin.TargetRange < (double)(AutoPilotPlugin.Conf.WarpMinRangeAU * 40000)) ? "---" : ((AutoPilotPlugin.WarperCount < 1) ? "NG" : "OK"))))));
|
||||
guistyle.normal.textColor = ((text2 == "OK") ? Color.cyan : ((text2 == "NG") ? Color.red : Color.white));
|
||||
GUILayout.Label("Warper : " + text2, guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
var text3 = ((AutoPilotPlugin.State == AutoPilotState.Inactive) ? "---" : (AutoPilotPlugin.LeavePlanet ? "ON" : "OFF"));
|
||||
guistyle.normal.textColor = ((text3 == "ON") ? Color.cyan : Color.white);
|
||||
GUILayout.Label("Leave Planet : " + text3, guistyle, Array.Empty<GUILayoutOption>());
|
||||
var text4 = ((AutoPilotPlugin.State == AutoPilotState.Inactive) ? "---" : (AutoPilotPlugin.SpeedUp ? "ON" : "OFF"));
|
||||
guistyle.normal.textColor = ((text4 == "ON") ? Color.cyan : Color.white);
|
||||
GUILayout.Label("Spee UP : " + text4, guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
}
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
var guistyle2 = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 160f,
|
||||
fixedHeight = 32f,
|
||||
fontSize = 14,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
};
|
||||
var flag2 = AutoPilotPlugin.State == AutoPilotState.Inactive;
|
||||
if (flag2)
|
||||
{
|
||||
GUILayout.Label("Auto Pilot Inactive.", guistyle2, Array.Empty<GUILayoutOption>());
|
||||
}
|
||||
else
|
||||
{
|
||||
guistyle2.normal.textColor = Color.cyan;
|
||||
GUILayout.Label("Auto Pilot Active.", guistyle2, Array.Empty<GUILayoutOption>());
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
var guistyle3 = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle)
|
||||
{
|
||||
fixedWidth = 50f,
|
||||
fixedHeight = 18f,
|
||||
fontSize = 11,
|
||||
alignment = TextAnchor.MiddleCenter
|
||||
};
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
var flag3 = GUILayout.Button("Config", guistyle3, Array.Empty<GUILayoutOption>());
|
||||
if (flag3)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
var show = AutoPilotConfigUI.Show;
|
||||
var num = wIdx;
|
||||
show[num] = !show[num];
|
||||
var flag4 = AutoPilotConfigUI.Show[wIdx];
|
||||
if (flag4)
|
||||
{
|
||||
AutoPilotConfigUI.TempMinEnergyPer = AutoPilotPlugin.Conf.MinEnergyPer.ToString();
|
||||
AutoPilotConfigUI.TempMaxSpeed = AutoPilotPlugin.Conf.MaxSpeed.ToString();
|
||||
AutoPilotConfigUI.TempWarpMinRangeAU = AutoPilotPlugin.Conf.WarpMinRangeAU.ToString();
|
||||
AutoPilotConfigUI.TempSpeedToWarp = AutoPilotPlugin.Conf.SpeedToWarp.ToString();
|
||||
}
|
||||
}
|
||||
var flag5 = GUILayout.Button("Start", guistyle3, Array.Empty<GUILayoutOption>());
|
||||
if (flag5)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
AutoPilotPlugin.State = AutoPilotState.Active;
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Button("-", guistyle3, Array.Empty<GUILayoutOption>());
|
||||
var flag6 = GUILayout.Button("Stop", guistyle3, Array.Empty<GUILayoutOption>());
|
||||
if (flag6)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
AutoPilotPlugin.State = AutoPilotState.Inactive;
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
GUI.DragWindow();
|
||||
}
|
||||
|
||||
private static int wIdx;
|
||||
|
||||
public const float WindowWidthFull = 398f;
|
||||
|
||||
public const float WindowHeightFull = 150f;
|
||||
|
||||
public const float WindowWidthMini = 288f;
|
||||
|
||||
public const float WindowHeightMini = 70f;
|
||||
|
||||
public static Rect[] Rect = {
|
||||
new Rect(0f, 0f, 398f, 150f),
|
||||
new Rect(0f, 0f, 398f, 150f)
|
||||
};
|
||||
|
||||
private static float[] lastCheckWindowLeft = { float.MinValue, float.MinValue };
|
||||
|
||||
private static float[] lastCheckWindowTop = { float.MinValue, float.MinValue };
|
||||
|
||||
public static long NextCheckGameTick = long.MaxValue;
|
||||
}
|
||||
BIN
AutoPilot/package/icon.png
Normal file
BIN
AutoPilot/package/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
10
AutoPilot/package/manifest.json
Normal file
10
AutoPilot/package/manifest.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "AutoPilot",
|
||||
"version_number": "0.0.4",
|
||||
"website_url": "https://github.com/tanukinomori/DSPMod",
|
||||
"description": "Auto pilot to a planet or star system.",
|
||||
"dependencies": [
|
||||
"xiaoye97-BepInEx-5.4.17",
|
||||
"tanu-CruiseAssist-0.0.37"
|
||||
]
|
||||
}
|
||||
157
CruiseAssist/Commons/ConfigManager.cs
Normal file
157
CruiseAssist/Commons/ConfigManager.cs
Normal file
@@ -0,0 +1,157 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace CruiseAssist.Commons;
|
||||
|
||||
internal abstract class ConfigManager
|
||||
{
|
||||
public static ConfigFile Config { get; private set; }
|
||||
|
||||
protected ConfigManager(ConfigFile config)
|
||||
{
|
||||
_instance = this;
|
||||
Config = config;
|
||||
Config.SaveOnConfigSet = false;
|
||||
}
|
||||
|
||||
public static void CheckConfig(Step step)
|
||||
{
|
||||
_instance.CheckConfigImplements(step);
|
||||
}
|
||||
|
||||
protected abstract void CheckConfigImplements(Step step);
|
||||
|
||||
public static ConfigEntry<T> Bind<T>(ConfigDefinition configDefinition, T defaultValue, ConfigDescription configDescription = null)
|
||||
{
|
||||
return Config.Bind(configDefinition, defaultValue, configDescription);
|
||||
}
|
||||
|
||||
public static ConfigEntry<T> Bind<T>(string section, string key, T defaultValue, ConfigDescription configDescription = null)
|
||||
{
|
||||
return Config.Bind(section, key, defaultValue, configDescription);
|
||||
}
|
||||
|
||||
public static ConfigEntry<T> Bind<T>(string section, string key, T defaultValue, string description)
|
||||
{
|
||||
return Config.Bind(section, key, defaultValue, description);
|
||||
}
|
||||
|
||||
public static ConfigEntry<T> GetEntry<T>(ConfigDefinition configDefinition)
|
||||
{
|
||||
ConfigEntry<T> configEntry;
|
||||
try
|
||||
{
|
||||
configEntry = (ConfigEntry<T>)Config[configDefinition];
|
||||
}
|
||||
catch (KeyNotFoundException ex)
|
||||
{
|
||||
LogManager.LogError($"{ex.GetType()}: configDefinition={configDefinition}");
|
||||
throw;
|
||||
}
|
||||
return configEntry;
|
||||
}
|
||||
|
||||
public static ConfigEntry<T> GetEntry<T>(string section, string key)
|
||||
{
|
||||
return GetEntry<T>(new ConfigDefinition(section, key));
|
||||
}
|
||||
|
||||
public static T GetValue<T>(ConfigDefinition configDefinition)
|
||||
{
|
||||
return GetEntry<T>(configDefinition).Value;
|
||||
}
|
||||
|
||||
public static T GetValue<T>(string section, string key)
|
||||
{
|
||||
return GetEntry<T>(section, key).Value;
|
||||
}
|
||||
|
||||
public static bool ContainsKey(ConfigDefinition configDefinition)
|
||||
{
|
||||
return Config.ContainsKey(configDefinition);
|
||||
}
|
||||
|
||||
public static bool ContainsKey(string section, string key)
|
||||
{
|
||||
return Config.ContainsKey(new ConfigDefinition(section, key));
|
||||
}
|
||||
|
||||
public static bool UpdateEntry<T>(string section, string key, T value) where T : IComparable
|
||||
{
|
||||
var entry = GetEntry<T>(section, key);
|
||||
var value2 = entry.Value;
|
||||
var flag = value2.CompareTo(value) == 0;
|
||||
bool flag2;
|
||||
if (flag)
|
||||
{
|
||||
flag2 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
entry.Value = value;
|
||||
flag2 = true;
|
||||
}
|
||||
return flag2;
|
||||
}
|
||||
|
||||
public static bool RemoveEntry(ConfigDefinition key)
|
||||
{
|
||||
return Config.Remove(key);
|
||||
}
|
||||
|
||||
public static Dictionary<ConfigDefinition, string> GetOrphanedEntries()
|
||||
{
|
||||
var flag = _orphanedEntries == null;
|
||||
if (flag)
|
||||
{
|
||||
_orphanedEntries = Traverse.Create(Config).Property<Dictionary<ConfigDefinition, string>>("OrphanedEntries").Value;
|
||||
}
|
||||
return _orphanedEntries;
|
||||
}
|
||||
|
||||
public static void Migration<T>(string newSection, string newKey, T defaultValue, string oldSection, string oldKey)
|
||||
{
|
||||
GetOrphanedEntries();
|
||||
var configDefinition = new ConfigDefinition(oldSection, oldKey);
|
||||
var flag = _orphanedEntries.TryGetValue(configDefinition, out var text);
|
||||
if (!flag) return;
|
||||
Bind(newSection, newKey, defaultValue).SetSerializedValue(text);
|
||||
_orphanedEntries.Remove(configDefinition);
|
||||
LogManager.LogInfo(string.Concat("migration ", oldSection, ".", oldKey, "(", text, ") => ", newSection, ".", newKey));
|
||||
}
|
||||
|
||||
public static void Save(bool clearOrphanedEntries = false)
|
||||
{
|
||||
if (clearOrphanedEntries)
|
||||
{
|
||||
GetOrphanedEntries().Clear();
|
||||
}
|
||||
Config.Save();
|
||||
LogManager.LogInfo("save config.");
|
||||
}
|
||||
|
||||
public static void Clear()
|
||||
{
|
||||
Config.Clear();
|
||||
}
|
||||
|
||||
public static void Reload()
|
||||
{
|
||||
Config.Reload();
|
||||
}
|
||||
|
||||
private static ConfigManager _instance;
|
||||
|
||||
private static Dictionary<ConfigDefinition, string> _orphanedEntries;
|
||||
|
||||
public enum Step
|
||||
{
|
||||
Awake,
|
||||
GameMainBegin,
|
||||
UniverseGenCreateGalaxy,
|
||||
State,
|
||||
ChangeSeed
|
||||
}
|
||||
}
|
||||
17
CruiseAssist/Commons/EnumUtils.cs
Normal file
17
CruiseAssist/Commons/EnumUtils.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
|
||||
namespace CruiseAssist.Commons;
|
||||
|
||||
internal static class EnumUtils
|
||||
{
|
||||
public static bool TryParse<TEnum>(string value, out TEnum result) where TEnum : struct
|
||||
{
|
||||
if (value == null || !Enum.IsDefined(typeof(TEnum), value))
|
||||
{
|
||||
result = (TEnum)Enum.GetValues(typeof(TEnum)).GetValue(0);
|
||||
return false;
|
||||
}
|
||||
result = (TEnum)Enum.Parse(typeof(TEnum), value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
29
CruiseAssist/Commons/ListUtils.cs
Normal file
29
CruiseAssist/Commons/ListUtils.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace CruiseAssist.Commons;
|
||||
|
||||
internal static class ListUtils
|
||||
{
|
||||
public static string ToString(List<int> list)
|
||||
{
|
||||
return list == null || list.Count == 0 ? "" : list.Select(id => id.ToString()).Aggregate((a, b) => a + "," + b);
|
||||
}
|
||||
|
||||
public static string ToString(List<string> list)
|
||||
{
|
||||
return list == null || list.Count == 0 ? "" : list.Aggregate((a, b) => a + "," + b);
|
||||
}
|
||||
|
||||
public static List<int> ParseToIntList(string str)
|
||||
{
|
||||
return string.IsNullOrEmpty(str)
|
||||
? []
|
||||
: str.Split(',').Where(s => int.TryParse(s, out _)).Select(int.Parse).ToList();
|
||||
}
|
||||
|
||||
public static List<string> ParseToStringList(string str)
|
||||
{
|
||||
return string.IsNullOrEmpty(str) ? [] : str.Split(',').ToList();
|
||||
}
|
||||
}
|
||||
34
CruiseAssist/Commons/LogManager.cs
Normal file
34
CruiseAssist/Commons/LogManager.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.Reflection;
|
||||
using BepInEx.Logging;
|
||||
|
||||
namespace CruiseAssist.Commons;
|
||||
|
||||
internal static class LogManager
|
||||
{
|
||||
public static ManualLogSource Logger { private get; set; }
|
||||
|
||||
public static void LogInfo(object data)
|
||||
{
|
||||
Logger.LogInfo(data);
|
||||
}
|
||||
|
||||
public static void LogInfo(MethodBase method)
|
||||
{
|
||||
Logger.LogInfo(method.DeclaringType.Name + "." + method.Name);
|
||||
}
|
||||
|
||||
public static void LogInfo(MethodBase method, object data)
|
||||
{
|
||||
Logger.LogInfo(string.Concat(method.DeclaringType.Name, ".", method.Name, ": ", data?.ToString()));
|
||||
}
|
||||
|
||||
public static void LogError(object data)
|
||||
{
|
||||
Logger.LogError(data);
|
||||
}
|
||||
|
||||
public static void LogError(MethodBase method, object data)
|
||||
{
|
||||
Logger.LogError(string.Concat(method.DeclaringType.Name, ".", method.Name, ": ", data?.ToString()));
|
||||
}
|
||||
}
|
||||
8
CruiseAssist/Commons/Tuple.cs
Normal file
8
CruiseAssist/Commons/Tuple.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace CruiseAssist.Commons;
|
||||
|
||||
internal struct Tuple<T1, T2>(T1 v1, T2 v2)
|
||||
{
|
||||
public T1 Item1 { get; set; } = v1;
|
||||
|
||||
public T2 Item2 { get; set; } = v2;
|
||||
}
|
||||
29
CruiseAssist/CruiseAssist.csproj
Normal file
29
CruiseAssist/CruiseAssist.csproj
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<AssemblyName>CruiseAssist</AssemblyName>
|
||||
<BepInExPluginGuid>tanu.CruiseAssist</BepInExPluginGuid>
|
||||
<Description>DSP MOD - CruiseAssist</Description>
|
||||
<Version>0.0.37</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">
|
||||
<Exec Command="del /F /Q package\$(ProjectName)-$(Version).zip
zip -9 -j package/$(ProjectName)-$(Version).zip $(TargetPath) package/icon.png package/manifest.json README.md" />
|
||||
</Target>
|
||||
</Project>
|
||||
116
CruiseAssist/CruiseAssistConfigManager.cs
Normal file
116
CruiseAssist/CruiseAssistConfigManager.cs
Normal file
@@ -0,0 +1,116 @@
|
||||
using System.Collections.Generic;
|
||||
using BepInEx.Configuration;
|
||||
using CruiseAssist.Commons;
|
||||
using CruiseAssist.Enums;
|
||||
using CruiseAssist.UI;
|
||||
|
||||
namespace CruiseAssist;
|
||||
|
||||
internal class CruiseAssistConfigManager(ConfigFile config) : ConfigManager(config)
|
||||
{
|
||||
|
||||
protected override void CheckConfigImplements(Step step)
|
||||
{
|
||||
var saveFlag = false;
|
||||
if (step == Step.Awake)
|
||||
{
|
||||
var configEntry = Bind("Base", "ModVersion", "0.0.37", "Don't change.");
|
||||
configEntry.Value = "0.0.37";
|
||||
Migration("State", "MainWindow0Left", 100, "State", "InfoWindowLeft");
|
||||
Migration("State", "MainWindow0Top", 100, "State", "InfoWindowTop");
|
||||
Migration("State", "MainWindow0Left", 100, "State", "MainWindowLeft");
|
||||
Migration("State", "MainWindow0Top", 100, "State", "MainWindowTop");
|
||||
Migration("State", "StarListWindow0Left", 100, "State", "StarListWindowLeft");
|
||||
Migration("State", "StarListWindow0Top", 100, "State", "StarListWindowTop");
|
||||
Migration("Setting", "CloseStarListWhenSetTargetPlanet", false, "Setting", "HideStarListWhenSetTargetPlanet");
|
||||
saveFlag = true;
|
||||
}
|
||||
if (step is Step.Awake or Step.GameMainBegin)
|
||||
{
|
||||
CruiseAssistDebugUI.Show = Bind("Debug", "DebugWindowShow", false).Value;
|
||||
CruiseAssistPlugin.Enable = Bind("Setting", "Enable", true).Value;
|
||||
CruiseAssistPlugin.Conf.MarkVisitedFlag = Bind("Setting", "MarkVisited", true).Value;
|
||||
CruiseAssistPlugin.Conf.SelectFocusFlag = Bind("Setting", "SelectFocus", true).Value;
|
||||
CruiseAssistPlugin.Conf.HideDuplicateHistoryFlag = Bind("Setting", "HideDuplicateHistory", true).Value;
|
||||
CruiseAssistPlugin.Conf.AutoDisableLockCursorFlag = Bind("Setting", "AutoDisableLockCursor", false).Value;
|
||||
CruiseAssistPlugin.Conf.ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag = Bind("Setting", "ShowMainWindowWhenTargetSelectedEvenNotSailMode", true).Value;
|
||||
CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag = Bind("Setting", "CloseStarListWhenSetTargetPlanet", false).Value;
|
||||
CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag = Bind("Setting", "HideBottomCloseButton", true).Value;
|
||||
CruiseAssistMainUI.Scale = Bind("Setting", "UIScale", 150).Value;
|
||||
var viewModeStr = Bind("Setting", "MainWindowViewMode", CruiseAssistMainUIViewMode.Full.ToString()).Value;
|
||||
EnumUtils.TryParse(viewModeStr, out CruiseAssistMainUI.ViewMode);
|
||||
for (var i = 0; i < 2; i++)
|
||||
{
|
||||
CruiseAssistMainUI.Rect[i].x = Bind("State", $"MainWindow{i}Left", 100).Value;
|
||||
CruiseAssistMainUI.Rect[i].y = Bind("State", $"MainWindow{i}Top", 100).Value;
|
||||
CruiseAssistStarListUI.Rect[i].x = Bind("State", $"StarListWindow{i}Left", 100).Value;
|
||||
CruiseAssistStarListUI.Rect[i].y = Bind("State", $"StarListWindow{i}Top", 100).Value;
|
||||
CruiseAssistConfigUI.Rect[i].x = Bind("State", $"ConfigWindow{i}Left", 100).Value;
|
||||
CruiseAssistConfigUI.Rect[i].y = Bind("State", $"ConfigWindow{i}Top", 100).Value;
|
||||
}
|
||||
CruiseAssistStarListUI.ListSelected = Bind("State", "StarListWindowListSelected", 0).Value;
|
||||
CruiseAssistDebugUI.Rect.x = Bind("State", "DebugWindowLeft", 100).Value;
|
||||
CruiseAssistDebugUI.Rect.y = Bind("State", "DebugWindowTop", 100).Value;
|
||||
}
|
||||
if (step is Step.Awake or Step.GameMainBegin or Step.State or Step.ChangeSeed)
|
||||
{
|
||||
if (DSPGame.IsMenuDemo || GameMain.galaxy == null)
|
||||
{
|
||||
var flag6 = CruiseAssistPlugin.Seed != -1;
|
||||
if (flag6)
|
||||
{
|
||||
CruiseAssistPlugin.Seed = -1;
|
||||
CruiseAssistPlugin.History = new List<int>();
|
||||
CruiseAssistPlugin.Bookmark = new List<int>();
|
||||
LogManager.LogInfo("clear seed.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CruiseAssistPlugin.Seed != GameMain.galaxy.seed)
|
||||
{
|
||||
CruiseAssistPlugin.Seed = GameMain.galaxy.seed;
|
||||
CruiseAssistPlugin.History = ListUtils.ParseToIntList(Bind("Save", $"History_{CruiseAssistPlugin.Seed}", "").Value);
|
||||
CruiseAssistPlugin.Bookmark = ListUtils.ParseToIntList(Bind("Save", $"Bookmark_{CruiseAssistPlugin.Seed}", "").Value);
|
||||
LogManager.LogInfo($"change seed {CruiseAssistPlugin.Seed}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (step == Step.State)
|
||||
{
|
||||
LogManager.LogInfo("check state.");
|
||||
saveFlag |= UpdateEntry("Setting", "Enable", CruiseAssistPlugin.Enable);
|
||||
saveFlag |= UpdateEntry("Setting", "MarkVisited", CruiseAssistPlugin.Conf.MarkVisitedFlag);
|
||||
saveFlag |= UpdateEntry("Setting", "SelectFocus", CruiseAssistPlugin.Conf.SelectFocusFlag);
|
||||
saveFlag |= UpdateEntry("Setting", "HideDuplicateHistory", CruiseAssistPlugin.Conf.HideDuplicateHistoryFlag);
|
||||
saveFlag |= UpdateEntry("Setting", "AutoDisableLockCursor", CruiseAssistPlugin.Conf.AutoDisableLockCursorFlag);
|
||||
saveFlag |= UpdateEntry("Setting", "ShowMainWindowWhenTargetSelectedEvenNotSailMode", CruiseAssistPlugin.Conf.ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag);
|
||||
saveFlag |= UpdateEntry("Setting", "CloseStarListWhenSetTargetPlanet", CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag);
|
||||
saveFlag |= UpdateEntry("Setting", "HideBottomCloseButton", CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag);
|
||||
saveFlag |= UpdateEntry("Setting", "UIScale", (int)CruiseAssistMainUI.Scale);
|
||||
saveFlag |= UpdateEntry("Setting", "MainWindowViewMode", CruiseAssistMainUI.ViewMode.ToString());
|
||||
for (var j = 0; j < 2; j++)
|
||||
{
|
||||
saveFlag |= UpdateEntry("State", $"MainWindow{j}Left", (int)CruiseAssistMainUI.Rect[j].x);
|
||||
saveFlag |= UpdateEntry("State", $"MainWindow{j}Top", (int)CruiseAssistMainUI.Rect[j].y);
|
||||
saveFlag |= UpdateEntry("State", $"StarListWindow{j}Left", (int)CruiseAssistStarListUI.Rect[j].x);
|
||||
saveFlag |= UpdateEntry("State", $"StarListWindow{j}Top", (int)CruiseAssistStarListUI.Rect[j].y);
|
||||
saveFlag |= UpdateEntry("State", $"ConfigWindow{j}Left", (int)CruiseAssistConfigUI.Rect[j].x);
|
||||
saveFlag |= UpdateEntry("State", $"ConfigWindow{j}Top", (int)CruiseAssistConfigUI.Rect[j].y);
|
||||
}
|
||||
saveFlag |= UpdateEntry("State", "StarListWindowListSelected", CruiseAssistStarListUI.ListSelected);
|
||||
saveFlag |= UpdateEntry("State", "DebugWindowLeft", (int)CruiseAssistDebugUI.Rect.x);
|
||||
saveFlag |= UpdateEntry("State", "DebugWindowTop", (int)CruiseAssistDebugUI.Rect.y);
|
||||
if (CruiseAssistPlugin.Seed != -1)
|
||||
{
|
||||
saveFlag |= UpdateEntry("Save", $"History_{CruiseAssistPlugin.Seed}", ListUtils.ToString(CruiseAssistPlugin.History));
|
||||
saveFlag |= UpdateEntry("Save", $"Bookmark_{CruiseAssistPlugin.Seed}", ListUtils.ToString(CruiseAssistPlugin.Bookmark));
|
||||
}
|
||||
CruiseAssistMainUI.NextCheckGameTick = long.MaxValue;
|
||||
}
|
||||
if (saveFlag)
|
||||
{
|
||||
Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
22
CruiseAssist/CruiseAssistExtensionAPI.cs
Normal file
22
CruiseAssist/CruiseAssistExtensionAPI.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace CruiseAssist;
|
||||
|
||||
public interface ICruiseAssistExtensionAPI
|
||||
{
|
||||
void CheckConfig(string step);
|
||||
|
||||
void SetTargetAstroId(int astroId);
|
||||
|
||||
bool OperateWalk(PlayerMove_Walk __instance);
|
||||
|
||||
bool OperateDrift(PlayerMove_Drift __instance);
|
||||
|
||||
bool OperateFly(PlayerMove_Fly __instance);
|
||||
|
||||
bool OperateSail(PlayerMove_Sail __instance);
|
||||
|
||||
void SetInactive();
|
||||
|
||||
void CancelOperate();
|
||||
|
||||
void OnGUI();
|
||||
}
|
||||
167
CruiseAssist/CruiseAssistPlugin.cs
Normal file
167
CruiseAssist/CruiseAssistPlugin.cs
Normal file
@@ -0,0 +1,167 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BepInEx;
|
||||
using CruiseAssist.Commons;
|
||||
using CruiseAssist.Enums;
|
||||
using CruiseAssist.Patches;
|
||||
using CruiseAssist.UI;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace CruiseAssist;
|
||||
|
||||
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
||||
public class CruiseAssistPlugin : BaseUnityPlugin
|
||||
{
|
||||
public void Awake()
|
||||
{
|
||||
LogManager.Logger = Logger;
|
||||
new CruiseAssistConfigManager(Config);
|
||||
ConfigManager.CheckConfig(ConfigManager.Step.Awake);
|
||||
_harmony = new Harmony("tanu.CruiseAssist.Patch");
|
||||
_harmony.PatchAll(typeof(Patch_GameMain));
|
||||
_harmony.PatchAll(typeof(Patch_UISailPanel));
|
||||
_harmony.PatchAll(typeof(Patch_UIStarmap));
|
||||
_harmony.PatchAll(typeof(Patch_UITechTree));
|
||||
_harmony.PatchAll(typeof(Patch_PlayerMoveWalk));
|
||||
_harmony.PatchAll(typeof(Patch_PlayerMoveDrift));
|
||||
_harmony.PatchAll(typeof(Patch_PlayerMoveFly));
|
||||
_harmony.PatchAll(typeof(Patch_PlayerMoveSail));
|
||||
}
|
||||
|
||||
public void OnDestroy()
|
||||
{
|
||||
_harmony.UnpatchSelf();
|
||||
}
|
||||
|
||||
public static void RegistExtension(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
Extensions.Add(extension);
|
||||
}
|
||||
|
||||
public static void UnregistExtension(Type type)
|
||||
{
|
||||
Extensions.RemoveAll(extension => extension.GetType().FullName == type.FullName);
|
||||
}
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
if (DSPGame.IsMenuDemo || GameMain.mainPlayer == null) return;
|
||||
if (UIMechaEditor.isOpened) return;
|
||||
var uiGame = UIRoot.instance.uiGame;
|
||||
if (!uiGame.guideComplete || uiGame.techTree.active || uiGame.escMenu.active || uiGame.dysonEditor.active || uiGame.hideAllUI0 || uiGame.hideAllUI1) return;
|
||||
if (UIMilkyWayLoadingSplash.instance != null && UIMilkyWayLoadingSplash.instance.active) return;
|
||||
if (UIRoot.instance.uiMilkyWay != null && UIRoot.instance.uiMilkyWay.active) return;
|
||||
if (!(GameMain.mainPlayer.sailing || uiGame.starmap.active || (Conf.ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag && TargetSelected))) return;
|
||||
if (Seed != GameMain.galaxy.seed)
|
||||
ConfigManager.CheckConfig(ConfigManager.Step.ChangeSeed);
|
||||
CruiseAssistMainUI.WIdx = uiGame.starmap.active ? 1 : 0;
|
||||
var scale = CruiseAssistMainUI.Scale / 100f;
|
||||
GUIUtility.ScaleAroundPivot(new Vector2(scale, scale), Vector2.zero);
|
||||
CruiseAssistMainUI.OnGUI();
|
||||
if (CruiseAssistStarListUI.Show[CruiseAssistMainUI.WIdx])
|
||||
{
|
||||
CruiseAssistStarListUI.OnGUI();
|
||||
}
|
||||
if (CruiseAssistConfigUI.Show[CruiseAssistMainUI.WIdx])
|
||||
{
|
||||
CruiseAssistConfigUI.OnGUI();
|
||||
}
|
||||
if (CruiseAssistDebugUI.Show)
|
||||
{
|
||||
CruiseAssistDebugUI.OnGUI();
|
||||
}
|
||||
var ok = ResetInput(CruiseAssistMainUI.Rect[CruiseAssistMainUI.WIdx], scale);
|
||||
if (!ok && CruiseAssistStarListUI.Show[CruiseAssistMainUI.WIdx])
|
||||
{
|
||||
ok = ResetInput(CruiseAssistStarListUI.Rect[CruiseAssistMainUI.WIdx], scale);
|
||||
}
|
||||
if (!ok && CruiseAssistConfigUI.Show[CruiseAssistMainUI.WIdx])
|
||||
{
|
||||
ok = ResetInput(CruiseAssistConfigUI.Rect[CruiseAssistMainUI.WIdx], scale);
|
||||
}
|
||||
if (!ok && CruiseAssistDebugUI.Show)
|
||||
{
|
||||
ResetInput(CruiseAssistDebugUI.Rect, scale);
|
||||
}
|
||||
Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.OnGUI();
|
||||
});
|
||||
}
|
||||
|
||||
private bool ResetInput(Rect rect, float scale)
|
||||
{
|
||||
var num = rect.xMin * scale;
|
||||
var num2 = rect.xMax * scale;
|
||||
var num3 = rect.yMin * scale;
|
||||
var num4 = rect.yMax * scale;
|
||||
var x = Input.mousePosition.x;
|
||||
var num5 = Screen.height - Input.mousePosition.y;
|
||||
var flag = num <= x && x <= num2 && num3 <= num5 && num5 <= num4;
|
||||
if (!flag) return false;
|
||||
var array = new[] { 0, 1, 2 };
|
||||
var flag2 = array.Any(Input.GetMouseButton) || Input.mouseScrollDelta.y != 0f;
|
||||
if (!flag2) return false;
|
||||
Input.ResetInputAxes();
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Enable = true;
|
||||
|
||||
public static bool TargetSelected = false;
|
||||
|
||||
public static StarData ReticuleTargetStar = null;
|
||||
|
||||
public static PlanetData ReticuleTargetPlanet = null;
|
||||
|
||||
public static StarData SelectTargetStar = null;
|
||||
|
||||
public static PlanetData SelectTargetPlanet = null;
|
||||
|
||||
public static int SelectTargetAstroId = 0;
|
||||
|
||||
public static StarData TargetStar = null;
|
||||
|
||||
public static PlanetData TargetPlanet = null;
|
||||
|
||||
public static VectorLF3 TargetUPos = VectorLF3.zero;
|
||||
|
||||
public static double TargetRange = 0.0;
|
||||
|
||||
public static CruiseAssistState State = CruiseAssistState.Inactive;
|
||||
|
||||
public static bool Interrupt = false;
|
||||
|
||||
public static int Seed = -1;
|
||||
|
||||
public static List<int> History = new List<int>();
|
||||
|
||||
public static List<int> Bookmark = new List<int>();
|
||||
|
||||
public static readonly Func<StarData, string> GetStarName = star => star.displayName;
|
||||
|
||||
public static readonly Func<PlanetData, string> GetPlanetName = planet => planet.displayName;
|
||||
|
||||
internal static readonly List<ICruiseAssistExtensionAPI> Extensions = [];
|
||||
|
||||
private Harmony _harmony;
|
||||
|
||||
public static class Conf
|
||||
{
|
||||
public static bool MarkVisitedFlag = true;
|
||||
|
||||
public static bool SelectFocusFlag = true;
|
||||
|
||||
public static bool HideDuplicateHistoryFlag = true;
|
||||
|
||||
public static bool AutoDisableLockCursorFlag = false;
|
||||
|
||||
public static bool ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag = true;
|
||||
|
||||
public static bool CloseStarListWhenSetTargetPlanetFlag = false;
|
||||
|
||||
public static bool HideBottomCloseButtonFlag = true;
|
||||
}
|
||||
}
|
||||
7
CruiseAssist/Enums/CruiseAssistMainUIViewMode.cs
Normal file
7
CruiseAssist/Enums/CruiseAssistMainUIViewMode.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace CruiseAssist.Enums;
|
||||
|
||||
public enum CruiseAssistMainUIViewMode
|
||||
{
|
||||
Full,
|
||||
Mini
|
||||
}
|
||||
8
CruiseAssist/Enums/CruiseAssistState.cs
Normal file
8
CruiseAssist/Enums/CruiseAssistState.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace CruiseAssist.Enums;
|
||||
|
||||
public enum CruiseAssistState
|
||||
{
|
||||
ToStar,
|
||||
ToPlanet,
|
||||
Inactive
|
||||
}
|
||||
30
CruiseAssist/Patches/Patch_GameMain.cs
Normal file
30
CruiseAssist/Patches/Patch_GameMain.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using CruiseAssist.Commons;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace CruiseAssist.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(GameMain))]
|
||||
internal class Patch_GameMain
|
||||
{
|
||||
[HarmonyPatch("Begin")]
|
||||
[HarmonyPostfix]
|
||||
public static void Begin_Postfix()
|
||||
{
|
||||
ConfigManager.CheckConfig(ConfigManager.Step.GameMainBegin);
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.CheckConfig(ConfigManager.Step.GameMainBegin.ToString());
|
||||
});
|
||||
}
|
||||
|
||||
[HarmonyPatch("Pause")]
|
||||
[HarmonyPrefix]
|
||||
public static void Pause_Prefix()
|
||||
{
|
||||
ConfigManager.CheckConfig(ConfigManager.Step.State);
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.CheckConfig(ConfigManager.Step.State.ToString());
|
||||
});
|
||||
}
|
||||
}
|
||||
31
CruiseAssist/Patches/Patch_PlayerMoveDrift.cs
Normal file
31
CruiseAssist/Patches/Patch_PlayerMoveDrift.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using HarmonyLib;
|
||||
|
||||
namespace CruiseAssist.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(PlayerMove_Drift))]
|
||||
internal class Patch_PlayerMoveDrift
|
||||
{
|
||||
[HarmonyPatch("GameTick")]
|
||||
[HarmonyPrefix]
|
||||
public static void GameTick_Prefix(PlayerMove_Drift __instance)
|
||||
{
|
||||
if (!CruiseAssistPlugin.Enable) return;
|
||||
if (!CruiseAssistPlugin.TargetSelected) return;
|
||||
if (__instance.controller.movementStateInFrame != EMovementState.Drift) return;
|
||||
if (VFInput._moveForward.pressing || VFInput._pullUp.pressing)
|
||||
{
|
||||
CruiseAssistPlugin.Interrupt = true;
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.CancelOperate();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.OperateDrift(__instance);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
31
CruiseAssist/Patches/Patch_PlayerMoveFly.cs
Normal file
31
CruiseAssist/Patches/Patch_PlayerMoveFly.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using HarmonyLib;
|
||||
|
||||
namespace CruiseAssist.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(PlayerMove_Fly))]
|
||||
internal class Patch_PlayerMoveFly
|
||||
{
|
||||
[HarmonyPatch("GameTick")]
|
||||
[HarmonyPrefix]
|
||||
public static void GameTick_Prefix(PlayerMove_Fly __instance)
|
||||
{
|
||||
if (!CruiseAssistPlugin.Enable) return;
|
||||
if (!CruiseAssistPlugin.TargetSelected) return;
|
||||
if (__instance.controller.movementStateInFrame != EMovementState.Fly) return;
|
||||
if (VFInput._moveForward.pressing || VFInput._pullUp.pressing)
|
||||
{
|
||||
CruiseAssistPlugin.Interrupt = true;
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.CancelOperate();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.OperateFly(__instance);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
51
CruiseAssist/Patches/Patch_PlayerMoveSail.cs
Normal file
51
CruiseAssist/Patches/Patch_PlayerMoveSail.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace CruiseAssist.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(PlayerMove_Sail))]
|
||||
internal class Patch_PlayerMoveSail
|
||||
{
|
||||
[HarmonyPatch("GameTick")]
|
||||
[HarmonyPrefix]
|
||||
public static void GameTick_Prefix(PlayerMove_Sail __instance)
|
||||
{
|
||||
if (!CruiseAssistPlugin.Enable) return;
|
||||
if (!CruiseAssistPlugin.TargetSelected) return;
|
||||
var player = __instance.player;
|
||||
if (!player.sailing) return;
|
||||
var controller = player.controller;
|
||||
if (controller.input0 != Vector4.zero || controller.input1 != Vector4.zero)
|
||||
{
|
||||
CruiseAssistPlugin.Interrupt = true;
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.CancelOperate();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CruiseAssistPlugin.TargetPlanet != null)
|
||||
{
|
||||
CruiseAssistPlugin.TargetUPos = CruiseAssistPlugin.TargetPlanet.uPosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CruiseAssistPlugin.TargetStar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
CruiseAssistPlugin.TargetUPos = CruiseAssistPlugin.TargetStar.uPosition;
|
||||
}
|
||||
var operate = false;
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
operate |= extension.OperateSail(__instance);
|
||||
});
|
||||
if (operate) return;
|
||||
var vec = CruiseAssistPlugin.TargetUPos - player.uPosition;
|
||||
var magnitude = controller.actionSail.visual_uvel.magnitude;
|
||||
player.uVelocity = Vector3.Slerp(player.uVelocity, vec.normalized * magnitude, 1.6f / Mathf.Max(10f, Vector3.Angle(vec, player.uVelocity)));
|
||||
}
|
||||
}
|
||||
}
|
||||
161
CruiseAssist/Patches/Patch_PlayerMoveWalk.cs
Normal file
161
CruiseAssist/Patches/Patch_PlayerMoveWalk.cs
Normal file
@@ -0,0 +1,161 @@
|
||||
using System.Linq;
|
||||
using CruiseAssist.Commons;
|
||||
using CruiseAssist.Enums;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace CruiseAssist.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(PlayerMove_Walk))]
|
||||
internal class Patch_PlayerMoveWalk
|
||||
{
|
||||
[HarmonyPatch("GameTick")]
|
||||
[HarmonyPrefix]
|
||||
public static void GameTick_Prefix(PlayerMove_Walk __instance)
|
||||
{
|
||||
CruiseAssistPlugin.State = CruiseAssistState.Inactive;
|
||||
CruiseAssistPlugin.Interrupt = false;
|
||||
CruiseAssistPlugin.TargetStar = null;
|
||||
CruiseAssistPlugin.TargetPlanet = null;
|
||||
CruiseAssistPlugin.TargetUPos = VectorLF3.zero;
|
||||
CruiseAssistPlugin.TargetRange = 0.0;
|
||||
CruiseAssistPlugin.TargetSelected = false;
|
||||
if (GameMain.localPlanet != null)
|
||||
{
|
||||
if (CruiseAssistPlugin.History.Count == 0 || CruiseAssistPlugin.History.Last() != GameMain.localPlanet.id)
|
||||
{
|
||||
if (CruiseAssistPlugin.History.Count >= 128)
|
||||
{
|
||||
CruiseAssistPlugin.History.RemoveAt(0);
|
||||
}
|
||||
CruiseAssistPlugin.History.Add(GameMain.localPlanet.id);
|
||||
ConfigManager.CheckConfig(ConfigManager.Step.State);
|
||||
}
|
||||
}
|
||||
|
||||
if (!CruiseAssistPlugin.Enable)
|
||||
{
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.SetInactive();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
var indicatorAstroId = GameMain.mainPlayer.navigation.indicatorAstroId;
|
||||
if (indicatorAstroId != 0 && CruiseAssistPlugin.SelectTargetAstroId != indicatorAstroId)
|
||||
{
|
||||
CruiseAssistPlugin.SelectTargetAstroId = indicatorAstroId;
|
||||
if (indicatorAstroId % 100 != 0)
|
||||
{
|
||||
CruiseAssistPlugin.SelectTargetPlanet = GameMain.galaxy.PlanetById(indicatorAstroId);
|
||||
CruiseAssistPlugin.SelectTargetStar = CruiseAssistPlugin.SelectTargetPlanet.star;
|
||||
}
|
||||
else
|
||||
{
|
||||
CruiseAssistPlugin.SelectTargetPlanet = null;
|
||||
CruiseAssistPlugin.SelectTargetStar = GameMain.galaxy.StarById(indicatorAstroId / 100);
|
||||
}
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.SetTargetAstroId(indicatorAstroId);
|
||||
});
|
||||
}
|
||||
|
||||
if (CruiseAssistPlugin.SelectTargetStar != null)
|
||||
{
|
||||
if (GameMain.localStar != null && CruiseAssistPlugin.SelectTargetStar.id == GameMain.localStar.id)
|
||||
{
|
||||
if (CruiseAssistPlugin.SelectTargetPlanet == null && GameMain.localPlanet != null)
|
||||
{
|
||||
CruiseAssistPlugin.SelectTargetStar = null;
|
||||
CruiseAssistPlugin.SelectTargetAstroId = 0;
|
||||
GameMain.mainPlayer.navigation.indicatorAstroId = 0;
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.SetInactive();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (CruiseAssistPlugin.SelectTargetPlanet != null)
|
||||
{
|
||||
if (GameMain.localPlanet != null && CruiseAssistPlugin.SelectTargetPlanet.id == GameMain.localPlanet.id)
|
||||
{
|
||||
CruiseAssistPlugin.SelectTargetStar = null;
|
||||
CruiseAssistPlugin.SelectTargetPlanet = null;
|
||||
CruiseAssistPlugin.SelectTargetAstroId = 0;
|
||||
GameMain.mainPlayer.navigation.indicatorAstroId = 0;
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.SetInactive();
|
||||
});
|
||||
return;
|
||||
}
|
||||
CruiseAssistPlugin.TargetPlanet = CruiseAssistPlugin.SelectTargetPlanet;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CruiseAssistPlugin.ReticuleTargetPlanet != null)
|
||||
{
|
||||
CruiseAssistPlugin.TargetPlanet = CruiseAssistPlugin.ReticuleTargetPlanet;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CruiseAssistPlugin.TargetStar = CruiseAssistPlugin.SelectTargetStar;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CruiseAssistPlugin.ReticuleTargetPlanet != null)
|
||||
{
|
||||
CruiseAssistPlugin.TargetPlanet = CruiseAssistPlugin.ReticuleTargetPlanet;
|
||||
}
|
||||
else if (CruiseAssistPlugin.ReticuleTargetStar != null)
|
||||
{
|
||||
CruiseAssistPlugin.TargetStar = CruiseAssistPlugin.ReticuleTargetStar;
|
||||
}
|
||||
}
|
||||
|
||||
if (CruiseAssistPlugin.TargetPlanet != null)
|
||||
{
|
||||
CruiseAssistPlugin.State = CruiseAssistState.ToPlanet;
|
||||
CruiseAssistPlugin.TargetStar = CruiseAssistPlugin.TargetPlanet.star;
|
||||
CruiseAssistPlugin.TargetRange = (CruiseAssistPlugin.TargetPlanet.uPosition - GameMain.mainPlayer.uPosition).magnitude - CruiseAssistPlugin.TargetPlanet.realRadius;
|
||||
CruiseAssistPlugin.TargetSelected = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CruiseAssistPlugin.TargetStar == null)
|
||||
{
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.SetInactive();
|
||||
});
|
||||
return;
|
||||
}
|
||||
CruiseAssistPlugin.State = CruiseAssistState.ToStar;
|
||||
CruiseAssistPlugin.TargetRange = (CruiseAssistPlugin.TargetStar.uPosition - GameMain.mainPlayer.uPosition).magnitude - (CruiseAssistPlugin.TargetStar.viewRadius - 120f);
|
||||
CruiseAssistPlugin.TargetSelected = true;
|
||||
}
|
||||
var flag18 = __instance.controller.movementStateInFrame > EMovementState.Walk;
|
||||
if (flag18) return;
|
||||
if (VFInput._jump.pressing)
|
||||
{
|
||||
CruiseAssistPlugin.Interrupt = true;
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.CancelOperate();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.OperateWalk(__instance);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
71
CruiseAssist/Patches/Patch_UISailPanel.cs
Normal file
71
CruiseAssist/Patches/Patch_UISailPanel.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection.Emit;
|
||||
using CruiseAssist.Commons;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace CruiseAssist.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(UISailPanel))]
|
||||
internal class Patch_UISailPanel
|
||||
{
|
||||
[HarmonyPatch("_OnUpdate")]
|
||||
[HarmonyTranspiler]
|
||||
public static IEnumerable<CodeInstruction> OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions)
|
||||
{
|
||||
var codeMatcher = new CodeMatcher(instructions);
|
||||
codeMatcher.MatchForward(true, new CodeMatch(OpCodes.Ldarg_0));
|
||||
codeMatcher.InsertAndAdvance(
|
||||
Transpilers.EmitDelegate<Action>(delegate
|
||||
{
|
||||
CruiseAssistPlugin.ReticuleTargetPlanet = null;
|
||||
CruiseAssistPlugin.ReticuleTargetStar = null;
|
||||
})
|
||||
);
|
||||
codeMatcher.MatchForward(true, new CodeMatch(OpCodes.Bge_Un), new CodeMatch(OpCodes.Ldloc_S), new CodeMatch(OpCodes.Stloc_S), new CodeMatch(OpCodes.Ldc_I4_1), new CodeMatch(OpCodes.Stloc_S), new CodeMatch(OpCodes.Ldloc_S), new CodeMatch(OpCodes.Stloc_S));
|
||||
codeMatcher.Advance(1).InsertAndAdvance(
|
||||
new CodeInstruction(OpCodes.Ldloc_0),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(StarData), "planets")),
|
||||
new CodeInstruction(OpCodes.Ldloc_S, 21),
|
||||
Transpilers.EmitDelegate(delegate(PlanetData[] planets, int planetIndex)
|
||||
{
|
||||
CruiseAssistPlugin.ReticuleTargetPlanet = planets[planetIndex];
|
||||
})
|
||||
);
|
||||
codeMatcher.MatchForward(true,
|
||||
new CodeMatch(OpCodes.Bge_Un),
|
||||
new CodeMatch(OpCodes.Ldloc_S),
|
||||
new CodeMatch(OpCodes.Stloc_S),
|
||||
new CodeMatch(OpCodes.Ldc_I4_1),
|
||||
new CodeMatch(OpCodes.Stloc_S),
|
||||
new CodeMatch(OpCodes.Ldloc_S),
|
||||
new CodeMatch(OpCodes.Stloc_S));
|
||||
codeMatcher.Advance(1).InsertAndAdvance(
|
||||
new CodeInstruction(OpCodes.Ldloc_S, 20),
|
||||
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(GalaxyData), "stars")),
|
||||
new CodeInstruction(OpCodes.Ldloc_S, 24),
|
||||
Transpilers.EmitDelegate(delegate(StarData[] stars, int starIndex)
|
||||
{
|
||||
CruiseAssistPlugin.ReticuleTargetStar = stars[starIndex];
|
||||
})
|
||||
);
|
||||
return codeMatcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
[HarmonyPatch("_OnOpen")]
|
||||
[HarmonyPrefix]
|
||||
public static void OnOpen_Prefix()
|
||||
{
|
||||
if (CruiseAssistPlugin.Conf.AutoDisableLockCursorFlag)
|
||||
{
|
||||
UIRoot.instance.uiGame.disableLockCursor = true;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch("_OnClose")]
|
||||
[HarmonyPrefix]
|
||||
public static void OnClose_Prefix()
|
||||
{
|
||||
ConfigManager.CheckConfig(ConfigManager.Step.State);
|
||||
}
|
||||
}
|
||||
19
CruiseAssist/Patches/Patch_UIStarmap.cs
Normal file
19
CruiseAssist/Patches/Patch_UIStarmap.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using CruiseAssist.Commons;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace CruiseAssist.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(UIStarmap))]
|
||||
internal class Patch_UIStarmap
|
||||
{
|
||||
[HarmonyPatch("_OnClose")]
|
||||
[HarmonyPrefix]
|
||||
public static void OnClose_Prefix()
|
||||
{
|
||||
ConfigManager.CheckConfig(ConfigManager.Step.State);
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.CheckConfig(ConfigManager.Step.State.ToString());
|
||||
});
|
||||
}
|
||||
}
|
||||
19
CruiseAssist/Patches/Patch_UITechTree.cs
Normal file
19
CruiseAssist/Patches/Patch_UITechTree.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using CruiseAssist.Commons;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace CruiseAssist.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(UITechTree))]
|
||||
internal class Patch_UITechTree
|
||||
{
|
||||
[HarmonyPatch("_OnOpen")]
|
||||
[HarmonyPrefix]
|
||||
public static void OnOpen_Prefix()
|
||||
{
|
||||
ConfigManager.CheckConfig(ConfigManager.Step.State);
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.CheckConfig(ConfigManager.Step.State.ToString());
|
||||
});
|
||||
}
|
||||
}
|
||||
230
CruiseAssist/UI/CruiseAssistConfigUI.cs
Normal file
230
CruiseAssist/UI/CruiseAssistConfigUI.cs
Normal file
@@ -0,0 +1,230 @@
|
||||
using System;
|
||||
using CruiseAssist.Enums;
|
||||
using UnityEngine;
|
||||
|
||||
namespace CruiseAssist.UI;
|
||||
|
||||
public static class CruiseAssistConfigUI
|
||||
{
|
||||
public static void OnGUI()
|
||||
{
|
||||
_wIdx = CruiseAssistMainUI.WIdx;
|
||||
Rect[_wIdx] = GUILayout.Window(99030293, Rect[_wIdx], WindowFunction, "CruiseAssist - Config", CruiseAssistMainUI.WindowStyle, Array.Empty<GUILayoutOption>());
|
||||
var num = CruiseAssistMainUI.Scale / 100f;
|
||||
if (Screen.width / num < Rect[_wIdx].xMax)
|
||||
{
|
||||
Rect[_wIdx].x = Screen.width / num - Rect[_wIdx].width;
|
||||
}
|
||||
if (Rect[_wIdx].x < 0f)
|
||||
{
|
||||
Rect[_wIdx].x = 0f;
|
||||
}
|
||||
if (Screen.height / num < Rect[_wIdx].yMax)
|
||||
{
|
||||
Rect[_wIdx].y = Screen.height / num - Rect[_wIdx].height;
|
||||
}
|
||||
if (Rect[_wIdx].y < 0f)
|
||||
{
|
||||
Rect[_wIdx].y = 0f;
|
||||
}
|
||||
if (LastCheckWindowLeft[_wIdx] != float.MinValue)
|
||||
{
|
||||
if (Rect[_wIdx].x != LastCheckWindowLeft[_wIdx] || Rect[_wIdx].y != LastCheckWindowTop[_wIdx])
|
||||
{
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
}
|
||||
LastCheckWindowLeft[_wIdx] = Rect[_wIdx].x;
|
||||
LastCheckWindowTop[_wIdx] = Rect[_wIdx].y;
|
||||
}
|
||||
|
||||
private static void WindowFunction(int windowId)
|
||||
{
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label("Main Window Style :", new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 120f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
}, Array.Empty<GUILayoutOption>());
|
||||
var guistyle = new GUIStyle(CruiseAssistMainUI.BaseToolbarButtonStyle)
|
||||
{
|
||||
fixedWidth = 80f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12
|
||||
};
|
||||
var array = new[] { "FULL", "MINI" };
|
||||
var num = CruiseAssistMainUI.ViewMode == CruiseAssistMainUIViewMode.Full ? 0 : 1;
|
||||
GUI.changed = false;
|
||||
var num2 = GUILayout.Toolbar(num, array, guistyle, Array.Empty<GUILayoutOption>());
|
||||
var changed = GUI.changed;
|
||||
if (changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
}
|
||||
if (num2 != num)
|
||||
{
|
||||
if (num2 != 0)
|
||||
{
|
||||
if (num2 == 1)
|
||||
{
|
||||
CruiseAssistMainUI.ViewMode = CruiseAssistMainUIViewMode.Mini;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CruiseAssistMainUI.ViewMode = CruiseAssistMainUIViewMode.Full;
|
||||
}
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label("UI Scale :", new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 60f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
}, Array.Empty<GUILayoutOption>());
|
||||
var guistyle2 = new GUIStyle(CruiseAssistMainUI.BaseHorizontalSliderStyle)
|
||||
{
|
||||
fixedWidth = 180f,
|
||||
margin =
|
||||
{
|
||||
top = 10
|
||||
},
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
};
|
||||
var guistyle3 = new GUIStyle(CruiseAssistMainUI.BaseHorizontalSliderThumbStyle)
|
||||
{
|
||||
border = new RectOffset(1, 1, 8, 8)
|
||||
};
|
||||
TempScale = GUILayout.HorizontalSlider(TempScale, 80f, 240f, guistyle2, guistyle3, Array.Empty<GUILayoutOption>());
|
||||
TempScale = (int)TempScale / 5 * 5;
|
||||
var guistyle4 = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 40f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
};
|
||||
GUILayout.Label(TempScale.ToString("0") + "%", guistyle4, Array.Empty<GUILayoutOption>());
|
||||
var ok = GUILayout.Button("SET", new GUIStyle(CruiseAssistMainUI.BaseButtonStyle)
|
||||
{
|
||||
fixedWidth = 60f,
|
||||
fixedHeight = 18f,
|
||||
margin =
|
||||
{
|
||||
top = 6
|
||||
},
|
||||
fontSize = 12
|
||||
}, Array.Empty<GUILayoutOption>());
|
||||
if (ok)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistMainUI.Scale = TempScale;
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
var guistyle5 = new GUIStyle(CruiseAssistMainUI.BaseToggleStyle)
|
||||
{
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12,
|
||||
alignment = TextAnchor.LowerLeft
|
||||
};
|
||||
GUI.changed = false;
|
||||
CruiseAssistPlugin.Conf.MarkVisitedFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.MarkVisitedFlag, "Mark the visited system and planet.".Translate(), guistyle5, Array.Empty<GUILayoutOption>());
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUI.changed = false;
|
||||
CruiseAssistPlugin.Conf.SelectFocusFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.SelectFocusFlag, "Focus when select target.".Translate(), guistyle5, Array.Empty<GUILayoutOption>());
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUI.changed = false;
|
||||
CruiseAssistPlugin.Conf.HideDuplicateHistoryFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.HideDuplicateHistoryFlag, "Hide duplicate history.".Translate(), guistyle5, Array.Empty<GUILayoutOption>());
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUI.changed = false;
|
||||
CruiseAssistPlugin.Conf.AutoDisableLockCursorFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.AutoDisableLockCursorFlag, "Disable lock cursor when starting sail mode.".Translate(), guistyle5, Array.Empty<GUILayoutOption>());
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUI.changed = false;
|
||||
CruiseAssistPlugin.Conf.ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.ShowMainWindowWhenTargetSelectedEvenNotSailModeFlag, "Show main window when target selected, even not sail mode.".Translate(), guistyle5, Array.Empty<GUILayoutOption>());
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUI.changed = false;
|
||||
CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag, "Close StarList when set target planet.".Translate(), guistyle5, Array.Empty<GUILayoutOption>());
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUI.changed = false;
|
||||
CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag = GUILayout.Toggle(CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag, "Hide bottom close button.".Translate(), guistyle5, Array.Empty<GUILayoutOption>());
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
GUILayout.FlexibleSpace();
|
||||
var guistyle6 = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle)
|
||||
{
|
||||
fixedWidth = 80f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12
|
||||
};
|
||||
ok = !CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag && GUILayout.Button("Close", guistyle6, Array.Empty<GUILayoutOption>());
|
||||
if (ok)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
Show[_wIdx] = false;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
ok = GUI.Button(new Rect(Rect[_wIdx].width - 16f, 1f, 16f, 16f), "", CruiseAssistMainUI.CloseButtonStyle);
|
||||
if (ok)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
Show[_wIdx] = false;
|
||||
}
|
||||
GUI.DragWindow();
|
||||
}
|
||||
|
||||
private static int _wIdx;
|
||||
|
||||
public const float WindowWidth = 400f;
|
||||
|
||||
public const float WindowHeight = 400f;
|
||||
|
||||
public static readonly bool[] Show = new bool[2];
|
||||
|
||||
public static readonly Rect[] Rect = {
|
||||
new Rect(0f, 0f, 400f, 400f),
|
||||
new Rect(0f, 0f, 400f, 400f)
|
||||
};
|
||||
|
||||
private static readonly float[] LastCheckWindowLeft = { float.MinValue, float.MinValue };
|
||||
|
||||
private static readonly float[] LastCheckWindowTop = { float.MinValue, float.MinValue };
|
||||
|
||||
public static float TempScale;
|
||||
}
|
||||
92
CruiseAssist/UI/CruiseAssistDebugUI.cs
Normal file
92
CruiseAssist/UI/CruiseAssistDebugUI.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using CruiseAssist.Commons;
|
||||
using UnityEngine;
|
||||
|
||||
namespace CruiseAssist.UI;
|
||||
|
||||
public static class CruiseAssistDebugUI
|
||||
{
|
||||
public static void OnGUI()
|
||||
{
|
||||
var guistyle = new GUIStyle(GUI.skin.window)
|
||||
{
|
||||
fontSize = 11
|
||||
};
|
||||
Rect = GUILayout.Window(99030294, Rect, WindowFunction, "CruiseAssist - Debug", guistyle, Array.Empty<GUILayoutOption>());
|
||||
if (Screen.width < Rect.xMax)
|
||||
{
|
||||
Rect.x = Screen.width - Rect.width;
|
||||
}
|
||||
if (Rect.x < 0f)
|
||||
{
|
||||
Rect.x = 0f;
|
||||
}
|
||||
if (Screen.height < Rect.yMax)
|
||||
{
|
||||
Rect.y = Screen.height - Rect.height;
|
||||
}
|
||||
if (Rect.y < 0f)
|
||||
{
|
||||
Rect.y = 0f;
|
||||
}
|
||||
if (_lastCheckWindowLeft != float.MinValue)
|
||||
{
|
||||
var flag6 = Rect.x != _lastCheckWindowLeft || Rect.y != _lastCheckWindowTop;
|
||||
if (flag6)
|
||||
{
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
}
|
||||
_lastCheckWindowLeft = Rect.x;
|
||||
_lastCheckWindowTop = Rect.y;
|
||||
}
|
||||
|
||||
private static void WindowFunction(int windowId)
|
||||
{
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
var guistyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fontSize = 12
|
||||
};
|
||||
_scrollPos = GUILayout.BeginScrollView(_scrollPos, Array.Empty<GUILayoutOption>());
|
||||
var reticuleTargetStar = CruiseAssistPlugin.ReticuleTargetStar;
|
||||
GUILayout.Label($"CruiseAssistPlugin.ReticuleTargetStar.id={(reticuleTargetStar != null ? new int?(reticuleTargetStar.id) : null)}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
var reticuleTargetPlanet = CruiseAssistPlugin.ReticuleTargetPlanet;
|
||||
GUILayout.Label($"CruiseAssistPlugin.ReticuleTargetPlanet.id={(reticuleTargetPlanet != null ? new int?(reticuleTargetPlanet.id) : null)}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
var selectTargetStar = CruiseAssistPlugin.SelectTargetStar;
|
||||
GUILayout.Label($"CruiseAssistPlugin.SelectTargetStar.id={(selectTargetStar != null ? new int?(selectTargetStar.id) : null)}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
var selectTargetPlanet = CruiseAssistPlugin.SelectTargetPlanet;
|
||||
GUILayout.Label($"CruiseAssistPlugin.SelectTargetPlanet.id={(selectTargetPlanet != null ? new int?(selectTargetPlanet.id) : null)}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.navigation.indicatorAstroId={GameMain.mainPlayer.navigation.indicatorAstroId}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input0.w={GameMain.mainPlayer.controller.input0.w}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input0.x={GameMain.mainPlayer.controller.input0.x}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input0.y={GameMain.mainPlayer.controller.input0.y}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input0.z={GameMain.mainPlayer.controller.input0.z}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input1.w={GameMain.mainPlayer.controller.input1.w}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input1.x={GameMain.mainPlayer.controller.input1.x}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input1.y={GameMain.mainPlayer.controller.input1.y}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GameMain.mainPlayer.controller.input1.z={GameMain.mainPlayer.controller.input1.z}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"VFInput._sailSpeedUp={VFInput._sailSpeedUp}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"CruiseAssistPlugin.Enable={CruiseAssistPlugin.Enable}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"CruiseAssistPlugin.History={CruiseAssistPlugin.History.Count()}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label("CruiseAssistPlugin.History=" + ListUtils.ToString(CruiseAssistPlugin.History), guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GUI.skin.window.margin.top={GUI.skin.window.margin.top}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GUI.skin.window.border.top={GUI.skin.window.border.top}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GUI.skin.window.padding.top={GUI.skin.window.padding.top}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.Label($"GUI.skin.window.overflow.top={GUI.skin.window.overflow.top}", guistyle, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.EndScrollView();
|
||||
GUILayout.EndVertical();
|
||||
GUI.DragWindow();
|
||||
}
|
||||
|
||||
public static bool Show = false;
|
||||
|
||||
public static Rect Rect = new Rect(0f, 0f, 400f, 400f);
|
||||
|
||||
private static float _lastCheckWindowLeft = float.MinValue;
|
||||
|
||||
private static float _lastCheckWindowTop = float.MinValue;
|
||||
|
||||
private static Vector2 _scrollPos = Vector2.zero;
|
||||
}
|
||||
920
CruiseAssist/UI/CruiseAssistMainUI.cs
Normal file
920
CruiseAssist/UI/CruiseAssistMainUI.cs
Normal file
@@ -0,0 +1,920 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CruiseAssist.Commons;
|
||||
using CruiseAssist.Enums;
|
||||
using UnityEngine;
|
||||
|
||||
namespace CruiseAssist.UI;
|
||||
|
||||
public static class CruiseAssistMainUI
|
||||
{
|
||||
public static void OnGUI()
|
||||
{
|
||||
if (WhiteBorderBackgroundTexture == null)
|
||||
{
|
||||
WhiteBorderBackgroundTexture = new Texture2D(64, 64, TextureFormat.RGBA32, false);
|
||||
var color = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
|
||||
var color2 = new Color32(0, 0, 0, 224);
|
||||
for (var i = 0; i < 64; i++)
|
||||
{
|
||||
for (var j = 0; j < 64; j++)
|
||||
{
|
||||
var color3 = i <= 0 || j <= 0 || i >= 63 || j >= 63 ? color : color2;
|
||||
WhiteBorderBackgroundTexture.SetPixel(j, i, color3);
|
||||
}
|
||||
}
|
||||
WhiteBorderBackgroundTexture.Apply();
|
||||
}
|
||||
|
||||
if (GrayBorderBackgroundTexture == null)
|
||||
{
|
||||
GrayBorderBackgroundTexture = new Texture2D(64, 64, TextureFormat.RGBA32, false);
|
||||
var color4 = new Color32(64, 64, 64, byte.MaxValue);
|
||||
var color5 = new Color32(0, 0, 0, 224);
|
||||
for (var k = 0; k < 64; k++)
|
||||
{
|
||||
for (var l = 0; l < 64; l++)
|
||||
{
|
||||
var color6 = k <= 0 || l <= 0 || k >= 63 || l >= 63 ? color4 : color5;
|
||||
GrayBorderBackgroundTexture.SetPixel(l, k, color6);
|
||||
}
|
||||
}
|
||||
GrayBorderBackgroundTexture.Apply();
|
||||
}
|
||||
|
||||
if (WhiteBorderTexture == null)
|
||||
{
|
||||
WhiteBorderTexture = new Texture2D(64, 64, TextureFormat.RGBA32, false);
|
||||
var color7 = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
|
||||
var color8 = new Color32(0, 0, 0, byte.MaxValue);
|
||||
for (var m = 0; m < 64; m++)
|
||||
{
|
||||
for (var n = 0; n < 64; n++)
|
||||
{
|
||||
var color9 = m <= 0 || n <= 0 || m >= 63 || n >= 63 ? color7 : color8;
|
||||
WhiteBorderTexture.SetPixel(n, m, color9);
|
||||
}
|
||||
}
|
||||
WhiteBorderTexture.Apply();
|
||||
}
|
||||
|
||||
if (GrayBorderTexture == null)
|
||||
{
|
||||
GrayBorderTexture = new Texture2D(64, 64, TextureFormat.RGBA32, false);
|
||||
var color10 = new Color32(64, 64, 64, byte.MaxValue);
|
||||
var color11 = new Color32(0, 0, 0, byte.MaxValue);
|
||||
for (var i = 0; i < 64; i++)
|
||||
{
|
||||
for (var j = 0; j < 64; j++)
|
||||
{
|
||||
var color12 = i <= 0 || j <= 0 || i >= 63 || j >= 63 ? color10 : color11;
|
||||
GrayBorderTexture.SetPixel(j, i, color12);
|
||||
}
|
||||
}
|
||||
GrayBorderTexture.Apply();
|
||||
}
|
||||
|
||||
if (BlackTexture == null)
|
||||
{
|
||||
BlackTexture = new Texture2D(64, 64, TextureFormat.RGBA32, false);
|
||||
var color13 = new Color32(0, 0, 0, byte.MaxValue);
|
||||
for (var i = 0; i < 64; i++)
|
||||
{
|
||||
for (var j = 0; j < 64; j++)
|
||||
{
|
||||
BlackTexture.SetPixel(j, i, color13);
|
||||
}
|
||||
}
|
||||
BlackTexture.Apply();
|
||||
}
|
||||
|
||||
if (WhiteTexture == null)
|
||||
{
|
||||
WhiteTexture = new Texture2D(64, 64, TextureFormat.RGBA32, false);
|
||||
var color14 = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
|
||||
for (var i = 0; i < 64; i++)
|
||||
{
|
||||
for (var j = 0; j < 64; j++)
|
||||
{
|
||||
WhiteTexture.SetPixel(j, i, color14);
|
||||
}
|
||||
}
|
||||
WhiteTexture.Apply();
|
||||
}
|
||||
|
||||
if (ToggleOnTexture == null)
|
||||
{
|
||||
ToggleOnTexture = new Texture2D(16, 16, TextureFormat.RGBA32, false);
|
||||
var color15 = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
|
||||
var color16 = new Color32(0, 0, 0, 0);
|
||||
for (var i = 0; i < 16; i++)
|
||||
{
|
||||
for (var j = 0; j < 16; j++)
|
||||
{
|
||||
var color17 = j is >= 1 and <= 12 && i is >= 2 and <= 13 ? color15 : color16;
|
||||
ToggleOnTexture.SetPixel(j, i, color17);
|
||||
}
|
||||
}
|
||||
ToggleOnTexture.Apply();
|
||||
}
|
||||
|
||||
if (ToggleOffTexture == null)
|
||||
{
|
||||
ToggleOffTexture = new Texture2D(16, 16, TextureFormat.RGBA32, false);
|
||||
var color18 = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
|
||||
var color19 = new Color32(0, 0, 0, byte.MaxValue);
|
||||
var color20 = new Color32(0, 0, 0, 0);
|
||||
for (var i = 0; i < 16; i++)
|
||||
{
|
||||
for (var j = 0; j < 16; j++)
|
||||
{
|
||||
var color21 = j < 1 || j > 12 || i < 2 || i > 13 ? color20 : j is > 1 and < 12 && i is > 2 and < 13 ? color19 : color18;
|
||||
ToggleOffTexture.SetPixel(j, i, color21);
|
||||
}
|
||||
}
|
||||
ToggleOffTexture.Apply();
|
||||
}
|
||||
|
||||
if (CloseButtonGrayBorderTexture != null)
|
||||
{
|
||||
CloseButtonGrayBorderTexture = new Texture2D(16, 16, TextureFormat.RGBA32, false);
|
||||
var color22 = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
|
||||
var color23 = new Color32(64, 64, 64, byte.MaxValue);
|
||||
var color24 = new Color32(0, 0, 0, byte.MaxValue);
|
||||
var color25 = new Color32(0, 0, 0, 0);
|
||||
for (var i = 0; i < 16; i++)
|
||||
{
|
||||
for (var j = 0; j < 16; j++)
|
||||
{
|
||||
var color26 = j < 1 || j > 12 || i < 2 || i > 13 ? color25 : j is > 1 and < 12 && i is > 2 and < 13 ? color24 : color23;
|
||||
CloseButtonGrayBorderTexture.SetPixel(j, i, color26);
|
||||
}
|
||||
}
|
||||
for (var i = 4; i <= 9; i++)
|
||||
{
|
||||
CloseButtonGrayBorderTexture.SetPixel(i, i + 1, color22);
|
||||
CloseButtonGrayBorderTexture.SetPixel(i, 14 - i, color22);
|
||||
}
|
||||
CloseButtonGrayBorderTexture.Apply();
|
||||
}
|
||||
|
||||
if (CloseButtonWhiteBorderTexture == null)
|
||||
{
|
||||
CloseButtonWhiteBorderTexture = new Texture2D(16, 16, TextureFormat.RGBA32, false);
|
||||
var color27 = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
|
||||
var color28 = new Color32(0, 0, 0, byte.MaxValue);
|
||||
var color29 = new Color32(0, 0, 0, 0);
|
||||
for (var i = 0; i < 16; i++)
|
||||
{
|
||||
for (var j = 0; j < 16; j++)
|
||||
{
|
||||
var color30 = j < 1 || j > 12 || i < 2 || i > 13 ? color29 : j is > 1 and < 12 && i is > 2 and < 13 ? color28 : color27;
|
||||
CloseButtonWhiteBorderTexture.SetPixel(j, i, color30);
|
||||
}
|
||||
}
|
||||
for (var i = 4; i <= 9; i++)
|
||||
{
|
||||
CloseButtonWhiteBorderTexture.SetPixel(i, i + 1, color27);
|
||||
CloseButtonWhiteBorderTexture.SetPixel(i, 14 - i, color27);
|
||||
}
|
||||
CloseButtonWhiteBorderTexture.Apply();
|
||||
}
|
||||
|
||||
WindowStyle ??= new GUIStyle(GUI.skin.window)
|
||||
{
|
||||
fontSize = 11,
|
||||
normal =
|
||||
{
|
||||
textColor = Color.white,
|
||||
background = GrayBorderBackgroundTexture
|
||||
},
|
||||
hover =
|
||||
{
|
||||
textColor = Color.white,
|
||||
background = GrayBorderBackgroundTexture
|
||||
},
|
||||
active =
|
||||
{
|
||||
textColor = Color.white,
|
||||
background = GrayBorderBackgroundTexture
|
||||
},
|
||||
focused =
|
||||
{
|
||||
textColor = Color.white,
|
||||
background = GrayBorderBackgroundTexture
|
||||
},
|
||||
onNormal =
|
||||
{
|
||||
textColor = Color.white,
|
||||
background = WhiteBorderBackgroundTexture
|
||||
},
|
||||
onHover =
|
||||
{
|
||||
textColor = Color.white,
|
||||
background = WhiteBorderBackgroundTexture
|
||||
},
|
||||
onActive =
|
||||
{
|
||||
textColor = Color.white,
|
||||
background = WhiteBorderBackgroundTexture
|
||||
},
|
||||
onFocused =
|
||||
{
|
||||
textColor = Color.white,
|
||||
background = WhiteBorderBackgroundTexture
|
||||
}
|
||||
};
|
||||
|
||||
BaseButtonStyle ??= new GUIStyle(GUI.skin.button)
|
||||
{
|
||||
normal =
|
||||
{
|
||||
textColor = Color.white,
|
||||
background = GrayBorderTexture
|
||||
},
|
||||
hover =
|
||||
{
|
||||
textColor = Color.white,
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
active =
|
||||
{
|
||||
textColor = Color.white,
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
focused =
|
||||
{
|
||||
textColor = Color.white,
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
onNormal =
|
||||
{
|
||||
textColor = Color.white,
|
||||
background = GrayBorderTexture
|
||||
},
|
||||
onHover =
|
||||
{
|
||||
textColor = Color.white,
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
onActive =
|
||||
{
|
||||
textColor = Color.white,
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
onFocused =
|
||||
{
|
||||
textColor = Color.white,
|
||||
background = WhiteBorderTexture
|
||||
}
|
||||
};
|
||||
|
||||
BaseToolbarButtonStyle ??= new GUIStyle(BaseButtonStyle)
|
||||
{
|
||||
normal =
|
||||
{
|
||||
textColor = Color.gray
|
||||
},
|
||||
hover =
|
||||
{
|
||||
textColor = Color.gray
|
||||
},
|
||||
active =
|
||||
{
|
||||
textColor = Color.gray
|
||||
},
|
||||
focused =
|
||||
{
|
||||
textColor = Color.gray
|
||||
},
|
||||
onNormal =
|
||||
{
|
||||
background = WhiteBorderBackgroundTexture
|
||||
}
|
||||
};
|
||||
|
||||
BaseVerticalScrollBarStyle ??= new GUIStyle(GUI.skin.verticalScrollbar)
|
||||
{
|
||||
name = "cruiseassist.verticalscrollbar",
|
||||
normal =
|
||||
{
|
||||
background = GrayBorderTexture
|
||||
},
|
||||
hover =
|
||||
{
|
||||
background = GrayBorderTexture
|
||||
},
|
||||
active =
|
||||
{
|
||||
background = GrayBorderTexture
|
||||
},
|
||||
focused =
|
||||
{
|
||||
background = GrayBorderTexture
|
||||
},
|
||||
onNormal =
|
||||
{
|
||||
background = GrayBorderTexture
|
||||
},
|
||||
onHover =
|
||||
{
|
||||
background = GrayBorderTexture
|
||||
},
|
||||
onActive =
|
||||
{
|
||||
background = GrayBorderTexture
|
||||
},
|
||||
onFocused =
|
||||
{
|
||||
background = GrayBorderTexture
|
||||
}
|
||||
};
|
||||
|
||||
BaseHorizontalSliderStyle ??= new GUIStyle(GUI.skin.horizontalSlider)
|
||||
{
|
||||
normal =
|
||||
{
|
||||
background = GrayBorderTexture
|
||||
},
|
||||
hover =
|
||||
{
|
||||
background = GrayBorderTexture
|
||||
},
|
||||
active =
|
||||
{
|
||||
background = GrayBorderTexture
|
||||
},
|
||||
focused =
|
||||
{
|
||||
background = GrayBorderTexture
|
||||
},
|
||||
onNormal =
|
||||
{
|
||||
background = GrayBorderTexture
|
||||
},
|
||||
onHover =
|
||||
{
|
||||
background = GrayBorderTexture
|
||||
},
|
||||
onActive =
|
||||
{
|
||||
background = GrayBorderTexture
|
||||
},
|
||||
onFocused =
|
||||
{
|
||||
background = GrayBorderTexture
|
||||
}
|
||||
};
|
||||
|
||||
BaseHorizontalSliderThumbStyle ??= new GUIStyle(GUI.skin.horizontalSliderThumb)
|
||||
{
|
||||
normal =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
hover =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
active =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
focused =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
onNormal =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
onHover =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
onActive =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
onFocused =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
}
|
||||
};
|
||||
|
||||
BaseToggleStyle ??= new GUIStyle(GUI.skin.toggle)
|
||||
{
|
||||
normal =
|
||||
{
|
||||
background = ToggleOffTexture
|
||||
},
|
||||
hover =
|
||||
{
|
||||
background = ToggleOffTexture
|
||||
},
|
||||
active =
|
||||
{
|
||||
background = ToggleOffTexture
|
||||
},
|
||||
focused =
|
||||
{
|
||||
background = ToggleOffTexture
|
||||
},
|
||||
onNormal =
|
||||
{
|
||||
background = ToggleOnTexture
|
||||
},
|
||||
onHover =
|
||||
{
|
||||
background = ToggleOnTexture
|
||||
},
|
||||
onActive =
|
||||
{
|
||||
background = ToggleOnTexture
|
||||
},
|
||||
onFocused =
|
||||
{
|
||||
background = ToggleOnTexture
|
||||
}
|
||||
};
|
||||
|
||||
BaseTextFieldStyle ??= new GUIStyle(GUI.skin.textField)
|
||||
{
|
||||
normal =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
hover =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
active =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
focused =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
onNormal =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
onHover =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
onActive =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
onFocused =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
}
|
||||
};
|
||||
|
||||
CloseButtonStyle ??= new GUIStyle(GUI.skin.button)
|
||||
{
|
||||
normal =
|
||||
{
|
||||
background = CloseButtonGrayBorderTexture
|
||||
},
|
||||
hover =
|
||||
{
|
||||
background = CloseButtonWhiteBorderTexture
|
||||
},
|
||||
active =
|
||||
{
|
||||
background = CloseButtonWhiteBorderTexture
|
||||
},
|
||||
focused =
|
||||
{
|
||||
background = CloseButtonWhiteBorderTexture
|
||||
},
|
||||
onNormal =
|
||||
{
|
||||
background = CloseButtonGrayBorderTexture
|
||||
},
|
||||
onHover =
|
||||
{
|
||||
background = CloseButtonWhiteBorderTexture
|
||||
},
|
||||
onActive =
|
||||
{
|
||||
background = CloseButtonWhiteBorderTexture
|
||||
},
|
||||
onFocused =
|
||||
{
|
||||
background = CloseButtonWhiteBorderTexture
|
||||
}
|
||||
};
|
||||
|
||||
if (_verticalScrollBarSkins == null)
|
||||
{
|
||||
_verticalScrollBarSkins = new List<GUIStyle>();
|
||||
var guistyle = new GUIStyle(GUI.skin.verticalScrollbarThumb)
|
||||
{
|
||||
name = "cruiseassist.verticalscrollbarthumb",
|
||||
normal =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
hover =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
active =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
focused =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
onNormal =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
onHover =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
onActive =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
},
|
||||
onFocused =
|
||||
{
|
||||
background = WhiteBorderTexture
|
||||
}
|
||||
};
|
||||
_verticalScrollBarSkins.Add(guistyle);
|
||||
var guistyle2 = new GUIStyle(GUI.skin.verticalScrollbarUpButton)
|
||||
{
|
||||
name = "cruiseassist.verticalscrollbarupbutton",
|
||||
normal =
|
||||
{
|
||||
background = BlackTexture
|
||||
},
|
||||
hover =
|
||||
{
|
||||
background = BlackTexture
|
||||
},
|
||||
active =
|
||||
{
|
||||
background = BlackTexture
|
||||
},
|
||||
focused =
|
||||
{
|
||||
background = BlackTexture
|
||||
},
|
||||
onNormal =
|
||||
{
|
||||
background = BlackTexture
|
||||
},
|
||||
onHover =
|
||||
{
|
||||
background = BlackTexture
|
||||
},
|
||||
onActive =
|
||||
{
|
||||
background = BlackTexture
|
||||
},
|
||||
onFocused =
|
||||
{
|
||||
background = BlackTexture
|
||||
}
|
||||
};
|
||||
_verticalScrollBarSkins.Add(guistyle2);
|
||||
var guistyle3 = new GUIStyle(GUI.skin.verticalScrollbarDownButton)
|
||||
{
|
||||
name = "cruiseassist.verticalscrollbardownbutton",
|
||||
normal =
|
||||
{
|
||||
background = BlackTexture
|
||||
},
|
||||
hover =
|
||||
{
|
||||
background = BlackTexture
|
||||
},
|
||||
active =
|
||||
{
|
||||
background = BlackTexture
|
||||
},
|
||||
focused =
|
||||
{
|
||||
background = BlackTexture
|
||||
},
|
||||
onNormal =
|
||||
{
|
||||
background = BlackTexture
|
||||
},
|
||||
onHover =
|
||||
{
|
||||
background = BlackTexture
|
||||
},
|
||||
onActive =
|
||||
{
|
||||
background = BlackTexture
|
||||
},
|
||||
onFocused =
|
||||
{
|
||||
background = BlackTexture
|
||||
}
|
||||
};
|
||||
_verticalScrollBarSkins.Add(guistyle3);
|
||||
GUI.skin.customStyles = GUI.skin.customStyles.Concat(_verticalScrollBarSkins).ToArray();
|
||||
}
|
||||
switch (ViewMode)
|
||||
{
|
||||
case CruiseAssistMainUIViewMode.Full:
|
||||
Rect[WIdx].width = 398f;
|
||||
Rect[WIdx].height = 150f;
|
||||
break;
|
||||
case CruiseAssistMainUIViewMode.Mini:
|
||||
Rect[WIdx].width = 288f;
|
||||
Rect[WIdx].height = 70f;
|
||||
break;
|
||||
}
|
||||
Rect[WIdx] = GUILayout.Window(99030291, Rect[WIdx], WindowFunction, "CruiseAssist", WindowStyle, Array.Empty<GUILayoutOption>());
|
||||
var scale = Scale / 100f;
|
||||
if (Screen.width / scale < Rect[WIdx].xMax)
|
||||
{
|
||||
Rect[WIdx].x = Screen.width / scale - Rect[WIdx].width;
|
||||
}
|
||||
|
||||
if (Rect[WIdx].x < 0f)
|
||||
{
|
||||
Rect[WIdx].x = 0f;
|
||||
}
|
||||
|
||||
if (Screen.height / scale < Rect[WIdx].yMax)
|
||||
{
|
||||
Rect[WIdx].y = Screen.height / scale - Rect[WIdx].height;
|
||||
}
|
||||
|
||||
if (Rect[WIdx].y < 0f)
|
||||
{
|
||||
Rect[WIdx].y = 0f;
|
||||
}
|
||||
|
||||
if (LastCheckWindowLeft[WIdx] != float.MinValue)
|
||||
{
|
||||
if (Rect[WIdx].x != LastCheckWindowLeft[WIdx] || Rect[WIdx].y != LastCheckWindowTop[WIdx])
|
||||
{
|
||||
NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
}
|
||||
LastCheckWindowLeft[WIdx] = Rect[WIdx].x;
|
||||
LastCheckWindowTop[WIdx] = Rect[WIdx].y;
|
||||
if (NextCheckGameTick <= GameMain.gameTick)
|
||||
{
|
||||
ConfigManager.CheckConfig(ConfigManager.Step.State);
|
||||
}
|
||||
}
|
||||
|
||||
private static void WindowFunction(int windowId)
|
||||
{
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
if (ViewMode == CruiseAssistMainUIViewMode.Full)
|
||||
{
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
var color = CruiseAssistPlugin.State == CruiseAssistState.ToStar ? Color.cyan : Color.white;
|
||||
var color2 = CruiseAssistPlugin.State == CruiseAssistState.ToPlanet ? Color.cyan : Color.white;
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
var guistyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 50f,
|
||||
fixedHeight = 36f,
|
||||
fontSize = 12,
|
||||
alignment = TextAnchor.UpperLeft
|
||||
};
|
||||
var guistyle2 = new GUIStyle(guistyle);
|
||||
guistyle.normal.textColor = color;
|
||||
GUILayout.Label("Target\n System:", guistyle, Array.Empty<GUILayoutOption>());
|
||||
guistyle2.normal.textColor = color2;
|
||||
GUILayout.Label("Target\n Planet:", guistyle2, Array.Empty<GUILayoutOption>());
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
var guistyle3 = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 240f,
|
||||
fixedHeight = 36f,
|
||||
fontSize = 14,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
};
|
||||
var guistyle4 = new GUIStyle(guistyle3);
|
||||
if (CruiseAssistPlugin.TargetStar != null && ((GameMain.localStar != null && CruiseAssistPlugin.TargetStar.id != GameMain.localStar.id) || CruiseAssistPlugin.TargetPlanet == null))
|
||||
{
|
||||
guistyle3.normal.textColor = color;
|
||||
GUILayout.Label(CruiseAssistPlugin.GetStarName(CruiseAssistPlugin.TargetStar), guistyle3, Array.Empty<GUILayoutOption>());
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Label(" ", guistyle3, Array.Empty<GUILayoutOption>());
|
||||
}
|
||||
|
||||
if (CruiseAssistPlugin.TargetPlanet != null)
|
||||
{
|
||||
guistyle4.normal.textColor = color2;
|
||||
GUILayout.Label(CruiseAssistPlugin.GetPlanetName(CruiseAssistPlugin.TargetPlanet), guistyle4, Array.Empty<GUILayoutOption>());
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Label(" ", guistyle4, Array.Empty<GUILayoutOption>());
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
var actionSail = GameMain.mainPlayer.controller.actionSail;
|
||||
var visualUvel = actionSail.visual_uvel;
|
||||
var warping = GameMain.mainPlayer.warping;
|
||||
var magnitude = warping ? (visualUvel + actionSail.currentWarpVelocity).magnitude : visualUvel.magnitude;
|
||||
var guistyle5 = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 80f,
|
||||
fixedHeight = 36f,
|
||||
fontSize = 12,
|
||||
alignment = TextAnchor.MiddleRight
|
||||
};
|
||||
var guistyle6 = new GUIStyle(guistyle5);
|
||||
if (CruiseAssistPlugin.TargetStar != null && ((GameMain.localStar != null && CruiseAssistPlugin.TargetStar.id != GameMain.localStar.id) || CruiseAssistPlugin.TargetPlanet == null))
|
||||
{
|
||||
guistyle5.normal.textColor = color;
|
||||
var text = GameMain.mainPlayer.sailing ? TimeToString(CruiseAssistPlugin.TargetRange / magnitude) : "-- -- --";
|
||||
GUILayout.Label(RangeToString(CruiseAssistPlugin.TargetRange) + "\n" + text, guistyle5, Array.Empty<GUILayoutOption>());
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Label(" \n ", guistyle5, Array.Empty<GUILayoutOption>());
|
||||
}
|
||||
|
||||
if (CruiseAssistPlugin.TargetPlanet != null)
|
||||
{
|
||||
guistyle6.normal.textColor = color2;
|
||||
var text2 = GameMain.mainPlayer.sailing ? TimeToString(CruiseAssistPlugin.TargetRange / magnitude) : "-- -- --";
|
||||
GUILayout.Label(RangeToString(CruiseAssistPlugin.TargetRange) + "\n" + text2, guistyle6, Array.Empty<GUILayoutOption>());
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Label(" \n ", guistyle6, Array.Empty<GUILayoutOption>());
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
}
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
var guistyle7 = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 160f,
|
||||
fixedHeight = 32f,
|
||||
fontSize = 14,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
};
|
||||
if (!CruiseAssistPlugin.Enable)
|
||||
{
|
||||
GUILayout.Label("Cruise Assist Disabled.", guistyle7, Array.Empty<GUILayoutOption>());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CruiseAssistPlugin.State == CruiseAssistState.Inactive || CruiseAssistPlugin.Interrupt)
|
||||
{
|
||||
GUILayout.Label("Cruise Assist Inactive.", guistyle7, Array.Empty<GUILayoutOption>());
|
||||
}
|
||||
else
|
||||
{
|
||||
guistyle7.normal.textColor = Color.cyan;
|
||||
GUILayout.Label("Cruise Assist Active.", guistyle7, Array.Empty<GUILayoutOption>());
|
||||
}
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
var guistyle8 = new GUIStyle(BaseButtonStyle)
|
||||
{
|
||||
fixedWidth = 50f,
|
||||
fixedHeight = 18f,
|
||||
fontSize = 11,
|
||||
alignment = TextAnchor.MiddleCenter
|
||||
};
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
if (GUILayout.Button("Config", guistyle8, Array.Empty<GUILayoutOption>()))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistConfigUI.Show[WIdx] = !CruiseAssistConfigUI.Show[WIdx];
|
||||
if (CruiseAssistConfigUI.Show[WIdx])
|
||||
{
|
||||
CruiseAssistConfigUI.TempScale = Scale;
|
||||
}
|
||||
}
|
||||
|
||||
if (GUILayout.Button(CruiseAssistPlugin.Enable ? "Enable" : "Disable", guistyle8, Array.Empty<GUILayoutOption>()))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistPlugin.Enable = !CruiseAssistPlugin.Enable;
|
||||
NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
if (GUILayout.Button("StarList", guistyle8, Array.Empty<GUILayoutOption>()))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistStarListUI.Show[WIdx] = !CruiseAssistStarListUI.Show[WIdx];
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Cancel", guistyle8, Array.Empty<GUILayoutOption>()))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
CruiseAssistStarListUI.SelectStar(null, null);
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
GUI.DragWindow();
|
||||
}
|
||||
|
||||
public static string RangeToString(double range)
|
||||
{
|
||||
return range switch
|
||||
{
|
||||
< 10000.0 => (int)(range + 0.5) + "m ",
|
||||
< 600000.0 => (range / 40000.0).ToString("0.00") + "AU",
|
||||
_ => (range / 2400000.0).ToString("0.00") + "Ly"
|
||||
};
|
||||
}
|
||||
|
||||
private static string TimeToString(double time)
|
||||
{
|
||||
var sec = (int)(time + 0.5);
|
||||
var min = sec / 60;
|
||||
var hour = min / 60;
|
||||
sec %= 60;
|
||||
min %= 60;
|
||||
return $"{hour:00} {min:00} {sec:00}";
|
||||
}
|
||||
|
||||
public static float Scale = 150f;
|
||||
|
||||
public static int WIdx = 0;
|
||||
|
||||
public static CruiseAssistMainUIViewMode ViewMode = CruiseAssistMainUIViewMode.Full;
|
||||
|
||||
public const float WindowWidthFull = 398f;
|
||||
|
||||
public const float WindowHeightFull = 150f;
|
||||
|
||||
public const float WindowWidthMini = 288f;
|
||||
|
||||
public const float WindowHeightMini = 70f;
|
||||
|
||||
public static readonly Rect[] Rect = {
|
||||
new Rect(0f, 0f, 398f, 150f),
|
||||
new Rect(0f, 0f, 398f, 150f)
|
||||
};
|
||||
|
||||
private static readonly float[] LastCheckWindowLeft = { float.MinValue, float.MinValue };
|
||||
|
||||
private static readonly float[] LastCheckWindowTop = { float.MinValue, float.MinValue };
|
||||
|
||||
public static long NextCheckGameTick = long.MaxValue;
|
||||
|
||||
public static Texture2D WhiteBorderBackgroundTexture;
|
||||
|
||||
public static Texture2D GrayBorderBackgroundTexture;
|
||||
|
||||
public static Texture2D WhiteBorderTexture;
|
||||
|
||||
public static Texture2D GrayBorderTexture;
|
||||
|
||||
public static Texture2D BlackTexture;
|
||||
|
||||
public static Texture2D WhiteTexture;
|
||||
|
||||
public static Texture2D ToggleOnTexture;
|
||||
|
||||
public static Texture2D ToggleOffTexture;
|
||||
|
||||
public static Texture2D CloseButtonGrayBorderTexture;
|
||||
|
||||
public static Texture2D CloseButtonWhiteBorderTexture;
|
||||
|
||||
public static GUIStyle WindowStyle;
|
||||
|
||||
public static GUIStyle BaseButtonStyle;
|
||||
|
||||
public static GUIStyle BaseToolbarButtonStyle;
|
||||
|
||||
public static GUIStyle BaseVerticalScrollBarStyle;
|
||||
|
||||
public static GUIStyle BaseHorizontalSliderStyle;
|
||||
|
||||
public static GUIStyle BaseHorizontalSliderThumbStyle;
|
||||
|
||||
public static GUIStyle BaseToggleStyle;
|
||||
|
||||
public static GUIStyle BaseTextFieldStyle;
|
||||
|
||||
public static GUIStyle CloseButtonStyle;
|
||||
|
||||
private static List<GUIStyle> _verticalScrollBarSkins;
|
||||
}
|
||||
526
CruiseAssist/UI/CruiseAssistStarListUI.cs
Normal file
526
CruiseAssist/UI/CruiseAssistStarListUI.cs
Normal file
@@ -0,0 +1,526 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace CruiseAssist.UI;
|
||||
|
||||
public class CruiseAssistStarListUI
|
||||
{
|
||||
public static void OnGUI()
|
||||
{
|
||||
wIdx = CruiseAssistMainUI.WIdx;
|
||||
Rect[wIdx] = GUILayout.Window(99030292, Rect[wIdx], WindowFunction, "CruiseAssist - StarList", CruiseAssistMainUI.WindowStyle, Array.Empty<GUILayoutOption>());
|
||||
var scale = CruiseAssistMainUI.Scale / 100f;
|
||||
if (Screen.width / scale < Rect[wIdx].xMax)
|
||||
{
|
||||
Rect[wIdx].x = Screen.width / scale - Rect[wIdx].width;
|
||||
}
|
||||
|
||||
if (Rect[wIdx].x < 0f)
|
||||
{
|
||||
Rect[wIdx].x = 0f;
|
||||
}
|
||||
|
||||
if (Screen.height / scale < Rect[wIdx].yMax)
|
||||
{
|
||||
Rect[wIdx].y = Screen.height / scale - Rect[wIdx].height;
|
||||
}
|
||||
|
||||
if (Rect[wIdx].y < 0f)
|
||||
{
|
||||
Rect[wIdx].y = 0f;
|
||||
}
|
||||
|
||||
if (lastCheckWindowLeft[wIdx] != float.MinValue)
|
||||
{
|
||||
if (Rect[wIdx].x != lastCheckWindowLeft[wIdx] || Rect[wIdx].y != lastCheckWindowTop[wIdx])
|
||||
{
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
}
|
||||
lastCheckWindowLeft[wIdx] = Rect[wIdx].x;
|
||||
lastCheckWindowTop[wIdx] = Rect[wIdx].y;
|
||||
}
|
||||
|
||||
public static void WindowFunction(int windowId)
|
||||
{
|
||||
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
var guistyle = new GUIStyle(CruiseAssistMainUI.BaseToolbarButtonStyle)
|
||||
{
|
||||
fixedWidth = 80f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12
|
||||
};
|
||||
var array = new[] { "Normal", "History", "Bookmark" };
|
||||
GUI.changed = false;
|
||||
var selectedIndex = GUILayout.Toolbar(ListSelected, array, guistyle, Array.Empty<GUILayoutOption>());
|
||||
if (GUI.changed)
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
}
|
||||
|
||||
if (selectedIndex != ListSelected)
|
||||
{
|
||||
ListSelected = selectedIndex;
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
scrollPos[ListSelected] = GUILayout.BeginScrollView(scrollPos[ListSelected], GUIStyle.none, new GUIStyle(CruiseAssistMainUI.BaseVerticalScrollBarStyle), Array.Empty<GUILayoutOption>());
|
||||
var nameLabelStyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 240f,
|
||||
stretchHeight = true,
|
||||
fontSize = 14,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
};
|
||||
var nRangeLabelStyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 60f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 14,
|
||||
alignment = TextAnchor.MiddleRight
|
||||
};
|
||||
var hRangeLabelStyle = new GUIStyle(nRangeLabelStyle)
|
||||
{
|
||||
fixedHeight = 40f
|
||||
};
|
||||
var nActionButtonStyle = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle)
|
||||
{
|
||||
fixedWidth = 40f,
|
||||
fixedHeight = 18f,
|
||||
margin =
|
||||
{
|
||||
top = 6
|
||||
},
|
||||
fontSize = 12
|
||||
};
|
||||
var hActionButtonStyle = new GUIStyle(nActionButtonStyle)
|
||||
{
|
||||
margin =
|
||||
{
|
||||
top = 16
|
||||
}
|
||||
};
|
||||
var nSortButtonStyle = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle)
|
||||
{
|
||||
fixedWidth = 20f,
|
||||
fixedHeight = 18f,
|
||||
margin =
|
||||
{
|
||||
top = 6
|
||||
},
|
||||
fontSize = 12
|
||||
};
|
||||
var hSortButtonStyle = new GUIStyle(nSortButtonStyle)
|
||||
{
|
||||
margin =
|
||||
{
|
||||
top = 16
|
||||
}
|
||||
};
|
||||
switch (ListSelected)
|
||||
{
|
||||
case 0:
|
||||
GameMain.galaxy.stars.Select(star => new Commons.Tuple<StarData, double>(star, (star.uPosition - GameMain.mainPlayer.uPosition).magnitude)).OrderBy(tuple => tuple.Item2).Do(delegate(Commons.Tuple<StarData, double> tuple)
|
||||
{
|
||||
var star = tuple.Item1;
|
||||
var range = tuple.Item2;
|
||||
var starName = CruiseAssistPlugin.GetStarName(star);
|
||||
var ok = false;
|
||||
if (GameMain.localStar != null && star.id == GameMain.localStar.id)
|
||||
{
|
||||
ok = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CruiseAssistPlugin.SelectTargetStar != null && star.id == CruiseAssistPlugin.SelectTargetStar.id && GameMain.history.universeObserveLevel >= (range >= 14400000.0 ? 4 : 3))
|
||||
{
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (ok)
|
||||
{
|
||||
star.planets.Select(planet => new Commons.Tuple<PlanetData, double>(planet, (planet.uPosition - GameMain.mainPlayer.uPosition).magnitude)).AddItem(new Commons.Tuple<PlanetData, double>(null, (star.uPosition - GameMain.mainPlayer.uPosition).magnitude)).OrderBy(tuple2 => tuple2.Item2).Do(delegate(Commons.Tuple<PlanetData, double> tuple2)
|
||||
{
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
var planetData = tuple2.Item1;
|
||||
var distance = tuple2.Item2;
|
||||
nameLabelStyle.normal.textColor = Color.white;
|
||||
nRangeLabelStyle.normal.textColor = Color.white;
|
||||
float height;
|
||||
if (planetData == null)
|
||||
{
|
||||
if (CruiseAssistPlugin.SelectTargetPlanet == null && CruiseAssistPlugin.SelectTargetStar != null && star.id == CruiseAssistPlugin.SelectTargetStar.id)
|
||||
{
|
||||
nameLabelStyle.normal.textColor = Color.cyan;
|
||||
nRangeLabelStyle.normal.textColor = Color.cyan;
|
||||
}
|
||||
var name = starName;
|
||||
if (CruiseAssistPlugin.Conf.MarkVisitedFlag)
|
||||
{
|
||||
name = (star.planets.Where(p => p.factory != null).Count() > 0 ? "● " : "") + name;
|
||||
}
|
||||
GUILayout.Label(name, nameLabelStyle, Array.Empty<GUILayoutOption>());
|
||||
height = nameLabelStyle.CalcHeight(new GUIContent(name), nameLabelStyle.fixedWidth);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CruiseAssistPlugin.SelectTargetPlanet != null && planetData.id == CruiseAssistPlugin.SelectTargetPlanet.id)
|
||||
{
|
||||
nameLabelStyle.normal.textColor = Color.cyan;
|
||||
nRangeLabelStyle.normal.textColor = Color.cyan;
|
||||
}
|
||||
var name = starName + " - " + CruiseAssistPlugin.GetPlanetName(planetData);
|
||||
if (CruiseAssistPlugin.Conf.MarkVisitedFlag)
|
||||
{
|
||||
name = (planetData.factory != null ? "● " : "") + name;
|
||||
}
|
||||
GUILayout.Label(name, nameLabelStyle, Array.Empty<GUILayoutOption>());
|
||||
height = nameLabelStyle.CalcHeight(new GUIContent(name), nameLabelStyle.fixedWidth);
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Label(CruiseAssistMainUI.RangeToString(planetData == null ? range : distance), height < 30f ? nRangeLabelStyle : hRangeLabelStyle, Array.Empty<GUILayoutOption>());
|
||||
if (GUILayout.Button(actionSelected[ListSelected] == 0 ? "SET" : planetData == null ? "-" : CruiseAssistPlugin.Bookmark.Contains(planetData.id) ? "DEL" : "ADD", height < 30f ? nActionButtonStyle : hActionButtonStyle, Array.Empty<GUILayoutOption>()))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
if (actionSelected[ListSelected] == 0)
|
||||
{
|
||||
SelectStar(star, planetData);
|
||||
var closeStarListWhenSetTargetPlanetFlag = CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag;
|
||||
if (closeStarListWhenSetTargetPlanetFlag)
|
||||
{
|
||||
Show[wIdx] = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (planetData != null)
|
||||
{
|
||||
if (CruiseAssistPlugin.Bookmark.Contains(planetData.id))
|
||||
{
|
||||
CruiseAssistPlugin.Bookmark.Remove(planetData.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CruiseAssistPlugin.Bookmark.Count <= 128)
|
||||
{
|
||||
CruiseAssistPlugin.Bookmark.Add(planetData.id);
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
nameLabelStyle.normal.textColor = Color.white;
|
||||
nRangeLabelStyle.normal.textColor = Color.white;
|
||||
if (CruiseAssistPlugin.SelectTargetStar != null && star.id == CruiseAssistPlugin.SelectTargetStar.id)
|
||||
{
|
||||
nameLabelStyle.normal.textColor = Color.cyan;
|
||||
nRangeLabelStyle.normal.textColor = Color.cyan;
|
||||
}
|
||||
var name = starName;
|
||||
if (CruiseAssistPlugin.Conf.MarkVisitedFlag)
|
||||
{
|
||||
name = (star.planets.Count(p => p.factory != null) > 0 ? "● " : "") + name;
|
||||
}
|
||||
GUILayout.Label(name, nameLabelStyle, Array.Empty<GUILayoutOption>());
|
||||
var height = nameLabelStyle.CalcHeight(new GUIContent(name), nameLabelStyle.fixedWidth);
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Label(CruiseAssistMainUI.RangeToString(range), height < 30f ? nRangeLabelStyle : hRangeLabelStyle, Array.Empty<GUILayoutOption>());
|
||||
if (GUILayout.Button(actionSelected[ListSelected] == 0 ? "SET" : "-", height < 30f ? nActionButtonStyle : hActionButtonStyle, Array.Empty<GUILayoutOption>()))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
if (actionSelected[ListSelected] == 0)
|
||||
{
|
||||
SelectStar(star, null);
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 1 or 2:
|
||||
{
|
||||
var highlighted = false;
|
||||
var enumBookmark = ListSelected != 1 ? CruiseAssistPlugin.Bookmark.ToList() : Enumerable.Reverse(CruiseAssistPlugin.History);
|
||||
if (ListSelected == 1 && actionSelected[ListSelected] != 2 && CruiseAssistPlugin.Conf.HideDuplicateHistoryFlag)
|
||||
{
|
||||
enumBookmark = enumBookmark.Distinct();
|
||||
}
|
||||
var listIndex = -1;
|
||||
enumBookmark.Do(delegate(int id)
|
||||
{
|
||||
listIndex += 1;
|
||||
var planetData = GameMain.galaxy.PlanetById(id);
|
||||
if (planetData == null) return;
|
||||
var magnitude = (planetData.uPosition - GameMain.mainPlayer.uPosition).magnitude;
|
||||
nameLabelStyle.normal.textColor = Color.white;
|
||||
nRangeLabelStyle.normal.textColor = Color.white;
|
||||
if (!highlighted && CruiseAssistPlugin.SelectTargetPlanet != null && planetData.id == CruiseAssistPlugin.SelectTargetPlanet.id)
|
||||
{
|
||||
nameLabelStyle.normal.textColor = Color.cyan;
|
||||
nRangeLabelStyle.normal.textColor = Color.cyan;
|
||||
highlighted = true;
|
||||
}
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
var name = CruiseAssistPlugin.GetStarName(planetData.star) + " - " + CruiseAssistPlugin.GetPlanetName(planetData);
|
||||
if (CruiseAssistPlugin.Conf.MarkVisitedFlag)
|
||||
{
|
||||
name = (planetData.factory != null ? "● " : "") + name;
|
||||
}
|
||||
GUILayout.Label(name, nameLabelStyle, Array.Empty<GUILayoutOption>());
|
||||
var height = nameLabelStyle.CalcHeight(new GUIContent(name), nameLabelStyle.fixedWidth);
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Label(CruiseAssistMainUI.RangeToString(magnitude), height < 30f ? nRangeLabelStyle : hRangeLabelStyle, Array.Empty<GUILayoutOption>());
|
||||
if (ListSelected == 2 && actionSelected[ListSelected] == 1)
|
||||
{
|
||||
var index = CruiseAssistPlugin.Bookmark.IndexOf(id);
|
||||
var first = index == 0;
|
||||
var last = index == CruiseAssistPlugin.Bookmark.Count - 1;
|
||||
if (GUILayout.Button(last ? "-" : "↓", height < 30f ? nSortButtonStyle : hSortButtonStyle, Array.Empty<GUILayoutOption>()))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
if (!last)
|
||||
{
|
||||
CruiseAssistPlugin.Bookmark.RemoveAt(index);
|
||||
CruiseAssistPlugin.Bookmark.Insert(index + 1, id);
|
||||
}
|
||||
}
|
||||
|
||||
if (GUILayout.Button(first ? "-" : "↑", height < 30f ? nSortButtonStyle : hSortButtonStyle, Array.Empty<GUILayoutOption>()))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
if (!first)
|
||||
{
|
||||
CruiseAssistPlugin.Bookmark.RemoveAt(index);
|
||||
CruiseAssistPlugin.Bookmark.Insert(index - 1, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GUILayout.Button(actionSelected[ListSelected] == 0 ? "SET" : actionSelected[ListSelected] == 2 ? ListSelected == 1 && listIndex == 0 ? "-" : "DEL" : CruiseAssistPlugin.Bookmark.Contains(id) ? "DEL" : "ADD", height < 30f ? nActionButtonStyle : hActionButtonStyle, Array.Empty<GUILayoutOption>()))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
switch (actionSelected[ListSelected])
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
SelectStar(planetData.star, planetData);
|
||||
if (CruiseAssistPlugin.Conf.CloseStarListWhenSetTargetPlanetFlag)
|
||||
{
|
||||
Show[wIdx] = false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if (ListSelected == 1)
|
||||
{
|
||||
if (CruiseAssistPlugin.Bookmark.Contains(id))
|
||||
{
|
||||
CruiseAssistPlugin.Bookmark.Remove(id);
|
||||
}
|
||||
else if (CruiseAssistPlugin.Bookmark.Count <= 128)
|
||||
{
|
||||
CruiseAssistPlugin.Bookmark.Add(id);
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (actionSelected[ListSelected] == 2)
|
||||
{
|
||||
switch (ListSelected)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
if (listIndex != 0)
|
||||
{
|
||||
CruiseAssistPlugin.History.RemoveAt(CruiseAssistPlugin.History.Count - 1 - listIndex);
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
CruiseAssistPlugin.Bookmark.Remove(planetData.id);
|
||||
CruiseAssistMainUI.NextCheckGameTick = GameMain.gameTick + 300L;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
GUILayout.EndScrollView();
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
|
||||
var buttonStyle = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle)
|
||||
{
|
||||
fixedWidth = 80f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12
|
||||
};
|
||||
var buttons = new[]
|
||||
{
|
||||
new[] { "Target", "Bookmark" },
|
||||
new[] { "Target", "Bookmark", "Delete" },
|
||||
new[] { "Target", "Sort", "Delete" }
|
||||
};
|
||||
if (GUILayout.Button(buttons[ListSelected][actionSelected[ListSelected]], buttonStyle, Array.Empty<GUILayoutOption>()))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
actionSelected[ListSelected]++;
|
||||
actionSelected[ListSelected] %= buttons[ListSelected].Length;
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
if (!CruiseAssistPlugin.Conf.HideBottomCloseButtonFlag && GUILayout.Button("Close", buttonStyle, Array.Empty<GUILayoutOption>()))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
Show[wIdx] = false;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
if (GUI.Button(new Rect(Rect[wIdx].width - 16f, 1f, 16f, 16f), "", CruiseAssistMainUI.CloseButtonStyle))
|
||||
{
|
||||
VFAudio.Create("ui-click-0", null, Vector3.zero, true);
|
||||
Show[wIdx] = false;
|
||||
}
|
||||
GUI.DragWindow();
|
||||
}
|
||||
|
||||
public static void SelectStar(StarData star, PlanetData planet)
|
||||
{
|
||||
CruiseAssistPlugin.SelectTargetStar = star;
|
||||
CruiseAssistPlugin.SelectTargetPlanet = planet;
|
||||
var uiGame = UIRoot.instance.uiGame;
|
||||
if (CruiseAssistPlugin.Conf.SelectFocusFlag && uiGame.starmap.active)
|
||||
{
|
||||
if (star != null)
|
||||
{
|
||||
var uistarmapStar = uiGame.starmap.starUIs.Where(s => s.star.id == star.id).FirstOrDefault();
|
||||
if (uistarmapStar != null)
|
||||
{
|
||||
UIStarmap_OnStarClick(uiGame.starmap, uistarmapStar);
|
||||
uiGame.starmap.OnCursorFunction2Click(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (planet != null)
|
||||
{
|
||||
var uistarmapPlanet = uiGame.starmap.planetUIs.Where(p => p.planet.id == planet.id).FirstOrDefault();
|
||||
if (uistarmapPlanet != null)
|
||||
{
|
||||
UIStarmap_OnPlanetClick(uiGame.starmap, uistarmapPlanet);
|
||||
uiGame.starmap.OnCursorFunction2Click(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (planet != null)
|
||||
{
|
||||
GameMain.mainPlayer.navigation.indicatorAstroId = planet.id;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (star != null)
|
||||
{
|
||||
GameMain.mainPlayer.navigation.indicatorAstroId = star.id * 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
GameMain.mainPlayer.navigation.indicatorAstroId = 0;
|
||||
}
|
||||
}
|
||||
CruiseAssistPlugin.SelectTargetAstroId = GameMain.mainPlayer.navigation.indicatorAstroId;
|
||||
CruiseAssistPlugin.Extensions.ForEach(delegate(ICruiseAssistExtensionAPI extension)
|
||||
{
|
||||
extension.SetTargetAstroId(CruiseAssistPlugin.SelectTargetAstroId);
|
||||
});
|
||||
}
|
||||
|
||||
private static void UIStarmap_OnStarClick(UIStarmap starmap, UIStarmapStar star)
|
||||
{
|
||||
var traverse = Traverse.Create(starmap);
|
||||
if (starmap.focusStar != star)
|
||||
{
|
||||
if (starmap.viewPlanet != null || (starmap.viewStar != null && star.star != starmap.viewStar))
|
||||
{
|
||||
starmap.screenCameraController.DisablePositionLock();
|
||||
}
|
||||
starmap.focusPlanet = null;
|
||||
starmap.focusStar = star;
|
||||
traverse.Field("_lastClickTime").SetValue(0.0);
|
||||
}
|
||||
traverse.Field("forceUpdateCursorView").SetValue(true);
|
||||
}
|
||||
|
||||
private static void UIStarmap_OnPlanetClick(UIStarmap starmap, UIStarmapPlanet planet)
|
||||
{
|
||||
var traverse = Traverse.Create(starmap);
|
||||
if (starmap.focusPlanet != planet)
|
||||
{
|
||||
if ((starmap.viewPlanet != null && planet.planet != starmap.viewPlanet) || starmap.viewStar != null)
|
||||
{
|
||||
starmap.screenCameraController.DisablePositionLock();
|
||||
}
|
||||
starmap.focusPlanet = planet;
|
||||
starmap.focusStar = null;
|
||||
traverse.Field("_lastClickTime").SetValue(0.0);
|
||||
}
|
||||
traverse.Field("forceUpdateCursorView").SetValue(true);
|
||||
}
|
||||
|
||||
private static int wIdx;
|
||||
|
||||
public const float WindowWidth = 400f;
|
||||
|
||||
public const float WindowHeight = 480f;
|
||||
|
||||
public static readonly bool[] Show = new bool[2];
|
||||
|
||||
public static readonly Rect[] Rect = {
|
||||
new Rect(0f, 0f, 400f, 480f),
|
||||
new Rect(0f, 0f, 400f, 480f)
|
||||
};
|
||||
|
||||
public static int ListSelected;
|
||||
|
||||
public static readonly int[] actionSelected = new int[3];
|
||||
|
||||
private static readonly float[] lastCheckWindowLeft = { float.MinValue, float.MinValue };
|
||||
|
||||
private static readonly float[] lastCheckWindowTop = { float.MinValue, float.MinValue };
|
||||
|
||||
private static readonly Vector2[] scrollPos = {
|
||||
Vector2.zero,
|
||||
Vector2.zero,
|
||||
Vector2.zero
|
||||
};
|
||||
|
||||
private const string VisitedMark = "● ";
|
||||
|
||||
private const string NonVisitMark = "";
|
||||
}
|
||||
BIN
CruiseAssist/package/icon.png
Normal file
BIN
CruiseAssist/package/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
9
CruiseAssist/package/manifest.json
Normal file
9
CruiseAssist/package/manifest.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "CruiseAssist",
|
||||
"version_number": "0.0.37",
|
||||
"website_url": "https://github.com/tanukinomori/DSPMod",
|
||||
"description": "Adjust the orientation to the target planet or star when moving between planets or star systems.",
|
||||
"dependencies": [
|
||||
"xiaoye97-BepInEx-5.4.17"
|
||||
]
|
||||
}
|
||||
@@ -2,6 +2,13 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompressSave", "CompressSave\CompressSave.csproj", "{A283A918-207F-4DD7-A098-F99EBE610558}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CruiseAssist", "CruiseAssist\CruiseAssist.csproj", "{DC0FFF11-FFD8-4600-9CDE-8DB6F00F38EB}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoPilot", "AutoPilot\AutoPilot.csproj", "{8F1E9D98-009B-4618-8827-5BFE7E0E2DD0}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{DC0FFF11-FFD8-4600-9CDE-8DB6F00F38EB} = {DC0FFF11-FFD8-4600-9CDE-8DB6F00F38EB}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -12,5 +19,13 @@ Global
|
||||
{A283A918-207F-4DD7-A098-F99EBE610558}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A283A918-207F-4DD7-A098-F99EBE610558}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A283A918-207F-4DD7-A098-F99EBE610558}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DC0FFF11-FFD8-4600-9CDE-8DB6F00F38EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DC0FFF11-FFD8-4600-9CDE-8DB6F00F38EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DC0FFF11-FFD8-4600-9CDE-8DB6F00F38EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DC0FFF11-FFD8-4600-9CDE-8DB6F00F38EB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8F1E9D98-009B-4618-8827-5BFE7E0E2DD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8F1E9D98-009B-4618-8827-5BFE7E0E2DD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8F1E9D98-009B-4618-8827-5BFE7E0E2DD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8F1E9D98-009B-4618-8827-5BFE7E0E2DD0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Dyson Sphere Program mods maintained by Soar Qin
|
||||
These mods were originally written by their own authros, but are lack of maintenance later on.
|
||||
So I take over them to support new game updates and may add new functions eventually.
|
||||
So I take over them to support new game updates and may add new features eventually.
|
||||
|
||||
## [CompressSave](CompressSave)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user