Exemple #1
0
    public void updateRed()
    {
        MakeData make = MakeData.GetData(_makeId);

        if (make == null)
        {
            return;
        }

        if (make.skillLevel >= 40 && !CompoundSystem.instance.GetIsOPenEquip((uint)_makeId))
        {
            this.gameObject.transform.FindChild("bg").FindChild("can").GetComponent <UISprite>().gameObject.SetActive(false);
            this.gameObject.transform.FindChild("bg").FindChild("noPag").GetComponent <UISprite>().gameObject.SetActive(true);
            return;
        }
        else
        {
            this.gameObject.transform.FindChild("bg").FindChild("noPag").GetComponent <UISprite>().gameObject.SetActive(false);
        }


        bool isItemEnough = true;

        for (int i = 0; i < make.needItems.Length; i++)
        {
            ItemData needItem  = ItemData.GetData(int.Parse(make.needItems [i]));
            int      itemCount = BagSystem.instance.GetItemMaxNum(uint.Parse(make.needItems [i]));
            if (itemCount < int.Parse(make.needItemNum [i]))
            {
                isItemEnough = false;
            }
        }
        if (isItemEnough)
        {
            this.gameObject.transform.FindChild("bg").FindChild("can").GetComponent <UISprite>().gameObject.SetActive(true);
        }
        else
        {
            this.gameObject.transform.FindChild("bg").FindChild("can").GetComponent <UISprite>().gameObject.SetActive(false);
        }

        this.gameObject.transform.FindChild("bg").FindChild("recommend").GetComponent <UISprite>().gameObject.SetActive(false);
        Profession pro = Profession.get((JobType)GamePlayer.Instance.GetIprop(PropertyType.PT_Profession), GamePlayer.Instance.GetIprop(PropertyType.PT_ProfessionLevel));

        ItemSubType[] items = pro.CanUsedItems(GamePlayer.Instance.GetIprop(PropertyType.PT_ProfessionLevel) * 2 + 2);

        for (int i = 0; i < items.Length; i++)
        {
            if (ItemData.GetData(_makeId).subType_ == items[i])
            {
                this.gameObject.transform.FindChild("bg").FindChild("recommend").GetComponent <UISprite>().gameObject.SetActive(true);
                break;
            }
        }
    }
Exemple #2
0
    private void OnSkillCell(ButtonScript obj, object args, int param1, int param2)
    {
        if (_chindItemCellObj != null && _chindItemCellObj != obj)
        {
            _chindItemCellObj.transform.FindChild("bg").FindChild("arrows").GetComponent <UISprite>().spriteName = "sanjiao";
            _chindItemCellObj = null;
        }

        if (obj.transform.FindChild("bg").FindChild("arrows").GetComponent <UISprite>().spriteName == "sanjiao2")
        {
            obj.transform.FindChild("bg").FindChild("arrows").GetComponent <UISprite>().spriteName = "sanjiao";
            foreach (GameObject c in chindCellList)
            {
                skillGrid.RemoveChild(c.transform);
                c.transform.parent = null;
                c.gameObject.SetActive(false);
                chindCellPoolList.Add(c);
            }
            chindCellList.Clear();
            _chindItemCellObj = null;
            return;
        }
        else
        {
            obj.transform.FindChild("bg").FindChild("arrows").GetComponent <UISprite>().spriteName = "sanjiao2";

            foreach (GameObject c in chindCellList)
            {
                skillGrid.RemoveChild(c.transform);
                c.transform.parent = null;
                c.gameObject.SetActive(false);
                chindCellPoolList.Add(c);
            }
            chindCellList.Clear();

            _chindItemCellObj = obj;
        }

        int indx   = skillGrid.GetIndex(obj.transform);
        int pLevel = param1;        // GamePlayer.Instance.GetIprop (PropertyType.PT_Level) / 10 + 1;

        if (pLevel == 1)
        {
            pLevel = 0;
        }
        int  index    = 0;
        bool jobFirst = false;


        Profession pro = Profession.get((JobType)GamePlayer.Instance.GetIprop(PropertyType.PT_Profession), GamePlayer.Instance.GetIprop(PropertyType.PT_ProfessionLevel));

        ItemSubType[] items = pro.CanUsedItems(GamePlayer.Instance.GetIprop(PropertyType.PT_ProfessionLevel) * 2 + 2);

        foreach (MakeData m in MakeData.metaData.Values)
        {
            if (_bJobEquip)
            {
                if ((pLevel <= m.skillLevel && m.skillLevel <= pLevel + 9) && m.type_ == "Player")
                {
                    for (int i = 0; i < items.Length; i++)
                    {
                        if (ItemData.GetData(m.itemId_).subType_ == items[i])
                        {
                            GameObject objCell = null;
                            if (chindCellPoolList.Count > 0)
                            {
                                objCell = chindCellPoolList[0];
                                chindCellPoolList.Remove(objCell);
                            }
                            else
                            {
                                objCell = Object.Instantiate(chindItemCell.gameObject) as GameObject;
                            }

                            UIManager.SetButtonEventHandler(objCell, EnumButtonEvent.OnClick, OnClickChindItem, 0, 0);
                            CompoundSkillCellUI cell = objCell.GetComponent <CompoundSkillCellUI>();
                            cell.SkillId = m.skillId;
                            cell.MakeId  = m.itemId_;
                            cell.gameObject.transform.FindChild("bg").FindChild("recommend").GetComponent <UISprite>().gameObject.SetActive(true);
                            skillGrid.AddChild(objCell.transform, ++indx);
                            objCell.SetActive(true);
                            objCell.transform.localScale = Vector3.one;
                            chindCellList.Add(objCell);

                            if (jobFirst == false && i == 0)
                            {
                                GuideManager.Instance.RegistGuideAim(objCell, GuideAimType.GAT_MainMakeSubFirst);
                            }
                            if (jobFirst == false)
                            {
                                jobFirst = true;
                            }
                        }
                    }
                }
            }
            else
            {
                if ((ItemData.GetData(m.itemId_).slot_ == (EquipmentSlot)_selectEquipType ||
                     ((EquipmentSlot)_selectEquipType == EquipmentSlot.ES_SingleHand &&
                      ItemData.GetData(m.itemId_).slot_ == EquipmentSlot.ES_DoubleHand)) &&
                    (pLevel <= m.skillLevel && m.skillLevel <= pLevel + 9) && m.type_ == "Player")
                {
                    GameObject objCell = null;
                    if (chindCellPoolList.Count > 0)
                    {
                        objCell = chindCellPoolList[0];
                        chindCellPoolList.Remove(objCell);
                    }
                    else
                    {
                        objCell = Object.Instantiate(chindItemCell.gameObject) as GameObject;
                    }

                    UIManager.SetButtonEventHandler(objCell, EnumButtonEvent.OnClick, OnClickChindItem, 0, 0);
                    CompoundSkillCellUI cell = objCell.GetComponent <CompoundSkillCellUI>();
                    cell.SkillId = m.skillId;
                    cell.MakeId  = m.itemId_;
                    skillGrid.AddChild(objCell.transform, ++indx);
                    objCell.SetActive(true);
                    objCell.transform.localScale = Vector3.one;
                    chindCellList.Add(objCell);
                    if (index == 0)
                    {
                        GuideManager.Instance.RegistGuideAim(objCell, GuideAimType.GAT_MainMakeSubFirst);
                    }

                    if (index == 2)
                    {
                        GuideManager.Instance.RegistGuideAim(objCell, GuideAimType.GAT_MainMakeSubSecond);
                    }

                    if (index == 4)
                    {
                        GuideManager.Instance.RegistGuideAim(objCell, GuideAimType.GAT_MainMakeSubThird);
                    }
                    index++;
                }
            }
        }
        GuideManager.Instance.ProcEvent(ScriptGameEvent.SGE_MainMakeSub, GamePlayer.Instance.GetIprop(PropertyType.PT_Profession));
    }
