void ReleaseDesignerOutlets() { if (Paused != null) { Paused.Dispose(); Paused = null; } if (RestartBtn != null) { RestartBtn.Dispose(); RestartBtn = null; } if (SpawnBtn != null) { SpawnBtn.Dispose(); SpawnBtn = null; } if (StopBtn != null) { StopBtn.Dispose(); StopBtn = null; } if (UrhoSurfacePlaceholder != null) { UrhoSurfacePlaceholder.Dispose(); UrhoSurfacePlaceholder = null; } }
// 游戏的几种状态 public void Success() { Time.timeScale = 0f; RestartBtn.SetActive(true); PauseBtn.SetActive(false); JoyStickBtn.SetActive(false); SuccessText.SetActive(true); }
public void GamePause() { Time.timeScale = 0f; PauseBtn.SetActive(false); ContinueBtn.SetActive(true); RestartBtn.SetActive(true); JoyStickBtn.SetActive(false); ArchiveBtn.SetActive(false); }
public void GameOver() { Time.timeScale = 0f; GameOverText.SetActive(true); RestartBtn.SetActive(true); ArchiveBtn.SetActive(true); PauseBtn.SetActive(false); JoyStickBtn.SetActive(false); }
public void GameContinue() { Time.timeScale = 1f; PauseBtn.SetActive(true); ContinueBtn.SetActive(false); JoyStickBtn.SetActive(true); RestartBtn.SetActive(false); ArchiveBtn.SetActive(false); GameOverText.SetActive(false); StartBtn.SetActive(false); }
private void StartBtn_Click(object sender, EventArgs e) { StartBtn.Hide(); PlusBtn.Show(); MultiBtn.Show(); CounterLbl.Show(); ValLbl.Show(); NeedLbl.Show(); Nval = Doubler.RandVal(); NeedLbl.Text = $"Need to get: {Nval}"; CancelBtn.Show(); CompActLbl.Show(); RestartBtn.Show(); CompActLbl.Text = $"Computer Actions count: {Doubler.ResSearch(Nval)}"; }
void Update() { IgnitionLeverValue = IgnitionLever.GetComponent <LinearMapping>().value; if (!RightHand.ObjectIsAttached(RightThrottle)) { Ignition.GetComponent <BoxCollider>().enabled = true; } if (ShipRunning && IgnitionLeverValue > 0) { Ignition.GetComponent <Interactable>().enabled = false; } else { Ignition.GetComponent <Interactable>().enabled = true; } if (PauseBtn.GetStateDown(LeftHand.handType)) { if (!Paused && !Dead) { Pause(); } else if (Paused && !Dead) { UnPause(); } } if (RestartBtn.GetStateDown(RightHand.handType)) { if (Paused || Dead) { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); } } }
public override bool OnUpdate(double ElapsedTime) { Engine.Drawer.Sprite(new PointF(0, 0), Background); if (Engine.MouseOnTopOf(StartBtn)) { StartBtn.SetAnimation("start_btn_on"); } else { StartBtn.SetAnimation("start_btn_off"); } if (Engine.MouseOnTopOf(RestartBtn)) { RestartBtn.SetAnimation("restart_btn_on"); } else { RestartBtn.SetAnimation("restart_btn_off"); } if (Engine.MouseOnTopOf(StartBtn)) { if (Engine.MouseClicked(System.Windows.Forms.MouseButtons.Left)) { UpDown.Play(false); if (Game == null) { game = new Playing(this.Engine); } else { game = Game; } Engine.RegisterScene(game); Engine.GoToScene(game); } } if (Engine.MouseOnTopOf(RestartBtn)) { if (Engine.MouseClicked(System.Windows.Forms.MouseButtons.Left)) { UpDown.Play(false); game = new Playing(this.Engine); Engine.RegisterScene(game); Engine.GoToScene(game); } } if (Engine.KeyClicked(System.Windows.Forms.Keys.Space)) { UpDown.Play(false); StartBtn.SetAnimation("start_btn_on"); if (Game == null) { game = new Playing(this.Engine); } else { game = Game; } Engine.RegisterScene(game); Engine.GoToScene(game); } Engine.Drawer.String("Use Space bar to Stop music", "Arial", 8, System.Drawing.Color.Black, new PointF(20, Engine.ScreenHeight() - 50)); Engine.Drawer.String("Use Escape to go back to this menu", "Arial", 8, System.Drawing.Color.Black, new PointF(20, Engine.ScreenHeight() - 40)); Engine.Drawer.String("Powred by CSharpGame | https://github.com/MohKamal/CsharpGame", "Arial", 8, System.Drawing.Color.Black, new PointF(20, Engine.ScreenHeight() - 20)); return(base.OnUpdate(ElapsedTime)); }
private void UpdateButtons() { StartBtn.GetBindingExpression(Button.IsEnabledProperty).UpdateTarget(); StopBtn.GetBindingExpression(Button.IsEnabledProperty).UpdateTarget(); RestartBtn.GetBindingExpression(Button.IsEnabledProperty).UpdateTarget(); }