Example #1
0
 public void ShowColoredShard(string msg, string desc, HudColor textColor, HudColor bgColor, int time = 5000)
 {
     Load(true);
     _start = Game.GameTime;
     _sc.CallFunction("SHOW_SHARD_CENTERED_MP_MESSAGE", msg, desc, (int)bgColor, (int)textColor);
     _timer = time;
 }
Example #2
0
 public void ShowColoredShard(string msg, string desc, HudColor textColor, HudColor bgColor, int time = 5000)
 {
     Load(true);
     _start = Game.GameTime;
     _sc.CallFunction("SHOW_SHARD_CENTERED_MP_MESSAGE", msg, desc, (int)bgColor, (int)textColor);
     _timer = time;
 }
    protected virtual void registerHud()
    {
        if (interactiveValues.Length <= 0 && interactiveColors.Length <= 0)
        {
            return;
        }

        float sum = (float)(interactiveValues.Length + interactiveColors.Length);

        for (int i = 0; i < interactiveValues.Length; i++)
        {
            InteractiveValue v = interactiveValues[i] as InteractiveValue;

            HudValue slider = hud.createSlider((float)i / sum);
            if (slider != null)
            {
                var text = slider.GetComponentInChildren <TextMesh>();
                if (text)
                {
                    text.text = v._description;
                }

                object obj = v.propSet.Get();
                if (obj != null)
                {
                    slider.setValue((float)obj);
                }

                slider.OnValueChanged += (val) => { v.propSet.Set(Mathf.Lerp(v._min, v._max, val)); };
                instancedHudValues.Add(slider);
            }
        }

        float tmp = interactiveValues.Length;

        for (int i = 0; i < interactiveColors.Length; i++)
        {
            InteractiveColor v = interactiveColors[i] as InteractiveColor;
            Debug.Log(string.Format("Creating hsv thing for {0}", v.name));

            HudColor slider = hud.createColorPicker(((float)i + tmp) / (float)sum);
            if (slider != null)
            {
                var text = slider.GetComponentInChildren <TextMesh>();
                if (text)
                {
                    text.text = v._description;
                }

                object obj = v.fieldSet.Get();
                if (obj != null)
                {
                    slider.setValue((Color)obj);
                }

                slider.OnColorChanged += (val) => { v.fieldSet.Set(val); };
                instancedHudColors.Add(slider);
            }
        }
    }
Example #4
0
 public static void ShowNotification(string message, HudColor hudColor = HudColor.HUD_COLOUR_DEFAULT)
 {
     if (hudColor != HudColor.HUD_COLOUR_DEFAULT)
     {
         CitizenFX.Core.Native.API.ThefeedNextPostBackgroundColor((int)hudColor);
     }
     Raw.ShowNotification(message);
 }
Example #5
0
        public async void ShowColoredShard(string msg, string desc, HudColor textColor, HudColor bgColor, int time = 5000)
        {
            await Load();

            _start = Game.GameTime;
            _sc.CallFunction("SHOW_SHARD_CENTERED_MP_MESSAGE", msg, desc, (int)bgColor, (int)textColor);
            _timer          = time;
            _hasAnimatedOut = false;
        }
Example #6
0
        public async void ShowColoredShard(string msg, string desc, HudColor bgColor, bool useDarkerShard = false, bool useCondensedShard = false, int time = 5000)
        {
            await Load();

            _start = Game.GameTime;
            _sc.CallFunction("SHOW_SHARD_MIDSIZED_MESSAGE", msg, desc, (int)bgColor, useDarkerShard, useCondensedShard);
            _timer          = time;
            _hasAnimatedOut = false;
        }
 public PlayerRow(int index, int rank, Player player, string status, string crewTag, PlayerIcon icon, HudColor rowColor, HudColor statusColor)
 {
     this.RowIndex    = index;
     this.PlayerRank  = rank;
     this.Player      = player;
     this.Status      = status;
     this.CrewTag     = crewTag;
     this.Icon        = icon;
     this.RowColor    = rowColor;
     this.StatusColor = statusColor;
 }
        public static void ShowBigMessage(string text, string description, HudColor color, HudColor background, int duration = 3000)
        {
            BigMessage message = new BigMessage
            {
                text        = text,
                description = description,
                color       = color,
                background  = background,
                duration    = duration
            };

            BigMessages.Add(message);
        }
    protected virtual void unregisterHud()
    {
        for (int i = 0; i < instancedHudValues.Count; i++)
        {
            HudValue obj = instancedHudValues[i];
            obj.transform.parent = null;
            Debug.Log(string.Format("Destroying hud value {0}", obj.name));
            Destroy(obj.gameObject);
        }

        instancedHudValues.Clear();

        for (int i = 0; i < instancedHudColors.Count; i++)
        {
            HudColor obj = instancedHudColors[i];
            obj.transform.parent = null;
            Debug.Log(string.Format("Destroying hud color {0}", obj.name));
            Destroy(obj.gameObject);
        }

        instancedHudColors.Clear();
    }
