//obsluga przycisniecia przyciskow //kupienie statku private void OnShipBtnMouseReleased(object sender, BtnReleasedEventArgs e) { PlayerManager.Instance.changeShip(e.arg); PlayerHud.Instance().ShipImg = new Sprite(new Texture(PlayerManager.Instance.ShipInfo.ShipTexture)); PlayerHud.Instance().ShipImg.Position = new Vector2f(1428 - PlayerHud.Instance().ShipImg.Texture.Size.X / 2, 200 - PlayerHud.Instance().ShipImg.Texture.Size.Y / 2); PlayerHud.Instance().update(); }
private void OnScrollPanelLeftMouseReleased(object sender, BtnReleasedEventArgs e) { int index = panelList.IndexOf(activePanel); if (--index < 0) { activePanel = panelList[panelList.Count - 1]; } else { activePanel = panelList[index]; } if (activePanel == panelList[0]) { EnableScrollBtns(); } else { DisableScrollBtns(); } ChangePanel(activePanel); var panelName = (componentList.Find(x => x.componentID == "panelName")) as OurLabel; panelName.Text = activePanel.PanelName; panelName.setPosition(new Vector2f(640 - panelName.Size.X / 2, 210)); }
private void OnBtnMissionMouseReleased(object sender, BtnReleasedEventArgs e) { if (PlayerManager.Instance.ShipInfo.ShipHealth < 1) { SceneManager.Instance().changeScene(GameScene.Instance()); } }
//wyświetlanie informacji o przyciskach private void OnPowerupMouseHovered(object sender, BtnReleasedEventArgs e) { var lbl = componentList.Find(x => x.componentID == "powerupDisplayedInfo") as OurLabel; lbl.Text = powerupInfo[e.arg]; (componentList.Find(x => x.componentID == "currentPowerups") as OurLabel).Text = string.Format("Posiadasz: {0}", PlayerManager.Instance.Powerups[e.arg]); }
private void OnShipMouseHovered(object sender, BtnReleasedEventArgs e) { var ship = PlayerManager.Instance.ShipPrefabs[e.arg]; (componentList.Find(x => x.componentID == "ShipShopDisplayedInfo") as OurLabel).Text = string.Format("{8}\n\nPredkosc statku: {0}\nOpancerzenie: {1}\nCelnosc: {2}\nSzybkostrzelnosc: {3}\nObrazenia broni: {4}\n\nPredkosc bazowa: {5}c\nWytrzymalosc bazowa: {6}\n\nCena: {7}", ship.MaxUpgrades[0], ship.MaxUpgrades[1], ship.MaxUpgrades[2], ship.MaxUpgrades[3], ship.MaxUpgrades[4], ship.DefaultSpeed, ship.DefaultHealth, ship.Price, ship.ShipName); componentList.Find(x => x.componentID == "ShipShopShipImg").ChangeTexture(new Texture(ResourcesManager.resourcesPath + ship.TexturePath)); componentList.Find(x => x.componentID == "ShipShopShipImg").setPosition(new Vector2f(900, 300)); }
//ulepszanie statów private void OnStatBtnMouseReleased(object sender, BtnReleasedEventArgs e) { stats stat; if (e.arg >= 0) { stat = (stats)e.arg; PlayerManager.Instance.upgradeShip(stat); } if (e.arg == -1) { PlayerManager.Instance.repairShip(0.1f); } }
private void OnBtnLoadMouseReleased(object sender, BtnReleasedEventArgs e) { try { PlayerMenu.Instance().cleanUp(); //napisac koniecznie wczytywanie teksturki jak sie wczytuje stan gry z pliku using (Stream stream = File.Open("ship.txt", FileMode.Open)) { BinaryFormatter bf = new BinaryFormatter(); PlayerManager.Instance = (PlayerManager)bf.Deserialize(stream); int index = PlayerManager.Instance.currentShip; PlayerManager.Instance.ShipInfo.ShipTexture = new Texture(ResourcesManager.resourcesPath + PlayerManager.Instance.ShipPrefabs[index].TexturePath); PlayerHud.Instance().PlayerInfo = PlayerManager.Instance; } sceneManager.changeScene(PlayerMenu.Instance()); } catch (System.IO.FileNotFoundException) { MessageBox.Show("Brak pliku zapisu"); } }
//kupowanie powerupów private void OnPowerupBtnMouseReleased(object sender, BtnReleasedEventArgs e) { PlayerManager.Instance.addPowerup((powerups)e.arg); (componentList.Find(x => x.componentID == "currentPowerups") as OurLabel).Text = string.Format("Posiadasz: {0}", PlayerManager.Instance.Powerups[e.arg]); }
private void OnStatBtnMouseHovered(object sender, BtnReleasedEventArgs e) { var lbl = componentList.Find(x => x.componentID == "workbenchDisplayedInfo") as OurLabel; lbl.Text = workbenchInfo[e.arg + 1]; }
private void OnBtnResumeMouseReleased(object sender, BtnReleasedEventArgs e) { sceneManager.changeScene(PlayerMenu.Instance()); }
private void OnBtnSaveMouseReleased(object sender, BtnReleasedEventArgs e) { SaveDataToFile(); sceneManager.changeScene(PlayerMenu.Instance()); }
private void OnBtnMainMenuMouseReleased(object sender, BtnReleasedEventArgs e) { MainMenu.Instance().cleanup(); sceneManager.changeScene(MainMenu.Instance()); }
private void OnBtnLoadMouseReleased(object sender, BtnReleasedEventArgs e) { LoadDataFromFile(); sceneManager.changeScene(PlayerMenu.Instance()); }