Exemplo n.º 1
0
        private void neuesSpielToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show(this, "Sind Sie sich sicher, dass Sie das aktuelle Spiel abbrechen und ein neues Spiel starten möchten?", "Neues Spiel?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
            {
                Spider.Class.Game.Mode currentMode = Class.Game.Mode.OneSuit;

                using (ModeDialog mld = new ModeDialog())
                {
                    if (mld.ShowDialog(this) == DialogResult.OK)
                    {
                        currentMode = mld.SelectedMode;
                    }
                }
                this.currentGame.MStructures.Clear();
                this.currentGame.OtherCards.Clear();
                this.Controls.Remove(this.currentRenderer);
                this.currentGame          = new Class.Game(this, currentMode);
                this.currentGame.Refresh += CurrentGame_Refresh;
                this.currentGame.ReDraw  += CurrentGame_ReDraw;
                this.currentRenderer.OnDraw();

                if (this.info.HW_ACC)
                {
                    this.currentRenderer = new Spider.Class.Render.SlimDXRenderer();
                }
                else
                {
                    this.currentRenderer = new Spider.Class.Render.GDIRenderer();
                }
                this.currentRenderer.MouseDown += CurrentRenderer_MouseDown;
                currentRenderer.OnInit(this.currentGame, this, this.info);
                currentRenderer.OnDraw();
            }
        }
Exemplo n.º 2
0
        public frmMain()
        {
            InitializeComponent();
            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
            this.UpdateStyles();
            this.ReadSettings();

            if (this.info.HW_ACC)
                this.currentRenderer = new Spider.Class.Render.SlimDXRenderer();
            else
                this.currentRenderer = new Spider.Class.Render.GDIRenderer();

            this.currentRenderer.MouseDown += CurrentRenderer_MouseDown;
        }
Exemplo n.º 3
0
        public frmMain()
        {
            InitializeComponent();
            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
            this.UpdateStyles();
            this.ReadSettings();

            if (this.info.HW_ACC)
            {
                this.currentRenderer = new Spider.Class.Render.SlimDXRenderer();
            }
            else
            {
                this.currentRenderer = new Spider.Class.Render.GDIRenderer();
            }

            this.currentRenderer.MouseDown += CurrentRenderer_MouseDown;
        }
Exemplo n.º 4
0
        private void spielLadenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog ofd = new OpenFileDialog()
            {
                Filter = ".xml|"
            })
            {
                if (ofd.ShowDialog(this) == DialogResult.OK)
                {
                    try
                    {
                        Serialization.Serialization <Class.Game> gameSer = new Serialization.Serialization <Class.Game>();
                        this.currentGame.MStructures.Clear();
                        this.currentGame.OtherCards.Clear();
                        this.Controls.Remove(this.currentRenderer);
                        this.currentGame          = gameSer.Read(ofd.FileName, Serialization.Serialization <Class.Game> .Typ.Normal);
                        this.currentGame.ReDraw  += CurrentGame_ReDraw;
                        this.currentGame.Refresh += CurrentGame_Refresh;
                        this.Invalidate();

                        if (this.info.HW_ACC)
                        {
                            this.currentRenderer = new Spider.Class.Render.SlimDXRenderer();
                        }
                        else
                        {
                            this.currentRenderer = new Spider.Class.Render.GDIRenderer();
                        }
                        this.currentRenderer.MouseDown += CurrentRenderer_MouseDown;
                        currentRenderer.OnInit(this.currentGame, this, this.info);
                        currentRenderer.OnDraw();
                        this.currentRenderer.OnDraw();
                    }
                    catch (Exception)
                    {
                        MessageBox.Show(this, "Die Datei ist ungültig! Bitte wählen Sie eine gültige Datei aus!", "Gültige Datei auswählen!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Exemplo n.º 5
0
        private void spielLadenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog ofd = new OpenFileDialog() { Filter = ".xml|" })
            {
                if (ofd.ShowDialog(this) == DialogResult.OK)
                {
                    try
                    {
                        Serialization.Serialization<Class.Game> gameSer = new Serialization.Serialization<Class.Game>();
                        this.currentGame.MStructures.Clear();
                        this.currentGame.OtherCards.Clear();
                        this.Controls.Remove(this.currentRenderer);
                        this.currentGame = gameSer.Read(ofd.FileName, Serialization.Serialization<Class.Game>.Typ.Normal);
                        this.currentGame.ReDraw += CurrentGame_ReDraw;
                        this.currentGame.Refresh += CurrentGame_Refresh;
                        this.Invalidate();

                        if (this.info.HW_ACC)
                            this.currentRenderer = new Spider.Class.Render.SlimDXRenderer();
                        else
                            this.currentRenderer = new Spider.Class.Render.GDIRenderer();
                        this.currentRenderer.MouseDown += CurrentRenderer_MouseDown;
                        currentRenderer.OnInit(this.currentGame, this, this.info);
                        currentRenderer.OnDraw();
                        this.currentRenderer.OnDraw();
                    }
                    catch (Exception)
                    {
                        MessageBox.Show(this, "Die Datei ist ungültig! Bitte wählen Sie eine gültige Datei aus!", "Gültige Datei auswählen!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Exemplo n.º 6
0
        private void neuesSpielToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show(this, "Sind Sie sich sicher, dass Sie das aktuelle Spiel abbrechen und ein neues Spiel starten möchten?", "Neues Spiel?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
            {
                Spider.Class.Game.Mode currentMode = Class.Game.Mode.OneSuit;

                using (ModeDialog mld = new ModeDialog())
                {
                    if (mld.ShowDialog(this) == DialogResult.OK)
                    {
                        currentMode = mld.SelectedMode;
                    }
                }
                this.currentGame.MStructures.Clear();
                this.currentGame.OtherCards.Clear();
                this.Controls.Remove(this.currentRenderer);
                this.currentGame = new Class.Game(this, currentMode);
                this.currentGame.Refresh += CurrentGame_Refresh;
                this.currentGame.ReDraw += CurrentGame_ReDraw;
                this.currentRenderer.OnDraw();

                if (this.info.HW_ACC)
                    this.currentRenderer = new Spider.Class.Render.SlimDXRenderer();
                else
                    this.currentRenderer = new Spider.Class.Render.GDIRenderer();
                this.currentRenderer.MouseDown += CurrentRenderer_MouseDown;
                currentRenderer.OnInit(this.currentGame, this, this.info);
                currentRenderer.OnDraw();
            }
        }