/// <summary> /// Advanced Menu constructor that allows custom title banner. /// </summary> /// <param name="title">Title that appears on the big banner. Set to "" if you are using a custom banner.</param> /// <param name="subtitle">Subtitle that appears in capital letters in a small black bar.</param> /// <param name="offset">Point object with X and Y data for offsets. Applied to all menu elements.</param> /// <param name="spriteLibrary">Sprite library name for the banner.</param> /// <param name="spriteName">Sprite name for the banner.</param> public UIMenu(string title, string subtitle, Point offset, string spriteLibrary, string spriteName) { _offset = offset; Children = new Dictionary<UIMenuItem, UIMenu>(); WidthOffset = 0; _instructionalButtonsScaleform = new Scaleform(0); _instructionalButtonsScaleform.Load("instructional_buttons"); UpdateScaleform(); _mainMenu = new UIContainer(new Point(0, 0), new Size(700, 500), Color.FromArgb(0, 0, 0, 0)); _logo = new Sprite(spriteLibrary, spriteName, new Point(0 + _offset.X, 0 + _offset.Y), new Size(431, 107)); _mainMenu.Items.Add(Title = new UIResText(title, new Point(215 + _offset.X, 20 + _offset.Y), 1.15f, Color.White, Font.HouseScript, UIResText.Alignment.Centered)); if (!String.IsNullOrWhiteSpace(subtitle)) { _mainMenu.Items.Add(new UIResRectangle(new Point(0 + offset.X, 107 + _offset.Y), new Size(431, 37), Color.Black)); _mainMenu.Items.Add(Subtitle = new UIResText(subtitle, new Point(8 + _offset.X, 110 + _offset.Y), 0.35f, Color.WhiteSmoke, 0, UIResText.Alignment.Left)); if (subtitle.StartsWith("~")) { CounterPretext = subtitle.Substring(0, 3); } _counterText = new UIResText("", new Point(425 + _offset.X, 110 + _offset.Y), 0.35f, Color.WhiteSmoke, 0, UIResText.Alignment.Right); _extraYOffset = 37; } _upAndDownSprite = new Sprite("commonmenu", "shop_arrows_upanddown", new Point(190 + _offset.X, 147 + 37 * (MaxItemsOnScreen + 1) + _offset.Y - 37 + _extraYOffset), new Size(50, 50)); _extraRectangleUp = new UIResRectangle(new Point(0 + _offset.X, 144 + 38 * (MaxItemsOnScreen + 1) + _offset.Y - 37 + _extraYOffset), new Size(431, 18), Color.FromArgb(200, 0, 0, 0)); _extraRectangleDown = new UIResRectangle(new Point(0 + _offset.X, 144 + 18 + 38 * (MaxItemsOnScreen + 1) + _offset.Y - 37 + _extraYOffset), new Size(431, 18), Color.FromArgb(200, 0, 0, 0)); _descriptionBar = new UIResRectangle(new Point(_offset.X, 123), new Size(431, 4), Color.Black); _descriptionRectangle = new Sprite("commonmenu", "gradient_bgd", new Point(_offset.X, 127), new Size(431, 30)); _descriptionText = new UIResText("Description", new Point(_offset.X + 5, 125), 0.35f, Color.FromArgb(255, 255, 255, 255), Font.ChaletLondon, UIResText.Alignment.Left); _background = new Sprite("commonmenu", "gradient_bgd", new Point(_offset.X, 144 + _offset.Y - 37 + _extraYOffset), new Size(290, 25)); SetKey(MenuControls.Up, Control.PhoneUp); SetKey(MenuControls.Down, Control.PhoneDown); SetKey(MenuControls.Left, Control.PhoneLeft); SetKey(MenuControls.Right, Control.PhoneRight); SetKey(MenuControls.Select, Control.FrontendAccept); SetKey(MenuControls.Back, Control.PhoneCancel); SetKey(MenuControls.Back, Control.FrontendPause); }
/// <summary> /// Gets the line count for the text. /// </summary> /// <param name="text">The text to measure.</param> /// <param name="position">The position of the text.</param> /// <param name="font">The font to use.</param> /// <returns>The number of lines used.</returns> public static int GetLineCount(string text, Point position, GTA.Font font, float scale, int wrap) { // Tell the game that we are going to request the number of lines Function.Call(Hash._SET_TEXT_GXT_ENTRY, "CELL_EMAIL_BCON"); // _BEGIN_TEXT_COMMAND_LINE_COUNT // Add the text that has been sent to us UIResText.AddLongStringForUtf8(text); // ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME // Get the resolution with the correct aspect ratio SizeF res = ResolutionMaintainRatio; // Calculate the x and y positions float x = position.X / res.Width; float y = position.Y / res.Height; // Set the properties for the text Function.Call(Hash.SET_TEXT_FONT, (int)font); Function.Call(Hash.SET_TEXT_SCALE, 1f, scale); // If there is some text wrap to add if (wrap > 0) { // Calculate the wrap size float start = position.X / res.Width; float end = start + (wrap / res.Width); // And apply it Function.Call(Hash.SET_TEXT_WRAP, x, end); } // Finally, return the number of lines being made by the string return(Function.Call <int>(Hash._0x9040DFB09BE75706, x, y)); // _GET_TEXT_SCREEN_LINE_COUNT }
public static int GetLineCount(string text, PointF position, CitizenFX.Core.UI.Font font, float scale, float wrap) { // Tell the game that we are going to request the number of lines SetTextGxtEntry("CELL_EMAIL_BCON"); // _BEGIN_TEXT_COMMAND_LINE_COUNT // Add the text that has been sent to us UIResText.AddLongStringForUtf8(text); // ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME // Get the resolution with the correct aspect ratio SizeF res = ResolutionMaintainRatio; // Calculate the x and y positions float x = position.X / res.Width; float y = position.Y / res.Height; // Set the properties for the text SetTextFont((int)font); SetTextScale(1f, scale); // If there is some text wrap to add if (wrap > 0) { // Calculate the wrap size float start = position.X / res.Width; float end = start + (wrap / res.Width); // And apply it SetTextWrap(x, end); } // Finally, return the number of lines being made by the string return(GetTextScreenLineCount(x, y)); // _GET_TEXT_SCREEN_LINE_COUNT }
public override void Draw(int interval) { SizeF res = UIMenu.GetScreenResolutionMaintainRatio(); Point safe = UIMenu.GetSafezoneBounds(); base.Draw(interval); UIResText.Draw(Text, (int)res.Width - safe.X - 10, (int)res.Height - safe.Y - (42 + (4 * interval)), Font.ChaletLondon, 0.5f, Color.White, UIResText.Alignment.Right, false, false, 0); }
/// <summary> /// Basic menu button. /// </summary> /// <param name="text">Button label.</param> /// <param name="description">Description.</param> public UIMenuItem(string text, string description) { Text = text; _rectangle = new UIResRectangle(new Point(0, 0), new Size(431, 38), Color.FromArgb(150, 0, 0, 0)); _text = new UIResText(text, new Point(8, 0), 0.33f, Color.WhiteSmoke, GTA.Font.ChaletLondon, false); Description = description; _selectedSprite = new Sprite("commonmenu", "gradient_nav", new Point(0, 0), new Size(431, 38)); _badgeLeft = new Sprite("commonmenu", "", new Point(0, 0), new Size(40, 40)); _badgeRight = new Sprite("commonmenu", "", new Point(0, 0), new Size(40, 40)); }
public UIMenuColorPanel(string Title, ColorPanelType ColorType) { if (ColorType == ColorPanelType.Hair) { Colors.Clear(); for (int i = 0; i < 64; i++) { API.GetHairRgbColor(i, ref r, ref g, ref b); Colors.Add(Color.FromArgb(r, g, b)); } } else if (ColorType == ColorPanelType.Makeup) { Colors.Clear(); for (int i = 0; i < 64; i++) { API.GetMakeupRgbColor(i, ref r, ref g, ref b); Colors.Add(Color.FromArgb(r, g, b)); } } Data.Pagination.Min = 0; Data.Pagination.Max = 7; Data.Pagination.Total = 7; Data.Index = 1000; Data.Items = Colors; Data.Title = Title ?? "Title"; Enabled = true; Data.Value = 1; Background = new Sprite("commonmenu", "gradient_bgd", new Point(0, 0), new Size(431, 122)); EnableArrow = true; LeftArrow = new Sprite("commonmenu", "arrowleft", new Point(0, 0), new Size(30, 30)); RightArrow = new Sprite("commonmenu", "arrowright", new Point(0, 0), new Size(30, 30)); SelectedRectangle = new UIResRectangle(new Point(0, 0), new Size(44, 8), Color.FromArgb(255, 255, 255)); Text = new UIResText(Title + " [1 / " + Colors.Count + "]", new Point(0, 0), 0.35f, Color.FromArgb(255, 255, 255, 255), CitizenFX.Core.UI.Font.ChaletLondon, Alignment.Center); ParentItem = null; for (int Index = 0; Index < Colors.Count; Index++) { if (Index < 9) { Bar.Add(new UIResRectangle(new PointF(0, 0), new SizeF(44.5f, 44.5f), Colors[Index])); } else { break; } } if (Data.Items.Count != 0) { Data.Index = 1000 - (1000 % Data.Items.Count); Data.Pagination.Max = Data.Pagination.Total + 1; Data.Pagination.Min = 0; } }
public UIMenuHorizontalOneLineGridPanel(string LeftText, string RightText, float CirclePositionX = 0.5f) { Enabled = true; Background = new Sprite("commonmenu", "gradient_bgd", new Point(0, 0), new Size(431, 275)); Grid = new Sprite("NativeUI", "horizontal_grid", new Point(0, 0), new Size(200, 200), 0f, Color.FromArgb(255, 255, 255)); Circle = new Sprite("mpinventory", "in_world_circle", new Point(0, 0), new Size(20, 20), 0f, Color.FromArgb(255, 255, 255)); Audio = new UIMenuGridAudio("CONTINUOUS_SLIDER", "HUD_FRONTEND_DEFAULT_SOUNDSET", 0); Left = new UIResText(LeftText ?? "Left", new Point(0, 0), .35f, Color.FromArgb(255, 255, 255), CitizenFX.Core.UI.Font.ChaletLondon, Alignment.Center); Right = new UIResText(RightText ?? "Right", new Point(0, 0), .35f, Color.FromArgb(255, 255, 255), CitizenFX.Core.UI.Font.ChaletLondon, Alignment.Center); SetCirclePosition = new PointF(CirclePositionX, 0.5f); }
public UIMenuVerticalOneLineGridPanel(string TopText, string BottomText, float circlePositionY = .5f) { Enabled = true; Background = new Sprite("commonmenu", "gradient_bgd", new Point(0, 0), new Size(431, 275)); Grid = new Sprite("NativeUI", "vertical_grid", new Point(0, 0), new Size(200, 200), 0f, Color.FromArgb(255, 255, 255)); Circle = new Sprite("mpinventory", "in_world_circle", new Point(0, 0), new Size(20, 20), 0f, Color.FromArgb(255, 255, 255)); Audio = new UIMenuGridAudio("CONTINUOUS_SLIDER", "HUD_FRONTEND_DEFAULT_SOUNDSET", 0); Top = new UIResText(TopText ?? "Up", new Point(0, 0), .35f, Color.FromArgb(255, 255, 255), CitizenFX.Core.UI.Font.ChaletLondon, Alignment.Center); Bottom = new UIResText(BottomText ?? "Down", new Point(0, 0), .35f, Color.FromArgb(255, 255, 255), CitizenFX.Core.UI.Font.ChaletLondon, Alignment.Center); SetCirclePosition = new PointF(.5f, circlePositionY != 0 ? circlePositionY : .5f); }
/// <summary> /// List item, with left/right arrows. /// </summary> /// <param name="text">Item label.</param> /// <param name="items">List that contains your items.</param> /// <param name="index">Index in the list. If unsure user 0.</param> /// <param name="description">Description for this item.</param> public UIMenuListItem(string text, List<dynamic> items, int index, string description) : base(text, description) { const int y = 0; _items = new List<dynamic>(items); _arrowLeft = new Sprite("commonmenu", "arrowleft", new Point(110, 105 + y), new Size(30, 30)); _arrowRight = new Sprite("commonmenu", "arrowright", new Point(280, 105 + y), new Size(30, 30)); _itemText = new UIResText("", new Point(290, y + 104), 0.35f, Color.White, Font.ChaletLondon, UIResText.Alignment.Left) {TextAlignment = UIResText.Alignment.Right}; Index = index; }
public UIMenuPercentagePanel(string title, string MinText, string MaxText) { Enabled = true; Background = new Sprite("commonmenu", "gradient_bgd", new Point(0, 0), new Size(431, 275)); ActiveBar = new UIResRectangle(new Point(0, 0), new Size(413, 10), Color.FromArgb(245, 245, 245)); BackgroundBar = new UIResRectangle(new Point(0, 0), new Size(413, 10), Color.FromArgb(80, 80, 80)); Min = new UIResText(MinText != "" || MinText != null ? MinText : "0%", new Point(0, 0), .35f, Color.FromArgb(255, 255, 255), CitizenFX.Core.UI.Font.ChaletLondon, Alignment.Center); Max = new UIResText(MaxText != "" || MaxText != null ? MaxText : "100%", new Point(0, 0), .35f, Color.FromArgb(255, 255, 255), CitizenFX.Core.UI.Font.ChaletLondon, Alignment.Center); Title = new UIResText(title != "" || title != null ? title : "Opacity", new Point(0, 0), .35f, Color.FromArgb(255, 255, 255), CitizenFX.Core.UI.Font.ChaletLondon, Alignment.Center); Audio = new UIMenuGridAudio("CONTINUOUS_SLIDER", "HUD_FRONTEND_DEFAULT_SOUNDSET", 0); }
/// <summary> /// List item with items generated at runtime /// </summary> /// <param name="text">Label text</param> /// <param name="description">Item description</param> public UIMenuDynamicListItem(string text, string description, string startingItem, DynamicListItemChangeCallback changeCallback) : base(text, description) { const int y = 0; _arrowLeft = new Sprite("commonmenu", "arrowleft", new Point(110, 105 + y), new Size(30, 30)); _arrowRight = new Sprite("commonmenu", "arrowright", new Point(280, 105 + y), new Size(30, 30)); _itemText = new UIResText("", new Point(290, y + 104), 0.35f, Color.White, Font.ChaletLondon, UIResText.Alignment.Right); CurrentListItem = startingItem; Callback = changeCallback; }
public UIMenuGridPanel(string TopText, string LeftText, string RightText, string BottomText, PointF circlePosition) { Enabled = true; Background = new Sprite("commonmenu", "gradient_bgd", new Point(0, 0), new Size(431, 275)); Grid = new Sprite("pause_menu_pages_char_mom_dad", "nose_grid", new Point(0, 0), new Size(200, 200), 0f, Color.FromArgb(255, 255, 255)); Circle = new Sprite("mpinventory", "in_world_circle", new PointF(0, 0), new SizeF(20, 20), 0f, Color.FromArgb(255, 255, 255)); Audio = new UIMenuGridAudio("CONTINUOUS_SLIDER", "HUD_FRONTEND_DEFAULT_SOUNDSET", 0); Top = new UIResText(TopText ?? "Up", new Point(0, 0), .35f, Color.FromArgb(255, 255, 255), CitizenFX.Core.UI.Font.ChaletLondon, Alignment.Center); Left = new UIResText(LeftText ?? "Left", new Point(0, 0), .35f, Color.FromArgb(255, 255, 255), CitizenFX.Core.UI.Font.ChaletLondon, Alignment.Center); Right = new UIResText(RightText ?? "Right", new Point(0, 0), .35f, Color.FromArgb(255, 255, 255), CitizenFX.Core.UI.Font.ChaletLondon, Alignment.Center); Bottom = new UIResText(BottomText ?? "Down", new Point(0, 0), .35f, Color.FromArgb(255, 255, 255), CitizenFX.Core.UI.Font.ChaletLondon, Alignment.Center); SetCirclePosition = new PointF(circlePosition.X != 0 ? circlePosition.X : .5f, circlePosition.Y != 0 ? circlePosition.Y : .5f); }
public UIMenuEditableNumericItem(string text, float defaultValue, float minimum, float maximum, float step, string description) : base(text, description) { Value = defaultValue; Minimum = minimum; Maximum = maximum; Step = step; _followingKeyEventNumber = 0; _valueText = new UIResText(defaultValue.ToString(), new Point(0, 0), 0.37f, Color.WhiteSmoke, GTA.Font.ChaletLondon, UIResText.Alignment.Centered); _rightArrow = new Sprite("commonmenu", "arrowright", new Point(0, 0), new Size(30, 30)); _leftArrow = new Sprite("commonmenu", "arrowleft", new Point(0, 0), new Size(30, 30)); }
public virtual void Draw(int interval) { SizeF res = UIMenu.GetScreenResolutionMaintainRatio(); Point safe = UIMenu.GetSafezoneBounds(); UIResText.Draw(Label, (int)res.Width - safe.X - 180, (int)res.Height - safe.Y - (30 + (4 * interval)), Font.ChaletLondon, 0.3f, Color.White, UIResText.Alignment.Right, false, false, 0); Sprite.Draw("timerbars", "all_black_bg", (int)res.Width - safe.X - 298, (int)res.Height - safe.Y - (40 + (4 * interval)), 300, 37, 0f, Color.FromArgb(180, 255, 255, 255)); UI.HideHudComponentThisFrame(HudComponent.AreaName); UI.HideHudComponentThisFrame(HudComponent.StreetName); UI.HideHudComponentThisFrame(HudComponent.VehicleName); }
/// <summary> /// Basic menu button. /// </summary> /// <param name="text">Button label.</param> /// <param name="description">Description.</param> public UIMenuItem(string text, string description) { Enabled = true; _rectangle = new UIResRectangle(new Point(0, 0), new Size(431, 38), Color.FromArgb(150, 0, 0, 0)); _text = new UIResText(text, new Point(8, 0), 0.33f, Color.WhiteSmoke, GTA.Font.ChaletLondon, UIResText.Alignment.Left); Description = description; _selectedSprite = new Sprite("commonmenu", "gradient_nav", new Point(0, 0), new Size(431, 38)); _badgeLeft = new Sprite("commonmenu", "", new Point(0, 0), new Size(40, 40)); _badgeRight = new Sprite("commonmenu", "", new Point(0, 0), new Size(40, 40)); _labelText = new UIResText("", new Point(0, 0), 0.35f) {TextAlignment = UIResText.Alignment.Right}; }
protected void Init() { _selectedSprite = new Sprite("commonmenu", "gradient_nav", new Size(431, 38), new Point(0, 0), HighlightColor); _rectangle = new UIResRectangle(new Point(0, 0), new Size(431, 38), Color.FromArgb(150, 0, 0, 0)); _text = new UIResText(Text, new Point(8, 0), 0.33f, Color.WhiteSmoke, GTA.UI.Font.ChaletLondon, Alignment.Left); Description = Description; _badgeLeft = new Sprite("commonmenu", "", new Size(40, 40), new Point(0, 0)); _badgeRight = new Sprite("commonmenu", "", new Size(40, 40), new Point(0, 0)); _labelText = new UIResText("", new Point(0, 0), 0.35f) { Alignment = Alignment.Right }; }
/// <summary> /// List item, with left/right arrows. /// </summary> /// <param name="text">Item label.</param> /// <param name="items">List that contains your items.</param> /// <param name="index">Index in the list. If unsure user 0.</param> /// <param name="description">Description for this item.</param> public UIMenuListItem(string text, List <dynamic> items, int index, string description) : base(text, description) { const int y = 0; _items = new List <dynamic>(items); _arrowLeft = new Sprite("commonmenu", "arrowleft", new PointF(110, 105 + y), new SizeF(30, 30)); _arrowRight = new Sprite("commonmenu", "arrowright", new PointF(280, 105 + y), new SizeF(30, 30)); _itemText = new UIResText("", new PointF(290, y + 104), 0.35f, UnknownColors.White, Font.ChaletLondon, UIResText.Alignment.Left) { TextAlignment = UIResText.Alignment.Right }; Index = index; }
protected void Init() { _selectedSprite = new Sprite("commonmenu", "gradient_nav", new PointF(0, 0), new SizeF(431, 38), 0, HighlightColor); _rectangle = new UIResRectangle(new PointF(0, 0), new SizeF(431, 38), Color.FromArgb(150, 0, 0, 0)); _text = new UIResText(Text, new PointF(8, 0), 0.33f, UnknownColors.WhiteSmoke, CitizenFX.Core.UI.Font.ChaletLondon, UIResText.Alignment.Left); Description = Description; _badgeLeft = new Sprite("commonmenu", "", new PointF(0, 0), new SizeF(40, 40)); _badgeRight = new Sprite("commonmenu", "", new PointF(0, 0), new SizeF(40, 40)); _labelText = new UIResText("", new PointF(0, 0), 0.35f) { TextAlignment = UIResText.Alignment.Right }; }
/// <summary> /// Calculates the width of a string. /// </summary> /// <param name="text">The text to measure.</param> /// <param name="font">Game font used for measurements.</param> /// <param name="scale">The scale of the characters.</param> /// <returns>The width of the string based on the font and scale.</returns> public static float GetTextWidth(string text, CitizenFX.Core.UI.Font font, float scale) { // Start by requesting the game to start processing a width measurement SetTextEntryForWidth("CELL_EMAIL_BCON"); // _BEGIN_TEXT_COMMAND_WIDTH // Add the text string UIResText.AddLongString(text); // Set the properties for the text SetTextFont((int)font); SetTextScale(1f, scale); // Ask the game for the relative string width float width = GetTextScreenWidth(true); // And return the literal result return(ResolutionMaintainRatio.Width * width); }
/// <summary> /// Basic menu button. /// </summary> /// <param name="text">Button label.</param> /// <param name="description">Description.</param> public UIMenuItem(string text, string description) { Enabled = true; _rectangle = new UIResRectangle(new Point(0, 0), new Size(431, 38), Color.FromArgb(150, 0, 0, 0)); _text = new UIResText(text, new Point(8, 0), 0.43f, Color.WhiteSmoke, GTA.UI.Font.ChaletComprimeCologne, UIResText.Alignment.Left); Description = description; _selectedSprite = new Sprite("commonmenu", "gradient_nav", new Point(0, 0), new Size(431, 38)); _badgeLeft = new Sprite("commonmenu", "", new Point(0, 0), new Size(40, 40)); _badgeRight = new Sprite("commonmenu", "", new Point(0, 0), new Size(40, 40)); _labelText = new UIResText("", new Point(0, 0), 0.45f) { TextAlignment = UIResText.Alignment.Right }; }
/// <summary> /// Basic menu button. /// </summary> /// <param name="text">Button label.</param> /// <param name="description">Description.</param> public UIMenuItem(string text, string description) { Enabled = true; _rectangle = new UIResRectangle(new PointF(0, 0), new SizeF(431, 38), Color.FromArgb(150, 0, 0, 0)); _text = new UIResText(text, new PointF(8, 0), 0.33f, UnknownColors.WhiteSmoke, CitizenFX.Core.UI.Font.ChaletLondon, UIResText.Alignment.Left); Description = description; _selectedSprite = new Sprite("commonmenu", "gradient_nav", new PointF(0, 0), new SizeF(431, 38)); _badgeLeft = new Sprite("commonmenu", "", new PointF(0, 0), new SizeF(40, 40)); _badgeRight = new Sprite("commonmenu", "", new PointF(0, 0), new SizeF(40, 40)); _labelText = new UIResText("", new PointF(0, 0), 0.35f) { TextAlignment = UIResText.Alignment.Right }; }
/// <summary> /// Basic menu button. /// </summary> /// <param name="text">Button label.</param> /// <param name="description">Description.</param> public UIMenuItem(string text, string description) { Enabled = true; _rectangle = new UIResRectangle(new Point(0, 0), new Size(431, 38), Color.FromArgb(20, 255, 255, 255)); // Color.FromArgb(150, 0, 0, 0) _text = new UIResText(text, new Point(8, 0), 0.33f, Color.WhiteSmoke, GTA.UI.Font.ChaletLondon, Alignment.Center); Description = description; _selectedSprite = new Sprite("commonmenu", "gradient_nav", new Size(431, 38), new Point(0, 0)); _badgeLeft = new Sprite("commonmenu", "", new Size(40, 40), new Point(0, 0)); _badgeRight = new Sprite("commonmenu", "", new Size(40, 40), new Point(0, 0)); _labelText = new UIResText("", new Point(0, 0), 0.35f) { Alignment = Alignment.Right }; }
/// <summary> /// Calculates the width of a string. /// </summary> /// <param name="text">The text to measure.</param> /// <param name="font">Game font used for measurements.</param> /// <param name="scale">The scale of the characters.</param> /// <returns>The width of the string based on the font and scale.</returns> public static float GetTextWidth(string text, GTA.Font font, float scale) { // Start by requesting the game to start processing a width measurement Function.Call(Hash._SET_TEXT_ENTRY_FOR_WIDTH, "CELL_EMAIL_BCON"); // _BEGIN_TEXT_COMMAND_WIDTH // Add the text string UIResText.AddLongString(text); // Set the properties for the text Function.Call(Hash.SET_TEXT_FONT, (int)font); Function.Call(Hash.SET_TEXT_SCALE, 1f, scale); // Ask the game for the relative string width float width = Function.Call <float>(Hash._GET_TEXT_SCREEN_WIDTH, true); // And return the literal result return(ResolutionMaintainRatio.Width * width); }
/// <summary> /// Basic menu button with description and colors. /// </summary> /// <param name="text">Button label.</param> /// <param name="description">Button label.</param> /// <param name="description">Button label.</param> /// <param name="description">Button label.</param> public UIMenuItem(string text, string description, Color color, Color highlightColor) { Enabled = true; MainColor = color; HighlightColor = highlightColor; TextColor = Colors.White; HighlightedTextColor = Colors.Black; _rectangle = new UIResRectangle(new Point(0, 0), new Size(431, 38), _defaultColor); // Color.FromArgb(150, 0, 0, 0) _text = new UIResText(text, new Point(8, 0), 0.33f, Colors.WhiteSmoke, CitizenFX.Core.UI.Font.ChaletLondon, Alignment.Left); Description = description; _selectedSprite = new Sprite("commonmenu", "gradient_nav", new Point(0, 0), new Size(431, 38)); _badgeLeft = new Sprite("commonmenu", "", new Point(0, 0), new Size(40, 40)); _badgeRight = new Sprite("commonmenu", "", new Point(0, 0), new Size(40, 40)); _labelText = new UIResText("", new Point(0, 0), 0.35f) { TextAlignment = Alignment.Right }; }
public static float MeasureString(string input, CitizenFX.Core.UI.Font font, float scale) { return(UIResText.MeasureStringWidth(input, font, scale)); }
void Deloreonfunctioning(int index) { #region functions display_background(); UIResText Deloreanlistnum = new UIResText("Number of Time Machines: " + Deloreanlist.Count.ToString(), new Point(loc.X, loc.Y - 50), (float)0.6, Color.Red); Deloreanlistnum.Draw(); UIResText Deloreanspeed = new UIResText("Speed: " + (int)((Deloreanlist[index].Deloreon.Speed / .27777) / 1.60934), new Point(loc.X, loc.Y - 130), (float)0.6, Color.Red); Deloreanspeed.Draw(); UIResText Deloreanpos = new UIResText(Deloreanlist[index].Deloreon.Rotation.ToString(), new Point(500, loc.Y - 130), (float)0.6, Color.Red); if (!Deloreanlist[index].engineturningon) { if (!Deloreanlist[index].engineison) { if (!Deloreanlist[index].RCmode) { //engineon.Play(); Deloreanlist[index].Deloreon.EngineRunning = true; } Deloreanlist[index].engineison = true; Deloreanlist[index].engineturningon = true; Deloreanlist[index].ifwentoutoffcar = false; Function.Call(Hash.SET_VEHICLE_ENGINE_ON, Game.Player.Character.CurrentVehicle, true); } } if (!Game.Player.Character.CurrentVehicle.IsDriveable) { if (!Deloreanlist[index].carjustdied) { Deloreanlist[index].carjustdied = true; trend.Play(); setfordeletion(Deloreanlist[index].Deloreon); Deloreanlist[index].Deloreon.IsPersistent = false; Deloreanlist[index].Deloreon = null; Game.Player.Character.CurrentVehicle.Detach(); Deloreanlist[index].ifwentoutoffcar = true; Deloreanlist.Remove(Deloreanlist[index]); } } if (Deloreanlist[index].refilltimecurcuits) { if (runoncefeul) { if (Mrfusionrefilltimer.getdelay() >= 3) { Mrfusionrefilltimer.Stop(); Mrfusionrefilltimer.Reset(); inputonfeul.Play(); Function.Call(Hash.SET_VEHICLE_MOD_KIT, Deloreanlist[index].Deloreon.Handle, 0); Deloreanlist[index].Deloreon.SetMod(VehicleMod.FrontBumper, 0, true); Deloreanlist[index].Deloreon.SetMod(VehicleMod.Roof, -1, true); runoncefeul = false; } } if (Mrfusionrefilltimer.getdelay() < 3) { if (!Deloreanlist[index].toggletimecurcuits) { if (!freezestarted) { Function.Call(Hash.SET_VEHICLE_MOD_KIT, Deloreanlist[index].Deloreon.Handle, 0); Deloreanlist[index].Deloreon.SetMod(VehicleMod.FrontBumper, -1, true); Deloreanlist[index].Deloreon.SetMod(VehicleMod.Roof, -1, true); } } } } else { if (!freezestarted) { Function.Call(Hash.SET_VEHICLE_MOD_KIT, Deloreanlist[index].Deloreon.Handle, 0); Deloreanlist[index].Deloreon.SetMod(VehicleMod.FrontBumper, -1, true); Deloreanlist[index].Deloreon.SetMod(VehicleMod.Roof, -1, true); } } #endregion if (Deloreanlist[index].toggletimecurcuits) { //timedisplay Function.Call(Hash.SET_VEHICLE_MOD_KIT, Deloreanlist[index].Deloreon.Handle, 0); Deloreanlist[index].Deloreon.SetMod(VehicleMod.SideSkirt, 0, true); //Function.Call(Hash.SET_VEHICLE_EXTRA, new InputArgument[] { TimeTravel.instantDelorean.Deloreanlist[index].Deloreon, 8, 0 }); tick(index); int tempspeed = (int)((Deloreanlist[index].Deloreon.Speed / .27777) / 1.60934); if (tempspeed > 84 && tempspeed < 88) { sparkprotect = true; if (!below84) { Function.Call(Hash.SET_VEHICLE_MOD_KIT, Deloreanlist[index].Deloreon.Handle, 0); Deloreanlist[index].Deloreon.SetMod(VehicleMod.Spoilers, 0, true); Deloreanlist[index].Deloreon.SetMod(VehicleMod.Frame, 5, true); if (Deloreanlist[index].refilltimecurcuits) make_effect("scr_martin1", "scr_sol1_sniper_impact", index); } World.DrawLightWithRange(Deloreanlist[index].Deloreon.GetOffsetInWorldCoords(new Vector3(0, (float)2.2, (float)0.5)), Color.DodgerBlue, (float)1.2, 400); if (!Deloreanlist[index].past84) { if (Deloreanlist[index].refilltimecurcuits) { sparksfeul.PlayLooping(); delay.Start(); Deloreanlist[index].Deloreon.IsInvincible = true; Deloreanlist[index].Deloreon.CanBeVisiblyDamaged = false; } else { sparks.PlayLooping(); } Deloreanlist[index].past84 = true; } } else if (tempspeed >= 88) { if (!below84) { Function.Call(Hash.SET_VEHICLE_MOD_KIT, Deloreanlist[index].Deloreon.Handle, 0); Deloreanlist[index].Deloreon.SetMod(VehicleMod.Spoilers, 0, true); Deloreanlist[index].Deloreon.SetMod(VehicleMod.Frame, 5, true); if (Deloreanlist[index].refilltimecurcuits) make_effect("scr_martin1", "scr_sol1_sniper_impact", index); } World.DrawLightWithRange(Deloreanlist[index].Deloreon.GetOffsetInWorldCoords(new Vector3(0, (float)2.2, (float)0.5)), Color.DodgerBlue, (float)1.2, 400); if (Deloreanlist[index].refilltimecurcuits) { if (delay.getdelay() < 5) { if (delay.getdelay() > 2) { } } else { if (Function.Call<int>(Hash.GET_FOLLOW_VEHICLE_CAM_VIEW_MODE) == 4) { Deloreanlist[index].timetravelentry(); Timetravelreentery.Play(); Ped[] peds = World.GetNearbyPeds(Game.Player.Character, 1000); Vehicle[] pedVehicles = World.GetNearbyVehicles(Game.Player.Character, 1000); for (int i = 0; i < peds.Length; i++) { if (peds[i] != Game.Player.Character) GTA.Native.Function.Call(GTA.Native.Hash.SET_ENTITY_COORDS_NO_OFFSET, peds[i], 0, 0, 0, 0, 0, 1); } Array.Clear(peds, 0, peds.Length); for (int i = 0; i < pedVehicles.Length; i++) { if (pedVehicles[i] != Game.Player.Character.CurrentVehicle) GTA.Native.Function.Call(GTA.Native.Hash.SET_ENTITY_COORDS_NO_OFFSET, pedVehicles[i], 0, 0, 0, 0, 0, 1); } Array.Clear(pedVehicles, 0, pedVehicles.Length); //End Ped Despawning GTA.Native.Function.Call(GTA.Native.Hash.SET_RANDOM_WEATHER_TYPE); //Function.Call(Hash.SET_CLOCK_DATE, Deloreanlist[index].getmonth(), Deloreanlist[index].getday(), Deloreanlist[index].getyear()); Function.Call(Hash.SET_CLOCK_TIME, ((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2), Deloreanlist[index].getminute(), 0); Game.Player.WantedLevel = 0; Player_time_class.pastday1 = Deloreanlist[index].pastday1; Player_time_class.pastday2 = Deloreanlist[index].pastday2; Player_time_class.pastmonth1 = Deloreanlist[index].pastmonth1; Player_time_class.pastmonth2 = Deloreanlist[index].pastmonth2; Player_time_class.pasty1 = Deloreanlist[index].pasty1; Player_time_class.pasty2 = Deloreanlist[index].pasty2; Player_time_class.pasty3 = Deloreanlist[index].pasty3; Player_time_class.pasty4 = Deloreanlist[index].pasty4; Player_time_class.pasth1 = Deloreanlist[index].pasth1; Player_time_class.pasth2 = Deloreanlist[index].pasth2; Player_time_class.pastm1 = Deloreanlist[index].pastm1; Player_time_class.pastm2 = Deloreanlist[index].pastm2; Player_time_class.pastampm = Deloreanlist[index].pastampm; Player_time_class.presday1 = Deloreanlist[index].presday1; Player_time_class.presday2 = Deloreanlist[index].presday2; Player_time_class.presmonth1 = Deloreanlist[index].presmonth1; Player_time_class.presmonth2 = Deloreanlist[index].presmonth2; Player_time_class.presy1 = Deloreanlist[index].presy1; Player_time_class.presy2 = Deloreanlist[index].presy2; Player_time_class.presy3 = Deloreanlist[index].presy3; Player_time_class.presy4 = Deloreanlist[index].presy4; Player_time_class.presh1 = Deloreanlist[index].presh1; Player_time_class.presh2 = Deloreanlist[index].presh2; Player_time_class.presm1 = Deloreanlist[index].presm1; Player_time_class.presm2 = Deloreanlist[index].presm2; Player_time_class.presampm = Deloreanlist[index].presampm; Player_time_class.fday1 = Deloreanlist[index].fday1; Player_time_class.fday2 = Deloreanlist[index].fday2; Player_time_class.fmonth1 = Deloreanlist[index].fmonth1; Player_time_class.fmonth2 = Deloreanlist[index].fmonth2; Player_time_class.fy1 = Deloreanlist[index].fy1; Player_time_class.fy2 = Deloreanlist[index].fy2; Player_time_class.fy3 = Deloreanlist[index].fy3; Player_time_class.fy4 = Deloreanlist[index].fy4; Player_time_class.fh1 = Deloreanlist[index].fh1; Player_time_class.fh2 = Deloreanlist[index].fh2; Player_time_class.fm1 = Deloreanlist[index].fm1; Player_time_class.fm2 = Deloreanlist[index].fm2; Player_time_class.fampm = Deloreanlist[index].fampm; Deloreanlist[index].refilltimecurcuits = false; Deloreanlist[index].Deloreon.DirtLevel = 12; below84 = true; if (Function.Call<bool>(Hash.IS_VEHICLE_EXTRA_TURNED_ON, new InputArgument[] { TimeTravel.instantDelorean.Deloreanlist[index].Deloreon, 10 })) { Function.Call(Hash.SET_VEHICLE_EXTRA, new InputArgument[] { TimeTravel.instantDelorean.Deloreanlist[index].Deloreon, 10, -1 }); } startfreeze(); Function.Call(Hash.SET_VEHICLE_MOD_KIT, Deloreanlist[index].Deloreon.Handle, 0); Deloreanlist[index].Deloreon.SetMod(VehicleMod.Spoilers, 1, true); Deloreanlist[index].Deloreon.SetMod(VehicleMod.FrontBumper, -1, true); } else { enterintime(); make_effect("scr_rcpaparazzo1", "scr_rcpap1_camera", index); Timetravelreenterycutscene.Play(); //Timetravelreentery.Play(); if (!stoponce) { Deloreanlist[index].Deloreon.Speed = 0; stoponce = true; } if (!Variableclass.sendinvincible) { Deloreanlist[index].Deloreon.IsInvincible = true; } Deloreanlist[index].Deloreon.IsVisible = false; below48(); Game.Player.CanControlCharacter = false; delay.Reset(); delay.Stop(); int tempcount = 0; while (tempcount <= 30) { int eplode = (int)ExplosionType.FlameExplode; World.AddExplosion(Deloreanlist[index].Deloreon.GetOffsetInWorldCoords(new Vector3(1, tempcount + 3, -2)), (ExplosionType)eplode, (float)1, 0); World.AddExplosion(Deloreanlist[index].Deloreon.GetOffsetInWorldCoords(new Vector3(-1, tempcount + 3, -2)), (ExplosionType)eplode, (float)1, 0); tempcount++; Application.DoEvents(); } if (Game.Player.WantedLevel > 0) { Game.Player.WantedLevel = 0; } rentry.Start(); if (Function.Call<bool>(Hash.IS_VEHICLE_EXTRA_TURNED_ON, new InputArgument[] { TimeTravel.instantDelorean.Deloreanlist[index].Deloreon, 10 })) { Function.Call(Hash.SET_VEHICLE_EXTRA, new InputArgument[] { TimeTravel.instantDelorean.Deloreanlist[index].Deloreon, 10, -1 }); } Function.Call(Hash.SET_VEHICLE_MOD_KIT, Deloreanlist[index].Deloreon.Handle, 0); Deloreanlist[index].Deloreon.SetMod(VehicleMod.Spoilers, 1, true); Deloreanlist[index].Deloreon.SetMod(VehicleMod.FrontBumper, -1, true); } } } } else { if (Deloreanlist[index].past84) { if (!entertime) { sparkprotect = false; stoponce = false; sparks.Stop(); Function.Call(Hash.SET_VEHICLE_MOD_KIT, Deloreanlist[index].Deloreon.Handle, 0); Deloreanlist[index].Deloreon.SetMod(VehicleMod.Spoilers, 1, true); } } if (Function.Call<int>(Hash.GET_FOLLOW_VEHICLE_CAM_VIEW_MODE) == 4) { below84 = false; } delay.Stop(); delay.Reset(); Deloreanlist[index].past84 = false; flux_capcitor(index); } } else { Function.Call(Hash.SET_VEHICLE_MOD_KIT, Deloreanlist[index].Deloreon.Handle, 0); Deloreanlist[index].Deloreon.SetMod(VehicleMod.FrontBumper, -1, true); Deloreanlist[index].Deloreon.SetMod(VehicleMod.SideSkirt, -1, true); Deloreanlist[index].Deloreon.SetMod(VehicleMod.Spoilers, -1, true); Deloreanlist[index].Deloreon.SetMod(VehicleMod.Frame, -1, true); Deloreanlist[index].Deloreon.SetMod(VehicleMod.Grille, -1, true); } }
public void tick(int index) { int tick = DateTime.Now.Second; if (Directory.Exists(image)) { #region future //month display img = displaymonth((Deloreanlist[index].fmonth1 * 10) + Deloreanlist[index].fmonth2, time.Future); if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + 27, loc.Y + 65), new Size(88, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } //Day display img = displaymunber(Deloreanlist[index].fday1, time.Future); if (File.Exists(image + "\\day\\1" + img)) { Sprite.DrawTexture(image + "\\day\\1" + img, new Point(loc.X + 140, loc.Y + 65), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].fday2, time.Future); if (File.Exists(image + "\\day\\2" + img)) { Sprite.DrawTexture(image + "\\day\\2" + img, new Point(loc.X + 166, loc.Y + 65), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } //yeardisplay img = displaymunber(Deloreanlist[index].fy1, time.Future); if (File.Exists(image + "\\year\\1" + img)) { Sprite.DrawTexture(image + "\\year\\1" + img, new Point(loc.X + 220, loc.Y + 65), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].fy2, time.Future); if (File.Exists(image + "\\year\\2" + img)) { Sprite.DrawTexture(image + "\\year\\2" + img, new Point(loc.X + 249, loc.Y + 65), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].fy3, time.Future); if (File.Exists(image + "\\year\\3" + img)) { Sprite.DrawTexture(image + "\\year\\3" + img, new Point(loc.X + 278, loc.Y + 65), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].fy4, time.Future); if (File.Exists(image + "\\year\\4" + img)) { Sprite.DrawTexture(image + "\\year\\4" + img, new Point(loc.X + 307, loc.Y + 65), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } int h1 = 1, h2 = 2; if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 0) { h1 = 1; h2 = 2; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 1) { h1 = 0; h2 = 1; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 2) { h1 = 0; h2 = 2; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 3) { h1 = 0; h2 = 3; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 4) { h1 = 0; h2 = 4; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 5) { h1 = 0; h2 = 5; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 6) { h1 = 0; h2 = 6; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 7) { h1 = 0; h2 = 7; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 8) { h1 = 0; h2 = 8; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 9) { h1 = 0; h2 = 9; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 10) { h1 = 1; h2 = 0; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 11) { h1 = 1; h2 = 1; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 12) { h1 = 1; h2 = 2; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 13) { h1 = 0; h2 = 1; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 14) { h1 = 0; h2 = 2; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 15) { h1 = 0; h2 = 3; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 16) { h1 = 0; h2 = 4; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 17) { h1 = 0; h2 = 5; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 18) { h1 = 0; h2 = 6; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 19) { h1 = 0; h2 = 7; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 20) { h1 = 0; h2 = 8; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 21) { h1 = 0; h2 = 9; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 22) { h1 = 1; h2 = 0; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 23) { h1 = 1; h2 = 1; } //hour display img = displaymunber(h1, time.Future); if (File.Exists(image + "\\hour\\1" + img)) { Sprite.DrawTexture(image + "\\hour\\1" + img, new Point(loc.X + 366, loc.Y + 65), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(h2, time.Future); if (File.Exists(image + "\\hour\\2" + img)) { Sprite.DrawTexture(image + "\\hour\\2" + img, new Point(loc.X + 388, loc.Y + 65), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) > 12) { Deloreanlist[index].fampm = "pm"; } else { Deloreanlist[index].fampm = "am"; } //ampm img = "\\red " + Deloreanlist[index].fampm + ".jpg"; if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + 340, loc.Y + 36), new Size(20, 28)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } //tick if (tick != temptick) { if (ticktock) { ticktock = false; } else { ticktock = true; } temptick = tick; } else { if (ticktock) { img = "\\red colon on.jpg"; if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + 427, loc.Y + 65), new Size(10, 14)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } } else { img = "\\red colon off.jpg"; if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + 427, loc.Y + 65), new Size(10, 14)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } } } //minute display img = displaymunber(Deloreanlist[index].fm1, time.Future); if (File.Exists(image + "\\min\\1" + img)) { Sprite.DrawTexture(image + "\\min\\1" + img, new Point(loc.X + 447, loc.Y + 65), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].fm2, time.Future); if (File.Exists(image + "\\min\\2" + img)) { Sprite.DrawTexture(image + "\\min\\2" + img, new Point(loc.X + 474, loc.Y + 65), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } #endregion #region present img = displaymonth((Deloreanlist[index].presmonth1 * 10) + Deloreanlist[index].presmonth2, time.Present); if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + 27, loc.Y + 157), new Size(88, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } //Day display img = displaymunber(Deloreanlist[index].presday1, time.Present); if (File.Exists(image + "\\day\\1" + img)) { Sprite.DrawTexture(image + "\\day\\1" + img, new Point(loc.X + 140, loc.Y + 157), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].presday2, time.Present); if (File.Exists(image + "\\day\\2" + img)) { Sprite.DrawTexture(image + "\\day\\2" + img, new Point(loc.X + 166, loc.Y + 157), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } //yeardisplay img = displaymunber(Deloreanlist[index].presy1, time.Present); if (File.Exists(image + "\\year\\1" + img)) { Sprite.DrawTexture(image + "\\year\\1" + img, new Point(loc.X + 220, loc.Y + 157), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].presy2, time.Present); if (File.Exists(image + "\\year\\2" + img)) { Sprite.DrawTexture(image + "\\year\\2" + img, new Point(loc.X + 249, loc.Y + 157), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].presy3, time.Present); if (File.Exists(image + "\\year\\3" + img)) { Sprite.DrawTexture(image + "\\year\\3" + img, new Point(loc.X + 278, loc.Y + 157), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].presy4, time.Present); if (File.Exists(image + "\\year\\4" + img)) { Sprite.DrawTexture(image + "\\year\\4" + img, new Point(loc.X + 307, loc.Y + 157), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } Deloreanlist[index].presampm = "am"; int hour = World.CurrentDayTime.Hours; if (hour == 0) { h1 = 1; h2 = 2; } else if (hour == 1) { h1 = 0; h2 = 1; } else if (hour == 2) { h1 = 0; h2 = 2; } else if (hour == 3) { h1 = 0; h2 = 3; } else if (hour == 4) { h1 = 0; h2 = 4; } else if (hour == 5) { h1 = 0; h2 = 5; } else if (hour == 6) { h1 = 0; h2 = 6; } else if (hour == 7) { h1 = 0; h2 = 7; } else if (hour == 8) { h1 = 0; h2 = 8; } else if (hour == 9) { h1 = 0; h2 = 9; } else if (hour == 10) { h1 = 1; h2 = 0; } else if (hour == 11) { h1 = 1; h2 = 1; } else if (hour == 12) { h1 = 1; h2 = 2; } else if (hour == 13) { h1 = 0; h2 = 1; } else if (hour == 14) { h1 = 0; h2 = 2; } else if (hour == 15) { h1 = 0; h2 = 3; } else if (hour == 16) { h1 = 0; h2 = 4; } else if (hour == 17) { h1 = 0; h2 = 5; } else if (hour == 18) { h1 = 0; h2 = 6; } else if (hour == 19) { h1 = 0; h2 = 7; } else if (hour == 20) { h1 = 0; h2 = 8; } else if (hour == 21) { h1 = 0; h2 = 9; } else if (hour == 22) { h1 = 1; h2 = 0; } else if (hour == 23) { h1 = 1; h2 = 1; } if (hour > 12) { Deloreanlist[index].fampm = "pm"; } else { Deloreanlist[index].fampm = "am"; } //ampm img = "\\green " + Deloreanlist[index].presampm + ".jpg"; if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + 340, loc.Y + 157), new Size(20, 32)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } //hour display img = displaymunber(h1, time.Present); if (File.Exists(image + "\\hour\\1" + img)) { Sprite.DrawTexture(image + "\\hour\\1" + img, new Point(loc.X + 366, loc.Y + 157), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(h2, time.Present); if (File.Exists(image + "\\hour\\2" + img)) { Sprite.DrawTexture(image + "\\hour\\2" + img, new Point(loc.X + 388, loc.Y + 157), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } //tick if (tick != temptick) { if (ticktock) { ticktock = false; } else { ticktock = true; } temptick = tick; } else { if (ticktock) { img = "\\green colon on.jpg"; if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + 427, loc.Y + 157), new Size(10, 14)); Deloreanlist[index].Deloreon.SetMod(VehicleMod.Grille, 0, true); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } } else { img = "\\green colon off.jpg"; if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + 427, loc.Y + 157), new Size(10, 14)); Deloreanlist[index].Deloreon.SetMod(VehicleMod.Grille, -1, true); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } } } //minute display int presmin = World.CurrentDayTime.Minutes; if (presmin < 10) { Deloreanlist[index].presm1 = 0; Deloreanlist[index].presm2 = presmin; } else { if (presmin < 20) { Deloreanlist[index].presm1 = 1; Deloreanlist[index].presm2 = presmin - 10; } else if (presmin < 30) { Deloreanlist[index].presm1 = 2; Deloreanlist[index].presm2 = presmin - 20; } else if (presmin < 40) { Deloreanlist[index].presm1 = 3; Deloreanlist[index].presm2 = presmin - 30; } else if (presmin < 50) { Deloreanlist[index].presm1 = 4; Deloreanlist[index].presm2 = presmin - 40; } else if (presmin < 60) { Deloreanlist[index].presm1 = 5; Deloreanlist[index].presm2 = presmin - 50; } } img = displaymunber(Deloreanlist[index].presm1, time.Present); if (File.Exists(image + "\\min\\1" + img)) { Sprite.DrawTexture(image + "\\min\\1" + img, new Point(loc.X + 447, loc.Y + 157), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].presm2, time.Present); if (File.Exists(image + "\\min\\2" + img)) { Sprite.DrawTexture(image + "\\min\\2" + img, new Point(loc.X + 474, loc.Y + 157), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } #endregion #region past //month display img = displaymonth((Deloreanlist[index].pastmonth1 * 10) + Deloreanlist[index].pastmonth2, time.Past); if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + 27, loc.Y + 243), new Size(88, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } //Day display img = displaymunber(Deloreanlist[index].pastday1, time.Past); if (File.Exists(image + "\\day\\1" + img)) { Sprite.DrawTexture(image + "\\day\\1" + img, new Point(loc.X + 140, loc.Y + 243), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].pastday2, time.Past); if (File.Exists(image + "\\day\\2" + img)) { Sprite.DrawTexture(image + "\\day\\2" + img, new Point(loc.X + 166, loc.Y + 243), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } //yeardisplay img = displaymunber(Deloreanlist[index].pasty1, time.Past); if (File.Exists(image + "\\year\\1" + img)) { Sprite.DrawTexture(image + "\\year\\1" + img, new Point(loc.X + 220, loc.Y + 243), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].pasty2, time.Past); if (File.Exists(image + "\\year\\2" + img)) { Sprite.DrawTexture(image + "\\year\\2" + img, new Point(loc.X + 249, loc.Y + 243), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].pasty3, time.Past); if (File.Exists(image + "\\year\\3" + img)) { Sprite.DrawTexture(image + "\\year\\3" + img, new Point(loc.X + 278, loc.Y + 243), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].pasty4, time.Past); if (File.Exists(image + "\\year\\4" + img)) { Sprite.DrawTexture(image + "\\year\\4" + img, new Point(loc.X + 307, loc.Y + 243), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } //ampm img = "\\amber " + Deloreanlist[index].pastampm + ".jpg"; if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + 340, loc.Y + 243), new Size(20, 32)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } //hour display img = displaymunber(Deloreanlist[index].pasth1, time.Past); if (File.Exists(image + "\\hour\\1" + img)) { Sprite.DrawTexture(image + "\\hour\\1" + img, new Point(loc.X + 366, loc.Y + 243), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].pasth2, time.Past); if (File.Exists(image + "\\hour\\2" + img)) { Sprite.DrawTexture(image + "\\hour\\2" + img, new Point(loc.X + 388, loc.Y + 243), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } //tick if (tick != temptick) { if (ticktock) { ticktock = false; } else { ticktock = true; } temptick = tick; } else { if (ticktock) { img = "\\amber colon on.jpg"; if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + 427, loc.Y + 243), new Size(10, 17)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } } else { img = "\\amber colon off.jpg"; if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + 427, loc.Y + 243), new Size(10, 17)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } } } //minute display img = displaymunber(Deloreanlist[index].pastm1, time.Past); if (File.Exists(image + "\\min\\1" + img)) { Sprite.DrawTexture(image + "\\min\\1" + img, new Point(loc.X + 447, loc.Y + 243), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].pastm2, time.Past); if (File.Exists(image + "\\min\\2" + img)) { Sprite.DrawTexture(image + "\\min\\2" + img, new Point(loc.X + 474, loc.Y + 243), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } #endregion } else { if (!Deloreanlist[index].refilltimecurcuits) { UIResText Mrfusion = new UIResText("Empty", new Point(1600, 900), (float)0.6, Color.Orange); Mrfusion.Draw(); } UIResText Timedisplayf = new UIResText(Deloreanlist[index].timedisplayfuture(), new Point(1450, 940), (float)0.6, Color.Red); UIResText Timedisplaypres = new UIResText(Deloreanlist[index].timedisplaypresent(), new Point(1450, 980), (float)0.6, Color.Green); UIResText Timedisplaypast = new UIResText(Deloreanlist[index].timedisplaypast(), new Point(1450, 1020), (float)0.6, Color.Yellow); Timedisplayf.DropShadow = true; Timedisplaypres.DropShadow = true; Timedisplaypast.DropShadow = true; Timedisplayf.Draw(); Timedisplaypres.Draw(); Timedisplaypast.Draw(); } }
public static float MeasureString(string input, Font font, float scale) { return(UIResText.MeasureStringWidth(input, font, scale)); }
protected void Init() { _selectedSprite = new Sprite("commonmenu", "gradient_nav", new Point(0, 0), new Size(431, 38), 0, HighlightColor); _rectangle = new UIResRectangle(new Point(0, 0), new Size(431, 38), Color.FromArgb(150, 0, 0, 0)); _text = new UIResText(Text, new Point(8, 0), 0.33f, Color.WhiteSmoke, GTA.Font.ChaletLondon, UIResText.Alignment.Left); Description = Description; _badgeLeft = new Sprite("commonmenu", "", new Point(0, 0), new Size(40, 40)); _badgeRight = new Sprite("commonmenu", "", new Point(0, 0), new Size(40, 40)); _labelText = new UIResText("", new Point(0, 0), 0.35f) { TextAlignment = UIResText.Alignment.Right }; }
/// <summary> /// Advanced Menu constructor that allows custom title banner. /// </summary> /// <param name="title">Title that appears on the big banner. Set to "" if you are using a custom banner.</param> /// <param name="subtitle">Subtitle that appears in capital letters in a small black bar.</param> /// <param name="offset">Point object with X and Y data for offsets. Applied to all menu elements.</param> /// <param name="spriteLibrary">Sprite library name for the banner.</param> /// <param name="spriteName">Sprite name for the banner.</param> public UIMenu(string title, string subtitle, Point offset, string spriteLibrary, string spriteName) { Offset = offset; Children = new Dictionary<UIMenuItem, UIMenu>(); _mainMenu = new UIContainer(new Point(0 + Offset.X, 0 + Offset.Y), new Size(700, 500), Color.FromArgb(0, 0, 0, 0)); _logo = new Sprite(spriteLibrary, spriteName, new Point(0 + Offset.X, 0 + Offset.Y), new Size(431, 107)); _mainMenu.Items.Add(new UIResText(title, new Point(215, 20), 1.15f, Color.White, Font.HouseScript, true)); if (!String.IsNullOrWhiteSpace(subtitle)) { _mainMenu.Items.Add(new UIResRectangle(new Point(0, 107), new Size(431, 37), Color.Black)); _mainMenu.Items.Add(new UIResText(subtitle, new Point(8, 110), 0.35f, Color.WhiteSmoke, 0, false)); if (subtitle.StartsWith("~")) { CounterPretext = subtitle.Substring(0, 3); } _counterText = new UIResText("", new Point(360 + Offset.X, 110 + Offset.Y), 0.35f, Color.WhiteSmoke, 0, false); ExtraYOffset = 37; } Title = title; Subtitle = subtitle; _upAndDownSprite = new Sprite("commonmenu", "shop_arrows_upanddown", new Point(190 + Offset.X, 147 + 37 * (MaxItemsOnScreen + 1) + Offset.Y - 37 + ExtraYOffset), new Size(50, 50)); _extraRectangleUp = new UIResRectangle(new Point(0 + Offset.X, 144 + 38 * (MaxItemsOnScreen + 1) + Offset.Y - 37 + ExtraYOffset), new Size(431, 18), Color.FromArgb(200, 0, 0, 0)); _extraRectangleDown = new UIResRectangle(new Point(0 + Offset.X, 144 + 18 + 38 * (MaxItemsOnScreen + 1) + Offset.Y - 37 + ExtraYOffset), new Size(431, 18), Color.FromArgb(200, 0, 0, 0)); _descriptionBar = new UIResRectangle(new Point(Offset.X, 123), new Size(431, 4), Color.Black); _descriptionRectangle = new Sprite("commonmenu", "gradient_bgd", new Point(Offset.X, 127), new Size(431, 30)); _descriptionText = new UIResText("Description", new Point(Offset.X + 5, 125), 0.33f, Color.FromArgb(255, 255, 255, 255), Font.ChaletLondon, false); _background = new Sprite("commonmenu", "gradient_bgd", new Point(Offset.X, 144 + Offset.Y - 37 + ExtraYOffset), new Size(290, 25)); SetKey(MenuControls.Up, GTA.Control.FrontendUp); SetKey(MenuControls.Down, GTA.Control.FrontendDown); SetKey(MenuControls.Left, GTA.Control.FrontendLeft); SetKey(MenuControls.Right, GTA.Control.FrontendRight); SetKey(MenuControls.Select, GTA.Control.FrontendAccept); SetKey(MenuControls.Back, GTA.Control.FrontendCancel); SetKey(MenuControls.Back, GTA.Control.FrontendPause); SetKey(MenuControls.Back, GTA.Control.Aim); MenuPool.Add(this); }
public void tick(int X, int Y, int index) { int tick = DateTime.Now.Second; Application.DoEvents(); if (Directory.Exists(image)) { #region future //month display img = displaymonth((Deloreanlist[index].fmonth1 * 10) + Deloreanlist[index].fmonth2, time.Future); if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + X, loc.Y + Y), new Size(88, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } //Day display img = displaymunber(Deloreanlist[index].fday1, time.Future); if (File.Exists(image + "\\day\\1" + img)) { Sprite.DrawTexture(image + "\\day\\1" + img, new Point(loc.X + X + 90, loc.Y + Y), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].fday2, time.Future); if (File.Exists(image + "\\day\\2" + img)) { Sprite.DrawTexture(image + "\\day\\2" + img, new Point(loc.X + X + 110, loc.Y + Y), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } //yeardisplay img = displaymunber(Deloreanlist[index].fy1, time.Future); if (File.Exists(image + "\\year\\1" + img)) { Sprite.DrawTexture(image + "\\year\\1" + img, new Point(loc.X + X + 140, loc.Y + Y), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].fy2, time.Future); if (File.Exists(image + "\\year\\2" + img)) { Sprite.DrawTexture(image + "\\year\\2" + img, new Point(loc.X + X + 160, loc.Y + Y), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].fy3, time.Future); if (File.Exists(image + "\\year\\3" + img)) { Sprite.DrawTexture(image + "\\year\\3" + img, new Point(loc.X + X + 180, loc.Y + Y), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].fy4, time.Future); if (File.Exists(image + "\\year\\4" + img)) { Sprite.DrawTexture(image + "\\year\\4" + img, new Point(loc.X + X + 200, loc.Y + Y), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } #region ampm int h1 = 1, h2 = 2; if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 0) { h1 = 1; h2 = 2; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 1) { h1 = 0; h2 = 1; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 2) { h1 = 0; h2 = 2; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 3) { h1 = 0; h2 = 3; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 4) { h1 = 0; h2 = 4; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 5) { h1 = 0; h2 = 5; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 6) { h1 = 0; h2 = 6; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 7) { h1 = 0; h2 = 7; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 8) { h1 = 0; h2 = 8; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 9) { h1 = 0; h2 = 9; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 10) { h1 = 1; h2 = 0; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 11) { h1 = 1; h2 = 1; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 12) { h1 = 1; h2 = 2; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 13) { h1 = 0; h2 = 1; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 14) { h1 = 0; h2 = 2; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 15) { h1 = 0; h2 = 3; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 16) { h1 = 0; h2 = 4; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 17) { h1 = 0; h2 = 5; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 18) { h1 = 0; h2 = 6; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 19) { h1 = 0; h2 = 7; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 20) { h1 = 0; h2 = 8; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 21) { h1 = 0; h2 = 9; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 22) { h1 = 1; h2 = 0; } else if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) == 23) { h1 = 1; h2 = 1; } #endregion Application.DoEvents(); //hour display img = displaymunber(h1, time.Future); if (File.Exists(image + "\\hour\\1" + img)) { Sprite.DrawTexture(image + "\\hour\\1" + img, new Point(loc.X + X + 250, loc.Y + Y), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(h2, time.Future); if (File.Exists(image + "\\hour\\2" + img)) { Sprite.DrawTexture(image + "\\hour\\2" + img, new Point(loc.X + X + 270, loc.Y + Y), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) > 12) { Deloreanlist[index].fampm = "pm"; } else { Deloreanlist[index].fampm = "am"; } UIResText Timedisplayf = new UIResText(Deloreanlist[index].timedisplayfuture(), new Point(1100, 570), (float)0.6, Color.Red); Timedisplayf.DropShadow = true; Timedisplayf.Draw(); //ampm img = "\\red " + Deloreanlist[index].fampm + ".jpg"; if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + X + 220, loc.Y + Y + 2), new Size(20, 28)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(loc.X + X, loc.Y + Y), (float)0.6); debug2.Draw(); } //tick if (tick != temptick) { Application.DoEvents(); if (ticktock) { ticktock = false; } else { ticktock = true; } temptick = tick; } else { Application.DoEvents(); if (ticktock) { img = "\\red colon on.jpg"; if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + X + 287, loc.Y + Y + 10), new Size(10, 14)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } } else { img = "\\red colon off.jpg"; if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + X + 287, loc.Y + Y + 10), new Size(10, 14)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } } } //minute display img = displaymunber(Deloreanlist[index].fm1, time.Future); if (File.Exists(image + "\\min\\1" + img)) { Sprite.DrawTexture(image + "\\min\\1" + img, new Point(loc.X + X + 300, loc.Y + Y), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].fm2, time.Future); if (File.Exists(image + "\\min\\2" + img)) { Sprite.DrawTexture(image + "\\min\\2" + img, new Point(loc.X + X + 320, loc.Y + Y), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } #endregion #region Present //month display img = displaymonth((Deloreanlist[index].presmonth1 * 10) + Deloreanlist[index].presmonth2, time.Present); if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + X, loc.Y + Y + 30), new Size(88, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } //Day display img = displaymunber(Deloreanlist[index].presday1, time.Present); if (File.Exists(image + "\\day\\1" + img)) { Sprite.DrawTexture(image + "\\day\\1" + img, new Point(loc.X + X + 90, loc.Y + Y + 30), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].presday2, time.Present); if (File.Exists(image + "\\day\\2" + img)) { Sprite.DrawTexture(image + "\\day\\2" + img, new Point(loc.X + X + 110, loc.Y + Y + 30), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } //yeardisplay img = displaymunber(Deloreanlist[index].presy1, time.Present); if (File.Exists(image + "\\year\\1" + img)) { Sprite.DrawTexture(image + "\\year\\1" + img, new Point(loc.X + X + 140, loc.Y + Y + 30), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].presy2, time.Present); if (File.Exists(image + "\\year\\2" + img)) { Sprite.DrawTexture(image + "\\year\\2" + img, new Point(loc.X + X + 160, loc.Y + Y + 30), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].presy3, time.Present); if (File.Exists(image + "\\year\\3" + img)) { Sprite.DrawTexture(image + "\\year\\3" + img, new Point(loc.X + X + 180, loc.Y + Y + 30), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].presy4, time.Present); if (File.Exists(image + "\\year\\4" + img)) { Sprite.DrawTexture(image + "\\year\\4" + img, new Point(loc.X + X + 200, loc.Y + Y + 30), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } #region ampm Deloreanlist[index].presampm = "am"; int hour = World.CurrentDayTime.Hours; if (hour == 0) { h1 = 1; h2 = 2; } else if (hour == 1) { h1 = 0; h2 = 1; } else if (hour == 2) { h1 = 0; h2 = 2; } else if (hour == 3) { h1 = 0; h2 = 3; } else if (hour == 4) { h1 = 0; h2 = 4; } else if (hour == 5) { h1 = 0; h2 = 5; } else if (hour == 6) { h1 = 0; h2 = 6; } else if (hour == 7) { h1 = 0; h2 = 7; } else if (hour == 8) { h1 = 0; h2 = 8; } else if (hour == 9) { h1 = 0; h2 = 9; } else if (hour == 10) { h1 = 1; h2 = 0; } else if (hour == 11) { h1 = 1; h2 = 1; } else if (hour == 12) { h1 = 1; h2 = 2; } else if (hour == 13) { h1 = 0; h2 = 1; } else if (hour == 14) { h1 = 0; h2 = 2; } else if (hour == 15) { h1 = 0; h2 = 3; } else if (hour == 16) { h1 = 0; h2 = 4; } else if (hour == 17) { h1 = 0; h2 = 5; } else if (hour == 18) { h1 = 0; h2 = 6; } else if (hour == 19) { h1 = 0; h2 = 7; } else if (hour == 20) { h1 = 0; h2 = 8; } else if (hour == 21) { h1 = 0; h2 = 9; } else if (hour == 22) { h1 = 1; h2 = 0; } else if (hour == 23) { h1 = 1; h2 = 1; } Application.DoEvents(); if (hour > 12) { Deloreanlist[index].fampm = "pm"; } else { Deloreanlist[index].fampm = "am"; } //ampm img = "\\green " + Deloreanlist[index].fampm + ".jpg"; if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + X + 220, loc.Y + Y + 32), new Size(20, 28)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(loc.X + X, loc.Y + Y), (float)0.6); debug2.Draw(); } #endregion //hour display img = displaymunber(h1, time.Present); if (File.Exists(image + "\\hour\\1" + img)) { Sprite.DrawTexture(image + "\\hour\\1" + img, new Point(loc.X + X + 250, loc.Y + Y + 30), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(h2, time.Present); if (File.Exists(image + "\\hour\\2" + img)) { Sprite.DrawTexture(image + "\\hour\\2" + img, new Point(loc.X + X + 270, loc.Y + Y + 30), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } //tick if (tick != temptick) { if (ticktock) { ticktock = false; } else { ticktock = true; } temptick = tick; } else { if (ticktock) { img = "\\green colon on.jpg"; if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + X + 287, loc.Y + Y + 40), new Size(10, 14)); Deloreanlist[index].Deloreon.SetMod(VehicleMod.Grille, 0, true); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } } else { img = "\\green colon off.jpg"; if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + X + 287, loc.Y + Y + 40), new Size(10, 14)); Deloreanlist[index].Deloreon.SetMod(VehicleMod.Grille, -1, true); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } } } //minute display int presmin = World.CurrentDayTime.Minutes; if (presmin < 10) { Deloreanlist[index].presm1 = 0; Deloreanlist[index].presm2 = presmin; } else { if (presmin < 20) { Deloreanlist[index].presm1 = 1; Deloreanlist[index].presm2 = presmin - 10; } else if (presmin < 30) { Deloreanlist[index].presm1 = 2; Deloreanlist[index].presm2 = presmin - 20; } else if (presmin < 40) { Deloreanlist[index].presm1 = 3; Deloreanlist[index].presm2 = presmin - 30; } else if (presmin < 50) { Deloreanlist[index].presm1 = 4; Deloreanlist[index].presm2 = presmin - 40; } else if (presmin < 60) { Deloreanlist[index].presm1 = 5; Deloreanlist[index].presm2 = presmin - 50; } } //minute display img = displaymunber(Deloreanlist[index].presm1, time.Present); if (File.Exists(image + "\\min\\1" + img)) { Sprite.DrawTexture(image + "\\min\\1" + img, new Point(loc.X + X + 300, loc.Y + Y + 30), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].presm2, time.Present); if (File.Exists(image + "\\min\\2" + img)) { Sprite.DrawTexture(image + "\\min\\2" + img, new Point(loc.X + X + 320, loc.Y + Y + 30), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } #endregion #region Past //month display img = displaymonth((Deloreanlist[index].pastmonth1 * 10) + Deloreanlist[index].pastmonth2, time.Past); if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + X, loc.Y + Y + 60), new Size(88, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } //Day display img = displaymunber(Deloreanlist[index].pastday1, time.Past); if (File.Exists(image + "\\day\\1" + img)) { Sprite.DrawTexture(image + "\\day\\1" + img, new Point(loc.X + X + 90, loc.Y + Y + 60), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].pastday2, time.Past); if (File.Exists(image + "\\day\\2" + img)) { Sprite.DrawTexture(image + "\\day\\2" + img, new Point(loc.X + X + 110, loc.Y + Y + 60), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } //yeardisplay img = displaymunber(Deloreanlist[index].pasty1, time.Past); if (File.Exists(image + "\\year\\1" + img)) { Sprite.DrawTexture(image + "\\year\\1" + img, new Point(loc.X + X + 140, loc.Y + Y + 60), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].pasty2, time.Past); if (File.Exists(image + "\\year\\2" + img)) { Sprite.DrawTexture(image + "\\year\\2" + img, new Point(loc.X + X + 160, loc.Y + Y + 60), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].pasty3, time.Past); if (File.Exists(image + "\\year\\3" + img)) { Sprite.DrawTexture(image + "\\year\\3" + img, new Point(loc.X + X + 180, loc.Y + Y + 60), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].pasty4, time.Past); if (File.Exists(image + "\\year\\4" + img)) { Sprite.DrawTexture(image + "\\year\\4" + img, new Point(loc.X + X + 200, loc.Y + Y + 60), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } #region ampm h1 = 1; h2 = 2; if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 0) { h1 = 1; h2 = 2; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 1) { h1 = 0; h2 = 1; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 2) { h1 = 0; h2 = 2; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 3) { h1 = 0; h2 = 3; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 4) { h1 = 0; h2 = 4; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 5) { h1 = 0; h2 = 5; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 6) { h1 = 0; h2 = 6; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 7) { h1 = 0; h2 = 7; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 8) { h1 = 0; h2 = 8; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 9) { h1 = 0; h2 = 9; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 10) { h1 = 1; h2 = 0; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 11) { h1 = 1; h2 = 1; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 12) { h1 = 1; h2 = 2; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 13) { h1 = 0; h2 = 1; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 14) { h1 = 0; h2 = 2; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 15) { h1 = 0; h2 = 3; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 16) { h1 = 0; h2 = 4; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 17) { h1 = 0; h2 = 5; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 18) { h1 = 0; h2 = 6; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 19) { h1 = 0; h2 = 7; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 20) { h1 = 0; h2 = 8; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 21) { h1 = 0; h2 = 9; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 22) { h1 = 1; h2 = 0; } else if (((Deloreanlist[index].pasth1 * 10) + Deloreanlist[index].pasth2) == 23) { h1 = 1; h2 = 1; } #endregion //hour display img = displaymunber(h1, time.Past); if (File.Exists(image + "\\hour\\1" + img)) { Sprite.DrawTexture(image + "\\hour\\1" + img, new Point(loc.X + X + 250, loc.Y + Y + 60), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(h2, time.Past); if (File.Exists(image + "\\hour\\2" + img)) { Sprite.DrawTexture(image + "\\hour\\2" + img, new Point(loc.X + X + 270, loc.Y + Y + 60), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } if (((Deloreanlist[index].fh1 * 10) + Deloreanlist[index].fh2) > 12) { Deloreanlist[index].fampm = "pm"; } else { Deloreanlist[index].fampm = "am"; } //ampm img = "\\amber " + Deloreanlist[index].pastampm + ".jpg"; if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + X + 220, loc.Y + Y + 62), new Size(20, 28)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(loc.X + X, loc.Y + Y + 50), (float)0.6); debug2.Draw(); } //tick if (tick != temptick) { if (ticktock) { ticktock = false; } else { ticktock = true; } temptick = tick; } else { if (ticktock) { img = "\\amber colon on.jpg"; if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + X + 287, loc.Y + Y + 70), new Size(10, 14)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } } else { img = "\\amber colon off.jpg"; if (File.Exists(image + img)) { Sprite.DrawTexture(image + img, new Point(loc.X + X + 287, loc.Y + Y + 70), new Size(10, 14)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } } } //minute display img = displaymunber(Deloreanlist[index].pastm1, time.Past); if (File.Exists(image + "\\min\\1" + img)) { Sprite.DrawTexture(image + "\\min\\1" + img, new Point(loc.X + X + 300, loc.Y + Y + 60), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } img = displaymunber(Deloreanlist[index].pastm2, time.Past); if (File.Exists(image + "\\min\\2" + img)) { Sprite.DrawTexture(image + "\\min\\2" + img, new Point(loc.X + X + 320, loc.Y + Y + 60), new Size(20, 29)); } else { UIText debug2 = new UIText("File is not present: " + img, new Point(400, 100), (float)0.6); debug2.Draw(); } #endregion } else { UIText debug2 = new UIText("images folder not present. Please place images folder in the scripts folder" + image, new Point(400, 100), (float)0.6); debug2.Draw(); } }