Ejemplo n.º 1
0
        /// <summary>
        /// Sets the "focus mode" of the UCP, used to make the UI accessible on phones.
        /// </summary>
        /// <param name="focus"></param>
        public void SetFocus(UCPFocusMode focus)
        {
            if (Focus == focus)
            {
                return;
            }
            if (FSOEnvironment.UIZoomFactor > 1f)
            {
                if (focus != UCPFocusMode.Game)
                {
                    var tween = GameFacade.Screens.Tween.To(this, 0.33f, new Dictionary <string, float>()
                    {
                        { "ScaleX", FSOEnvironment.UIZoomFactor },
                        { "ScaleY", FSOEnvironment.UIZoomFactor },
                        { "Y", Game.ScreenHeight - (int)(210 * FSOEnvironment.UIZoomFactor) },
                        { "X", (focus == UCPFocusMode.ActiveTab)?-(int)(225 * FSOEnvironment.UIZoomFactor):0 }
                    }, TweenQuad.EaseInOut);

                    Remove(SelfBlocker); SelfBlocker = null;
                    if (focus == UCPFocusMode.ActiveTab)
                    {
                        Remove(PanelBlocker); PanelBlocker = null;
                    }

                    if (GameBlocker == null)
                    {
                        GameBlocker             = new UIBlocker();
                        GameBlocker.Position    = new Vector2(0, 220 - Game.ScreenHeight);
                        GameBlocker.OnMouseEvt += (evt, state) =>
                        {
                            if (evt == UIMouseEventType.MouseDown)
                            {
                                SetFocus(UCPFocusMode.Game);
                            }
                        };
                        AddAt(0, GameBlocker);
                    }
                }
                else
                {
                    var tween = GameFacade.Screens.Tween.To(this, 0.33f, new Dictionary <string, float>()
                    {
                        { "ScaleX", 1f },
                        { "ScaleY", 1f },
                        { "Y", Game.ScreenHeight - 210 },
                        { "X", 0 }
                    }, TweenQuad.EaseInOut);

                    if (SelfBlocker == null)
                    {
                        SelfBlocker             = new UIBlocker(220, 210);
                        SelfBlocker.OnMouseEvt += (evt, state) =>
                        {
                            if (evt == UIMouseEventType.MouseDown)
                            {
                                SetFocus(UCPFocusMode.UCP);
                            }
                        };
                        Add(SelfBlocker);
                    }

                    if (CurrentPanel > -1 && PanelBlocker == null)
                    {
                        PanelBlocker             = new UIBlocker(580, 104);
                        PanelBlocker.Position    = new Vector2(220, 106);
                        PanelBlocker.OnMouseEvt += (evt, state) =>
                        {
                            if (evt == UIMouseEventType.MouseDown)
                            {
                                SetFocus(UCPFocusMode.ActiveTab);
                            }
                        };
                        Add(PanelBlocker);
                    }

                    Remove(GameBlocker); GameBlocker = null;
                }
            }
            Focus = focus;
        }
