Esempio n. 1
0
 public LampController(GameController game)
 {
     this.game = game;
     this.show = new LampShowMode(game);
     this.saved_state_dicts = new Dictionary<string, SavedLampState>();
     this.shows = new Dictionary<string, string>();
 }
Esempio n. 2
0
        public Trough(GameController game, string[] position_switchnames, string eject_switchname, string eject_coilname,
            string[] early_save_switchnames, string shooter_lane_switchname, Delegate drain_callback = null)
            : base(game, 90)
        {
            this.position_switchnames = position_switchnames;
            this.eject_switchname = eject_switchname;
            this.eject_coilname = eject_coilname;
            this.early_save_switchnames = early_save_switchnames;
            this.shooter_lane_switchname = shooter_lane_switchname;
            this.drain_callback = drain_callback;

            // Install switch handlers
            foreach (string sw in position_switchnames)
            {
                add_switch_handler(sw, "active", 0, new SwitchAcceptedHandler(position_switch_handler));
                add_switch_handler(sw, "inactive", 0, new SwitchAcceptedHandler(position_switch_handler));
            }

            // Install early save switch handlers
            foreach (string sw in early_save_switchnames)
            {
                add_switch_handler(sw, "active", 0, new SwitchAcceptedHandler(early_save_switch_handler));
            }

            // Reset all variables
            num_balls_in_play = 0;
            num_balls_locked = 0;
            num_balls_to_launch = 0;
            num_balls_to_stealth_launch = 0;
            launch_in_progress = false;
            ball_save_active = false;
            ball_save_callback = null;
            num_balls_to_save = null;
            launch_callback = null;
        }
Esempio n. 3
0
        public BallSearch(GameController game, int countdown_time,
            string[] coils = null, Dictionary<string, string> reset_switches = null, Dictionary<string, string> stop_switches = null,
            string[] enable_switch_names = null, Mode[] special_handler_modes = null)
            : base(game, 8)
        {
            if (stop_switches == null) this.stop_switches = new Dictionary<string, string>();
            else this.stop_switches = stop_switches;
            if (coils == null) this.coils = new string[] { };
            else this.coils = coils;
            if (reset_switches == null) this.reset_switches = new Dictionary<string, string>();
            else this.reset_switches = reset_switches;
            if (enable_switch_names == null) this.enable_switch_names = new string[] { };
            else this.enable_switch_names = enable_switch_names;
            if (special_handler_modes == null) this.special_handler_modes = new Mode[] { };
            else this.special_handler_modes = special_handler_modes;

            this.enabled = false;

            foreach (string sw in reset_switches.Keys)
            {
                this.add_switch_handler(sw, reset_switches[sw], 0, new SwitchAcceptedHandler(this.reset));
            }
            foreach (string sw in stop_switches.Keys)
            {
                this.add_switch_handler(sw, stop_switches[sw], 0, new SwitchAcceptedHandler(this.stop));
            }
        }
Esempio n. 4
0
        public TestMode(GameController game, Dictionary<string, Driver> drivers)
            : base(game, 90)
        {
            if (drivers != null)
                _trap_switch_coils = drivers;
            else
                _trap_switch_coils = new Dictionary<string, Driver>();

            /*
            this.add_switch_handler("trough1", "closed", 3,
                new SwitchAcceptedHandler(delegate(Switch s) {
                    game.Coils["trough"].Pulse();
                    return SWITCH_CONTINUE;
                }));
             */
        }
Esempio n. 5
0
        public VirtualDriver(GameController game, string name, ushort number, bool polarity)
            : base(game, name, number)
        {
            this._state = new DriverState();
            this._state.Polarity = polarity;
            this._state.Timeslots = 0x0;
            this._state.PatterEnable = false;
            this._state.DriverNum = number;
            this._state.PatterOnTime = 0;
            this._state.PatterOffTime = 0;
            this._state.State = false;
            this._state.OutputDriveTime = 0;
            this._state.WaitForFirstTimeSlot = false;

            this._currentValue = !(_currentState ^ this._state.Polarity);
        }