Exemple #3
0
    private void SelectItem()
    {
        levelBtnCellList[0].gameObject.transform.FindChild("arrows").GetComponent <UISprite>().spriteName = "sanjiao2";
        int indx   = skillGrid.GetIndex(levelBtnCellList[0].gameObject.transform);
        int pLevel = 1;        // GamePlayer.Instance.GetIprop (PropertyType.PT_Level) / 10 + 1;

        if (pLevel == 1)
        {
            pLevel = 0;
        }

        Profession pro = Profession.get((JobType)GamePlayer.Instance.GetIprop(PropertyType.PT_Profession), GamePlayer.Instance.GetIprop(PropertyType.PT_ProfessionLevel));

        ItemSubType[] items = pro.CanUsedItems(GamePlayer.Instance.GetIprop(PropertyType.PT_ProfessionLevel) * 2 + 2);

        foreach (MakeData m in MakeData.metaData.Values)
        {
            if ((pLevel <= m.skillLevel && m.skillLevel <= pLevel + 9) && m.type_ == "Player")
            {
                for (int i = 0; i < items.Length; i++)
                {
                    if (ItemData.GetData(m.itemId_).subType_ == items[i])
                    {
                        GameObject objCell = null;
                        if (chindCellPoolList.Count > 0)
                        {
                            objCell = chindCellPoolList[0];
                            chindCellPoolList.Remove(objCell);
                        }
                        else
                        {
                            objCell = Object.Instantiate(chindItemCell.gameObject) as GameObject;
                        }

                        UIManager.SetButtonEventHandler(objCell, EnumButtonEvent.OnClick, OnClickChindItem, 0, 0);
                        CompoundSkillCellUI cell = objCell.GetComponent <CompoundSkillCellUI>();
                        cell.SkillId = m.skillId;
                        cell.MakeId  = m.itemId_;
                        cell.gameObject.transform.FindChild("recommend").GetComponent <UISprite>().gameObject.SetActive(true);
                        skillGrid.AddChild(objCell.transform, ++indx);
                        objCell.SetActive(true);
                        objCell.transform.localScale = Vector3.one;
                        chindCellList.Add(objCell);
                    }
                }
            }
        }


        CompoundSkillCellUI cell1 = chindCellList[0].gameObject.GetComponent <CompoundSkillCellUI> ();

        if (_selectChindObj == chindCellList[0].gameObject)
        {
            return;
        }
        if (_selectChindObj == null)
        {
            _selectChindObj = chindCellList[0].gameObject;
            chindCellList[0].GetComponent <CompoundSkillCellUI> ().arrow.gameObject.SetActive(true);
        }
        else
        {
            _selectChindObj.GetComponent <CompoundSkillCellUI> ().arrow.gameObject.SetActive(false);
            _selectChindObj = chindCellList[0].gameObject;
            _selectChindObj.GetComponent <CompoundSkillCellUI> ().arrow.gameObject.SetActive(true);;
        }

        if (cell1 == null)
        {
            return;
        }
        updateCompoundInfo(cell1);
        updateCompoundPropInfo(cell1);
    }