コード例 #1
0
        private static void ServerWelcomeTittle(Entity player, string tittle, float[] rgb)
        {
            player.SetField("welcome", 0);
            player.SpawnedPlayer += new Action(() =>
            {
                if (player.GetField <int>("welcome") == 0)
                {
                    HudElem serverWelcome = HudElem.CreateFontString(player, HudElem.Fonts.HudBig, 1f);
                    serverWelcome.SetPoint("TOPCENTER", "TOPCENTER", 0, 165);
                    serverWelcome.SetText(tittle);
                    serverWelcome.GlowColor = (new Vector3(rgb[0], rgb[1], rgb[2]));
                    serverWelcome.GlowAlpha = 1f;
                    serverWelcome.SetPulseFX(150, 4700, 700);
                    player.SetField("welcome", 1);

                    AfterDelay(5000, () => { serverWelcome.Destroy(); });
                }
            });
        }
コード例 #2
0
        private void GivePerkHud(Entity player, string name, string perk, string color)
        {
            HudElem perkicon = HudElem.CreateIcon(player, perk, 90, 90);

            perkicon.Parent = HudElem.UIParent;
            perkicon.SetPoint("TOPCENTER", "TOPCENTER", 0, 60);
            perkicon.SetShader(perk, 90, 90);
            perkicon.Foreground     = true;
            perkicon.HideWhenInMenu = true;
            AfterDelay(1400, () => { perkicon.Destroy(); });

            HudElem perkname = HudElem.CreateFontString(player, HudElem.Fonts.HudBig, 1f);

            perkname.SetPoint("TOPCENTER", "TOPCENTER", 0, 165);
            perkname.SetText(name);
            perkname.GlowAlpha = 1f;
            perkname.SetPulseFX(100, 1000, 600);

            switch (color)
            {
            case "green":
                perkname.GlowColor = (new Vector3(0f, 1f, 0f));
                break;

            case "blue":
                perkname.GlowColor = (new Vector3(0f, 0f, 1f));
                break;

            case "red":
                perkname.GlowColor = (new Vector3(1f, 0f, 0f));
                break;

            default:
                perkname.GlowColor = (new Vector3(245f, 208f, 051f));
                break;
            }
        }
コード例 #3
0
        private static HudElem[] createEndGameScreen(bool win, string endText)
        {
            HudElem outcomeTitle = HudElem.CreateServerFontString(HudElem.Fonts.HudBig, 1.5f);

            outcomeTitle.SetPoint("CENTER", "", 0, -134);
            outcomeTitle.Foreground     = true;
            outcomeTitle.GlowAlpha      = 1;
            outcomeTitle.HideWhenInMenu = false;
            outcomeTitle.Archived       = false;

            HudElem outcomeText = HudElem.CreateServerFontString(HudElem.Fonts.HudBig, 1);

            outcomeText.Parent     = outcomeTitle;
            outcomeText.Foreground = true;
            outcomeText.SetPoint("TOP", "BOTTOM", 0, 18);
            outcomeText.GlowAlpha      = 1;
            outcomeText.HideWhenInMenu = false;
            outcomeText.Archived       = false;

            outcomeTitle.GlowColor = new Vector3(0, 0, 0);
            if (win)
            {
                outcomeTitle.SetText("Victory!");
                outcomeTitle.Color = new Vector3(.3f, .7f, .2f);
            }
            else
            {
                outcomeTitle.SetText("Defeat!");
                outcomeTitle.Color = new Vector3(.7f, .3f, .2f);
            }
            outcomeText.GlowColor = new Vector3(.2f, .3f, .7f);
            outcomeText.SetText(endText);
            outcomeTitle.SetPulseFX(100, 60000, 1000);
            outcomeText.SetPulseFX(100, 60000, 1000);

            HudElem leftIcon    = NewHudElem();
            string  alliesTeam  = GetMapCustom("allieschar");
            string  icon_allies = TableLookup("mp/factionTable.csv", 0, alliesTeam, 1);

            leftIcon.SetShader(icon_allies, 70, 70);
            leftIcon.Parent = outcomeText;
            leftIcon.SetPoint("TOP", "BOTTOM", -60, 45);
            //leftIcon.SetShader("cardicon_soap", 70, 70);
            leftIcon.Foreground     = true;
            leftIcon.HideWhenInMenu = false;
            leftIcon.Archived       = false;
            leftIcon.Alpha          = 0;
            leftIcon.FadeOverTime(.5f);
            leftIcon.Alpha = 1;

            HudElem rightIcon = NewHudElem();
            string  axisTeam  = GetMapCustom("axischar");
            string  icon_axis = TableLookup("mp/factionTable.csv", 0, axisTeam, 1);

            rightIcon.SetShader(icon_axis, 70, 70);
            rightIcon.Parent = outcomeText;
            rightIcon.SetPoint("TOP", "BOTTOM", 60, 45);
            //rightIcon.SetShader("cardicon_nuke", 70, 70);
            rightIcon.Foreground     = true;
            rightIcon.HideWhenInMenu = false;
            rightIcon.Archived       = false;
            rightIcon.Alpha          = 0;
            rightIcon.FadeOverTime(.5f);
            rightIcon.Alpha = 1;

            HudElem leftScore = HudElem.CreateServerFontString(HudElem.Fonts.HudBig, 1.25f);

            leftScore.Parent = leftIcon;
            leftScore.SetPoint("TOP", "BOTTOM", 0, 0);
            if (win)
            {
                leftScore.GlowColor = new Vector3(.2f, .8f, .2f);
                leftScore.SetText("Win");
            }
            else
            {
                leftScore.GlowColor = new Vector3(.8f, .2f, .2f);
                leftScore.SetText("Lose");
            }
            leftScore.GlowAlpha      = 1;
            leftScore.Foreground     = true;
            leftScore.HideWhenInMenu = false;
            leftScore.Archived       = false;
            leftScore.SetPulseFX(100, 60000, 1000);

            HudElem rightScore = HudElem.CreateServerFontString(HudElem.Fonts.HudBig, 1.25f);

            rightScore.Parent = rightIcon;
            rightScore.SetPoint("TOP", "BOTTOM", 0);
            rightScore.GlowAlpha = 1;
            if (!win)
            {
                rightScore.GlowColor = new Vector3(.2f, .8f, .2f);
                rightScore.SetText("Win");
            }
            else
            {
                rightScore.GlowColor = new Vector3(.8f, .2f, .2f);
                rightScore.SetText("Lose");
            }
            rightScore.Foreground     = true;
            rightScore.HideWhenInMenu = false;
            rightScore.Archived       = false;
            rightScore.SetPulseFX(100, 60000, 1000);

            return(new HudElem[] { outcomeTitle, outcomeText, rightScore, leftScore, rightIcon, leftIcon });
        }