Compare commits

..

10 Commits

Author SHA1 Message Date
45699adcc8 Added additional safe tile logic. 2026-01-30 13:54:19 +05:30
f7c2f4c612 Merge remote-tracking branch 'origin/Gameplay/main-gameplay' into Gameplay/siva-gameplay 2026-01-30 13:33:07 +05:30
9eef3eb04c Merge branch 'Gameplay/ashby-gameplay' into Gameplay/main-gameplay
# Conflicts:
#	Assets/External-Assets/packages/Project/Scripts/Gameplay/Snake and Ladder/DiceView.cs
#	Assets/Scripts/Gameplay/GameplayManager.cs
#	Assets/Scripts/Input/DiceRollHandler.cs
2026-01-30 12:57:17 +05:30
14d4a562a4 New dice logic + fixes. 2026-01-30 12:54:43 +05:30
c42db86e28 Merge remote-tracking branch 'origin/Gameplay/main-gameplay' into Gameplay/siva-gameplay 2026-01-30 11:36:37 +05:30
253b5affc3 Merge branch 'UI/ashby-ui' into UI/main-ui
# Conflicts:
#	Assets/Scripts/UI/Pages/PopUp/PvPModePopup.cs
2026-01-30 11:32:51 +05:30
47880ef652 Added Game Mode UI Prefab with selection updates
- On PVP, Player can now chose color
2026-01-30 11:08:44 +05:30
224c29f19d Merge remote-tracking branch 'origin/Gameplay/main-gameplay' into Gameplay/siva-gameplay 2026-01-29 22:18:02 +05:30
d2cfc4ad4a Merge remote-tracking branch 'origin/Gameplay/main-gameplay' into Gameplay/siva-gameplay 2026-01-29 21:37:32 +05:30
78fce93bec Added Game Icon 2026-01-29 21:21:05 +05:30
15 changed files with 7827 additions and 173 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

View File

@ -0,0 +1,147 @@
fileFormatVersion: 2
guid: f6f7cf722ebaa46bdab456d7c3009064
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: Android
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
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:

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

View File

@ -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:

View File

@ -25,10 +25,11 @@ public class DiceView : MonoBehaviour, IBase
transform.localPosition = new Vector3(0, 20, 0); transform.localPosition = new Vector3(0, 20, 0);
} }
public void Roll(Action<int> onComplete) public void Roll(Action<int> onComplete, bool isBot)
{ {
if (!rolling) if (!rolling)
{ {
Debug.Log($"isBot: {isBot}");
onRollingComplete = onComplete; onRollingComplete = onComplete;
StartCoroutine(RollRoutine()); StartCoroutine(RollRoutine());
} }
@ -96,5 +97,12 @@ public class DiceView : MonoBehaviour, IBase
rb.angularVelocity = Vector3.zero; rb.angularVelocity = Vector3.zero;
transform.localPosition = new Vector3(0, 20, 0); transform.localPosition = new Vector3(0, 20, 0);
rolling = false; rolling = false;
Invoke(nameof(ResetEvent), 0.5f);
}
private void ResetEvent()
{
onRollingComplete = null;
} }
} }

View File

