private bool ReDrawGraph(int itemID, int scirptIndex = 0) { if (mGraphCtrl == null) { return(false); } this.AddScriptItemData(itemID); if (!this.m_Formulas.ContainsKey(itemID) || scirptIndex >= this.m_Formulas[itemID].Count || scirptIndex < 0) { return(true); } if (mRootType == ItemLabel.Root.ISO) { // Iso } else { Pathea.Replicator.KnownFormula knownFornula = this.m_Formulas[itemID][scirptIndex]; Pathea.Replicator.Formula ms = knownFornula.Get(); ItemProto item = this.m_ItemDataList.Find(a => a.id == itemID); if (ms == null || item == null) { return(false); } // 临时处理 bool enable = (ms.workSpace != 0) ? true : false; mLbGraphInfo.enabled = enable; mLbGraphInfo.text = enable ? PELocalization.GetString(8000151) : ""; mGraphCtrl.ClearGraph(); int level_v = 0; UIGraphNode root = mGraphCtrl.AddGraphItem(level_v, null, ms, item.icon, "Icon"); root.mTipCtrl.SetToolTipInfo(ListItemType.mItem, itemID); root.mCtrl.ItemClick += this.GraphItemOnClick; this.m_CurScriptMatIDs.Clear(); for (int j = 0; j < ms.materials.Count; j++) { if (ms.materials[j].itemId != 0) { this.m_CurScriptMatIDs.Add(ms.materials[j].itemId); ItemProto item2 = ItemProto.GetItemData(ms.materials[j].itemId); UIGraphNode node = mGraphCtrl.AddGraphItem(level_v, root, null, item2.icon, "Icon"); node.mTipCtrl.SetToolTipInfo(ListItemType.mItem, ms.materials[j].itemId); node.mCtrl.ItemClick += this.GraphItemOnClick; } } UpdateItemsTrackState(ms); } mGraphCtrl.DrawGraph(); return(true); }
//lz-2016.08.08 点击ScriptItem事件 private void ScriptItemEvent(int itemID, int scriptIndex) { if (!this.m_Formulas.ContainsKey(itemID) || scriptIndex >= this.m_Formulas[itemID].Count || scriptIndex < 0) { return; } //更改new的状态 Pathea.Replicator.KnownFormula knownFornula = this.m_Formulas[itemID][scriptIndex]; Pathea.Replicator r = replicator; if (null != r) { r.SetKnownFormulaFlag(knownFornula.id); } //颜色根据选的脚本改变 List <GameObject> ListItems = m_LeftList.Gos; if (mListSelectedIndex >= 0 && mListSelectedIndex < ListItems.Count) { Pathea.Replicator.Formula formula = knownFornula.Get(); bool isInColony = (formula.workSpace != 0) ? true : false; Color textColor = isInColony ? Color.red : Color.white; UICompoundWndListItem listItem = ListItems[mListSelectedIndex].GetComponent <UICompoundWndListItem>(); listItem.SetTextColor(textColor); } //绘制当前选择的脚本和Item bool ok = ReDrawGraph(itemID, scriptIndex); if (ok) { AddGraphResetList(itemID); SetBottomInfo(); QueryGridItems(itemID); } }
// --------------------------------- // Func // --------------------------------- private bool ReDrawGraph(int itemID, int scirptIndex = 0) { if (FactoryReplicator == null) { return(false); } this.AddScriptItemData(itemID); if (!this.m_Formulas.ContainsKey(itemID) || scirptIndex >= this.m_Formulas[itemID].Count || scirptIndex < 0) { return(true); } UIGraphControl graph_ctrl = FactoryReplicator.m_MiddleContent.graphCtrl; if (m_RootType == ItemLabel.Root.ISO) { // Iso } else { if (itemID != -1) { //Pathea.Replicator.Formula ms = Pathea.Replicator.Formula.Mgr.Instance.FindByProductId(m_id); Pathea.Replicator.KnownFormula knownFornula = this.m_Formulas[itemID][scirptIndex]; Pathea.Replicator.Formula ms = knownFornula.Get(); ItemProto item = this.m_ItemDataList.Find(a => a.id == itemID); if (ms == null || item == null) { return(false); } FactoryReplicator.ClearGraph(); int level_v = 0; UIGraphNode root = graph_ctrl.AddGraphItem(level_v, null, ms, item.icon, "Icon"); root.mTipCtrl.SetToolTipInfo(ListItemType.mItem, itemID); root.mCtrl.ItemClick += this.OnGraphItemClick; for (int j = 0; j < ms.materials.Count; j++) { if (ms.materials[j].itemId != 0) { ItemProto item2 = ItemProto.GetItemData(ms.materials[j].itemId); string[] strico2 = item2.icon; UIGraphNode node = graph_ctrl.AddGraphItem(level_v, root, null, strico2, "Icon"); node.mTipCtrl.SetToolTipInfo(ListItemType.mItem, ms.materials[j].itemId); node.mCtrl.ItemClick += this.OnGraphItemClick; } } UpdateItemsTrackState(ms); } } // graph_ctrl.DrawGraph(); FactoryReplicator.DrawGraph(); return(true); }