Generates pie menus when the player clicks on objects.
Inheritance: FSO.Client.UI.Framework.UIContainer
示例#1
0
        public UIChatDialog(UILotControl owner)
            : base(UIDialogStyle.Standard | UIDialogStyle.OK | UIDialogStyle.Close, false)
        {
            //todo: this dialog is resizable. The elements use offests from each side to size and position themselves.
            //right now we're just using positions.

            CloseButton.Tooltip = GameFacade.Strings.GetString("f113", "43");
            Owner   = owner;
            History = new List <VMChatEvent>();

            this.RenderScript("chatdialog.uis");
            this.SetSize(400, 255);

            this.Caption = "Property Chat (?) - ???";

            ChatEntryBackground          = new UIImage(GetTexture((ulong)0x7A400000001)).With9Slice(13, 13, 13, 13);
            ChatEntryBackground.Position = new Vector2(25, 211);
            ChatEntryBackground.SetSize(323, 26);
            AddAt(5, ChatEntryBackground);

            ChatHistoryBackground          = new UIImage(GetTexture((ulong)0x7A400000001)).With9Slice(13, 13, 13, 13);
            ChatHistoryBackground.Position = new Vector2(19, 39);
            ChatHistoryBackground.SetSize(341, 166);
            AddAt(5, ChatHistoryBackground);

            ChatHistorySlider.AttachButtons(ChatHistoryScrollUpButton, ChatHistoryScrollDownButton, 1);
            ChatHistoryText.AttachSlider(ChatHistorySlider);

            ChatHistoryText.Position      = new Vector2(29, 47);
            ChatHistoryText.BBCodeEnabled = true;
            var histStyle = ChatHistoryText.TextStyle.Clone();

            histStyle.Size            = chatSize;
            ChatHistoryText.Size      = new Vector2(ChatHistoryBackground.Size.X - 19, ChatHistoryBackground.Size.Y - 16);
            ChatHistoryText.MaxLines  = 10;
            ChatHistoryText.TextStyle = histStyle;

            ChatEntryTextEdit.OnChange += ChatEntryTextEdit_OnChange;
            ChatEntryTextEdit.Position  = new Vector2(38, 216);
            ChatEntryTextEdit.Size      = new Vector2(295, 17);

            OKButton.Disabled       = true;
            OKButton.OnButtonClick += SendMessage;

            CloseButton.OnButtonClick += CloseButton_OnButtonClick;

            var emojis = new UIEmojiSuggestions(ChatEntryTextEdit);

            DynamicOverlay.Add(emojis);
            emojis.Parent = this;
            ChatEntryTextEdit.OnEnterPress += SendMessageEnter;

            Background.ListenForMouse(new UIMouseEvent(DragMouseEvents));

            Categories          = new UIChatCategoryList(this);
            Categories.Position = new Vector2(31, 29);
            Add(Categories);
            ChangeSizeTo(new Vector2(GlobalSettings.Default.ChatSizeX, GlobalSettings.Default.ChatSizeY));
        }
示例#2
0
        public UIChatPanel(VM vm, UILotControl owner)
        {
            this.vm    = vm;
            this.Owner = owner;

            if (FSOEnvironment.SoftwareKeyboard)
            {
                //need a button to initiate chat history
                var btn = new UIButton();
                btn.Caption        = "Chat";
                btn.Position       = new Vector2(10, 10);
                btn.OnButtonClick += (state) =>
                {
                    HistoryDialog.Visible = !HistoryDialog.Visible;
                };
                Add(btn);
            }

            Style        = TextStyle.DefaultTitle.Clone();
            Style.Size   = 16;
            Style.Shadow = true;
            Labels       = new List <UIChatBalloon>();

            TextBox         = new UITextBox();
            TextBox.Visible = false;
            Add(TextBox);
            TextBox.Position = new Vector2(25, 25);
            TextBox.SetSize(GlobalSettings.Default.GraphicsWidth - 50, 25);

            TextBox.OnEnterPress += SendMessageElem;

            SelectionFillColor = new Color(0, 25, 70);

            //-- populate invalid areas --
            //chat bubbles will be pushed out of these areas
            //when this happens, they will also begin displaying the name of the speaking avatar.

            InvalidAreas = new List <Rectangle>();
            InvalidAreas.Add(new Rectangle(-100000, -100000, 100020, 200000 + GlobalSettings.Default.GraphicsHeight));                                   //left
            InvalidAreas.Add(new Rectangle(-100000, -100000, 200000 + GlobalSettings.Default.GraphicsWidth, 100020));                                    //top
            InvalidAreas.Add(new Rectangle(GlobalSettings.Default.GraphicsWidth - 20, -100000, 100020, 200000 + GlobalSettings.Default.GraphicsHeight)); //right
            InvalidAreas.Add(new Rectangle(-100000, GlobalSettings.Default.GraphicsHeight - 20, 200000 + GlobalSettings.Default.GraphicsWidth, 100020)); //bottom
            InvalidAreas.Add(new Rectangle(-100000, GlobalSettings.Default.GraphicsHeight - 230, 100230, 100230));                                       //ucp

            HistoryDialog                = new UIChatDialog();
            HistoryDialog.Position       = new Vector2(20, 20);
            HistoryDialog.Visible        = false;
            HistoryDialog.Opacity        = 0.75f;
            HistoryDialog.OnSendMessage += SendMessage;
            this.Add(HistoryDialog);

            PropertyLog          = new UIPropertyLog();
            PropertyLog.Position = new Vector2(400, 20);
            PropertyLog.Visible  = false;
            PropertyLog.Opacity  = 0.75f;
            this.Add(PropertyLog);
        }
示例#3
0
        public UIChatPanel(VM vm, UILotControl owner)
        {
            this.vm = vm;
            this.Owner = owner;

            if (FSOEnvironment.SoftwareKeyboard)
            {
                //need a button to initiate chat history
                var btn = new UIButton();
                btn.Caption = "Chat";
                btn.Position = new Vector2(10, 10);
                btn.OnButtonClick += (state) =>
                {
                    HistoryDialog.Visible = !HistoryDialog.Visible;
                };
                Add(btn);
            }

            Style = TextStyle.DefaultTitle.Clone();
            Style.Size = 16;
            Style.Shadow = true;
            Labels = new List<UIChatBalloon>();

            TextBox = new UITextBox();
            TextBox.Visible = false;
            Add(TextBox);
            TextBox.Position = new Vector2(25, 25);
            TextBox.SetSize(GlobalSettings.Default.GraphicsWidth - 50, 25);

            TextBox.OnEnterPress += SendMessageElem;

            SelectionFillColor = new Color(0, 25, 70);

            //-- populate invalid areas --
            //chat bubbles will be pushed out of these areas
            //when this happens, they will also begin displaying the name of the speaking avatar.

            InvalidAreas = new List<Rectangle>();
            InvalidAreas.Add(new Rectangle(-100000, -100000, 100020, 200000 + GlobalSettings.Default.GraphicsHeight)); //left
            InvalidAreas.Add(new Rectangle(-100000, -100000, 200000 + GlobalSettings.Default.GraphicsWidth, 100020)); //top
            InvalidAreas.Add(new Rectangle(GlobalSettings.Default.GraphicsWidth-20, -100000, 100020, 200000 + GlobalSettings.Default.GraphicsHeight)); //right
            InvalidAreas.Add(new Rectangle(-100000, GlobalSettings.Default.GraphicsHeight - 20, 200000 +GlobalSettings.Default.GraphicsWidth, 100020)); //bottom
            InvalidAreas.Add(new Rectangle(-100000, GlobalSettings.Default.GraphicsHeight - 230, 100230, 100230)); //ucp

            HistoryDialog = new UIChatDialog();
            HistoryDialog.Position = new Vector2(20, 20);
            HistoryDialog.Visible = false;
            HistoryDialog.Opacity = 0.75f;
            HistoryDialog.OnSendMessage += SendMessage;
            this.Add(HistoryDialog);

            PropertyLog = new UIPropertyLog();
            PropertyLog.Position = new Vector2(400, 20);
            PropertyLog.Visible = false;
            PropertyLog.Opacity = 0.75f;
            this.Add(PropertyLog);
        }
示例#4
0
        public UIBuildMode(UILotControl lotController) : base("buildpanel", lotController)
        {
            Divider          = new UIImage(dividerImage);
            Divider.Position = new Vector2(337, 14);
            this.AddAt(1, Divider);

            SubToolBg          = new UIImage(subtoolsBackground);
            SubToolBg.Position = new Vector2(336, 5);
            this.AddAt(2, SubToolBg);

            Catalog.Position = new Vector2(364, 7);

            PreviousPageButton.OnButtonClick += PreviousPage;
            NextPageButton.OnButtonClick     += NextPage;
            SubtoolsSlider.MinValue           = 0;
            SubtoolsSlider.OnChange          += PageSlider;

            LotController.ObjectHolder.Roommate = true;
            LotController.QueryPanel.Roommate   = true;

            RoofSteepBtn   = new UIButton(GetTexture(0x4C200000001));
            RoofSteepBtn.X = 46;
            RoofSteepBtn.Y = 6;
            Add(RoofSteepBtn);
            RoofShallowBtn   = new UIButton(GetTexture(0x4C700000001));
            RoofShallowBtn.X = 46;
            RoofShallowBtn.Y = 92;
            Add(RoofShallowBtn);

            RoofSlider               = new UISlider();
            RoofSlider.Orientation   = 1;
            RoofSlider.Texture       = GetTexture(0x4AB00000001);
            RoofSlider.MinValue      = 0f;
            RoofSlider.MaxValue      = 1.25f;
            RoofSlider.AllowDecimals = true;
            RoofSlider.AttachButtons(RoofSteepBtn, RoofShallowBtn, 0.25f);
            RoofSlider.X         = 48;
            RoofSlider.Y         = 24;
            RoofSlider.OnChange += (elem) =>
            {
                if (RoofSlider.Value != (1.25f - LotController.vm.Context.Architecture.RoofPitch))
                {
                    LotController.vm.Context.Blueprint.RoofComp.SetStylePitch(
                        LotController.vm.Context.Architecture.RoofStyle,
                        (1.25f - RoofSlider.Value)
                        );
                    SendRoofValue = true;
                }
            };
            RoofSlider.SetSize(0, 64f);
            Add(RoofSlider);

            RoofSteepBtn.Visible   = false;
            RoofShallowBtn.Visible = false;
            RoofSlider.Visible     = false;
        }
        public UIAbstractCatalogPanel(string mode, UILotControl lotController)
        {
            LotController = lotController;
            Holder        = LotController.ObjectHolder;

            var useSmall = (FSOEnvironment.UIZoomFactor > 1f || GlobalSettings.Default.GraphicsWidth < 1024);

            UseSmall = useSmall;
            var script = this.RenderScript(mode + (useSmall ? "" : "1024") + ".uis");

            Script = script;

            Background   = new UIImage(GetTexture(useSmall ? (ulong)0x000000D800000002 : (ulong)0x0000018300000002));
            Background.Y = 0;
            Background.BlockInput();
            this.AddAt(0, Background);
            Size = Background.Size.ToVector2();

            Catalog                    = new UICatalog((mode == "buildpanel") ? (useSmall ? 10 : 20) : (useSmall ? 14 : 24));
            Catalog.LotControl         = lotController;
            Catalog.OnSelectionChange += new CatalogSelectionChangeDelegate(Catalog_OnSelectionChange);

            this.Add(Catalog);

            //prepare catalog map
            InitCategoryMap();
            foreach (UIButton btn in CategoryMap.Keys)
            {
                btn.OnButtonClick += ChangeCategory;
            }

            Holder.OnPickup      += HolderPickup;
            Holder.OnDelete      += HolderDelete;
            Holder.OnPutDown     += HolderPutDown;
            Holder.BeforeRelease += HolderBeforeRelease;
            DynamicOverlay.Add(QueryPanel);

            ObjLimitLabel = new UILabel();
            ObjLimitLabel.CaptionStyle        = ObjLimitLabel.CaptionStyle.Clone();
            ObjLimitLabel.CaptionStyle.Shadow = true;
            ObjLimitLabel.CaptionStyle.Color  = Microsoft.Xna.Framework.Color.White;
            ObjLimitLabel.Caption             = "127/250 Objects";
            ObjLimitLabel.Y         = -20;
            ObjLimitLabel.X         = Background.Width / 2 - 100;
            ObjLimitLabel.Size      = new Microsoft.Xna.Framework.Vector2(200, 0);
            ObjLimitLabel.Alignment = TextAlignment.Center;
            DynamicOverlay.Add(ObjLimitLabel);
        }
