Added Game Mode UI Prefab with selection updates
- On PVP, Player can now chose color
This commit is contained in:
parent
9af9ac09fb
commit
47880ef652
BIN
Assets/Artifacts/Sprites/Other/freepik__background__18020.png
Normal file
BIN
Assets/Artifacts/Sprites/Other/freepik__background__18020.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 77 KiB |
@ -0,0 +1,147 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 34e3d7c5f315b46f9b3481e3ea797ffe
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 12
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
ignoreMasterTextureLimit: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 0
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
cookieLightType: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: iPhone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Android
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
nameFileIdTable: {}
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
2128
Assets/Prefabs/UI/Player V AI Popup .prefab
Normal file
2128
Assets/Prefabs/UI/Player V AI Popup .prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Prefabs/UI/Player V AI Popup .prefab.meta
Normal file
7
Assets/Prefabs/UI/Player V AI Popup .prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b04f48863fc6c4f75821857086cea347
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
4441
Assets/Prefabs/UI/Player V Player Popup.prefab
Normal file
4441
Assets/Prefabs/UI/Player V Player Popup.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Prefabs/UI/Player V Player Popup.prefab.meta
Normal file
7
Assets/Prefabs/UI/Player V Player Popup.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4fd2ca927610f4ed9a93f6bb3ec71a1d
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
@ -8,6 +9,7 @@ public class PvPModePopup : PopupBase
|
|||||||
[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 switchBtn;
|
||||||
[SerializeField] private Button playBtn;
|
[SerializeField] private Button playBtn;
|
||||||
[SerializeField] private Button closeBtn;
|
[SerializeField] private Button closeBtn;
|
||||||
|
|
||||||
@ -23,32 +25,70 @@ public class PvPModePopup : PopupBase
|
|||||||
private string playerThreeName;
|
private string playerThreeName;
|
||||||
private string playerFourName;
|
private string playerFourName;
|
||||||
|
|
||||||
|
[Header("References")]
|
||||||
|
[SerializeField] private GameObject playerNameInputParent1;
|
||||||
|
[SerializeField] private GameObject playerNameInputParent2;
|
||||||
|
|
||||||
|
[Header("Placeholders")]
|
||||||
|
[SerializeField] private TMP_Text playerOnePlaceholder;
|
||||||
|
[SerializeField] private TMP_Text playerTwoPlaceholder;
|
||||||
|
[SerializeField] private TMP_Text playerThreePlaceholder;
|
||||||
|
[SerializeField] private TMP_Text playerFourPlaceholder;
|
||||||
|
|
||||||
private ScreenManager screenManager;
|
private ScreenManager screenManager;
|
||||||
private GameManager gameManager;
|
private GameManager gameManager;
|
||||||
private SoundManager soundManager;
|
private SoundManager soundManager;
|
||||||
private int selectedPlayerCount;
|
private int selectedPlayerCount;
|
||||||
public int SelectedPlayerCount => selectedPlayerCount;
|
public int SelectedPlayerCount => selectedPlayerCount;
|
||||||
|
|
||||||
|
[Header("Horizontal Rows (P1–P4)")]
|
||||||
|
public List<GameObject> rows;
|
||||||
|
private int hiddenIndex = 0;
|
||||||
|
|
||||||
|
Dictionary<PlayerType, string> playerNameMap = new();
|
||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
twoPlayerBtn.onClick.AddListener(() => OnPlayerCountSelected(2));
|
twoPlayerBtn.onClick.AddListener(OnClick_TwoPlayerBtn);
|
||||||
threePlayerBtn.onClick.AddListener(() => OnPlayerCountSelected(3));
|
threePlayerBtn.onClick.AddListener(OnClick_ThreePlayerBtn);
|
||||||
fourPlayerBtn.onClick.AddListener(() => OnPlayerCountSelected(4));
|
fourPlayerBtn.onClick.AddListener(OnClick_FourPlayerBtn);
|
||||||
playBtn.onClick.AddListener(OnClick_playBtn);
|
playBtn.onClick.AddListener(OnClick_PlayBtn);
|
||||||
closeBtn.onClick.AddListener(OnClick_closeBtn);
|
closeBtn.onClick.AddListener(OnClick_CloseBtn);
|
||||||
|
switchBtn.onClick.AddListener(OnClick_SwitchBtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDisable()
|
private void OnDisable()
|
||||||
{
|
{
|
||||||
twoPlayerBtn.onClick.RemoveAllListeners();
|
twoPlayerBtn.onClick.RemoveListener(OnClick_TwoPlayerBtn);
|
||||||
threePlayerBtn.onClick.RemoveAllListeners();
|
threePlayerBtn.onClick.RemoveListener(OnClick_ThreePlayerBtn);
|
||||||
fourPlayerBtn.onClick.RemoveAllListeners();
|
fourPlayerBtn.onClick.RemoveAllListeners();
|
||||||
playBtn.onClick.RemoveAllListeners();
|
playBtn.onClick.RemoveListener(OnClick_PlayBtn);
|
||||||
closeBtn.onClick.RemoveAllListeners();
|
closeBtn.onClick.RemoveListener(OnClick_CloseBtn);
|
||||||
|
switchBtn.onClick.RemoveListener(OnClick_SwitchBtn);
|
||||||
}
|
}
|
||||||
private void OnPlayerCountSelected(int count)
|
|
||||||
|
private void OnClick_TwoPlayerBtn()
|
||||||
{
|
{
|
||||||
selectedPlayerCount = count;
|
switchBtn.gameObject.SetActive(true);
|
||||||
|
selectedPlayerCount = 2;
|
||||||
|
playerNameInputParent2.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnClick_ThreePlayerBtn()
|
||||||
|
{
|
||||||
|
switchBtn.gameObject.SetActive(true);
|
||||||
|
selectedPlayerCount = 3;
|
||||||
|
playerNameInputParent1.SetActive(true);
|
||||||
|
playerNameInputParent2.SetActive(true);
|
||||||
|
UpdateInputFieldsVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnClick_FourPlayerBtn()
|
||||||
|
{
|
||||||
|
switchBtn.gameObject.SetActive(false);
|
||||||
|
selectedPlayerCount = 4;
|
||||||
|
playerNameInputParent1.SetActive(true);
|
||||||
|
playerNameInputParent2.SetActive(true);
|
||||||
UpdateInputFieldsVisibility();
|
UpdateInputFieldsVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,12 +100,37 @@ public class PvPModePopup : PopupBase
|
|||||||
playerFourNameInput.transform.parent.gameObject.SetActive(selectedPlayerCount >= 4);
|
playerFourNameInput.transform.parent.gameObject.SetActive(selectedPlayerCount >= 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnClick_playBtn()
|
private void OnClick_PlayBtn()
|
||||||
{
|
{
|
||||||
playerOneName = string.IsNullOrWhiteSpace(playerOneNameInput.text) ? Ludo_3D_Constants.Player1_Name : playerOneNameInput.text;
|
int logicalIndex = 0;
|
||||||
playerTwoName = string.IsNullOrWhiteSpace(playerTwoNameInput.text) ? Ludo_3D_Constants.Player1_Name : playerTwoNameInput.text;
|
|
||||||
playerThreeName = string.IsNullOrWhiteSpace(playerThreeNameInput.text) ? Ludo_3D_Constants.Player1_Name : playerThreeNameInput.text;
|
foreach (GameObject row in rows)
|
||||||
playerFourName = string.IsNullOrWhiteSpace(playerFourNameInput.text) ? Ludo_3D_Constants.Player1_Name : playerFourNameInput.text;
|
{
|
||||||
|
if (!row.activeSelf)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
TMP_InputField input = row.GetComponentInChildren<TMP_InputField>();
|
||||||
|
|
||||||
|
PlayerType playerType = (PlayerType)logicalIndex;
|
||||||
|
|
||||||
|
string playerName = string.IsNullOrWhiteSpace(input.text)
|
||||||
|
? playerType.ToString()
|
||||||
|
: input.text;
|
||||||
|
|
||||||
|
playerNameMap[playerType] = playerName;
|
||||||
|
logicalIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// playerOneName = string.IsNullOrWhiteSpace(playerOneNameInput.text) ? Ludo_3D_Constants.Player1_Name : playerOneNameInput.text;
|
||||||
|
// playerTwoName = string.IsNullOrWhiteSpace(playerTwoNameInput.text) ? Ludo_3D_Constants.Player1_Name : playerTwoNameInput.text;
|
||||||
|
// playerThreeName = string.IsNullOrWhiteSpace(playerThreeNameInput.text) ? Ludo_3D_Constants.Player1_Name : playerThreeNameInput.text;
|
||||||
|
// playerFourName = string.IsNullOrWhiteSpace(playerFourNameInput.text) ? Ludo_3D_Constants.Player1_Name : playerFourNameInput.text;
|
||||||
|
|
||||||
|
playerOneName = playerNameMap.GetValueOrDefault(PlayerType.Player1, Ludo_3D_Constants.Player1_Name);
|
||||||
|
playerTwoName = playerNameMap.GetValueOrDefault(PlayerType.Player2, Ludo_3D_Constants.Player2_Name);
|
||||||
|
playerThreeName = playerNameMap.GetValueOrDefault(PlayerType.Player3, Ludo_3D_Constants.Player3_Name);
|
||||||
|
playerFourName = playerNameMap.GetValueOrDefault(PlayerType.Player4, Ludo_3D_Constants.Player4_Name);
|
||||||
|
|
||||||
|
|
||||||
soundManager = soundManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<SoundManager>() : soundManager;
|
soundManager = soundManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<SoundManager>() : soundManager;
|
||||||
soundManager?.PlayGameSoundClip(SoundType.ButtonClick);
|
soundManager?.PlayGameSoundClip(SoundType.ButtonClick);
|
||||||
@ -80,7 +145,57 @@ public class PvPModePopup : PopupBase
|
|||||||
Debug.Log($"Player 4: {playerFourName}");
|
Debug.Log($"Player 4: {playerFourName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnClick_closeBtn()
|
private void OnClick_SwitchBtn()
|
||||||
|
{
|
||||||
|
if (SelectedPlayerCount == 2)
|
||||||
|
{
|
||||||
|
if (playerNameInputParent1.activeSelf)
|
||||||
|
{
|
||||||
|
playerNameInputParent1.SetActive(false);
|
||||||
|
playerNameInputParent2.SetActive(true);
|
||||||
|
playerOnePlaceholder.text = "Player 1";
|
||||||
|
playerThreePlaceholder.text = "Player 2";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
playerNameInputParent1.SetActive(true);
|
||||||
|
playerNameInputParent2.SetActive(false);
|
||||||
|
playerTwoPlaceholder.text = "Player 1";
|
||||||
|
playerFourPlaceholder.text = "Player 2";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (SelectedPlayerCount == 3)
|
||||||
|
{
|
||||||
|
hiddenIndex = (hiddenIndex + 1) % rows.Count;
|
||||||
|
UpdateRows();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateRows()
|
||||||
|
{
|
||||||
|
int visiblePlayerIndex = 1;
|
||||||
|
|
||||||
|
for (int i = 0; i < rows.Count; i++)
|
||||||
|
{
|
||||||
|
bool isHidden = (i == hiddenIndex);
|
||||||
|
rows[i].SetActive(!isHidden);
|
||||||
|
|
||||||
|
if (!isHidden)
|
||||||
|
{
|
||||||
|
TMP_InputField input =
|
||||||
|
rows[i].GetComponentInChildren<TMP_InputField>();
|
||||||
|
|
||||||
|
TMP_Text placeholder = input.placeholder as TMP_Text;
|
||||||
|
if (placeholder != null)
|
||||||
|
{
|
||||||
|
placeholder.text = $"Player {visiblePlayerIndex}";
|
||||||
|
visiblePlayerIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnClick_CloseBtn()
|
||||||
{
|
{
|
||||||
screenManager = screenManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<ScreenManager>() : screenManager;
|
screenManager = screenManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<ScreenManager>() : screenManager;
|
||||||
screenManager.ShowScreen(ScreenType.MenuScreen);
|
screenManager.ShowScreen(ScreenType.MenuScreen);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user