當前位置: 首頁>>代碼示例>>C#>>正文


C# Card.CopyFrom方法代碼示例

本文整理匯總了C#中Sanguosha.Core.Cards.Card.CopyFrom方法的典型用法代碼示例。如果您正苦於以下問題:C# Card.CopyFrom方法的具體用法?C# Card.CopyFrom怎麽用?C# Card.CopyFrom使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sanguosha.Core.Cards.Card的用法示例。


在下文中一共展示了Card.CopyFrom方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Run

        public virtual void Run()
        {
            if (games.ContainsKey(Thread.CurrentThread))
            {
                throw new GameAlreadyStartedException();
            }
            else
            {
                games.Add(Thread.CurrentThread, this);
            }
            if (GameServer != null)
            {
                GameServer.Start();
                Trace.Assert(Settings != null);
                for (int i = 0; i < players.Count; i++)
                {
                    GameServer.SendObject(i, Settings);
                    GameServer.SendObject(i, i);
                    GameServer.Flush(i);
                }

            }

            availableCards = new List<CardHandler>();
            foreach (Card c in OriginalCardSet)
            {
                bool typeCheck = false;
                foreach (var type in availableCards)
                {
                    if (type.GetType().Name.Equals(c.Type.GetType().Name))
                    {
                        typeCheck = true;
                        break;
                    }
                }
                if (!typeCheck)
                {
                    availableCards.Add(c.Type);
                }
            }

            foreach (var card in OriginalCardSet)
            {
                //you are client. everything is unknown
                if (IsClient)
                {
                    unknownCard = new Card();
                    unknownCard.Id = Card.UnknownCardId;
                    unknownCard.Rank = 0;
                    unknownCard.Suit = SuitType.None;
                    if (card.Type is Heroes.HeroCardHandler)
                    {
                        unknownCard.Type = new Heroes.UnknownHeroCardHandler();
                        unknownCard.Id = Card.UnknownHeroId;
                    }
                    else if (card.Type is RoleCardHandler)
                    {
                        unknownCard.Id = Card.UnknownRoleId;
                        unknownCard.Type = card.Type;
                    }
                    else
                    {
                        unknownCard.Type = new UnknownCardHandler();
                    }
                }
                //you are server.
                else
                {
                    unknownCard = new Card();
                    unknownCard.CopyFrom(card);
                    if (unknownCard.Type is Heroes.HeroCardHandler)
                    {
                        unknownCard.Type = (Heroes.HeroCardHandler)(unknownCard.Type as Heroes.HeroCardHandler).Clone();
                    }
                }
                cardSet.Add(unknownCard);
            }

            foreach (var trig in triggersToRegister)
            {
                RegisterTrigger(trig.key, trig.trigger);
            }

            InitTriggers();
            try
            {
                NotificationProxy.NotifyGameStart();
                Emit(GameEvent.GameStart, new GameEventArgs());
            }
            catch (GameOverException)
            {

            }
            #if RELEASE
            catch (Exception e)
            {
                Trace.TraceError(e.StackTrace);
            }
            #endif
            if (GameServer != null)
//.........這裏部分代碼省略.........
開發者ID:pxoylngx,項目名稱:sgs,代碼行數:101,代碼來源:Game.cs

示例2: _FindARoleCard

 private Card _FindARoleCard(Role role)
 {
     foreach (var card in allRoleCards)
     {
         if ((card.Type as RoleCardHandler).Role == role && !usedRoleCards.Contains(card))
         {
             var c = new Card();
             c.CopyFrom(card);
             c.Place = new DeckPlace(null, RoleGame.RoleDeckType);
             usedRoleCards.Add(card);
             return c;
         }
     }
     return null;
 }
開發者ID:pxoylngx,項目名稱:sgs,代碼行數:15,代碼來源:RoleGame.cs

示例3: Run

        public virtual void Run()
        {
            if (games.ContainsKey(Thread.CurrentThread))
            {
                throw new GameAlreadyStartedException();
            }
            else
            {
                games.Add(Thread.CurrentThread, this);
            }
            if (GameServer != null)
            {
                GameServer.Ready();
            }

            availableCards = new List<CardHandler>();
            foreach (Card c in OriginalCardSet)
            {
                bool typeCheck = false;
                foreach (var type in availableCards)
                {
                    if (type.GetType().Name.Equals(c.Type.GetType().Name))
                    {
                        typeCheck = true;
                        break;
                    }
                }
                if (!typeCheck)
                {
                    availableCards.Add(c.Type);
                }
            }

            foreach (var card in OriginalCardSet)
            {
                //you are client. everything is unknown
                if (IsClient)
                {
                    unknownCard = new Card();
                    unknownCard.Id = Card.UnknownCardId;
                    unknownCard.Rank = 0;
                    unknownCard.Suit = SuitType.None;
                    if (card.Type is Heroes.HeroCardHandler)
                    {
                        unknownCard.Type = new Heroes.UnknownHeroCardHandler();
                    }
                    else
                    {
                        unknownCard.Type = new UnknownCardHandler();
                    }
                }
                //you are server.
                else
                {
                    unknownCard = new Card();
                    unknownCard.CopyFrom(card);
                }
                cardSet.Add(unknownCard);
            }

            foreach (var trig in triggersToRegister)
            {
                RegisterTrigger(trig.key, trig.trigger);
            }

            InitTriggers();
            try
            {
                Emit(GameEvent.GameStart, new GameEventArgs());
            }
            catch (GameOverException)
            {
                Trace.TraceError("Game is over");
            }
            #if RELEASE
            catch (Exception e)
            {
                Trace.TraceError(e.StackTrace);
            }
            #endif
            Trace.TraceError("Game exited normally");
        }
開發者ID:maplegh,項目名稱:sgs,代碼行數:82,代碼來源:Game.cs


注:本文中的Sanguosha.Core.Cards.Card.CopyFrom方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。