完善时间锁功能
This commit is contained in:
parent
988b770b16
commit
71418f2ac1
@ -52,6 +52,29 @@ public class FixedMainEditor
|
|||||||
AssetDatabase.Refresh();
|
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<TimerLock>(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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -7,10 +7,20 @@ using UnityEditor.Build;
|
|||||||
using UnityEditor.Build.Reporting;
|
using UnityEditor.Build.Reporting;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class VirtualFPostProcess : IPostprocessBuildWithReport
|
public class VirtualFPostProcess : IPostprocessBuildWithReport, IPreprocessBuildWithReport
|
||||||
{
|
{
|
||||||
public int callbackOrder => 0;
|
public int callbackOrder => 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 构建前生成时间锁
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="report"></param>
|
||||||
|
public void OnPreprocessBuild(BuildReport report)
|
||||||
|
{
|
||||||
|
// 生成时间锁
|
||||||
|
GneratorTimerLock();
|
||||||
|
}
|
||||||
|
|
||||||
public void OnPostprocessBuild(BuildReport report)
|
public void OnPostprocessBuild(BuildReport report)
|
||||||
{
|
{
|
||||||
string projectPath = Application.dataPath;
|
string projectPath = Application.dataPath;
|
||||||
@ -29,9 +39,7 @@ public class VirtualFPostProcess : IPostprocessBuildWithReport
|
|||||||
Debug.LogWarning("未找到数据目录: " + dataFolderPath);
|
Debug.LogWarning("未找到数据目录: " + dataFolderPath);
|
||||||
}
|
}
|
||||||
DeletAssetBundle(buildOutputPath);
|
DeletAssetBundle(buildOutputPath);
|
||||||
|
AssetDatabase.Refresh();
|
||||||
// 生成时间锁
|
|
||||||
GneratorTimerLock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -173,4 +181,6 @@ public class VirtualFPostProcess : IPostprocessBuildWithReport
|
|||||||
}
|
}
|
||||||
return new string(chars);
|
return new string(chars);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -27,6 +27,7 @@ public class DateManager : MonoBehaviour
|
|||||||
|
|
||||||
public void ShowTip(string str)
|
public void ShowTip(string str)
|
||||||
{
|
{
|
||||||
|
gameObject.SetActive(true);
|
||||||
ui.SetActive(true);
|
ui.SetActive(true);
|
||||||
text.text = str;
|
text.text = str;
|
||||||
}
|
}
|
||||||
@ -42,6 +43,7 @@ public class DateManager : MonoBehaviour
|
|||||||
if (string.IsNullOrEmpty(datas))
|
if (string.IsNullOrEmpty(datas))
|
||||||
{
|
{
|
||||||
updateTimer?.Invoke();
|
updateTimer?.Invoke();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
EndTimer = datas.Split('|')[0];
|
EndTimer = datas.Split('|')[0];
|
||||||
RecordData = datas.Split('|')[1];
|
RecordData = datas.Split('|')[1];
|
||||||
@ -70,12 +72,14 @@ public class DateManager : MonoBehaviour
|
|||||||
{
|
{
|
||||||
Debug.LogError($"数据出错: {e.Message}");
|
Debug.LogError($"数据出错: {e.Message}");
|
||||||
error?.Invoke($"数据出错: {e.Message}");
|
error?.Invoke($"数据出错: {e.Message}");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JudgeExpire())
|
if (JudgeExpire())
|
||||||
{
|
{
|
||||||
Debug.Log("请联系管理员进行升级");
|
Debug.Log("请联系管理员进行升级");
|
||||||
timeOut?.Invoke("请联系管理员进行升级");
|
timeOut?.Invoke("请联系管理员进行升级");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user