diff --git a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/Resources.meta b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/Resources.meta new file mode 100644 index 0000000..ab0b5aa --- /dev/null +++ b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2b256610b1c85bb4aab826657d690b10 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Shader.meta b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/Resources/Shader.meta similarity index 100% rename from 03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Shader.meta rename to 03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/Resources/Shader.meta diff --git a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Shader/TransitionEffectShader.shader b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/Resources/Shader/TransitionEffectShader.shader similarity index 93% rename from 03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Shader/TransitionEffectShader.shader rename to 03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/Resources/Shader/TransitionEffectShader.shader index ee8c2b1..d03bd7b 100644 --- a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Shader/TransitionEffectShader.shader +++ b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/Resources/Shader/TransitionEffectShader.shader @@ -47,7 +47,7 @@ fixed4 col_dst = tex2D(_TargetTex, i.uv); fixed4 col_tra = tex2D(_TransitionTex, i.uv); - col_dst.rgb = col_dst.rgb * col_tra.g + col_src.rgb * (1 - col_tra.g); + col_dst.rgba = col_dst.rgba * col_tra.r + col_src.rgba * (1 - col_tra.r); return col_dst; } ENDCG diff --git a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Shader/TransitionEffectShader.shader.meta b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/Resources/Shader/TransitionEffectShader.shader.meta similarity index 100% rename from 03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Shader/TransitionEffectShader.shader.meta rename to 03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/Resources/Shader/TransitionEffectShader.shader.meta diff --git a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait.unity b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait.unity index 9054024..283303a 100644 --- a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait.unity +++ b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait.unity @@ -3148,7 +3148,7 @@ Camera: m_Enabled: 1 serializedVersion: 2 m_ClearFlags: 2 - m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} + m_BackGroundColor: {r: 1, g: 1, b: 1, a: 0} m_projectionMatrixMode: 1 m_SensorSize: {x: 36, y: 24} m_LensShift: {x: 0, y: 0} @@ -3192,7 +3192,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1067656010} - m_RootOrder: 1 + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &961139956 MonoBehaviour: @@ -3285,7 +3285,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 961139953} - m_Enabled: 0 + m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 10f07b3f9fb96524db93eb42d89c229c, type: 3} m_Name: @@ -3294,7 +3294,7 @@ MonoBehaviour: LoadOnAwake: 1 PlayOnStart: 0 Looping: 0 - AudioVolume: 1 + AudioVolume: 0 --- !u!114 &961139959 MonoBehaviour: m_ObjectHideFlags: 0 @@ -3302,7 +3302,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 961139953} - m_Enabled: 0 + m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 197846e613a35e34aae5281af759652f, type: 3} m_Name: @@ -3492,7 +3492,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1067656010} - m_RootOrder: 0 + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!20 &998739363 Camera: @@ -3758,8 +3758,8 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 100} m_LocalScale: {x: 0.16666667, y: 0.16666667, z: 0.16666667} m_Children: - - {fileID: 998739362} - {fileID: 961139955} + - {fileID: 998739362} - {fileID: 2144215267} - {fileID: 2092843638} - {fileID: 1821221164} diff --git a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Script/Portrait.cs b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Script/Portrait.cs index e109db0..a827771 100644 --- a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Script/Portrait.cs +++ b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Script/Portrait.cs @@ -151,6 +151,19 @@ namespace UltraCombos.Frozen } } + public void OnPause() + { + if (BgMovie) + { + BgMovie.Pause(); + } + + if (FgMovie) + { + FgMovie.Pause(); + } + } + public void OnStop() { if (BgMovie) diff --git a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Script/PortraitManager.cs b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Script/PortraitManager.cs index 36f0d1b..5501aab 100644 --- a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Script/PortraitManager.cs +++ b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Script/PortraitManager.cs @@ -141,6 +141,12 @@ namespace UltraCombos.Frozen.RoyalGallery IEnumerator OnTransition(string next) { + if (portraits.ContainsKey(PortraitKeyCur)) + { + Portrait p_cur = portraits[PortraitKeyCur]; + p_cur.OnPause(); + } + isTransiting = true; Portrait p_nxt = portraits[next]; @@ -159,7 +165,6 @@ namespace UltraCombos.Frozen.RoyalGallery IEnumerator UpdateTransition(string next, TransitionScript transition) { - /* transition.OnPlay(); while (true) @@ -173,7 +178,6 @@ namespace UltraCombos.Frozen.RoyalGallery } transition.OnStop(); - */ string PortraitKeyPre = PortraitKeyCur; PortraitKeyCur = next; @@ -200,14 +204,12 @@ namespace UltraCombos.Frozen.RoyalGallery IEnumerator OnStopPortrait(string pre) { - if (!portraits.ContainsKey(pre)) + if (portraits.ContainsKey(pre)) { - yield return null; + Portrait p = portraits[pre]; + p.OnStop(); } - Portrait p = portraits[pre]; - p.OnStop(); - isTransiting = false; yield return null; diff --git a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Script/RorayGalleryGrpcServer.cs b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Script/RorayGalleryGrpcServer.cs index 5937792..05020a6 100644 --- a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Script/RorayGalleryGrpcServer.cs +++ b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Script/RorayGalleryGrpcServer.cs @@ -5,9 +5,20 @@ using System.Threading.Tasks; using UnityEngine; using UnityEngine.Events; using UnityEngine.Networking; +//using System.Runtime.CompilerServices; namespace UltraCombos.Frozen.RoyalGallery { + /* + public static class AwaitExtensions + { + public static TaskAwaiter GetAwaiter(this System.TimeSpan timeSpan) + { + return Task.Delay(timeSpan).GetAwaiter(); + } + } + */ + class IndexInfo { public string id; @@ -91,41 +102,49 @@ namespace UltraCombos.Frozen.RoyalGallery if (data != null) { - string role_id = data.Id; + HandleData(data); + } - if (texture == null) - { - texture = new Texture2D(2048, 2048, TextureFormat.ARGB32, false); - } + DebugInformation.Instance.UpdateProperty("Resouce Server", $"{port}"); + } - if (tex_sign == null) - { - tex_sign = new Texture2D(1513, 625, TextureFormat.ARGB32, false); - } + //async Task HandleData(DataRequest data) + void HandleData(DataRequest data) + { + string role_id = data.Id; - if (texture.LoadImage(data.Content.ToByteArray(), false)) - { - Texture2D tex_tmp = null; - if (tex_sign.LoadImage(data.Signature.ToByteArray(), false)) - { - tex_tmp = tex_sign; - Log($"Signature {role_id} is loaded. ({tex_sign.width} x {tex_sign.height})"); - } - - onMessageReceived.Invoke(data); - onTextureReceived.Invoke(role_id, texture, tex_tmp); - Log($"Texture {role_id} is loaded. ({texture.width} x {texture.height})"); - - DebugInformation.Instance.UpdateProperty("Last painting", $"{role_id} ({texture.width} x {texture.height})"); - } - else + if (texture == null) + { + texture = new Texture2D(2048, 2048, TextureFormat.ARGB32, false); + } + + if (tex_sign == null) + { + tex_sign = new Texture2D(1513, 625, TextureFormat.ARGB32, false); + } + + if (texture.LoadImage(data.Content.ToByteArray(), false)) + { + Texture2D tex_tmp = null; + if (tex_sign.LoadImage(data.Signature.ToByteArray(), false)) { - Log("Texture load fail.", LogType.Error); - DebugInformation.Instance.UpdateProperty("Last painting", $"load fail"); + tex_tmp = tex_sign; + Log($"Signature {role_id} is loaded. ({tex_sign.width} x {tex_sign.height})"); } + + onMessageReceived.Invoke(data); + onTextureReceived.Invoke(role_id, texture, tex_tmp); + Log($"Texture {role_id} is loaded. ({texture.width} x {texture.height})"); + + DebugInformation.Instance.UpdateProperty("Last painting", $"{role_id} ({texture.width} x {texture.height})"); + } + else + { + Log("Texture load fail.", LogType.Error); + DebugInformation.Instance.UpdateProperty("Last painting", $"load fail"); } - DebugInformation.Instance.UpdateProperty("Resouce Server", $"{port}"); + //await System.TimeSpan.FromMilliseconds(100); } private void OnMessageReceived(DataRequest request) @@ -139,15 +158,15 @@ namespace UltraCombos.Frozen.RoyalGallery private IndexInfo OnIndexRequest(int deviceId) { - IndexInfo info = new IndexInfo(); - info.id = m_IdList[index]; - info.color = onRequestColor(info.id); - lock (idx_mtx) { index = (index + 1) % m_IdList.Count; } + IndexInfo info = new IndexInfo(); + info.id = m_IdList[index]; + info.color = onRequestColor(info.id); + return info; } } diff --git a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Script/TransitionScript.cs b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Script/TransitionScript.cs index 14ee9da..55e049d 100644 --- a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Script/TransitionScript.cs +++ b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/Assets/RoyalGalleryPortrait/Script/TransitionScript.cs @@ -30,13 +30,12 @@ namespace UltraCombos.Frozen.RoyalGallery public void OnPlay() { - enabled = true; MovPlayer.Play(); } public void OnStop() { - enabled = false; + } // Update is called once per frame diff --git a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/ProjectSettings/ProjectSettings.asset b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/ProjectSettings/ProjectSettings.asset index cd20401..b772998 100644 --- a/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/ProjectSettings/ProjectSettings.asset +++ b/03_RoyalGallery/Unity-19050-03_RoyalGallery_Portrait_PC/19050-03_RoyalGallery_Portrait_PC/ProjectSettings/ProjectSettings.asset @@ -118,7 +118,7 @@ PlayerSettings: 16:10: 1 16:9: 1 Others: 1 - bundleVersion: 0.5 + bundleVersion: 1.0 preloadedAssets: [] metroInputSource: 0 wsaTransparentSwapchain: 0