public void Deal(int playerId)
 {
     // if (IsChipinClose) {
     if (CurrentStage != EStage.CanChipIning)
     {
         NotifySinglePlayer(WebscoketSendObjs.RoomMessage(playerId, "不是押底阶段,不能发牌!"), playerId);
         return;
     }
     // if (JoinSeats.Count() != InningeGame.NotEmptySeats().Count()) {
     if (JoinSeats.Count() < 2)
     {
         NotifyRoomPlayers(WebscoketSendObjs.RoomMessage(0, "押底人数不足2人,不能发牌"));
         return;
     }
     CheckDateTime = DateTime.Now;
     //  IsChipinClose = true;//?
     PokerManager.Riffile();
     lock (this) {
         for (int i = 0; i < JoinSeats.Count(); i++)
         {
             ThreeCards threeCards = new ThreeCards(PokerManager.TackOut(3));
             JoinSeats[i].Pokers      = threeCards;
             JoinSeats[i].PreChipType = EChipinType.PlayerChipIn;
         }
         CurrentStage = EStage.Running;
     }
     CheckDateTime = DateTime.Now;
     NotifyRoomPlayers(new FreshGameFace(0));
     NotifyRoomPlayers(WebscoketSendObjs.RoomMessage(0, "发牌完毕,庄家开始下注"));
 }
Example #2
0
 private Player StartGame(Player player)
 {
     Card[] cards = player.Cards.ToArray();
     if (PokerManager.IsStraightFlush(cards))
     {
         player.Category = 9;
         player.CardRank = cards.Max(x => x.Rank);
         return(player);
     }
     else if (PokerManager.IsFourOfAKind(cards))
     {
         player.Category = 8;
         player.CardRank = cards[2].Rank;
         return(player);
     }
     else if (PokerManager.IsFullHouse(cards))
     {
         player.Category = 7;
         player.CardRank = cards[2].Rank;
         return(player);
     }
     else if (PokerManager.IsFlush(cards))
     {
         player.Category = 6;
         return(player);
     }
     else if (PokerManager.IsStraight(cards))
     {
         player.Category = 5;
         player.CardRank = cards.Max(x => x.Rank);
         return(player);
     }
     else if (PokerManager.IsThreeOfAKind(cards))
     {
         player.Category = 4;
         player.CardRank = cards[2].Rank;
         return(player);
     }
     else if (PokerManager.IsTwoPair(cards))
     {
         player.Category = 3;
         return(player);
     }
     else if (PokerManager.IsPair(cards))
     {
         player.Category = 2;
         return(player);
     }
     else
     {
         player.Category = 1;
         player.CardRank = cards[2].Rank;
         return(player);
     };
 }
        public void Test_CheckAllPokerHaveCards(string s1, string s2, string s3, string s4)
        {
            PokerManager m  = new PokerManager();
            Poker        p1 = CreatePoker("P1", s1);
            Poker        p2 = CreatePoker("P2", s2);
            Poker        p3 = CreatePoker("P3", s3);
            Poker        p4 = CreatePoker("P4", s4);

            m.NumberOfPlayers = 4;
            m.Pokers.Add(p1);
            m.Pokers.Add(p2);
            m.Pokers.Add(p3);
            m.Pokers.Add(p4);

            var result = m.CheckAllPokerHaveCards();

            Assert.IsTrue(result);
        }
Example #4
0
        public void TestHandsTie()
        {
            List <Card> handOne = new List <Card>
            {
                new Card("S", "Q"),
                new Card("H", "2"),
                new Card("S", "6"),
                new Card("D", "9"),
                new Card("S", "10")
            };
            List <Card> handTwo = new List <Card>
            {
                new Card("S", "9"),
                new Card("H", "3"),
                new Card("S", "T"),
                new Card("D", "9"),
                new Card("S", "4")
            };

            PokerManager pokerManager = new PokerManager();
            string       result       = pokerManager.Compare(handOne, handTwo);

            Assert.True(result == "Hand one wins");
        }
