using System; using CIG.Translation; using CIGEnums; using SUISS.Core; using SUISSEngine; using UnityEngine; public abstract class DefaultTwoStageRatingRequestManager : RatingRequestManager { public DefaultTwoStageRatingRequestManager(MonoBehaviour anyMonobehaviour, INativeBindings nativeBindings, Messenger messenger, string appID, int buildVersion, string gameTitle) : base(anyMonobehaviour, nativeBindings, messenger, appID, buildVersion) { this._gameTitle = gameTitle; } protected virtual ILocalizedString AppreciateFeedbackKey { get { return Localization.Key("rating_appreciate_your_feedback"); } } protected virtual ILocalizedString DoLikePlayingKey { get { return Localization.Key("rating_do_like_playing"); } } protected virtual ILocalizedString YesKey { get { return Localization.Key("rating_yes"); } } protected virtual ILocalizedString NotReallyKey { get { return Localization.Key("rating_not_really"); } } protected virtual ILocalizedString SorryToHearKey { get { return Localization.Key("rating_sorry_to_hear"); } } protected virtual ILocalizedString DescriptionKey { get { return Localization.Key("rating_rate_game_description"); } } protected virtual ILocalizedString FeedbackAtKey { get { return Localization.Key("rating_feedback_at"); } } protected virtual ILocalizedString WillDoKey { get { return Localization.Key("rating_will_do"); } } protected virtual ILocalizedString YeahSureKey { get { return Localization.Key("rating_yeah_sure"); } } protected virtual ILocalizedString ThanksKey { get { return Localization.Key("thank_you"); } } protected virtual ILocalizedString NoThanksKey { get { return Localization.Key("no_thanks"); } } protected virtual ILocalizedString FeedbackEmail { get { return Localization.Literal("feedback@sparklingsociety.net"); } } protected override void ShowRatingRequestPopup(Action answerCallback) { Action positiveCallback = delegate() { answerCallback(true); }; Action negativeCallback = delegate() { answerCallback(false); }; this.ShowLikeGamePopup(positiveCallback, negativeCallback); } protected virtual void ShowLikeGamePopup(Action positiveCallback, Action negativeCallback) { SingletonMonobehaviour.Instance.AddScreenViewed("rating_like_game"); this.ShowPopup(this.AppreciateFeedbackKey, UISpriteType.GameIcon, Localization.Format(this.DoLikePlayingKey, new ILocalizedString[] { Localization.Literal(this._gameTitle) }), this.YesKey, this.NotReallyKey, delegate { this.RequestRatingPopup(positiveCallback, negativeCallback); }, delegate { negativeCallback(); this.ShowFeedbackPopup(); }, negativeCallback, true); } protected virtual void RequestRatingPopup(Action positiveCallback, Action negativeCallback) { SingletonMonobehaviour.Instance.AddScreenViewed("rating_request"); this.ShowPopup(this.ThanksKey, UISpriteType.FiveStarIcon, Localization.Format(this.DoLikePlayingKey, new ILocalizedString[] { Localization.Literal(this._gameTitle) }), this.YeahSureKey, this.NoThanksKey, positiveCallback, negativeCallback, negativeCallback, true); } protected virtual void ShowFeedbackPopup() { SingletonMonobehaviour.Instance.AddScreenViewed("rating_feedback"); this.ShowPopup(this.SorryToHearKey, UISpriteType.GameIcon, Localization.Format(this.FeedbackAtKey, new ILocalizedString[] { this.FeedbackEmail }), this.WillDoKey, this.NoThanksKey, null, null, null, true); } protected abstract void ShowPopup(ILocalizedString title, UISpriteType iconType, ILocalizedString description, ILocalizedString yesButtonText, ILocalizedString noButtonText, Action yesButtonAction, Action noButtonAction, Action dissmissAction, bool dismissable = true); private string _gameTitle; }