public async Task <ActionResult <Todo> > PutTodoSort([FromBody] ItemMove data)
        {
            if (data.Id == -1 || data.DestinationIndex == -1)
            {
                return(BadRequest("Nem adtál meg elegendő adatot!"));
            }

            //adatok

            var item = dbContext.Todo.Where(t => t.Id == data.Id).SingleOrDefault();

            if (item == null)
            {
                return(NotFound("Nem található ilyen teendő"));
            }
            //-adatok

            //újtábla újra rendezése
            var todos = dbContext.Todo.Where(t => t.TypeId == item.TypeId).OrderBy(t => t.Order).ToList();

            await dbContext.SaveChangesAsync();

            await ReOrderTodosRowSort(todos, item.Order, data.DestinationIndex);

            return(Ok());
        }
Пример #2
0
    //プレイヤーのあたり判定
    private void OnTriggerStay2D(Collider2D col)
    {
        if (currentCol == null)
        {
            switch (col.gameObject.tag)
            {
            //アイテムに衝突するとき
            case "Item1":
                if (Input.GetKeyDown(KeyCode.JoystickButton4))
                {
                    BuildManager.Instance.DataReturn(col, this.gameObject);
                    itemMoveObj = col.gameObject.GetComponent <ItemMove>();
                    currentCol  = col;
                }
                break;

            //石に衝突するとき
            case "Stone":
                // Debug.Log("dsdd");
                if (Input.GetKeyDown(KeyCode.JoystickButton4))
                {
                    //BuildManager.Instance.DataReturn(col, this.gameObject);
                    stoneObjCode = col.gameObject.GetComponent <Stone>();
                    stoneObjCode.SetPlayerObject(this.gameObject);
                    isSetStonePosition = true;
                    currentCol         = col;
                }
                break;
            }
        }
    }
Пример #3
0
    /// <summary>
    /// アイテムの射出攻撃メソッド
    /// </summary>
    private void AttackItem()
    {
        if (itemMoveObj != null)
        {
            //射出するオブジェクのデータを渡す
            //引数1:攻撃開始位置
            //引数2:攻撃終了位置
            //引数3:アイテムの移動速度
            //引数4:移動中最大の高さ
            if (direction == "right")
            {
                Vector3 endPoint = transform.position + new Vector3(selectedItem.width, 0, 0);
                itemMoveObj.SetAttackData(attackStartPosition.position, endPoint, selectedItem.speed, selectedItem.height);
            }
            else if (direction == "left")
            {
                Vector3 endPoint = transform.position - new Vector3(selectedItem.width, 0, 0);
                itemMoveObj.SetAttackData(attackStartPosition.position, endPoint, selectedItem.speed, selectedItem.height);
            }

            itemMoveObj  = null;
            selectedItem = null;
        }
        currentCol = null;
    }
Пример #4
0
    public void SetItemId(int id, int num = 1)
    {
        ItemMove item = GetComponentInChildren <ItemMove>();

        item.SetId(id);

        this.num = num;

        nameLabel.text = num.ToString();
        nameLabel.gameObject.SetActive(true);
    }
Пример #5
0
        /// <summary>
        /// Create the item mpve
        /// </summary>
        private void CreateItemMove()
        {
            if (null == TheMailProcessor)
            {
                throw new ArgumentNullException(nameof(TheMailProcessor));
            }
            if (null == TheEngine)
            {
                throw new ArgumentNullException(nameof(TheEngine));
            }

            // then start monitoring folders for user moving files.
            TheIemMove = new ItemMove(TheEngine.Categories, TheMailProcessor, TheEngine.Options, TheEngine.Logger);
        }
Пример #6
0
        public async Task <ActionResult <Todo> > PutTodoTypeSort([FromBody] ItemMove data)
        {
            if (data.Id == -1 || data.DestinationIndex == -1 || data.SourceIndex == -1)
            {
                return(BadRequest("Nem adtál meg elegendő adatot!"));
            }

            var tt = dbContext.TodoTypes.Where(t => t.Id == data.Id).SingleOrDefault();

            if (tt == null)
            {
                return(NotFound("Nem található ilyen tábla"));
            }
            var todotypes = dbContext.TodoTypes.OrderBy(t => t.Order).ToList();

            await dbContext.SaveChangesAsync();

            await ReOrderTodoTypeRowSort(todotypes, data.SourceIndex, data.DestinationIndex);

            return(Ok());
        }
        public async Task <ActionResult <Todo> > PutTodoColumn([FromBody] ItemMove data)
        {
            if (data.Id == -1 || String.IsNullOrEmpty(data.DestinationTableName) || data.DestinationIndex == -1)
            {
                return(BadRequest("Nem adtál meg elegendő adatot!"));
            }


            var item = dbContext.Todo.Where(t => t.Id == data.Id).SingleOrDefault();

            if (item == null)
            {
                return(NotFound("Nem található ilyen Item"));
            }
            var type = dbContext.TodoTypes.Where(t => t.Name.ToLower().Equals(data.DestinationTableName.ToLower())).SingleOrDefault();

            if (type == null)
            {
                return(NotFound("Nem található ilyen Tábla"));
            }

            var originalTypeTodos = dbContext.Todo.Where(t => t.TypeId == item.TypeId && t.Id != item.Id);

            await ReOrderTodos(originalTypeTodos);


            int number = item.Order;

            item.Type   = type;
            item.TypeId = type.Id;
            item.Order  = data.DestinationIndex;

            await dbContext.SaveChangesAsync();

            return(Ok());
        }
Пример #8
0
 private void Awake()
 {
     Instance = this;
 }