void SetMenuListItemContent(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.name, data.id, newFlag, data.icon, data.GetName(), index, ListItemType.mItem);
        item.SetSelectmState(false);

        item.mItemClick -= OnMenuListItemClick;
        item.mItemClick += OnMenuListItemClick;
    }
Exemple #2
0
    private void ListItemOnClick(int index)
    {
        if (IsCompounding)
        {
            return;
        }
        if (index < 0 || index >= m_ItemDataList.Count)
        {
            return;
        }
        List <GameObject> items = m_LeftList.Gos;

        if (mListSelectedIndex != -1 && mListSelectedIndex < items.Count)
        {
            UICompoundWndListItem item = items[mListSelectedIndex].GetComponent <UICompoundWndListItem>();
            item.SetSelectmState(false);
        }
        if (index < items.Count)
        {
            UICompoundWndListItem item = items[index].GetComponent <UICompoundWndListItem>();
            item.SetSelectmState(true);
        }
        mListSelectedIndex = index;
        this.UpdateCurItemScriptList(this.m_ItemDataList[index].id);
        this.SelectFirstScritItem();
    }
    void ClearMenuListItemContent(GameObject go)
    {
        UICompoundWndListItem cwl = go.GetComponent <UICompoundWndListItem>();

        if (cwl == null)
        {
            return;
        }

        cwl.mItemClick -= OnMenuListItemClick;
    }
Exemple #4
0
    void NewClearLeftListContent(GameObject go)
    {
        UICompoundWndListItem item = go.GetComponent <UICompoundWndListItem>();

        if (item == null)
        {
            return;
        }

        item.mItemClick -= ListItemOnClick;
    }
    void OnMenuListItemClick(int index)
    {
        if (index < 0 || index >= m_ItemDataList.Count)
        {
            return;
        }
        List <GameObject> items = FactoryReplicator.m_MenuContent.gridList.Gos;

        if (mListSelectedIndex != -1 && mListSelectedIndex < items.Count)
        {
            UICompoundWndListItem item = items[mListSelectedIndex].GetComponent <UICompoundWndListItem>();
            item.SetSelectmState(false);
        }
        if (index < items.Count)
        {
            UICompoundWndListItem item = items[index].GetComponent <UICompoundWndListItem>();
            item.SetSelectmState(true);
        }
        mListSelectedIndex = index;
        this.UpdateCurItemScriptList(this.m_ItemDataList[index].id);
        this.SelectFirstScritItem();
    }
Exemple #6
0
    //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);
        }
    }