示例#6
0
        public UIAdmitBanPanel(UILotControl lotController)
        {
            var script = this.RenderScript("admitbanpanel.uis");

            foreach (var child in Children)
            {
                if (child is UILabel)
                {
                    var label = ((UILabel)child);
                    label.CaptionStyle        = label.CaptionStyle.Clone();
                    label.CaptionStyle.Shadow = true;
                    label.Alignment           = TextAlignment.Right;
                }
            }
            Background = script.Create <UIImage>("Background");
            this.AddAt(0, Background);
            AdmitList = script.Create <UIAdmitList>("AdmitInfoListSetup");
            this.Add(AdmitList);

            AdmitAllButton.OnButtonClick  += (btn) => { _Mode = 0; SetMode(true); };
            AdmitListButton.OnButtonClick += (btn) => { _Mode = 1; SetMode(true); };
            BanListButtton.OnButtonClick  += (btn) => { _Mode = 2; SetMode(true); };
            BanAllButton.OnButtonClick    += (btn) => { _Mode = 3; SetMode(true); };

            PreviousPageButton.OnButtonClick += (btn) => ChangePage(-1);
            NextPageButton.OnButtonClick     += (btn) => ChangePage(1);
            AdmitList.OnAvatarClick          += (id) =>
            {
                if (UIScreen.Current is CoreGameScreen)
                {
                    var cg = (CoreGameScreen)UIScreen.Current;
                    cg.PersonPage.FindController <PersonPageController>()?.Show(id);
                }
            };

            if (lotController.vm.TSOState.OwnerID != lotController.vm.MyUID)
            {
                AdmitAllButton.Disabled  = true;
                AdmitListButton.Disabled = true;
                BanListButtton.Disabled  = true;
                BanAllButton.Disabled    = true;
            }
        }
示例#7
0
        public UIHouseMode(UILotControl lotController)
        {
            var useSmall = true;  //(FSOEnvironment.UIZoomFactor > 1f || GlobalSettings.Default.GraphicsWidth < 1024);
            var script   = RenderScript("housepanel.uis");

            Background = new UIImage(GetTexture(useSmall ? (ulong)0x000000D800000002 : (ulong)0x0000018300000002))
            {
                Y = 9
            };
            Background.BlockInput();
            AddAt(0, Background);

            Size = Background.Size.ToVector2() + new Vector2(0, 9);

            Divider         = script.Create <UIImage>("Divider");
            Divider.Texture = DividerImage;
            Add(Divider);

            BtnToMode = new Dictionary <UIButton, int>()
            {
                { HouseInfoButton, 0 },
                { StatisticsButton, 1 },
                { RoommatesButton, 2 },
                { LogButton, 3 },
                { AdmitBanButton, 4 },
                { EnvironmentButton, 5 },
                { BillsButton, 6 },
                { LotResizeButton, 7 }
            };

            StatisticsButton.Disabled = true;
            BillsButton.Disabled      = true;
            LogButton.Disabled        = true;

            foreach (var btn in BtnToMode.Keys)
            {
                btn.OnButtonClick += SetMode;
            }

            CurrentPanel = -1;
            LotControl   = lotController;
        }
示例#8
0
        public UIChatPanel(VM vm, UILotControl owner)
        {
            this.vm = vm;
            this.Owner = owner;

            Style = TextStyle.DefaultTitle.Clone();
            Style.Size = 16;
            Style.Shadow = true;
            Labels = new List<UILabel>();

            TextBox = new UITextBox();
            TextBox.Visible = false;
            Add(TextBox);
            TextBox.Position = new Vector2(25, 25);
            TextBox.SetSize(GlobalSettings.Default.GraphicsWidth - 50, 25);

            TextBox.OnEnterPress += SendMessage;

            SelectionFillColor = new Color(0, 25, 70);
        }
示例#9
0
        public UIBuyMode(UILotControl lotController) : base("buypanel", lotController)
        {
            InventoryButtonBackgroundImage = Script.Create <UIImage>("InventoryButtonBackgroundImage");
            this.AddAt(1, InventoryButtonBackgroundImage);

            CatBg = Script.Create <UIImage>("ProductCatalogImage");
            this.AddAt(2, CatBg);

            InventoryCatBg = Script.Create <UIImage>("InventoryCatalogRoommateImage");
            this.AddAt(3, InventoryCatBg);

            NonRMInventoryCatBg = Script.Create <UIImage>("InventoryCatalogVisitorImage");
            this.AddAt(4, NonRMInventoryCatBg);

            InventoryCatalogVisitorIcon = Script.Create <UIImage>("InventoryCatalogVisitorIcon");
            this.AddAt(5, InventoryCatalogVisitorIcon);

            Catalog.Position = new Microsoft.Xna.Framework.Vector2(275, 7);

            //MapBuildingModeButton.OnButtonClick += ChangeCategory;
            InventoryButton.OnButtonClick += ChangeCategory;

            ProductCatalogPreviousPageButton.OnButtonClick           += PreviousPage;
            InventoryCatalogRoommatePreviousPageButton.OnButtonClick += PreviousPage;
            InventoryCatalogVisitorPreviousPageButton.OnButtonClick  += PreviousPage;

            ProductCatalogNextPageButton.OnButtonClick           += NextPage;
            InventoryCatalogRoommateNextPageButton.OnButtonClick += NextPage;
            InventoryCatalogVisitorNextPageButton.OnButtonClick  += NextPage;

            ProductCatalogSlider.MinValue           = 0;
            InventoryCatalogRoommateSlider.MinValue = 0;
            InventoryCatalogVisitorSlider.MinValue  = 0;

            ProductCatalogSlider.OnChange           += PageSlider;
            InventoryCatalogRoommateSlider.OnChange += PageSlider;
            InventoryCatalogVisitorSlider.OnChange  += PageSlider;

            SetMode(0);
            SetRoomCategories(false);
        }
示例#10
0
        public UIRoommatesPanel(UILotControl lotController)
        {
            this.LotControl = lotController;
            var script = this.RenderScript("roommatespanel.uis");

            RoommateList = script.Create <UIRoommateCheckList>("RoommateList");
            RoommateList.OnCheckChange += RoommateList_OnCheckChange;
            Add(RoommateList);
            TitleLabel.CaptionStyle        = TitleLabel.CaptionStyle.Clone();
            TitleLabel.CaptionStyle.Shadow = true;
            TitleLabel.Alignment           = TextAlignment.Left;
            TitleLabel.Y -= 8;

            var buildico = new UIImage(BuildIconImage);

            buildico.Position = new Vector2(30 - 18, 30 + 34 + 8); //to the left of all the checkboxes
            buildico.Tooltip  = GameFacade.Strings.GetString("178", "2");
            UIUtils.GiveTooltip(buildico);
            Add(buildico);
            UpdateList();
        }
示例#11
0
        public UILiveMode(UILotControl lotController)
        {
            var script = this.RenderScript("livepanel" + ((GlobalSettings.Default.GraphicsWidth < 1024)?"":"1024") + ".uis");

            LotController = lotController;

            Background   = new UIImage(GetTexture((GlobalSettings.Default.GraphicsWidth < 1024) ? (ulong)0x000000D800000002 : (ulong)0x0000018300000002));
            Background.Y = 33;
            this.AddAt(0, Background);

            var PeopleListBg = new UIImage(PeopleListBackgroundImg);

            PeopleListBg.Position = new Microsoft.Xna.Framework.Vector2(375, 38);
            this.AddAt(1, PeopleListBg);

            Divider          = new UIImage(DividerImg);
            Divider.Position = new Microsoft.Xna.Framework.Vector2(140, 49);
            this.AddAt(1, Divider);

            MoodPanelButton = new UIButton();

            MoodPanelButton.Texture     = GetTexture((ulong)GameContent.FileIDs.UIFileIDs.lpanel_moodpanelbtn);
            MoodPanelButton.ImageStates = 4;
            MoodPanelButton.Position    = new Vector2(31, 63);
            this.Add(MoodPanelButton);

            Thumbnail          = new UIImage();
            Thumbnail.Size     = new Point(32, 32);
            Thumbnail.Position = new Vector2(65, 74);
            this.Add(Thumbnail);

            MotiveDisplay          = new UIMotiveDisplay();
            MotiveDisplay.Position = new Vector2(165, 59);
            this.Add(MotiveDisplay);

            EODHelpButton.Visible     = false;
            EODCloseButton.Visible    = false;
            EODExpandButton.Visible   = false;
            EODContractButton.Visible = false;
        }
示例#12
0
        public UILiveMode(UILotControl lotController)
        {
            var script = this.RenderScript("livepanel"+((GlobalSettings.Default.GraphicsWidth < 1024)?"":"1024")+".uis");
            LotController = lotController;

            Background = new UIImage(GetTexture((GlobalSettings.Default.GraphicsWidth < 1024) ? (ulong)0x000000D800000002 : (ulong)0x0000018300000002));
            Background.Y = 33;
            this.AddAt(0, Background);

            var PeopleListBg = new UIImage(PeopleListBackgroundImg);
            PeopleListBg.Position = new Microsoft.Xna.Framework.Vector2(375, 38);
            this.AddAt(1, PeopleListBg);

            Divider = new UIImage(DividerImg);
            Divider.Position = new Microsoft.Xna.Framework.Vector2(140, 49);
            this.AddAt(1, Divider);

            MoodPanelButton = new UIButton();

            MoodPanelButton.Texture = GetTexture((ulong)GameContent.FileIDs.UIFileIDs.lpanel_moodpanelbtn);
            MoodPanelButton.ImageStates = 4;
            MoodPanelButton.Position = new Vector2(31, 63);
            this.Add(MoodPanelButton);

            Thumbnail = new UIImage();
            Thumbnail.Size = new Point(32, 32);
            Thumbnail.Position = new Vector2(65, 74);
            this.Add(Thumbnail);

            MotiveDisplay = new UIMotiveDisplay();
            MotiveDisplay.Position = new Vector2(165, 59);
            this.Add(MotiveDisplay);

            EODHelpButton.Visible = false;
            EODCloseButton.Visible = false;
            EODExpandButton.Visible = false;
            EODContractButton.Visible = false;
        }
示例#13
0
        public UIChatPanel(VM vm, UILotControl owner)
        {
            this.vm    = vm;
            this.Owner = owner;

            Style        = TextStyle.DefaultTitle.Clone();
            Style.Size   = 16;
            Style.Shadow = true;
            Labels       = new List <UIChatBalloon>();

            TextBox         = new UITextBox();
            TextBox.Visible = false;
            Add(TextBox);
            TextBox.Position = new Vector2(25, 25);
            TextBox.SetSize(GlobalSettings.Default.GraphicsWidth - 50, 25);

            TextBox.OnEnterPress += SendMessageElem;

            SelectionFillColor = new Color(0, 25, 70);

            //-- populate invalid areas --
            //chat bubbles will be pushed out of these areas
            //when this happens, they will also begin displaying the name of the speaking avatar.

            InvalidAreas = new List <Rectangle>();
            InvalidAreas.Add(new Rectangle(-100000, -100000, 100020, 200000 + GlobalSettings.Default.GraphicsHeight));                                   //left
            InvalidAreas.Add(new Rectangle(-100000, -100000, 200000 + GlobalSettings.Default.GraphicsWidth, 100020));                                    //top
            InvalidAreas.Add(new Rectangle(GlobalSettings.Default.GraphicsWidth - 20, -100000, 100020, 200000 + GlobalSettings.Default.GraphicsHeight)); //right
            InvalidAreas.Add(new Rectangle(-100000, GlobalSettings.Default.GraphicsHeight - 20, 200000 + GlobalSettings.Default.GraphicsWidth, 100020)); //bottom
            InvalidAreas.Add(new Rectangle(-100000, GlobalSettings.Default.GraphicsHeight - 230, 100230, 100230));                                       //ucp

            HistoryDialog                = new UIChatDialog();
            HistoryDialog.Position       = new Vector2(20, 20);
            HistoryDialog.Visible        = false;
            HistoryDialog.Opacity        = 0.75f;
            HistoryDialog.OnSendMessage += SendMessage;
            this.Add(HistoryDialog);
        }
