public override IEnumerable <string> ConfigErrors() { if (scenario == null) { yield return("null scenario"); } foreach (string item in scenario.ConfigErrors()) { yield return(item); } }
public override IEnumerable <string> ConfigErrors() { if (scenario == null) { yield return("null scenario"); /*Error: Unable to find new state assignment for yield return*/; } using (IEnumerator <string> enumerator = scenario.ConfigErrors().GetEnumerator()) { if (enumerator.MoveNext()) { string se = enumerator.Current; yield return(se); /*Error: Unable to find new state assignment for yield return*/; } } yield break; IL_00f1: /*Error near IL_00f2: Unexpected return in MoveNext()*/; }
public static Scenario GenerateNewRandomScenario(string seed) { Rand.PushState(); Rand.Seed = seed.GetHashCode(); int @int = Rand.Int; int[] array = new int[10]; for (int i = 0; i < array.Length; i++) { array[i] = Rand.Int; } int int2 = Rand.Int; scen = new Scenario(); scen.Category = ScenarioCategory.CustomLocal; scen.name = NameGenerator.GenerateName(RulePackDefOf.NamerScenario); scen.description = null; scen.summary = null; Rand.Seed = @int; scen.playerFaction = (ScenPart_PlayerFaction)MakeScenPart(ScenPartDefOf.PlayerFaction); scen.parts.Add(MakeScenPart(ScenPartDefOf.ConfigPage_ConfigureStartingPawns)); scen.parts.Add(MakeScenPart(ScenPartDefOf.PlayerPawnsArriveMethod)); Rand.Seed = array[0]; AddCategoryScenParts(scen, ScenPartCategory.PlayerPawnFilter, Rand.RangeInclusive(-1, 2)); Rand.Seed = array[1]; AddCategoryScenParts(scen, ScenPartCategory.StartingImportant, Rand.RangeInclusive(0, 2)); Rand.Seed = array[2]; AddCategoryScenParts(scen, ScenPartCategory.PlayerPawnModifier, Rand.RangeInclusive(-1, 2)); Rand.Seed = array[3]; AddCategoryScenParts(scen, ScenPartCategory.Rule, Rand.RangeInclusive(-2, 3)); Rand.Seed = array[4]; AddCategoryScenParts(scen, ScenPartCategory.StartingItem, Rand.RangeInclusive(0, 6)); Rand.Seed = array[5]; AddCategoryScenParts(scen, ScenPartCategory.WorldThing, Rand.RangeInclusive(-3, 6)); Rand.Seed = array[6]; AddCategoryScenParts(scen, ScenPartCategory.GameCondition, Rand.RangeInclusive(-1, 2)); Rand.Seed = int2; foreach (ScenPart allPart in scen.AllParts) { allPart.Randomize(); } for (int j = 0; j < scen.parts.Count; j++) { for (int k = 0; k < scen.parts.Count; k++) { if (j != k && scen.parts[j].TryMerge(scen.parts[k])) { scen.parts.RemoveAt(k); k--; if (j > k) { j--; } } } } for (int l = 0; l < scen.parts.Count; l++) { for (int m = 0; m < scen.parts.Count; m++) { if (l != m && !scen.parts[l].CanCoexistWith(scen.parts[m])) { scen.parts.RemoveAt(m); m--; if (l > m) { l--; } } } } foreach (string item in scen.ConfigErrors()) { Log.Error(item); } Rand.PopState(); Scenario result = scen; scen = null; return(result); }