Ejemplo n.º 2
0
        public UIUCP(UIScreen owner)
        {
            this.RenderScript("ucp.uis");

            Game = (CoreGameScreen)owner;

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


            BackgroundMatchmaker   = new UIImage(BackgroundMatchmakerImage);
            BackgroundMatchmaker.Y = 81;
            this.AddAt(0, BackgroundMatchmaker);
            BackgroundMatchmaker.BlockInput();

            TimeText.Caption              = "12:00 am";
            TimeText.CaptionStyle         = TimeText.CaptionStyle.Clone();
            TimeText.CaptionStyle.Shadow  = true;
            MoneyText.Caption             = "§0";
            MoneyText.CaptionStyle        = TimeText.CaptionStyle.Clone();
            MoneyText.CaptionStyle.Shadow = true;

            CurrentPanel = -1;

            OptionsModeButton.OnButtonClick += new ButtonClickDelegate(OptionsModeButton_OnButtonClick);
            LiveModeButton.OnButtonClick    += new ButtonClickDelegate(LiveModeButton_OnButtonClick);
            BuyModeButton.OnButtonClick     += new ButtonClickDelegate(BuyModeButton_OnButtonClick);
            BuildModeButton.OnButtonClick   += BuildModeButton_OnButtonClick;

            ZoomOutButton.OnButtonClick += new ButtonClickDelegate(ZoomControl);
            ZoomInButton.OnButtonClick  += new ButtonClickDelegate(ZoomControl);
            PhoneButton.OnButtonClick   += new ButtonClickDelegate(PhoneButton_OnButtonClick);

            CloseZoomButton.OnButtonClick    += new ButtonClickDelegate(SetCityZoom);
            MediumZoomButton.OnButtonClick   += new ButtonClickDelegate(SetCityZoom);
            FarZoomButton.OnButtonClick      += new ButtonClickDelegate(SetCityZoom);
            NeighborhoodButton.OnButtonClick += new ButtonClickDelegate(SetCityZoom);
            WorldButton.OnButtonClick        += new ButtonClickDelegate(SetCityZoom);

            HouseViewSelectButton.OnButtonClick += new ButtonClickDelegate(WallsViewPopup);
            WallsDownButton.OnButtonClick       += new ButtonClickDelegate(WallsViewPopup);
            WallsUpButton.OnButtonClick         += new ButtonClickDelegate(WallsViewPopup);
            WallsCutawayButton.OnButtonClick    += new ButtonClickDelegate(WallsViewPopup);
            RoofButton.OnButtonClick            += new ButtonClickDelegate(WallsViewPopup);

            RotateClockwiseButton.OnButtonClick        += new ButtonClickDelegate(RotateClockwise);
            RotateCounterClockwiseButton.OnButtonClick += new ButtonClickDelegate(RotateCounterClockwise);

            FirstFloorButton.OnButtonClick  += FirstFloor;
            SecondFloorButton.OnButtonClick += SecondFloor;

            SecondFloorButton.Selected = (Game.Level == Game.Stories);
            FirstFloorButton.Selected  = (Game.Level == 1);

            MoneyText.CaptionStyle = MoneyText.CaptionStyle.Clone();

            SetInLot(false);
            SetMode(UCPMode.CityMode);
            Focus = UCPFocusMode.UCP;
            SetFocus(UCPFocusMode.Game);
        }
Ejemplo n.º 3
0
        private UISelectHouseView SelWallsPanel; //select view panel that is created when clicking the current walls mode

        #endregion Fields

        #region Constructors

        public UIUCP(UIScreen owner)
        {
            this.RenderScript("ucp.uis");

            Game = (CoreGameScreen)owner;

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

            BackgroundMatchmaker = new UIImage(BackgroundMatchmakerImage);
            BackgroundMatchmaker.Y = 81;
            this.AddAt(0, BackgroundMatchmaker);
            BackgroundMatchmaker.BlockInput();

            TimeText.Caption = "12:00 am";
            TimeText.CaptionStyle = TimeText.CaptionStyle.Clone();
            TimeText.CaptionStyle.Shadow = true;
            MoneyText.Caption = "§0";
            MoneyText.CaptionStyle = TimeText.CaptionStyle.Clone();
            MoneyText.CaptionStyle.Shadow = true;

            CurrentPanel = -1;

            OptionsModeButton.OnButtonClick += new ButtonClickDelegate(OptionsModeButton_OnButtonClick);
            LiveModeButton.OnButtonClick += new ButtonClickDelegate(LiveModeButton_OnButtonClick);
            BuyModeButton.OnButtonClick += new ButtonClickDelegate(BuyModeButton_OnButtonClick);
            BuildModeButton.OnButtonClick += BuildModeButton_OnButtonClick;

            ZoomOutButton.OnButtonClick += new ButtonClickDelegate(ZoomControl);
            ZoomInButton.OnButtonClick += new ButtonClickDelegate(ZoomControl);
            PhoneButton.OnButtonClick += new ButtonClickDelegate(PhoneButton_OnButtonClick);

            CloseZoomButton.OnButtonClick += new ButtonClickDelegate(SetCityZoom);
            MediumZoomButton.OnButtonClick += new ButtonClickDelegate(SetCityZoom);
            FarZoomButton.OnButtonClick += new ButtonClickDelegate(SetCityZoom);
            NeighborhoodButton.OnButtonClick += new ButtonClickDelegate(SetCityZoom);
            WorldButton.OnButtonClick += new ButtonClickDelegate(SetCityZoom);

            HouseViewSelectButton.OnButtonClick += new ButtonClickDelegate(WallsViewPopup);
            WallsDownButton.OnButtonClick += new ButtonClickDelegate(WallsViewPopup);
            WallsUpButton.OnButtonClick += new ButtonClickDelegate(WallsViewPopup);
            WallsCutawayButton.OnButtonClick += new ButtonClickDelegate(WallsViewPopup);
            RoofButton.OnButtonClick += new ButtonClickDelegate(WallsViewPopup);

            RotateClockwiseButton.OnButtonClick += new ButtonClickDelegate(RotateClockwise);
            RotateCounterClockwiseButton.OnButtonClick += new ButtonClickDelegate(RotateCounterClockwise);

            FirstFloorButton.OnButtonClick += FirstFloor;
            SecondFloorButton.OnButtonClick += SecondFloor;

            SecondFloorButton.Selected = (Game.Level == Game.Stories);
            FirstFloorButton.Selected = (Game.Level == 1);

            MoneyText.CaptionStyle = MoneyText.CaptionStyle.Clone();

            SetInLot(false);
            SetMode(UCPMode.CityMode);
            Focus = UCPFocusMode.UCP;
            SetFocus(UCPFocusMode.Game);
        }
