예제 #1
0
        //===================================================
        public void LoadBoardUIs()
        {
            BoardBLL boardBLL = new BoardBLL();

            boards.Clear();
            this.pnWorkSpace.Controls.Clear();

            this.pnWorkSpace.Controls.Add(listActivityUI);
            this.pnWorkSpace.BackgroundImage = null;

            // boards = boardBLL.GetAllBoard();
            boards = boardBLL.GetAllBoard(user.UserId);

            //foreach (Board bo in boards)
            for (int i = 0; i < boards.Count; i++)
            {
                Board bo = boards[i];
                //BoardUI b = new BoardUI(bo.BoardId,bo.Index,bo.GroupId,bo.Title,bo.Mode,bo.Star,bo.Background);
                BoardUI b = new BoardUI(bo.BoardId, i, bo.GroupId, bo.Title, bo.Mode, bo.Star, bo.Background);
                boardUIs.Add(b);

                this.pnWorkSpace.Controls.Add(b);
            }

            BoardNoInfor boardNoInfor = new BoardNoInfor(this, boards.Count);

            this.pnWorkSpace.Controls.Add(boardNoInfor);
        }
예제 #2
0
 // Use this for initialization
 void Start()
 {
     _boardUI = FindObjectOfType <BoardUI>();
     animator = GetComponent <Animator>();
     animator.SetBool("IsGameOver", false);
     _currentPlayer = PlayersInfo.p1Symbol;
 }
예제 #3
0
        private static void CreateGameOverMenu(GameBoard board, bool won)
        {
            var gameOverMenu = new Menu
            {
                Title     = !won ? "GAME OVER! YOU LOST!" : "GAME OVER! CONGRATULATIONS, YOU WON!",
                Execute   = () => BoardUI.PrintBoard(board),
                MenuItems = new List <MenuItem>()
                {
                    new MenuItem()
                    {
                        Title = "Start New Game", Execute = StartGameMenu.Run
                    },
                    new MenuItem()
                    {
                        Title = "Return to Main Menu", Execute = MainMenu.Run
                    },
                    new MenuItem()
                    {
                        Title = "Exit", Execute = QuitGame
                    }
                }
            };

            gameOverMenu.Run();
        }
 public GagaUI(Gaga gaga, BoardUI <MonkeyBoard> boardUI = null)
     : base(gaga, new MovableAnimatedImage(
                new List <ImageFrames> {
     new ImageFrames(new Image() { Source = Images.Monster }, 500)
 }), boardUI)
 {
 }
예제 #5
0
 public void ResetGame()
 {
     _game    = new Game();
     _boardUI = new BoardUI(_game.Board);
     moveHistory.Reset();
     _game.GameEvent += UpdateGameState;
 }
예제 #6
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            base.Initialize();
            Views = new List <View>();
            var Board = new PacManMulti.Logic.Board();

            Board.Height = 10;
            Board.Width  = 15;
            Random  rand    = new Random();
            BoardUI BoardUI = new BoardUI(Board, Window.ClientBounds.Width, Window.ClientBounds.Height - 30, 0, 30);

            for (int i = 0; i < 10; i++)
            {
                Element e = (Element) new PacPlayer();
                e.X = rand.Next(15);
                e.Y = rand.Next(10);
                //e.P = new Point(rand.Next(15), rand.Next(10));
                Sprite s = new SpriteDemo(e);
                Board.board.Add(e);
                BoardUI.RegisterSprite(s);
            }
            Views.Add(BoardUI);
            Views.Add(new Score(Window.ClientBounds.Width, 30, 0, 0));

            foreach (View v in Views)
            {
                v.Initialize(this);
            }
        }
