コード例 #1
0
        public async Task <IEnumerable <Motivation> > GetMotivationsForType(MotivationType motivationType)
        {
            var motivationsByType = await _motivationEntityStore.GetByPartitionAsync(motivationType.ToString());

            return(motivationsByType.Select(x => new Motivation
            {
                Id = new Guid(x.RowKey),
                MotivationType = (MotivationType)Enum.Parse(typeof(MotivationType), x.PartitionKey, true),
                MotivationMessage = x.MotivationMessage
            }));
        }
コード例 #2
0
        public Task InsertMotivation(string userId, MotivationType motivationType, string message)
        {
            var newMotivationId  = Guid.NewGuid().ToString();
            var motivationEntity = new MotivationEntity(motivationType.ToString(), newMotivationId, message, userId);

            var motivationEntityTask = _motivationEntityStore.SetAsync(motivationEntity);

            var motivationByIdEntity = new MotivationByIdEntity(userId, newMotivationId, message, motivationType);

            var motivationByIdEntityTask = _motivationByIdEntityStore.SetAsync(motivationByIdEntity);

            return(Task.WhenAll(new Task[] { motivationEntityTask, motivationByIdEntityTask }));
        }
コード例 #3
0
ファイル: WinCheck.cs プロジェクト: Dreeryan/SenshiPinya
    public void Initialize(string _minigameID, UnityEvent _minigameCompleted, TextMeshProUGUI _progressText = null)
    {
        hasWon      = false;
        curProgress = 0;
        minigameCompleted?.RemoveAllListeners();

        minigameID = _minigameID;
        ScoreData scoreData = Instance.data.GetData(_minigameID);

        goal              = scoreData.Goal;
        phrase            = scoreData.Phrase;
        progressText      = _progressText;
        motivationType    = scoreData.MotivationType;
        minigameCompleted = _minigameCompleted;
    }
コード例 #4
0
    public void UpdateMotivation(MotivationType type)
    {
        int delta = incrementation;

        if (type == MotivationType.Reduce)
        {
            delta *= -1;
        }
        currMotivation += delta;

        currMotivation = Mathf.Clamp(currMotivation
                                     , 0
                                     , maxMotivation);

        OnMotivationUpdated?.Invoke(FillRatio);
        SaveData();
    }
コード例 #5
0
    private void Update()
    {
        if (Input.GetKeyDown(increaseKey))
        {
            type = MotivationType.Gain;
            IncrementMotivation();
        }
        else if (Input.GetKeyDown(decreaseKey))
        {
            type = MotivationType.Reduce;
            IncrementMotivation();
        }

        if (Input.GetKeyDown(ResetKey))
        {
            ResetMotivation();
        }
    }
コード例 #6
0
        public async Task <bool> InsertPushSchedule(string userId, MotivationType motivationType, DateTime timeofDay)
        {
            var pushScheduleEntity = new ScheduledPushEntity(timeofDay.Hour.ToString(), userId, motivationType);

            return(await _pushEntityStore.SetAsync(pushScheduleEntity));
        }
コード例 #7
0
ファイル: Functions.cs プロジェクト: Iamabdul/MotivateMe
        private async Task SendToQueue(ILogger logger, Guid userId, MotivationType motivationType)
        {
            await _pushJobQueueManager.PushMessage(new MotivationQueueMessage { UserId = userId, MotivationType = motivationType });

            logger.LogInformation($"Sending motivation to {userId} with a {motivationType} of encouragement!");
        }
コード例 #8
0
 public ScheduledPushEntity(string partitionKey, string rowKey, MotivationType motivationType)
 {
     PartitionKey   = partitionKey;
     RowKey         = rowKey;
     MotivationType = motivationType.ToString();
 }
コード例 #9
0
 public Task <IEnumerable <Motivation> > GetAllForType(MotivationType motivationType)
 {
     return(_motivationsStoreManager.GetMotivationsForType(motivationType));
 }
コード例 #10
0
 public MotivationByIdEntity(string userId, string motivationId, string motivationMessage, MotivationType motivationType)
 {
     PartitionKey      = userId;
     RowKey            = motivationId;
     MotivationMessage = motivationMessage;
     UserId            = userId;
     MotivationType    = motivationType.ToString();
 }