Cleanup
This commit is contained in:
parent
20e281f9dd
commit
85dee79cc8
@ -1,5 +1,5 @@
|
||||
using KBCore.Refs;
|
||||
using NEG.UI.UnityUi.Buttons.Reaction;
|
||||
using NEG.UI.UnityUi.Buttons.Behaviours;
|
||||
using NEG.UI.UnityUi.Buttons.Settings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -43,7 +43,11 @@ namespace NEG.UI.UnityUi.Buttons
|
||||
|
||||
private void Start() => OnDeselect(null);
|
||||
|
||||
private void OnValidate() => this.ValidateRefs();
|
||||
private void OnValidate()
|
||||
{
|
||||
this.ValidateRefs();
|
||||
text.text = gameObject.name;
|
||||
}
|
||||
|
||||
public void OnDeselect(BaseEventData eventData) => OnDeselected?.Invoke(eventData is SilentEventData);
|
||||
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 953c3353e3af44258625fe607ede632b
|
||||
timeCreated: 1683915598
|
||||
@ -1,21 +0,0 @@
|
||||
using NEG.UI.UnityUi.Buttons.Settings;
|
||||
using System;
|
||||
|
||||
namespace NEG.UI.UnityUi.Buttons.Reaction
|
||||
{
|
||||
public abstract class ButtonElementBehaviour : IDisposable
|
||||
{
|
||||
protected readonly BaseButton button;
|
||||
protected SettingData baseData;
|
||||
|
||||
public ButtonElementBehaviour(BaseButton baseButton, SettingData settingData)
|
||||
{
|
||||
button = baseButton;
|
||||
baseData = settingData;
|
||||
}
|
||||
|
||||
public abstract void Dispose();
|
||||
|
||||
public virtual void ChangeData(SettingData newData) => baseData = newData;
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5e3decad6424cb288eff3e6f7e0d28e
|
||||
timeCreated: 1683919740
|
||||
@ -1,41 +0,0 @@
|
||||
using NEG.UI.UnityUi.Buttons.Settings;
|
||||
using NEG.Utils;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NEG.UI.UnityUi.Buttons.Reaction
|
||||
{
|
||||
public class ChangeTextColorBehaviour : ButtonElementBehaviour
|
||||
{
|
||||
private ColorData data;
|
||||
|
||||
public ChangeTextColorBehaviour(BaseButton baseButton, ColorData data) : base(baseButton, data)
|
||||
{
|
||||
if (baseButton.Text == null)
|
||||
return;
|
||||
|
||||
baseButton.OnSelected += OnButtonSelected;
|
||||
baseButton.OnDeselected += OnButtonDeselected;
|
||||
ChangeData(data);
|
||||
}
|
||||
|
||||
public override void ChangeData(SettingData newData)
|
||||
{
|
||||
base.ChangeData(newData);
|
||||
Debug.Assert(newData is ColorData, "newData is not ColorData");
|
||||
data = (ColorData)newData;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
button.OnSelected -= OnButtonSelected;
|
||||
button.OnDeselected -= OnButtonDeselected;
|
||||
}
|
||||
|
||||
[FactoryRegistration]
|
||||
private static void RegisterInFactory() =>
|
||||
MonoUiManager.Instance.BehavioursFactory.Register("ChangeTextColor", typeof(ChangeTextColorBehaviour));
|
||||
|
||||
private void OnButtonSelected(bool _) => button.Text.color = data.SelectedColor;
|
||||
private void OnButtonDeselected(bool _) => button.Text.color = data.DeselectedColor;
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2079225d6e34001ae85f74a0a418d68
|
||||
timeCreated: 1683919878
|
||||
@ -1,21 +0,0 @@
|
||||
#if FMOD
|
||||
namespace NEG.UI.UnityUi.Buttons.Reaction
|
||||
{
|
||||
public class SimpleSoundBehaviour : ButtonElementBehaviour
|
||||
{
|
||||
public SimpleSoundBehaviour(BaseButton baseButton, FmodSoundData data) : base(baseButton, data)
|
||||
{
|
||||
//TODO: use silnet to not play sound
|
||||
}
|
||||
|
||||
[FactoryRegistration]
|
||||
private static void RegisterInFactory() =>
|
||||
MonoUiManager.Instance.BehavioursFactory.Register("SimpleSound", typeof(SimpleSoundBehaviour));
|
||||
|
||||
public override void ChangeData(SettingData newData) => throw new System.NotImplementedException();
|
||||
|
||||
public override void Dispose() => throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d75c0d86eeab47a1a6340f0b03b83de0
|
||||
timeCreated: 1684002680
|
||||
3
NEG/UI/UnityUi/Buttons/Reactions.meta
Normal file
3
NEG/UI/UnityUi/Buttons/Reactions.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ccaf0d2f63be41f6956471dcd9c210d9
|
||||
timeCreated: 1709465582
|
||||
@ -1,10 +1,10 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace NEG.UI.UnityUi.Buttons
|
||||
namespace NEG.UI.UnityUi.Buttons.Reactions
|
||||
{
|
||||
[RequireComponent(typeof(BaseButton))]
|
||||
public class ChangeSceneButton : ButtonReaction
|
||||
public class ChangeScene : ButtonReaction
|
||||
{
|
||||
[Header("Leave empty to use int value")] [SerializeField]
|
||||
private string sceneName;
|
||||
@ -1,4 +1,4 @@
|
||||
namespace NEG.UI.UnityUi.Buttons
|
||||
namespace NEG.UI.UnityUi.Buttons.Reactions
|
||||
{
|
||||
public class CloseAllWindows : ButtonReaction
|
||||
{
|
||||
@ -2,7 +2,7 @@
|
||||
using NEG.UI.Window;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NEG.UI.UnityUi.Buttons
|
||||
namespace NEG.UI.UnityUi.Buttons.Reactions
|
||||
{
|
||||
[RequireComponent(typeof(BaseButton))]
|
||||
public class CloseWindow : ButtonReaction
|
||||
15
NEG/UI/UnityUi/Buttons/Reactions/ExitGame.cs
Normal file
15
NEG/UI/UnityUi/Buttons/Reactions/ExitGame.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NEG.UI.UnityUi.Buttons.Reactions
|
||||
{
|
||||
public class ExitGame : ButtonReaction
|
||||
{
|
||||
protected override void OnClicked()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.isPlaying = false;
|
||||
#endif
|
||||
Application.Quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
3
NEG/UI/UnityUi/Buttons/Reactions/ExitGame.cs.meta
Normal file
3
NEG/UI/UnityUi/Buttons/Reactions/ExitGame.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 185f765a5bf7487ab85a7d95fc0ef2c7
|
||||
timeCreated: 1709473462
|
||||
@ -2,7 +2,7 @@
|
||||
using NEG.UI.Window;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NEG.UI.UnityUi.Buttons
|
||||
namespace NEG.UI.UnityUi.Buttons.Reactions
|
||||
{
|
||||
public class OpenAsCurrentMainChild : ButtonReaction
|
||||
{
|
||||
@ -3,7 +3,7 @@ using NEG.UI.UnityUi.WindowSlot;
|
||||
using NEG.UI.Window;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NEG.UI.UnityUi.Buttons
|
||||
namespace NEG.UI.UnityUi.Buttons.Reactions
|
||||
{
|
||||
[RequireComponent(typeof(BaseButton))]
|
||||
public class OpenWindow : ButtonReaction
|
||||
@ -1,6 +1,6 @@
|
||||
using NEG.UI.Area;
|
||||
using NEG.UI.Popup;
|
||||
using NEG.UI.UnityUi.Buttons.Reaction;
|
||||
using NEG.UI.UnityUi.Buttons.Behaviours;
|
||||
using NEG.UI.UnityUi.Buttons.Settings;
|
||||
using NEG.UI.UnityUi.Popup;
|
||||
using NEG.UI.UnityUi.Window;
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da80835a1611a5e4d908f51f09e8d3bc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 849242dbc213969488426f85222a43a9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
x
Reference in New Issue
Block a user