Ejemplo n.º 1
0
    //初始化底部入口item
    void InitFateItem(FateObjItem item)
    {
        List <int> idList = null;

        if (item != null)
        {
            if (item.HeadID != 0 || item.EquipID != 0)
            {
                idList = Core.Data.newDungeonsManager.GetFloorIdByGiftId(item.HeadID);
            }
        }
        //可能没有配缘的  也可能 有 很多缘分
        if (idList != null)
        {
            for (int i = 0; i <= idList.Count; i++)
            {
                GameObject obj = null;

                if (i == idList.Count)
                {
                    obj = this.CreatFateBtnObj(btnItemGrid.transform, null, Vector3.down * i * 80);
                    btnItemList.Add(obj);
                    break;
                }

                obj = this.CreatFateBtnObj(btnItemGrid.transform, Core.Data.newDungeonsManager.FloorList[idList [i]], Vector3.down * i * 80);
                btnItemList.Add(obj);
            }
        }
        else
        {
            GameObject tobj = this.CreatFateBtnObj(btnItemGrid.transform, null, Vector3.zero);
            btnItemList.Add(tobj);
        }
    }
Ejemplo n.º 2
0
    void InitHeadItem()
    {
        if (fateD != null)
        {
            monData   = Core.Data.fateManager.GetMonsterByFateNum(fateD.ID);
            equipData = Core.Data.fateManager.GetEquipByFateNum(fateD.ID);
        }
        else if (equipD != null)
        {
            equipData.Add(equipD);
        }
        else if (monsterD != null)
        {
            monData.Add(monsterD);
        }

        for (int i = 0; i < monData.Count + equipData.Count; i++)
        {
            UnityEngine.Object obj = WXLLoadPrefab.GetPrefab(WXLPrefabsName.UIFateHeadItem);
            if (obj != null)
            {
                GameObject  go = Instantiate(obj) as GameObject;
                FateObjItem hi = go.GetComponent <FateObjItem> ();

                if (monData.Count != 0 && equipData.Count == 0)
                {
                    hi.HeadID                  = monData [i].ID;
                    go.transform.parent        = headItemGrid.transform;
                    go.transform.localScale    = Vector3.one;
                    go.transform.localPosition = startPos + i * Vector3.right * 160;
                    hi.id = i;
                }
                else if (equipData.Count != 0 && monData.Count == 0)
                {
                    hi.EquipID = equipData [i].ID;
                    go.gameObject.transform.parent = headItemGrid.transform;
                    go.transform.localScale        = Vector3.one;
                    go.transform.localPosition     = startPos + i * Vector3.right * 160;
                    hi.id = i;
                }
                headItem.Add(hi);
            }
        }
    }
Ejemplo n.º 3
0
    public void OnGoFateItem(int index)
    {
        if (index == defaultItem.id)
        {
            return;
        }
        FateObjItem item = headItem [index];

        if (item != null)
        {
            for (int i = 0; i < btnItemList.Count; i++)
            {
                Destroy(btnItemList [i].gameObject);
            }
            btnItemList.Clear();
            btnItemGrid.GetComponent <UIGrid> ().Reposition();

            this.InitFateItem(item);

            float tempX = item.gameObject.transform.localPosition.x - 128 + headItemGrid.transform.parent.localPosition.x;
            if (tempX < -168f)
            {
                tempX = -168f;
            }
            else if (tempX > 178)
            {
                tempX = 178f;
            }

            Vector3 targetPos = new Vector3(tempX, spArrow.transform.localPosition.y, 0);
            MiniItween.MoveTo(spArrow.gameObject, targetPos, 0.3f, MiniItween.EasingType.Clerp, false);
            item.mainBg.spriteName        = slectName;
            defaultItem.mainBg.spriteName = normalName;
            defaultItem = item;
        }
    }
Ejemplo n.º 4
0
    void Start()
    {
        //		Debug.Log (" id = " + myId);



        if (myId != 0)
        {
            if ((int)(myId / 1000) == 9)
            {
                fateD    = Core.Data.fateManager.getFateDataFromID(myId);
                equipD   = null;
                monsterD = null;
            }
            else
            {
                switch (DataCore.getDataType(myId))
                {
                case ConfigDataType.Fate:
                    fateD    = Core.Data.fateManager.getFateDataFromID(myId);
                    equipD   = null;
                    monsterD = null;
                    Debug.Log(" fate   case    = " + fateD);
                    break;

                case ConfigDataType.Equip:
                    equipD   = Core.Data.EquipManager.getEquipConfig(myId);
                    monsterD = null;
                    fateD    = null;
                    break;

                case ConfigDataType.Monster:
                    monsterD = Core.Data.monManager.getMonsterByNum(myId);
                    equipD   = null;
                    fateD    = null;
                    break;

                default:
                    fateD    = null;
                    monsterD = null;
                    equipD   = null;
                    break;
                }
            }
        }

        if (fateD != null)
        {
            lblTitle.text = fateD.name;
            InitHeadItem();
            defaultItem = headItem [0];
            defaultItem.mainBg.spriteName = slectName;
            InitFateItem(defaultItem);
            spArrow.transform.localPosition = new Vector3(-125, spArrow.transform.localPosition.y, 0);
        }
        else if (equipD != null)
        {
            lblTitle.text = equipD.name;
            InitHeadItem();
            defaultItem = headItem [0];
            defaultItem.mainBg.spriteName = slectName;
            InitFateItem(defaultItem);
            spArrow.transform.localPosition = new Vector3(-125, spArrow.transform.localPosition.y, 0);
        }
        else if (monsterD != null)
        {
            lblTitle.text = monsterD.name;
            InitHeadItem();
            defaultItem = headItem [0];
            defaultItem.mainBg.spriteName = slectName;
            InitFateItem(defaultItem);
            spArrow.transform.localPosition = new Vector3(-125, spArrow.transform.localPosition.y, 0);
        }
    }