Beispiel #1
0
        public void GuoHaidi(string uid)
        {
            this.OutCardState = OutCardState.haidi;
            this.SetAllResetEvent();
            LinkedListNode <CsGamePlayer> node = FindPlayer(uid);

            this.haiGuoNumber++;

            //都没人要留局
            if (this.haiGuoNumber == this.Players.Count)
            {
                A1018Response.Builder rep1018 = A1018Response.CreateBuilder();
                rep1018.Card = this.cardArray[this.CardIndex];;
                var rep1018Array = rep1018.Build().ToByteArray();
                foreach (var row in Players)
                {
                    WebSocketServerWrappe.SendPackgeWithUser(row.PlayerUser.Uid, 1018, rep1018Array);
                }
                this.EndGame();
            }
            else
            {
                A1016Response.Builder rep1016 = A1016Response.CreateBuilder();
                rep1016.Uid = node.NextOrFirst().Value.PlayerUser.Uid;
                var rep1016Array = rep1016.Build().ToByteArray();
                foreach (var row in Players)
                {
                    WebSocketServerWrappe.SendPackgeWithUser(row.PlayerUser.Uid, 1016, rep1016Array);
                }
            }
        }
Beispiel #2
0
        public void DaHaidi(string uid, int card)
        {
            LinkedListNode <CsGamePlayer> node = FindPlayer(uid);

            this.OutCardState = OutCardState.Normal;

            A1024Response.Builder a1024Response = A1024Response.CreateBuilder();
            a1024Response.Card = card;
            a1024Response.Uid  = uid;

            byte[] responseArray = a1024Response.Build().ToByteArray();

            foreach (var row in Players)
            {
                if (row.PlayerUser.Uid != uid)
                {
                    row.HaidiPai = -1;
                }

                WebSocketServerWrappe.SendPackgeWithUser(row.PlayerUser.Uid, 1024, responseArray);

                actionStorage.PushDa(uid, card);
            }

            foreach (var row in Players)
            {
                if (row.PlayerUser.Uid != uid && row.CheckHu(card))
                {
                    row.ResetEvent.WaitOne();
                }
            }

            if (this.OutCardState != OutCardState.Normal)
            {
                return;
            }

            A1018Response.Builder a1018Response = A1018Response.CreateBuilder();

            byte[] response1018Array = a1018Response.Build().ToByteArray();

            foreach (var row in Players)
            {
                WebSocketServerWrappe.SendPackgeWithUser(row.PlayerUser.Uid, 1018, response1018Array);
            }
            this.EndGame();
        }