Beispiel #1
0
    // 发牌,nextTurn升序一人一张轮着发
    public void Deal()
    {
        // 发五轮
        for (int k = 0; k < 5; k++)
        {
            // 共多少玩家
            for (int j = 0; j < playerCount; j++)
            {
                // 从牌库抽一张牌
                int index = Random.Range(1, libraryList.Count);
                Debug.Log("抽第" + index + "张,当前剩余" + libraryList.Count);

                CardAttribute card = libraryList[index];
                Debug.Log("[Player" + nextTurn + "]抽到 " + card.cardid);

                // 把牌放入玩家手中
                playerList[nextTurn].handCardsList.Add(card);

                // 把牌从牌库中移除
                libraryList.Remove(card);

                // 下一轮
                Debug.Log("----- 下一轮 -----");
                nextTurn++;
                if (nextTurn > playerCount - 1)
                {
                    nextTurn = 0;
                }
            }
        }

        ///TODO: 如果牌库不足10张,执行洗牌
    }
Beispiel #2
0
    public void CreateAttribute(CardAttribute.Type type, int value1)
    {
        GameObject    newAttribute = Instantiate(attributePrefab, attributeHolder.position, Quaternion.identity, attributeHolder);
        CardAttribute attribute    = newAttribute.GetComponent <CardAttribute>();

        switch (type)
        {
        case CardAttribute.Type.Damage:

            attribute.Setup(attributeIcons[0], value1.ToString(), FightManager.instance.damageColor);
            break;

        case CardAttribute.Type.Heal:

            attribute.Setup(attributeIcons[1], value1.ToString(), FightManager.instance.healColor);
            break;

        case CardAttribute.Type.SpellPower:

            if (value1 > 0)
            {
                attribute.Setup(attributeIcons[5], value1.ToString(), FightManager.instance.healColor);
            }
            else
            {
                attribute.Setup(attributeIcons[5], value1.ToString(), FightManager.instance.damageColor);
            }
            break;

        case CardAttribute.Type.StealCard:

            attribute.Setup(attributeIcons[7], value1.ToString(), FightManager.instance.healColor);
            break;
        }
    }
Beispiel #3
0
    private void RandomSelectCardsSetter(TeamColor teamColor)
    {
        numbers = new List <int>();

        for (int i = start; i < end; i++)
        {
            numbers.Add(i);
        }

        System.Random rnd = new System.Random();

        for (int i = 0; i < 5; i++)
        {
            Debug.Log("Size" + numbers.Count);
            int index = rnd.Next(numbers.Count);
            int num   = numbers[index];
            numbers.RemoveAt(index);

            Debug.Log(index);

            CardAttribute cardAttribute = new CardAttribute();
            cardAttribute.Top       = int.Parse(_csvDatas[num + 1][0]);
            cardAttribute.Right     = int.Parse(_csvDatas[num + 1][1]);
            cardAttribute.Bottom    = int.Parse(_csvDatas[num + 1][2]);
            cardAttribute.Left      = int.Parse(_csvDatas[num + 1][3]);
            cardAttribute.TeamColor = teamColor;

            DataSender.Instance.data.AddSelectCardList(cardAttribute);
        }
    }
    public CardConstant(ushort cardIndex, byte[] bytes)
    {
        this.Index          = cardIndex;
        this.Name           = Cards.GetNameByIndex(cardIndex);
        this.bytes          = bytes;
        this.kind           = bytes[0];
        this.cardKind       = new CardKind(this.kind);
        this.kindOfs        = bytes[1];
        this.levelAttribute = new BitArray(new byte[] { bytes[2] });
        this.level          = bytes[2].splitByte()[1];
        this.attribute      = new CardAttribute(bytes[2].splitByte()[0]);
        this.DeckCost       = bytes[3];
        this.effectId       = BitConverter.ToUInt16(new byte[] { bytes[4], bytes[5] }, 0);
        this.xaxId          = BitConverter.ToUInt16(new byte[] { bytes[6], bytes[7] }, 0);

        this.apWithFlags            = new BitArray(new byte[] { bytes[8], bytes[9] });
        this.attack                 = CardConstant.GetAttackOrDefense(new byte[] { bytes[8], bytes[9] });
        this.hasImage               = apWithFlags[apWithFlags.Length - 3];
        this.passwordWorks          = apWithFlags[apWithFlags.Length - 2];
        this.appearsInReincarnation = apWithFlags[apWithFlags.Length - 1];

        this.dpWithFlags        = new BitArray(new byte[] { bytes[10], bytes[11] });
        this.defense            = CardConstant.GetAttackOrDefense(new byte[] { bytes[10], bytes[11] });
        this.appearsInSlotReels = dpWithFlags[dpWithFlags.Length - 3];
        this.isSlotRare         = dpWithFlags[dpWithFlags.Length - 2];

        this.hasAlternateArt = dpWithFlags[dpWithFlags.Length - 1];
        this.passwordArray   = new byte[] { bytes[12], bytes[13], bytes[14], bytes[15], bytes[16], bytes[17], bytes[18], bytes[19] };
        this.setCardColor();
    }
Beispiel #5
0
    //隣り合うカードと比較 コンボ
    private void CompareCombo(int targetCardIndex)
    {
        int row = targetCardIndex / _gridNum;
        int col = targetCardIndex % _gridNum;

        Debug.Log(row + " " + col);

        CardAttribute targetCardAttribute = _cardAttributeOnTileArray[col, row].CardAttribute;

        //righit
        if (col + 1 < _gridNum && _cardAttributeOnTileArray[col + 1, row] != null)
        {
            CardAction rightCard = _cardAttributeOnTileArray[col + 1, row];


            if (targetCardAttribute.Right > rightCard.CardAttribute.Left && targetCardAttribute.TeamColor != rightCard.CardAttribute.TeamColor)
            {
                ChangeNextCardColor(targetCardAttribute, rightCard);
                StartCoroutine(ComboWaitCoRoutine(targetCardIndex + 1));
            }
        }

        //left
        if (col - 1 >= 0 && _cardAttributeOnTileArray[col - 1, row] != null)
        {
            CardAction leftCard = _cardAttributeOnTileArray[col - 1, row];


            if (targetCardAttribute.Left > leftCard.CardAttribute.Right && targetCardAttribute.TeamColor != leftCard.CardAttribute.TeamColor)
            {
                ChangeNextCardColor(targetCardAttribute, leftCard);
                StartCoroutine(ComboWaitCoRoutine(targetCardIndex - 1));
            }
        }

        //top
        if (row + 1 < _gridNum && _cardAttributeOnTileArray[col, row + 1] != null)
        {
            CardAction topCard = _cardAttributeOnTileArray[col, row + 1];

            if (targetCardAttribute.Top > topCard.CardAttribute.Bottom && targetCardAttribute.TeamColor != topCard.CardAttribute.TeamColor)
            {
                ChangeNextCardColor(targetCardAttribute, topCard);
                StartCoroutine(ComboWaitCoRoutine(targetCardIndex + _gridNum));
            }
        }

        //bottom
        if (row - 1 >= 0 && _cardAttributeOnTileArray[col, row - 1] != null)
        {
            CardAction bottomCard = _cardAttributeOnTileArray[col, row - 1];


            if (targetCardAttribute.Bottom > bottomCard.CardAttribute.Top && targetCardAttribute.TeamColor != bottomCard.CardAttribute.TeamColor)
            {
                ChangeNextCardColor(targetCardAttribute, bottomCard);
                StartCoroutine(ComboWaitCoRoutine(targetCardIndex - _gridNum));
            }
        }
    }
Beispiel #6
0
    public int nextTurn = 0; //流程控制,当前出牌玩家id
    public void Deal()
    {
        // 发五轮
        for (int k = 0; k < 5; k++)
        {
            // 共多少玩家
            for (int j = 0; j < playerCount; j++)
            {
                // 从牌库抽一张牌
                int index = Random.Range(1, libraryList.Count);

                CardAttribute card = libraryList[index];

                // 把牌放入玩家手中
                playerList[nextTurn].handCardsList.Add(card);

                // 把牌从牌库中移除
                libraryList.Remove(card);

                // 下一轮
                //Debug.LogFormat("玩家{0} - 第{1}轮 - 抽第{2}张 - 当前剩余{3}", j, k, index, libraryList.Count);
                nextTurn++;
                if (nextTurn > playerCount - 1)
                {
                    nextTurn = 0;
                }
            }
        }

        ///TODO: 如果牌库不足10张,执行洗牌
    }
Beispiel #7
0
    public void CreateAttribute(CardAttribute.Type type, int value1, Character target)
    {
        GameObject    newAttribute = Instantiate(attributePrefab, attributeHolder.position, Quaternion.identity, attributeHolder);
        CardAttribute attribute    = newAttribute.GetComponent <CardAttribute>();

        switch (type)
        {
        case CardAttribute.Type.Draw:

            if (side == Side.Enemy && target == FightManager.instance.enemy)
            {
                attribute.Setup(attributeIcons[6], value1.ToString(), FightManager.instance.healColor);
            }
            if (side == Side.Enemy && target == FightManager.instance.player)
            {
                attribute.Setup(attributeIcons[6], value1.ToString(), FightManager.instance.damageColor);
            }

            if (side == Side.Player && target == FightManager.instance.enemy)
            {
                attribute.Setup(attributeIcons[6], value1.ToString(), FightManager.instance.damageColor);
            }
            if (side == Side.Player && target == FightManager.instance.player)
            {
                attribute.Setup(attributeIcons[6], value1.ToString(), FightManager.instance.healColor);
            }
            break;
        }
    }
Beispiel #8
0
 public string GetCardRace()
 {
     if (this.m_cardRace != null)
     {
         return(this.m_cardRace);
     }
     CardRace[] raceArray = new CardRace[] {
         CardRace.Warrior, CardRace.SpellCaster, CardRace.Fairy, CardRace.Fiend, CardRace.Zombie, CardRace.Machine, CardRace.Aqua, CardRace.Pyro, CardRace.Rock, CardRace.WindBeast, CardRace.Plant, CardRace.Insect, CardRace.Thunder, CardRace.Dragon, CardRace.Beast, CardRace.BestWarrior,
         CardRace.Dinosaur, CardRace.Fish, CardRace.SeaSerpent, CardRace.Reptile, CardRace.Psycho, CardRace.DivineBeast
     };
     CardAttribute[] attributeArray = new CardAttribute[] { CardAttribute.Dark, CardAttribute.Divine, CardAttribute.Earth, CardAttribute.Fire, CardAttribute.Light, CardAttribute.Water, CardAttribute.Wind };
     foreach (CardRace race in raceArray)
     {
         if ((this.Race & (int)race) != 0)
         {
             this.m_cardRace = race.ToString();
             break;
         }
     }
     foreach (CardAttribute attribute in attributeArray)
     {
         if ((this.Attribute & (int)attribute) != 0)
         {
             this.m_cardRace = this.m_cardRace + " - " + attribute;
             break;
         }
     }
     return(this.m_cardRace ?? (this.m_cardRace = ""));
 }
Beispiel #9
0
 private double GetCardUpgradeVale(CardAttribute cardAttribute, int internalUpgradeLevel)
 {
     return(_cardUpgrades.Where(cu => cu.UpgradeFrom < internalUpgradeLevel)
            .SelectMany(cu => cu.CardAttributeUpgrades)
            .Where(c => c.CardAttribute == cardAttribute)
            .Sum(c => c.Value));
 }
Beispiel #10
0
    // 洗牌
    public void Shuffle()
    {
        // 重置
        libraryList.Clear();
        deskList.Clear();
        for (int i = 0; i < playerList.Count; i++)
        {
            playerList[i].handCardsList.Clear();
        }

        //哈希不重复的随机数
        System.Random id        = new System.Random();
        Hashtable     hashtable = new Hashtable();

        for (int i = 0; hashtable.Count < cardCount; i++) //取值范围1-52
        {
            int nValue = id.Next(cardCount + 1);
            if (!hashtable.ContainsValue(nValue) && nValue != 0)
            {
                hashtable.Add(nValue, nValue);
                CardAttribute card = new CardAttribute()
                {
                    cardid = nValue, //1-10 / 11->10 / 12->10 / 13->10
                };
                card.SerializeCard();
                libraryList.Add(card);
            }
        }
    }
Beispiel #11
0
    private void ChangeNextCardColor(CardAttribute target, CardAction next)
    {
        next.CardAttribute.TeamColor = target.TeamColor;

        isFripping = true;
        next.FripCard(target.TeamColor);
    }
        public CardAttributeValue(CardAttribute _cardAttribute, Card _card)
        {
            cardAttribute = _cardAttribute;
            card = _card;

            cardAttribute.AttributeValues.Add(this);
            card.AttributeValues.Add(this);
        }
Beispiel #13
0
 public CardData(string name, CardVariety variety, string grade, string description, CardAttribute attribute, List <CardSkill> skills)
 {
     cardName        = name;
     cardVariety     = variety;
     cardGrade       = grade;
     cardDescription = description;
     cardAttribute   = attribute;
     cardSkills      = skills;
 }
    private void OnGUI()
    {
        if (!_isInit)
        {
            return;
        }

        GUILayout.BeginVertical();
        GUILayout.Label("Card Attribute Editor", EditorStyles.boldLabel);

        GUILayout.Space(15);

        E.Dropdown("Select Attribute", ref _selectedAttribute, DropdownOptions, (oldAttr, newAttr) =>
        {
            if (newAttr == "None")
            {
                _attribute = null;
            }
            else if (oldAttr != newAttr)
            {
                _attribute = (CardAttribute)CreateInstance(AttributeMap[newAttr]);
                if (_attribute is Ability a)
                {
                    a.Actions.Add(new ActionDefinition());
                }
            }
        });

        GUILayout.Space(10);

        if (_attribute != null)
        {
            var editor = Editor.CreateEditor(_attribute);

            if (editor is IValidator validator)
            {
                _isValid = validator.IsValid();
            }

            editor.OnInspectorGUI();
        }

        if (!_isValid || _attribute == null)
        {
            GUI.enabled = false;
        }

        E.Button("Create", E.Colors.Action, () =>
        {
            _callback.Invoke(_attribute);
            Close();
        });

        GUI.enabled = true;
        GUILayout.EndVertical();
    }
Beispiel #15
0
    protected int GetAttribute(string name)
    {
        CardAttribute attribute = m_attributes.Find(attrib => attrib.name == name);

        if (attribute != null)
        {
            return(attribute.value);
        }
        return(0);
    }
Beispiel #16
0
 /// <summary>设置卡牌属性值</summary>
 private void SetAttributeValue(CardAttribute attribute)
 {
     int[] value = new int[] { attribute.attackValue, attribute.defenseValue, attribute.evasionValue, attribute.critValue };
     for (int j = 0; j < value.Length; j++)
     {
         for (int i = 0; i < value[j]; i++)
         {
             attributeValue[j, i].SetActive(i <= value[j] ? true : false);
         }
     }
 }
Beispiel #17
0
 public Card(CardAttribute _CA, string _name, int _hp, int _damage, float _attact_interval, AttactAttribute _AA, float _range, float _speed, int _cost)
 {
     CA              = _CA;
     name            = _name;
     hp              = _hp;
     damage          = _damage;
     attact_interval = _attact_interval;
     AA              = _AA;
     range           = _range;
     speed           = _speed;
     cost            = _cost;
 }
    public void InitData(CardAttribute data)
    {
        cardAttribute = data;

        string combName = (data.cardColor.ToString().ToLower() + "" + (data.cardNum > 0 ? "+" : "") + (int)data.cardNum);
        //Debug.Log(combName);

        //var array = cardArray.Where(x => x.name == combName).ToList();
        //Debug.Log(array.Count);
        var sp = cardArray.First(x => x.name == combName);

        mMainSP.sprite = sp;
    }
 public DummyShaVerifier(Player t, CardHandler shaType, CardAttribute helper = null)
 {
     target      = t;
     type        = shaType;
     this.helper = helper;
     dummyCards  = new List <Card>()
     {
         new Card()
         {
             Type = shaType, Place = new DeckPlace(null, DeckType.None)
         }
     };
 }
Beispiel #20
0
    //対応するリストから削除
    public void RemoveSelectCardList(CardAttribute cardAttribute)
    {
        switch (cardAttribute.TeamColor)
        {
        case TeamColor.RED:
            _selectCardListRed.Remove(cardAttribute);
            break;

        case TeamColor.BLUE:
            _selectCardListBlue.Remove(cardAttribute);
            break;
        }
    }
Beispiel #21
0
    void ShowCardAttributes()
    {
        // Display Card Attributes label with an "Add" button
        EditorGUILayout.BeginHorizontal();
        {
            EditorGUILayout.LabelField("Card Attributes:");
            // Add new attribute button
            if (GUILayout.Button("+", GUILayout.Width(20)))
            {
                CardAttribute newAttrib = new CardAttribute();
                newAttrib.name  = "NewAttribute";
                newAttrib.value = 0;
                m_currentCard.cardAttributes.Add(newAttrib);
            }
        }
        EditorGUILayout.EndHorizontal();

        // Display each attribute
        EditorGUI.indentLevel++;
        m_attribScrollPos = EditorGUILayout.BeginScrollView(m_attribScrollPos, GUILayout.Height(170));
        int attribCount = m_currentCard.cardAttributes.Count;

        for (int i = 0; i < attribCount; i++)
        {
            CardAttribute attrib = m_currentCard.cardAttributes[i];

            // Display attribute number with a "Remove" button
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.LabelField((i + 1).ToString());
                if (GUILayout.Button("-", GUILayout.Width(20)))
                {
                    // Remove the attribute and continue to the next one
                    // Removing attribute within for loop is a bit dodgy so be careful here
                    m_currentCard.cardAttributes.RemoveAt(i);
                    attribCount--;  // Decrement attribute count, do not increment i
                    continue;
                }
            }
            EditorGUILayout.EndHorizontal();

            // Show the attribute data
            EditorGUI.indentLevel++;
            attrib.name  = EditorGUILayout.TextField("Name:", attrib.name);
            attrib.value = int.Parse(EditorGUILayout.TextField("Value:", attrib.value.ToString()));
            EditorGUI.indentLevel--;
        }
        EditorGUILayout.EndScrollView();
        EditorGUI.indentLevel--;
    }
Beispiel #22
0
    //打出一张牌,抽一张牌
    public void DealOnce(int chair_id)
    {
        if (playerList[chair_id].handCardsList.Count < 5)
        {
            // 从牌库抽一张牌
            int index = Random.Range(1, libraryList.Count);

            CardAttribute card = libraryList[index];

            // 把牌放入玩家手中
            playerList[chair_id].handCardsList.Add(card);

            // 把牌从牌库中移除
            libraryList.Remove(card);
        }
    }
Beispiel #23
0
    public void CreateAttribute(CardAttribute.Type type, int value1, int value2)
    {
        GameObject    newAttribute = Instantiate(attributePrefab, attributeHolder.position, Quaternion.identity, attributeHolder);
        CardAttribute attribute    = newAttribute.GetComponent <CardAttribute>();

        switch (type)
        {
        case CardAttribute.Type.DOT:

            attribute.Setup(attributeIcons[2], value1.ToString(), attributeIcons[3], value2.ToString(), FightManager.instance.damageColor);
            break;

        case CardAttribute.Type.HOT:

            attribute.Setup(attributeIcons[1], value1.ToString(), attributeIcons[3], value2.ToString(), FightManager.instance.healColor);
            break;
        }
    }
Beispiel #24
0
        public CardAttributeViewModel(ICardGameDataStore cardGameDataStore, IDialogService dialogService, Guid cardTypeId, CardAttribute original, Action cancelEdit, Action updated)
        {
            _dialogService      = dialogService ?? throw new ArgumentNullException(nameof(dialogService));
            _cardGameDataStore  = cardGameDataStore ?? throw new ArgumentNullException(nameof(cardGameDataStore));
            _original           = original ?? throw new ArgumentNullException(nameof(original));
            _cardTypeId         = cardTypeId;
            _cancelEdit         = cancelEdit;
            _existingAttributes = _cardGameDataStore.GetCardAttributes(_cardTypeId);
            _isDeleted          = false;
            Name = _original.Name ?? String.Empty;

            PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == nameof(HasChanges))
                {
                    updated?.Invoke();
                }
            };
        }
Beispiel #25
0
    public void SetAttribute(string name, int value)
    {
        // If the attribute already exists, set it
        foreach (CardAttribute attrib in cardAttributes)
        {
            if (attrib.name == name)
            {
                attrib.value = value;
                return;
            }
        }

        // If the attribute doesn't exist, create it
        CardAttribute attribute = new CardAttribute();

        attribute.name  = name;
        attribute.value = value;

        cardAttributes.Add(attribute);
    }
    public void Callback(CardAttribute card)
    {
        Debug.Log("出牌:" + card.cardColor + " - " + card.cardNum);

        //TODO:让对应颜色的乌龟走移动 //考虑彩色(可选)和最慢(可选)
        //runnerList.FirstOrDefault(x => x.mColor == card.cardColor);
        if (card.cardColor == CardColor.Slow)
        {
            //找最慢的array(1-5种)
        }
        else if (card.cardColor == CardColor.Color)
        {
            //任意颜色(5种)
        }
        else
        {
            //指定颜色(1种)
        }

        //TODO:再抽一张牌
    }
Beispiel #27
0
    // Start is called before the first frame update
    void Start()
    {
        //csvにカードの強さ情報入ってるよ
        _csvFile = Resources.Load("CardData") as TextAsset;
        StringReader reader = new StringReader(_csvFile.text);

        while (reader.Peek() != -1)
        {
            string line = reader.ReadLine();
            _csvDatas.Add(line.Split(','));
        }

        for (int i = 1; i <= _cardNum; i++)
        {
            // select画面のカード生む
            _cardAction = Instantiate <CardAction>(_cardPrefab, _cardsObject.transform);
            CardAttribute cardAttribute = _cardAction.CardAttribute;

            //強さとTextセット
            cardAttribute.Top    = int.Parse(_csvDatas[i][0]);
            cardAttribute.Right  = int.Parse(_csvDatas[i][1]);
            cardAttribute.Bottom = int.Parse(_csvDatas[i][2]);
            cardAttribute.Left   = int.Parse(_csvDatas[i][3]);
            _cardAction.CardTextSet();

            //チームカラー
            _cardAction.CardAttribute.TeamColor = _cardManager.TeamColor;

            //まだ選択されてない
            _cardAction.IsSelect = false;

            _cardAction.Initialize(_cardManager, _buttonAction);

            //クリックとドラッグ
            _cardAction.SetOnClickCallback();
            _cardAction.SwichCardDragEnable(false);

            _cardManager.AddCardList(_cardAction.CardAttribute);
        }
    }
Beispiel #28
0
    public void OnSummon(CardInfo info)
    {
        cardName     = info.cardName;
        element      = info.element;
        HP           = new CardAttribute(info.HP);
        currHP       = HP.value;
        attack       = new CardAttribute(info.attack);
        defense      = new CardAttribute(info.defense);
        magicAttack  = new CardAttribute(info.magicAttack);
        magicDefense = new CardAttribute(info.magicDefense);
        speed        = new CardAttribute(info.speed);
        lucky        = new CardAttribute(info.lucky);
        skills       = info.skills;
        anim         = info.anim;

        isDead = false;
        foreach (Buff bf in info.persistence)
        {
            bf.user   = this;
            bf.target = this;
            bf.OnOccur();
        }
    }
Beispiel #29
0
        public void SaveCardAttribute(Guid cardTypeId, CardAttribute attribute)
        {
            var attributeData = _cardGameData.CardAttributes.SingleOrDefault(ca => ca.Id == attribute.Id);

            if (attributeData == null)
            {
                attributeData = new JsonCardAttribute
                {
                    Id         = attribute.Id,
                    Type       = attribute.Type,
                    CardTypeId = cardTypeId
                };
                _cardGameData.CardAttributes.Add(attributeData);
            }

            if (attributeData.CardTypeId != cardTypeId)
            {
                throw new InvalidOperationException("Mismatch between card type ids");
            }

            attributeData.Name = attribute.Name;
            SaveChanges();
        }
Beispiel #30
0
        //获取属性
        public static string GetAttribute(int attr)
        {
            CardAttribute cattr = (CardAttribute)attr;
            string        sattr = MseAttribute.NONE;

            switch (cattr)
            {
            case CardAttribute.ATTRIBUTE_DARK:
                sattr = MseAttribute.DARK;
                break;

            case CardAttribute.ATTRIBUTE_DEVINE:
                sattr = MseAttribute.DIVINE;
                break;

            case CardAttribute.ATTRIBUTE_EARTH:
                sattr = MseAttribute.EARTH;
                break;

            case CardAttribute.ATTRIBUTE_FIRE:
                sattr = MseAttribute.FIRE;
                break;

            case CardAttribute.ATTRIBUTE_LIGHT:
                sattr = MseAttribute.LIGHT;
                break;

            case CardAttribute.ATTRIBUTE_WATER:
                sattr = MseAttribute.WATER;
                break;

            case CardAttribute.ATTRIBUTE_WIND:
                sattr = MseAttribute.WIND;
                break;
            }
            return(sattr);
        }
Beispiel #31
0
 public void SelectAttributes(CardAttribute[] attributes)
 {
     m_attributes.Clear();
     foreach (CardAttribute attribute in attributes)
         m_attributes.Add(attribute);
 }
