Esempio n. 1
0
 void OnSkillItemClick(UISkillItem item)
 {
     if (onSkillItemClick != null)
     {
         onSkillItemClick(item);
     }
 }
Esempio n. 2
0
 void OnSkillItemLernBtn(UISkillItem item)
 {
     if (onSkillItemLernBtn != null)
     {
         onSkillItemLernBtn(item);
     }
 }
Esempio n. 3
0
    private void ShowDesc(UISkillItem skill)
    {
        currentItem = skill;
        skillDesc.SetActive(true);
        skillDesc.transform.localPosition = new Vector3(300f, skillDesc.transform.localPosition.y, skillDesc.transform.localPosition.z);
        skillDesc.GetComponent <RectTransform>().DOAnchorPos(new Vector2(-289.28f, -44.05f), 0.25f, true);

        RefreshDesc(skill);
    }
Esempio n. 4
0
    private void ShowDesc(UISkillItem skill)
    {
        currentItem = skill;
        skillDesc.SetActive(true);
        skillDesc.transform.localPosition = new Vector3(300f, skillDesc.transform.localPosition.y, skillDesc.transform.localPosition.z);
        skillDesc.GetComponent<RectTransform>().DOAnchorPos(new Vector2(-289.28f, -44.05f), 0.25f, true);

        RefreshDesc(skill);
    }
Esempio n. 5
0
    void OnSkillItemLernClick(UISkillItem item)
    {
        SKTLearnResult r = _SkillMgr.SKTLearn(item.data._skillType);

        if (r == SKTLearnResult.SKTLearnResult_DontHaveEnoughExp)
        {
            if (_curTipCooldown >= _TipCooldown)
            {
                new PeTipMsg(PELocalization.GetString(8000159), PeTipMsg.EMsgLevel.Warning, PeTipMsg.EMsgType.Misc);
                _curTipCooldown = 0;
            }
        }
    }
Esempio n. 6
0
    private void CreateSkillItem(UDSkill.Skill skill, Transform parent)
    {
        var go = Object.Instantiate(skillItem);

        go.transform.SetParent(parent);
        go.transform.localScale = Vector3.one;
        go.SetActive(true);

        UISkillItem item = new UISkillItem(go.transform);

        item.Refresh(skill);

        //add click btn
        go.AddComponent <Button>().AddListener(() => ShowDesc(item));
    }
Esempio n. 7
0
    private void InitItems()
    {
        var Skills = User.Instance.CurrentCharacter.SkillMgr.Skills;

        foreach (var skill in Skills)
        {
            if (skill.Define.Type == Common.Battle.SkillType.Skill)
            {
                GameObject  go = Instantiate(itemPrefab, this.listMain.transform);
                UISkillItem ui = go.GetComponent <UISkillItem>();
                ui.SetItem(skill, this, false);
                this.listMain.AddItem(ui);
            }
        }
    }
Esempio n. 8
0
    private void InitItems()
    {
        var Skills = DataManager.Instance.Skills[(int)User.Instance.CurrentCharacterInfo.Class];

        foreach (var kv in Skills)
        {
            if (kv.Value.Type == Common.Battle.SkillType.Skill)
            {
                GameObject  go = Instantiate(itemPrefab, this.listMain.transform);
                UISkillItem ui = go.GetComponent <UISkillItem>();
                ui.SetItem(kv.Value, this, false);
                this.listMain.AddItem(ui);
            }
        }
    }
Esempio n. 9
0
    private void CreateSkillItem(UDSkill.Skill skill)
    {
        GameObject go = GameObject.Instantiate(skillItem) as GameObject;

        go.transform.SetParent(skillItem.transform.parent);
        go.transform.localScale = Vector3.one;
        go.SetActive(true);

        UISkillItem item = go.AddComponent <UISkillItem>();

        item.Refresh(skill);
        skillItems.Add(item);

        //add click btn
        go.AddComponent <Button>().onClick.AddListener(OnClickSkillItem);
    }
Esempio n. 10
0
 void OnSkillItemSelectChanged(UISkillItem item)
 {
     if (item != null)
     {
         try
         {
             //Parse desc
             string desc = item.data._desc.Substring(item.data._desc.LastIndexOf("\\n") + 2)
                           + "\r\n" + PELocalization.GetString(8000160) + "[5CB0FF]" + GameUI.Instance.mSkillWndCtrl._SkillMgr.GetNextExpBySkillType(item.data._skillType) + "[-]";
             mSkillTypeCtrl.desc = desc;
         }
         catch
         {
             mSkillTypeCtrl.desc = "";
         }
     }
     else
     {
         mSkillTypeCtrl.desc = "";
     }
 }
