void OnSetViewNodeChildContent(int index, GameObject child) { UIMissionGoalNode node = child.GetComponent <UIMissionGoalNode>(); MissionGoal mg = _goals[index]; string txt = ""; if (mg is MissionGoal_Bool) { MissionGoal_Bool mb = mg as MissionGoal_Bool; txt = mb.text; node.value2 = mg.id; } else if (mg is MissionGoal_Item) { MissionGoal_Item mi = mg as MissionGoal_Item; txt = mi.text + " " + mi.current.ToString() + "/" + mi.target.ToString(); node.value0 = mi.current; node.value1 = mi.target; node.value2 = mg.id; } else if (mg is MissionGoal_Kill) { MissionGoal_Kill mi = mg as MissionGoal_Kill; txt = mi.text + " " + mi.current.ToString() + "/" + mi.target.ToString(); node.value0 = mi.current; node.value1 = mi.target; node.value2 = mg.id; } node.SetContent(txt, false, false); }
void OnSetGoalItemContent(UIMissionGoalItem item) { MissionGoal mg = _goals[item.index]; if (!mg.achieved) { item.textColor = Color.white; } else { item.textColor = Color.green; } if (mg as MissionGoal_Bool != null) { MissionGoal_Bool mgb = mg as MissionGoal_Bool; item.SetBoolContent(mgb.text, mgb.achieved); } else if (mg as MissionGoal_Item != null) { MissionGoal_Item mgi = mg as MissionGoal_Item; string text = mgi.text + " " + mgi.current.ToString() + "/" + mgi.target.ToString(); item.value0 = mgi.current; item.value1 = mgi.target; if (mgi.item.isSpecificPrototype) { string[] sprites = ItemAsset.ItemProto.GetIconName(mgi.item.Id); if (sprites != null) { item.SetItemContent(text, sprites[0]); } else { item.SetItemContent(text); } } else { item.SetItemContent(text); } } else if (mg as MissionGoal_Kill != null) { MissionGoal_Kill mgk = mg as MissionGoal_Kill; string text = mgk.text + " " + mgk.current.ToString() + "/" + mgk.target.ToString(); MissionGoal_Kill mgi = mg as MissionGoal_Kill; item.value0 = mgi.current; item.value1 = mgi.target; if (item != null) { if (mgi.monster.isSpecificEntity) { SpawnPoint sp = PeCustomScene.Self.spawnData.GetSpawnPoint(mgi.id); if (sp as MonsterSpawnPoint != null) { MonsterProtoDb.Item proto = MonsterProtoDb.Get(sp.ID); item.SetItemContent(text, proto.icon); } else if (sp as NPCSpawnPoint != null) { NpcProtoDb.Item proto = NpcProtoDb.Get(sp.ID); item.SetItemContent(text, proto.icon); } else { item.SetItemContent(text); } } else if (mgi.monster.isSpecificPrototype) { MonsterProtoDb.Item proto = MonsterProtoDb.Get(mgi.monster.Id); if (proto != null) { item.SetItemContent(text, proto.icon); } else { item.SetItemContent(text); } } else { item.SetItemContent(text); } } else { item.SetItemContent(text); } } }