Exemple #1
0
    private int GetAvailableRoomSlotIndex()
    {
        if (PhotonNetwork.room == null)
        {
            return(-1);
        }

        //Make the next available slot occupied
        int slot_index = -1;

        bool[] slots = PhotonUtility.GetRoomProperties <bool[]> (PhotonEnums.Room.Slots);

        //debug.LogError("Slot Count : " + slots.Length);

        bool bFoundNewIndex = false;

        for (int i = 0; i < slots.Length; i++)
        {
            if (slots[i] == false)
            {
                slot_index     = i;
                slots[i]       = true;
                bFoundNewIndex = true;
                break;
            }
        }

        if (bFoundNewIndex)
        {
            PhotonUtility.SetRoomProperties(PhotonEnums.Room.Slots, slots);
        }

        return(slot_index);
    }
Exemple #2
0
    private void onSuccessJoinRoom(bool val)
    {
        ExitGames.Client.Photon.Hashtable properties = PhotonNetwork.room.CustomProperties;
        if (!properties.ContainsKey(PhotonEnums.Room.Slots))
        {
            if (GlobalVariables.gameType == GameType.TexasPoker)
            {
                PhotonUtility.SetRoomProperties(PhotonEnums.Room.Slots, new bool[8] {
                    false, false, false, false, false, false, false, false
                });
            }
            else if (GlobalVariables.gameType == GameType.Sicbo)
            {
                PhotonUtility.SetRoomProperties(PhotonEnums.Room.Slots, new bool[10] {
                    false, false, false, false, false, false, false, false, false, false
                });
            }
        }

        string strBetType  = PhotonUtility.GetRoomProperties <string>(PhotonEnums.Room.BetType);
        string strPassword = PhotonUtility.GetRoomProperties <string> (PhotonEnums.Room.Password);

        Logger.E("join room pass: "******"bIsPassword: "******"gems")
        {
            GlobalVariables.bIsCoins = false;
        }
        else
        {
            GlobalVariables.bIsCoins = true;
        }


        if (PlayerPrefs.GetString(PrefEnum.PHOTON_ROOM_NAME.ToString(), string.Empty).Equals(PhotonNetwork.room.Name))
        {
            Debug.LogError("if 1: " + PhotonNetwork.room.Name);
            //PokerManager.instance.uiOthers.OnSwitchTable(true);
            SwitchingRoom();
        }
        else
        {
            StartCoroutine(LoadGame());
        }
        //HomeSceneManager.Instance.HitAbsent(PhotonNetwork.room.Name);
    }
Exemple #3
0
    private void SyncSlots()
    {
        if (PhotonNetwork.isMasterClient)
        {
            bool[] slots = PhotonUtility.GetRoomProperties <bool[]> (PhotonEnums.Room.Slots);
            for (int i = 0; i < slots.Length; i++)
            {
                slots[i] = false;
            }

            foreach (PhotonPlayer player in PhotonNetwork.playerList)
            {
                int slotIndex = PhotonUtility.GetPlayerProperties <int> (player, PhotonEnums.Player.SlotIndex);

                if (slotIndex != -1)
                {
                    slots[slotIndex] = true;
                }
            }

            PhotonUtility.SetRoomProperties(PhotonEnums.Room.Slots, slots);
        }
    }