Esempio n. 11
0
    public void SetContent(int grade, List <SkillTreeUnit> skills)
    {
        mSkillGos.RefreshItem(skills.Count, mSkillItemPrefab, mContent);
        mSkillItems.Clear();

        for (int i = 0; i < mSkillGos.Count; i++)
        {
            UISkillItem item  = mSkillGos[i].GetComponent <UISkillItem>();
            int         pos_y = i * -c_SkillItemSpace * 2 + (mSkillGos.Count - 1) * c_SkillItemSpace;
            item.gameObject.transform.localPosition = new Vector3(0, pos_y, 0);
            item.SetCoord(grade, i);

            item.onClickLernBtn -= OnSkillItemLernBtn;
            item.onClickItemBtn -= OnSkillItemClick;
            item.onClickLernBtn += OnSkillItemLernBtn;
            item.onClickItemBtn += OnSkillItemClick;

            mSkillItems.Add(item);
        }

        SetV_LineSize((mSkillGos.Count - 1) * c_SkillItemSpace * 2);
    }
Esempio n. 12
0
 public void InitSkillList()
 {
     for (int i = meleeParent.childCount - 1; i > 0; i--)
     {
         DestroyImmediate(meleeParent.GetChild(i).gameObject);
     }
     for (int i = gunParent.childCount - 1; i > 0; i--)
     {
         DestroyImmediate(gunParent.GetChild(i).gameObject);
     }
     for (int i = bodyParent.childCount - 1; i > 0; i--)
     {
         DestroyImmediate(bodyParent.GetChild(i).gameObject);
     }
     uiSkills = new List <UISkillItem>();
     foreach (var id in skillManager.meleeSkills)
     {
         UISkillItem uiSkill = null;
         uiSkill = Instantiate(skillUIPrefab, meleeParent).GetComponent <UISkillItem>();
         uiSkill.InitSkillItem(skillManager.skills[id]);
         uiSkills.Add(uiSkill);
     }
     foreach (var id in skillManager.gunSkills)
     {
         UISkillItem uiSkill = null;
         uiSkill = Instantiate(skillUIPrefab, gunParent).GetComponent <UISkillItem>();
         uiSkill.InitSkillItem(skillManager.skills[id]);
         uiSkills.Add(uiSkill);
     }
     foreach (var id in skillManager.bodySkills)
     {
         UISkillItem uiSkill = null;
         uiSkill = Instantiate(skillUIPrefab, bodyParent).GetComponent <UISkillItem>();
         uiSkill.InitSkillItem(skillManager.skills[id]);
         uiSkills.Add(uiSkill);
     }
 }
Esempio n. 13
0
 void OnSkillItemClick(UISkillItem item)
 {
     selectItem = item;
 }
Esempio n. 14
0
 private void RefreshDesc(UISkillItem skill)
 {
     content.text = string.Format("{0}\n名称:{1}\n等级:{2}", skill.data.desc, skill.data.name, skill.data.level);
 }
Esempio n. 15
0
 private void OnItemSelected(ListView.ListViewItem item)
 {
     this.selectedItem  = item as UISkillItem;
     this.descript.text = this.selectedItem.item.Define.Description;
 }
Esempio n. 16
0
 private void RefreshDesc(UISkillItem skill)
 {
     skillDesc.transform.Find("content").GetComponent <Text>().text = skill.data.desc + "\n名称:" + skill.data.name + "\n等级:" + skill.data.level;
 }
Esempio n. 17
0
 private void RefreshDesc(UISkillItem skill)
 {
     skillDesc.transform.Find("content").GetComponent<Text>().text = skill.data.desc + "\n名称:" + skill.data.name + "\n等级:" + skill.data.level;
 }
Esempio n. 18
0
    private void OnClickSkillItem()
    {
        UISkillItem item = UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject.GetComponent <UISkillItem>();

        ShowDesc(item);
    }