@ -111,15 +111,15 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 5da822beb0d884a49a6333925f5142a8, type: 3} - target: {fileID: -8679921383154817045, guid: 5da822beb0d884a49a6333925f5142a8, type: 3}
propertyPath: m_LocalScale.x propertyPath: m_LocalScale.x
value: 0.14 value: 0.2
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 5da822beb0d884a49a6333925f5142a8, type: 3} - target: {fileID: -8679921383154817045, guid: 5da822beb0d884a49a6333925f5142a8, type: 3}
propertyPath: m_LocalScale.y propertyPath: m_LocalScale.y
value: 0.14 value: 0.2
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 5da822beb0d884a49a6333925f5142a8, type: 3} - target: {fileID: -8679921383154817045, guid: 5da822beb0d884a49a6333925f5142a8, type: 3}
propertyPath: m_LocalScale.z propertyPath: m_LocalScale.z
value: 0.14 value: 0.2
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 5da822beb0d884a49a6333925f5142a8, type: 3} - target: {fileID: -8679921383154817045, guid: 5da822beb0d884a49a6333925f5142a8, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b04f48863fc6c4f75821857086cea347
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4fd2ca927610f4ed9a93f6bb3ec71a1d
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -96,8 +96,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
{ {
tilesManager = InterfaceManager.Instance.GetInterfaceInstance<TilesManager>(); tilesManager = InterfaceManager.Instance.GetInterfaceInstance<TilesManager>();
CanRollDiceForUser = true;
InitPlayerTypesForBotMatch(PlayerType.Player1, 3); InitPlayerTypesForBotMatch(PlayerType.Player1, 3);
} }
@ -109,6 +107,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
playerBaseHandler.InitPlayerTypes(allPlayerTypes); playerBaseHandler.InitPlayerTypes(allPlayerTypes);
InitCurrentGamePlayerInfo(); InitCurrentGamePlayerInfo();
SetCanRollDiceForUser(true);
} }
public void InitPlayerTypesForBotMatch(PlayerType selectedPlayerType, int botCount) public void InitPlayerTypesForBotMatch(PlayerType selectedPlayerType, int botCount)
@ -124,6 +124,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
InitCurrentGamePlayerInfo(); InitCurrentGamePlayerInfo();
InitBotRuntimeData(); InitBotRuntimeData();
AssignPlayerAndBotStates(selectedPlayerType); AssignPlayerAndBotStates(selectedPlayerType);
SetCanRollDiceForUser(!botTypesInGame.Contains(selectedPlayerType));
} }
private void InitBotRuntimeData() private void InitBotRuntimeData()
@ -244,7 +246,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
{ {
Debug.Log($"Switching player"); Debug.Log($"Switching player");
SwitchPlayer(); SwitchPlayer();
SetCanRollDiceForUser(true);
} }
} }
@ -276,7 +277,11 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
// What happens when you get a 6 // What happens when you get a 6
private void SelectPawnFromBotBase() private void SelectPawnFromBotBase()
{ {
if (canSwitchPlayer || availPlayers.Count() < 1 && !CanRollDiceAgain || !botTypesInGame.Contains(currentPlayerTypeTurn)) return; // Have a better check here if (canSwitchPlayer || availPlayers.Count() < 1 && !CanRollDiceAgain || !botTypesInGame.Contains(currentPlayerTypeTurn))
{
Debug.Log($"returning from SelectPawnFromBotBase");
return; // Have a better check here
}
Debug.Log($"CallTest: SelectPawnFromBotBase: {currentPlayerTypeTurn}"); Debug.Log($"CallTest: SelectPawnFromBotBase: {currentPlayerTypeTurn}");
var botPawnsDictForCurrentPlayer = botRuntimeMovementData[currentPlayerTypeTurn]; // set the data inside this dict var botPawnsDictForCurrentPlayer = botRuntimeMovementData[currentPlayerTypeTurn]; // set the data inside this dict
@ -452,7 +457,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
Debug.Log($"### AreAllPawnsInFinishingPath"); Debug.Log($"### AreAllPawnsInFinishingPath");
if (AreAllPawnsInFinishingPath()) if (AreAllPawnsInFinishingPath())
{ {
SetCanRollDiceForUser(true); SetCanRollDiceForUser(!botTypesInGame.Contains(currentPlayerTypeTurn));
return; return;
} }
@ -800,10 +805,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
} }
SwitchPlayer(playerPawn); SwitchPlayer(playerPawn);
if (!CanRollDiceAgain)
{
SetCanRollDiceForUser(true);
}
} }
}, },
index); index);
@ -925,20 +926,19 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
CanRollDiceAgain = true; CanRollDiceAgain = true;
if (playerPawn.IsBotPlayer) if (playerPawn.IsBotPlayer)
CheckDiceRollForBot(playerPawn); CheckDiceRollForBot(playerPawn);
else
SetCanRollDiceForUser(true);
} }
} }
else else
{ {
if (CheckForMaxDiceRollAttempt()) if (CheckForMaxDiceRollAttempt())
{ {
SetCanRollDiceForUser(true);
return; return;
} }
SwitchPlayer(); SwitchPlayer();
} }
SetCanRollDiceForUser(true);
} }
}, },
index); index);
@ -946,8 +946,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
private void SetCanRollDiceForUser(bool state) private void SetCanRollDiceForUser(bool state)
{ {
// if (botTypesInGame.Contains(playerType)) return;
CanRollDiceForUser = state; CanRollDiceForUser = state;
Debug.Log($"CAnRollDiceForUser: {CanRollDiceForUser}");
} }
} }

