//int[] m_ProductItemList = null; //List<int> m_NeedShowItem = new List<int>(1); void SetLeftListContent(int index, GameObject go) { UICompoundWndListItem item = go.GetComponent <UICompoundWndListItem>(); if (item == null) { return; } if (index < 0 || index >= m_ItemDataList.Count) { return; } ItemProto data = m_ItemDataList[index]; if (!this.m_Formulas.ContainsKey(data.id)) { return; } //lz-2016.08.08 有任何可以合成这个Item的新脚本就标记为new bool newFlag = this.m_Formulas[data.id].Any(a => a.flag == true); item.SetItem(data.GetName(), data.id, newFlag, data.icon, data.GetName(), index, ListItemType.mItem); item.SetSelectmState(false); //lz-2017.01.16 错误 #8503 item颜色不正确 item.SetTextColor(Color.white); item.mItemClick -= ListItemOnClick; item.mItemClick += ListItemOnClick; }
void OnPlayerItemPackageEvent(object sender, PlayerPackageCmpt.GetItemEventArg e) { // ItemPackage.EventArg.Op type = e.; PlayerPackageCmpt pkg = PeCreature.Instance.mainPlayer.GetCmpt <Pathea.PlayerPackageCmpt>(); if (pkg == null) { return; } // ItemObject io = e.itemObj; // if (io == null) // return; ItemProto item = ItemProto.Mgr.Instance.Get(e.protoId); if (item == null) { return; } //lz-2018.1.19 获取东西的时候显示背包数量 string msg = string.Format("{0} X {1} ({2})", item.GetName(), e.count, pkg.GetItemCount(e.protoId)); new PeTipMsg(msg, item.icon[0], PeTipMsg.EMsgLevel.Norm, PeTipMsg.EMsgType.Misc); // PeTipMsg tips = new PeTipMsg(msg, PeTipMsg.EMsgLevel.Warning, PeTipMsg.EMsgType.Misc); }
void OnIsoClick(int index) { if (mWndCtrl.IsoListSelectIndex > -1) { mWndCtrl.ClearCostList(); BSIsoHeadData header = m_IsoHeaders[mWndCtrl.IsoListSelectIndex]; foreach (var kvp in header.costs) { int item_id = PEBuildingMan.GetBlockItemProtoID(kvp.Key); // if (item_id < PEBuildingMan.c_MinItemProtoID || item_id > PEBuildingMan.c_MaxItemProtoID) // continue; if (item_id == -1) { return; } ItemProto proto = ItemProto.Mgr.Instance.Get(item_id); Pathea.PlayerPackageCmpt pkg = Pathea.PeCreature.Instance.mainPlayer.GetCmpt <Pathea.PlayerPackageCmpt>(); int player_cnt = pkg.GetItemCount(item_id); int final_cnt = Mathf.Clamp(player_cnt, 0, 9999); mWndCtrl.AddCostListItem(proto.GetName(), Mathf.CeilToInt(kvp.Value / 4.0f).ToString() + '/' + final_cnt.ToString(), proto.icon[0], "Icon"); } IsoRePos = true; //mWndCtrl.ResetCostPostion(); } }
void RPC_S2C_NewItemList(uLink.BitStream stream, uLink.NetworkMessageInfo info) { ItemSample[] newItems = stream.Read <ItemSample[]>(); if (null == newItems || newItems.Length <= 0) { return; } foreach (ItemSample item in newItems) { if (null == item) { continue; } if (null != MissionManager.Instance) { MissionManager.Instance.ProcessCollectMissionByID(item.protoId); } // GlobalShowGui_N.Instance.AddShow(item); ItemProto protoData = ItemProto.Mgr.Instance.Get(item.protoId); if (protoData == null) { continue; } string msg = protoData.GetName() + " X " + item.stackCount.ToString(); /*PeTipMsg tips = */ new PeTipMsg(msg, protoData.icon[0], PeTipMsg.EMsgLevel.Norm, PeTipMsg.EMsgType.Misc); } }
public string GetName() // 名字 { if (_itemData != null) { return(_itemData.GetName()); } return(""); }
void UpdateNodeText(UIMissionNode node) { if (node == null) { return; } if (!_nodeDataDic.ContainsKey(node)) { return; } ItemTrackData data = _nodeDataDic[node]; if (data == null) { return; } UIMissionNode childNode = null; if (node.mChilds.Count > 0) { childNode = node.mChilds[0]; } bool complate = true; if (playerPackage != null) { string text = string.Empty; foreach (var kv in data.costDic) { string costName = ItemProto.GetName(kv.Key); int curCount = playerPackage.GetCount(kv.Key); string countStr = string.Empty; countStr = string.Format(countFormat, curCount, kv.Value); bool costComplate = curCount >= kv.Value; text += string.Format(costComplate ? complateCountColor : uncompletedCountColor, costName, countStr); if (!costComplate) { complate = false; } } if (childNode) { childNode.mLbTitle.text = text; } } string titleText = data.itemName; if (complate) { titleText = string.Format(complateTitleColor, string.Format(complateTitleFormat, data.itemName, data.itemCount, PELocalization.GetString(8000694))); } node.mLbTitle.text = titleText; }
static List <string> GetEquipName(List <int> itemProtoIDs) { List <string> retList = new List <string>(); if (null != itemProtoIDs) { for (int i = 0; i < itemProtoIDs.Count; ++i) { ItemProto itemData = ItemProto.Mgr.Instance.Get(itemProtoIDs[i]); retList.Add(null != itemData ? itemData.GetName() : ""); } } return(retList); }
void OnItemToolTip(bool show, UIBuildWndItem.ItemType item_type, int item_index) { if (item_type == UIBuildWndItem.ItemType.mVoxelMat) { ItemProto proto = ItemProto.Mgr.Instance.Get(m_VoxelProtoItems[item_index]); UITooltip.ShowText(proto.GetName()); } else if (item_type == UIBuildWndItem.ItemType.mBlockMat) { ItemProto proto = ItemProto.Mgr.Instance.Get(m_BlockProtoItems[item_index]); UITooltip.ShowText(proto.GetName()); } else if (item_type == UIBuildWndItem.ItemType.mMenu) { UIBuildWndItem item = mMenuCtrl.mBoxBars.Items[item_index].GetComponent <UIBuildWndItem>(); if (item != null) { if (item.mTargetItemType == UIBuildWndItem.ItemType.mVoxelMat) { ItemProto proto = ItemProto.Mgr.Instance.Get(m_VoxelProtoItems[item.mTargetIndex]); UITooltip.ShowText(proto.GetName()); } else if (item.mTargetItemType == UIBuildWndItem.ItemType.mBlockMat) { ItemProto proto = ItemProto.Mgr.Instance.Get(m_BlockProtoItems[item.mTargetIndex]); UITooltip.ShowText(proto.GetName()); } else if (item.mTargetItemType == UIBuildWndItem.ItemType.mVoxelType) { int proto_id = BSVoxelMatMap.GetItemID(item.ItemId); ItemProto proto = ItemProto.Mgr.Instance.Get(proto_id); UITooltip.ShowText(proto.GetName()); } } } else if (item_type == UIBuildWndItem.ItemType.mVoxelType) { int proto_id = BSVoxelMatMap.GetItemID(m_VoxelTypeList[item_index]); ItemProto proto = ItemProto.Mgr.Instance.Get(proto_id); UITooltip.ShowText(proto.GetName()); } }
public void UpdateOrAddScript(Pathea.Replicator.Formula ms, int multiple) { if (ms == null) { return; } ItemTrackData data = null; foreach (var nodeData in _nodeDataDic.Values) { if (nodeData.type == TrackType.Script && nodeData.scriptID == ms.id) { data = nodeData; break; } } bool needAdd = false; if (data == null) { data = new ItemTrackData(TrackType.Script); data.scriptID = ms.id; data.itemName = ItemProto.GetName(ms.productItemId); needAdd = true; } else { data.costDic.Clear(); } data.itemCount = multiple * ms.m_productItemCount; foreach (var item in ms.materials) { data.costDic.Add(item.itemId, item.itemCount * multiple); } if (needAdd) { AddTrackData(data); } }
void UpdateLeftList(bool useSearch = false) { if (null == m_Replicator) { return; } string queryText = FactoryReplicator.GetQueryString(); m_Formulas.Clear(); m_ItemDataList.Clear(); Dictionary <ItemProto, List <Pathea.Replicator.KnownFormula> > itemDic = new Dictionary <ItemProto, List <Pathea.Replicator.KnownFormula> >(); foreach (Pathea.Replicator.KnownFormula kf in m_Replicator.knowFormulas) { if (kf == null) { continue; } Pathea.Replicator.Formula f = kf.Get(); if (null == f) { continue; } ItemProto item = ItemProto.GetItemData(f.productItemId); if (item == null) { continue; } bool AddItem = false; if (m_RootType == ItemLabel.Root.ISO) { // Iso } else if (m_RootType == ItemLabel.Root.all || (m_RootType == item.rootItemLabel && (m_ItemType == 0 || m_ItemType == item.itemLabel))) { if (useSearch) { if (QueryItem(queryText, item.GetName())) { AddItem = true; } } else { AddItem = true; } } if (AddItem) { //lz-2016.08.09 这里要用Any()不能用Container() if (!itemDic.Keys.Any(a => a.id == item.id)) { itemDic.Add(item, new List <Replicator.KnownFormula>()); } ItemProto itemKey = itemDic.Keys.First(a => a.id == item.id); if (!itemDic[itemKey].Any(a => a.id == kf.id)) { itemDic[itemKey].Add(kf); } } } //lz-2016.08.08根据Item的Sort字段来排序 itemDic = itemDic.OrderBy(a => a.Key.sortLabel).ToDictionary(k => k.Key, v => v.Value); m_Formulas = itemDic.ToDictionary(k => k.Key.id, v => v.Value); m_ItemDataList = itemDic.Keys.ToList(); FactoryReplicator.m_MenuContent.gridList.UpdateList(m_ItemDataList.Count, SetMenuListItemContent, ClearMenuListItemContent); FactoryReplicator.m_MenuContent.scrollBox.m_VertScrollBar.scrollValue = 0; }
public bool _updateLeftList = true;//使更新不过于太频繁 //log:lz-2016.04.12: 这里加一个参数为了搜索和切换类型分开 public void UpdateLeftList(bool useSearch = false) { if (!_updateLeftList) { return; } _updateLeftList = false; mListSelectedIndex = -1; string queryText = mQueryInput.text; // replace some # queryText = queryText.Replace("*", ""); queryText = queryText.Replace("$", ""); queryText = queryText.Replace("(", ""); queryText = queryText.Replace(")", ""); queryText = queryText.Replace("@", ""); queryText = queryText.Replace("^", ""); queryText = queryText.Replace("[", ""); queryText = queryText.Replace("]", ""); //lz-2016.08.12 "\"增加字符过滤 queryText = queryText.Replace("\\", ""); //queryText = queryText.Replace(" ", ""); mQueryInput.text = queryText; m_Formulas.Clear(); m_ItemDataList.Clear(); Pathea.Replicator r = replicator; Dictionary <ItemProto, List <Pathea.Replicator.KnownFormula> > itemDic = new Dictionary <ItemProto, List <Pathea.Replicator.KnownFormula> >(); foreach (Pathea.Replicator.KnownFormula kf in r.knowFormulas) { if (kf == null) { continue; } Pathea.Replicator.Formula f = kf.Get(); if (null == f) { continue; } ItemProto item = ItemProto.GetItemData(f.productItemId); if (item == null) { continue; } bool AddItem = false; if (mRootType == ItemLabel.Root.ISO) { // Iso } else if (mRootType == ItemLabel.Root.all || (mRootType == item.rootItemLabel && (mItemType == 0 || mItemType == item.itemLabel))) { if (useSearch) { if (QueryItem(queryText, item.GetName())) { AddItem = true; } } else { AddItem = true; } } if (AddItem) { //lz-2016.08.09 这里要用Any()不能用Container() if (!itemDic.Keys.Any(a => a.id == item.id)) { itemDic.Add(item, new List <Replicator.KnownFormula>()); } ItemProto itemKey = itemDic.Keys.First(a => a.id == item.id); if (!itemDic[itemKey].Any(a => a.id == kf.id)) { itemDic[itemKey].Add(kf); } } } //lz-2016.08.08根据Item的Sort字段来排序 itemDic = itemDic.OrderBy(a => a.Key.sortLabel).ToDictionary(k => k.Key, v => v.Value); m_Formulas = itemDic.ToDictionary(k => k.Key.id, v => v.Value); m_ItemDataList = itemDic.Keys.ToList(); m_LeftList.UpdateList(m_ItemDataList.Count, SetLeftListContent, ClearLeftListContent); mListScrolBar.scrollValue = 0; }