コード例 #1
0
ファイル: ScreenViewModel.cs プロジェクト: taradinoc/ZDebug
        private void StoryService_StoryClosing(object sender, StoryClosingEventArgs e)
        {
            windowManager.Root.Close();

            mainWindow  = null;
            upperWindow = null;
        }
コード例 #2
0
        private void OnGameOpened(object sender, EventArgs e)
        {
            this.mainWindow = this.windowManager.OpenWindow(ZWindowKind.TextBuffer);
            this.windowContainer.Children.Add(this.mainWindow);
            this.upperWindow = this.windowManager.OpenWindow(ZWindowKind.TextGrid, this.mainWindow, ZWindowPosition.Above);

            this.windowManager.ActivateWindow(this.mainWindow);
        }
コード例 #3
0
ファイル: ScreenViewModel.cs プロジェクト: taradinoc/ZDebug
        private void StoryService_StoryOpened(object sender, StoryOpenedEventArgs e)
        {
            mainWindow = windowManager.Open(ZWindowType.TextBuffer);
            windowContainer.Children.Add(mainWindow);
            upperWindow = windowManager.Open(ZWindowType.TextGrid, mainWindow, ZWindowPosition.Above, ZWindowSizeType.Fixed, 0);

            windowManager.Activate(mainWindow);
        }
コード例 #4
0
ファイル: OutputViewModel.cs プロジェクト: taradinoc/ZDebug
        private void DebuggerService_MachineCreated(object sender, MachineCreatedEventArgs e)
        {
            mainWindow = windowManager.Open(ZWindowType.TextBuffer);
            windowContainer.Children.Add(mainWindow);
            upperWindow = windowManager.Open(ZWindowType.TextGrid, mainWindow, ZWindowPosition.Above, ZWindowSizeType.Fixed, 0);

            windowManager.Activate(mainWindow);

            debuggerService.Machine.RegisterScreen(this);
            debuggerService.Machine.RegisterSoundEngine(this);
        }
コード例 #5
0
        private void DebuggerService_MachineCreated(object sender, MachineCreatedEventArgs e)
        {
            mainWindow = windowManager.Open(ZWindowType.TextBuffer);
            windowContainer.Children.Add(mainWindow);
            upperWindow = windowManager.Open(ZWindowType.TextGrid, mainWindow, ZWindowPosition.Above, ZWindowSizeType.Fixed, 0);

            windowManager.Activate(mainWindow);

            debuggerService.Machine.RegisterScreen(this);
            debuggerService.Machine.RegisterSoundEngine(this);

            // Listen to SizeChanged events for updating the screen size.
            // Otherwise, the size of the output window at load time determines the registered size
            mainWindow.SizeChanged += OutputViewModel_SizeChanged;
        }
コード例 #6
0
 private void OnGameClosing(object sender, EventArgs e)
 {
     this.mainWindow  = null;
     this.upperWindow = null;
     this.windowManager.CloseWindow(this.windowManager.RootWindow);
 }
