Exemple #1
0
        public static HudElem createTimer(int time, string label)
        {
            HudElem timerBG = NewHudElem();

            //roundBG.SetPoint("BOTTOM LEFT", "BOTTOM LEFT", 10, -5);
            timerBG.AlignX           = HudElem.XAlignments.Center;
            timerBG.AlignY           = HudElem.YAlignments.Middle;
            timerBG.Alpha            = 0;
            timerBG.Archived         = false;
            timerBG.Foreground       = false;
            timerBG.HideIn3rdPerson  = false;
            timerBG.HideWhenDead     = false;
            timerBG.HideWhenInDemo   = false;
            timerBG.HideWhenInMenu   = false;
            timerBG.Color            = Vector3.Zero;
            timerBG.LowResBackground = false;
            timerBG.HorzAlign        = HudElem.HorzAlignments.Center_Adjustable;
            timerBG.VertAlign        = HudElem.VertAlignments.Middle;
            timerBG.X = -165;
            timerBG.Y = 75;
            timerBG.SetShader("clanlvl_box", 128, 48);
            timerBG.FadeOverTime(.5f);
            timerBG.Alpha = .5f;

            HudElem timer = NewHudElem();

            //timer.SetPoint("CENTER", "CENTER", -150, 50);
            timer.Parent          = timerBG;
            timer.Alpha           = 0;
            timer.Archived        = false;
            timer.Font            = HudElem.Fonts.Objective;
            timer.FontScale       = 2f;
            timer.Foreground      = true;
            timer.HideIn3rdPerson = false;
            timer.HideWhenDead    = false;
            timer.HideWhenInDemo  = false;
            timer.HideWhenInMenu  = false;
            timer.X = 0;
            timer.Y = 0;
            timer.SetPoint("left", "left", 20);
            timer.SetTenthsTimer(time);
            timer.FadeOverTime(.5f);
            timer.Alpha = 1f;

            if (label != "" || !string.IsNullOrEmpty(label))
            {
                HudElem timerText = HudElem.CreateServerFontString(HudElem.Fonts.Default, 1);
                timerText.Parent = timer;
                timerText.Alpha  = 0;
                timerText.SetPoint("left", "left", 45, 12);
                timerText.Archived        = false;
                timerText.Foreground      = true;
                timerText.HideIn3rdPerson = false;
                timerText.HideWhenDead    = false;
                timerText.HideWhenInDemo  = false;
                timerText.HideWhenInMenu  = false;
                timerText.Color           = new Vector3(1, 1, 0.2f);
                timerText.SetText(label + createHudShaderString("hud_killstreak_dpad_arrow_down", false, 38, 48));
                timerText.FadeOverTime(.5f);
                timerText.Alpha = 1;
            }

            return(timer);
        }