Exemplo n.º 1
0
        public override void Draw(UISpriteBatch batch)
        {
            if (!Visible || Opacity == 0)
            {
                return;
            }

            DrawLocalTexture(batch, ShadowImg, null, Vector2.Zero, Vector2.One, Color.Black * 0.5f);
            if (Target != null)
            {
                var effect = LotView.WorldContent.SpriteEffect;
                batch.SetEffect(effect);

                effect.CurrentTechnique = effect.Techniques["StickyEffect"];
                var off = ((Position + Size * Scale / 2) - ContainerSize / 2).X * -0.001f * (Size.Y / 240f);
                effect.Parameters["stickyOffset"].SetValue(off * OffsetMultiplier);
                effect.Parameters["stickyPersp"].SetValue((Size.Y / 240f) * -0.2f);

                DrawLocalTexture(batch, Target,
                                 new Rectangle((int)(-100 * ScaleX), 0, (int)(Target.Width + 200 * ScaleX), Target.Height),
                                 -(BackOffset.ToVector2() + new Vector2(100, 0)), new Vector2(1 / (Scale.X), 1 / (Scale.Y)));
                batch.SetEffect();
            }
            DynamicOverlay.GetChildren().ForEach(x =>
            {
                if (x.Opacity != Opacity)
                {
                    x.Opacity = Opacity;
                }
            });
            DynamicOverlay.Draw(batch);
        }
Exemplo n.º 2
0
        public UIBulletinDialog(uint nhoodID) : base(UIDialogStyle.Close, true)
        {
            Board              = new UIBulletinBoard();
            Board.OnSelection += SelectedPost;
            Post         = new UIBulletinPost();
            Post.Opacity = 0;
            Post.Visible = false;
            Post.OnBack += Return;
            DynamicOverlay.Add(Board);
            DynamicOverlay.Add(Post);

            CurrentNeigh = new Binding <Neighborhood>()
                           .WithBinding(this, "Caption", "Neighborhood_Name", (name) =>
            {
                return(GameFacade.Strings.GetString("f120", "1", new string[] { (string)name }));
            })
                           .WithBinding(this, "MayorID", "Neighborhood_MayorID");

            Caption = GameFacade.Strings.GetString("f120", "1", new string[] { "" });
            SetSize(600, 610);

            var controller = ControllerUtils.BindController <BulletinDialogController>(this);

            controller.LoadNhood(nhoodID);

            GlobalInstance = this;
        }
Exemplo n.º 3
0
        public UIDPIScaleDialog() : base(UIDialogStyle.OK, true)
        {
            DPILabel           = new UILabel();
            DPILabel.Position  = new Vector2(25, 50);
            DPILabel.Size      = new Vector2(350f, 0f);
            DPILabel.Alignment = TextAlignment.Center;
            DynamicOverlay.Add(DPILabel);

            DPISlider               = new UISlider();
            DPISlider.Orientation   = 0;
            DPISlider.Texture       = GetTexture(0x42500000001);
            DPISlider.MinValue      = 4f;
            DPISlider.MaxValue      = 12f;
            DPISlider.AllowDecimals = false;
            DPISlider.Position      = new Vector2(25, 80);
            DPISlider.SetSize(350f, 0f);

            DPISlider.Value = FSOEnvironment.DPIScaleFactor * 4;
            DynamicOverlay.Add(DPISlider);

            DPISlider.OnChange += DPISlider_OnChange;

            SetSize(400, 150);

            OKButton.OnButtonClick += (btn) =>
            {
                UIScreen.RemoveDialog(this);
            };
        }
Exemplo n.º 4
0
 public override void Update(UpdateState state)
 {
     UpdateMotives();
     base.Update(state);
     if (Opacity < 1)
     {
         if (DynamicOverlay.GetChildren().Count > 0)
         {
             foreach (var m in MotiveDisplays)
             {
                 DynamicOverlay.Remove(m);
                 Add(m);
             }
         }
         Invalidate();
     }
     else
     {
         if (DynamicOverlay.GetChildren().Count == 0)
         {
             foreach (var m in MotiveDisplays)
             {
                 Remove(m);
                 DynamicOverlay.Add(m);
                 Invalidate();
             }
         }
     }
 }
Exemplo n.º 5
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));
        }
Exemplo n.º 6
0
        public void InitAllSummaries()
        {
            LastMayorPost          = new UILargeBulletinSummary();
            LastMayorPost.OnClick += SelectPost;
            LastMayorPost.Opacity  = 0;
            DynamicOverlay.Add(LastMayorPost);

            for (int i = 0; i < MayorPostsBuffer.Length; i++)
            {
                var mayorPost = new UIMediumBulletinSummary();
                mayorPost.Opacity   = 0;
                mayorPost.OnClick  += SelectPost;
                MayorPostsBuffer[i] = mayorPost;
                DynamicOverlay.Add(mayorPost);
                if (i % 2 == 1)
                {
                    mayorPost.HSVMod = new Color(255 - 16, 255, 245, 255);
                }
            }

            for (int i = 0; i < SystemPostsBuffer.Length; i++)
            {
                var systemPost = new UISmallBulletinSummary(true);
                systemPost.OnClick  += SelectPost;
                systemPost.Opacity   = 0;
                SystemPostsBuffer[i] = systemPost;
                DynamicOverlay.Add(systemPost);
                if (i % 2 == 1)
                {
                    systemPost.HSVMod = new Color(20, 255, 240, 255);
                }
            }

            LastCommunityPost          = new UIMediumBulletinSummary(true);
            LastCommunityPost.OnClick += SelectPost;
            LastCommunityPost.Opacity  = 0;
            DynamicOverlay.Add(LastCommunityPost);

            for (int i = 0; i < CommunityPostsBuffer.Length; i++)
            {
                var communityPost = new UISmallBulletinSummary(false);
                communityPost.OnClick  += SelectPost;
                communityPost.Opacity   = 0;
                CommunityPostsBuffer[i] = communityPost;
                DynamicOverlay.Add(communityPost);
                if ((i + i / 2) % 2 == 1)
                {
                    communityPost.HSVMod = new Color(communityPost.HSVMod.R + 15, 255, 240, 255);
                }
            }
        }
