Beispiel #1
0
 void OnCancel()
 {
     UIController.AskYesNoQ("Are u sure u want to discard the room?",
                            () => // yes answer
     {
         UIController.GoFrom_To(UIController.genericYesNoModal, UIController.LobbyPanel);
         LobbyManager.RemoveRoom(LobbyManager.currentRoom.ID);
         this.gameObject.SetActive(false);
     },
                            () => // no answer
     {
         UIController.CloseYesNoQ();
     });
 }
Beispiel #2
0
    new void OnEnable()
    {
        base.OnEnable();
        UIController.currentPanel = this.gameObject;

        UIController.IfClick_GoTo(UIController.backButton,
                                  () =>
        {
            UIController.AskYesNoQ("Are u sure u want to discard the room?",
                                   () => // yes answer
            {
                UIController.GoFrom_To(UIController.genericYesNoModal, UIController.LobbyPanel);
                UIController.Disable_EnableUI(this.gameObject);
                LobbyManager.RemoveRoom(LobbyManager.currentRoom.ID);
            },
                                   () => // no answer
            {
                UIController.GoFrom_To(UIController.genericYesNoModal, UIController.RoomPanel);
            });
        });

        // #revision: read all the on-server data to keep UI in sync.
        SetObjectives(1, 20);
        roomName.text = LobbyManager.currentRoom.roomName;
        UIController.GetItemInDropDown(gameMode, UIController.ReturnGameMode(LobbyManager.currentRoom.gameMode));
        UIController.GetItemInDropDown(playerMode, UIController.ReturnPlayerMode(LobbyManager.currentRoom.playerMode));
        UIController.GetItemInDropDown(map, UIController.ReturnMap(LobbyManager.currentRoom.map));
        UIController.GetItemInDropDown(objectives, UIController.ReturnGameObjectives(LobbyManager.currentRoom.gameMode));
        password.text = LobbyManager.currentRoom.password;
        UIController.GetItemInDropDown(weaponFilter, UIController.ReturnWeaponFilter(WeaponFilter.NONE));
        UIController.GetItemInDropDown(gameTime, V_UIController.T_DEFAULT_TIME);


        // #revision: roomName is not editable any ways, so:
        roomName.interactable = false;
        // Check if player is MasterClient
        if (LobbyManager.isMasterServer)
        {
            start_Join_Ready.GetComponentInChildren <Text>().text = "Start";
        }
        // or he is a normal client
        else
        {
            gameMode.interactable     = false;
            playerMode.interactable   = false;
            map.interactable          = false;
            objectives.interactable   = false;
            password.interactable     = false;
            weaponFilter.interactable = false;
            gameTime.interactable     = false;

            if (LobbyManager.currentRoom != null && LobbyManager.currentRoom.hasAnActiveGame)
            {
                start_Join_Ready.GetComponentInChildren <Text>().text = "Join";
            }
            else
            {
                start_Join_Ready.GetComponentInChildren <Text>().text = "Ready";
            }
        }
    }