Beispiel #1
0
        protected string GetSpriteName(int line, CardType type)
        {
            switch (type)
            {
            case CardType.santiao:
                return(line == 0 ? "chongsan" : type.ToString());

            default:
                return(type.ToString());
            }
        }
Beispiel #2
0
 private void addCard(int x, int y, CardType type)
 {
     if (x > -1 && y > -1)
     {
         _board.AddCard(new Card(type, new Point(x, y)));
         LogAggregator.AddItem(type.ToString() + " played to " + x + "-" + y);
     }
     else
     {
         LogAggregator.AddItem(type.ToString() + " passed");
     }
 }
Beispiel #3
0
        /// <summary>
        /// 创建卡券
        /// </summary>
        private CreateCardResult CreateCard(CardType cardType, dynamic card, RequiredInfo required, BaseInfo baseInfo, AdvanceInfo advance)
        {
            var dic = new Dictionary <string, object>();

            dic.Add("card_type", cardType.ToString());
            dic.Add(cardType.ToString().ToLower(), card);
            FillBaseInfo(card, required, baseInfo);
            FillAdvanceInfo(card, advance);
            var data = new
            {
                card = dic
            };

            return(PostJson <CreateCardResult>("/card/create", data));
        }
Beispiel #4
0
        /// <summary>
        /// Spawns new unit and adds it to dictionary
        /// </summary>
        /// <param name="message"></param>
        private void SpawnUnit(MatchMessageUnitSpawned message)
        {
            Debug.Log("Spawned Unit Beg: " + message.UnitId);
            CardType    cardType = message.Card.GetCardInfo().CardType;
            Node        node     = GameManager.Instance.Nodes[message.NodeX, message.NodeY];
            PlayerColor player   = message.OwnerId == NakamaSessionManager.Instance.Session.UserId ? PlayerColor.Black : PlayerColor.Red;
            int         id       = message.UnitId;
            string      ownerId  = message.OwnerId;

            Quaternion rotation;

            if (MatchCommunicationManager.Instance.IsHost)
            {
                rotation = player == PlayerColor.Black ? Quaternion.Euler(0, 90, 0) : Quaternion.Euler(0, -90, 0);
            }
            else
            {
                rotation = player == PlayerColor.Black ? Quaternion.Euler(0, -90, 0) : Quaternion.Euler(0, 90, 0);
            }

            GameObject prefab = Resources.Load <GameObject>("Units/" + cardType.ToString() + "_" + player.ToString());

            Unit unit = Instantiate(prefab, node.transform.position, rotation, transform).GetComponent <Unit>();

            if (unit)
            {
                unit.Init(player, ownerId, id, node, message.Card);
                Debug.Log("Spawned Unit: " + id);
                _units[player].Add(id, unit);
                unit.OnDestroy += RemoveUnit;
            }
        }
