Inheritance: GUIElement
示例#1
0
        public void ShowChatWindow()
        {
            // remove tool box if already there
            Remove((int)GUIElementIDS.CHAT_WINDOW);

            GUIWindow wnd = Reference.GUIEnvironment.AddWindowW(
                new Rect(new Position2D(Reference.Viewer.Width / 2 - 150, Reference.Viewer.Height / 2 - 110), new Dimension2D(300, 220)),
                false, "   " + DialogText.Chat, parentElement, (int)GUIElementIDS.CHAT_WINDOW);

            wnd.CloseButton.UseAlphaChannel = true;
            wnd.CloseButton.SetImage(closeButton);
            wnd.ToolTipText = string.Empty;
            wnd.ToolTipTextW = string.Empty;

            GUIListBox chatBoxMessageList_private = Reference.GUIEnvironment.AddListBox(new Rect(new Position2D(4, 24), new Dimension2D(290, 140)), wnd, (int)GUIElementIDS.CHAT_MSGLIST, true);

            Texture buttonTex = Reference.VideoDriver.GetTexture(Util.ApplicationDataDirectory + @"/media/gui/windows/button_chatenter.png");
            chatBoxInput = Reference.GUIEnvironment.AddEditBoxW("", new Rect(new Position2D(4, 172), new Dimension2D(276, 44)), true, wnd, (int)GUIElementIDS.CHAT_ENTERMSG);
            GUIButton btn = Reference.GUIEnvironment.AddButtonW(new Rect(new Position2D(284, 172), new Dimension2D(buttonTex.OriginalSize.Width, buttonTex.OriginalSize.Height)), wnd, (int)GUIElementIDS.CHAT_SENDBUTTON, "");
            btn.SetImage(buttonTex);
            //Reference.GUIEnvironment.AddImage(Reference.VideoDriver.GetTexture(Util.ApplicationDataDirectory + @"/media/gui/windows/button_chatenter.png"), new Position2D(0, 0), true, btn, -1, "");

            Reference.GUIEnvironment.AddImage(Reference.VideoDriver.GetTexture(Util.ApplicationDataDirectory + @"/media/gui/windows/window_chat.png"), new Position2D(5, 2), true, wnd, -1, "");

            // Get all chat history.
            for (int i = 0; i < Reference.Viewer.ChatManager.Messages.Length; i++)
            {
                chatBoxMessageList_private.AddItemW(Reference.Viewer.ChatManager.Messages[i]);
            }

            // Set last message.
            chatBoxMessageList_private.Selected = chatBoxMessageList_private.ItemCount - 1;
            chatBoxMessageList = chatBoxMessageList_private;
            // Set focus.
            Reference.GUIEnvironment.SetFocus(chatBoxInput);

            imageChat.Visible = false;
        }
