mirror of
https://github.com/soarqin/DSP_Mods_TO.git
synced 2025-12-14 10:33:31 +08:00
WIP
This commit is contained in:
20
AutoPilot/README.md
Normal file
20
AutoPilot/README.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# AutoPilot
|
||||
|
||||
## What's this?
|
||||
|
||||
Auto pilot to a planet or star system.
|
||||
|
||||
This mod is a CruiseAssist extension.
|
||||
|
||||
Original mod: [AutoPilot](https://thunderstore.io/package/tanu/AutoPilot/)
|
||||
It was discontinued, so I made a fork of it.
|
||||
|
||||
## CHANGE LOG
|
||||
|
||||
### 0.1.0
|
||||
* Cleanup from disassmbly codes of AutoPilot 0.0.4.
|
||||
* Optimization to codes.
|
||||
* Add a simple localization implementation.
|
||||
|
||||
### Origianal AutoPilot Changelogs
|
||||
Check [original mod](https://thunderstore.io/c/dyson-sphere-program/p/tanu/AutoPilot/) for details
|
||||
@@ -87,7 +87,7 @@ internal static class AutoPilotConfigUI
|
||||
_labelStyle.fixedWidth = 240f;
|
||||
GUILayout.Label(Strings.Get(17), _labelStyle);
|
||||
GUILayout.FlexibleSpace();
|
||||
SetValue(ref TempWarpMinRangeAu, GUILayout.TextArea(TempWarpMinRangeAu, _textFieldStyle), 1, 60, ref AutoPilotPlugin.Conf.WarpMinRangeAu);
|
||||
SetValue(ref TempWarpMinRangeAu, GUILayout.TextField(TempWarpMinRangeAu, _textFieldStyle), 1, 60, ref AutoPilotPlugin.Conf.WarpMinRangeAu);
|
||||
_labelStyle.fixedWidth = 20f;
|
||||
GUILayout.Label("AU", _labelStyle);
|
||||
GUILayout.EndHorizontal();
|
||||
@@ -95,7 +95,7 @@ internal static class AutoPilotConfigUI
|
||||
_labelStyle.fixedWidth = 240f;
|
||||
GUILayout.Label(Strings.Get(18), _labelStyle);
|
||||
GUILayout.FlexibleSpace();
|
||||
SetValue(ref TempSpeedToWarp, GUILayout.TextArea(TempSpeedToWarp, _textFieldStyle), 0, 2000, ref AutoPilotPlugin.Conf.SpeedToWarp);
|
||||
SetValue(ref TempSpeedToWarp, GUILayout.TextField(TempSpeedToWarp, _textFieldStyle), 0, 2000, ref AutoPilotPlugin.Conf.SpeedToWarp);
|
||||
_labelStyle.fixedWidth = 20f;
|
||||
GUILayout.Label("m/s", _labelStyle);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using CruiseAssist.Commons;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace AutoPilot.UI;
|
||||
@@ -60,7 +59,7 @@ public static class Strings
|
||||
"最小能量百分比 (0-100 默认:20)",
|
||||
"最大速度 (0-2000 默认:2000)",
|
||||
"启用曲速最小距离 (1-60 默认:2)",
|
||||
"航行速度达到此值时启动曲速 (0-2000 默认:1200)",
|
||||
"启动曲速的航行速度 (0-2000 默认:1200)",
|
||||
"即使本星系的行星也允许曲速",
|
||||
// 20
|
||||
"设置目标行星后立即开始导航",
|
||||
|
||||
21
CruiseAssist/README.md
Normal file
21
CruiseAssist/README.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# CruiseAssist
|
||||
|
||||
## What's this?
|
||||
|
||||
Adjust the orientation to the target planet or star when moving between planets or star systems.
|
||||
|
||||
You can set the target by selecting it in the indicator, by selecting it in the star list, or by facing the star.
|
||||
|
||||
Original mod: [CruiseAssist](https://thunderstore.io/package/tanu/CruiseAssist/)
|
||||
It was discontinued, so I made a fork of it.
|
||||
|
||||
## CHANGE LOG
|
||||
|
||||
### 0.1.0
|
||||
* Cleanup from disassmbly codes of CruiseAssist 0.0.37.
|
||||
* Heavily optimization to codes, with CPU usage reduced a lot.
|
||||
* Add search text box to star list.
|
||||
* Add a simple localization implementation.
|
||||
|
||||
### Origianal CruiseAssit Changelogs
|
||||
* Check [original mod](https://thunderstore.io/c/dyson-sphere-program/p/tanu/CruiseAssit/) for details
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using CruiseAssist.Commons;
|
||||
using CruiseAssist.Enums;
|
||||
using CruiseAssist.Enums;
|
||||
using UnityEngine;
|
||||
|
||||
namespace CruiseAssist.UI;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CruiseAssist.Commons;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -17,6 +17,7 @@ public static class CruiseAssistStarListUI
|
||||
private static GUIStyle _nSortButtonStyle;
|
||||
private static GUIStyle _verticalScrollbarStyle;
|
||||
private static GUIStyle _commonButtonStyle;
|
||||
private static GUIStyle _searchLabelStyle;
|
||||
private static string[] _tabs = [
|
||||
Strings.Get(10),
|
||||
Strings.Get(11),
|
||||
@@ -25,8 +26,8 @@ public static class CruiseAssistStarListUI
|
||||
|
||||
private static string[][] _buttonTexts =
|
||||
[
|
||||
[Strings.Get(13), Strings.Get(14)],
|
||||
[Strings.Get(13), Strings.Get(14), Strings.Get(15)],
|
||||
[Strings.Get(13), Strings.Get(12)],
|
||||
[Strings.Get(13), Strings.Get(12), Strings.Get(15)],
|
||||
[Strings.Get(13), Strings.Get(16), Strings.Get(15)]
|
||||
];
|
||||
|
||||
@@ -89,13 +90,20 @@ public static class CruiseAssistStarListUI
|
||||
},
|
||||
fontSize = 12
|
||||
};
|
||||
_verticalScrollbarStyle = new GUIStyle(CruiseAssistMainUI.BaseVerticalScrollBarStyle);
|
||||
_verticalScrollbarStyle = CruiseAssistMainUI.BaseVerticalScrollBarStyle;
|
||||
_commonButtonStyle = new GUIStyle(CruiseAssistMainUI.BaseButtonStyle)
|
||||
{
|
||||
fixedWidth = 80f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12
|
||||
};
|
||||
_searchLabelStyle = new GUIStyle(GUI.skin.label)
|
||||
{
|
||||
fixedWidth = 50f,
|
||||
fixedHeight = 20f,
|
||||
fontSize = 12,
|
||||
alignment = TextAnchor.MiddleRight
|
||||
};
|
||||
return;
|
||||
|
||||
void LangChanged()
|
||||
@@ -170,7 +178,18 @@ public static class CruiseAssistStarListUI
|
||||
{
|
||||
case 0:
|
||||
UpdateStarPlanetList();
|
||||
foreach (var celestialBody in _celestialBodies)
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label(Strings.Get(32), _searchLabelStyle);
|
||||
GUI.changed = false;
|
||||
_searchString = GUILayout.TextField(_searchString, CruiseAssistMainUI.BaseTextFieldStyle);
|
||||
if (GUI.changed)
|
||||
{
|
||||
_searchResults = string.IsNullOrEmpty(_searchString)
|
||||
? null
|
||||
: _celestialBodies.Where(celestialBody => (celestialBody.IsPlanet ? celestialBody.PlanetData.name : celestialBody.StarData.name).Contains(_searchString)).ToList();
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
foreach (var celestialBody in _searchResults ?? _celestialBodies)
|
||||
{
|
||||
var selected = celestialBody.Selected;
|
||||
GUILayout.BeginHorizontal();
|
||||
@@ -495,7 +514,7 @@ public static class CruiseAssistStarListUI
|
||||
return;
|
||||
}
|
||||
_nextCheckTick2 = GameMain.instance.timei + (GameMain.data.localPlanet == null ? 30 : 300);
|
||||
foreach (var body in ListSelected == 1 ? History : Bookmark)
|
||||
foreach (var body in ListSelected == 1 ? _historyDistinct : Bookmark)
|
||||
{
|
||||
body.Range = (body.PlanetData.uPosition - GameMain.mainPlayer.uPosition).magnitude - body.PlanetData.realRadius;
|
||||
}
|
||||
@@ -645,13 +664,16 @@ public static class CruiseAssistStarListUI
|
||||
{
|
||||
History.RemoveAt(0);
|
||||
}
|
||||
|
||||
History.Add(new BookmarkCelestialBody
|
||||
{
|
||||
PlanetData = planet,
|
||||
Range = (planet.uPosition - GameMain.mainPlayer.uPosition).magnitude - planet.realRadius,
|
||||
InBookmark = HasBookmark(planet.id)
|
||||
});
|
||||
var b = History.Find(b => b.PlanetData == planet);
|
||||
if (b != null)
|
||||
History.Add(b);
|
||||
else
|
||||
History.Add(new BookmarkCelestialBody
|
||||
{
|
||||
PlanetData = planet,
|
||||
Range = (planet.uPosition - GameMain.mainPlayer.uPosition).magnitude - planet.realRadius,
|
||||
InBookmark = HasBookmark(planet.id)
|
||||
});
|
||||
_historyDistinct = Enumerable.Reverse(History).Distinct().ToList();
|
||||
}
|
||||
|
||||
@@ -665,7 +687,7 @@ public static class CruiseAssistStarListUI
|
||||
{
|
||||
if (index < 0 || index >= _historyDistinct.Count) return;
|
||||
var body = _historyDistinct[index];
|
||||
History.Remove(body);
|
||||
History.RemoveAll(b => b == body);
|
||||
_historyDistinct.RemoveAt(index);
|
||||
}
|
||||
|
||||
@@ -687,8 +709,20 @@ public static class CruiseAssistStarListUI
|
||||
if (!int.TryParse(s, out var id)) continue;
|
||||
var planet = GameMain.galaxy.PlanetById(id);
|
||||
if (planet == null) continue;
|
||||
AddHistory(planet);
|
||||
var b = History.Find(b => b.PlanetData == planet);
|
||||
if (b != null)
|
||||
{
|
||||
History.Add(b);
|
||||
continue;
|
||||
}
|
||||
History.Add(new BookmarkCelestialBody
|
||||
{
|
||||
PlanetData = planet,
|
||||
Range = (planet.uPosition - GameMain.mainPlayer.uPosition).magnitude - planet.realRadius,
|
||||
InBookmark = HasBookmark(planet.id)
|
||||
});
|
||||
}
|
||||
_historyDistinct = Enumerable.Reverse(History).Distinct().ToList();
|
||||
}
|
||||
|
||||
private static bool HasBookmark(int id) => BookmarkSet.Contains(id);
|
||||
@@ -763,6 +797,8 @@ public static class CruiseAssistStarListUI
|
||||
private static List<CelestialBody> _stars;
|
||||
private static List<CelestialBody> _localStarPlanets;
|
||||
private static List<CelestialBody> _selectedStarPlanets;
|
||||
private static List<CelestialBody> _searchResults;
|
||||
private static string _searchString;
|
||||
|
||||
private static readonly List<BookmarkCelestialBody> History = [];
|
||||
private static List<BookmarkCelestialBody> _historyDistinct = [];
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using CruiseAssist.Commons;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace CruiseAssist.UI;
|
||||
@@ -45,7 +44,8 @@ public static class Strings
|
||||
"Hide bottom close button.",
|
||||
// 30
|
||||
"FULL",
|
||||
"MINI"
|
||||
"MINI",
|
||||
"Search: ",
|
||||
];
|
||||
|
||||
private static readonly string[] ZhoCn =
|
||||
@@ -71,7 +71,7 @@ public static class Strings
|
||||
// 15
|
||||
"删除",
|
||||
"排序",
|
||||
"设为目标",
|
||||
"选择",
|
||||
"添加",
|
||||
"删除",
|
||||
// 20
|
||||
@@ -88,7 +88,8 @@ public static class Strings
|
||||
"隐藏底部关闭按钮",
|
||||
// 30
|
||||
"完整",
|
||||
"迷你"
|
||||
"迷你",
|
||||
"搜索:",
|
||||
];
|
||||
|
||||
public static Action OnLanguageChanged;
|
||||
|
||||
Reference in New Issue
Block a user