Exemplo n.º 7
0
        public void Fade(float opacity)
        {
            var elems = DynamicOverlay.GetChildren().ToList();

            if (opacity == 1f)
            {
                MayorPostsScroll     = MayorPostsScroll;
                SystemPostsScroll    = SystemPostsScroll;
                CommunityPostsScroll = CommunityPostsScroll;
                LastMayorPost.ScaleX = LastMayorPost.ScaleY = 1f;
                foreach (var elem in MayorPostsBuffer)
                {
                    elem.ScaleX = elem.ScaleY = 1f;
                }
                foreach (var elem in SystemPostsBuffer)
                {
                    elem.ScaleX = elem.ScaleY = 1f;
                }
                LastCommunityPost.ScaleX = LastCommunityPost.ScaleY = 1f;
                foreach (var elem in CommunityPostsBuffer)
                {
                    elem.ScaleX = elem.ScaleY = 1f;
                }

                NoPostMayor.Opacity     = 1;
                NoPostCommunity.Opacity = 1;
                NoPostSystem.Opacity    = 1;

                UpdateScrollButtons();
                elems.RemoveAll(x => x.Opacity == 0 && x is UIMediumBulletinSummary);
                foreach (var elem in elems)
                {
                    elem.Opacity = 0;
                }
            }
            foreach (var child in elems)
            {
                GameFacade.Screens.Tween.To(child, 0.66f, new Dictionary <string, float>()
                {
                    { "Opacity", opacity }
                }, (Opacity == 0) ? TweenQuad.EaseIn : TweenQuad.EaseOut);
            }

            GameFacade.Screens.Tween.To(this, 0.66f, new Dictionary <string, float>()
            {
                { "Opacity", opacity }
            }, (Opacity == 0) ? TweenQuad.EaseIn : TweenQuad.EaseOut);
        }
        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);
        }
Exemplo n.º 9
0
        private void SelectPost(UIAbstractStickyContainer sticky)
        {
            if (!AcceptSelections)
            {
                return;
            }
            var item = (UIMediumBulletinSummary)sticky;

            if (item.Item == null)
            {
                return;                    //or mode is edit
            }
            else
            {
                HIT.HITVM.Get().PlaySoundEvent(Model.UISounds.Click);
                HIT.HITVM.Get().PlaySoundEvent(Model.UISounds.Whoosh);
                //cancel tweens repositioning the bulletin items
                MayorTween?.Complete();
                SystemTween?.Complete();
                CommunityTween?.Complete();

                ScrollMayorLeft.Disabled     = true;
                ScrollSystemLeft.Disabled    = true;
                ScrollCommunityLeft.Disabled = true;

                ScrollMayorRight.Disabled     = true;
                ScrollSystemRight.Disabled    = true;
                ScrollCommunityRight.Disabled = true;

                GameFacade.Screens.Tween.To(item, 0.66f, new Dictionary <string, float>()
                {
                    { "X", (Size.X - item.Size.X * 3) / 2 },
                    { "Y", (Size.Y - (item.Size.Y * 3 - 30)) / 2 },
                    { "ScaleX", 3f }, { "ScaleY", 3f }
                }, TweenQuad.EaseOut);

                DynamicOverlay.SendToFront(item);

                OnSelection?.Invoke(item.Item);
            }
        }
Exemplo n.º 10
0
        public void DisplayChange(int change)
        {
            var newLabel = new UILabel();

            newLabel.Position           = MoneyLabel.Position;
            newLabel.Y                 += -20f;
            newLabel.CaptionStyle       = MoneyLabel.CaptionStyle.Clone();
            newLabel.CaptionStyle.Size  = 15;
            newLabel.CaptionStyle.Color = (change > 0) ? UIStyle.Current.Text : UIStyle.Current.NegMoney;
            newLabel.Alignment          = FSO.Client.UI.Framework.TextAlignment.Right | FSO.Client.UI.Framework.TextAlignment.Middle;
            newLabel.Size               = MoneyLabel.Size;

            newLabel.Caption = ((change > 0) ? "+" : "-") + "§" + Math.Abs(change);
            DynamicOverlay.Add(newLabel);

            GameFacade.Screens.Tween.To(newLabel, 1.5f, new Dictionary <string, float>()
            {
                { "Y", newLabel.Y - 30 }, { "Opacity", 0 }
            });
            GameThread.SetTimeout(() => { Remove(newLabel); }, 1500);
        }
Exemplo n.º 11
0
        public UIJobSubpanel(TS1GameScreen game) : base(game)
        {
            PerformanceTitle          = new UILabel();
            PerformanceTitle.Caption  = "Performance";
            PerformanceTitle.Position = new Vector2(79, 16);
            InitLabel(PerformanceTitle);

            PerformanceBar          = new UIMotiveBar();
            PerformanceBar.Position = new Vector2(79, 41);
            DynamicOverlay.Add(PerformanceBar);

            JobTitle          = new UILabel();
            JobTitle.Caption  = "Subway Musician";
            JobTitle.Position = new Vector2(18, 71);
            InitLabel(JobTitle);

            SalaryTitle          = new UILabel();
            SalaryTitle.Caption  = "Salary: §90";
            SalaryTitle.Position = new Vector2(18, 94);
            InitLabel(SalaryTitle);
            SalaryTitle.CaptionStyle.Color = UIStyle.Current.BtnActive;

            CareerButton          = new UITwoStateButton(Content.Get().CustomUI.Get("blank_blue.png").Get(GameFacade.GraphicsDevice));
            CareerButton.Position = new Vector2(20, 15);
            Add(CareerButton);

            Skills = new UISkillDisplay[6];
            for (int i = 0; i < 6; i++)
            {
                Skills[i]          = new UISkillDisplay();
                Skills[i].Position = new Vector2(334 + (i % 3) * 140, 35 + 60 * (i / 3));
                Add(Skills[i]);

                var name = new UILabel();
                name.Caption  = SkillNames[i];
                name.Position = new Vector2(332 + (i % 3) * 140, 11 + 60 * (i / 3));
                InitLabel(name);
            }
        }
