private bool LoadAnimation(HItemCtrl.Item _item, HItemCtrl.ListItem _info) { if (Object.op_Equality((Object)_item.objItem, (Object)null)) { return(false); } _item.animItem = (Animator)_item.objItem.GetComponent <Animator>(); if (Object.op_Equality((Object)_item.animItem, (Object)null)) { _item.animItem = (Animator)_item.objItem.GetComponentInChildren <Animator>(); if (Object.op_Equality((Object)_item.animItem, (Object)null)) { return(false); } } if (_info.pathAssetAnimator.IsNullOrEmpty() || _info.nameAnimator.IsNullOrEmpty()) { _item.animItem = (Animator)null; return(false); } using (List <ValueTuple <string, RuntimeAnimatorController> > .Enumerator enumerator = this.BaseRacs.GetEnumerator()) { while (enumerator.MoveNext()) { ValueTuple <string, RuntimeAnimatorController> current = enumerator.Current; if (!((string)current.Item1 != _info.nameAnimatorBase)) { this.rac[0] = (RuntimeAnimatorController)current.Item2; } } } _item.animItem.set_runtimeAnimatorController(this.rac[0]); if (Object.op_Equality((Object)_item.animItem.get_runtimeAnimatorController(), (Object)null)) { _item.animItem = (Animator)null; } this.rac[1] = CommonLib.LoadAsset <RuntimeAnimatorController>(_info.pathAssetAnimator, _info.nameAnimator, false, string.Empty); _item.animItem.set_runtimeAnimatorController((RuntimeAnimatorController)Illusion.Utils.Animator.SetupAnimatorOverrideController(_item.animItem.get_runtimeAnimatorController(), this.rac[1])); return(true); }
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); }