//Universum Beitreten public void Enter(string universeGroupName, string teamName) { universeGroup = connector.UniverseGroups[universeGroupName]; Team team = universeGroup.Teams[teamName]; //Um einem team zu betreten // if (!File.Exists("benchmark123.bin")) // { // PerformanceMark newBenchmark = Connector.DoBenchmark(); // File.WriteAllBytes("benchmark123.bin", Connector.SaveBenchmark()); // } // else // { // Connector.LoadBenchmark(File.ReadAllBytes("benchmark.bin")); // } universeGroup.Join("Karim", team); ship = universeGroup.RegisterShip("Flixbus", "Flixbus"); Thread thread = new Thread(Run); thread.Name = "MainLoop"; thread.Start(); }
public void Enter(string universeGroupName, string teamName = "None") { _universeGroup = _connector.UniverseGroups[universeGroupName]; Team team = _universeGroup.Teams[teamName]; _universeGroup.Join(Nickname, team); _ship = _universeGroup.RegisterShip(ShipType, ShipName); Thread thread = new Thread(Run) { Name = "MainLoop" }; thread.Start(); }
/// <summary> /// Creates a map manager /// </summary> /// <param name="universeGroup"></param> internal MapManager(UniverseSession universeSession) { Session = universeSession; UniverseGroup = universeSession.UniverseGroup; mainMaps = new ConcurrentDictionary <string, Map>(Environment.ProcessorCount * 2, 4); universeSortedMaps = new ConcurrentDictionary <string, List <Map> >(Environment.ProcessorCount * 2, 4); foreach (Universe universe in UniverseGroup.Universes) { mainMaps.TryAdd(universe.Name, null); universeSortedMaps.TryAdd(universe.Name, new List <Map>()); } workerThread = new Thread(new ThreadStart(worker)); workerThread.Start(); }
public UniverseTable(Screen screen, UniverseGroup universeGroup, Brush backColorBrush) { this.universeGroup = universeGroup; this.screen = screen; this.backColorBrush = backColorBrush; teamTables = new Dictionary <string, UniverseTeamTable>(); UniverseTeamTable teamTable = null; foreach (Team team in universeGroup.Teams) { SolidColorBrush teamColor = SolidColorBrushes.TeamColors[team.Name]; teamTable = new UniverseTeamTable(screen, team, teamColor); teamTables.Add(team.Name, teamTable); } }
/// <summary> /// Joins the passed universe group /// </summary> /// <param name="universeGroup">The desired universe group to join</param> /// <param name="name">The nickname which will be used in the universe</param> /// <param name="team">Team to join in the universe</param> /// <returns>Returns a session of the universe</returns> public UniverseSession Join(UniverseGroup universeGroup, string name, Team team) { if (!connector.IsConnected) { throw new ObjectDisposedException("Connection to Flattiverse was closed"); } if (universeGroup == null || string.IsNullOrWhiteSpace(name) || team == null) { throw new ArgumentNullException("Value is null"); } if (session != null) { throw new InvalidOperationException("Close the current session first before joining a new one"); } messageManager.UniverseGroup = universeGroup; session = new UniverseSession(this, universeGroup, name, team); return(session); }
public Starship(Starbase starBase, UniverseGroup universeGroup) { this.universeGroup = universeGroup; this.starBase = starBase; Random r = new Random(); Name = "Scharle" + r.Next(1000, 2000).ToString(); ship = universeGroup.RegisterShip("ScharleRover", Name); Thread thread = new Thread(shipRotation); thread.Name = "StarShip"; thread.Start(); scanRange = ship.ScannerArea.Limit; scanAngle = ship.ScannerDegreePerScan; shotStartDistance = ship.WeaponSize + ship.Radius - 10; shotSpeed = ship.WeaponShot.Speed.Limit; shotTime = ship.WeaponShot.Time.Limit; }