Exemplo n.º 12
0
        public UILotPurchaseDialog() : base(UIDialogStyle.Standard | UIDialogStyle.OK | UIDialogStyle.Close, false)
        {
            var script = RenderScript("lotpurchasedialog.uis");

            SetSize(380, 210);

            NameTextEdit          = script.Create <UITextEdit>("NameTextEdit");
            NameTextEdit.MaxLines = 1;
            NameTextEdit.BackgroundTextureReference = UITextBox.StandardBackground;
            NameTextEdit.TextMargin   = new Rectangle(8, 3, 8, 3);
            NameTextEdit.FlashOnEmpty = true;
            NameTextEdit.MaxChars     = 24;
            Add(NameTextEdit);

            NameTextEditValidation = new UIValidationMessages <string>()
                                     .WithValidation(InvalidNameErrorShort, x => x.Length < 3)
                                     .WithValidation(InvalidNameErrorLong, x => x.Length > 24)
                                     .WithValidation(InvalidNameErrorNumeric, x => VALIDATE_NUMERIC.IsMatch(x))
                                     .WithValidation(InvalidNameErrorApostrophe, x => !VALIDATE_APOSTROPHES.IsMatch(x))
                                     .WithValidation(InvalidNameErrorDash, x => !VALIDATE_DASHES.IsMatch(x))
                                     .WithValidation(InvalidNameErrorSpace, x => !VALIDATE_SPACES.IsMatch(x))
                                     .WithValidation(InvalidNameErrorSpecial, x => VALIDATE_SPECIAL_CHARS.IsMatch(x));

            NameTextEditValidation.ErrorPrefix = InvalidNameErrorTitle;
            NameTextEditValidation.Position    = new Vector2(NameTextEdit.X, NameTextEdit.Y + NameTextEdit.Height);
            NameTextEditValidation.Width       = (int)NameTextEdit.Width;
            DynamicOverlay.Add(NameTextEditValidation);

            GameFacade.Screens.inputManager.SetFocus(NameTextEdit);

            NameTextEdit.OnChange += NameTextEdit_OnChange;
            RefreshValidation();

            OKButton.OnButtonClick    += AcceptButton_OnButtonClick;
            CloseButton.OnButtonClick += CloseButton_OnButtonClick;
        }
Exemplo n.º 13
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();
            });
        }
Exemplo n.º 14
0
        /// <summary>
        /// Creates a new UIMessage instance.
        /// </summary>
        /// <param name="type">The type of message (IM, compose or read).</param>
        /// <param name="author">Author if type is read or IM, recipient if type is compose.</param>
        public UIMessageWindow()
        {
            var script = this.RenderScript("message.uis");

            Messages = new List <IMEntry>();

            BtnBackground   = new UIImage(backgroundBtnImage);
            BtnBackground.X = 313;
            BtnBackground.Y = 216;
            this.AddAt(0, BtnBackground);

            TypeBackground   = new UIImage(backgroundMessageImage);
            TypeBackground.X = 10;
            TypeBackground.Y = 12;
            this.AddAt(0, TypeBackground);

            Background = new UIImage(backgroundImage);
            this.AddAt(0, Background);

            UIUtils.MakeDraggable(Background, this, true);
            UIUtils.MakeDraggable(TypeBackground, this, true);

            LetterSubjectTextEdit.MaxLines   = 1;
            LetterSubjectTextEdit.TextMargin = new Microsoft.Xna.Framework.Rectangle(2, 2, 2, 2);
            LetterSubjectTextEdit.MaxChars   = 128;

            MessageSlider.AttachButtons(MessageScrollUpButton, MessageScrollDownButton, 1);
            MessageTextEdit.AttachSlider(MessageSlider);
            MessageTextEdit.OnChange        += new ChangeDelegate(MessageTextEdit_OnChange);
            SendMessageButton.OnButtonClick += new ButtonClickDelegate(SendMessage);

            var emojis = new UIEmojiSuggestions(MessageTextEdit);

            DynamicOverlay.Add(emojis);
            MessageTextEdit.OnEnterPress += new KeyPressDelegate(SendMessageEnter);

            SendMessageButton.Disabled = true;

            LetterSlider.AttachButtons(LetterScrollUpButton, LetterScrollDownButton, 1);
            LetterTextEdit.AttachSlider(LetterSlider);
            LetterTextEdit.MaxChars = 1000;

            var emojis2 = new UIEmojiSuggestions(LetterTextEdit);

            DynamicOverlay.Add(emojis2);

            RespondLetterButton.OnButtonClick += new ButtonClickDelegate(RespondLetterButton_OnButtonClick);
            SendLetterButton.OnButtonClick    += new ButtonClickDelegate(SendLetter);

            HistorySlider.AttachButtons(HistoryScrollUpButton, HistoryScrollDownButton, 1);
            HistoryTextEdit.AttachSlider(HistorySlider);
            HistoryTextEdit.BBCodeEnabled  = true;
            HistoryTextEdit.TextStyle      = HistoryTextEdit.TextStyle.Clone();
            HistoryTextEdit.TextStyle.Size = 8;
            HistoryTextEdit.TextMargin     = new Microsoft.Xna.Framework.Rectangle(3, 1, 3, 3);
            HistoryTextEdit.TextStyle.LineHeightModifier = -1;
            HistoryTextEdit.SetSize(333, 100);

            CloseButton.OnButtonClick    += new ButtonClickDelegate(CloseButton_OnButtonClick);
            MinimizeButton.OnButtonClick += MinimizeButton_OnButtonClick;

            PersonButton           = script.Create <UIPersonButton>("AvatarThumbnail");
            PersonButton.FrameSize = UIPersonButtonSize.SMALL;
            Add(PersonButton);

            SpecialButton                = new UIButton();
            SpecialButton.Visible        = false;
            SpecialButton.OnButtonClick += SpecialButton_OnButtonClick;
            Add(SpecialButton);

            User = new Binding <UserReference>()
                   .WithBinding(SimNameText, "Caption", "Name");

            MyUser = new Binding <UserReference>();

            User.ValueChanged += (x) => PersonButton.User.Value = x;
            Size = Background.Size.ToVector2();


            this.Opacity = GlobalSettings.Default.ChatWindowsOpacity;
            this.AddUpdateHook(ChatOpacityChangedListener);
        }
