work in progress
@@ -7,7 +7,7 @@ using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
public static class UIFunctions
|
||||
{
|
||||
@@ -19,6 +19,7 @@ public static class UIFunctions
|
||||
private static int _cornerComboBoxIndex;
|
||||
private static string[] _starOrderNames;
|
||||
private static bool _starmapFilterInitialized;
|
||||
private static ulong[] _starmapStarFilterValues;
|
||||
private static bool _starFilterEnabled;
|
||||
private static UI.MyCheckButton _starmapFilterToggler;
|
||||
public static bool[] ShowStarName;
|
||||
@@ -34,82 +35,16 @@ public static class UIFunctions
|
||||
});
|
||||
I18N.Add("KEYOpenUXAssistConfigWindow", "[UXA] Open UXAssist Config Window", "[UXA] 打开UX助手设置面板");
|
||||
I18N.OnInitialized += RecreateConfigWindow;
|
||||
GameLogic.OnGameBegin += () =>
|
||||
{
|
||||
var galaxy = GameMain.data.galaxy;
|
||||
ShowStarName = new bool[galaxy.starCount];
|
||||
_starOrderNames = new string[galaxy.starCount];
|
||||
StarData[] stars = [.. galaxy.stars.Where(star => star != null)];
|
||||
Array.Sort(stars, (a, b) =>
|
||||
{
|
||||
int res = a.position.sqrMagnitude.CompareTo(b.position.sqrMagnitude);
|
||||
if (res != 0) return res;
|
||||
return a.index.CompareTo(b.index);
|
||||
});
|
||||
for (int i = 0; i < stars.Length; i++)
|
||||
{
|
||||
var star = stars[i];
|
||||
_starOrderNames[star.index] = star.displayName;
|
||||
}
|
||||
int[] spectrCount = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
for (int i = 0; i < stars.Length; i++)
|
||||
{
|
||||
var star = stars[i];
|
||||
var index = star.index;
|
||||
switch (star.type)
|
||||
{
|
||||
case EStarType.MainSeqStar:
|
||||
switch (star.spectr)
|
||||
{
|
||||
case ESpectrType.M:
|
||||
_starOrderNames[index] = String.Format("M{0}", ++spectrCount[0]);
|
||||
break;
|
||||
case ESpectrType.K:
|
||||
_starOrderNames[index] = String.Format("K{0}", ++spectrCount[1]);
|
||||
break;
|
||||
case ESpectrType.G:
|
||||
_starOrderNames[index] = String.Format("G{0}", ++spectrCount[2]);
|
||||
break;
|
||||
case ESpectrType.F:
|
||||
_starOrderNames[index] = String.Format("F{0}", ++spectrCount[3]);
|
||||
break;
|
||||
case ESpectrType.A:
|
||||
_starOrderNames[index] = String.Format("A{0}", ++spectrCount[4]);
|
||||
break;
|
||||
case ESpectrType.B:
|
||||
_starOrderNames[index] = String.Format("B{0}", ++spectrCount[5]);
|
||||
break;
|
||||
case ESpectrType.O:
|
||||
_starOrderNames[index] = String.Format("O{0}", ++spectrCount[6]);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case EStarType.GiantStar:
|
||||
_starOrderNames[index] = String.Format("GS{0}", ++spectrCount[7]);
|
||||
break;
|
||||
case EStarType.WhiteDwarf:
|
||||
_starOrderNames[index] = String.Format("WD{0}", ++spectrCount[8]);
|
||||
break;
|
||||
case EStarType.NeutronStar:
|
||||
_starOrderNames[index] = String.Format("NS{0}", ++spectrCount[9]);
|
||||
break;
|
||||
case EStarType.BlackHole:
|
||||
_starOrderNames[index] = String.Format("BH{0}", ++spectrCount[10]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
GameLogic.OnGameEnd += () =>
|
||||
{
|
||||
_starOrderNames = null;
|
||||
ShowStarName = null;
|
||||
};
|
||||
}
|
||||
|
||||
public static void OnUpdate()
|
||||
{
|
||||
if (!_starmapFilterInitialized || _starmapFilterToggler == null || _starmapFilterToggler.gameObject.activeSelf) return;
|
||||
if (PlanetModelingManager.scnPlanetReqList.Count == 0) _starmapFilterToggler.gameObject.SetActive(true);
|
||||
if (PlanetModelingManager.scnPlanetReqList.Count == 0)
|
||||
{
|
||||
StarmapUpdateFilterValues();
|
||||
_starmapFilterToggler.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnInputUpdate()
|
||||
@@ -139,6 +74,23 @@ public static class UIFunctions
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly Sprite[] PlanetIcons = [
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/07.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/09.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/10.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/13.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/14.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/15.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/16.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/17.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/18.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/19.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/21.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/22.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/23.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/24.png"),
|
||||
Common.Util.LoadEmbeddedSprite("assets/planet_icon/25.png")
|
||||
];
|
||||
public static void InitMenuButtons()
|
||||
{
|
||||
if (_initialized) return;
|
||||
@@ -205,20 +157,28 @@ public static class UIFunctions
|
||||
{
|
||||
Functions.UIFunctions.CornerComboBoxIndex = index;
|
||||
};
|
||||
_starmapFilterToggler = UI.MyCheckButton.CreateCheckButton(20, 0, rtrans, false, ">>").WithSize(20, 20);
|
||||
_starmapFilterToggler = UI.MyCheckButton.CreateCheckButton(10, 0, rtrans, false, ">>").WithSize(24, 24);
|
||||
MyCheckButton[] buttons = [
|
||||
UI.MyCheckButton.CreateCheckButton(40, 0, rtrans, false).WithIcon().WithSize(20, 20), // Kimberlite
|
||||
UI.MyCheckButton.CreateCheckButton(60, 0, rtrans, false).WithIcon().WithSize(20, 20), // Fractal Silicon
|
||||
UI.MyCheckButton.CreateCheckButton(80, 0, rtrans, false).WithIcon().WithSize(20, 20), // Organic Crystal
|
||||
UI.MyCheckButton.CreateCheckButton(100, 0, rtrans, false).WithIcon().WithSize(20, 20), // Grating Crystal
|
||||
UI.MyCheckButton.CreateCheckButton(120, 0, rtrans, false).WithIcon().WithSize(20, 20), // Stalagmite Crystal
|
||||
UI.MyCheckButton.CreateCheckButton(140, 0, rtrans, false).WithIcon().WithSize(20, 20), // Unipolar Magnet
|
||||
UI.MyCheckButton.CreateCheckButton(160, 0, rtrans, false).WithIcon().WithSize(20, 20), // Crude Oil
|
||||
UI.MyCheckButton.CreateCheckButton(180, 0, rtrans, false).WithIcon().WithSize(20, 20), // Fire Ice
|
||||
UI.MyCheckButton.CreateCheckButton(200, 0, rtrans, false).WithIcon().WithSize(20, 20), // Sulfuric Acid
|
||||
UI.MyCheckButton.CreateCheckButton(220, 0, rtrans, false).WithIcon().WithSize(20, 20), // Water
|
||||
UI.MyCheckButton.CreateCheckButton(240, 0, rtrans, false).WithIcon().WithSize(20, 20), // Hydrogen
|
||||
UI.MyCheckButton.CreateCheckButton(260, 0, rtrans, false).WithIcon().WithSize(20, 20), // Deuterium
|
||||
UI.MyCheckButton.CreateCheckButton(34, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Kimberlite
|
||||
UI.MyCheckButton.CreateCheckButton(58, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Fractal Silicon
|
||||
UI.MyCheckButton.CreateCheckButton(82, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Organic Crystal
|
||||
UI.MyCheckButton.CreateCheckButton(106, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Grating Crystal
|
||||
UI.MyCheckButton.CreateCheckButton(130, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Stalagmite Crystal
|
||||
UI.MyCheckButton.CreateCheckButton(154, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Unipolar Magnet
|
||||
UI.MyCheckButton.CreateCheckButton(178, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Crude Oil
|
||||
UI.MyCheckButton.CreateCheckButton(202, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Fire Ice
|
||||
UI.MyCheckButton.CreateCheckButton(226, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Sulfuric Acid
|
||||
UI.MyCheckButton.CreateCheckButton(250, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Water
|
||||
UI.MyCheckButton.CreateCheckButton(274, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Hydrogen
|
||||
UI.MyCheckButton.CreateCheckButton(298, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Deuterium
|
||||
|
||||
UI.MyCheckButton.CreateCheckButton(34, 24, rtrans, false).WithIcon().WithSize(120, 24).WithIconWidth(24),
|
||||
UI.MyCheckButton.CreateCheckButton(34, 48, rtrans, false).WithIcon().WithSize(120, 24).WithIconWidth(24),
|
||||
UI.MyCheckButton.CreateCheckButton(34, 72, rtrans, false).WithIcon().WithSize(120, 24).WithIconWidth(24),
|
||||
UI.MyCheckButton.CreateCheckButton(34, 96, rtrans, false).WithIcon().WithSize(120, 24).WithIconWidth(24),
|
||||
UI.MyCheckButton.CreateCheckButton(34, 120, rtrans, false).WithIcon().WithSize(120, 24).WithIconWidth(24),
|
||||
UI.MyCheckButton.CreateCheckButton(34, 144, rtrans, false).WithIcon().WithSize(120, 24).WithIconWidth(24),
|
||||
UI.MyCheckButton.CreateCheckButton(34, 168, rtrans, false).WithIcon().WithSize(120, 24).WithIconWidth(24),
|
||||
];
|
||||
_starmapFilterToggler.OnChecked += UpdateButtons;
|
||||
foreach (var button in buttons)
|
||||
@@ -246,15 +206,118 @@ public static class UIFunctions
|
||||
buttons[10].WithTip(itemProto.Name).SetIcon(itemProto.iconSprite);
|
||||
itemProto = LDB.items.Select(1121);
|
||||
buttons[11].WithTip(itemProto.Name).SetIcon(itemProto.iconSprite);
|
||||
|
||||
// [ 0] = 07.png
|
||||
// [ 1] = 09.png
|
||||
// [ 2] = 10.png
|
||||
// [ 3] = 13.png
|
||||
// [ 4] = 14.png
|
||||
// [ 5] = 15.png
|
||||
// [ 6] = 16.png
|
||||
// [ 7] = 17.png
|
||||
// [ 8] = 18.png
|
||||
// [ 9] = 19.png
|
||||
// [10] = 21.png
|
||||
// [11] = 22.png
|
||||
// [12] = 23.png
|
||||
// [13] = 24.png
|
||||
// [14] = 25.png
|
||||
|
||||
var themeProto = LDB.themes.Select(16);
|
||||
buttons[12].SetLabelText(themeProto.DisplayName);
|
||||
buttons[12].SetIcon(PlanetIcons[6]);
|
||||
themeProto = LDB.themes.Select(23);
|
||||
buttons[13].SetLabelText(themeProto.DisplayName);
|
||||
buttons[13].SetIcon(PlanetIcons[12]);
|
||||
themeProto = LDB.themes.Select(10);
|
||||
buttons[14].SetLabelText(themeProto.DisplayName);
|
||||
buttons[14].SetIcon(PlanetIcons[2]);
|
||||
themeProto = LDB.themes.Select(15);
|
||||
buttons[15].SetLabelText(themeProto.DisplayName);
|
||||
buttons[15].SetIcon(PlanetIcons[5]);
|
||||
themeProto = LDB.themes.Select(18);
|
||||
buttons[16].SetLabelText(themeProto.DisplayName);
|
||||
buttons[16].SetIcon(PlanetIcons[8]);
|
||||
themeProto = LDB.themes.Select(22);
|
||||
buttons[17].SetLabelText(themeProto.DisplayName);
|
||||
buttons[17].SetIcon(PlanetIcons[11]);
|
||||
themeProto = LDB.themes.Select(25);
|
||||
buttons[18].SetLabelText(themeProto.DisplayName);
|
||||
buttons[18].SetIcon(PlanetIcons[14]);
|
||||
};
|
||||
|
||||
GameLogic.OnGameBegin += () =>
|
||||
{
|
||||
if (DSPGame.IsMenuDemo) return;
|
||||
|
||||
var galaxy = GameMain.data.galaxy;
|
||||
ShowStarName = new bool[galaxy.starCount];
|
||||
_starOrderNames = new string[galaxy.starCount];
|
||||
_starmapStarFilterValues = new ulong[galaxy.starCount];
|
||||
StarData[] stars = [.. galaxy.stars.Where(star => star != null)];
|
||||
Array.Sort(stars, (a, b) =>
|
||||
{
|
||||
int res = a.position.sqrMagnitude.CompareTo(b.position.sqrMagnitude);
|
||||
if (res != 0) return res;
|
||||
return a.index.CompareTo(b.index);
|
||||
});
|
||||
for (int i = 0; i < stars.Length; i++)
|
||||
{
|
||||
var star = stars[i];
|
||||
_starOrderNames[star.index] = star.displayName;
|
||||
}
|
||||
int[] spectrCount = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
for (int i = 0; i < stars.Length; i++)
|
||||
{
|
||||
var star = stars[i];
|
||||
var index = star.index;
|
||||
switch (star.type)
|
||||
{
|
||||
case EStarType.MainSeqStar:
|
||||
switch (star.spectr)
|
||||
{
|
||||
case ESpectrType.M:
|
||||
_starOrderNames[index] = String.Format("M{0}", ++spectrCount[0]);
|
||||
break;
|
||||
case ESpectrType.K:
|
||||
_starOrderNames[index] = String.Format("K{0}", ++spectrCount[1]);
|
||||
break;
|
||||
case ESpectrType.G:
|
||||
_starOrderNames[index] = String.Format("G{0}", ++spectrCount[2]);
|
||||
break;
|
||||
case ESpectrType.F:
|
||||
_starOrderNames[index] = String.Format("F{0}", ++spectrCount[3]);
|
||||
break;
|
||||
case ESpectrType.A:
|
||||
_starOrderNames[index] = String.Format("A{0}", ++spectrCount[4]);
|
||||
break;
|
||||
case ESpectrType.B:
|
||||
_starOrderNames[index] = String.Format("B{0}", ++spectrCount[5]);
|
||||
break;
|
||||
case ESpectrType.O:
|
||||
_starOrderNames[index] = String.Format("O{0}", ++spectrCount[6]);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case EStarType.GiantStar:
|
||||
_starOrderNames[index] = String.Format("GS{0}", ++spectrCount[7]);
|
||||
break;
|
||||
case EStarType.WhiteDwarf:
|
||||
_starOrderNames[index] = String.Format("WD{0}", ++spectrCount[8]);
|
||||
break;
|
||||
case EStarType.NeutronStar:
|
||||
_starOrderNames[index] = String.Format("NS{0}", ++spectrCount[9]);
|
||||
break;
|
||||
case EStarType.BlackHole:
|
||||
_starOrderNames[index] = String.Format("BH{0}", ++spectrCount[10]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
_starmapFilterToggler.gameObject.SetActive(false);
|
||||
_starmapFilterToggler.Checked = false;
|
||||
UpdateButtons();
|
||||
SetStarFilterEnabled(false);
|
||||
foreach (var star in GameMain.data.galaxy.stars)
|
||||
foreach (var star in galaxy.stars)
|
||||
{
|
||||
if (star != null) PlanetModelingManager.RequestScanStar(star);
|
||||
}
|
||||
@@ -262,6 +325,9 @@ public static class UIFunctions
|
||||
};
|
||||
GameLogic.OnGameEnd += () =>
|
||||
{
|
||||
_starOrderNames = null;
|
||||
ShowStarName = null;
|
||||
_starmapStarFilterValues = null;
|
||||
_starmapFilterInitialized = false;
|
||||
};
|
||||
void UpdateButtons()
|
||||
@@ -285,50 +351,70 @@ public static class UIFunctions
|
||||
}
|
||||
void UpdateStarmapStarFilters()
|
||||
{
|
||||
List<(int, int)> filters = [];
|
||||
bool showAny = false;
|
||||
var filterValue = 0UL;
|
||||
if (_starmapFilterToggler.Checked)
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
if (buttons[i].Checked)
|
||||
{
|
||||
filters.Add((i + 9, 0));
|
||||
showAny = true;
|
||||
filterValue |= 1UL << (i + 9);
|
||||
}
|
||||
}
|
||||
if (buttons[6].Checked)
|
||||
{
|
||||
filters.Add((7, 0));
|
||||
showAny = true;
|
||||
filterValue |= 1UL << 7;
|
||||
}
|
||||
if (buttons[7].Checked)
|
||||
{
|
||||
filters.Add((8, 1011));
|
||||
showAny = true;
|
||||
filterValue |= 1UL << 8;
|
||||
}
|
||||
if (buttons[8].Checked)
|
||||
{
|
||||
filters.Add((0, 1116));
|
||||
showAny = true;
|
||||
filterValue |= 1UL << 22;
|
||||
}
|
||||
if (buttons[9].Checked)
|
||||
{
|
||||
filters.Add((0, 1000));
|
||||
showAny = true;
|
||||
filterValue |= 1UL << 23;
|
||||
}
|
||||
if (buttons[10].Checked)
|
||||
{
|
||||
filters.Add((0, 1120));
|
||||
showAny = true;
|
||||
filterValue |= 1UL << 20;
|
||||
}
|
||||
if (buttons[11].Checked)
|
||||
{
|
||||
filters.Add((0, 1121));
|
||||
showAny = true;
|
||||
filterValue |= 1UL << 21;
|
||||
}
|
||||
if (buttons[12].Checked)
|
||||
{
|
||||
filterValue |= 1UL << (30 + 16);
|
||||
}
|
||||
if (buttons[13].Checked)
|
||||
{
|
||||
filterValue |= 1UL << (30 + 23);
|
||||
}
|
||||
if (buttons[14].Checked)
|
||||
{
|
||||
filterValue |= 1UL << (30 + 10);
|
||||
}
|
||||
if (buttons[15].Checked)
|
||||
{
|
||||
filterValue |= 1UL << (30 + 15);
|
||||
}
|
||||
if (buttons[16].Checked)
|
||||
{
|
||||
filterValue |= 1UL << (30 + 18);
|
||||
}
|
||||
if (buttons[17].Checked)
|
||||
{
|
||||
filterValue |= 1UL << (30 + 22);
|
||||
}
|
||||
if (buttons[18].Checked)
|
||||
{
|
||||
filterValue |= 1UL << (30 + 25);
|
||||
}
|
||||
}
|
||||
if (!showAny)
|
||||
if (filterValue == 0UL)
|
||||
{
|
||||
for (int i = 0; i < ShowStarName.Length; i++)
|
||||
{
|
||||
@@ -337,74 +423,101 @@ public static class UIFunctions
|
||||
SetStarFilterEnabled(false);
|
||||
return;
|
||||
}
|
||||
for (int i = _starmapStarFilterValues.Length - 1; i >= 0; i--)
|
||||
{
|
||||
ShowStarName[i] = (_starmapStarFilterValues[i] & filterValue) == filterValue;
|
||||
}
|
||||
SetStarFilterEnabled(true);
|
||||
}
|
||||
}
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
private static void StarmapUpdateFilterValues()
|
||||
{
|
||||
var galaxy = GameMain.data.galaxy;
|
||||
var stars = galaxy.stars;
|
||||
for (int i = 0; i < galaxy.starCount; i++)
|
||||
{
|
||||
var star = stars[i];
|
||||
if (star == null) continue;
|
||||
ShowStarName[i] = false;
|
||||
var allMatch = true;
|
||||
foreach (var filter in filters)
|
||||
{
|
||||
var match = false;
|
||||
var value = 0UL;
|
||||
foreach (var planet in star.planets)
|
||||
{
|
||||
if (planet == null) continue;
|
||||
if (planet.type == EPlanetType.Gas)
|
||||
while (planet.scanning)
|
||||
{
|
||||
if (filter.Item2 != 0)
|
||||
Thread.Sleep(50);
|
||||
}
|
||||
var planetValue = 0UL;
|
||||
if (planet.type == EPlanetType.Gas)
|
||||
{
|
||||
foreach (var n in planet.gasItems)
|
||||
{
|
||||
if (n == filter.Item2)
|
||||
switch (n)
|
||||
{
|
||||
match = true;
|
||||
case 1011:
|
||||
planetValue |= 1UL << 8;
|
||||
break;
|
||||
case 1120:
|
||||
planetValue |= 1UL << 20;
|
||||
break;
|
||||
case 1121:
|
||||
planetValue |= 1UL << 21;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (match) break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (filter.Item2 != 0)
|
||||
{
|
||||
if (planet.waterItemId == filter.Item2)
|
||||
{
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (filter.Item1 != 0)
|
||||
{
|
||||
foreach (var group in planet.veinGroups)
|
||||
{
|
||||
if (group.amount > 0 && (int)group.type == filter.Item1)
|
||||
if (group.amount > 0)
|
||||
{
|
||||
match = true;
|
||||
planetValue |= 1UL << (int)group.type;
|
||||
}
|
||||
}
|
||||
switch (planet.waterItemId)
|
||||
{
|
||||
case 1116:
|
||||
planetValue |= 1UL << 22;
|
||||
break;
|
||||
case 1000:
|
||||
planetValue |= 1UL << 23;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (match) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!match)
|
||||
if ((value & (1UL << (30 + planet.theme))) == 0)
|
||||
{
|
||||
allMatch = false;
|
||||
switch (planet.theme)
|
||||
{
|
||||
case 7: case 9: case 13: case 17: case 19: case 24:
|
||||
{
|
||||
const ulong needed = 0x7EUL;
|
||||
if ((planetValue & needed) == needed)
|
||||
{
|
||||
value |= 1UL << (30 + planet.theme);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 14:
|
||||
{
|
||||
const ulong needed = 0x2200UL;
|
||||
if ((planetValue & needed) == needed)
|
||||
{
|
||||
value |= 1UL << (30 + planet.theme);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 10: case 15: case 16: case 18: case 21: case 22: case 23: case 25:
|
||||
value |= 1UL << (30 + planet.theme);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (allMatch)
|
||||
{
|
||||
ShowStarName[i] = true;
|
||||
value |= planetValue;
|
||||
}
|
||||
_starmapStarFilterValues[i] = value;
|
||||
}
|
||||
SetStarFilterEnabled(true);
|
||||
}
|
||||
}
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
public static void RecreateConfigWindow()
|
||||
|
||||
@@ -18,7 +18,6 @@ public static class WindowFunctions
|
||||
private static IntPtr _oldWndProc = IntPtr.Zero;
|
||||
private static IntPtr _gameWindowHandle = IntPtr.Zero;
|
||||
|
||||
private static bool _gameLoaded;
|
||||
public static WinApi.LogicalProcessorDetails ProcessorDetails { get; private set; }
|
||||
|
||||
public static ConfigEntry<int> ProcessPriority;
|
||||
@@ -48,7 +47,6 @@ public static class WindowFunctions
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
GameLogic.OnDataLoaded += OnDataLoaded;
|
||||
var wndProc = new WinApi.WndProc(GameWndProc);
|
||||
var gameWnd = FindGameWindow();
|
||||
if (gameWnd != IntPtr.Zero)
|
||||
@@ -65,7 +63,7 @@ public static class WindowFunctions
|
||||
UpdateAffinity();
|
||||
return;
|
||||
|
||||
void UpdateAffinity()
|
||||
static void UpdateAffinity()
|
||||
{
|
||||
var process = WinApi.GetCurrentProcess();
|
||||
if (!WinApi.GetProcessAffinityMask(process, out _, out var systemMask))
|
||||
@@ -94,16 +92,6 @@ public static class WindowFunctions
|
||||
}
|
||||
}
|
||||
|
||||
public static void Uninit()
|
||||
{
|
||||
GameLogic.OnDataLoaded -= OnDataLoaded;
|
||||
}
|
||||
|
||||
private static void OnDataLoaded()
|
||||
{
|
||||
_gameLoaded = true;
|
||||
}
|
||||
|
||||
private static IntPtr GameWndProc(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam)
|
||||
{
|
||||
switch (uMsg)
|
||||
@@ -122,13 +110,13 @@ public static class WindowFunctions
|
||||
switch ((long)wParam & 0xFFF0L)
|
||||
{
|
||||
case WinApi.SC_MOVE:
|
||||
if (GamePatch.LoadLastWindowRectEnabled.Value && !_gameLoaded) return (IntPtr)1L;
|
||||
if (GamePatch.LoadLastWindowRectEnabled.Value && !GameMain.isRunning) return (IntPtr)1L;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case WinApi.WM_MOVING:
|
||||
if (!GamePatch.LoadLastWindowRectEnabled.Value || _gameLoaded) break;
|
||||
if (!GamePatch.LoadLastWindowRectEnabled.Value || GameMain.isRunning) break;
|
||||
var rect = GamePatch.LastWindowRect.Value;
|
||||
if (rect is { z: 0f, w: 0f }) break;
|
||||
var x = Mathf.RoundToInt(rect.x);
|
||||
@@ -137,9 +125,9 @@ public static class WindowFunctions
|
||||
rect2.Left = x;
|
||||
rect2.Top = y;
|
||||
Marshal.StructureToPtr(rect2, lParam, false);
|
||||
break;
|
||||
return (IntPtr)1L;
|
||||
case WinApi.WM_SIZING:
|
||||
if (!GamePatch.LoadLastWindowRectEnabled.Value || _gameLoaded) break;
|
||||
if (!GamePatch.LoadLastWindowRectEnabled.Value || Screen.fullScreenMode is FullScreenMode.ExclusiveFullScreen or FullScreenMode.FullScreenWindow or FullScreenMode.MaximizedWindow || GameMain.isRunning) break;
|
||||
rect = GamePatch.LastWindowRect.Value;
|
||||
if (rect is { z: 0f, w: 0f }) break;
|
||||
x = Mathf.RoundToInt(rect.x);
|
||||
@@ -152,7 +140,7 @@ public static class WindowFunctions
|
||||
rect2.Right = x + w;
|
||||
rect2.Bottom = y + h;
|
||||
Marshal.StructureToPtr(rect2, lParam, false);
|
||||
break;
|
||||
return (IntPtr)1L;
|
||||
}
|
||||
|
||||
return WinApi.CallWindowProc(_oldWndProc, hWnd, uMsg, wParam, lParam);
|
||||
@@ -219,7 +207,14 @@ public static class WindowFunctions
|
||||
{
|
||||
// Get profile name from command line arguments, and set window title accordingly
|
||||
var args = Environment.GetCommandLineArgs();
|
||||
for (var i = 0; i < args.Length - 1; i++)
|
||||
for (var i = args.Length - 2; i >= 0; i--)
|
||||
{
|
||||
if (args[i] == "--gale-profile")
|
||||
{
|
||||
// We use gale profile name directly
|
||||
ProfileName = args[i + 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Doorstop 3.x and 4.x use different arguments to pass the target assembly path
|
||||
if (args[i] != "--doorstop-target" && args[i] != "--doorstop-target-assembly") continue;
|
||||
@@ -233,10 +228,11 @@ public static class WindowFunctions
|
||||
if (index < 0)
|
||||
break;
|
||||
arg = arg.Substring(index + profileSuffix.Length);
|
||||
ProfileName = arg;
|
||||
}
|
||||
var wnd = FindGameWindow();
|
||||
if (wnd == IntPtr.Zero) return;
|
||||
ProfileName = arg;
|
||||
_gameWindowTitle = $"Dyson Sphere Program - {arg}";
|
||||
_gameWindowTitle = $"Dyson Sphere Program - {ProfileName}";
|
||||
WinApi.SetWindowText(wnd, _gameWindowTitle);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection.Emit;
|
||||
using System.Threading;
|
||||
using System.Xml;
|
||||
using BepInEx.Configuration;
|
||||
using CommonAPI.Systems;
|
||||
@@ -270,8 +271,6 @@ public class GamePatch : PatchImpl<GamePatch>
|
||||
LastWindowRect.Value = new Vector4(x, y, w, h);
|
||||
}
|
||||
}
|
||||
|
||||
MoveWindowPosition();
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
@@ -311,13 +310,6 @@ public class GamePatch : PatchImpl<GamePatch>
|
||||
height = h;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(Screen), nameof(Screen.SetResolution), typeof(int), typeof(int), typeof(FullScreenMode), typeof(int))]
|
||||
private static void Screen_SetResolution_Postfix(FullScreenMode fullscreenMode)
|
||||
{
|
||||
MoveWindowPosition();
|
||||
}
|
||||
|
||||
private static void VFPreload_InvokeOnLoadWorkEnded_Postfix()
|
||||
{
|
||||
if (_loaded || Screen.fullScreenMode is FullScreenMode.ExclusiveFullScreen or FullScreenMode.FullScreenWindow or FullScreenMode.MaximizedWindow) return;
|
||||
|
||||
@@ -46,7 +46,11 @@ public class MyCheckButton : MonoBehaviour
|
||||
if (txt)
|
||||
{
|
||||
txt.text = "";
|
||||
txt.rectTransform.pivot = new Vector2(0.5f, 0.5f);
|
||||
txt.alignment = TextAnchor.MiddleCenter;
|
||||
txt.rectTransform.anchorMax = new Vector2(0f, 1f);
|
||||
txt.rectTransform.anchorMin = new Vector2(0f, 1f);
|
||||
txt.rectTransform.pivot = new Vector2(0f, 1f);
|
||||
txt.rectTransform.localPosition = new Vector3(0f, 0f, 0f);
|
||||
}
|
||||
var localizer = comp.GetComponent<Localizer>();
|
||||
if (localizer) DestroyImmediate(localizer);
|
||||
@@ -88,21 +92,16 @@ public class MyCheckButton : MonoBehaviour
|
||||
{
|
||||
cb.labelText.text = "";
|
||||
cb.labelText.fontSize = fontSize;
|
||||
cb.UpdateLabelTextWidth();
|
||||
}
|
||||
}
|
||||
|
||||
cb._iconWidth = Mathf.Min(cb._iconWidth > 0f ? cb._iconWidth : 28f, rect.sizeDelta.y);
|
||||
cb._iconWidth = Mathf.Min(cb._iconWidth > 0f ? cb._iconWidth : 32f, rect.sizeDelta.y);
|
||||
cb.UpdateCheckColor();
|
||||
cb.uiButton.onClick += cb.OnClick;
|
||||
cb.UpdateSize();
|
||||
return cb;
|
||||
}
|
||||
|
||||
private void UpdateLabelTextWidth()
|
||||
{
|
||||
if (labelText) labelText.rectTransform.sizeDelta = new Vector2(labelText.preferredWidth, labelText.rectTransform.sizeDelta.y);
|
||||
}
|
||||
|
||||
public bool Checked
|
||||
{
|
||||
get => _checked;
|
||||
@@ -118,7 +117,6 @@ public class MyCheckButton : MonoBehaviour
|
||||
if (labelText != null)
|
||||
{
|
||||
labelText.text = val.Translate();
|
||||
UpdateLabelTextWidth();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,17 +145,19 @@ public class MyCheckButton : MonoBehaviour
|
||||
{
|
||||
var width = rectTrans.sizeDelta.x;
|
||||
var height = rectTrans.sizeDelta.y;
|
||||
labelText.rectTransform.localPosition = new Vector3(icon != null ? _iconWidth : 0f, 0f, 0f);
|
||||
labelText.rectTransform.sizeDelta = new Vector2(icon != null ? width - _iconWidth : width, height);
|
||||
if (icon != null)
|
||||
{
|
||||
icon.transform.localPosition = new Vector3((-width - _iconWidth) * 0.5f, 0f, 0f);
|
||||
icon.rectTransform.sizeDelta = new Vector2(_iconWidth, _iconWidth);
|
||||
icon.rectTransform.localPosition = new Vector3(0f, -height * 0.5f, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public MyCheckButton WithSize(float width, float height)
|
||||
{
|
||||
rectTrans.sizeDelta = new Vector2(width, height);
|
||||
if (height > _iconWidth) _iconWidth = height;
|
||||
if (height < _iconWidth) _iconWidth = height;
|
||||
UpdateSize();
|
||||
return this;
|
||||
}
|
||||
@@ -178,25 +178,21 @@ public class MyCheckButton : MonoBehaviour
|
||||
|
||||
public MyCheckButton WithIcon(Sprite sprite = null)
|
||||
{
|
||||
var trans = labelText.gameObject.transform;
|
||||
if (icon == null)
|
||||
{
|
||||
var iconGo = new GameObject("icon");
|
||||
var rect = iconGo.AddComponent<RectTransform>();
|
||||
(icon = iconGo.AddComponent<Image>()).sprite = sprite;
|
||||
iconGo.transform.SetParent(trans);
|
||||
rect.localPosition = new Vector3(0f, 0f, 0f);
|
||||
iconGo.transform.SetParent(rectTrans);
|
||||
rect.sizeDelta = new Vector2(_iconWidth, _iconWidth);
|
||||
rect.localScale = new Vector3(1f, 1f, 1f);
|
||||
rect.anchorMax = new Vector2(0f, 1f);
|
||||
rect.anchorMin = new Vector2(0f, 1f);
|
||||
rect.pivot = new Vector2(0f, 0.5f);
|
||||
var height = rectTrans.sizeDelta.y;
|
||||
rect.localPosition = new Vector3(0f, -height * 0.5f, 0f);
|
||||
iconGo.SetActive(sprite != null);
|
||||
|
||||
var width = rectTrans.sizeDelta.x;
|
||||
var originPosition = labelText.rectTransform.localPosition;
|
||||
labelText.rectTransform.localPosition = new Vector3(originPosition.x + _iconWidth * 0.5f, originPosition.y, originPosition.z);
|
||||
labelText.rectTransform.sizeDelta = new Vector2(width - _iconWidth, labelText.rectTransform.sizeDelta.y);
|
||||
UpdateSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -220,7 +216,6 @@ public class MyCheckButton : MonoBehaviour
|
||||
public void SetIcon(Sprite sprite = null)
|
||||
{
|
||||
icon.sprite = sprite;
|
||||
icon.transform.localPosition = new Vector3((-rectTrans.sizeDelta.x - _iconWidth) * 0.5f, 0f, 0f);
|
||||
icon.gameObject.SetActive(sprite != null);
|
||||
}
|
||||
|
||||
@@ -258,7 +253,7 @@ public class MyCheckButton : MonoBehaviour
|
||||
{
|
||||
uiButton.transitions[0].mouseoverColor = closeMouseOverColor;
|
||||
uiButton.transitions[0].pressedColor = closePressColor;
|
||||
uiButton.transitions[0].normalColor = closeNormalColor;
|
||||
uiButton.transitions[0].normalColor = new Color(0.6557f, 0.9145f, 1f, 0.0627f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,21 @@
|
||||
<EmbeddedResource Include="assets/icon/in.png" />
|
||||
<EmbeddedResource Include="assets/icon/out.png" />
|
||||
<EmbeddedResource Include="assets/icon/keep.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/07.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/09.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/10.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/13.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/14.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/15.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/16.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/17.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/18.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/19.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/21.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/22.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/23.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/24.png" />
|
||||
<EmbeddedResource Include="assets/planet_icon/25.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
|
||||
|
||||
BIN
UXAssist/assets/planet_icon/07.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
UXAssist/assets/planet_icon/09.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
UXAssist/assets/planet_icon/10.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
UXAssist/assets/planet_icon/13.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
UXAssist/assets/planet_icon/14.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
UXAssist/assets/planet_icon/15.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
UXAssist/assets/planet_icon/16.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
UXAssist/assets/planet_icon/17.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
UXAssist/assets/planet_icon/18.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
UXAssist/assets/planet_icon/19.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
UXAssist/assets/planet_icon/21.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
UXAssist/assets/planet_icon/22.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
UXAssist/assets/planet_icon/23.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
UXAssist/assets/planet_icon/24.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
UXAssist/assets/planet_icon/25.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |