FashionShowCloseItem.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class FashionShowCloseItem
  6. {
  7. #region Config
  8. //StartMark-Used by LabelUtility-Do not remove
  9. private Image Icon1;
  10. private Image Icon2;
  11. private Image Icon3;
  12. private Button BuyButton;
  13. private TextPlus BuyButtonText;
  14. //EndMark-Used by LabelUtility-Do not remove
  15. public Text Text;
  16. public Button BoxButton;
  17. public Transform Transform;
  18. public CloseItem CloseItem;
  19. #endregion
  20. public void Init(int closeID, Transform fashionShowCloseItem)
  21. {
  22. Dictionary<string, Transform> childDictionary = new Dictionary<string, Transform>();
  23. Auxiliary.CompileDic(fashionShowCloseItem, childDictionary);
  24. Icon1 = childDictionary[FashionShowCloseItemLabel.Icon1].GetComponent<Image>();
  25. Icon2 = childDictionary[FashionShowCloseItemLabel.Icon2].GetComponent<Image>();
  26. Icon3 = childDictionary[FashionShowCloseItemLabel.Icon3].GetComponent<Image>();
  27. BuyButton = childDictionary[FashionShowCloseItemLabel.BuyButton].GetComponent<Button>();
  28. BoxButton = childDictionary[FashionShowCloseItemLabel.FashionShowCloseItem].GetComponent<Button>();
  29. BuyButtonText = childDictionary[FashionShowCloseItemLabel.BuyButtonText].GetComponent<TextPlus>();
  30. Text = childDictionary[FashionShowCloseItemLabel.Text].GetComponent<Text>();
  31. Transform = fashionShowCloseItem;
  32. LanguageManager.Add(Text, new MulLanStr(LanguageLabel.UI__Pg_Bought));
  33. CloseItem = PlayerManager.CloseItemDictionary[closeID];
  34. CloseItem.SetupStandardItem(Icon1, Icon2, Icon3, BuyButton, BuyButtonText);
  35. BuyButton.SetActive(false);
  36. if (CloseItem.IsBought)
  37. {
  38. BoxButton.interactable = false;
  39. Text.SetActive(true);
  40. }
  41. else
  42. {
  43. BoxButton.interactable = true;
  44. }
  45. BoxButton.onClick.AddListener(() => CloseItem.OpenBuyPanel(() => FashionShowEditPage.UpdateTotalCost(true), null));
  46. }
  47. }