コード例 #1
0
        public override void Update(FSO.Common.Rendering.Framework.Model.UpdateState state)
        {
            GameFacade.Game.IsFixedTimeStep = (vm == null || vm.Ready);

            Visible = World?.Visible == true && (World?.State as FSO.LotView.RC.WorldStateRC)?.CameraMode != true;
            GameFacade.Game.IsMouseVisible = Visible;

            if (state.WindowFocused && state.NewKeys.Contains(Microsoft.Xna.Framework.Input.Keys.F1) && state.CtrlDown)
            {
                FSOFacade.Controller.ToggleDebugMenu();
            }

            base.Update(state);

            if (state.WindowFocused && state.InputManager.GetFocus() == null)
            {
                if (state.NewKeys.Contains(Keys.D1) || (state.KeyboardState.NumLock && state.NewKeys.Contains(Keys.NumPad1)))
                {
                    ChangeSpeedTo(1);
                }
                else if (state.NewKeys.Contains(Keys.D2) || (state.KeyboardState.NumLock && state.NewKeys.Contains(Keys.NumPad2)))
                {
                    ChangeSpeedTo(2);
                }
                else if (state.NewKeys.Contains(Keys.D3) || (state.KeyboardState.NumLock && state.NewKeys.Contains(Keys.NumPad3)))
                {
                    ChangeSpeedTo(3);
                }
                else if (state.NewKeys.Contains(Keys.P) || state.NewKeys.Contains(Keys.D0) || (state.KeyboardState.NumLock && state.NewKeys.Contains(Keys.NumPad0)))
                {
                    ChangeSpeedTo(0);
                }
            }

            if (World != null)
            {
                //stub smooth zoom?
            }

            lock (StateChanges)
            {
                while (StateChanges.Count > 0)
                {
                    var e = StateChanges.Dequeue();
                    ClientStateChangeProcess(e.State, e.Progress);
                }
            }

            if (SwitchLot > 0)
            {
                InitializeLot(Path.Combine(Content.Content.Get().TS1BasePath, "UserData/Houses/House" + SwitchLot.ToString().PadLeft(2, '0') + ".iff"), false);
                SwitchLot = -1;
            }
            if (vm != null)
            {
                vm.Update();
            }
        }
コード例 #2
0
        public override void Update(FSO.Common.Rendering.Framework.Model.UpdateState state)
        {
            GameFacade.Game.IsFixedTimeStep = (vm == null || vm.Ready);

            Visible = (World?.State as FSO.LotView.RC.WorldStateRC)?.CameraMode != true;
            GameFacade.Game.IsMouseVisible = Visible;

            base.Update(state);
            if (state.NewKeys.Contains(Keys.NumPad1))
            {
                ChangeSpeedTo(1);
            }
            if (state.NewKeys.Contains(Keys.NumPad2))
            {
                ChangeSpeedTo(2);
            }
            if (state.NewKeys.Contains(Keys.NumPad3))
            {
                ChangeSpeedTo(3);
            }
            if (state.NewKeys.Contains(Keys.P))
            {
                ChangeSpeedTo(0);
            }

            if (World != null)
            {
                //stub smooth zoom?
            }

            if (SwitchLot > 0)
            {
                if (!Downtown)
                {
                    SavedLot = vm.Save();
                }
                if (SwitchLot == ActiveFamily.HouseNumber && SavedLot != null)
                {
                    Downtown = false;
                    InitializeLot(SavedLot);
                    SavedLot = null;
                }
                else
                {
                    Downtown = true;
                    InitializeLot(Path.Combine(Content.Get().TS1BasePath, "UserData/Houses/House" + SwitchLot.ToString().PadLeft(2, '0') + ".iff"), false);
                }
                SwitchLot = -1;
            }
            //vm.Context.Clock.Hours = 12;
            if (vm != null)
            {
                vm.Update();
            }

            //SaveHouseButton_OnButtonClick(null);
        }
コード例 #3
0
 public void Update(FSO.Common.Rendering.Framework.Model.UpdateState state)
 {
     foreach (var scene in Scenes)
     {
         scene.Update(state);
     }
     foreach (var scene in External)
     {
         scene.Update(state);
     }
 }
