public EventHandlerData(Delegate delegateInfo)
 {
     eType     = null;
     priority  = 50;
     eSpace    = EventSpace.Everything;
     actionDel = delegateInfo;
 }
 public EventHandlerData(EventHandlerAttribute attri, Delegate delegateInfo)
 {
     eType     = attri.eType;
     priority  = attri.priority;
     eSpace    = attri.eSpace;
     actionDel = delegateInfo;
 }
        public void ActionTest_ReturnsNoActionWhenNull()
        {
            EventSpace loseMoneyEventSpace = new EventSpace("NOLUCK", "Bad luck space", onStopAction: null, onWalkAction: null);

            Assert.AreEqual(EventSpace.NoAction, loseMoneyEventSpace.OnWalkAction);
            Assert.AreEqual(EventSpace.NoAction, loseMoneyEventSpace.OnStopAction);
        }
 public ContextEntryData(ContextEntryAttribute attri, GenericMenu.MenuFunction2 menufuncInfo)
 {
     eSpace      = attri.eSpace;
     on          = attri.on;
     contextPath = attri.contextPath;
     menufunc2   = menufuncInfo;
 }
 public HotKeyHandlerData(HotkeyAttribute attri, Delegate delegateInfo)
 {
     hotKey     = attri.hotKey;
     eModifiers = attri.eModifiers;
     eType      = attri.eType;
     priority   = attri.priority;
     eSpace     = attri.eSpace;
     actionDel  = delegateInfo;
 }
Exemple #6
0
        public void StopOnEventTest()
        {
            Action <IPlayer> pay100 = delegate(IPlayer player) { player.Pay(100); };
            EventSpace       loseMoneyEventSpace = new EventSpace("NOLUCK", "Bad luck space", onStopAction: pay100);
            Player           player1             = new Player(0, "player", 200);

            player1.StopOnEvent(loseMoneyEventSpace);
            Assert.AreEqual(200 - 100, player1.Money);
        }
        public void AcceptWalkingTest()
        {
            Action <IPlayer> pay100 = delegate(IPlayer player) { player.Pay(100); };
            EventSpace       loseMoneyEventSpace = new EventSpace("NOLUCK", "Bad luck space", onStopAction: null, onWalkAction: pay100);
            Player           player1             = new Player(0, "player", 200);

            loseMoneyEventSpace.AcceptWalking(player1);
            Assert.AreEqual(200 - 100, player1.Money);
        }
        public void EventSpaceTest_PartialConstructor()
        {
            Action <IPlayer> pay200 = delegate(IPlayer player) { player.Pay(200); };
            EventSpace       loseMoneyEventSpace = new EventSpace("NOLUCK", "Bad luck space", onStopAction: pay200);

            Assert.AreEqual("NOLUCK", loseMoneyEventSpace.Id);
            Assert.AreEqual("Bad luck space", loseMoneyEventSpace.Name);
            Assert.AreEqual(pay200, loseMoneyEventSpace.OnStopAction);
            Assert.AreEqual(EventSpace.NoAction, loseMoneyEventSpace.OnWalkAction);
        }
Exemple #9
0
        public EditorStates(EditorStates editorStates)
        {
            info     = editorStates.info;
            mousePos = editorStates.mousePos;
            curEvent = editorStates.curEvent;
            curSpace = editorStates.curSpace;

            states   = editorStates.states;
            curState = editorStates.curState;
            capacity = editorStates.capacity;
            curIndex = editorStates.curIndex;
        }
Exemple #10
0
        public EditorStates(string message, EditorStates editorStates)
        {
            info     = message;
            mousePos = editorStates.mousePos;
            curEvent = editorStates.curEvent;
            curSpace = editorStates.curSpace;

            states   = editorStates.states;
            curState = editorStates.curState;
            capacity = editorStates.capacity;
            curIndex = editorStates.curIndex;
        }