예제 #7
0
        public MainPage()
        {
            InitializeComponent();

            NavigateNewBattleField.Subscribe(_ =>
            {
                reversi.Board.Init();
                BlackCounter.InIt();
                WhiteCounter.InIt();
                BoardUI.BoardPlayers         = reversi.Board.Board;
                BoardUI.EnableColorPointList = reversi.Board.GetEnableColorPointList(Black);
                BoardUI.ReRendering();
                CPUPieceCount.Value    = reversi.Board.CountWhiteColor();
                PlayerPieceCount.Value = reversi.Board.CountBlackColor();
            });
            NavigateHome.Subscribe(_ => this.Frame.Navigate(typeof(HomePage)));
            NavigateBattleResult.Subscribe(_ => this.Frame.Navigate(typeof(BattleResultPage), new ScoreData(reversi.Board.CountBlackColor(), reversi.Board.CountWhiteColor())));

            if (AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Mobile")
            {
            }

            BoardUI.EnableColorPointList = reversi.Board.GetEnableColorPointList(Black);
            BoardUI.BoardPlayers         = reversi.Board.Board;
            BoardUI.ReRendering();
            CPUPieceCount.Value    = reversi.Board.CountWhiteColor();
            PlayerPieceCount.Value = reversi.Board.CountBlackColor();

            IntelliService = new CPU(reversi.Board);
        }
예제 #8
0
        /// <summary>
        /// Ingame logic
        /// </summary>
        private static void StartGame()
        {
            if (Game.GetPlayers().Count.Equals(0) || Game.GetItems().Count.Equals(0))
            {
                BoardUI.PrintNoData();
                return;
            }

            Game.StartGame();
            do
            {
                // 1. SCORE
                BoardUI.PrintScore(Game.GetPlayers(), Game.GetRoundNumber());

                // 2. PLAY
                Game.SetPlays(BoardUI.ReadHumanPlays(Game.GetPlayers(), Game.GetItems()));

                // 3. PRINT
                BoardUI.PrintPlays(Game.GetPlayers(), Game.GetRoundNumber(), Game.GetRoundWinner());

                // 4. VALIDATE
                string winners = Game.ValidateEndGame();
                if (winners != null)
                {
                    BoardUI.PrintWinner(winners);
                }
            } while (!Game.IsEndGame());
        }
예제 #9
0
 public SyncMaster(Game Spiel, BoardUI Board_UI_GameBoard, BoardUI Board_UI_Preview, MainWindow Window)
 {
     // TODO: Complete member initializations
     this.Game = Spiel;
     this.Board_UI_GameBoard    = Board_UI_GameBoard;
     this.Board_UI_PreviewBoard = Board_UI_Preview;
     this.Window = Window;
 }
예제 #10
0
 private void RefreshBoard(List <string> response)
 {
     BoardUI.DrawBoard(clientUsername, response[0]);
     BoardUI.ShowHP(GetHP(response));
     BoardUI.ShowKills(GetKills(response));
     BoardUI.ShowNearPlayers(GetNearPlayers(response));
     Console.WriteLine("Action: ");
 }
예제 #11
0
 public Node(Board b, BoardUI UI)
 {
     Board        = b;
     Handle       = this;
     Location     = Seek();
     CheckedBoard = new bool[Board.Width, Board.Height];
     All          = new Dictionary <Point, Node>();
     Node.UI      = UI;
 }
예제 #12
0
    void OnMouseDrag()
    {
        //only if movement is allowed
        if (_allowMovement)
        {
            if (!_dragging)
            {
                OnStartDrag();
                _dragging = true;
            }

            //if hovered a tile that is reachable then move have the player move there
            Collider   tileParent;
            TileHolder tileHolder = null;
            if (BoardUI.GetTileHovered_Position(out tileParent))
            {
                tileHolder = tileParent.GetComponentInChildren <TileHolder> ();
            }

            if (tileHolder != null)
            {
                //try get the commander position marker
                GameObject posMarker = getCommanderMarker(tileHolder);
                if (posMarker != null)
                {
                    _toGoTo              = posMarker.transform.position;
                    _destination         = _toGoTo;
                    _destinationRotation = posMarker.transform.rotation;
                }
                else
                {
                    _toGoTo      = tileHolder.transform.position;
                    _destination = _toGoTo;
                }

                _toGoTo.y = _LiftedHeight;

                _targetY = tileHolder._Tile.Height;

                _destinationTile = tileHolder;

                //dragging
                OnDraggingCommander();
            }
            else
            {
                _destinationTile = null;
            }

            if (!_hasBeenLifted && !_liftingPiece)              // && _destinationTile == null )//|| _prevHovered != hoveredCollider))
            {
                LiftPiece();
            }
            //block raycast
            this.gameObject.layer = LayerMask.NameToLayer("Ignore Raycast");
        }
    }
예제 #13
0
        public void BoardUI_WithPositiveSizeParameter_HasCorrectSizes(int size, int expectedWidth, int expectedHeight)
        {
            BoardUI boardUI = new BoardUI(size, new Board());

            Size expectedSize = new Size(expectedWidth, expectedHeight);
            Size actualSize   = boardUI.Size;

            Assert.AreEqual(expectedSize, actualSize);
        }
 public GoombaUI(Goomba Goomba, BoardUI <MonkeyBoard> boardUI = null)
     : base(Goomba, new MovableAnimatedImage(
                new List <ImageFrames> {
     new ImageFrames(new Image() { Source = Images.Goomba1 }, 1),
     new ImageFrames(new Image() { Source = Images.Goomba2 }, 1)
 })
            , boardUI)
 {
 }
예제 #15
0
    void HandleMultiUpdate(float newMulti)
    {
        BoardUI boardUI = (BoardUI)CurrentUI;

        if (boardUI)
        {
            boardUI.UpdateMultiplierText(newMulti);
        }
    }
예제 #16
0
    void HandleScoreUpdate(int newScore)
    {
        BoardUI boardUI = (BoardUI)CurrentUI;

        if (boardUI)
        {
            boardUI.UpdateScoreText(newScore);
        }
    }
 public MonkeyUI(Monkey monkey, BoardUI <MonkeyBoard> boardUI = null)
     : base(monkey, new ControllableAnimatedImage(
                new List <ControllableImageFrames> {
     new ControllableImageFrames(new Image() { Source = Images.MonkeyMoveLeft }, Key.Left),
     new ControllableImageFrames(new Image() { Source = Images.MonkeyMoveRight }, Key.Right)
 }, new Image() { Source = Images.Monkey })
            , boardUI)
 {
 }
 public GhostUI(Ghost Ghost, BoardUI <MonkeyBoard> boardUI = null)
     : base(Ghost, new MovableAnimatedImage(
                new List <ImageFrames> {
     new ImageFrames(new Image() { Source = Images.Ghost1 }, 1),
     new ImageFrames(new Image() { Source = Images.Ghost2 }, 1)
 })
            , boardUI)
 {
 }
예제 #19
0
        /// <summary>
        /// Started program method
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            BoardUI.PrintWelcomeMessage();

            MenuEnum option;

            do
            {
                option = BoardUI.PrintAndReadMenuOptions(Game.GetMenuOptions());

                switch (option)
                {
                case MenuEnum.StartGame:
                    StartGame();
                    BoardUI.PrintWelcomeMessage();
                    break;

                case MenuEnum.ListPlayers:
                    BoardUI.PrintPlayers(Game.GetPlayers());
                    break;

                case MenuEnum.AddPlayer:
                    Game.AddPlayer(BoardUI.ReadPlayer(Game.GetPlayers()));
                    break;

                case MenuEnum.ListItems:
                    BoardUI.PrintItems(Game.GetItems());
                    break;

                case MenuEnum.AddItem:
                    Game.AddItem(BoardUI.ReadItem(Game.GetItems()));
                    break;

                case MenuEnum.RemoveItem:
                    Game.RemoveItem(BoardUI.ReadRemoveItem(Game.GetItems()));
                    break;

                case MenuEnum.RemovePlayer:
                    Game.RemovePlayer(BoardUI.ReadRemovePlayer(Game.GetPlayers()));
                    break;

                case MenuEnum.DefaultPlayers:
                    SetTestPlayers();
                    break;

                case MenuEnum.ResetGame:
                    Game = new Game();
                    break;

                default:
                    break;
                }
            } while (!option.Equals(MenuEnum.EndGame));

            BoardUI.PrintByeByeMessage();
        }