コード例 #4
0
        public override void Update(FSO.Common.Rendering.Framework.Model.UpdateState state)
        {
            GameFacade.Game.IsFixedTimeStep = (vm == null || vm.Ready);

            Visible = World?.Visible == true && (World?.State as FSO.LotView.RC.WorldStateRC)?.CameraMode != true;
            GameFacade.Game.IsMouseVisible = Visible;

            base.Update(state);
            if (state.NewKeys.Contains(Keys.NumPad1))
            {
                ChangeSpeedTo(1);
            }
            if (state.NewKeys.Contains(Keys.NumPad2))
            {
                ChangeSpeedTo(2);
            }
            if (state.NewKeys.Contains(Keys.NumPad3))
            {
                ChangeSpeedTo(3);
            }
            if (state.NewKeys.Contains(Keys.P))
            {
                ChangeSpeedTo(0);
            }

            if (World != null)
            {
                //stub smooth zoom?
            }

            lock (StateChanges)
            {
                while (StateChanges.Count > 0)
                {
                    var e = StateChanges.Dequeue();
                    ClientStateChangeProcess(e.State, e.Progress);
                }
            }

            if (SwitchLot > 0)
            {
                InitializeLot(Path.Combine(Content.Content.Get().TS1BasePath, "UserData/Houses/House" + SwitchLot.ToString().PadLeft(2, '0') + ".iff"), false);
                SwitchLot = -1;
            }
            if (vm != null)
            {
                vm.Update();
            }
        }
コード例 #5
0
        public override void Update(FSO.Common.Rendering.Framework.Model.UpdateState state)
        {
            base.Update(state);
            if (m_BgGrow < 1)
            {
                m_BgGrow       += 1.0 / 30.0;
                HeadCamera.Zoom = (float)m_BgGrow * 5.12f;

                m_Bg.SetSize((float)m_BgGrow * 200, (float)m_BgGrow * 200);
                m_Bg.X = (float)m_BgGrow * (-100);
                m_Bg.Y = (float)m_BgGrow * (-100);
            }
            RotateHeadCam(GlobalPoint(new Vector2(state.MouseState.X, state.MouseState.Y)));
            ShiftDown = state.KeyboardState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift);
        }
コード例 #6
0
ファイル: UILiveMode.cs プロジェクト: pepster98/FreeSO
        public override void Update(FSO.Common.Rendering.Framework.Model.UpdateState state)
        {
            base.Update(state);
            if (SelectedAvatar != null)
            {
                if (SelectedAvatar != LastSelected)
                {
                    Thumbnail.Texture = SelectedAvatar.GetIcon(GameFacade.GraphicsDevice, 0);
                    Thumbnail.Tooltip = SelectedAvatar.Name;
                    LastSelected      = SelectedAvatar;
                }

                UpdateMotives();
            }
        }
コード例 #7
0
ファイル: UIPieMenu.cs プロジェクト: LinSianTing/FreeSO
        public override void Update(FSO.Common.Rendering.Framework.Model.UpdateState state)
        {
            base.Update(state);
            if (m_BgGrow < 1)
            {
                m_BgGrow       += 1.0 / 30.0 * (60.0 / FSOEnvironment.RefreshRate);
                HeadCamera.Zoom = (float)m_BgGrow * 5.12f;

                m_Bg.SetSize((float)m_BgGrow * 200, (float)m_BgGrow * 200);
                m_Bg.X = (float)m_BgGrow * (-100);
                m_Bg.Y = (float)m_BgGrow * (-100);
            }
            RotateHeadCam(GlobalPoint(new Vector2(state.MouseState.X, state.MouseState.Y)));
            ShiftDown = state.ShiftDown;
        }
コード例 #8
0
        public override void Update(FSO.Common.Rendering.Framework.Model.UpdateState state)
        {
            int min  = NetworkFacade.ServerTime.Minute;
            int hour = NetworkFacade.ServerTime.Hour;

            if (Game.InLot) //if ingame, use time from ingame clock (should be very close to server time anyways, if we set the game pacing up right...)
            {
                min  = Game.vm.Context.Clock.Minutes;
                hour = Game.vm.Context.Clock.Hours;
            }

            string suffix = (hour > 11) ? "pm" : "am";

            hour %= 12;
            if (hour == 0)
            {
                hour = 12;
            }

            TimeText.Caption = hour.ToString() + ":" + ZeroPad(min.ToString(), 2) + " " + suffix;

            base.Update(state);
        }
