Ejemplo n.º 1
0
        public Palette(int x, int y)
        {
            // Start out hidden.
            IsHidden = true;
            Position = new Point(x, y);

            ObjectFactory = new EntityFactory();

            // Instantiate new start states.
            _states.Add("Shape", new ShapePaletteState(this));
            _states.Add("Num", new NumPaletteState(this));
            _states.Add("Alph", new AlphPaletteState(this));

            // The states they go to.
            _states.Add("Size", new SizePaletteState(this));
            _states.Add("Color", new ColorPaletteState(this));
            _states.Add("Position", new PositionPaletteState(this));

            // Setup the initial, and next states.
            _states.Add("INITIAL", _states[InitialStateName]);
            // First is always Shape
            CurrentState = _states["INITIAL"];
            // Set the current state to the initial state.
            CurrentStateName = InitialStateName;

            // Make sure that it's unhidden!
            Show();
        }
Ejemplo n.º 2
0
        public void Reset()
        {
            // Create a new EntityFactory and let the GC deal with the old one.
            ObjectFactory = new EntityFactory();

            RequestStateChange("INITIAL");
            Hide();
        }