mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-02-05 02:22:21 +08:00
Starmap filter: Hide top overlaping windows while the filter UI is shown
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
* 1.3.3
|
* 1.3.3
|
||||||
+ `Re-initialize planet`: Fix a crash.
|
+ `Re-initialize planet`: Fix a crash.
|
||||||
+ `Auto navigation on sailings`: Do not auto-use Warper if required Tech is not researched.
|
+ `Auto navigation on sailings`: Do not auto-use Warper if required Tech is not researched.
|
||||||
|
+ Starmap filter: Hide top overlaping windows while the filter UI is shown.
|
||||||
* 1.3.2
|
* 1.3.2
|
||||||
+ New feature: `Disable battle-related techs in Peace mode`
|
+ New feature: `Disable battle-related techs in Peace mode`
|
||||||
+ New button: `Unlock all techs with metadata`
|
+ New button: `Unlock all techs with metadata`
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public static class UIFunctions
|
|||||||
private static bool _starmapFilterInitialized;
|
private static bool _starmapFilterInitialized;
|
||||||
private static ulong[] _starmapStarFilterValues;
|
private static ulong[] _starmapStarFilterValues;
|
||||||
private static bool _starFilterEnabled;
|
private static bool _starFilterEnabled;
|
||||||
private static UI.MyCheckButton _starmapFilterToggler;
|
public static UI.MyCheckButton StarmapFilterToggler;
|
||||||
public static bool[] ShowStarName;
|
public static bool[] ShowStarName;
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
@@ -224,7 +224,7 @@ public static class UIFunctions
|
|||||||
{
|
{
|
||||||
Functions.UIFunctions.CornerComboBoxIndex = index;
|
Functions.UIFunctions.CornerComboBoxIndex = index;
|
||||||
};
|
};
|
||||||
_starmapFilterToggler = UI.MyCheckButton.CreateCheckButton(0, 0, rtrans, false, ">>").WithSize(24, 24);
|
StarmapFilterToggler = UI.MyCheckButton.CreateCheckButton(0, 0, rtrans, false, ">>").WithSize(24, 24);
|
||||||
MyCheckButton[] buttons = [
|
MyCheckButton[] buttons = [
|
||||||
UI.MyCheckButton.CreateCheckButton(24, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Kimberlite
|
UI.MyCheckButton.CreateCheckButton(24, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Kimberlite
|
||||||
UI.MyCheckButton.CreateCheckButton(48, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Fractal Silicon
|
UI.MyCheckButton.CreateCheckButton(48, 0, rtrans, false).WithIcon().WithSize(24, 24).WithIconWidth(24), // Fractal Silicon
|
||||||
@@ -264,7 +264,7 @@ public static class UIFunctions
|
|||||||
};
|
};
|
||||||
var allOresText = MyWindow.AddText(20, 190, rtrans, "All 6 Basic Ores".Translate(), 12);
|
var allOresText = MyWindow.AddText(20, 190, rtrans, "All 6 Basic Ores".Translate(), 12);
|
||||||
allOresText.gameObject.SetActive(false);
|
allOresText.gameObject.SetActive(false);
|
||||||
_starmapFilterToggler.OnChecked += UpdateButtons;
|
StarmapFilterToggler.OnChecked += UpdateButtons;
|
||||||
foreach (var button in buttons)
|
foreach (var button in buttons)
|
||||||
{
|
{
|
||||||
button.OnChecked += () =>
|
button.OnChecked += () =>
|
||||||
@@ -374,8 +374,8 @@ public static class UIFunctions
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_starmapFilterToggler.gameObject.SetActive(false);
|
StarmapFilterToggler.gameObject.SetActive(false);
|
||||||
_starmapFilterToggler.Checked = false;
|
StarmapFilterToggler.Checked = false;
|
||||||
UpdateButtons();
|
UpdateButtons();
|
||||||
SetStarFilterEnabled(false);
|
SetStarFilterEnabled(false);
|
||||||
foreach (var star in galaxy.stars)
|
foreach (var star in galaxy.stars)
|
||||||
@@ -446,7 +446,7 @@ public static class UIFunctions
|
|||||||
}
|
}
|
||||||
void UpdateButtons()
|
void UpdateButtons()
|
||||||
{
|
{
|
||||||
var chk = _starmapFilterToggler.Checked;
|
var chk = StarmapFilterToggler.Checked;
|
||||||
foreach (var button in buttons)
|
foreach (var button in buttons)
|
||||||
{
|
{
|
||||||
if (chk)
|
if (chk)
|
||||||
@@ -459,17 +459,18 @@ public static class UIFunctions
|
|||||||
}
|
}
|
||||||
unionCheckBox.gameObject.SetActive(chk);
|
unionCheckBox.gameObject.SetActive(chk);
|
||||||
allOresText.gameObject.SetActive(chk);
|
allOresText.gameObject.SetActive(chk);
|
||||||
_starmapFilterToggler.SetLabelText(chk ? "X" : ">>");
|
StarmapFilterToggler.SetLabelText(chk ? "X" : ">>");
|
||||||
if (!chk)
|
if (!chk)
|
||||||
{
|
{
|
||||||
UpdateStarmapStarFilters();
|
UpdateStarmapStarFilters();
|
||||||
}
|
}
|
||||||
|
UIRoot.instance.uiGame.dfMonitor.transform.parent.gameObject.SetActive(!chk);
|
||||||
}
|
}
|
||||||
void UpdateStarmapStarFilters()
|
void UpdateStarmapStarFilters()
|
||||||
{
|
{
|
||||||
var filterValue = 0UL;
|
var filterValue = 0UL;
|
||||||
var union = unionCheckBox.Checked;
|
var union = unionCheckBox.Checked;
|
||||||
if (_starmapFilterToggler.Checked)
|
if (StarmapFilterToggler.Checked)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 12; i++)
|
for (int i = 0; i < 12; i++)
|
||||||
{
|
{
|
||||||
@@ -513,9 +514,9 @@ public static class UIFunctions
|
|||||||
|
|
||||||
public static void OnPlanetScanEnded()
|
public static void OnPlanetScanEnded()
|
||||||
{
|
{
|
||||||
if (!_starmapFilterInitialized || _starmapFilterToggler == null || _starmapFilterToggler.gameObject.activeSelf) return;
|
if (!_starmapFilterInitialized || StarmapFilterToggler == null || StarmapFilterToggler.gameObject.activeSelf) return;
|
||||||
StarmapUpdateFilterValues();
|
StarmapUpdateFilterValues();
|
||||||
_starmapFilterToggler.gameObject.SetActive(true);
|
StarmapFilterToggler.gameObject.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void StarmapUpdateFilterValues()
|
private static void StarmapUpdateFilterValues()
|
||||||
|
|||||||
@@ -41,4 +41,33 @@ public class UIPatch: PatchImpl<UIPatch>
|
|||||||
{
|
{
|
||||||
return Functions.UIFunctions.CornerComboBoxIndex == 0;
|
return Functions.UIFunctions.CornerComboBoxIndex == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(UIMechaLab), nameof(UIMechaLab.DetermineVisible))]
|
||||||
|
private static bool UIMechaLab_DetermineVisible_Prefix(UIMechaLab __instance, ref bool __result)
|
||||||
|
{
|
||||||
|
if (!UIRoot.instance.uiGame.starmap.active || !Functions.UIFunctions.StarmapFilterToggler.Checked)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
__instance._Close();
|
||||||
|
__result = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(UIGoalPanel), nameof(UIGoalPanel.DetermineVisiable))]
|
||||||
|
private static bool UIGoalPanel_DetermineVisiable_Prefix(UIGoalPanel __instance)
|
||||||
|
{
|
||||||
|
if (!UIRoot.instance.uiGame.starmap.active || !Functions.UIFunctions.StarmapFilterToggler.Checked)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
__instance.isUseOverwrittenState = true;
|
||||||
|
if (__instance.stateOverwritten == EUIGoalPanelState.None)
|
||||||
|
{
|
||||||
|
__instance.stateOverwritten = EUIGoalPanelState.Collapse;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#### TODO
|
#### TODO
|
||||||
* Starmap filter: top windows overlap fix
|
|
||||||
* Set battlefield analysis base power charging
|
* Set battlefield analysis base power charging
|
||||||
* Auto-navigation: avoid darkfogs
|
* Auto-navigation: avoid darkfogs
|
||||||
|
|||||||
Reference in New Issue
Block a user