diff --git a/.vs/PortiaMods/v16/.suo b/.vs/PortiaMods/v16/.suo index 847e8f7..435aee4 100644 Binary files a/.vs/PortiaMods/v16/.suo and b/.vs/PortiaMods/v16/.suo differ diff --git a/CookingMachine/Main.cs b/CookingMachine/Main.cs index 93f23d5..6662c7e 100644 --- a/CookingMachine/Main.cs +++ b/CookingMachine/Main.cs @@ -20,8 +20,9 @@ namespace CookingMachine public static class Main { public static bool enabled; - private static bool isDebug = true; + private static bool isDebug = false; private static List crash; + private static CompoundItemData templateData; public static void Dbgl(string str = "", bool pref = true) { @@ -34,6 +35,12 @@ private static void Load(UnityModManager.ModEntry modEntry) { settings = Settings.Load(modEntry); + SqliteDataReader reader = LocalDb.cur.ReadFullTable("Synthesis_table "); + var sourceData = DbReader.Read(reader, 20); + + templateData = sourceData.Find((CompoundItemData c) => c.ItemID == 2000046); + + modEntry.OnToggle = OnToggle; modEntry.OnGUI = OnGUI; modEntry.OnSaveGUI = OnSaveGUI; @@ -72,6 +79,7 @@ static class AutomataMachineMenuCtr_1 { static void Postfix(ref CompoundItem[] __result) { + int start = 5000; int start2 = 5001000; @@ -83,60 +91,46 @@ static void Postfix(ref CompoundItem[] __result) Dbgl("missing list"); return; } - Dbgl("getting cid"); - - SqliteDataReader reader = LocalDb.cur.ReadFullTable("Synthesis_table "); - var sourceData = DbReader.Read(reader, 20); - CompoundItemData cidd = sourceData.Find((CompoundItemData c) => c.ItemID == 2000046); - Dbgl("getting list"); foreach (CookBookData food in cookList) { if (food != null && food.like) { - Dbgl("got food"); - cidd.NameID = Module.Self.GetItemNameId(food.foodId); - cidd.ItemID = food.foodId; - Dbgl("food " + food.foodId); - Dbgl("menu list length " + food.menuList.Count); + templateData.NameID = Module.Self.GetItemNameId(food.foodId); + templateData.ItemID = food.foodId; foreach (CookMatData cmd in food.menuList) { - Dbgl("matdic length " + cmd.matDic.Count); - cidd.ID = start++; - cidd.BookId = start2++; - cidd.RequireItem1 = cmd.matDic.Keys.ToList()[0]; - cidd.RequireItemNum1 = cmd.matDic[cmd.matDic.Keys.ToList()[0]]; - Dbgl($"item1 {cidd.RequireItem1} count {cidd.RequireItemNum1}"); + templateData.ID = start++; + templateData.BookId = start2++; + templateData.RequireItem1 = cmd.matDic.Keys.ToList()[0]; + templateData.RequireItemNum1 = cmd.matDic[cmd.matDic.Keys.ToList()[0]]; if (cmd.matDic.Count > 1) { - cidd.RequireItem2 = cmd.matDic.Keys.ToList()[1]; - cidd.RequireItemNum2 = cmd.matDic[cmd.matDic.Keys.ToList()[1]]; - Dbgl($"item2 {cidd.RequireItem2} count {cidd.RequireItemNum2}"); + templateData.RequireItem2 = cmd.matDic.Keys.ToList()[1]; + templateData.RequireItemNum2 = cmd.matDic[cmd.matDic.Keys.ToList()[1]]; if (cmd.matDic.Count > 2) { - cidd.RequireItem3 = cmd.matDic.Keys.ToList()[2]; - cidd.RequireItemNum3 = cmd.matDic[cmd.matDic.Keys.ToList()[2]]; - Dbgl($"item3 {cidd.RequireItem3} count {cidd.RequireItemNum3}"); + templateData.RequireItem3 = cmd.matDic.Keys.ToList()[2]; + templateData.RequireItemNum3 = cmd.matDic[cmd.matDic.Keys.ToList()[2]]; } else { - cidd.RequireItem3 = 0; - cidd.RequireItemNum3 = 0; + templateData.RequireItem3 = 0; + templateData.RequireItemNum3 = 0; } } else { - cidd.RequireItem2 = 0; - cidd.RequireItemNum2 = 0; + templateData.RequireItem2 = 0; + templateData.RequireItemNum2 = 0; } - newList.Add(new CompoundItem(cidd)); + newList.Add(new CompoundItem(templateData)); } } } - Dbgl("list length" + __result.Length); + __result = newList.ToArray(); - Dbgl("list length" + __result.Length); } } diff --git a/CustomTextures/Main.cs b/CustomTextures/Main.cs index 2f44873..31f4113 100644 --- a/CustomTextures/Main.cs +++ b/CustomTextures/Main.cs @@ -1,4 +1,6 @@ using Harmony12; +using Pathea; +using Pathea.ModuleNs; using System.Reflection; using UnityEngine; using UnityEngine.SceneManagement; @@ -77,14 +79,6 @@ private static void ChangeScene(Scene arg0, Scene arg1) } FixSceneTextures(arg1); - if(arg1.name == "Main") - { - FixWorkshopTextures(); - } - else if(arg1.name == "PlayerHome") - { - FixHomeTextures(); - } } } diff --git a/CustomTextures/Methods.cs b/CustomTextures/Methods.cs index de6b246..e0a97c6 100644 --- a/CustomTextures/Methods.cs +++ b/CustomTextures/Methods.cs @@ -1,6 +1,7 @@ using Harmony12; using Pathea; using Pathea.ActorNs; +using Pathea.Expression; using Pathea.HomeNs; using Pathea.ModuleNs; using Pathea.NpcAppearNs; @@ -177,6 +178,38 @@ private static void FixSceneTextures(Scene arg1) { FixOneTexture(obj); } + + if (Module.Self != null && Module.Self.actor != null) + { + FixOneTexture(Module.Self.actor.gameObject); + + BlinkController bc = (BlinkController) typeof(Actor).GetField("blinkController", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(Module.Self.actor); + if(bc != null) + { + SkinnedMeshRenderer mr = (SkinnedMeshRenderer)typeof(BlinkController).GetField("_mesh", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(bc); + if(mr != null) + { + string name = mr.name; + if (customTexturesMisc.ContainsKey(name) && mr.material && mr.material.HasProperty("_MainTex") && mr.material.mainTexture != null) + { + Dbgl($"Changing texture for {name}"); + Texture2D tex = customTexturesMisc[name]; + tex.name = $"{name}.png"; + mr.material.mainTexture = tex; + } + } + } + } + + if (arg1.name == "Main") + { + FixWorkshopTextures(); + } + else if (arg1.name == "PlayerHome") + { + FixHomeTextures(); + } + } private static void FixOneTexture(GameObject go) @@ -195,6 +228,18 @@ private static void FixOneTexture(GameObject go) mr.material.mainTexture = tex; } } + SkinnedMeshRenderer[] smrs = go.GetComponentsInChildren(); + foreach (SkinnedMeshRenderer mr in smrs) + { + string name = mr.name; + if (customTexturesMisc.ContainsKey(name) && mr.material && mr.material.HasProperty("_MainTex") && mr.material.mainTexture != null) + { + Dbgl($"Changing texture for {name}"); + Texture2D tex = customTexturesMisc[name]; + tex.name = $"{name}.png"; + mr.material.mainTexture = tex; + } + } } private static void DumpObjectNames() @@ -206,10 +251,62 @@ private static void DumpObjectNames() Dbgl("scene is null"); return; } - + string names = ""; List meshTextures = new List(); - string names = ""; + if (Module.Self != null && Module.Self.actor != null) + { + GameObject player = Module.Self.actor.gameObject; + names += $"Player actor mesh and texture names:\r\n\r\n\t"; + + + MeshRenderer[] mrs = player.GetComponentsInChildren(); + + foreach (MeshRenderer mr in mrs) + { + if (mr.material && mr.material.HasProperty("_MainTex") && mr.material.mainTexture != null) + { + string mt = $"mesh name: {mr.name} texture name: {mr.material.mainTexture.name}"; + if (!meshTextures.Contains(mt)) + { + meshTextures.Add(mt); + } + + } + } + + SkinnedMeshRenderer[] smrs = player.GetComponentsInChildren(); + + foreach (SkinnedMeshRenderer mr in smrs) + { + if (mr.material && mr.material.HasProperty("_MainTex") && mr.material.mainTexture != null) + { + string mt = $"smesh name: {mr.name} texture name: {mr.material.mainTexture.name}"; + if (!meshTextures.Contains(mt)) + { + meshTextures.Add(mt); + } + + } + } + + BlinkController bc = (BlinkController)typeof(Actor).GetField("blinkController", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(Module.Self.actor); + if (bc != null) + { + SkinnedMeshRenderer smr = (SkinnedMeshRenderer)typeof(BlinkController).GetField("_mesh", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(bc); + if (smr != null && smr.material && smr.material.HasProperty("_MainTex") && smr.material.mainTexture != null) + { + string mt = $"blink mesh name: {smr.name} texture name: {smr.material.mainTexture.name}"; + if (!meshTextures.Contains(mt)) + { + meshTextures.Add(mt); + } + } + } + + names += string.Join("\r\n\t", meshTextures.ToArray()) + "\r\n\r\n"; + meshTextures.Clear(); + } names += $"DLC actor mesh and texture names:\r\n\r\n\t"; diff --git a/CustomTextures/Patches.cs b/CustomTextures/Patches.cs index d3aadea..23b0311 100644 --- a/CustomTextures/Patches.cs +++ b/CustomTextures/Patches.cs @@ -86,7 +86,7 @@ private static void Prefix(NpcAppear __instance, List npcAppearUn [HarmonyPatch(typeof(AppearTarget), "BuildMesh", new Type[] { typeof(List), typeof(AppearData), typeof(AppearUnit), typeof(string) })] static class BuildMesh1_Patch { - static void Prefix(AppearTarget __instance, AppearData appearData, ref List units) + static void Prefix(ref List units) { //Dbgl($"Building player mesh"); @@ -97,13 +97,29 @@ static void Prefix(AppearTarget __instance, AppearData appearData, ref ListUse Custom Anti-Aliasing", new GUILayoutOption[0]); if (settings.customAA) { @@ -550,7 +550,7 @@ private static void OnGUI(UnityModManager.ModEntry modEntry) GUILayout.EndHorizontal(); } - + */ GUILayout.Space(20f); GUILayout.EndVertical(); diff --git a/PostProcessing/Patches.cs b/PostProcessing/Patches.cs index bf52bb6..c89c511 100644 --- a/PostProcessing/Patches.cs +++ b/PostProcessing/Patches.cs @@ -25,9 +25,12 @@ static partial class Main private static MotionBlurModel.Settings defaultMotionBlurSettings; private static DepthOfFieldModel.Settings defaultDepthOfFieldSettings; private static ColorGradingModel.Settings defaultColorGradingSettings; - private static AntialiasingModel.Settings defaultAASettings; private static AmbientOcclusionModel.Settings defaultAOSettings; + private static bool defaultAASet = false; + private static AntialiasingModel.Settings defaultAATaaSettings; + private static AntialiasingModel.Settings defaultAAFxaaSettings; + [HarmonyPatch(typeof(PostProcessingBehaviour), "OnEnable")] static class PostProcessingBehaviour_OnEnable_Patch { @@ -42,7 +45,6 @@ static void Prefix(PostProcessingBehaviour __instance) defaultMotionBlurSettings = __instance.profile.motionBlur.settings; defaultDepthOfFieldSettings = __instance.profile.depthOfField.settings; defaultColorGradingSettings = __instance.profile.colorGrading.settings; - defaultAASettings = __instance.profile.antialiasing.settings; defaultAOSettings = __instance.profile.ambientOcclusion.settings; defaultPostProcessingSet = true; } @@ -74,7 +76,7 @@ static void Postfix(ref VignetteComponent ___m_Vignette, ref BloomComponent ___m { ___m_Vignette.model.settings = defaultVignetteSettings; } - + if (enabled && settings.customBloom) { BloomModel.BloomSettings bbSettings = new BloomModel.BloomSettings @@ -103,7 +105,7 @@ static void Postfix(ref VignetteComponent ___m_Vignette, ref BloomComponent ___m { ___m_Bloom.model.settings = defaultBloomSettings; } - + if (enabled && settings.customEyeAdapt) { EyeAdaptationModel.Settings eSettings = new EyeAdaptationModel.Settings @@ -223,6 +225,15 @@ static void Postfix(ref VignetteComponent ___m_Vignette, ref BloomComponent ___m ___m_AmbientOcclusion.model.settings = defaultAOSettings; } + /* + + if(!defaultAASet) + { + defaultAATaaSettings = ___m_Taa.model.settings; + defaultAAFxaaSettings = ___m_Fxaa.model.settings; + defaultAASet = true; + } + if (enabled && settings.customAA) { AntialiasingModel.FxaaSettings afSettings = new AntialiasingModel.FxaaSettings @@ -236,35 +247,34 @@ static void Postfix(ref VignetteComponent ___m_Vignette, ref BloomComponent ___m sharpen = settings.AASharpen, stationaryBlending = settings.AAStationaryBlending, motionBlending = settings.AAMotionBlending + }; AntialiasingModel.Settings aSettings = new AntialiasingModel.Settings { - method = settings.AAMethodTaa?AntialiasingModel.Method.Taa: AntialiasingModel.Method.Fxaa, + //method = settings.AAMethodTaa?AntialiasingModel.Method.Taa: AntialiasingModel.Method.Fxaa, + method = ___m_Taa.model.settings.method, fxaaSettings = afSettings, taaSettings = atSettings }; - ___m_Taa.model.settings = aSettings; - ___m_Fxaa.model.settings = aSettings; - if (settings.AAMethodTaa) - { - ___m_Taa.model.enabled = true; - ___m_Fxaa.model.enabled = false; - } - else + AntialiasingModel.Settings aSettings2 = new AntialiasingModel.Settings { - ___m_Taa.model.enabled = false; - ___m_Fxaa.model.enabled = true; - } + //method = settings.AAMethodTaa?AntialiasingModel.Method.Taa: AntialiasingModel.Method.Fxaa, + method = ___m_Fxaa.model.settings.method, + fxaaSettings = afSettings, + taaSettings = atSettings + }; + + ___m_Taa.model.settings = aSettings; + ___m_Fxaa.model.settings = aSettings2; } else { - ___m_Taa.model.settings = defaultAASettings; - ___m_Fxaa.model.settings = defaultAASettings; - ___m_Taa.model.enabled = false; - ___m_Fxaa.model.enabled = false; + ___m_Taa.model.settings = defaultAATaaSettings; + ___m_Fxaa.model.settings = defaultAAFxaaSettings; } + */ } } } diff --git a/ShippingBin/MailShipping.cs b/ShippingBin/MailShipping.cs index 1f45c71..31f0c8e 100644 --- a/ShippingBin/MailShipping.cs +++ b/ShippingBin/MailShipping.cs @@ -17,7 +17,13 @@ public MailShipping(int gols) Type = MailType.Gift; itemList = new List(); GameDateTime gdt = Module.Self.DateTime; - GameDateTime morning = new GameDateTime(gdt.Year, gdt.Month, gdt.Day + 1, 7, 0, 0); + GameDateTime morning; + if (gdt.Hour >= 7) + { + gdt = gdt.AddDays(1); + } + morning = new GameDateTime(gdt.Year, gdt.Month, gdt.Day, 7, 0, 0); + sendDateTicks = morning.Ticks; baseData = new Pathea.MailConfInfo diff --git a/Television/Main.cs b/Television/Main.cs index 2856ee7..7101d6a 100644 --- a/Television/Main.cs +++ b/Television/Main.cs @@ -12,6 +12,8 @@ using System.IO; using Pathea.ItemSystem; using System.Linq; +using Pathea.CameraSystemNs; +using Pathea.ModuleNs; namespace Television { @@ -57,6 +59,43 @@ private static void OnSaveGUI(UnityModManager.ModEntry modEntry) private static void OnGUI(UnityModManager.ModEntry modEntry) { + return; + foreach(string video in videoPaths.Keys) + { + if (GUILayout.Button(video)){ + GameObject camera = CameraManager.Instance.SourceCamera.gameObject; + var audioSource = camera.AddComponent(); + MeshRenderer back = camera.GetComponent(); + if (back == null) + { + Dbgl("Adding mesh renderer"); + back = camera.AddComponent(); + } + back.material.SetTexture("_MainTex", new Texture2D(1920,1080)); + back.material.SetColor("_MainTex", Color.white); + //back.transform.localScale = new Vector3(0.5f,0.5f,0.5f); + cameraVideo = camera.AddComponent(); + cameraVideo.targetCameraAlpha = 0.5F; + cameraVideo.url = videoPaths[video]; + + cameraVideo.renderMode = UnityEngine.Video.VideoRenderMode.MaterialOverride; + cameraVideo.targetMaterialRenderer = back; + cameraVideo.targetMaterialProperty = "_MainTex"; + + cameraVideo.audioOutputMode = UnityEngine.Video.VideoAudioOutputMode.AudioSource; + cameraVideo.SetTargetAudioSource(0,audioSource); + + cameraVideo.prepareCompleted += CameraVideo_prepareCompleted; + cameraVideo.Prepare(); + } + } + + } + + private static void CameraVideo_prepareCompleted(UnityEngine.Video.VideoPlayer source) + { + + source.Play(); } private static void LoadVideoFiles() @@ -89,6 +128,7 @@ private static void LoadVideoFiles() private static Dictionary videoPaths = new Dictionary(); private static Dictionary videoNames = new Dictionary(); + private static UnityEngine.Video.VideoPlayer cameraVideo; [HarmonyPatch(typeof(VideoChoiceUICtr), "GetVideoes")] static class VideoChoiceUICtr_GetVideoes @@ -159,11 +199,15 @@ private static bool Prefix(int id, ref string __result) [HarmonyPatch(typeof(TVCtr), "Play")] static class TVCtr_Play { - static bool Prefix(TVCtr __instance, string fileName) + static bool Prefix(TVCtr __instance, string fileName, GameObject ___screen) { if (!enabled) return true; + //___screen.transform.localScale = new Vector3(1.6f, 1.4f, 1f); + //___screen.transform.position = new Vector3(___screen.transform.position.x - 0.08f, ___screen.transform.position.y - 0.32f, ___screen.transform.position.z - 0.21f); + //___screen.transform.rotation = new Quaternion(___screen.transform.rotation.x + 0.0155f, ___screen.transform.rotation.y,___screen.transform.rotation.z + 0.0155f, ___screen.transform.rotation.w); + if (__instance.CurPlay == fileName) { return false; diff --git a/Television/Television.csproj b/Television/Television.csproj index ea4d31e..ef9d116 100644 --- a/Television/Television.csproj +++ b/Television/Television.csproj @@ -91,6 +91,9 @@ ..\external\UnityEngine.UnityWebRequestWWWModule.dll + + ..\external\UnityEngine.VideoModule.dll + ..\external\UnityModManager\UnityModManager.dll diff --git a/external/UnityEngine.VideoModule.dll b/external/UnityEngine.VideoModule.dll new file mode 100644 index 0000000..448e1e0 Binary files /dev/null and b/external/UnityEngine.VideoModule.dll differ diff --git a/repository.json b/repository.json index f9364cd..3f67dbd 100644 --- a/repository.json +++ b/repository.json @@ -5,11 +5,11 @@ {"Id": "BuildAnywhere", "Version": "0.2.4"}, {"Id": "ChangeClothes", "Version": "0.2.4"}, {"Id": "ChineseVoice", "Version": "0.1.0"}, - {"Id": "CookingMachine", "Version": "0.3.0"}, + {"Id": "CookingMachine", "Version": "0.3.1"}, {"Id": "CustomizePlayer", "Version": "0.1.3"}, {"Id": "CustomMerch", "Version": "0.2.0"}, {"Id": "CustomQuests", "Version": "0.1.0"}, - {"Id": "CustomTextures", "Version": "0.7.3"}, + {"Id": "CustomTextures", "Version": "0.8.0"}, {"Id": "DeeDeeAnywhere", "Version": "0.1.7"}, {"Id": "DialogueEdit", "Version": "0.1.0"}, {"Id": "Environment", "Version": "0.3.3"}, @@ -33,7 +33,7 @@ {"Id": "PlantMod", "Version": "0.3.0"}, {"Id": "PostProcessing", "Version": "0.2.0"}, {"Id": "SaveAnyTime", "Version": "0.10.0"}, - {"Id": "ShippingBin", "Version": "0.1.4"}, + {"Id": "ShippingBin", "Version": "0.1.6"}, {"Id": "StorageAnywhere", "Version": "0.6.0"}, {"Id": "Swim", "Version": "0.2.1"}, {"Id": "Teleport", "Version": "0.0.1"},