public static AssetMng.DownloadID GetShadow(string _name, System.Action <GameObject, EResult> _onComplete) { string url = AssetMng.GetPathWithoutExtension("effect/" + _name, AssetPathType.PersistentDataPath) + ".object"; AssetMng.DownloadID downloadID = AssetMng.instance.LoadAsset <GameObject>(url, _name, _onComplete, true); return(downloadID); }
/// <summary> /// 获取随从模型 /// </summary> /// <param name="_url"></param> /// <param name="_onComplete"></param> /// <returns></returns> public static AssetMng.DownloadID GetEntourage(string _url, System.Action <GameObject, EResult> _onComplete) { AssetMng.DownloadID downloadID = AssetMng.instance.LoadAsset <GameObject>(AssetMng.GetPathWithExtension(_url, AssetPathType.PersistentDataPath), _url, _onComplete, true); return(downloadID); }
public void EndDownLoadTask(AssetMng.DownloadID _task) { if (_task == null || pendingDownloadList == null) { return; } if (pendingDownloadList.ContainsKey(_task.shortURL)) { pendingDownloadList.Remove(_task.shortURL); } }
public static AssetMng.DownloadID GetMount(string _modelName, System.Action <GameObject, EResult> _onComplete) { string[] strs = _modelName.Split('/'); string resName = strs[strs.Length - 1]; AssetMng.DownloadID downloadID = AssetMng.instance.LoadAsset <GameObject>(AssetMng.GetPathWithExtension(_modelName, AssetPathType.PersistentDataPath), resName, _onComplete, true); return(downloadID); }
public void PushDownLoadTask(AssetMng.DownloadID _task) { if (_task == null || pendingDownloadList == null) { return; } if (pendingDownloadList.ContainsKey(_task.shortURL)) { AssetMng.instance.CancelDownload(_task.shortURL); pendingDownloadList.Remove(_task.shortURL); } pendingDownloadList.Add(_task.shortURL, _task); }
public void EquipArmor(EquipSlot _slot, string _shortURL, string _name) { int slot = (int)_slot; ++pendingArmors; armorDirty = true; AssetMng.DownloadID id = armorDownloadingList[slot]; if (id != null) { --pendingArmors; AssetMng.instance.CancelDownload(id); armorDownloadingList[slot] = null; } bool done = false; id = AssetMng.instance.LoadAsset <GameObject>(_shortURL, "", delegate(GameObject _prefab, EResult _result) { --pendingArmors; done = true; if (_result == EResult.Success) { GameCenter.curGameStage.CacheEquipmentURL(_shortURL, _prefab); armorDownloadingList[slot] = null; armorList[slot] = _prefab; SkinnedMeshRenderer smr = _prefab.GetComponentInChildrenFast <SkinnedMeshRenderer>(true); if (smr != null && smr.sharedMaterial != null) { smr.sharedMaterial.shader = Shader.Find(smr.sharedMaterial.shader.name); } else { Debug.Log("smr 为空"); } } }, true ); if (done == false) { armorDownloadingList[slot] = id; } }
public static AssetMng.DownloadID GetRace(int _id, System.Action <GameObject, EResult> _onComplete) { PlayerConfig playerConfig = ConfigMng.Instance.GetPlayerConfig(_id); if (playerConfig != null) { AssetMng.DownloadID downloadID = AssetMng.instance.LoadAsset <GameObject>(AssetMng.GetPathWithExtension(playerConfig.res_name, AssetPathType.PersistentDataPath), playerConfig.res_name, _onComplete, true); return(downloadID); } else { GameSys.LogError("Unknown raceID " + _id); _onComplete(null, EResult.NotFound); return(null); } }
public static AssetMng.DownloadID GetRace(int _id, System.Action <GameObject, EResult> _onComplete, bool isCreatePlayer) { PlayerConfig playerConfig = ConfigMng.Instance.GetPlayerConfig(_id); if (playerConfig != null) { string resName = (isCreatePlayer?playerConfig.display_res:playerConfig.res_name); //Debug.Log("resName:"+resName); AssetMng.DownloadID downloadID = AssetMng.instance.LoadAsset <GameObject>(AssetMng.GetPathWithExtension(resName, AssetPathType.PersistentDataPath), resName, _onComplete, true); return(downloadID); } else { GameSys.LogError("Unknown raceID " + _id); _onComplete(null, EResult.NotFound); return(null); } }
/// <summary> /// 场景物品 /// </summary> public static AssetMng.DownloadID GetSceneItem(int _id, System.Action <GameObject, EResult> _onComplete) { SceneItemRef itemRef = ConfigMng.Instance.GetSceneItemRef(_id); if (itemRef != null) { string[] strs = itemRef.assetName.Split('/'); string resName = strs[strs.Length - 1]; AssetMng.DownloadID downloadID = AssetMng.instance.LoadAsset <GameObject>(AssetMng.GetPathWithExtension(itemRef.assetName, AssetPathType.PersistentDataPath), resName, _onComplete, true); return(downloadID); } else { GameSys.LogError("Unknown type " + _id); _onComplete(null, EResult.NotFound); return(null); } }
//public static void UnloadRace(int _id) //{ // PlayerConfig playerConfig = ConfigMng.Instance.GetPlayerConfig(_id); // if (playerConfig != null) // { // AssetMng.instance.UnloadUrl(AssetMng.GetPathWithExtension("Player/" + playerConfig.res_name, (AssetPathType)playerConfig.path_type)); // } //} public static AssetMng.DownloadID GetNPC(int _id, System.Action <GameObject, EResult> _onComplete) { NPCTypeRef npcRef = ConfigMng.Instance.GetNPCTypeRef(_id); if (npcRef != null) { string[] strs = npcRef.res_name.Split('/'); string resName = strs[strs.Length - 1]; AssetMng.DownloadID downloadID = AssetMng.instance.LoadAsset <GameObject>(AssetMng.GetPathWithExtension(npcRef.res_name, (AssetPathType)npcRef.path_type), resName, _onComplete, true); return(downloadID); } else { GameSys.LogError("Unknown type " + _id); _onComplete(null, EResult.NotFound); return(null); } }
public virtual void EquipWeapon(EquipmentInfo _eq, EquipSlot _slot, string _shortURL, string _name) { int slot = (int)_slot; ++pendingArmors; armorDirty = true; AssetMng.DownloadID id = armorDownloadingList[slot]; if (id != null) { --pendingArmors; AssetMng.instance.CancelDownload(id); armorDownloadingList[slot] = null; } bool done = false; id = AssetMng.instance.LoadAsset <GameObject>(_shortURL, "", delegate(GameObject _prefab, EResult _result) { --pendingArmors; done = true; if (_result == EResult.Success) { GameCenter.curGameStage.CacheEquipmentURL(_shortURL, _prefab); armorDownloadingList[slot] = null; Renderer smr = _prefab.GetComponentInChildrenFast <Renderer>(true); if (smr != null) { smr.sharedMaterial.shader = Shader.Find(smr.sharedMaterial.shader.name); } else { // Debug.Log("smr 为空"); } Transform point = null; if (isInComBat) { if (cachedBones.ContainsKey(_eq.FightWeaponPointName)) { point = cachedBones[_eq.FightWeaponPointName]; } else { point = this.transform.FindChild(_eq.FightWeaponPointName); if (point == null) { Debug.LogError("战斗挂点丢失 " + _eq.FightWeaponPointName); } } } else { if (cachedBones.ContainsKey(_eq.UnFightWeaponPointName)) { point = cachedBones[_eq.UnFightWeaponPointName]; } else { point = this.transform.FindChild(_eq.UnFightWeaponPointName); if (point == null) { Debug.LogError("非战斗挂点丢失 " + _eq.UnFightWeaponPointName); } } } if (point != null) { GameObject weapon = Instantiate(_prefab) as GameObject; weapon.transform.parent = point; weapon.transform.localScale = Vector3.one; weapon.transform.localEulerAngles = Vector3.zero; weapon.transform.localPosition = Vector3.zero; weapon.SetMaskLayer(gameObject.layer); if (weaponDictionary.ContainsKey(_eq.Slot) && weaponDictionary[_eq.Slot] != null) { Destroy(weaponDictionary[_eq.Slot] as GameObject); } weaponDictionary[_eq.Slot] = weapon; bool hide = false; OtherPlayer actor = GameCenter.curGameStage.GetOtherPlayer(actorInfo.ServerInstanceID); if (actor != null) { if (!actor.IsShowing) { hide = true; } } if (hide) //隐藏的玩家,进入视野时,可能导致武器未隐藏 by邓成 { List <Renderer> allRendererList = weapon.GetComponentsInChildrenFast <Renderer>(true); for (int i = 0; i < allRendererList.Count; ++i) { //Debug.Log(allRendererList[i].gameObject.name); allRendererList[i].enabled = false; } } } } }, true ); if (done == false) { armorDownloadingList[slot] = id; } }