Exemplo n.º 1
0
        public void setChatHudLength(int length)
        {
            int textheight = iGlobal["ChatHud.Profile.fontSize"] + iGlobal["ChatHud.lineSpacing"];

            if (textheight <= 0)
            {
                textheight = 12;
            }

            int lengthInPixels = iGlobal["$outerChatLenY[" + length + "]"] * textheight;

            GuiBitmapBorderCtrl OuterChatHud  = "OuterChatHud";
            GuiScrollCtrl       ChatScrollHud = "ChatScrollHud";
            int chatMargin = OuterChatHud.extent.y - ChatScrollHud.extent.y + 2 * ChatScrollHud.profile.borderThickness;

            OuterChatHud.setExtent(new Point2F(OuterChatHud.extent.x, (lengthInPixels + chatMargin)));
            ChatScrollHud.scrollToBottom();
            ((GuiControl)"ChatPageDown").setVisible(false);
        }
Exemplo n.º 2
0
            public void eval()
            {
                string text = this.getValue().Trim();

                if (text == "")
                {
                    return;
                }
                // If it's missing a trailing () and it's not a variable,
                // append the parentheses.

                if (Util.strpos(text, "(", 0) == -1 && !Util.isDefined(text))
                {
                    if (Util.strpos(text, "=", 0) == -1 && Util.strpos(text, " ", 0) == -1)
                    {
                        if (Util.strpos(text, "{", 0) == -1 && Util.strpos(text, "}", 0) == -1)
                        {
                            text = text + "()";
                        }
                    }
                }
                // Append a semicolon if need be.
                int pos = text.Length - 1;

                if (Util.strpos(text, ";", pos) == -1 && Util.strpos(text, "}", 0) == -1)
                {
                    text += ";";
                }

                // Turn off warnings for assigning from void
                // and evaluate the snippet.

                bool oldWarnVoidAssignment;

                if (Util.isDefined("$Con::warnVoidAssignment"))
                {
                    oldWarnVoidAssignment = true;
                }
                else
                {
                    oldWarnVoidAssignment = bGlobal["$Con::warnVoidAssignment"];
                }

                bGlobal["$Con::warnVoidAssignment"] = false;

                Util._echo("==>" + text);
                string result = "";

                if (text.StartsWith("function") || text.StartsWith("datablock") || text.StartsWith("foreach(") || text.StartsWith("foreach$(") || text.StartsWith("if(") || text.StartsWith("while(") || text.StartsWith("for(") || text.StartsWith("switch(") || text.StartsWith("switch$("))
                {
                    result = Util.eval("%result = " + text + "return %result;");
                }
                else
                {
                    Util.eval(text);
                }
                bGlobal["$Con::warnVoidAssignment"] = oldWarnVoidAssignment;

                this.setValue("");

                // Echo result.
                if (result != "")
                {
                    Util._echo(result);
                }

                GuiScrollCtrl ConsoleEntryScroll = "ConsoleEntryScroll";

                ConsoleEntryScroll.scrollToBottom();
            }