예제 #20
0
 public DoorUI(Door positional, BoardUI <MonkeyBoard> boardUI) :
     base(positional, new AnimatedImage(
              new List <ImageFrames> {
     new ImageFrames(new Image() { Source = ImageManager.ElementImageDictionary["DoorClose"] }, 0),
     new ImageFrames(new Image() { Source = ImageManager.ElementImageDictionary["DoorOpen"] }, 0)
 }), boardUI)
 {
     if (boardUI != null)
     {
         positional.DoorOpen += this.OpenDoor;
     }
 }
 public MonkeyBananaUI(Banana block, BoardUI <MonkeyBoard> boardUI = null)
     : base(block, new AnimatedImage(
                new List <ImageFrames> {
     new ImageFrames(new Image() { Source = Images.EyeBanana1 }, rnd.Next(50, 121)),
     new ImageFrames(new Image() { Source = Images.EyeBanana2 }, 7),
     new ImageFrames(new Image() { Source = Images.EyeBanana3 }, 7),
     new ImageFrames(new Image() { Source = Images.EyeBanana4 }, 7),
     new ImageFrames(new Image() { Source = Images.EyeBanana3 }, 7),
     new ImageFrames(new Image() { Source = Images.EyeBanana2 }, 7)
 })
            , boardUI)
 {
 }
