private void Init()
        {
            plugin            = this;
            ConVar.Decay.tick = float.MaxValue;

            cmd.AddChatCommand("join", this, cmdJoin);
            cmd.AddChatCommand("joingui", this, cmdJoinGUI);
            cmd.AddChatCommand("leave", this, cmdLeave);
            cmd.AddChatCommand("lobby", this, cmdLeave);
            cmd.AddChatCommand("ready", this, cmdReady);
            cmd.AddChatCommand("r", this, cmdReady);

            //colors must be rgba, float
            teamColors.Add("1 0 0 1");
            teamColors.Add("0 0 1 1");
            teamColors.Add("0 1 0 1");
            teamColors.Add("1 0 1 1");
            teamColors.Add("0 1 1 1");
            UIObject ui = new UIObject();

            //make sure there aren't leftover msgs
            foreach (var player in BasePlayer.activePlayerList)
            {
                ui.Destroy(player, "DeathNotice");
                ui.Destroy(player, "DeathNotice_DropShadow");
            }
        }
        void UICoreMessage(BasePlayer player, string message, float timeout = SimpleUI_HideTimer)
        {
            float fadeIn = 0.1f;

            UIObject ui = new UIObject();

            //make sure there aren't leftover msgs
            //ui.Destroy(player, "DeathNotice");
            //ui.Destroy(player, "DeathNotice_DropShadow");

            ui.AddText("DeathNotice_DropShadow",
                       SimpleUI_Left + 0.001, SimpleUI_Top + 0.001,
                       SimpleUI_MaxWidth, SimpleUI_MaxHeight,
                       shadowColor,
                       StripTags(message),
                       SimpleUI_FontSize,
                       "Hud", 3, fadeIn, fadeIn);

            ui.AddText("DeathNotice", SimpleUI_Left, SimpleUI_Top, SimpleUI_MaxWidth, SimpleUI_MaxHeight, noticeColor, message, SimpleUI_FontSize, "Hud", 3, fadeIn, fadeIn);

            ui.Draw(player);
            timer.Once(timeout, () => {
                ui.Destroy(player);
            });
        }
示例#3
0
        void DestroyCrosshair(BasePlayer player)
        {
            UIObject ui = new UIObject();

            ui.AddText("Crosshair", 0, 0, 0, 0, new UIColor(0, 0, 0, 0), "", 0, "Hud.Under", 4);

            ui.Destroy(player);
        }
示例#4
0
        void UIMessage(BasePlayer player, string message)
        {
            bool  replaced = false;
            float fadeIn   = 0.2f;

            Timer playerTimer;

            timers.TryGetValue(player, out playerTimer);

            if (playerTimer != null && !playerTimer.Destroyed)
            {
                playerTimer.Destroy();
                fadeIn = 0.1f;

                replaced = true;
            }

            UIObject ui = new UIObject();

            ui.AddText("DeathNotice_DropShadow", SimpleUI_Left + 0.001, SimpleUI_Top + 0.001, SimpleUI_MaxWidth, SimpleUI_MaxHeight, deathNoticeShadowColor, StripTags(message), SimpleUI_FontSize, "Hud.Under", 3, fadeIn, 0.2f);
            ui.AddText("DeathNotice", SimpleUI_Left, SimpleUI_Top, SimpleUI_MaxWidth, SimpleUI_MaxHeight, deathNoticeColor, message, SimpleUI_FontSize, "Hud.Under", 3, fadeIn, 0.2f);

            ui.Destroy(player);

            if (replaced)
            {
                timer.Once(0.1f, () =>
                {
                    ui.Draw(player);

                    timers[player] = timer.Once(SimpleUI_HideTimer, () => ui.Destroy(player));
                });
            }
            else
            {
                ui.Draw(player);

                timers[player] = timer.Once(SimpleUI_HideTimer, () => ui.Destroy(player));
            }
        }