You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

162 lines
4.0 KiB

  1. using System;
  2. using CIG.Translation;
  3. using CIGEnums;
  4. using SUISS.Core;
  5. using SUISSEngine;
  6. using UnityEngine;
  7. public abstract class DefaultTwoStageRatingRequestManager : RatingRequestManager
  8. {
  9. public DefaultTwoStageRatingRequestManager(MonoBehaviour anyMonobehaviour, INativeBindings nativeBindings, Messenger messenger, string appID, int buildVersion, string gameTitle) : base(anyMonobehaviour, nativeBindings, messenger, appID, buildVersion)
  10. {
  11. this._gameTitle = gameTitle;
  12. }
  13. protected virtual ILocalizedString AppreciateFeedbackKey
  14. {
  15. get
  16. {
  17. return Localization.Key("rating_appreciate_your_feedback");
  18. }
  19. }
  20. protected virtual ILocalizedString DoLikePlayingKey
  21. {
  22. get
  23. {
  24. return Localization.Key("rating_do_like_playing");
  25. }
  26. }
  27. protected virtual ILocalizedString YesKey
  28. {
  29. get
  30. {
  31. return Localization.Key("rating_yes");
  32. }
  33. }
  34. protected virtual ILocalizedString NotReallyKey
  35. {
  36. get
  37. {
  38. return Localization.Key("rating_not_really");
  39. }
  40. }
  41. protected virtual ILocalizedString SorryToHearKey
  42. {
  43. get
  44. {
  45. return Localization.Key("rating_sorry_to_hear");
  46. }
  47. }
  48. protected virtual ILocalizedString DescriptionKey
  49. {
  50. get
  51. {
  52. return Localization.Key("rating_rate_game_description");
  53. }
  54. }
  55. protected virtual ILocalizedString FeedbackAtKey
  56. {
  57. get
  58. {
  59. return Localization.Key("rating_feedback_at");
  60. }
  61. }
  62. protected virtual ILocalizedString WillDoKey
  63. {
  64. get
  65. {
  66. return Localization.Key("rating_will_do");
  67. }
  68. }
  69. protected virtual ILocalizedString YeahSureKey
  70. {
  71. get
  72. {
  73. return Localization.Key("rating_yeah_sure");
  74. }
  75. }
  76. protected virtual ILocalizedString ThanksKey
  77. {
  78. get
  79. {
  80. return Localization.Key("thank_you");
  81. }
  82. }
  83. protected virtual ILocalizedString NoThanksKey
  84. {
  85. get
  86. {
  87. return Localization.Key("no_thanks");
  88. }
  89. }
  90. protected virtual ILocalizedString FeedbackEmail
  91. {
  92. get
  93. {
  94. return Localization.Literal("feedback@sparklingsociety.net");
  95. }
  96. }
  97. protected override void ShowRatingRequestPopup(Action<bool> answerCallback)
  98. {
  99. Action positiveCallback = delegate()
  100. {
  101. answerCallback(true);
  102. };
  103. Action negativeCallback = delegate()
  104. {
  105. answerCallback(false);
  106. };
  107. this.ShowLikeGamePopup(positiveCallback, negativeCallback);
  108. }
  109. protected virtual void ShowLikeGamePopup(Action positiveCallback, Action negativeCallback)
  110. {
  111. SingletonMonobehaviour<CIGGameStats>.Instance.AddScreenViewed("rating_like_game");
  112. this.ShowPopup(this.AppreciateFeedbackKey, UISpriteType.GameIcon, Localization.Format(this.DoLikePlayingKey, new ILocalizedString[]
  113. {
  114. Localization.Literal(this._gameTitle)
  115. }), this.YesKey, this.NotReallyKey, delegate
  116. {
  117. this.RequestRatingPopup(positiveCallback, negativeCallback);
  118. }, delegate
  119. {
  120. negativeCallback();
  121. this.ShowFeedbackPopup();
  122. }, negativeCallback, true);
  123. }
  124. protected virtual void RequestRatingPopup(Action positiveCallback, Action negativeCallback)
  125. {
  126. SingletonMonobehaviour<CIGGameStats>.Instance.AddScreenViewed("rating_request");
  127. this.ShowPopup(this.ThanksKey, UISpriteType.FiveStarIcon, Localization.Format(this.DoLikePlayingKey, new ILocalizedString[]
  128. {
  129. Localization.Literal(this._gameTitle)
  130. }), this.YeahSureKey, this.NoThanksKey, positiveCallback, negativeCallback, negativeCallback, true);
  131. }
  132. protected virtual void ShowFeedbackPopup()
  133. {
  134. SingletonMonobehaviour<CIGGameStats>.Instance.AddScreenViewed("rating_feedback");
  135. this.ShowPopup(this.SorryToHearKey, UISpriteType.GameIcon, Localization.Format(this.FeedbackAtKey, new ILocalizedString[]
  136. {
  137. this.FeedbackEmail
  138. }), this.WillDoKey, this.NoThanksKey, null, null, null, true);
  139. }
  140. protected abstract void ShowPopup(ILocalizedString title, UISpriteType iconType, ILocalizedString description, ILocalizedString yesButtonText, ILocalizedString noButtonText, Action yesButtonAction, Action noButtonAction, Action dissmissAction, bool dismissable = true);
  141. private string _gameTitle;
  142. }