Пример #1
0
 public MainWindow()
 {
     WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
     InitializeComponent();
     ShopValues.LoadFromJson();
     DataContext = MainWindowViewModel.InstanceCreation();
 }
Пример #2
0
 public ShopView()
 {
     WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
     InitializeComponent();
     ShopValues.LoadFromJson();
     DataContext   = _mh;
     this.Closing += OnClosing;
 }
Пример #3
0
 private void NewGameButton(object sender, RoutedEventArgs e)
 {
     ShopValues.saveToJson();
     this.Close();
     StartGame();
     Process.Start(Application.ResourceAssembly.Location);
     Application.Current.Shutdown();
 }
Пример #4
0
        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();
 }
Пример #6
0
 private void HeartButton_Click(object sender, RoutedEventArgs e)
 {
     if (_mh.NotifyHandler.GoldAmount >= heartCost)
     {
         _mh.NotifyHandler.GoldAmount  -= heartCost;
         _mh.NotifyHandler.LivesExceed += 1;
         ShopValues.saveToJson();
     }
 }
Пример #7
0
 private void supernova_Click(object sender, RoutedEventArgs e)
 {
     if (_mh.NotifyHandler.GoldAmount >= supernvaCost)
     {
         _mh.NotifyHandler.GoldAmount     -= supernvaCost;
         _mh.NotifyHandler.SupernovaCount += 1;
         ShopValues.saveToJson();
     }
 }
Пример #8
0
 /// <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);
 }
Пример #9
0
 private void vbomb_Click(object sender, RoutedEventArgs e)
 {
     if (_mh.NotifyHandler.GoldAmount >= vbombCost)
     {
         _mh.NotifyHandler.GoldAmount -= vbombCost;
         _mh.NotifyHandler.VBombCount += 1;
         ShopValues.saveToJson();
     }
 }
Пример #10
0
 private void apokalypse_Click(object sender, RoutedEventArgs e)
 {
     if (_mh.NotifyHandler.GoldAmount >= apokalypseCost)
     {
         _mh.NotifyHandler.GoldAmount      -= apokalypseCost;
         _mh.NotifyHandler.Apokalypsecount += 1;
         ShopValues.saveToJson();
     }
 }
Пример #11
0
    public ShopData SetPrice(int index, Sprite newImage)
    {
        ReadAllData();
        shopValues       = WriteData <ShopValues>(index);
        shopValues.image = newImage;
        ChangeData(shopValues, index);

        SaveData();
        return(this);
    }
Пример #12
0
    public ShopData SetName(int index, string newValue)
    {
        ReadAllData();
        shopValues      = WriteData <ShopValues>(index);
        shopValues.name = newValue;
        ChangeData(shopValues, index);

        SaveData();
        return(this);
    }
Пример #13
0
    public ShopData SetPrice(int index, float newValue)
    {
        ReadAllData();
        shopValues        = WriteData <ShopValues>(index);
        shopValues.prices = newValue;
        ChangeData(shopValues, index);

        SaveData();
        return(this);
    }
Пример #14
0
    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;
    }
Пример #15
0
    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);
    }
Пример #16
0
 private void OnClosing(object sender, CancelEventArgs cancelEventArgs)
 {
     ShopValues.saveToJson();
 }
Пример #17
0
 private void ExitButton(object sender, RoutedEventArgs e)
 {
     ShopValues.saveToJson();
     this.Close();
 }
Пример #18
0
 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.
 }
Пример #19
0
 private void Exit_Click(object sender, RoutedEventArgs e)
 {
     ShopValues.saveToJson();
     Close();
 }
Пример #20
0
 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.
 }
Пример #21
0
 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.
 }
Пример #22
0
 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.
 }
Пример #23
0
 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.
 }
Пример #24
0
        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;
                }
            }
        }