Exemplo n.º 1
0
    void OnUserLeaved(int userIndex, int userCode)
    {
        userIndex = GameUserList.IndexOf(userCode);
        connectedUser[userIndex] = false;
        GameUserList [userIndex] = -1;
        roomMasterCode           = -1;

        foreach (int code in GameUserList)
        {
            if (code != -1)
            {
                roomMasterCode = code;
                break;
            }
        }

        if (roomMasterCode == -1)        // All Disconnected
        {
            hostController.SendEndGame();
            //TODO popup
            //PopupManager_RaS.Instance.OpenPopup(POPUP_TYPE_RaS.POPUP_GAMESCLOSE);
            // Application.Quit();
        }

        int charType = selectedPlayerCharacter [userIndex];

        selectedPlayerCharacter[userIndex] = (int)CHARACTER_TYPE.CHARACTER_DISCONNECTED;

        totalScore[userIndex] = 0;
        for (int i = 0; i < itemScore.GetLength(1); i++)
        {
            itemScore[userIndex, i] = 0;
        }

        if (InGameUserCount() == 1)           //한명만 남은 거
        //TODO popup
        //PopupManager_RaS.Instance.OpenPopup(POPUP_TYPE_RaS.POPUP_HOSTDISCONNECTED);
        {
            hostController.SendData("Replay");
        }

        if (SceneManager.GetActiveScene().name == "CharacterSelectLobbyBS")
        {
            CancleSoldOut(userCode, charType);
            ClearSelectedCharacter(userIndex);
        }
    }