public void Awake() { MerchantPanel = transform.parent.GetComponent <MerchantPanel>(); BountyDisplay = transform.Find("BountyInfo").gameObject.AddComponent <BountyListElement>(); YesButton = transform.Find("YesButton").GetComponent <Button>(); NoButton = transform.Find("NoButton").GetComponent <Button>(); YesButton.onClick.AddListener(OnYesButtonClicked); NoButton.onClick.AddListener(OnNoButtonClicked); }
private string GetTooltip() { _sb.Clear(); var biome = $"$biome_{BountyInfo.Biome.ToString().ToLower()}"; var monsterName = AdventureDataManager.GetMonsterName(BountyInfo.Target.MonsterID).ToLowerInvariant(); var targetName = string.IsNullOrEmpty(BountyInfo.TargetName) ? "" : $"<color=orange>{BountyInfo.TargetName}</color>, "; var slayMessage = BountyInfo.Adds.Count > 0 ? "$mod_epicloot_bounties_tooltip_slaymultiple" : "$mod_epicloot_bounties_tooltip_slay"; //"mod_epicloot_bounties_tooltip": "Travel to the <color=#31eb41>$1</color> and locate $2 the <color=#f03232>$3</color>. $4. Return to me when it is done.", var tooltipText = Localization.instance.Localize("$mod_epicloot_bounties_tooltip", biome, targetName, monsterName, slayMessage); _sb.AppendLine(tooltipText); _sb.AppendLine(); _sb.AppendLine("<color=#ffc400>$mod_epicloot_bounties_tooltip_rewards</color>"); if (BountyInfo.RewardIron > 0) { _sb.AppendLine($" {MerchantPanel.GetIronBountyTokenName()} x{BountyInfo.RewardIron}"); } if (BountyInfo.RewardGold > 0) { _sb.AppendLine($" {MerchantPanel.GetGoldBountyTokenName()} x{BountyInfo.RewardGold}"); } if (BountyInfo.RewardCoins > 0) { _sb.AppendLine($" {MerchantPanel.GetCoinsName()} x{BountyInfo.RewardCoins}"); } _sb.AppendLine(); _sb.AppendLine("<color=#ffc400>$mod_epicloot_bounties_tooltip_status</color>"); switch (BountyInfo.State) { case BountyState.Available: _sb.AppendLine($" {Localization.instance.Localize("$mod_epicloot_bounties_tooltip_available")}"); break; case BountyState.InProgress: _sb.AppendLine(" <color=#00f0ff>$mod_epicloot_bounties_tooltip_inprogress</color>"); break; case BountyState.Complete: _sb.AppendLine(" <color=#70f56c>$mod_epicloot_bounties_tooltip_vanquished</color>"); break; case BountyState.Claimed: _sb.AppendLine(" $mod_epicloot_bounties_tooltip_claimed"); break; } return(Localization.instance.Localize(_sb.ToString())); }
public void Awake() { _instance = this; var storeGui = transform.parent.GetComponent <StoreGui>(); gameObject.name = nameof(MerchantPanel); _audioSource = gameObject.GetComponent <AudioSource>(); if (_audioSource == null) { _audioSource = gameObject.AddComponent <AudioSource>(); } if (GambleSuccessDialog == null) { GambleSuccessDialog = CraftSuccessDialog.Create(transform); GambleSuccessDialog.Frame.anchoredPosition = new Vector2(-700, -300); } if (AbandonBountyDialog == null) { AbandonBountyDialog = transform.Find("AbandonBountyDialog").gameObject.AddComponent <AbandonBountyDialog>(); AbandonBountyDialog.gameObject.SetActive(false); } var existingBackground = storeGui.m_rootPanel.transform.Find("border (1)"); if (existingBackground != null) { var image = existingBackground.GetComponent <Image>(); GetComponent <Image>().material = image.material; } var scrollbars = GetComponentsInChildren <ScrollRect>(true); foreach (var scrollRect in scrollbars) { scrollRect.verticalScrollbar.size = 0.4f; scrollRect.onValueChanged.AddListener((_) => scrollRect.verticalScrollbar.size = 0.4f); scrollRect.normalizedPosition = new Vector2(0, 1); } var storeBuyButtonTooltip = storeGui.m_buyButton.GetComponent <UITooltip>().m_tooltipPrefab; var storeItemTooltip = storeGui.m_listElement.GetComponent <UITooltip>().m_tooltipPrefab; var tooltips = GetComponentsInChildren <UITooltip>(true); foreach (var tooltip in tooltips) { if (tooltip.name == "Sundial" || tooltip.name == "ItemElement") { tooltip.m_tooltipPrefab = storeItemTooltip; } else { tooltip.m_tooltipPrefab = storeBuyButtonTooltip; } } InputBlocker = transform.Find("InputBlocker").gameObject; InputBlocker.SetActive(false); var secretStashRefreshTooltip = GetRefreshTimeTooltip(AdventureDataManager.SecretStash.RefreshInterval); var gambleRefreshTooltip = GetRefreshTimeTooltip(AdventureDataManager.Gamble.RefreshInterval); var treasureMapRefreshTooltip = GetRefreshTimeTooltip(AdventureDataManager.TreasureMaps.RefreshInterval); var bountiesRefreshTooltip = GetRefreshTimeTooltip(AdventureDataManager.Bounties.RefreshInterval); transform.Find("Sundial").GetComponent <UITooltip>().m_text = $"$mod_epicloot_merchant_secretstash: {secretStashRefreshTooltip}\n" + $"$mod_epicloot_merchant_gamble: {gambleRefreshTooltip}\n" + $"$mod_epicloot_merchant_treasuremaps: {treasureMapRefreshTooltip}\n" + $"$mod_epicloot_merchant_bounties: {bountiesRefreshTooltip}\n\n" + $"<color=silver>$mod_epicloot_merchant_rollovertime</color>"; var buyListPrefab = transform.Find("SecretStash/Panel/ItemElement").gameObject.AddComponent <BuyListElement>(); buyListPrefab.gameObject.SetActive(false); var treasureMapElementPrefab = transform.Find("TreasureMap/Panel/ItemElement").gameObject.AddComponent <TreasureMapListElement>(); treasureMapElementPrefab.gameObject.SetActive(false); var bountyElementPrefab = transform.Find("Bounties/AvailableBountiesPanel/ItemElement").gameObject.AddComponent <BountyListElement>(); bountyElementPrefab.gameObject.SetActive(false); Panels.Add(new SecretStashListPanel(this, buyListPrefab)); Panels.Add(new GambleListPanel(this, buyListPrefab)); Panels.Add(new TreasureMapListPanel(this, treasureMapElementPrefab)); Panels.Add(new AvailableBountiesListPanel(this, bountyElementPrefab)); Panels.Add(new ClaimableBountiesListPanel(this, bountyElementPrefab)); CoinsCount = transform.Find("Currencies/CoinsCount").GetComponent <Text>(); ForestTokensCount = transform.Find("Currencies/ForestTokensCount").GetComponent <Text>(); IronBountyTokensCount = transform.Find("Currencies/BountyTokensIronCount").GetComponent <Text>(); GoldBountyTokensCount = transform.Find("Currencies/BountyTokensGoldCount").GetComponent <Text>(); }
public void OnDestroy() { _instance = null; }
public void Awake() { _instance = this; var storeGui = transform.parent.GetComponent <StoreGui>(); gameObject.name = nameof(MerchantPanel); _audioSource = gameObject.GetComponent <AudioSource>(); if (_audioSource == null) { _audioSource = gameObject.AddComponent <AudioSource>(); } if (GambleSuccessDialog == null) { if (EpicLoot.HasAuga) { var resultsPanel = Auga.API.Workbench_CreateNewResultsPanel(); resultsPanel.SetActive(false); resultsPanel.transform.SetParent(transform); GambleSuccessDialog = resultsPanel.gameObject.AddComponent <CraftSuccessDialog>(); GambleSuccessDialog.NameText = GambleSuccessDialog.transform.Find("Topic").GetComponent <Text>(); GambleSuccessDialog.Frame = (RectTransform)GambleSuccessDialog.transform; GambleSuccessDialog.Frame.anchoredPosition = new Vector2(0, 0); } else { GambleSuccessDialog = CraftSuccessDialog.Create(transform); GambleSuccessDialog.Frame.anchoredPosition = new Vector2(-700, -300); } } if (AbandonBountyDialog == null) { if (EpicLoot.HasAuga) { AugaReplaceButton(transform.Find("AbandonBountyDialog/YesButton").GetComponent <Button>()); AugaReplaceButton(transform.Find("AbandonBountyDialog/NoButton").GetComponent <Button>()); } AbandonBountyDialog = transform.Find("AbandonBountyDialog").gameObject.AddComponent <AbandonBountyDialog>(); AbandonBountyDialog.gameObject.SetActive(false); } var existingBackground = storeGui.m_rootPanel.transform.Find("border (1)"); if (existingBackground != null) { var image = existingBackground.GetComponent <Image>(); GetComponent <Image>().material = image.material; } var scrollbars = GetComponentsInChildren <ScrollRect>(true); foreach (var scrollRect in scrollbars) { scrollRect.verticalScrollbar.size = 0.4f; scrollRect.onValueChanged.AddListener((_) => scrollRect.verticalScrollbar.size = 0.4f); scrollRect.normalizedPosition = new Vector2(0, 1); } var storeBuyButtonTooltip = storeGui.m_buyButton.GetComponent <UITooltip>().m_tooltipPrefab; var storeItemTooltip = storeGui.m_listElement.GetComponent <UITooltip>().m_tooltipPrefab; var tooltips = GetComponentsInChildren <UITooltip>(true); foreach (var tooltip in tooltips) { if (tooltip.name == "Sundial" || tooltip.name == "ItemElement") { tooltip.m_tooltipPrefab = storeItemTooltip; } else { tooltip.m_tooltipPrefab = storeBuyButtonTooltip; } } InputBlocker = transform.Find("InputBlocker").gameObject; InputBlocker.SetActive(false); var secretStashRefreshTooltip = GetRefreshTimeTooltip(AdventureDataManager.SecretStash.RefreshInterval); var gambleRefreshTooltip = GetRefreshTimeTooltip(AdventureDataManager.Gamble.RefreshInterval); var treasureMapRefreshTooltip = GetRefreshTimeTooltip(AdventureDataManager.TreasureMaps.RefreshInterval); var bountiesRefreshTooltip = GetRefreshTimeTooltip(AdventureDataManager.Bounties.RefreshInterval); var sundialTooltip = transform.Find("Sundial").GetComponent <UITooltip>(); if (EpicLoot.HasAuga) { Auga.API.Tooltip_MakeSimpleTooltip(sundialTooltip.gameObject); var rt = (RectTransform)sundialTooltip.transform; rt.anchoredPosition = new Vector2(20, -20); rt.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 40); rt.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 40); } sundialTooltip.m_text = $"$mod_epicloot_merchant_secretstash: {secretStashRefreshTooltip}\n" + $"$mod_epicloot_merchant_gamble: {gambleRefreshTooltip}\n" + $"$mod_epicloot_merchant_treasuremaps: {treasureMapRefreshTooltip}\n" + $"$mod_epicloot_merchant_bounties: {bountiesRefreshTooltip}\n\n" + $"<color=silver>$mod_epicloot_merchant_rollovertime</color>"; var buyListPrefab = transform.Find("SecretStash/Panel/ItemElement").gameObject.AddComponent <BuyListElement>(); buyListPrefab.gameObject.SetActive(false); var treasureMapElementPrefab = transform.Find("TreasureMap/Panel/ItemElement").gameObject.AddComponent <TreasureMapListElement>(); treasureMapElementPrefab.gameObject.SetActive(false); var bountyElementPrefab = transform.Find("Bounties/AvailableBountiesPanel/ItemElement").gameObject.AddComponent <BountyListElement>(); bountyElementPrefab.gameObject.SetActive(false); var activeBountyElementPrefab = transform.Find("Bounties/ClaimableBountiesPanel/ItemElement").gameObject.AddComponent <BountyListElement>(); bountyElementPrefab.gameObject.SetActive(false); if (EpicLoot.HasAuga) { AugaReplaceButton(transform.Find("SecretStash/SecretStashBuyButton").GetComponent <Button>()); AugaReplaceButton(transform.Find("Gamble/GambleBuyButton").GetComponent <Button>()); AugaReplaceButton(transform.Find("TreasureMap/TreasureMapBuyButton").GetComponent <Button>()); AugaReplaceButton(transform.Find("Bounties/AcceptBountyButton").GetComponent <Button>()); AugaReplaceButton(transform.Find("Bounties/ClaimBountyButton").GetComponent <Button>()); AugaReplaceButton(transform.Find("Bounties/AbandonBountyButton").GetComponent <Button>(), true); } Panels.Add(new SecretStashListPanel(this, buyListPrefab)); Panels.Add(new GambleListPanel(this, buyListPrefab)); Panels.Add(new TreasureMapListPanel(this, treasureMapElementPrefab)); Panels.Add(new AvailableBountiesListPanel(this, bountyElementPrefab)); Panels.Add(new ClaimableBountiesListPanel(this, activeBountyElementPrefab)); CoinsCount = transform.Find("Currencies/CoinsCount").GetComponent <Text>(); ForestTokensCount = transform.Find("Currencies/ForestTokensCount").GetComponent <Text>(); IronBountyTokensCount = transform.Find("Currencies/BountyTokensIronCount").GetComponent <Text>(); GoldBountyTokensCount = transform.Find("Currencies/BountyTokensGoldCount").GetComponent <Text>(); if (EpicLoot.HasAuga) { AugaReplaceBackground(gameObject, true); AugaReplaceBackground(AbandonBountyDialog.gameObject, false); AugaFixItemBG(buyListPrefab.gameObject); AugaFixItemBG(treasureMapElementPrefab.gameObject); AugaFixItemBG(bountyElementPrefab.gameObject); AugaFixItemBG(activeBountyElementPrefab.gameObject); AugaFixItemBG(AbandonBountyDialog.BountyDisplay.gameObject); AugaFixListElementColors(buyListPrefab.gameObject); AugaFixListElementColors(treasureMapElementPrefab.gameObject); AugaFixListElementColors(bountyElementPrefab.gameObject); AugaFixListElementColors(activeBountyElementPrefab.gameObject); AugaFixListElementColors(AbandonBountyDialog.BountyDisplay.gameObject); AugaFixFonts(gameObject); AugaMakeSimpleTooltip(treasureMapElementPrefab.gameObject); AugaMakeSimpleTooltip(bountyElementPrefab.gameObject); AugaMakeSimpleTooltip(activeBountyElementPrefab.gameObject); } }