示例#1
0
    void OnDoubleClick()
    {
        NOrder order = GameBaseInfo.Instance.othOrders.Find(x => x.id == Data.orderid);

        if (order != null)
        {
            string str  = "";
            int[]  cnts = order.GetCnts();
            int[]  ids  = order.GetItems();
            for (int i = 0; i < ids.Length; i++)
            {
                TItem item = Tables.Instance.GetTable <List <TItem> >(TableID.ITEMS).Find(x => x.id == ids[i]);
                str += item.name + "   X" + cnts[i] + "\n";
            }
            if (!string.IsNullOrEmpty(str))
            {
                StrText txt = new StrText(10074, str);
                UIHandler.Instance.Push(PageID.TEXT, txt);
            }
        }
        else
        {
            Debug.Log("order is null!");
        }
    }
示例#2
0
    private void OnAccnt(GameObject go)
    {
        List <NItem> nitems = new List <NItem>();

        if (langtis.Count > 0)
        {
            List <LangtiItem> langitems = langtis.FindAll(x => x.state == 1);
            foreach (var item in langtis)
            {
                NOrder order = GameBaseInfo.Instance.othOrders.Find(x => x.id == item.orderid);
                if (order != null)
                {
                    int[] items = order.GetItems();
                    int[] cnts  = order.GetCnts();
                    for (int i = 0; i < items.Length; i++)
                    {
                        NItem it = nitems.Find(x => x.id == items [i]);
                        if (it != null)
                        {
                            it.cnt += cnts [i];
                        }
                        else
                        {
                            NItem n = new NItem();
                            n.id  = items [i];
                            n.cnt = cnts [i];
                            nitems.Add(n);
                        }
                    }
                }
            }

            string content = string.Empty;
            for (int i = 0; i < nitems.Count; i++)
            {
                content += GameBaseInfo.Instance.items.Find(x => x.n_item.id == nitems [i].id).t_item.name + " X" + nitems [i].cnt + "\n";
            }
            UIHandler.Instance.Push(PageID.TEXT, new StrText(10057, string.Format(Localization.Get(10058), content)));
        }
        else
        {
            Toast.Instance.Show(10059);
        }
    }