示例#1
0
        public HttpResponseMessage Post(HttpRequestMessage request)
        {
            var body = request.Content.ReadAsStringAsync().Result;

            var widget = request.RequestUri.Segments[request.RequestUri.Segments.Length - 1];

            dynamic result;

            try
            {
                result = JsonConvert.DeserializeObject <dynamic>(body);
            }
            catch (JsonReaderException)
            {
                return(new HttpResponseMessage(HttpStatusCode.BadRequest));
            }

            var authTokenInMessage = result["auth_token"] != null ? result["auth_token"].Value : null;

            if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["AuthToken"]) ||
                string.Equals(ConfigurationManager.AppSettings["AuthToken"], authTokenInMessage))
            {
                result.id = widget;

                if (Dashing.SendMessage != null)
                {
                    Dashing.SendMessage(result);
                }

                return(new HttpResponseMessage(HttpStatusCode.NoContent));
            }

            return(new HttpResponseMessage(HttpStatusCode.Unauthorized));
        }
 private void Awake()
 {
     rb             = GetComponent <Rigidbody>();
     boostDirection = transform.up;
     playerHandler  = GetComponentInParent <PlayerHandler>();
     mechDash       = GetComponent <Dashing>();
 }
示例#3
0
        private void SendMessage(object message)
        {
            var authentication = TwitterHelper.Authenticate();

            if (authentication == null)
            {
                Dashing.SendMessage(new { id = "twitter_mentions", comments = new object [] { new { name = "dashing.net", body = "please configure your consumer key/secret", avatar = "" } } });

                return;
            }

            using (var client = new WebClient())
            {
                var url = string.Format("https://api.twitter.com/1.1/search/tweets.json?q={0}", HttpUtility.UrlEncode(SearchTerm));

                client.Headers.Add("Authorization", string.Format("{0} {1}", authentication.TokenType, authentication.AccessToken));

                using (var data = client.OpenRead(url))
                {
                    if (data == null)
                    {
                        return;
                    }

                    var reader = new StreamReader(data);

                    var results = JsonConvert.DeserializeObject <SearchResults>(reader.ReadToEnd());

                    Dashing.SendMessage(new { id = "twitter_mentions", comments = results.Results.Select(n => new { name = n.User.Name, body = n.Text, avatar = n.User.ProfileImageUrl }) });
                }
            }
        }
示例#4
0
        public void SendMessage(object sent)
        {
            LastKarma = CurrentKarma;

            CurrentKarma = _rand.Next(200000);

            Dashing.SendMessage(new { current = CurrentKarma, last = LastKarma, id = "karma" });
        }
示例#5
0
        private void ProcessSprintGoalData(IDictionary <string, object> data)
        {
            string sprintGoal = this.TryGetValue(data, "text");

            // Persist and save the data
            this.persister.Set("sprintgoal", sprintGoal);
            Dashing.SendMessage(new { id = "sprintgoal", text = sprintGoal });
        }
示例#6
0
        protected void SendMessage(object message)
        {
            LastValuation = CurrentValuation;

            CurrentValuation = _rand.Next(100);

            Dashing.SendMessage(new { current = CurrentValuation, last = LastValuation, id = "sample" });
        }
示例#7
0
 private void Awake()
 {
     rigidbody2DWrapper = GetComponentNotNull <C_Rigidbody2DProxy>();
     groundChecker      = GetComponentNotNull <C_ColliderChecker>().GetChecker("Ground Checker");
     climb         = GetComponentNotNull <C_Climb>();
     animatorProxy = GetComponentNotNull <C_AnimatorProxy>();
     dashing       = GetComponentNotNull <Dashing>();
     hairFlow      = GetComponentNotNull <HairFlow>();
 }
示例#8
0
 void Awake()
 {
     playerHandler      = GetComponentInParent <PlayerHandler>();
     mechController     = GetComponent <MechController>();
     firstPersonCamera  = GetComponent <FirstPersonCamera>();
     projectileLauncher = GetComponent <ProjectileLauncher>();
     dashing            = GetComponent <Dashing>();
     viewModelControl   = GetComponent <ViewmodelControl>();
 }
