working on city

This commit is contained in:
Hubert Mattusch 2023-12-16 22:22:25 +01:00
parent d9fc097783
commit 8d5b903b1a
5 changed files with 31 additions and 4 deletions

View File

@ -170,7 +170,7 @@ namespace NEG.UI
protected void SetDefaultPopup(IDefaultPopup popup) => currentDefaultPopup = popup; protected void SetDefaultPopup(IDefaultPopup popup) => currentDefaultPopup = popup;
private void UpdatePopupsState(bool forceShow, int priority = 0, PopupData data = null) protected virtual void UpdatePopupsState(bool forceShow, int priority = 0, PopupData data = null)
{ {
if (forceShow) if (forceShow)
{ {

View File

@ -12,12 +12,10 @@ namespace NEG.UI.UnityUi
Direction Direction
} }
public class UiInputModule { } public class UiInputModule { public SelectionSource CurrentSelectionSource { get; protected set; }}
public class DefaultInputModule : UiInputModule public class DefaultInputModule : UiInputModule
{ {
public SelectionSource CurrentSelectionSource { get; private set; }
public DefaultInputModule() public DefaultInputModule()
{ {
var defaultActions = new DefaultInputActions(); var defaultActions = new DefaultInputActions();

View File

@ -3,11 +3,13 @@ using NEG.UI.Popup;
using NEG.UI.UnityUi.Buttons.Reaction; using NEG.UI.UnityUi.Buttons.Reaction;
using NEG.UI.UnityUi.Buttons.Settings; using NEG.UI.UnityUi.Buttons.Settings;
using NEG.UI.UnityUi.Popup; using NEG.UI.UnityUi.Popup;
using NEG.UI.UnityUi.Window;
using NEG.Utils; using NEG.Utils;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.Assertions; using UnityEngine.Assertions;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
using Object = UnityEngine.Object; using Object = UnityEngine.Object;
@ -68,6 +70,17 @@ namespace NEG.UI.UnityUi
Instance = null; Instance = null;
} }
protected override void UpdatePopupsState(bool forceShow, int priority = 0, PopupData data = null)
{
base.UpdatePopupsState(forceShow, priority, data);
if(inputModule.CurrentSelectionSource != SelectionSource.Direction)
return;
if (CurrentPopup == null && (EventSystem.current.currentSelectedGameObject != null || !EventSystem.current.currentSelectedGameObject.activeInHierarchy))
{
EventSystem.current.SetSelectedGameObject(((MonoWindow)CurrentMainWindow).DefaultSelectedItem);
}
}
private void SpawnDefaultPopup() private void SpawnDefaultPopup()
{ {
var canvas = Object.Instantiate(canvasPrefab); var canvas = Object.Instantiate(canvasPrefab);

View File

@ -0,0 +1,13 @@
using NegUtils.NEG.UI;
namespace NEG.UI.UnityUi.Window
{
public class NoReactionOnBack : MonoController
{
protected override void OnBackUsed(IControllable.BackUsed backUsed)
{
base.OnBackUsed(backUsed);
backUsed.Used = true;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c4a5380c95244c76ac79f820d16ea11c
timeCreated: 1702565120