Example #10
0
 /// <summary>
 /// Sets the RGBA value of the specified HUD color.
 /// </summary>
 /// <param name="hudColor">The HUD color.</param>
 /// <param name="color">The new color value.</param>
 public static void SetColor(this HudColor hudColor, Color color) => N.ReplaceHudColourWithRgba((int)hudColor, color.R, color.G, color.B, color.A);
Example #11
0
 /// <summary>
 /// Gets the RGBA value of the specified HUD color.
 /// </summary>
 ///<param name="hudColor">The HUD color.</param>
 public static Color GetColor(this HudColor hudColor)
 {
     N.GetHudColour((int)hudColor, out int r, out int g, out int b, out int a);
     return(Color.FromArgb(a, r, g, b));
 }
 public static void DisplayHelpText(this Client player, string text, HudColor color, int time = 5000, int alpha = 255)
 {
     player.triggerEvent("CLIENT_WRAPPER", "DisplayHelpText", text, time, (int)color, alpha);
 }
        public async void UpdatePlayer(Player player, int rank, string status, string crewTag, PlayerIcon icon, HudColor rowColor, HudColor statusColor)
        {
            PlayerRow p = playerRows.Find(pr => { return(pr.Player.ServerId == player.ServerId); });

            p.Status      = status;
            p.PlayerRank  = rank;
            p.CrewTag     = crewTag;
            p.Icon        = icon;
            p.RowColor    = rowColor;
            p.StatusColor = statusColor;
            await UpdateList();
        }
        public async void UpdatePlayer(int index, int rank, string status, string crewTag, PlayerIcon icon, HudColor rowColor, HudColor statusColor)
        {
            PlayerRow p = playerRows[index];

            p.Status      = status;
            p.PlayerRank  = rank;
            p.CrewTag     = crewTag;
            p.Icon        = icon;
            p.RowColor    = rowColor;
            p.StatusColor = statusColor;
            await UpdateList();
        }
 public static void ShowMidsizedMessage(this Client player, string title, string message, HudColor bgColor, bool useDarkerShard, bool condensed, int time = 3000)
 {
     player.triggerEvent("CLIENT_WRAPPER", "ShowMidsizedMessage", title, message, (int)bgColor, useDarkerShard, condensed, time);
 }
Example #16
0
 /// <summary>
 /// Gets the real name of the specified HUD color. For example, for <see cref="HudColor.PureWhite"/> it will return "HUD_COLOUR_PURE_WHITE".
 /// </summary>
 /// <remarks>
 /// One of the uses of the returned name is changing the color of the text from notifications, help messages or subtitles.
 /// <code lang="C#" title="Usage example in a notification">
 /// Game.DisplayHelp($"~{HudColor.Red.GetName()}~Now this text is red!");
 /// </code>
 /// </remarks>
 /// <param name="hudColor">The HUD color.</param>
 public static string GetName(this HudColor hudColor) => hudColor switch
 {
Example #17
0
        public static void ShowAdvancedNotification(string sender, string subject, string message, NotificationPicture notificationPicture = NotificationPicture.CHAR_MULTIPLAYER, IconType iconType = IconType.ChatBox, bool flash = false, bool savetoBreif = true, HudColor hudColor = HudColor.HUD_COLOUR_DEFAULT)
        {
            if (hudColor != HudColor.HUD_COLOUR_DEFAULT)
            {
                Raw.ShowAdvancedNotification(sender, subject, message, notificationPicture.ToString(), (int)iconType, flash, savetoBreif, (int)hudColor);
                return;
            }

            Raw.ShowAdvancedNotification(sender, subject, message, notificationPicture.ToString(), (int)iconType, flash, savetoBreif, null);
        }
Example #18
0
        public static void ShowAdvancedNotification(string sender, string subject, string message, string textureDict, IconType iconType, bool flash = false, bool savetoBreif = true, HudColor hudColor = HudColor.HUD_COLOUR_DEFAULT)
        {
            if (hudColor != HudColor.HUD_COLOUR_DEFAULT)
            {
                Raw.ShowAdvancedNotification(sender, subject, message, textureDict, (int)iconType, flash, savetoBreif, (int)hudColor);
                return;
            }

            Raw.ShowAdvancedNotification(sender, subject, message, textureDict, (int)iconType, flash, savetoBreif, null);
        }
 public async void AddPlayer(Player player, int rank, string status, string crewTag, PlayerIcon icon, HudColor rowColor, HudColor statusColor)
 {
     if (!IsVisible)
     {
         await ToggleMenu();
     }
     playerRows.Add(new PlayerRow(index: playerRows.Count, rank: rank, player: player, status: status, crewTag: crewTag, icon: icon, rowColor: rowColor, statusColor: statusColor));
     //await BaseScript.Delay(100);
     await UpdateList();
 }
 public static void ShowColoredShard(this Client player, string message, string description, HudColor textColor, HudColor bgColor, int time = 3000)
 {
     player.triggerEvent("CLIENT_WRAPPER", "ShowColoredShard", message, description, (int)textColor, (int)bgColor, time);
 }