コード例 #9
0
ファイル: UILiveMode.cs プロジェクト: simscolony/FreeSims
        public override void Update(FSO.Common.Rendering.Framework.Model.UpdateState state)
        {
            base.Update(state);
            if (SelectedAvatar != null)
            {
                if (SelectedAvatar != LastSelected)
                {
                    if (Thumb != null)
                    {
                        Remove(Thumb);
                    }
                    Thumb = new UIPersonIcon(SelectedAvatar, LotController.vm, false);
                    UpdateThumbPosition();
                    Add(Thumb);
                    LastSelected = SelectedAvatar;
                }

                UpdateMotives();
                Skills.UpdateSkills(SelectedAvatar);
            }

            if (LastEODConfig != LotController.EODs.DisplayMode)
            {
                HideEOD = false;
                SetInEOD(LotController.EODs.DisplayMode, LotController.EODs.ActiveEOD);
            }

            if (LotController.EODs.EODMessage != (string)MsgWinTextEntry.Items[0].Data)
            {
                MsgWinTextEntry.Items[0].Data       = LotController.EODs.EODMessage;
                MsgWinTextEntry.Items[0].Columns[0] = LotController.EODs.EODMessage;
            }
            if (LotController.EODs.EODTime != TimerTextEntry.CurrentText)
            {
                TimerTextEntry.CurrentText = LotController.EODs.EODTime;
            }
        }
コード例 #10
0
        public override void Update(FSO.Common.Rendering.Framework.Model.UpdateState state)
        {
            GameFacade.Game.IsFixedTimeStep = (vm == null || vm.Ready);

            Visible = World?.Visible != false && World?.State.Cameras.HideUI != true;
            GameFacade.Game.IsMouseVisible = Visible;

            if (state.NewKeys.Contains(Keys.D1))
            {
                ChangeSpeedTo(1);
            }
            if (state.NewKeys.Contains(Keys.D2))
            {
                ChangeSpeedTo(2);
            }
            if (state.NewKeys.Contains(Keys.D3))
            {
                ChangeSpeedTo(3);
            }
            if (state.NewKeys.Contains(Keys.P))
            {
                ChangeSpeedTo(0);
            }
            if (state.NewKeys.Contains(Keys.D0))
            {
                //frame advance
                ChangeSpeedTo(1);
                GameThread.NextUpdate((FSO.Common.Rendering.Framework.Model.UpdateState ustate) => ChangeSpeedTo(0));
            }
            base.Update(state);

            if (state.NewKeys.Contains(Microsoft.Xna.Framework.Input.Keys.F12) && GraphicsModeControl.Mode != GlobalGraphicsMode.Full2D)
            {
                GraphicsModeControl.ChangeMode((GraphicsModeControl.Mode == GlobalGraphicsMode.Full3D) ? GlobalGraphicsMode.Hybrid2D : GlobalGraphicsMode.Full3D);
            }

            /*
             * if (state.NewKeys.Contains(Keys.F12))
             * {
             *  ChangeSpeedTo(1);
             *  //running 10000 ticks
             *  var timer = new System.Diagnostics.Stopwatch();
             *  timer.Start();
             *
             *  for (int i=0; i<10000; i++)
             *  {
             *      vm.Tick();
             *  }
             *
             *  timer.Stop();
             *  UIScreen.GlobalShowDialog(new UIMobileAlert(new UIAlertOptions() {
             *      Title = "Benchmark",
             *      Message = "10000 ticks took " + timer.ElapsedMilliseconds + "ms."
             *  }), true);
             * }
             */

            if (World != null)
            {
                //stub smooth zoom?
            }

            if (SwitchLot > 0)
            {
                if (!Downtown)
                {
                    SavedLot = vm.Save();
                }
                if (SwitchLot == ActiveFamily.HouseNumber && SavedLot != null)
                {
                    Downtown = false;
                    InitializeLot(SavedLot);
                    SavedLot = null;
                }
                else
                {
                    Downtown = true;
                    InitializeLot(Content.Get().Neighborhood.GetHousePath(SwitchLot), false);
                }
                SwitchLot = -1;
            }
            //vm.Context.Clock.Hours = 12;
            if (vm != null)
            {
                vm.Update();
            }

            //SaveHouseButton_OnButtonClick(null);
        }
