public MainWindow() { WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; InitializeComponent(); ShopValues.LoadFromJson(); DataContext = MainWindowViewModel.InstanceCreation(); }
public ShopView() { WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; InitializeComponent(); ShopValues.LoadFromJson(); DataContext = _mh; this.Closing += OnClosing; }
private void NewGameButton(object sender, RoutedEventArgs e) { ShopValues.saveToJson(); this.Close(); StartGame(); Process.Start(Application.ResourceAssembly.Location); Application.Current.Shutdown(); }
private void Back_Click(object sender, RoutedEventArgs e) { ShopValues.saveToJson(); MainWindow a = new MainWindow(); a.Show(); Close(); }
private void NewGame(object sender, KeyEventArgs e) { Thread.Sleep(3000); Process.Start(Application.ResourceAssembly.Location); Application.Current.Shutdown(); UIObjects.GameOver = false; ShopValues.saveToJson(); }
private void HeartButton_Click(object sender, RoutedEventArgs e) { if (_mh.NotifyHandler.GoldAmount >= heartCost) { _mh.NotifyHandler.GoldAmount -= heartCost; _mh.NotifyHandler.LivesExceed += 1; ShopValues.saveToJson(); } }
private void supernova_Click(object sender, RoutedEventArgs e) { if (_mh.NotifyHandler.GoldAmount >= supernvaCost) { _mh.NotifyHandler.GoldAmount -= supernvaCost; _mh.NotifyHandler.SupernovaCount += 1; ShopValues.saveToJson(); } }
/// <summary> /// Satış durumu belirlenir. /// </summary> /// <param name="index"></param> /// <param name="newValue">satış durumu</param> public ShopData SetSold(int index, bool newValue) { ReadAllData(); shopValues = WriteData <ShopValues>(index); shopValues.isSold = newValue; ChangeData(shopValues, index); SaveData(); return(this); }
private void vbomb_Click(object sender, RoutedEventArgs e) { if (_mh.NotifyHandler.GoldAmount >= vbombCost) { _mh.NotifyHandler.GoldAmount -= vbombCost; _mh.NotifyHandler.VBombCount += 1; ShopValues.saveToJson(); } }
private void apokalypse_Click(object sender, RoutedEventArgs e) { if (_mh.NotifyHandler.GoldAmount >= apokalypseCost) { _mh.NotifyHandler.GoldAmount -= apokalypseCost; _mh.NotifyHandler.Apokalypsecount += 1; ShopValues.saveToJson(); } }
public ShopData SetPrice(int index, Sprite newImage) { ReadAllData(); shopValues = WriteData <ShopValues>(index); shopValues.image = newImage; ChangeData(shopValues, index); SaveData(); return(this); }
public ShopData SetName(int index, string newValue) { ReadAllData(); shopValues = WriteData <ShopValues>(index); shopValues.name = newValue; ChangeData(shopValues, index); SaveData(); return(this); }
public ShopData SetPrice(int index, float newValue) { ReadAllData(); shopValues = WriteData <ShopValues>(index); shopValues.prices = newValue; ChangeData(shopValues, index); SaveData(); return(this); }
public override void SetInformations(ItemContoller itemContoller, int id) { this.id = id; sellProduct = new SellProduct(id); this.itemContoller = itemContoller; shopValues = DataManager.Instance.shopDataController.shopProducts[id].shopValues; image.sprite = shopValues.image; nameOfProduct.text = shopValues.name; prices.text = shopValues.prices.ToString(); isSold = shopValues.isSold; isSelected = shopValues.isSelected; lockImage.enabled = !isSold; selectImage.enabled = isSelected; }
public bool SellThis() { shopValues = DataManager.Instance.shopDataController.getData.GetData(id); Debug.Log("sell " + (isAvaibleSell && !shopValues.isSold)); if (isAvaibleSell && !shopValues.isSold) { Debug.Log("SAtış işlemini gerçekleştir"); //Buraya satış işlemini gerçekleştirecek kodu yazınız. DataManager.Instance.walletDataController.getData.Spend("Gold", shopValues.prices); DataManager.Instance.shopDataController.getData.SetSold(id, true); return(true); } return(false); }
private void OnClosing(object sender, CancelEventArgs cancelEventArgs) { ShopValues.saveToJson(); }
private void ExitButton(object sender, RoutedEventArgs e) { ShopValues.saveToJson(); this.Close(); }
public Sprite GetImage(int index) { shopValues = WriteData <ShopValues>(index); //data sınıfa aktarılır. return(shopValues.image); //data döndürülür. }
private void Exit_Click(object sender, RoutedEventArgs e) { ShopValues.saveToJson(); Close(); }
public string GetName(int index) { shopValues = WriteData <ShopValues>(index); //data sınıfa aktarılır. return(shopValues.name); //data döndürülür. }
public float GetPrice(int index) { shopValues = WriteData <ShopValues>(index); //data sınıfa aktarılır. return(shopValues.prices); //data döndürülür. }
public int GetID(int index) { shopValues = WriteData <ShopValues>(index); //data sınıfa aktarılır. return(shopValues.id); //data döndürülür. }
public bool GetSold(int index) { shopValues = WriteData <ShopValues>(index); //data sınıfa aktarılır. return(shopValues.isSold); //data döndürülür. }
private void OnKeyDown(object sender, KeyEventArgs e) { //switch (e.Key) //{ // case Key.P: // _mh.ClickCommand.Execute(); // break; //} if (!MainWindowViewModel.IsPaused) { switch (e.Key) { case Key.Space: if (checkShootings()) { player.ConfigureShoot(Playground, Player); } break; case Key.V: if (checkShootings()) { player.ConfigureSuperLaser(Playground, Player); } break; case Key.B: if (checkShootings()) { player.ConfigureVBomb(Playground, Player); } break; case Key.N: if (checkShootings()) { player.ConfigureSuperNova(Playground, Player); } break; case Key.M: if (checkShootings()) { player.ConfigureApokalypse(Playground, Player); } break; case Key.Left: case Key.A: case Key.NumPad4: //MainWindowViewModel.Move(DirectionPlayer.Left); if (MainWindowViewModel.previousDirection != (int)DirectionPlayer.Right) { MainWindowViewModel.direction = (int)DirectionPlayer.Left; } break; case Key.Right: case Key.D: case Key.NumPad6: //MainWindowViewModel.Move(DirectionPlayer.Right); if (MainWindowViewModel.previousDirection != (int)DirectionPlayer.Left) { MainWindowViewModel.direction = (int)DirectionPlayer.Right; } break; case Key.Up: case Key.W: case Key.NumPad8: //MainWindowViewModel.Move(DirectionPlayer.Right); if (MainWindowViewModel.previousDirection != (int)DirectionPlayer.Down) { MainWindowViewModel.direction = (int)DirectionPlayer.Up; } break; case Key.Down: case Key.S: case Key.NumPad5: //MainWindowViewModel.Move(DirectionPlayer.Right); if (MainWindowViewModel.previousDirection != (int)DirectionPlayer.Up) { MainWindowViewModel.direction = (int)DirectionPlayer.Down; } break; case Key.Escape: ShopValues.saveToJson(); Environment.Exit(0); break; case Key.Enter: ShopValues.saveToJson(); Process.Start(Application.ResourceAssembly.Location); Application.Current.Shutdown(); break; } } }