Exemple #1
0
        public static void updateWeaponLevel(Entity player, string weapon, bool updateLevelNumber = false)
        {
            string  baseWeapon         = getBaseWeaponName(weapon);
            HudElem weaponLevelBar     = player.GetField <HudElem>("hud_weaponLevelBar");
            HudElem weaponLevelCounter = player.GetField <HudElem>("hud_weaponIcon").Children[0];

            if (!horde.weaponNames.ContainsKey(baseWeapon))
            {
                weaponLevelBar.ScaleOverTime(.3f, 0, 18);
                weaponLevelCounter.SetValue(0);
                return;
            }

            int   weaponLevelValue = horde.weaponLevelValues[player.EntRef][baseWeapon];
            float percent          = weaponLevelValue / (float)horde.maxWeaponLevelValue;

            if (percent < .05f)
            {
                percent = .05f;
            }
            weaponLevelBar.ScaleOverTime(.3f, (int)(percent * (int)weaponLevelBar.GetField("maxWidth")), 18);
            if (updateLevelNumber)
            {
                int weaponLevel = horde.weaponLevels[player.EntRef][baseWeapon];
                weaponLevelCounter.SetValue(weaponLevel);
            }
        }
Exemple #2
0
        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);
            }
        }
Exemple #3
0
        private static void updateThrusterBar(Entity player, int percentage)
        {
            HudElem thrusterBar = player.GetField <HudElem>("hud_thrusterBar");

            thrusterBar.FadeOverTime(1);
            thrusterBar.Alpha = 1;
            thrusterBar.Parent.FadeOverTime(.5f);
            thrusterBar.Parent.Alpha = .2f;
            thrusterBar.ScaleOverTime(.5f, percentage * 4, 3);
            AfterDelay(2000, () =>
            {
                int thrusterEnergy = player.GetField <int>("thrusterEnergy");
                if (thrusterEnergy >= 25)
                {
                    //HudElem thrusterBar = p.GetField<HudElem>("hud_thrusterBar");
                    if (thrusterBar.Alpha == 1)
                    {
                        thrusterBar.FadeOverTime(.5f);
                        thrusterBar.Alpha = 0;
                        thrusterBar.Parent.FadeOverTime(1);
                        thrusterBar.Parent.Alpha = 0;
                    }
                }
            });
        }
Exemple #4
0
    public void onHover()
    {
        if (hud == null)
        {
            return;
        }

        if (isHovered)
        {
            return;
        }

        hud.ScaleOverTime(.25f, Width + 12, Height + 12);
        hud.Color = new Vector3(1, 1, 0);
        hud.Children[0].ChangeFontScaleOverTime(.25f);
        hud.Children[0].FontScale += .2f;
        isHovered = true;
    }
Exemple #5
0
        public static void updateSupportDropMeter()
        {
            HudElem supportBar = horde.supportDropMeter.Children[0];

            float percent = horde.supportDropMeterValue / (float)horde.maxSupportDropValue;

            if (percent < .03f)
            {
                percent = .03f;
            }
            supportBar.ScaleOverTime(.3f, (int)(percent * 152), 8);
        }
Exemple #6
0
        public static void giveAllPerks(Entity player)
        {
            bool[] ownedPerks = AIZ.getOwnedPerks(player);
            if (!ownedPerks.Contains(false))
            {
                return;                             //Owns all perks, give up on life...
            }
            if (!ownedPerks[0])
            {
                player.MaxHealth = 250;
                player.Health    = player.MaxHealth;
                player.SetField("PerkBought", "cardicon_juggernaut_1");
                player.SetField("perk1bought", true);
                hud.updatePerksHud(player, false, true);
            }
            if (!ownedPerks[1])
            {
                player.SetPerk("specialty_lightweight", true, true);
                //player.SetPerk("specialty_marathon", true, true);
                player.SetPerk("specialty_longersprint", true, true);
                player.SetField("PerkBought", "specialty_longersprint_upgrade");
                player.SetField("perk2bought", true);
                hud.updatePerksHud(player, false, true);
            }
            if (!ownedPerks[2])
            {
                player.SetPerk("specialty_fastreload", true, true);
                //player.SetPerk("specialty_quickswap", true, true);
                player.SetPerk("specialty_quickdraw", true, true);
                player.SetField("PerkBought", "specialty_fastreload_upgrade");
                player.SetField("perk3bought", true);
                hud.updatePerksHud(player, false, true);
            }
            if (!ownedPerks[3])
            {
                player.SetField("NewGunReady", true);
                player.SetField("PerkBought", "specialty_twoprimaries_upgrade");
                player.SetField("perk4bought", true);
                hud.updatePerksHud(player, false, true);
            }
            if (!ownedPerks[4])
            {
                player.SetPerk("specialty_rof", true, true);
                player.SetField("PerkBought", "weapon_attachment_rof");
                player.SetField("perk5bought", true);
                hud.updatePerksHud(player, false, true);
            }
            if (!ownedPerks[5])
            {
                player.SetPerk("specialty_stalker", true, true);
                player.SetField("PerkBought", "specialty_stalker_upgrade");
                player.SetField("perk6bought", true);
                hud.updatePerksHud(player, false, true);
            }
            if (!ownedPerks[6])
            {
                player.SetField("autoRevive", true);
                player.SetField("PerkBought", "waypoint_revive");
                player.SetField("perk7bought", player.GetField <int>("perk7bought") + 1);
                hud.updatePerksHud(player, false, true);
            }

            HudElem perkIcon = NewClientHudElem(player);

            perkIcon.X         = 0;
            perkIcon.Y         = 0;
            perkIcon.AlignX    = HudElem.XAlignments.Center;
            perkIcon.AlignY    = HudElem.YAlignments.Middle;
            perkIcon.VertAlign = HudElem.VertAlignments.Middle;
            perkIcon.HorzAlign = HudElem.HorzAlignments.Center_Adjustable;
            perkIcon.SetShader("specialty_perks_all", 128, 128);
            perkIcon.Foreground     = true;
            perkIcon.HideWhenInMenu = true;
            perkIcon.Alpha          = 1;
            perkIcon.ScaleOverTime(1, 512, 512);
            perkIcon.FadeOverTime(1);
            perkIcon.Alpha = 0;

            player.PlayLocalSound("earn_superbonus");
            AfterDelay(1000, () =>
                       perkIcon.Destroy());
        }
