示例#1
0
 public HighscoreVM(MainViewModel main, string name, long points)
 {
     this.main = main;
     records = new HighscoreRecordList();
     records.AddRecord(name, points);
     Gyoztesek = records.Lista;
 }
示例#2
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     g = Content as Grid;
     gw = (int)g.ActualWidth;
     gh = (int)g.ActualHeight;
     VM = new MainViewModel(gw,gh);
     this.DataContext = VM;
     timer = new DispatcherTimer();
     timer.Interval = TimeSpan.FromMilliseconds(20);
     timer.Tick += Timer_Tick;
     timer.Start();
 }
示例#3
0
        public ViewModel(int w, int h, MainViewModel mainModel)
        {
            this.mainModel = mainModel;
            items = new ObservableCollection<GameObjectShape>();
            Game = new Game(w, h);
            Game.NewObject += (s, e) => AddToScene(e);
            Game.RemoveObject += (s, e) => RemoveFromScene(e);
            Game.GameEndEvent += (s, e) => GameEnded(e);

            //informacios panel a jobb oldalon
            //100*ch meret
            HUDmodel sidepanelmodel = new HUDmodel(w - 100, 0, 100, h);
            Rectangle sidepanel = new Rectangle();
            sidepanel.Width = sidepanelmodel.Area.Width;
            sidepanel.Height = sidepanelmodel.Area.Height;
            sidepanel.Fill = sidepanelmodel.B;
            items.Add(new GameObjectShape(sidepanelmodel, sidepanel));

            //Palya label
            Label palya = new Label();
            HUDmodel palyaszammodel = new HUDmodel(w-100, 5, 0, 0);
            palya.DataContext = game;
            palya.ContentStringFormat = "Pálya: {0}";
            palya.SetBinding(ContentControl.ContentProperty, new Binding("Palyaszam"));
            items.Add(new GameObjectShape(palyaszammodel, palya));

            //Eletek label
            Label eletek = new Label();
            HUDmodel eletmodel = new HUDmodel(w-100, 20, 0, 0);
            eletek.DataContext = game;
            eletek.ContentStringFormat = "Életek: {0}";
            eletek.SetBinding(ContentControl.ContentProperty, new Binding("Player.Lives"));
            items.Add(new GameObjectShape(eletmodel, eletek));

            //Pontok label
            Label pontszam = new Label();
            HUDmodel pontmodel = new HUDmodel(w-100, 35, 0, 0);
            pontszam.DataContext = game;
            pontszam.ContentStringFormat = "Pontok: {0}";
            pontszam.SetBinding(ContentControl.ContentProperty, new Binding("Player.Points"));
            items.Add(new GameObjectShape(pontmodel, pontszam));

            //jatekos fegyverenek sebzese
            Label sebzes = new Label();
            HUDmodel sebzesmodel = new HUDmodel(w - 100, 50, 0, 0);
            sebzes.DataContext = game;
            sebzes.ContentStringFormat = "Sebzés: {0}";
            sebzes.SetBinding(ContentControl.ContentProperty, new Binding("Player.Damage"));
            items.Add(new GameObjectShape(sebzesmodel, sebzes));
        }
示例#4
0
 public HighscoreVM(MainViewModel main)
 {
     this.main = main;
     records = new HighscoreRecordList();
     Gyoztesek = records.Lista;
 }
示例#5
0
 public GameOverVM(MainViewModel main, GameEndEnum en, long pontszam)
 {
     mainmodel = main;
     orulunk = (en == GameEndEnum.Win) ? ":)" : ":(";
     this.pontszam = pontszam;
 }
 public HighscoreScreen(MainViewModel main, string name, long points)
 {
     InitializeComponent();
     VM = new HighscoreVM(main,name, points);
     this.DataContext = VM;
 }
 public HighscoreScreen(MainViewModel main)
 {
     InitializeComponent();
     VM = new HighscoreVM(main);
     this.DataContext = VM;
 }
示例#8
0
 public MenuControl(MainViewModel main)
 {
     InitializeComponent();
     vm = new MenuViewModel(main);
     this.DataContext = vm;
 }
 public GameOverScreen(GameEndEnum en, long pontok, MainViewModel mainvm)
 {
     InitializeComponent();
     VM = new GameOverVM(mainvm, en, pontok);
     this.DataContext = VM;
 }
示例#10
0
 public MenuViewModel(MainViewModel main)
 {
     this.mainmodel = main;
 }