Exemplo n.º 1
0
        public void OnActionResult(MsgActionResultNotify msg)
        {
            // 出牌
            if (msg.Action == (int)ActionType.EnumActionTypeDiscard)
            {
                var discardedHands = msg.ActionHands;
                foreach (var h in discardedHands)
                {
                    foreach (var d in h.Cards)
                    {
                        TilesHandList.Remove(d);
                    }

                    MeldList.Add(h);
                }

                Hand2Buttons();
                MeldList2Buttons();

                //MyOwner.BtnDiscard.Content = new Image() { Source = ImagesSrc[msg.actionTile] };
                //MyOwner.TbDiscard.Text = $"{MyPlayer.Name}->{MyOwner.TileId2Name(msg.actionTile)}";
                //MyOwner.AppendActionLog($"[discard]({MyPlayer.Name}):{MyOwner.TileId2Name(msg.actionTile)}");
                return;
            }
        }
Exemplo n.º 2
0
 public void Reset2New()
 {
     HideAllButtons();
     TilesFlowerList.Clear();
     TilesHandList.Clear();
     MeldList.Clear();
     BankerChairId       = 0;
     TbRichi.Text        = "";
     TbPseudoFlower.Text = "";
 }
        protected override async Task LastPartOfSetUpBeforeBindingsAsync()
        {
            if (IsLoaded == false)
            {
                SingleInfo = PlayerList !.GetSelf();
                Aggregator.Subscribe(SingleInfo);
                SingleInfo = PlayerList.GetWhoPlayer(); //i think.
            }
            LoadControls();
            LoadVM();
            SaveRoot !.MeldList.Clear();
            SaveRoot.CardList.Clear();
            SaveRoot.TrumpSuit = _model.Pile1 !.GetCardInfo().Suit;
            _aTrick !.ClearBoard(); //try this too.
            PlayerList !.ForEach(thisPlayer =>
            {
                thisPlayer.TricksWon    = 0;
                thisPlayer.CurrentScore = 0;
            });
            var thisCard = _model.Pile1.GetCardInfo();

            if (thisCard.Value == EnumCardValueList.Nine)
            {
                int player = WhoStarts;
                if (player == 1)
                {
                    player = 2;
                }
                else
                {
                    player = 1;
                }
                MeldClass thisMeld = new MeldClass();
                thisMeld.Player      = player;
                thisMeld.ClassAValue = EnumClassA.Dix;
                SaveRoot.MeldList.Add(thisMeld);
                var tempPlayer = PlayerList[player];
                SaveRoot.StartMessage = $"{tempPlayer.NickName} gets an exta 10 points because the discard to begin with is a dix and is not going first";
                CalculateScore(player);
                await UIPlatform.ShowMessageAsync(SaveRoot.StartMessage);
            }
            await base.LastPartOfSetUpBeforeBindingsAsync();
        }