Exemple #7
0
        public static IEnumerator giveRandomPerk(Entity player, int perk = -1)
        {
            bool[] ownedPerks = AIZ.getOwnedPerks(player);
            if (!ownedPerks.Contains(false))
            {
                yield break;                             //Owns all perks, give up on life...
            }
            if (perk == -1)
            {
                perk = AIZ.rng.Next(7);
                perk++;
            }

            if (ownedPerks[perk - 1])
            {
                //re-roll
                int randomPerk = AIZ.rng.Next(7);
                randomPerk++;
                StartAsync(giveRandomPerk(player, randomPerk));
                yield break;
            }

            hud.scoreMessage(player, AIZ.gameStrings[99]);

            switch (perk)
            {
            case 1:
                player.MaxHealth = 250;
                player.Health    = player.MaxHealth;
                player.SetField("PerkBought", "cardicon_juggernaut_1");
                break;

            case 2:
                player.SetPerk("specialty_lightweight", true, true);
                //player.SetPerk("specialty_marathon", true, true);
                player.SetPerk("specialty_longersprint", true, true);
                player.SetField("PerkBought", "specialty_longersprint_upgrade");
                break;

            case 3:
                player.SetPerk("specialty_fastreload", true, true);
                //player.SetPerk("specialty_quickswap", true, true);
                player.SetPerk("specialty_quickdraw", true, true);
                player.SetField("PerkBought", "specialty_fastreload_upgrade");
                break;

            case 4:
                player.SetField("NewGunReady", true);
                player.SetField("PerkBought", "specialty_twoprimaries_upgrade");
                break;

            case 5:
                player.SetPerk("specialty_rof", true, true);
                player.SetField("PerkBought", "weapon_attachment_rof");
                break;

            case 6:
                player.SetPerk("specialty_stalker", true, true);
                player.SetField("PerkBought", "specialty_stalker_upgrade");
                break;

            case 7:
                player.SetField("autoRevive", true);
                player.SetField("PerkBought", "waypoint_revive");
                break;

            case 8:
                player.SetPerk("specialty_scavenger", true, true);
                player.SetField("PerkBought", "specialty_scavenger_upgrade");
                break;
            }

            if (perk != 7)
            {
                player.SetField("perk" + perk + "bought", true);
            }
            else
            {
                player.SetField("perk7bought", player.GetField <int>("perk7bought") + 1);
            }

            HudElem perkIcon = NewClientHudElem(player);

            perkIcon.X         = 0 * (perk - 1);
            perkIcon.Y         = -54;
            perkIcon.AlignX    = HudElem.XAlignments.Left;
            perkIcon.AlignY    = HudElem.YAlignments.Bottom;
            perkIcon.VertAlign = HudElem.VertAlignments.Bottom_Adjustable;
            perkIcon.HorzAlign = HudElem.HorzAlignments.Left;
            perkIcon.SetShader(player.GetField <string>("perkBought"), 128, 128);
            perkIcon.Foreground     = true;
            perkIcon.HideWhenInMenu = true;
            perkIcon.Alpha          = 1;
            perkIcon.ScaleOverTime(1, 30, 30);

            player.PlayLocalSound("earn_perk");

            yield return(Wait(1));

            perkIcon.Destroy();
            hud.updatePerksHud(player, false, true);
        }
