コード例 #1
0
        public void Add(TempMove tempMove)
        {
            if (list.Exists(item => item == tempMove))
            {
                return;
            }

            list.Add(tempMove);
        }
コード例 #2
0
    bool CheckIfSameMove(TempMove move1, TempMove move2)
    {
        bool temp = false;

        if (move1.LeftArmPosition == move2.LeftArmPosition && move1.RightArmPosition == move2.RightArmPosition && move1.LeftLegPosition == move2.LeftLegPosition && move1.RightLegPosition == move2.RightLegPosition)
        {
            temp = true;
        }
        return(temp);
    }
コード例 #3
0
        protected override void LoadFromSql()
        {
            DataTable dt = Provider.Select("TempMove");

            foreach (DataRow row in dt.Rows)
            {
                TempMove tempMove = new TempMove(row);
                Add(tempMove);
            }
        }
コード例 #4
0
        internal Driver getDriver(Car car, DateTime date)
        {
            var tempMoves = list.Where(item => item.isDriverCar(car, date));

            if (tempMoves.Count() > 0)
            {
                TempMove tempMove = tempMoves.First() as TempMove;
                return(tempMove.Driver);
            }
            else
            {
                return(null);
            }
        }
コード例 #5
0
        private void DoubleClickTempMove(Point point)
        {
            if (_dgvMain.GetID() == 0)
            {
                return;
            }

            TempMoveList tempMoveList = TempMoveList.getInstance();
            TempMove     tempMove     = tempMoveList.getItem(_dgvMain.GetID());

            TempMove_AddEdit tempMoveAE = new TempMove_AddEdit(tempMove);

            if (tempMoveAE.ShowDialog() == DialogResult.OK)
            {
                loadCars();
            }
        }
コード例 #6
0
        private ToolStripMenuItem CreateNewTempMove()
        {
            ToolStripMenuItem item = CreateItem("Новое временное перемещение");

            item.Click += delegate
            {
                Car car = _dgvMain.GetCar();
                if (car == null)
                {
                    return;
                }

                TempMove tempMove = car.createTempMove();

                TempMove_AddEdit tempMoveAE = new TempMove_AddEdit(tempMove);
                tempMoveAE.ShowDialog();
            };
            return(item);
        }
コード例 #7
0
        public TempMove_AddEdit(TempMove tempMove)
        {
            InitializeComponent();

            _tempMove = tempMove;
        }
コード例 #8
0
    public override bool OnUpdate()
    {
        SetScoreBars();
        accumulatedTime += Time.deltaTime;
        measureTimer    += Time.deltaTime;
        if (accumulatedTime < activeTimelimit && measureTimer > 0.25)
        {
            TempMove tempMoveP1 = inputCheck.getCurrentMove(true);
            TempMove tempMoveP2 = inputCheck.getCurrentMove(false);
            if (recentMovesP1.Count >= 5 && !CheckIfSameMove(recentMovesP1[4], tempMoveP1))
            {
                int tempScore = 0;
                for (int i = recentMovesP1.Count - 1; i >= 0; i--)
                {
                    if (CheckIfSameMove(recentMovesP1[i], tempMoveP1))
                    {
                        tempScore = repitionScore;
                        break;
                    }
                    else
                    {
                        if (i == 0)
                        {
                            tempScore = maxScore;
                        }
                    }
                }
                playerOneScore += tempScore;
                recentMovesP1.Add(tempMoveP1);
            }

            if (recentMovesP1.Count < 5)
            {
                recentMovesP1.Add(tempMoveP1);
            }


            if (recentMovesP2.Count >= 5 && !CheckIfSameMove(recentMovesP2[4], tempMoveP2))
            {
                int tempScore = 0;
                for (int i = recentMovesP2.Count - 1; i >= 0; i--)
                {
                    if (CheckIfSameMove(recentMovesP2[i], tempMoveP2))
                    {
                        tempScore = repitionScore;
                        break;
                    }
                    else
                    {
                        if (i == 0)
                        {
                            tempScore = maxScore;
                        }
                    }
                    playerTwoScore += tempScore;
                    recentMovesP1.Add(tempMoveP1);
                }
            }

            if (recentMovesP2.Count < 5)
            {
                recentMovesP2.Add(tempMoveP2);
            }

            if (recentMovesP1.Count > 5)
            {
                recentMovesP1.RemoveAt(0);
            }
            if (recentMovesP2.Count > 5)
            {
                recentMovesP2.RemoveAt(0);
            }
            measureTimer = 0;
        }
        else if (accumulatedTime >= activeTimelimit)
        {
            stateFinished = true;
            return(false);
        }
        return(true);
    }