private void OnEnable() { foreach (Transform transform in ShelfGridContent.transform) { Destroy(transform.gameObject); } CGetMarketItems msg = new CGetMarketItems(); Gamekit3D.Network.Client.Instance.Send(msg); }
private void OnRecvGetMarketItems(IChannel channel, Message message) { CGetMarketItems msg = message as CGetMarketItems; SGetMarketItems response = new SGetMarketItems(); List <MarketItem> items = new List <MarketItem>(); using (var conn = GameDataBase.GetConnection()) { using (var cmd = conn.CreateCommand()) { cmd.CommandText = "Select " + "Item.item_id, seller_id, price_type, price, name, health_value, speed_value, damage_value, intelligence_value, defence_value, icon, type " + "From Market,Item Where valid=true And Market.item_id=Item.item_id;"; var reader = cmd.ExecuteReader(); while (reader.Read()) { MarketItem item = new MarketItem(); DItem ditem = new DItem(); ditem.item_id = reader.GetInt32(0); item.owner_id = reader.GetInt32(1); item.costConf.costType = (CostType)System.Enum.Parse(typeof(CostType), reader.GetString(2)); item.costConf.cost = reader.GetInt32(3); ditem.name = reader.GetString(4); ditem.health_value = reader.GetInt32(5); ditem.speed_value = reader.GetInt32(6); ditem.damage_value = reader.GetInt32(7); ditem.intelligence_value = reader.GetInt32(8); ditem.defence_value = reader.GetInt32(9); ditem.icon_name = reader.GetString(10); ditem.item_type = (ItemType)System.Enum.Parse(typeof(ItemType), reader.GetString(11)); item.ditem = ditem; items.Add(item); } reader.Close(); } } response.items = items.ToArray(); channel.Send(response); }