示例#14
0
        public UIEnvPanel(UILotControl lotController)
        {
            var script = this.RenderScript("envpanel.uis");

            Divider         = script.Create <UIImage>("Divider");
            Divider.Texture = DividerImage;
            Add(Divider);

            BtnToMode = new Dictionary <UIButton, int>()
            {
                { LightColorsButton, 0 },
                { TimeOfDayButton, 1 },
                { SoundsButton, 2 }
            };

            foreach (var btn in BtnToMode.Keys)
            {
                btn.OnButtonClick += SetMode;
            }

            LotControl   = lotController;
            CurrentPanel = -1;
        }
示例#15
0
 public UIStatsPanel(UILotControl lotController)
 {
     RenderScript("statisticspanel.uis");
 }
示例#16
0
 public UILogPanel(UILotControl lotController)
 {
     RenderScript("logpanel.uis");
 }
示例#17
0
        public UIBuildMode(UILotControl lotController)
        {
            LotController = lotController;
            Holder        = LotController.ObjectHolder;

            var useSmall = (FSOEnvironment.UIZoomFactor > 1f || GlobalSettings.Default.GraphicsWidth < 1024);
            var script   = this.RenderScript("buildpanel" + (useSmall ? "" : "1024") + ".uis");

            Background   = new UIImage(GetTexture(useSmall ? (ulong)0x000000D800000002 : (ulong)0x0000018300000002));
            Background.Y = 0;
            Background.BlockInput();
            this.AddAt(0, Background);

            Size = Background.Size.ToVector2();

            Divider          = new UIImage(dividerImage);
            Divider.Position = new Vector2(337, 14);
            this.AddAt(1, Divider);

            SubToolBg          = new UIImage(subtoolsBackground);
            SubToolBg.Position = new Vector2(336, 5);
            this.AddAt(2, SubToolBg);

            Catalog                    = new UICatalog(useSmall ? 10 : 20);
            Catalog.ActiveVM           = lotController.vm;
            Catalog.OnSelectionChange += new CatalogSelectionChangeDelegate(Catalog_OnSelectionChange);
            Catalog.Position           = new Vector2(364, 7);
            this.Add(Catalog);

            CategoryMap = new Dictionary <UIButton, int>
            {
                { TerrainButton, 29 },
                { WaterButton, 5 },
                { WallButton, 7 },
                { WallpaperButton, 8 },
                { StairButton, 2 },
                { FireplaceButton, 4 },

                { PlantButton, 3 },
                { FloorButton, 9 },
                { DoorButton, 0 },
                { WindowButton, 1 },
                { RoofButton, 6 },
                { HandButton, 28 },
            };

            TerrainButton.Disabled         = (LotController?.ActiveEntity?.TSOState as VMTSOAvatarState)?.Permissions < VMTSOAvatarPermissions.Admin;
            TerrainButton.OnButtonClick   += ChangeCategory;
            WaterButton.OnButtonClick     += ChangeCategory;
            WallButton.OnButtonClick      += ChangeCategory;
            WallpaperButton.OnButtonClick += ChangeCategory;
            StairButton.OnButtonClick     += ChangeCategory;
            FireplaceButton.OnButtonClick += ChangeCategory;

            PlantButton.OnButtonClick  += ChangeCategory;
            FloorButton.OnButtonClick  += ChangeCategory;
            DoorButton.OnButtonClick   += ChangeCategory;
            WindowButton.OnButtonClick += ChangeCategory;
            RoofButton.OnButtonClick   += ChangeCategory;
            HandButton.OnButtonClick   += ChangeCategory;

            PreviousPageButton.OnButtonClick += PreviousPage;
            NextPageButton.OnButtonClick     += NextPage;
            SubtoolsSlider.MinValue           = 0;
            SubtoolsSlider.OnChange          += PageSlider;

            Holder.OnPickup  += HolderPickup;
            Holder.OnDelete  += HolderDelete;
            Holder.OnPutDown += HolderPutDown;
            DynamicOverlay.Add(QueryPanel);

            LotController.ObjectHolder.Roommate = true;
            LotController.QueryPanel.Roommate   = true;

            ObjLimitLabel = new UILabel();
            ObjLimitLabel.CaptionStyle        = ObjLimitLabel.CaptionStyle.Clone();
            ObjLimitLabel.CaptionStyle.Shadow = true;
            ObjLimitLabel.CaptionStyle.Color  = Microsoft.Xna.Framework.Color.White;
            ObjLimitLabel.Caption             = "127/250 Objects";
            ObjLimitLabel.Y         = -20;
            ObjLimitLabel.X         = Background.Width / 2 - 100;
            ObjLimitLabel.Size      = new Microsoft.Xna.Framework.Vector2(200, 0);
            ObjLimitLabel.Alignment = TextAlignment.Center;
            DynamicOverlay.Add(ObjLimitLabel);

            RoofSteepBtn   = new UIButton(GetTexture(0x4C200000001));
            RoofSteepBtn.X = 46;
            RoofSteepBtn.Y = 6;
            Add(RoofSteepBtn);
            RoofShallowBtn   = new UIButton(GetTexture(0x4C700000001));
            RoofShallowBtn.X = 46;
            RoofShallowBtn.Y = 92;
            Add(RoofShallowBtn);


            RoofSlider               = new UISlider();
            RoofSlider.Orientation   = 1;
            RoofSlider.Texture       = GetTexture(0x4AB00000001);
            RoofSlider.MinValue      = 0f;
            RoofSlider.MaxValue      = 1.25f;
            RoofSlider.AllowDecimals = true;
            RoofSlider.AttachButtons(RoofSteepBtn, RoofShallowBtn, 0.25f);
            RoofSlider.X         = 48;
            RoofSlider.Y         = 24;
            RoofSlider.OnChange += (elem) =>
            {
                if (RoofSlider.Value != (1.25f - LotController.vm.Context.Architecture.RoofPitch))
                {
                    LotController.vm.Context.Blueprint.RoofComp.SetStylePitch(
                        LotController.vm.Context.Architecture.RoofStyle,
                        (1.25f - RoofSlider.Value)
                        );
                    SendRoofValue = true;
                }
            };
            RoofSlider.SetSize(0, 64f);
            Add(RoofSlider);

            RoofSteepBtn.Visible   = false;
            RoofShallowBtn.Visible = false;
            RoofSlider.Visible     = false;
        }
示例#18
0
        public UIQueryPanel(UILotControl parent, LotView.World world)
        {
            var ui = Content.Content.Get().CustomUI;
            var gd = GameFacade.GraphicsDevice;

            LotParent = parent;
            World     = world;
            Active    = false;
            Opacity   = 0;
            Visible   = false;

            AdStrings = new string[14];
            for (int i = 0; i < 14; i++)
            {
                string str = GameFacade.Strings.GetString("206", (i + 4).ToString());
                AdStrings[i] = ((i < 7) ? str.Substring(0, str.Length - 2) + "{0}" : str) + "\r\n";
            }

            CategoryStrings = new string[11];
            for (int i = 0; i < 10; i++)
            {
                CategoryStrings[i] = GameFacade.Strings.GetString("f115", (i + 73).ToString());
            }
            CategoryStrings[10] = GameFacade.Strings.GetString("f115", "98");

            var useSmall = (GlobalSettings.Default.GraphicsWidth < 1024) || FSOEnvironment.UIZoomFactor > 1f;
            var script   = this.RenderScript("querypanel" + (useSmall ? "" : "1024") + ".uis");

            //NOTE: the background and position of this element changes with the context it is used in.
            //other elements that are only used for certain modes will be flagged as such with comments.

            QuerybackPanel   = new UIImage(BackgroundImagePanel);
            QuerybackPanel.Y = 0;
            this.AddAt(0, QuerybackPanel);

            ListenForMouse(new Rectangle(0, 0, QuerybackPanel.Texture.Width, QuerybackPanel.Texture.Height), (t, s) => { });

            Size       = QuerybackPanel.Size.ToVector2() + new Vector2(22, 42);
            BackOffset = new Point(40, 0);

            QuerybackCatalog          = new UIImage(BackgroundImageCatalog);
            QuerybackCatalog.Position = new Vector2(-22, 0);
            this.AddAt(1, QuerybackCatalog);

            QuerybackTrade   = new UIImage(BackgroundImageTrade);
            QuerybackTrade.X = -40;
            QuerybackTrade.Y = 0;
            this.AddAt(2, QuerybackTrade);

            //init general tab specific backgrounds

            DescriptionBackgroundImage          = new UIImage(ImageDescriptionBackground);
            DescriptionBackgroundImage.Position = new Microsoft.Xna.Framework.Vector2(119, 7);
            this.AddAt(3, DescriptionBackgroundImage);

            MotivesBackgroundImage          = new UIImage(ImageMotivesBackground);
            MotivesBackgroundImage.Position = new Microsoft.Xna.Framework.Vector2(useSmall ? 395 : 619, 7);
            this.AddAt(3, MotivesBackgroundImage);

            GeneralTabImage          = new UIImage(ImageGeneralTab);
            GeneralTabImage.Position = new Microsoft.Xna.Framework.Vector2(useSmall ? 563 : 787, 0);
            this.AddAt(3, GeneralTabImage);

            SpecificTabImage          = new UIImage(ImageSpecificTab);
            SpecificTabImage.Position = new Microsoft.Xna.Framework.Vector2(useSmall ? 563 : 787, 0);
            this.AddAt(3, SpecificTabImage);

            OwnerPriceBack = script.Create <UIImage>("OwnerPriceBack");
            this.AddAt(3, OwnerPriceBack);

            BuyerPriceBack = script.Create <UIImage>("BuyerPriceBack");
            this.AddAt(3, BuyerPriceBack);

            OwnerPriceBack.X = ForSalePrice.X;
            BuyerPriceBack.X = ForSalePrice.X;
            ForSalePrice.Y  += 2;
            ForSalePrice.SetSize(OwnerPriceBack.Width, ForSalePrice.Height);

            Thumbnail          = new UIImage();
            Thumbnail.Position = new Vector2(24, 11);
            Thumbnail.SetSize(90, 90);
            this.Add(Thumbnail);

            DescriptionText.CurrentText = "No Object Selected"; //user should not see this.
            DescriptionSlider.AttachButtons(DescriptionScrollUpButton, DescriptionScrollDownButton, 1);
            DescriptionText.AttachSlider(DescriptionSlider);

            MotivesText.CurrentText = "";
            MotivesSlider.AttachButtons(MotivesScrollUpButton, MotivesScrollDownButton, 1);
            MotivesText.AttachSlider(MotivesSlider);

            GeneralTabButton.OnButtonClick  += new ButtonClickDelegate(GeneralTabButton_OnButtonClick);
            SpecificTabButton.OnButtonClick += new ButtonClickDelegate(SpecificTabButton_OnButtonClick);
            SellBackButton.OnButtonClick    += new ButtonClickDelegate(SellBackButton_OnButtonClick);

            AsyncBuyButton.OnButtonClick        += (btn) => { OnAsyncBuyClicked?.Invoke(btn); };
            AsyncSaleButton.OnButtonClick       += (btn) => { OnAsyncSaleClicked?.Invoke(btn); };
            AsyncEditPriceButton.OnButtonClick  += (btn) => { OnAsyncPriceClicked?.Invoke(btn); };
            AsyncCancelSaleButton.OnButtonClick += (btn) => { OnAsyncSaleCancelClicked?.Invoke(btn); };

            InventoryButton.OnButtonClick += InventoryButton_OnButtonClick;

            WearProgressBar.CaptionStyle        = TextStyle.DefaultLabel.Clone();
            WearProgressBar.CaptionStyle.Shadow = true;

            var btnBg = GetTexture(0x8A700000001); //buybuild_query_generalbuy_sellasyncback = 0x8A700000001

            SpecificBtnBGs = new List <UIImage>();
            SpecificBtnBGs.Add(AddButtonBackground(SellBackButton, btnBg));
            SpecificBtnBGs.Add(AddButtonBackground(InventoryButton, btnBg));
            AsyncSaleButtonBG = AddButtonBackground(AsyncSaleButton, btnBg);
            SpecificBtnBGs.Add(AsyncSaleButtonBG);
            AsyncCancelSaleButtonBG = AddButtonBackground(AsyncCancelSaleButton, btnBg);

            var progressBG = new UIImage(ImageWearBack);

            progressBG.Position = WearProgressBar.Position - new Vector2(3, 2);
            AddAt(3, progressBG);
            SpecificBtnBGs.Add(progressBG);

            //upgrade button
            UpgradeBack          = new UIImage(ui.Get("up_button_seat.png").Get(gd));
            UpgradeBack.Position = new Vector2(useSmall ? 582 : 806, 0);
            Add(UpgradeBack);

            UpgradeList         = new UIUpgradeList(LotParent);
            UpgradeList.Visible = false;
            DynamicOverlay.Add(UpgradeList);

            UpgradeButton = new UIButton(ui.Get("up_button.png").Get(gd));
            UpgradeButton.OnButtonClick += UpgradeButton_OnButtonClick;
            UpgradeButton.Tooltip        = GameFacade.Strings.GetString("f125", "1");
            UpgradeButton.Position       = UpgradeBack.Position + new Vector2(6, 7);
            DynamicOverlay.Add(UpgradeButton);
            UpgradeList.Position = UpgradeButton.Position + new Vector2(-542, 11);

            Mode = 1;
            Tab  = 0;
        }