Exemplo n.º 15
0
        public UIBulletinPost()
        {
            var ui = Content.Content.Get().CustomUI;
            var gd = GameFacade.GraphicsDevice;

            var bigCaption = TextStyle.DefaultLabel.Clone();

            bigCaption.Color  = Color.White;
            bigCaption.Shadow = true;
            bigCaption.Size   = 28;
            BaseTitleStyle    = bigCaption.Clone();
            Add(TitleEdit     = new UITextEdit()
            {
                Position     = new Vector2(27, 40),
                Size         = new Vector2(542, 44),
                TextStyle    = bigCaption,
                Alignment    = TextAlignment.Middle | TextAlignment.Center,
                CurrentText  = "",
                MaxChars     = 64,
                FlashOnEmpty = true
            });

            var semiT = bigCaption.Clone();

            semiT.Color         *= 0.6f;
            semiT.Shadow         = false;
            Add(TitlePlaceholder = new UILabel()
            {
                Position     = new Vector2(27, 40),
                Size         = new Vector2(542, 44),
                CaptionStyle = semiT,
                Alignment    = TextAlignment.Middle | TextAlignment.Center,
                Caption      = GameFacade.Strings.GetString("f120", "23")
            });

            BackButton                     = new UIButton(ui.Get("vote_big_btn.png").Get(gd));
            BackButton.Width               = 150;
            BackButton.Caption             = GameFacade.Strings.GetString("f120", "13");
            BackButton.Tooltip             = GameFacade.Strings.GetString("f120", "15");
            BackButton.CaptionStyle        = BackButton.CaptionStyle.Clone();
            BackButton.CaptionStyle.Color  = Color.White;
            BackButton.CaptionStyle.Shadow = true;
            BackButton.CaptionStyle.Size   = 22;
            BackButton.Position            = new Vector2(30, 481);
            Add(BackButton);

            BackButton.OnButtonClick += GoBack;

            MiddleButton                     = new UIButton(ui.Get("vote_big_btn.png").Get(gd));
            MiddleButton.Width               = 150;
            MiddleButton.Caption             = GameFacade.Strings.GetString("f120", "35");
            MiddleButton.CaptionStyle        = BackButton.CaptionStyle.Clone();
            MiddleButton.CaptionStyle.Color  = Color.White;
            MiddleButton.CaptionStyle.Shadow = true;
            MiddleButton.CaptionStyle.Size   = 22;
            MiddleButton.Position            = new Vector2(220, 481);
            Add(MiddleButton);

            MiddleButton.OnButtonClick += MButtonClick;

            RightButton                     = new UIButton(ui.Get("vote_big_btn.png").Get(gd));
            RightButton.Width               = 150;
            RightButton.Caption             = GameFacade.Strings.GetString("f120", "12");
            RightButton.CaptionStyle        = BackButton.CaptionStyle.Clone();
            RightButton.CaptionStyle.Color  = Color.White;
            RightButton.CaptionStyle.Shadow = true;
            RightButton.CaptionStyle.Size   = 22;
            RightButton.Position            = new Vector2(410, 481);
            Add(RightButton);

            RightButton.OnButtonClick += RButtonClick;

            BodyText = new UITextEdit();
            BodyText.BackgroundTextureReference = UITextBox.StandardBackground;
            BodyText.TextMargin      = new Rectangle(8, 3, 8, 3);
            BodyText.FlashOnEmpty    = true;
            BodyText.MaxChars        = 1000;
            BodyText.ScrollbarGutter = 7;
            BodyText.TextMargin      = new Rectangle(12, 10, 12, 10);
            BodyText.SetSize(388, 346);
            BodyText.Position = new Vector2(22, 96);
            Add(BodyText);
            BodyText.ScrollbarImage = GetTexture(0x4AB00000001);
            BodyText.InitDefaultSlider();
            BodyText.OnChange += BodyText_OnChange;

            var emojis = new UIEmojiSuggestions(BodyText);

            DynamicOverlay.Add(emojis);
            emojis.Parent = this;

            var whiteText = TextStyle.DefaultLabel.Clone();

            whiteText.Color  = Color.White;
            whiteText.Shadow = true;

            Add(TimeLabel = new UILabel()
            {
                Position     = new Vector2(34, 442),
                CaptionStyle = whiteText
            });

            Add(TypeLabel = new UILabel()
            {
                Position     = new Vector2(34, 442),
                Size         = new Vector2(388 - 24, 1),
                Alignment    = TextAlignment.Right | TextAlignment.Top,
                CaptionStyle = whiteText
            });


            Add(PropertyButtonBG = new UIImage(ui.Get("bulletin_post_lot_bg.png").Get(gd))
            {
                Position = new Vector2(440, 101)
            });

            Add(PersonButtonBG = new UIImage(ui.Get("bulletin_post_ava_bg.png").Get(gd))
            {
                Position = new Vector2(449, 266 - 23)
            });

            Add(LotThumbButton = new UILotThumbButtonAuto()
            {
                Position = new Vector2(446, 107)
            });
            LotThumbButton.OnNameChange += (id, name) =>
            {
                if (id == 0)
                {
                    PropertyButtonName.Caption = GameFacade.Strings.GetString("f120", "28");
                }
                else
                {
                    PropertyButtonName.Caption = name;
                }
                if (EditorMode)
                {
                    LotThumbButton.LotTooltip = GameFacade.Strings.GetString("f120", "29");
                }
            };
            LotThumbButton.OnLotClick += PropertyButtonClick;
            LotThumbButton.Init(GetTexture(0x0000079300000001), GetTexture(0x0000079300000001));

            DynamicOverlay.Add(PersonButton = new UIBigPersonButton()
            {
                Position = new Vector2(452, 269 - 23)
            });

            PersonButton.OnNameChange += (id, name) =>
            {
                PersonButtonName.Caption = name;
            };

            Add(PropertyButtonName = new UILabel()
            {
                Position     = new Vector2(435, 202),
                Size         = new Vector2(151, 1),
                Alignment    = TextAlignment.Center | TextAlignment.Top,
                CaptionStyle = whiteText,
                Caption      = "",
                Wrapped      = true,
                MaxLines     = 4
            });

            Add(PersonButtonName = new UILabel()
            {
                Position     = new Vector2(435, 442 - 23),
                Size         = new Vector2(151, 1),
                Alignment    = TextAlignment.Center | TextAlignment.Top,
                CaptionStyle = whiteText,
                Caption      = "",
                Wrapped      = true,
                MaxLines     = 3
            });

            Size = new Vector2(600, 550);
        }
