/// <summary> /// </summary> /// <param name="playfieldNumber"> /// </param> public void CreatePlayfield(int playfieldNumber) { foreach (PlayfieldInfo playfieldInfo in Playfields.Instance.playfields) { if (playfieldInfo.id != playfieldNumber) { continue; } Identity identity = new Identity(); identity.Type = IdentityType.Playfield; identity.Instance = playfieldNumber; IPlayfield playfield = this.CreatePlayfield(identity); foreach (DistrictInfo districtInfo in playfieldInfo.districts) { PlayfieldDistrict playfieldDistrict = new PlayfieldDistrict(); playfieldDistrict.Name = districtInfo.districtName; playfieldDistrict.MinLevel = districtInfo.minLevel; playfieldDistrict.MaxLevel = districtInfo.maxLevel; playfieldDistrict.SuppressionGas = districtInfo.suppressionGas; playfield.Districts.Add(playfieldDistrict); } playfield.X = playfieldInfo.x; playfield.Z = playfieldInfo.z; playfield.XScale = playfieldInfo.xscale; playfield.ZScale = playfieldInfo.zscale; playfield.Expansion = (Expansions)playfieldInfo.expansion; this.playfields.Add(playfield); PlayfieldWorkerHolder playfieldWorkerHolder = new PlayfieldWorkerHolder(); playfieldWorkerHolder.PlayfieldWorker.SetPlayfield(playfield); Thread thread = new Thread(playfieldWorkerHolder.PlayfieldWorker.DoWork); playfieldWorkerHolder.thread = thread; thread.Start(); this.workers.Add(playfieldWorkerHolder); while (!thread.IsAlive) { ; } break; } }
/// <summary> /// </summary> /// <returns> /// </returns> public int CreatePlayfields() { foreach (PlayfieldInfo playfieldInfo in Playfields.Instance.playfields) { if (!playfieldInfo.disabled) { Identity identity = new Identity(); identity.Type = IdentityType.Playfield; identity.Instance = playfieldInfo.id; IPlayfield playfield = this.CreatePlayfield(identity); foreach (DistrictInfo districtInfo in playfieldInfo.districts) { PlayfieldDistrict playfieldDistrict = new PlayfieldDistrict(); playfieldDistrict.Name = districtInfo.districtName; playfieldDistrict.MinLevel = districtInfo.minLevel; playfieldDistrict.MaxLevel = districtInfo.maxLevel; playfieldDistrict.SuppressionGas = districtInfo.suppressionGas; playfield.Districts.Add(playfieldDistrict); } playfield.X = playfieldInfo.x; playfield.Z = playfieldInfo.z; playfield.XScale = playfieldInfo.xscale; playfield.ZScale = playfieldInfo.zscale; playfield.Expansion = (Expansions)playfieldInfo.expansion; this.playfields.Add(playfield); PlayfieldWorkerHolder playfieldWorkerHolder = new PlayfieldWorkerHolder(); playfieldWorkerHolder.PlayfieldWorker.SetPlayfield(playfield); Thread thread = new Thread(playfieldWorkerHolder.PlayfieldWorker.DoWork); thread.Name = "PF" + playfield.Identity.Instance.ToString(); playfieldWorkerHolder.thread = thread; thread.Start(); this.workers.Add(playfieldWorkerHolder); while (!thread.IsAlive) { ; } } } return(this.playfields.Count); }
/// <summary> /// </summary> /// <returns> /// </returns> public int CreatePlayfields() { foreach (PlayfieldInfo playfieldInfo in Playfields.Instance.playfields) { if (!playfieldInfo.disabled) { Identity identity = new Identity(); identity.Type = IdentityType.Playfield; identity.Instance = playfieldInfo.id; IPlayfield playfield = this.CreatePlayfield(identity); foreach (DistrictInfo districtInfo in playfieldInfo.districts) { PlayfieldDistrict playfieldDistrict = new PlayfieldDistrict(); playfieldDistrict.Name = districtInfo.districtName; playfieldDistrict.MinLevel = districtInfo.minLevel; playfieldDistrict.MaxLevel = districtInfo.maxLevel; playfieldDistrict.SuppressionGas = districtInfo.suppressionGas; playfield.Districts.Add(playfieldDistrict); } playfield.X = playfieldInfo.x; playfield.Z = playfieldInfo.z; playfield.XScale = playfieldInfo.xscale; playfield.ZScale = playfieldInfo.zscale; playfield.Expansion = (Expansions)playfieldInfo.expansion; this.playfields.Add(playfield); PlayfieldWorkerHolder playfieldWorkerHolder = new PlayfieldWorkerHolder(); playfieldWorkerHolder.PlayfieldWorker.SetPlayfield(playfield); Thread thread = new Thread(playfieldWorkerHolder.PlayfieldWorker.DoWork); thread.Name = "PF" + playfield.Identity.Instance.ToString(); playfieldWorkerHolder.thread = thread; thread.Start(); this.workers.Add(playfieldWorkerHolder); while (!thread.IsAlive) { ; } } } return this.playfields.Count; }