示例#19
0
        public void InitTestLot(string path, bool host)
        {
            if (Connecting) return;

            if (vm != null) CleanupLastWorld();

            World = new LotView.World(GameFacade.Game.GraphicsDevice);
            GameFacade.Scenes.Add(World);

            VMNetDriver driver;
            if (host)
            {
                driver = new VMServerDriver(37564, null);
            }
            else
            {
                Connecting = true;
                ConnectingDialog = new UILoginProgress();

                ConnectingDialog.Caption = GameFacade.Strings.GetString("211", "1");
                ConnectingDialog.ProgressCaption = GameFacade.Strings.GetString("211", "24");
                //this.Add(ConnectingDialog);

                UIScreen.ShowDialog(ConnectingDialog, true);

                driver = new VMClientDriver(path, 37564, ClientStateChange);
            }

            vm = new VM(new VMContext(World), driver, new UIHeadlineRendererProvider());
            vm.Init();
            vm.LotName = (path == null) ? "localhost" : path.Split('/').LastOrDefault(); //quick hack just so we can remember where we are

            if (host)
            {
                //check: do we have an fsov to try loading from?

                string filename = Path.GetFileName(path);
                try
                {
                    using (var file = new BinaryReader(File.OpenRead(Path.Combine(FSOEnvironment.UserDir, "LocalHouse/")+filename.Substring(0, filename.Length-4)+".fsov")))
                    {
                        var marshal = new SimAntics.Marshals.VMMarshal();
                        marshal.Deserialize(file);
                        vm.Load(marshal);
                        vm.Reset();
                    }
                }
                catch (Exception) {
                    short jobLevel = -1;

                    //quick hack to find the job level from the chosen blueprint
                    //the final server will know this from the fact that it wants to create a job lot in the first place...

                    try
                    {
                        if (filename.StartsWith("nightclub") || filename.StartsWith("restaurant") || filename.StartsWith("robotfactory"))
                            jobLevel = Convert.ToInt16(filename.Substring(filename.Length - 9, 2));
                    }
                    catch (Exception) { }

                    vm.SendCommand(new VMBlueprintRestoreCmd
                    {
                        JobLevel = jobLevel,
                        XMLData = File.ReadAllBytes(path)
                    });
                }
            }

            uint simID = (uint)(new Random()).Next();
            vm.MyUID = simID;

            vm.SendCommand(new VMNetSimJoinCmd
            {
                ActorUID = simID,
                HeadID = GlobalSettings.Default.DebugHead,
                BodyID = GlobalSettings.Default.DebugBody,
                SkinTone = (byte)GlobalSettings.Default.DebugSkin,
                Gender = !GlobalSettings.Default.DebugGender,
                Name = GlobalSettings.Default.LastUser
            });

            LotController = new UILotControl(vm, World);
            this.AddAt(0, LotController);

            vm.Context.Clock.Hours = 10;
            if (m_ZoomLevel > 3)
            {
                World.Visible = false;
                LotController.Visible = false;
            }

            if (host)
            {
                ZoomLevel = 1;
                ucp.SetInLot(true);
            } else
            {
                ZoomLevel = Math.Max(ZoomLevel, 4);
            }

            if (IDEHook.IDE != null) IDEHook.IDE.StartIDE(vm);

            vm.OnFullRefresh += VMRefreshed;
            vm.OnChatEvent += Vm_OnChatEvent;
            vm.OnEODMessage += LotController.EODs.OnEODMessage;
        }
示例#20
0
        public UILiveMode(UILotControl lotController)
        {
            var small800 = (GlobalSettings.Default.GraphicsWidth < 1024) || FSOEnvironment.UIZoomFactor > 1f;
            var script   = this.RenderScript("livepanel" + (small800?"":"1024") + ".uis");

            Script        = script;
            LotController = lotController;

            DefaultBGImage = GetTexture(small800 ? (ulong)0x000000D800000002 : (ulong)0x0000018300000002);
            Background     = new UIImage(DefaultBGImage);
            Background.Y   = 35;
            this.AddAt(0, Background);

            EODCloseButton.OnButtonClick += EODCloseButton_OnButtonClick;

            MotivesLabel.CaptionStyle        = MotivesLabel.CaptionStyle.Clone();
            MotivesLabel.CaptionStyle.Shadow = true;
            MotivesLabel.Alignment           = TextAlignment.Left;
            MotivesLabel.Position           -= new Vector2(0, 5);

            PeopleListBg          = new UIImage(PeopleListBackgroundImg);
            PeopleListBg.Position = new Microsoft.Xna.Framework.Vector2(375, 38);
            this.AddAt(1, PeopleListBg);

            Divider          = new UIImage(DividerImg);
            Divider.Position = new Microsoft.Xna.Framework.Vector2(140, 49);
            this.AddAt(1, Divider);

            MoodPanelButton = new UIButton();

            MoodPanelButton.Texture     = GetTexture((ulong)GameContent.FileIDs.UIFileIDs.lpanel_moodpanelbtn);
            MoodPanelButton.ImageStates = 4;
            MoodPanelButton.Position    = new Vector2(31, 63);
            this.Add(MoodPanelButton);

            MotiveDisplay          = new UIMotiveDisplay();
            MotiveDisplay.Position = new Vector2(165, 56);
            this.Add(MotiveDisplay);

            PersonGrid = new UIPersonGrid(LotController.vm);
            Add(PersonGrid);
            PersonGrid.Position = new Vector2(409, 51);
            if (small800)
            {
                PersonGrid.Columns = 4;
                PersonGrid.DrawPage();
            }

            EODPanel     = new UIImage(EODPanelImg);
            EODPanel.Y   = 20;
            EODPanelTall = new UIImage(EODPanelTallImg);
            //EODDoublePanelTall = new UIImage(EODDoublePanelTallImg);

            AddAt(0, EODPanel);
            AddAt(0, EODPanelTall);
            //Add(EODDoublePanelTall);

            EODButtonLayoutNone     = script.Create <UIImage>("EODButtonLayoutNone");
            EODButtonLayoutNoneTall = script.Create <UIImage>("EODButtonLayoutNoneTall");
            EODButtonLayoutOne      = script.Create <UIImage>("EODButtonLayoutOne");
            EODButtonLayoutOneTall  = script.Create <UIImage>("EODButtonLayoutOneTall");
            EODButtonLayoutTwo      = script.Create <UIImage>("EODButtonLayoutTwo");
            EODButtonLayoutTwoTall  = script.Create <UIImage>("EODButtonLayoutTwoTall");

            EODSubFullLength       = script.Create <UIImage>("EODSubFullLength");
            EODSubFullLengthTall   = script.Create <UIImage>("EODSubFullLengthTall");
            EODSubMediumLength     = script.Create <UIImage>("EODSubMediumLength");
            EODSubMediumLengthTall = script.Create <UIImage>("EODSubMediumLengthTall");
            EODSubShortLength      = script.Create <UIImage>("EODSubShortLength");
            EODSubShortLengthTall  = script.Create <UIImage>("EODSubShortLengthTall");

            Add(EODButtonLayoutNone);
            Add(EODButtonLayoutNoneTall);
            Add(EODButtonLayoutOne);
            Add(EODButtonLayoutOneTall);
            Add(EODButtonLayoutTwo);
            Add(EODButtonLayoutTwoTall);

            Add(EODSubFullLength);
            Add(EODSubFullLengthTall);
            Add(EODSubMediumLength);
            Add(EODSubMediumLengthTall);
            Add(EODSubShortLength);
            Add(EODSubShortLengthTall);

            EODMsgWinLong  = script.Create <UIImage>("EODMsgWinLong");
            EODMsgWinShort = script.Create <UIImage>("EODMsgWinShort");
            EODTimer       = script.Create <UIImage>("EODTimer");

            AddAt(0, EODTimer);
            AddAt(0, EODMsgWinLong);
            AddAt(0, EODMsgWinShort);

            EODButton = new UIButton(EODButtonImg);
            Add(EODButton);
            EODButton.OnButtonClick += EODToggle;
            EODImage = script.Create <UIImage>("EODButtonImageSize");
            Add(EODImage);

            NextPageButton.OnButtonClick     += (UIElement btn) => { PersonGrid.NextPage(); };
            DefaultNextPagePos                = NextPageButton.Position;
            PreviousPageButton.OnButtonClick += (UIElement btn) => { PersonGrid.PreviousPage(); };

            MsgWinTextEntry.Items.Add(new UIListBoxItem("", ""));

            EODCloseBase = EODCloseButton.Position;
            EODHelpBase  = EODHelpButton.Position;
            SetInEOD(null, null);
        }
示例#21
0
 public UILotControlTouchHelper(UILotControl master)
 {
     Master = master;
 }