Exemplo n.º 16
0
        public void SetPanel(int newPanel)
        {
            GameFacade.Cursor.SetCursor(CursorType.Hourglass);

            OptionsModeButton.Selected = false;
            BuyModeButton.Selected     = false;
            BuildModeButton.Selected   = false;
            LiveModeButton.Selected    = false;
            HouseModeButton.Selected   = false;

            if (Game.InLot)
            {
                Game.LotControl.QueryPanel.Active     = false;
                Game.LotControl.QueryPanel.Visible    = false;
                Game.LotControl.LiveMode              = true;
                Game.LotControl.World.State.BuildMode = 0;
            }

            if (CurrentPanel != -1)
            {
                switch (CurrentPanel)
                {
                case 3:
                case 2:
                    if (Game.InLot && Game.vm.TSOState.Roommates.Contains(Game.vm.MyUID))
                    {
                        FindController <CoreGameScreenController>()?.UploadLotThumbnail();
                    }
                    break;
                }
                DynamicOverlay.Remove(Panel);
                Panel = null;

                if (Game.InLot)
                {
                    Game.LotControl.SetDonatorDialogVisible(false);
                    Game.LotControl.PanelActive = false;
                }
            }
            if (newPanel != CurrentPanel)
            {
                if (SpecialMusic || SpecialMusicTrigger())
                {
                    if (newPanel == 2)
                    {
                        HITVM.Get().PlaySoundEvent(UIMusic.Buy);
                    }
                    else if (newPanel == 3 || newPanel == 4)
                    {
                        HITVM.Get().PlaySoundEvent(UIMusic.Build);
                    }
                    else if (newPanel != 5)
                    {
                        HITVM.Get().PlaySoundEvent(UIMusic.None);
                    }
                }

                if (Game.InLot)
                {
                    Game.LotControl.SetDonatorDialogVisible(newPanel > 1 && newPanel < 4);
                    Game.LotControl.PanelActive = true;
                    if ((newPanel == 2 || newPanel == 3) && Game.vm.TSOState.CommunityLot)
                    {
                        if (Game.vm.TSOState.OwnerID == Game.vm.MyUID)
                        {
                            FSOFacade.Hints.TriggerHint("ui:mayor_buildbuy");
                            FSOFacade.Hints.TriggerHint("ui:mayor_donators");
                        }
                        else if (Game.vm.TSOState.Roommates.Contains(Game.vm.MyUID))
                        {
                            FSOFacade.Hints.TriggerHint("ui:donator");
                        }
                    }
                }
                switch (newPanel)
                {
                case 5:
                    Panel   = new UIOptions();
                    Panel.X = 177;
                    Panel.Y = 96;
                    DynamicOverlay.Add(Panel);
                    OptionsModeButton.Selected = true;
                    SetFocus(UCPFocusMode.ActiveTab);
                    break;

                case 2:
                    if (!Game.InLot)
                    {
                        break;                  //not ingame
                    }
                    Panel = new UIBuyMode(Game.LotControl);

                    //enable grid
                    Game.LotControl.World.State.BuildMode = 1;

                    Game.LotControl.LiveMode = false;
                    Panel.X = 177;
                    Panel.Y = 96;
                    DynamicOverlay.Add(Panel);
                    BuyModeButton.Selected = true;
                    SetFocus(UCPFocusMode.ActiveTab);
                    break;

                case 3:
                    if (!Game.InLot)
                    {
                        break;                  //not ingame
                    }
                    Panel = new UIBuildMode(Game.LotControl);

                    //enable air tile graphics + grid
                    Game.LotControl.World.State.BuildMode = 2;

                    Game.LotControl.LiveMode = false;
                    Panel.X = 177;
                    Panel.Y = 96;
                    DynamicOverlay.Add(Panel);
                    BuildModeButton.Selected = true;
                    SetFocus(UCPFocusMode.ActiveTab);

                    FSOFacade.Hints.TriggerHint("ui:buildmode");
                    break;

                case 4:
                    if (!Game.InLot)
                    {
                        break;                  //not ingame
                    }
                    Panel = new UIHouseMode(Game.LotControl);

                    //enable grid
                    Game.LotControl.World.State.BuildMode = 1;

                    Panel.X = 177;
                    Panel.Y = 87;
                    DynamicOverlay.Add(Panel);
                    HouseModeButton.Selected = true;
                    SetFocus(UCPFocusMode.ActiveTab);
                    break;

                case 1:
                    if (!Game.InLot)
                    {
                        break;                  //not ingame
                    }
                    Panel   = new UILiveMode(Game.LotControl);
                    Panel.X = 177;
                    Panel.Y = 61;
                    DynamicOverlay.Add(Panel);
                    LiveModeButton.Selected = true;
                    SetFocus(UCPFocusMode.ActiveTab);
                    break;

                default:
                    if (Game.InLot)
                    {
                        Game.LotControl.PanelActive = false;
                    }
                    break;
                }
                CurrentPanel = newPanel;
            }
            else
            {
                Remove(PanelBlocker);
                PanelBlocker = null;
                CurrentPanel = -1;
            }
            GameFacade.Cursor.SetCursor(CursorType.Normal);
        }
Exemplo n.º 17
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);
        }
Exemplo n.º 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;
        }
