void Start () { ItemConversion.converter = new GameObjectItemDataConverter(); ItemDataList droppedItems = new ItemDataList(); for (int i = 0; i < 3; i++) { SocialPlay.Data.ItemData newItem = new SocialPlay.Data.ItemData(); newItem.Amount = 0; newItem.AssetBundleName = "h"; newItem.BaseItemEnergy = 0; newItem.BaseItemID = 0; newItem.Behaviours = "k"; newItem.Description = ""; newItem.Detail = ""; newItem.Energy = 0; newItem.Image = ""; newItem.ItemID = 0; newItem.Location = 0; newItem.Name = ""; newItem.Quality = 0; newItem.SellPrice = 0; newItem.StackLocationID = Guid.Empty; newItem.Tags = ""; newItem.Type = 0; droppedItems.Add(newItem); } List<ItemData> items = ItemConversion.converter.ConvertItems(droppedItems); itemGetter.OnReceivedGeneratedItems(items); }
void Start() { ItemConversion.converter = new GameObjectItemDataConverter(); ItemDataList droppedItems = new ItemDataList(); for (int i = 0; i < 3; i++) { SocialPlay.Data.ItemData newItem = new SocialPlay.Data.ItemData(); newItem.Amount = 0; newItem.AssetBundleName = "h"; newItem.BaseItemEnergy = 0; newItem.BaseItemID = 0; newItem.Behaviours = "k"; newItem.Description = ""; newItem.Detail = ""; newItem.Energy = 0; newItem.Image = ""; newItem.ItemID = 0; newItem.Location = 0; newItem.Name = ""; newItem.Quality = 0; newItem.SellPrice = 0; newItem.StackLocationID = Guid.Empty; newItem.Tags = ""; newItem.Type = 0; droppedItems.Add(newItem); } List <ItemData> items = ItemConversion.converter.ConvertItems(droppedItems); itemGetter.OnReceivedGeneratedItems(items); }
public CatalogDeal(int Id, int PageId, string Items, string DisplayName, int Credits, int Pixels, ItemDataManager ItemDataManager) { this.Id = Id; this.PageId = PageId; this.DisplayName = DisplayName; this.ItemDataList = new List <CatalogItem>(); string[] SplitItems = Items.Split(';'); foreach (string Split in SplitItems) { string[] Item = Split.Split('*'); int ItemId = 0; int Amount = 0; if (!int.TryParse(Item[0], out ItemId) || !int.TryParse(Item[1], out Amount)) { continue; } ItemData Data = null; if (!ItemDataManager.GetItem(ItemId, out Data)) { continue; } ItemDataList.Add(new CatalogItem(0, ItemId, Data, string.Empty, PageId, CostCredits, CostPixels, 0, Amount, 0, 0, false, "", "", 0, 0, 0)); } this.CostCredits = Credits; this.CostPixels = Pixels; }
/// <summary> /// ItemDataListの中身を再生成する /// /// ブロックのデータも入れないといけない為、生成用のメソッドを作成 /// 何かいい方法はない? /// </summary> public static void refresh() { ItemDataList.AddRange(ItemBaseList); foreach (var block in BlockData.BlockBaseList) { if (block.canInventory) { ItemDataList.Add(new ItemBaseData() { name = block.name, description = block.description }); } } }
private static void CreateItemData(ItemDataList itemDataList, JsonReader reader) { if (reader.Token.ToString() == "ObjectStart") { SocialPlay.Data.ItemData itemData = new SocialPlay.Data.ItemData(); while (reader.Token.ToString() != "ObjectEnd") { reader.Read(); if (reader.Token.ToString() == "PropertyName") { string propertyString = reader.Value.ToString(); reader.Read(); if (propertyString == "StackLocationID") { itemData.StackLocationID = new Guid(reader.Value.ToString()); } if (propertyString == "Amount") { int tmpInt = 0; int.TryParse(reader.Value.ToString(), out tmpInt); itemData.Amount = tmpInt; } if (propertyString == "Detail") { itemData.Detail = reader.Value.ToString(); } if (propertyString == "ItemID") { int tmpInt = 0; int.TryParse(reader.Value.ToString(), out tmpInt); itemData.ItemID = tmpInt; } if (propertyString == "Type") { int tmpInt = 0; int.TryParse(reader.Value.ToString(), out tmpInt); itemData.Type = tmpInt; } if (propertyString == "Location") { int tmpInt = 0; int.TryParse(reader.Value.ToString(), out tmpInt); itemData.Location = tmpInt; } if (propertyString == "BaseItemEnergy") { int tmpInt = 0; int.TryParse(reader.Value.ToString(), out tmpInt); itemData.BaseItemEnergy = tmpInt; } if (propertyString == "Energy") { int tmpInt = 0; int.TryParse(reader.Value.ToString(), out tmpInt); itemData.Energy = tmpInt; } if (propertyString == "SellPrice") { int tmpInt = 0; int.TryParse(reader.Value.ToString(), out tmpInt); itemData.SellPrice = tmpInt; } if (propertyString == "Name") { itemData.Name = reader.Value.ToString(); } if (propertyString == "Image") { itemData.Image = reader.Value.ToString(); } if (propertyString == "Quality") { int tmpInt = 0; int.TryParse(reader.Value.ToString(), out tmpInt); itemData.Quality = tmpInt; } if (propertyString == "Behaviours") { if (reader.Value != null) { itemData.Behaviours = reader.Value.ToString(); } } if (propertyString == "BaseItemID") { int tmpInt = 0; int.TryParse(reader.Value.ToString(), out tmpInt); itemData.BaseItemID = tmpInt; } if (propertyString == "Description") { itemData.Description = reader.Value.ToString(); } if (propertyString == "AssetBundleName") { itemData.AssetBundleName = reader.Value.ToString(); } if (propertyString == "Tags") { if (reader.Value != null) { itemData.Tags = reader.Value.ToString(); } } } } itemDataList.Add(itemData); } }
public CatalogDeal(int Id, string Items, string DisplayName, int RoomId, ItemDataManager ItemDataManager) { this.Id = Id; this.DisplayName = DisplayName; this.RoomId = RoomId; this.ItemDataList = new List <CatalogItem>(); if (RoomId != 0) { DataTable getRoomItems = null; Dictionary <int, int> roomItems = new Dictionary <int, int>(); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `items`.base_item, COALESCE(`items_groups`.`group_id`, 0) AS `group_id` FROM `items` LEFT OUTER JOIN `items_groups` ON `items`.`id` = `items_groups`.`id` WHERE `items`.`room_id` = @rid;"); dbClient.AddParameter("rid", RoomId); getRoomItems = dbClient.GetTable(); } if (getRoomItems != null) { foreach (DataRow dRow in getRoomItems.Rows) { int item_id = Convert.ToInt32(dRow["base_item"]); if (roomItems.ContainsKey(item_id)) { roomItems[item_id]++; } else { roomItems.Add(item_id, 1); } } } foreach (var roomItem in roomItems) { Items += roomItem.Key + "*" + roomItem.Value + ";"; } if (roomItems.Count > 0) { Items = Items.Remove(Items.Length - 1); } } string[] SplitItems = Items.Split(';'); foreach (string Split in SplitItems) { string[] Item = Split.Split('*'); int ItemId = 0; int Amount = 0; if (!int.TryParse(Item[0], out ItemId) || !int.TryParse(Item[1], out Amount)) { continue; } ItemData Data = null; if (!ItemDataManager.GetItem(ItemId, out Data)) { continue; } ItemDataList.Add(new CatalogItem(0, ItemId, Data, string.Empty, 0, 0, 0, 0, Amount, 0, 0, false, "", "", 0)); } }