private void LoadPrefab(RoleInfo roleInfo) { if (this.modelPath != roleInfo.ModelPath || objModel == null) { DestoryModel(); this.modelPath = roleInfo.ModelPath; if (roleInfo.IsLocal) { this.objModel = PrefabRoot.GetGameObject("Role", this.modelPath); if (this.objModel != null) { this.PetName = roleInfo.Name; this.objModel.transform.SetParent(this.roleRoot, false); this.objModel.tag = this.GetTag(); animator = objModel.GetComponent <Animator>(); this.LocalPetAccessoryAgent.LoadData(); } } else { this.AssetBundleUtils.LoadAssetAsync(roleInfo.AB, roleInfo.ModelPath, (gameObject) => { if (gameObject != null) { this.PetName = roleInfo.Name; gameObject.SetActive(true); gameObject.AddComponent <FixShader>(); this.objModel = gameObject; this.objModel.transform.SetParent(this.roleRoot, false); this.objModel.tag = this.GetTag(); animator = objModel.GetComponent <Animator>(); this.LocalPetAccessoryAgent.LoadData(); } else { this.StopAllCoroutines(); this.StartCoroutine(this.CircleInspect(roleInfo)); } }, (errorText) => { this.StopAllCoroutines(); this.StartCoroutine(this.CircleInspect(roleInfo)); Debug.LogErrorFormat("<><PetPlayer.LoadPrefab>Error: {0}", errorText); }); } } }
protected virtual void LoadPrefab(string prefabPath) { if (this.modelPath != prefabPath || objModel == null) { DestoryModel(); this.modelPath = prefabPath; this.objModel = PrefabRoot.GetGameObject("Role", this.modelPath); if (this.objModel != null) { this.objModel.transform.SetParent(this.roleRoot, false); this.objModel.tag = this.GetTag(); animator = objModel.GetComponent <Animator>(); this.LocalPetAccessoryAgent.LoadData(); } } }