コード例 #11
0
ファイル: UIUCP.cs プロジェクト: yuripourre-forks/FreeSO
        public override void Update(FSO.Common.Rendering.Framework.Model.UpdateState state)
        {
            var time    = DateTime.UtcNow;
            var tsoTime = TSOTime.FromUTC(time);
            int min     = tsoTime.Item2;
            int hour    = tsoTime.Item1;

            if (MoneyHighlightFrames > 0)
            {
                if (--MoneyHighlightFrames == 0)
                {
                    MoneyText.CaptionStyle.Color = TextStyle.DefaultLabel.Color;
                }
            }
            uint budget = 0;

            if (Game.InLot)
            {
                // if ingame, use time from ingame clock
                // (should be very close to server time anyways, if we set the game pacing up right...)
                min  = Game.vm.Context.Clock.Minutes;
                hour = Game.vm.Context.Clock.Hours;

                // update with ingame budget.
                var cont = Game.LotControl;
                if (cont.ActiveEntity != null && cont.ActiveEntity is VMAvatar)
                {
                    var avatar = (VMAvatar)cont.ActiveEntity;
                    budget = avatar.TSOState.Budget.Value;

                    //check if we have build/buy permissions
                    //TODO: global build/buy enable/disable (via the global calls)
                    BuildModeButton.Disabled = ((VMTSOAvatarState)(avatar.TSOState)).Permissions
                                               < VMTSOAvatarPermissions.BuildBuyRoommate;
                    HouseModeButton.Disabled = BuyModeButton.Disabled;

                    if (CurrentPanel == 2)
                    {
                        var panel    = (UIBuyMode)Panel;
                        var isRoomie = ((VMTSOAvatarState)(avatar.TSOState)).Permissions
                                       >= VMTSOAvatarPermissions.Roommate;
                        panel.SetRoommate(isRoomie);
                    }
                }
                var level = Game.LotControl.World.State.Level.ToString();
                if (FloorNumLabel.Caption != level)
                {
                    FloorNumLabel.Caption = level;
                }

                if (CurrentPanel == 3 && BuildModeButton.Disabled)
                {
                    SetPanel(-1);
                }
                if (LastZoom != Game.ZoomLevel)
                {
                    UpdateZoomButton();
                }
            }
            else
            {
                budget = OldMoney;
            }

            if (budget != OldMoney)
            {
                OldMoney = budget;
                MoneyText.CaptionStyle.Color = Color.White;
                MoneyHighlightFrames         = 45;
                Game.VisualBudget            = budget;
            }

            string suffix = (hour > 11) ? "pm" : "am";

            hour %= 12;
            if (hour == 0)
            {
                hour = 12;
            }

            TimeText.Caption  = hour.ToString() + ":" + ZeroPad(min.ToString(), 2) + " " + suffix;
            MoneyText.Caption = "$" + Game.VisualBudget.ToString("##,#0");

            if (InboxFlashing)
            {
                if ((InboxFlashTime++) > FSOEnvironment.RefreshRate / 2)
                {
                    if (PhoneButton.ForceState == 2)
                    {
                        PhoneButton.ForceState = -1;
                        Invalidate();
                    }
                }
                else
                {
                    if (PhoneButton.ForceState != 2)
                    {
                        PhoneButton.ForceState = 2;
                        Invalidate();
                    }
                }
                InboxFlashTime %= FSOEnvironment.RefreshRate;
            }

            var keys    = state.NewKeys;
            var nofocus = state.InputManager.GetFocus() == null;

            base.Update(state);
            if (Game.InLot && state.WindowFocused)
            {
                if (keys.Contains(Keys.F1) && !state.CtrlDown)
                {
                    SetPanel(1);                                            // Live Mode Panel
                }
                if (keys.Contains(Keys.F2))
                {
                    SetPanel(2);                         // Buy Mode Panel
                }
                if (keys.Contains(Keys.F3) && !BuildModeButton.Disabled)
                {
                    SetPanel(3);                                                      // Build Mode Panel
                }
                if (keys.Contains(Keys.F4))
                {
                    SetPanel(4);                         // House Mode Panel
                }
                if (nofocus)
                {
                    if (FSOEnvironment.Enable3D)
                    {
                        //if the zoom or rotation buttons are down, gradually change their values.
                        if (RotateClockwiseButton.IsDown || state.KeyboardState.IsKeyDown(Keys.OemPeriod))
                        {
                            ((WorldStateRC)Game.vm.Context.World.State).RotationX += 2f / FSOEnvironment.RefreshRate;
                        }
                        if (RotateCounterClockwiseButton.IsDown || state.KeyboardState.IsKeyDown(Keys.OemComma))
                        {
                            ((WorldStateRC)Game.vm.Context.World.State).RotationX -= 2f / FSOEnvironment.RefreshRate;
                        }
                        if (ZoomInButton.IsDown || (state.KeyboardState.IsKeyDown(Keys.OemPlus) && !state.CtrlDown))
                        {
                            Game.LotControl.TargetZoom = Math.Max(0.25f, Math.Min(Game.LotControl.TargetZoom + 1f / FSOEnvironment.RefreshRate, 2));
                        }
                        if (ZoomOutButton.IsDown || (state.KeyboardState.IsKeyDown(Keys.OemMinus) && !state.CtrlDown))
                        {
                            Game.LotControl.TargetZoom = Math.Max(0.25f, Math.Min(Game.LotControl.TargetZoom - 1f / FSOEnvironment.RefreshRate, 2));
                        }
                    }
                    else
                    {
                        if (keys.Contains(Keys.OemPlus) && !state.CtrlDown && !ZoomInButton.Disabled)
                        {
                            Game.ZoomLevel -= 1; UpdateZoomButton();
                        }
                        if (keys.Contains(Keys.OemMinus) && !state.CtrlDown && !ZoomOutButton.Disabled)
                        {
                            Game.ZoomLevel += 1; UpdateZoomButton();
                        }
                        if (keys.Contains(Keys.OemComma))
                        {
                            RotateCounterClockwise(null);
                        }
                        if (keys.Contains(Keys.OemPeriod))
                        {
                            RotateClockwise(null);
                        }
                    }
                    if (keys.Contains(Keys.PageDown))
                    {
                        FirstFloor(null);
                    }
                    if (keys.Contains(Keys.PageUp))
                    {
                        SecondFloor(null);
                    }
                    if (keys.Contains(Keys.Home))
                    {
                        UpdateWallsViewKeyHandler(1);
                    }
                    if (keys.Contains(Keys.End))
                    {
                        UpdateWallsViewKeyHandler(0);
                    }
                }
            }
            if (keys.Contains(Keys.F5))
            {
                SetPanel(5);                         // Options Mode Panel
            }
        }
