public static void TextPopup2(this Entity player, string text) { HudElem hud; if (!player.HasField("textpopup2")) { player.SetField("textpopup2", new Parameter(HudElem.NewClientHudElem(player))); } hud = player.GetField <HudElem>("textpopup2"); if (hud != null) { hud.Call("destroy"); } hud = HudElem.CreateFontString(player, "hudbig", 0.8f); hud.SetPoint("BOTTOMCENTER", "BOTTOMCENTER", 0, -105); hud.SetText(text); hud.Alpha = 0.85f; hud.GlowColor = new Vector3(0.3f, 0.9f, 0.9f); hud.GlowAlpha = 0.55f; hud.Call("SetPulseFX", 100, 3000, 1000); hud.ChangeFontScaleOverTime(0.1f, 0.75f); player.AfterDelay(100, e => { hud.ChangeFontScaleOverTime(0.1f, 0.65f); }); }
private void StaticEffect(Entity player, int duration) { if (!player.IsPlayer) { return; } HudElem staticBG = HudElem.NewClientHudElem(player); staticBG.HorzAlign = "Fullscreen"; staticBG.VertAlign = "Fullscreen"; staticBG.SetShader("white", 640, 480); staticBG.Archived = true; staticBG.Sort = 10; HudElem staticFG = HudElem.NewClientHudElem(player); staticFG.HorzAlign = "Fullscreen"; staticFG.VertAlign = "Fullscreen"; staticFG.SetShader("ac130_overlay_grain", 640, 480); staticFG.Archived = true; staticFG.Sort = 20; AfterDelay(duration, () => { staticFG.Call("Destroy"); staticBG.Call("Destroy"); }); return; }
public Dictionary <string, HudElem> Overlay(Entity player) { Dictionary <string, HudElem> overlay = new Dictionary <string, HudElem>() { ["thermal_vision"] = HudElem.NewClientHudElem(player), ["enhanced_vision"] = HudElem.NewClientHudElem(player) }; overlay["thermal_vision"].X = 200; overlay["thermal_vision"].Y = 0; overlay["thermal_vision"].AlignX = "left"; overlay["thermal_vision"].AlignY = "top"; overlay["thermal_vision"].HorzAlign = "left"; overlay["thermal_vision"].VertAlign = "top"; overlay["thermal_vision"].FontScale = 2.5f; overlay["thermal_vision"].SetText("FLIR"); overlay["thermal_vision"].Alpha = 1; overlay["enhanced_vision"].X = -200; overlay["enhanced_vision"].Y = 0; overlay["enhanced_vision"].AlignX = "right"; overlay["enhanced_vision"].AlignY = "top"; overlay["enhanced_vision"].HorzAlign = "right"; overlay["enhanced_vision"].VertAlign = "top"; overlay["enhanced_vision"].FontScale = 2.5f; overlay["enhanced_vision"].SetText("OPT"); overlay["enhanced_vision"].Alpha = 1; player.Call("setBlurForPlayer", 1.2f, 0); return(overlay); }
public static HudElem PerkHud(this Entity player, PerkCola perk, bool playsound = false) { player.Call("setblurforplayer", 6, 0.5f); int perksAmount = player.PerkColasCount() - 1; int MultiplyTimes = 28 * perksAmount; var hudtext = HudElem.NewClientHudElem(player); hudtext.AlignX = "center"; hudtext.VertAlign = "middle"; hudtext.AlignY = "middle"; hudtext.HorzAlign = "center"; hudtext.Font = "objective"; hudtext.FontScale = 1.5f; hudtext.X = 0; hudtext.Y = 0; hudtext.Foreground = true; hudtext.Color = perk.HudColor; hudtext.Alpha = 0; hudtext.SetText(perk.HudName); var hudshader = HudElem.NewClientHudElem(player); hudshader.AlignX = "center"; hudshader.VertAlign = "middle"; hudshader.AlignY = "middle"; hudshader.HorzAlign = "center"; hudshader.X = 0; hudshader.Y = 0; hudshader.Foreground = true; hudshader.SetShader(perk.Icon, 25, 25); hudshader.Alpha = 1; hudshader.SetField("perk", new Parameter(perk.Type)); player.AfterDelay(300, e => { hudshader.Call("moveovertime", 0.5f); hudshader.X = -200; }); player.AfterDelay(700, e => { player.Call("setblurforplayer", 0, 0.3f); hudtext.Alpha = 1; }); player.AfterDelay(3700, e => { hudtext.Call("fadeovertime", 0.25f); hudtext.Alpha = 0; hudshader.Call("scaleovertime", 1, 25, 25); hudshader.Call("moveovertime", 1); hudshader.X = -300 + MultiplyTimes; hudshader.Y = 180; }); player.AfterDelay(4700, e => { hudtext.Call("destroy"); }); return(hudshader); }
private void MakeHUD(Entity player) { HudElem screen = HudElem.NewClientHudElem(player); screen.X = 0f; screen.Y = 0f; screen.AlignX = "left"; screen.AlignY = "top"; screen.HorzAlign = "fullscreen"; screen.VertAlign = "fullscreen"; screen.SetShader("remote_turret_overlay_mp", 640, 480); screen.Sort = -10; screen.Archived = true; OnInterval(100, () => { if (player.GetField <int>("isjet") == 0) { screen.Alpha = 0f; } else { screen.Alpha = 1f; } return(player != null); }); }
public static HudElem PerkHud(this Entity player, string shader, Vector3 color, string text) { player.Call("setblurforplayer", 6, 0.5f); int perksAmount = player.PerkColasCount() - 1; int MultiplyTimes = 28 * perksAmount; var hudtext = HudElem.NewClientHudElem(player); hudtext.AlignX = "center"; hudtext.VertAlign = "middle"; hudtext.AlignY = "middle"; hudtext.HorzAlign = "center"; hudtext.Font = "objective"; hudtext.FontScale = 1.5f; hudtext.X = 0; hudtext.Y = 0; hudtext.Foreground = true; hudtext.Color = color; hudtext.Alpha = 0; hudtext.SetText(text); var hudshader = HudElem.NewClientHudElem(player); hudshader.AlignX = "center"; hudshader.VertAlign = "middle"; hudshader.AlignY = "middle"; hudshader.HorzAlign = "center"; hudshader.X = 0; hudshader.Y = 0; hudshader.Foreground = true; hudshader.SetShader(shader, 25, 25); hudshader.Alpha = 1; player.AfterDelay(300, e => { hudshader.Call("moveovertime", 0.5f); hudshader.X = -200; }); player.AfterDelay(700, e => { player.Call("setblurforplayer", 0, 0.3f); hudtext.Alpha = 1; }); player.AfterDelay(3700, e => { hudtext.Call("fadeovertime", 0.25f); hudtext.Alpha = 0; hudshader.Call("scaleovertime", 1, 25, 25); hudshader.Call("moveovertime", 1); hudshader.X = -410 + MultiplyTimes; hudshader.Y = 160; }); player.AfterDelay(4700, e => { hudtext.Call("destroy"); }); return(hudshader); }
/// <summary> /// Функция создания HUD-элеметов для трэкинга дамага на экране /// </summary> /// <param name="self">Игрок</param> private void CreateDamageHud(Entity self) { self.SetField("hud_damagefeedback", new Parameter(HudElem.NewClientHudElem(self))); self.GetField <HudElem>("hud_damagefeedback").HorzAlign = "center"; self.GetField <HudElem>("hud_damagefeedback").VertAlign = "middle"; self.GetField <HudElem>("hud_damagefeedback").X = -12; self.GetField <HudElem>("hud_damagefeedback").Y = -12; self.GetField <HudElem>("hud_damagefeedback").Alpha = 0; self.GetField <HudElem>("hud_damagefeedback").SetShader("damage_feedback", 24, 48); }
public hpHud() { Call("precacheShader", "black"); base.PlayerConnected += delegate(Entity player) { HudElem bar = HudElem.NewClientHudElem(player); HudElem barBack = HudElem.NewClientHudElem(player); barBack.X = 395f; barBack.Y = -100f; bar.X = 395f; bar.Y = -102f; barBack.AlignX = "center"; barBack.AlignY = "bottom"; barBack.HorzAlign = "center"; barBack.VertAlign = "bottom"; barBack.Alpha = 0.5f; barBack.HideWhenInMenu = true; bar.AlignX = "center"; bar.AlignY = "bottom"; bar.HorzAlign = "center"; bar.VertAlign = "bottom"; bar.Alpha = 1; bar.Color = new Vector3(0f, 0f, 0f); bar.HideWhenInMenu = true; HudElem hp = HudElem.CreateFontString(player, "default", 1f); hp.HideWhenInMenu = true; hp.SetPoint("RIGHT", "RIGHT", -25, 111); OnInterval(10, delegate { if (player.Health >= 100) { bar.Color = new Vector3(0f, 5f, 0f); hp.SetText("^2" + player.Health); } else if (player.Health < 100 && player.Health > 50) { bar.Color = new Vector3(6f, 6f, 0f); hp.SetText("^3" + player.Health); } else { bar.Color = new Vector3(5f, 0f, 0f); hp.SetText("^1" + player.Health); } barBack.SetShader("black", 13, (int)((float)player.Health * 1.1f + 5f)); bar.SetShader("white", 7, (int)((float)player.Health * 1.1f)); if (player.Health == 0) { hp.SetText(""); } return(true); }); }; }
private void UsableHud(Entity player) { HudElem message = HudElem.CreateFontString(player, "big", 1.5f); message.SetPoint("CENTER", "CENTER", 1, 115); message.Alpha = 0.65f; HudElem perk = HudElem.NewClientHudElem(player); player.OnInterval(100, e => { try { bool flag = false; bool flag2 = false; foreach (var item in boxents) { if (player.Origin.DistanceTo(item.Origin) >= item.Range) { continue; } message.SetText(item.UsableText(player)); if (item.Type == BoxType.PerkColaMachine) { var type = ((PerkColaMachine)item).PerkCola; perk.SetShader(type.GetIcon(), 15, 15); perk.X = item.Origin.X; perk.Y = item.Origin.Y; perk.Z = item.Origin.Z + 50f; perk.Call("setwaypoint", 1, 1); perk.Alpha = 0.7f; flag2 = true; } flag = true; } if (!flag) { message.SetText(""); } if (!flag2) { perk.Alpha = 0f; } } catch (Exception) { message.SetText(""); perk.Alpha = 0; } return(player.IsPlayer); }); }
public static HudElem HeadIcon(Vector3 pos, Entity self, string shader, byte width = 15, byte height = 15) { HudElem _headicon = HudElem.NewClientHudElem(self); _headicon.X = pos.X; _headicon.Y = pos.Y; _headicon.Z = pos.Z + 35; _headicon.Alpha = 1; _headicon.SetShader(shader, width, height); _headicon.Call("SetWaypoint", true, true); return(_headicon); }
public static HudElem CreateTemplateOverlay(this Entity self, String shader = "") { HudElem overlay = HudElem.NewClientHudElem(self); overlay.X = 0; overlay.Y = 0; overlay.AlignX = "Left"; overlay.AlignY = "Top"; overlay.HorzAlign = "Fullscreen"; overlay.VertAlign = "Fullscreen"; overlay.SetShader(shader, 640, 480); overlay.Sort = -10; overlay.Alpha = 1; return(overlay); }
public HudElem Timer(Entity player, int duration) { HudElem timer = HudElem.NewClientHudElem(player); timer.X = -100; timer.Y = 0; timer.AlignX = "right"; timer.AlignY = "bottom"; timer.HorzAlign = "right_adjustable"; timer.VertAlign = "bottom_adjustable"; timer.FontScale = 2.5f; timer.Call("SetTimer", duration); timer.Alpha = 1; return(timer); }
public static HudElem CreateRandomPerkHud(this Entity player) { var hudshader = HudElem.NewClientHudElem(player); hudshader.AlignX = "center"; hudshader.VertAlign = "middle"; hudshader.AlignY = "middle"; hudshader.HorzAlign = "center"; hudshader.X = 0; hudshader.Y = 0; hudshader.Foreground = true; hudshader.Alpha = 1; return(hudshader); }
public void Overlay(Entity player) { HudElem overlay = HudElem.NewClientHudElem(player); overlay.X = 0; overlay.Y = 0; overlay.AlignX = "left"; overlay.AlignY = "top"; overlay.HorzAlign = "fullscreen"; overlay.VertAlign = "fullscreen"; overlay.SetShader("ac130_overlay_105mm", 640, 480); overlay.Sort = -10; overlay.Archived = true; player.SetField("overlay_uav_ac130_105mm", new Parameter(overlay)); }
public static void CreateXpEventPopup(this Entity self) { HudElem hud_xpEventPopup = HudElem.NewClientHudElem(self); hud_xpEventPopup.Children = new List <HudElem>(); hud_xpEventPopup.HorzAlign = "Right"; hud_xpEventPopup.VertAlign = "Bottom"; hud_xpEventPopup.AlignX = "Right"; hud_xpEventPopup.AlignY = "Bottom"; hud_xpEventPopup.X = -20; hud_xpEventPopup.Y = -15; hud_xpEventPopup.Font = "HudBig"; hud_xpEventPopup.FontScale = 0.55f; hud_xpEventPopup.Archived = false; hud_xpEventPopup.Color = new Vector3(0.5f, 0.5f, 0.5f); hud_xpEventPopup.Sort = 10000; self.SetField("hud_xpEventPopup", new Parameter(hud_xpEventPopup)); }
private void PerkHud(Entity player) { HudElem hud = HudElem.NewClientHudElem(player); hud.Alpha = 0f; OnInterval(100, () => { try { var flag = false; foreach (var ent in usables) { if (player.Origin.DistanceTo(ent.Origin) >= 50) { continue; } if (ent.GetField <string>("usabletype") == "perk") { var perk = ent.GetField <PerkCola>("perk"); hud.SetShader(perk.PerkIcon, 15, 15); hud.X = ent.Origin.X; hud.Y = ent.Origin.Y; hud.Z = ent.Origin.Z + 50f; hud.Call("setwaypoint", ent.Origin); hud.Alpha = 0.7f; } flag = true; } if (!flag) { hud.Alpha = 0f; } } catch (Exception) { hud.Alpha = 0f; } return(true); }); }
private void CreatePerkHUD(Entity player) { var icons = new HudElem[3]; new[] { -300, -250, -200 }.ToList().ForEach(y => { var i = (y + 300) / 50; var elem = HudElem.CreateIcon(player, "specialty_quickdraw_upgrade", 40, 40); elem.SetPoint("bottom right", "bottom right", -120, y); elem.Alpha = 0; elem.HideWhenInMenu = true; elem.Foreground = true; icons[i] = elem; }); player.SetField("shrp_perkIcons", new Parameter(icons)); var names = new HudElem[3]; new[] { -275, -225, -175 }.ToList().ForEach(y => { var i = (y + 275) / 50; var elem = HudElem.NewClientHudElem(player); elem.X = 40; elem.Y = y; elem.AlignX = "right"; elem.AlignY = "bottom"; elem.HorzAlign = "right"; elem.VertAlign = "bottom"; elem.FontScale = 1.5f; elem.SetText("Quickdraw"); elem.Alpha = 0; elem.HideWhenInMenu = true; elem.Foreground = true; names[i] = elem; }); player.SetField("shrp_perkNames", new Parameter(names)); }
public static HudElem PerkHudNoEffect(this Entity player, string shader) { int perksAmount = player.PerkColasCount() - 1; int MultiplyTimes = 28 * perksAmount; var hudshader = HudElem.NewClientHudElem(player); hudshader.AlignX = "center"; hudshader.VertAlign = "middle"; hudshader.AlignY = "middle"; hudshader.HorzAlign = "center"; hudshader.X = -410 + MultiplyTimes; hudshader.Y = 160; hudshader.Foreground = true; hudshader.SetShader(shader, 25, 25); hudshader.Alpha = 1; return(hudshader); }
public static HudElem PerkHudNoEffect(this Entity player, PerkCola perk, bool playsound = false) { int perksAmount = player.PerkColasCount() - 1; int MultiplyTimes = 28 * perksAmount; var hudshader = HudElem.NewClientHudElem(player); hudshader.AlignX = "center"; hudshader.VertAlign = "middle"; hudshader.AlignY = "middle"; hudshader.HorzAlign = "center"; hudshader.X = -300 + MultiplyTimes; hudshader.Y = 180; hudshader.Foreground = true; hudshader.SetShader(perk.Icon, 25, 25); hudshader.Call("fadeovertime", 0.5f); hudshader.Alpha = 1; hudshader.SetField("perk", new Parameter(perk.Type)); return(hudshader); }
public void ShotFiredDarkScreenOverlay(Entity player) { HudElem darkScreenOverlay = HudElem.NewClientHudElem(player); darkScreenOverlay.X = 0; darkScreenOverlay.Y = 0; darkScreenOverlay.AlignX = "left"; darkScreenOverlay.AlignY = "top"; darkScreenOverlay.HorzAlign = "fullscreen"; darkScreenOverlay.VertAlign = "fullscreen"; darkScreenOverlay.SetShader("black", 640, 480); darkScreenOverlay.Sort = -10; darkScreenOverlay.Alpha = 1; AfterDelay(1000, () => { darkScreenOverlay.Call("fadeOverTime", 1f); darkScreenOverlay.Alpha = 0; AfterDelay(500, () => darkScreenOverlay.Call("destroy")); }); }
public static void TextPopup(this Entity player, string text) { HudElem hud = player.GetTextPopupHud(); if (hud == null) { hud = HudElem.NewClientHudElem(player); } hud.Call("destroy"); hud = HudElem.CreateFontString(player, "hudbig", 0.8f); hud.SetPoint("BOTTOMCENTER", "BOTTOMCENTER", 0, -65); hud.SetText(text); hud.Alpha = 0.85f; hud.GlowColor = new Vector3(0.3f, 0.9f, 0.9f); hud.GlowAlpha = 0.55f; hud.Call("SetPulseFX", 100, 2100, 1000); hud.ChangeFontScaleOverTime(0.1f, 0.75f); player.AfterDelay(100, e => { hud.ChangeFontScaleOverTime(0.1f, 0.65f); }); }
public static void InitScorePopup(this Entity player) { ScorePopupHuds[player.EntRef] = HudElem.NewClientHudElem(player); }
private void UsableHud(Entity player) { HudElem message = HudElem.CreateFontString(player, "big", 1.5f); message.SetPoint("CENTER", "CENTER", 1, 115); message.Alpha = 0.65f; HudElem perk = HudElem.NewClientHudElem(player); player.SetField("currentusable_entref", 0); player.OnInterval(100, e => { try { List <IUsable> _closingusables = new List <IUsable>(); foreach (var item in usables) { if (player.Origin.DistanceTo(item.Origin) >= item.Range) { continue; } else { _closingusables.Add(item); } } if (_closingusables.Count > 0) { _closingusables.Sort(); var ent = _closingusables[0]; if (player.GetField <int>("currentusable_entref") != ent.EntRef || ent.GetType().BaseType == typeof(Turret)) { message.SetText(ent.GetUsableText(player)); if (ent.GetType() == typeof(PerkColaMachine)) { var ent2 = ent as PerkColaMachine; var type = ent2.PerkCola; perk.SetShader(type.Icon, 15, 15); perk.X = ent.Origin.X; perk.Y = ent.Origin.Y; perk.Z = ent.Origin.Z + 50f; perk.Call("setwaypoint", 1, 1); perk.Alpha = 0.7f; } else { perk.Alpha = 0; } player.SetField("currentusable_entref", ent.EntRef); } } else { player.SetField("currentusable_entref", 0); message.SetText(""); perk.Alpha = 0; } } catch (Exception) { } return(player.IsPlayer); }); }
public static void InitGambleTextHud(this Entity player) { GambleTextHuds[player.EntRef] = HudElem.NewClientHudElem(player); }
private void CreateHUD(Entity player) { if (player.HasField("bohud_created")) { return; } // background bars, left side var bars = new HudElem[2]; new[] { new { X = -20, Y = 15, i = 0 }, new { X = -20, Y = -4, i = 1 } }.ToList().ForEach(coord => { var bar = HudElem.NewClientHudElem(player); bar.X = coord.X; bar.Y = coord.Y; bar.AlignX = "left"; bar.AlignY = "bottom"; bar.HorzAlign = "left"; bar.VertAlign = "bottom"; bar.SetShader("white", 190, 15); bar.Alpha = 0.3f; bar.HideWhenInMenu = true; bar.Foreground = false; bars[coord.i] = bar; }); player.SetField("bohud_bars", new Parameter(bars)); // ranking background var circle = HudElem.CreateIcon(player, "cardicon_radiation", 60, 60); circle.SetPoint("bottom left", "bottom left", 15, -15); circle.HideWhenInMenu = true; circle.Foreground = true; circle.Alpha = 1; player.SetField("bohud_circle", new Parameter(circle)); // rank text/shadow var rankX = -26; player.SetField("bohud_rankX", rankX); var rankText = new HudElem[3]; new[] { new { X = rankX - 1, Sort = 3 }, new { X = rankX + 1, Sort = 4 }, new { X = rankX, Sort = 5 } }.ToList().ForEach(entry => { var text = HudElem.NewClientHudElem(player); text.X = entry.X; text.Y = 18; text.AlignX = "left"; text.AlignY = "bottom"; text.HorzAlign = "left"; text.VertAlign = "bottom"; text.FontScale = 5; text.Sort = entry.Sort; text.HideWhenInMenu = true; text.SetText((entry.Sort == 5) ? "1" : "^01"); rankText[entry.Sort - 3] = text; }); player.SetField("bohud_rankText", new Parameter(rankText)); // message texts var messageText = new HudElem[2]; new[] { new { X = 30, Y = 16, Text = "", i = 0 }, new { X = 30, Y = -3, Text = "0", i = 1 }, }.ToList().ForEach(entry => { var text = HudElem.NewClientHudElem(player); text.X = entry.X; text.Y = entry.Y; text.AlignX = "left"; text.AlignY = "bottom"; text.HorzAlign = "left"; text.VertAlign = "bottom"; text.FontScale = 1.5f; text.Alpha = 0.5f; text.HideWhenInMenu = true; text.Sort = 5; text.SetText(entry.Text); messageText[entry.i] = text; }); player.SetField("bohud_messageText", new Parameter(messageText)); // ammo stuff var ammoSlash = HudElem.CreateFontString(player, "default", 1.25f); ammoSlash.SetPoint("bottom right", "bottom right", -85, -35); ammoSlash.GlowAlpha = 0; ammoSlash.HideWhenInMenu = true; ammoSlash.Archived = false; ammoSlash.SetText("/"); player.SetField("bohud_ammoSlash", new Parameter(ammoSlash)); var ammoStock = HudElem.CreateFontString(player, "default", 1.25f); ammoStock.Parent = ammoSlash; ammoStock.SetPoint("bottom left", "bottom left", 3, 0); ammoStock.GlowAlpha = 0; ammoStock.HideWhenInMenu = true; ammoStock.Archived = false; ammoStock.SetText("48"); player.SetField("bohud_ammoStock", new Parameter(ammoStock)); var ammoClip = HudElem.CreateFontString(player, "default", 1.95f); ammoClip.Parent = ammoSlash; ammoClip.SetPoint("right", "right", -7, -4); ammoClip.GlowAlpha = 0; ammoClip.HideWhenInMenu = true; ammoClip.Archived = false; ammoClip.SetText("12"); player.SetField("bohud_ammoClip", new Parameter(ammoClip)); player.SetField("bohud_created", true); }
public static void InitTextPopup2(this Entity player) { TextPopup2Huds[player.EntRef] = HudElem.NewClientHudElem(player); }