Example #1
0
        public UISandboxSelector()
        {
            var ui = this.RenderScript("bookmarks.uis");

            var background = ui.Create <UIImage>("BookmarkBackground");

            SimsTab = ui.Create <UIImage>("SimsTab");
            AddAt(0, SimsTab);
            IgnoreTab = ui.Create <UIImage>("IgnoreTab");
            AddAt(0, IgnoreTab);
            IgnoreTab.Visible = false;

            AddAt(0, ui.Create <UIImage>("Tab1Background"));
            AddAt(0, ui.Create <UIImage>("Tab2Background"));
            AddAt(0, ui.Create <UIImage>("ListBoxBackground"));
            AddAt(0, background);


            UIUtils.MakeDraggable(background, this, true);

            BookmarkListSlider.AttachButtons(BookmarkListScrollUpButton, BookmarkScrollDownButton, 1);
            BookmarkListBox.AttachSlider(BookmarkListSlider);
            BookmarkListBox.OnDoubleClick += BookmarkListBox_OnDoubleClick;
            BookmarkListBoxColors          = ui.Create <UIListBoxTextStyle>("BookmarkListBoxColors", BookmarkListBox.FontStyle);
            CloseButton.OnButtonClick     += CloseButton_OnButtonClick;

            //IgnoreTabButton.OnButtonClick += (btn) => { ChangeType(BookmarkType.IGNORE_AVATAR); };
            //SimsTabButton.OnButtonClick += (btn) => { ChangeType(BookmarkType.AVATAR); };

            populateWithXMLHouses();
        }
Example #2
0
        public UISandboxSelector() : base(UIDialogStyle.Close, true)
        {
            if (GlobalSettings.Default.DebugBody == 0)
            {
                GameThread.NextUpdate(x => FSOFacade.Controller.ShowPersonCreation(null));
            }
            var ui = RenderScript("bookmarks.uis");

            Caption = $"Host a lot on :{_port}";

            //var background = ui.Create<UIImage>("BookmarkBackground");
            //SimsTab = ui.Create<UIImage>("SimsTab");
            //AddAt(0, SimsTab);
            //IgnoreTab = ui.Create<UIImage>("IgnoreTab");
            //AddAt(0, IgnoreTab);
            //IgnoreTab.Visible = false;

            //AddAt(0, ui.Create<UIImage>("Tab1Background"));
            //AddAt(0, ui.Create<UIImage>("Tab2Background"));
            var listBg = ui.Create <UIImage>("ListBoxBackground");

            AddAt(4, listBg);
            //AddAt(0, background);


            //UIUtils.MakeDraggable(background, this, true);
            listBg.With9Slice(25, 25, 25, 25);
            listBg.Height += 180;
            BookmarkListBox.VisibleRows += 10;
            BookmarkListSlider.SetSize(10, 170 + 180);
            BookmarkScrollDownButton.Y += 180;
            BookmarkListSlider.AttachButtons(BookmarkListScrollUpButton, BookmarkScrollDownButton, 1);
            BookmarkListBox.AttachSlider(BookmarkListSlider);
            BookmarkListBox.OnDoubleClick += BookmarkListBox_OnDoubleClick;
            BookmarkListBoxColors          = ui.Create <UIListBoxTextStyle>("BookmarkListBoxColors", BookmarkListBox.FontStyle);
            Remove(CloseButton);
            Remove(SimsTabButton);
            Remove(IgnoreTabButton);
            base.CloseButton.OnButtonClick += CloseButton_OnButtonClick;

            //IgnoreTabButton.OnButtonClick += (btn) => { ChangeType(BookmarkType.IGNORE_AVATAR); };
            //SimsTabButton.OnButtonClick += (btn) => { ChangeType(BookmarkType.AVATAR); };

            PopulateWithXMLHouses();

            var joinButton = new UIButton
            {
                Caption = "Join a server"
            };

            joinButton.OnButtonClick += (btn) =>
            {
                UIAlert alert = null;
                alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
                {
                    Message   = "Enter the address of the server you wish to connect to. (can optionally include port, eg localhost:34656)",
                    Width     = 400,
                    TextEntry = true,
                    Buttons   = new UIAlertButton[]
                    {
                        new UIAlertButton(UIAlertButtonType.Cancel, (btn2) => { UIScreen.RemoveDialog(alert); }),
                        new UIAlertButton(UIAlertButtonType.OK, (btn2) => {
                            UIScreen.RemoveDialog(alert);
                            var addr = alert.ResponseText;
                            if (!addr.Contains(':'))
                            {
                                addr += $":{_port}";
                            }
                            UIScreen.RemoveDialog(this);
                            LotSwitch(addr, true);
                        })
                    }
                }, true);
                alert.ResponseText = "127.0.0.1";
            };
            joinButton.Width = 190;
            joinButton.X     = 25;
            joinButton.Y     = 500 - 50;
            Add(joinButton);

            var casButton = new UIButton
            {
                Caption = "CAS"
            };

            casButton.OnButtonClick += (btn) =>
            {
                if (UIScreen.Current is SandboxGameScreen)
                {
                    ((SandboxGameScreen)UIScreen.Current).CleanupLastWorld();
                }
                FSOFacade.Controller.ShowPersonCreation(null);
            };
            casButton.Width = 50;
            casButton.X     = 300 - (25 + 50);
            casButton.Y     = 500 - 50;
            Add(casButton);

            SetSize(300, 500);
        }