コード例 #12
0
 /// <summary>
 /// Updates this Avatar instance.
 /// </summary>
 /// <param name="state">An UpdateState instance.</param>
 public override void Update(FSO.Common.Rendering.Framework.Model.UpdateState state)
 {
 }
コード例 #13
0
ファイル: UILiveMode.cs プロジェクト: terrynoya/FreeSO
        public override void Update(FSO.Common.Rendering.Framework.Model.UpdateState state)
        {
            if (SelectedAvatar != null)
            {
                if (SelectedAvatar != LastSelected)
                {
                    if (Thumb != null)
                    {
                        Remove(Thumb);
                    }
                    Thumb = new UIVMPersonButton(SelectedAvatar, LotController.vm, false);
                    UpdateThumbPosition();
                    Add(Thumb);
                    LastSelected = SelectedAvatar;
                }

                UpdateMotives();
            }
            base.Update(state);

            var jobMode = JobUI != null;

            StatusBarTimerTextEntry.Visible  = jobMode;
            StatusBarMsgWinStraight.Visible  = jobMode;
            StatusBarMsgWinTextEntry.Visible = jobMode;
            StatusBarTimerStraight.Visible   = jobMode;

            if (jobMode)
            {
                JobUI = LotController.vm.TSOState.JobUI;
                bool textDirty = false;
                if (StatusBarMsgWinTextEntry.Items.Count != JobUI.MessageText.Count)
                {
                    textDirty = true;
                }
                else
                {
                    for (int i = 0; i < JobUI.MessageText.Count; i++)
                    {
                        if (!StatusBarMsgWinTextEntry.Items[i].Columns[0].Equals(JobUI.MessageText[i]))
                        {
                            textDirty = true;
                            break;
                        }
                    }
                }

                if (textDirty)
                {
                    StatusBarMsgWinTextEntry.Items        = JobUI.MessageText.Select(x => new UIListBoxItem(x, x)).ToList();
                    StatusBarMsgWinTextEntry.ScrollOffset = 0;
                    StatusBarCycleTime = 0;
                }

                StatusBarTimerBreakIcon.Visible = JobUI.Mode == VMTSOJobMode.Intermission;
                StatusBarTimerWorkIcon.Visible  = JobUI.Mode == VMTSOJobMode.Round;
                var timeText = " " + JobUI.Minutes + ":" + (JobUI.Seconds.ToString().PadLeft(2, '0'));
                if (StatusBarTimerTextEntry.CurrentText != timeText)
                {
                    StatusBarTimerTextEntry.CurrentText = timeText;
                }

                if (StatusBarCycleTime++ > 60 * 4 && StatusBarMsgWinTextEntry.Items.Count > 0)
                {
                    StatusBarMsgWinTextEntry.ScrollOffset = (StatusBarMsgWinTextEntry.ScrollOffset + 1) % StatusBarMsgWinTextEntry.Items.Count;
                    StatusBarCycleTime = 0;
                }
            }
            else
            {
                StatusBarTimerBreakIcon.Visible = false;
                StatusBarTimerWorkIcon.Visible  = false;

                JobUI = LotController.vm.TSOState.JobUI;
            }

            if (LastEODConfig != LotController.EODs.DisplayMode)
            {
                HideEOD = false;
                SetInEOD(LotController.EODs.DisplayMode, LotController.EODs.ActiveEOD);
            }

            if (LotController.EODs.EODMessage != (string)MsgWinTextEntry.Items[0].Data)
            {
                MsgWinTextEntry.Items[0].Data       = LotController.EODs.EODMessage;
                MsgWinTextEntry.Items[0].Columns[0] = LotController.EODs.EODMessage;
            }
            if (LotController.EODs.EODTime != TimerTextEntry.CurrentText)
            {
                TimerTextEntry.CurrentText = LotController.EODs.EODTime;
            }
        }
