ui update

This commit is contained in:
Hubert Mattusch 2023-10-03 15:55:02 +02:00
parent 0148de0db7
commit 164fd2f794
7 changed files with 58 additions and 10 deletions

View File

@ -55,6 +55,18 @@ public static class BuildingUtils
BuildDevelopment();
UploadSteam();
}
[MenuItem("Tools/Build/Steam/Demo")]
public static void SteamDemo()
{
if(!CanBuild())
return;
IncreaseBuildNumber();
BuildDemo();
UploadSteam(true);
}
[MenuItem("Tools/Build/All Release")]
public static void BuildRelease()
@ -72,6 +84,15 @@ public static class BuildingUtils
return;
BuildWindowsDevelopment();
}
[MenuItem("Tools/Build/All Demo")]
public static void BuildDemo()
{
if(!CanBuild())
return;
BuildWindows(true, new[] {"DEMO"});
BuildLinux(true, new[] {"DEMO"});
}
[MenuItem("Tools/Build/Platform/Windows/x64-Development")]
public static void BuildWindowsDevelopment()
@ -163,9 +184,13 @@ public static class BuildingUtils
PlayerSettings.bundleVersion = string.Join(".", versionParts);
}
private static void UploadSteam()
private static void UploadSteam(bool demo = false)
{
string command = $"cd {Application.dataPath}/../../{Application.productName}-Steam/ContentBuilder && push_build.bat";
if (demo)
{
command = $"cd {Application.dataPath}/../../{Application.productName}-Steam/ContentBuilder && push_demo.bat";
}
var processInfo = new ProcessStartInfo("cmd.exe", $"/c {command}")
{

View File

@ -6,6 +6,7 @@ using NEG.Utils;
using NegUtils.NEG.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace NEG.UI
@ -34,7 +35,7 @@ namespace NEG.UI
/// <summary>
/// Current window that is considered main (focused, lastly opened). Can be null.
/// </summary>
public IWindow CurrentMainWindow { get; protected set; }
public IWindow CurrentMainWindow => mainWindows.LastOrDefault();
public PopupData CurrentPopup => currentShownPopup.data;
@ -47,6 +48,8 @@ namespace NEG.UI
//TODO: localize
private string localizedYes = "Yes", localizedNo = "No", localizedOk = "Ok";
private List<IWindow> mainWindows;
protected UiManager(IArea startArea)
{
if (Instance != null)
@ -58,6 +61,7 @@ namespace NEG.UI
Instance = this;
CurrentArea = startArea;
mainWindows = new List<IWindow>();
}
/// <summary>
@ -146,14 +150,16 @@ namespace NEG.UI
public virtual void Dispose() => Instance = null;
public void SetMainWindow(IWindow window) => CurrentMainWindow = window;
public void SetMainWindow(IWindow window) => mainWindows.Add(window);
public void MainWindowClosed(IWindow window) => mainWindows.Remove(window);
public void OnWindowClosed(IWindow window)
{
if(CurrentMainWindow != window)
return;
CurrentMainWindow = null;
MainWindowClosed(window);
//TODO: select new main window
}

View File

@ -48,14 +48,14 @@ namespace NEG.UI.UnityUi
private void OnSelectionChangeStarted()
{
if(CurrentSelectionSource == SelectionSource.Direction)
if(CurrentSelectionSource == SelectionSource.Direction && EventSystem.current.currentSelectedGameObject != null)
return;
SetDirectionInput();
}
private void SetDirectionInput()
{
if (EventSystem.current == null || MonoUiManager.Instance == null || CurrentSelectionSource == SelectionSource.Direction)
if (EventSystem.current == null || MonoUiManager.Instance == null )
{
return;
}
@ -95,6 +95,8 @@ namespace NEG.UI.UnityUi
if (EventSystem.current.currentInputModule == null)
return;
EventSystem.current.SetSelectedGameObject(null);
var module = (InputSystemUIInputModule)EventSystem.current.currentInputModule;
var result = module.GetLastRaycastResult(0);
if(result.gameObject == null)

View File

@ -12,6 +12,7 @@ using UnityEngine.Serialization;
namespace NEG.UI.UnityUi.Window
{
[DefaultExecutionOrder(10)]
public class MonoWindow : MonoBehaviour, IWindow
{
public event Action<object> OnOpened;

View File

@ -1,3 +1,11 @@
fileFormatVersion: 2
fileFormatVersion: 2
guid: 85d136d6850728d4b96c26fa286ffe3c
timeCreated: 1670709296
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 10
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -24,7 +24,13 @@ namespace NEG.UI.WindowSlot
window.SetOpenedState(this, data);
}
public override void DetachWindow(IWindow window) => CurrentWindow = null;
public override void DetachWindow(IWindow window)
{
if(UiManager.Instance.CurrentMainWindow == window)
UiManager.Instance.MainWindowClosed(window);
CurrentWindow = null;
}
public override void CloseAllWindows() => CurrentWindow = null;
}
}

View File

@ -47,7 +47,7 @@ namespace NegUtils.NEG.UI.UnityUi.WindowSlot
currentWindow = windowsHistory[^1];
currentWindow.SeVisibleState();
if(UiManager.Instance.CurrentMainWindow == window)
UiManager.Instance.SetMainWindow(currentWindow);
UiManager.Instance.MainWindowClosed(window);
EventSystem.current.SetSelectedGameObject(((MonoWindow)currentWindow).DefaultSelectedItem);
}
public override void CloseAllWindows()