Esempio n. 6
0
        public DisplayController(GameController game, int width = 128, int height = 32, Font message_font = null)
        {
            this.game = game;
            this.width = width;
            this.height = height;
            if (message_font != null)
                this.message_layer = new TextLayer(1, 1, message_font, FontJustify.Center);

            // Do two updates to get the "pump primed" ? -- Yeah.
            for (int i = 0; i < 2; i++)
                this.update();

            this.frame_handlers = new List<DMDFrameHandler>();

            this.frame_handlers.Add(new DMDFrameHandler(game.PROC.dmd_draw));
        }
Esempio n. 7
0
        public BallSave(GameController game, string lamp, string delayed_start_switch = "")
            : base(game, 3)
        {
            this.lamp = lamp;
            this.num_balls_to_save = 1;
            this.mode_begin = 0;
            this.allow_multiple_saves = false;
            this.timer = 0;

            if (delayed_start_switch != "")
                add_switch_handler(delayed_start_switch, "inactive", 1.0, this.delayed_start_handler);

            // Optional method to be called when a ball is saved. Should be defined externally
            callback = null;

            // Optional method to be called to tell a trough to save balls. Should be linked externally to an enable method for a trough
            trough_enable_ball_save = null;
        }
Esempio n. 8
0
        public ScoreDisplay(GameController game, int priority, FontJustify left_players_justify = FontJustify.Right)
            : base(game, priority)
        {
            this.layer = new ScoreLayer(128, 32, this);
            this.font_common = FontManager.instance.font_named("Font07x5.dmd");
            this.font_18x12 = FontManager.instance.font_named("Font18x12.dmd");
            this.font_18x11 = FontManager.instance.font_named("Font18x11.dmd");
            this.font_18x10 = FontManager.instance.font_named("Font18x10.dmd");
            this.font_14x10 = FontManager.instance.font_named("Font14x10.dmd");
            this.font_14x9 = FontManager.instance.font_named("Font14x9.dmd");
            this.font_14x8 = FontManager.instance.font_named("Font14x8.dmd");
            this.font_09x5 = FontManager.instance.font_named("Font09x5.dmd");
            this.font_09x6 = FontManager.instance.font_named("Font09x6.dmd");
            this.font_09x7 = FontManager.instance.font_named("Font09x7.dmd");

            this.score_posns = new Dictionary<bool, List<Pair<int, int>>>();

            this.set_left_players_justify(left_players_justify);
        }
Esempio n. 9
0
 public LampShowMode(GameController game)
     : base(game, 3)
 {
     this.lampshow = new LampShow(game);
     this.show_over = true;
 }
Esempio n. 10
0
 public Driver(GameController game, string name, ushort number)
     : base(game, name, number)
 {
 }
Esempio n. 11
0
 public BaseGameMode(GameController game)
     : base(game, 2)
 {
     ball_starting = true;
 }
Esempio n. 12
0
 public GameItem(GameController game, string name, ushort number)
 {
     this._game = game;
     this._name = name;
     this._number = number;
 }
Esempio n. 13
0
 /// <summary>
 /// Creates a new Switch object
 /// </summary>
 /// <param name="game">The GameController this switch belongs to</param>
 /// <param name="name">The pretty name of this switch</param>
 /// <param name="number">The encoded number of this switch</param>
 /// <param name="sType">Switch type NO = Normally Open (leaf switches), NC = Normally Closed (optos)</param>
 public Switch(GameController game, string name, ushort number, SwitchType sType = SwitchType.NO)
     : base(game, name, number)
 {
     this._type = sType;
 }
Esempio n. 14
0
 public LampShow(GameController game)
 {
     this.game = game;
     this.reset();
 }
Esempio n. 15
0
 public ModeQueue(GameController game)
 {
     _game = game;
     _modes = new List<Mode>();
 }
Esempio n. 16
0
 public Claw(GameController game)
     : base(game, 2)
 {
 }
Esempio n. 17
0
 public void resolve_driver_with_game(GameController game)
 {
     if (name.StartsWith("coil:"))
         this.driver = game.Coils[name.Substring(5)];
     else if (name.StartsWith("lamp:"))
         this.driver = game.Lamps[name.Substring(5)];
     else
         this.driver = game.Lamps[name];
 }