Exemple #11
0
        /// <summary>
        /// Creates a stub board board with 40 spaces : a Go Space giving 200 $ to any player walking on it, and 39 other spaces that are empty and do nothing.
        /// </summary>
        /// <returns></returns>
        private static StubIBoard CreateStubBoardWithOnlyGoSpaceGiving200OnWalk()
        {
            IVisitableSpace goSpace    = new EventSpace("GO_SPACE", "Go", onStopAction: null, onWalkAction: (player) => player.Earn(200));
            IVisitableSpace blankSpace = new EventSpace("BLANK", "Blank", null);

            var stubBoard = new Fakes.StubIBoard()
            {
                ItemGetInt32 = (key) =>//Any space besides 0 is a blank useless space.
                {
                    if (key >= 40 || key < 0)
                    {
                        throw new ArgumentOutOfRangeException();
                    }
                    if (key == 0)
                    {
                        return(goSpace);
                    }
                    else
                    {
                        return(blankSpace);
                    }
                },
                GoSpaceGet = () => goSpace,
                CountGet   = () => 40,//The Count will always return 40
                IndexOfSpaceIVisitableSpace = (space) =>
                {
                    if (space == goSpace)
                    {
                        return(0);
                    }
                    else
                    {
                        return(1);
                    };
                }
            };

            return(stubBoard);
        }
 public ContextFillerAttribute()
 {
     eSpace = EventSpace.Everything;
 }
 public ContextEntryAttribute(EventSpace newSpace, bool switchable, string newPath)
 {
     eSpace      = newSpace;
     on          = switchable;
     contextPath = newPath;
 }
 public ContextEntryAttribute(EventSpace newSpace, string newPath)
 {
     eSpace      = newSpace;
     on          = false;
     contextPath = newPath;
 }
 public ContextEntryAttribute(string newPath, bool switchable)
 {
     eSpace      = EventSpace.Everything;
     on          = switchable;
     contextPath = newPath;
 }
 public ContextEntryAttribute(EventSpace newSpace, bool switchable)
 {
     eSpace      = newSpace;
     on          = switchable;
     contextPath = "";
 }
 public ContextEntryAttribute(string newPath)
 {
     eSpace      = EventSpace.Everything;
     on          = false;
     contextPath = newPath;
 }
 public EventHandlerAttribute()
 {
     eType    = null;
     priority = 50;
     eSpace   = EventSpace.Everything;
 }
 public ContextEntryAttribute(EventSpace newSpace)
 {
     eSpace      = newSpace;
     on          = false;
     contextPath = "";
 }
 public ContextEntryAttribute()
 {
     eSpace      = EventSpace.Everything;
     on          = false;
     contextPath = "";
 }
 public EventHandlerAttribute(EventType newType, int newPriority, EventSpace newSpace)
 {
     eType    = newType;
     eSpace   = newSpace;
     priority = newPriority;
 }
 public EventHandlerAttribute(EventType newType)
 {
     eType    = newType;
     priority = 50;
     eSpace   = EventSpace.Everything;
 }
 public EventHandlerAttribute(int newPriority)
 {
     eType    = null;
     priority = newPriority;
     eSpace   = EventSpace.Everything;
 }
 public ContextFillerAttribute(EventSpace newSpace)
 {
     eSpace = newSpace;
 }
 public ContextEntryAttribute(bool switchable)
 {
     eSpace      = EventSpace.Everything;
     on          = switchable;
     contextPath = "";
 }
 public EventHandlerAttribute(EventType newType, EventSpace newSpace)
 {
     eType    = newType;
     priority = 50;
     eSpace   = newSpace;
 }
 public ContextFillerData(ContextFillerAttribute attri, Delegate delegateInfo)
 {
     eSpace    = attri.eSpace;
     actionDel = delegateInfo;
 }
Exemple #28
0
 public void UpdateEvents()
 {
     curEvent = Event.current;
     mousePos = curEvent.mousePosition;
     curSpace = EventSpace.None;
 }
 public EventHandlerAttribute(EventType newType, int newPriority)
 {
     eType    = newType;
     priority = newPriority;
     eSpace   = EventSpace.Everything;
 }