Exemplo n.º 19
0
        public UIMediumBulletinSummary(string type) : base(type)
        {
            var ui = Content.Content.Get().CustomUI;
            var gd = GameFacade.GraphicsDevice;

            var titleCaption = TextStyle.DefaultTitle.Clone();

            titleCaption.Size  = 9;
            titleCaption.Color = TitleColor;
            TitleLabel         = new UILabel()
            {
                Wrapped      = true,
                Size         = new Vector2(107, 30),
                Alignment    = TextAlignment.Center | TextAlignment.Middle,
                Position     = new Vector2(22, 4),
                CaptionStyle = titleCaption,
                Caption      = "",
                MaxLines     = 2,
            };
            Add(TitleLabel);

            var bodyCaption = TextStyle.DefaultTitle.Clone();

            bodyCaption.Size  = 8;
            bodyCaption.Color = BodyColor;
            bodyCaption.LineHeightModifier = -2;

            Body = new UILabel()
            {
                Wrapped      = true,
                Size         = new Vector2(108, 57),
                Position     = new Vector2(21, 35),
                CaptionStyle = bodyCaption,
                Caption      = "",
                MaxLines     = 5,
            };
            Add(Body);

            var dateCaption = titleCaption.Clone();

            dateCaption.Size = 8;

            DateLabel = new UILabel()
            {
                Position     = new Vector2(22, 97),
                CaptionStyle = dateCaption,
                Caption      = DateTime.Now.ToShortDateString(),
                Alignment    = TextAlignment.Left | TextAlignment.Top,
                Size         = Vector2.One
            };
            Add(DateLabel);

            PersonButton = new UIPersonButton()
            {
                FrameSize = UIPersonButtonSize.SMALL,
                Position  = new Vector2(109, 93),
            };
            Add(PersonButton);

            PromotedStar = new UIImage(ui.Get((type == "bulletin_large")? "bulletin_promote_l.png":"bulletin_promote_s.png").Get(gd))
            {
                Position = new Vector2(114, -12)
            };
            PromotedStar.UseTooltip();
            PromotedStar.Tooltip = GameFacade.Strings.GetString("f120", "17");
            PromotedStar.Visible = false;
            DynamicOverlay.Add(PromotedStar);
        }
Exemplo n.º 20
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();
            });
        }
Exemplo n.º 21
0
        public UIBulletinBoard()
        {
            var strings = GameFacade.Strings;

            var subtitleStyle = TextStyle.DefaultLabel.Clone();

            subtitleStyle.Size   = 9;
            subtitleStyle.Shadow = true;

            var pageStyle = subtitleStyle.Clone();

            pageStyle.Color = Color.White;

            var titleStyle = TextStyle.DefaultLabel.Clone();

            titleStyle.Color  = Color.White;
            titleStyle.Size   = 22;
            titleStyle.Shadow = true;

            //mayor

            MayorPostsLabel = new UILabel()
            {
                Position     = new Vector2(220, 38),
                CaptionStyle = titleStyle,
                Caption      = strings.GetString("f120", "2")
            };
            Add(MayorPostsLabel);

            MayorPostsSubtitle = new UILabel()
            {
                Position     = new Vector2(220, 72),
                Size         = new Vector2(313, 32),
                Alignment    = TextAlignment.Left | TextAlignment.Top,
                Wrapped      = true,
                CaptionStyle = subtitleStyle,
                Caption      = strings.GetString("f120", "3")
            };
            Add(MayorPostsSubtitle);

            MayorPostsPage = new UILabel()
            {
                Position     = new Vector2(0, 232),
                Size         = new Vector2(600, 1),
                Alignment    = TextAlignment.Center | TextAlignment.Top,
                CaptionStyle = pageStyle,
                Caption      = strings.GetString("f120", "8", new string[] { "1" })
            };
            Add(MayorPostsPage);

            //system

            SystemPostsLabel = new UILabel()
            {
                Position     = new Vector2(20, 253 - 10),
                CaptionStyle = titleStyle,
                Caption      = strings.GetString("f120", "4")
            };
            Add(SystemPostsLabel);

            SystemPostsSubtitle = new UILabel()
            {
                Position     = new Vector2(0, 269 - 10),
                Size         = new Vector2(600 - 20, 1),
                Alignment    = TextAlignment.Right | TextAlignment.Top,
                CaptionStyle = subtitleStyle,
                Caption      = strings.GetString("f120", "5")
            };
            Add(SystemPostsSubtitle);

            SystemPostsPage = new UILabel()
            {
                Position     = new Vector2(0, 342),
                Size         = new Vector2(600, 1),
                Alignment    = TextAlignment.Center | TextAlignment.Top,
                CaptionStyle = pageStyle,
                Caption      = strings.GetString("f120", "8", new string[] { "1" })
            };
            Add(SystemPostsPage);

            //community

            CommunityPostsLabel = new UILabel()
            {
                Position     = new Vector2(0, 356),
                Size         = new Vector2(600, 1),
                Alignment    = TextAlignment.Center | TextAlignment.Top,
                CaptionStyle = titleStyle,
                Caption      = strings.GetString("f120", "6")
            };
            Add(CommunityPostsLabel);

            CommunityPostsSubtitle = new UILabel()
            {
                Position     = new Vector2(0, 389),
                Size         = new Vector2(600, 1),
                Alignment    = TextAlignment.Center | TextAlignment.Top,
                CaptionStyle = subtitleStyle,
                Caption      = strings.GetString("f120", "7")
            };
            Add(CommunityPostsSubtitle);

            CommunityPostsPage = new UILabel()
            {
                Position     = new Vector2(0, 526),
                Size         = new Vector2(600, 1),
                Alignment    = TextAlignment.Center | TextAlignment.Top,
                CaptionStyle = pageStyle,
                Caption      = strings.GetString("f120", "8", new string[] { "1" })
            };
            Add(CommunityPostsPage);

            InitAllSummaries();

            var ui = Content.Content.Get().CustomUI;
            var gd = GameFacade.GraphicsDevice;

            var larrow = ui.Get("bulletin_pleft.png").Get(gd);
            var rarrow = ui.Get("bulletin_pright.png").Get(gd);

            DynamicOverlay.Add(ScrollMayorLeft = new UIButton(larrow)
            {
                Position = new Vector2(31 - 6, 150), Tooltip = strings.GetString("f120", "10")
            });                                                                                                                                            //hidden on page 1
            DynamicOverlay.Add(ScrollMayorRight = new UIButton(rarrow)
            {
                Position = new Vector2(555 + 6, 150), Tooltip = strings.GetString("f120", "9")
            });                                                                                                                                             //offset up on page 1

            DynamicOverlay.Add(ScrollSystemLeft = new UIButton(larrow)
            {
                Position = new Vector2(31 - 6, 306 - 10), Tooltip = strings.GetString("f120", "10")
            });
            DynamicOverlay.Add(ScrollSystemRight = new UIButton(rarrow)
            {
                Position = new Vector2(555 + 6, 306 - 10), Tooltip = strings.GetString("f120", "9")
            });

            DynamicOverlay.Add(ScrollCommunityLeft = new UIButton(larrow)
            {
                Position = new Vector2(31 - 6, 448), Tooltip = strings.GetString("f120", "10")
            });
            DynamicOverlay.Add(ScrollCommunityRight = new UIButton(rarrow)
            {
                Position = new Vector2(555 + 6, 448), Tooltip = strings.GetString("f120", "9")
            });

            ScrollMayorLeft.OnButtonClick  += (btn) => Scroll(UIBulletinBoardType.Mayor, -1);
            ScrollMayorRight.OnButtonClick += (btn) => Scroll(UIBulletinBoardType.Mayor, 1);

            ScrollSystemLeft.OnButtonClick  += (btn) => Scroll(UIBulletinBoardType.System, -1);
            ScrollSystemRight.OnButtonClick += (btn) => Scroll(UIBulletinBoardType.System, 1);

            ScrollCommunityLeft.OnButtonClick  += (btn) => Scroll(UIBulletinBoardType.Community, -1);
            ScrollCommunityRight.OnButtonClick += (btn) => Scroll(UIBulletinBoardType.Community, 1);

            UpdateScrollButtons();
            MayorPostsScroll     = MayorPostsScroll;
            SystemPostsScroll    = SystemPostsScroll;
            CommunityPostsScroll = CommunityPostsScroll;

            PostButton                     = new UIButton(ui.Get("vote_big_btn.png").Get(gd));
            PostButton.Width               = 150;
            PostButton.Caption             = strings.GetString("f120", "12");
            PostButton.CaptionStyle        = PostButton.CaptionStyle.Clone();
            PostButton.CaptionStyle.Color  = Color.White;
            PostButton.CaptionStyle.Shadow = true;
            PostButton.CaptionStyle.Size   = 22;
            PostButton.Position            = new Vector2((600 - 150) / 2, 545);
            PostButton.OnButtonClick      += PostButton_OnButtonClick;
            Add(PostButton);

            var noPostStyle = TextStyle.DefaultLabel.Clone();

            noPostStyle.Size   = 12;
            noPostStyle.Shadow = true;
            noPostStyle.Color  = new Color(255, 153, 153);

            DynamicOverlay.Add(NoPostMayor = new UIMediumBulletinSummary()
            {
                Position = new Vector2((600 - 150) / 2, MayorMedTop),
            });

            DynamicOverlay.Add(NoPostSystem = new UISmallBulletinSummary(true)
            {
                Position = new Vector2((600 - 150) / 2, SystemTop),
            });

            DynamicOverlay.Add(NoPostCommunity = new UIMediumBulletinSummary(true)
            {
                Position = new Vector2((600 - 150) / 2, CommunityTop),
            });

            NoPostLabels = new UIMediumBulletinSummary[] { NoPostMayor, NoPostSystem, NoPostCommunity };
            var rand = new Random();

            foreach (var label in NoPostLabels)
            {
                PrepareInactivePost(label, rand);
            }

            Size = new Vector2(600, 610);

            InitBulletinItems(new BulletinItem[]
            {
            });

            //InitTestData();
        }
