static public bool LoadAsset(ENTITY_ID dressId, ENTITY_ID weaponId, AssetLoader.AssetLoadCallback CallBack, ParamData paramData) { // id to name string weaponName = GlobalInstanceFunction.Instance.GetAssetsName((int)weaponId, AssetLoader.EAssetType.ASSET_WEAPON); if (!GlobalInstanceFunction.Instance.IsValidName(weaponName)) { return(false); } string dressName = ""; string assName = ""; if ((int)dressId != 0) { dressName = GlobalInstanceFunction.Instance.GetAssetsName((int)dressId, AssetLoader.EAssetType.ASSET_PLAYER); //去掉性别 dressName = dressName.Remove(dressName.Length - 1, 1); assName = string.Format("{0}_{1}", dressName, weaponName); } else { assName = weaponName; } //Load Asset AssetLoader.LoadAssetBundle(assName, AssetLoader.EAssetType.ASSET_WEAPON, CallBack, paramData); return(true); }
static public bool LoadAsset(ENTITY_ID ID, AssetLoader.AssetLoadCallback CallBack, ParamData paramData) { // id to name string AssetsName = GlobalInstanceFunction.Instance.GetAssetsName((int)ID, AssetLoader.EAssetType.ASSET_PLAYER); if (!GlobalInstanceFunction.Instance.IsValidName(AssetsName)) { return(false); } string[] depFiles = PlayerDepedenceData.GetRefAssets(AssetsName); PlayerLoadReq info = new PlayerLoadReq(); info.name_ = AssetsName; info.callback_ = CallBack; info.pdata_ = paramData; if (depFiles != null) { info.status_ = new Dictionary <string, PlayerDepLoader.PlayerDepStatus>(); PlayerDepLoader.PlayerDepStatus[] refStatus = PlayerDepLoader.Instance.LoadAtlas(depFiles); for (int i = 0; i < depFiles.Length; ++i) { info.status_.Add(depFiles[i], refStatus[i]); } if (!LoadCheck(info)) { loadLst.Add(info); } } else { if (pdRefDic_.ContainsKey(AssetsName)) { if (pdRefDic_[AssetsName].hasBundle) { CallBack(pdRefDic_[AssetsName].Open(), paramData); } else { pdRefDic_[AssetsName].Set(CallBack, paramData); AssetLoader.LoadAssetBundle(AssetsName, AssetLoader.EAssetType.ASSET_PLAYER, LoadPlayerCallback, paramData); } } else { PlayerBundleRef bundleRef = new PlayerBundleRef(); bundleRef.Set(CallBack, paramData); pdRefDic_.Add(AssetsName, bundleRef); pdRef4For_.Add(bundleRef); AssetLoader.LoadAssetBundle(AssetsName, AssetLoader.EAssetType.ASSET_PLAYER, LoadPlayerCallback, paramData); } } return(true); }
void UpdateTeamMBOk(COM_SimplePlayerInst info) { index = TeamSystem.GetTeamMembers().Length - 1; ENTITY_ID weaponAssetId = 0; if (GlobalInstanceFunction.Instance.WeaponID(info) != 0) { weaponAssetId = (ENTITY_ID)ItemData.GetData(GlobalInstanceFunction.Instance.WeaponID(info)).weaponEntityId_; } GameManager.Instance.GetActorClone((ENTITY_ID)info.properties_[(int)PropertyType.PT_AssetId], weaponAssetId, EntityType.ET_Player, AssetLoadCallBack, new ParamData((int)info.instId_, index, (int)info.properties_[(int)PropertyType.PT_AssetId]), "UI", GlobalInstanceFunction.Instance.GetDressId(info.equips_)); UIManager.SetButtonEventHandler(teamCells[index].gameObject, EnumButtonEvent.OnClick, OnClickShowTips, 0, 0); }
public void UpdateHandler(uint target, COM_Item equip) { if (data_ != null && target != data_.iParam) { return; } if (equip.slot_ != (ushort)EquipmentSlot.ES_Fashion) { ENTITY_ID weaponId = (ENTITY_ID)ItemData.GetData((int)equip.itemId_).weaponEntityId_; UpdateHandler(weaponId); } }
static public bool LoadAsset(ENTITY_ID ID, AssetLoader.AssetLoadCallback CallBack, ParamData paramData) { // id to name string AssetsName = GlobalInstanceFunction.Instance.GetAssetsName((int)ID, AssetLoader.EAssetType.ASSET_WEAPON); if (!GlobalInstanceFunction.Instance.IsValidName(AssetsName)) { return(false); } //Load Asset AssetLoader.LoadAssetBundle(AssetsName, AssetLoader.EAssetType.ASSET_WEAPON, CallBack, paramData); return(true); }
void ShowTeamMembers() { if (TeamSystem.IsInTeam()) { COM_SimplePlayerInst[] members = TeamSystem.GetTeamMembers(); for (int i = 0; i < members.Length; ++i) { ENTITY_ID weaponAssetId = 0; if (GlobalInstanceFunction.Instance.WeaponID(members[i]) != 0) { weaponAssetId = (ENTITY_ID)ItemData.GetData(GlobalInstanceFunction.Instance.WeaponID(members[i])).weaponEntityId_; } GameManager.Instance.GetActorClone((ENTITY_ID)members[i].properties_[(int)PropertyType.PT_AssetId], weaponAssetId, EntityType.ET_Player, AssetLoadCallBack, new ParamData((int)members[i].instId_, i, (int)members[i].properties_[(int)PropertyType.PT_AssetId]), "UI", GlobalInstanceFunction.Instance.GetDressId(members[i].equips_)); } } }
void CreatePlayerObj(COM_SimpleInformation mRole) { ENTITY_ID weaponAssetId = 0; if (mRole.weaponItemId_ != 0) { weaponAssetId = (ENTITY_ID)ItemData.GetData(mRole.weaponItemId_).weaponEntityId_; } int dressId = 0; ItemData dress = ItemData.GetData(mRole.fashionId_); if (dress != null) { dressId = dress.weaponEntityId_; } GameManager.Instance.GetActorClone((ENTITY_ID)mRole.asset_id_, weaponAssetId, EntityType.ET_Player, AssetLoadCallBack, new ParamData(mRole.instId_), "Default", dressId); }
public void GetActorClone(ENTITY_ID assetId, ENTITY_ID weaponId, EntityType type, CallBackPack.ActorLoadedCallBack callback, ParamData data = null, string layerName = "3D", int dressId = 0) { CallBackPack pack = new CallBackPack(); pack.actorCallBack_ = callback; pack.data_ = data; ENTITY_ID AssId = 0; ENTITY_ID WeassId = weaponId; if (dressId != 0) { AssId = (ENTITY_ID)dressId; } else { AssId = assetId; } pack.playerAssetId_ = AssId; pack.weaponAssetId_ = WeassId; pack.hasDress_ = dressId != 0; pack.layerName_ = layerName; pack.uid_ = GenerateUid; if (loadedPack_ == null) { loadedPack_ = new Dictionary <int, CallBackPack>(); } loadedPack_.Add(pack.uid_, pack); bool ignoreWeaponUpdate = (type != EntityType.ET_Player); if (!ignoreWeaponUpdate) { pack.hasWeapon_ = weaponId != 0; } if (PlayerAsseMgr.LoadAsset(AssId, ActorAssetLoaded, new ParamData(pack.uid_, ignoreWeaponUpdate)) == false) { ClientLog.Instance.LogError("EntityAssetID: " + (int)AssId + " has not found!"); } }
public void UpdateHandler(int target, int itemid) { if (data_ != null && target != data_.iParam) { return; } if (itemid == 0) { RemoveWeaponDirectly(target); return; } ItemData item = ItemData.GetData(itemid); if (item != null && item.slot_ != EquipmentSlot.ES_Fashion) { ENTITY_ID weaponId = (ENTITY_ID)ItemData.GetData(itemid).weaponEntityId_; UpdateHandler(weaponId); } }
public void UpdateHandler(ENTITY_ID weaponAssetId) { if ((int)weaponAssetId == 0) { return; } weaponAssId_ = weaponAssetId; WeaponAssetMgr.LoadAsset((ENTITY_ID)dressAssId_, weaponAssId_, (AssetBundle bundle, ParamData data) => { if (hasDestroy) { WeaponAssetMgr.DeleteAsset(bundle, false); return; } if (weapon_ != null) { Destroy(weapon_); weapon_ = null; } if (EntityAssetsData.GetData((int)weaponAssetId).bindPoint_.Contains("L")) { bindPoint_ = gameObject.GetComponent <WeaponHand>().weaponLeftHand_; } else { bindPoint_ = gameObject.GetComponent <WeaponHand>().weaponRightHand_; } weapon_ = (GameObject)GameObject.Instantiate(bundle.mainAsset, bindPoint_.position, bindPoint_.rotation) as GameObject; WeaponAssetMgr.DeleteAsset(bundle, false); weapon_.transform.parent = bindPoint_; //weapon_.transform.localScale = Vector3.one; NGUITools.SetChildLayer(transform, LayerMask.NameToLayer(layerName_)); }, null); }
static public void DeleteAsset(ENTITY_ID ID, bool unLoadAllLoadedObjects) {// id to name string AssetsName = GlobalInstanceFunction.Instance.GetAssetsName((int)ID, AssetLoader.EAssetType.ASSET_WEAPON); AssetInfoMgr.Instance.DecRefCount(AssetsName, unLoadAllLoadedObjects); }
void DestroyBaby(ENTITY_ID eId, bool unLoadAllLoadedObjects, GameObject obj) { PlayerAsseMgr.DeleteAsset(eId, unLoadAllLoadedObjects); Destroy(obj); }
bool Talking() { if (TalkIndex >= TalkList.Count) { return(false); } string txt = TalkList[TalkIndex].second; NpcData npcData = NpcData.GetData(TalkList[TalkIndex].first); bool isSelf = (npcData == null); ENTITY_ID assetId = npcData == null ? (ENTITY_ID)GamePlayer.Instance.GetIprop(PropertyType.PT_AssetId) : (ENTITY_ID)npcData.AssetsID; if (!isSelf) { if (preNpcAssId != assetId) { if (pos2 != null) { DestroyImmediate(pos2); } } preNpcAssId = assetId; } bool hasGameObject = isSelf ? pos1 != null : pos2 != null; string actorname = isSelf? GamePlayer.Instance.InstName: npcData.Name; string playerName = GamePlayer.Instance.InstName; StringTool.RepColor(ref playerName, "00FF00"); StringTool.RepName(ref txt, playerName); ClearName(); if (pos1 != null) { pos1.SetActive(isSelf); } if (pos2 != null) { pos2.SetActive(!isSelf); } ShowName(isSelf, actorname); if (!hasGameObject) { GameManager.Instance.GetActorClone(assetId, isSelf ? (ENTITY_ID)GamePlayer.Instance.WeaponAssetID : (ENTITY_ID)0, EntityType.ET_Player, (GameObject go, ParamData data) => { if (hasDestroy_) { Destroy(go); return; } int dialogScale = 0; GlobalValue.Get(Constant.C_DialogScale, out dialogScale); if (data.bParam == true) { pos1 = go; pos1.transform.parent = model[0]; pos1.transform.localPosition = /*ector3.zero*/ new Vector3(0f, 0f, -200f); pos1.transform.Rotate(Vector3.up, 180f); float zoom = EntityAssetsData.GetData((int)assetId).zoom_; pos1.transform.localScale = new Vector3(zoom + dialogScale, zoom + dialogScale, zoom + dialogScale); } else { pos2 = go; pos2.transform.parent = model[1]; pos2.transform.localPosition = /*Vector3.zero*/ new Vector3(0f, 0f, -200f); pos2.transform.Rotate(Vector3.up, 180f); float zoom = EntityAssetsData.GetData((int)assetId).zoom_; pos2.transform.localScale = new Vector3(zoom + dialogScale, zoom + dialogScale, zoom + dialogScale); } //PlayerAsseMgr.DeleteAsset(assetId, false); }, new ParamData((int)assetId, isSelf), "UI", isSelf ? GamePlayer.Instance.DressID : 0); } NpcDialogue = txt; TalkIndex++; return(true); }
/// <summary> /// 发送EntityView命令 /// </summary> /// <param name="entityID">实体ID</param> /// <param name="cmdID">命令ID,参见EntityViewDef.h</param> /// <param name="nParam">整形参数</param> /// <param name="strParam">字符串参数</param> /// <param name="ptrParam">指针参数</param> /// <returns></returns> static public bool sendEntityCommand_Handler(ENTITY_ID entityID, int cmdID, int nParam, IntPtr strParam, IntPtr ptrParam, int len, int nTickCount) { return(EntityFactory.entry_sendCommand(entityID, cmdID, nParam, Marshal.PtrToStringAnsi(strParam), ptrParam, len, nTickCount)); }
/// <summary> /// 删除实体 /// </summary> /// <param name="id">实体ID</param> /// <returns>是否删除成功</returns> static public bool destroyEntityView_Handler(ENTITY_ID entityID) { return(EntityFactory.entry_destroyEntry(entityID)); }