public static void SetState(this PeEntity entity, NpcMissionState state) { EntityInfoCmpt info = entity.GetCmpt <EntityInfoCmpt>(); if (info != null) { info.SetMissionState(state); } }
public static string ExtGetFaceIcon(this PeEntity entity) { EntityInfoCmpt info = entity.GetCmpt <EntityInfoCmpt>(); if (null == info) { return(null); } return(string.IsNullOrEmpty(info.faceIcon) ? "npc_big_Unknown" : info.faceIcon); }
public static void ExtSetFaceIcon(this PeEntity entity, string icon) { EntityInfoCmpt info = entity.GetCmpt <EntityInfoCmpt>(); if (null == info) { return; } info.faceIcon = icon; }
public static void ExtSetName(this PeEntity entity, CharacterName name) { EntityInfoCmpt info = entity.GetCmpt <EntityInfoCmpt>(); if (null == info) { return; } info.characterName = name; }
public static string ExtGetName(this PeEntity entity) { EntityInfoCmpt info = entity.GetCmpt <EntityInfoCmpt>(); if (null == info) { return(null); } return(info.characterName.fullName); }
//public static void ExtSetMapIcon(this PeEntity entity, int icon) //{ // EntityInfoCmpt info = entity.GetCmpt<EntityInfoCmpt>(); // if (null == info) // { // return; // } // info.mapIcon = icon; //} //public static int ExtGetMapIcon(this PeEntity entity) //{ // EntityInfoCmpt info = entity.GetCmpt<EntityInfoCmpt>(); // if (null == info) // { // return PeMap.MapIcon.FlagIcon; // } // return info.mapIcon; //} public static void ExtSetFaceTex(this PeEntity entity, Texture icon) { EntityInfoCmpt info = entity.GetCmpt <EntityInfoCmpt>(); if (null == info) { return; } info.faceTex = icon; }
public static Texture ExtGetFaceTex(this PeEntity entity) { EntityInfoCmpt info = entity.GetCmpt <EntityInfoCmpt>(); if (null == info) { return(null); } return(info.faceTex); }
IEnumerator NpcRevive(SkEntity entity, float delayTime) { if (Pathea.PeGameMgr.IsMulti) { yield break; } PeEntity peentity = entity.GetComponent <PeEntity>(); if (peentity == null) { yield break; } EntityInfoCmpt InfoCmpt = peentity.enityInfoCmpt; InfoCmpt.SetDelaytime(Time.time, delayTime); PESkEntity skentity = peentity.peSkEntity; yield return(new WaitForSeconds(delayTime)); if (entity != null && skentity != null && skentity.isDead) { MotionMgrCmpt motion = entity.GetComponent <MotionMgrCmpt>(); if (motion != null) { while (true) { if (null == peentity || null == motion) { yield break; } //在复活中被任务设置成不能复活 ReviveTime = -1 if (peentity.NpcCmpt.ReviveTime < 0) { break; } PEActionParamB param = PEActionParamB.param; param.b = false; if (motion.DoAction(PEActionType.Revive, param)) { entity.SetAttribute((int)AttribType.Hp, entity.GetAttribute((int)AttribType.HpMax) * 0.8f); break; } else { yield return(new WaitForSeconds(1)); } } } } }
void GetEntityCmpt() { if (player != GameUI.Instance.mMainPlayer) { player = GameUI.Instance.mMainPlayer; viewCmpt = player.biologyViewCmpt; commonCmpt = player.commonCmpt; equipmentCmpt = player.equipmentCmpt; //packageCmpt = player.GetCmpt<PlayerPackageCmpt>(); entityInfoCmpt = player.enityInfoCmpt; playerArmorCmpt = player.GetCmpt <WhiteCat.PlayerArmorCmpt>(); } }
void GetServentCmpt() { if (leaderCmpt != null) { NpcCmpt cmpt = leaderCmpt.GetServant((int)mCurrentIndex); if (cmpt != null && cmpt != npcCmpt) { viewCmpt = cmpt.Entity.biologyViewCmpt; commonCmpt = cmpt.Entity.commonCmpt; packageCmpt = cmpt.GetComponent <NpcPackageCmpt>(); GetNpcPakgeSlotList(); entityInfoCmpt = cmpt.Entity.enityInfoCmpt; // register changeEvent if (equipmentCmpt != null) { equipmentCmpt.changeEventor.Unsubscribe(EquipmentChangeEvent); } equipmentCmpt = cmpt.Entity.equipmentCmpt; equipmentCmpt.changeEventor.Subscribe(EquipmentChangeEvent); } npcCmpt = cmpt; CheckWhtherCanGet(); servant = (npcCmpt != null) ? npcCmpt.Entity : null; } else { npcCmpt = null; CheckWhtherCanGet(); } if (npcCmpt == null) { viewCmpt = null; commonCmpt = null; equipmentCmpt = null; packageCmpt = null; entityInfoCmpt = null; mInteractionPackage = null; mPrivatePakge = null; mSprSex.spriteName = "null"; ClearEqList(); ClearNpcPackage(); } mEqTex.enabled = (npcCmpt != null); }
public void Sell(Grid_N grid, int num) { //lz-2016.08.10 执行Sell的时候重置包裹当前的操作Item GameUI.Instance.mItemPackageCtrl.ResetCurOpItem(); if (null == grid || null == grid.ItemObj) { Debug.LogError("Sell item is null"); return; } int proid = grid.ItemObj.protoId; int instanceid = grid.ItemObj.instanceId; int maxStackCount = grid.ItemObj.GetStackMax(); int cost = grid.ItemObj.GetSellPrice();//(int)(grid.ItemObj.prototypeData.m_CurrencyValue * num * (0.8f * grid.ItemObj.Durability / grid.ItemObj.DurabilityMax + 0.2f)); // string itemname = grid.ItemObj.protoData.GetName(); if (npc == null) { return; } NpcPackageCmpt npcpc = npc.GetCmpt <NpcPackageCmpt>(); if (npcpc == null) { return; } cost *= num; if (cost > npcpc.money.current) { string errInfo = ""; EntityInfoCmpt cmpt = npc.GetCmpt <EntityInfoCmpt>(); if (cmpt != null) { string _name = ""; // if (npc.entityProto.proto == EEntityProto.RandomNpc) // { // _name = cmpt.characterName.fullName; // } // else if (npc.entityProto.proto == EEntityProto.Npc) // { // _name = cmpt.characterName.givenName; // } _name = cmpt.characterName.fullName; //lz-2016.10.31 have no money to pay for you! errInfo = _name + " " + PELocalization.GetString(8000853); } else { //lz-2016.10.31 have no money to pay for you! errInfo = npc.name + " " + PELocalization.GetString(8000853); } new PeTipMsg(errInfo, PeTipMsg.EMsgLevel.Error); return; } //Add money to player if (PeGameMgr.IsMulti) { PlayerNetwork.mainPlayer.RequestSell(npc.Id, instanceid, num); } else { npcpc.money.current -= cost; ItemObject SellItemObj; if (maxStackCount == 1) { SellItemObj = grid.ItemObj; } else { SellItemObj = ItemMgr.Instance.CreateItem(proid); } PlayerPackageCmpt pkg = PeCreature.Instance.mainPlayer.GetCmpt <PlayerPackageCmpt>(); if (null == pkg) { return; } if (maxStackCount == 1) { pkg.Remove(SellItemObj); } else { pkg.DestroyItem(instanceid, num); } //if (grid.ItemObj.GetCount() > num) //{ // SellItemObj = ItemMgr.Instance.CreateItem(grid.ItemObj.protoId); // single // SellItemObj.IncreaseStackCount(num); // grid.ItemObj.DecreaseStackCount(num); //} //else //{ // SellItemObj = grid.ItemObj; // PlayerFactory.mMainPlayer.GetItemPackage().RemoveItem(grid.ItemObj); // GameUI.Instance.mUIItemPackageCtrl.ResetItem(); //} //SellItemObj.SetProperty(ItemProperty.SellItemMark, 1f); AddRepurchase(SellItemObj, num); // if (cost != 0 && !PeCreature.Instance.mainPlayer.AddToPkg(StroyManager.PRICE_ID, cost)) // { // return; // } pkg.money.current += cost; ResetItem(); } //GameGui_N.Instance.mChatGUI.AddChat(PromptData.PromptType.PromptType_14, itemname, num, cost); mOpItem.SetItem(null); mOpGrid = null; mSellOpLayer.gameObject.SetActive(false); return; }
public override void Show() { mSellOpLayer.gameObject.SetActive(false); mOpItem.mShowNum = false; mBtnAll.isChecked = true; shopSelectItemType = ItemLabel.Root.all; mCurrentPickTab = 0; ResetItem(mCurrentPickTab, 0); npc = EntityMgr.Instance.Get(m_CurNpcID); EntityInfoCmpt info = npc.GetCmpt <EntityInfoCmpt>(); if (npc != null) { //npc.CmdIdle = true; if (info != null) { SetNpcName(info.characterName.fullName); } NpcPackageCmpt npcpc = npc.GetCmpt <NpcPackageCmpt>(); if (npcpc == null) { return; } SetNpcMoney(npcpc.money.current); Texture icon_tex = null; string icon_str = ""; if (EntityCreateMgr.Instance.IsRandomNpc(npc)) { icon_tex = npc.ExtGetFaceTex(); if (icon_tex == null) { icon_str = npc.ExtGetFaceIcon(); } } else { icon_str = npc.ExtGetFaceIcon(); } if (icon_tex != null) { SetNpcICO(icon_tex); } else { SetNpcICO(icon_str); } StroyManager.Instance.SetTalking(EntityMgr.Instance.Get(m_CurNpcID)); isShopping = true; //Invoke("ShopSetTalking", 0.25f); } if (!GameUI.Instance.mItemPackageCtrl.isShow) { GameUI.Instance.mItemPackageCtrl.Show(); } prePos = GameUI.Instance.mItemPackageCtrl.transform.localPosition; GameUI.Instance.mItemPackageCtrl.transform.localPosition = UIDefaultPostion.Instance.pos_ItemPackge; transform.localPosition = UIDefaultPostion.Instance.pos_Shop; base.Show(); }