View File

@ -34,11 +34,11 @@ public class DiceRollHandler : MonoBehaviour
{ {
if (!inputManager.GameplayManager.CanRollDiceForUser) return; if (!inputManager.GameplayManager.CanRollDiceForUser) return;
diceView.Roll(onComplete: (rolledVal) => OnUserDiceRollComplete(rolledVal)); diceView.Roll(onComplete: (rolledVal) => OnUserDiceRollComplete(rolledVal), false);
} }
public void HandleDiceViewForBot(Action<int> onComplete) public void HandleDiceViewForBot(Action<int> onComplete)
{ {
diceView.Roll(onComplete: onComplete); diceView.Roll(onComplete: (val) => onComplete?.Invoke(val), true);
} }
} }

View File

@ -9,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;
@ -24,6 +25,16 @@ 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 SoundManager soundManager; private SoundManager soundManager;
private GameModeHandler gameModeHandler; private GameModeHandler gameModeHandler;
@ -31,26 +42,54 @@ public class PvPModePopup : PopupBase
private int selectedPlayerCount; private int selectedPlayerCount;
public int SelectedPlayerCount => selectedPlayerCount; public int SelectedPlayerCount => selectedPlayerCount;
[Header("Horizontal Rows (P1P4)")]
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();
} }
@ -62,12 +101,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.Player2_Name : playerTwoNameInput.text;
playerThreeName = string.IsNullOrWhiteSpace(playerThreeNameInput.text) ? Ludo_3D_Constants.Player3_Name : playerThreeNameInput.text; foreach (GameObject row in rows)
playerFourName = string.IsNullOrWhiteSpace(playerFourNameInput.text) ? Ludo_3D_Constants.Player4_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);
@ -105,7 +169,57 @@ public class PvPModePopup : PopupBase
gameModeHandler.InitPVPModeData(playerTypes); gameModeHandler.InitPVPModeData(playerTypes);
} }
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);

View File

@ -157,7 +157,9 @@ PlayerSettings:
resetResolutionOnWindowResize: 0 resetResolutionOnWindowResize: 0
androidSupportedAspectRatio: 1 androidSupportedAspectRatio: 1
androidMaxAspectRatio: 2.1 androidMaxAspectRatio: 2.1
applicationIdentifier: {} applicationIdentifier:
Android: com.DefaultCompany.Ludo3D
Standalone: com.DefaultCompany.Ludo-3D
buildNumber: buildNumber:
Standalone: 0 Standalone: 0
iPhone: 0 iPhone: 0
@ -271,7 +273,14 @@ PlayerSettings:
AndroidMinifyDebug: 0 AndroidMinifyDebug: 0
AndroidValidateAppBundleSize: 1 AndroidValidateAppBundleSize: 1
AndroidAppBundleSizeToValidate: 150 AndroidAppBundleSizeToValidate: 150
m_BuildTargetIcons: [] m_BuildTargetIcons:
- m_BuildTarget:
m_Icons:
- serializedVersion: 2
m_Icon: {fileID: 2800000, guid: f6f7cf722ebaa46bdab456d7c3009064, type: 3}
m_Width: 128
m_Height: 128
m_Kind: 0
m_BuildTargetPlatformIcons: m_BuildTargetPlatformIcons:
- m_BuildTarget: iPhone - m_BuildTarget: iPhone
m_Icons: m_Icons: