Esempio n. 1
0
    public virtual void Use(Action callback)
    {
        if (Data.CD > 0)
        {
            CurrentCD = Data.CD + 1; //要加一是因為本回合不減CD
        }
        _skillCallback = callback;
        GetTargetList();

        _floatingNumberDic.Clear();
        if (_hasNoTarget)
        {
            SetEffect(null, _floatingNumberDic);
        }
        else
        {
            for (int i = 0; i < _targetList.Count; i++)
            {
                SetEffect(_targetList[i], _floatingNumberDic);
            }
        }

        if (IsSpellCard)
        {
            string largeImage = "";
            if (_user.JobData != null)
            {
                largeImage = _user.JobData.LargeImage;
            }
            else if (_user.EnemyData != null)
            {
                largeImage = _user.EnemyData.LargeImage;
            }

            BattleUI.Instance.ShowSpellCard(Data.GetName(), largeImage, () =>
            {
                CameraMove();
            });
        }
        else
        {
            BattleUI.Instance.SetSkillLabel(true, Data.GetName());
            CameraMove();
        }

        if (ItemID != 0)
        {
            ItemManager.Instance.MinusItem(ItemID, 1, ItemManager.Type.Bag);
        }
    }
Esempio n. 2
0
    public void SetData(SkillData.RootObject data, int lv)
    {
        NameLabel.text      = data.GetName();
        LvLabel.text        = "Lv." + lv;
        MPLabel.text        = "MP:" + data.MP;
        CDLabel.text        = "冷卻:" + data.CD;
        AddPowerLabel.text  = "增加 Power:" + data.AddPower;
        NeedPowerLabel.text = "需要 Power:" + data.NeedPower;
        CommentLabel.text   = data.GetComment();

        if (data.ValueList.Count > 0)
        {
            if (data.Type == SkillData.TypeEnum.Attack)
            {
                DamageLabel.text = "傷害:" + data.ValueList[lv - 1];
            }
            else
            {
                DamageLabel.text = "回復:" + data.ValueList[lv - 1];
            }
        }
        else
        {
            DamageLabel.text = "傷害:" + 0;
        }
        if (data.Target == SkillData.TargetType.Us)
        {
            TargetLabel.text = "目標:我方";
        }
        else if (data.Target == SkillData.TargetType.Them)
        {
            TargetLabel.text = "目標:敵方";
        }
        else if (data.Target == SkillData.TargetType.All)
        {
            TargetLabel.text = "目標:全體";
        }

        BattleStatusTitlle.gameObject.SetActive(true);
        for (int i = 0; i < BattleStatusComment.Length; i++)
        {
            if (data != null)
            {
                if (data.StatusID != 0)
                {
                    BattleStatusData.RootObject statusData = BattleStatusData.GetData(data.StatusID);
                    if ((int)statusData.ValueType <= 7)
                    {
                        BattleStatusComment[i].gameObject.SetActive(true);
                        BattleStatusComment[i].text = statusData.GetComment(lv);
                    }
                    else
                    {
                        BattleStatusComment[i].gameObject.SetActive(false);
                    }
                }
                else
                {
                    BattleStatusComment[i].gameObject.SetActive(false);
                }

                if (data.SubID != 0)
                {
                    data = SkillData.GetData(data.SubID);
                }
                else
                {
                    data = null;
                }
            }
            else
            {
                BattleStatusComment[i].gameObject.SetActive(false);
            }
        }
    }
Esempio n. 3
0
    private void SetData(SkillData.RootObject data, int lv)
    {
        _data          = data;
        NameLabel.text = data.GetName();
        NameLabel.transform.parent.gameObject.SetActive(true);
        LvLabel.text = lv.ToString();
        LvLabel.transform.parent.gameObject.SetActive(true);
        MPLabel.text = data.MP.ToString();
        MPLabel.transform.parent.gameObject.SetActive(true);
        HitRateLabel.text   = "命中:" + data.HitRate + "%";
        CDLabel.text        = "冷卻:" + data.CD;
        AddPowerLabel.text  = "增加 Power:" + data.AddPower;
        NeedPowerLabel.text = "需要 Power:" + data.NeedPower;
        CommentLabel.text   = data.GetComment();

        if (data.ValueList.Count > 0)
        {
            if (data.Type == SkillData.TypeEnum.Attack)
            {
                DamageLabel.text = "傷害:" + data.ValueList[lv - 1];
            }
            else
            {
                DamageLabel.text = "回復:" + data.ValueList[lv - 1];
            }
        }
        else
        {
            DamageLabel.text = "傷害:" + 0;
        }
        if (data.Target == SkillData.TargetType.Us)
        {
            TargetLabel.text = "目標:我方";
        }
        else if (data.Target == SkillData.TargetType.Them)
        {
            TargetLabel.text = "目標:敵方";
        }
        else if (data.Target == SkillData.TargetType.All)
        {
            TargetLabel.text = "目標:全體";
        }

        if (lv < data.MaxLv)
        {
            ItemAmountLabel.gameObject.SetActive(true);
            UpgradeButton.gameObject.SetActive(true);

            if (lv == 1)
            {
                _currentItemAmount          = ItemManager.Instance.GetItemAmount(_bookId_1, _itemManagerType);
                NeedBookLabel.text          = "初級技能書";
                NeedBookIcon.overrideSprite = Resources.Load <Sprite>("Image/Item/Book_1");
                _consumeBookId = _bookId_1;
            }
            else if (lv == 2)
            {
                _currentItemAmount          = ItemManager.Instance.GetItemAmount(_bookId_2, _itemManagerType);
                NeedBookLabel.text          = "中級技能書";
                NeedBookIcon.overrideSprite = Resources.Load <Sprite>("Image/Item/Book_2");
                _consumeBookId = _bookId_2;
            }
            else if (lv == 3)
            {
                _currentItemAmount          = ItemManager.Instance.GetItemAmount(_bookId_3, _itemManagerType);
                NeedBookLabel.text          = "高級技能書";
                NeedBookIcon.overrideSprite = Resources.Load <Sprite>("Image/Item/Book_3");
                _consumeBookId = _bookId_3;
            }

            if (_currentItemAmount < 1)
            {
                UpgradeButton.GetComponent <Image>().color = Color.gray;
                ItemAmountLabel.text = "<color=#FF0000>" + _currentItemAmount + "</color>/" + 1;
            }
            else
            {
                UpgradeButton.GetComponent <Image>().color = Color.white;
                ItemAmountLabel.text = _currentItemAmount + "/" + 1;
            }
        }
        else
        {
            ItemAmountLabel.gameObject.SetActive(false);
            UpgradeButton.gameObject.SetActive(false);
        }

        BattleStatusTitlle.gameObject.SetActive(true);

        for (int i = 0; i < BattleStatusComment.Length; i++)
        {
            BattleStatusComment[i].gameObject.SetActive(false);
        }

        for (int i = 0; i < BattleStatusComment.Length; i++)
        {
            if (data != null)
            {
                if (data.StatusID != 0)
                {
                    BattleStatusData.RootObject statusData = BattleStatusData.GetData(data.StatusID);
                    BattleStatusComment[i].gameObject.SetActive(true);
                    BattleStatusComment[i].text = statusData.GetComment(lv);
                }
                else
                {
                    i--;
                }

                if (data.SubID != 0)
                {
                    data = SkillData.GetData(data.SubID);
                }
                else
                {
                    data = null;
                }
            }
            else
            {
                break;
            }
        }
    }