Example #5
0
    IEnumerator _LoadAllScenes()
    {
        AsyncOperation async;

        string[]      enums   = Enum.GetNames(typeof(SceneType));
        BundleManager bundleM = BundleManager.instance;

        for (int i = 2; i < enums.Length; i++)
        {
            bundleM.txtStatusBar.text = "Memuat permainan " + Mathf.RoundToInt(((float)i / (float)enums.Length) * 100).ToString() + "%";
            string loadPath = BundleManager.instance.GetSceneLoadPath(i);
            //Logger.E ("loading scene: " + loadPath);
            AssetBundle ab        = AssetBundle.LoadFromFile(loadPath);
            string[]    scenePath = ab.GetAllScenePaths();
            //Logger.E (scenePath[0]);
            async = SceneManager.LoadSceneAsync(scenePath[0], LoadSceneMode.Additive);
            while (!async.isDone)
            {
                yield return(_WFSUtility.wef);
                //Logger.E ("name: " + scenePath[0] + " | progress: " + async.progress);
            }
            ab.Unload(false);
            //add progress here
        }
        yield return(_WFSUtility.wef);

        homeM = HomeManager.instance;
        yield return(_WFSUtility.wef);

        profileM = ProfileManager.instance;
        yield return(_WFSUtility.wef);

        verifyM = VerifyManager.instance;
        yield return(_WFSUtility.wef);

        vipM = VipManager.instance;
        yield return(_WFSUtility.wef);

        pokerM = PokerManager.instance;
        yield return(_WFSUtility.wef);

        beginM = BeginManager.instance;
        yield return(_WFSUtility.wef);

        loginM = LoginManager.instance;
        yield return(_WFSUtility.wef);

        shopM = ShopManager.instance;
        yield return(_WFSUtility.wef);

        proomM = PokerRoomManager.instance;
        yield return(_WFSUtility.wef);

        slotoM = FindObjectOfType <SlotoManagerScript> ();
        yield return(_WFSUtility.wef);

        sicboM = SicboManager.instance;
        yield return(_WFSUtility.wef);

        settingsM = SettingsManager.instance;
        yield return(_WFSUtility.wef);

        heroM = HeroManager.instance;
        yield return(_WFSUtility.wef);

        leaderboardM = LeaderboardManager.instance;
        yield return(_WFSUtility.wef);

        friendM = FriendManager.instance;
        yield return(_WFSUtility.wef);

        inboxM = InboxManager.instance;
        yield return(_WFSUtility.wef);

        transferM = TransferManager.instance;
        yield return(_WFSUtility.wef);

        redeemM = RedeemManager.instance;
        yield return(_WFSUtility.wef);

        dailyRewardsM = DailyRewardsManager.instance;
        yield return(_WFSUtility.wef);

        weeklyRewardsM = WeeklyRewardsManager.instance;
        yield return(_WFSUtility.wef);

        moneySlotM = MoneySlotManager.instance;
        yield return(_WFSUtility.wef);

        dailyQuestM = DailyQuestManager.instance;
        yield return(_WFSUtility.wef);

        watchAdsM = WatchAdsManager.instance;

        PhotonNetwork.ConnectUsingSettings("v1.0");
        yield return(_WFSUtility.wef);

        SetActiveScene(SceneType.SLOTO, false);
        yield return(_WFSUtility.wef);

        int    playerID = PlayerPrefs.GetInt(PrefEnum.PLAYER_ID.ToString(), 0);
        string token    = PlayerPrefs.GetString(PrefEnum.TOKEN.ToString(), string.Empty);

        if (playerID != 0 && token != string.Empty)
        {
            ApiManager.instance.GetHome();
        }
        else
        {
            SetActiveScene(SceneType.LOGIN, true);
        }
        yield return(_WFSUtility.wef);

        BundleManager.instance.bLoadingScenes = true;
        yield return(_WFSUtility.wef);

        SceneManager.UnloadSceneAsync("SeSplash");
    }