예제 #22
0
        private void SetupDisplay()
        {
            BoardUI <MonkeyBoard>   boardUI   = BoardPackage.BoardUI;
            MainBarUI <MonkeyBoard> mainbarUI = BoardPackage.MainBarUI;

            // maintains aspect ratio
            Viewbox displayedWindow = new Viewbox();

            displayedWindow.StretchDirection = StretchDirection.Both;
            displayedWindow.Stretch          = Stretch.Uniform;

            Grid displayedGrid = new Grid();

            displayedGrid.Height = 680;
            displayedGrid.Width  = 1120;

            RowDefinition row1 = new RowDefinition();
            RowDefinition row2 = new RowDefinition();

            row1.Height = new GridLength(50);
            displayedGrid.RowDefinitions.Add(row1);
            displayedGrid.RowDefinitions.Add(row2);

            Viewbox background      = new Viewbox();
            Image   backgroundImage = new Image();

            backgroundImage.Source  = Images.NatureForest;
            background.Child        = backgroundImage;
            background.Stretch      = Stretch.UniformToFill;
            background.ClipToBounds = true;
            background.SetValue(Canvas.ZIndexProperty, -1);

            // displayed game area
            Viewbox displayedBoardUI = new Viewbox();

            displayedBoardUI.Child        = boardUI;
            displayedBoardUI.Stretch      = Stretch.UniformToFill;
            displayedBoardUI.ClipToBounds = true;

            Grid.SetRow(background, 0);
            Grid.SetRowSpan(background, 2);
            Grid.SetRow(mainbarUI, 0);
            Grid.SetRow(displayedBoardUI, 1);

            displayedGrid.Children.Add(background);
            displayedGrid.Children.Add(mainbarUI);
            displayedGrid.Children.Add(displayedBoardUI);

            displayedWindow.Child = displayedGrid;
            Content = displayedWindow;
        }
예제 #23
0
    private void Awake()
    {
        Audio = GetComponentInChildren <AudioManager>();

        player  = transform.Find("Player").GetComponent <Player>();
        client1 = transform.Find("Client 1").GetComponent <Client>();
        client2 = transform.Find("Client 2").GetComponent <Client>();

        repairCardFactory = new CardAssetFactory <RepairCardAsset>();
        badCardFactory    = new CardAssetFactory <BadCardAsset>();

        boardUI  = GetComponent <BoardUI>();
        tutorial = GetComponent <Tutorial>();
    }
