当前位置: 首页>>代码示例>>C#>>正文


C# Game.ShowDialog方法代码示例

本文整理汇总了C#中Game.ShowDialog方法的典型用法代码示例。如果您正苦于以下问题:C# Game.ShowDialog方法的具体用法?C# Game.ShowDialog怎么用?C# Game.ShowDialog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Game的用法示例。


在下文中一共展示了Game.ShowDialog方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FirstGame_Click

        private void FirstGame_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();

            Game memo = new Game(_username);
            memo.ShowDialog(this);
        }
开发者ID:Narrya,项目名称:IBGames,代码行数:8,代码来源:GameChooseDialog.cs

示例2: Application_Startup

        /// <summary>
        /// Checks for arguments on startup
        /// </summary>
        /// <param name="sender">not used</param>
        /// <param name="e">list of arguments</param>
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            // File type setup
            if (e.Args.Length == 1 && e.Args[0].Equals("setup"))
            {
                try
                {
                    // Get a path for the icon in appdata
                    string iconPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\icon.ico";

                    // Save the icon
                    FileStream iconStream = new FileStream(iconPath, FileMode.Create);
                    TowerHaven.Properties.Resources.icon.Save(iconStream);
                    iconStream.Close();

                    // Create the application reference
                    RegistryKey root = Registry.ClassesRoot;
                    RegistryKey application = root.CreateSubKey("TowerHaven");
                    application.SetValue(string.Empty, "Tower Haven Level Data");
                    application.CreateSubKey("DefaultIcon")
                        .SetValue(string.Empty, iconPath);
                    application.CreateSubKey("shell")
                        .CreateSubKey("Open")
                        .CreateSubKey("Command")
                        .SetValue(string.Empty, "\"" + Environment.CurrentDirectory + "\\" + AppDomain.CurrentDomain.FriendlyName + "\" OpenMap %1");

                    // Create the file type association
                    RegistryKey extension = root.CreateSubKey(".thld");
                    extension.SetValue(string.Empty, "TowerHaven");
                }
                catch (Exception) { /* In case someone runs the program with the argument without elevation or when it is already set up */ }
                Environment.Exit(0);
            }

            // Play level
            else if (e.Args.Length > 1 && e.Args[0].Equals("OpenMap"))
            {
                BasicLevel level = new BasicLevel();
                string path = e.Args[1];
                for (int i = 2; i < e.Args.Length; ++i)
                    path += " " + e.Args[i];
                level.LoadMap(path);
                Game game = new Game(level);
                game.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                game.ShowDialog();
            }
        }
开发者ID:Eniripsa96,项目名称:TowerHaven,代码行数:52,代码来源:App.xaml.cs

示例3: startGameInEditor

        private void startGameInEditor(int mgotop, int mgoleft)
        {
            tmpHandler.updateTMP();

            int levelTop = this.Top + SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height + tableLayout.Top + level.Top;
            int levelLeft = this.Left + SystemInformation.FrameBorderSize.Width + tableLayout.Left + level.Left;
            g = new Game(tmpHandler.TmpFilename, PlayMode.GameInEditor, levelTop, levelLeft,
                mgotop,
                mgoleft);

            string oldtext = this.Text;
            this.Text = "littleRunner Level Editor [press ESC to quit game]";

            try
            {
                g.ShowDialog();
            }
            catch (ObjectDisposedException)
            {
                MessageBox.Show("Unknown error, Code #01", "littleRunner Error");
            }
            g = null;
            AnimateImage.Refresh = false;

            this.Text = oldtext;
        }
开发者ID:andihit,项目名称:littleRunner,代码行数:26,代码来源:Editor.cs

示例4: gameWindowToolStripMenuItem_Click

        private void gameWindowToolStripMenuItem_Click(object sender, EventArgs e)
        {
            tmpHandler.updateTMP();

            g = new Game(tmpHandler.TmpFilename, PlayMode.Game,
                vScroll.Value - vScroll.Minimum,
                hScroll.Value - hScroll.Minimum);

            g.ShowDialog();
            g = null;
            AnimateImage.Refresh = false;
        }
开发者ID:andihit,项目名称:littleRunner,代码行数:12,代码来源:Editor.cs

示例5: gameLevelbeginToolStripMenuItem_Click

        private void gameLevelbeginToolStripMenuItem_Click(object sender, EventArgs e)
        {
            tmpHandler.updateTMP();

            g = new Game(tmpHandler.TmpFilename, PlayMode.Game);

            g.ShowDialog();
            g = null;
            AnimateImage.Refresh = false;
        }
开发者ID:andihit,项目名称:littleRunner,代码行数:10,代码来源:Editor.cs

示例6: PlayTutor

 public void PlayTutor()
 {
     var game = new Game();
     game.ShowDialog();
 }
开发者ID:LihouzovS,项目名称:Gwent,代码行数:5,代码来源:MainWindowVM.cs

示例7: startButton_Click

        /// <summary>
        /// Starts the selected level
        /// </summary>
        /// <param name="sender">not used</param>
        /// <param name="e">not used</param>
        private void startButton_Click(object sender, RoutedEventArgs e)
        {
            int index = (int)cursor.Margin.Top / 20;

            if (campaign && index == 2)
            {
                EndlessMode endlessMode = new EndlessMode();
                endlessMode.Owner = this;
                Hide();
                try
                {
                    endlessMode.ShowDialog();
                }
                catch (Exception)
                {
                    endlessMode.Close();
                    MessageBox.Show("Game data has been modified during play.\nAn error has occurred due to this.\nThe level was aborted.");
                }
                Show();
                return;
            }

            Boolean goodMap = false;
            BasicLevel level = new BasicLevel();

            // Load the map
            if (campaign)
                goodMap = level.LoadCampaign(mapNames[index]);
            else
                goodMap = level.Load(mapNames[index]);

            // If successful, play the map
            if (goodMap)
            {
                Game game = new Game(level);
                game.Owner = this;
                Hide();
                try
                {
                    game.ShowDialog();
                }
                catch (Exception)
                {
                    game.Close();
                    MessageBox.Show("Game data has been modified during play.\nAn error has occurred due to this.\nThe level was aborted.");
                }
                Show();
                return;
            }

            // Remove the map due to not being valid
            grid1.Children.RemoveAt(index + 1);
            for (int i = index + 1; i < grid1.Children.Count; ++i)
            {
                Label l = grid1.Children[i] as Label;
                l.Margin = new Thickness(l.Margin.Left, l.Margin.Top - 20, 0, 0);
            }
            if (grid1.Children.Count == 1)
            {
                MessageBox.Show("There are no more maps available");
                Close();
            }
            else if (index == grid1.Children.Count - 1)
            {
                cursor.Margin = new Thickness(8, 20 * index - 16, 0, 0);
            }
        }
开发者ID:Eniripsa96,项目名称:TowerHaven,代码行数:72,代码来源:LevelSelection.xaml.cs


注:本文中的Game.ShowDialog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。