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

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

            if (state.NewKeys.Contains(Keys.F1) && state.CtrlDown)
            {
                FSOFacade.Controller.ToggleDebugMenu();
            }

            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 (_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.GameContent.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(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;
        }
コード例 #3
0
ファイル: UINewspaperEOD.cs プロジェクト: terrynoya/FreeSO
        private void OnSkillHover(UIMouseEventType type, Common.Rendering.Framework.Model.UpdateState state, int id)
        {
            switch (type)
            {
            case UIMouseEventType.MouseOver:
                Graph.SetHover(id);
                foreach (var skl in SkillLabels)
                {
                    skl.Opacity = 0.5f;
                }
                SkillLabels[id].Opacity = 1f;
                break;

            case UIMouseEventType.MouseOut:
                Graph.SetHover(-1);
                foreach (var skl in SkillLabels)
                {
                    skl.Opacity = 1f;
                }
                break;
            }
        }
コード例 #4
0
ファイル: UIUCP.cs プロジェクト: HarryFreeMyLand/newso
        public override void Update(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)
            {
                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
            }
        }
コード例 #5
0
        public override void Update(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;
            }
        }