Esempio n. 1
0
        public void Initialize(Vector2 position)
        {
            this.Transform.Position = position;

            // add sprites
            TransformSpriteComponent c = new TransformSpriteComponent(Assets.SpriteFromSheet("hook"), SpriteSize);

            c.Transform.Position = new Vector2(-Towerblock.Size.X / 2f + 1 / 5f * Towerblock.Size.X, 0f);
            this.Add(c);

            c = new TransformSpriteComponent(Assets.SpriteFromSheet("hook"), SpriteSize);
            c.Transform.Position = new Vector2(+Towerblock.Size.X / 2f - 1 / 5f * Towerblock.Size.X, 0f);
            this.Add(c);

            // add animation that moves from outside of view to the side
            this.animationDuration = AnimationDuration;
            this.AddSpawnAnimation();

            // add release action
            this.releaseAction = new InputActionList();
            this.releaseAction.Add(new KeyboardAction(Microsoft.Xna.Framework.Input.Keys.Space, ActionType.OnUp));
            this.releaseAction.Add(new GamepadAction(Microsoft.Xna.Framework.Input.Buttons.A, ActionType.OnUp));
            // todo: restrict touchpanel action to playarea, to not trigger on e.g. some pause button
            this.releaseAction.Add(new TouchpanelAction(ActionType.OnUp));
        }
Esempio n. 2
0
        public ActionResult ActionList(InputActionList input)
        {
            if (IsGetRequest)
            {
                return(View(CurrentUser));
            }
            var result = new BaseOutput();
            int total  = 0;
            var filter = ExpressionBuilder.Where <ActionLog>(f => f.Level <= Level);

            if (!string.IsNullOrEmpty(input.Name))
            {
                filter = filter.And(f => f.UserName.Contains(input.Name));
            }
            if (!string.IsNullOrEmpty(input.Path))
            {
                filter = filter.And(f => f.Path.Contains(input.Path));
            }
            if (input.StartTime.HasValue)
            {
                filter = filter.And(f => f.StartTime >= input.StartTime.Value);
            }
            if (input.EndTime.HasValue)
            {
                input.EndTime = input.EndTime.Value.AddDays(1);
                filter        = filter.And(f => f.StartTime < input.EndTime.Value);
            }
            var repo = GetRepo <ActionLog>();
            var list = repo.GetPaged(out total, input.PageIndex, input.PageSize, filter);

            result.total = total;
            if (list.Any())
            {
                result.data = list;
                SetResponse(s => s.Success, result);
            }
            else
            {
                SetResponse(s => s.NoData, result);
            }
            return(JsonNet(result));
        }