Example #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);
    }
Example #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);
    }
Example #3
0
        public void StartFirstTurn()
        {
            indexLastDealer = GetIndexValueRound(indexLastDealer, matchPlayers.Count);

            if (PhotonNetwork.isMasterClient)
            {
                PhotonUtility.SetRoomProperties(PhotonEnums.Room.LastIndexDealer, indexLastDealer);
            }

            phaseTurn = 0;

            instance.AddPot(0, 0, currentPlayers.ToArray());

            if (currentPlayers.Count > 2)
            {
                lastBet = startBet;

                currentPlayers[indexLastDealer].SetMyRole(_GameRoleEnums.Dealer);
                instance.chipD.SetActive(true);
                LeanTween.move(instance.chipD, currentPlayers[indexLastDealer].chipsD, 1f);

                currentPlayers[GetIndexValueRound(indexLastDealer, matchPlayers.Count)].SetMyRole(_GameRoleEnums.SmallBlind);
                currentPlayers[GetIndexValueRound(indexLastDealer + 1, matchPlayers.Count)].SetMyRole(_GameRoleEnums.BigBlind);

                turnNow = currentPlayers[GetIndexValueRound(indexLastDealer + 1, matchPlayers.Count)];
            }
            else if (currentPlayers.Count == 2)
            {
                lastBet = startBet;
                instance.chipD.SetActive(false);
                currentPlayers[indexLastDealer].SetMyRole(_GameRoleEnums.SmallBlind);
                currentPlayers[GetIndexValueRound(indexLastDealer, matchPlayers.Count)].SetMyRole(_GameRoleEnums.BigBlind);

                turnNow = currentPlayers[GetIndexValueRound(indexLastDealer, matchPlayers.Count)];
            }

            UpdatePlayerNextTurn();  //To Initialize the Next Turn Player before Start Game

            if (PhotonUtility.GetPlayerProperties <bool> (PhotonNetwork.player, PhotonEnums.Player.Active))
            {
                if (!nextTurn.isMine || nextTurn.isBot)
                {
                    instance.unsortedPlayers[0].panelPreAction.SetActive(true);
                }
            }

            StartNextTurn();
        }
Example #4
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);
        }
    }
Example #5
0
    IEnumerator _PreparingRound()
    {
        PhotonUtility.SetRoomProperties(PhotonEnums.Room.MasterClientID, PhotonNetwork.player.UserId);
        PhotonUtility.SetRoomProperties(PhotonEnums.Room.IS_PLAYING, true);

        //int readyCount = 0;
        //yield return _WFSUtility.wfs2;
        //foreach (PhotonPlayer player in PhotonNetwork.playerList)
        //{
        //    bool bReady = PhotonUtility.GetPlayerProperties<bool> (player, PhotonEnums.Player.ReadyInitialized);
        //    Logger.E (bReady.ToString());
        //    if (bReady)
        //        readyCount++;
        //}
        //if (SicboTimer.instance == null)
        //{
        //    GameObject objTimer = PhotonNetwork.InstantiateSceneObject ("PhotonObjectTimer", Vector3.zero, Quaternion.identity, 0, new object[] { });
        //    SicboTimer.instance.SetScaleZ (15f);
        //}

        yield return(_WFSUtility.wfs2);

        PrepareSicboRound();
    }