/// <summary> /// Registers the events this TimerController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { gameMode.TimerTick += (sender, args) => { (sender as Timer)?.OnTick(args); }; }
/// <summary> /// Registers the events this PlayerObjectController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { gameMode.PlayerObjectMoved += (sender, args) => { (sender as PlayerObject)?.OnMoved(args); }; gameMode.PlayerEditPlayerObject += (sender, args) => { (sender as PlayerObject)?.OnEdited(args); }; gameMode.PlayerSelectPlayerObject += (sender, args) => { (sender as PlayerObject)?.OnSelected(args); }; gameMode.PlayerCleanup += (sender, args) => { var player = sender as BasePlayer; if (player == null) return; foreach (var obj in PlayerObject.Of(player)) obj.Dispose(); }; }
/// <summary> /// Registers the events this DelayController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { gameMode.TimerTick += (sender, args) => { (sender as Delay)?.Action?.Invoke(); }; }
/// <summary> /// Registers the events this TextDrawController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { gameMode.PlayerPickUpPickup += (sender, args) => { (sender as Pickup)?.OnPickUp(args); }; }
/// <summary> /// Registers the events this TextDrawController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { gameMode.PlayerClickTextDraw += (sender, args) => { args.TextDraw?.OnClick(args); }; }
/// <summary> /// Registers the events this PlayerObjectController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { gameMode.PlayerObjectMoved += (sender, args) => { var obj = sender as PlayerObject; if (obj != null) obj.OnMoved(args); }; gameMode.PlayerEditPlayerObject += (sender, args) => { var obj = sender as PlayerObject; if (obj != null) obj.OnEdited(args); }; gameMode.PlayerSelectPlayerObject += (sender, args) => { var obj = sender as PlayerObject; if (obj != null) obj.OnSelected(args); }; gameMode.PlayerCleanup += (sender, args) => { var player = sender as GtaPlayer; foreach (var obj in PlayerObject.All.Where(o => o.Owner == player)) obj.Dispose(); }; }
/// <summary> /// Registers the events this GlobalObjectController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { gameMode.ObjectMoved += (sender, args) => { var obj = sender as GlobalObject; if (obj != null) obj.OnMoved(args); }; gameMode.PlayerEditGlobalObject += (sender, args) => { GlobalObject obj = args.Object; if (obj != null) obj.OnEdited(args); }; gameMode.PlayerSelectGlobalObject += (sender, args) => { GlobalObject obj = args.Object; if (obj != null) obj.OnSelected(args); }; }
/// <summary> /// Registers the services this controller provides. /// </summary> /// <param name="gameMode">The game mode.</param> /// <param name="serviceContainer">The service container.</param> public virtual void RegisterServices(BaseMode gameMode, GameModeServiceContainer serviceContainer) { CommandsManager = new CommandsManager(gameMode); serviceContainer.AddService(CommandsManager); // Register commands in game mode. CommandsManager.RegisterCommands(gameMode.GetType()); }
/// <summary> /// Registers the events this VehicleController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { //Register all vehicle events gameMode.VehicleSpawned += (sender, args) => { (sender as BaseVehicle)?.OnSpawn(args); }; gameMode.VehicleDied += (sender, args) => { (sender as BaseVehicle)?.OnDeath(args); }; gameMode.PlayerEnterVehicle += (sender, args) => { args.Vehicle?.OnPlayerEnter(args); }; gameMode.PlayerExitVehicle += (sender, args) => { args.Vehicle?.OnPlayerExit(args); }; gameMode.VehicleMod += (sender, args) => { (sender as BaseVehicle)?.OnMod(args); }; gameMode.VehiclePaintjobApplied += (sender, args) => { (sender as BaseVehicle)?.OnPaintjobApplied(args); }; gameMode.VehicleResprayed += (sender, args) => { (sender as BaseVehicle)?.OnResprayed(args); }; gameMode.VehicleDamageStatusUpdated += (sender, args) => { (sender as BaseVehicle)?.OnDamageStatusUpdated(args); }; gameMode.UnoccupiedVehicleUpdated += (sender, args) => { (sender as BaseVehicle)?.OnUnoccupiedUpdate(args); }; gameMode.VehicleStreamIn += (sender, args) => { (sender as BaseVehicle)?.OnStreamIn(args); }; gameMode.VehicleStreamOut += (sender, args) => { (sender as BaseVehicle)?.OnStreamOut(args); }; gameMode.TrailerUpdate += (sender, args) => { (sender as BaseVehicle)?.OnTrailerUpdate(args); }; gameMode.VehicleSirenStateChange += (sender, args) => { (sender as BaseVehicle)?.OnSirenStateChanged(args); }; }
/// <summary> /// Registers the events this DelayController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public void RegisterEvents(BaseMode gameMode) { gameMode.TimerTick += (sender, args) => { var delay = sender as Delay; if (delay != null && delay.Action != null) delay.Action(); }; }
/// <summary> /// Registers the events this TimerController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { gameMode.TimerTick += (sender, args) => { var timer = sender as Timer; if (timer != null) timer.OnTick(args); }; }
/// <summary> /// Registers the events this TextDrawController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public void RegisterEvents(BaseMode gameMode) { gameMode.PlayerClickTextDraw += (sender, args) => { TextDraw textdraw = args.TextDraw; if (textdraw != null) textdraw.OnClick(args); }; }
/// <summary> /// Registers the events this TextDrawController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public void RegisterEvents(BaseMode gameMode) { gameMode.PlayerPickUpPickup += (sender, args) => { var obj = sender as Pickup; if (obj != null) obj.OnPickUp(args); }; }
/// <summary> /// Registers the events this PlayerTextDrawController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { gameMode.PlayerClickPlayerTextDraw += (sender, args) => { args.PlayerTextDraw?.OnClick(args); }; gameMode.PlayerCleanup += (sender, args) => { var player = sender as BasePlayer; foreach (var textdraw in PlayerTextDraw.Of(player)) textdraw.Dispose(); }; }
/// <summary> /// Registers the events this <see cref="IEventListener" /> wants to listen to. /// </summary> /// <param name="gameMode">An instance of the <see cref="BaseMode" /> currently running.</param> public virtual void RegisterEvents(BaseMode gameMode) { gameMode.PlayerGiveDamageActor += (sender, args) => { (sender as Actor)?.OnPlayerGiveDamage(args); }; gameMode.ActorStreamIn += (sender, args) => { (sender as Actor)?.OnStreamIn(args); }; gameMode.ActorStreamOut += (sender, args) => { (sender as Actor)?.OnStreamOut(args); }; }
/// <summary> /// Registers the events this GlobalObjectController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { gameMode.ObjectMoved += (sender, args) => { (sender as GlobalObject)?.OnMoved(args); }; gameMode.PlayerEditGlobalObject += (sender, args) => { (sender as GlobalObject)?.OnEdited(args); }; gameMode.PlayerSelectGlobalObject += (sender, args) => { (sender as GlobalObject)?.OnSelected(args); }; }
/// <summary> /// Registers the events this PlayerTextDrawController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public void RegisterEvents(BaseMode gameMode) { gameMode.PlayerClickPlayerTextDraw += (sender, args) => { PlayerTextDraw textdraw = args.PlayerTextDraw; if (textdraw != null) textdraw.OnClick(args); }; gameMode.PlayerCleanup += (sender, args) => { var player = sender as GtaPlayer; foreach (var textdraw in PlayerTextDraw.All.Where(o => o.Owner == player)) textdraw.Dispose(); }; }
/// <summary> /// Registers the events this DialogController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { gameMode.DialogResponse += (sender, args) => { var player = sender as GtaPlayer; Dialog dialog = Dialog.GetOpenDialog(player); if (dialog != null) dialog.OnResponse(args); }; gameMode.PlayerDisconnected += (sender, args) => { var player = sender as GtaPlayer; Dialog.Hide(player); }; }
/// <summary> /// Registers the events this SyncController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public void RegisterEvents(BaseMode gameMode) { _gameMode = gameMode; MainThread = Thread.CurrentThread; gameMode.Exited += (sender, args) => { foreach (Sync.SyncTask t in Sync.SyncTask.All) { t.Dispose(); } }; if (_waiting) { _gameMode.Tick += _gameMode_Tick; } }
/// <summary> /// Registers the events this PlayerController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public void RegisterEvents(BaseMode gameMode) { gameMode.PlayerExitedMenu += (sender, args) => { var player = sender as GtaPlayer; Menu menu = Menu.All.FirstOrDefault(m => m.Viewers.Contains(player)); if (menu != null) menu.OnExit(player, args); }; gameMode.PlayerSelectedMenuRow += (sender, args) => { var player = sender as GtaPlayer; Menu menu = Menu.All.FirstOrDefault(m => m.Viewers.Contains(player)); if (menu != null) menu.OnResponse(player, args); }; }
/// <summary> /// Registers the events this <see cref="IEventListener" /> wants to listen to. /// </summary> /// <param name="gameMode">An instance of the <see cref="BaseMode" /> currently running.</param> public void RegisterEvents(BaseMode gameMode) { gameMode.PlayerGiveDamageActor += (sender, args) => { var actor = sender as Actor; if (actor != null) actor.OnPlayerGiveDamage(args); }; gameMode.ActorStreamIn += (sender, args) => { var actor = sender as Actor; if (actor != null) actor.OnStreamIn(args); }; gameMode.ActorStreamOut += (sender, args) => { var actor = sender as Actor; if (actor != null) actor.OnStreamOut(args); }; }
/// <summary> /// Registers the events this PlayerController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { gameMode.PlayerExitedMenu += (sender, args) => { var player = sender as BasePlayer; if (player == null) return; Menu.All.FirstOrDefault(m => m.Viewers.Contains(player))?.OnExit(player, args); }; gameMode.PlayerSelectedMenuRow += (sender, args) => { var player = sender as BasePlayer; if (player == null) return; Menu.All.FirstOrDefault(m => m.Viewers.Contains(player))?.OnResponse(player, args); }; }
/// <summary> /// Registers the events this DialogController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { gameMode.DialogResponse += (sender, args) => { var player = sender as BasePlayer; if (player == null) return; Dialog.GetOpenDialog(player)?.OnResponse(args); }; gameMode.PlayerDisconnected += (sender, args) => { var player = sender as BasePlayer; if (player == null) return; Dialog.Hide(player); }; }
/// <summary> /// Initializes a new instance of the <see cref="Service" /> class. /// </summary> /// <param name="gameMode">The game mode.</param> protected Service(BaseMode gameMode) { GameMode = gameMode; }
/// <summary> /// Registers the events this GlobalObjectController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { gameMode.ObjectMoved += (sender, args) => (sender as GlobalObject)?.OnMoved(args); gameMode.PlayerEditGlobalObject += (sender, args) => (sender as GlobalObject)?.OnEdited(args); gameMode.PlayerSelectGlobalObject += (sender, args) => (sender as GlobalObject)?.OnSelected(args); }
/// <summary> /// Loads controllers provided by this extensions. /// </summary> /// <param name="gameMode">The game mode.</param> /// <param name="controllerCollection">The controller collection.</param> public virtual void LoadControllers(BaseMode gameMode, ControllerCollection controllerCollection) { gameMode.AutoloadControllersForAssembly(GetType().GetTypeInfo().Assembly); }
public DiffMode(ObjectDataFormatter objectDataFormatter, BaseMode snapshotFirst, BaseMode snapshotSecond) { ProgressBarDisplay.ShowBar("Snapshot diff in progress"); m_ObjectDataFormatter = objectDataFormatter; m_ObjectDataFormatter.PrettyNamesOptionChanged += UpdateTableSelectionNames; modeFirst = snapshotFirst; modeSecond = snapshotSecond; m_SchemaFirst = modeFirst.GetSchema(); m_SchemaSecond = modeSecond.GetSchema(); ProgressBarDisplay.UpdateProgress(0.1f, "Building diff schema."); m_SchemaDiff = new Database.Operation.DiffSchema(m_SchemaFirst, m_SchemaSecond, () => { ProgressBarDisplay.UpdateProgress(0.3f, "Computing table data"); }); ProgressBarDisplay.UpdateProgress(0.85f, "Updating table selection."); UpdateTableSelectionNames(); ProgressBarDisplay.ClearBar(); }
public void RegisterEvents(BaseMode gameMode) { gameMode.PlayerConnected += Spectate_PlayerConnected; gameMode.PlayerDisconnected += Spectate_PlayerDisconnected; }
/// <summary> /// Performs post-load actions. /// </summary> /// <param name="gameMode">The game mode.</param> public virtual void PostLoad(BaseMode gameMode) { }
/// <summary> /// Registers the events this TextDrawController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { gameMode.PlayerPickUpPickup += (sender, args) => (sender as Pickup)?.OnPickUp(args); }
public TestServiceB(BaseMode gameMode) : base(gameMode) { }
public void RegisterEvents(BaseMode gameMode) => gameMode.Initialized += (sender, e) => CheckConnection();
/// <summary> /// Registers the services this controller provides. /// </summary> /// <param name="gameMode">The game mode.</param> /// <param name="serviceContainer">The service container.</param> public virtual void RegisterServices(BaseMode gameMode, GameModeServiceContainer serviceContainer) { serviceContainer.AddService<IVehicleFactory>(new BaseVehicleFactory(gameMode)); }
/// <summary> /// Registers the events this <see cref="GlobalObjectController" /> wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { gameMode.PlayerCommandText += gameMode_PlayerCommandText; }
/// <summary> /// Registers the services this controller provides. /// </summary> /// <param name="gameMode">The game mode.</param> /// <param name="serviceContainer">The service container.</param> public virtual void RegisterServices(BaseMode gameMode, GameModeServiceContainer serviceContainer) { serviceContainer.AddService <IVehicleFactory>(new BaseVehicleFactory(gameMode)); }
// public override void LoadServices(BaseMode gameMode) { GameMode = gameMode; gameMode.Services.AddService(this); base.LoadServices(gameMode); }
private void optHex_CheckedChanged(object sender, EventArgs e) { if (!optHex.Checked) return; if (!m_Error) { string PrevResult = lblDisplay.Text; btnCancel.PerformClick(); switch (m_BaseMode) { case BaseMode.Decimal: if (!HasFractionalPart(Convert.ToDouble(PrevResult)) && Math.Sign(Convert.ToDouble(PrevResult)) > 0) { try { lblDisplay.Text = Convert.ToUInt32(PrevResult).ToString("X"); } catch (Exception) { lblDisplay.Text = new string('F', 8); } } break; case BaseMode.Binary: try { lblDisplay.Text = Convert.ToString(Convert.ToInt32(PrevResult, (int)BaseMode.Binary), (int)BaseMode.Hexadecimal).ToUpper(); } catch (Exception) { lblDisplay.Text = new string('F', 8); } break; }; } m_BaseMode = BaseMode.Hexadecimal; Button[] ButtonsToEnable = { btn2, btn3, btn4, btn5, btn6, btn7, btn8, btn9, btnA, btnB, btnC, btnD, btnE, btnF }; Button[] ButtonsToDisable = { btnMC, btnMR, btnMS, btnMPlus, btnMMinus, btnExp, btnPi, btnMod, btnPlusMinus, btnPercentage, btnSquareRoot, btnInverse, btnSquare, btnCube, btnTensPower, btnePower, btnSin, btnCos, btnTan, btnFactorial, btnSinInverse, btnCosInverse, btnTanInverse, btnLog, btnDecimal, btnSinh, btnCosh, btnTanh, btnLn, btnAND, btnOR, btnNOT, btnXOR, btnLsh, btnRsh, btnRoL, btnRoR }; // Enable some for (int i = 0; i < ButtonsToEnable.Length; i++) ButtonsToEnable[i].Enabled = true; // Disable others for (int i = 0; i < ButtonsToDisable.Length; i++) ButtonsToDisable[i].Enabled = false; }
//private void DeleteProcess() //{ // try // { // using (MySqlConnection conn = new MySqlConnection(Commons.CONNSTR)) // { // conn.Open(); //using문사용시 자동으로 conn.close해줌 원래는 conn.close해줘야함! // MySqlCommand cmd = new MySqlCommand(); // cmd.Connection = conn; // cmd.CommandText = "DELETE FROM divtbl " + // " WHERE Division = @Division "; // MySqlParameter paramDivision = new MySqlParameter(@"Division", MySqlDbType.VarChar); // paramDivision.Value = TxtDivision.Text; // cmd.Parameters.Add(paramDivision); // var result = cmd.ExecuteNonQuery(); // } // } // catch (Exception ex) // { // MetroMessageBox.Show(this, $"에러발생 {ex.Message}", "에러", // MessageBoxButtons.OK, MessageBoxIcon.Error); // } // finally // { // UpdataData(); // } //} #endregion private void BtnNew_Click(object sender, EventArgs e) { InitControls(); myMode = BaseMode.INSERT; //신규 입력 모드 변경 }
/// <summary> /// Initializes a new instance of the <see cref="BaseVehicleFactory" /> class. /// </summary> /// <param name="gameMode">The game mode.</param> public BaseVehicleFactory(BaseMode gameMode) { GameMode = gameMode; }
private void BtnNew_Click_1(object sender, EventArgs e) { InitControls(); MyMode = BaseMode.INSERT; }
public void RegisterEvents(BaseMode gameMode) { gameMode.Initialized += SpeedCamera_GamemodeInitialized; }
/// <summary> /// Registers the events this DelayController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { gameMode.TimerTick += (sender, args) => (sender as Delay)?.Action?.Invoke(); }
/// <summary> /// Loads services provided by this extensions. /// </summary> /// <param name="gameMode">The game mode.</param> public virtual void LoadServices(BaseMode gameMode) { }
private void metroButton3_Click(object sender, EventArgs e) { myMode = BaseMode.UPDATE; InitControls(); }
public DiffMode(ObjectDataFormatter objectDataFormatter, BaseMode snapshotFirst, BaseMode snapshotSecond) { m_ObjectDataFormatter = objectDataFormatter; m_ObjectDataFormatter.PrettyNamesOptionChanged += UpdateTableSelectionNames; modeFirst = snapshotFirst; modeSecond = snapshotSecond; m_SchemaFirst = modeFirst.GetSchema(); m_SchemaSecond = modeSecond.GetSchema(); m_SchemaDiff = new Database.Operation.DiffSchema(m_SchemaFirst, m_SchemaSecond); UpdateTableSelectionNames(); }
/// <summary> /// Registers the events this VehicleController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { //Register all vehicle events gameMode.VehicleSpawned += (sender, args) => { var vehicle = sender as GtaVehicle; if (vehicle != null) { vehicle.OnSpawn(args); } }; gameMode.VehicleDied += (sender, args) => { var vehicle = sender as GtaVehicle; if (vehicle != null) { vehicle.OnDeath(args); } }; gameMode.PlayerEnterVehicle += (sender, args) => { if (args.Vehicle != null) { args.Vehicle.OnPlayerEnter(args); } }; gameMode.PlayerExitVehicle += (sender, args) => { if (args.Vehicle != null) { args.Vehicle.OnPlayerExit(args); } }; gameMode.VehicleMod += (sender, args) => { var vehicle = sender as GtaVehicle; if (vehicle != null) { vehicle.OnMod(args); } }; gameMode.VehiclePaintjobApplied += (sender, args) => { var vehicle = sender as GtaVehicle; if (vehicle != null) { vehicle.OnPaintjobApplied(args); } }; gameMode.VehicleResprayed += (sender, args) => { var vehicle = sender as GtaVehicle; if (vehicle != null) { vehicle.OnResprayed(args); } }; gameMode.VehicleDamageStatusUpdated += (sender, args) => { var vehicle = sender as GtaVehicle; if (vehicle != null) { vehicle.OnDamageStatusUpdated(args); } }; gameMode.UnoccupiedVehicleUpdated += (sender, args) => { var vehicle = sender as GtaVehicle; if (vehicle != null) { vehicle.OnUnoccupiedUpdate(args); } }; gameMode.VehicleStreamIn += (sender, args) => { var vehicle = sender as GtaVehicle; if (vehicle != null) { vehicle.OnStreamIn(args); } }; gameMode.VehicleStreamOut += (sender, args) => { var vehicle = sender as GtaVehicle; if (vehicle != null) { vehicle.OnStreamOut(args); } }; gameMode.TrailerUpdate += (sender, args) => { var vehicle = sender as GtaVehicle; if (vehicle != null) { vehicle.OnTrailerUpdate(args); } }; gameMode.VehicleSirenStateChange += (sender, args) => { var vehicle = sender as GtaVehicle; if (vehicle != null) { vehicle.OnSirenStateChanged(args); } }; }
protected BaseMode(BaseMode copy) { m_TableNames = copy.m_TableNames; m_Tables = copy.m_Tables; }
public void RegisterEvents(BaseMode gameMode) { gameMode.Initialized += Bonus_GamemodeInitialized; }
private void metroButton2_Click(object sender, EventArgs e) { Savedata(); myMode = BaseMode.UPDATE; }
/// <summary> /// Registers the events this <see cref="IEventListener" /> wants to listen to. /// </summary> /// <param name="gameMode">An instance of the <see cref="BaseMode" /> currently running.</param> public virtual void RegisterEvents(BaseMode gameMode) { gameMode.PlayerGiveDamageActor += (sender, args) => (sender as Actor)?.OnPlayerGiveDamage(args); gameMode.ActorStreamIn += (sender, args) => (sender as Actor)?.OnStreamIn(args); gameMode.ActorStreamOut += (sender, args) => (sender as Actor)?.OnStreamOut(args); }
public void RegisterEvents(BaseMode gameMode) { gameMode.PlayerDisconnected += Convoy_PlayerDisconnected; gameMode.PlayerDied += Convoy_PlayerDied; }
private void metroButton1_Click(object sender, EventArgs e) { myMode = BaseMode.INSERT; InitControls(); }
private void optDecimal_CheckedChanged(object sender, EventArgs e) { if (!optDecimal.Checked) return; if (!m_Error) { string PrevResult = lblDisplay.Text; btnCancel.PerformClick(); switch (m_BaseMode) { case BaseMode.Hexadecimal: lblDisplay.Text = Convert.ToUInt32(PrevResult, (int) BaseMode.Hexadecimal).ToString(); break; case BaseMode.Binary: lblDisplay.Text = Convert.ToUInt32(PrevResult, (int) BaseMode.Binary).ToString(); break; }; } m_BaseMode = BaseMode.Decimal; Button[] ButtonsToEnable = { btnMC, btnMR, btnMS, btnMPlus, btnMMinus, btnExp, btnPi, btnMod, btnDecimal, btn2, btn3, btn4, btn5, btn6, btn7, btn8, btn9, btnPlusMinus, btnSquareRoot, btnInverse, btnSquare, btnCube, btnTensPower, btnePower, btnSin, btnCos, btnTan, btnFactorial, btnSinInverse, btnCosInverse, btnTanInverse, btnLog, btnPercentage, btnSinh, btnCosh, btnTanh, btnLn }; Button[] ButtonsToDisable = { btnA, btnB, btnC, btnD, btnE, btnF, btnAND, btnOR, btnNOT, btnXOR, btnLsh, btnRsh, btnRoL, btnRoR }; // Enable some for (int i = 0; i < ButtonsToEnable.Length; i++) ButtonsToEnable[i].Enabled = true; // Disable others for (int i = 0; i < ButtonsToDisable.Length; i++) ButtonsToDisable[i].Enabled = false; }
public void RegisterEvents(BaseMode gameMode) { PlayerLogin += PlayerAccountController_PlayerLogin; gameMode.PlayerConnected += GameMode_PlayerConnected; gameMode.PlayerDisconnected += GameMode_PlayerDisconnected; }
/// <summary> /// Registers the events this PlayerController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { //Register all player events gameMode.PlayerConnected += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnConnected(args); }; gameMode.PlayerDisconnected += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnDisconnected(args); }; gameMode.PlayerCleanup += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnCleanup(args); }; gameMode.PlayerSpawned += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnSpawned(args); }; gameMode.PlayerDied += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnDeath(args); }; gameMode.PlayerText += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnText(args); }; gameMode.PlayerCommandText += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnCommandText(args); }; gameMode.PlayerRequestClass += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnRequestClass(args); }; gameMode.PlayerEnterVehicle += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnEnterVehicle(args); }; gameMode.PlayerExitVehicle += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnExitVehicle(args); }; gameMode.PlayerStateChanged += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnStateChanged(args); }; gameMode.PlayerEnterCheckpoint += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnEnterCheckpoint(args); }; gameMode.PlayerLeaveCheckpoint += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnLeaveCheckpoint(args); }; gameMode.PlayerEnterRaceCheckpoint += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnEnterRaceCheckpoint(args); }; gameMode.PlayerLeaveRaceCheckpoint += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnLeaveRaceCheckpoint(args); }; gameMode.PlayerRequestSpawn += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnRequestSpawn(args); }; gameMode.PlayerEnterExitModShop += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnEnterExitModShop(args); }; gameMode.PlayerSelectedMenuRow += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnSelectedMenuRow(args); }; gameMode.PlayerExitedMenu += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnExitedMenu(args); }; gameMode.PlayerInteriorChanged += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnInteriorChanged(args); }; gameMode.PlayerKeyStateChanged += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnKeyStateChanged(args); }; gameMode.PlayerUpdate += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnUpdate(args); }; gameMode.PlayerStreamIn += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnStreamIn(args); }; gameMode.PlayerStreamOut += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnStreamOut(args); }; gameMode.DialogResponse += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnDialogResponse(args); }; gameMode.PlayerTakeDamage += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnTakeDamage(args); }; gameMode.PlayerGiveDamage += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnGiveDamage(args); }; gameMode.PlayerClickMap += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnClickMap(args); }; gameMode.PlayerClickTextDraw += (sender, args) => { var player = sender as GtaPlayer; if (args.TextDraw == null) { if (player != null) player.OnCancelClickTextDraw(args); } else { if (player != null) player.OnClickTextDraw(args); } }; gameMode.PlayerClickPlayerTextDraw += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnClickPlayerTextDraw(args); }; gameMode.PlayerClickPlayer += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnClickPlayer(args); }; gameMode.PlayerEditGlobalObject += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnEditGlobalObject(args); }; gameMode.PlayerEditPlayerObject += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnEditPlayerObject(args); }; gameMode.PlayerEditAttachedObject += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnEditAttachedObject(args); }; gameMode.PlayerSelectGlobalObject += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnSelectGlobalObject(args); }; gameMode.PlayerSelectPlayerObject += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnSelectPlayerObject(args); }; gameMode.PlayerWeaponShot += (sender, args) => { var player = sender as GtaPlayer; if (player != null) player.OnWeaponShot(args); }; }
/// <summary> /// Registers the events this TimerController wants to listen to. /// </summary> /// <param name="gameMode">The running GameMode.</param> public virtual void RegisterEvents(BaseMode gameMode) { gameMode.Tick += OnTick; }
public void RegisterEvents(BaseMode gameMode) { gameMode.PlayerEnterCheckpoint += Pilot_PlayerEnterCheckpoint; gameMode.PlayerExitVehicle += Pilot_PlayerExitVehicle; }
/// <summary> /// Initializes a new instance of the <see cref="CommandsManager"/> class. /// </summary> /// <param name="gameMode">The game mode.</param> /// <exception cref="ArgumentNullException"></exception> public CommandsManager(BaseMode gameMode) { GameMode = gameMode ?? throw new ArgumentNullException(nameof(gameMode)); }