예제 #24
0
    public void OnDollDestroyed()
    {
        lives -= 1;
        BoardUI boardUI = (BoardUI)CurrentUI;

        ScoreManager.HandleDollDestroyed();
        if (boardUI)
        {
            boardUI.UpdateLivesText(lives);
        }
        if (lives == 0)
        {
            // calls StateChanged which calls HandleGameOver
            ChangeState(GameState.GameOver);
        }
    }
예제 #25
0
        private async void NewGameStart(object sender, RoutedEventArgs e)
        {
            var Dialog = new MessageDialog("新規ゲームを開始しますか?");

            Dialog.Commands.Add(new UICommand("はい", null, true));
            Dialog.Commands.Add(new UICommand("いいえ", null, false));
            var dialogResult = await Dialog.ShowAsync();

            if (!(bool)dialogResult.Id)
            {
                return;
            }
            reversi.Board.Init();
            BoardUI.EnableColorPointList = reversi.Board.GetEnableColorPointList(Black);
            RefreshInfomatinText();
            BoardUI.ReRendering();
        }
예제 #26
0
        public void BoardUI_WithSizeParameter_CreatesRowsWithAlternatingColors()
        {
            BoardUI boardUI = new BoardUI(0, new Board());

            for (int column = 0; column < 10; column++)
            {
                for (int row = 0; row < 9; row++)
                {
                    SquareUI currentSquare = boardUI.Squares[row, column];
                    SquareUI nextSquare    = boardUI.Squares[row + 1, column];

                    if (currentSquare.BackColor == nextSquare.BackColor)
                    {
                        Assert.Fail();
                    }
                }
            }
        }
예제 #27
0
        public BoardAndStages(int nbS)
        {
            _nbStages  = nbS;
            _listBalls = new ArrayList();
            _tabStages = new Stage[_nbStages + 1];
            Stage below = new Board(_nbStages + 1);

            _tabStages[_nbStages] = below;
            for (var i = _nbStages; i > 0; i--)
            {
                _tabStages[i - 1]       = new Stage(i);
                below.Above             = _tabStages[i - 1];
                _tabStages[i - 1].Below = below;
                below = _tabStages[i - 1];
            }
            below.Above = null;
            _board      = GameObject.Find("Board").GetComponent <BoardUI>();
        }
예제 #28
0
        private void SetColor(Tuple <int, int> point)
        {
            effect.Play();
            reversi.SetStone(point.Item1, point.Item2, Player.NowPlayer);
            Player.ChangePlayer();
            BoardUI.EnableColorPointList = reversi.Board.GetEnableColorPointList(Black);
            BoardUI.ReRendering();
            RefreshInfomatinText();
            var latestInput = new ColorData(new Tuple <int, int>(point.Item1, point.Item2), 0);

            BoardUI.BeforeInputColor = latestInput;
            BattleLog.Add(new BattleLoginTurn {
                player = Player.NowPlayer, PositionList = reversi.Board.GetPieceReversiAllDirection(point.Item1, point.Item2, Player.NowPlayer)
            });

            CPUPieceCount.Value    = reversi.Board.CountWhiteColor();
            PlayerPieceCount.Value = reversi.Board.CountBlackColor();
        }
