public abstract IEnumerator onInit(LChatacterRecourceInterface loader, LChatacterInterface character, AddCoroutineFun fun);
public override IEnumerator onInit(LChatacterRecourceInterface loader, LCharacterInterface character, AddCoroutineFun fun) { yield return(null); }
CharactorLoadHandle LChatacterRecourceInterface.LoadSkillDataFile(string skillId, AddCoroutineFun fun) { LCHSkillData skillData; CharactorLoadResultData _res = new CharactorLoadResultData(); CharactorLoadResult h = new CharactorLoadResult(_res); if (skillDatas.TryGetValue(skillId, out skillData)) { _res.asset = skillData; _res.isFinish = true; } else { fun(LoadSkillData(_res, skillId)); } return(h); }
public override IEnumerator onInit(LChatacterRecourceInterface loader, LCharacterInterface character, AddCoroutineFun fun) { hasLoaded = false; CharactorLoadHandle handle0 = loader.LoadSkillDataFile(SkillId, fun); while (!handle0.isFinish) { yield return(null); } skillData = (LCHSkillData)handle0.asset; role.type = 1; role.objId = -1; character.UpdateSkillRange(cdName, skillData.skillRange, skillData.skillWidth); // objs[role.objId] = role; objList = new ObjectContain[skillData.objs.Length]; for (int i = 0, l = skillData.objs.Length; i < l; i++) { var o = skillData.objs[i]; ObjectContain oc = new ObjectContain(); oc.SetInformation(o); objs[o.id] = oc; objList[i] = oc; if (o.id == -1)//不加载主模型。 { continue; } else if (o.type == 1)//对象(特效,模型...)。 { //Debug.LogError("load " + oc.mod); var handle = loader.loadResource(oc.mod_name, oc.mod, fun); while (!handle.isFinish) { yield return(1); } if (null != handle.asset) { if (handle.asset == null) { Debug.LogError("找不到资源,是否没打包 ? " + oc.mod); } else { oc.baseGameObject = (GameObject)handle.asset; if (null != oc.baseGameObject) { oc.gameobject = GameObject.Instantiate(oc.baseGameObject); oc.gameobject.SetActive(false); oc.gameobject.name = o.name; oc.gameobject.hideFlags = HideFlags.None; oc.systems = oc.gameobject.GetComponentsInChildren <ParticleSystem>(); } } } } else if (o.type == 2)//(碰撞体)。 { GameObject g = new GameObject(); g.layer = character.GetAttackLayer(); g.SetActive(false); g.AddComponent <BoxCollider>(); g.hideFlags = HideFlags.DontSave; oc.gameobject = g; g.name = o.name; } else if (o.type == 3)//模型本身碰撞体。暂不连接。 { continue; } else if (o.type == 4)//加载声音 { GameObject g = new GameObject(); g.name = o.name; oc.gameobject = g; loader.loadResource(oc.mod_name, oc.mod, fun); } } for (int i = 0, c0 = skillData.events.Count; i < c0; i++) { var _e = skillData.events[i]; var contain = objs[_e.objId]; contain.events.Add(_e); } for (int i = 0, c0 = skillData.channels.Count; i < c0; i++) { var _c = skillData.channels[i]; var contain = objs[_c.objId]; contain.channels.Add(_c); } hasLoaded = true; }
CharactorLoadHandle LChatacterRecourceInterface.loadResource(string name, string path, AddCoroutineFun fun) { var handle = LAssetBundleManager.Instance().loadAsset(path); return(handle); }