/// <summary> /// Show one quest message from active quests. /// </summary> public override void OnLoadingScreen(PlayerEnterExit.TransitionEventArgs args) { loadingSave = false; if (string.IsNullOrEmpty(questMessage = GetQuestMessage())) { questMessage = defaultquestMessage; } }
/// <summary> /// Get ExteriorTransition & DungeonExteriorTransition events from PlayerEnterExit /// </summary> /// <param name="args"></param> public void ExteriorTransitionEvent(PlayerEnterExit.TransitionEventArgs args) //player transitioned to exterior from indoors or dungeon { _stopWatch.Stop(); TimeInside = _stopWatch.Elapsed.Minutes; if (EnhancedSkyCurrentToggle) { ToggleSkyObjects(true); //enable sky objects } }
private void OnTransitionToDungeonExterior(PlayerEnterExit.TransitionEventArgs args) { if (args.TransitionType == PlayerEnterExit.TransitionType.ToDungeonExterior) { DeactivateDevice(); RemoveActiveDevices(GameManager.Instance.PlayerEntity.Items); RemoveActiveDevices(GameManager.Instance.PlayerEntity.WagonItems); } }
private static void OnTransitionInterior_GiveTempWagon(PlayerEnterExit.TransitionEventArgs args) { if (WagonDeployed && CurrentMapPixel.Y == WagonMapPixel.Y && CurrentMapPixel.X == WagonMapPixel.X) { WagonClose = true; DaggerfallUnityItem wagon = ItemBuilder.CreateItem(ItemGroups.Transportation, (int)Transportation.Small_cart); wagon.value = 0; GameManager.Instance.PlayerEntity.Items.AddItem(wagon); } }
private static void RemoveVanillaLightSources(PlayerEnterExit.TransitionEventArgs args) { DungeonLightHandler[] dfLights = (DungeonLightHandler[])FindObjectsOfType(typeof(DungeonLightHandler)); //Get all dungeon lights in the scene for (int i = 0; i < dfLights.Length; i++) { if (dfLights[i].gameObject.name.StartsWith("DaggerfallLight [Dungeon]")) { Destroy(dfLights[i].gameObject); } } }
private static void OnTransitionInterior_PlaceMounts(PlayerEnterExit.TransitionEventArgs args) { if (Horse != null) { Horse.SetActive(false); } if (Wagon != null) { Wagon.SetActive(false); } }
private static void OnTransitionExterior_HeightExitCorrection(PlayerEnterExit.TransitionEventArgs args) { if (HorseDeployed) { NeedToGroundHorse = true; } if (WagonDeployed) { NeedToGroundWagon = true; } }
private static void AddVanillaLightToLightSources(PlayerEnterExit.TransitionEventArgs args) { DaggerfallBillboard[] lightBillboards = (DaggerfallBillboard[])FindObjectsOfType(typeof(DaggerfallBillboard)); //Get all "light emitting objects" in the dungeon foreach (DaggerfallBillboard billBoard in lightBillboards) { if (billBoard.Summary.Archive == 210) { GameObject lightsNode = new GameObject("Lights"); lightsNode.transform.parent = billBoard.transform; AddLight(DaggerfallUnity.Instance, billBoard.transform.gameObject, lightsNode.transform); } } }
private static void OnTransitionToInterior_VariantShopTavernNPCsprites(PlayerEnterExit.TransitionEventArgs args) { PlayerEnterExit playerEnterExit = GameManager.Instance.PlayerEnterExit; DFLocation.BuildingData buildingData = playerEnterExit.Interior.BuildingData; if (buildingData.BuildingType == DFLocation.BuildingTypes.Tavern || RMBLayout.IsShop(buildingData.BuildingType)) { Billboard[] dfBillboards = playerEnterExit.Interior.GetComponentsInChildren <Billboard>(); foreach (Billboard billboard in dfBillboards) { int record = -1; if (billboard.Summary.Archive == 182 && billboard.Summary.Record == 0) { record = GetRecord_182_0(buildingData.Quality); // (buildingData.Quality - 1) / 4; #if UNITY_EDITOR Debug.LogFormat("Shop quality {0} using record {1} to replace 182_0", buildingData.Quality, record); #endif } else if (billboard.Summary.Archive == 182 && billboard.Summary.Record == 1) { if (buildingData.Quality < 12) { // Using big test flats version record = 4; } else if (buildingData.Quality > 14) { record = 5; } #if UNITY_EDITOR Debug.LogFormat("Tavern quality {0} using record {1} to replace 182_1", buildingData.Quality, record); #endif } else if (billboard.Summary.Archive == 182 && billboard.Summary.Record == 2) { if (buildingData.Quality > 12) { record = 6; } #if UNITY_EDITOR Debug.LogFormat("Tavern quality {0} using record {1} to replace 182_2", buildingData.Quality, record); #endif } if (record > -1) { billboard.SetMaterial(197, record); GameObjectHelper.AlignBillboardToGround(billboard.gameObject, billboard.Summary.Size); } } } }
/// <summary> /// Called during transition (entering/exiting building). /// </summary> /// <param name="args">Transition parameters.</param> public virtual void OnLoadingScreen(PlayerEnterExit.TransitionEventArgs args) { CurrentLoadingType = LoadingType.Get(args.TransitionType); RefreshRect(); RefreshBackground(); foreach (LoadingScreenComponent component in components) { if (component.Enabled) { component.OnLoadingScreen(args); } } }
void OnTransitionToExterior(PlayerEnterExit.TransitionEventArgs args) { LayerMask layerIndexWorldTerrain = LayerMask.NameToLayer("WorldTerrain"); if (layerIndexWorldTerrain != -1) { mirrorRefl.m_ReflectLayers.value = (1 << LayerMask.NameToLayer("Default")) + (1 << LayerMask.NameToLayer("WorldTerrain")); mirrorReflSeaLevel.m_ReflectLayers = (1 << LayerMask.NameToLayer("Default")) + (1 << LayerMask.NameToLayer("WorldTerrain")); } else { mirrorRefl.m_ReflectLayers.value = 1 << LayerMask.NameToLayer("Default"); mirrorReflSeaLevel.m_ReflectLayers = 1 << LayerMask.NameToLayer("Default"); } }
private static void OnTransitionExterior_DropTempWagon(PlayerEnterExit.TransitionEventArgs args) { WagonClose = false; if (WagonDeployed) { ItemCollection playerItems = GameManager.Instance.PlayerEntity.Items; for (int i = 0; i < playerItems.Count; i++) { DaggerfallUnityItem item = playerItems.GetItem(i); if (item != null && item.IsOfTemplate(ItemGroups.Transportation, (int)Transportation.Small_cart)) { playerItems.RemoveItem(item); } } } }
private static void OnPreInterior_PlaceMounts(PlayerEnterExit.TransitionEventArgs args) { CurrentMapPixel = GameManager.Instance.PlayerGPS.CurrentMapPixel; if (!playerEnterExit.IsPlayerInside) { if (transportManager.HasCart()) { LeaveWagon(); } if (transportManager.HasHorse()) { LeaveHorse(); } transportManager.TransportMode = TransportModes.Foot; } }
void OnTransitionToExterior(PlayerEnterExit.TransitionEventArgs args) { LayerMask layerIndexWorldTerrain = LayerMask.NameToLayer("WorldTerrain"); if (layerIndexWorldTerrain != -1) { mirrorRefl.m_ReflectLayers.value = (1 << LayerMask.NameToLayer("Default")) + (1 << LayerMask.NameToLayer("WorldTerrain")); mirrorReflSeaLevel.m_ReflectLayers = (1 << LayerMask.NameToLayer("Default")) + (1 << LayerMask.NameToLayer("WorldTerrain")); } else { mirrorRefl.m_ReflectLayers.value = 1 << LayerMask.NameToLayer("Default"); mirrorReflSeaLevel.m_ReflectLayers = 1 << LayerMask.NameToLayer("Default"); } mirrorRefl.CurrentBackgroundSettings = MirrorReflection.EnvironmentSetting.OutdoorSetting; mirrorReflSeaLevel.CurrentBackgroundSettings = MirrorReflection.EnvironmentSetting.OutdoorSetting; }
/// <summary> /// Adjust the existing lights in the interior, and add a light flicker if we have it enabled /// </summary> /// <param name="args"></param> private void AdjustExistingLights(PlayerEnterExit.TransitionEventArgs args) { Debug.Log("Adjust existing lights"); Light[] dfLights = (Light[])FindObjectsOfType(typeof(Light)); //Get all static NPC's in the scene foreach (Light dfLight in dfLights) { //We don't want to adjust the torch when we enter the interior if (dfLight.gameObject.name != "Torch") { dfLight.intensity = interiorModSettings.InteriorLightsIntensity; dfLight.shadows = LightShadows.Soft; dfLight.range = 10; dfLight.GetComponent <Light>().color = interiorModSettings.InteriorLightsColor; //Add light flickering to the existing light in the interior, but not to the player torch if (interiorModSettings.InteriorFlickeringLights) { AddLightFlicker(dfLight.gameObject, 1.5f, 2.5f, 0, interiorModSettings.LightFlickerStrength); } } } }
/// <summary> /// Adjust the existing lights in the interior, and add a light flicker if we have it enabled /// </summary> /// <param name="args"></param> private void AdjustExistingLights(PlayerEnterExit.TransitionEventArgs args) { Light[] dfLights = (Light[])FindObjectsOfType(typeof(Light)); //Get all static NPC's in the scene foreach (Light dfLight in dfLights) { //We don't want to adjust the torch when we enter the interior // if (dfLight.gameObject.name != "Torch" && (handPaintedModFound == false || handPaintedModFound == true && dfLight.transform.parent.name.Contains("[Replacement]"))) { if (dfLight.gameObject.name != "Torch" && dfLight.transform.root.name != "Exterior") { dfLight.intensity = interiorModSettings.InteriorLightsIntensity; dfLight.shadows = LightShadows.Soft; dfLight.range = 10; dfLight.GetComponent <Light>().color = interiorModSettings.InteriorLightsColor; //Add light flickering to the existing light in the interior, but not to the player torch if (interiorModSettings.InteriorFlickeringLights) { AddLightFlicker(dfLight.gameObject, 1.5f, 2.5f, 0, interiorModSettings.LightFlickerStrength); } } } }
/// <summary> /// If the user is running the Handpainted Models mod - adjust the lights instead of completely replacing them. /// </summary> private void AdjustExistingLightSources(PlayerEnterExit.TransitionEventArgs args) { Light[] dfLights = (Light[])FindObjectsOfType(typeof(Light)); //Get all dungeon lights in the scene foreach (Light dfLight in dfLights) { //We don't want the torch to be changed here, and we only want to run adjustments on light sources that are placed by Handpainted models. Replacement objects contain "[Replacement]" on the GameObject name. if (dfLight.gameObject.name != "Torch" && dfLight.transform.parent.name.Contains("[Replacement]")) { dfLight.color = dungeonModSettings.DungeonLightsColor; dfLight.intensity = dungeonModSettings.DungeonLightsIntensity; dfLight.range = 10; dfLight.type = LightType.Point; dfLight.shadows = LightShadows.Soft; dfLight.shadowStrength = 1f; //Add flickering to regular light source if (dungeonModSettings.FlickeringLights == true) { AddLightFlicker(dfLight.gameObject, 1.5f, 2.5f, 0, dungeonModSettings.LightFlickerStrength); } } } }
/// <summary> /// If the user is running the Handpainted Models mod - adjust the lights instead of completely replacing them. /// </summary> private void AdjustExistingLightSources(PlayerEnterExit.TransitionEventArgs args) { Light[] dfLights = (Light[])FindObjectsOfType(typeof(Light)); //Get all dungeon lights in the scene foreach (Light dfLight in dfLights) { //We don't want the torch to be changed here if (dfLight.gameObject.name != "Torch") { dfLight.color = dungeonModSettings.DungeonLightsColor; dfLight.intensity = dungeonModSettings.DungeonLightsIntensity; dfLight.range = 10; dfLight.type = LightType.Point; dfLight.shadows = LightShadows.Soft; dfLight.shadowStrength = 1f; //Add flickering to regular light source if (dungeonModSettings.FlickeringLights == true) { AddLightFlicker(dfLight.gameObject, 1.5f, 2.5f, 0, dungeonModSettings.LightFlickerStrength); } } } }
protected static void GenerateShop_OnTransitionInterior(PlayerEnterExit.TransitionEventArgs args) { ulong creationTime = 0; int buildingQuality = 0; bool investedIn = false; uint amountInvested = 0; int shopAttitude = 0; int buildingKey = 0; int currentGoldSupply = 0; creationTime = DaggerfallUnity.Instance.WorldTime.DaggerfallDateTime.ToSeconds(); buildingQuality = GameManager.Instance.PlayerEnterExit.BuildingDiscoveryData.quality; buildingKey = GameManager.Instance.PlayerEnterExit.BuildingDiscoveryData.buildingKey; if (GameManager.Instance.PlayerEnterExit.IsPlayerInsideOpenShop) { //Debug.Log("You Just Entered An Open Shop, Good Job!..."); ShopData sd; currentGoldSupply = GoldSupplyAmountGenerator(buildingQuality); shopAttitude = UnityEngine.Random.Range(0, 2); // Mostly have it as an int instead of a bool, just incase I want to add more "attitude types" to this later on. //Debug.Log("Building Attitude Rolled: " + shopAttitude.ToString()); FlexCurrentGoldSupply = currentGoldSupply; // On transition, sets the shops gold supply to this "global variable" for later uses. if (!ShopBuildingData.ContainsKey(buildingKey)) { ShopData currentBuildKey = new ShopData { CreationTime = creationTime, InvestedIn = investedIn, AmountInvested = amountInvested, ShopAttitude = shopAttitude, BuildingQuality = buildingQuality, CurrentGoldSupply = currentGoldSupply }; //Debug.Log("Adding building " + buildingKey.ToString() + " - quality: " + buildingQuality.ToString()); ShopBuildingData.Add(buildingKey, currentBuildKey); } else { if (ShopBuildingData.TryGetValue(buildingKey, out sd)) { ulong timeLastVisited = creationTime - sd.CreationTime; investedIn = sd.InvestedIn; if (timeLastVisited >= 1296000) { // 15 * 86400 = Number of seconds in 15 days. if (investedIn) { investedIn = sd.InvestedIn; amountInvested = sd.AmountInvested; shopAttitude = sd.ShopAttitude; buildingQuality = sd.BuildingQuality; currentGoldSupply = InvestedGoldSupplyAmountGenerator(buildingQuality, amountInvested, shopAttitude); ShopBuildingData.Remove(buildingKey); //Debug.Log("Removing Expired Invested Shop Gold & Time: " + buildingKey.ToString()); ShopData currentBuildKey = new ShopData { CreationTime = creationTime, InvestedIn = investedIn, AmountInvested = amountInvested, ShopAttitude = shopAttitude, BuildingQuality = buildingQuality, CurrentGoldSupply = currentGoldSupply }; //Debug.Log("Refreshing building " + buildingKey.ToString() + " - quality: " + buildingQuality.ToString()); ShopBuildingData.Add(buildingKey, currentBuildKey); } else { ShopBuildingData.Remove(buildingKey); //Debug.Log("Removed Expired Building Key " + buildingKey.ToString() + " Generating New Properties"); ShopData currentBuildKey = new ShopData { CreationTime = creationTime, InvestedIn = investedIn, AmountInvested = amountInvested, ShopAttitude = shopAttitude, BuildingQuality = buildingQuality, CurrentGoldSupply = currentGoldSupply }; //Debug.Log("Adding building " + buildingKey.ToString() + " - quality: " + buildingQuality.ToString()); ShopBuildingData.Add(buildingKey, currentBuildKey); } } //Debug.Log("Building " + buildingKey.ToString() + " is present - quality = " + sd.BuildingQuality.ToString()); } } } else { return; } //Debug.Log("You Just Entered Something Other Than An Open Shop..."); }
private void PlayerEnterExit_OnTransitionExterior(PlayerEnterExit.TransitionEventArgs args) { // Any foes pending placement to dungeon or building interior are now invalid pendingFoeGameObjects = null; spawnInProgress = false; }
private static void ClearData_OnTransitionExterior(PlayerEnterExit.TransitionEventArgs args) { dungeon = -1; }
/// <summary> /// Get InteriorTransition & InteriorDungeonTransition events from PlayerEnterExit /// </summary> /// <param name="args"></param> public void InteriorTransitionEvent(PlayerEnterExit.TransitionEventArgs args) //player went indoors (or dungeon), disable sky objects { _stopWatch.Reset(); _stopWatch.Start(); }
// End of transition private void PlayerEnterExit_OnTransition(PlayerEnterExit.TransitionEventArgs args) { isLoading = false; }
private void ApplyShadowSettings(PlayerEnterExit.TransitionEventArgs args) { BillboardShadows.ToggleIndoorNPCBillboardShadows(interiorModSettings.NpcShadows); }
public override void OnLoadingScreen(PlayerEnterExit.TransitionEventArgs args) { SetEnemy(); }
public override void OnLoadingScreen(PlayerEnterExit.TransitionEventArgs args) { UpdateLevelCounter(); }
private static void OnTransitionExterior_PlaceMounts(PlayerEnterExit.TransitionEventArgs args) { OnNewMagicRound_PlaceMounts(); }
private static void OnTransitionToInterior_VariantResidenceNPCsprites(PlayerEnterExit.TransitionEventArgs args) { if (villagerVarietyMod != null && villagerVarietyNumVariants == 0) { ModManager.Instance.SendModMessage(VILLAGERVARIETY_MODNAME, "getNumVariants", null, (string message, object data) => { villagerVarietyNumVariants = (int)data; }); } PlayerEnterExit playerEnterExit = GameManager.Instance.PlayerEnterExit; DFLocation.BuildingData buildingData = playerEnterExit.Interior.BuildingData; if (RMBLayout.IsResidence(buildingData.BuildingType)) { Races race = GetClimateRace(); int gender = -1; Billboard[] dfBillboards = playerEnterExit.Interior.GetComponentsInChildren <Billboard>(); foreach (Billboard billboard in dfBillboards) { if (billboard.Summary.Archive == 182) { gender = GetGender182(billboard.Summary.Record); } else if (billboard.Summary.Archive == 184) { gender = GetGender184(billboard.Summary.Record); } if (gender != -1) { StaticNPC npc = billboard.GetComponent <StaticNPC>(); if (npc && npc.Data.factionID == 0) { int faceVariant = npc.Data.nameSeed % 29; Debug.LogFormat("Replace house NPC {0}.{1} with faceVariant {2} - {3}", billboard.Summary.Archive, billboard.Summary.Record, faceVariant, faceVariant < 24); if (faceVariant < 24) { int outfitVariant = npc.Data.nameSeed % 4; int archive = gender == (int)Genders.Male ? raceArchivesMale[race][outfitVariant] : raceArchivesFemale[race][outfitVariant]; int record = 5; int faceRecord = gender == (int)Genders.Male ? raceFaceRecordMale[race][outfitVariant] : raceFaceRecordFemale[race][outfitVariant]; faceRecord += faceVariant; bool materialSet = false; if (villagerVarietyMod != null) { int variant = npc.Data.nameSeed % villagerVarietyNumVariants; string season = ""; //ModManager.Instance.SendModMessage(VILLAGERVARIETY_MODNAME, "getSeasonStr", null, (string message, object data) => { season = (string)data; }); Debug.LogFormat("Replace house NPC {0}.{1} with {2}.{3}, outfit: {4} faceRecord: {5} ({6}) variant: {7} season: {8}", billboard.Summary.Archive, billboard.Summary.Record, archive, record, outfitVariant, faceRecord, faceVariant, variant, season); string imageName = null; ModManager.Instance.SendModMessage(VILLAGERVARIETY_MODNAME, "getImageName", new object[] { archive, record, 0, faceRecord, variant, season }, (string message, object data) => { imageName = (string)data; }); if (!string.IsNullOrEmpty(imageName) && villagerVarietyMod.HasAsset(imageName)) { // Get texture and create material Texture2D texture = villagerVarietyMod.GetAsset <Texture2D>(imageName); Material material = MaterialReader.CreateStandardMaterial(MaterialReader.CustomBlendMode.Cutout); material.mainTexture = texture; // Apply material to mesh renderer MeshRenderer meshRenderer = billboard.GetComponent <MeshRenderer>(); meshRenderer.sharedMaterial = material; // Create mesh and setup UV map for mesh filter Vector2 size; Mesh mesh = DaggerfallUnity.Instance.MeshReader.GetBillboardMesh(new Rect(0, 0, 1, 1), archive, record, out size); mesh.uv = new Vector2[] { new Vector2(0, 1), new Vector2(1, 1), new Vector2(0, 0), new Vector2(1, 0) }; MeshFilter meshFilter = billboard.GetComponent <MeshFilter>(); Destroy(meshFilter.sharedMesh); meshFilter.sharedMesh = mesh; materialSet = true; } } if (!materialSet) { billboard.SetMaterial(archive, record); billboard.FramesPerSecond = 1; } GameObjectHelper.AlignBillboardToGround(billboard.gameObject, billboard.Summary.Size); Dictionary <int, FlatsFile.FlatData> flatsDict = DaggerfallUnity.Instance.ContentReader.FlatsFileReader.FlatsDict; int flatId = FlatsFile.GetFlatID(npc.Data.billboardArchiveIndex, npc.Data.billboardRecordIndex); #if UNITY_EDITOR Debug.LogFormat("Replacing face dict for {0} with {1} (for {2}.{3} / {4}.{5})", flatsDict[flatId].faceIndex, faceRecord, npc.Data.billboardArchiveIndex, npc.Data.billboardRecordIndex, billboard.Summary.Archive, billboard.Summary.Record); #endif flatsDict[flatId] = new FlatsFile.FlatData() { archive = billboard.Summary.Archive, record = billboard.Summary.Record, faceIndex = faceRecord, }; } } } } } }
private void FireTransitionSave(PlayerEnterExit.TransitionEventArgs args) { Autosave(); }
private void ApplyShadowSettings(PlayerEnterExit.TransitionEventArgs args) { BillboardShadows.ToggleIndoorNPCBillboardShadows(dungeonModSettings.EnemyShadows); //Technically there are usually no NPC's in dungeon except rescue quests so we toggle this anyway BillboardShadows.ToggleDungeonEnemyBillboardShadows(dungeonModSettings.EnemyShadows, this); //Toggle enemy billboard shadows }