コード例 #14
0
        public override void Update(FSO.Common.Rendering.Framework.Model.UpdateState state)
        {
            GameFacade.Game.IsFixedTimeStep = (vm == null || vm.Ready);

            Visible = World?.Visible == true && World?.State.Cameras.HideUI == false;
            GameFacade.Game.IsMouseVisible = Visible;

            if (state.WindowFocused && state.NewKeys.Contains(Microsoft.Xna.Framework.Input.Keys.F1) && state.CtrlDown)
            {
                FSOFacade.Controller.ToggleDebugMenu();
            }

            base.Update(state);

            if (state.WindowFocused && state.InputManager.GetFocus() == null)
            {
                if (state.NewKeys.Contains(Keys.D1) || (state.KeyboardState.NumLock && state.NewKeys.Contains(Keys.NumPad1)))
                {
                    ChangeSpeedTo(1);
                }
                else if (state.NewKeys.Contains(Keys.D2) || (state.KeyboardState.NumLock && state.NewKeys.Contains(Keys.NumPad2)))
                {
                    ChangeSpeedTo(2);
                }
                else if (state.NewKeys.Contains(Keys.D3) || (state.KeyboardState.NumLock && state.NewKeys.Contains(Keys.NumPad3)))
                {
                    ChangeSpeedTo(3);
                }
                else if (state.NewKeys.Contains(Keys.P) || state.NewKeys.Contains(Keys.D0) || (state.KeyboardState.NumLock && state.NewKeys.Contains(Keys.NumPad0)))
                {
                    ChangeSpeedTo(0);
                }
            }

            if (World != null)
            {
                //stub smooth zoom?
                if (state.NewKeys.Contains(Keys.F11))
                {
                    //render lot thumbnail test
                    var thumb = World.GetLotThumb(GameFacade.GraphicsDevice, null);
                    var alert = UIAlert.Alert("Thumbnail Test", ".", false);
                    alert.SetIcon(thumb, thumb.Width, thumb.Height);
                    alert.SetSize(thumb.Width + 100, thumb.Height + 100);
                }
            }

            lock (StateChanges)
            {
                while (StateChanges.Count > 0)
                {
                    var e = StateChanges.Dequeue();
                    ClientStateChangeProcess(e.State, e.Progress);
                }
            }

            if (SwitchLot > 0)
            {
                InitializeLot(Path.Combine(Content.Content.Get().TS1BasePath, "UserData/Houses/House" + SwitchLot.ToString().PadLeft(2, '0') + ".iff"), false);
                SwitchLot = -1;
            }
            if (vm != null)
            {
                vm.Update();
            }

            if (state.NewKeys.Contains(Microsoft.Xna.Framework.Input.Keys.F12) && GraphicsModeControl.Mode != GlobalGraphicsMode.Full2D)
            {
                GraphicsModeControl.ChangeMode((GraphicsModeControl.Mode == GlobalGraphicsMode.Full3D) ? GlobalGraphicsMode.Hybrid2D : GlobalGraphicsMode.Full3D);
            }
        }