示例#22
0
        public UIBuildMode(UILotControl lotController)
        {
            LotController = lotController;
            Holder        = LotController.ObjectHolder;
            QueryPanel    = LotController.QueryPanel;

            var useSmall = (FSOEnvironment.UIZoomFactor > 1f || GlobalSettings.Default.GraphicsWidth < 1024);
            var script   = this.RenderScript("buildpanel" + (useSmall ? "" : "1024") + ".uis");

            Background   = new UIImage(GetTexture(useSmall ? (ulong)0x000000D800000002 : (ulong)0x0000018300000002));
            Background.Y = 0;
            Background.BlockInput();
            this.AddAt(0, Background);

            Divider          = new UIImage(dividerImage);
            Divider.Position = new Vector2(337, 14);
            this.AddAt(1, Divider);

            SubToolBg          = new UIImage(subtoolsBackground);
            SubToolBg.Position = new Vector2(336, 5);
            this.AddAt(2, SubToolBg);

            Catalog = new UICatalog(useSmall ? 10 : 20);
            Catalog.OnSelectionChange += new CatalogSelectionChangeDelegate(Catalog_OnSelectionChange);
            Catalog.Position           = new Vector2(364, 7);
            this.Add(Catalog);

            CategoryMap = new Dictionary <UIButton, int>
            {
                { TerrainButton, 10 },
                { WaterButton, 5 },
                { WallButton, 7 },
                { WallpaperButton, 8 },
                { StairButton, 2 },
                { FireplaceButton, 4 },

                { PlantButton, 3 },
                { FloorButton, 9 },
                { DoorButton, 0 },
                { WindowButton, 1 },
                { RoofButton, 6 },
                { HandButton, 28 },
            };

            TerrainButton.OnButtonClick   += ChangeCategory;
            WaterButton.OnButtonClick     += ChangeCategory;
            WallButton.OnButtonClick      += ChangeCategory;
            WallpaperButton.OnButtonClick += ChangeCategory;
            StairButton.OnButtonClick     += ChangeCategory;
            FireplaceButton.OnButtonClick += ChangeCategory;

            PlantButton.OnButtonClick  += ChangeCategory;
            FloorButton.OnButtonClick  += ChangeCategory;
            DoorButton.OnButtonClick   += ChangeCategory;
            WindowButton.OnButtonClick += ChangeCategory;
            RoofButton.OnButtonClick   += ChangeCategory;
            HandButton.OnButtonClick   += ChangeCategory;

            PreviousPageButton.OnButtonClick += PreviousPage;
            NextPageButton.OnButtonClick     += NextPage;
            SubtoolsSlider.MinValue           = 0;
            SubtoolsSlider.OnChange          += PageSlider;

            Holder.OnPickup  += HolderPickup;
            Holder.OnDelete  += HolderDelete;
            Holder.OnPutDown += HolderPutDown;
            Add(QueryPanel);

            RoofSteepBtn   = new UIButton(GetTexture(0x4C200000001));
            RoofSteepBtn.X = 46;
            RoofSteepBtn.Y = 6;
            Add(RoofSteepBtn);
            RoofShallowBtn   = new UIButton(GetTexture(0x4C700000001));
            RoofShallowBtn.X = 46;
            RoofShallowBtn.Y = 92;
            Add(RoofShallowBtn);


            RoofSlider               = new UISlider();
            RoofSlider.Orientation   = 1;
            RoofSlider.Texture       = GetTexture(0x4AB00000001);
            RoofSlider.MinValue      = 0f;
            RoofSlider.MaxValue      = 1.25f;
            RoofSlider.AllowDecimals = true;
            RoofSlider.AttachButtons(RoofSteepBtn, RoofShallowBtn, 1);
            RoofSlider.X         = 48;
            RoofSlider.Y         = 24;
            RoofSlider.OnChange += (elem) =>
            {
                if (RoofSlider.Value != (1.25f - LotController.vm.Context.Architecture.RoofPitch))
                {
                    LotController.vm.Context.Blueprint.RoofComp.SetStylePitch(
                        LotController.vm.Context.Architecture.RoofStyle,
                        (1.25f - RoofSlider.Value)
                        );
                    SendRoofValue = true;
                }
            };
            RoofSlider.SetSize(0, 64f);
            Add(RoofSlider);

            RoofSteepBtn.Visible   = false;
            RoofShallowBtn.Visible = false;
            RoofSlider.Visible     = false;
        }
示例#23
0
        public void InitTestLot(string path, bool host)
        {
            if (Connecting) return;

            if (vm != null) CleanupLastWorld();

            World = new LotView.World(GameFacade.Game.GraphicsDevice);
            GameFacade.Scenes.Add(World);

            VMNetDriver driver;
            if (host)
            {
                driver = new VMServerDriver(37564);
            }
            else
            {
                Connecting = true;
                ConnectingDialog = new UILoginProgress();

                ConnectingDialog.Caption = GameFacade.Strings.GetString("211", "1");
                ConnectingDialog.ProgressCaption = GameFacade.Strings.GetString("211", "24");
                //this.Add(ConnectingDialog);

                UIScreen.ShowDialog(ConnectingDialog, true);

                driver = new VMClientDriver(path, 37564, ClientStateChange);
            }

            vm = new VM(new VMContext(World), driver);
            vm.Init();

            if (host)
            {
                vm.SendCommand(new VMBlueprintRestoreCmd
                {
                    XMLData = File.ReadAllBytes(path)
                });
            }

            uint simID = (uint)(new Random()).Next();

            vm.SendCommand(new VMNetSimJoinCmd
            {
                SimID = simID,
                HeadID = GlobalSettings.Default.DebugHead,
                BodyID = GlobalSettings.Default.DebugBody,
                SkinTone = (byte)GlobalSettings.Default.DebugSkin,
                Gender = !GlobalSettings.Default.DebugGender,
                Name = GlobalSettings.Default.LastUser
            });

            LotController = new UILotControl(vm, World);
            LotController.SelectedSimID = simID;
            this.AddAt(0, LotController);

            vm.Context.Clock.Hours = 8;
            if (m_ZoomLevel > 3)
            {
                World.Visible = false;
                LotController.Visible = false;
            }

            if (host)
            {
                ZoomLevel = 1;
                ucp.SetInLot(true);
            } else
            {
                ZoomLevel = Math.Max(ZoomLevel, 4);
            }

            vm.OnFullRefresh += VMRefreshed;
        }
示例#24
0
        public UIBuyMode(UILotControl lotController)
        {
            LotController = lotController;
            Holder        = LotController.ObjectHolder;
            QueryPanel    = LotController.QueryPanel;

            var script = this.RenderScript("buypanel" + ((GlobalSettings.Default.GraphicsWidth < 1024)?"":"1024") + ".uis");

            Background   = new UIImage(GetTexture((GlobalSettings.Default.GraphicsWidth < 1024) ? (ulong)0x000000D800000002 : (ulong)0x0000018300000002));
            Background.Y = 0;
            Background.BlockInput();
            this.AddAt(0, Background);

            CatBg          = new UIImage(catalogBackground);
            CatBg.Position = new Microsoft.Xna.Framework.Vector2(250, 5);
            this.AddAt(1, CatBg);

            InventoryCatBg          = new UIImage(inventoryRoommateBackground);
            InventoryCatBg.Position = new Microsoft.Xna.Framework.Vector2(250, 5);
            this.AddAt(2, InventoryCatBg);

            NonRMInventoryCatBg          = new UIImage(inventoryVisitorBackground);
            NonRMInventoryCatBg.Position = new Microsoft.Xna.Framework.Vector2(68, 5);
            this.AddAt(3, InventoryCatBg);

            Catalog = new UICatalog((GlobalSettings.Default.GraphicsWidth < 1024) ? 14 : 24);
            Catalog.OnSelectionChange += new CatalogSelectionChangeDelegate(Catalog_OnSelectionChange);
            Catalog.Position           = new Microsoft.Xna.Framework.Vector2(275, 7);
            this.Add(Catalog);

            CategoryMap = new Dictionary <UIButton, int>
            {
                { SeatingButton, 12 },
                { SurfacesButton, 13 },
                { AppliancesButton, 14 },
                { ElectronicsButton, 15 },
                { SkillButton, 16 },
                { DecorativeButton, 17 },
                { MiscButton, 18 },
                { LightingButton, 19 },
                { PetsButton, 20 },
            };

            SeatingButton.OnButtonClick         += ChangeCategory;
            SurfacesButton.OnButtonClick        += ChangeCategory;
            DecorativeButton.OnButtonClick      += ChangeCategory;
            ElectronicsButton.OnButtonClick     += ChangeCategory;
            AppliancesButton.OnButtonClick      += ChangeCategory;
            SkillButton.OnButtonClick           += ChangeCategory;
            LightingButton.OnButtonClick        += ChangeCategory;
            MiscButton.OnButtonClick            += ChangeCategory;
            PetsButton.OnButtonClick            += ChangeCategory;
            MapBuildingModeButton.OnButtonClick += ChangeCategory;

            ProductCatalogPreviousPageButton.OnButtonClick           += PreviousPage;
            InventoryCatalogRoommatePreviousPageButton.OnButtonClick += PreviousPage;
            InventoryCatalogVisitorPreviousPageButton.OnButtonClick  += PreviousPage;

            ProductCatalogNextPageButton.OnButtonClick           += NextPage;
            InventoryCatalogRoommateNextPageButton.OnButtonClick += NextPage;
            InventoryCatalogVisitorNextPageButton.OnButtonClick  += NextPage;

            ProductCatalogSlider.MinValue           = 0;
            InventoryCatalogRoommateSlider.MinValue = 0;
            InventoryCatalogVisitorSlider.MinValue  = 0;

            ProductCatalogSlider.OnChange           += PageSlider;
            InventoryCatalogRoommateSlider.OnChange += PageSlider;
            InventoryCatalogVisitorSlider.OnChange  += PageSlider;

            SetMode(0);
            SetRoomCategories(false);

            Holder.OnPickup  += HolderPickup;
            Holder.OnDelete  += HolderDelete;
            Holder.OnPutDown += HolderPutDown;
        }
示例#25
0
        private bool Roommate = true; //if false, shows visitor inventory only.

        #endregion Fields

        #region Constructors

        public UIBuyMode(UILotControl lotController)
        {
            LotController = lotController;
            Holder = LotController.ObjectHolder;
            QueryPanel = LotController.QueryPanel;

            var useSmall = (FSOEnvironment.UIZoomFactor > 1f || GlobalSettings.Default.GraphicsWidth < 1024);
            var script = this.RenderScript("buypanel"+(useSmall?"":"1024")+".uis");

            Background = new UIImage(GetTexture(useSmall ? (ulong)0x000000D800000002 : (ulong)0x0000018300000002));
            Background.Y = 0;
            Background.BlockInput();
            this.AddAt(0, Background);

            CatBg = new UIImage(catalogBackground);
            CatBg.Position = new Microsoft.Xna.Framework.Vector2(250, 5);
            this.AddAt(1, CatBg);

            InventoryCatBg = new UIImage(inventoryRoommateBackground);
            InventoryCatBg.Position = new Microsoft.Xna.Framework.Vector2(250, 5);
            this.AddAt(2, InventoryCatBg);

            NonRMInventoryCatBg = new UIImage(inventoryVisitorBackground);
            NonRMInventoryCatBg.Position = new Microsoft.Xna.Framework.Vector2(68, 5);
            this.AddAt(3, InventoryCatBg);

            Catalog = new UICatalog(useSmall ? 14 : 24);
            Catalog.OnSelectionChange += new CatalogSelectionChangeDelegate(Catalog_OnSelectionChange);
            Catalog.Position = new Microsoft.Xna.Framework.Vector2(275, 7);
            this.Add(Catalog);

            CategoryMap = new Dictionary<UIButton, int>
            {
                { SeatingButton, 12 },
                { SurfacesButton, 13 },
                { AppliancesButton, 14 },
                { ElectronicsButton, 15 },
                { SkillButton, 16 },
                { DecorativeButton, 17 },
                { MiscButton, 18 },
                { LightingButton, 19 },
                { PetsButton, 20 },
            };

            SeatingButton.OnButtonClick += ChangeCategory;
            SurfacesButton.OnButtonClick += ChangeCategory;
            DecorativeButton.OnButtonClick += ChangeCategory;
            ElectronicsButton.OnButtonClick += ChangeCategory;
            AppliancesButton.OnButtonClick += ChangeCategory;
            SkillButton.OnButtonClick += ChangeCategory;
            LightingButton.OnButtonClick += ChangeCategory;
            MiscButton.OnButtonClick += ChangeCategory;
            PetsButton.OnButtonClick += ChangeCategory;
            MapBuildingModeButton.OnButtonClick += ChangeCategory;

            ProductCatalogPreviousPageButton.OnButtonClick += PreviousPage;
            InventoryCatalogRoommatePreviousPageButton.OnButtonClick += PreviousPage;
            InventoryCatalogVisitorPreviousPageButton.OnButtonClick += PreviousPage;

            ProductCatalogNextPageButton.OnButtonClick += NextPage;
            InventoryCatalogRoommateNextPageButton.OnButtonClick += NextPage;
            InventoryCatalogVisitorNextPageButton.OnButtonClick += NextPage;

            ProductCatalogSlider.MinValue = 0;
            InventoryCatalogRoommateSlider.MinValue = 0;
            InventoryCatalogVisitorSlider.MinValue = 0;

            ProductCatalogSlider.OnChange += PageSlider;
            InventoryCatalogRoommateSlider.OnChange += PageSlider;
            InventoryCatalogVisitorSlider.OnChange += PageSlider;

            SetMode(0);
            SetRoomCategories(false);

            Holder.OnPickup += HolderPickup;
            Holder.OnDelete += HolderDelete;
            Holder.OnPutDown += HolderPutDown;
            Add(QueryPanel);
        }