Beispiel #32
0
 public void SelectAttribute(CardAttribute attribute)
 {
     m_attributes.Clear();
     m_attributes.Add(attribute);
 }
Beispiel #33
0
 public bool HasAttribute(CardAttribute attribute)
 {
     return ((Attribute & (int)attribute) != 0);
 }
Beispiel #34
0
 public string GetCardRace()
 {
     if (this.m_cardRace != null)
     {
         return this.m_cardRace;
     }
     CardRace[] raceArray = new CardRace[] {
         CardRace.Warrior, CardRace.SpellCaster, CardRace.Fairy, CardRace.Fiend, CardRace.Zombie, CardRace.Machine, CardRace.Aqua, CardRace.Pyro, CardRace.Rock, CardRace.WindBeast, CardRace.Plant, CardRace.Insect, CardRace.Thunder, CardRace.Dragon, CardRace.Beast, CardRace.BestWarrior,
         CardRace.Dinosaur, CardRace.Fish, CardRace.SeaSerpent, CardRace.Reptile, CardRace.Psycho, CardRace.DivineBeast
      };
     CardAttribute[] attributeArray = new CardAttribute[] { CardAttribute.Dark, CardAttribute.Divine, CardAttribute.Earth, CardAttribute.Fire, CardAttribute.Light, CardAttribute.Water, CardAttribute.Wind };
     foreach (CardRace race in raceArray)
     {
         if ((this.Race & (int)race) != 0)
         {
             this.m_cardRace = race.ToString();
             break;
         }
     }
     foreach (CardAttribute attribute in attributeArray)
     {
         if ((this.Attribute & (int)attribute) != 0)
         {
             this.m_cardRace = this.m_cardRace + " - " + attribute;
             break;
         }
     }
     return (this.m_cardRace ?? (this.m_cardRace = ""));
 }
Beispiel #35
0
 public Sprite GetSpriteForAttribute (CardAttribute.Type type)
 {
     return Icons.First (x => x.name == CardAttribute.IconMap [type]);
 }
Beispiel #36
0
 public void SelectAttribute(CardAttribute attribute)
 {
     m_attributes.Clear();
     m_attributes.Add(attribute);
 }
Beispiel #37
0
    // todo : 弃用
    public Unit(int unitID, ChessboardPosition targetPosition)
    {
        this._curCell = Chessboard.GetCell(targetPosition);

        Skill_1 = null;
        Skill_2 = null;
        Skill_3 = null;

        switch (unitID)
        {
            case 1:
                Skill_1 = new Skill_1_1(this);
                Skill_2 = new Skill_1_2(this);
                break;
        }

        // Test
        this._sysId = "Unit_0001_01";
        this._cfg = UnitManager.getInatance().getUnitCfgBySysId(sysId);
        UnitAttribute = new CardAttribute();
        this._curHp = UnitAttribute.hp;
        this._maxHp = UnitAttribute.hp;
        //
        this.createUnitPrefab();
        Chessboard.addChildOnLayer(this._unitGo, BattleConsts.BattleFieldLayer_Unit, targetPosition.y, targetPosition.x);
        //unitSprite = new UnitUI(this, targetPosition);
        this._id = IDProvider.getInstance().applyUnitId(this);
        UnitManager.getInatance().registerUnit(this);
        this._buffList = new List<BuffDataDriven>();
        InterpreterManager.getInstance().registerLightUserData(this);
        this.setUpdateViewFlag(true);
        // 生成技能
        // test
        if ( a == 0 )
        {
            InterpreterManager.getInstance().initSkill("skill1", this);
            a = 1;
        }
        this.initAttributes();
    }
Beispiel #38
0
 public Unit(string sysId)
 {
     this._sysId = sysId;
     this._cfg = UnitManager.getInatance().getUnitCfgBySysId(sysId);
     // 先粘贴
     UnitAttribute = new CardAttribute();
     this._curHp = this._cfg.hitPoint;
     this._maxHp = this._cfg.hitPoint;
     //
     //unitSprite = new UnitUI(this, targetPosition);
     this._id = IDProvider.getInstance().applyUnitId(this);
     UnitManager.getInatance().registerUnit(this);
     this._buffList = new List<BuffDataDriven>();
     InterpreterManager.getInstance().registerLightUserData(this);
     this.initAttributes();
 }