Exemplo n.º 1
0
 public bool ReleaseItem()
 {
     for (int index1 = 0; index1 < this.lstItem.Count; ++index1)
     {
         if (!Object.op_Equality((Object)this.lstItem[index1].objItem, (Object)null))
         {
             for (int index2 = 0; index2 < this.lstItem[index1].lstChild.Count; ++index2)
             {
                 HItemCtrl.ChildInfo childInfo = this.lstItem[index1].lstChild[index2];
                 if (Object.op_Implicit((Object)childInfo.objChild) && Object.op_Implicit((Object)childInfo.oldParent))
                 {
                     childInfo.transChild.SetParent(childInfo.oldParent, false);
                 }
             }
             Object.Destroy((Object)this.lstItem[index1].objItem);
             this.lstItem[index1].objItem  = (GameObject)null;
             this.lstItem[index1].animItem = (Animator)null;
         }
     }
     this.lstItem.Clear();
     this.itemObj.Clear();
     return(true);
 }
Exemplo n.º 2
0
    public bool LoadItem(
        int _mode,
        int _id,
        GameObject _boneMale,
        GameObject _boneFemale,
        GameObject _boneMale1,
        GameObject _boneFemale1)
    {
        this.ReleaseItem();
        List <HItemCtrl.ListItem> listItemList = (List <HItemCtrl.ListItem>)null;

        this.itemObj.Clear();
        for (int index = 0; index < this.lstParent[_mode].Count; ++index)
        {
            if (this.lstParent[_mode][index].ContainsKey(_id))
            {
                listItemList = this.lstParent[_mode][index][_id];
                foreach (HItemCtrl.ListItem _info in listItemList)
                {
                    HItemCtrl.Item obj = new HItemCtrl.Item();
                    if (GlobalMethod.AssetFileExist(_info.pathAssetObject, _info.nameObject, _info.nameManifest))
                    {
                        obj.itemName  = _info.Name;
                        obj.objItem   = CommonLib.LoadAsset <GameObject>(_info.pathAssetObject, _info.nameObject, true, _info.nameManifest);
                        obj.transItem = obj.objItem.get_transform();
                        Singleton <HSceneManager> .Instance.hashUseAssetBundle.Add(_info.pathAssetObject);

                        this.LoadAnimation(obj, _info);
                        this.lstItem.Add(obj);
                    }
                }
            }
        }
        if (listItemList == null)
        {
            return(false);
        }
        for (int index1 = 0; index1 < listItemList.Count && this.lstItem.Count > index1; ++index1)
        {
            if (!Object.op_Equality((Object)this.lstItem[index1].objItem, (Object)null))
            {
                foreach (HItemCtrl.ParentInfo parentInfo in listItemList[index1].lstParent)
                {
                    GameObject gameObject1 = (GameObject)null;
                    if (parentInfo.numToWhomParent == 0)
                    {
                        if (Object.op_Inequality((Object)_boneMale, (Object)null))
                        {
                            gameObject1 = _boneMale.get_transform().FindLoop(parentInfo.nameParent);
                        }
                    }
                    else if (parentInfo.numToWhomParent == 1)
                    {
                        if (Object.op_Inequality((Object)_boneFemale, (Object)null))
                        {
                            gameObject1 = _boneFemale.get_transform().FindLoop(parentInfo.nameParent);
                        }
                    }
                    else if (parentInfo.numToWhomParent == 2)
                    {
                        if (Object.op_Inequality((Object)_boneMale1, (Object)null))
                        {
                            gameObject1 = _boneMale1.get_transform().FindLoop(parentInfo.nameParent);
                        }
                    }
                    else if (parentInfo.numToWhomParent == 3)
                    {
                        if (Object.op_Inequality((Object)_boneFemale1, (Object)null))
                        {
                            gameObject1 = _boneFemale1.get_transform().FindLoop(parentInfo.nameParent);
                        }
                    }
                    else
                    {
                        int index2 = parentInfo.numToWhomParent - 4;
                        if (this.lstItem.Count > index2 && Object.op_Implicit((Object)this.lstItem[index2].objItem))
                        {
                            gameObject1 = this.lstItem[index2].transItem.FindLoop(parentInfo.nameParent);
                        }
                    }
                    GameObject gameObject2 = !(parentInfo.nameSelf != string.Empty) ? this.lstItem[index1].objItem : this.lstItem[index1].transItem.FindLoop(parentInfo.nameSelf);
                    if (!Object.op_Equality((Object)gameObject1, (Object)null) && !Object.op_Equality((Object)gameObject2, (Object)null))
                    {
                        HItemCtrl.ChildInfo childInfo = new HItemCtrl.ChildInfo();
                        childInfo.objChild   = gameObject2;
                        childInfo.transChild = gameObject2.get_transform();
                        childInfo.oldParent  = gameObject2.get_transform().get_parent();
                        this.lstItem[index1].lstChild.Add(childInfo);
                        if (parentInfo.isParentMode)
                        {
                            childInfo.transChild.SetParent(gameObject1.get_transform(), false);
                            childInfo.transChild.set_localPosition(Vector3.get_zero());
                            childInfo.transChild.set_localRotation(Quaternion.get_identity());
                        }
                        else
                        {
                            childInfo.transChild.SetParent(this.hitemPlace, false);
                            childInfo.transChild.set_position(gameObject1.get_transform().get_position());
                            childInfo.transChild.set_rotation(gameObject1.get_transform().get_rotation());
                        }
                        if (!parentInfo.isParentScale)
                        {
                            this.itemObj.Add(new ValueTuple <Transform, Transform, bool>(childInfo.transChild, gameObject1.get_transform(), parentInfo.isParentMode));
                        }
                    }
                }
            }
        }
        GC.Collect();
        return(true);
    }