DrawPage() public method

public DrawPage ( ) : void
return void
Ejemplo n.º 1
0
        public void SetInEOD(EODLiveModeOpt options, UIEOD eod)
        {
            bool eodPresent = (options != null);
            bool inEOD      = eodPresent && !HideEOD;

            if (ActiveEOD != null)
            {
                Remove(ActiveEOD);
            }

            LastEODConfig             = options;
            ActiveEOD                 = eod;
            EODHelpButton.Visible     = inEOD;
            EODCloseButton.Visible    = inEOD;
            EODExpandButton.Visible   = false; //todo
            EODContractButton.Visible = false;
            EODButton.Visible         = eodPresent;

            bool tall = inEOD && options.Height == EODHeight.Tall;

            EODPanel.Visible     = inEOD && !tall;
            EODPanelTall.Visible = inEOD && tall;

            EODButtonLayoutNone.Visible     = inEOD && !tall && options.Buttons == 0;
            EODButtonLayoutNoneTall.Visible = inEOD && tall && options.Buttons == 0;
            EODButtonLayoutOne.Visible      = inEOD && !tall && options.Buttons == 1;
            EODButtonLayoutOneTall.Visible  = inEOD && tall && options.Buttons == 1;
            EODButtonLayoutTwo.Visible      = inEOD && !tall && options.Buttons == 2;
            EODButtonLayoutTwoTall.Visible  = inEOD && tall && options.Buttons == 2;

            EODSubFullLength.Visible       = inEOD && !tall && options.Length == EODLength.Full;
            EODSubFullLengthTall.Visible   = inEOD && tall && options.Length == EODLength.Full;
            EODSubMediumLength.Visible     = inEOD && !tall && options.Length == EODLength.Medium;
            EODSubMediumLengthTall.Visible = inEOD && tall && options.Length == EODLength.Medium;
            EODSubShortLength.Visible      = inEOD && !tall && options.Length == EODLength.Short;
            EODSubShortLengthTall.Visible  = inEOD && tall && options.Length == EODLength.Short;

            EODMsgWinLong.Visible  = inEOD && options.Tips == EODTextTips.Long;
            EODMsgWinShort.Visible = inEOD && options.Tips == EODTextTips.Short;
            EODTimer.Visible       = inEOD && options.Timer == EODs.EODTimer.Normal;

            MsgWinTextEntry.Visible = inEOD && options.Tips != EODTextTips.None;
            TimerTextEntry.Visible  = inEOD && options.Timer != EODs.EODTimer.None;

            MoodPanelButton.Position = (eodPresent) ? new Vector2(20, 7) : new Vector2(31, 63);
            if (EODImage.Texture != null)
            {
                EODImage.Texture.Dispose();
            }
            EODImage.Texture = null;

            if (inEOD)
            {
                Add(ActiveEOD);
                ActiveEOD.Position = new Vector2(120, 0);
            }

            if (eodPresent)
            {
                Vector2 TopXOffset    = new Vector2();
                Vector2 MoodButtonOff = new Vector2();
                var     offHeight     = options.Height;
                if (HideEOD)
                {
                    offHeight = EODHeight.Normal;
                }
                switch (offHeight)
                {
                case EODHeight.Normal:
                    TopXOffset    = (Vector2)Script.GetControlProperty("EODActiveOffset");
                    MoodButtonOff = TopXOffset;
                    break;

                case EODHeight.Tall:
                    TopXOffset    = (Vector2)Script.GetControlProperty("EODActiveOffset");
                    MoodButtonOff = (Vector2)Script.GetControlProperty("EODActiveOffsetTall");
                    break;
                }
                MoodPanelButton.Position += MoodButtonOff;
                EODCloseButton.Position   = EODCloseBase + TopXOffset;
                EODHelpButton.Position    = EODHelpBase + MoodButtonOff;

                EODButton.Position = (Vector2)Script.GetControlProperty("EODButtonPosition") + MoodButtonOff;

                var ava = SelectedAvatar;
                if (ava != null)
                {
                    var blockInfo = ava.Thread.BlockingState;
                    if (blockInfo is VMEODPluginThreadState)
                    {
                        var eodInfo = (VMEODPluginThreadState)blockInfo;
                        var entity  = LotController.vm.GetObjectById(eodInfo.ObjectID);
                        if (entity is VMGameObject)
                        {
                            var objects = entity.MultitileGroup.Objects;
                            ObjectComponent[] objComps = new ObjectComponent[objects.Count];
                            for (int i = 0; i < objects.Count; i++)
                            {
                                objComps[i] = (ObjectComponent)objects[i].WorldUI;
                            }
                            var thumb = LotController.World.GetObjectThumb(objComps, entity.MultitileGroup.GetBasePositions(), GameFacade.GraphicsDevice);

                            EODImage.Texture = thumb;
                        }
                    }
                }
                if (EODImage.Texture != null)
                {
                    var imgScale = 22f / Math.Max(EODImage.Texture.Width, EODImage.Texture.Height);
                    EODImage.SetSize(EODImage.Texture.Width * imgScale, EODImage.Texture.Height * imgScale);

                    EODImage.Position = EODButton.Position + new Vector2((EODButton.Texture.Width / 4 - EODImage.Width) / 2, (EODButton.Texture.Height - EODImage.Height) / 2);
                }
            }

            this.Y = (inEOD && options.Height == EODHeight.Tall) ? 41: 61;

            Divider.Visible            = !inEOD;
            MotiveDisplay.Visible      = !inEOD;
            PersonGrid.Visible         = !inEOD;
            MotivesLabel.Visible       = !inEOD;
            PeopleListBg.Visible       = !inEOD;
            PreviousPageButton.Visible = !inEOD;
            NextPageButton.Visible     = !inEOD;
            Background.Visible         = !inEOD;

            PersonGrid.Columns = (eodPresent || (GlobalSettings.Default.GraphicsWidth < 1024)) ?4:9;
            PersonGrid.DrawPage();
            PeopleListBg.Texture = (eodPresent && PeopleListEODBackgroundImg != null) ? PeopleListEODBackgroundImg : PeopleListBackgroundImg;
            PeopleListBg.SetSize(PeopleListBg.Texture.Width, PeopleListBg.Texture.Height);

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

            NextPageButton.Position = (eodPresent && !small800) ? (Vector2)Script.GetControlProperty("NextPageEODButton") : DefaultNextPagePos;
            Background.Texture      = (eodPresent) ? BackgroundEODImg : DefaultBGImage;
            Background.SetSize(Background.Texture.Width, Background.Texture.Height);

            UpdateThumbPosition();
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        public void SetInEOD(EODLiveModeOpt options, UIEOD eod)
        {
            Invalidate(); //i mean, duh
            bool eodPresent = (options != null);
            bool inEOD      = eodPresent && !HideEOD;

            if (ActiveEOD != null)
            {
                DynamicOverlay.Remove(ActiveEOD);
            }

            LastEODConfig = options;
            ActiveEOD     = eod;


            /**
             * Useful values
             */

            bool isTall       = inEOD && (options.Height == EODHeight.Tall || options.Height == EODHeight.TallTall);
            bool isDoubleTall = inEOD && options.Height == EODHeight.TallTall;
            bool isTrade      = inEOD && options.Height == EODHeight.Trade;


            /**
             * Reset / hide standard and eod UI
             */
            MoodPanelButton.Position = (eodPresent) ? EODLayout.Baseline + new Vector2(20, 7) : new Vector2(31, 63);
            EODButtonLayout.Visible  = inEOD;
            EODSub.Visible           = inEOD;
            EODMsgWin.Visible        = inEOD && options.Tips != EODTextTips.None;

            EODHelpButton.Visible     = inEOD;
            EODCloseButton.Visible    = inEOD;
            EODExpandButton.Visible   = inEOD && options.Expandable && !options.Expanded;
            EODContractButton.Visible = inEOD && options.Expandable && options.Expanded;
            EODExpandBack.Visible     = inEOD && options.Expandable;
            EODButton.Visible         = eodPresent;

            EODTopSub.Visible          = inEOD && options.Expandable && options.Expanded;
            EODTopButtonLayout.Visible = inEOD && options.Expandable && options.Expanded;

            EODPanel.Visible           = inEOD && !isTall && !isTrade;
            EODPanelTall.Visible       = inEOD && isTall;
            EODDoublePanelTall.Visible = inEOD && isDoubleTall && options.Expanded;

            EODTimer.Visible        = inEOD && options.Timer == EODs.EODTimer.Normal;
            MsgWinTextEntry.Visible = inEOD && options.Tips != EODTextTips.None;
            TimerTextEntry.Visible  = inEOD && options.Timer != EODs.EODTimer.None;

            //Cleanup
            if (EODImage.Texture != null)
            {
                EODImage.Texture.Dispose();
            }
            EODImage.Texture = null;

            //EOD Button
            EODButton.Selected = inEOD;
            EODButton.Position = EODLayout.EODButtonPosition;

            /**
             * Attach new EOD UI
             */
            if (inEOD)
            {
                DynamicOverlay.Add(ActiveEOD);
            }

            /**
             * Position / style EOD specific UI
             */
            if (eodPresent)
            {
                EODButtonLayout.Reset();
                EODSub.Reset();
                EODMsgWin.Reset();

                var buttons      = new string[] { "None", "One", "Two", "Three" }; // three doesn't work, but at least for now it won't be out of bounds array
                var buttonLayout = buttons[options.Buttons];
                Script.ApplyControlProperties(EODButtonLayout, "EODButtonLayout" + buttonLayout + EODLayout.GetHeightSuffix(options.Height, true));
                Script.ApplyControlProperties(EODSub, "EODSub" + options.Length + "Length" + EODLayout.GetHeightSuffix(options.Height, true));
                if (options.Length == EODLength.None)
                {
                    EODSub.Visible = false;
                }
                EODButtonLayout.Visible = EODSub.Visible;

                if (options.Tips != EODTextTips.None)
                {
                    Script.ApplyControlProperties(EODMsgWin, "EODMsgWin" + options.Tips.ToString());
                }

                var topLeft = EODLayout.GetTopLeft(options.Height);

                //EOD position
                ActiveEOD.Position = topLeft + (Vector2)Script.GetControlProperty(isTrade?"EODTradePosition":"EODPosition");

                //Close button
                EODCloseButton.Position = EODLayout.GetChromePosition("EODCloseButton", options.Height);

                //Help button
                EODHelpButton.Position = EODLayout.HelpButtonPosition;

                if (isTrade && !Small800)
                {
                    //place the close/help button at 1024x768 position
                    EODCloseButton.X += 224;
                    EODHelpButton.X  += 224;
                }

                //Chrome
                var chromeOffset = EODLayout.GetChromeOffset(options.Height);
                EODButtonLayout.Position += chromeOffset;
                EODSub.Position          += chromeOffset;

                //Message
                EODMsgWin.Position = EODLayout.GetMessageWindowPosition(options.Height, options.Tips, options.Expanded);
                EODMsgWin.BlockInput();
                MsgWinTextEntry.Position = EODLayout.GetMessageWindowTextPosition(options.Height, options.Expanded);

                //Timer
                EODTimer.Position = EODLayout.GetTimerPosition(options.Height, options.Expanded);
                EODTimer.BlockInput();
                EODTimer.Texture        = GetTexture(0x0000011300000002); // regular .\uigraphics\ucp\livepanel\eod_timerback.tga, changed for TallTall below
                TimerTextEntry.Position = EODLayout.GetTimerTextPosition(options.Height, options.Expanded);

                //Expand / contract
                EODExpandButton.Position   = EODLayout.GetExpandButtonPosition(options.Height);
                EODContractButton.Position = EODLayout.GetContractButtonPosition(options.Height);
                EODExpandBack.Position     = EODLayout.GetExpandBackPosition(options.Height);

                //backgrounds
                EODPanel.Position = EODLayout.GetPanelPosition(EODHeight.Normal);
                EODPanel.BlockInput();
                EODPanelTall.Position = EODLayout.GetPanelPosition(EODHeight.Tall);
                EODPanelTall.BlockInput();
                EODDoublePanelTall.Position = EODLayout.GetPanelPosition(EODHeight.TallTall);
                EODDoublePanelTall.BlockInput();

                if (isTrade)
                {
                    Size = new Vector2(BackgroundEODTradeImg.Width, BackgroundEODTradeImg.Height);
                }
                else
                {
                    Size = new Vector2(Background.Size.X, ((options.Height == EODHeight.TallTall && options.Expanded) ? (EODDoublePanelTall.Size.Y + (EODDoublePanelTall.Y - EODMsgWin.Y)) : EODPanelTall.Size.Y) - (int)EODMsgWin.Position.Y);
                }
                BackOffset = new Point(isTrade?22:0, -(int)EODMsgWin.Position.Y);


                //Double tall panel chrome
                if (options.Height == EODHeight.TallTall)
                {
                    //BackOffset = new Point(0, -(int)EODDoublePanelTall.Y);
                    EODTopSub.Reset();
                    EODTopButtonLayout.Reset();

                    var topButtonLayout = buttons[options.TopPanelButtons];
                    Script.ApplyControlProperties(EODTopButtonLayout, "EODButtonLayout" + topButtonLayout + EODLayout.GetHeightSuffix(EODHeight.Tall));
                    Script.ApplyControlProperties(EODTopSub, "EODSub" + options.Length + "Length" + EODLayout.GetHeightSuffix(EODHeight.Tall));

                    EODTopButtonLayout.Position -= new Vector2(0, 155);
                    EODTopSub.Position          -= new Vector2(0, 155);

                    if (EODTimer.Visible == true && options.Expanded) // needs to be eod_timerback_straight.tga for TallTall
                    {
                        EODTimer.Texture = GetTexture(0x000001BF00000002);
                    }
                }



                var ava = SelectedAvatar;
                if (ava != null)
                {
                    var eodConnection = ava.Thread.EODConnection;
                    if (eodConnection != null)
                    {
                        var entity = LotController.vm.GetObjectById(eodConnection.ObjectID);
                        if (entity is VMGameObject)
                        {
                            var objects = entity.MultitileGroup.Objects;
                            ObjectComponent[] objComps = new ObjectComponent[objects.Count];
                            for (int i = 0; i < objects.Count; i++)
                            {
                                objComps[i] = (ObjectComponent)objects[i].WorldUI;
                            }
                            var thumb = LotController.World.GetObjectThumb(objComps, entity.MultitileGroup.GetBasePositions(), GameFacade.GraphicsDevice);

                            EODImage.Texture = thumb;
                        }
                    }
                }
                if (EODImage.Texture != null)
                {
                    var imgScale = 22f / Math.Max(EODImage.Texture.Width, EODImage.Texture.Height);
                    EODImage.SetSize(EODImage.Texture.Width * imgScale, EODImage.Texture.Height * imgScale);

                    EODImage.Position = EODButton.Position + new Vector2((EODButton.Texture.Width / 4 - EODImage.Width) / 2, (EODButton.Texture.Height - EODImage.Height) / 2);
                }
            }
            else
            {
                BackOffset = new Point(0, 0);
                Size       = new Vector2(DefaultBGImage.Width, EODPanelTall.Size.Y);
            }

            //this.Y = (inEOD && options.Height == EODHeight.Tall) ? 41: 61;

            Divider.Visible            = !inEOD;
            MotiveDisplay.Visible      = !inEOD;
            PersonGrid.Visible         = !inEOD;
            MotivesLabel.Visible       = !inEOD;
            PeopleListBg.Visible       = !inEOD;
            PreviousPageButton.Visible = !inEOD;
            NextPageButton.Visible     = !inEOD;
            Background.Visible         = !inEOD || isTrade;

            PersonGrid.Columns = (eodPresent || Small800) ?4:9;
            PersonGrid.DrawPage();
            PeopleListBg.Texture = (eodPresent && PeopleListEODBackgroundImg != null) ? PeopleListEODBackgroundImg : PeopleListBackgroundImg;
            PeopleListBg.SetSize(PeopleListBg.Texture.Width, PeopleListBg.Texture.Height);

            NextPageButton.Position = (eodPresent && !Small800) ? (Vector2)Script.GetControlProperty("NextPageEODButton") : DefaultNextPagePos;
            Background.Texture      = (eodPresent) ? (isTrade? BackgroundEODTradeImg : BackgroundEODImg) : DefaultBGImage;
            Background.Position     = (isTrade) ? new Vector2(-22, -79) : new Vector2(0, 35);
            Background.SetSize(Background.Texture.Width, Background.Texture.Height);

            var changeJobY = StatusBarMsgWinStraight.Y != (inEOD ? -18 : 2);
            var changeJobX = StatusBarMsgWinStraight.X != (eodPresent ? 159 : 383);

            if (Small800)
            {
                changeJobX = false;
            }
            if (changeJobX || changeJobY)
            {
                //there don't seem to be any UIScript cues for this.
                var offset = new Vector2(Small800 ? 0 : (800 - 1024), -20);
                if (!changeJobX)
                {
                    offset.X = 0;
                }
                if (!changeJobY)
                {
                    offset.Y = 0;
                }
                if (!inEOD)
                {
                    offset.Y *= -1;
                }
                if (!eodPresent)
                {
                    offset.X *= -1;
                }
                StatusBarMsgWinStraight.Position  += offset;
                StatusBarMsgWinTextEntry.Position += offset;
                StatusBarTimerBreakIcon.Position  += offset;
                StatusBarTimerWorkIcon.Position   += offset;
                StatusBarTimerStraight.Position   += offset;
                StatusBarTimerTextEntry.Position  += offset;
            }

            UpdateThumbPosition();
            Common.Utils.GameThread.NextUpdate(x =>
            {
                Invalidate();
            });
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
        public void SetInEOD(EODLiveModeOpt options, UIEOD eod)
        {
            Invalidate(); //i mean, duh
            bool eodPresent = (options != null);
            bool inEOD      = eodPresent && !HideEOD;

            if (ActiveEOD != null)
            {
                DynamicOverlay.Remove(ActiveEOD);
            }

            LastEODConfig = options;
            ActiveEOD     = eod;


            /**
             * Useful values
             */

            bool isTall       = inEOD && (options.Height == EODHeight.Tall || options.Height == EODHeight.TallTall);
            bool isDoubleTall = inEOD && options.Height == EODHeight.TallTall;


            /**
             * Reset / hide standard and eod UI
             */
            MoodPanelButton.Position = (eodPresent) ? EODLayout.Baseline + new Vector2(20, 7) : new Vector2(31, 63);
            EODButtonLayout.Visible  = inEOD;
            EODSub.Visible           = inEOD;
            EODMsgWin.Visible        = inEOD && options.Tips != EODTextTips.None;

            EODHelpButton.Visible     = inEOD;
            EODCloseButton.Visible    = inEOD;
            EODExpandButton.Visible   = inEOD && options.Expandable && !options.Expanded;
            EODContractButton.Visible = inEOD && options.Expandable && options.Expanded;
            EODExpandBack.Visible     = inEOD && options.Expandable;
            EODButton.Visible         = eodPresent;

            EODTopSub.Visible          = inEOD && options.Expandable && options.Expanded;
            EODTopButtonLayout.Visible = inEOD && options.Expandable && options.Expanded;

            EODPanel.Visible           = inEOD && !isTall;
            EODPanelTall.Visible       = inEOD && isTall;
            EODDoublePanelTall.Visible = inEOD && isDoubleTall && options.Expanded;

            EODTimer.Visible        = inEOD && options.Timer == EODs.EODTimer.Normal;
            MsgWinTextEntry.Visible = inEOD && options.Tips != EODTextTips.None;
            TimerTextEntry.Visible  = inEOD && options.Timer != EODs.EODTimer.None;

            //Cleanup
            if (EODImage.Texture != null)
            {
                EODImage.Texture.Dispose();
            }
            EODImage.Texture = null;

            //EOD Button
            EODButton.Selected = inEOD;
            EODButton.Position = EODLayout.EODButtonPosition;

            /**
             * Attach new EOD UI
             */
            if (inEOD)
            {
                DynamicOverlay.Add(ActiveEOD);
            }

            /**
             * Position / style EOD specific UI
             */
            if (eodPresent)
            {
                EODButtonLayout.Reset();
                EODSub.Reset();
                EODMsgWin.Reset();

                var buttons      = new string[] { "None", "One", "Two" };
                var buttonLayout = buttons[options.Buttons];
                Script.ApplyControlProperties(EODButtonLayout, "EODButtonLayout" + buttonLayout + EODLayout.GetHeightSuffix(options.Height, true));
                Script.ApplyControlProperties(EODSub, "EODSub" + options.Length + "Length" + EODLayout.GetHeightSuffix(options.Height, true));

                if (options.Tips != EODTextTips.None)
                {
                    Script.ApplyControlProperties(EODMsgWin, "EODMsgWin" + options.Tips.ToString());
                }

                var topLeft = EODLayout.GetTopLeft(options.Height);

                //EOD position
                ActiveEOD.Position = topLeft + (Vector2)Script.GetControlProperty("EODPosition");

                //Close button
                EODCloseButton.Position = EODLayout.GetChromePosition("EODCloseButton", options.Height);

                //Help button
                EODHelpButton.Position = EODLayout.HelpButtonPosition;

                //Chrome
                var chromeOffset = EODLayout.GetChromeOffset(options.Height);
                EODButtonLayout.Position += chromeOffset;
                EODSub.Position          += chromeOffset;

                //Message
                EODMsgWin.Position       = EODLayout.GetMessageWindowPosition(options.Height, options.Tips, options.Expanded);
                MsgWinTextEntry.Position = EODLayout.GetMessageWindowTextPosition(options.Height, options.Expanded);

                //Timer
                EODTimer.Position       = EODLayout.GetTimerPosition(options.Height);
                TimerTextEntry.Position = EODLayout.GetTimerTextPosition(options.Height);

                //Expand / contract
                EODExpandButton.Position   = EODLayout.GetExpandButtonPosition(options.Height);
                EODContractButton.Position = EODLayout.GetContractButtonPosition(options.Height);
                EODExpandBack.Position     = EODLayout.GetExpandBackPosition(options.Height);

                //backgrounds
                EODPanel.Position           = EODLayout.GetPanelPosition(EODHeight.Normal);
                EODPanelTall.Position       = EODLayout.GetPanelPosition(EODHeight.Tall);
                EODDoublePanelTall.Position = EODLayout.GetPanelPosition(EODHeight.TallTall);

                Size       = new Vector2(Background.Size.X, ((options.Height == EODHeight.TallTall && options.Expanded)? (EODDoublePanelTall.Size.Y + (EODDoublePanelTall.Y - EODMsgWin.Y)) :EODPanelTall.Size.Y) - (int)EODMsgWin.Position.Y);
                BackOffset = new Point(0, -(int)EODMsgWin.Position.Y);


                //Double tall panel chrome
                if (options.Height == EODHeight.TallTall)
                {
                    //BackOffset = new Point(0, -(int)EODDoublePanelTall.Y);
                    EODTopSub.Reset();
                    EODTopButtonLayout.Reset();

                    var topButtonLayout = buttons[options.TopPanelButtons];
                    Script.ApplyControlProperties(EODTopButtonLayout, "EODButtonLayout" + topButtonLayout + EODLayout.GetHeightSuffix(EODHeight.Tall));
                    Script.ApplyControlProperties(EODTopSub, "EODSub" + options.Length + "Length" + EODLayout.GetHeightSuffix(EODHeight.Tall));

                    EODTopButtonLayout.Position -= new Vector2(0, 155);
                    EODTopSub.Position          -= new Vector2(0, 155);
                }



                var ava = SelectedAvatar;
                if (ava != null)
                {
                    var eodConnection = ava.Thread.EODConnection;
                    if (eodConnection != null)
                    {
                        var entity = LotController.vm.GetObjectById(eodConnection.ObjectID);
                        if (entity is VMGameObject)
                        {
                            var objects = entity.MultitileGroup.Objects;
                            ObjectComponent[] objComps = new ObjectComponent[objects.Count];
                            for (int i = 0; i < objects.Count; i++)
                            {
                                objComps[i] = (ObjectComponent)objects[i].WorldUI;
                            }
                            var thumb = LotController.World.GetObjectThumb(objComps, entity.MultitileGroup.GetBasePositions(), GameFacade.GraphicsDevice);

                            EODImage.Texture = thumb;
                        }
                    }
                }
                if (EODImage.Texture != null)
                {
                    var imgScale = 22f / Math.Max(EODImage.Texture.Width, EODImage.Texture.Height);
                    EODImage.SetSize(EODImage.Texture.Width * imgScale, EODImage.Texture.Height * imgScale);

                    EODImage.Position = EODButton.Position + new Vector2((EODButton.Texture.Width / 4 - EODImage.Width) / 2, (EODButton.Texture.Height - EODImage.Height) / 2);
                }
            }
            else
            {
                Size = new Vector2(DefaultBGImage.Width, EODPanelTall.Size.Y);
            }

            //this.Y = (inEOD && options.Height == EODHeight.Tall) ? 41: 61;

            Divider.Visible            = !inEOD;
            MotiveDisplay.Visible      = !inEOD;
            PersonGrid.Visible         = !inEOD;
            MotivesLabel.Visible       = !inEOD;
            PeopleListBg.Visible       = !inEOD;
            PreviousPageButton.Visible = !inEOD;
            NextPageButton.Visible     = !inEOD;
            Background.Visible         = !inEOD;

            PersonGrid.Columns = (eodPresent || Small800) ?4:9;
            PersonGrid.DrawPage();
            PeopleListBg.Texture = (eodPresent && PeopleListEODBackgroundImg != null) ? PeopleListEODBackgroundImg : PeopleListBackgroundImg;
            PeopleListBg.SetSize(PeopleListBg.Texture.Width, PeopleListBg.Texture.Height);

            NextPageButton.Position = (eodPresent && !Small800) ? (Vector2)Script.GetControlProperty("NextPageEODButton") : DefaultNextPagePos;
            Background.Texture      = (eodPresent) ? BackgroundEODImg : DefaultBGImage;
            Background.SetSize(Background.Texture.Width, Background.Texture.Height);

            UpdateThumbPosition();
            Common.Utils.GameThread.NextUpdate(x =>
            {
                Invalidate();
            });
        }