Beispiel #5
0
        public Card(int cardID, CardType type, int emeraldsValue = 0)
        {
            this.EmeraldValue = emeraldsValue;
            this.CardID       = cardID;
            this.Type         = type;
            this.Title        = type.ToString();
            switch (type)
            {
            case CardType.ENTRY: ImagePath = "mine_entry.png"; break;

            case CardType.DRAGON: ImagePath = "dragon.png"; break;

            case CardType.EMERALDS: ImagePath = "cave.png"; break;

            case CardType.LAVA: ImagePath = "lava.png"; break;

            case CardType.ROCKS: ImagePath = "toxic.png"; break;

            case CardType.SPIDERS: ImagePath = "spiders.png"; break;

            case CardType.SNAKES: ImagePath = "snakes.png"; break;

            case CardType.TRAP: ImagePath = "trap.png"; break;

            case CardType.ARTIFACT: ImagePath = "cave.png"; break;
            }
        }
        public Card OpenNewCard(string shortCardName, Currency currency, CardType cardType)
        {
            if (cardType == CardType.UNKNOWN)
            {
                throw new UserDataException("Wrong type card", cardType.ToString());
            }

            IList <Card> allCards = GetCards().ToList();

            var cardNumber = _businessLogicService.GenerateNewCardNumber(cardType);

            _businessLogicService.ValidateCardExist(allCards, shortCardName, cardNumber);

            var newCard = new Card
            {
                CardNumber = cardNumber,
                CardName   = shortCardName,
                Currency   = currency,
                CardType   = cardType
            };

            _cardRepository.Add(newCard);
            _cardRepository.Save();

            var transaction = _businessLogicService.AddBonusOnOpen(newCard);

            _transactionRepository.Add(transaction);
            _transactionRepository.Save();

            return(newCard);
        }
        private CardDetails GetCardDetails(CardType card)
        {
            var cardDetails = new CardDetails {
                Card = card.ToString()
            };

            switch (card)
            {
            case CardType.None:
                cardDetails.CardDisplay = "no credit cards are available";
                break;

            case CardType.Vanquis:
                cardDetails.CardDisplay = "Vanquis";
                cardDetails.CardPromo   = "easy to get accepted and a reasonable APR";
                cardDetails.CardAPR     = "17.9% APR";
                break;

            case CardType.Barclaycard:
                cardDetails.CardDisplay = "Barclaycard";
                cardDetails.CardPromo   = "a card for the more distinguished applicant offering industry leading rates";
                cardDetails.CardAPR     = "12.9% APR";
                break;
            }

            return(cardDetails);
        }
 public bool SetInitParamValue(string name, object value)
 {
     if (name == _initParamNames[0])
     {
         CardType ct = (CardType)value;
         if (ct == CardType.PCI_Unknown)
         {
             _initErrorInfo = "初始化参数 \"" + name + "\" 为无效值:" + ct.ToString();
             return(false);
         }
         _initErrorInfo = "Succes! setinitparam:" + name;
         _cardType      = ct;
         return(true);
     }
     else if (name == _initParamNames[1])
     {
         _cardIndex     = (int)value;
         _initErrorInfo = "Succes! setinitparam:" + name;
         return(true);
     }
     else
     {
         throw new ArgumentException("不支持的初始化参数名:" + name);
     }
 }
Beispiel #9
0
 public NewPaymentEventArgs(CardType cardType, int customerID, double paymentAmount, int paymentID)
 {
     this.cardType      = cardType.ToString();
     this.customerID    = customerID;
     this.paymentAmount = paymentAmount;
     this.paymentID     = paymentID;
 }
Beispiel #10
0
    // Use this for initialization
    void Start()
    {
        // initialize and fill predictVector
        debug = false;

        border.renderer.enabled = false;
        //type = CardType.NONE;
        name = type.ToString();
        this.transform.localScale  = new Vector3(width, .5f, height);
        this.transform.eulerAngles = new Vector3(0, 0, 0);

        // updatePrediction(CardType.ZEUS, 1);
        // updatePrediction(CardType.ARGUS, 1);
        // updatePrediction(CardType.DIONYSUS, 2);
        // updatePrediction(CardType.HADES, 1);
        // updatePrediction(CardType.MEDUSA, 4);
        // updatePrediction(CardType.PANDORA, 1);
        // updatePrediction(CardType.PEGASUS, 9);
        // updatePrediction(CardType.PERSEPHONE, 1);
        // updatePrediction(CardType.PYTHIA, 2);
        // updatePrediction(CardType.SIRENS, 1);
        // updatePrediction(CardType.HERO, 5);
        // updatePrediction(CardType.POSEIDON, 1);
        // updatePrediction(CardType.APOLLO, 2);
        // updatePrediction(CardType.GIANT, 3);
        // updatePrediction(CardType.CYCLOPS, 4);
        // updatePrediction(CardType.CENTAUR, 5);
    }