示例#26
0
        public UIPieMenu(List <VMPieMenuInteraction> pie, VMEntity obj, VMEntity caller, UILotControl parent)
        {
            if (FSOEnvironment.UIZoomFactor > 1.33f)
            {
                ScaleX = ScaleY = FSOEnvironment.UIZoomFactor * 0.75f;
            }
            TrueScale        = ScaleX * FSOEnvironment.DPIScaleFactor;
            m_PieButtons     = new List <UIButton>();
            this.m_Obj       = obj;
            this.m_Caller    = caller;
            this.m_Parent    = parent;
            this.ButtonStyle = new TextStyle
            {
                Font          = GameFacade.MainFont,
                VFont         = GameFacade.VectorFont,
                Size          = 12,
                Color         = new Color(0xA5, 0xC3, 0xD6),
                SelectedColor = new Color(0x00, 0xFF, 0xFF),
                CursorColor   = new Color(255, 255, 255)
            };

            HighlightStyle       = ButtonStyle.Clone();
            HighlightStyle.Color = Color.Yellow;

            lerpSpeed = 0.125f * (60.0f / FSOEnvironment.RefreshRate);
            m_Bg      = new UIImage(TextureGenerator.GetPieBG(GameFacade.GraphicsDevice));
            m_Bg.SetSize(0, 0); //is scaled up later
            this.AddAt(0, m_Bg);

            m_PieTree = new UIPieMenuItem()
            {
                Category = true
            };

            for (int i = 0; i < pie.Count; i++)
            {
                string[] depth = (pie[i].Name == null)?new string[] { "???" } :pie[i].Name.Split('/');

                var category = m_PieTree;                  //set category to root
                for (int j = 0; j < depth.Length - 1; j++) //iterate through categories
                {
                    if (category.ChildrenByName.ContainsKey(depth[j]))
                    {
                        category = category.ChildrenByName[depth[j]];
                    }
                    else
                    {
                        var newCat = new UIPieMenuItem()
                        {
                            Category = true,
                            Name     = depth[j],
                            Parent   = category
                        };
                        category.Children.Add(newCat);
                        category.ChildrenByName[depth[j]] = newCat;
                        category = newCat;
                    }
                }
                //we are in the category, put the interaction in here;

                var name     = depth[depth.Length - 1];
                var semiInd  = name.LastIndexOf(';');
                int colorMod = 0;
                if (semiInd > -1)
                {
                    int.TryParse(name.Substring(semiInd + 1), out colorMod);
                    name = name.Substring(0, semiInd);
                }

                var item = new UIPieMenuItem()
                {
                    Category = false,
                    Name     = name,
                    ColorMod = colorMod,
                    ID       = pie[i].ID,
                    Param0   = pie[i].Param0,
                    Global   = pie[i].Global
                };
                category.Children.Add(item);
                category.ChildrenByName[item.Name] = item;
            }

            m_CurrentItem = m_PieTree;
            m_PieButtons  = new List <UIButton>();
            RenderMenu();

            VMAvatar Avatar = (VMAvatar)caller;

            m_Head = new SimAvatar(Avatar.Avatar); //talk about confusing...
            m_Head.StripAllButHead();

            initSimHead();
        }
示例#27
0
        public UIPieMenu(List<VMPieMenuInteraction> pie, VMEntity obj, VMEntity caller, UILotControl parent)
        {
            if (FSOEnvironment.UIZoomFactor>1.33f) ScaleX = ScaleY = FSOEnvironment.UIZoomFactor*0.75f;
            TrueScale = ScaleX *FSOEnvironment.DPIScaleFactor;
            m_PieButtons = new List<UIButton>();
            this.m_Obj = obj;
            this.m_Caller = caller;
            this.m_Parent = parent;
            this.ButtonStyle = new TextStyle
            {
                Font = GameFacade.MainFont,
                Size = 12,
                Color = new Color(0xA5, 0xC3, 0xD6),
                SelectedColor = new Color(0x00, 0xFF, 0xFF),
                CursorColor = new Color(255, 255, 255)
            };

            m_Bg = new UIImage(TextureGenerator.GetPieBG(GameFacade.GraphicsDevice));
            m_Bg.SetSize(0, 0); //is scaled up later
            this.AddAt(0, m_Bg);

            m_PieTree = new UIPieMenuItem()
            {
                Category = true
            };

            for (int i = 0; i < pie.Count; i++)
            {
                string[] depth = (pie[i].Name == null)?new string[] { "???" } :pie[i].Name.Split('/');

                var category = m_PieTree; //set category to root
                for (int j = 0; j < depth.Length-1; j++) //iterate through categories
                {
                    if (category.Children.ContainsKey(depth[j]))
                    {
                        category = category.Children[depth[j]];
                    }
                    else
                    {
                        var newCat = new UIPieMenuItem()
                        {
                            Category = true,
                            Name = depth[j],
                            Parent = category
                        };
                        category.Children.Add(depth[j], newCat);
                        category = newCat;
                    }
                }
                //we are in the category, put the interaction in here;

                var item = new UIPieMenuItem()
                {
                    Category = false,
                    Name = depth[depth.Length - 1],
                    ID = pie[i].ID,
                    Param0 = pie[i].Param0
                };
                if (!category.Children.ContainsKey(item.Name)) category.Children.Add(item.Name, item);
            }

            m_CurrentItem = m_PieTree;
            m_PieButtons = new List<UIButton>();
            RenderMenu();

            VMAvatar Avatar = (VMAvatar)caller;
            m_Head = new SimAvatar(Avatar.Avatar); //talk about confusing...
            m_Head.StripAllButHead();

            initSimHead();
        }
示例#28
0
        public UIBuildableAreaPanel(UILotControl lotController)
        {
            var script = RenderScript("buildableareapanel.uis");

            BuildableAreaBackground = script.Create <UIImage>("BuildableAreaBackground");
            AddAt(0, BuildableAreaBackground);

            Labels = new List <UILabel>()
            {
                LotSizeLabel,
                TilesLabel,
                UpgradeCostLabel,
                lackofRoomateLabel,
                TotalCostLabel,
                RoommatesLabel,
                SizeLevelLabel
            };

            foreach (var label in Labels)
            {
                label.Alignment           = TextAlignment.Left;
                label.CaptionStyle        = label.CaptionStyle.Clone();
                label.CaptionStyle.Shadow = true;
                label.Y -= 6;
                label.X += 3;
                SavedInitialText.Add(label.Caption.Replace("%d", "%s"));
            }
            LotControl = lotController;

            LargerButton.OnButtonClick  += (btn) => { UpdateSizeTarget++; UpdateCost(); };
            SmallerButton.OnButtonClick += (btn) => { UpdateSizeTarget--; UpdateCost(); };
            AcceptButton.OnButtonClick  += PurchaseLotSize;

            FloorsLargerButton                = script.Create <UIButton>("LargerButton");
            FloorsLargerButton.Y             += 39;
            FloorsLargerButton.OnButtonClick += (btn) => { UpdateFloorsTarget++; UpdateCost(); };
            Add(FloorsLargerButton);
            FloorsSmallerButton                = script.Create <UIButton>("SmallerButton");
            FloorsSmallerButton.Y             += 39;
            FloorsSmallerButton.OnButtonClick += (btn) => { UpdateFloorsTarget--; UpdateCost(); };
            Add(FloorsSmallerButton);

            var sizeLabel = new UILabel();

            sizeLabel.CaptionStyle        = sizeLabel.CaptionStyle.Clone();
            sizeLabel.CaptionStyle.Shadow = true;
            sizeLabel.CaptionStyle.Size   = 6;
            sizeLabel.Position            = new Vector2(LargerButton.X + 3, LargerButton.Y + 11);
            sizeLabel.Size      = new Vector2(45, 0);
            sizeLabel.Alignment = TextAlignment.Center;
            sizeLabel.Caption   = "Size";
            Add(sizeLabel);

            var floorsLabel = new UILabel
            {
                CaptionStyle = sizeLabel.CaptionStyle.Clone()
            };

            floorsLabel.CaptionStyle.Shadow = true;
            floorsLabel.CaptionStyle.Size   = 6;
            floorsLabel.Position            = new Vector2(FloorsLargerButton.X + 3, FloorsLargerButton.Y + 11);
            floorsLabel.Size      = new Vector2(45, 0);
            floorsLabel.Alignment = TextAlignment.Center;
            floorsLabel.Caption   = "Floors";
            Add(floorsLabel);

            SizeLevelLabel.X        -= 19;
            SizeLevelLabel.Alignment = TextAlignment.Center;
            SizeLevelLabel.Size      = new Vector2(41, 1);

            PreviewTarget = new RenderTarget2D(GameFacade.GraphicsDevice, 72, 72, false, SurfaceFormat.Color, DepthFormat.None,
                                               GlobalSettings.Default.AntiAlias ? 4 : 0, RenderTargetUsage.PreserveContents);
            Batch = new SpriteBatch(GameFacade.GraphicsDevice);

            PreviewImage = new UIImage(PreviewTarget)
            {
                Position = BuildableAreaBackground.Position + new Vector2(2)
            };
            Add(PreviewImage);

            UpdateCost();

            if (lotController.vm.TSOState.OwnerID != lotController.vm.MyUID)
            {
                LargerButton.Disabled        = true;
                SmallerButton.Disabled       = true;
                FloorsLargerButton.Disabled  = true;
                FloorsSmallerButton.Disabled = true;
                AcceptButton.Disabled        = true;
            }
        }
示例#29
0
        public UIBuildMode(UILotControl lotController)
        {
            LotController = lotController;
            Holder        = LotController.ObjectHolder;
            QueryPanel    = LotController.QueryPanel;

            var script = this.RenderScript("buildpanel" + ((GlobalSettings.Default.GraphicsWidth < 1024) ? "" : "1024") + ".uis");

            Background   = new UIImage(GetTexture((GlobalSettings.Default.GraphicsWidth < 1024) ? (ulong)0x000000D800000002 : (ulong)0x0000018300000002));
            Background.Y = 0;
            Background.BlockInput();
            this.AddAt(0, Background);

            Divider          = new UIImage(dividerImage);
            Divider.Position = new Vector2(337, 14);
            this.AddAt(1, Divider);

            SubToolBg          = new UIImage(subtoolsBackground);
            SubToolBg.Position = new Vector2(336, 5);
            this.AddAt(2, SubToolBg);

            Catalog = new UICatalog((GlobalSettings.Default.GraphicsWidth < 1024) ? 10 : 20);
            Catalog.OnSelectionChange += new CatalogSelectionChangeDelegate(Catalog_OnSelectionChange);
            Catalog.Position           = new Vector2(364, 7);
            this.Add(Catalog);

            CategoryMap = new Dictionary <UIButton, int>
            {
                { TerrainButton, 29 },
                { WaterButton, 5 },
                { WallButton, 7 },
                { WallpaperButton, 8 },
                { StairButton, 2 },
                { FireplaceButton, 4 },

                { PlantButton, 3 },
                { FloorButton, 9 },
                { DoorButton, 0 },
                { WindowButton, 1 },
                { RoofButton, 28 },
                { HandButton, 28 },
            };

            TerrainButton.OnButtonClick   += ChangeCategory;
            WaterButton.OnButtonClick     += ChangeCategory;
            WallButton.OnButtonClick      += ChangeCategory;
            WallpaperButton.OnButtonClick += ChangeCategory;
            StairButton.OnButtonClick     += ChangeCategory;
            FireplaceButton.OnButtonClick += ChangeCategory;

            PlantButton.OnButtonClick  += ChangeCategory;
            FloorButton.OnButtonClick  += ChangeCategory;
            DoorButton.OnButtonClick   += ChangeCategory;
            WindowButton.OnButtonClick += ChangeCategory;
            RoofButton.OnButtonClick   += ChangeCategory;
            HandButton.OnButtonClick   += ChangeCategory;

            PreviousPageButton.OnButtonClick += PreviousPage;
            NextPageButton.OnButtonClick     += NextPage;
            SubtoolsSlider.MinValue           = 0;
            SubtoolsSlider.OnChange          += PageSlider;

            Holder.OnPickup  += HolderPickup;
            Holder.OnDelete  += HolderDelete;
            Holder.OnPutDown += HolderPutDown;
        }