Exemplo n.º 22
0
        public void SetPanel(int newPanel)
        {
            GameFacade.Cursor.SetCursor(CursorType.Hourglass);

            OptionsModeButton.Selected = false;
            BuyModeButton.Selected     = false;
            BuildModeButton.Selected   = false;
            LiveModeButton.Selected    = false;
            HouseModeButton.Selected   = false;

            if (Game.InLot)
            {
                Game.LotControl.QueryPanel.Active     = false;
                Game.LotControl.QueryPanel.Visible    = false;
                Game.LotControl.LiveMode              = true;
                Game.LotControl.World.State.BuildMode = 0;
            }

            if (CurrentPanel != -1)
            {
                switch (CurrentPanel)
                {
                case 3:
                case 2:
                    if (Game.InLot && Game.vm.TSOState.Roommates.Contains(Game.vm.MyUID))
                    {
                        FindController <CoreGameScreenController>().UploadLotThumbnail();
                    }
                    break;
                }
                DynamicOverlay.Remove(Panel);
                Panel = null;

                if (Game.InLot)
                {
                    Game.LotControl.PanelActive = false;
                }
            }
            if (newPanel != CurrentPanel)
            {
                if (Game.InLot)
                {
                    Game.LotControl.PanelActive = true;
                }
                switch (newPanel)
                {
                case 5:
                    Panel   = new UIOptions();
                    Panel.X = 177;
                    Panel.Y = 96;
                    DynamicOverlay.Add(Panel);
                    OptionsModeButton.Selected = true;
                    SetFocus(UCPFocusMode.ActiveTab);
                    break;

                case 2:
                    if (!Game.InLot)
                    {
                        break;                  //not ingame
                    }
                    Panel = new UIBuyMode(Game.LotControl);

                    //enable grid
                    Game.LotControl.World.State.BuildMode = 1;

                    Game.LotControl.LiveMode = false;
                    Panel.X = 177;
                    Panel.Y = 96;
                    DynamicOverlay.Add(Panel);
                    BuyModeButton.Selected = true;
                    SetFocus(UCPFocusMode.ActiveTab);
                    break;

                case 3:
                    if (!Game.InLot)
                    {
                        break;                  //not ingame
                    }
                    Panel = new UIBuildMode(Game.LotControl);

                    //enable air tile graphics + grid
                    Game.LotControl.World.State.BuildMode = 2;

                    Game.LotControl.LiveMode = false;
                    Panel.X = 177;
                    Panel.Y = 96;
                    DynamicOverlay.Add(Panel);
                    BuildModeButton.Selected = true;
                    SetFocus(UCPFocusMode.ActiveTab);
                    break;

                case 4:
                    if (!Game.InLot)
                    {
                        break;                  //not ingame
                    }
                    Panel = new UIHouseMode(Game.LotControl);

                    //enable grid
                    Game.LotControl.World.State.BuildMode = 1;

                    Panel.X = 177;
                    Panel.Y = 87;
                    DynamicOverlay.Add(Panel);
                    HouseModeButton.Selected = true;
                    SetFocus(UCPFocusMode.ActiveTab);
                    break;

                case 1:
                    if (!Game.InLot)
                    {
                        break;                  //not ingame
                    }
                    Panel   = new UILiveMode(Game.LotControl);
                    Panel.X = 177;
                    Panel.Y = 61;
                    DynamicOverlay.Add(Panel);
                    LiveModeButton.Selected = true;
                    SetFocus(UCPFocusMode.ActiveTab);
                    break;

                default:
                    if (Game.InLot)
                    {
                        Game.LotControl.PanelActive = false;
                    }
                    break;
                }
                CurrentPanel = newPanel;
            }
            else
            {
                Remove(PanelBlocker);
                PanelBlocker = null;
                CurrentPanel = -1;
            }
            GameFacade.Cursor.SetCursor(CursorType.Normal);
        }