示例#2
0
        public void ShowTeleportWindow()
        {
            // remove tool box if already there
            Remove((int)GUIElementIDS.TELEPORT_WINDOW);

            GUIWindow wnd = Reference.GUIEnvironment.AddWindowW(
                new Rect(new Position2D(Reference.Viewer.Width / 2 - 150, Reference.Viewer.Height / 2 - 64), new Dimension2D(300, 128)),
                false, "   " + DialogText.Teleport, parentElement, (int)GUIElementIDS.TELEPORT_WINDOW);

            wnd.CloseButton.UseAlphaChannel = true;
            wnd.CloseButton.SetImage(closeButton);

            // teleport region
            Reference.GUIEnvironment.AddStaticTextW(DialogText.RegionName, new Rect(new Position2D(4, 24), new Dimension2D(96, 24)), false, false, wnd, -1, false);
            teleportRegionName = Reference.GUIEnvironment.AddEditBoxW(Reference.Viewer.ProtocolManager.GetCurrentSimName(), new Rect(new Position2D(100, 24), new Dimension2D(196, 24)), true, wnd, (int)GUIElementIDS.TELEPORT_REGIONNAME);

            int ox = 4;
            // teleport position
            Reference.GUIEnvironment.AddStaticTextW("X", new Rect(new Position2D(ox, 52), new Dimension2D(12, 24)), false, false, wnd, -1, false);
            Reference.GUIEnvironment.AddStaticTextW("Y", new Rect(new Position2D(96 + ox, 52), new Dimension2D(12, 24)), false, false, wnd, -1, false);
            Reference.GUIEnvironment.AddStaticTextW("Z", new Rect(new Position2D(196 + ox, 52), new Dimension2D(12, 24)), false, false, wnd, -1, false);

            teleportX = Reference.GUIEnvironment.AddEditBoxW("128", new Rect(new Position2D(12 + ox, 52), new Dimension2D(80, 24)), true, wnd, (int)GUIElementIDS.TELEPORT_X);
            teleportY = Reference.GUIEnvironment.AddEditBoxW("128", new Rect(new Position2D(112 + ox, 52), new Dimension2D(80, 24)), true, wnd, (int)GUIElementIDS.TELEPORT_Y);
            teleportZ = Reference.GUIEnvironment.AddEditBoxW("128", new Rect(new Position2D(212 + ox, 52), new Dimension2D(80, 24)), true, wnd, (int)GUIElementIDS.TELEPORT_Z);

            // teleport button
            Reference.GUIEnvironment.AddButtonW(new Rect(new Position2D(4, 96), new Dimension2D(300 - 8, BUTTON_DEFULT_HEIGHT)), wnd, (int)GUIElementIDS.TELEPORT_TELEPORTBUTTON, DialogText.Teleport);

            Reference.GUIEnvironment.AddImage(Reference.VideoDriver.GetTexture(Util.ApplicationDataDirectory + @"/media/gui/windows/window_teleport.png"), new Position2D(5, 2), true, wnd, -1, "");

            // Set focus.
            Reference.GUIEnvironment.SetFocus(teleportRegionName);
        }
示例#3
0
        private void ShowLoginWindowManual()
        {
            GUIWindow wnd = Reference.GUIEnvironment.AddWindowW(
                new Rect(new Position2D(Reference.Viewer.Width / 2 - 150, Reference.Viewer.Height / 2 - 88), new Dimension2D(300, 166)),
                false, "   " + DialogText.Login, parentElement, (int)GUIElementIDS.LOGIN_WINDOW);

            wnd.CloseButton.Visible = false;

            int x = 4;
            int y = 28;
            int w = 128;
            int h = 24;
            int oy = 24;
            //Reference.GUIEnvironment.AddStaticTextW(DialogText.ServerURI, new Rect(new Position2D(4, 8), new Position2D(200, 24)), false, false, wnd, (int)GUIElementIDS.LOGIN_SERVERURI_TEXT, false);
            Reference.GUIEnvironment.AddStaticTextW(DialogText.Firstname, new Rect(new Position2D(x, y * 1 + oy), new Dimension2D(w, h)), false, false, wnd, (int)GUIElementIDS.LOGIN_FIRSTNAME_TEXT, false);
            Reference.GUIEnvironment.AddStaticTextW(DialogText.Lastname, new Rect(new Position2D(x, y * 2 + oy), new Dimension2D(w, h)), false, false, wnd, (int)GUIElementIDS.LOGIN_LASTNAME_TEXT, false);
            Reference.GUIEnvironment.AddStaticTextW(DialogText.Password, new Rect(new Position2D(x, y * 3 + oy), new Dimension2D(w, h)), false, false, wnd, (int)GUIElementIDS.LOGIN_PASSWORD_TEXT, false);

            loginServerURI = Reference.GUIEnvironment.AddEditBox(DialogText.ServerURI, new Rect(new Position2D(x, y * 0 + oy), new Dimension2D(292, h)), true, wnd, (int)GUIElementIDS.LOGIN_SERVERURI);

            x = 136;
            w = 160;
            loginFirstName = Reference.GUIEnvironment.AddEditBox("", new Rect(new Position2D(x, y * 1 + oy), new Dimension2D(w, h)), true, wnd, (int)GUIElementIDS.LOGIN_FIRSTNAME);
            loginLastName = Reference.GUIEnvironment.AddEditBox("", new Rect(new Position2D(x, y * 2 + oy), new Dimension2D(w, h)), true, wnd, (int)GUIElementIDS.LOGIN_LASTNAME);
            loginPassword = Reference.GUIEnvironment.AddEditBox("", new Rect(new Position2D(x, y * 3 + oy), new Dimension2D(w, h)), true, wnd, (int)GUIElementIDS.LOGIN_PASSWORD);
            loginPassword.Password = true;

            Reference.GUIEnvironment.AddButtonW(new Rect(new Position2D(50, y * 4 + oy), new Dimension2D(200, h)), wnd, (int)GUIElementIDS.LOGIN_LOGINBUTTON, DialogText.Login);

            Reference.GUIEnvironment.AddImage(Reference.VideoDriver.GetTexture(Util.ApplicationDataDirectory + @"/media/gui/windows/window_login.png"), new Position2D(5, 2), true, wnd, -1, "");

            /* Initialize parameters */
            loginServerURI.Text = loginInfo.URI;
            loginFirstName.Text = loginInfo.FirstName;
            loginLastName.Text = loginInfo.LastName;
            loginPassword.Text = loginInfo.Password;

            // Set focus.
            Reference.GUIEnvironment.SetFocus(loginServerURI);
        }
