Commit uncommited stuff I was missing like an idiot
This commit is contained in:
parent
6efd2653a1
commit
9e4ab5f7a3
37 changed files with 3055 additions and 1 deletions
71
Assets/Scripts/UI/DeliveryResultUI.cs
Normal file
71
Assets/Scripts/UI/DeliveryResultUI.cs
Normal file
|
@ -0,0 +1,71 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DeliveryResultUI : MonoBehaviour
|
||||
{
|
||||
|
||||
private const string POPUP = "Popup";
|
||||
|
||||
[SerializeField] private Image backgroundImage;
|
||||
[SerializeField] private Image iconImage;
|
||||
[SerializeField] private TextMeshProUGUI messageText;
|
||||
|
||||
[SerializeField] private Color successColour;
|
||||
[SerializeField] private Color failColour;
|
||||
|
||||
[SerializeField] private Sprite successSprite;
|
||||
[SerializeField] private Sprite failSprite;
|
||||
|
||||
private Animator animator;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
animator = GetComponentInChildren<Animator>();
|
||||
}
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
DeliveryManager.Instance.OnRecipeCompleted += DeliveryManager_OnRecipeCompleted;
|
||||
DeliveryManager.Instance.OnRecipeFailed += DeliveryManager_OnRecipeFailed;
|
||||
|
||||
Hide();
|
||||
}
|
||||
|
||||
private void DeliveryManager_OnRecipeFailed(object sender, System.EventArgs e)
|
||||
{
|
||||
backgroundImage.color = failColour;
|
||||
iconImage.sprite = failSprite;
|
||||
|
||||
messageText.text = "DELIVERY\nFAILED";
|
||||
|
||||
Show();
|
||||
|
||||
animator.SetTrigger(POPUP);
|
||||
}
|
||||
|
||||
private void DeliveryManager_OnRecipeCompleted(object sender, System.EventArgs e)
|
||||
{
|
||||
backgroundImage.color = successColour;
|
||||
iconImage.sprite = successSprite;
|
||||
|
||||
messageText.text = "DELIVERY\nSUCCESS";
|
||||
|
||||
Show();
|
||||
|
||||
animator.SetTrigger(POPUP);
|
||||
}
|
||||
|
||||
private void Show()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
private void Hide()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
11
Assets/Scripts/UI/DeliveryResultUI.cs.meta
Normal file
11
Assets/Scripts/UI/DeliveryResultUI.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 46812ad5454e74340a5e08d4802bcdb7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
62
Assets/Scripts/UI/GamePausedUI.cs
Normal file
62
Assets/Scripts/UI/GamePausedUI.cs
Normal file
|
@ -0,0 +1,62 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class GamePausedUI : MonoBehaviour
|
||||
{
|
||||
|
||||
[SerializeField] private Button resumeButton;
|
||||
[SerializeField] private Button optionsButton;
|
||||
[SerializeField] private Button mainMenuButton;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
resumeButton.onClick.AddListener(() =>
|
||||
{
|
||||
GameStateManager.Instace.TogglePauseGame();
|
||||
});
|
||||
|
||||
optionsButton.onClick.AddListener(() =>
|
||||
{
|
||||
Hide();
|
||||
OptionsUI.Instance.Show(Show);
|
||||
});
|
||||
|
||||
mainMenuButton.onClick.AddListener(() =>
|
||||
{
|
||||
Loader.Load(Loader.Scene.MainMenuScene);
|
||||
});
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
GameStateManager.Instace.OnGamePaused += GameStateManager_OnGamePaused;
|
||||
GameStateManager.Instace.OnGameUnpaused += GameStateManager_OnGameUnpaused;
|
||||
|
||||
Hide();
|
||||
}
|
||||
|
||||
private void GameStateManager_OnGameUnpaused(object sender, System.EventArgs e)
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
|
||||
private void GameStateManager_OnGamePaused(object sender, System.EventArgs e)
|
||||
{
|
||||
Show();
|
||||
}
|
||||
|
||||
private void Show()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
|
||||
resumeButton.Select();
|
||||
}
|
||||
|
||||
private void Hide()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
}
|
11
Assets/Scripts/UI/GamePausedUI.cs.meta
Normal file
11
Assets/Scripts/UI/GamePausedUI.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d07fdeb993fb5cb4f9c0f84581449bb0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
154
Assets/Scripts/UI/OptionsUI.cs
Normal file
154
Assets/Scripts/UI/OptionsUI.cs
Normal file
|
@ -0,0 +1,154 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class OptionsUI : MonoBehaviour
|
||||
{
|
||||
|
||||
public static OptionsUI Instance { get; private set; }
|
||||
|
||||
private Action onCloseButtonAction;
|
||||
|
||||
// ---Sound settings---
|
||||
[SerializeField] private Button soundEffectsButton;
|
||||
[SerializeField] private Button musicButton;
|
||||
[SerializeField] private Button closeButton;
|
||||
[SerializeField] private TextMeshProUGUI soundEffectsText;
|
||||
[SerializeField] private TextMeshProUGUI musicText;
|
||||
|
||||
// ---Bindings buttons---
|
||||
[SerializeField] private Button moveUpButton;
|
||||
[SerializeField] private Button moveDownButton;
|
||||
[SerializeField] private Button moveLeftButton;
|
||||
[SerializeField] private Button moveRightButton;
|
||||
[SerializeField] private Button interactButton;
|
||||
[SerializeField] private Button altInteractButton;
|
||||
[SerializeField] private Button pauseButton;
|
||||
[SerializeField] private Button gamePadInteractButton;
|
||||
[SerializeField] private Button gamePadAltInteractButton;
|
||||
[SerializeField] private Button gamePadPauseButton;
|
||||
|
||||
// ---Bindings text---
|
||||
[SerializeField] private TextMeshProUGUI moveUpText;
|
||||
[SerializeField] private TextMeshProUGUI moveDownText;
|
||||
[SerializeField] private TextMeshProUGUI moveLeftText;
|
||||
[SerializeField] private TextMeshProUGUI moveRightText;
|
||||
[SerializeField] private TextMeshProUGUI interactText;
|
||||
[SerializeField] private TextMeshProUGUI altInteractText;
|
||||
[SerializeField] private TextMeshProUGUI pauseText;
|
||||
[SerializeField] private TextMeshProUGUI gamePadInteractText;
|
||||
[SerializeField] private TextMeshProUGUI gamePadAltInteractText;
|
||||
[SerializeField] private TextMeshProUGUI gamePadPauseText;
|
||||
|
||||
// ---Rebind overlay---
|
||||
[SerializeField] private Transform pressToRebindKeyTransform;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
|
||||
soundEffectsButton.onClick.AddListener(() =>
|
||||
{
|
||||
SoundManager.Instance.ChangeVolume();
|
||||
UpdateVisual();
|
||||
});
|
||||
|
||||
musicButton.onClick.AddListener(() =>
|
||||
{
|
||||
MusicManager.Instance.ChangeVolume();
|
||||
UpdateVisual();
|
||||
});
|
||||
|
||||
closeButton.onClick.AddListener(() =>
|
||||
{
|
||||
Hide();
|
||||
onCloseButtonAction();
|
||||
});
|
||||
|
||||
// ---Rebind keys---
|
||||
moveUpButton.onClick.AddListener(() => {RebindKey(GameInput.Bindings.Move_Up);});
|
||||
moveDownButton.onClick.AddListener(() => {RebindKey(GameInput.Bindings.Move_Down);});
|
||||
moveLeftButton.onClick.AddListener(() => {RebindKey(GameInput.Bindings.Move_Left);});
|
||||
moveRightButton.onClick.AddListener(() => {RebindKey(GameInput.Bindings.Move_Right);});
|
||||
interactButton.onClick.AddListener(() => { RebindKey(GameInput.Bindings.Interact); });
|
||||
altInteractButton.onClick.AddListener(() => { RebindKey(GameInput.Bindings.InteractAlternate); });
|
||||
pauseButton.onClick.AddListener(() => { RebindKey(GameInput.Bindings.Pause); });
|
||||
gamePadInteractButton.onClick.AddListener(() => { RebindKey(GameInput.Bindings.Gamepad_Interact); });
|
||||
gamePadAltInteractButton.onClick.AddListener(() => { RebindKey(GameInput.Bindings.Gamepad_InteractAlternate); });
|
||||
gamePadPauseButton.onClick.AddListener(() => { RebindKey(GameInput.Bindings.Gamepad_Pause); });
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
GameStateManager.Instace.OnGameUnpaused += GameStateManager_OnGameUnpaused;
|
||||
|
||||
UpdateVisual();
|
||||
|
||||
HideRebindOverlay();
|
||||
Hide();
|
||||
}
|
||||
|
||||
private void GameStateManager_OnGameUnpaused(object sender, System.EventArgs e)
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
|
||||
private void UpdateVisual()
|
||||
{
|
||||
// ---Update volume button text---
|
||||
soundEffectsText.text = "Sound Effects: " + Mathf.Round(SoundManager.Instance.GetVolume() * 10f);
|
||||
musicText.text = "Music: " + Mathf.Round(MusicManager.Instance.GetVolume() * 10f);
|
||||
|
||||
// ---Update keybind button text---
|
||||
moveUpText.text = GameInput.Instance.GetBindingText(GameInput.Bindings.Move_Up);
|
||||
moveDownText.text = GameInput.Instance.GetBindingText(GameInput.Bindings.Move_Down);
|
||||
moveLeftText.text = GameInput.Instance.GetBindingText(GameInput.Bindings.Move_Left);
|
||||
moveRightText.text = GameInput.Instance.GetBindingText(GameInput.Bindings.Move_Right);
|
||||
interactText.text = GameInput.Instance.GetBindingText(GameInput.Bindings.Interact);
|
||||
altInteractText.text = GameInput.Instance.GetBindingText(GameInput.Bindings.InteractAlternate);
|
||||
pauseText.text = GameInput.Instance.GetBindingText(GameInput.Bindings.Pause);
|
||||
gamePadInteractText.text = GameInput.Instance.GetBindingText(GameInput.Bindings.Gamepad_Interact);
|
||||
gamePadAltInteractText.text = GameInput.Instance.GetBindingText(GameInput.Bindings.Gamepad_InteractAlternate);
|
||||
gamePadPauseText.text = GameInput.Instance.GetBindingText(GameInput.Bindings.Gamepad_Pause);
|
||||
}
|
||||
|
||||
public void Show(Action onCloseButtonAction)
|
||||
{
|
||||
this.onCloseButtonAction = onCloseButtonAction;
|
||||
|
||||
gameObject.SetActive(true);
|
||||
|
||||
soundEffectsButton.Select();
|
||||
}
|
||||
|
||||
private void Hide()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void ShowRebindOverlay()
|
||||
{
|
||||
pressToRebindKeyTransform.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
private void HideRebindOverlay()
|
||||
{
|
||||
pressToRebindKeyTransform.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private void RebindKey(GameInput.Bindings key)
|
||||
{
|
||||
ShowRebindOverlay();
|
||||
|
||||
GameInput.Instance.RebindButton(key, () =>
|
||||
{
|
||||
HideRebindOverlay();
|
||||
UpdateVisual();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
11
Assets/Scripts/UI/OptionsUI.cs.meta
Normal file
11
Assets/Scripts/UI/OptionsUI.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c1698a1f518bd6e4c943cd2702613962
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
35
Assets/Scripts/UI/StoveBurnFlashingBarUI.cs
Normal file
35
Assets/Scripts/UI/StoveBurnFlashingBarUI.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class StoveBurnFlashingBarUI : MonoBehaviour
|
||||
{
|
||||
|
||||
private const string IS_FLASHING = "IsFlashing";
|
||||
|
||||
[SerializeField] private StoveCounter stoveCounter;
|
||||
|
||||
private Animator animator;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
animator = GetComponent<Animator>();
|
||||
|
||||
animator.SetBool(IS_FLASHING, false);
|
||||
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
stoveCounter.OnProgressChange += StoveCounter_OnProgressChange;
|
||||
}
|
||||
|
||||
private void StoveCounter_OnProgressChange(object sender, IHasProgress.OnProgressChangeEventsArgs e)
|
||||
{
|
||||
float burnShowProgressAmount = .5f;
|
||||
bool play = stoveCounter.IsFried() && e.progressNormalized >= burnShowProgressAmount;
|
||||
|
||||
animator.SetBool(IS_FLASHING, play);
|
||||
}
|
||||
|
||||
}
|
11
Assets/Scripts/UI/StoveBurnFlashingBarUI.cs.meta
Normal file
11
Assets/Scripts/UI/StoveBurnFlashingBarUI.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 05d92978b779dd84b90fb03815ec18ae
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
41
Assets/Scripts/UI/StoveBurnWarningUI.cs
Normal file
41
Assets/Scripts/UI/StoveBurnWarningUI.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class StoveBurnWarningUI : MonoBehaviour
|
||||
{
|
||||
|
||||
[SerializeField] private StoveCounter stoveCounter;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
stoveCounter.OnProgressChange += StoveCounter_OnProgressChange;
|
||||
|
||||
Hide();
|
||||
}
|
||||
|
||||
private void StoveCounter_OnProgressChange(object sender, IHasProgress.OnProgressChangeEventsArgs e)
|
||||
{
|
||||
float burnShowProgressAmount = .5f;
|
||||
bool show = stoveCounter.IsFried() && e.progressNormalized >= burnShowProgressAmount;
|
||||
|
||||
if (show)
|
||||
{
|
||||
Show();
|
||||
} else
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
}
|
||||
|
||||
private void Show()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
private void Hide()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
}
|
11
Assets/Scripts/UI/StoveBurnWarningUI.cs.meta
Normal file
11
Assets/Scripts/UI/StoveBurnWarningUI.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d05a4f69376d1a7478855887647310fa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
75
Assets/Scripts/UI/TutorialSplashUI.cs
Normal file
75
Assets/Scripts/UI/TutorialSplashUI.cs
Normal file
|
@ -0,0 +1,75 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class TutorialSplashUI : MonoBehaviour
|
||||
{
|
||||
|
||||
// ---Movement---
|
||||
[SerializeField] private TextMeshProUGUI keyMoveUpText;
|
||||
[SerializeField] private TextMeshProUGUI keyMoveDownText;
|
||||
[SerializeField] private TextMeshProUGUI keyMoveLeftText;
|
||||
[SerializeField] private TextMeshProUGUI keyMoveRightText;
|
||||
|
||||
// ---Keyboard actions---
|
||||
[SerializeField] private TextMeshProUGUI keyInteractText;
|
||||
[SerializeField] private TextMeshProUGUI keyAltInteractText;
|
||||
[SerializeField] private TextMeshProUGUI keyPauseText;
|
||||
|
||||
|
||||
// ---GamePad actions---
|
||||
[SerializeField] private TextMeshProUGUI keyGamepadInteractText;
|
||||
[SerializeField] private TextMeshProUGUI keyGamepadAltInteractText;
|
||||
[SerializeField] private TextMeshProUGUI keyGamepadPauseText;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
GameInput.Instance.OnKeyRebind += GameInput_OnKeyRebind;
|
||||
GameStateManager.Instace.OnStateChanged += GameStateManager_OnStateChanged;
|
||||
|
||||
UpdateVisual();
|
||||
|
||||
Show();
|
||||
}
|
||||
|
||||
private void GameStateManager_OnStateChanged(object sender, System.EventArgs e)
|
||||
{
|
||||
if (GameStateManager.Instace.IsCountdownToStartActive())
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
}
|
||||
|
||||
private void GameInput_OnKeyRebind(object sender, System.EventArgs e)
|
||||
{
|
||||
UpdateVisual();
|
||||
}
|
||||
|
||||
private void UpdateVisual()
|
||||
{
|
||||
// ---Update keybind button text---
|
||||
keyMoveUpText.text = GameInput.Instance.GetBindingText(GameInput.Bindings.Move_Up);
|
||||
keyMoveDownText.text = GameInput.Instance.GetBindingText(GameInput.Bindings.Move_Down);
|
||||
keyMoveLeftText.text = GameInput.Instance.GetBindingText(GameInput.Bindings.Move_Left);
|
||||
keyMoveRightText.text = GameInput.Instance.GetBindingText(GameInput.Bindings.Move_Right);
|
||||
keyInteractText.text = GameInput.Instance.GetBindingText(GameInput.Bindings.Interact);
|
||||
keyAltInteractText.text = GameInput.Instance.GetBindingText(GameInput.Bindings.InteractAlternate);
|
||||
keyPauseText.text = GameInput.Instance.GetBindingText(GameInput.Bindings.Pause);
|
||||
keyGamepadInteractText.text = GameInput.Instance.GetBindingText(GameInput.Bindings.Gamepad_Interact);
|
||||
keyGamepadAltInteractText.text = GameInput.Instance.GetBindingText(GameInput.Bindings.Gamepad_InteractAlternate);
|
||||
keyGamepadPauseText.text = GameInput.Instance.GetBindingText(GameInput.Bindings.Gamepad_Pause);
|
||||
}
|
||||
|
||||
private void Show()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
private void Hide()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
|
||||
}
|
11
Assets/Scripts/UI/TutorialSplashUI.cs.meta
Normal file
11
Assets/Scripts/UI/TutorialSplashUI.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2e18298f7c56e06429e61a6407befd7f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in a new issue