Beispiel #11
0
        public void OutCard(OneSide oneSide, CardType cardType, int cardNum, int cardid)
        {
            LogHelper.DebugLog(oneSide.AccountID + " outcard:" + cardType.ToString() + cardNum);
            lock (BattleLock)
            {
                Card card = oneSide.Cards.FirstOrDefault(c => c.Type == cardType && c.Num == cardNum && c.ID == cardid);
                if (card == null)
                {
                    return;//操作无效,长时间会被超时处理
                }
                Battle.Step = BattleCommand.HandOutCardBack;
                if (oneSide.Step == BattleCommand.HandOutCardBack)
                {
                    return;
                }
                oneSide.Step = Battle.Step;

                oneSide.Cards.Remove(card);
                oneSide.OutCards.Add(card);
                oneSide.TakeOutCard = card;
                foreach (var s in Battle.Sides)
                {
                    if (s == oneSide)
                    {
                        continue;
                    }
                    s.TakeOutCard = null;
                }
                NoticeOutCard();
            }
        }
Beispiel #12
0
        private static string GetImage(int number, CardType cardType)
        {
            string image = "_of_" + cardType.ToString().ToLowerInvariant();

            if (number <= 10)
            {
                image = number.ToString() + image;
            }
            else if (number == 11)
            {
                image = "jack" + image + "2";
            }
            else if (number == 12)
            {
                image = "queen" + image + "2";
            }
            else if (number == 13)
            {
                image = "king" + image + "2";
            }
            else if (number == 14)
            {
                image = "ace" + image;
            }

            image += ".png";

            return(image);
        }
 public static string CardTypeConverter(CardType type)
 {
     if (type == CardType.HERO_POWER)
     {
         return("Hero Power");
     }
     return(CultureInfo.InvariantCulture.TextInfo.ToTitleCase(type.ToString().ToLower().Replace("_", "")));
 }
Beispiel #14
0
        public static char GetSymbol(this CardType value)
        {
            var type         = typeof(CardType);
            var memInfo      = type.GetMember(value.ToString());
            var cardAttrbute = (CardSymbolAttribute)memInfo[0].GetCustomAttributes(typeof(CardSymbolAttribute), false).First();

            return(cardAttrbute.Symbol);
        }
Beispiel #15
0
 public Card(Suit suit, CardType type)
 {
     this.Name = type.ToString();
     this.Type = type;
     this.Suit = suit;
     SetCardValue(type);
     SetCardOrdinal(type);
 }
Beispiel #16
0
        /// <summary>
        /// 更新卡券字段(特殊卡券更新。包括共有的基础字段和私有字段)
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="cardId"></param>
        /// <param name="cardType">卡券类型</param>
        /// <param name="pik">字段键值对</param>
        /// <returns></returns>
        public static ErrorEntity UpdateCardField(string accessToken, string cardId, CardType cardType, Dictionary <Enum, object> pik)
        {
            var dic = new Dictionary <string, object>();

            dic.Add("card_id", cardId);
            dic.Add(cardType.ToString().ToLower(), pik);
            return(UpdateCardField(accessToken, dic));
        }
Beispiel #17
0
        /// <summary>
        /// 更新卡券字段(只包括基础信息字段)
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="cardId"></param>
        /// <param name="cardType">卡券类型</param>
        /// <param name="bik">字段键值对</param>
        /// <returns></returns>
        public static ErrorEntity UpdateCardField(string accessToken, string cardId, CardType cardType, Dictionary <BaseInfoKey, object> bik)
        {
            var dic = new Dictionary <string, object>();

            dic.Add("card_id", cardId);
            dic.Add(cardType.ToString().ToLower(), new { base_info = bik });
            return(UpdateCardField(accessToken, dic));
        }
Beispiel #18
0
        private string GetCardName(CardType Type)
        {
            var Name = Type.ToString();

            if (Name.StartsWith("_"))
            {
                Name = Name.Replace("_", string.Empty);
            }
            return(Name);
        }
Beispiel #19
0
        public Member Member(string usernameOrId, CardType cardType = CardType.None)
        {
            var request = new RestRequest("/1/members/{username}", Method.GET);
            request.AddUrlSegment("username", usernameOrId);

            request.AddParameter("cards", cardType.ToString().ToLower());

            var member = ServiceManager.Execute<Member>(request);
            return member;
        }
        private int GetValue(CardType cardType)
        {
            var memberInfos = enumType.GetMember(cardType.ToString());

            MemberInfo enumValueMemberInfo = memberInfos.FirstOrDefault(m => m.DeclaringType == enumType);

            var valueAttributes = enumValueMemberInfo.GetCustomAttributes(typeof(CardValueAttribute), false);

            return(((CardValueAttribute)valueAttributes[0]).Value);
        }