示例#4
0
        public void ShowSettingWindow()
        {
            //----------------------------------------------------------------------
            // Remove window
            //----------------------------------------------------------------------
            Remove((int)GUIElementIDS.SETTING_WINDOW);

            //----------------------------------------------------------------------
            // Set window
            //----------------------------------------------------------------------
            Rect rect = new Rect(new Position2D(Reference.Viewer.Width / 2 - 150, Reference.Viewer.Height / 2 - 110), new Dimension2D(300, 220));
            GUIWindow wnd = Reference.GUIEnvironment.AddWindowW(rect, false, "   " + DialogText.Settings, parentElement, (int)GUIElementIDS.SETTING_WINDOW);

            Texture tex = Reference.VideoDriver.GetTexture(Util.ApplicationDataDirectory + @"/media/gui/windows/window_settings.png");
            if (tex != null)
                Reference.GUIEnvironment.AddImage(tex, new Position2D(5, 2), true, wnd, -1, "");

            wnd.CloseButton.UseAlphaChannel = true;
            wnd.CloseButton.SetImage(closeButton);

            //----------------------------------------------------------------------
            // Set tab
            //----------------------------------------------------------------------
            const int width = 4;
            const int height = 32;
            rect.X = width / 2;
            rect.Width = rect.Width - width;
            rect.Y = height;
            rect.Height = (int)(rect.Height * 2f) - (rect.Y / 2);
            GUITabControl tab = Reference.GUIEnvironment.AddTabControl(rect, wnd, true, true, -1);

            //----------------------------------------------------------------------
            // Graphic tab
            //----------------------------------------------------------------------
            GUITab t1 = tab.AddTabW(DialogText.General, -1);
            Rect t1Rect = new Rect();

            t1Rect.X = 8;
            t1Rect.Y = 24;
            t1Rect.Width = 80;
            t1Rect.Height = 20 * 1;
            Reference.GUIEnvironment.AddStaticTextW(DialogText.SeaShader+":", t1Rect, false, false, t1, -1, false);
            t1Rect.X = t1Rect.X + t1Rect.Width;
            t1Rect.Width = 48;
            t1Rect.Height = 20 * 2;
            settingTab1SeaQualityList = Reference.GUIEnvironment.AddListBox(t1Rect, t1, -1, false);
            settingTab1SeaQualityList.AddItemW(DialogText.High);
            settingTab1SeaQualityList.AddItemW(DialogText.Low);
            settingTab1SeaQualityList.Selected = (Reference.Viewer.SeaQuality == Viewer.ShaderLevelType.High ? 0 : 1);

            t1Rect.X = 16 + t1Rect.X + t1Rect.Width;
            t1Rect.Width = 80;
            t1Rect.Height = 20 * 1;
            Reference.GUIEnvironment.AddStaticTextW(DialogText.SkyShader+":", t1Rect, false, false, t1, -1, false);
            t1Rect.X = t1Rect.X + t1Rect.Width;
            t1Rect.Width = 48;
            t1Rect.Height = 20 * 2;
            settingTab1SkyQualityList = Reference.GUIEnvironment.AddListBox(t1Rect, t1, -1, false);
            settingTab1SkyQualityList.AddItemW(DialogText.High);
            settingTab1SkyQualityList.AddItemW(DialogText.Low);
            settingTab1SkyQualityList.Selected = (Reference.Viewer.SkyQuality == Viewer.ShaderLevelType.High ? 0 : 1);

            t1Rect.X = 8;
            t1Rect.Y = t1Rect.Y + t1Rect.Height + 6;
            t1Rect.Width = 80;
            t1Rect.Height = 20 * 1;
            Reference.GUIEnvironment.AddStaticTextW(DialogText.Locale+":", t1Rect, false, false, t1, -1, false);
            t1Rect.X = t1Rect.X + t1Rect.Width;
            t1Rect.Width = 192;
            t1Rect.Height = 16 * 2;
            settingTab1Locale = Reference.GUIEnvironment.AddListBox(t1Rect, t1, -1, false);
            settingTab1Locale.AddItemW(DialogText.EN);
            if (Reference.Viewer.JapaneseEnabled)
                settingTab1Locale.AddItemW(DialogText.JP);
            settingTab1Locale.Selected = (Reference.Viewer.Locale == "en" ? 0 : 1);

            t1Rect.X = 8;
            t1Rect.Y = t1Rect.Y + t1Rect.Height + 16;
            t1Rect.Width = 278;
            t1Rect.Height = BUTTON_DEFULT_HEIGHT;
            Reference.GUIEnvironment.AddButtonW(t1Rect, t1, (int)GUIElementIDS.SETTING_TAB1_BUTTON00, "OK");

            //----------------------------------------------------------------------
            // Cache tab
            //----------------------------------------------------------------------
            GUITab t2 = tab.AddTabW(DialogText.Cache, -1);

            Rect t2Rect = new Rect(new Position2D(8, 24), new Dimension2D(278, 64));
            Reference.GUIEnvironment.AddStaticTextW(DialogText.CacheInformationMessage, t2Rect, false, true, t2, -1, false);

            t2Rect = new Rect(new Position2D(112, 88), new Dimension2D(278, 32));
            Reference.GUIEnvironment.AddStaticTextW(DialogText.CacheUnitMessage, t2Rect, false, true, t2, -1, false);

            t2Rect = new Rect(new Position2D(224, 80), new Dimension2D(64, 32));
            long cacheMB = Reference.Viewer.CacheManager.CacheMaxSize / (1000 * 1000);
            settingTab2CacheSize = Reference.GUIEnvironment.AddEditBox(cacheMB.ToString(), t2Rect, true, t2, -1);

            t2Rect = new Rect(new Position2D(8, 118), new Dimension2D(278, BUTTON_DEFULT_HEIGHT));
            Reference.GUIEnvironment.AddButtonW(t2Rect, t2, (int)GUIElementIDS.SETTING_TAB2_BUTTON00, DialogText.Delete);

            //----------------------------------------------------------------------
            // Information tab
            //----------------------------------------------------------------------
            GUITab t3 = tab.AddTabW(DialogText.Information, -1);
            Reference.GUIEnvironment.AddImage(Reference.VideoDriver.GetTexture(Util.ApplicationDataDirectory + @"/media/gui/windows/logo.tga"), new Position2D(22, 24), false, t3, -1, string.Empty);
            Reference.GUIEnvironment.AddStaticTextW(DialogText.Version + ": " + Reference.Viewer.Version.ToString(), new Rect(new Position2D(22, 100), new Dimension2D(Reference.Viewer.Width - 8, 24)), false, true, t3, -1, false);
            Reference.GUIEnvironment.AddStaticTextW("Copyright (C) 2009 3Di, Inc.", new Rect(new Position2D(22, 120), new Dimension2D(Reference.Viewer.Width - 8, 24)), false, true, t3, -1, false);
        }