예제 #1
0
        private EntityRulesViewModel(string name, IEnumerable <EffectViewModelBase> preBattleEffects, IEnumerable <EffectViewModelBase> postBattleEffects, IEnumerable <EffectViewModelBase> preTurnEffects, IEnumerable <EffectViewModelBase> postTurnEffects, ConditionViewModelBase eliminationCondition, IEnumerable <ActionViewModel> actions, IEnumerable <ResultViewModel> results, ActionMatrixViewModel actionMatrix, StringLookupViewModel stringLookup)
        {
            m_name = name;
            m_eliminationCondition = eliminationCondition;

            m_selectedRule = new TreeNodeViewModel <LabeledViewModelBase>("", Enumerable.Empty <LabeledViewModelBase>());

            m_preBattleEffectsNode  = new TreeNodeViewModel <EffectViewModelBase>(OurResources.PreBattleEffectsNodeLabel, preBattleEffects);
            m_postBattleEffectsNode = new TreeNodeViewModel <EffectViewModelBase>(OurResources.PostBattleEffectsNodeLabel, postBattleEffects);
            m_preTurnEffectsNode    = new TreeNodeViewModel <EffectViewModelBase>(OurResources.PreTurnEffectsNodeLabel, preTurnEffects);
            m_postTurnEffectsNode   = new TreeNodeViewModel <EffectViewModelBase>(OurResources.PostTurnEffectsNodeLabel, postTurnEffects);
            m_actionsNode           = new TreeNodeViewModel <ActionViewModel>(OurResources.ActionsNodeLabel, actions);
            m_resultsNode           = new TreeNodeViewModel <ResultViewModel>(OurResources.ResultsNodeLabel, results);

            Rules = new List <TreeNodeViewModelBase>
            {
                m_preBattleEffectsNode,
                m_preTurnEffectsNode,
                m_postTurnEffectsNode,
                m_postBattleEffectsNode,
                m_actionsNode,
                m_resultsNode,
            };

            ActionMatrix = actionMatrix;
            StringLookup = stringLookup;
        }
예제 #2
0
        private new static EffectViewModelBase CreateFromData(EffectBase effect)
        {
            if (!(effect is RemoveTagsEffect removeTagsEffect))
            {
                return(null);
            }

            var condition = ConditionViewModelBase.CreateFromData(removeTagsEffect.Condition);

            return(new RemoveTagsEffectViewModel(removeTagsEffect.TagKey, removeTagsEffect.TagKeyMatchKind, condition, removeTagsEffect.Target));
        }
예제 #3
0
        public static GameRulesViewModel CreateFromData(GameRules rules)
        {
            var preBattleEffects     = rules.PreBattleEffects.Select(EffectViewModelBase.CreateFromData);
            var postBattleEffects    = rules.PostBattleEffects.Select(EffectViewModelBase.CreateFromData);
            var postTurnEffects      = rules.PostTurnEffects.Select(EffectViewModelBase.CreateFromData);
            var preResultEffects     = rules.PreResultEffects.Select(EffectViewModelBase.CreateFromData);
            var postResultEffects    = rules.PostResultEffects.Select(EffectViewModelBase.CreateFromData);
            var eliminationCondition = ConditionViewModelBase.CreateFromData(rules.EliminationCondition);

            return(new GameRulesViewModel(preBattleEffects, postBattleEffects, postTurnEffects, preResultEffects, postResultEffects, eliminationCondition));
        }
예제 #4
0
        private new static EffectViewModelBase CreateFromData(EffectBase effect)
        {
            if (!(effect is CopyTagsEffect copyTagsEffect))
            {
                return(null);
            }

            var condition = ConditionViewModelBase.CreateFromData(copyTagsEffect.Condition);

            return(new CopyTagsEffectViewModel(copyTagsEffect.TagKey, copyTagsEffect.TagKeyMatchKind, copyTagsEffect.TagScope, copyTagsEffect.NewTagKey, copyTagsEffect.ConflictResolution, condition, copyTagsEffect.Target));
        }
예제 #5
0
        private new static TagViewModelBase CreateFromData(TagBase tag)
        {
            if (!(tag is ConditionTag conditionTag))
            {
                return(null);
            }

            var condition = ConditionViewModelBase.CreateFromData(conditionTag.Condition);

            return(new ConditionTagViewModel(condition, conditionTag.Key, conditionTag.Duration));
        }
        private new static EffectViewModelBase CreateFromData(EffectBase effect)
        {
            if (!(effect is AddTagEffect addTagEffect))
            {
                return(null);
            }

            var tag       = TagViewModelBase.CreateFromData(addTagEffect.Tag);
            var condition = ConditionViewModelBase.CreateFromData(addTagEffect.Condition);

            return(new AddTagEffectViewModel(tag, addTagEffect.ConflictResolution, condition, addTagEffect.Target));
        }
예제 #7
0
        private new static TagViewModelBase CreateFromData(TagBase tag)
        {
            if (!(tag is ConditionalTagsTag conditionalTagsTag))
            {
                return(null);
            }

            var tags      = conditionalTagsTag.Tags.Select(TagViewModelBase.CreateFromData);
            var condition = ConditionViewModelBase.CreateFromData(conditionalTagsTag.Condition);

            return(new ConditionalTagsTagViewModel(tags, condition, conditionalTagsTag.Key, conditionalTagsTag.Duration));
        }
