/// <summary> /// Wird aufgerufen, wenn auf den Menüpunkt "Neues Spiel" geklickt wird /// </summary> private void miNeuesSpiel_Click(object sender, EventArgs e) { if (this.a.isRunning) { bool h = this.a.isPause; this.a.isPause = true; DialogResult res = MessageBox.Show( this, "Willst du das laufende Spiel wirklich beenden?", this.Text, MessageBoxButtons.YesNo); this.a.isPause = h; if (res == System.Windows.Forms.DialogResult.No) { return; } } TSegmentBase.stopAnimation(); this.a.stopGame(); this.Display.reset(); this.Data.reset(); this.a = new TArena(this.Display, this.Data); this.Segment.registerArena(this.a); this.myArena = new TVisualArena(a, this.paTetris, this.Data, this.Segment); this.paTetris.Refresh(); this.paNext.Refresh(); }
/// <summary> /// Standard-Konstruktor /// </summary> /// <param name="pa">Das Panel, auf dem die Segmente dargestellt werden</param> public TSegmentBase(Panel pa) { this._MyPanel = pa; this.CenterX = calcCenterX(pa); this.CenterY = calcCenterY(pa); this.SegmentBreite = calcBreite(); this._MyArena = null; this._MyPanel.Paint += _MyPanel_Paint; this._TrapezData = new TrapezData(); }
/// <summary> /// Standard-Konstruktor /// </summary> public foMain() { InitializeComponent(); this.Data = new TSharedData(); this.Display = new TDisplayFoMain(this, this.Data); this.a = new TArena(this.Display, this.Data); this.Segment = new TVisualSegment(this.paTetris); this.Segment.registerArena(this.a); this.myArena = new TVisualArena(a, this.paTetris, this.Data, this.Segment); TSegmentBase.registerForm(this); }
/// <summary> /// Standard-Konstruktor /// </summary> /// <param name="a"></param> /// <param name="p"></param> public TVisualArena(TArena a, Panel p, TSharedData data, TVisualSegment segment) { this.myArena = a; this.myPanel = p; this._MeinSegment = segment; this.SpielfeldFarben = new Color[TArena.AnzahlSektoren, TArena.AnzahlSchichten]; this.myPanel.Paint += myPanel_Paint; initLabelPause(); this.myArena.registerArena(this); this._SharedData = data; }
/// <summary> /// Registriert eine Arena /// </summary> /// <param name="a">Die zu registrierende Arena</param> public void registerArena(TArena a) { this._MyArena = a; }