private void ShowAwardItemsView() { DCopy copyDB = ReadCfgCopy.GetDataById(mCopyID); int awardID = copyDB.AwardId; List <KStruct> list = AwardModule.Instance.GetAwardDataByID(awardID); if (list == null) { return; } for (int i = 0; i < items.Count; i++) { ItemAward tab = items[i]; if (i < items.Count) { KStruct data = list[i]; tab.itemBtn.SetActive(true); GTItemHelper.ShowItemTexture(tab.itemTexture, data.Id); GTItemHelper.ShowItemQuality(tab.itemQuality, data.Id); GTItemHelper.ShowItemChip(tab.itemChip, data.Id); UIEventListener.Get(tab.itemBtn).onClick = delegate(GameObject go) { GTItemHelper.ShowItemDialogById(data.Id); }; } else { tab.itemBtn.SetActive(false); } } }
protected override void OnAwake() { btnEnter = transform.Find("Btn_Enter").gameObject; btnClose = transform.Find("Btn_Close").gameObject; btnSweep = transform.Find("Btn_Sweep").gameObject; btnOneKeyToSweep = transform.Find("Btn_OneKeyToSweep").gameObject; costActionTexture = transform.Find("CostAction/Texture").GetComponent <UITexture>(); costActionNum = transform.Find("CostAction/Num").GetComponent <UILabel>(); gateTexture = transform.Find("Info/Texture").GetComponent <UITexture>(); gateDesc = transform.Find("Info/Desc").GetComponent <UILabel>(); gateFightValue = transform.Find("Info/FightValue").GetComponent <UILabel>(); gateName = transform.Find("Background/TopBar/Label").GetComponent <UILabel>(); gateCopyType = transform.Find("Info/CopyType").GetComponent <UILabel>(); gateBattleTimes = transform.Find("Info/BattleTimes").GetComponent <UILabel>(); for (int i = 1; i <= 5; i++) { ItemAward it = new ItemAward(); it.itemBtn = transform.Find("Items/" + i).gameObject; it.itemTexture = it.itemBtn.transform.Find("Texture").GetComponent <UITexture>(); it.itemQuality = it.itemBtn.transform.Find("Quality").GetComponent <UISprite>(); it.itemChip = it.itemBtn.transform.Find("Chip").gameObject; items.Add(it); } }
protected override void OnAwake() { Transform pivot = transform.Find("Pivot"); btnEnter = pivot.Find("BtnEnter").gameObject; btnClose = pivot.Find("BtnClose").gameObject; btnSweep = pivot.Find("BtnSweep").gameObject; btnOneKeyToSweep = pivot.Find("BtnOneKeyToSweep").gameObject; costActionTexture = pivot.Find("CopyCostAction/Icon").GetComponent <UITexture>(); costActionNum = pivot.Find("CopyCostAction/Num").GetComponent <UILabel>(); gateTexture = pivot.Find("CopyInfo/CopyTexture").GetComponent <UITexture>(); gateDesc = pivot.Find("CopyInfo/CopyDesc").GetComponent <UILabel>(); gateFightValue = pivot.Find("CopyInfo/CopyRequireFightValue").GetComponent <UILabel>(); gateCopyDiffculty = pivot.Find("CopyInfo/CopyDifficulty").GetComponent <UILabel>(); gateBattleTimes = pivot.Find("CopyInfo/CopyBattleTimes").GetComponent <UILabel>(); gateName = pivot.Find("CopyName").GetComponent <UILabel>(); for (int i = 1; i <= 5; i++) { ItemAward it = new ItemAward(); it.itemBtn = pivot.Find("CopyItems/" + i).gameObject; it.itemTexture = it.itemBtn.transform.Find("Texture").GetComponent <UITexture>(); it.itemQuality = it.itemBtn.transform.Find("Quality").GetComponent <UISprite>(); it.itemChip = it.itemBtn.transform.Find("Chip").gameObject; items.Add(it); } }
async Task ExecuteSearch() { var searchResult = await session.SearchFort(Id, Position.Latitude, Position.Longitude); InitializeIsActiveTimer(searchResult.CooldownCompleteTimestampMs); if (searchResult.Result == FortSearchResponse.Types.Result.Success || searchResult.Result == FortSearchResponse.Types.Result.InventoryFull) { var sb = new StringBuilder("Pokestop successfully farmed."); sb.AppendFormat(" {0}Xp", searchResult.ExperienceAwarded); player.Xp += searchResult.ExperienceAwarded; foreach (var itemGroup in searchResult.ItemsAwarded.GroupBy(i => i.ItemId)) { // since 3 pokeballs are returned as 3x one pokeball, we group here to get a nicer display. var item = new ItemAward { ItemCount = itemGroup.Sum(i => i.ItemCount), ItemId = itemGroup.Key }; var itemInInventory = player.Inventory.Items.SingleOrDefault(i => (int)i.ItemType == (int)item.ItemId); if (itemInInventory == null) { itemInInventory = new ItemViewModel(item, session); player.Inventory.Items.Add(itemInInventory); } else { itemInInventory.Count += item.ItemCount; } sb.AppendFormat(" - {0}x {1}", item.ItemCount, Enum.GetName(typeof(Enums.ItemType), itemInInventory.ItemType)); } if (searchResult.PokemonDataEgg != null) { sb.AppendFormat("- 1x Egg ({0}km)", searchResult.PokemonDataEgg.EggKmWalkedTarget); player.Inventory.Eggs.Add(new EggViewModel(searchResult.PokemonDataEgg, player.Inventory.EggIncubators, player.KmWalked, settings)); } MessengerInstance.Send(new Message(Colors.Green, sb.ToString())); } else { MessengerInstance.Send(new Message(Colors.Red, $"Failed to farm Pokestop. Result is {Enum.GetName(typeof(FortSearchResponse.Types.Result), searchResult.Result)}.")); } }
public ItemViewModel(ItemAward item, SessionViewModel session) : this(item.ItemCount, (Enums.ItemType)item.ItemId, session) { }