Exemplo n.º 23
0
        public UIAlert(UIAlertOptions options) : base(UIDialogStyle.Standard, true)
        {
            this.m_Options = options;
            this.Caption   = options.Title;
            this.Opacity   = 0.9f;

            m_TextStyle      = TextStyle.DefaultLabel.Clone();
            m_TextStyle.Size = options.TextSize;

            Icon          = new UIImage();
            Icon.Position = new Vector2(32, 32);
            Icon.SetSize(0, 0);
            Add(Icon);

            /** Determine the size **/
            ComputeText();

            if (options.ProgressBar)
            {
                _ProgressBar          = new UIProgressBar();
                _ProgressBar.Mode     = ProgressBarMode.Animated;
                _ProgressBar.Position = new Microsoft.Xna.Framework.Vector2(32, 0);
                _ProgressBar.SetSize(options.Width - 64, 26);
                this.Add(_ProgressBar);
            }

            /** Add buttons **/
            Buttons = new List <UIButton>();

            foreach (var button in options.Buttons)
            {
                string buttonText = "";
                if (button.Text != null)
                {
                    buttonText = button.Text;
                }
                else
                {
                    switch (button.Type)
                    {
                    case UIAlertButtonType.OK:
                        buttonText = GameFacade.Strings.GetString("142", "ok button");
                        break;

                    case UIAlertButtonType.Yes:
                        buttonText = GameFacade.Strings.GetString("142", "yes button");
                        break;

                    case UIAlertButtonType.No:
                        buttonText = GameFacade.Strings.GetString("142", "no button");
                        break;

                    case UIAlertButtonType.Cancel:
                        buttonText = GameFacade.Strings.GetString("142", "cancel button");
                        break;
                    }
                }
                var btnElem = AddButton(buttonText, button.Type, button.Handler == null);
                Buttons.Add(btnElem);
                if (button.Handler != null)
                {
                    btnElem.OnButtonClick += button.Handler;
                }
            }

            if (options.TextEntry)
            {
                TextBox          = new UITextBox();
                TextBox.MaxChars = options.MaxChars;
                this.Add(TextBox);
            }

            if (options.GenericAddition != null)
            {
                GenericAddition = options.GenericAddition;
                if (options.GenericAdditionDynamic)
                {
                    DynamicOverlay.Add(GenericAddition);
                }
                else
                {
                    Add(GenericAddition);
                }
            }

            /** Position buttons **/
            RefreshSize();
        }
Exemplo n.º 24
0
        public override void Update(UpdateState state)
        {
            base.Update(state);

            if (Opacity < 1)
            {
                if (DynamicOverlay.GetChildren().Count > 0)
                {
                    DynamicOverlay.Remove(PerformanceBar);
                    Add(PerformanceBar);
                }
            }
            else
            {
                if (DynamicOverlay.GetChildren().Count == 0)
                {
                    Remove(PerformanceBar);
                    DynamicOverlay.Add(PerformanceBar);
                }
            }
            var sel = Game.SelectedAvatar;

            if (sel == null)
            {
                return;
            }
            var type        = sel.GetPersonData(FSO.SimAntics.Model.VMPersonDataVariable.JobType);
            var level       = sel.GetPersonData(FSO.SimAntics.Model.VMPersonDataVariable.JobPromotionLevel);
            var performance = sel.GetPersonData(FSO.SimAntics.Model.VMPersonDataVariable.JobPerformance);

            var job = Content.Get().Jobs.GetJob((ushort)type);

            if (job == null)
            {
                if (LastPerformance != -200)
                {
                    JobTitle.Caption         = "Unemployed";
                    SalaryTitle.Caption      = "";
                    PerformanceBar.Visible   = false;
                    PerformanceTitle.Visible = false;

                    LastJobLevel    = null;
                    LastPerformance = -200;
                }
            }
            else
            {
                var myLevel = job.JobLevels[level];

                if (myLevel != LastJobLevel)
                {
                    JobTitle.Caption    = myLevel.JobName;
                    SalaryTitle.Caption = "Salary: §" + myLevel.Salary + " (" + ToTime(myLevel.StartTime) + "-" + ToTime(myLevel.EndTime) + ")";

                    LastJobLevel = myLevel;
                }

                if (LastPerformance != performance)
                {
                    PerformanceBar.Visible     = true;
                    PerformanceTitle.Visible   = true;
                    PerformanceBar.MotiveValue = performance;
                    LastPerformance            = performance;
                }
                for (int i = 0; i < 6; i++)
                {
                    Skills[i].Needed = myLevel.MinRequired[i + 1] / 100;
                }
            }

            for (int i = 0; i < 6; i++)
            {
                Skills[i].Value = sel.GetPersonData(SkillInd[i]) / 100;
            }
        }
Exemplo n.º 25
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);
        }
Exemplo n.º 26
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.LotControl         = lotController;
            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;
            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;
        }