public static string CSTFile(string cst, string key) { var path = Path.Combine(AppContext.BaseDirectory, cst); var file = File.ReadAllText(path); return(CaretSeparatedText.Parse(file, key)); }
public LoginDialog(UIScreen Screen, Vector2 Pos) : base(Screen, Pos, false, true, false) { m_Font = m_Screen.Font11px; m_Cst = StringManager.StrTable(209); m_LblTitle = new UILabel(m_Cst[1], 1, Pos, m_Font.MeasureString(m_Cst[1]), m_Screen.StandardTxtColor, 11, m_Screen, UIParser.Nodes.TextAlignment.Center_Center); m_LblUsername = new UILabel(m_Cst[4], 2, new Vector2(Pos.X + 20, Pos.Y - 50), m_Font.MeasureString(m_Cst[4]), m_Screen.StandardTxtColor, 9, m_Screen, UIParser.Nodes.TextAlignment.Center_Center); m_LblPassword = new UILabel(m_Cst[5], 3, new Vector2(Pos.X + 20, Pos.Y - 110), m_Font.MeasureString(m_Cst[4]), m_Screen.StandardTxtColor, 9, m_Screen, UIParser.Nodes.TextAlignment.Center_Center); m_TxtUsername = new UITextEdit("TxtUsername", 4, true, 1, new Vector2(Pos.X + 20, Pos.Y - 85), new Vector2(250, 25), 10, m_Screen); RegistrableUIElements.Add(m_TxtUsername.Name, m_TxtUsername); m_TxtPassword = new UITextEdit("TxtPassword", 5, true, 1, new Vector2(Pos.X + 20, Pos.Y - 145), new Vector2(250, 25), 10, m_Screen); RegistrableUIElements.Add(m_TxtPassword.Name, m_TxtPassword); m_BtnLogin = new UIButton("BtnLogin", new Vector2(120, 170), m_Screen, null, m_Cst[2], 9); m_BtnExit = new UIButton("BtnExit", new Vector2(200, 170), m_Screen, null, m_Cst[3], 9); SetSize((int)((m_Font.MeasureString(m_Cst[1]).X + 40) * Resolution.getVirtualAspectRatio()), (int)(175 * Resolution.getVirtualAspectRatio())); }
/// <summary> /// Consstructs a new UIProgressBar instance. /// </summary> /// <param name="Screen">A UIScreen instance.</param> /// <param name="Width">The width of this UIProgressBar instance.</param> /// <param name="Parent">A UIElement that acts as a parent (optional).</param> public UIStatusBar(UIScreen Screen, Vector2 ProgressBarPosition, int Width, UIElement Parent = null) : base(Screen, Parent) { m_Font = m_Screen.Font9px; m_CSTCurrentStatus = StringManager.StrTable(210); if (Parent != null) { //Would a text edit ever be attached to anything but a UIDialog instance? Probably not. UIDialog Dialog = (UIDialog)Parent; Dialog.OnDragged += Dialog_OnDragged; } m_ProgressBarBack = new UIImage(FileManager.Instance.GetTexture((ulong)FileIDs.UIFileIDs.dialog_progressbarback), new Vector2(0, 0), Screen, null, 0.800f); m_ProgressBarFront = new UIImage(FileManager.Instance.GetTexture((ulong)FileIDs.UIFileIDs.dialog_progressbarfront), new Vector2(0, 0), Screen, null, 0.800f); string InitialValue = m_ProgressInPercentage.ToString() + " %"; m_LblCurrentStatus = new UILabel(m_CSTCurrentStatus[4], 1, Position + new Vector2(Width / 2, 0), m_Font.MeasureString(InitialValue), Color.Wheat, 9, m_Screen); Position = ProgressBarPosition; m_Size.X = Width; m_Size.Y = m_ProgressBarBack.Texture.Height; }
public LoginDialog(UIScreen Screen, Vector2 Pos) : base(Screen, Pos, false, true, false, 0.800f) { m_Font = m_Screen.Font11px; m_Cst = StringManager.StrTable(209); Vector2 RelativePosition = new Vector2(45, 0); m_LblTitle = new UILabel(m_Cst[1], 1, Pos + RelativePosition, m_Font.MeasureString(m_Cst[1]), m_Screen.StandardTxtColor, 11, m_Screen, this, UIParser.Nodes.TextAlignment.Center_Center); m_LblTitle.DrawOrder = (int)DrawOrderEnum.UI; RelativePosition = new Vector2(20, 50); m_LblUsername = new UILabel(m_Cst[4], 2, Pos + RelativePosition, m_Font.MeasureString(m_Cst[4]), m_Screen.StandardTxtColor, 9, m_Screen, this, UIParser.Nodes.TextAlignment.Center_Center); m_LblUsername.DrawOrder = (int)DrawOrderEnum.UI; RelativePosition = new Vector2(20, 110); m_LblPassword = new UILabel(m_Cst[5], 3, Pos + RelativePosition, m_Font.MeasureString(m_Cst[4]), m_Screen.StandardTxtColor, 9, m_Screen, this, UIParser.Nodes.TextAlignment.Center_Center); m_LblPassword.DrawOrder = (int)DrawOrderEnum.UI; RelativePosition = new Vector2(20, 85); m_TxtUsername = new TextBox(new Rectangle((int)(Pos.X + RelativePosition.X), (int)(Pos.Y + RelativePosition.Y), 230, 25), 64, "", m_Screen.Manager.Graphics, 9, Color.Wheat, Color.White, 30, m_Screen, true, true, this); m_TxtUsername.DrawOrder = (int)DrawOrderEnum.UI; m_TxtUsername.Name = "TxtUsername"; RelativePosition = new Vector2(20, 145); m_TxtPassword = new TextBox(new Rectangle((int)(Pos.X + RelativePosition.X), (int)(Pos.Y + RelativePosition.Y), 230, 25), 64, "", m_Screen.Manager.Graphics, 9, Color.Wheat, Color.White, 30, m_Screen, true, true, this); m_TxtPassword.Name = "TxPassword"; m_TxtPassword.DrawOrder = (int)DrawOrderEnum.UI; KeyboardInput.Initialize(Screen.Manager, 500f, 20); RelativePosition = new Vector2(120, 175); m_BtnLogin = new UIButton("BtnLogin", Pos + RelativePosition, m_Screen, null, m_Cst[2], 9, true, this); m_BtnLogin.OnButtonClicked += BtnLogin_OnButtonClicked; m_BtnLogin.DrawOrder = (int)DrawOrderEnum.UI; RelativePosition = new Vector2(200, 175); m_BtnExit = new UIButton("BtnExit", Pos + RelativePosition, m_Screen, null, m_Cst[3], 9, true, this); m_BtnExit.DrawOrder = (int)DrawOrderEnum.UI; SetSize((int)(50 + m_Font.MeasureString(m_Cst[1]).X + 40), m_DefaultSize.Y + m_BtnExit.Size.Y + 10); this.DrawOrder = (int)DrawOrderEnum.UI; }
public LoginProgressDialog(UIScreen Screen, Vector2 Pos) : base(Screen, Pos, false, true, false) { m_Font = m_Screen.Font11px; //cityselprotocolstrings.cst m_Cst = StringManager.StrTable(210); Vector2 RelativePosition = new Vector2(60, 0); m_LblTitle = new UILabel(m_Cst[1], 1, Pos + RelativePosition, m_Font.MeasureString(m_Cst[1]), m_Screen.StandardTxtColor, 11, m_Screen, UIParser.Nodes.TextAlignment.Center_Center); RelativePosition = new Vector2(20, 85); m_ProgressBar = new UIProgressBar(m_Screen, Pos + RelativePosition, 250); SetSize((int)((m_Font.MeasureString(m_Cst[1]).X + 40) * Resolution.getVirtualAspectRatio()), (int)(175 * Resolution.getVirtualAspectRatio())); }
public LoginProgressDialog(UIScreen Screen, Vector2 Pos) : base(Screen, Pos, false, false, false, 0.800f) { m_Font = m_Screen.Font11px; m_CSTCurrentStatus = StringManager.StrTable(210); m_ErrorMsgBox = new MessageBox(Screen, new Vector2((Resolution.ScreenArea.Width - 350) / 2, (Resolution.ScreenArea.Height - 200) / 2), "", "Error", MsgBoxButtonEnum.Ok); //cityselprotocolstrings.cst m_Cst = StringManager.StrTable(210); float Width = (m_Font.MeasureString(m_Cst[1]).X + 100); Vector2 RelativePosition = new Vector2(60, 0); m_LblTitle = new UILabel(m_Cst[1], 1, Pos + RelativePosition, m_Font.MeasureString(m_Cst[1]), m_Screen.StandardTxtColor, 11, m_Screen, this, UIParser.Nodes.TextAlignment.Center_Center); m_LblTitle.DrawOrder = (int)DrawOrderEnum.UI; RelativePosition = new Vector2(20, 40); m_LblProgress = new UILabel(m_Cst[2], 1, Pos + RelativePosition, new Vector2(300, 20), Color.Wheat, 9, m_Screen, this, UIParser.Nodes.TextAlignment.Left_Center); m_LblProgress.DrawOrder = (int)DrawOrderEnum.UI; RelativePosition = new Vector2(20, 70); m_ProgressBar = new UIProgressBar(m_Screen, Pos + RelativePosition, 300, this); m_ProgressBar.DrawOrder = (int)DrawOrderEnum.UI; RegistrableUIElements.Add("ProgressBar", m_ProgressBar); RelativePosition = new Vector2(20, 100); m_LblCurrentTask = new UILabel(m_Cst[3], 1, Pos + RelativePosition, new Vector2(300, 20), Color.Wheat, 9, m_Screen, this, UIParser.Nodes.TextAlignment.Left_Center); m_LblCurrentTask.DrawOrder = (int)DrawOrderEnum.UI; RelativePosition = new Vector2(20, 130); m_StatusBar = new UIStatusBar(m_Screen, Pos + RelativePosition, 300, this); m_StatusBar.DrawOrder = (int)DrawOrderEnum.UI; RegistrableUIElements.Add("StatusBar", m_ProgressBar); SetSize((Width < m_StatusBar.Size.X) ? (m_StatusBar.Size.X + (RelativePosition.X * 2)) : Width, 175); this.DrawOrder = (int)DrawOrderEnum.UI; }
public LoadingScreen(ScreenManager Manager, SpriteBatch SBatch) : base(Manager, "LoadingScreen", SBatch, new Vector2(0, 0), new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight)) { DateTime Now = DateTime.Now; //For some reason, 31. of October isn't valid... DateTime Halloween = DateTime.ParseExact("30/09/" + Now.Year.ToString(), "dd/MM/yyyy", null); DateTime Valentine = DateTime.ParseExact("14/02/" + Now.Year.ToString(), "dd/MM/yyyy", null); DateTime StPaddys = DateTime.ParseExact("17/03/" + Now.Year.ToString(), "dd/MM/yyyy", null); DateRange Christmas = new DateRange(new DateTime(Now.Year, 12, 25), new DateTime(Now.Year, 12, 30)); if (!Now.IsSameDay(Halloween) && !Now.IsSameDay(Valentine) && !Now.IsSameDay(StPaddys) && !Christmas.Includes(Now)) { m_BackgroundImg = new UIImage(FileManager.GetTexture((ulong)FileIDs.UIFileIDs.setup, false), this); } else if (Now.IsSameDay(Halloween)) { m_BackgroundImg = new UIImage(FileManager.GetTexture((ulong)FileIDs.UIFileIDs.setup_halloween), this); } else if (Now.IsSameDay(Valentine)) { m_BackgroundImg = new UIImage(FileManager.GetTexture((ulong)FileIDs.UIFileIDs.setup_valentine), this); } else if (Now.IsSameDay(StPaddys)) { m_BackgroundImg = new UIImage(FileManager.GetTexture((ulong)FileIDs.UIFileIDs.setup_paddys_day), this); } else if (Christmas.Includes(Now)) { m_BackgroundImg = new UIImage(FileManager.GetTexture((ulong)FileIDs.UIFileIDs.setup_xmas), this); } m_Txt = StringManager.StrTable(155); m_LblExtrudingTerrainWeb = new UILabel(m_Txt[5], 1, new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight - 24), new Vector2(12, 12), Color.FromNonPremultiplied(255, 249, 157, 255), 12, this); m_LblExtrudingTerrainWeb.Visible = false; m_LblCalculatingDomesticCoefficients = new UILabel(m_Txt[6], 1, new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight - 24), new Vector2(12, 12), Color.FromNonPremultiplied(255, 249, 157, 255), 12, this); m_LblCalculatingDomesticCoefficients.Visible = false; m_LblReadjustingCareerLadder = new UILabel(m_Txt[7], 1, new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight - 24), new Vector2(12, 12), Color.FromNonPremultiplied(255, 249, 157, 255), 12, this); m_LblReadjustingCareerLadder.Visible = false; m_LblAccessingMoneySupply = new UILabel(m_Txt[8], 1, new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight - 24), new Vector2(12, 12), Color.FromNonPremultiplied(255, 249, 157, 255), 12, this); m_LblAccessingMoneySupply.Visible = false; m_LblHackingTheSocialNetwork = new UILabel(m_Txt[9], 1, new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight - 24), new Vector2(12, 12), Color.FromNonPremultiplied(255, 249, 157, 255), 12, this); m_LblHackingTheSocialNetwork.Visible = false; m_LblDownloadingReticulatedSplines = new UILabel(m_Txt[10], 1, new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight - 24), new Vector2(12, 12), Color.FromNonPremultiplied(255, 249, 157, 255), 12, this); m_LblDownloadingReticulatedSplines.Visible = false; m_LblAdjustingEmotionalWeights = new UILabel(m_Txt[11], 1, new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight - 24), new Vector2(12, 12), Color.FromNonPremultiplied(255, 249, 157, 255), 12, this); m_LblAdjustingEmotionalWeights.Visible = false; m_LblCalibratingPersonalityMatrix = new UILabel(m_Txt[12], 1, new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight - 24), new Vector2(12, 12), Color.FromNonPremultiplied(255, 249, 157, 255), 12, this); m_LblCalibratingPersonalityMatrix.Visible = false; m_LblSettingUpPersonfinder = new UILabel(m_Txt[13], 1, new Vector2(GlobalSettings.Default.ScreenWidth, GlobalSettings.Default.ScreenHeight - 24), new Vector2(12, 12), Color.FromNonPremultiplied(255, 249, 157, 255), 12, this); m_LblSettingUpPersonfinder.Visible = false; HitVM.PlayEvent("bkground_load"); Task LoadTask = new Task(new Action(CacheResources)); LoadTask.Start(); m_Stopwatch = new Stopwatch(); m_Stopwatch.Start(); m_Tween = new Tweener(); m_Tween.Tween(m_LblExtrudingTerrainWeb, new { XPosition = (float)GlobalSettings.Default.ScreenWidth / 2 }, 7); }