示例#30
0
        public UISoundsPanel(UILotControl lotController)
        {
            var script = this.RenderScript("soundspanel.uis");

            Background = new UIImage(BackgroundImage);
            AddAt(0, Background);

            AnimalsTab    = script.Create <UIImage>("AnimalsTab");
            MechanicalTab = script.Create <UIImage>("MechanicalTab");
            WeatherTab    = script.Create <UIImage>("WeatherTab");
            PeopleTab     = script.Create <UIImage>("PeopleTab");
            LoopsTab      = script.Create <UIImage>("LoopsTab");
            ThemesTab     = script.Create <UIImage>("ThemesTab");

            TabImages = new UIImage[]
            {
                AnimalsTab, MechanicalTab, WeatherTab, PeopleTab, LoopsTab, ThemesTab
            };
            TabButtons = new UIButton[]
            {
                AnimalsTabButton, MechanicalTabButton, WeatherTabButtton, PeopleTabButton, LoopsTabButtton, ThemesTabButton
            };

            for (int i = 0; i < 6; i++)
            {
                var tabId = i;
                TabButtons[i].OnButtonClick += (btn) => { SetTab(tabId); };
            }

            CheckButtons = new UIButton[]
            {
                CheckButton1, CheckButton2, CheckButton3, CheckButton4, CheckButton5, CheckButton6
            };
            RadioButtons = new UIButton[]
            {
                RadioButton1, RadioButton2, RadioButton3, RadioButton4, RadioButton5, RadioButton6,
            };
            ItemLabels = new UILabel[]
            {
                Label1, Label2, Label3, Label4, label5, Label6
            };

            foreach (var img in TabImages)
            {
                AddAt(1, img);
            }
            foreach (var item in ItemLabels)
            {
                item.Alignment           = TextAlignment.Left;
                item.X                  += 3;
                item.CaptionStyle        = item.CaptionStyle.Clone();
                item.CaptionStyle.Shadow = true;
            }
            var noPermission = (!lotController.vm.TSOState.BuildRoommates.Contains(lotController.vm.MyUID) && lotController.vm.TSOState.OwnerID != lotController.vm.MyUID);
            var j            = 0;

            foreach (var item in CheckButtons)
            {
                if (noPermission)
                {
                    item.Disabled = true;
                }
                var index = j++; item.OnButtonClick += (btn) => { SelectItem(item, index, false); };
            }
            j = 0;
            foreach (var item in RadioButtons)
            {
                if (noPermission)
                {
                    item.Disabled = true;
                }
                var index = j++; item.OnButtonClick += (btn) => { SelectItem(item, index, true); };
            }
            Script     = script;
            LotControl = lotController;
            SetTab(0);

            ScrollLeftButton.OnButtonClick  += (btn) => { SetPage(CurrentPage - 1); };
            ScrollRightButton.OnButtonClick += (btn) => { SetPage(CurrentPage + 1); };
        }
示例#31
0
        public UILiveMode(UILotControl lotController)
        {
            Small800 = (GlobalSettings.Default.GraphicsWidth < 1024) || FSOEnvironment.UIZoomFactor > 1f;
            var script = this.RenderScript("livepanel" + (Small800?"":"1024") + ".uis");

            EODLayout     = new UIEODLayout(script);
            Script        = script;
            LotController = lotController;

            DefaultBGImage = GetTexture(Small800 ? (ulong)0x000000D800000002 : (ulong)0x0000018300000002);
            Background     = new UIImage(DefaultBGImage);
            Background.Y   = 35;
            this.AddAt(0, Background);

            EODCloseButton.OnButtonClick += EODCloseButton_OnButtonClick;

            MotivesLabel.CaptionStyle        = MotivesLabel.CaptionStyle.Clone();
            MotivesLabel.CaptionStyle.Shadow = true;
            MotivesLabel.Alignment           = TextAlignment.Left;
            MotivesLabel.Position           -= new Vector2(0, 5);

            PeopleListBg          = new UIImage(PeopleListBackgroundImg);
            PeopleListBg.Position = new Microsoft.Xna.Framework.Vector2(375, 38);
            this.AddAt(1, PeopleListBg);

            Divider          = new UIImage(DividerImg);
            Divider.Position = new Microsoft.Xna.Framework.Vector2(140, 49);
            this.AddAt(1, Divider);

            MoodPanelButton = new UIButton();

            MoodPanelButton.Texture     = GetTexture((ulong)GameContent.FileIDs.UIFileIDs.lpanel_moodpanelbtn);
            MoodPanelButton.ImageStates = 4;
            MoodPanelButton.Position    = new Vector2(31, 63);
            this.Add(MoodPanelButton);

            MotiveDisplay          = new UIMotiveDisplay();
            MotiveDisplay.Position = new Vector2(165, 56);
            this.Add(MotiveDisplay);
            DynamicOverlay.Add(MotiveDisplay);

            PersonGrid = new UIPersonGrid(LotController.vm);
            Add(PersonGrid);
            PersonGrid.Position = new Vector2(409, 51);
            if (Small800)
            {
                PersonGrid.Columns = 4;
                PersonGrid.DrawPage();
            }

            EODPanel           = new UIImage(EODPanelImg);
            EODPanelTall       = new UIImage(EODPanelTallImg);
            EODDoublePanelTall = new UIImage(EODDoublePanelTallImg);

            Size = new Vector2(Background.Size.X, EODPanelTall.Size.Y);

            AddAt(0, EODDoublePanelTall);
            AddAt(0, EODPanel);
            AddAt(0, EODPanelTall);


            EODButtonLayout = new UIImage();
            EODSub          = new UIImage();
            EODExpandBack   = Script.Create <UIImage>("EODExpandBack");

            Add(EODButtonLayout);
            Add(EODSub);
            Add(EODExpandBack);

            EODTopSub          = new UIImage();
            EODTopButtonLayout = new UIImage();
            Add(EODTopButtonLayout);
            Add(EODTopSub);


            StatusBarMsgWinStraight = script.Create <UIImage>("StatusBarMsgWinStraight");
            StatusBarTimerStraight  = script.Create <UIImage>("StatusBarTimerStraight");
            StatusBarTimerBreakIcon = script.Create <UIImage>("StatusBarTimerBreakIcon");
            StatusBarTimerWorkIcon  = script.Create <UIImage>("StatusBarTimerWorkIcon");

            StatusBarTimerStraight.X  -= 1;
            StatusBarTimerStraight.Y  += 2;
            StatusBarTimerBreakIcon.Y += 2;
            StatusBarTimerWorkIcon.Y  += 2;
            StatusBarTimerTextEntry.Y += 2;
            StatusBarTimerTextEntry.X += 3;
            StatusBarMsgWinStraight.Y += 2;

            AddAt(0, StatusBarTimerBreakIcon);
            AddAt(0, StatusBarTimerWorkIcon);
            AddAt(0, StatusBarTimerStraight);
            AddAt(0, StatusBarMsgWinStraight);

            StatusBarMsgWinStraight.Visible  = false;
            StatusBarTimerStraight.Visible   = false;
            StatusBarTimerBreakIcon.Visible  = false;
            StatusBarTimerWorkIcon.Visible   = false;
            StatusBarTimerTextEntry.Visible  = false;
            StatusBarMsgWinTextEntry.Visible = false;

            EODMsgWin = new UIImage();
            EODTimer  = script.Create <UIImage>("EODTimer");

            AddAt(0, EODTimer);
            AddAt(0, EODMsgWin);

            EODButton = new UIButton(EODButtonImg);
            Add(EODButton);
            EODButton.OnButtonClick += EODToggle;
            EODImage = script.Create <UIImage>("EODButtonImageSize");
            Add(EODImage);

            Add(EODExpandButton);
            Add(EODContractButton);

            EODExpandButton.OnButtonClick   += EODExpandToggle;
            EODContractButton.OnButtonClick += EODExpandToggle;

            NextPageButton.OnButtonClick     += (UIElement btn) => { PersonGrid.NextPage(); };
            DefaultNextPagePos                = NextPageButton.Position;
            PreviousPageButton.OnButtonClick += (UIElement btn) => { PersonGrid.PreviousPage(); };

            MsgWinTextEntry.Items.Add(new UIListBoxItem("", ""));

            SetInEOD(null, null);
        }
示例#32
0
        public UIBuyMode(UILotControl lotController)
        {
            LotController = lotController;
            Holder        = LotController.ObjectHolder;

            var useSmall = (FSOEnvironment.UIZoomFactor > 1f || GlobalSettings.Default.GraphicsWidth < 1024);

            UseSmall = useSmall;
            var script = this.RenderScript("buypanel" + (useSmall?"":"1024") + ".uis");

            Background   = new UIImage(GetTexture(useSmall ? (ulong)0x000000D800000002 : (ulong)0x0000018300000002));
            Background.Y = 0;
            Background.BlockInput();
            this.AddAt(0, Background);
            Size = Background.Size.ToVector2();

            InventoryButtonBackgroundImage = script.Create <UIImage>("InventoryButtonBackgroundImage");
            this.AddAt(1, InventoryButtonBackgroundImage);

            CatBg = script.Create <UIImage>("ProductCatalogImage");
            this.AddAt(2, CatBg);

            InventoryCatBg = script.Create <UIImage>("InventoryCatalogRoommateImage");
            this.AddAt(3, InventoryCatBg);

            NonRMInventoryCatBg = script.Create <UIImage>("InventoryCatalogVisitorImage");
            this.AddAt(4, NonRMInventoryCatBg);

            InventoryCatalogVisitorIcon = script.Create <UIImage>("InventoryCatalogVisitorIcon");
            this.AddAt(5, InventoryCatalogVisitorIcon);

            Catalog                    = new UICatalog(useSmall ? 14 : 24);
            Catalog.LotControl         = lotController;
            Catalog.OnSelectionChange += new CatalogSelectionChangeDelegate(Catalog_OnSelectionChange);
            Catalog.Position           = new Microsoft.Xna.Framework.Vector2(275, 7);
            this.Add(Catalog);

            CategoryMap = new Dictionary <UIButton, int>
            {
                { SeatingButton, 12 },
                { SurfacesButton, 13 },
                { AppliancesButton, 14 },
                { ElectronicsButton, 15 },
                { SkillButton, 16 },
                { DecorativeButton, 17 },
                { MiscButton, 18 },
                { LightingButton, 19 },
                { PetsButton, 20 },
            };

            SeatingButton.OnButtonClick         += ChangeCategory;
            SurfacesButton.OnButtonClick        += ChangeCategory;
            DecorativeButton.OnButtonClick      += ChangeCategory;
            ElectronicsButton.OnButtonClick     += ChangeCategory;
            AppliancesButton.OnButtonClick      += ChangeCategory;
            SkillButton.OnButtonClick           += ChangeCategory;
            LightingButton.OnButtonClick        += ChangeCategory;
            MiscButton.OnButtonClick            += ChangeCategory;
            PetsButton.OnButtonClick            += ChangeCategory;
            MapBuildingModeButton.OnButtonClick += ChangeCategory;
            InventoryButton.OnButtonClick       += ChangeCategory;

            ProductCatalogPreviousPageButton.OnButtonClick           += PreviousPage;
            InventoryCatalogRoommatePreviousPageButton.OnButtonClick += PreviousPage;
            InventoryCatalogVisitorPreviousPageButton.OnButtonClick  += PreviousPage;

            ProductCatalogNextPageButton.OnButtonClick           += NextPage;
            InventoryCatalogRoommateNextPageButton.OnButtonClick += NextPage;
            InventoryCatalogVisitorNextPageButton.OnButtonClick  += NextPage;

            ProductCatalogSlider.MinValue           = 0;
            InventoryCatalogRoommateSlider.MinValue = 0;
            InventoryCatalogVisitorSlider.MinValue  = 0;

            ProductCatalogSlider.OnChange           += PageSlider;
            InventoryCatalogRoommateSlider.OnChange += PageSlider;
            InventoryCatalogVisitorSlider.OnChange  += PageSlider;

            SetMode(0);
            SetRoomCategories(false);

            Holder.OnPickup  += HolderPickup;
            Holder.OnDelete  += HolderDelete;
            Holder.OnPutDown += HolderPutDown;
            DynamicOverlay.Add(QueryPanel);

            ObjLimitLabel = new UILabel();
            ObjLimitLabel.CaptionStyle        = ObjLimitLabel.CaptionStyle.Clone();
            ObjLimitLabel.CaptionStyle.Shadow = true;
            ObjLimitLabel.CaptionStyle.Color  = Microsoft.Xna.Framework.Color.White;
            ObjLimitLabel.Caption             = "127/250 Objects";
            ObjLimitLabel.Y         = -20;
            ObjLimitLabel.X         = Background.Width / 2 - 100;
            ObjLimitLabel.Size      = new Microsoft.Xna.Framework.Vector2(200, 0);
            ObjLimitLabel.Alignment = TextAlignment.Center;
            DynamicOverlay.Add(ObjLimitLabel);
        }
