diff --git a/Assets/Plugins/Asp.meta b/Assets/Plugins/Asp.meta new file mode 100644 index 0000000..9ef6dab --- /dev/null +++ b/Assets/Plugins/Asp.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5245db37ffaf5384482cd9ae581d921b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Asp/Aspose.Words.dll b/Assets/Plugins/Asp/Aspose.Words.dll new file mode 100644 index 0000000..8e03f7e Binary files /dev/null and b/Assets/Plugins/Asp/Aspose.Words.dll differ diff --git a/Assets/Plugins/Asp/Aspose.Words.dll.meta b/Assets/Plugins/Asp/Aspose.Words.dll.meta new file mode 100644 index 0000000..83298c4 --- /dev/null +++ b/Assets/Plugins/Asp/Aspose.Words.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: c076867c77afa19408ff0411f1661b29 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Asp/I18N.CJK.dll b/Assets/Plugins/Asp/I18N.CJK.dll new file mode 100644 index 0000000..5a6db13 Binary files /dev/null and b/Assets/Plugins/Asp/I18N.CJK.dll differ diff --git a/Assets/Plugins/Asp/I18N.CJK.dll.meta b/Assets/Plugins/Asp/I18N.CJK.dll.meta new file mode 100644 index 0000000..b3d1818 --- /dev/null +++ b/Assets/Plugins/Asp/I18N.CJK.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: fa629f83f57078048a17fc3f5e3720af +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Asp/I18N.MidEast.dll b/Assets/Plugins/Asp/I18N.MidEast.dll new file mode 100644 index 0000000..a668940 Binary files /dev/null and b/Assets/Plugins/Asp/I18N.MidEast.dll differ diff --git a/Assets/Plugins/Asp/I18N.MidEast.dll.meta b/Assets/Plugins/Asp/I18N.MidEast.dll.meta new file mode 100644 index 0000000..152df1f --- /dev/null +++ b/Assets/Plugins/Asp/I18N.MidEast.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: c950e361e6b1e2f4d872bc7669507a26 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Asp/I18N.Other.dll b/Assets/Plugins/Asp/I18N.Other.dll new file mode 100644 index 0000000..7cc7e1c Binary files /dev/null and b/Assets/Plugins/Asp/I18N.Other.dll differ diff --git a/Assets/Plugins/Asp/I18N.Other.dll.meta b/Assets/Plugins/Asp/I18N.Other.dll.meta new file mode 100644 index 0000000..863b714 --- /dev/null +++ b/Assets/Plugins/Asp/I18N.Other.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: f5899f8e7237f4f4ea175ecb305b5d1d +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Asp/I18N.Rare.dll b/Assets/Plugins/Asp/I18N.Rare.dll new file mode 100644 index 0000000..e3c56c1 Binary files /dev/null and b/Assets/Plugins/Asp/I18N.Rare.dll differ diff --git a/Assets/Plugins/Asp/I18N.Rare.dll.meta b/Assets/Plugins/Asp/I18N.Rare.dll.meta new file mode 100644 index 0000000..8765858 --- /dev/null +++ b/Assets/Plugins/Asp/I18N.Rare.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 102f3f34ce012904e890960c7a5fb81a +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Asp/I18N.West.dll b/Assets/Plugins/Asp/I18N.West.dll new file mode 100644 index 0000000..843d72d Binary files /dev/null and b/Assets/Plugins/Asp/I18N.West.dll differ diff --git a/Assets/Plugins/Asp/I18N.West.dll.meta b/Assets/Plugins/Asp/I18N.West.dll.meta new file mode 100644 index 0000000..ecca76f --- /dev/null +++ b/Assets/Plugins/Asp/I18N.West.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 76a80607cca61d244885781bf220a8d2 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Asp/I18N.dll b/Assets/Plugins/Asp/I18N.dll new file mode 100644 index 0000000..b80f873 Binary files /dev/null and b/Assets/Plugins/Asp/I18N.dll differ diff --git a/Assets/Plugins/Asp/I18N.dll.meta b/Assets/Plugins/Asp/I18N.dll.meta new file mode 100644 index 0000000..74faaa5 --- /dev/null +++ b/Assets/Plugins/Asp/I18N.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 815eaf607fce2fa449ee031177df3c5f +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebGLDownLoadWord.meta b/Assets/WebGLDownLoadWord.meta new file mode 100644 index 0000000..0fde7e4 --- /dev/null +++ b/Assets/WebGLDownLoadWord.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 66a963eef57758a4bbfada0dbebd2905 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebGLDownLoadWord/Plugins.meta b/Assets/WebGLDownLoadWord/Plugins.meta new file mode 100644 index 0000000..73fe2e0 --- /dev/null +++ b/Assets/WebGLDownLoadWord/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c30ea19771718df4082a72c69a62a2da +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebGLDownLoadWord/Plugins/WebGLDownloadFile.jslib b/Assets/WebGLDownLoadWord/Plugins/WebGLDownloadFile.jslib new file mode 100644 index 0000000..dcdfd15 --- /dev/null +++ b/Assets/WebGLDownLoadWord/Plugins/WebGLDownloadFile.jslib @@ -0,0 +1,27 @@ + +mergeInto(LibraryManager.library, { + WebGLDownloadWord : function(array,size,reportjson) + { + var reportdata= UTF8ToString(reportjson); + var bytes = new Uint8Array(size); + for (var i = 0; i < size; i++) + { + bytes[i] = HEAPU8[array + i]; + } + + HtmlDownloadWord(bytes,reportdata); + + }, + CopyToClipboard: function(text) { + + var str = Pointer_stringify(text); + + + if (navigator.clipboard) { + navigator.clipboard.writeText(str).then(function() { + }).catch(function(error) { + }); + } else { + } + } +}); diff --git a/Assets/WebGLDownLoadWord/Plugins/WebGLDownloadFile.jslib.meta b/Assets/WebGLDownLoadWord/Plugins/WebGLDownloadFile.jslib.meta new file mode 100644 index 0000000..8b3613f --- /dev/null +++ b/Assets/WebGLDownLoadWord/Plugins/WebGLDownloadFile.jslib.meta @@ -0,0 +1,32 @@ +fileFormatVersion: 2 +guid: 3c5db0930befe7d419f28aed73f4dcd9 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + WebGL: WebGL + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebGLDownLoadWord/Resources.meta b/Assets/WebGLDownLoadWord/Resources.meta new file mode 100644 index 0000000..540a1cc --- /dev/null +++ b/Assets/WebGLDownLoadWord/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3f8ba2d94d39cde4497a65c1ececf209 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebGLDownLoadWord/Resources/下载Word配置文件.asset b/Assets/WebGLDownLoadWord/Resources/下载Word配置文件.asset new file mode 100644 index 0000000..9e9f600 --- /dev/null +++ b/Assets/WebGLDownLoadWord/Resources/下载Word配置文件.asset @@ -0,0 +1,17 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bca17604ecf2ff74a8c8bc9974e71bb3, type: 3} + m_Name: "\u4E0B\u8F7DWord\u914D\u7F6E\u6587\u4EF6" + m_EditorClassIdentifier: + Author: Chao + PackPathName: KunChong + TemplatePath: Assets/StreamingAssets/Template/ diff --git a/Assets/WebGLDownLoadWord/Resources/下载Word配置文件.asset.meta b/Assets/WebGLDownLoadWord/Resources/下载Word配置文件.asset.meta new file mode 100644 index 0000000..a50d02e --- /dev/null +++ b/Assets/WebGLDownLoadWord/Resources/下载Word配置文件.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c37e63a24fee820468a5815cbf92ec10 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebGLDownLoadWord/Scripts.meta b/Assets/WebGLDownLoadWord/Scripts.meta new file mode 100644 index 0000000..c27aeb6 --- /dev/null +++ b/Assets/WebGLDownLoadWord/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1e590c4ae3cc2b3428e1aee0548579e6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebGLDownLoadWord/Scripts/DownLoadWord.meta b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord.meta new file mode 100644 index 0000000..518bd54 --- /dev/null +++ b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 63ad792ad5744fb4e86f31716e3e26fe +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts.meta b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts.meta new file mode 100644 index 0000000..7eb6ac5 --- /dev/null +++ b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fce78ddffb926bf4cba621fc565358ba +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/C.meta b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/C.meta new file mode 100644 index 0000000..0057155 --- /dev/null +++ b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/C.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 95cfb9a8de2c1274fb9b3219d5518aec +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/C/ScreenShot.cs b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/C/ScreenShot.cs new file mode 100644 index 0000000..58d161e --- /dev/null +++ b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/C/ScreenShot.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +public class ScreenShot : MonoBehaviour +{ + public Texture2D screenImage; + public void Shot(Action callBack) + { + //if (MVC.GetModel().IsKaoHe) + //{ + // StartCoroutine(ScrrenCapture(callBack)); + //} + } + + IEnumerator ScrrenCapture(Action callBack) + { + yield return new WaitForEndOfFrame(); + // 创建一个新的Texture2D对象,尺寸为屏幕当前分辨率 + screenImage = new Texture2D(Screen.width, Screen.height); + // 读取屏幕上当前帧的像素 + screenImage.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0); + screenImage.Apply(); + //生成Base64 + string base64 = "data:image/png;base64," + Texture2DToBase64(screenImage); + // 清理 + callBack?.Invoke(base64); + } + + public string Texture2DToBase64(Texture2D texture) + { + byte[] data = texture.EncodeToPNG(); + return Convert.ToBase64String(data); + } +} diff --git a/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/C/ScreenShot.cs.meta b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/C/ScreenShot.cs.meta new file mode 100644 index 0000000..a7e7709 --- /dev/null +++ b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/C/ScreenShot.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9f66816bedeb18345a5f4f55bef8f9b0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/M.meta b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/M.meta new file mode 100644 index 0000000..dc22c5e --- /dev/null +++ b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/M.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: df4bb7b1427ea994c935597c8276fd22 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/M/LabReprotData.cs b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/M/LabReprotData.cs new file mode 100644 index 0000000..2c2d03b --- /dev/null +++ b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/M/LabReprotData.cs @@ -0,0 +1,259 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using System; +/// +/// 实验报告基础参数 +/// +[Serializable] +public class LabReprotData +{ + public string realname; + + #region 选择题基础数据 + public string xuanzeti_1; + public string xuanzeti_2; + public string xuanzeti_3; + public string xuanzeti_4; + public string xuanzeti_5; + public string xuanzeti_6; + public string xuanzeti_7; + public string xuanzeti_8; + public string xuanzeti_9; + public string xuanzeti_10; + public string xuanzeti_11; + public string xuanzeti_12; + public string xuanzeti_13; + public string xuanzeti_14; + public string xuanzeti_15; + #endregion + + #region 标本采集1基础数据 + public string biaobencaiji_1_name; + public string biaobencaiji_1_shijian; + public string biaobencaiji_1_buzhou_1; + public string biaobencaiji_1_jilu_1; + public string biaobencaiji_1_image_1; + public string biaobencaiji_1_daan_1; + public string biaobencaiji_1_buzhou_2; + public string biaobencaiji_1_jilu_2; + public string biaobencaiji_1_image_2; + public string biaobencaiji_1_daan_2; + public string biaobencaiji_1_buzhou_3; + public string biaobencaiji_1_jilu_3; + public string biaobencaiji_1_image_3; + public string biaobencaiji_1_daan_3; + public string biaobencaiji_1_buzhou_4; + public string biaobencaiji_1_jilu_4; + public string biaobencaiji_1_image_4; + public string biaobencaiji_1_daan_4; + public string biaobencaiji_1_buzhou_5; + public string biaobencaiji_1_jilu_5; + public string biaobencaiji_1_image_5; + public string biaobencaiji_1_daan_5; + #endregion + #region 标本采集2基础数据 + public string biaobencaiji_2_name; + public string biaobencaiji_2_shijian; + public string biaobencaiji_2_buzhou_1; + public string biaobencaiji_2_jilu_1; + public string biaobencaiji_2_image_1; + public string biaobencaiji_2_daan_1; + public string biaobencaiji_2_buzhou_2; + public string biaobencaiji_2_jilu_2; + public string biaobencaiji_2_image_2; + public string biaobencaiji_2_daan_2; + public string biaobencaiji_2_buzhou_3; + public string biaobencaiji_2_jilu_3; + public string biaobencaiji_2_image_3; + public string biaobencaiji_2_daan_3; + public string biaobencaiji_2_buzhou_4; + public string biaobencaiji_2_jilu_4; + public string biaobencaiji_2_image_4; + public string biaobencaiji_2_daan_4; + #endregion + #region 标本采集3基础数据 + public string biaobencaiji_3_name; + public string biaobencaiji_3_shijian; + public string biaobencaiji_3_buzhou_1; + public string biaobencaiji_3_jilu_1; + public string biaobencaiji_3_image_1; + public string biaobencaiji_3_daan_1; + public string biaobencaiji_3_buzhou_2; + public string biaobencaiji_3_jilu_2; + public string biaobencaiji_3_image_2; + public string biaobencaiji_3_daan_2; + public string biaobencaiji_3_buzhou_3; + public string biaobencaiji_3_jilu_3; + public string biaobencaiji_3_image_3; + public string biaobencaiji_3_daan_3; + public string biaobencaiji_3_buzhou_4; + public string biaobencaiji_3_jilu_4; + public string biaobencaiji_3_image_4; + public string biaobencaiji_3_daan_4; + #endregion + #region 标本采集4基础数据 + public string biaobencaiji_4_name; + public string biaobencaiji_4_shijian; + public string biaobencaiji_4_buzhou_1; + public string biaobencaiji_4_jilu_1; + public string biaobencaiji_4_image_1; + public string biaobencaiji_4_daan_1; + public string biaobencaiji_4_buzhou_2; + public string biaobencaiji_4_jilu_2; + public string biaobencaiji_4_image_2; + public string biaobencaiji_4_daan_2; + public string biaobencaiji_4_buzhou_3; + public string biaobencaiji_4_jilu_3; + public string biaobencaiji_4_image_3; + public string biaobencaiji_4_daan_3; + public string biaobencaiji_4_buzhou_4; + public string biaobencaiji_4_jilu_4; + public string biaobencaiji_4_image_4; + public string biaobencaiji_4_daan_4; + #endregion + #region 标本采集5基础数据 + public string biaobencaiji_5_name; + public string biaobencaiji_5_shijian; + public string biaobencaiji_5_buzhou_1; + public string biaobencaiji_5_jilu_1; + public string biaobencaiji_5_image_1; + public string biaobencaiji_5_daan_1; + public string biaobencaiji_5_buzhou_2; + public string biaobencaiji_5_jilu_2; + public string biaobencaiji_5_image_2; + public string biaobencaiji_5_daan_2; + public string biaobencaiji_5_buzhou_3; + public string biaobencaiji_5_jilu_3; + public string biaobencaiji_5_image_3; + public string biaobencaiji_5_daan_3; + public string biaobencaiji_5_buzhou_4; + public string biaobencaiji_5_jilu_4; + public string biaobencaiji_5_image_4; + public string biaobencaiji_5_daan_4; + #endregion + #region 标本采集6基础数据 + public string biaobencaiji_6_name; + public string biaobencaiji_6_shijian; + public string biaobencaiji_6_buzhou_1; + public string biaobencaiji_6_jilu_1; + public string biaobencaiji_6_image_1; + public string biaobencaiji_6_daan_1; + public string biaobencaiji_6_buzhou_2; + public string biaobencaiji_6_jilu_2; + public string biaobencaiji_6_image_2; + public string biaobencaiji_6_daan_2; + public string biaobencaiji_6_buzhou_3; + public string biaobencaiji_6_jilu_3; + public string biaobencaiji_6_image_3; + public string biaobencaiji_6_daan_3; + public string biaobencaiji_6_buzhou_4; + public string biaobencaiji_6_jilu_4; + public string biaobencaiji_6_image_4; + public string biaobencaiji_6_daan_4; + #endregion + + #region 标本制作1基础数据 + public string biaobenzhizuo_1_name; + public string biaobenzhizuo_1_jilu_1; + public string biaobenzhizuo_1_image_1; + public string biaobenzhizuo_1_daan_1; + public string biaobenzhizuo_1_jilu_2; + public string biaobenzhizuo_1_image_2; + public string biaobenzhizuo_1_daan_2; + public string biaobenzhizuo_1_jilu_3; + public string biaobenzhizuo_1_image_3; + public string biaobenzhizuo_1_daan_3; + public string biaobenzhizuo_1_jilu_4; + public string biaobenzhizuo_1_image_4; + public string biaobenzhizuo_1_daan_4; + public string biaobenzhizuo_1_jilu_5; + public string biaobenzhizuo_1_image_5; + public string biaobenzhizuo_1_daan_5; + #endregion + #region 标本制作2基础数据 + public string biaobenzhizuo_2_name; + public string biaobenzhizuo_2_jilu_1; + public string biaobenzhizuo_2_image_1; + public string biaobenzhizuo_2_daan_1; + public string biaobenzhizuo_2_jilu_2; + public string biaobenzhizuo_2_image_2; + public string biaobenzhizuo_2_daan_2; + public string biaobenzhizuo_2_jilu_3; + public string biaobenzhizuo_2_image_3; + public string biaobenzhizuo_2_daan_3; + #endregion + #region 标本制作3基础数据 + public string biaobenzhizuo_3_name; + public string biaobenzhizuo_3_jilu_1; + public string biaobenzhizuo_3_image_1; + public string biaobenzhizuo_3_daan_1; + public string biaobenzhizuo_3_jilu_2; + public string biaobenzhizuo_3_image_2; + public string biaobenzhizuo_3_daan_2; + public string biaobenzhizuo_3_jilu_3; + public string biaobenzhizuo_3_image_3; + public string biaobenzhizuo_3_daan_3; + #endregion + #region 标本制作4基础数据 + public string biaobenzhizuo_4_name; + public string biaobenzhizuo_4_jilu_1; + public string biaobenzhizuo_4_image_1; + public string biaobenzhizuo_4_daan_1; + public string biaobenzhizuo_4_jilu_2; + public string biaobenzhizuo_4_image_2; + public string biaobenzhizuo_4_daan_2; + public string biaobenzhizuo_4_jilu_3; + public string biaobenzhizuo_4_image_3; + public string biaobenzhizuo_4_daan_3; + public string biaobenzhizuo_4_jilu_4; + public string biaobenzhizuo_4_image_4; + public string biaobenzhizuo_4_daan_4; + public string biaobenzhizuo_4_jilu_5; + public string biaobenzhizuo_4_image_5; + public string biaobenzhizuo_4_daan_5; + public string biaobenzhizuo_4_jilu_6; + public string biaobenzhizuo_4_image_6; + public string biaobenzhizuo_4_daan_6; + public string biaobenzhizuo_4_jilu_7; + public string biaobenzhizuo_4_image_7; + public string biaobenzhizuo_4_daan_7; + public string biaobenzhizuo_4_jilu_8; + public string biaobenzhizuo_4_image_8; + public string biaobenzhizuo_4_daan_8; + public string biaobenzhizuo_4_jilu_9; + public string biaobenzhizuo_4_image_9; + public string biaobenzhizuo_4_daan_9; + public string biaobenzhizuo_4_jilu_10; + public string biaobenzhizuo_4_image_10; + public string biaobenzhizuo_4_daan_10; + public string biaobenzhizuo_4_jilu_11; + public string biaobenzhizuo_4_image_11; + public string biaobenzhizuo_4_daan_11; + public string biaobenzhizuo_4_jilu_12; + public string biaobenzhizuo_4_image_12; + public string biaobenzhizuo_4_daan_12; + public string biaobenzhizuo_4_jilu_13; + public string biaobenzhizuo_4_image_13; + public string biaobenzhizuo_4_daan_13; + #endregion + #region 标本制作5蝶翅画 + public string biaobenzhizuo_diechihua_image; + #endregion + + #region 昆虫解剖1基础数据 + public string kunchongjiepou_1_name; + public string kunchongjiepou_1_buzhou_1; + public string kunchongjiepou_1_jilu_1; + public string kunchongjiepou_1_image_1; + public string kunchongjiepou_1_daan_1; + public string kunchongjiepou_1_buzhou_2; + public string kunchongjiepou_1_jilu_2; + public string kunchongjiepou_1_image_2; + public string kunchongjiepou_1_daan_2; + public string kunchongjiepou_1_buzhou_3; + public string kunchongjiepou_1_jilu_3; + public string kunchongjiepou_1_image_3; + public string kunchongjiepou_1_daan_3; + #endregion +} diff --git a/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/M/LabReprotData.cs.meta b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/M/LabReprotData.cs.meta new file mode 100644 index 0000000..123ce6a --- /dev/null +++ b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/M/LabReprotData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 88f29195f280e2b4aaff177780c5bcd0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/V.meta b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/V.meta new file mode 100644 index 0000000..b393a9e --- /dev/null +++ b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/LabReprotScripts/V.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5bd960b5c0324a542b043cc588092b8a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/WebGLDownLoadFileScripts.meta b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/WebGLDownLoadFileScripts.meta new file mode 100644 index 0000000..f07c2f6 --- /dev/null +++ b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/WebGLDownLoadFileScripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b448d06c5c5ff52468263f9ad64fad22 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/WebGLDownLoadFileScripts/WebGLDownLoadFile.cs b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/WebGLDownLoadFileScripts/WebGLDownLoadFile.cs new file mode 100644 index 0000000..b7fdb8f --- /dev/null +++ b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/WebGLDownLoadFileScripts/WebGLDownLoadFile.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +using UnityEngine; +using UnityEngine.Networking; + +/// +/// 下载Word脚本 +/// +public class WebGLDownLoadFile : MonoBehaviour +{ + + [DllImport("__Internal")] + private static extern void WebGLDownloadWord(byte[] array, int size, string reportjson); + + public static WebGLDownLoadFile instance; + private void Awake() + { + instance = this; + DontDestroyOnLoad(this); + } + + /// + /// 下载Word 方法 + /// + public void Download(string json) + { + #region 初始化 + //LabReprotData reprotData = new LabReprotData(); + //// 转json + //string json = JsonUtility.ToJson(reprotData, true); + #endregion + + // 调用携程下载数据 + StartCoroutine(WebGLDownloadWord(json)); + } + + + /// + /// 下载Word + /// + /// 实验报告json + /// + IEnumerator WebGLDownloadWord(string json) + { + UnityWebRequest request = UnityWebRequest.Get(Global.reportDemoPath); + yield return request.SendWebRequest(); + + if (string.IsNullOrEmpty(request.error) == false) + { + Debug.Log("错误路径:" + request.error); + } + else + { + // 下载word + DownloadDocx(request.downloadHandler.data, json); + } + } + + /// + /// 调用下载Word + /// + /// 支持多种文件格式下载(doc docx xml xlsx txt等) + /// json数据 + public void DownloadDocx(byte[] bytes, string reportjson) + { + WebGLDownloadWord(bytes, bytes.Length, reportjson); + } + +} diff --git a/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/WebGLDownLoadFileScripts/WebGLDownLoadFile.cs.meta b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/WebGLDownLoadFileScripts/WebGLDownLoadFile.cs.meta new file mode 100644 index 0000000..be8bc63 --- /dev/null +++ b/Assets/WebGLDownLoadWord/Scripts/DownLoadWord/WebGLDownLoadFileScripts/WebGLDownLoadFile.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 40ec725cf2804f149acc5f79096b0f59 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebGLDownLoadWord/Scripts/Editor.meta b/Assets/WebGLDownLoadWord/Scripts/Editor.meta new file mode 100644 index 0000000..6987c7f --- /dev/null +++ b/Assets/WebGLDownLoadWord/Scripts/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 98a6b80550e33de4c8d7a6880d9d6eb7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebGLDownLoadWord/Scripts/Editor/CreateHtml.cs b/Assets/WebGLDownLoadWord/Scripts/Editor/CreateHtml.cs new file mode 100644 index 0000000..6e250b7 --- /dev/null +++ b/Assets/WebGLDownLoadWord/Scripts/Editor/CreateHtml.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using UnityEditor; +using UnityEditor.ProjectWindowCallback; +using UnityEngine; +public class CreateHtml +{ + + [MenuItem("Assets/Create/创建WordAssets文件/Webgl Index Html", false, 60)] + public static void CreateIndex() + { + //参数为传递给CreateEventCSScriptAsset类action方法的参数 + + var endNameEditAction = ScriptableObject.CreateInstance(); + + var icon = EditorGUIUtility.FindTexture("html Script Icon"); + + var resourceFile = "Assets/StreamingAssets/Template/" + "Index.html.txt"; + + ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, endNameEditAction, "index.html", icon, resourceFile); + } +} +public class CreateEventCSScriptAsset : EndNameEditAction +{ + public override void Action(int instanceId, string pathName, string resourceFile) + { + //创建资源 + UnityEngine.Object obj = CreateScriptAssetFromTemplate(pathName, resourceFile); + ProjectWindowUtil.ShowCreatedAsset(obj);//高亮显示资源 + } + + private static UnityEngine.Object CreateScriptAssetFromTemplate(string pathName, string resourceFile) + { + //获取要创建资源的绝对路径 + string fullPath = Path.GetFullPath(pathName); + + //读取本地的模板文件 + StreamReader streamReader = new StreamReader(resourceFile); + string text = streamReader.ReadToEnd(); + streamReader.Close(); + + //获取文件名,不含扩展名 + string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(pathName); + text = Regex.Replace(text, "#ScriptName#", fileNameWithoutExtension); + text = Regex.Replace(text, "#Author#", WordConfig.Instance.Author); + text = Regex.Replace(text, "#ProgramName#", PlayerSettings.productName); + text = Regex.Replace(text, "#NowTime#", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); + text = Regex.Replace(text, "#ReleasePathName#", WordConfig.Instance.PackPathName); + + //写入配置文件 + bool encoderShouldEmitUTF8Identifier = true; //参数指定是否提供 Unicode 字节顺序标记 + bool throwOnInvalidBytes = false;//是否在检测到无效的编码时引发异常 + bool append = false; + UTF8Encoding encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier, throwOnInvalidBytes); + StreamWriter streamWriter = new StreamWriter(fullPath, append, encoding); + streamWriter.Write(text); + streamWriter.Close(); + + //刷新资源管理器 + AssetDatabase.ImportAsset(pathName); + AssetDatabase.Refresh(); + return AssetDatabase.LoadAssetAtPath(pathName, typeof(UnityEngine.Object)); + } +} + + diff --git a/Assets/WebGLDownLoadWord/Scripts/Editor/CreateHtml.cs.meta b/Assets/WebGLDownLoadWord/Scripts/Editor/CreateHtml.cs.meta new file mode 100644 index 0000000..e634c26 --- /dev/null +++ b/Assets/WebGLDownLoadWord/Scripts/Editor/CreateHtml.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4b73c4f0759d3ca4e96d8a83388d6e8f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebGLDownLoadWord/Scripts/Editor/WordConfig.cs b/Assets/WebGLDownLoadWord/Scripts/Editor/WordConfig.cs new file mode 100644 index 0000000..1eeeaf7 --- /dev/null +++ b/Assets/WebGLDownLoadWord/Scripts/Editor/WordConfig.cs @@ -0,0 +1,50 @@ +using System.IO; +using UnityEditor; +using UnityEngine; +[CreateAssetMenu(fileName = "下载Word配置文件", menuName = "创建WordAssets文件/配置文件")] +public class WordConfig : ScriptableObject +{ + + /// + /// 作者 + /// + [Header("作者")] + public string Author = "ChenXiang"; + + /// + /// 项目发布目录名称 + /// + [Header("项目发布目录名称")] + public string PackPathName = "目录名称"; + + /// + /// 模板路径 + /// + [Header("模板路径")] + public string TemplatePath = "Assets/StreamingAssets/Template/"; + + private static WordConfig instance; + + public static WordConfig Instance + { + get + { + if (instance != null) + { + return instance; + } + + instance = Resources.Load("下载Word配置文件"); + if (instance == null) + { + Debug.Log("Resources资源为空请创建文件"); + instance = CreateInstance(); + AssetDatabase.CreateAsset(instance, Application.dataPath + "/Resources"); + } + + return instance; + } + } +} + + diff --git a/Assets/WebGLDownLoadWord/Scripts/Editor/WordConfig.cs.meta b/Assets/WebGLDownLoadWord/Scripts/Editor/WordConfig.cs.meta new file mode 100644 index 0000000..aa3aeb0 --- /dev/null +++ b/Assets/WebGLDownLoadWord/Scripts/Editor/WordConfig.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: befc8bc5bf204f047a84c5781e59ffc4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WebGLDownLoadWord/Scripts/Editor/WordConfigWindow.cs b/Assets/WebGLDownLoadWord/Scripts/Editor/WordConfigWindow.cs new file mode 100644 index 0000000..85ffa7a --- /dev/null +++ b/Assets/WebGLDownLoadWord/Scripts/Editor/WordConfigWindow.cs @@ -0,0 +1,55 @@ +using System.IO; +using UnityEditor; +using UnityEngine; +/// +/// 脚本配置窗口 +/// +public class WordConfigWindow : EditorWindow +{ + + /// + /// 脚本配置菜单 + /// + // 添加一个新的菜单项 CTRL-SHIFT-A + [MenuItem("WordConfig/WordConfigWindow &f")] + static void ScriptsConfig() + { + WordConfigWindow configWindow = new WordConfigWindow(); + configWindow.minSize = new Vector2(600, 300); + configWindow.maxSize = new Vector2(600, 300); + configWindow.Show(); + } + /// + /// + /// + private void OnGUI() + { + GUILayout.BeginVertical(); + GUILayout.Space(30); + GUI.skin.label.fontSize = 15; + + GUI.skin.label.alignment = TextAnchor.UpperLeft; + this.titleContent = new GUIContent("脚本生成配置"); + + WordConfig.Instance.Author = EditorGUILayout.TextField("作者:", WordConfig.Instance.Author); + GUILayout.Space(10); + WordConfig.Instance.PackPathName = EditorGUILayout.TextField("项目发布路径名称:", WordConfig.Instance.PackPathName); + GUILayout.Space(10); + WordConfig.Instance.TemplatePath = EditorGUILayout.TextField("模板路径:", WordConfig.Instance.TemplatePath); + GUILayout.Space(10); + GUI.skin.label.alignment = TextAnchor.MiddleCenter; + GUILayout.Space(20); + GUI.color = Color.red; + + + if (GUILayout.Button("完成")) + { + AssetDatabase.SaveAssets(); + AssetDatabase.Refresh(); + this.Close(); + + } + GUILayout.EndVertical(); + } + +} diff --git a/Assets/WebGLDownLoadWord/Scripts/Editor/WordConfigWindow.cs.meta b/Assets/WebGLDownLoadWord/Scripts/Editor/WordConfigWindow.cs.meta new file mode 100644 index 0000000..7ada1c7 --- /dev/null +++ b/Assets/WebGLDownLoadWord/Scripts/Editor/WordConfigWindow.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 40feb81115ab2284e8d2f91c2b43fb93 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scenes/Home.unity b/Assets/_Scenes/Home.unity index f2d0354..062fd89 100644 --- a/Assets/_Scenes/Home.unity +++ b/Assets/_Scenes/Home.unity @@ -2445,6 +2445,7 @@ GameObject: m_Component: - component: {fileID: 1619907666} - component: {fileID: 1619907667} + - component: {fileID: 1619907668} m_Layer: 0 m_Name: WebGL m_TagString: Untagged @@ -2481,6 +2482,18 @@ MonoBehaviour: m_EditorClassIdentifier: RSA: {fileID: 0} uploadUrl: +--- !u!114 &1619907668 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1619907665} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 40ec725cf2804f149acc5f79096b0f59, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1623041755 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/_Scripts/Application/DataModel/AZBSData/DataNiuHandler.cs b/Assets/_Scripts/Application/DataModel/AZBSData/DataNiuHandler.cs index f562b82..719cb7a 100644 --- a/Assets/_Scripts/Application/DataModel/AZBSData/DataNiuHandler.cs +++ b/Assets/_Scripts/Application/DataModel/AZBSData/DataNiuHandler.cs @@ -33,6 +33,7 @@ namespace ZXK.LouDiXvMuNiu /// private Dictionary> _examScore = new Dictionary>(); + public Dictionary scoreTime = new Dictionary(); public DataNiuHandler() { InitAppData(); @@ -40,11 +41,11 @@ namespace ZXK.LouDiXvMuNiu public void InitAppData() { -//#if UNITY_EDITOR || UNITY_STANDALONE_WIN -// string[] excelList = Directory.GetFiles(Application.streamingAssetsPath + ConstCtrl.EXCEL_PATH, "*.xlsx"); -// ExcelUtility excel = new ExcelUtility(excelList[0]); -// excel.ConvertToJson(Application.streamingAssetsPath + ConstCtrl.JSON_PATH + Path.GetFileNameWithoutExtension(excelList[0]) + ".txt", new UTF8Encoding(false)); -//#endif + //#if UNITY_EDITOR || UNITY_STANDALONE_WIN + // string[] excelList = Directory.GetFiles(Application.streamingAssetsPath + ConstCtrl.EXCEL_PATH, "*.xlsx"); + // ExcelUtility excel = new ExcelUtility(excelList[0]); + // excel.ConvertToJson(Application.streamingAssetsPath + ConstCtrl.JSON_PATH + Path.GetFileNameWithoutExtension(excelList[0]) + ".txt", new UTF8Encoding(false)); + //#endif string Niupath = Application.streamingAssetsPath + ConstCtrl.JSON_PATH + "NiuData.txt"; TxtFileHandle.ReadAllTxt(Niupath, (string vul) => { @@ -67,7 +68,7 @@ namespace ZXK.LouDiXvMuNiu }); } - public NiuData GetNextStep(NiuData curStep=null) + public NiuData GetNextStep(NiuData curStep = null) { if (curStep == null) curStep = CurNiuHandler.Value; List tempData = GameManager.Instance._DataNiuHandler.NiuStepTypeDic[GameManager.Instance._CurModelType]; @@ -110,7 +111,7 @@ namespace ZXK.LouDiXvMuNiu for (int i = 0; i < _niuDataArray.Count; i++) { - if (string.IsNullOrEmpty(_niuDataArray[i].TaskName)|| _niuDataArray[i].TaskName==ConstCtrl.TaskName_JieShao) continue; + if (string.IsNullOrEmpty(_niuDataArray[i].TaskName) || _niuDataArray[i].TaskName == ConstCtrl.TaskName_JieShao) continue; curstep = _niuDataArray[i]; if (i == _niuDataArray.Count - 1) { @@ -152,6 +153,16 @@ namespace ZXK.LouDiXvMuNiu _examScore[bigStepName].Add(smallStepName, 0); } _examScore[bigStepName][smallStepName] += score; + + if (scoreTime.ContainsKey(bigStepName + smallStepName) == false) + { + scoreTime.Add(bigStepName + smallStepName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); + } + else + { + scoreTime[bigStepName + smallStepName] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + } + return _examScore[bigStepName][smallStepName]; } } diff --git a/Assets/_Scripts/Application/UI/ScoreDataPanel.cs b/Assets/_Scripts/Application/UI/ScoreDataPanel.cs index 8fd9cc3..c0c4ac0 100644 --- a/Assets/_Scripts/Application/UI/ScoreDataPanel.cs +++ b/Assets/_Scripts/Application/UI/ScoreDataPanel.cs @@ -1,8 +1,11 @@ using CG.Framework; using CG.UTility; +using Newtonsoft.Json; +using System; using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.Networking; using UnityEngine.UI; /******************************************************************************* *Create By CG @@ -61,38 +64,95 @@ namespace ZXK.LouDiXvMuNiu { if (!CheckInfo()) return; Queue scoreQueue = GameManager.Instance._DataNiuHandler.GetExamScore(); -#if UNITY_EDITOR || UNITY_STANDALONE + string json = string.Empty; - string savePath = CG.UTility.FolderBrowserHelper.GetPathFromWindowsExplorer(); - if (!string.IsNullOrEmpty(savePath)) + + // ģݣƣܳɼʵʳɼ + Dictionary data = new Dictionary(); + data.Add("name", _studentNameInF.text); + + foreach (var item in scoreQueue) { - string systemTypeName = GameManager.Instance._CurModelType; - string fileName = "ʵѵɼ_ţֲ̥.pdf"; - string filePath = System.IO.Path.Combine(savePath, fileName); - PDFGreadeManager.Instance.GreatePDFPC(filePath - , systemTypeName - , scoreQueue - , GameManager.Instance._StudentName - , GameManager.Instance._StudentNumber - , () => - { - PopUpMng.PopConBox("ļ", $"ļѾ\"{filePath}\"ǷֱӴ", "", "ȡ", - () => { FolderBrowserHelper.OpenFolder(filePath); }); - }); + data.Add(item[0] + item[1], item[3]); } -#elif UNITY_WEBGL - string systemTypeName = GameManager.Instance._CurModelType; - string fileName = "ʵѵɼ_ţֲ̥.pdf"; - PDFGreadeManager.Instance.GreatePDFWeb(fileName - , systemTypeName - , scoreQueue - , GameManager.Instance._StudentName - , GameManager.Instance._StudentNumber); + + foreach (var item in GameManager.Instance._DataNiuHandler.scoreTime) + { + data.Add(item.Key + "Time", item.Value); + } + json = JsonConvert.SerializeObject(data); + +#if UNITY_EDITOR || UNITY_STANDALONE + AsposeHelper.Writer(json, filePath => + { + PopUpMng.PopConBox("ļ", $"ļѾ\"{filePath}\"ǷֱӴ", "", "ȡ", + () => { FolderBrowserHelper.OpenFolder(filePath); }); + }); + +#else + + StartCoroutine(DownLoadReport(bytes => + { + WebGLDownLoadFile.instance.DownloadDocx(bytes, json); + })); #endif + + + + + //#if UNITY_EDITOR || UNITY_STANDALONE + + // string savePath = CG.UTility.FolderBrowserHelper.GetPathFromWindowsExplorer(); + // if (!string.IsNullOrEmpty(savePath)) + // { + // string systemTypeName = GameManager.Instance._CurModelType; + // string fileName = "ʵѵɼ_ţֲ̥.pdf"; + // string filePath = System.IO.Path.Combine(savePath, fileName); + // PDFGreadeManager.Instance.GreatePDFPC(filePath + // , systemTypeName + // , scoreQueue + // , GameManager.Instance._StudentName + // , GameManager.Instance._StudentNumber + // , () => + // { + // PopUpMng.PopConBox("ļ", $"ļѾ\"{filePath}\"ǷֱӴ", "", "ȡ", + // () => { FolderBrowserHelper.OpenFolder(filePath); }); + // }); + // } + //#elif UNITY_WEBGL + // string systemTypeName = GameManager.Instance._CurModelType; + // string fileName = "ʵѵɼ_ţֲ̥.pdf"; + // PDFGreadeManager.Instance.GreatePDFWeb(fileName + // , systemTypeName + // , scoreQueue + // , GameManager.Instance._StudentName + // , GameManager.Instance._StudentNumber); + //#endif }); ShowScore(GameManager.Instance._DataNiuHandler.GetExamScore()); CG.UTility.PopUpMng._TriAble = false; } + + /// + /// ʵ鱨ģ + /// + /// + IEnumerator DownLoadReport(Action callback) + { + UnityWebRequest request = new UnityWebRequest(Global.reportDemoPath); + request.downloadHandler = new DownloadHandlerBuffer(); + yield return request.SendWebRequest(); + if (string.IsNullOrEmpty(request.error)) + { + callback?.Invoke(request.downloadHandler.data); + } + else + { + Debug.LogError(request.error); + } + yield return null; + } + /// /// ʾɼ /// diff --git a/Assets/_Scripts/Tools.meta b/Assets/_Scripts/Tools.meta new file mode 100644 index 0000000..546e170 --- /dev/null +++ b/Assets/_Scripts/Tools.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 31cd026807f5a364795f42049111747b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scripts/Tools/AsposeHelper.cs b/Assets/_Scripts/Tools/AsposeHelper.cs new file mode 100644 index 0000000..d5e10cf --- /dev/null +++ b/Assets/_Scripts/Tools/AsposeHelper.cs @@ -0,0 +1,96 @@ +using Aspose.Words; +using Aspose.Words.Replacing; +using UnityEngine; +using Newtonsoft.Json.Linq; +using System; +using System.IO; + +public class AsposeHelper : MonoBehaviour +{ + + + //public static void Writer(string json, Action callback = null) + //{ + // // Wordĵ + // Document doc = new Document(Global.reportDemoPath); + + // JObject jObject = JObject.Parse(json); + + // foreach (JProperty property in jObject.Properties()) + // { + // string key = property.Name; + // string value = property.Value.ToString(); + // doc.Range.Replace($"{{{key}}}", $"{value}", new FindReplaceOptions()); + // } + + // string filePath = ChinarFileController.SaveProject(Path.GetFileName(Global.reportDemoPath).Split('.')[1]); + // if (string.IsNullOrEmpty(filePath) == false) + // { + // doc.Save(filePath); + // } + // callback?.Invoke(); + // // 滻ı + // //SaveWithDialog(doc, callback); + // //Debug.Log("ĵɣĵѱ浽: " + outputFilePath); + //} + + public static void Writer(string json, Action callback = null) + { + // Wordĵ + Document doc = new Document(Global.reportDemoPath); + + JToken jToken = JToken.Parse(json); + TraverseAndReplace(jToken, doc); + + string filePath = ChinarFileController.SaveProject(Path.GetFileName(Global.reportDemoPath).Split('.')[1]); + if (!string.IsNullOrEmpty(filePath)) + { + doc.Save(filePath); + } + callback?.Invoke(filePath); + } + + private static void TraverseAndReplace(JToken jToken, Document doc) + { + if (jToken.Type == JTokenType.Object) + { + foreach (JProperty property in ((JObject)jToken).Properties()) + { + if (property.Value.Type == JTokenType.Object || property.Value.Type == JTokenType.Array) + { + TraverseAndReplace(property.Value, doc); + } + else + { + string key = property.Name; + string value = property.Value.ToString(); + doc.Range.Replace($"{{{key}}}", $"{value}", new FindReplaceOptions()); + } + } + } + else if (jToken.Type == JTokenType.Array) + { + foreach (JToken item in jToken) + { + TraverseAndReplace(item, doc); + } + } + } + + + + + //private static void SaveWithDialog(Document doc, Action callback) + //{ + // SaveFileDialog dialog = new SaveFileDialog(); + // dialog.Filter = "Wordĵ|*.docx"; + // var result = dialog.ShowDialog(); + // if (result == DialogResult.OK) + // { + // doc.Save(dialog.FileName); + // } + // callback?.Invoke(result); + //} +} + + diff --git a/Assets/_Scripts/Tools/AsposeHelper.cs.meta b/Assets/_Scripts/Tools/AsposeHelper.cs.meta new file mode 100644 index 0000000..d22eb09 --- /dev/null +++ b/Assets/_Scripts/Tools/AsposeHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2b8efffae1f8a8f48a8097dd7af0912e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scripts/Tools/ChinarFileController.cs b/Assets/_Scripts/Tools/ChinarFileController.cs new file mode 100644 index 0000000..1e6c7dc --- /dev/null +++ b/Assets/_Scripts/Tools/ChinarFileController.cs @@ -0,0 +1,65 @@ +using UnityEngine; +using System.Runtime.InteropServices; +using System; + + +/// +/// ļƽű +/// +public class ChinarFileController : MonoBehaviour +{ + /// + /// Ŀ + /// + public static string OpenProject() + { + string originalDir = Environment.CurrentDirectory; + string filepath = string.Empty; + OpenFileDlg pth = new OpenFileDlg(); + pth.structSize = Marshal.SizeOf(pth); + // ʽƳĩβߣ + //pth.filter = @"All Files (*.*)|*.jpg"; + pth.file = new string(new char[256]); + pth.maxFile = pth.file.Length; + pth.fileTitle = new string(new char[64]); + pth.maxFileTitle = pth.fileTitle.Length; + pth.initialDir = Application.dataPath.Replace("/", "\\") + "\\Resources"; + pth.title = "Ŀ"; + pth.defExt = "dat"; + // Flagsãؼѡ + pth.flags = 0x00080000 | 0x00001000 | 0x00000800; // OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST + + if (OpenFileDialog.GetOpenFileName(pth)) + { + filepath = pth.file; + } + Environment.CurrentDirectory = originalDir; + return filepath; + } + + + /// + /// ļĿ + /// + public static string SaveProject(string ext) + { + string filepath = string.Empty; + SaveFileDlg pth = new SaveFileDlg(); + pth.structSize = Marshal.SizeOf(pth); + pth.filter = "All files (*.*)|*.*"; + pth.file = new string(new char[256]); + pth.maxFile = pth.file.Length; + pth.fileTitle = new string(new char[64]); + pth.maxFileTitle = pth.fileTitle.Length; + pth.initialDir = Application.dataPath; //Ĭ· + pth.title = "Ŀ"; + pth.defExt = ext; + pth.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008; + if (SaveFileDialog.GetSaveFileName(pth)) + { + filepath = pth.file; //ѡļ·; + } + return filepath; + } +} + diff --git a/Assets/_Scripts/Tools/ChinarFileController.cs.meta b/Assets/_Scripts/Tools/ChinarFileController.cs.meta new file mode 100644 index 0000000..c6d1fb8 --- /dev/null +++ b/Assets/_Scripts/Tools/ChinarFileController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 455fa6f266eceb84bafae54e439f93ca +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scripts/Tools/ChinarFileDlog.cs b/Assets/_Scripts/Tools/ChinarFileDlog.cs new file mode 100644 index 0000000..607f099 --- /dev/null +++ b/Assets/_Scripts/Tools/ChinarFileDlog.cs @@ -0,0 +1,57 @@ +using System.Runtime.InteropServices; +using System; + + +/// +/// ļ־ +/// +// [(.,ַ=ַ.Զ)] +[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] +public class ChinarFileDlog +{ + public int structSize = 0; + public IntPtr dlgOwner = IntPtr.Zero; + public IntPtr instance = IntPtr.Zero; + public String filter = null; + public String customFilter = null; + public int maxCustFilter = 0; + public int filterIndex = 0; + public String file = null; + public int maxFile = 0; + public String fileTitle = null; + public int maxFileTitle = 0; + public String initialDir = null; + public String title = null; + public int flags = 0; + public short fileOffset = 0; + public short fileExtension = 0; + public String defExt = null; + public IntPtr custData = IntPtr.Zero; + public IntPtr hook = IntPtr.Zero; + public String templateName = null; + public IntPtr reservedPtr = IntPtr.Zero; + public int reservedInt = 0; + public int flagsEx = 0; +} + +[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] +public class OpenFileDlg : ChinarFileDlog +{ +} + +public class OpenFileDialog +{ + [DllImport("Comdlg32.dll", SetLastError = true, ThrowOnUnmappableChar = true, CharSet = CharSet.Auto)] + public static extern bool GetOpenFileName([In, Out] OpenFileDlg ofd); +} + +public class SaveFileDialog +{ + [DllImport("Comdlg32.dll", SetLastError = true, ThrowOnUnmappableChar = true, CharSet = CharSet.Auto)] + public static extern bool GetSaveFileName([In, Out] SaveFileDlg ofd); +} + +[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] +public class SaveFileDlg : ChinarFileDlog +{ +} \ No newline at end of file diff --git a/Assets/_Scripts/Tools/ChinarFileDlog.cs.meta b/Assets/_Scripts/Tools/ChinarFileDlog.cs.meta new file mode 100644 index 0000000..1f6c623 --- /dev/null +++ b/Assets/_Scripts/Tools/ChinarFileDlog.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f631b0046aaa78a4a94df55fc69fbefb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scripts/Tools/Global.cs b/Assets/_Scripts/Tools/Global.cs new file mode 100644 index 0000000..ff4e511 --- /dev/null +++ b/Assets/_Scripts/Tools/Global.cs @@ -0,0 +1,22 @@ +using UnityEngine; +public class Global +{ + Global() { } + +#if UNITY_WEBGL && !UNITY_EDITOR + public static string dataPath = Application.dataPath + "/Data"; +#else + public static string dataPath = Application.dataPath + "/../Data"; +#endif + public static string deviceIconsPath = dataPath + "/DeviceIcons/"; + public static string audioPath = dataPath + "/Audio/"; + public static string appXmlPath = dataPath + "/App.xml"; + public static string imagePath = dataPath + "/Image/"; + public static string videoPath = dataPath + "/Video/"; + public static string xmlPath = dataPath + "/Xml/"; + public static string reportPath = dataPath + "/Report/"; + public static string reportDemoPath = reportPath + "Demo.docx"; + + + +} diff --git a/Assets/_Scripts/Tools/Global.cs.meta b/Assets/_Scripts/Tools/Global.cs.meta new file mode 100644 index 0000000..4898898 --- /dev/null +++ b/Assets/_Scripts/Tools/Global.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7254632d4e952454ea2b56b2c1f08519 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/data/Report/demo.docx b/data/Report/demo.docx new file mode 100644 index 0000000..c90297a Binary files /dev/null and b/data/Report/demo.docx differ