コード例 #15
0
ファイル: UIUCP.cs プロジェクト: fourks/FreeSO
        public override void Update(FSO.Common.Rendering.Framework.Model.UpdateState state)
        {
            var time    = DateTime.UtcNow;
            var tsoTime = TSOTime.FromUTC(time);
            int min     = tsoTime.Item2;
            int hour    = tsoTime.Item1;

            if (MoneyHighlightFrames > 0)
            {
                if (--MoneyHighlightFrames == 0)
                {
                    MoneyText.CaptionStyle.Color = TextStyle.DefaultLabel.Color;
                }
            }
            uint budget = 0;

            if (Game.InLot)
            {
                // if ingame, use time from ingame clock
                // (should be very close to server time anyways, if we set the game pacing up right...)
                min  = Game.vm.Context.Clock.Minutes;
                hour = Game.vm.Context.Clock.Hours;

                // update with ingame budget.
                var cont = Game.LotControl;
                if (cont.ActiveEntity != null && cont.ActiveEntity is VMAvatar)
                {
                    var avatar = (VMAvatar)cont.ActiveEntity;
                    budget = avatar.TSOState.Budget.Value;

                    //check if we have build/buy permissions
                    //TODO: global build/buy enable/disable (via the global calls)
                    BuildModeButton.Disabled = ((VMTSOAvatarState)(avatar.TSOState)).Permissions
                                               < VMTSOAvatarPermissions.BuildBuyRoommate;
                    HouseModeButton.Disabled = BuyModeButton.Disabled;

                    if (CurrentPanel == 2)
                    {
                        var panel    = (UIBuyMode)Panel;
                        var isRoomie = ((VMTSOAvatarState)(avatar.TSOState)).Permissions
                                       >= VMTSOAvatarPermissions.Roommate;
                        panel.SetRoommate(isRoomie);
                    }
                }
                var level = Game.LotControl.World.State.Level.ToString();
                if (FloorNumLabel.Caption != level)
                {
                    FloorNumLabel.Caption = level;
                }

                if (CurrentPanel == 3 && BuildModeButton.Disabled)
                {
                    SetPanel(-1);
                }
            }
            else
            {
                budget = OldMoney;
            }

            if (budget != OldMoney)
            {
                OldMoney = budget;
                MoneyText.CaptionStyle.Color = Color.White;
                MoneyHighlightFrames         = 45;
                Game.VisualBudget            = budget;
            }

            string suffix = (hour > 11) ? "pm" : "am";

            hour %= 12;
            if (hour == 0)
            {
                hour = 12;
            }

            TimeText.Caption  = hour.ToString() + ":" + ZeroPad(min.ToString(), 2) + " " + suffix;
            MoneyText.Caption = "$" + Game.VisualBudget.ToString("##,#0");

            base.Update(state);
        }
