Пример #1
0
 private void SetRiverData()
 {
     for (int playerIndex = 0; playerIndex < Rivers.Length; playerIndex++)
     {
         int placeIndex = CurrentRoundStatus.GetPlaceIndex(playerIndex);
         CurrentRoundStatus.SetRiverData(placeIndex, Rivers[playerIndex]);
     }
 }
Пример #2
0
 private void HandleRoundDraw(WaitingData[] data)
 {
     for (int playerIndex = 0; playerIndex < data.Length; playerIndex++)
     {
         int placeIndex = CurrentRoundStatus.GetPlaceIndex(playerIndex);
         CheckReadyOrNot(placeIndex, data[playerIndex]);
     }
 }
 private void HandleLocalDiscard()
 {
     // if local, check data accuracy, including hand tiles and river tiles
     // check hand tiles
     CurrentRoundStatus.CheckLocalHandTiles(HandTiles);
     // set river tiles
     for (int playerIndex = 0; playerIndex < Rivers.Length; playerIndex++)
     {
         int placeIndex = CurrentRoundStatus.GetPlaceIndex(playerIndex);
         CurrentRoundStatus.SetRiverData(placeIndex, Rivers[playerIndex]);
     }
     // set zhenting status
     CurrentRoundStatus.SetZhenting(Zhenting);
     // skipping this out turn operation, since the current turn is the turn of local player.
     ClientBehaviour.Instance.OnSkipOutTurnOperation(BonusTurnTime);
 }
Пример #4
0
        public override void OnClientStateEnter()
        {
            Debug.Log($"Turn ends, operation {string.Join(",", Operations)} is taking.");
            // update current place index
            CurrentRoundStatus.SetCurrentPlaceIndex(PlayerIndex);
            // update richi status
            CurrentRoundStatus.UpdateRichiStatus(RichiStatus);
            // update points
            CurrentRoundStatus.UpdatePoints(Points);
            // update richi sticks
            CurrentRoundStatus.SetRichiSticks(RichiSticks);
            // update mahjong set
            CurrentRoundStatus.SetMahjongSetData(MahjongSetData);
            // update zhenting status
            CurrentRoundStatus.SetZhenting(Zhenting);
            // perform operation
            if (Operations.All(op => op.Type == OutTurnOperationType.Skip))
            {
                return;
            }
            for (int playerIndex = 0; playerIndex < Operations.Length; playerIndex++)
            {
                int placeIndex = CurrentRoundStatus.GetPlaceIndex(playerIndex);
                var operation  = Operations[playerIndex];
                switch (operation.Type)
                {
                case OutTurnOperationType.Skip:
                    continue;

                case OutTurnOperationType.Chow:
                case OutTurnOperationType.Pong:
                case OutTurnOperationType.Kong:
                    HandleOpen(placeIndex, operation);
                    break;

                case OutTurnOperationType.Rong:
                    HandleRong(placeIndex, operation);
                    break;

                case OutTurnOperationType.RoundDraw:
                    HandleRoundDraw(operation);
                    break;
                }
            }
        }
        private IEnumerator UpdateHandData(int currentPlaceIndex, bool discardingLastDraw, Tile tile, RiverData[] rivers)
        {
            CurrentRoundStatus.ClearLastDraws();
            controller.TableTilesManager.DiscardTile(currentPlaceIndex, discardingLastDraw);
            Debug.Log($"Playing player (place: {currentPlaceIndex}) discarding animation");
            yield return(new WaitForEndOfFrame());

            for (int playerIndex = 0; playerIndex < rivers.Length; playerIndex++)
            {
                int placeIndex = CurrentRoundStatus.GetPlaceIndex(playerIndex);
                CurrentRoundStatus.SetRiverData(placeIndex, rivers[playerIndex]);
            }
            var panelShown = controller.ShowOutTurnPanels(Operations, BonusTurnTime);

            if (panelShown)
            {
                controller.TableTilesManager.ShineLastTile(currentPlaceIndex);
            }
        }