示例#9
0
    private void Start()
    {
        #region Configuring State Machine

        _animator       = GetComponent <Animator>();
        _spriteRenderer = GetComponent <SpriteRenderer>();
        _rb             = GetComponent <Rigidbody2D>();
        _collider       = GetComponent <Collider2D>();

        _stateMachine = new StateMachine();

        // Instantiating states
        var moving       = new Moving(this, _animator);
        var idle         = new Idle(this, _animator);
        var dashing      = new Dashing(this, _animator, _rb, _collider);
        var attacking    = new Attacking(this, _animator, _rb);
        var boomeranging = new Boomeranging(this, _animator, _rb);
        var swapping     = new Swapping(this, _animator, _rb);

        // Assigning transitions
        At(moving, idle, IsIdle());
        At(idle, moving, IsMoving());

        // Dashing
        At(idle, dashing, IsDashing());
        At(moving, dashing, IsDashing());
        At(dashing, idle, IsNotDashing());

        // Attacking
        At(idle, attacking, IsAttacking());
        At(moving, attacking, IsAttacking());
        At(attacking, idle, IsNotAttacking());

        // Boomeranging
        At(idle, boomeranging, IsBoomeranging());
        At(moving, boomeranging, IsBoomeranging());
        At(boomeranging, idle, IsNotBoomeranging());

        // Swapping
        _stateMachine.AddAnyTransition(swapping, IsSwapping());
        At(swapping, idle, IsNotSwapping());

        // Starting state
        _stateMachine.SetState(moving);

        // Method to assign transitions easily
        void At(IState to, IState from, Func <bool> condition) => _stateMachine.AddTransition(to, from, condition);

        #endregion

        #region Instantiating instance variables
        // Base sorting layer
        baseLayer = GetComponent <SpriteRenderer>().sortingOrder;
        #endregion
    }
示例#10
0
        protected void SendMessage(object message)
        {
            Tuple <int, int> obj;

            _lastX += 1;

            _points.TryDequeue(out obj);

            _points.Enqueue(new Tuple <int, int>(_lastX, _rand.Next(50)));

            Dashing.SendMessage(new { id = "convergence", points = _points.Select(m => new { x = m.Item1, y = m.Item2 }) });
        }
示例#11
0
    private void Start()
    {
        #region Configuring State Machine

        _animator       = GetComponent <Animator>();
        _spriteRenderer = GetComponent <SpriteRenderer>();
        _rb             = GetComponent <Rigidbody2D>();

        _stateMachine = new StateMachine();

        // Instantiating states
        var running = new Running(this, _animator);
        var idle    = new Idle(this, _animator);
        var dashing = new Dashing(this, _animator, _rb);
        var stunned = new Stunned(this, _rb);

        // Assigning transitions
        _stateMachine.AddAnyTransition(stunned, IsStunned());
        At(running, idle, IsIdle());
        At(idle, running, IsMoving());
        At(idle, dashing, IsDashing());
        At(running, dashing, IsDashing());
        At(stunned, idle, IsNotStunned());

        // Starting state
        _stateMachine.SetState(running);

        // Method to assign transitions easily
        void At(IState to, IState from, Func <bool> condition) => _stateMachine.AddTransition(to, from, condition);

        // Transition conditions
        Func <bool> IsMoving() => () => (xInput != 0 || yInput != 0);
        Func <bool> IsIdle() => () => (xInput == 0 && yInput == 0);
        Func <bool> IsDashing() => () => (isDashing);
        Func <bool> IsNotDashing() => () => (!isDashing);
        Func <bool> IsStunned() => () => (isStunned);
        Func <bool> IsNotStunned() => () => (!isStunned);

        #endregion

        #region Instantiating instance variables
        // Get boundaries object to set player movement boundaries
        GameObject boundaryObj = GameObject.Find("Boundaries");
        Boundaries boundary    = boundaryObj.GetComponent <Boundaries>();
        xBoundary = boundary.playerBoundary_x;
        yBoundary = boundary.playerBoundary_y;

        // Base sorting layer
        baseLayer = GetComponent <SpriteRenderer>().sortingOrder;
        #endregion
    }
