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 static void MBOKCancelDetailsToggleInfoFrame()
        {
            GuiScrollCtrl MBOKCancelDetailsScroll = "MBOKCancelDetailsScroll";

            if (!MBOKCancelDetailsScroll.isVisible())
            {
                MBOKCancelDetailsScroll.setVisible(true);
                GuiMLTextCtrl MBOKCancelDetailsText = "MBOKCancelDetailsText";
                Point2I       textExtent            = MBOKCancelDetailsText.getExtent();
                int           textExtentY           = textExtent.y;
                Point2I       textPos  = MBOKCancelDetailsText.getPosition();
                int           textPosY = textPos.y;

                int verticalStretch = textExtentY;

                if (verticalStretch > 260 || verticalStretch < 0)
                {
                    verticalStretch = 260;
                }

                Point2I extent = new Point2I(((GuiWindowCtrl)"MBOKCancelDetailsFrame")["defaultExtent"]);
                int     height = extent.y;

                int posY = textPosY + textExtentY + 10;

                int posX = MBOKCancelDetailsScroll.getPosition().x;

                MBOKCancelDetailsScroll.setPosition(posX, posY);
                MBOKCancelDetailsScroll.setExtent(new Point2F(MBOKCancelDetailsScroll.extent.x, verticalStretch));
                ((GuiWindowCtrl)"MBOKCancelDetailsFrame").setExtent(new Point2F(300, (height + verticalStretch + 10)));
            }
            else
            {
                Point2I extent = new Point2I(((GuiWindowCtrl)"MBOKCancelDetailsFrame")["defaultExtent"]);
                int     width  = extent.x;
                int     height = extent.y;
                ((GuiWindowCtrl)"MBOKCancelDetailsFrame").setExtent(new Point2F(width, height));
                MBOKCancelDetailsScroll.setVisible(false);
            }
        }
Exemplo n.º 3
0
        public static void Init()
        {
            ConsoleDlg = new ConsoleDlg();

            GuiConsoleEditCtrl ConsoleEntry = new ConsoleEntry();

            ConsoleEntry.registerObject();
            ConsoleDlg.add(ConsoleEntry);

            GuiScrollCtrl scrollCtrl = new GuiScrollCtrl
            {
                InternalName = "Scroll",
                Profile      = Sim.FindObjectByName <GuiControlProfile>("ConsoleScrollProfile"),
                HorizSizing  = GuiHorizontalSizing.Width,
                VertSizing   = GuiVerticalSizing.Height,
                Position     = Point2I.Zero,
                Extent       = new Point2I(640, 462),
                MinExtent    = new Point2I(8, 8),
                Visible      = true,
                //TODO HelpTag = "0",
                WillFirstRespond    = true,
                HScrollBar          = GuiScrollBarBehavior.AlwaysOn,
                VScrollBar          = GuiScrollBarBehavior.AlwaysOn,
                LockHorizScroll     = false,
                LockVertScroll      = false,
                ConstantThumbHeight = false,
                ChildMargin         = new Point2I(0, 0)
            };
            GuiConsole ConsoleMessageLogView = new GuiConsole("ConsoleMessageLogView")
            {
                Profile  = Sim.FindObjectByName <GuiControlProfile>("GuiConsoleProfile"),
                Position = Point2I.Zero
            };

            ConsoleMessageLogView.registerObject();
            scrollCtrl.add(ConsoleMessageLogView);
            scrollCtrl.registerObject();
            ConsoleDlg.add(scrollCtrl);
            ConsoleDlg.registerObject();
        }
Exemplo n.º 4
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();
            }