Beispiel #1
0
    /// <summary>
    /// Cập nhật lại vị trí và giao diện
    /// </summary>
    public static void UpdatePlayerSide()
    {
        if (YourController != null)
        {
            YourController.mSide = ESide.Slot_0;
        }

        foreach (PlayerControllerChan p in ListPlayer)
        {
            p.mSide = SlotToSide(p.slotServer);
        }

        foreach (PlayerControllerChan p in ListJoinGameWhenPlaying)
        {
            p.mSide = SlotToSide(p.slotServer);
        }

        //Vẽ thông tin người đang tham gia trận đấu. Khi vẽ thông tin người dùng sẽ tự động destroy các slot trống.
        ListPlayer.ForEach(p => { if (p.cuiPlayer == null && p.slotServer <= 3)
                                  {
                                      CUIPlayerChan.Create(p, game.mPlaymat.locationPlayer[(int)p.mSide]);
                                  }
                           });
        //Vẽ thông tin người đang chờ trận đấu mới.
        ListJoinGameWhenPlaying.ForEach(p => { if (p.cuiPlayer == null)
                                               {
                                                   CUIPlayerChan.Create(p, game.mPlaymat.locationPlayer[(int)p.mSide]);
                                               }
                                        });

        DrawInfoPlayerNoSlot();
    }
Beispiel #2
0
    /// <summary>
    /// Bắt đầu game. Reset lại các biến.
    /// </summary>
    public static void CreateNewGame()
    {
        if (GameModelChan.game.isViewCompleted)
        {
            GameModelChan.game.isViewCompleted = !GameModelChan.game.isViewCompleted;
        }

        GameModelChan.ListPlayer.ForEach(p => { if (p.IsHasQuit)
                                                {
                                                    GameModelChan.SetPlayer(p.slotServer, null);
                                                }
                                         });
        ListJoinGameWhenPlaying.ForEach(p => GameModelChan.SetPlayer(p.slotServer, p));
        model.ChangePositionStealAndTrashYourController();
        ListJoinGameWhenPlaying.Clear();
        //if(GameModel.game.iconBettingUp.active)
        if (GameModelChan.game.iconBettingUp.gameObject.activeSelf)
        {
            GameModelChan.game.iconBettingUp.gameObject.SetActive(false);
        }
        GameModelChan.game.Listener.RegisterEventNewGame();
        GameModelChan.game.dicUserBetting.Clear();

        DeckCount       = 23;
        IndexInTurn     = 0;
        IndexLastInTurn = 0;

        game.stolen         = false;
        game.fullLaying     = false;
        game.canRequestSort = true;

        game.listGiveCard.Clear();
        game.sortList.Clear();
        game.summaryGame.Clear();
        game.meldList.Clear();

        MiniState = EGameStateMini.discard;

        GameModelChan.UpdatePlayerSide();

        if (IsQuitWhenEndGame)
        {
            game.OnQuitGame(false);
        }
        // clear am thanh
        SoundGameplay.Instances.ResetSoundWhenNewGame();
    }