コード例 #16
0
        public override void Update(FSO.Common.Rendering.Framework.Model.UpdateState state)
        {
            //ScaleX = ScaleY = 1;
            if (MoneyHighlightFrames > 0)
            {
                if (--MoneyHighlightFrames == 0)
                {
                    MoneyText.CaptionStyle.Color = TextStyle.DefaultLabel.Color;
                }
            }

            int  min    = NetworkFacade.ServerTime.Minute;
            int  hour   = NetworkFacade.ServerTime.Hour;
            uint budget = 0;

            if (Game.InLot)
            {
                // if ingame, use time from ingame clock
                // (should be very close to server time anyways, if we set the game pacing up right...)
                min  = Game.vm.Context.Clock.Minutes;
                hour = Game.vm.Context.Clock.Hours;

                // update with ingame budget.
                var cont = Game.LotController;
                if (cont.ActiveEntity != null && cont.ActiveEntity is VMAvatar)
                {
                    var avatar = (VMAvatar)cont.ActiveEntity;
                    budget = avatar.TSOState.Budget.Value;

                    //check if we have build/buy permissions
                    //TODO: global build/buy enable/disable (via the global calls)
                    BuyModeButton.Disabled = ((VMTSOAvatarState)(avatar.TSOState)).Permissions
                                             < VMTSOAvatarPermissions.Roommate;
                    BuildModeButton.Disabled = ((VMTSOAvatarState)(avatar.TSOState)).Permissions
                                               < VMTSOAvatarPermissions.BuildBuyRoommate;
                    HouseModeButton.Disabled = BuyModeButton.Disabled;
                }

                if (CurrentPanel == 2 && BuyModeButton.Disabled || CurrentPanel == 3 && BuildModeButton.Disabled)
                {
                    SetPanel(-1);
                }
            }

            if (budget != OldMoney)
            {
                OldMoney = budget;
                MoneyText.CaptionStyle.Color = Color.White;
                MoneyHighlightFrames         = 45;
            }

            string suffix = (hour > 11) ? "pm" : "am";

            hour %= 12;
            if (hour == 0)
            {
                hour = 12;
            }

            TimeText.Caption = hour.ToString() + ":" + ZeroPad(min.ToString(), 2) + " " + suffix;

            MoneyText.Caption = "$" + budget.ToString("##,#0");

            base.Update(state);
        }
コード例 #17
0
        public override void Update(FSO.Common.Rendering.Framework.Model.UpdateState state)
        {
            GameFacade.Game.IsFixedTimeStep = (vm == null || vm.Ready);

            Visible = (World?.State as FSO.LotView.RC.WorldStateRC)?.CameraMode != true;
            GameFacade.Game.IsMouseVisible = Visible;

            base.Update(state);
            if (state.NewKeys.Contains(Keys.D1))
            {
                ChangeSpeedTo(1);
            }
            if (state.NewKeys.Contains(Keys.D2))
            {
                ChangeSpeedTo(2);
            }
            if (state.NewKeys.Contains(Keys.D3))
            {
                ChangeSpeedTo(3);
            }
            if (state.NewKeys.Contains(Keys.P))
            {
                ChangeSpeedTo(0);
            }

            if (state.NewKeys.Contains(Keys.F12))
            {
                ChangeSpeedTo(1);
                //running 10000 ticks
                var timer = new System.Diagnostics.Stopwatch();
                timer.Start();

                for (int i = 0; i < 10000; i++)
                {
                    vm.Tick();
                }

                timer.Stop();
                UIScreen.GlobalShowDialog(new UIMobileAlert(new UIAlertOptions()
                {
                    Title   = "Benchmark",
                    Message = "10000 ticks took " + timer.ElapsedMilliseconds + "ms."
                }), true);
            }

            if (World != null)
            {
                //stub smooth zoom?
            }

            if (SwitchLot > 0)
            {
                if (!Downtown)
                {
                    SavedLot = vm.Save();
                }
                if (SwitchLot == ActiveFamily.HouseNumber && SavedLot != null)
                {
                    Downtown = false;
                    InitializeLot(SavedLot);
                    SavedLot = null;
                }
                else
                {
                    Downtown = true;
                    InitializeLot(Content.Get().Neighborhood.GetHousePath(SwitchLot), false);
                }
                SwitchLot = -1;
            }
            //vm.Context.Clock.Hours = 12;
            if (vm != null)
            {
                vm.Update();
            }

            //SaveHouseButton_OnButtonClick(null);
        }