/// <summary> /// 停止服务 /// </summary> public void Stop() { if (listenSocket == null) { return; } var listenSocket_ = listenSocket; listenSocket = null; //(x.1) stop conn ConnectedList.ToList().ForEach(conn => conn.Close()); connMap.Clear(); //(x.2) close Socket try { listenSocket_.Close(); listenSocket_.Dispose(); //listenSocket_.Shutdown(SocketShutdown.Both); } catch (Exception ex) { Logger.Error(ex); } }
public clsMap() { frmMainLink = new ConnectedListLink<clsMap, frmMain>(this); Gateways = new ConnectedList<clsGateway, clsMap>(this); Initialize(); }
public Sector(XYInt NewPos) { Units = new ConnectedList <clsUnitSectorConnection, Sector>(this); Pos = NewPos; }
public clsWallType() { WallType_ObjectDataLink = new ConnectedListLink <clsWallType, clsObjectData>(this); Segments = new ConnectedList <StructureTypeBase, clsWallType>(this); Segments.MaintainOrder = true; }
public clsMap(sXY_int TileSize) { frmMainLink = new ConnectedListLink<clsMap, frmMain>(this); Gateways = new ConnectedList<clsGateway, clsMap>(this); Initialize(); TerrainBlank(TileSize); TileType_Reset(); }
public clsObjectData() { UnitTypes = new ConnectedList<clsUnitType, clsObjectData>(this); FeatureTypes = new ConnectedList<clsFeatureType, clsObjectData>(this); StructureTypes = new ConnectedList<clsStructureType, clsObjectData>(this); DroidTemplates = new ConnectedList<clsDroidTemplate, clsObjectData>(this); WallTypes = new ConnectedList<clsWallType, clsObjectData>(this); Bodies = new ConnectedList<clsBody, clsObjectData>(this); Propulsions = new ConnectedList<clsPropulsion, clsObjectData>(this); Turrets = new ConnectedList<clsTurret, clsObjectData>(this); Weapons = new ConnectedList<clsWeapon, clsObjectData>(this); Sensors = new ConnectedList<clsSensor, clsObjectData>(this); Repairs = new ConnectedList<clsRepair, clsObjectData>(this); Constructors = new ConnectedList<clsConstruct, clsObjectData>(this); Brains = new ConnectedList<clsBrain, clsObjectData>(this); ECMs = new ConnectedList<clsECM, clsObjectData>(this); }
public clsObjectData() { UnitTypes = new ConnectedList<UnitTypeBase, clsObjectData>(this); FeatureTypes = new ConnectedList<FeatureTypeBase, clsObjectData>(this); StructureTypes = new ConnectedList<StructureTypeBase, clsObjectData>(this); DroidTemplates = new ConnectedList<DroidTemplate, clsObjectData>(this); WallTypes = new ConnectedList<clsWallType, clsObjectData>(this); Bodies = new ConnectedList<Body, clsObjectData>(this); Propulsions = new ConnectedList<Propulsion, clsObjectData>(this); Turrets = new ConnectedList<Turret, clsObjectData>(this); Weapons = new ConnectedList<Weapon, clsObjectData>(this); Sensors = new ConnectedList<Sensor, clsObjectData>(this); Repairs = new ConnectedList<Repair, clsObjectData>(this); Constructors = new ConnectedList<Construct, clsObjectData>(this); Brains = new ConnectedList<Brain, clsObjectData>(this); ECMs = new ConnectedList<Ecm, clsObjectData>(this); }
public clsObjectData() { UnitTypes = new ConnectedList <UnitTypeBase, clsObjectData>(this); FeatureTypes = new ConnectedList <FeatureTypeBase, clsObjectData>(this); StructureTypes = new ConnectedList <StructureTypeBase, clsObjectData>(this); DroidTemplates = new ConnectedList <DroidTemplate, clsObjectData>(this); WallTypes = new ConnectedList <clsWallType, clsObjectData>(this); Bodies = new ConnectedList <Body, clsObjectData>(this); Propulsions = new ConnectedList <Propulsion, clsObjectData>(this); Turrets = new ConnectedList <Turret, clsObjectData>(this); Weapons = new ConnectedList <Weapon, clsObjectData>(this); Sensors = new ConnectedList <Sensor, clsObjectData>(this); Repairs = new ConnectedList <Repair, clsObjectData>(this); Constructors = new ConnectedList <Construct, clsObjectData>(this); Brains = new ConnectedList <Brain, clsObjectData>(this); ECMs = new ConnectedList <Ecm, clsObjectData>(this); }
public Unit(Unit unitToCopy, Map targetMap) { MapLink = new ConnectedListLink <Unit, Map>(this); MapSelectedUnitLink = new ConnectedListLink <Unit, Map>(this); Sectors = new ConnectedList <clsUnitSectorConnection, Unit>(this); var IsDesign = default(bool); if (unitToCopy.TypeBase.Type == UnitType.PlayerDroid) { IsDesign = !((DroidDesign)unitToCopy.TypeBase).IsTemplate; } else { IsDesign = false; } if (IsDesign) { var DroidDesign = new DroidDesign(); TypeBase = DroidDesign; DroidDesign.CopyDesign((DroidDesign)unitToCopy.TypeBase); DroidDesign.UpdateAttachments(); } else { TypeBase = unitToCopy.TypeBase; } Pos = unitToCopy.Pos; Rotation = unitToCopy.Rotation; var otherUnitGroup = default(clsUnitGroup); otherUnitGroup = unitToCopy.UnitGroup; if (otherUnitGroup.WZ_StartPos < 0) { UnitGroup = targetMap.ScavengerUnitGroup; } else { UnitGroup = targetMap.UnitGroups[otherUnitGroup.WZ_StartPos]; } SavePriority = unitToCopy.SavePriority; Health = unitToCopy.Health; PreferPartsOutput = unitToCopy.PreferPartsOutput; }
public clsMap() { SectorCount = new XYInt(0, 0); Selected_Area_VertexA = new XYInt(0, 0); Selected_Area_VertexB = new XYInt(0, 0); frmMainLink = new ConnectedListLink<clsMap, frmMain>(this); Sectors = new clsSector[0, 0]; ShadowSectors = new clsShadowSector[0, 0]; HeightMultiplier = 2; _ReadyForUserInput = false; ChangedSinceSave = false; AutoSave = new clsAutoSave(); Painter = new Painter(); Tile_TypeNum = new byte[0]; Gateways = new ConnectedList<clsGateway, clsMap>(this); Units = new ConnectedList<clsUnit, clsMap>(this); UnitGroups = new ConnectedList<clsUnitGroup, clsMap>(this); ScriptPositions = new ConnectedList<clsScriptPosition, clsMap>(this); ScriptAreas = new ConnectedList<clsScriptArea, clsMap>(this); Initialize(); }
public Unit() { MapLink = new ConnectedListLink <Unit, Map>(this); MapSelectedUnitLink = new ConnectedListLink <Unit, Map>(this); Sectors = new ConnectedList <clsUnitSectorConnection, Unit>(this); }
public virtual void Deallocate() { CancelUserInput(); MakeMinimapTimer.Enabled = false; MakeMinimapTimer.Dispose(); MakeMinimapTimer = null; MakeMinimapTimer.Tick += MinimapTimer_Tick; frmMainLink.Deallocate(); frmMainLink = null; UnitGroups.Deallocate(); UnitGroups = null; while ( Units.Count > 0 ) { Units[0].Deallocate(); } Units.Deallocate(); Units = null; while ( Gateways.Count > 0 ) { Gateways[0].Deallocate(); } Gateways.Deallocate(); Gateways = null; while ( ScriptPositions.Count > 0 ) { ScriptPositions[0].Deallocate(); } ScriptPositions.Deallocate(); ScriptPositions = null; while ( ScriptAreas.Count > 0 ) { ScriptAreas[0].Deallocate(); } ScriptAreas.Deallocate(); ScriptAreas = null; }
public clsSector(sXY_int NewPos) { Units = new ConnectedList<clsUnitSectorConnection, clsSector>(this); Pos = NewPos; }
public clsSector() { Units = new ConnectedList<clsUnitSectorConnection, clsSector>(this); }
public void CancelUserInput() { if ( !_ReadyForUserInput ) { return; } _ReadyForUserInput = false; int X = 0; int Y = 0; if ( CompileScreen != null ) { CompileScreen.Close(); CompileScreen = null; } SectorAll_GLLists_Delete(); MinimapGLDelete(); ShadowSectors = null; for ( Y = 0; Y <= SectorCount.Y - 1; Y++ ) { for ( X = 0; X <= SectorCount.X - 1; X++ ) { Sectors[X, Y].Deallocate(); } } Sectors = null; SectorGraphicsChanges.Deallocate(); SectorGraphicsChanges = null; SectorUnitHeightsChanges.Deallocate(); SectorUnitHeightsChanges = null; SectorTerrainUndoChanges.Deallocate(); SectorTerrainUndoChanges = null; AutoTextureChanges.Deallocate(); AutoTextureChanges = null; TerrainInterpretChanges.Deallocate(); TerrainInterpretChanges = null; UnitChanges = null; GatewayChanges = null; Undos = null; SelectedUnits.Deallocate(); SelectedUnits = null; Selected_Tile_A = null; Selected_Tile_B = null; Selected_Area_VertexA = null; Selected_Area_VertexB = null; Unit_Selected_Area_VertexA = null; ViewInfo = null; _SelectedUnitGroup = null; Messages = null; }
public clsWallType() { WallType_ObjectDataLink = new ConnectedListLink<clsWallType, clsObjectData>(this); Segments = new ConnectedList<StructureTypeBase, clsWallType>(this); Segments.MaintainOrder = true; }
public ConnectionHub() { connectedList = ConnectedList.GetInstance(); }
public abstract void BeforeAdd(ConnectedList <TItemType, TSourceType> newList, int newPosition);
public OptionGroup() { Options = new ConnectedList<OptionInterface, OptionGroup>(this); }
public clsMap(clsMap MapToCopy, sXY_int Offset, sXY_int Area) { frmMainLink = new ConnectedListLink<clsMap, frmMain>(this); Gateways = new ConnectedList<clsGateway, clsMap>(this); int EndX = 0; int EndY = 0; int X = 0; int Y = 0; Initialize(); //make some map data for selection EndX = Math.Min(MapToCopy.Terrain.TileSize.X - Offset.X, Area.X); EndY = Math.Min(MapToCopy.Terrain.TileSize.Y - Offset.Y, Area.Y); Terrain = new clsTerrain(Area); for ( Y = 0; Y <= Terrain.TileSize.Y - 1; Y++ ) { for ( X = 0; X <= Terrain.TileSize.X - 1; X++ ) { Terrain.Tiles[X, Y].Texture.TextureNum = -1; } } for ( Y = 0; Y <= EndY; Y++ ) { for ( X = 0; X <= EndX; X++ ) { Terrain.Vertices[X, Y].Height = MapToCopy.Terrain.Vertices[Offset.X + X, Offset.Y + Y].Height; Terrain.Vertices[X, Y].Terrain = MapToCopy.Terrain.Vertices[Offset.X + X, Offset.Y + Y].Terrain; } } for ( Y = 0; Y <= EndY - 1; Y++ ) { for ( X = 0; X <= EndX - 1; X++ ) { Terrain.Tiles[X, Y].Copy(MapToCopy.Terrain.Tiles[Offset.X + X, Offset.Y + Y]); } } for ( Y = 0; Y <= EndY; Y++ ) { for ( X = 0; X <= EndX - 1; X++ ) { Terrain.SideH[X, Y].Road = MapToCopy.Terrain.SideH[Offset.X + X, Offset.Y + Y].Road; } } for ( Y = 0; Y <= EndY - 1; Y++ ) { for ( X = 0; X <= EndX; X++ ) { Terrain.SideV[X, Y].Road = MapToCopy.Terrain.SideV[Offset.X + X, Offset.Y + Y].Road; } } SectorCount.X = (int)(Math.Ceiling((double)(Area.X / Constants.SectorTileSize))); SectorCount.Y = (int)(Math.Ceiling((double)(Area.Y / Constants.SectorTileSize))); Sectors = new clsSector[SectorCount.X, SectorCount.Y]; for ( Y = 0; Y <= SectorCount.Y - 1; Y++ ) { for ( X = 0; X <= SectorCount.X - 1; X++ ) { Sectors[X, Y] = new clsSector(new sXY_int(X, Y)); } } sXY_int PosDif = new sXY_int(); clsUnitAdd NewUnitAdd = new clsUnitAdd(); NewUnitAdd.Map = this; clsUnit NewUnit = default(clsUnit); clsGateway Gateway = default(clsGateway); foreach ( clsGateway tempLoopVar_Gateway in MapToCopy.Gateways ) { Gateway = tempLoopVar_Gateway; GatewayCreate(new sXY_int(Gateway.PosA.X - Offset.X, Gateway.PosA.Y - Offset.Y), new sXY_int(Gateway.PosB.X - Offset.X, Gateway.PosB.Y - Offset.Y)); } PosDif.X = - Offset.X * App.TerrainGridSpacing; PosDif.Y = - Offset.Y * App.TerrainGridSpacing; clsUnit Unit = default(clsUnit); sXY_int NewPos = new sXY_int(); foreach ( clsUnit tempLoopVar_Unit in MapToCopy.Units ) { Unit = tempLoopVar_Unit; NewPos = Unit.Pos.Horizontal + PosDif; if ( PosIsOnMap(NewPos) ) { NewUnit = new clsUnit(Unit, this); NewUnit.Pos.Horizontal = NewPos; NewUnitAdd.NewUnit = NewUnit; NewUnitAdd.Label = Unit.Label; NewUnitAdd.Perform(); } } }
public OptionGroup() { Options = new ConnectedList <OptionInterface, OptionGroup>(this); }
public void InitializeUserInput() { if ( _ReadyForUserInput ) { return; } _ReadyForUserInput = true; int X = 0; int Y = 0; SectorCount.X = (int)(Math.Ceiling((double)(Terrain.TileSize.X / Constants.SectorTileSize))); SectorCount.Y = (int)(Math.Ceiling((double)(Terrain.TileSize.Y / Constants.SectorTileSize))); Sectors = new clsSector[SectorCount.X, SectorCount.Y]; for ( Y = 0; Y <= SectorCount.Y - 1; Y++ ) { for ( X = 0; X <= SectorCount.X - 1; X++ ) { Sectors[X, Y] = new clsSector(new sXY_int(X, Y)); } } clsUnit Unit = default(clsUnit); foreach ( clsUnit tempLoopVar_Unit in Units ) { Unit = tempLoopVar_Unit; UnitSectorsCalc(Unit); } ShadowSectors = new clsShadowSector[SectorCount.X, SectorCount.Y]; for ( Y = 0; Y <= SectorCount.Y - 1; Y++ ) { for ( X = 0; X <= SectorCount.X - 1; X++ ) { ShadowSector_Create(new sXY_int(X, Y)); } } SectorGraphicsChanges = new clsSectorChanges(this); SectorGraphicsChanges.SetAllChanged(); SectorUnitHeightsChanges = new clsSectorChanges(this); SectorTerrainUndoChanges = new clsSectorChanges(this); AutoTextureChanges = new clsAutoTextureChanges(this); TerrainInterpretChanges = new clsTerrainUpdate(Terrain.TileSize); UnitChanges = new SimpleClassList<clsUnitChange>(); UnitChanges.MaintainOrder = true; GatewayChanges = new SimpleClassList<clsGatewayChange>(); GatewayChanges.MaintainOrder = true; Undos = new SimpleClassList<clsUndo>(); Undos.MaintainOrder = true; UndoPosition = 0; SelectedUnits = new ConnectedList<clsUnit, clsMap>(this); if ( InterfaceOptions == null ) { InterfaceOptions = new clsInterfaceOptions(); } ViewInfo = new clsViewInfo(this, Program.frmMainInstance.MapViewControl); _SelectedUnitGroup = new clsUnitGroupContainer(); SelectedUnitGroup.Item = ScavengerUnitGroup; Messages = new SimpleClassList<clsMessage>(); Messages.MaintainOrder = true; }
public Sector() { Pos = new XYInt(0, 0); Units = new ConnectedList <clsUnitSectorConnection, Sector>(this); }