Exemplo n.º 1
0
    /// <summary>
    /// 倒计时工具
    /// </summary>
    private IEnumerator Timer(FreeAction freeAction, float time)
    {
        yield return(0);

        yield return(new WaitForSeconds(time));

        freeAction();
        yield return(null);
    }
Exemplo n.º 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;
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 4
0
 public FreeAction Do(Action<ITransformationProvider> action)
 {
     var item = new FreeAction(action);
     Actions.Add(item);
     return item;
 }