コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,LabWorkID,TeacherID,Name,Date,Place")] Passing passing)
        {
            if (id != passing.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(passing);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PassingExists(passing.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TeacherID"] = new SelectList(_context.Teachers, "ID", "Address", passing.TeacherID);
            ViewData["LabWorkID"] = new SelectList(_context.LabWorks, "ID", "Name", passing.LabWorkID);
            return(View(passing));
        }
コード例 #2
0
    // Start is called before the first frame update
    void Start()
    {
        finalPosition = transform.position;

        //reset = GameObject.FindGameObjectWithTag("Canvas").GetComponent<Reset>();
        //win = GameObject.FindGameObjectWithTag("Canvas").GetComponent<WinCondicional>();

        parent = transform.parent.GetComponent <Passing>();
        reset  = parent.reset;
        win    = parent.win;

        wining = false;

        switch (player)
        {
        case Player.Player1:
            horizontal = "Horizontal_1";
            vertical   = "Vertical_1";
            break;

        case Player.Player2:
            horizontal = "Horizontal_2";
            vertical   = "Vertical_2";
            break;
        }

        atchoo = false;
    }
コード例 #3
0
        private static StoreMessage ParseStoreMessage(string dataFromClient)
        {
            var parts        = dataFromClient.Split(new char[] { '@' }, StringSplitOptions.RemoveEmptyEntries);
            var i            = 0;
            var storeMessage = new StoreMessage();

            foreach (var part in parts)
            {
                if (i == 0)
                {
                    storeMessage.Location = part;
                }
                else if (i == 1)
                {
                    i++;
                    continue; // part == "Store" (function name)
                }
                else
                {
                    if (int.TryParse(part, out int messageNumber)) // last part, containing count
                    {
                        storeMessage.MessageNumber = messageNumber;
                    }
                    else // actual passing
                    {
                        storeMessage.Passings.Add(Passing.Parse(part));
                    }
                }
                i++;
            }

            return(storeMessage);
        }
コード例 #4
0
        private void OnTimedEvent(object sender, ElapsedEventArgs e)
        {
            if (IsRunning)  // 執行中就不要觸發
            {
                try
                {
                    Passing?.Invoke(this, new KtTimerPassEventArgs(PassCount++));
                }
                catch (Exception ex)
                {
                    Error?.Invoke(this, new ExceptionEventArgs(ex));
                }

                return;
            }

            try
            {
                IsRunning = true;
                PassCount = 0;

                foreach (var action in _actions)
                {
                    action?.Invoke();
                }
            }
            catch (Exception ex)
            {
                Error?.Invoke(this, new ExceptionEventArgs(ex));
            }
            finally
            {
                IsRunning = false;
            }
        }
コード例 #5
0
        static public void ExecutionProcess(Action action, bool debugFlag = false)
        {
            try
            {
                eexecutionTokenSource = new CancellationTokenSource();
                eexecutionToken       = eexecutionTokenSource.Token;

                if (!serialPort.IsOpen)
                {
                    throw new InvalidOperationException();
                }
                if (!startExecution_status)
                {
                    startExecution_status = true;
                    action();

                    execution = new Task(() =>
                    {
                        Point[] tempPoints = new Point[pointList.Count];
                        pointList.CopyTo(tempPoints);
                        do
                        {
                            Passing.pastPoint = tempPoints[0];
                            //проходимся по всем точкам и выролняем их отправку
                            foreach (Point point in tempPoints)
                            {
                                if (eexecutionToken.IsCancellationRequested)
                                {
                                    return;                                          //принудительное закрытие задачи
                                }
                                Passing.sinFunc(Passing.pastPoint,
                                                point,
                                                serialPort.Write);
                                Passing.pastPoint = point;
                                if (debugFlag)
                                {
                                    CommonConsoleWrite(point.ToString());
                                }
                            }
                        } while (cycleStatus && startExecution_status);

                        startExecution_status = false;

                        action();
                    });
                    execution.Start();
                }
                else
                {
                    startExecution_status = false;  //в зависимости от него переключить внешний вид кнопки запуска программы точек
                    action();
                    eexecutionTokenSource.Cancel();
                }
            }
            catch (Exception ce)
            {
                CommonConsoleWrite(ce.Message, Colors.Red);
            }
        }
コード例 #6
0
    private void PassBallToPlayer(Passing targetPlayer)
    {
        var direction = DirectionTo(targetPlayer);

        _ball.transform.SetParent(null);
        _ball.GetComponent <Rigidbody>().isKinematic = false;
        _ball.GetComponent <Rigidbody>().AddForce(direction * passForce);
    }
コード例 #7
0
    private void Update()
    {
        Passing closestTeamPlayer = FindClosestTeamPlayer();

        if (IhaveBall())
        {
            if (Input.GetKeyUp(KeyCode.Q))
            {
                PassBallToPlayer(closestTeamPlayer);
                Debug.Log("We passed the ball to the closest player");
            }
        }
    }
コード例 #8
0
 // Start is called before the first frame update
 void Start()
 {
     // ボールを取得
     ball = GameObject.Find("Ball");
     // ボールのRigidbodyを取得
     ballRigidbody = ball.GetComponent <Rigidbody>();
     // ボールのPassingクラスを取得
     passScript = ball.GetComponent <Passing>();
     // Animatorを取得
     animator = GetComponent <Animator>();
     // プレイヤーのRigidbodyを取得
     rb = GetComponent <Rigidbody>();
 }
コード例 #9
0
        public async Task <IActionResult> Create([Bind("ID,LabWorkID,TeacherID,Name,Date,Place")] Passing passing)
        {
            if (ModelState.IsValid)
            {
                _context.Add(passing);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TeacherID"] = new SelectList(_context.Teachers, "ID", "Address", passing.TeacherID);
            ViewData["LabWorkID"] = new SelectList(_context.LabWorks, "ID", "Name", passing.LabWorkID);
            return(View(passing));
        }
コード例 #10
0
 // Use this for initialization
 void Start()
 {
     // Rigidbodyを取得
     rb = GetComponent <Rigidbody>();
     // Animatorを取得
     animator = GetComponent <Animator>();
     // Playerの現在より少し前の位置を保存
     playerPos = transform.position;
     // ボールを取得
     ball = GameObject.Find("Ball");
     // ボールのPassingクラスを取得
     passScript = ball.GetComponent <Passing>();
 }
コード例 #11
0
        public override int GetHashCode()
        {
            var hashCode = -1413490195;

            hashCode = hashCode * -1521134295 + Sum.GetHashCode();
            hashCode = hashCode * -1521134295 + Experiences.GetHashCode();
            hashCode = hashCode * -1521134295 + Stamina.GetHashCode();
            hashCode = hashCode * -1521134295 + Goalkeeper.GetHashCode();
            hashCode = hashCode * -1521134295 + Tackling.GetHashCode();
            hashCode = hashCode * -1521134295 + Header.GetHashCode();
            hashCode = hashCode * -1521134295 + Winger.GetHashCode();
            hashCode = hashCode * -1521134295 + Creativity.GetHashCode();
            hashCode = hashCode * -1521134295 + Passing.GetHashCode();
            hashCode = hashCode * -1521134295 + Attacker.GetHashCode();
            return(hashCode);
        }
コード例 #12
0
 // Use this for initialization
 void Start()
 {
     // ボールを取得
     ball = GameObject.Find("Ball");
     // ボールのRigidbodyを取得
     ballRigidbody = ball.GetComponent <Rigidbody>();
     // Passingクラスを取得
     passScript = ball.GetComponent <Passing>();
     // Animatorを取得
     animator = GetComponent <Animator>();
     // ゾンビの声を取得
     zombiVoice  = Resources.Load <AudioClip>("voc_monster_attack_rnd_04");
     audioSource = transform.GetComponent <AudioSource>();
     // Score GUIを取得
     scoreGUI = GameObject.Find("Score GUI");
     // Scoreクラスを取得
     scoreScript = scoreGUI.GetComponent <Score>();
 }
コード例 #13
0
        public frmProfile(string Phone_Number_Acc)
        {
            InitializeComponent();
            Phone_Login = Phone_Number_Acc;
            FileStream   fs = new FileStream(Phone_Login + "_profile.txt", FileMode.Open, FileAccess.Read);
            StreamReader sr = new StreamReader(fs);

            Passing     = sr.ReadToEnd();
            Passing_Arr = Passing.Split(Delimiter);
            sr.Close();
            fs.Close();
            TB_Nama.Text         = Passing_Arr[0];
            TB_ID_Type.Text      = Passing_Arr[1];
            TB_ID_Number.Text    = Passing_Arr[2];
            TB_Phone_Number.Text = Passing_Arr[3];
            TB_Date_Birth.Text   = Passing_Arr[4] + " " + Passing_Arr[5] + " " + Passing_Arr[6];
            TB_Place_Birth.Text  = Passing_Arr[7];
            TB_Password.Text     = Passing_Arr[8];
        }
コード例 #14
0
    private Passing FindClosestTeamPlayer()
    {
        Passing closestPlayer      = null;
        float   closestDistanceSqr = Mathf.Infinity;
        Vector3 currentPosition    = transform.position;

        foreach (Passing potentialTarget in _allOtherPlayers)
        {
            Vector3 directionToTarget = potentialTarget.GetComponent <BoxCollider>().transform.position - currentPosition;
            float   dSqrToTarget      = directionToTarget.sqrMagnitude;
            if (dSqrToTarget < closestDistanceSqr)
            {
                closestDistanceSqr = dSqrToTarget;
                closestPlayer      = potentialTarget;
            }
        }

        return(closestPlayer);
    }
コード例 #15
0
 public void Remove(Passing passing)
 {
     _context.Passings.Remove(passing);
 }
コード例 #16
0
    private static void Main(string[] args)
    {
        Passing passing = new Passing("Hello World");

        Console.WriteLine(passing);
    }
コード例 #17
0
ファイル: Board.cs プロジェクト: haagor/ChessProject_PNSInnov
    /// <summary>
    ///     Return the Position of the square you reach if you add the movement to
    ///     the coordinate passed in parameter on this board
    /// </summary>
    /// <param name="coo">the start coordinate on this board</param>
    /// <param name="movement">the movement you do</param>
    /// <returns>The Position you reach after this movement</returns>
    public Position GetPositionFromTo(Vector2 coo, Vector2 movement, ref IList <int[, ]> convertMatrices)
    {
        Position  p       = new Position();
        Vector2   carry   = coo + movement;
        bool      passing = false;
        Direction dir     = Direction.NONE;

        Vector2 newMovement = new Vector2(movement.x, movement.y);

        //depassement droite
        if (carry.x > columns)
        {
            passing        = true;
            dir            = Direction.RIGHT;
            newMovement.x -= (columns - coo.x) + 1;

            /*p = newBoard.GetPositionFromTo(new Vector2(newBoard.Columns, (rows - coo.y) + 1),
             *  new Vector2((columns-coo.x)+1-movement.x, -movement.y));
             */
        }
        else if (carry.x <= 0)
        {
            passing        = true;
            dir            = Direction.LEFT;
            newMovement.x += coo.x;

            /*
             * Board newBoard = this.neighbour[Direction.LEFT];
             * p = newBoard.GetPositionFromTo(new Vector2(1, (rows - coo.y) + 1),
             *  new Vector2(-movement.x-((coo.x - 1) + 1), -movement.y));*/
        }
        else if (carry.y > rows)
        {
            passing        = true;
            dir            = Direction.UP;
            newMovement.y -= (rows - coo.y) + 1;

            /*
             * Board newBoard = this.neighbour[Direction.UP];
             * p = newBoard.GetPositionFromTo(new Vector2(coo.x, 1),
             *  new Vector2(movement.x, movement.y - ((rows - coo.y)+1)));*/
        }
        else if (carry.y <= 0)
        {
            passing        = true;
            dir            = Direction.DOWN;
            newMovement.y += coo.y;

            /*
             * Board newBoard = this.neighbour[Direction.DOWN];
             * p = newBoard.GetPositionFromTo(new Vector2(coo.x, newBoard.rows),
             *  new Vector2(movement.x, carry.y));*/
        }
        else
        {
            p = new Position(this, carry);
        }

        if (passing)
        {
            Board   newBoard = this.neighbour[dir];
            Passing pass     = this.convertMatrices[dir];
            Vector2 newPos   = pass.newBeginning(coo, this.rows, this.columns);
            int     moveX    = (int)(newMovement.x * pass.convertMatrix[0, 0] + newMovement.y * pass.convertMatrix[1, 0]);
            int     moveY    = (int)(newMovement.x * pass.convertMatrix[0, 1] + newMovement.y * pass.convertMatrix[1, 1]);
            Vector2 newMove  = new Vector2(moveX, moveY);
            convertMatrices.Add(pass.convertMatrix);

            p = newBoard.GetPositionFromTo(newPos, newMove, ref convertMatrices);
        }
        return(p);
    }
コード例 #18
0
ファイル: Board.cs プロジェクト: haagor/ChessProject_PNSInnov
 /// <summary>
 ///     Add a neighbour board to this one
 /// </summary>
 /// <param name="dir">The direction where the other board is</param>
 /// <param name="board">the new neighbour</param>
 public void AddBoard(Direction dir, Board board, Passing p)
 {
     neighbour.Add(dir, board);
     convertMatrices.Add(dir, p);
 }
コード例 #19
0
    /// <summary>
    ///     Initialize the different boards
    /// </summary>
    /// <param name="boardAbove">the boards we want to init</param>
    private void InitBoards(Board[] boards)
    {
        Passing up_down = new Passing();

        up_down.convertMatrix = new int[2, 2] {
            { 1, 0 },
            { 0, 1 }
        };

        up_down.newBeginning = (Vector2 coo, int rows, int columns) => { return(new Vector2(coo.x, 1)); };
        boards[0].AddBoard(Direction.UP, boards[3], up_down);
        boards[1].AddBoard(Direction.UP, boards[0], up_down);
        boards[2].AddBoard(Direction.UP, boards[1], up_down);
        boards[3].AddBoard(Direction.UP, boards[2], up_down);

        Passing down_up = new Passing();

        down_up.convertMatrix = new int[2, 2] {
            { 1, 0 },
            { 0, 1 }
        };
        down_up.newBeginning = (Vector2 coo, int rows, int columns) => { return(new Vector2(coo.x, rows)); };
        boards[0].AddBoard(Direction.DOWN, boards[1], down_up);
        boards[1].AddBoard(Direction.DOWN, boards[2], down_up);
        boards[2].AddBoard(Direction.DOWN, boards[3], down_up);
        boards[3].AddBoard(Direction.DOWN, boards[0], down_up);


        Passing left_left = new Passing();

        left_left.convertMatrix = new int[2, 2] {
            { -1, 0 },
            { 0, -1 }
        };
        left_left.newBeginning = (Vector2 coo, int rows, int columns) => { return(new Vector2(1, (rows - coo.y) + 1)); };
        boards[4].AddBoard(Direction.LEFT, boards[3], left_left);
        boards[3].AddBoard(Direction.LEFT, boards[4], left_left);

        Passing right_right = new Passing();

        right_right.convertMatrix = new int[2, 2] {
            { -1, 0 },
            { 0, -1 }
        };
        right_right.newBeginning = (Vector2 coo, int rows, int columns) => { return(new Vector2(columns, (rows - coo.y) + 1)); };
        boards[5].AddBoard(Direction.RIGHT, boards[3], right_right);
        boards[3].AddBoard(Direction.RIGHT, boards[5], right_right);


        Passing right_left = new Passing();

        right_left.convertMatrix = new int[2, 2] {
            { 1, 0 },
            { 0, 1 }
        };
        right_left.newBeginning = (Vector2 coo, int rows, int columns) => { return(new Vector2(1, coo.y)); };
        boards[1].AddBoard(Direction.RIGHT, boards[5], right_left);
        boards[4].AddBoard(Direction.RIGHT, boards[1], right_left);

        Passing left_right = new Passing();

        left_right.convertMatrix = new int[2, 2] {
            { 1, 0 },
            { 0, 1 }
        };
        left_right.newBeginning = (Vector2 coo, int rows, int columns) => { return(new Vector2(columns, coo.y)); };
        boards[5].AddBoard(Direction.LEFT, boards[1], left_right);
        boards[1].AddBoard(Direction.LEFT, boards[4], left_right);

        Passing right_up = new Passing();

        right_up.convertMatrix = new int[2, 2] {
            { 0, -1 },
            { 1, 0 }
        };
        right_up.newBeginning = (Vector2 coo, int rows, int columns) => { return(new Vector2(coo.y, columns)); };
        boards[0].AddBoard(Direction.RIGHT, boards[5], right_up);

        Passing up_right = new Passing();

        up_right.convertMatrix = new int[2, 2] {
            { 0, 1 },
            { -1, 0 }
        };
        up_right.newBeginning = (Vector2 coo, int rows, int columns) => { return(new Vector2(rows, coo.x)); };
        boards[5].AddBoard(Direction.UP, boards[0], up_right);

        Passing left_down = new Passing();

        left_down.convertMatrix = new int[2, 2] {
            { 0, -1 },
            { 1, 0 }
        };
        left_down.newBeginning = (Vector2 coo, int rows, int columns) => { return(new Vector2(coo.y, 1)); };
        boards[2].AddBoard(Direction.LEFT, boards[4], left_down);

        Passing down_left = new Passing();

        down_left.convertMatrix = new int[2, 2] {
            { 0, 1 },
            { -1, 0 }
        };
        down_left.newBeginning = (Vector2 coo, int rows, int columns) => { return(new Vector2(1, coo.x)); };
        boards[4].AddBoard(Direction.DOWN, boards[2], down_left);


        Passing right_down = new Passing();

        right_down.convertMatrix = new int[2, 2] {
            { 0, 1 },
            { -1, 0 }
        };
        right_down.newBeginning = (Vector2 coo, int rows, int columns) => { return(new Vector2(1 + rows - coo.y, 1)); };
        boards[2].AddBoard(Direction.RIGHT, boards[5], right_down);


        Passing down_right = new Passing();

        down_right.convertMatrix = new int[2, 2] {
            { 0, -1 },
            { 1, 0 }
        };
        down_right.newBeginning = (Vector2 coo, int rows, int columns) => { return(new Vector2(columns, (rows - coo.x) + 1)); };
        boards[5].AddBoard(Direction.DOWN, boards[2], down_right);


        Passing left_up = new Passing();

        left_up.convertMatrix = new int[2, 2] {
            { 0, 1 },
            { -1, 0 }
        };
        left_up.newBeginning = (Vector2 coo, int rows, int columns) => { return(new Vector2(1 + columns - coo.y, rows)); };
        boards[0].AddBoard(Direction.LEFT, boards[4], left_up);


        Passing up_left = new Passing();

        up_left.convertMatrix = new int[2, 2] {
            { 0, -1 },
            { 1, 0 }
        };
        up_left.newBeginning = (Vector2 coo, int rows, int columns) => { return(new Vector2(1, (columns - coo.x) + 1)); };
        boards[4].AddBoard(Direction.UP, boards[0], up_left);
    }
コード例 #20
0
 public async Task <PassingResource> SaveAsync(Passing passing)
 {
     return(new PassingResource());
 }
コード例 #21
0
ファイル: Form1.cs プロジェクト: crawfis/RaceManager
 private void LogPassings(TagReadEventArgs e)
 {
     TagInfo tagInfo = e.TagInfo;
     Passing passing = new Passing();
     passing.Tag = tagInfo.ID.Value;
     passing.PassingTime = tagInfo.Time;
     passing.ReadingNumber = -1;
     passing.Lap = -1;
     //database.Passings.InsertOnSubmit(passing);
     //database.SubmitChanges();
 }
コード例 #22
0
 public void Update(Passing passing)
 {
     _context.Passings.Update(passing);
 }
コード例 #23
0
 private Vector3 DirectionTo(Passing player)
 {
     return(Vector3.Normalize(player.transform.position - _ball.transform.position));
 }
コード例 #24
0
 public async Task AddAsync(Passing passing)
 {
     await _context.Passings.AddAsync(passing);
 }