void OnTooltip(bool show) { if (ListItemType.mItem == mType) { if (show == true && mItemSample == null && m_ProtoId != 0) { mItemSample = new ItemSample(m_ProtoId); } else if (show == false) { mItemSample = null; } if (mItemSample != null) { //string tipStr = PELocalization.GetString(mItemSample.protoData.descriptionStringId); //ToolTipsMgr.ShowText(tipStr); _itemObj = ItemMgr.Instance.CreateItem(m_ProtoId); string tipStr = _itemObj.GetTooltip(); ToolTipsMgr.ShowText(tipStr); } else { ItemMgr.Instance.DestroyItem(_itemObj); ToolTipsMgr.ShowText(null); } } }
void RPC_S2C_GetDeadObjItem(uLink.BitStream stream, uLink.NetworkMessageInfo info) { int netId = stream.Read <int>(); int index = stream.Read <int>(); int itemId = stream.Read <int>(); AiNetwork ai = AiNetwork.Get <AiNetwork>(netId); if (null == ai || null == ai.Runner) { return; } ItemDropPeEntity dropEntity = ai.Runner.GetComponent <ItemDropPeEntity>(); if (null == dropEntity) { return; } ItemSample item = dropEntity.Get(index); if (null == item || item.protoId != itemId) { return; } dropEntity.RemoveDroppableItem(item); if (null != GameUI.Instance.mItemGet) { GameUI.Instance.mItemGet.Reflash(); } }
// Use this for initialization void Start() { #if PLANET_EXPLORERS ItemSample item = new ItemSample(m_GameItemId); if (item.protoData == null) { return; } m_IconSprite.spriteName = item.iconString0; //ItemAsset.ItemData item = ItemAsset.ItemData.s_tblItemData.Find(iter => iter.m_ID == m_GameItemId); //m_IconSprite.spriteName = item.m_Icon.Split(',')[0]; m_NameLabel.text = VCUtils.Capital(item.nameText, true); //if ( PlayerFactory.mMainPlayer != null ) if (PeCreature.Instance.mainPlayer != null) { if (VCEditor.Instance.m_CheatWhenMakeCreation) { m_CountLabel.text = m_GameItemCost.ToString("#,##0").Trim() + " / [60FF00]" + "Cheat".ToLocalizationString() + "[-]"; m_IsEnough = true; } else if (Pathea.PeGameMgr.IsSingleBuild) { m_CountLabel.text = m_GameItemCost.ToString("#,##0").Trim() + " / [60FF00]" + "Build".ToLocalizationString() + "[-]"; m_IsEnough = true; } else if (PeGameMgr.playerType == PeGameMgr.EPlayerType.Tutorial) { m_CountLabel.text = m_GameItemCost.ToString("#,##0").Trim() + " / [60FF00]" + "Tutorial".ToLocalizationString() + "[-]"; m_IsEnough = true; } else { Pathea.PlayerPackageCmpt pkg = Pathea.PeCreature.Instance.mainPlayer.GetCmpt <Pathea.PlayerPackageCmpt>(); int have = pkg.package.GetCount(m_GameItemId); if (have >= m_GameItemCost) { m_CountLabel.text = m_GameItemCost.ToString("#,##0").Trim() + " / [60FF00]" + have.ToString("#,##0").Trim() + "[-]"; m_IsEnough = true; } else { m_CountLabel.text = m_GameItemCost.ToString("#,##0").Trim() + " / [FF0000]" + have.ToString("#,##0").Trim() + "[-]"; m_IsEnough = false; } } } else { m_CountLabel.text = m_GameItemCost.ToString("#,##0").Trim(); m_IsEnough = false; } #else m_IconSprite.spriteName = ""; m_NameLabel.text = m_GameItemId.ToString(); m_CountLabel.text = m_GameItemCost.ToString("# ##0"); m_IsEnough = false; #endif }
/// <summary> /// 删除 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Delete(BaseEntity p_Entity) { try { ItemSample MasterEntity = (ItemSample)p_Entity; if (MasterEntity.ID == 0) { return(0); } //删除主表数据 string Sql = ""; Sql = "DELETE FROM Data_ItemSample WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(Sql); } else { AffectedRows = sqlTrans.ExecuteNonQuery(Sql); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E); } }
public void AddShow(ItemSample itemGrid) { if (itemGrid.protoId < CreationData.ObjectStartID) { mShowList.Add(itemGrid); } }
/// <summary> /// 新增 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int AddNew(BaseEntity p_Entity) { try { ItemSample MasterEntity = (ItemSample)p_Entity; if (MasterEntity.ID == 0) { return(0); } //新增主表数据 StringBuilder MasterField = new StringBuilder(); StringBuilder MasterValue = new StringBuilder(); MasterField.Append("INSERT INTO Data_ItemSample("); MasterValue.Append(" VALUES("); MasterField.Append("ID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ","); MasterField.Append("MainID" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.MainID) + ","); MasterField.Append("Seq" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.Seq) + ","); MasterField.Append("SampleNo" + ","); MasterValue.Append(SysString.ToDBString(MasterEntity.SampleNo) + ","); MasterField.Append("SampleDate" + ","); if (MasterEntity.SampleDate != SystemConfiguration.DateTimeDefaultValue) { MasterValue.Append(SysString.ToDBString(MasterEntity.SampleDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { MasterValue.Append("null,"); } MasterField.Append("ItemCode" + ")"); MasterValue.Append(SysString.ToDBString(MasterEntity.ItemCode) + ")"); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString()); } else { AffectedRows = sqlTrans.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString()); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBInsert), E); } }
public override void FetchAll() { if (GameConfig.IsMultiClient) { if (null != PlayerNetwork.mainPlayer && null != _skAlive && null != _skAlive.Entity) { PlayerNetwork.mainPlayer.RequestDeadObjAllItems(_skAlive.Entity.Id); } return; } List <MaterialItem> items = new List <MaterialItem>(); foreach (IDroppableItemList dropItems in _itemLists) { int n = dropItems.DroppableItemCount; for (int i = 0; i < n; i++) { ItemSample item = dropItems.GetDroppableItemAt(i); items.Add(new MaterialItem() { protoId = item.protoId, count = item.stackCount }); } } if (!playerPkg.package.CanAdd(items.ToArray())) { return; } Pathea.PeEntity npc = gameObject.GetComponent <Pathea.PeEntity>(); if (npc != null) { if (npc.entityProto.proto == Pathea.EEntityProto.RandomNpc || npc.entityProto.proto == Pathea.EEntityProto.Npc) { OwnerData.deadNPC = new OwnerData(); OwnerData.deadNPC.npcID = gameObject.GetComponent <Pathea.PeEntity>().Id; OwnerData.deadNPC.npcName = gameObject.GetComponent <Pathea.PeEntity>().name; } } foreach (MaterialItem item in items) { playerPkg.Add(item.protoId, item.count); } foreach (IDroppableItemList itemDrop in _itemLists) { itemDrop.RemoveDroppableItemAll(); } if (_skAlive != null && GetCount() == 0) { PeEventGlobal.Instance.PickupEvent.Invoke(_skAlive); } }
public void RemoveDroppableItem(ItemSample item) { ItemObject it = item as ItemObject; if (it != null) { TakeOffEquipment(it, false); } }
public void AddDroppableItem(ItemSample item) { ItemObject it = item as ItemObject; if (it != null) { mItemList.Add(it); } }
void Clear() { Grid_N.SetActiveGrid(null); UICursor.Clear(); mIcontex.enabled = false; mIcontex.mainTexture = null; //mCurrenReq = null; mItemSample = null; }
void Awake() { mInstance = this; mItemPlace = ItemPlaceType.IPT_Null; mItemSample = null; mItemIndex = 0; mItemSkillmar = new ItemSkillMar(); ItemMgr.Instance.DestoryItemEvent -= DestoryItemEvent; ItemMgr.Instance.DestoryItemEvent += DestoryItemEvent; }
public bool CanAdd(ItemSample itemSample) { if (itemSample.protoData.category == quest_item) { return(_missionPak.CanAdd(itemSample)); } else { return(_playerPak.CanAdd(itemSample)); } }
void AddRewards(ItemSample itemGrid) { Grid_N AddItem = Instantiate(mPrefabGrid_N) as Grid_N; AddItem.transform.parent = mRewardsGrid.transform; AddItem.transform.localPosition = new Vector3(0, 0, -1); AddItem.transform.localRotation = Quaternion.identity; AddItem.transform.localScale = Vector3.one; AddItem.SetItem(itemGrid); mRewardsList.Add(AddItem); }
/// <summary> /// 修改 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Update(BaseEntity p_Entity) { try { ItemSample MasterEntity = (ItemSample)p_Entity; if (MasterEntity.ID == 0) { return(0); } //更新主表数据 StringBuilder UpdateBuilder = new StringBuilder(); UpdateBuilder.Append("UPDATE Data_ItemSample SET "); UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ","); UpdateBuilder.Append(" MainID=" + SysString.ToDBString(MasterEntity.MainID) + ","); UpdateBuilder.Append(" Seq=" + SysString.ToDBString(MasterEntity.Seq) + ","); UpdateBuilder.Append(" SampleNo=" + SysString.ToDBString(MasterEntity.SampleNo) + ","); if (MasterEntity.SampleDate != SystemConfiguration.DateTimeDefaultValue) { UpdateBuilder.Append(" SampleDate=" + SysString.ToDBString(MasterEntity.SampleDate.ToString("yyyy-MM-dd HH:mm:ss")) + ","); } else { UpdateBuilder.Append(" SampleDate=null,"); } UpdateBuilder.Append(" ItemCode=" + SysString.ToDBString(MasterEntity.ItemCode)); UpdateBuilder.Append(" WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID)); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(UpdateBuilder.ToString()); } else { AffectedRows = sqlTrans.ExecuteNonQuery(UpdateBuilder.ToString()); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBUpdate), E); } }
void SetItem(int index, ItemSample item) { if (null == item || index <= -1 || index >= mItemList.Count) { return; } mItemList[index].SetItem(item, index); mItemList[index].e_GetItem -= GetItem; mItemList[index].e_GetItem += GetItem; }
public void SetItem(ItemSample itemSample, int index) { mGrid.SetItem(itemSample); mGrid.SetItemPlace(ItemPlaceType.IPT_ItemGet, index); if (itemSample != null) { mName.text = itemSample.protoData.GetName() + "[30FF30] x " + itemSample.stackCount + "[-]"; } else { mName.text = ""; } }
public void SetItem(ItemSample itemSample, ItemPlaceType place = ItemPlaceType.IPT_Null, int index = 0, GridMask gridMask = GridMask.GM_Any) { mGridMask = gridMask; mItemSample = itemSample; mItemPlace = place; mItemIndex = index; if (mPutBackFlag) { CancelDrop(); } mPutBackFlag = false; mGrid = null; if (mItemSample == null) { Clear(); return; } if (null != Grid_N.mActiveGrid) { Grid_N.mActiveGrid.mSkillCooldown.fillAmount = 0; Grid_N.mActiveGrid = null; } GameUI.Instance.mItemPackageCtrl.RestItemState(); //BuildBlockManager.self.QuitBuildMode(); SetIcon(mItemSample.iconTex, mItemSample.iconString0); //ItemObject obj = mItemSample as ItemObject; //ItemAsset.Drag drag = null; //if (null != obj) //{ // drag = obj.GetCmpt<ItemAsset.Drag>(); //} //if (obj != null && drag != null && (place == ItemPlaceType.IPT_Bag || place == ItemPlaceType.IPT_HotKeyBar) // && !GameUI.Instance.bMainPlayerDead // ) //{ // ItemObjDragging dragging = new ItemObjDragging(drag); // DraggingMgr.Instance.Begin(dragging); //} //else //{ // mCurrenReq = null; //} mHasCreated = false; }
void AddItem(ItemSample itemGrid) { if (null == itemGrid) { return; } ItemGetItem_N item = Instantiate(mPrefab) as ItemGetItem_N; item.transform.parent = mGrid.transform; item.transform.localPosition = new Vector3(0, 0, -1); item.transform.localRotation = Quaternion.identity; item.transform.localScale = Vector3.one; item.SetItem(itemGrid, mItemList.Count); item.e_GetItem += GetItem; mItemList.Add(item); }
protected bool CanFetchAll() { int n = GetCount(); MaterialItem[] array = new MaterialItem[n]; for (int i = 0; i < n; i++) { ItemSample item = Get(i); array[i] = new MaterialItem() { protoId = item.protoId, count = item.stackCount }; } return(playerPkg.package.CanAdd(array)); }
public void InitItem(ItemSample itemGrid) { if (itemGrid == null) { return; } mItem.SetItem(itemGrid); if (itemGrid.protoData.maxStackNum > 1) { mItemName.text = itemGrid.protoData.GetName() + "+" + itemGrid.GetCount(); } else { mItemName.text = itemGrid.protoData.GetName(); } mPos = transform.localPosition; }
public override void Fetch(int index) { int n, lIdx; if (!ConvertIndex(index, out n, out lIdx)) { return; } if (GameConfig.IsMultiClient) { ItemSample dropItem = _itemLists[n].GetDroppableItemAt(lIdx); if (null != PlayerNetwork.mainPlayer && null != _skAlive && null != _skAlive.Entity) { PlayerNetwork.mainPlayer.RequestDeadObjItem(_skAlive.Entity.Id, lIdx, dropItem.protoId); } return; } Pathea.PeEntity npc = gameObject.GetComponent <Pathea.PeEntity>(); if (npc != null) { if (npc.entityProto.proto == Pathea.EEntityProto.RandomNpc || npc.entityProto.proto == Pathea.EEntityProto.Npc) { OwnerData.deadNPC = new OwnerData(); OwnerData.deadNPC.npcID = gameObject.GetComponent <Pathea.PeEntity>().Id; OwnerData.deadNPC.npcName = gameObject.GetComponent <Pathea.PeEntity>().name; } } ItemSample item = _itemLists[n].GetDroppableItemAt(lIdx); if (playerPkg.package.CanAdd(item)) { playerPkg.Add(item.protoId, item.stackCount); _itemLists[n].RemoveDroppableItem(item); } if (_skAlive != null && GetCount() == 0) { PeEventGlobal.Instance.PickupEvent.Invoke(_skAlive); } }
public static List <ItemSample> GetDropItems(int id) { ItemDropData itemDropData = null; if (!s_ItemDropDataTbl.TryGetValue(id, out itemDropData)) { return(null); } List <ItemSample> ret = new List <ItemSample>(); System.Random r = new System.Random(); // Meat int n = r.Next(itemDropData._meatData.lower, itemDropData._meatData.upper); if (n > 0) { ret.Add(new ItemSample(229, n)); } // Other for (int i = 0; i < itemDropData._cnt; i++) { foreach (DropData dat in itemDropData._dropList) { float perc = (float)r.NextDouble(); if (perc < dat.pro) { if (dat.id > 0) { ItemSample item = ret.Find(it => it.protoId == dat.id); if (item == null) { ret.Add(new ItemSample(dat.id)); } else { item.stackCount += 1; } } break; } } } return(ret); }
/// <summary> /// 删除 /// </summary> /// <param name="p_BE">要删除的实体</param> /// <param name="sqlTrans">事务类</param> public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); ItemSample entity = (ItemSample)p_BE; ItemSampleCtl control = new ItemSampleCtl(sqlTrans); control.Delete(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
/// <summary> /// lz-2016.10.26 用来检测某个Item是不是玩家正在操作的东西 /// </summary> /// <returns></returns> public bool EqualUsingItem(ItemSample item, bool showUsingTip = true) { if (null == item || null == CurOperateItem) { return(false); } if (CurOperateItem == item) { if (showUsingTip) { PeTipMsg.Register(PELocalization.GetString(8000623), PeTipMsg.EMsgLevel.Error); } return(true); } else { return(false); } }
/// <summary> /// 治疗药物设置 /// </summary> /// <param name="_ic"></param> public void TreatMedicineShow(ItemIdCount _ic) { if (m_MedicineAboutTreat_Show == null) { return; } if (!m_MedicineAboutTreat_Show.transform.parent.gameObject.activeSelf) { m_MedicineAboutTreat_Show.transform.parent.gameObject.SetActive(true); } ItemSample _ip = new ItemSample(); _ip.protoId = _ic.protoId; //ItemProto _protoData = _ip.protoData; m_MedicineAboutTreat_Show.m_Grid.SetItem(_ip); m_MedicineAboutTreat_Show.NeedCnt = _ic.count; //if (!hasUsedMedicine)//没得药品放在里面 // m_MedicineAboutTreat_Show.m_Grid.SetGridForbiden(true); }
/// <summary> /// 新增(传入事务处理) /// </summary> /// <param name="p_BE">要新增的实体</param> /// <param name="sqlTrans">事务类</param> public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); ItemSample entity = (ItemSample)p_BE; ItemSampleCtl control = new ItemSampleCtl(sqlTrans); entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Data_ItemSample, sqlTrans); control.AddNew(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
public bool NpcCanFetchAll(Pathea.NpcPackageCmpt npcPackage) { List <MaterialItem> items = new List <MaterialItem>(); foreach (IDroppableItemList dropItems in _itemLists) { int n = dropItems.DroppableItemCount; for (int i = 0; i < n; i++) { ItemSample item = dropItems.GetDroppableItemAt(i); items.Add(new MaterialItem() { protoId = item.protoId, count = item.stackCount }); } } return(npcPackage.CanAddItemList(items)); }
public override void Fetch(int index) { if (!CanFetch(index)) { return; } ItemSample item = _itemList[index]; if (!PeGameMgr.IsMulti) { playerPkg.Add(item.protoId, item.stackCount); _itemList.Remove(item); CheckDestroyObj(); } else { int protoid = item.protoId; int count = item.stackCount; PlayerNetwork.mainPlayer.RPCServer(EPacketType.PT_InGame_RandomItemFetch, genPos, index, protoid, count); } }
void OnTooltip(bool show) { if (ListItemType.mItem == mType) { if (show == true && mItemSample == null && mItemId != 0) { mItemSample = new ItemSample(mItemId); } else if (show == false) { mItemSample = null; } if (mItemSample != null) { //string tipStr = PELocalization.GetString(mItemSample.protoData.descriptionStringId); //string _eName = mItemSample.protoData.englishName; //int _itemObjId = ItemProto.Mgr.Instance.GetItemObjProtoId(_eName, mItemSample.protoData.id); //if (_itemObjId != -1) //{ // ItemObject _itemObj =ItemMgr.Instance.CreateItem(_itemObjId); // tipStr = _itemObj.GetTooltip(); // ToolTipsMgr.ShowText(tipStr); //} //else // ToolTipsMgr.ShowText(tipStr); _itemObj = ItemMgr.Instance.CreateItem(mItemId); string tipStr = _itemObj.GetTooltip(); ToolTipsMgr.ShowText(tipStr); } else { ItemMgr.Instance.DestroyItem(_itemObj); ToolTipsMgr.ShowText(null); } } }
public void NpcFetchAll(Pathea.NpcPackageCmpt npcPackage) { List <MaterialItem> items = new List <MaterialItem>(); foreach (IDroppableItemList dropItems in _itemLists) { int n = dropItems.DroppableItemCount; for (int i = 0; i < n; i++) { ItemSample item = dropItems.GetDroppableItemAt(i); items.Add(new MaterialItem() { protoId = item.protoId, count = item.stackCount }); } } if (!npcPackage.CanAddItemList(items)) { return; } foreach (MaterialItem item in items) { npcPackage.Add(item.protoId, item.count); } foreach (IDroppableItemList itemDrop in _itemLists) { itemDrop.RemoveDroppableItemAll(); } if (_skAlive != null && GetCount() == 0) { PeEventGlobal.Instance.PickupEvent.Invoke(_skAlive); } }