Example #1
0
        public GameViewer GameContainer()
        {
            GameViewer game = resourcesManager.GamePrefabs.GameContainer(managerCanvas.CurrentŠ”anvas.transform);

            GamePresenter presenter = new GamePresenter(game, _gameModel);

            return(game);
        }
Example #2
0
        public GameViewer GameContainer(Transform parent)
        {
            GameViewer gameViewer = Instantiate(_gameViewer, parent);

            gameViewer.transform.SetSiblingIndex(0);
            gameViewer.gameObject.SetActive(true);

            return(gameViewer);
        }
 public override bool Initialize()
 {
     viewer = GameViewer.Instance;
     if (viewer == null)
         return false;
     viewer.Window.AddAccelGroup (accel);
     viewer.RegisterGameLoader (this, menuItem);
     return true;
 }
Example #4
0
        private void StartGame()
        {
            var gameViewer = new GameViewer(m_ComponentManager);

            gameViewer.GameCompleted += OnGameCompleted;
            m_OldWidth  = Width;
            m_OldHeight = Height;
            Controls.Add(gameViewer);
            CenterToScreen();
        }
Example #5
0
 public void InitViewer()
 {
     Viewer = ViewerManager.Instance.AcquireViewer <GameViewer>();
     if (null == Viewer)
     {
         Debug.LogWarning("Unable to acquire game viewer!");
         return;
     }
     Viewer.Initialize(GameGameData);
 }
Example #6
0
        public Game()
        {
            _gameViewer = new GameViewer();
            var trapCreator = new TrapInitializer();

            IsGameFinished = false;
            Field          = new Field();
            Player         = new Player();
            Princes        = new Princes();
            Traps          = trapCreator.InitializeTraps();
            _dataToView    = new DataToView(Field.Cells, Traps, Player, Princes);
        }
Example #7
0
        private void OnGameCompleted(GameViewer ctrl)
        {
            ctrl.GameCompleted -= OnGameCompleted;
            Controls.Remove(ctrl);
            Width  = m_OldWidth;
            Height = m_OldHeight;
            var gameCompletedSelector = new GameCompletedSelector();

            gameCompletedSelector.Dock             = DockStyle.Fill;
            gameCompletedSelector.RestartClick    += OnRestartClick;
            gameCompletedSelector.PlayWinnerClick += OnPlayWinnerClick;
            Controls.Add(gameCompletedSelector);
            CenterToScreen();
        }
 public override bool Initialize()
 {
     viewer = GameViewer.Instance;
     if (viewer == null)
         return false;
     menuItem.AddAccelerator ("activate",
                  viewer.AccelGroup,
                  new AccelKey (Gdk.
                            Key.o,
                            Gdk.
                            ModifierType.
                            ControlMask,
                            AccelFlags.
                            Visible));
     //viewer.Window.AddAccelGroup (accel);
     viewer.RegisterGameLoader (this, menuItem);
     return true;
 }