コード例 #7
0
        public Task ShowStatusAsync()
        {
            return(this.foregroundThreadAffinitedObject.InvokeBelowInputPriority(() =>
            {
                if (this.gameService.Machine.Memory.Version > 3)
                {
                    return;
                }

                if (this.upperWindow == null)
                {
                    this.upperWindow = this.windowManager.OpenWindow(
                        ZWindowKind.TextGrid,
                        this.mainWindow,
                        ZWindowPosition.Above,
                        ZWindowSizeKind.Fixed,
                        size: 1);
                }
                else
                {
                    int height = this.upperWindow.GetHeight();
                    if (height != 1)
                    {
                        this.upperWindow.SetHeight(1);
                        this.machineStatusHeight = 1;
                    }
                }

                this.upperWindow.Clear();

                var charWidth = ScreenWidthInColumns;
                var locationObject = this.gameService.Machine.ReadGlobalVariable(0);
                var locationText = " " + this.gameService.Machine.ReadObjectShortName(locationObject);

                this.upperWindow.SetReverse(true);

                if (charWidth < 5)
                {
                    this.upperWindow.PutText(new string(' ', charWidth), forceFixedWidthFont: false);
                    return;
                }

                if (locationText.Length > charWidth)
                {
                    locationText = locationText.Substring(0, charWidth - 3) + "...";
                    this.upperWindow.PutText(locationText, forceFixedWidthFont: false);
                    return;
                }

                this.upperWindow.PutText(locationText, forceFixedWidthFont: false);

                string rightText;
                if (this.gameService.Machine.IsScoreGame())
                {
                    int score = (short)this.gameService.Machine.ReadGlobalVariable(1);
                    int moves = this.gameService.Machine.ReadGlobalVariable(2);
                    rightText = string.Format("Score: {0,-8} Moves: {1,-6} ", score, moves);
                }
                else
                {
                    int hours = this.gameService.Machine.ReadGlobalVariable(1);
                    int minutes = this.gameService.Machine.ReadGlobalVariable(2);
                    var pm = (hours / 12) > 0;
                    if (pm)
                    {
                        hours = hours % 12;
                    }

                    rightText = string.Format("{0}:{1:n2} {2}", hours, minutes, (pm ? "pm" : "am"));
                }

                if (rightText.Length < charWidth - locationText.Length - 1)
                {
                    this.upperWindow.PutText(
                        new string(' ', charWidth - locationText.Length - rightText.Length),
                        forceFixedWidthFont: false);

                    this.upperWindow.PutText(rightText, forceFixedWidthFont: false);
                }
            }));
        }
コード例 #8
0
ファイル: ScreenViewModel.cs プロジェクト: taradinoc/ZDebug
        void IScreen.ShowStatus()
        {
            Dispatch(() =>
            {
                var story = storyService.Story;
                if (story.Version > 3)
                {
                    return;
                }

                if (upperWindow == null)
                {
                    upperWindow = windowManager.Open(ZWindowType.TextGrid, mainWindow, ZWindowPosition.Above, ZWindowSizeType.Fixed, 1);
                }
                else
                {
                    int height = upperWindow.GetHeight();
                    if (height != 1)
                    {
                        upperWindow.SetHeight(1);
                        currStatusHeight = 1;
                        machStatusHeight = 1;
                    }
                }

                upperWindow.Clear();

                var charWidth    = ((IScreen)this).ScreenWidthInColumns;
                var locationText = " " + story.ObjectTable.GetByNumber(story.GlobalVariablesTable[0]).ShortName;

                upperWindow.SetReverse(true);

                if (charWidth < 5)
                {
                    upperWindow.PutString(new string(' ', charWidth));
                    return;
                }

                if (locationText.Length > charWidth)
                {
                    locationText = locationText.Substring(0, charWidth - 3) + "...";
                    upperWindow.PutString(locationText);
                    return;
                }

                upperWindow.PutString(locationText);

                string rightText;
                if (IsScoreGame())
                {
                    int score = (short)story.GlobalVariablesTable[1];
                    int moves = (ushort)story.GlobalVariablesTable[2];
                    rightText = string.Format("Score: {0,-8} Moves: {1,-6} ", score, moves);
                }
                else
                {
                    int hours   = (ushort)story.GlobalVariablesTable[1];
                    int minutes = (ushort)story.GlobalVariablesTable[2];
                    var pm      = (hours / 12) > 0;
                    if (pm)
                    {
                        hours = hours % 12;
                    }

                    rightText = string.Format("{0}:{1:n2} {2}", hours, minutes, (pm ? "pm" : "am"));
                }

                if (rightText.Length < charWidth - locationText.Length - 1)
                {
                    upperWindow.PutString(new string(' ', charWidth - locationText.Length - rightText.Length));
                    upperWindow.PutString(rightText);
                }
            });
        }
コード例 #9
0
 internal ZWindowStream(ZWindow window)
 {
     this.window = window;
 }