From 672ddd6570e92cc5415d8b8d4b6c2fabdecad01f Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Wed, 23 Apr 2025 10:32:17 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=9C=BA=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scenes/Main.unity | 69 +++------------------------------------- 1 file changed, 4 insertions(+), 65 deletions(-) diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 5790e9e2..03aa07af 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -969,7 +969,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 888371916723674439} + - {fileID: 7622962939547687553} m_Father: {fileID: 1269024859} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -989,7 +989,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 718cf7f3f1b16f141ab751a37af8cae1, type: 3} m_Name: m_EditorClassIdentifier: - ui: {fileID: 2089839050043354719} + ui: {fileID: 0} text: {fileID: 4601331229292980818} btn: {fileID: 7231834583498103603} --- !u!1 &2114935602 @@ -1263,26 +1263,6 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 ---- !u!224 &888371916723674439 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2089839050043354719} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 7622962939547687553} - m_Father: {fileID: 1764640267} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: -1920, y: -1080} - m_Pivot: {x: 0.5, y: 0.5} --- !u!224 &902241654539185805 RectTransform: m_ObjectHideFlags: 0 @@ -1557,24 +1537,6 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!1 &2089839050043354719 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 888371916723674439} - - component: {fileID: 7923541361196308593} - - component: {fileID: 4452057681510801829} - m_Layer: 5 - m_Name: UITipWindow - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 --- !u!224 &2521152647019992497 RectTransform: m_ObjectHideFlags: 0 @@ -1890,21 +1852,6 @@ MonoBehaviour: CustomComponentName: BtnContent CustomComment: mComponentName: RectTransform ---- !u!114 &4452057681510801829 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2089839050043354719} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: cadc477eb7be81c4b899b49b072235bd, type: 3} - m_Name: - m_EditorClassIdentifier: - Label: {fileID: 4601331229292980818} - BtnContent: {fileID: 2655579637452759910} - BtnPrefab: {fileID: 7231834583498103603} --- !u!114 &4467067367704618080 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2289,13 +2236,13 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 7245332692720103295} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - {fileID: 3877370567018537602} - m_Father: {fileID: 888371916723674439} + m_Father: {fileID: 1764640267} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -2341,14 +2288,6 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 23.5} m_SizeDelta: {x: 51, y: 51} m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &7923541361196308593 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2089839050043354719} - m_CullTransparentMesh: 1 --- !u!114 &7937913353350945267 MonoBehaviour: m_ObjectHideFlags: 0 From 988b770b16ad94c522aa96d417c897e3e93c5857 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Wed, 23 Apr 2025 10:37:52 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scenes/Main.unity | 4 ++-- .../Scripts/Tools/ZXKLicenses/Encryption/DateManager.cs | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 03aa07af..863a3a0c 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -989,7 +989,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 718cf7f3f1b16f141ab751a37af8cae1, type: 3} m_Name: m_EditorClassIdentifier: - ui: {fileID: 0} + ui: {fileID: 7245332692720103295} text: {fileID: 4601331229292980818} btn: {fileID: 7231834583498103603} --- !u!1 &2114935602 @@ -1317,7 +1317,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 0, g: 0, b: 0, a: 0.5019608} + m_Color: {r: 0, g: 0, b: 0, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 diff --git a/Assets/Scripts/Tools/ZXKLicenses/Encryption/DateManager.cs b/Assets/Scripts/Tools/ZXKLicenses/Encryption/DateManager.cs index 97a8c72c..9dc0b2d9 100644 --- a/Assets/Scripts/Tools/ZXKLicenses/Encryption/DateManager.cs +++ b/Assets/Scripts/Tools/ZXKLicenses/Encryption/DateManager.cs @@ -19,7 +19,10 @@ public class DateManager : MonoBehaviour { Application.Quit(); }); - UpdateTime(ShowTip, ShowTip); + UpdateTime(ShowTip, ShowTip, () => + { + gameObject.SetActive(false); + }); } public void ShowTip(string str) @@ -36,6 +39,10 @@ public class DateManager : MonoBehaviour try { string datas = DecryptFileReader.ReadAndDecryptData("Timer.txt"); + if (string.IsNullOrEmpty(datas)) + { + updateTimer?.Invoke(); + } EndTimer = datas.Split('|')[0]; RecordData = datas.Split('|')[1]; //第一次获取获取系统时间 From 71418f2ac1bdc82258c4982d6e98677312b8d896 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Wed, 23 Apr 2025 11:45:50 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E9=94=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Editor/FixedMainEditor.cs | 23 +++++++++++++++++++ Assets/Scripts/Editor/VirtualFPostProcess.cs | 18 +++++++++++---- .../ZXKLicenses/Encryption/DateManager.cs | 4 ++++ 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/Editor/FixedMainEditor.cs b/Assets/Scripts/Editor/FixedMainEditor.cs index 568d4eee..be177835 100644 --- a/Assets/Scripts/Editor/FixedMainEditor.cs +++ b/Assets/Scripts/Editor/FixedMainEditor.cs @@ -52,6 +52,29 @@ public class FixedMainEditor AssetDatabase.Refresh(); } + [MenuItem("Tools/Timerļ")] + private static void GeneratorTimer() + { + if (File.Exists(Application.dataPath + "/TimerLock.asset")) + { + string path = "Assets/TimerLock.asset"; + var asset = AssetDatabase.LoadAssetAtPath(path); + if (asset != null) + { + if (string.IsNullOrEmpty(asset.time) == false) + { + //һλȡȡϵͳʱ + DateTime currentDateTime = DateTime.Now; + string RecordData = currentDateTime.ToString("yyyy-MM-dd HH:mm:ss"); + string strMerge = asset.time + "|" + RecordData; + EncryptFileCreator.EncryptAndSaveData(strMerge, "Timer.txt"); + } + } + } + //ˢ½ + AssetDatabase.Refresh(); + } + diff --git a/Assets/Scripts/Editor/VirtualFPostProcess.cs b/Assets/Scripts/Editor/VirtualFPostProcess.cs index a6d39e6f..d84b64ab 100644 --- a/Assets/Scripts/Editor/VirtualFPostProcess.cs +++ b/Assets/Scripts/Editor/VirtualFPostProcess.cs @@ -7,10 +7,20 @@ using UnityEditor.Build; using UnityEditor.Build.Reporting; using UnityEngine; -public class VirtualFPostProcess : IPostprocessBuildWithReport +public class VirtualFPostProcess : IPostprocessBuildWithReport, IPreprocessBuildWithReport { public int callbackOrder => 0; + /// + /// ǰʱ + /// + /// + public void OnPreprocessBuild(BuildReport report) + { + // ʱ + GneratorTimerLock(); + } + public void OnPostprocessBuild(BuildReport report) { string projectPath = Application.dataPath; @@ -29,9 +39,7 @@ public class VirtualFPostProcess : IPostprocessBuildWithReport Debug.LogWarning("δҵĿ¼: " + dataFolderPath); } DeletAssetBundle(buildOutputPath); - - // ʱ - GneratorTimerLock(); + AssetDatabase.Refresh(); } /// @@ -173,4 +181,6 @@ public class VirtualFPostProcess : IPostprocessBuildWithReport } return new string(chars); } + + } \ No newline at end of file diff --git a/Assets/Scripts/Tools/ZXKLicenses/Encryption/DateManager.cs b/Assets/Scripts/Tools/ZXKLicenses/Encryption/DateManager.cs index 9dc0b2d9..3dfcd51f 100644 --- a/Assets/Scripts/Tools/ZXKLicenses/Encryption/DateManager.cs +++ b/Assets/Scripts/Tools/ZXKLicenses/Encryption/DateManager.cs @@ -27,6 +27,7 @@ public class DateManager : MonoBehaviour public void ShowTip(string str) { + gameObject.SetActive(true); ui.SetActive(true); text.text = str; } @@ -42,6 +43,7 @@ public class DateManager : MonoBehaviour if (string.IsNullOrEmpty(datas)) { updateTimer?.Invoke(); + return; } EndTimer = datas.Split('|')[0]; RecordData = datas.Split('|')[1]; @@ -70,12 +72,14 @@ public class DateManager : MonoBehaviour { Debug.LogError($"数据出错: {e.Message}"); error?.Invoke($"数据出错: {e.Message}"); + return; } if (JudgeExpire()) { Debug.Log("请联系管理员进行升级"); timeOut?.Invoke("请联系管理员进行升级"); + return; } } From 00b308544f2d9d24bde194c7ccd3ce8977ed0561 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Wed, 23 Apr 2025 14:00:54 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Tools/ZXKLicenses/Encryption/DateManager.cs | 5 ----- .../Tools/ZXKLicenses/Encryption/DecryptFileReader.cs | 5 +---- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/Assets/Scripts/Tools/ZXKLicenses/Encryption/DateManager.cs b/Assets/Scripts/Tools/ZXKLicenses/Encryption/DateManager.cs index 3dfcd51f..f8a93a76 100644 --- a/Assets/Scripts/Tools/ZXKLicenses/Encryption/DateManager.cs +++ b/Assets/Scripts/Tools/ZXKLicenses/Encryption/DateManager.cs @@ -40,11 +40,6 @@ public class DateManager : MonoBehaviour try { string datas = DecryptFileReader.ReadAndDecryptData("Timer.txt"); - if (string.IsNullOrEmpty(datas)) - { - updateTimer?.Invoke(); - return; - } EndTimer = datas.Split('|')[0]; RecordData = datas.Split('|')[1]; //第一次获取获取系统时间 diff --git a/Assets/Scripts/Tools/ZXKLicenses/Encryption/DecryptFileReader.cs b/Assets/Scripts/Tools/ZXKLicenses/Encryption/DecryptFileReader.cs index 9a68c1bb..1c6d60f5 100644 --- a/Assets/Scripts/Tools/ZXKLicenses/Encryption/DecryptFileReader.cs +++ b/Assets/Scripts/Tools/ZXKLicenses/Encryption/DecryptFileReader.cs @@ -11,10 +11,7 @@ public class DecryptFileReader public static string ReadAndDecryptData(string filePath) { string fullPath = Path.Combine(Application.streamingAssetsPath, filePath); - if (File.Exists(fullPath) == false) - { - return ""; - } + if (File.Exists(filePath)) return ""; // 读取加密文件 byte[] encryptedData = File.ReadAllBytes(fullPath);