Пример #1
0
        private void OnRecvGetTmallItems(IChannel channel, Message message)
        {
            SGetTmallItems msg = message as SGetTmallItems;

            World.Instance.TmallItems = msg.TmallItems.ToList <KeyValuePair <ItemConf, CostConf> >();
            World.Instance.TmallItems.Sort(delegate(KeyValuePair <ItemConf, CostConf> kv1, KeyValuePair <ItemConf, CostConf> kv2) {
                if (kv1.Value.costType != kv2.Value.costType)
                {
                    return(kv2.Value.costType.CompareTo(kv1.Value.costType));
                }
                else
                {
                    return(kv1.Key.type.CompareTo(kv2.Key.type));
                }
            });
            World.Instance.TmallItems.Insert(1, new KeyValuePair <ItemConf, CostConf>(
                                                 new ItemConf()
            {
                name = "Silver", icon = "Silver", type = ItemType.Others
            },
                                                 new CostConf()
            {
                costType = CostType.Gold, cost = 5
            }));
            GameObject.FindObjectOfType <ShelfGridUI>().GetAllItems();
        }
Пример #2
0
        private void OnRecvGetTmallItems(IChannel channel, Message message)
        {
            SGetTmallItems response = new SGetTmallItems();
            var            items    = FrontEnd.Item.FItem.itemConfs;
            List <KeyValuePair <ItemConf, CostConf> > item_price = new List <KeyValuePair <ItemConf, CostConf> >();

            foreach (var item in items)
            {
                CostConf costConf = new CostConf {
                    cost = 5, costType = CostType.Gold
                };
                if (item.name == "HealthElixir")
                {
                    costConf.costType = CostType.Silver;
                }
                item_price.Add(new KeyValuePair <ItemConf, CostConf>(item, costConf));
            }
            response.TmallItems = item_price.ToArray();
            channel.Send(response);
            System.Console.WriteLine("GetTmallItems");
        }