private void Credits(Entity ent) { HudElem credits = HudElem.CreateFontString(ent, "hudbig", 1.0f); credits.SetPoint("CENTER", "BOTTOM", 0, -70); credits.Call("settext", "CHINA Magic Infect Extreme Edition"); credits.Alpha = 0f; credits.SetField("glowcolor", new Vector3(1f, 0.5f, 1f)); credits.GlowAlpha = 1f; HudElem credits2 = HudElem.CreateFontString(ent, "hudbig", 0.6f); credits2.SetPoint("CENTER", "BOTTOM", 0, -90); credits2.Call("settext", "Vesion 1.1.7 Code in: github.com/A2ON"); credits2.Alpha = 0f; credits2.SetField("glowcolor", new Vector3(1f, 0.5f, 1f)); credits2.GlowAlpha = 1f; ent.OnNotify("tab", entity => { credits.Alpha = 1f; credits2.Alpha = 1f; }); ent.OnNotify("-tab", entity => { credits.Alpha = 0f; credits2.Alpha = 0f; }); }
public static void Credits(this Entity player) { HudElem credits = HudElem.CreateFontString(player, "hudbig", 1.0f); credits.SetPoint("CENTER", "BOTTOM", 0, -70); credits.Call("settext", "Project Cirno (INF3) for FFA"); credits.Alpha = 0f; credits.SetField("glowcolor", new Vector3(1f, 0.5f, 1f)); credits.GlowAlpha = 1f; HudElem credits2 = HudElem.CreateFontString(player, "hudbig", 0.6f); credits2.SetPoint("CENTER", "BOTTOM", 0, -90); credits2.Call("settext", "Vesion 1.0. Code in: https://github.com/A2ON"); credits2.Alpha = 0f; credits2.SetField("glowcolor", new Vector3(1f, 0.5f, 1f)); credits2.GlowAlpha = 1f; player.Call("notifyonplayercommand", "tab", "+scores"); player.OnNotify("tab", entity => { credits.Alpha = 1f; credits2.Alpha = 1f; }); player.Call("notifyonplayercommand", "-tab", "-scores"); player.OnNotify("-tab", entity => { credits.Alpha = 0f; credits2.Alpha = 0f; }); }
public static void CreateFlyingScore(Entity e, int score) { HudElem h = HudElem.CreateFontString(e, "hudsmall", 1.0f); h.Call("setvalue", score); h.SetField("x", 640 / 2); h.SetField("y", 480 / 2); h.Call("moveovertime", 1f); h.SetField("x", 640); h.SetField("y", 0); e.AfterDelay(1000, ent => { h.Call("destroy"); UpdateHudMoney(e); }); }
public static void givePerk(Entity player, string perk) { if (player.HasPerk(perk) || player.HasField(perk)) { return; } if (perk == "_specialty_blastshield" || perk == "specialty_triggerhappy" || perk == "specialty_regenspeed") { player.SetField(perk, true); } else { player.SetPerk(perk, true, true); } List <string> perksList = player.GetField <List <string> >("perksList"); perksList.Add(perk); player.SetField("perksList", new Parameter(perksList)); player.PlayLocalSound("earn_perk"); HudElem perks = player.GetField <HudElem>("hud_perks"); string text = (string)perks.GetField("text"); text += createHudShaderString(horde.perkIcons[perk], false, 64, 64); perks.SetText(text); perks.SetField("text", text); }
public static void updateBar(HudElem barBG, int barFrac, float rateOfChange) { HudElem bar = (HudElem)barBG.GetField("bar"); bar.SetField("frac", barFrac); if (rateOfChange > 0) { bar.ScaleOverTime(rateOfChange, barFrac, bar.Height); } else if (rateOfChange < 0) { bar.ScaleOverTime(-1 * rateOfChange, barFrac, bar.Height); } }
public static HudElem createPrimaryProgressBar(Entity player, int xOffset, int yOffset) { HudElem progressBar = HudElem.CreateIcon(player, "progress_bar_fill", 0, 9);//NewClientHudElem(player); progressBar.SetField("frac", 0); progressBar.Color = new Vector3(1, 1, 1); progressBar.Sort = -2; progressBar.Shader = "progress_bar_fill"; progressBar.SetShader("progress_bar_fill", 1, 9); progressBar.Alpha = 1; progressBar.SetPoint("center", "", 0, -61); progressBar.AlignX = HudElem.XAlignments.Left; progressBar.X = -60; HudElem progressBarBG = HudElem.CreateIcon(player, "progress_bar_bg", 124, 13);//NewClientHudElem(player); progressBarBG.SetPoint("center", "", 0, -61); progressBarBG.SetField("bar", progressBar); progressBarBG.Sort = -3; progressBarBG.Color = new Vector3(0, 0, 0); progressBarBG.Alpha = .5f; return(progressBarBG); }
public static void takeLastPerk(Entity player) { string perk = player.GetField <List <string> >("perksList").Last(); if (player.HasField(perk)) { player.ClearField(perk); } else { player.UnSetPerk(perk, true); } HudElem perks = player.GetField <HudElem>("hud_perks"); string text = (string)perks.GetField("text"); string[] perkTokens = text.Split('^'); string lastPerk = perkTokens.Last(); int perkIndex = Array.IndexOf(perkTokens, lastPerk); text.Remove(perkIndex, text.Length - perkIndex); perks.SetText(text); perks.SetField("text", text); }