示例#33
0
        public UILiveMode(UILotControl lotController)
        {
            var small800 = (GlobalSettings.Default.GraphicsWidth < 1024) || FSOEnvironment.UIZoomFactor > 1f;
            var script = this.RenderScript("livepanel"+(small800?"":"1024")+".uis");
            Script = script;
            LotController = lotController;

            DefaultBGImage = GetTexture(small800 ? (ulong)0x000000D800000002 : (ulong)0x0000018300000002);
            Background = new UIImage(DefaultBGImage);
            Background.Y = 35;
            this.AddAt(0, Background);

            EODCloseButton.OnButtonClick += EODCloseButton_OnButtonClick;

            MotivesLabel.CaptionStyle = MotivesLabel.CaptionStyle.Clone();
            MotivesLabel.CaptionStyle.Shadow = true;
            MotivesLabel.Alignment = TextAlignment.Left;
            MotivesLabel.Position -= new Vector2(0, 5);

            PeopleListBg = new UIImage(PeopleListBackgroundImg);
            PeopleListBg.Position = new Microsoft.Xna.Framework.Vector2(375, 38);
            this.AddAt(1, PeopleListBg);

            Divider = new UIImage(DividerImg);
            Divider.Position = new Microsoft.Xna.Framework.Vector2(140, 49);
            this.AddAt(1, Divider);

            MoodPanelButton = new UIButton();

            MoodPanelButton.Texture = GetTexture((ulong)GameContent.FileIDs.UIFileIDs.lpanel_moodpanelbtn);
            MoodPanelButton.ImageStates = 4;
            MoodPanelButton.Position = new Vector2(31, 63);
            this.Add(MoodPanelButton);

            MotiveDisplay = new UIMotiveDisplay();
            MotiveDisplay.Position = new Vector2(165, 56);
            this.Add(MotiveDisplay);

            PersonGrid = new UIPersonGrid(LotController.vm);
            Add(PersonGrid);
            PersonGrid.Position = new Vector2(409, 51);
            if (small800) {
                PersonGrid.Columns = 4;
                PersonGrid.DrawPage();
            }

            EODPanel = new UIImage(EODPanelImg);
            EODPanel.Y = 20;
            EODPanelTall = new UIImage(EODPanelTallImg);
            //EODDoublePanelTall = new UIImage(EODDoublePanelTallImg);

            AddAt(0, EODPanel);
            AddAt(0, EODPanelTall);
            //Add(EODDoublePanelTall);

            EODButtonLayoutNone = script.Create<UIImage>("EODButtonLayoutNone");
            EODButtonLayoutNoneTall = script.Create<UIImage>("EODButtonLayoutNoneTall");
            EODButtonLayoutOne = script.Create<UIImage>("EODButtonLayoutOne");
            EODButtonLayoutOneTall = script.Create<UIImage>("EODButtonLayoutOneTall");
            EODButtonLayoutTwo = script.Create<UIImage>("EODButtonLayoutTwo");
            EODButtonLayoutTwoTall = script.Create<UIImage>("EODButtonLayoutTwoTall");

            EODSubFullLength = script.Create<UIImage>("EODSubFullLength");
            EODSubFullLengthTall = script.Create<UIImage>("EODSubFullLengthTall");
            EODSubMediumLength = script.Create<UIImage>("EODSubMediumLength");
            EODSubMediumLengthTall = script.Create<UIImage>("EODSubMediumLengthTall");
            EODSubShortLength = script.Create<UIImage>("EODSubShortLength");
            EODSubShortLengthTall = script.Create<UIImage>("EODSubShortLengthTall");

            Add(EODButtonLayoutNone);
            Add(EODButtonLayoutNoneTall);
            Add(EODButtonLayoutOne);
            Add(EODButtonLayoutOneTall);
            Add(EODButtonLayoutTwo);
            Add(EODButtonLayoutTwoTall);

            Add(EODSubFullLength);
            Add(EODSubFullLengthTall);
            Add(EODSubMediumLength);
            Add(EODSubMediumLengthTall);
            Add(EODSubShortLength);
            Add(EODSubShortLengthTall);

            EODMsgWinLong = script.Create<UIImage>("EODMsgWinLong");
            EODMsgWinShort = script.Create<UIImage>("EODMsgWinShort");
            EODTimer = script.Create<UIImage>("EODTimer");

            AddAt(0, EODTimer);
            AddAt(0, EODMsgWinLong);
            AddAt(0, EODMsgWinShort);

            EODButton = new UIButton(EODButtonImg);
            Add(EODButton);
            EODButton.OnButtonClick += EODToggle;
            EODImage = script.Create<UIImage>("EODButtonImageSize");
            Add(EODImage);

            NextPageButton.OnButtonClick += (UIElement btn) => { PersonGrid.NextPage(); };
            DefaultNextPagePos = NextPageButton.Position;
            PreviousPageButton.OnButtonClick += (UIElement btn) => { PersonGrid.PreviousPage(); };

            MsgWinTextEntry.Items.Add(new UIListBoxItem("", ""));

            EODCloseBase = EODCloseButton.Position;
            EODHelpBase = EODHelpButton.Position;
            SetInEOD(null, null);
        }
示例#34
0
        public UIPieMenu(List <VMPieMenuInteraction> pie, VMEntity obj, VMEntity caller, UILotControl parent)
        {
            if (FSOEnvironment.UIZoomFactor > 1.33f)
            {
                ScaleX = ScaleY = FSOEnvironment.UIZoomFactor * 0.75f;
            }
            TrueScale        = ScaleX * FSOEnvironment.DPIScaleFactor;
            m_PieButtons     = new List <UIButton>();
            this.m_Obj       = obj;
            this.m_Caller    = caller;
            this.m_Parent    = parent;
            this.ButtonStyle = new TextStyle
            {
                Font          = GameFacade.MainFont,
                Size          = 12,
                Color         = new Color(0xA5, 0xC3, 0xD6),
                SelectedColor = new Color(0x00, 0xFF, 0xFF),
                CursorColor   = new Color(255, 255, 255)
            };

            m_Bg = new UIImage(TextureGenerator.GetPieBG(GameFacade.GraphicsDevice));
            m_Bg.SetSize(0, 0); //is scaled up later
            this.AddAt(0, m_Bg);

            m_PieTree = new UIPieMenuItem()
            {
                Category = true
            };

            for (int i = 0; i < pie.Count; i++)
            {
                string[] depth = (pie[i].Name == null)?new string[] { "???" } :pie[i].Name.Split('/');

                var category = m_PieTree;                  //set category to root
                for (int j = 0; j < depth.Length - 1; j++) //iterate through categories
                {
                    if (category.Children.ContainsKey(depth[j]))
                    {
                        category = category.Children[depth[j]];
                    }
                    else
                    {
                        var newCat = new UIPieMenuItem()
                        {
                            Category = true,
                            Name     = depth[j],
                            Parent   = category
                        };
                        category.Children.Add(depth[j], newCat);
                        category = newCat;
                    }
                }
                //we are in the category, put the interaction in here;

                var item = new UIPieMenuItem()
                {
                    Category = false,
                    Name     = depth[depth.Length - 1],
                    ID       = pie[i].ID,
                    Param0   = pie[i].Param0
                };
                if (!category.Children.ContainsKey(item.Name))
                {
                    category.Children.Add(item.Name, item);
                }
            }

            m_CurrentItem = m_PieTree;
            m_PieButtons  = new List <UIButton>();
            RenderMenu();

            VMAvatar Avatar = (VMAvatar)caller;

            m_Head = new SimAvatar(Avatar.Avatar); //talk about confusing...
            m_Head.StripAllButHead();

            initSimHead();
        }
示例#35
0
 public UITimeOfDayPanel(UILotControl lotController)
 {
     this.RenderScript("timeofdaypanel.uis");
 }
示例#36
0
 public UIObjectHolder(VM vm, LotView.World World, UILotControl parent)
 {
     this.vm = vm;
     this.World = World;
     ParentControl = parent;
 }
示例#37
0
 public UILightingPanel(UILotControl lotController)
 {
     this.RenderScript("lightingpanel.uis");
 }
示例#38
0
 public UIObjectHolder(VM vm, LotView.World World, UILotControl parent)
 {
     this.vm = vm;
     this.World = World;
     ParentControl = parent;
 }
示例#39
0
        public UIBuildMode(UILotControl lotController)
        {
            LotController = lotController;
            Holder = LotController.ObjectHolder;
            QueryPanel = LotController.QueryPanel;

            var script = this.RenderScript("buildpanel" + ((GlobalSettings.Default.GraphicsWidth < 1024) ? "" : "1024") + ".uis");

            Background = new UIImage(GetTexture((GlobalSettings.Default.GraphicsWidth < 1024) ? (ulong)0x000000D800000002 : (ulong)0x0000018300000002));
            Background.Y = 0;
            Background.BlockInput();
            this.AddAt(0, Background);

            Divider = new UIImage(dividerImage);
            Divider.Position = new Vector2(337, 14);
            this.AddAt(1, Divider);

            SubToolBg = new UIImage(subtoolsBackground);
            SubToolBg.Position = new Vector2(336, 5);
            this.AddAt(2, SubToolBg);

            Catalog = new UICatalog((GlobalSettings.Default.GraphicsWidth < 1024) ? 10 : 20);
            Catalog.OnSelectionChange += new CatalogSelectionChangeDelegate(Catalog_OnSelectionChange);
            Catalog.Position = new Vector2(364, 7);
            this.Add(Catalog);

            CategoryMap = new Dictionary<UIButton, int>
            {
                { TerrainButton, 28 },
                { WaterButton, 5 },
                { WallButton, 7 },
                { WallpaperButton, 8 },
                { StairButton, 2 },
                { FireplaceButton, 4 },

                { PlantButton, 3 },
                { FloorButton, 9 },
                { DoorButton, 0 },
                { WindowButton, 1 },
                { RoofButton, 28 },
                { HandButton, 28 },
            };

            TerrainButton.OnButtonClick += ChangeCategory;
            WaterButton.OnButtonClick += ChangeCategory;
            WallButton.OnButtonClick += ChangeCategory;
            WallpaperButton.OnButtonClick += ChangeCategory;
            StairButton.OnButtonClick += ChangeCategory;
            FireplaceButton.OnButtonClick += ChangeCategory;

            PlantButton.OnButtonClick += ChangeCategory;
            FloorButton.OnButtonClick += ChangeCategory;
            DoorButton.OnButtonClick += ChangeCategory;
            WindowButton.OnButtonClick += ChangeCategory;
            RoofButton.OnButtonClick += ChangeCategory;
            HandButton.OnButtonClick += ChangeCategory;

            PreviousPageButton.OnButtonClick += PreviousPage;
            NextPageButton.OnButtonClick += NextPage;
            SubtoolsSlider.MinValue = 0;
            SubtoolsSlider.OnChange += PageSlider;

            Holder.OnPickup += HolderPickup;
            Holder.OnDelete += HolderDelete;
            Holder.OnPutDown += HolderPutDown;
        }