GameOverScreenTitle.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using UnityEngine;
  2. using System.Collections;
  3. using TMPro;
  4. using ICTS.Localization;
  5. public class GameOverScreenTitle : MonoBehaviour
  6. {
  7. public TextMeshProUGUI title;
  8. public GameObject WithGetWeapon;
  9. public GameObject Continue;
  10. void Start()
  11. {
  12. WithGetWeapon.SetActive(false);
  13. Continue.SetActive(false);
  14. }
  15. public void ResetButtons()
  16. {
  17. WithGetWeapon.SetActive(false);
  18. Continue.SetActive(true);
  19. }
  20. public void OnActive(bool active = false)
  21. {
  22. if (PlayerPrefs.GetInt("Coupone")==1)
  23. {
  24. MenuManager._instance.CouponeMessage.Show();
  25. return;
  26. }
  27. var curLEvel = LevelsManager.Instance.GetIndexCurLevel();
  28. curLEvel++;
  29. Debug.Log("Finish Game " + curLEvel);
  30. if(MenuManager._instance.Finish)
  31. {
  32. Debug.Log("Finish " + LevelsManager.Instance.CurrentLevelIndex);
  33. title.text = string.Format(Localization.instance.Get("scoreSummary.title.finished"), curLEvel-1);
  34. if (LevelsManager.Instance.CurrentLevelIndex > 2)
  35. {
  36. if (InventoryManager.Instance.GetItemCount(InventoryItem.specialwave) <= 1)
  37. {
  38. Continue.SetActive(false);
  39. WithGetWeapon.SetActive(true);
  40. }
  41. else
  42. {
  43. WithGetWeapon.SetActive(false);
  44. Continue.SetActive(true);
  45. }
  46. }
  47. else
  48. {
  49. WithGetWeapon.SetActive(false);
  50. Continue.SetActive(true);
  51. }
  52. }
  53. else
  54. {
  55. title.text = string.Format(Localization.instance.Get("scoreSummary.title.nofinished"), curLEvel);
  56. if (LevelsManager.Instance.CurrentLevelIndex > 2)
  57. {
  58. if(InventoryManager.Instance.GetItemCount(InventoryItem.specialwave)<=1)
  59. {
  60. Continue.SetActive(false);
  61. Debug.Log(InventoryManager.Instance.GetItemCount(InventoryItem.specialwave));
  62. WithGetWeapon.SetActive(true);
  63. }
  64. else
  65. {
  66. WithGetWeapon.SetActive(false);
  67. Continue.SetActive(true);
  68. }
  69. }
  70. else
  71. {
  72. WithGetWeapon.SetActive(false);
  73. Continue.SetActive(true);
  74. }
  75. }
  76. //MenuManager._instance.Finish = false;
  77. }
  78. }