예제 #29
0
        public MainWindow()
        {
            InitializeComponent();
            Game = new Game();

            #region UI
            Game.GuiInteraction          = new Gui_Interaction(this, Game);
            this.label_TIME.Content      = "PLAYTIME : " + System.Environment.NewLine + "00:00:00";
            this.label_Controls1.Content = "SYSTEM-CONTROLS : " + System.Environment.NewLine + " • ENTER = Start" + System.Environment.NewLine + " • SPACE = Pause" + System.Environment.NewLine +
                                           " • ESCAPE  = Quit ";

            this.label_Controls.Content = "MOVEMENT-CONTROLS : " + System.Environment.NewLine + " • LEFT = Move left" + System.Environment.NewLine +
                                          " • RIGHT = Move right" + System.Environment.NewLine + " • DOWN = Move down" + System.Environment.NewLine + " • UP = Rotate";
            //  Intro();


            this.KeyDown += new KeyEventHandler(Window_KeyDown);
            // Erstelle GameBoard
            Board_UI_GameBoard = new BoardUI(this, Game, Grid_GameBoard);
            Board_UI_GameBoard.ErstelleGrid(this.Game.Config.Width_GameBoard, this.Game.Config.Height_GameBoard);
            Board_UI_GameBoard.GenerateBoardFeldArray(this.Game.Config.Width_GameBoard, this.Game.Config.Height_GameBoard);

            // Erstelle PreviewBoard
            Board_UI_PreviewBoard = new BoardUI(this, Game, Grid_PreviewBoard);
            Board_UI_PreviewBoard.ErstelleGrid(this.Game.Config.Width_Preview, this.Game.Config.Height_Preview);
            Board_UI_PreviewBoard.GenerateBoardFeldArray(this.Game.Config.Width_Preview, this.Game.Config.Height_Preview);

            Sync       = new SyncMaster(Game, Board_UI_GameBoard, Board_UI_PreviewBoard, this);
            this.Timer = new Timer_GUI(this.Dispatcher, this, Sync, Game);

            //this.Width = 1468;
            //this.Height = 826;
            // 0,5626702997275204

            this.Width  = 1680;
            this.Height = 1680 * ((double)826 / 1468);

            //this.Height = 1050;
            // 0,625
            //    this.Show();
            //System.Windows.Forms.Screen screen = System.Windows.Forms.Screen.PrimaryScreen;
            //screen.Bounds
            #endregion UI
        }
예제 #30
0
        private async Task GameEndProcess()
        {
            if (!WhiteCounter.IsContinue() || !BlackCounter.IsContinue() || (reversi.Board.CountNoneColor() == 0))
            {
                await
                ShowDialog(
                    $"ゲームが終了しました。\n プレイヤー:{reversi.Board.CountBlackColor()}  CPU:{reversi.Board.CountWhiteColor()}");

                var scoreData = new ScoreData(reversi.Board.CountBlackColor(), reversi.Board.CountWhiteColor());
                await new ScoreClient().AddScore(scoreData);
                reversi.Board.Init();
                BlackCounter.InIt();
                WhiteCounter.InIt();
                BoardUI.BoardPlayers         = reversi.Board.Board;
                BoardUI.EnableColorPointList = reversi.Board.GetEnableColorPointList(Black);
                BoardUI.ReRendering();
                NavigateBattleResult.Subscribe();
            }
        }
예제 #31
0
        public CoreUI(OpCore core)
        {
            Core = core;

            // load menus for loaded services
            foreach (var service in Core.ServiceMap.Values)
            {
                var id = service.ServiceID;

                if (id == ServiceIDs.Board)
                    Services[id] = new BoardUI(this, service);

                if (id == ServiceIDs.Buddy)
                    Services[id] = new BuddyUI(this, service);

                if (id == ServiceIDs.Chat)
                    Services[id] = new ChatUI(this, service);

                if (id == ServiceIDs.IM)
                    Services[id] = new IMUI(this, service);

                if (id == ServiceIDs.Mail)
                    Services[id] = new MailUI(this, service);

                if (id == ServiceIDs.Plan)
                    Services[id] = new PlanUI(this, service);

                if (id == ServiceIDs.Profile)
                    Services[id] = new ProfileUI(this, service);

                if (id == ServiceIDs.Share)
                    Services[id] = new ShareUI(this, service);

                if (id == ServiceIDs.Storage)
                    Services[id] = new StorageUI(this, service);

                if (id == ServiceIDs.Trust)
                    Services[id] = new TrustUI(this, service);
            }

            Core.RunInGui += Core_RunInGui;
            Core.UpdateConsole += Core_UpdateConsole;
            Core.ShowConfirm += Core_ShowConfirm;
            Core.ShowMessage += Core_ShowMessage;
            Core.VerifyPass += Core_VerifyPass;

            Core_UpdateConsole("DeOps " + Application.ProductVersion);
        }