Beispiel #21
0
 /// <summary>
 /// 回收
 /// </summary>
 public void Recycle()
 {
     Status         = CardStatus.Recycled;
     this.Deposit   = 0;
     this.Balance   = 0;
     this.ValidDate = new DateTime(2011, 1, 1);
     this.OwnerName = CardType.ToString();
     this.CarPlate  = string.Empty;
     this.Memo      = string.Empty;
 }
Beispiel #22
0
    Card CreateCardOnDeck(CardType t, CardValue v)
    {
        Card temp = Instantiate(_cardPrefab, cardDeckTransform.position, Quaternion.identity, cardDeckTransform);

        temp.Type   = t;
        temp.Value  = v;
        temp.IsOpen = false;
        temp.CalcPoint();
        temp.name = t.ToString() + "_" + v.ToString();
        return(temp);
    }
Beispiel #23
0
        public CardAsciiBuilder Type(CardType cardType)
        {
            var oneChar = cardType.ToString().ToCharArray()[0];

            if (cardType == CardType.SPELL)
            {
                oneChar = 'S';
            }
            _generatedcard[0][5] = oneChar;
            return(this);
        }
Beispiel #24
0
 public override string ToString()
 {
     if (type == CardType.Locomotive)
     {
         return("Locomotive");
     }
     else
     {
         return(color.ToString() + " " + type.ToString());
     }
 }
Beispiel #25
0
 public Card(Suit suit, CardType type, bool givesNobs, int x, int y)
 {
     this.Type = type;
     this.Suit = suit;
     this.Name = type.ToString() + " of " + suit.ToString();
     SetCardValue(type);
     SetCardOrdinal(type);
     this.GivesNobs = givesNobs;
     SpriteX        = x;
     SpriteY        = y;
 }
Beispiel #26
0
        public void SetSpecialType(int special)
        {
            if (SpecialType == null)
            {
                return;
            }
            CardType type = (CardType)special;

            SpecialType.spriteName = type.ToString();
            SpecialType.MakePixelPerfect();
            SpecialType.gameObject.SetActive(true);
        }
Beispiel #27
0
		public static string CardTypeConverter(CardType type)
		{
			switch(type)
			{
				case CardType.ABILITY:
					return "Spell";
				case CardType.HERO_POWER:
					return "Hero Power";
				default:
					return CultureInfo.InvariantCulture.TextInfo.ToTitleCase(type.ToString().ToLowerInvariant());
			}
		}
Beispiel #28
0
        /// <summary>
        /// Check if card exists or not
        /// </summary>
        /// <param name="num"></param>
        /// <param name="cardType"></param>
        /// <returns></returns>
        public bool CheckCardExists(int num, CardType cardType)
        {
            string k = string.Format("{0}{1}", num, cardType.ToString());

            for (int i = 0; i < DeckOfCards.Count; i++)
            {
                if (DeckOfCards[i].id == k)
                {
                    return(true);
                }
            }
            return(false);
        }
Beispiel #29
0
        public static string ToString(CardType type, CardSuit suit)
        {
            int t = (int)type;

            if (t < 10)
            {
                return(t.ToString() + suit.ToString());
            }
            else
            {
                return(type.ToString() + suit.ToString());
            }
        }
Beispiel #30
0
        protected override string GetLineTypeSriteName(int line, CardType cardType)
        {
            string typeName;

            if (line == 0 && cardType == CardType.santiao)
            {
                typeName = "chongsan";
            }
            else
            {
                typeName = cardType.ToString();
            }
            return(typeName);
        }
        public static string CardTypeConverter(CardType type)
        {
            switch (type)
            {
            case CardType.ABILITY:
                return("Spell");

            case CardType.HERO_POWER:
                return("Hero Power");

            default:
                return(CultureInfo.InvariantCulture.TextInfo.ToTitleCase(type.ToString().ToLowerInvariant()));
            }
        }
