예제 #1
0
    /// <summary>
    /// 倒计时工具
    /// </summary>
    private IEnumerator Timer(FreeAction freeAction, float time)
    {
        yield return(0);

        yield return(new WaitForSeconds(time));

        freeAction();
        yield return(null);
    }
예제 #2
0
        public void ExecuteTurn()
        {
            SleepAction.CalculateScore();
            EatAction.CalculateScore();
            WorkAction.CalculateScore();
            FreeAction.CalculateScore();

            Result = new PlayerTurnResult();

            Result.MoneyEarned = WorkAction.MoneyEarned;
            if (!WorkAction.TargetMet)
            {
                Result.WarningStrikesEarned++;
            }
            Result.SelfEsteemChange -= SleepAction.LostSelfEsteem;
            Result.SelfEsteemChange -= EatAction.LostSelfEsteem;
        }
예제 #3
0
        private void SetFreeActions()
        {
            FreeAction _freeAction = _cache.GetData <FreeAction>("FreeActions");

            if (_freeAction == null || (DateTime.Now.Subtract(_freeAction.created_at).Hours >= 24))
            {
                _freeAction = new FreeAction();
                Query       = new QueryParam()
                {
                    Table  = typeof(Actions).GetTableName(),
                    Fields = "distinct service_url",
                    Where  = new List <ConditionParameter> {
                        Condition("is_free", true),
                        new ConditionParameter {
                            direct_condition = "service_url is not null", PropertyValue = "#$#", PropertyName = "service_url"
                        }
                    }
                };
                _freeAction.actions    = NewRepo.FindAll <string>(Query).ToList();
                _freeAction.created_at = DateTime.Now;
                _cache.SaveData(_freeAction, "FreeActions", null);
            }
        }
예제 #4
0
 public FreeAction Do(Action<ITransformationProvider> action)
 {
     var item = new FreeAction(action);
     Actions.Add(item);
     return item;
 }