private void _maintainPrePregnanciesInfo() { List <Hero> heroList = new List <Hero>(); using (Dictionary <Hero, PregnancyControlBehavior.PrePregnancyInfo> .Enumerator enumerator = this.m_prePregnancyInfoMap.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <Hero, PregnancyControlBehavior.PrePregnancyInfo> current = enumerator.Current; if (!current.Key.IsDead && current.Key.IsPregnant == false) { CampaignTime pregnantDate = current.Value.m_pregnantDate; } else { heroList.Add(current.Key); } } } using (List <Hero> .Enumerator enumerator = heroList.GetEnumerator()) { while (enumerator.MoveNext()) { Hero current = enumerator.Current; this.m_prePregnancyInfoMap.Remove(current); Utillty.DebugDisplayMessage("_checkAddNewPregnancies Remove! Mother : " + ((object)current.Name).ToString()); } } }
private static void _removeAbortionMotherInHeroPregnancies(Hero hero) { if (hero == null) { return; } PregnancyControlBehavior pregnancyControlInst = Utillty.GetPregnancyControlBehaviorInstance(); if (pregnancyControlInst == null || !pregnancyControlInst.PreAbortionMap.ContainsKey(hero)) { return; } object pregnanciesObject = PregCampHelper.GetHeroPregnanciesObject(); if (pregnanciesObject == null) { return; } MethodInfo pregnanciesMethodInfo = PregCampHelper.GetHeroPregnanciesMethodInfo("RemoveAll"); if (pregnanciesMethodInfo == (MethodInfo)null) { return; } Predicate <object> predicate = (Predicate <object>)(pregnancyObj => PregnancyCheckOffspringsToDeliverPatch._removeAbortionMotherPredicate(ref pregnancyControlInst, hero, pregnancyObj)); Utillty.DebugDisplayMessage("_removeAbortionMotherInHeroPregnancies Success! RemoveNums : " + ((int)pregnanciesMethodInfo.Invoke(pregnanciesObject, new object[1] { (object)predicate })).ToString()); pregnancyControlInst.CleanPreAbortionList(); }
public void RecordPreAbortion(Hero mother, Hero caused) { if (mother == null || !PregCampHelper.IsInPregnancies(mother, (Hero)null) || this.m_preAbortionMap.ContainsKey(mother)) { return; } this.m_preAbortionMap.Add(mother, caused); Utillty.DebugDisplayMessage("_recordAbortion Success! Mother : " + ((object)mother.Name).ToString()); }
private static void _getRealParentsInCurPregnancy(Hero mother) { if (mother == null) { return; } PregnancyControlBehavior behaviorInstance = Utillty.GetPregnancyControlBehaviorInstance(); if (behaviorInstance == null) { return; } Hero fatherInCurPregnancy = behaviorInstance.GetRealFatherInCurPregnancy(mother); PregnancyChildConceivedPatch.m_father = fatherInCurPregnancy != mother.Spouse ? fatherInCurPregnancy : (Hero)null; PregnancyChildConceivedPatch.m_mother = PregnancyChildConceivedPatch.m_father != null ? mother : (Hero)null; Utillty.DebugDisplayMessage("_getRealParentsInCurPregnancy End!"); }
private void _addPregCtrlClanLayer(TutorialContextChangedEvent tccEvent) { if (tccEvent.NewContext != TutorialContexts.ClanScreen) { return; } GauntletLayer screenGauntletLayer = UIHelper.GetClanScreenGauntletLayer(); if (screenGauntletLayer == null) { return; } this.m_pregContClanVM = new PregnancyControlClanVM(); if (((List <Tuple <GauntletMovie, ViewModel> >)screenGauntletLayer._moviesAndDatasources).FindIndex((Predicate <Tuple <GauntletMovie, ViewModel> >)(obj => string.Equals(obj.Item1.MovieName, this.m_sPregCtrlClanXmlName))) >= 0) { return; } screenGauntletLayer.LoadMovie("PregnancyControlClan", (ViewModel)this.m_pregContClanVM); Utillty.DebugDisplayMessage("_addPregCtrlClanLayer Add Layer Success!"); }
public void RecordPrePregnantInfo(Hero sexPartner1, Hero sexPartner2) { if ((double)MBRandom.RandomFloatRanged(0.0f, 1f) > (double)Config.Instance.PregnancyProbability || sexPartner1 == null || sexPartner2 == null || !Config.Instance.EnableLesbianPregnancy && sexPartner1.IsFemale && sexPartner2.IsFemale) { return; } Hero key = (Hero)null; Hero father = (Hero)null; if (sexPartner1.IsAlive && sexPartner1.IsFemale && (sexPartner1.IsPregnant == false && (double)sexPartner1.Age > (double)Config.Instance.MinAge)) { key = sexPartner1; father = sexPartner2; } if (sexPartner2.IsAlive && sexPartner2.IsFemale && (sexPartner2.IsPregnant == false && (double)sexPartner2.Age > (double)Config.Instance.MinAge) && (key == null || MBRandom.RandomInt(0, 1) == 0)) { key = sexPartner2; father = sexPartner1; } if (key == null || father == null) { return; } CampaignTime pregnantDate = CampaignTime.DaysFromNow((float)MBRandom.RandomInt(Config.Instance.MinPregnancyDelayDays, Config.Instance.MaxPregnancyDelayDays)); if (this.m_prePregnancyInfoMap.ContainsKey(key)) { if (this.m_prePregnancyInfoMap[key].m_pregnantDate > pregnantDate) { this.m_prePregnancyInfoMap[key].m_father = father; this.m_prePregnancyInfoMap[key].m_pregnantDate = pregnantDate; } } else { this.m_prePregnancyInfoMap.Add(key, new PregnancyControlBehavior.PrePregnancyInfo(father, pregnantDate)); } Utillty.DebugDisplayMessage("_recordPrePregnantInfo Success! Mother : " + ((object)key.Name).ToString() + " Father : " + ((object)father.Name).ToString() + " PregnantDate : " + pregnantDate.ToString()); }
private static void _changeFatherInCurPregnancy() { if (PregnancyChildConceivedPatch.m_mother == null || PregnancyChildConceivedPatch.m_father == null) { return; } IEnumerable pregnanciesObject = (IEnumerable)PregCampHelper.GetHeroPregnanciesObject(); if (pregnanciesObject == null) { return; } foreach (object pregnancyObj in pregnanciesObject) { if (PregCampHelper.GetPregnancyMother(pregnancyObj) == PregnancyChildConceivedPatch.m_mother) { PregCampHelper.SetPregnancyFather(pregnancyObj, PregnancyChildConceivedPatch.m_father); Utillty.DebugDisplayMessage("_changeFatherInCurPregnancy Make Pregnant! Mother : " + ((object)PregnancyChildConceivedPatch.m_mother.Name).ToString() + " Father : " + ((object)PregnancyChildConceivedPatch.m_father.Name).ToString()); break; } } }
public void RecordSexInfo(Hero sexPartner1, Hero sexPartner2) { if (sexPartner1 == null || sexPartner1.IsDead || (sexPartner2 == null || sexPartner2.IsDead)) { return; } CampaignTime nextSexEnableDate = CampaignTime.DaysFromNow((float)MBRandom.RandomInt(Config.Instance.MinSexDelayDays, Config.Instance.MaxSexDelayDays)); if (this.m_dailySexTimeCountMap.ContainsKey(sexPartner1)) { ++this.m_dailySexTimeCountMap[sexPartner1]; } else { this.m_dailySexTimeCountMap.Add(sexPartner1, 1); } if (this.m_dailySexTimeCountMap.ContainsKey(sexPartner2)) { ++this.m_dailySexTimeCountMap[sexPartner2]; } else { this.m_dailySexTimeCountMap.Add(sexPartner2, 1); } int index = this.m_sexInformationList.FindIndex((Predicate <PregnancyControlBehavior.SexInfo>)(info => info.m_sexPartner1 == sexPartner1 && info.m_sexPartner2 == sexPartner2 || info.m_sexPartner2 == sexPartner1 && info.m_sexPartner1 == sexPartner2)); if (index >= 0) { this.m_sexInformationList[index].m_nextSexEnableDate = (this.m_sexInformationList[index].m_nextSexEnableDate >= nextSexEnableDate) ? this.m_sexInformationList[index].m_nextSexEnableDate : nextSexEnableDate; } else { this.m_sexInformationList.Add(new PregnancyControlBehavior.SexInfo(sexPartner1, sexPartner2, nextSexEnableDate)); } Utillty.DebugDisplayMessage("_recordSexInfo Success! Partner1 : " + ((object)sexPartner1.Name).ToString() + " Partner2 : " + ((object)sexPartner2.Name).ToString() + " NexSexEnableDate : " + nextSexEnableDate.ToString()); }
public void CleanPreAbortionList() { this.m_preAbortionMap.Clear(); Utillty.DebugDisplayMessage("CleanPreAbortionList Success!"); }