Exemple #8
0
    private static void buildEmoteMenu(Entity player)
    {
        if (player.GetField <bool>("emoteMenuOpen"))
        {
            return;
        }

        if (player.GetField <bool>("isEmoting"))
        {
            return;
        }

        if (!player.IsAlive)
        {
            return;
        }

        player.SetField("emoteMenuOpen", true);

        HudElem bg = NewClientHudElem(player);

        bg.AlignX          = HudElem.XAlignments.Center;
        bg.AlignY          = HudElem.YAlignments.Middle;
        bg.HorzAlign       = HudElem.HorzAlignments.Center;
        bg.VertAlign       = HudElem.VertAlignments.Middle;
        bg.Alpha           = 0;
        bg.Archived        = false;
        bg.Foreground      = true;
        bg.HideIn3rdPerson = false;
        bg.HideWhenDead    = true;
        bg.HideWhenInDemo  = false;
        bg.HideWhenInMenu  = false;
        bg.X     = 0;
        bg.Y     = 0;
        bg.Color = new Vector3(1, 1, 1);
        bg.SetShader("compassping_portable_radar_sweep", 0, 0);

        bg.ScaleOverTime(0.5f, 320, 320);
        bg.FadeOverTime(0.5f);
        bg.Alpha = 1;

        HudElem bgCross = NewClientHudElem(player);

        bgCross.Parent          = bg;
        bgCross.AlignX          = HudElem.XAlignments.Center;
        bgCross.AlignY          = HudElem.YAlignments.Middle;
        bgCross.HorzAlign       = HudElem.HorzAlignments.Center;
        bgCross.VertAlign       = HudElem.VertAlignments.Middle;
        bgCross.Alpha           = 0;
        bgCross.Archived        = false;
        bgCross.Foreground      = true;
        bgCross.HideIn3rdPerson = false;
        bgCross.HideWhenDead    = true;
        bgCross.HideWhenInDemo  = false;
        bgCross.HideWhenInMenu  = false;
        bgCross.X     = 0;
        bgCross.Y     = 120;
        bgCross.Color = new Vector3(0, .8f, .8f);
        bgCross.SetShader("damage_feedback", 0, 0);

        bgCross.ScaleOverTime(0.5f, 260, 460);
        bgCross.FadeOverTime(0.5f);
        bgCross.Alpha = .7f;

        HudElem selections1 = NewClientHudElem(player);

        selections1.Parent          = bg;
        selections1.AlignX          = HudElem.XAlignments.Center;
        selections1.AlignY          = HudElem.YAlignments.Top;
        selections1.HorzAlign       = HudElem.HorzAlignments.Center;
        selections1.VertAlign       = HudElem.VertAlignments.Middle;
        selections1.Alpha           = 0;
        selections1.Archived        = false;
        selections1.Foreground      = true;
        selections1.HideIn3rdPerson = false;
        selections1.HideWhenDead    = true;
        selections1.HideWhenInDemo  = false;
        selections1.HideWhenInMenu  = false;
        selections1.X    = 0;
        selections1.Y    = -120;
        selections1.Font = HudElem.Fonts.HudSmall;
        //selections1.FontScale = .8f;
        selections1.FontScale = .1f;
        selections1.SetText("   " + emoteList_names[0] + "\n\n\n\n         (^3[{+actionslot 4}]^7)\n\n\n\n\n\n         (^3[{+actionslot 7}]^7)\n\n\n\n" + emoteList_names[3]);

        selections1.FadeOverTime(0.5f);
        selections1.Alpha = 1;
        selections1.ChangeFontScaleOverTime(.5f);
        selections1.FontScale = 1f;

        HudElem selections2 = NewClientHudElem(player);

        selections2.Parent          = bg;
        selections2.AlignX          = HudElem.XAlignments.Center;
        selections2.AlignY          = HudElem.YAlignments.Middle;
        selections2.HorzAlign       = HudElem.HorzAlignments.Center;
        selections2.VertAlign       = HudElem.VertAlignments.Middle;
        selections2.Alpha           = 0;
        selections2.Archived        = false;
        selections2.Foreground      = true;
        selections2.HideIn3rdPerson = false;
        selections2.HideWhenDead    = true;
        selections2.HideWhenInDemo  = false;
        selections2.HideWhenInMenu  = false;
        selections2.X         = 0;
        selections2.Y         = 0;
        selections2.Font      = HudElem.Fonts.HudSmall;
        selections2.FontScale = .1f;
        selections2.SetText(emoteList_names[1] + "    (^3[{+actionslot 5}]^7)          (^3[{+actionslot 6}]^7)  " + emoteList_names[2]);

        selections2.FadeOverTime(0.5f);
        selections2.Alpha = 1;
        selections2.ChangeFontScaleOverTime(.5f);
        selections2.FontScale = 1f;

        player.SetField("emoteMenu", bg);
    }