Beispiel #32
0
 private void LoadCards(List <Card> cards, CardType type)
 {
     using (StreamReader reader = new StreamReader("decks/" + Name + "/" + type.ToString().ToLower()))
     {
         while (!reader.EndOfStream)
         {
             string card = reader.ReadLine();
             if (card != string.Empty)
             {
                 cards.Add(new Card(card, type, this));
             }
         }
     }
 }
		public static string CardTypeConverter(CardType type)
		{
			if(type == CardType.HERO_POWER)
				return "Hero Power";
			return CultureInfo.InvariantCulture.TextInfo.ToTitleCase(type.ToString().ToLower().Replace("_", ""));
		}
		public static string CardTypeConverter(CardType type)
		{
			return CultureInfo.InvariantCulture.TextInfo.ToTitleCase(type.ToString().ToLower().Replace("_", ""));
		}
Beispiel #35
0
 public static string ToString(CardType type, CardSuit suit)
 {
     int t = (int)type;
     if (t < 10)
         return t.ToString() + suit.ToString();
     else
         return type.ToString() + suit.ToString();
 }
Beispiel #36
0
    public void SetType(CardType cardType)
    {
        this.type = cardType;
        this.name = type.ToString();
        this.title = type.ToString();
        if (this.title == "PERSEPHONE") this.title = "PERSEPH";

        switch(type) {
            /*
            case CardType.HERA:
                this.strength = -1;
                this.special = true;
                break;
            case CardType.IO:
                this.strength = 0;
                this.special = true;
                break;
            case CardType.AMAZON:
                this.strength = 2;
                this.special = true;
                break;
            case CardType.NEMESIS:
                this.strength = 7;
                this.special = false;
                break;
            case CardType.ARTEMIS:
                this.strength = 6;
                this.special = false;
                break;
            case CardType.HYDRA:
                this.strength = 5;
                this.special = false;
                break;
            case CardType.HARPY:
                this.strength = 4;
                this.special = false;
                break;
            case CardType.FURY:
                this.strength = 3;
                this.special = false;
                break;
                */
            case CardType.ZEUS:
                this.strength = -1;
                this.special = true;
                break;
            case CardType.ARGUS:
                this.strength = 0;
                this.special = true;
                break;
            case CardType.HERO:
                this.strength = 2;
                this.special = true;
                break;
            case CardType.POSEIDON:
                this.strength = 7;
                this.special = false;
                break;
            case CardType.APOLLO:
                this.strength = 6;
                this.special = false;
                break;
            case CardType.GIANT:
                this.strength = 5;
                this.special = false;
                break;
            case CardType.CYCLOPS:
                this.strength = 4;
                this.special = false;
                break;
            case CardType.CENTAUR:
                this.strength = 3;
                this.special = false;
                break;
            case CardType.DIONYSUS:
                this.strength = -1;
                this.special = true;
                break;
            case CardType.HADES:
                this.strength = -1;
                this.special = true;
                break;
            case CardType.MEDUSA:
                this.strength = 0;
                this.special = true;
                break;
            case CardType.PANDORA:
                this.strength = 0;
                this.special = true;
                break;
            case CardType.PEGASUS:
                this.strength = 1;
                this.special = true;
                break;
            case CardType.PERSEPHONE:
                this.strength = -1;
                this.special = true;
                break;
            case CardType.PYTHIA:
                this.strength = 0;
                this.special = true;
                break;
            case CardType.SIRENS:
                this.strength = -1;
                this.special = true;
                break;
            default:
                this.title = "ERROR";
                this.strength = -1;
                this.special = false;
                break;
        }

        subValue = strength;

        titleText.text = this.title;
        strengthText.text = (this.strength == -1) ? " " : this.strength.ToString();
        specialText.text = (this.special) ? "X" : " ";
    }
 protected VillageRandomizer(CardType type, string name, params string[] additionalTags)
     : base(type, name, new[] { type.ToString() }.Concat(additionalTags).ToArray())
 {
 }
		public static string CardTypeConverter(CardType type) => type == CardType.HERO_POWER ? "Hero Power" : CultureInfo.InvariantCulture.TextInfo.ToTitleCase(type.ToString().ToLowerInvariant().Replace("_", ""));