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 Update()
    {
        if (!_initialized)
        {
            return;
        }

        if (missionWnd.isShow)
        {
            if (_currentGoals != null)
            {
                for (int i = 0; i < _goals.Count; i++)
                {
                    MissionGoal mg = _goals[i];


                    if (mg as MissionGoal_Item != null)
                    {
                        MissionGoal_Item  mgi  = mg as MissionGoal_Item;
                        UIMissionGoalItem item = missionWnd.GetGoalItem(i);

                        int current = mgi.current;
                        int target  = mgi.target;
                        if (item != null && (current != item.value0 || target != item.value1))
                        {
                            string text = mgi.text + " " + mgi.current.ToString() + "/" + mgi.target.ToString();

                            item.itemText = text;

                            item.value0 = current;
                            item.value1 = target;
                        }
                    }
                    else if (mg as MissionGoal_Kill != null)
                    {
                        MissionGoal_Kill  mgi  = mg as MissionGoal_Kill;
                        UIMissionGoalItem item = missionWnd.GetGoalItem(i);

                        int current = mgi.current;
                        int target  = mgi.target;
                        if (item != null && (current != item.value0 || target != item.value1))
                        {
                            string text = mgi.text + " " + mgi.current.ToString() + "/" + mgi.target.ToString();

                            item.itemText = text;

                            item.value0 = current;
                            item.value1 = target;
                        }
                    }
                }
            }
        }
    }
    void Update()
    {
        if (!_initialized)
        {
            return;
        }

        if (missionTrackWnd.isShow)
        {
            for (int i = 0; i < missionTrackWnd.viewNodes.Count; i++)
            {
                UIMissionGoalNode vNode = missionTrackWnd.viewNodes[i];
                int mission_id          = m_TrackedIds[i];
                for (int j = 0; j < vNode.childNode.Count; j++)
                {
                    UIMissionGoalNode child_node = vNode.childNode[j].GetComponent <UIMissionGoalNode>();
                    MissionGoal       mg         = PeCustomScene.Self.scenario.missionMgr.GetGoal(child_node.value2, mission_id);
                    if (mg != null)
                    {
                        if (mg is MissionGoal_Item)
                        {
                            MissionGoal_Item mgi = mg as MissionGoal_Item;
                            int current          = mgi.current;
                            int target           = mgi.target;

                            if (current != child_node.value0 || target != child_node.value1)
                            {
                                if (mgi.achieved)
                                {
                                    child_node.titleColor = new Color(0.65f, 0.65f, 0.65f);
                                }
                                else
                                {
                                    child_node.titleColor = Color.white;
                                }
                                string text = mgi.text + " " + mgi.current.ToString() + "/" + mgi.target.ToString();

                                child_node.SetContent(text, false, false);

                                child_node.value0 = current;
                                child_node.value1 = target;
                            }
                        }
                        else if (mg is MissionGoal_Kill)
                        {
                            MissionGoal_Kill mgi = mg as MissionGoal_Kill;
                            int current          = mgi.current;
                            int target           = mgi.target;
                            if (current != child_node.value0 || target != child_node.value1)
                            {
                                if (mgi.achieved)
                                {
                                    child_node.titleColor = new Color(0.75f, 0.75f, 0.75f);
                                }
                                else
                                {
                                    child_node.titleColor = Color.white;
                                }
                                string text = mgi.text + " " + mgi.current.ToString() + "/" + mgi.target.ToString();

                                child_node.SetContent(text, false, false);

                                child_node.value0 = current;
                                child_node.value1 = target;
                            }
                        }
                    }
                }
            }
        }
    }
    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);
            }
        }
    }