public static void AccountBannedPromptSetup(DPrompt promptData, AlertType bannedCategory, DateTime?expirationDate) { string text = string.Empty; if (expirationDate.HasValue) { TimeSpan value = (expirationDate - DateTime.Now).Value; if (value.TotalHours >= 0.0) { text = $"{(int)value.TotalHours}hrs {Math.Max(1, value.Minutes)}m"; } } promptData.SetText("Moderation.Text.Time", text, isTranslated: true); string i18nText = (string.IsNullOrEmpty(text) ? "Account.PermaBan.Body" : "Account.TemporaryBan.Body"); promptData.SetText(DPrompt.PROMPT_TEXT_BODY, i18nText); }
public void ShowGiftMessage(List <ServerAddedReward> rewards) { string text = ""; string bodyText = ""; string i18nText = ""; string tier = ""; if (rewards.Count > 1) { bodyText = Service.Get <Localizer>().GetTokenTranslation("Playercard.FriendInvite.Referrer.B2"); foreach (ServerAddedReward reward in rewards) { ServerAddedReward current = reward; string str = string.Format(Service.Get <Localizer>().GetTokenTranslation("Playercard.FriendInvite.Referrer.B2.Header"), current.instanceId); text = text + str + "\n"; } i18nText = Service.Get <Localizer>().GetTokenTranslation("Playercard.FriendInvite.Referrer.B3"); tier = "thankyou_multiple"; } else if (rewards.Count == 1) { ServerAddedReward current = rewards[0]; if (current.instanceId == getCurrentDisplayName()) { AccountFlowData accountFlowData = Service.Get <MembershipService>().GetAccountFlowData(); text = string.Format(Service.Get <Localizer>().GetTokenTranslation("Playercard.FriendInvite.Referee.A"), accountFlowData.Referrer); bodyText = Service.Get <Localizer>().GetTokenTranslation("Playercard.FriendInvite.Referee.A1"); i18nText = Service.Get <Localizer>().GetTokenTranslation("Playercard.FriendInvite.PopUp.A"); tier = "welcome"; } else { text = string.Format(Service.Get <Localizer>().GetTokenTranslation("Playercard.FriendInvite.Referrer.B.Header"), current.instanceId); bodyText = Service.Get <Localizer>().GetTokenTranslation("Playercard.FriendInvite.Referrer.B.Body"); i18nText = Service.Get <Localizer>().GetTokenTranslation("Playercard.FriendInvite.Referrer.B3"); tier = "thankyou_single"; } } DPrompt data = new DPrompt(text, bodyText, DPrompt.ButtonFlags.OK, null, isModal: true, autoClose: true, isTranslated: true); data.SetText(DPrompt.PROMPT_TEXT_INFO, i18nText, isTranslated: true); Service.Get <ICPSwrveService>().Action("refer_gift_award", tier); Content.LoadAsync(delegate(string path, GameObject prefab) { onFriendshipPromptLoaded(data, prefab); }, FriendshipPromptPrefabContentKey); }