更新时间锁
This commit is contained in:
parent
d0e07bc814
commit
28f9c1da4e
11
Assets/Editor/TimerLock.cs
Normal file
11
Assets/Editor/TimerLock.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(fileName = "时间锁", menuName = "创建时间锁/配置文件")]
|
||||
public class TimerLock : ScriptableObject
|
||||
{
|
||||
[Header("软件有效期")]
|
||||
public string time;
|
||||
|
||||
}
|
||||
11
Assets/Editor/TimerLock.cs.meta
Normal file
11
Assets/Editor/TimerLock.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c5b8343931d7c9a49a1ff9597f3ba0c2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
51
Assets/Editor/Tools.cs
Normal file
51
Assets/Editor/Tools.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public class Tools
|
||||
{
|
||||
[MenuItem("Tools/创建时间锁")]
|
||||
private static void TimerLock()
|
||||
{
|
||||
//创建数据资源文件
|
||||
//泛型是继承自ScriptableObject的类
|
||||
TimerLock asset = ScriptableObject.CreateInstance<TimerLock>();
|
||||
//前一步创建的资源只是存在内存中,现在要把它保存到本地
|
||||
//通过编辑器API,创建一个数据资源文件,第二个参数为资源文件在Assets目录下的路径
|
||||
AssetDatabase.CreateAsset(asset, "Assets/TimerLock.asset");
|
||||
//保存创建的资源
|
||||
AssetDatabase.SaveAssets();
|
||||
//刷新界面
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
11
Assets/Editor/Tools.cs.meta
Normal file
11
Assets/Editor/Tools.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0772e5557591b3a4997bc2f77ef34f50
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
630
Assets/Resources/UIPrefabs/TimerCheckPanel.prefab
Normal file
630
Assets/Resources/UIPrefabs/TimerCheckPanel.prefab
Normal file
@ -0,0 +1,630 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &603515846068347574
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2973387460174964899}
|
||||
- component: {fileID: 4046774654178239024}
|
||||
- component: {fileID: 6775752147316619189}
|
||||
m_Layer: 5
|
||||
m_Name: Other2_N
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2973387460174964899
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 603515846068347574}
|
||||
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: []
|
||||
m_Father: {fileID: 9133111343023862921}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.12200001, y: 0.5231482}
|
||||
m_AnchorMax: {x: 0.874, y: 0.8561482}
|
||||
m_AnchoredPosition: {x: 1.5, y: 1}
|
||||
m_SizeDelta: {x: 7, y: -4}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4046774654178239024
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 603515846068347574}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &6775752147316619189
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 603515846068347574}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 7ace1598f8a7c3d47b2c127e89fe6a21, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &1146598296151246231
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4750655449581826011}
|
||||
- component: {fileID: 4966594276472824005}
|
||||
- component: {fileID: 1823834173995265821}
|
||||
- component: {fileID: 1798522582073850381}
|
||||
m_Layer: 5
|
||||
m_Name: Train_N
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &4750655449581826011
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1146598296151246231}
|
||||
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: []
|
||||
m_Father: {fileID: 2888913759714920061}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0}
|
||||
m_AnchorMax: {x: 0.5, y: 0}
|
||||
m_AnchoredPosition: {x: 1.3491, y: 330}
|
||||
m_SizeDelta: {x: 284, y: 76}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4966594276472824005
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1146598296151246231}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1823834173995265821
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1146598296151246231}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 97d5d667b4207cd4198d9accb49a2e1c, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &1798522582073850381
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1146598296151246231}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 2
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 21300000, guid: 0e1346da76c650844ac909b4fc2c6d49,
|
||||
type: 3}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 1823834173995265821}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!1 &2888913759714920062
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2888913759714920061}
|
||||
- component: {fileID: 2888913759714920060}
|
||||
m_Layer: 5
|
||||
m_Name: TrainModelPanel
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2888913759714920061
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2888913759714920062}
|
||||
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: 2888913760214439239}
|
||||
- {fileID: 4750655449581826011}
|
||||
m_Father: {fileID: 4130714088394774955}
|
||||
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: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2888913759714920060
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2888913759714920062}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &2888913760214439352
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2888913760214439239}
|
||||
- component: {fileID: 2888913760214439237}
|
||||
- component: {fileID: 2888913760214439238}
|
||||
- component: {fileID: 8166912465334887831}
|
||||
m_Layer: 5
|
||||
m_Name: Teach_N
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2888913760214439239
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2888913760214439352}
|
||||
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: []
|
||||
m_Father: {fileID: 2888913759714920061}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0}
|
||||
m_AnchorMax: {x: 0.5, y: 0}
|
||||
m_AnchoredPosition: {x: 1.3491, y: 415.5491}
|
||||
m_SizeDelta: {x: 284, y: 76}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2888913760214439237
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2888913760214439352}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &2888913760214439238
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2888913760214439352}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: e52ed5e3cd6db80459c9520802557f8f, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &8166912465334887831
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2888913760214439352}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 2
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 21300000, guid: ef43cff673d43ef48badac85cfd8b156,
|
||||
type: 3}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 2888913760214439238}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!1 &2901388735067139032
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 78317203956937394}
|
||||
- component: {fileID: 2943517008154441021}
|
||||
- component: {fileID: 3672005570292551768}
|
||||
m_Layer: 5
|
||||
m_Name: Other1_N
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &78317203956937394
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2901388735067139032}
|
||||
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: []
|
||||
m_Father: {fileID: 9133111343023862921}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.100375, y: 0.20066665}
|
||||
m_AnchorMax: {x: 0.89500004, y: 0.545}
|
||||
m_AnchoredPosition: {x: 4.5, y: -0.5}
|
||||
m_SizeDelta: {x: 11, y: 2}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2943517008154441021
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2901388735067139032}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3672005570292551768
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2901388735067139032}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 4b3ac25c5ebd0ab41b0c5e3744d70e0e, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &6683858983085824027
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8762010044699360691}
|
||||
- component: {fileID: 2698470933306118203}
|
||||
- component: {fileID: 7593153994056117987}
|
||||
m_Layer: 5
|
||||
m_Name: BiaoTi_N
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &8762010044699360691
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6683858983085824027}
|
||||
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: []
|
||||
m_Father: {fileID: 9133111343023862921}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 274}
|
||||
m_SizeDelta: {x: 1851, y: 112}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2698470933306118203
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6683858983085824027}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &7593153994056117987
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6683858983085824027}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: a8ceb856dc4f19c49b678813dc40f9d2, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &8912481142875709138
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4130714088394774955}
|
||||
m_Layer: 5
|
||||
m_Name: TimerCheckPanel
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &4130714088394774955
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8912481142875709138}
|
||||
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: 9133111343023862921}
|
||||
- {fileID: 2888913759714920061}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 1920, y: 1080}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &9133111343023862922
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 9133111343023862921}
|
||||
- component: {fileID: 9133111343023862919}
|
||||
- component: {fileID: 9133111343023862920}
|
||||
m_Layer: 5
|
||||
m_Name: TrainBGPanel
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &9133111343023862921
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9133111343023862922}
|
||||
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: 78317203956937394}
|
||||
- {fileID: 2973387460174964899}
|
||||
- {fileID: 8762010044699360691}
|
||||
m_Father: {fileID: 4130714088394774955}
|
||||
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: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &9133111343023862919
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9133111343023862922}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &9133111343023862920
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9133111343023862922}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 9e4be6af4716004489f80f843948fa4a, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
7
Assets/Resources/UIPrefabs/TimerCheckPanel.prefab.meta
Normal file
7
Assets/Resources/UIPrefabs/TimerCheckPanel.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2339bd97a05734748b4394b9b5415761
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1
Assets/StreamingAssets/Timer.txt
Normal file
1
Assets/StreamingAssets/Timer.txt
Normal file
@ -0,0 +1 @@
|
||||
ILBJֻֽֿג05ד
†ִlֱ‡נע<D7A0>ַj@{־אה~<7E>Pj…¥טa²ֲPװ+Z}ִ„ְֲ>
|
||||
7
Assets/StreamingAssets/Timer.txt.meta
Normal file
7
Assets/StreamingAssets/Timer.txt.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa0c91508fecffb4fb68596a0a07da40
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
15
Assets/TimerLock.asset
Normal file
15
Assets/TimerLock.asset
Normal file
@ -0,0 +1,15 @@
|
||||
%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: c5b8343931d7c9a49a1ff9597f3ba0c2, type: 3}
|
||||
m_Name: TimerLock
|
||||
m_EditorClassIdentifier:
|
||||
time: 2025-07-06 00:00:00
|
||||
8
Assets/TimerLock.asset.meta
Normal file
8
Assets/TimerLock.asset.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f30da0ad8d81325448a5006790548dd4
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,5 +1,7 @@
|
||||
using CG.Framework;
|
||||
using CG.UTility;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
/********************************************************************************
|
||||
*Create By CG
|
||||
*Function Ö÷ҳ״̬
|
||||
@ -15,6 +17,16 @@ namespace ZXK.LouDiXvMuNiu
|
||||
public override void EnterState()
|
||||
{
|
||||
UI_Manage.Instance.ShowPanel("HomePanel", Type.GetType("ZXK.LouDiXvMuNiu.HomePanel"), UIGroup.Main);
|
||||
DateManager.UpdateTime(Tip, Tip, success: () =>
|
||||
{
|
||||
});
|
||||
}
|
||||
public void Tip(string str)
|
||||
{
|
||||
PopUpMng.PopAlert("", str, "È·¶¨", () =>
|
||||
{
|
||||
Application.Quit();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
24
Assets/_Scripts/Application/States/TimerCheckState.cs
Normal file
24
Assets/_Scripts/Application/States/TimerCheckState.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using CG.Framework;
|
||||
using CG.UTility;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
/********************************************************************************
|
||||
*Create By CG
|
||||
*Function Ö÷ҳ״̬
|
||||
*********************************************************************************/
|
||||
namespace ZXK.LouDiXvMuNiu
|
||||
{
|
||||
public class TimerCheckState : State
|
||||
{
|
||||
public override string _SceneName => "TimerCheck";
|
||||
public TimerCheckState(StateContext stateContext) : base(stateContext)
|
||||
{
|
||||
}
|
||||
public override void EnterState()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/_Scripts/Application/States/TimerCheckState.cs.meta
Normal file
11
Assets/_Scripts/Application/States/TimerCheckState.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab0e00d8e8cede74982f2b8e93253470
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
31
Assets/_Scripts/Application/UI/TimerCheckPanel.cs
Normal file
31
Assets/_Scripts/Application/UI/TimerCheckPanel.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using CG.Framework;
|
||||
using CG.UTility;
|
||||
using System;
|
||||
/*******************************************************************************
|
||||
*Create By CG
|
||||
*Function
|
||||
*******************************************************************************/
|
||||
namespace ZXK.LouDiXvMuNiu
|
||||
{
|
||||
public class TimerCheckPanel : UIBase
|
||||
{
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
|
||||
PopUpMng.PopAlert("提示", "当前模块已完成", "确认", () => {
|
||||
if (GameManager.Instance._StateContext.GetState().Name.Equals("ExamState"))
|
||||
{
|
||||
PopUpMng._TriAble = false;
|
||||
UI_Manage.Instance.ShowPanel("ScoreDataPanel", Type.GetType("ZXK.LouDiXvMuNiu.ScoreDataPanel"), UIGroup.Tip);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/_Scripts/Application/UI/TimerCheckPanel.cs.meta
Normal file
11
Assets/_Scripts/Application/UI/TimerCheckPanel.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd50c7322bfdad14d8f7cf2a9e33e0c1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/_Scripts/NetWork.meta
Normal file
8
Assets/_Scripts/NetWork.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 212a0a4f9a45b9740af050a33918ac7b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/_Scripts/NetWork/Encryption.meta
Normal file
8
Assets/_Scripts/NetWork/Encryption.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb335401f53d3c94490f449b410da1ba
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
91
Assets/_Scripts/NetWork/Encryption/DateManager.cs
Normal file
91
Assets/_Scripts/NetWork/Encryption/DateManager.cs
Normal file
@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class DateManager
|
||||
{
|
||||
|
||||
public static string EndTimer = "2025-07-06 00:00:00";//结束时间
|
||||
private static string RecordData;
|
||||
private void Start()
|
||||
{
|
||||
// CreatTimer();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新系统时间
|
||||
/// </summary>
|
||||
public static void UpdateTime(UnityAction<string> error = null, UnityAction<string> timeOut = null, UnityAction update = null, UnityAction success = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
string datas = DecryptFileReader.ReadAndDecryptData("Timer.txt");
|
||||
EndTimer = datas.Split('|')[0];
|
||||
RecordData = datas.Split('|')[1];
|
||||
//第一次获取获取系统时间
|
||||
DateTime currentDateTime = DateTime.Now;
|
||||
string Data = currentDateTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
if (DateTime.TryParse(RecordData, out DateTime recordDateTime) && DateTime.TryParse(Data, out DateTime nowDateTime))
|
||||
{
|
||||
if (recordDateTime > nowDateTime)
|
||||
{
|
||||
Debug.Log("仿真文件被损坏,请联系管理员进行修复");
|
||||
error?.Invoke("仿真文件被损坏,请联系管理员进行修复");
|
||||
}
|
||||
else
|
||||
{
|
||||
//把上一次存储得系统时间更新到最新
|
||||
string timer = "Timer.txt";
|
||||
RecordData = Data;
|
||||
string strMerge = EndTimer + "|" + RecordData;
|
||||
EncryptFileCreator.EncryptAndSaveData(strMerge, timer);
|
||||
update?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"数据出错: {e.Message}");
|
||||
error?.Invoke($"数据出错: {e.Message}");
|
||||
}
|
||||
|
||||
if (JudgeExpire())
|
||||
{
|
||||
Debug.Log("请联系管理员进行升级");
|
||||
timeOut?.Invoke("请联系管理员进行升级");
|
||||
return;
|
||||
}
|
||||
success?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否到期
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool JudgeExpire()
|
||||
{
|
||||
if (DateTime.TryParse(EndTimer, out DateTime endDataTime) && DateTime.TryParse(RecordData, out DateTime recordDateTime))
|
||||
{
|
||||
//结束日期小于目前日期代表到期
|
||||
if (endDataTime < recordDateTime)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 给客户打包的时候,需要设置EndTimer,然后运行一次生成文件并注释掉
|
||||
/// </summary>
|
||||
public static void CreatTimer()
|
||||
{
|
||||
//第一次获取获取系统时间
|
||||
DateTime currentDateTime = DateTime.Now;
|
||||
RecordData = currentDateTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
string strMerge = EndTimer + "|" + RecordData;
|
||||
EncryptFileCreator.EncryptAndSaveData(strMerge, "Timer.txt");
|
||||
}
|
||||
}
|
||||
11
Assets/_Scripts/NetWork/Encryption/DateManager.cs.meta
Normal file
11
Assets/_Scripts/NetWork/Encryption/DateManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 989d94de1a3619e4ea11eebacb08d0f7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
41
Assets/_Scripts/NetWork/Encryption/DecryptFileReader.cs
Normal file
41
Assets/_Scripts/NetWork/Encryption/DecryptFileReader.cs
Normal file
@ -0,0 +1,41 @@
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
public class DecryptFileReader
|
||||
{
|
||||
private static byte[] key = Encoding.UTF8.GetBytes("Sixteen byte key"); // 加密密钥,需与加密时一致
|
||||
private static byte[] iv = Encoding.UTF8.GetBytes("InitializationVe"); // 确保IV长度为16字节
|
||||
|
||||
public static string ReadAndDecryptData(string filePath)
|
||||
{
|
||||
string fullPath = Path.Combine(Application.streamingAssetsPath, filePath);
|
||||
if (File.Exists(filePath)) return "";
|
||||
// 读取加密文件
|
||||
byte[] encryptedData = File.ReadAllBytes(fullPath);
|
||||
|
||||
// 创建AES解密器
|
||||
using (Aes aesAlg = Aes.Create())
|
||||
{
|
||||
aesAlg.Key = key;
|
||||
aesAlg.IV = iv;
|
||||
|
||||
ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);
|
||||
|
||||
// 创建内存流和加密流
|
||||
using (MemoryStream msDecrypt = new MemoryStream(encryptedData))
|
||||
{
|
||||
using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
|
||||
{
|
||||
byte[] decryptedBytes = new byte[encryptedData.Length];
|
||||
int decryptedByteCount = csDecrypt.Read(decryptedBytes, 0, decryptedBytes.Length);
|
||||
|
||||
// 将解密后的数据转换为字符串
|
||||
string decryptedData = Encoding.UTF8.GetString(decryptedBytes, 0, decryptedByteCount);
|
||||
return decryptedData;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/_Scripts/NetWork/Encryption/DecryptFileReader.cs.meta
Normal file
11
Assets/_Scripts/NetWork/Encryption/DecryptFileReader.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 354bc54210a77764ebad2d49b5e927ba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
56
Assets/_Scripts/NetWork/Encryption/EncryptFileCreator.cs
Normal file
56
Assets/_Scripts/NetWork/Encryption/EncryptFileCreator.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
public class EncryptFileCreator
|
||||
{
|
||||
private static byte[] key = Encoding.UTF8.GetBytes("Sixteen byte key"); // 加密密钥,需16字节
|
||||
private static byte[] iv = Encoding.UTF8.GetBytes("InitializationVe"); // 确保IV长度为16字节
|
||||
|
||||
public static void EncryptAndSaveData(string data,string path)
|
||||
{
|
||||
string filePath = Path.Combine(Application.streamingAssetsPath, path);
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
// 创建文件
|
||||
File.WriteAllText(filePath, "");
|
||||
Debug.Log("文件已创建");
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Debug.LogError($"创建文件时出错: {e.Message}");
|
||||
}
|
||||
}
|
||||
// 将数据转换为字节数组
|
||||
byte[] plainText = Encoding.UTF8.GetBytes(data);
|
||||
|
||||
// 创建AES加密器
|
||||
using (Aes aesAlg = Aes.Create())
|
||||
{
|
||||
aesAlg.Key = key;
|
||||
aesAlg.IV = iv;
|
||||
|
||||
ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);
|
||||
|
||||
// 创建内存流和加密流
|
||||
using (MemoryStream msEncrypt = new MemoryStream())
|
||||
{
|
||||
using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
|
||||
{
|
||||
csEncrypt.Write(plainText, 0, plainText.Length);
|
||||
csEncrypt.FlushFinalBlock();
|
||||
|
||||
// 获取加密后的数据
|
||||
byte[] encryptedData = msEncrypt.ToArray();
|
||||
|
||||
// 保存加密文件到StreamingAssets文件夹
|
||||
string fullPath = Path.Combine(Application.streamingAssetsPath, filePath);
|
||||
File.WriteAllBytes(fullPath, encryptedData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 22f7660ba2e708d4eb33622fe324499b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
73
Assets/_Scripts/NetWork/HttpRestful.cs
Normal file
73
Assets/_Scripts/NetWork/HttpRestful.cs
Normal file
@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
using ZXKFramework;
|
||||
|
||||
public class HttpRestful : SingletonDdol<HttpRestful>
|
||||
{
|
||||
public void Get(string url, Action<bool, string> actionResult = null)
|
||||
{
|
||||
StartCoroutine(_Get(url, actionResult));
|
||||
}
|
||||
|
||||
private IEnumerator _Get(string url, Action<bool, string> action)
|
||||
{
|
||||
using (UnityWebRequest request = UnityWebRequest.Get(url))
|
||||
{
|
||||
yield return request.SendWebRequest();
|
||||
|
||||
string resstr = "";
|
||||
if (request.isNetworkError || request.isHttpError)
|
||||
{
|
||||
resstr = request.error;
|
||||
}
|
||||
else
|
||||
{
|
||||
resstr = request.downloadHandler.text;
|
||||
}
|
||||
|
||||
if (action != null)
|
||||
{
|
||||
action(request.isHttpError, resstr);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void Post(string url, string form, Action<bool, DownloadHandler> callBack, string Header = null, string HeaderValue = null, int timeOut = 3)
|
||||
{
|
||||
|
||||
StartCoroutine(_Post(url, form, callBack, Header, HeaderValue, timeOut));
|
||||
}
|
||||
|
||||
public IEnumerator _Post(string url, string form, Action<bool, DownloadHandler> callBack, string Header = null, string HeaderValue = null, int timeOut = 3)
|
||||
{
|
||||
//请求链接,并将form对象发送到远程服务器
|
||||
using (UnityWebRequest webRequest = UnityWebRequest.Post(url, form, "application/json"))//;charset=utf-8
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Header) && !string.IsNullOrEmpty(HeaderValue))
|
||||
{
|
||||
webRequest.SetRequestHeader(Header, HeaderValue);
|
||||
}
|
||||
webRequest.timeout = timeOut * 1000;
|
||||
yield return webRequest.SendWebRequest();
|
||||
if (webRequest.result!= UnityWebRequest.Result.Success)
|
||||
{
|
||||
Debug.Log(webRequest.error);
|
||||
callBack?.Invoke(false, webRequest.downloadHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
callBack?.Invoke(true, webRequest.downloadHandler);
|
||||
}
|
||||
//if (webRequest.isHttpError || webRequest.isNetworkError)
|
||||
//{
|
||||
// //Debug.LogError("===========");
|
||||
// callBack?.Invoke(false, null);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// callBack?.Invoke(true, webRequest.downloadHandler);
|
||||
//}
|
||||
};
|
||||
}
|
||||
}
|
||||
11
Assets/_Scripts/NetWork/HttpRestful.cs.meta
Normal file
11
Assets/_Scripts/NetWork/HttpRestful.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cca16177d7a134a43a4fb3320d5b8fc7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/_Scripts/NetWork/Licence.meta
Normal file
8
Assets/_Scripts/NetWork/Licence.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32677377141e60248a7a2484825ce1d4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
46
Assets/_Scripts/NetWork/Licence/LicenceData.cs
Normal file
46
Assets/_Scripts/NetWork/Licence/LicenceData.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class LicenceData
|
||||
{
|
||||
public string project_id;
|
||||
public string user_name;
|
||||
public string license_code;
|
||||
public string host_id;
|
||||
public string duration; //使用时长
|
||||
public string sign;
|
||||
}
|
||||
public class Datas
|
||||
{
|
||||
public static string Project_id = "7";
|
||||
public static string secretKey = "pZNwkYoMRp7MG_O7aGtmA";
|
||||
public static string UserName;
|
||||
public static string Licensecode;
|
||||
public static string Hostid;
|
||||
public static int Duration;//持续时间
|
||||
}
|
||||
[Serializable]
|
||||
public class License
|
||||
{
|
||||
public int id;
|
||||
public string user_name;
|
||||
public string license_code;
|
||||
public int is_authorized;
|
||||
public string host_id;
|
||||
public string authorization_at;
|
||||
public string authorization_end_at;
|
||||
public string created_at;
|
||||
public int login_count;
|
||||
public int duration;
|
||||
public string last_login;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class LicenseValidationResponse
|
||||
{
|
||||
public string status;
|
||||
public string message;
|
||||
public License license;
|
||||
}
|
||||
11
Assets/_Scripts/NetWork/Licence/LicenceData.cs.meta
Normal file
11
Assets/_Scripts/NetWork/Licence/LicenceData.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f40d10c2dcbad941ac179b38fde96bd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
179
Assets/_Scripts/NetWork/Licence/LicenseManager.cs
Normal file
179
Assets/_Scripts/NetWork/Licence/LicenseManager.cs
Normal file
@ -0,0 +1,179 @@
|
||||
using LitJson;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
public class LicenseManager : MonoBehaviour
|
||||
{
|
||||
private Dictionary<string, string> Data = new();
|
||||
private LicenseValidationResponse LicenseRes = new LicenseValidationResponse();
|
||||
private string Hostid = "";
|
||||
|
||||
public void Init()
|
||||
{
|
||||
Hostid = GetPhysicalAddress();
|
||||
Datas.Hostid = Hostid;
|
||||
}
|
||||
public LicenceData GetLicenceData(string projectid, string userName, string licensecode, string hostid, int duration)
|
||||
{
|
||||
Data.Clear();
|
||||
LicenceData licence = new LicenceData();
|
||||
licence.project_id = projectid;
|
||||
licence.user_name = userName;
|
||||
licence.license_code = licensecode;
|
||||
licence.host_id = hostid;
|
||||
licence.duration = duration.ToString();
|
||||
if (!Data.ContainsKey("project_id"))
|
||||
{
|
||||
Data.Add("project_id", licence.project_id);
|
||||
}
|
||||
if (!Data.ContainsKey("user_name"))
|
||||
{
|
||||
Data.Add("user_name", licence.user_name);
|
||||
}
|
||||
if (!Data.ContainsKey("license_code"))
|
||||
{
|
||||
Data.Add("license_code", licence.license_code);
|
||||
}
|
||||
if (!Data.ContainsKey("host_id"))
|
||||
{
|
||||
Data.Add("host_id", licence.host_id);
|
||||
}
|
||||
if (!Data.ContainsKey("duration"))
|
||||
{
|
||||
Data.Add("duration", licence.duration);
|
||||
}
|
||||
licence.sign = GenerateSignature(Datas.secretKey, Data);
|
||||
return licence;
|
||||
}
|
||||
/// <summary>
|
||||
/// 请求
|
||||
/// </summary>
|
||||
/// <param name="licence"></param>
|
||||
/// <param name="callBack"></param>
|
||||
public void LicensePost(Action<bool> callBack = null)
|
||||
{
|
||||
LicenceData licence = GetLicenceData(Datas.Project_id, Datas.UserName, Datas.Licensecode, Datas.Hostid, Datas.Duration);
|
||||
string json = JsonMapper.ToJson(licence);
|
||||
HttpRestful.Instance.Post("https://locallicense.zxkedu.com/api/license/validate/", json, (m, n) =>
|
||||
{
|
||||
LicenseRes = JsonMapper.ToObject<LicenseValidationResponse>(n.text);
|
||||
if (LicenseRes.status == "success")
|
||||
{
|
||||
EncryptedFile();
|
||||
}
|
||||
callBack.Invoke(m);
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成密匙
|
||||
/// </summary>
|
||||
/// <param name="secretKey"></param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public string GenerateSignature(string secretKey, Dictionary<string, string> data)
|
||||
{
|
||||
// 添加当前时间戳
|
||||
//string timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString();
|
||||
//获取当前时间戳并四舍五入到最近的分钟
|
||||
long timestamp = (long)(DateTimeOffset.UtcNow.ToUnixTimeSeconds() / 60) * 60;
|
||||
//long timestamp = (long)(GetTimestamp() / 60) * 60;
|
||||
if (!data.ContainsKey("timestamp"))
|
||||
{
|
||||
data.Add("timestamp", timestamp.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
data["timestamp"] = timestamp.ToString();
|
||||
}
|
||||
// 对键值对进行排序
|
||||
var sortedData = data.OrderBy(kvp => kvp.Key);
|
||||
Debug.Log("sortedData对键值对进行排序:" + sortedData);
|
||||
|
||||
// 构建查询字符串
|
||||
string queryString = string.Join("&", sortedData.Select(kvp => $"{kvp.Key}={kvp.Value}"));
|
||||
Debug.Log("queryString构建查询字符串:" + queryString);
|
||||
// 使用HMAC-SHA256生成签名
|
||||
using (var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(secretKey)))
|
||||
{
|
||||
byte[] hash = hmac.ComputeHash(Encoding.UTF8.GetBytes(queryString));
|
||||
Debug.Log("生成签名:" + BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant());
|
||||
return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
|
||||
public void StartSetDuration()
|
||||
{
|
||||
if (gameObject.activeSelf)
|
||||
{
|
||||
StartCoroutine(SetDuration(60f));
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator SetDuration(float times)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
yield return new WaitForSeconds(times);
|
||||
Datas.Duration++;
|
||||
LicensePost();
|
||||
Datas.Duration = 0;
|
||||
}
|
||||
}
|
||||
public string GetMachineGuid()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Hostid))
|
||||
{
|
||||
NetworkInterface[] nis = NetworkInterface.GetAllNetworkInterfaces();
|
||||
foreach (NetworkInterface ni in nis)
|
||||
{
|
||||
if (ni.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 ||
|
||||
ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet)
|
||||
{
|
||||
Hostid = ni.GetPhysicalAddress().ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Hostid;
|
||||
}
|
||||
|
||||
string GetPhysicalAddress()
|
||||
{
|
||||
//string physicalAddress = "";
|
||||
//NetworkInterface[] nis = NetworkInterface.GetAllNetworkInterfaces();
|
||||
//foreach (NetworkInterface ni in nis)
|
||||
//{
|
||||
// if (ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet && ni.OperationalStatus == OperationalStatus.Up)
|
||||
// {
|
||||
// physicalAddress = ni.GetPhysicalAddress().ToString();
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
return SystemInfo.deviceUniqueIdentifier;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 本地存储Hostid
|
||||
/// </summary>
|
||||
public void EncryptedFile()
|
||||
{
|
||||
string dataToEncrypt = Datas.UserName + "|" + Datas.Licensecode + "|";
|
||||
EncryptFileCreator.EncryptAndSaveData(dataToEncrypt, "encryptedData.txt");
|
||||
}
|
||||
/// <summary>
|
||||
/// 读取Hostid
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string ReadDecryptedFile()
|
||||
{
|
||||
string decryptedData = DecryptFileReader.ReadAndDecryptData("encryptedData.txt");
|
||||
return decryptedData;
|
||||
}
|
||||
}
|
||||
11
Assets/_Scripts/NetWork/Licence/LicenseManager.cs.meta
Normal file
11
Assets/_Scripts/NetWork/Licence/LicenseManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 13a2f840c2d90a44b8473ca7cf9adef1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
x
Reference in New Issue
Block a user