Added Options, Instructions, basic HUDs and Game over
This commit is contained in:
parent
bfbb1e7d8b
commit
f29b38f650
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -88,20 +88,20 @@ public class PopupManager : MonoBehaviour, IBase, IBootLoader
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case PopupResultEvent.LifeLostInGameOver:
|
case PopupResultEvent.LifeLostInGameOver:
|
||||||
ShowPopup(PopupType.LevelFailPopup);
|
//ShowPopup(PopupType.LevelFailPopup);
|
||||||
break;
|
break;
|
||||||
case PopupResultEvent.OnSpentCoinsForLevel:
|
case PopupResultEvent.OnSpentCoinsForLevel:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PopupResultEvent.OnFreeRefillHealth:
|
case PopupResultEvent.OnFreeRefillHealth:
|
||||||
ShowPopup(PopupType.FreeRefillPopup);
|
//ShowPopup(PopupType.FreeRefillPopup);
|
||||||
break;
|
break;
|
||||||
case PopupResultEvent.LivesFull:
|
case PopupResultEvent.LivesFull:
|
||||||
case PopupResultEvent.OnCancelRefillHealth:
|
case PopupResultEvent.OnCancelRefillHealth:
|
||||||
case PopupResultEvent.FreeRefillUsed:
|
case PopupResultEvent.FreeRefillUsed:
|
||||||
Debug.Log($"GetMoreLivesPopup");
|
Debug.Log($"GetMoreLivesPopup");
|
||||||
ShowPopup(PopupType.GetMoreLivesPopup);
|
//ShowPopup(PopupType.GetMoreLivesPopup);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -5,17 +5,10 @@ using UnityEngine;
|
|||||||
|
|
||||||
public enum PopupType
|
public enum PopupType
|
||||||
{
|
{
|
||||||
FTUE_Popup, //
|
PvPModePopup,
|
||||||
PVPModePopup,
|
PvAIModePopup,
|
||||||
SettingsPopup,
|
OptionsPopup,
|
||||||
RestartPopup, //
|
InstructionsPopup
|
||||||
LevelCompletePopup,
|
|
||||||
GameOverPopup,
|
|
||||||
LevelFailPopup,
|
|
||||||
GetMoreLivesPopup, //
|
|
||||||
FreeRefillPopup,
|
|
||||||
FeedbackPopup,
|
|
||||||
TargetGoalPopup
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PopupScalerType
|
public enum PopupScalerType
|
||||||
@ -55,6 +48,7 @@ public class PopupBase : UIBase, IUIBase
|
|||||||
{
|
{
|
||||||
popupManager = popupManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<PopupManager>() : popupManager;
|
popupManager = popupManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<PopupManager>() : popupManager;
|
||||||
popupManager.RegisterPopup(this);
|
popupManager.RegisterPopup(this);
|
||||||
|
Debug.Log($"Popup Registered: {popupType}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitNextActionEvent(Action<PopupResultEvent> onComplete)
|
public void InitNextActionEvent(Action<PopupResultEvent> onComplete)
|
||||||
|
|||||||
8
Assets/Scripts/UI/Pages/PopUp.meta
Normal file
8
Assets/Scripts/UI/Pages/PopUp.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 687ccf4067732407e96347725f685218
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/Scripts/UI/Pages/PopUp/InstructionsPopup.cs
Normal file
8
Assets/Scripts/UI/Pages/PopUp/InstructionsPopup.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class InstructionsPopup : PopupBase
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
11
Assets/Scripts/UI/Pages/PopUp/InstructionsPopup.cs.meta
Normal file
11
Assets/Scripts/UI/Pages/PopUp/InstructionsPopup.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5e049140f2b6b460aa6f3de9b81ea51f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
7
Assets/Scripts/UI/Pages/PopUp/OptionsPopup.cs
Normal file
7
Assets/Scripts/UI/Pages/PopUp/OptionsPopup.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class OptionsPopup : PopupBase
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
11
Assets/Scripts/UI/Pages/PopUp/OptionsPopup.cs.meta
Normal file
11
Assets/Scripts/UI/Pages/PopUp/OptionsPopup.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9eadc1bf151984d48afd7c4fadae0b78
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
62
Assets/Scripts/UI/Pages/PopUp/PvAIModePopup.cs
Normal file
62
Assets/Scripts/UI/Pages/PopUp/PvAIModePopup.cs
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
using TMPro;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class PvAIModePopup : PopupBase
|
||||||
|
{
|
||||||
|
[Header("Buttons")]
|
||||||
|
[SerializeField] private Button twoPlayerBtn;
|
||||||
|
[SerializeField] private Button threePlayerBtn;
|
||||||
|
[SerializeField] private Button fourPlayerBtn;
|
||||||
|
[SerializeField] private Button playBtn;
|
||||||
|
[SerializeField] private Button closeBtn;
|
||||||
|
|
||||||
|
[Header("Input Field")]
|
||||||
|
[SerializeField] private TMP_InputField playerNameInput;
|
||||||
|
|
||||||
|
|
||||||
|
[Header("Player Names")]
|
||||||
|
private string playerName;
|
||||||
|
|
||||||
|
private ScreenManager screenManager;
|
||||||
|
private int selectedPlayerCount;
|
||||||
|
public int SelectedPlayerCount => selectedPlayerCount;
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
twoPlayerBtn.onClick.AddListener(() => OnPlayerCountSelected(2));
|
||||||
|
threePlayerBtn.onClick.AddListener(() => OnPlayerCountSelected(3));
|
||||||
|
fourPlayerBtn.onClick.AddListener(() => OnPlayerCountSelected(4));
|
||||||
|
playBtn.onClick.AddListener(OnClick_playBtn);
|
||||||
|
closeBtn.onClick.AddListener(OnClick_closeBtn);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
twoPlayerBtn.onClick.RemoveAllListeners();
|
||||||
|
threePlayerBtn.onClick.RemoveAllListeners();
|
||||||
|
fourPlayerBtn.onClick.RemoveAllListeners();
|
||||||
|
playBtn.onClick.RemoveAllListeners();
|
||||||
|
closeBtn.onClick.RemoveAllListeners();
|
||||||
|
}
|
||||||
|
private void OnPlayerCountSelected(int count)
|
||||||
|
{
|
||||||
|
selectedPlayerCount = count;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnClick_playBtn()
|
||||||
|
{
|
||||||
|
playerName = playerNameInput.text;
|
||||||
|
|
||||||
|
Debug.Log($"Starting PVP Mode with {selectedPlayerCount} players:");
|
||||||
|
Debug.Log($"Player 1: {playerName}");
|
||||||
|
|
||||||
|
}
|
||||||
|
private void OnClick_closeBtn()
|
||||||
|
{
|
||||||
|
screenManager = screenManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<ScreenManager>() : screenManager;
|
||||||
|
screenManager.ShowScreen(ScreenType.MenuHUDScreen);
|
||||||
|
|
||||||
|
Hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/UI/Pages/PopUp/PvAIModePopup.cs.meta
Normal file
11
Assets/Scripts/UI/Pages/PopUp/PvAIModePopup.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c3712f2a7228f4609af05e3a56d1f98f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -1,35 +1,75 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
public class MenuHUDScreen : ScreenBase
|
public class MenuHUDScreen : ScreenBase
|
||||||
{
|
{
|
||||||
[Header("Buttons")]
|
[Header("Mode Buttons")]
|
||||||
[SerializeField] private Button pvpModeBtn;
|
[SerializeField] private Button pvpModeBtn;
|
||||||
[SerializeField] private Button pvaiModeBtn;
|
[SerializeField] private Button pvaiModeBtn;
|
||||||
|
|
||||||
|
[Header("Popups")]
|
||||||
|
[SerializeField] private Button optionsBtn;
|
||||||
|
[SerializeField] private Button instructionsBtn;
|
||||||
|
[SerializeField] private Button exitBtn;
|
||||||
|
|
||||||
private PopupManager popupManager;
|
private PopupManager popupManager;
|
||||||
private ScreenManager screenManager;
|
private ScreenManager screenManager;
|
||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
pvpModeBtn.onClick.AddListener(OnClick_pvpModeBtn);
|
pvpModeBtn.onClick.AddListener(OnClick_pvpModeBtn);
|
||||||
|
pvaiModeBtn.onClick.AddListener(OnClick_pvaiModeBtn);
|
||||||
|
optionsBtn.onClick.AddListener(OnClick_optionsBtn);
|
||||||
|
instructionsBtn.onClick.AddListener(OnClick_instructionsBtn);
|
||||||
|
exitBtn.onClick.AddListener(OnClick_exitBtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDisable()
|
private void OnDisable()
|
||||||
{
|
{
|
||||||
pvpModeBtn.onClick.RemoveListener(OnClick_pvpModeBtn);
|
pvpModeBtn.onClick.RemoveListener(OnClick_pvpModeBtn);
|
||||||
|
pvaiModeBtn.onClick.RemoveListener(OnClick_pvaiModeBtn);
|
||||||
|
optionsBtn.onClick.RemoveListener(OnClick_optionsBtn);
|
||||||
|
instructionsBtn.onClick.RemoveListener(OnClick_instructionsBtn);
|
||||||
|
exitBtn.onClick.RemoveListener(OnClick_exitBtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnClick_pvpModeBtn()
|
private void OnClick_pvpModeBtn()
|
||||||
{
|
{
|
||||||
popupManager = popupManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<PopupManager>() : popupManager;
|
popupManager = popupManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<PopupManager>() : popupManager;
|
||||||
popupManager.ShowPopup(PopupType.PVPModePopup);
|
popupManager.ShowPopup(PopupType.PvPModePopup);
|
||||||
|
|
||||||
Hide();
|
Hide();
|
||||||
// screenManager = screenManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<ScreenManager>() : screenManager;
|
// screenManager = screenManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<ScreenManager>() : screenManager;
|
||||||
// screenManager.HideScreen(ScreenType.MenuHUDScreen);
|
// screenManager.HideScreen(ScreenType.MenuHUDScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnClick_pvaiModeBtn()
|
||||||
|
{
|
||||||
|
popupManager = popupManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<PopupManager>() : popupManager;
|
||||||
|
popupManager.ShowPopup(PopupType.PvAIModePopup);
|
||||||
|
|
||||||
|
Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnClick_optionsBtn()
|
||||||
|
{
|
||||||
|
popupManager = popupManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<PopupManager>() : popupManager;
|
||||||
|
popupManager.ShowPopup(PopupType.OptionsPopup);
|
||||||
|
|
||||||
|
Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnClick_instructionsBtn()
|
||||||
|
{
|
||||||
|
popupManager = popupManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<PopupManager>() : popupManager;
|
||||||
|
popupManager.ShowPopup(PopupType.InstructionsPopup);
|
||||||
|
|
||||||
|
Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnClick_exitBtn()
|
||||||
|
{
|
||||||
|
Application.Quit();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,13 +2,14 @@ using TMPro;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
public class PVPModePopup : PopupBase
|
public class PvPModePopup : PopupBase
|
||||||
{
|
{
|
||||||
[Header("Buttons")]
|
[Header("Buttons")]
|
||||||
[SerializeField] private Button twoPlayerBtn;
|
[SerializeField] private Button twoPlayerBtn;
|
||||||
[SerializeField] private Button threePlayerBtn;
|
[SerializeField] private Button threePlayerBtn;
|
||||||
[SerializeField] private Button fourPlayerBtn;
|
[SerializeField] private Button fourPlayerBtn;
|
||||||
[SerializeField] private Button playBtn;
|
[SerializeField] private Button playBtn;
|
||||||
|
[SerializeField] private Button closeBtn;
|
||||||
|
|
||||||
[Header("Input Field")]
|
[Header("Input Field")]
|
||||||
[SerializeField] private TMP_InputField playerOneNameInput;
|
[SerializeField] private TMP_InputField playerOneNameInput;
|
||||||
@ -22,6 +23,7 @@ public class PVPModePopup : PopupBase
|
|||||||
private string playerThreeName;
|
private string playerThreeName;
|
||||||
private string playerFourName;
|
private string playerFourName;
|
||||||
|
|
||||||
|
private ScreenManager screenManager;
|
||||||
private int selectedPlayerCount;
|
private int selectedPlayerCount;
|
||||||
public int SelectedPlayerCount => selectedPlayerCount;
|
public int SelectedPlayerCount => selectedPlayerCount;
|
||||||
|
|
||||||
@ -30,7 +32,8 @@ public class PVPModePopup : PopupBase
|
|||||||
twoPlayerBtn.onClick.AddListener(() => OnPlayerCountSelected(2));
|
twoPlayerBtn.onClick.AddListener(() => OnPlayerCountSelected(2));
|
||||||
threePlayerBtn.onClick.AddListener(() => OnPlayerCountSelected(3));
|
threePlayerBtn.onClick.AddListener(() => OnPlayerCountSelected(3));
|
||||||
fourPlayerBtn.onClick.AddListener(() => OnPlayerCountSelected(4));
|
fourPlayerBtn.onClick.AddListener(() => OnPlayerCountSelected(4));
|
||||||
playBtn.onClick.AddListener(OnPlayButtonClicked);
|
playBtn.onClick.AddListener(OnClick_playBtn);
|
||||||
|
closeBtn.onClick.AddListener(OnClick_closeBtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDisable()
|
private void OnDisable()
|
||||||
@ -39,6 +42,7 @@ public class PVPModePopup : PopupBase
|
|||||||
threePlayerBtn.onClick.RemoveAllListeners();
|
threePlayerBtn.onClick.RemoveAllListeners();
|
||||||
fourPlayerBtn.onClick.RemoveAllListeners();
|
fourPlayerBtn.onClick.RemoveAllListeners();
|
||||||
playBtn.onClick.RemoveAllListeners();
|
playBtn.onClick.RemoveAllListeners();
|
||||||
|
closeBtn.onClick.RemoveAllListeners();
|
||||||
}
|
}
|
||||||
private void OnPlayerCountSelected(int count)
|
private void OnPlayerCountSelected(int count)
|
||||||
{
|
{
|
||||||
@ -48,13 +52,13 @@ public class PVPModePopup : PopupBase
|
|||||||
|
|
||||||
private void UpdateInputFieldsVisibility()
|
private void UpdateInputFieldsVisibility()
|
||||||
{
|
{
|
||||||
playerOneNameInput.gameObject.SetActive(true);
|
playerOneNameInput.transform.parent.gameObject.SetActive(true);
|
||||||
playerTwoNameInput.gameObject.SetActive(selectedPlayerCount >= 2);
|
playerTwoNameInput.transform.parent.gameObject.SetActive(selectedPlayerCount >= 2);
|
||||||
playerThreeNameInput.gameObject.SetActive(selectedPlayerCount >= 3);
|
playerThreeNameInput.transform.parent.gameObject.SetActive(selectedPlayerCount >= 3);
|
||||||
playerFourNameInput.gameObject.SetActive(selectedPlayerCount >= 4);
|
playerFourNameInput.transform.parent.gameObject.SetActive(selectedPlayerCount >= 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPlayButtonClicked()
|
private void OnClick_playBtn()
|
||||||
{
|
{
|
||||||
playerOneName = playerOneNameInput.text;
|
playerOneName = playerOneNameInput.text;
|
||||||
playerTwoName = playerTwoNameInput.text;
|
playerTwoName = playerTwoNameInput.text;
|
||||||
@ -70,4 +74,12 @@ public class PVPModePopup : PopupBase
|
|||||||
Debug.Log($"Player 4: {playerFourName}");
|
Debug.Log($"Player 4: {playerFourName}");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnClick_closeBtn()
|
||||||
|
{
|
||||||
|
screenManager = screenManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<ScreenManager>() : screenManager;
|
||||||
|
screenManager.ShowScreen(ScreenType.MenuHUDScreen);
|
||||||
|
|
||||||
|
Hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"com.unity.2d.sprite": "1.0.0",
|
||||||
"com.unity.collab-proxy": "2.5.2",
|
"com.unity.collab-proxy": "2.5.2",
|
||||||
"com.unity.feature.development": "1.0.1",
|
"com.unity.feature.development": "1.0.1",
|
||||||
"com.unity.ide.rider": "3.0.31",
|
"com.unity.ide.rider": "3.0.31",
|
||||||
|
|||||||
@ -1,5 +1,11 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"com.unity.2d.sprite": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"depth": 0,
|
||||||
|
"source": "builtin",
|
||||||
|
"dependencies": {}
|
||||||
|
},
|
||||||
"com.unity.collab-proxy": {
|
"com.unity.collab-proxy": {
|
||||||
"version": "2.5.2",
|
"version": "2.5.2",
|
||||||
"depth": 0,
|
"depth": 0,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user