예제 #8
0
        public static EntityRulesViewModel CreateFromData(EntityRules entity)
        {
            var stringLookup         = StringLookupViewModel.CreateFromData(entity.StringLookup);
            var preBattleEffects     = entity.PreBattleEffects.Select(EffectViewModelBase.CreateFromData);
            var postBattleEffects    = entity.PostBattleEffects.Select(EffectViewModelBase.CreateFromData);
            var preTurnEffects       = entity.PreTurnEffects.Select(EffectViewModelBase.CreateFromData);
            var postTurnEffects      = entity.PostTurnEffects.Select(EffectViewModelBase.CreateFromData);
            var eliminationCondition = ConditionViewModelBase.CreateFromData(entity.EliminationCondition);
            var actions      = entity.Actions.Select(x => ActionViewModel.CreateFromData(x, stringLookup));
            var results      = entity.Results.Select(x => ResultViewModel.CreateFromData(x, stringLookup));
            var actionMatrix = ActionMatrixViewModel.CreateFromData(entity.ActionMatrix.Values);

            return(new EntityRulesViewModel(entity.Name, preBattleEffects, postBattleEffects, preTurnEffects, postTurnEffects, eliminationCondition, actions, results, actionMatrix, stringLookup));
        }
예제 #9
0
        private GameRulesViewModel(IEnumerable <EffectViewModelBase> preBattleEffects, IEnumerable <EffectViewModelBase> postBattleEffects, IEnumerable <EffectViewModelBase> postTurnEffects, IEnumerable <EffectViewModelBase> preResultEffects, IEnumerable <EffectViewModelBase> postResultEffects, ConditionViewModelBase eliminationCondition)
        {
            m_eliminationCondition = eliminationCondition;
            m_selectedEffect       = new TreeNodeViewModel <EffectViewModelBase>("", Enumerable.Empty <EffectViewModelBase>());

            m_preBattleEffectsNode  = new TreeNodeViewModel <EffectViewModelBase>(OurResources.PreBattleEffectsNodeLabel, preBattleEffects);
            m_preResultEffectsNode  = new TreeNodeViewModel <EffectViewModelBase>(OurResources.PreResultEffectsNodeLabel, preResultEffects);
            m_postResultEffectsNode = new TreeNodeViewModel <EffectViewModelBase>(OurResources.PostResultEffectsNodelLabel, postResultEffects);
            m_postTurnEffectsNode   = new TreeNodeViewModel <EffectViewModelBase>(OurResources.PostTurnEffectsNodeLabel, postTurnEffects);
            m_postBattleEffectsNode = new TreeNodeViewModel <EffectViewModelBase>(OurResources.PostBattleEffectsNodeLabel, postBattleEffects);
            Effects = new List <TreeNodeViewModelBase>
            {
                m_preBattleEffectsNode,
                m_preResultEffectsNode,
                m_postResultEffectsNode,
                m_postTurnEffectsNode,
                m_postBattleEffectsNode,
            };
        }
예제 #10
0
        private new static ConditionViewModelBase CreateFromData(ConditionBase condition)
        {
            if (!(condition is UnaryLogicCondition logicCondition))
            {
                return(null);
            }

            UnaryLogicKind?kind = null;

            if (condition is NotCondition)
            {
                kind = UnaryLogicKind.Not;
            }
            if (kind == null)
            {
                return(null);
            }

            var child = ConditionViewModelBase.CreateFromData(logicCondition.Child);

            return(new UnaryLogicConditionViewModel(child, kind.Value));
        }
예제 #11
0
 private RemoveTagsEffectViewModel(string tagKey, MatchKind tagKeyMatchKind, ConditionViewModelBase condition, EffectTarget target)
     : base(condition, target)
 {
     m_tagKey          = tagKey;
     m_tagKeyMatchKind = tagKeyMatchKind;
 }
예제 #12
0
 private UnaryLogicConditionViewModel(ConditionViewModelBase child, UnaryLogicKind logicKind)
 {
     m_child     = child;
     m_logicKind = logicKind;
 }
예제 #13
0
 private ConditionalTagsTagViewModel(IEnumerable <TagViewModelBase> tags, ConditionViewModelBase condition, string key, int?duration)
     : base(condition, key, duration)
 {
     Tags = new ObservableCollection <TagViewModelBase>(tags);
 }
예제 #14
0
 protected EffectViewModelBase(ConditionViewModelBase condition, EffectTarget target)
 {
     m_condition = condition;
     m_target    = target;
 }
예제 #15
0
 private ConditionTagViewModel(ConditionViewModelBase condition, string key, int?duration)
     : base(condition, key, duration)
 {
 }
 private AddTagEffectViewModel(TagViewModelBase tag, KeyConflictResolutionKind conflictResolution, ConditionViewModelBase condition, EffectTarget target)
     : base(condition, target)
 {
     m_tag = tag;
     m_conflictResolution = conflictResolution;
 }
예제 #17
0
 private CopyTagsEffectViewModel(string tagKey, MatchKind tagKeyMatchKind, TagScope tagScope, string newTagKey, KeyConflictResolutionKind conflictResolution, ConditionViewModelBase condition, EffectTarget target)
     : base(condition, target)
 {
     m_tagKey             = tagKey;
     m_tagKeyMatchKind    = tagKeyMatchKind;
     m_tagScope           = tagScope;
     m_newTagKey          = newTagKey;
     m_conflictResolution = conflictResolution;
 }