/** Creates a new notification with given text and optional graphic */ public GuiNotification(string content, Sprite sprite = null) : base(260, 60) { Stage = NotificationStage.AnimateOn; stageLife = AnimationDuration; Color = new Color(0.2f, 0.2f, 0.2f); text = new GuiLabel(content); text.AutoHeight = false; text.AutoWidth = false; text.X = 5; text.Y = 5; text.Width = (int)ContentsBounds.width - 10; text.Height = (int)ContentsBounds.height - 10; text.FontSize = 12; text.WordWrap = true; text.TextAlign = TextAnchor.MiddleLeft; Add(text); OuterShadow = true; if (sprite != null) { image = new GuiImage(3, 3, sprite); image.Scale = (Height - 10) / sprite.rect.height; text.X = 60; text.Width = (int)ContentsBounds.width - text.X - 5; var frame = new GuiFillRect(1, 1, image.Width + 4, image.Height + 4, Color.black.Faded(0.50f)); Add(frame); Add(image); var shadow = new GuiFrameRect(3, 3, image.Width, image.Height, Color.black.Faded(0.5f)); Add(shadow); } }
// Token: 0x06000123 RID: 291 RVA: 0x00013510 File Offset: 0x00011710 private void SaveStage(NotificationStage stage) { if (stage >= NotificationStage.None && stage <= NotificationStage.Stage5) { try { long userId = DataManager.Instance.RoleAttr.UserId; this.m_SaveStage = stage; this.m_Data = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); PlayerPrefs.SetInt(this.AntiAddictiveSatge + userId, (int)this.m_SaveStage); PlayerPrefs.SetString(this.AntiAddictiveDate + userId, this.m_Data.ToString()); } catch (Exception ex) { Debug.Log("AntiAddictive SaveStage Exception"); } } }
// Token: 0x06000125 RID: 293 RVA: 0x00013728 File Offset: 0x00011928 private void SetDlgStack(NotificationStage stage, bool enable) { if (stage < (NotificationStage)this.m_DlgStack.Length && stage > NotificationStage.None) { if (enable) { if (this.m_DlgStack[(int)stage] != 1) { this.m_DlgStack[(int)stage] = 1; this.m_StackCount += 1; } } else if (this.m_DlgStack[(int)stage] != 0) { this.m_DlgStack[(int)stage] = 0; this.m_StackCount -= 1; } } }
// Token: 0x06000126 RID: 294 RVA: 0x000137A0 File Offset: 0x000119A0 private bool GetDlgStack(NotificationStage stage) { return(stage < (NotificationStage)this.m_DlgStack.Length && stage > NotificationStage.None && this.m_DlgStack[(int)stage] == 1); }
// Token: 0x06000122 RID: 290 RVA: 0x00012EC8 File Offset: 0x000110C8 private bool OpeenNotificationDlg(NotificationStage stage) { bool result = false; bool bShowCloseBtn = true; bool flag = BattleController.IsGambleMode || BattleController.IsActive || WarManager.IsActive; this.m_CStr.ClearString(); switch (stage) { case NotificationStage.Stage1: if (!flag) { if (this.m_RealNameState != RealNameState.Authorized) { bool bShowRealNameBtn = true; this.m_CStr.IntToFormat(1L, 1, false); this.m_CStr.AppendFormat(DataManager.Instance.mStringTable.GetStringByID(10140u)); GUIManager.Instance.CloseAntiAddictiveMessageBox(); GUIManager.Instance.OpenAntiAddictiveMessageBox(stage, DataManager.Instance.mStringTable.GetStringByID(10147u), this.m_CStr.ToString(), null, bShowRealNameBtn, bShowCloseBtn, 21, 0); } else if (this.m_RealNameState == RealNameState.Authorized) { bool bShowRealNameBtn = false; this.m_CStr.IntToFormat(1L, 1, false); this.m_CStr.AppendFormat(DataManager.Instance.mStringTable.GetStringByID(10141u)); GUIManager.Instance.CloseAntiAddictiveMessageBox(); GUIManager.Instance.OpenAntiAddictiveMessageBox(stage, DataManager.Instance.mStringTable.GetStringByID(10147u), this.m_CStr.ToString(), null, bShowRealNameBtn, bShowCloseBtn, 21, 0); } result = true; this.SaveStage(NotificationStage.Stage1); } else { this.SetDlgStack(NotificationStage.Stage1, true); } break; case NotificationStage.Stage2: if (!flag) { if (this.m_RealNameState != RealNameState.Authorized) { bool bShowRealNameBtn = true; this.m_CStr.IntToFormat(2L, 1, false); this.m_CStr.AppendFormat(DataManager.Instance.mStringTable.GetStringByID(10140u)); GUIManager.Instance.CloseAntiAddictiveMessageBox(); GUIManager.Instance.OpenAntiAddictiveMessageBox(stage, DataManager.Instance.mStringTable.GetStringByID(10147u), this.m_CStr.ToString(), null, bShowRealNameBtn, bShowCloseBtn, 21, 0); } else if (this.m_RealNameState == RealNameState.Authorized) { bool bShowRealNameBtn = false; this.m_CStr.IntToFormat(2L, 1, false); this.m_CStr.AppendFormat(DataManager.Instance.mStringTable.GetStringByID(10141u)); GUIManager.Instance.CloseAntiAddictiveMessageBox(); GUIManager.Instance.OpenAntiAddictiveMessageBox(stage, DataManager.Instance.mStringTable.GetStringByID(10147u), this.m_CStr.ToString(), null, bShowRealNameBtn, bShowCloseBtn, 21, 0); } result = true; this.SaveStage(NotificationStage.Stage2); } else { this.SetDlgStack(NotificationStage.Stage2, true); } break; case NotificationStage.Stage3: if (!flag) { if (this.m_RealNameState != RealNameState.Authorized) { bool bShowRealNameBtn = true; this.m_CStr.FloatToFormat(2.5f, -1, true); this.m_CStr.AppendFormat(DataManager.Instance.mStringTable.GetStringByID(10140u)); GUIManager.Instance.CloseAntiAddictiveMessageBox(); GUIManager.Instance.OpenAntiAddictiveMessageBox(stage, DataManager.Instance.mStringTable.GetStringByID(10147u), this.m_CStr.ToString(), null, bShowRealNameBtn, bShowCloseBtn, 21, 0); } else if (this.m_RealNameState == RealNameState.Authorized) { bool bShowRealNameBtn = false; this.m_CStr.FloatToFormat(2.5f, -1, true); this.m_CStr.AppendFormat(DataManager.Instance.mStringTable.GetStringByID(10141u)); GUIManager.Instance.CloseAntiAddictiveMessageBox(); GUIManager.Instance.OpenAntiAddictiveMessageBox(stage, DataManager.Instance.mStringTable.GetStringByID(10147u), this.m_CStr.ToString(), null, bShowRealNameBtn, bShowCloseBtn, 21, 0); } result = true; this.SaveStage(NotificationStage.Stage3); } else { this.SetDlgStack(NotificationStage.Stage3, true); } break; case NotificationStage.Stage4: if (!flag) { GUIManager.Instance.CloseAntiAddictiveMessageBox(); long num = 0L; if (10800L >= this.m_CumulativeTime) { long num2 = 10800L - this.m_CumulativeTime; num = ((num2 % 60L != 0L) ? (num2 / 60L + 1L) : (num2 / 60L)); } num = (long)Mathf.Clamp((float)num, 1f, 5f); if (this.m_RealNameState != RealNameState.Authorized) { bool bShowRealNameBtn = true; this.m_CStr.IntToFormat(num, 1, false); this.m_CStr.AppendFormat(DataManager.Instance.mStringTable.GetStringByID(10142u)); GUIManager.Instance.OpenAntiAddictiveMessageBox(stage, DataManager.Instance.mStringTable.GetStringByID(10147u), this.m_CStr.ToString(), null, bShowRealNameBtn, bShowCloseBtn, 21, 0); } else if (this.m_RealNameState == RealNameState.Authorized) { bool bShowRealNameBtn = false; this.m_CStr.IntToFormat(num, 1, false); this.m_CStr.AppendFormat(DataManager.Instance.mStringTable.GetStringByID(10143u)); GUIManager.Instance.OpenAntiAddictiveMessageBox(stage, DataManager.Instance.mStringTable.GetStringByID(10147u), this.m_CStr.ToString(), null, bShowRealNameBtn, bShowCloseBtn, 21, 0); } this.m_FinalRepeat = 0; result = true; this.SaveStage(NotificationStage.Stage4); } else { this.SetDlgStack(NotificationStage.Stage4, true); } break; case NotificationStage.Stage5: { bShowCloseBtn = false; GUIManager.Instance.CloseAntiAddictiveMessageBox(); DateTime tomorrow = this.GetTomorrow(); this.m_CStr.IntToFormat((long)tomorrow.Year, 1, false); this.m_CStr.IntToFormat((long)tomorrow.Month, 1, false); this.m_CStr.IntToFormat((long)tomorrow.Day, 1, false); this.m_CStr.IntToFormat((long)tomorrow.Hour, 1, false); if (this.m_RealNameState != RealNameState.Authorized) { bool bShowRealNameBtn = true; this.m_CStr.AppendFormat(DataManager.Instance.mStringTable.GetStringByID(10144u)); GUIManager.Instance.OpenAntiAddictiveMessageBox(stage, DataManager.Instance.mStringTable.GetStringByID(10147u), this.m_CStr.ToString(), null, bShowRealNameBtn, bShowCloseBtn, 21, 0); } else { bool bShowRealNameBtn = false; this.m_CStr.AppendFormat(DataManager.Instance.mStringTable.GetStringByID(10145u)); GUIManager.Instance.OpenAntiAddictiveMessageBox(stage, DataManager.Instance.mStringTable.GetStringByID(10147u), this.m_CStr.ToString(), null, bShowRealNameBtn, bShowCloseBtn, 21, 0); } this.m_FinalRepeat = 0; result = true; this.SaveStage(NotificationStage.Stage5); break; } } return(result); }
// Token: 0x0600011D RID: 285 RVA: 0x00012D3C File Offset: 0x00010F3C public void SetAnitAddicitvDlgStage(NotificationStage stage) { this.m_AnitAddicitvDlgStage = stage; }