private void Update() { if (GameLobby.isClosedGameLooby) { sendInvitationConatiner.SetActive(false); playerVsPlayerContainer.SetActive(false); playerVsComputerContainer.SetActive(false); startGameContainer.SetActive(false); gameLobbyContainer.SetActive(false); signInContainer.SetActive(false); MenuUserContainer.SetActive(false); receiveInvitationContainer.SetActive(false); userUIContainer.SetActive(true); MainMenuContainer.SetActive(true); UIContainer.SetActive(true); GameLobby.isClosedGameLooby = false; } if (isUpdateAvatar && isClosedEditAvatar) { Image avatar = ProfileContainer.transform.Find("[ProfileUser]").Find("AvatarNameContainer").Find("Avatar").Find("Image").GetComponent <Image>(); string nameAvatar = NetworkClient.users[NetworkClient.clientID].avatar; Avatar.DisplayAvatar(avatar, nameAvatar); isUpdateAvatar = false; isClosedEditAvatar = false; } }
public void Start() { invitations = new Dictionary <string, User>(); allInvitationObj = new Dictionary <string, GameObject>(); Avatar = new Avatar(); playerVsPlayerContainer.SetActive(false); playerVsComputerContainer.SetActive(false); startGameContainer.SetActive(false); userUIContainer.SetActive(false); gameLobbyContainer.SetActive(false); MainMenuContainer.SetActive(false); signInContainer.SetActive(true); MenuUserContainer.SetActive(false); isProfileMenuShow = false; isUpdateAvatar = false; isClosedEditAvatar = false; NetworkClient.OnSignInComplete += OnSignInComplete; NetworkClient.OnStateChange += OnStateChange; NetworkClient.OnSignInUpMessage += OnSignInUpMessage; NetworkClient.UpdateUsernameEnd += UpdateUsernameEnd; NetworkClient.UpdatePasswordEnd += UpdatePasswordEnd; NetworkClient.UpdateAvatarEnd += UpdateAvatarEnd; }
void OnEnable() { playerController.IncreaseScore += OnScoreIncrease; playerController.PlayerDead += OnPlayerDead; MainMenuContainer.SetActive(true); newScoreObj.SetActive(false); ScoreBoard.SetActive(false); hudmenu.SetActive(false); Leaderboards.SetActive(false); LeaderboardSubmit.SetActive(false); //on game end scoreboard menu ,if user presses on restart , //we need to disable the mainmenu and changing player to readyto play. if (isRestartPressed) { MainMenuContainer.SetActive(false); isRestartPressed = false; readyToPlay = true; hudmenu.SetActive(true); playerController.currentState = playerController.playerStates.alive; } else { playerController.currentState = playerController.playerStates.idle; } scoreTextMesh.text = "" + 0; }
void OnEnable() { playerController.IncreaseScore += OnScoreIncrease; playerController.PlayerDead += OnPlayerDead; MainMenuContainer.SetActive(true); newScoreObj.SetActive(false); ScoreBoard.SetActive(false); //on game end scoreboard menu ,if user presses on restart , //we need to disable the mainmenu and changing player to readyto play. if (isRestartPressed) { MainMenuContainer.SetActive(false); isRestartPressed = false; readyToPlay = true; } else { playerController.currentState = playerController.playerStates.idle; } #if UNITY_IOS //apple won't like quit button Destroy(QuitButton); #endif //to display messsage to developers #if UNITY_EDITOR assetStoreReviewText.SetActive(true); #else assetStoreReviewText.SetActive(false); #endif }
public void OnSignInComplete() { signInContainer.SetActive(false); MainMenuContainer.SetActive(true); playerVsPlayerContainer.SetActive(false); playerVsComputerContainer.SetActive(false); userUIContainer.SetActive(true); }
public void OnClickPlayerVsComputer() { signInContainer.SetActive(false); MainMenuContainer.SetActive(false); playerVsPlayerContainer.SetActive(false); playerVsComputerContainer.SetActive(true); startGameContainer.SetActive(false); }
public void OnClickMultiplayerLevel2() { currentLevelGame = SceneList.MULTIPLAYER_LEVEL2; signInContainer.SetActive(false); MainMenuContainer.SetActive(false); playerVsPlayerContainer.SetActive(false); playerVsComputerContainer.SetActive(false); startGameContainer.SetActive(true); }
public void OnCreateGame() { SocketReference.Emit("createNewGame", new JSONObject(JsonUtility.ToJson(new CurrentLevelGame(currentLevelGame)))); GameLobby.isCloseInvitation = false; signInContainer.SetActive(false); MainMenuContainer.SetActive(false); playerVsPlayerContainer.SetActive(false); playerVsComputerContainer.SetActive(false); startGameContainer.SetActive(false); }
public void OnClickPlayerVsPlayer() { GameLobby.isClosedGameLooby = false; signInContainer.SetActive(false); MainMenuContainer.SetActive(false); playerVsPlayerContainer.SetActive(true); playerVsComputerContainer.SetActive(false); startGameContainer.SetActive(false); }
public void OnClickLogout() { NetworkClient.users[NetworkClient.clientID].socket.Emit("disconnect"); playerVsPlayerContainer.SetActive(false); playerVsComputerContainer.SetActive(false); startGameContainer.SetActive(false); userUIContainer.SetActive(false); gameLobbyContainer.SetActive(false); MainMenuContainer.SetActive(false); sendInvitationConatiner.SetActive(false); signInContainer.SetActive(true); }
public void OnClickPlayerVsComputerLevel2() { currentLevelGame = SceneList.PLAYER_VS_COMPUTER_LEVEL2; signInContainer.SetActive(false); MainMenuContainer.SetActive(false); playerVsPlayerContainer.SetActive(false); playerVsComputerContainer.SetActive(false); startGameContainer.SetActive(false); UIContainer.SetActive(false); SceneManagementManager.Instance.LoadLevel(SceneList.PLAYER_VS_COMPUTER_LEVEL2, (levelName) => { }); }
private void OnStateChange(SocketIOEvent e, string state, string sendername) { if (state == "") { state = e.data["state"].str; } switch (state) { case LobbyState.LOBBY: startGameContainer.SetActive(false); receiveInvitationContainer.SetActive(false); MainMenuContainer.SetActive(false); sendInvitationConatiner.SetActive(false); gameLobbyContainer.SetActive(true); UIContainer.SetActive(true); break; case LobbyState.UNCONECCTED_USERS: Debug.Log("UNCONECCTED_USERS"); startGameContainer.SetActive(false); receiveInvitationContainer.SetActive(false); MainMenuContainer.SetActive(false); sendInvitationConatiner.SetActive(false); gameLobbyContainer.SetActive(false); UIContainer.SetActive(true); Text txt = sendInvitationConatiner.transform.Find("[Invitation]").Find("Text").GetComponent <Text>(); txt.text = "There is no available players..."; sendInvitationConatiner.SetActive(true); NetworkClient.users[NetworkClient.clientID].socket.Emit("invitationPlayerConnect"); break; case LobbyState.SEND_INVITATION: playerVsPlayerContainer.SetActive(false); playerVsComputerContainer.SetActive(false); startGameContainer.SetActive(false); userUIContainer.SetActive(false); gameLobbyContainer.SetActive(false); MainMenuContainer.SetActive(false); signInContainer.SetActive(false); sendInvitationConatiner.SetActive(true); UIContainer.SetActive(true); Text invitationTxt = sendInvitationConatiner.transform.Find("[Invitation]").Find("Text").GetComponent <Text>(); invitationTxt.text = "Add player to your game"; break; case LobbyState.RECEIVE_INVITATION: receiveInvitationContainer.SetActive(true); UIContainer.SetActive(true); Debug.Log("ReceiveInvitation" + receiveInvitationContainer.name); Text name = receiveInvitationContainer.transform.Find("Message").Find("SenderName").GetComponent <Text>(); Debug.Log("ReceiveInvitation text" + name.name); name.text = sendername.ToString(); Text msg = receiveInvitationContainer.transform.Find("Message").Find("textMessage").GetComponent <Text>(); msg.text = currentLevelGame == SceneList.MULTIPLAYER_LEVEL1? "invited you to multiplayer game level 1": "invited you to multiplayer game level 2"; break; case LobbyState.RESULT_INVITATION: playerVsPlayerContainer.SetActive(false); playerVsComputerContainer.SetActive(false); startGameContainer.SetActive(false); userUIContainer.SetActive(false); gameLobbyContainer.SetActive(false); MainMenuContainer.SetActive(false); signInContainer.SetActive(false); UIContainer.SetActive(true); Text denymsg = sendInvitationConatiner.transform.Find("[Invitation]").Find("Text").GetComponent <Text>(); denymsg.text = userInvitation + " deny your invitation game.."; sendInvitationConatiner.SetActive(true); break; case LobbyState.GAME: UIContainer.SetActive(false); break; case LobbyState.GAME_OVER: UIContainer.SetActive(false); break; default: receiveInvitationContainer.SetActive(false); MainMenuContainer.SetActive(false); gameLobbyContainer.SetActive(false); startGameContainer.SetActive(false); sendInvitationConatiner.SetActive(false); break; } }
void Update() { if (Input.GetKeyDown(KeyCode.Mouse0)) { // Debug.Log(playerController.currentState); Ray R = UICamera.ScreenPointToRay(Input.mousePosition); if (readyToPlay && playerController.currentState == playerController.playerStates.idle) { playerController.currentState = playerController.playerStates.alive; readyToPlay = false; iTween.ScaleTo(Tutorial, iTween.Hash("scale", Vector3.zero, "time", 0.5f, "easetype", iTween.EaseType.linear)); iTween.FadeTo(Tutorial, iTween.Hash("alpha", 0, "time", 0.2f, "easetype", iTween.EaseType.linear)); } if (Physics.Raycast(R, out hit, 100)) { iTween.ScaleTo(hit.collider.gameObject, iTween.Hash("scale", new Vector3(0.45f, 0.45f, 0.45f), "time", 0.5f, "easetype", iTween.EaseType.easeInOutBounce)); SoundController.Static.PlayClickSound(); switch (hit.collider.name) { case "Play": MainMenuContainer.SetActive(false); Tutorial.SetActive(true); readyToPlay = true; break; } } } if (Input.GetKeyUp(KeyCode.Mouse0)) { Ray R = UICamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(R, out hit, 100)) { switch (hit.collider.name) { case "Home": restart(); break; case "DoubleYes": ShowRewardedAd(); break; case "DoubleNo": isRestartPressed = true; restart(); playerController.currentState = playerController.playerStates.idle; break; case "More": Application.OpenURL("https://unity3d.com/services/ads"); break; case "Quit": Application.Quit(); break; } } } //to handle escape key if (Input.GetKeyUp(KeyCode.Escape)) { if (playerController.currentState == playerController.playerStates.idle) { Application.Quit(); } else { restart(); } } }
public void OnButtonClicks(string incomingName) { // Debug.Log ("clicked on " + incomingName); SoundController.Static.PlayClickSound(); switch (incomingName) { case "Play": MainMenuContainer.SetActive(false); Tutorial.SetActive(true); readyToPlay = true; playerController.currentState = playerController.playerStates.alive; hudmenu.SetActive(true); Invoke("lateDeactivateTutorial", 3); break; case "Home": restart(); break; case "Restart": isRestartPressed = true; hudmenu.SetActive(true); restart(); break; case "Setting": Setting.SetActive(true); break; case "BackSetting": Setting.SetActive(false); break; case "Leaderboards": Leaderboards.SetActive(true); break; case "Back": Leaderboards.SetActive(false); break; case "LeaderboardSubmit": LeaderboardSubmit.SetActive(true); break; case "BackSubmit": LeaderboardSubmit.SetActive(false); ScoreBoard.SetActive(true); break; case "LeaderboardEnding": LeaderboardEnding.SetActive(true); break; case "BackLeaderboardEnding": LeaderboardEnding.SetActive(false); break; case "Quit": Application.Quit(); break; } }
void Update() { if (Input.GetKeyDown(KeyCode.Mouse0)) { // Debug.Log(playerController.currentState); Ray R = UICamera.ScreenPointToRay(Input.mousePosition); if (readyToPlay && playerController.currentState == playerController.playerStates.idle) { playerController.currentState = playerController.playerStates.alive; readyToPlay = false; iTween.ScaleTo(Tutorial, iTween.Hash("scale", Vector3.zero, "time", 0.5f, "easetype", iTween.EaseType.linear)); iTween.FadeTo(Tutorial, iTween.Hash("alpha", 0, "time", 0.2f, "easetype", iTween.EaseType.linear)); } if (Physics.Raycast(R, out hit, 100)) { iTween.ScaleTo(hit.collider.gameObject, iTween.Hash("scale", new Vector3(0.45f, 0.45f, 0.45f), "time", 0.5f, "easetype", iTween.EaseType.easeInOutBounce)); SoundController.Static.PlayClickSound(); switch (hit.collider.name) { case "Play": MainMenuContainer.SetActive(false); Tutorial.SetActive(true); readyToPlay = true; break; } } } if (Input.GetKeyUp(KeyCode.Mouse0)) { Ray R = UICamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(R, out hit, 100)) { switch (hit.collider.name) { case "Home": restart(); break; case "Replay": isRestartPressed = true; restart(); playerController.currentState = playerController.playerStates.idle; break; case "Facebook": Application.OpenURL("https://www.facebook.com/AceGamesHyderabad?ref=hl"); break; case "Review": #if UNITY_ANDROID Application.OpenURL("https://www.facebook.com/AceGamesHyderabad?ref=hl"); #endif #if UNITY_IOS Application.OpenURL("https://www.facebook.com/AceGamesHyderabad?ref=hl"); #endif #if UNITY_WEBPLAYER Application.OpenURL("https://www.facebook.com/AceGamesHyderabad?ref=hl"); #endif #if UNITY_EDITOR Application.OpenURL("https://www.facebook.com/AceGamesHyderabad?ref=hl"); #endif break; case "Quit": Application.Quit(); break; } } } //to handle escape key if (Input.GetKeyUp(KeyCode.Escape)) { if (playerController.currentState == playerController.playerStates.idle) { Application.Quit(); } else { restart(); } } }