void NewMap(object Sender, ValuedEventArgs <MapConfiguration> E) { var pane = (NewMapPane)Sender; SetMap(E.Value.GenerateMap(new Random(), null, new IdGenerator())); pane.Visible = false; }
void HandleSelectMapRegion(object Sender, ValuedEventArgs <StandardItem <MapRegion> > E) { if (OnMapRegionSelected != null) { OnMapRegionSelected(this, new ValuedEventArgs <MapRegion>(E.Value.Value)); } }
void HandleSendMessage(object Sender, ValuedEventArgs <string> E) { if (E.Value != "") { _Adapter.SendMessage(new ChatMessage(_Player, E.Value)); } }
void HandleJoinRemoteMatch(object Sender, ValuedEventArgs <MatchLobbyContext> E) { OnProgramStateTransition( this, new ProgramStateTransitionEventArgs( ProgramState.MATCH_LOBBY, E.Value)); }
void HandleSelect(object Sender, ValuedEventArgs <SelectionOption <FileInfo> > E) { MatchRecord record = null; using (FileStream stream = new FileStream(E.Value.Value.FullName, FileMode.Open)) { using (GZipStream compressionStream = new GZipStream(stream, CompressionMode.Decompress)) { record = new MatchRecord(new SerializationInputStream(compressionStream)); } } _ScenarioView.SetScenario( record.Match.Scenario, new UnitConfigurationRenderer( record.Match.Scenario, GameData.UnitRenderDetails, 128, 1024, ClassLibrary.Instance.GetFont("compacta")), new FactionRenderer( record.Match.Scenario, GameData.FactionRenderDetails, 512, 1024)); _SelectedRecord = record; }
void HandleUnload(object Sender, ValuedEventArgs <Unit> E) { var unit = (Unit)Sender; if (unit.Army == TrackingArmy) { var tileDeltas = unit.GetFieldOfSight(E.Value.Configuration.SightRange, unit.Position) .Select(i => new Tuple <Tile, TileSightLevel>(i.Final, GetTileSightLevel(i.Final))) .ToList(); var unitDeltas = UnitTracker.ComputeDelta(this, tileDeltas); if (OnSightUpdated != null) { OnSightUpdated( this, new SightUpdatedEventArgs(unit, null, tileDeltas, unitDeltas)); } } else { if (OnSightUpdated != null) { OnSightUpdated( this, new SightUpdatedEventArgs( unit, null, new List <Tuple <Tile, TileSightLevel> >(), new List <Tuple <Unit, UnitVisibility> >())); } } }
void HandleChange(object sender, ValuedEventArgs <StandardItem <T> > E) { if (OnItemSelected != null) { OnItemSelected(this, new ValuedEventArgs <T>(E.Value.Value)); } }
void HandleUnitConfigurationRightClicked(object Sender, ValuedEventArgs <UnitConfiguration> E) { ClearPane(); _Pane = new UnitConfigurationInfoPane(E.Value, _ArmyBuilder.Parameters.Faction, _Renderer); _Pane.OnClose += (sender, e) => ClearPane(); _Screen.PaneLayer.Add(_Pane); }
void HandleAttackTargetChanged(object Sender, ValuedEventArgs <StandardItem <AttackTarget> > E) { if (OnAttackTargetChanged != null) { OnAttackTargetChanged(this, new ValuedEventArgs <AttackTarget>(E.Value.Value)); } }
void HandlePlayerReadyStateChanged(object Sender, ValuedEventArgs <Tuple <Player, bool> > E) { if (OnPlayerReadyStateChanged != null) { OnPlayerReadyStateChanged(this, E); } }
void HandleArmyConfigurationSelected(object Sender, ValuedEventArgs <Tuple <Player, ArmyConfiguration> > E) { if (OnArmyConfigurationSelected != null) { OnArmyConfigurationSelected(this, E); } }
void HandleScenarioSelected(object Sender, ValuedEventArgs <StandardItem <Scenario> > E) { if (OnScenarioSelected != null) { OnScenarioSelected(this, new ValuedEventArgs <Scenario>(E.Value.Value)); } }
void HandleStartScenario(object Sender, ValuedEventArgs <Scenario> E) { OnProgramStateTransition( this, new ProgramStateTransitionEventArgs( ProgramState.MATCH, new MatchContext(new Match(E.Value.MakeStatic(new Random()), new FullOrderAutomater())))); }
void HandleUnitInfoRequested(object Sender, ValuedEventArgs <UnitConfigurationLink> E) { if (Keyboard.IsKeyPressed(Keyboard.Key.LShift) || Keyboard.IsKeyPressed(Keyboard.Key.RShift)) { OnUnitConfigurationRightClicked?.Invoke( Sender, new ValuedEventArgs <UnitConfiguration>(E.Value.UnitConfiguration)); } }
void HandlePlayerReadyStateChanged(object Sender, ValuedEventArgs <bool> E) { if (OnPlayerReadyStateChanged != null) { OnPlayerReadyStateChanged( this, new ValuedEventArgs <Tuple <Player, bool> >(new Tuple <Player, bool>(Player, E.Value))); } }
void SetActivePage(object sender, ValuedEventArgs <StandardItem <DeploymentPage> > E) { _Pages.ForEach(i => i.Visible = false); E.Value.Value.Visible = true; if (OnDeploymentSelected != null) { OnDeploymentSelected(null, EventArgs.Empty); } }
void HandleUnload(object Sender, ValuedEventArgs <Unit> E) { var u = (Unit)Sender; var carrierOption = _Selection.FirstOrDefault(i => i.Unit == u); var option = new SingularUnitSelectionOption("deployment-selection-option", E.Value, _Renderer); _Selection.Insert(Math.Min(_Selection.Count() - 1, _Selection.ToList().IndexOf(carrierOption) + 1), option); carrierOption.Value.Remove(E.Value); }
void HandleChatAction(object Sender, ValuedEventArgs <ChatAction> E) { if (E.Value is AddChatMessageAction) { lock (_IncomingMessages) { _IncomingMessages.Add(((AddChatMessageAction)E.Value).Message); } } }
void HandleArmyConfigurationSelected(object Sender, ValuedEventArgs <StandardItem <ArmyConfiguration> > E) { if (OnArmyConfigurationSelected != null) { OnArmyConfigurationSelected( this, new ValuedEventArgs <Tuple <Player, ArmyConfiguration> >( new Tuple <Player, ArmyConfiguration>(Player, E.Value.Value))); } }
void HandleArmyParametersChanged(object Sender, ValuedEventArgs <ArmyParameters> E) { if (OnArmyParametersChanged != null) { OnArmyParametersChanged( this, new ValuedEventArgs <Tuple <ArmyBuilder, ArmyParameters> >( new Tuple <ArmyBuilder, ArmyParameters>( ((ScenarioBuilderArmySection)Sender).ArmyBuilder, E.Value))); } }
void HandleStartScenario(object Sender, ValuedEventArgs <MatchRecord> E) { var m = new MatchContext(E.Value.Match); var a = m.MakeMatchAdapter(); var controller = new MatchRecordReplayPlayerController(a, E.Value); foreach (Army army in E.Value.Match.Armies) { m.OverridePlayerController(army, controller); } OnProgramStateTransition(this, new ProgramStateTransitionEventArgs(ProgramState.MATCH, m)); }
void HandleRemoveUnit(object Sender, ValuedEventArgs <UnitConfigurationLink> E) { if (Keyboard.IsKeyPressed(Keyboard.Key.LShift) || Keyboard.IsKeyPressed(Keyboard.Key.RShift)) { HandleUnitInfoRequested(Sender, E); } else { _SelectedUnits.Remove(E.Value); SetPointTotal( _PointTotal - E.Value.UnitConfiguration.GetPointValue(_Parameters.Faction.HalfPriceTrucks)); } }
void HandleAddMapRegion(object Sender, ValuedEventArgs <string> E) { var m = new MapRegion { Name = E.Value }; m.OnChange += HandleRegionChanged; _EditScreen.MapView.Map.Regions.Add(m); _EditScreen.MapView.MapRegions.Add(new MapRegionView(m, _EditScreen.MapView.TileRenderer)); _EditPane.UpdateFromMap(_EditScreen.MapView.Map); UnHighlight(); _EditScreen.PaneLayer.Remove(_NewRegionPane); _NewRegionPane = null; }
void UnitCaptured(object Sender, ValuedEventArgs <Army> E) { var unit = (Unit)Sender; if (this != E.Value) { return; } var newUnit = new Unit(this, unit.Configuration, _IdGenerator); newUnit.OnDestroy += UnitDestroyed; newUnit.OnCapture += UnitCaptured; _CapturedUnits.Add(newUnit); if (OnUnitAdded != null) { OnUnitAdded(this, new NewUnitEventArgs(newUnit)); } newUnit.Place(unit.Position); }
void HandleFortify(object Sender, ValuedEventArgs <Unit> E) { var unit = (Unit)Sender; if (unit.Army == TrackingArmy) { if (OnSightUpdated != null) { OnSightUpdated( this, new SightUpdatedEventArgs( unit, null, new List <Tuple <Tile, TileSightLevel> >(), new List <Tuple <Unit, UnitVisibility> >())); } } else { var unitOverride = _OverrideVisibleUnits.Contains(unit); var fortOverride = _OverrideVisibleUnits.Contains(E.Value); var unitDeltas = new List <Tuple <Unit, UnitVisibility> >(); if (unitOverride && !fortOverride) { _OverrideVisibleUnits.Add(E.Value); unitDeltas.AddRange(UnitTracker.Update(this, E.Value)); } if (OnSightUpdated != null) { OnSightUpdated( this, new SightUpdatedEventArgs( unit, null, new List <Tuple <Tile, TileSightLevel> >(), unitDeltas)); } } }
void HandleRemoteConnect(object Sender, ValuedEventArgs <string> E) { try { var client = NetworkContext.CreateClient(E.Value, GameData.OnlinePort); var lobby = client.MakePlayerContext(GameData.Player).MakeLobbyContext(); if (lobby != null) { OnConnectionSetup(this, new ValuedEventArgs <MatchLobbyContext>(lobby)); } else { _ConnectionPane.SetError("Failed to join lobby"); client.Close(); } } catch { _ConnectionPane.SetError("Failed to establish connection"); } }
void HandleArmyRemoved(object Sender, ValuedEventArgs <ArmyBuilder> E) { _Screen.RemoveArmyBuilder(E.Value); _ScenarioBuilder.RemoveArmy(E.Value); }
void HandleArmyParametersChanged(object Sender, ValuedEventArgs <Tuple <ArmyBuilder, ArmyParameters> > E) { E.Value.Item1.SetParameters(E.Value.Item2); }
void HandleParametersChanged(object Sender, ValuedEventArgs <ScenarioParameters> E) { _ScenarioBuilder.SetParameters(E.Value); }
void HandleLogIn(object Sender, ValuedEventArgs <PlayerContext> E) { OnProgramStateTransition(this, new ProgramStateTransitionEventArgs(ProgramState.ONLINE_LANDING, E.Value)); }