Example #1
0
        /// <summary>
        /// Start new game
        /// </summary>
        private void NewGame()
        {
            var settings = new SettingsForm();

            if (settings.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            var maxColor = settings.Colors;

            GenerateColors(maxColor);
            // set up the game
            game         = new Game(settings.Player1, settings.Player2, settings.BoardSize, maxColor);
            game.Update += Game_Update;
            game.End    += Game_End;
            // create a new board
            control            = new BoardControl(game.Board, colors);
            control.CellClick += Control_CellClick;
            boardPanel.Controls.Clear();
            boardPanel.Controls.Add(control);
            // create color pickers
            colorPicker            = new ColorPicker(colors, game.GetMoves());
            colorPicker.CellClick += Control_CellClick;
            SwitchPicker(game.CurrentPlayer, game.CurPlayer.Bot);
            //set scores
            UpdateScores();
            //set names
            player1Label.Text = game.Player1.Name;
            player2Label.Text = game.Player2.Name;
        }
Example #2
0
    void Start()
    {
        bC        = GetComponent <BoardControl>();
        sH        = GetComponent <SoundHandler>();
        oneSecond = new WaitForSeconds(0.75f);

        StartCoroutine(StartGame());
    }
Example #3
0
 public VolkeTestOrchestrator(Form parentForm, BoardControl boardControl, VolkeTest test, int idParticipant, Sensors.SensorContainer sensors)
     : base(parentForm, boardControl)
 {
     this.test = test;
     this.testItems = test.Items.GetEnumerator();
     this.idParticipant = idParticipant;
     this.sensors = sensors;
 }
Example #4
0
        public MinionPortret(BoardControl b, Minion m) : base(b.center, new MinionCard(m))
        {
            board  = b;
            minion = m;
            board.Controls.Add(this);

            DoubleBuffered = true;
        }
Example #5
0
    public void JointBoard(BoardControl Player)
    {
        transform.parent.parent.GetComponent <Board_Mode_1>().Reset_Rotation();
        // Player.Body.velocity = Player.Body.velocity / 3;
        Transform trans = transform.parent.parent;

        Player.BasketNeedHold = trans.Find("Basket");
        Player.Trigger        = trans.Find("Basket/Trigger");
        Player.Hool           = trans.Find("Hool");
        Player.ImgScale       = trans.Find("ImgScale");
        Player.Ball           = Player.transform;
        Player.PosBall        = trans.Find("PosBall");
        Player.PosOriginal    = trans.Find("PosBasketOriginal");
        Player.PosLastBall    = trans.Find("Pos");
        Player.HoldBasket     = trans;
        //     Player.EnableMode(true);
        StartCoroutine(ResetVelocity(Player.Body));
        Player.isDone = false;
        if (key != Player.Key)
        {
            LevelController.instance.UpdateTime = true;
            if (Result())
            {
                if (Check_Ball[point0] == 0 && Check_Ball[point1] == 0)
                {
                    SpawnEffect.instance.Set_System(PointEffect.position, "+PERFECT X" + BoardControl.instance.CountPerfect, null, 0);
                    SpawnEffect.instance.Set_System(PointEffect.position, "+" + BoardControl.instance.CountPerfect * 3, null, 0.5f);
                    int x = BoardControl.instance.CountPerfect;

                    BoardControl.instance.TakeScore(Paractice_Type.PERFECT);
                }
            }

            else
            {
                if ((Check_Ball[point0] + Check_Ball[point1]) == 1)
                {
                    SpawnEffect.instance.Set_System(PointEffect.position, "COOL", null, 0);
                    SpawnEffect.instance.Set_System(PointEffect.position, "+2", null, 0.5f);
                    BoardControl.instance.TakeScore(Paractice_Type.NORMAL);
                    BoardControl.instance.AddScore(1);
                }
                else
                {
                    int x = BoardControl.instance.CountPerfect;
                    BoardControl.instance.TakeScore(Paractice_Type.NORMAL);


                    SpawnEffect.instance.Set_System(PointEffect.position, "+1", null, 0.5f);
                }
            }
            transform.parent.parent.GetComponent <Board_Mode_1>().Reset_Rotation();
            Debug.Log("Get key");
            Player.NextKey();
            SpawnerCtrl.instante.chanceBoard = true;
            MoveFollowPlayer.instance.new_Collider_Camera();
        }
    }
Example #6
0
        private void Start_NewGameBtn_Click(object sender, RoutedEventArgs e)
        {
            WelcomePanel.Visibility = Visibility.Hidden;
            GamePanel.Visibility    = Visibility.Visible;

            BoardControl gameBoard = new BoardControl();

            GamePanel.Children.Add(gameBoard);
        }
Example #7
0
 /*
  * Этот класс должен расположить все элементы на экране:
  * 1. Поле для шахмат.
  * 2. Историю.
  * 3. Сообщения игрокам.
  */
 public ChessForm(ChessApp app, IBoardStyle boardStyle,
                  ICellBitmapSelector <ChessPiece> bitmapSelector, IMessageSelector <ChessGame> messageSelector)
 {
     this.app             = app;
     this.bitmapSelector  = bitmapSelector;
     this.messageSelector = messageSelector;
     board             = new BoardControl(boardStyle, bitmapSelector.BitmapWidth, bitmapSelector.BitmapHeight);
     board.CellClick  += app.ClickAt;
     app.StateChanged += Invalidate;
     // need some layout
 }
Example #8
0
    void Start()
    {
        bC = GameObject.Find("Board").GetComponent <BoardControl>();
        gC = GameObject.Find("Board").GetComponent <GameControl>();
        Vector2 boardCenter = new Vector2((bC.dimensions.x - 1) / 2, (bC.dimensions.y - 1) / 2) * bC.step;

        transform.position = new Vector3(boardCenter.x, boardCenter.y, transform.position.z);

        whiteScore     = whiteScoreBlock.GetComponent <Text>();
        greenScore     = greenScoreBlock.GetComponent <Text>();
        countdownText  = countdownBlock.GetComponent <Text>();
        roundCountText = roundCountBlock.GetComponent <Text>();
    }
Example #9
0
    void Start()
    {
        sH         = GetComponent <SoundHandler>();
        bC         = GameObject.Find("Board").GetComponent <BoardControl>();
        gC         = GetComponent <GameControl>();
        whitePos   = bC.wStart;
        greenPos   = bC.gStart;
        bufferTime = new WaitForSeconds(0.125f);

        whiteAnim = white.GetComponent <Animator>();
        greenAnim = green.GetComponent <Animator>();
        //SetColor(true);
        //SetColor(false);
    }
Example #10
0
 private void OnMouseDown()
 {
     if (Input.GetMouseButtonDown(0))
     {
         if (transform.parent != null)
         {
             BoardControl board = transform.parent.gameObject.GetComponent <BoardControl>();
             if (board != null)
             {
                 board.SlateClicked(Index);
             }
         }
     }
 }
Example #11
0
        public VolkePlayer(BoardControl boardControl, BoardControl boardControlSidePlayer)
        {
            this.boardControl = boardControl;
            this.boardControl.Clear();
            this.boardControl.Visible = true;
            this.boardControlSidePlayer = boardControlSidePlayer;

                this.boardControlSidePlayer.Clear();
                this.boardControlSidePlayer.Visible = true;

            timer = new Timer();
            timer.Tick += ProcessMessage;
            timer.Enabled = true;
        }
Example #12
0
        static public IBoardControlView BuildBoardControlView(BoardControl boardControl)
        {
            if (boardControl is StickyNote)
            {
                return(new StickyNoteView());
            }

            if (boardControl is BoardImage)
            {
                return(new BoardImageView());
            }

            throw new Exception($"Unknown board control type {boardControl.GetType().Name}");
        }
Example #13
0
        static public BoardControlViewModel BuildBoardControlViewModel(BoardControl boardControl, BoardViewModel boardViewModel)
        {
            if (boardControl is StickyNote)
            {
                return(new StickyNoteViewModel(boardControl as StickyNote, boardViewModel));
            }

            if (boardControl is BoardImage)
            {
                return(new BoardImageViewModel(boardControl as BoardImage, boardViewModel));
            }

            throw new Exception($"Unknown board control type {boardControl.GetType().Name}");
        }
Example #14
0
        public MainWindow()
        {
            InitializeComponent();

            httpClientProvider    = new HttpClientProvider();
            clientUiConfiguration = ClientUiConfiguration.ReadConfiguration();
            LoadHttpClientProviderSettings(clientUiConfiguration);
            CreateMenuAuthorization();

            boardControl = new BoardControl(httpClientProvider);
            GridForBaord.Children.Add(boardControl);
            boardControl.AddBoard    += (sender, args) => boardControl.LoadBoard((string)(ComboBoxBoards.SelectedItem = string.Empty));
            boardControl.EditBoard   += (sender, args) => boardControl.LoadBoard((string)(ComboBoxBoards.SelectedItem = string.Empty));
            boardControl.DeleteBoard += (sender, args) => boardControl.LoadBoard((string)(ComboBoxBoards.SelectedItem = string.Empty));
        }
Example #15
0
    // Use this for initialization
    void Start()
    {
        playField = BoardControl.getField();
        fieldSize = Mathf.RoundToInt(Mathf.Sqrt(playField.Length));
        if (GameObject.FindGameObjectsWithTag("player").Length < 2)
        {
            firstPlayer = true;
        }
        else
        {
            firstPlayer = false;
        }
        // Spieler 1 kriegt Reihe 1,2
        // Spieler 2 kriegt Reihe fieldSize-1, fieldSize-2
        for (int x = 0; x < fieldSize; x++)
        {
            for (int z = 0; z < 2; z++)
            {
                if (firstPlayer)
                {
                    soldier = GameObject.Instantiate(prefabSoldier, new Vector3(x, 0, z), Quaternion.identity);//, gameObject.transform);
                }
                else
                {
                    soldier = GameObject.Instantiate(prefabSoldier, new Vector3(x, 0, fieldSize - z - 1), Quaternion.identity);//, gameObject.transform);
                }
                // set Color
                MeshRenderer renderer = soldier.GetComponentInChildren <MeshRenderer>();
                int          choice   = Random.Range(1, 4);
                switch (choice)
                {
                case 1:
                    renderer.material = rockMaterial;
                    break;

                case 2:
                    renderer.material = paperMaterial;
                    break;

                case 3:
                    renderer.material = scissorMaterial;
                    break;
                }
            }
        }
    }
Example #16
0
 private void Awake()
 {
     if (GameController.instance.Game_Type == GAME_MODE_TYPE.MODE_4)
     {
     }
     else
     {
         if (instance != null)
         {
             Destroy(gameObject);
         }
         else
         {
             instance = this;
         }
     }
 }
        public ControlCenter(GameInstance g, GamingForm f)
        {
            parent  = f;
            game    = g;
            g.Input = GetInput;

            InvokeRebuild = () => parent.Invoke((Action)ReBuild);
            Input         = (p) =>
            {
                parent.Invoke(InvokeRebuild);
                return(true);
            };

            endButt = new EndTurnButton(this);
            HeroA   = new HeroPortret(this, true);
            HeroB   = new HeroPortret(this, false);
            AHand   = new HandControl(this, true);
            BHand   = new HandControl(this, false);
            boardC  = new BoardControl(this);
        }
Example #18
0
        public Form1()
        {
            //이것도 커밋해 보시지!!
            InitializeComponent();
            _board            = new Board();
            _control          = new BoardControl(_board);
            _control.Location = new Point(0, 0);
            _control.Size     = new Size(hScrollBar1.Maximum * 30 + Width, vScrollBar1.Maximum * 30 + Height);
            this.Controls.Add(_control);

            _control.Printed += _control_Printed;

            this.KeyDown += Form1_KeyDown;
            KeyPreview    = true;

            EntryBlock entry = new EntryBlock(_board);

            entry.Location = new Point(00, 50);
            _control.AddBlocks(entry);
            _board.Entry = entry;
        }
Example #19
0
        public GamingForm(GameInstance g)
        {
            CheckForIllegalCrossThreadCalls = false;
            KeyPreview      = true;
            StartPosition   = FormStartPosition.CenterScreen;
            FormBorderStyle = FormBorderStyle.FixedToolWindow;

            Size = new Size(1300, 700);

            center = new ControlCenter(g, this);

            center.boardC.Location = BoardControl.StdLocation(center.boardC);

            center.HeroA.Location = HeroPortret.DefaultLocation(center.HeroA);
            center.HeroB.Location = HeroPortret.DefaultLocation(center.HeroB);

            center.AHand.Location = HandControl.StdLocation(center.AHand, false);
            center.BHand.Location = HandControl.StdLocation(center.BHand, true);

            center.endButt.Location = EndTurnButton.StdLocation(center.endButt);

            Load += StdForm_Load;
        }
Example #20
0
        public MainWindowViewModel(BoardControl boardControl)
        {
            _boardControl = boardControl;
            Iterations    = 0;
            Interval      = 10;

            _timer.Tick += (_, __) =>
            {
                SearchStep searchStep;
                if (_solver.SearchSteps.TryDequeue(out searchStep))
                {
                    var piecePlacements = searchStep.PiecePlacements.ToList();
                    ProcessSearchStep(piecePlacements);
                    if (piecePlacements.Count == Pieces.ThePieces.Count())
                    {
                        _timer.Stop();
                    }
                }
            };

            _solver.Solve();
            _timer.Start();
        }
Example #21
0
 public override TestOrchestrator GetOrchestrator(Form parentForm, BoardControl boardControl, int idParticipant, Sensors.SensorContainer sensorContainer)
 {
     return new AdHocOrchestrator(parentForm, boardControl, this);
 }
Example #22
0
 public override TestOrchestrator GetOrchestrator(Form parentForm, BoardControl boardControl, Sensors.SensorContainer sensorContainer)
 {
     return new VolkeTestOrchestrator(parentForm, boardControl, this, 0, sensorContainer);
 }
Example #23
0
 public void RemoveBoardControl(BoardControl boardControl)
 {
     boardControls.Remove(boardControl);
 }
Example #24
0
 public void AddBoardControl(BoardControl boardControl)
 {
     boardControls.Add(boardControl);
 }
Example #25
0
 public MainViewModel(BoardControl boardControl)
 {
     this.boardControl = boardControl;
 }
Example #26
0
File: Test.cs Project: hcesar/Chess
 public abstract TestOrchestrator GetOrchestrator(Form parentForm, BoardControl boardControl, int idParticipant, Sensors.SensorContainer sensorContainer);
Example #27
0
            public CurrentTest(VolkeTestItem test, BoardControl boardControl, DateTime questionDate, DateTime startDate, DateTime overallStartDate)
            {
                this.StartDate = startDate;
                this.QuestionDate = questionDate;
                this.overallStartDate = overallStartDate;
                this.Stopwatch = System.Diagnostics.Stopwatch.StartNew();
                this.Test = test;
                var board = boardControl.StartNew(new Player(), new Player(), test.FEN);

                //var mouseSensor = new Sensors.MouseSensor(boardControl);
                this.RecordFile = "recorded-files\\" + Guid.NewGuid() + ".chess";
                this.sensorContainer = new Sensors.SensorContainer();
                this.writer = new IO.ChessStreamWriter(board, sensorContainer, this.RecordFile);
            }
Example #28
0
 public AdHocOrchestrator(Form parentForm, BoardControl control, AdHocTest test)
     : base(parentForm, control)
 {
     this.startDate = DateTime.Now;
     this.test = test;
 }
Example #29
0
 public TestOrchestrator(Form parentForm, BoardControl boardControl)
 {
     this.ParentForm = parentForm;
     this.BoardControl = boardControl;
 }
Example #30
0
File: Test.cs Project: hcesar/Chess
 public void OnPreInit(BoardControl boardControl)
 {
     this.OnInit();
 }
Example #31
0
 private void InitGamePanel(Board b)
 {
     _boardControl = new BoardControl();
     _boardControl.Init(b);
 }