Esempio n. 19
0
    void UpdateSkillTooltip()
    {
        string step   = "\r\n";
        int    sCount = mObject.skills.Length;

        for (int i = 0; i < sCount; i++)
        {
            UISkillItem usi = skillsHolder.GetChild(i).GetComponent <UISkillItem>();
            System.Text.StringBuilder core = new System.Text.StringBuilder();
            System.Text.StringBuilder pro  = new System.Text.StringBuilder();

            usi.skillInfo = mObject.skills[i];

            core.Append(Language.GetText(skills.Find(x => x.name == mObject.skills[i].clientPrefab).GetComponent <Language>().textId) + step);
            pro.Append(step);

            if (mObject.skills[i].effect > 0)
            {
                //Append SKILLTYPE
                core.Append(Language.GetText(32) + step + step);

                switch (mObject.skills[i].skillType)
                {
                case MObjects.SkillType.Area:
                    pro.Append(Language.GetText(34) + step + step);
                    break;

                case MObjects.SkillType.Self:
                    pro.Append(Language.GetText(66) + step + step);
                    break;

                default:
                    pro.Append(Language.GetText(33) + step + step);
                    break;
                }

                core.Append(step + Language.GetText(27));
                pro.Append(step + mObject.skills[i].effect);
            }

            core.Append(step + Language.GetText(28));
            pro.Append(step + ((mObject.skills[i].casttime > 0) ? (mObject.skills[i].casttime + " " + Language.GetText(31)) : Language.GetText(29)));

            core.Append(step + Language.GetText(30));
            pro.Append(step + mObject.skills[i].cooldown + " " + Language.GetText(31));

            if (mObject.skills[i].moveSpeed > 0)
            {
                core.Append(step + Language.GetText(35));
                pro.Append(step + mObject.skills[i].moveSpeed + " " + Language.GetText(36));
            }

            if (mObject.skills[i].life > 0)
            {
                core.Append(step + Language.GetText(37));
                pro.Append(step + mObject.skills[i].life + " " + Language.GetText(31));
            }

            if (mObject.skills[i].effectTime > 0)
            {
                core.Append(step + Language.GetText(67));
                pro.Append(step + mObject.skills[i].effectTime + " " + Language.GetText(31));
            }

            if (mObject.skills[i].collision > 0)
            {
                //Append Hit Radius
                core.Append(step + Language.GetText(38));
                pro.Append(step + mObject.skills[i].collision + " " + Language.GetText(39));
            }

            if (mObject.skills[i].hitAndDestroy)
            {
                core.Append(step + step + Language.GetText(40));
            }

            if (mObject.skills[i].hitContinous)
            {
                core.Append(step + step + Language.GetText(41));
            }

            usi.core = core;
            usi.pro  = pro;
        }
    }
Esempio n. 20
0
    void Update()
    {
        if (myAgent.isController && !GameManager.SessionEnd && GameManager.sessionStarted)
        { // only if this is the controller one
            TryToMove();
        }

        if (autoTarget != null)
        {
            AutoTarget.singleton.icon.transform.position = Camera.main.WorldToScreenPoint(autoTarget.transform.position);
        }

        if (nextAuto > Time.time)
        {
            return;
        }

        nextAuto = Time.time + 0.1f;

        if (autoTargeter)
        {
            /*
             * MOVE TO TARGET
             * */

            if (autoTarget != null && (MapLoader.isBlocked(GameManager.currentMapId, transform.position, autoTarget.transform.position, false) || autoTarget.currentHealth == 0))
            {
                autoTarget = null;
                nextTarget = 0;
            }

            if (nextTarget < Time.time && autoTarget == null)
            {
                nextTarget = Time.time + 2; // Search for target per 4 seconds

                List <MobileAgent> possibleTargets = MobileAgent.list.FindAll(x => (x.team != myAgent.team || GameManager.singleton.sessionUpdate.teamSize == 0) && x.currentHealth > 0 && !MapLoader.isBlocked(GameManager.currentMapId, myAgent.transform.position, x.transform.position, false));
                possibleTargets = possibleTargets.OrderBy(x => GameManager.GetDistance(x.transform.position, myAgent.transform.position)).ToList();

                if (possibleTargets.Count > 0)
                {
                    autoTarget    = possibleTargets[0];
                    targetSkill   = GameManager.singleton.skillsHolder.GetChild(0).GetComponent <UISkillItem>(); // First skill
                    skillDistance = targetSkill.skillInfo.life * targetSkill.skillInfo.moveSpeed;                // First skill's distance
                }
                else
                {
                    autoTargeter = false; // Disable auto targeting
                    return;
                }
            }

            /*
             * GOTO TARGET
             * */
            if (autoTarget != null)
            {
                float dist = GameManager.GetDistance(myAgent.transform.position, autoTarget.transform.position);
                if (dist < skillDistance / 1.25f)
                {
                    if (GameManager.singleton.skillsHolder.GetChild(0).GetComponentInChildren <Filler>()._image.fillAmount == 0)
                    {
                        if (myAgent.isCasting)
                        {
                            AimRequest(autoTarget.transform.position);
                        }
                        targetSkill.Request();
                    }
                    else
                    {
                        MoveRequest(transform.position, true);
                    }
                }
                else if (dist > skillDistance)
                {
                    MoveRequest(autoTarget.transform.position);
                }
            }
        }
    }