示例#12
0
        protected void SendMessage(object message)
        {
            var random = _buzzwords[_rand.Next(_buzzwords.Length)];

            if (_buzzwordCounts.ContainsKey(random))
            {
                _buzzwordCounts[random] = (_buzzwordCounts[random] + 1) % 30;
            }
            else
            {
                _buzzwordCounts.Add(random, 1);
            }

            Dashing.SendMessage(new { id = "buzzwords", items = _buzzwordCounts.Select(m => new { label = m.Key, value = m.Value }) });
        }
示例#13
0
        public void SendMessage(object message)
        {
            var sprintGoal = this.persister.Get("sprintgoal");

            if (!string.IsNullOrWhiteSpace(sprintGoal))
            {
                Dashing.SendMessage(new { id = "sprintgoal", text = sprintGoal });
            }

            // Now send the burndown
            var data = this.GetData("burndown");

            if (data != null)
            {
                Dashing.SendMessage(new { id = "burndown", points = data });
            }
        }
示例#14
0
    void Start()
    {
        physicController = GetComponent <EnhancedPhysicController>();
        walking          = GetComponent <Walking>();
        jumping          = GetComponent <Jumping>();
        dashing          = GetComponent <Dashing>();

        var movementsInputs = inputs.FindActionMap("Movements");

        movementsInputs.Enable();
        movementsInputs["MoveForward"].performed += OnMoveForward;
        movementsInputs["MoveRight"].performed   += OnMoveRight;
        movementsInputs["Jump"].performed        += OnJump;
        movementsInputs["LookAt"].performed      += OnLookAt;
        //movementsInputs["LookAt"].canceled += OnStopLookAt;
        movementsInputs["Dash"].performed += OnDash;

        onJumpActions.Add(() => { audioSource.clip = jumpSound; audioSource.Play(); });
        onDashActions.Add(() => { audioSource.clip = dashSound; audioSource.Play(); });
    }
示例#15
0
        public Job()
        {
            this.feelUrl = System.Configuration.ConfigurationManager.AppSettings.GetValues("whosoff-icalFeed")?.FirstOrDefault();

            var refreshStr = System.Configuration.ConfigurationManager.AppSettings.GetValues("whosoff-refreshInterval")?.FirstOrDefault();

            if (!int.TryParse(refreshStr, out this.refreshInterval))
            {
                this.refreshInterval = 3;
            }

            var data = new WhosOffDataModel();

            data.items.Add(new WhosOffDataModel.Item {
                DaysOff = 0, Name = "Feed URL:" + this.feelUrl
            });
            Dashing.SendMessage(new { id = "whosoff", items = data.items });

            Timer = new Lazy <Timer>(() => new Timer(SendMessage, null, TimeSpan.Zero, TimeSpan.FromMinutes(this.refreshInterval)));
        }
示例#16
0
        private void ProcessBurnDownData(IDictionary <string, object> data)
        {
            var points = new List <Point>();

            for (int i = 1; i < 11; i++)
            {
                string y = this.TryGetValue(data, "d" + i);
                int    Y;
                int.TryParse(y, out Y);
                points.Add(new Point()
                {
                    X = i, Y = Y
                });
            }

            // Save the data
            var json = Newtonsoft.Json.JsonConvert.SerializeObject(points);

            this.persister.Set("burndown", json);

            // Send it
            Dashing.SendMessage(new { id = "burndown", points = points.Select(m => new { x = m.X, y = m.Y }) });
        }
示例#17
0
        public void SendMessage(object message)
        {
            var feed = this.GetFeed() ?? CreateFakeFeedItem();

            Dashing.SendMessage(new { id = "rss", item_title = feed.Title, item_description = feed.Description });
        }
示例#18
0
 protected void SendMessage(object message)
 {
     Dashing.SendMessage(new { value = _rand.Next(100), id = "synergy" });
 }
示例#19
0
        public void SendMessage(object message)
        {
            var data = GetData();

            Dashing.SendMessage(new { id = "whosoff", items = data.items });
        }
示例#20
0
        public void SendMessage(object message)
        {
            var projectStatus = GetCurrentProjectStatus();

            Dashing.SendMessage(new { id = "teamcity", items = projectStatus });
        }