当前位置: 首页>>代码示例>>C#>>正文


C# EventContext.PushScope方法代码示例

本文整理汇总了C#中EventContext.PushScope方法的典型用法代码示例。如果您正苦于以下问题:C# EventContext.PushScope方法的具体用法?C# EventContext.PushScope怎么用?C# EventContext.PushScope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventContext的用法示例。


在下文中一共展示了EventContext.PushScope方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Evaluate

        public bool Evaluate(EventContext context, Game game)
        {
            //No children means its never true.  Used in CHILDREN_WELLDRESS_PRESTIGE_MOD.
            if (context.CurrentCharacter.Children.Count == 0)
                return false;

            for (int i = 0; i < context.CurrentCharacter.Children.Count; ++i)
            {
                context.PushScope(context.CurrentCharacter.Children[i]);
                if (!requirements.Evaluate(context, game))
                {
                    //We've found a child that doesn't the requirements.  This is a failure
                    context.PopScope();
                    return false;
                }
                context.PopScope();
            }
            return true;
        }
开发者ID:jenn0108,项目名称:CourtIntrigue,代码行数:19,代码来源:Logic.cs

示例2: Evaluate

        public double Evaluate(Game game, EventContext context, Weights weights)
        {
            //TODO: Start with random index.
            // TODO: Should we be doing some average here instead of just stopping
            // at the first one that works?
            for (int i = 0; i < context.CurrentCharacter.Children.Count; ++i)
            {
                Character character = context.CurrentCharacter.Children[i];
                context.PushScope(character);
                if (requirements.Evaluate(context, game))
                {
                    double result = operation.Evaluate(game, context, weights);

                    //AnyChild stops after a single interation.
                    context.PopScope();
                    return result;
                }
                context.PopScope();
            }
            return 0.0;
        }
开发者ID:jenn0108,项目名称:CourtIntrigue,代码行数:21,代码来源:Execute.cs

示例3: Execute

        public void Execute(EventResults result, Game game, EventContext context)
        {
            Character tellingCharacter = context.GetScopedObjectByName("ROOT") as Character;
            InformationInstance informationInstance = tellingCharacter.ChooseInformationAbout(type, context.GetScopedObjectByName(about) as Character);
            bool isNewInformation = context.CurrentCharacter.AddInformation(informationInstance);
            context.PushScope(informationInstance);
            operation.Execute(result, game, context);
            context.PopScope();

            result.AddObservableInfo(informationInstance, overhearChance, tellingCharacter);

            if (isNewInformation)
            {
                game.Log(context.CurrentCharacter.Name + " learned an information.");
                informationInstance.ExecuteOnTold(context.CurrentCharacter, game, context.CurrentCharacter.CurrentRoom);
            }
        }
开发者ID:jenn0108,项目名称:CourtIntrigue,代码行数:17,代码来源:Execute.cs

示例4: EvaluateChangedModifiers

        private double EvaluateChangedModifiers(Character character, EventContext context, Game game)
        {
            context.PushScope(character);
            List<PrestigeModifier> addedModifiers = new List<PrestigeModifier>();
            List<PrestigeModifier> removedModifiers = new List<PrestigeModifier>();
            game.GetChangedModifiers(context, addedModifiers, removedModifiers);

            double result = 0.0;
            if (addedModifiers.Count > 0 || removedModifiers.Count > 0)
            {
                foreach (var added in addedModifiers)
                {
                    result += added.DailyChange;
                }
                foreach (var removed in removedModifiers)
                {
                    result -= removed.DailyChange;
                }

            }
            context.PopScope();
            return result * 100.0 * 10.0;
        }
开发者ID:jenn0108,项目名称:CourtIntrigue,代码行数:23,代码来源:Execute.cs

示例5: FilterCharacters

 public Character[] FilterCharacters(ILogic requirements, EventContext context)
 {
     List<Character> matchingCharacters = new List<Character>();
     foreach (Character character in this.AllCharacters)
     {
         context.PushScope(character);
         if (requirements.Evaluate(context, this))
         {
             matchingCharacters.Add(character);
         }
         context.PopScope();
     }
     return matchingCharacters.ToArray();
 }
开发者ID:jenn0108,项目名称:CourtIntrigue,代码行数:14,代码来源:Game.cs


注:本文中的EventContext.PushScope方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。