diff --git a/Assets/Art/UIPrefab/UIScore.prefab b/Assets/Art/UIPrefab/UIScore.prefab
index c67afc3e..6600d0b5 100644
--- a/Assets/Art/UIPrefab/UIScore.prefab
+++ b/Assets/Art/UIPrefab/UIScore.prefab
@@ -1858,6 +1858,7 @@ GameObject:
- component: {fileID: 5242346012832629294}
- component: {fileID: 7581586130610749331}
- component: {fileID: 8788681420710167634}
+ - component: {fileID: 2190811092157322984}
m_Layer: 0
m_Name: InputName
m_TagString: Untagged
@@ -2034,9 +2035,22 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
MarkType: 0
- CustomComponentName:
+ CustomComponentName: InputName
CustomComment:
mComponentName: TMPro.TMP_InputField
+--- !u!114 &2190811092157322984
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4232881240181435649}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: cc33a39070010f94fb1c2dd721c1286d, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ showHtmlElement: 0
--- !u!1 &4549258305985580856
GameObject:
m_ObjectHideFlags: 0
@@ -3893,6 +3907,7 @@ GameObject:
- component: {fileID: 1368589810807828378}
- component: {fileID: 639293668922443356}
- component: {fileID: 644957437798113380}
+ - component: {fileID: 1459098634278024062}
m_Layer: 0
m_Name: InputId
m_TagString: Untagged
@@ -4069,9 +4084,22 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
MarkType: 0
- CustomComponentName:
+ CustomComponentName: InputId
CustomComment:
mComponentName: TMPro.TMP_InputField
+--- !u!114 &1459098634278024062
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 8227476442829037126}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: cc33a39070010f94fb1c2dd721c1286d, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ showHtmlElement: 0
--- !u!1 &8329961033367211886
GameObject:
m_ObjectHideFlags: 0
diff --git a/Assets/Data/App.xml b/Assets/Data/App.xml
index b803c547..074b40c6 100644
--- a/Assets/Data/App.xml
+++ b/Assets/Data/App.xml
@@ -632,7 +632,7 @@
-
+
+ /// Ƶ
+ ///
+ public class LocalAudioRes : Res
+ {
+ private string mFullPath;
+ private string mHashCode;
+ private object mRawAsset;
+
+ UnityWebRequest request;
+ public static LocalAudioRes Allocate(string name)
+ {
+ var res = SafeObjectPool.Instance.Allocate();
+ if (res != null)
+ {
+ res.AssetName = name;
+ res.SetUrl(name.Substring(11));
+ }
+ return res;
+ }
+
+ public void SetDownloadProgress(int totalSize, int download)
+ {
+
+ }
+
+ public string LocalResPath
+ {
+ get { return string.Format("{0}{1}", AssetBundlePathHelper.PersistentDataPath4Photo, mHashCode); }
+ }
+
+ public virtual object RawAsset
+ {
+ get { return mRawAsset; }
+ }
+
+ public bool NeedDownload
+ {
+ get { return RefCount > 0; }
+ }
+
+ public string Url
+ {
+ get { return mFullPath; }
+ }
+
+ public int FileSize
+ {
+ get { return 1; }
+ }
+
+ public void SetUrl(string url)
+ {
+ if (string.IsNullOrEmpty(url))
+ {
+ return;
+ }
+
+ mFullPath = url;
+ mHashCode = string.Format("Photo_{0}", mFullPath.GetHashCode());
+ }
+
+ public override bool UnloadImage(bool flag)
+ {
+ return false;
+ }
+
+ public override bool LoadSync()
+ {
+ return false;
+ }
+
+ public override void LoadAsync()
+ {
+ if (!CheckLoadAble())
+ {
+ return;
+ }
+
+ if (string.IsNullOrEmpty(mAssetName))
+ {
+ return;
+ }
+
+ DoLoadWork();
+ }
+
+ private void DoLoadWork()
+ {
+ State = ResState.Loading;
+
+ OnDownLoadResult(true);
+
+ //ⱾļǷ
+ /*
+ if (!File.Exists(LocalResPath))
+ {
+ ResDownloader.S.AddDownloadTask(this);
+ }
+ else
+ {
+ OnDownLoadResult(true);
+ }
+ */
+ }
+
+ protected override void OnReleaseRes()
+ {
+ if (mAsset != null)
+ {
+ GameObject.Destroy(mAsset);
+ mAsset = null;
+ }
+
+ mRawAsset = null;
+ }
+
+ public override void Recycle2Cache()
+ {
+ SafeObjectPool.Instance.Recycle(this);
+ }
+
+ public override void OnRecycled()
+ {
+
+ }
+
+ public void DeleteOldResFile()
+ {
+ //throw new NotImplementedException();
+ }
+
+ public void OnDownLoadResult(bool result)
+ {
+ if (!result)
+ {
+ OnResLoadFaild();
+ return;
+ }
+
+ if (RefCount <= 0)
+ {
+ State = ResState.Waiting;
+ return;
+ }
+
+ ResMgr.Instance.PushIEnumeratorTask(this);
+ }
+
+ //ȫWWWʽ,Unity 棬ЧòƸ
+ // TODO:persistantPath read
+ public override IEnumerator DoLoadAsync(System.Action finishCallback)
+ {
+ AudioType type = AudioType.MPEG;
+
+ if (mFullPath.EndsWith("mp3"))
+ {
+ type = AudioType.MPEG;
+ }
+ else if (mFullPath.EndsWith("ogg"))
+ {
+ type = AudioType.OGGVORBIS;
+ }
+ else if (mFullPath.EndsWith("wav"))
+ {
+ type = AudioType.WAV;
+ }
+ using (UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(mFullPath, type))
+ {
+ yield return request.SendWebRequest();
+
+ if (request.result != UnityWebRequest.Result.Success)
+ {
+ Debug.LogError(string.Format("Res:{0}, WWW Errors:{1}", mFullPath, request.error));
+ OnResLoadFaild();
+ finishCallback();
+ yield break;
+ }
+ else
+ {
+ // Convert the downloaded data to an AudioClip
+ AudioClip clip = DownloadHandlerAudioClip.GetContent(request);
+ mAsset = clip;
+ }
+
+ if (RefCount <= 0)
+ {
+ OnResLoadFaild();
+ finishCallback();
+ yield break;
+ }
+ }
+
+ State = ResState.Ready;
+
+ finishCallback();
+ }
+
+ protected override float CalculateProgress()
+ {
+ if (request == null)
+ {
+ return 0;
+ }
+
+ return request.downloadProgress;
+ }
+
+ /*
+ public IEnumerator StartIEnumeratorTask2(Action finishCallback)
+ {
+ if (refCount <= 0)
+ {
+ OnResLoadFaild();
+ finishCallback();
+ yield break;
+ }
+
+ WWW www = new WWW("file://" + LocalResPath);
+ yield return www;
+ if (www.error != null)
+ {
+ Log.E("WWW Error:" + www.error);
+ OnResLoadFaild();
+ finishCallback();
+ yield break;
+ }
+
+ if (!www.isDone)
+ {
+ Log.E("NetImageRes WWW Not Done! Url:" + m_Url);
+ OnResLoadFaild();
+ finishCallback();
+
+ www.Dispose();
+ www = null;
+
+ yield break;
+ }
+
+ if (refCount <= 0)
+ {
+ OnResLoadFaild();
+ finishCallback();
+
+ www.Dispose();
+ www = null;
+ yield break;
+ }
+
+ TimeDebugger dt = new TimeDebugger("Tex");
+ dt.Begin("LoadingTask");
+ Texture2D tex = www.texture;
+ tex.Compress(true);
+ dt.End();
+ dt.Dump(-1);
+
+ m_Asset = tex;
+ www.Dispose();
+ www = null;
+
+ resState = eResState.kReady;
+
+ finishCallback();
+ }
+ */
+ }
+}
diff --git a/Assets/QFramework/Toolkits/ResKit/Scripts/LocalAudioSupport.cs.meta b/Assets/QFramework/Toolkits/ResKit/Scripts/LocalAudioSupport.cs.meta
new file mode 100644
index 00000000..b2669f75
--- /dev/null
+++ b/Assets/QFramework/Toolkits/ResKit/Scripts/LocalAudioSupport.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 9964b8282bdb1684b99f6eaefd2f2f1e
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/UI/UIHint.cs b/Assets/Scripts/UI/UIHint.cs
index 1fb952b0..769ffc88 100644
--- a/Assets/Scripts/UI/UIHint.cs
+++ b/Assets/Scripts/UI/UIHint.cs
@@ -2,6 +2,7 @@ using UnityEngine;
using UnityEngine.UI;
using QFramework;
using DG.Tweening;
+using System.Runtime.CompilerServices;
namespace QFramework.Example
{
@@ -39,17 +40,14 @@ namespace QFramework.Example
{
string path = Global.audioPath + mData.audio;
loader = ResLoader.Allocate();
- loader.Add2Load(path.ToNetImageResName(), (success, res) =>
+ loader.Add2Load(path.ToLocalAudioResName(), (success, res) =>
{
if (success)
{
- AudioKit.PlayVoice(res.As(), false);
+ AudioKit.PlayVoice(res.Asset.As(), false);
}
});
- loader.LoadAsync(() =>
- {
- loader.Recycle2Cache();
- });
+ loader.LoadAsync();
}
}
diff --git a/Assets/Third.meta b/Assets/Third.meta
new file mode 100644
index 00000000..3f8b8d61
--- /dev/null
+++ b/Assets/Third.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: a7664b83b06ff8c4d8c951aa9012f9e1
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Third/WebGLSupport.meta b/Assets/Third/WebGLSupport.meta
new file mode 100644
index 00000000..2aea70f1
--- /dev/null
+++ b/Assets/Third/WebGLSupport.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 84df1f4338a421641ac99067546e8139
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Third/WebGLSupport/Editor.meta b/Assets/Third/WebGLSupport/Editor.meta
new file mode 100644
index 00000000..908e2558
--- /dev/null
+++ b/Assets/Third/WebGLSupport/Editor.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 59d15a398f7a6ef4ca057f6d2471425f
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Third/WebGLSupport/Editor/Postprocessor.cs b/Assets/Third/WebGLSupport/Editor/Postprocessor.cs
new file mode 100644
index 00000000..ae670b91
--- /dev/null
+++ b/Assets/Third/WebGLSupport/Editor/Postprocessor.cs
@@ -0,0 +1,59 @@
+using System.IO;
+using UnityEditor;
+using UnityEditor.Callbacks;
+using UnityEngine;
+
+namespace WebGLSupport
+{
+ public class Postprocessor
+ {
+ const string MenuPath = "Assets/WebGLSupport/OverwriteFullscreenButton";
+
+#if UNITY_2021_1_OR_NEWER
+ static readonly bool supportedPostprocessor = true;
+ static readonly string defaultFullscreenFunc = "unityInstance.SetFullscreen(1);";
+ static readonly string fullscreenNode = "unity-container";
+#else
+ static readonly bool supportedPostprocessor = false;
+ static readonly string defaultFullscreenFunc = "";
+ static readonly string fullscreenNode = "";
+#endif
+
+ private static bool IsEnable => PlayerPrefs.GetInt(MenuPath, 1) == 1;
+
+ [PostProcessBuild(1)]
+ public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
+ {
+ if (target != BuildTarget.WebGL) return;
+ if (!supportedPostprocessor) return;
+ if (!IsEnable) return;
+
+ var path = Path.Combine(pathToBuiltProject, "index.html");
+ if (!File.Exists(path)) return;
+
+ var html = File.ReadAllText(path);
+
+ // check node is exist
+ if (html.Contains(fullscreenNode))
+ {
+ html = html.Replace(defaultFullscreenFunc, $"document.makeFullscreen('{fullscreenNode}');");
+ File.WriteAllText(path, html);
+ }
+ }
+
+ [MenuItem(MenuPath)]
+ public static void OverwriteDefaultFullscreenButton()
+ {
+ var flag = !Menu.GetChecked(MenuPath);
+ Menu.SetChecked(MenuPath, flag);
+ PlayerPrefs.SetInt(MenuPath, flag ? 1 : 0);
+ }
+
+ [MenuItem(MenuPath, validate = true)]
+ private static bool OverwriteDefaultFullscreenButtonValidator()
+ {
+ Menu.SetChecked(MenuPath, IsEnable);
+ return true;
+ }
+ }
+}
diff --git a/Assets/Third/WebGLSupport/Editor/Postprocessor.cs.meta b/Assets/Third/WebGLSupport/Editor/Postprocessor.cs.meta
new file mode 100644
index 00000000..111a49e8
--- /dev/null
+++ b/Assets/Third/WebGLSupport/Editor/Postprocessor.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: a264ac0d7a7e8a746aa37a17a495e24f
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Third/WebGLSupport/WebGLInput.meta b/Assets/Third/WebGLSupport/WebGLInput.meta
new file mode 100644
index 00000000..f95881ef
--- /dev/null
+++ b/Assets/Third/WebGLSupport/WebGLInput.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 23d83eab8f753b04fb7f1384ac6676a0
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Third/WebGLSupport/WebGLInput/Detail.meta b/Assets/Third/WebGLSupport/WebGLInput/Detail.meta
new file mode 100644
index 00000000..58cc3251
--- /dev/null
+++ b/Assets/Third/WebGLSupport/WebGLInput/Detail.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: dd840bb14379149498902237a63bb794
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Third/WebGLSupport/WebGLInput/Detail/RebuildChecker.cs b/Assets/Third/WebGLSupport/WebGLInput/Detail/RebuildChecker.cs
new file mode 100644
index 00000000..a61ca381
--- /dev/null
+++ b/Assets/Third/WebGLSupport/WebGLInput/Detail/RebuildChecker.cs
@@ -0,0 +1,64 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace WebGLSupport.Detail
+{
+ public class RebuildChecker
+ {
+ IInputField input;
+
+ string beforeString;
+ int beforeCaretPosition;
+ int beforeSelectionFocusPosition;
+ int beforeSelectionAnchorPosition;
+ //Vector2 anchoredPosition;
+
+ public RebuildChecker(IInputField input)
+ {
+ this.input = input;
+ }
+
+ public bool NeedRebuild(bool debug = false)
+ {
+ var res = false;
+
+ // any not same
+ if (beforeString != input.text)
+ {
+ if(debug) Debug.Log(string.Format("beforeString : {0} != {1}", beforeString, input.text));
+ beforeString = input.text;
+ res = true;
+ }
+
+ if (beforeCaretPosition != input.caretPosition)
+ {
+ if (debug) Debug.Log(string.Format("beforeCaretPosition : {0} != {1}", beforeCaretPosition, input.caretPosition));
+ beforeCaretPosition = input.caretPosition;
+ res = true;
+ }
+
+ if (beforeSelectionFocusPosition != input.selectionFocusPosition)
+ {
+ if (debug) Debug.Log(string.Format("beforeSelectionFocusPosition : {0} != {1}", beforeSelectionFocusPosition, input.selectionFocusPosition));
+ beforeSelectionFocusPosition = input.selectionFocusPosition;
+ res = true;
+ }
+
+ if (beforeSelectionAnchorPosition != input.selectionAnchorPosition)
+ {
+ if (debug) Debug.Log(string.Format("beforeSelectionAnchorPosition : {0} != {1}", beforeSelectionAnchorPosition, input.selectionAnchorPosition));
+ beforeSelectionAnchorPosition = input.selectionAnchorPosition;
+ res = true;
+ }
+
+ //if (anchoredPosition != input.TextComponentRectTransform().anchoredPosition)
+ //{
+ // if (debug) Debug.Log(string.Format("anchoredPosition : {0} != {1}", anchoredPosition, input.TextComponentRectTransform().anchoredPosition));
+ // anchoredPosition = input.TextComponentRectTransform().anchoredPosition;
+ // res = true;
+ //}
+ return res;
+ }
+ }
+}
diff --git a/Assets/Third/WebGLSupport/WebGLInput/Detail/RebuildChecker.cs.meta b/Assets/Third/WebGLSupport/WebGLInput/Detail/RebuildChecker.cs.meta
new file mode 100644
index 00000000..3f04d6e8
--- /dev/null
+++ b/Assets/Third/WebGLSupport/WebGLInput/Detail/RebuildChecker.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 3cb8b49a6bee2384b888ba951eb2bdbd
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Third/WebGLSupport/WebGLInput/Detail/Support.cs b/Assets/Third/WebGLSupport/WebGLInput/Detail/Support.cs
new file mode 100644
index 00000000..6fd0504b
--- /dev/null
+++ b/Assets/Third/WebGLSupport/WebGLInput/Detail/Support.cs
@@ -0,0 +1,45 @@
+using UnityEngine;
+
+namespace WebGLSupport.Detail
+{
+ public static class Support
+ {
+ ///
+ /// 画面内の描画範囲を取得する
+ ///
+ ///
+ ///
+ public static Rect GetScreenCoordinates(RectTransform uiElement)
+ {
+ var worldCorners = new Vector3[4];
+ uiElement.GetWorldCorners(worldCorners);
+
+ // try to support RenderMode:WorldSpace
+ var canvas = uiElement.GetComponentInParent