示例#1
0
 public Layer(string name, ILayerHandler handler = null) : this()
 {
     Name = name;
     if (handler != null)
     {
         _Handler = handler;
     }
 }
 public GenericModifier(ILayerHandler layerMan, IGraphicsHandler graphicsMan)
 {
     // Initialize the default modifier mapping
     _modifierActionMap = new Dictionary<ModifierType, ILayerModifier>
     {
         {ModifierType.BringToFront, new BringToFrontModifier(layerMan, graphicsMan)},
         {ModifierType.SendToBack, new SendToBackModifier(layerMan, graphicsMan)},
         {ModifierType.SendBackward, new SendBackwardModifier(layerMan, graphicsMan)}
     };
 }
 public SendToBackModifier(ILayerHandler manager, IGraphicsHandler graphics)
     : base(manager, graphics)
 {
 }
 protected LayerModifierBase(ILayerHandler manager, IGraphicsHandler updater)
 {
     HandlerLayers = manager;
     HandlerGraphics = updater;
 }
示例#5
0
        public void Check(IGameState gs, ILayerHandler handler)
        {
            if (Action == null || ReferenceComparisons == null)
            {
                return;
            }

            foreach (Tuple <string, Tuple <LogicOperator, object> > kvp in ReferenceComparisons)
            {
                dynamic var = GameStateUtils.RetrieveGameStateParameter(gs, kvp.Item1);

                if (var == null)
                {
                    return;
                }

                Console.WriteLine("Got him");

                dynamic comparison = kvp.Item2.Item2;
                bool    valid      = false;

                switch (kvp.Item2.Item1)
                {
                case LogicOperator.GreaterThan:
                    valid = Operator.GreaterThan(var, comparison);
                    break;

                case LogicOperator.GreaterThanOrEqual:
                    valid = Operator.GreaterThanOrEqual(var, comparison);
                    break;

                case LogicOperator.LessThan:
                    valid = Operator.LessThan(var, comparison);
                    break;

                case LogicOperator.LessThanOrEqual:
                    valid = Operator.LessThanOrEqual(var, comparison);
                    break;

                case LogicOperator.Equal:
                    valid = Operator.Equal(var, comparison);
                    break;

                case LogicOperator.NotEqual:
                    valid = Operator.NotEqual(var, comparison);
                    break;

                default:
                    break;
                }

                if (!valid)
                {
                    return;
                }
            }

            switch (Action.Item1)
            {
            case ActionType.SetProperty:
                Tuple <string, object> vars = (Tuple <string, object>)Action.Item2;
                string str = vars.Item1;
                if (!str.StartsWith("_"))
                {
                    str = "_" + str;
                }
                object var = vars.Item2;
                if (var is RealColor)
                {
                    var = ((RealColor)var).Color;
                }
                ((ILogic)handler.Properties).Logic.SetValueFromString(str, var);
                //handler.Properties._PrimaryColor = (Color)Action.Item2;
                break;

            default:
                break;
            }
        }
示例#6
0
 public Layer(string name, ILayerHandler handler, OverrideLogicBuilder builder) : this(name, handler, builder.Create())
 {
 }
示例#7
0
 public Layer(string name, ILayerHandler handler, Dictionary <string, IOverrideLogic> overrideLogic) : this(name, handler)
 {
     _OverrideLogic = overrideLogic;
 }
示例#8
0
 public Layer(string name, ILayerHandler handler = null) : this()
 {
     Name    = name;
     Handler = handler ?? Handler;
 }
示例#9
0
 private void Add(ILayerHandler handler)
 {
     handlers.Add(handler);
 }
 public BringToFrontModifier(ILayerHandler manager, IGraphicsHandler graphics)
     : base(manager, graphics)
 {
 }