public bool GetAgelessForeign(MiniSimDescription desc) { if (desc.HomeWorld != WorldName.Undefined && desc.HomeWorld != WorldName.UserCreated) { return(mAgelessForeign.ContainsKey(desc.HomeWorld)); } if (mWorldForSims.ContainsKey(desc.SimDescriptionId)) { string world = mWorldForSims[desc.SimDescriptionId]; string name = world.Replace(".world", ""); WorldName worldName = WorldName.Undefined; try { worldName = unchecked ((WorldName)ResourceUtils.HashString32(name.Replace(" ", ""))); } catch { return(true); } return(mAgelessForeign.ContainsKey(worldName)); } return(true); }
// methods // 构造函数 public World(Vector3 pos, WorldName name) { _worldPos = pos; _name = name; _worldIndex = (int)name; }
public static Sim DGSMakeRandomSimNoCheck(Vector3 point, CASAgeGenderFlags age, CASAgeGenderFlags gender, WorldName worldname) { LotLocation lotLocation = default(LotLocation); ulong lotLocation2 = World.GetLotLocation(point, ref lotLocation); Lot lot = LotManager.GetLot(lotLocation2); SimDescription simDescription2 = DGSMakeSSimDescription(age, gender, worldname, uint.MaxValue); Genetics.AssignRandomTraits(simDescription2); if (lot != null) { if (lot.Household == null) { Household household = Household.Create(); lot.MoveIn(household); } lot.Household.Add(simDescription2); } else { Household household2 = Household.Create(); household2.SetName(/* "E3Lesa is Good" */ "Good Household"); household2.Add(simDescription2); } WorldName currentWorld = worldname; simDescription2.FirstName = SimUtils.GetRandomGivenName(simDescription2.IsMale, currentWorld); simDescription2.LastName = SimUtils.GetRandomFamilyName(currentWorld); return(simDescription2.Instantiate(point)); }
public WorldName GetHomeWorld(IMiniSimDescription desc) { if (desc == null) { return(WorldName.Undefined); } if (desc.HomeWorld != WorldName.Undefined && desc.HomeWorld != WorldName.UserCreated) { return(desc.HomeWorld); } if (!mWorldForSims.ContainsKey(desc.SimDescriptionId)) { return(WorldName.Undefined); } string world = mWorldForSims[desc.SimDescriptionId]; string name = world.Replace(".world", ""); WorldName worldName = WorldName.Undefined; try { worldName = unchecked ((WorldName)ResourceUtils.HashString32(name.Replace(" ", ""))); } catch { return(WorldName.Undefined); } return(worldName); }
public static List <MiniSimDescription> GetVacationWorldSimDescriptions() { Dictionary <ulong, SimDescription> allSims = SimListing.GetResidents(false); List <MiniSimDescription> list = new List <MiniSimDescription>(); if (MiniSimDescription.sMiniSims != null) { WorldName currentWorld = GameUtils.GetCurrentWorld(); foreach (MiniSimDescription description in MiniSimDescription.sMiniSims.Values) { // Added to allow for Traveler miniSims if ((description.HomeWorld == WorldName.UserCreated) && (currentWorld == WorldName.UserCreated)) { if (allSims.ContainsKey(description.SimDescriptionId)) { continue; } list.Add(description); } else if (GameUtils.GetWorldType(description.HomeWorld) == WorldType.Vacation) { list.Add(description); } else if (GameUtils.GetWorldType(description.HomeWorld) == WorldType.Future) { list.Add(description); } } } return(list); }
/// <summary> /// Applies the current camera tuning values /// to the game engine's scene manager's cameras. /// </summary> /// <param name="type">Camera Controller Type</param> /// <param name="worldName">World Type</param> public static void Load(Sims3.CSHost.Camera.CameraControllerType type, WorldName worldName) { switch (type) { case Sims3.CSHost.Camera.CameraControllerType.WorldEdit: bool kFlyConstantHeight = CameraTuning.kFlyConstantHeight; float[] vars = new float[] { kFlyMoveDefaultSpeed, kFlyMoveBoostSpeed, kFlyZoomDefaultSpeed, kFlyZoomBoostSpeed, kFlyTurnDefaultSpeed *Deg2Rad, kFlyTurnBoostSpeed *Deg2Rad, kFlyMinZoom, kFlyMaxZoom }; Sims3.CSHost.Camera.LoadTuning((uint)type, vars, kFlyConstantHeight); break; case Sims3.CSHost.Camera.CameraControllerType.InGame: LoadInGame(worldName); break; } }
protected static void CloneResidentRole(Role.RoleType type, WorldName world) { RoleData data = RoleData.GetData(type, world, true); if (data == null) { return; } if (data.FillRoleFrom != Role.RoleFillFrom.Townies) { return; } RoleData r = CloneRole(data, world, Role.RoleFillFrom.Residents); if (r == null) { return; } Dictionary <Role.RoleType, RoleData> dictionary; if (!RoleData.sData.TryGetValue(r.World, out dictionary)) { dictionary = new Dictionary <Role.RoleType, RoleData>(); RoleData.sData.Add(r.World, dictionary); } dictionary.Remove(r.Type); dictionary.Add(r.Type, r); }
protected override OptionResult Run(GameHitParameters <GameObject> parameters) { if (!AcceptCancelDialog.Show(Common.Localize(GetTitlePrefix() + ":Prompt"))) { return(OptionResult.Failure); } // Store for later use List <SimDescription> sims = new List <SimDescription>(GameStates.TravelHousehold.AllSimDescriptions); GameStates.sTravelData = null; WorldData.SetVacationWorld(false, true); WorldName currentWorld = GameUtils.GetCurrentWorld(); foreach (SimDescription sim in sims) { MiniSimDescription miniSim = MiniSimDescription.Find(sim.SimDescriptionId); if (miniSim != null) { miniSim.mHomeWorld = currentWorld; } sim.mHomeWorld = currentWorld; } if (Sim.ActiveActor != null) { (Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel).OnSimAgeChanged(Sim.ActiveActor.ObjectId); } return(OptionResult.SuccessClose); }
public SpeedInterval(WorldName world, List<DaysOfTheWeek> days, int start, int end, int speed) { mWorld = world; mDays = days; mStartHour = start; mEndHour = end; mSpeed = speed; }
public SpeedInterval() { mWorld = GameUtils.GetCurrentWorld(); mDays = new List<DaysOfTheWeek>(sAllDays); mStartHour = 0; mEndHour = 24; mSpeed = Relativity.sOneMinute; }
public void OnWorldQuit() { ResetWorldType(); mOldHouse = null; sPreviousWorld = WorldName.Undefined; }
public void Import(Persistence.Lookup settings) { mWorld = settings.GetEnum <WorldName>("World", GameUtils.GetCurrentWorld()); mDays = ParserFunctions.ParseDayList(settings.GetString("Days")); mStartHour = settings.GetInt("StartHour", 0); mEndHour = settings.GetInt("EndHour", 24); mSpeed = settings.GetInt("Speed", Relativity.sOneMinute); }
//public static void // 世界切换 public static void SwitchWorldCamera(WorldName targetWorld) { Debug.Log("-- Func : CameraManager.SwitchWorldCamera --"); Vector3 dis = WorldManager.GetWorldPos(targetWorld) - WorldManager.GetPrevWorld().WorldPos; TranslateMainCamera(dis, Space.World); }
public SpeedInterval() { mWorld = GameUtils.GetCurrentWorld(); mDays = new List <DaysOfTheWeek>(sAllDays); mStartHour = 0; mEndHour = 24; mSpeed = Relativity.sOneMinute; }
public SpeedInterval(WorldName world, List <DaysOfTheWeek> days, int start, int end, int speed) { mWorld = world; mDays = days; mStartHour = start; mEndHour = end; mSpeed = speed; }
public static SimDescription MakeDescendant(SimDescription dad, SimDescription mom, SimDescription robotDad, SimDescription robotMom, CASAgeGenderFlags age, CASAgeGenderFlags gender, float averageMood, Random pregoRandom, bool interactive, bool updateGenealogy, bool setName, WorldName homeWorld, bool plantSimBaby) { return(MakeDescendant(dad, mom, robotDad, robotMom, age, gender, averageMood, pregoRandom, interactive, updateGenealogy, setName, homeWorld, plantSimBaby, new Pregnancy.BabyCustomizeData { IsBabyCustomized = false })); }
public HomeworldReversion(SimDescription sim) { mSim = sim; if (sim != null) { mOldWorld = sim.HomeWorld; sim.mHomeWorld = WorldName.UserCreated; } }
public World(float x, float y, float z, WorldName name) { _worldPos.x = x; _worldPos.y = y; _worldPos.z = z; _name = name; _worldIndex = (int)name; }
// 切换世界 public void SwitchToWorld(WorldName name) { if ((int)name < 0 || (int)name >= WorldConstants.WORLDS_NUM) { Debug.Log("Error : Switch World Failed - worldIndex out of range. World name: " + name); return; } AttachedGameObject.GetComponent <PlayerMove>().MoveToWorld(name); }
public DestinationInfoEx(string image, string name, string description, string confirmImage, string confirmDescription, int index, WorldName worldName) { mImage = image; mName = name; mDescription = description; mConfirmImage = confirmImage; mConfirmDescription = confirmDescription; mIndex = index; mWorldName = worldName; }
public HomeworldReversion(SimDescription sim) { mSim = sim; mOriginal = mSim.HomeWorld; if (!GameUtils.IsOnVacation()) { mSim.mHomeWorld = GameUtils.GetCurrentWorld(); } }
public static bool HasLegendaryPerkUp(this IMissionX m, WorldName world) { var rslt = m.FindNormalItemById("Reagent_Alteration_Upgrade_SR", world); m.SetOrderNumber(rslt, 4); if (m.IsGroupMission) { m.SetOrderNumber(rslt, 3); } return(rslt); }
public bool GetAgelessForeign(MiniSimDescription desc) { WorldName name = GetHomeWorld(desc as IMiniSimDescription); if (name != WorldName.Undefined) { return(mAgelessForeign.ContainsKey(name)); } return(true); }
public override string GetLocalizedValue(WorldName value) { string result; if (sWorlds.TryGetValue(value, out result)) { return(result); } return(value.ToString()); }
// 设置当前的世界编号,成功返回当前世界编号,失败返回-1 public static int SetCurrentWorldIndex(int index) { if (index >= 0 && index < WorldConstants.WORLDS_NUM) { _currentWorld = (WorldName)index; return(index); } else { return(-1); } }
public static string GetWorldFile(WorldName worldName) { WorldNameData data; if (sData.TryGetValue(worldName, out data)) { return(data.mWorldFile); } else { return(null); } }
protected override bool Allow(WorldName value) { switch (value) { case WorldName.China: case WorldName.France: case WorldName.Egypt: case WorldName.UserCreated: return(true); } return(false); }
public World(Vector3 pos, int index) { if (index < 0 || index >= WorldConstants.WORLDS_NUM) { Debug.Log("Error : index out of range @ World constructor."); return; } _worldPos = pos; _name = (WorldName)index; _worldIndex = index; }
private static void OneDayPassedVacationUpdates(Household ths) { if (GameStates.CurrentDayOfTrip == GameStates.TripLength) { if (!GameStates.IsTravelling) { StyledNotification.Format format = new StyledNotification.Format(Common.LocalizeEAString("Gameplay/Vacation:OneDayLeft"), StyledNotification.NotificationStyle.kSystemMessage); StyledNotification.Show(format); } ths.mLastDayAlarm = AlarmManager.Global.AddAlarm(SimClock.HoursUntil(12f), TimeUnit.Hours, ths.HalfDayLeft, "Half Day left TNS", AlarmType.AlwaysPersisted, ths); } else if (GameStates.CurrentDayOfTrip > GameStates.TripLength) { bool denyTravel = false; if (!GameStates.IsTravelling) { foreach (Sim sim in Households.AllSims(ths)) { sim.VisaManager.UpdateDaysSpentInWorld(GameUtils.GetCurrentWorld(), GameStates.CurrentDayOfTrip - 0x1); if (sim.IsDying()) { denyTravel = true; } } } if (!denyTravel) { GameStates.StopSnappingPicturesIfNeccessary(); Sims3.Gameplay.UI.HudModel hudModel = Sims3.Gameplay.UI.Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel; if (hudModel != null) { WorldName currentWorld = GameUtils.GetCurrentWorld(); string str = hudModel.LocationName(currentWorld); SimpleMessageDialog.Show(TravelUtil.LocalizeString("TripOverCaption", new object[0x0]), TravelUtil.LocalizeString("TripOverText", new object[] { str }), ModalDialog.PauseMode.PauseSimulator); } } if (!denyTravel) { Traveler.SaveGame(); TravelUtil.PlayerMadeTravelRequest = true; // Calls custom function GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld(); } } }
public static Sim DGSMakeRandomSim(Vector3 point, CASAgeGenderFlags age, CASAgeGenderFlags gender, WorldName worldname) { LotLocation lotLocation = default(LotLocation); ulong lotLocation2 = World.GetLotLocation(point, ref lotLocation); Lot lot = LotManager.GetLot(lotLocation2); if ((age & (CASAgeGenderFlags.Baby | CASAgeGenderFlags.Toddler | CASAgeGenderFlags.Child)) != CASAgeGenderFlags.None) { bool flag = false; if (lot != null && lot.Household != null) { foreach (SimDescription simDescription in lot.Household.SimDescriptions) { if (simDescription.TeenOrAbove) { flag = true; break; } } } if (!flag) { return(null); } } SimDescription simDescription2 = DGSMakeSSimDescription(age, gender, worldname, uint.MaxValue); Genetics.AssignRandomTraits(simDescription2); if (lot != null) { if (lot.Household == null) { Household household = Household.Create(); household.Name = simDescription2.mLastName ?? ""; lot.MoveIn(household); } lot.Household.Add(simDescription2); } else { Household household2 = Household.Create(); household2.SetName(/* "E3Lesa is Good" */ "Good Household"); household2.Add(simDescription2); } WorldName currentWorld = worldname; simDescription2.FirstName = SimUtils.GetRandomGivenName(simDescription2.IsMale, currentWorld); simDescription2.LastName = SimUtils.GetRandomFamilyName(currentWorld); return(simDescription2.Instantiate(point)); }
public World(float x, float y, float z, int index) { if (index < 0 || index >= WorldConstants.WORLDS_NUM) { throw new System.IndexOutOfRangeException("IIndexOutOfRangeException @ World constructor."); } _worldPos.x = x; _worldPos.y = y; _worldPos.z = z; _name = (WorldName)index; _worldIndex = index; }
public static bool GetLoadFileName(WorldName world, bool useTravelData) { WorldNameData data = null; if (sData.TryGetValue(world, out data)) { GameStates.GetLoadFileName(data.mWorldFile, data.mSaveFile, useTravelData); return(true); } else { return(false); } }
public BaseWorldReversion() { mPreviousCheatOverride = GameUtils.CheatOverrideCurrentWorld; mPreviousWorldType = GameUtils.GetCurrentWorldType(); switch (mPreviousWorldType) { case WorldType.Vacation: case WorldType.University: case WorldType.Future: GameUtils.CheatOverrideCurrentWorld = GameUtils.GetCurrentWorld(); GameUtils.WorldNameToType[GameUtils.CheatOverrideCurrentWorld] = WorldType.Base; mAltered = true; break; } }
private static bool CanMoveWorldsInternal(Sim actor, bool testFamilyPregnancy, WorldName worldName, bool ignoreCertainTransformBuffs, bool testMoveRequested, ref GreyedOutTooltipCallback callback) { if ((actor == null) || GameUtils.IsOnVacation() || actor.BuffManager.HasElement(BuffNames.HeartOfGold) || (Household.RoommateManager.IsNPCRoommate(actor))) { return false; } CommonSpace.Helpers.TravelUtilEx.Type filter = Traveler.Settings.mTravelFilter; if (testFamilyPregnancy) { filter &= ~CommonSpace.Helpers.TravelUtilEx.Type.Pregnant; } string reason = CommonSpace.Helpers.TravelUtilEx.CheckForReasonsToFailTravel(actor.SimDescription, filter, worldName, false, testMoveRequested); if (!string.IsNullOrEmpty(reason)) { callback = delegate { return reason; }; return false; } return true; }
public static bool FinalBoardingCall(Household travelingHousehold, List<Sim> allTravelers, WorldName worldName, bool isWorldMove, ref string reason) { foreach (Sim sim in allTravelers) { reason = CommonSpace.Helpers.TravelUtilEx.CheckForReasonsToFailTravel(sim.SimDescription, Traveler.Settings.mTravelFilter, worldName, isWorldMove, false); if (!string.IsNullOrEmpty(reason)) { return false; } /* if (sim.Household != travelingHousehold) { reason = "Not in Household: " + sim.FullName; return false; } */ } reason = null; return true; }
public static string GetWorldFile(WorldName worldName) { WorldNameData data; if (sData.TryGetValue(worldName, out data)) { return data.mWorldFile; } else { return null; } }
public string LocationName(WorldName world) { return mHudModel.LocationName(world); }
public static string GetLocationName(WorldName world) { string key = "Gameplay/Visa/TravelUtil:" + world + "Full"; if (Localization.HasLocalizationString(key)) { return Common.LocalizeEAString(key); } else { WorldNameData data; if (sData.TryGetValue(world, out data)) { return data.mDestinationInfoName; } else { return key; } } }
public static void SetPreviousWorld() { sPreviousWorld = GameUtils.GetCurrentWorld(); }
public string LocationName(WorldName world, bool fullName) { return mHudModel.LocationName(world, fullName); }
public bool GetHiddenWorlds(WorldName world) { return mHiddenWorlds.ContainsKey(world); }
public static void TravelToVacationWorld(WorldName newWorldName, List<ulong> travelerIds, int tripLength, int numDaysSinceLastInDestWorld) { GameStates.StopOperationsThatCannotTravel(); GameStates.TravelData origTravelData = GameStates.sTravelData; if (origTravelData == null) { if (newWorldName == WorldName.FutureWorld) { CauseEffectService.GetInstance().PreFutureWorldLoadProcess(); FutureDescendantServiceEx.BuildDescendantHouseholdSpecs(FutureDescendantService.GetInstance()); } } GameStates.sTravelData = new GameStates.TravelData(); GameStates.sIsChangingWorlds = true; GameStates.sTravelData.mState = GameStates.TravelData.TravelState.StartVacation; if (origTravelData != null) { GameStates.sTravelData.mHomeWorld = origTravelData.mHomeWorld; GameStates.sTravelData.mHomeWorldMetadataName = origTravelData.mHomeWorldMetadataName; GameStates.sTravelData.mTimeInHomeworld = origTravelData.mTimeInHomeworld; GameStates.sTravelData.mRealEstateManager = origTravelData.mRealEstateManager; GameStates.sTravelData.mNumDaysSinceLastInDestWorld = origTravelData.mNumDaysSinceLastInDestWorld; } else { GameStates.sTravelData.mHomeWorld = GameStates.GetCurrentWorldName(true); GameStates.sTravelData.mHomeWorldMetadataName = GameStates.GetCurrentWorldName(false); GameStates.sTravelData.mTimeInHomeworld = SimClock.CurrentTime(); GameStates.sTravelData.mRealEstateManager = Household.ActiveHousehold.RealEstateManager; GameStates.sTravelData.mRealEstateManager.SavePropertyNamesForTravel(); GameStates.sTravelData.mNumDaysSinceLastInDestWorld = numDaysSinceLastInDestWorld; } GameStates.sTravelData.mTravelerIds = travelerIds; GameStates.sTravelData.mDestWorld = newWorldName; GameStates.sTravelData.mTripLength = tripLength; GameStates.sTravelData.mCurrentDayOfTrip = 1; if (AgingManager.NumberAgingYearsElapsed != -1f) { GameStates.sTravelData.mNumberAgingYearsElapsed = AgingManager.NumberAgingYearsElapsed; } else { GameStates.sTravelData.mNumberAgingYearsElapsed = 0f; } List<SimDescription> sims = new List<SimDescription>(Households.All(Household.ActiveHousehold)); Dictionary<ulong,SimDescription> lookup = SimListing.GetResidents(false); foreach (ulong id in travelerIds) { SimDescription sim; if (!lookup.TryGetValue(id, out sim)) continue; if (sims.Contains(sim)) continue; sims.Add(sim); } CrossWorldControl.sRetention.OnSwitchWorlds(sims); CrossWorldControl.Store(sims); Common.FunctionTask.Perform(SwitchWorlds); }
public void PlayLoadLoopAudio(WorldName world) { mHudModel.PlayLoadLoopAudio(world); }
protected static RoleData CloneRole(RoleData data, WorldName world, Role.RoleFillFrom fillType) { RoleData.ConstructorData conData = new RoleData.ConstructorData(); conData.World = world; conData.Type = data.mType; conData.MaxSpecCount = data.mMaxSpecCount; conData.MidSpecCount = data.mMidSpeCount; conData.MinSpecCount = data.mMinSpecCount; conData.StartTime = data.mStartTime; conData.EndTime = data.mEndTime; conData.AgeSpecies = data.mAgeSpecies;// | CASAgeGenderFlags.YoungAdult | CASAgeGenderFlags.Adult | CASAgeGenderFlags.Elder; conData.Motives = data.mMotives; conData.FillRollFrom = fillType; conData.ValidProductVersion = data.mValidProductVersion; conData.MotivesToFreeze = data.mMotivesToFreeze; conData.UseHoverbot = data.mUseHoverbot; conData.UseServobot = data.mUseServobot; conData.MaleUniform = null; conData.FemaleUniform = null; conData.MaleUniformElder = null; conData.FemaleUniformElder = null; conData.FutureWorldMaleUniform = null; conData.FutureWorldFemaleUniform = null; conData.FutureWorldMaleUniformElder = null; conData.FutureWorldFemaleUniformElder = null; RoleData r = new RoleData(conData); r.mFemaleUniform = data.mFemaleUniform; r.mFemaleUniformElder = data.mFemaleUniformElder; r.mMaleUniform = data.mMaleUniform; r.mMaleUniformElder = data.mMaleUniformElder; r.mFutureWorldFemaleUniform = data.mFutureWorldFemaleUniform; r.mFutureWorldFemaleUniformElder = data.mFutureWorldFemaleUniformElder; r.mFutureWorldMaleUniform = data.mFutureWorldMaleUniform; r.mFutureWorldMaleUniformElder = data.mFutureWorldMaleUniformElder; return r; }
public bool GetAgelessForeign(WorldName world) { return mAgelessForeign.ContainsKey(world); }
public int GetVisaLevel(WorldName world) { return mHudModel.GetVisaLevel(world); }
public void Import(Persistence.Lookup settings) { mWorld = settings.GetEnum<WorldName>("World", GameUtils.GetCurrentWorld()); mDays = ParserFunctions.ParseDayList(settings.GetString("Days")); mStartHour = settings.GetInt("StartHour", 0); mEndHour = settings.GetInt("EndHour", 24); mSpeed = settings.GetInt("Speed", Relativity.sOneMinute); }
protected static void CloneResidentRole(Role.RoleType type, WorldName world) { RoleData data = RoleData.GetData(type, world, true); if (data == null) return; if (data.FillRoleFrom != Role.RoleFillFrom.Townies) return; RoleData r = CloneRole(data, world, Role.RoleFillFrom.Residents); if (r == null) return; Dictionary<Role.RoleType, RoleData> dictionary; if (!RoleData.sData.TryGetValue(r.World, out dictionary)) { dictionary = new Dictionary<Role.RoleType, RoleData>(); RoleData.sData.Add(r.World, dictionary); } dictionary.Remove(r.Type); dictionary.Add(r.Type, r); }
public static bool GetLoadFileName(WorldName world, bool useTravelData) { WorldNameData data = null; if (sData.TryGetValue(world, out data)) { GameStates.GetLoadFileName(data.mWorldFile, data.mSaveFile, useTravelData); return true; } else { return false; } }
public string SmallLocationIconName(WorldName world) { return mHudModel.SmallLocationIconName(world); }