Example #9
0
        private void Render()
        {
            var viewer = new GameViewer();

            Console.Clear();

            Console.WriteLine("Turn: {0:#,##0}", this.State.Turn);
            foreach (var p in PlayerTypes.All)
            {
                var hero = this.State.GetHero(p);

                Console.ForegroundColor = (p == this.Player) ? ConsoleColor.White : ConsoleColor.Gray;
                Console.WriteLine("{0} Health: {1,3}, Mines: {2,2}, Gold: {3,4}, Exp: {4}",
                                  p,
                                  hero.Health,
                                  hero.Mines,
                                  hero.Gold,
                                  hero.Gold + hero.Mines * ((1195 + (int)p - this.State.Turn) >> 2)
                                  );
            }
            viewer.Render(this.Map, this.State);
        }
            public override bool Initialize()
            {
                viewer = GameViewer.Instance;
                if (viewer == null)
                    return false;

                viewer.RegisterPrintHandler (this);

                ImageMenuItem item =
                    new ImageMenuItem (Catalog.
                               GetString
                               ("_PS File"));
                  item.Image =
                    new Image (Gtk.Stock.SaveAs,
                           IconSize.Menu);
                  exportPsMenuItem = item;
                  exportPsMenuItem.Activated +=
                    on_export_ps_activate;
                  exportPsMenuItem.Show ();
                  viewer.RegisterExporter (this,
                               exportPsMenuItem);
                  return true;
            }
 public static void CreateInstance()
 {
     if (viewer != null)
       {
           return;
       }
     viewer = new GameViewer ();
     CsBoardApp.Instance.AddApp (viewer);
     CsBoard.Plugin.PluginManager.Instance.
         StartPlugins ();
 }
            public override bool Initialize()
            {
                if ((viewer = GameViewer.Instance) == null)
                    return false;
                Menu menu = new Menu ();
                toolsItem = new MenuItem (Catalog.GetString("Tools"));
                toolsItem.Submenu = menu;
                MenuItem pluginsItem =
                    new MenuItem (Catalog.GetString("Plugins"));
                menu.Add (pluginsItem);

                pluginsItem.Activated += on_plugins_activate;

                int idx = viewer.MenuBar.Children.Length - 1;
                viewer.MenuBar.Insert (toolsItem, idx);
                toolsItem.ShowAll ();
                return true;
            }
            public GameEditor(GameViewer viewer)
                : base(Catalog.
								    GetString
								    ("Rating"))
            {
                this.viewer = viewer;
                viewer.ChessGameWidget.GameLoadedEvent +=
                    OnGameLoaded;
                combo = new ComboBox (new string[]
                              {
                              Catalog.
                              GetString
                              ("Not interested"),
                              Catalog.
                              GetString
                              ("Average Game"),
                              Catalog.
                              GetString ("Good Game"),
                              Catalog.
                              GetString
                              ("Excellent Game"),
                              Catalog.
                              GetString ("Must Have")}
                );
                save = new Button (Stock.Save);
                save.Sensitive = false;
                save.Clicked += OnSave;
                combo.Changed +=
                    delegate (object o, EventArgs args)
                {
                    save.Sensitive = true;
                };

                ratings = new GameRating[]
                {
                GameRating.Ignore,
                        GameRating.Average,
                        GameRating.Good,
                        GameRating.Excellent,
                        GameRating.MustHave};
                tagsStore = new ListStore (typeof (string));
                tagsCombo = new ComboBoxEntry (tagsStore, 0);
                tagsCombo.Entry.Activated +=
                    OnTagsComboActivated;

                Table table = new Table (3, 2, false);
                table.RowSpacing = 2;
                table.ColumnSpacing = 2;
                uint row = 0, col = 0;
                Label label =
                    new Label (Catalog.
                           GetString ("My Rating"));
                label.Xalign = 0;
                label.Yalign = 0;
                table.Attach (label, col, col + 1, row,
                          row + 1);
                col++;
                table.Attach (combo, col, col + 1, row,
                          row + 1);

                label = new Label (Catalog.
                           GetString ("Tags"));
                label.Xalign = 0;
                label.Yalign = 0;
                col = 0;
                row++;
                table.Attach (label, col, col + 1, row,
                          row + 1);
                col++;
                table.Attach (tagsCombo, col, col + 1, row,
                          row + 1);

                col = 1;
                row++;
                Alignment align = new Alignment (1, 0, 0, 0);
                align.Add (save);
                table.Attach (align, col, col + 1, row,
                          row + 1);

                Add (table);

                ShowAll ();
            }
            public override bool Initialize()
            {
                viewer = GameViewer.Instance;
                if (viewer == null)
                    return false;
                GameViewer.GameDb = GameDb.Instance;
                GameDbBrowser browser = new GameDbBrowser ();
                CsBoard.CsBoardApp.Instance.AddApp (browser);

                editor = new GameEditor (viewer);
                viewer.ChessGameDetailsBox.PackStart (editor,
                                      false,
                                      true,
                                      2);

                viewer.AddToFileMenu (saveItem);
                //viewer.AddToViewMenu (openDbItem);

                return true;
            }
            public ExportHandler(GameViewer viewer,
					      ArrayList games,
					      PrintWrapper printer,
					      string file)
                : base(viewer,
								 games,
								 printer)
            {
                this.file = file;
            }
            public PrintHandler(GameViewer viewer,
					     ArrayList games,
					     PrintWrapper printer,
					     int response)
                : base(viewer,
								 games,
								 printer)
            {
                this.response = response;
            }
            public PGNExportHandler(GameViewer viewer,
						 ArrayList games,
						 PrintWrapper printer)
            {
                this.games = games;
                this.viewer = viewer;
                this.printer = printer;
                totalgames = games.Count;
                ngames = 0;
                GLib.Idle.
                    Add (new
                         GLib.IdleHandler
                         (PGNExportIdleHandler));
            }
            public GameLoader(GameViewer viewer)
            {
                games = new ArrayList ();
                this.viewer = viewer;

                gameloader = new PGNGameLoader ();
                gameloader.GameLoaded += OnGameLoaded;
            }
Example #19
0
 private void CreateContainer()
 {
     _gameViewer = _gameFactory.GameContainer();
 }