Ejemplo n.º 4
0
        public UIUCP(UIScreen owner)
        {
            this.RenderScript("ucp.uis");

            Game = (IGameScreen)owner;

            Background = new UIImage(BackgroundGameImage);
            this.AddAt(0, Background);
            Background.BlockInput();
            Size = new Vector2(Background.Width, Background.Height); //for caching


            BackgroundMatchmaker   = new UIImage(BackgroundMatchmakerImage);
            BackgroundMatchmaker.Y = 81;
            this.AddAt(0, BackgroundMatchmaker);
            BackgroundMatchmaker.BlockInput();

            TimeText.Caption              = "12:00 am";
            TimeText.CaptionStyle         = TimeText.CaptionStyle.Clone();
            TimeText.CaptionStyle.Shadow  = true;
            MoneyText.Caption             = "§0";
            MoneyText.CaptionStyle        = TimeText.CaptionStyle.Clone();
            MoneyText.CaptionStyle.Shadow = true;

            CurrentPanel = -1;

            OptionsModeButton.OnButtonClick += new ButtonClickDelegate(OptionsModeButton_OnButtonClick);
            LiveModeButton.OnButtonClick    += new ButtonClickDelegate(LiveModeButton_OnButtonClick);
            BuyModeButton.OnButtonClick     += new ButtonClickDelegate(BuyModeButton_OnButtonClick);
            BuildModeButton.OnButtonClick   += BuildModeButton_OnButtonClick;
            HouseModeButton.OnButtonClick   += (btn) => { SetPanel(4); };

            ZoomOutButton.OnButtonClick += new ButtonClickDelegate(ZoomControl);
            ZoomInButton.OnButtonClick  += new ButtonClickDelegate(ZoomControl);
            PhoneButton.OnButtonClick   += new ButtonClickDelegate(PhoneButton_OnButtonClick);
            HelpButton.OnButtonClick    += HelpButton_OnButtonClick;

            CloseZoomButton.OnButtonClick    += new ButtonClickDelegate(SetCityZoom);
            MediumZoomButton.OnButtonClick   += new ButtonClickDelegate(SetCityZoom);
            FarZoomButton.OnButtonClick      += new ButtonClickDelegate(SetCityZoom);
            NeighborhoodButton.OnButtonClick += new ButtonClickDelegate(SetCityZoom);
            WorldButton.OnButtonClick        += new ButtonClickDelegate(SetCityZoom);

            HouseViewSelectButton.OnButtonClick += new ButtonClickDelegate(WallsViewPopup);
            WallsDownButton.OnButtonClick       += new ButtonClickDelegate(WallsViewPopup);
            WallsUpButton.OnButtonClick         += new ButtonClickDelegate(WallsViewPopup);
            WallsCutawayButton.OnButtonClick    += new ButtonClickDelegate(WallsViewPopup);
            RoofButton.OnButtonClick            += new ButtonClickDelegate(WallsViewPopup);

            RotateClockwiseButton.OnButtonClick        += new ButtonClickDelegate(RotateClockwise);
            RotateCounterClockwiseButton.OnButtonClick += new ButtonClickDelegate(RotateCounterClockwise);

            FirstFloorButton.OnButtonClick  += FirstFloor;
            SecondFloorButton.OnButtonClick += SecondFloor;

            BookmarkButton.OnButtonClick      += BookmarkButton_OnButtonClick;
            FriendshipWebButton.OnButtonClick += FriendshipWebButton_OnButtonClick;

            SecondFloorButton.Selected = (Game.Level == Game.Stories);
            FirstFloorButton.Selected  = (Game.Level == 1);

            MoneyText.CaptionStyle = MoneyText.CaptionStyle.Clone();

            var temp = new UILabel();

            temp.X                   = SecondFloorButton.X + 7;
            temp.Y                   = SecondFloorButton.Y - 14;
            temp.Caption             = "1";
            temp.CaptionStyle        = temp.CaptionStyle.Clone();
            temp.CaptionStyle.Size   = 7;
            temp.CaptionStyle.Shadow = true;
            Add(temp);
            FloorNumLabel = temp;

            SetInLot(false);
            SetMode(UCPMode.CityMode);
            Focus = UCPFocusMode.UCP;
            SetFocus(UCPFocusMode.Game);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Sets the "focus mode" of the UCP, used to make the UI accessible on phones.
        /// </summary>
        /// <param name="focus"></param>
        public void SetFocus(UCPFocusMode focus)
        {
            if (Focus == focus) return;
            if (FSOEnvironment.UIZoomFactor>1f)
            {
                if (focus != UCPFocusMode.Game)
                {
                    var tween = GameFacade.Screens.Tween.To(this, 0.33f, new Dictionary<string, float>()
                    {
                        {"ScaleX", FSOEnvironment.UIZoomFactor},
                        {"ScaleY", FSOEnvironment.UIZoomFactor},
                        {"Y", Game.ScreenHeight-(int)(210*FSOEnvironment.UIZoomFactor) },
                        {"X", (focus == UCPFocusMode.ActiveTab)?-(int)(225*FSOEnvironment.UIZoomFactor):0 }
                    }, TweenQuad.EaseInOut);

                    Remove(SelfBlocker); SelfBlocker = null;
                    if (focus == UCPFocusMode.ActiveTab)
                    {
                        Remove(PanelBlocker); PanelBlocker = null;
                    }

                    if (GameBlocker == null)
                    {
                        GameBlocker = new UIBlocker();
                        GameBlocker.Position = new Vector2(0, 220 - Game.ScreenHeight);
                        GameBlocker.OnMouseEvt += (evt, state) =>
                        {
                            if (evt == UIMouseEventType.MouseDown) SetFocus(UCPFocusMode.Game);
                        };
                        AddAt(0, GameBlocker);
                    }
                } else
                {
                    var tween = GameFacade.Screens.Tween.To(this, 0.33f, new Dictionary<string, float>()
                    {
                        {"ScaleX", 1f},
                        {"ScaleY", 1f},
                        {"Y", Game.ScreenHeight-210 },
                        {"X", 0 }
                    }, TweenQuad.EaseInOut);

                    if (SelfBlocker == null)
                    {
                        SelfBlocker = new UIBlocker(220, 210);
                        SelfBlocker.OnMouseEvt += (evt, state) =>
                        {
                            if (evt == UIMouseEventType.MouseDown) SetFocus(UCPFocusMode.UCP);
                        };
                        Add(SelfBlocker);
                    }

                    if (CurrentPanel > -1 && PanelBlocker == null)
                    {
                        PanelBlocker = new UIBlocker(580, 104);
                        PanelBlocker.Position = new Vector2(220, 106);
                        PanelBlocker.OnMouseEvt += (evt, state) =>
                        {
                            if (evt == UIMouseEventType.MouseDown) SetFocus(UCPFocusMode.ActiveTab);
                        };
                        Add(PanelBlocker);
                    }

                    Remove(GameBlocker); GameBlocker = null;
                }
            }
            Focus = focus;
        }