Example #6
0
    IEnumerator _LoadLocalScenes()
    {
        AsyncOperation async;
        BundleManager  bundleM = BundleManager.instance;

        for (int i = 2; i < SceneManager.sceneCountInBuildSettings; i++)
        {
            bundleM.txtStatusBar.text = "Memuat permainan " + Mathf.RoundToInt(((float)i / (float)SceneManager.sceneCountInBuildSettings) * 100).ToString() + "%";
            async = SceneManager.LoadSceneAsync(i, LoadSceneMode.Additive);
            while (!async.isDone)
            {
                yield return(_WFSUtility.wef);
            }
        }

        yield return(_WFSUtility.wef);

        homeM = HomeManager.instance;
        yield return(_WFSUtility.wef);

        profileM = ProfileManager.instance;
        yield return(_WFSUtility.wef);

        verifyM = VerifyManager.instance;
        yield return(_WFSUtility.wef);

        vipM = VipManager.instance;
        yield return(_WFSUtility.wef);

        pokerM = PokerManager.instance;
        PhotonNetwork.ConnectUsingSettings("v1.0");
        yield return(_WFSUtility.wef);

        beginM = BeginManager.instance;
        yield return(_WFSUtility.wef);

        loginM = LoginManager.instance;
        yield return(_WFSUtility.wef);

        shopM = ShopManager.instance;
        yield return(_WFSUtility.wef);

        proomM = PokerRoomManager.instance;
        yield return(_WFSUtility.wef);

        slotoM = FindObjectOfType <SlotoManagerScript> ();
        yield return(_WFSUtility.wef);

        sicboM = SicboManager.instance;
        yield return(_WFSUtility.wef);

        settingsM = SettingsManager.instance;
        yield return(_WFSUtility.wef);

        heroM = HeroManager.instance;
        yield return(_WFSUtility.wef);

        leaderboardM = LeaderboardManager.instance;
        yield return(_WFSUtility.wef);

        friendM = FriendManager.instance;
        yield return(_WFSUtility.wef);

        inboxM = InboxManager.instance;
        yield return(_WFSUtility.wef);

        transferM = TransferManager.instance;
        yield return(_WFSUtility.wef);

        redeemM = RedeemManager.instance;
        yield return(_WFSUtility.wef);

        dailyRewardsM = DailyRewardsManager.instance;
        yield return(_WFSUtility.wef);

        weeklyRewardsM = WeeklyRewardsManager.instance;
        yield return(_WFSUtility.wef);

        moneySlotM = MoneySlotManager.instance;
        yield return(_WFSUtility.wef);

        dailyQuestM = DailyQuestManager.instance;
        yield return(_WFSUtility.wef);

        watchAdsM = WatchAdsManager.instance;


        yield return(_WFSUtility.wef);

        SetActiveScene(SceneType.SLOTO, false);
        yield return(_WFSUtility.wef);

        int    playerID = PlayerPrefs.GetInt(PrefEnum.PLAYER_ID.ToString(), 0);
        string token    = PlayerPrefs.GetString(PrefEnum.TOKEN.ToString(), string.Empty);

        if (playerID != 0 && token != string.Empty)
        {
            ApiManager.instance.GetHome();
        }
        else
        {
            SetActiveScene(SceneType.LOGIN, true);
        }
        yield return(_WFSUtility.wef);

        BundleManager.instance.bLoadingScenes = true;
        yield return(_WFSUtility.wef);

        SceneManager.UnloadSceneAsync("SeSplash");
    }
Example #7
0
        public int GetHolderId(RoomActor roomData)
        {
            //确定庄家位置
            var cardDatas = roomData.Seats.Where(m => m.InGame).Select(m =>
                                                                       new { UserId = m.UserId, CardSize = PokerManager.GetCardSize(m.CardDataBefore, roomData) }).ToList();

            cardDatas = cardDatas.Where(m => m.CardSize / 1000 >= 10 && m.CardSize / 1000 <= 12).ToList();

            if (cardDatas.Count > 0)
            {
                cardDatas.Sort((x, y) => y.CardSize - x.CardSize);

                return(cardDatas[0].UserId);
            }
            return(roomData.HolderId);
        }