Merge branch 'NewMaster' into LouDi_Pig

This commit is contained in:
shenjianxing 2025-04-23 10:26:10 +08:00
commit 5aedb7d265
20 changed files with 1524 additions and 3 deletions

View File

@ -750,7 +750,7 @@ Canvas:
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_SortingOrder: 500
m_TargetDisplay: 0
--- !u!224 &1269024859
RectTransform:
@ -765,6 +765,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 376402498555991245}
- {fileID: 1764640267}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@ -939,6 +940,58 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1764640266
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1764640267}
- component: {fileID: 1764640268}
m_Layer: 0
m_Name: UIDateCheck
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1764640267
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1764640266}
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: 888371916723674439}
m_Father: {fileID: 1269024859}
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!114 &1764640268
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1764640266}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 718cf7f3f1b16f141ab751a37af8cae1, type: 3}
m_Name:
m_EditorClassIdentifier:
ui: {fileID: 2089839050043354719}
text: {fileID: 4601331229292980818}
btn: {fileID: 7231834583498103603}
--- !u!1 &2114935602
GameObject:
m_ObjectHideFlags: 0
@ -1098,6 +1151,40 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7258947687994042621}
m_CullTransparentMesh: 1
--- !u!114 &110887888300473105
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3921544984887548570}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 0
m_MinWidth: 436
m_MinHeight: 43
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!114 &187303085634958717
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2086965462285735655}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 2
m_VerticalFit: 2
--- !u!224 &376402498555991245
RectTransform:
m_ObjectHideFlags: 0
@ -1118,6 +1205,34 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &457648689321205319
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2086965462285735655}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 0
m_MinWidth: 436
m_MinHeight: 183
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!222 &525492089466544073
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5681206649821475691}
m_CullTransparentMesh: 1
--- !u!114 &755439116886819988
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1148,6 +1263,26 @@ 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
@ -1189,6 +1324,36 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 238, y: 176}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1128038912698321512
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7245332692720103295}
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: 0, g: 0, b: 0, a: 0.5019608}
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: 0}
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 &1504961720473882854
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1205,6 +1370,56 @@ MonoBehaviour:
CustomComponentName: Icon
CustomComment:
mComponentName: UnityEngine.UI.Image
--- !u!1 &1671880619992264758
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2521152647019992497}
- component: {fileID: 6681216128200013423}
- component: {fileID: 1813275364079888314}
- component: {fileID: 7231834583498103603}
- component: {fileID: 6180712463440446537}
m_Layer: 5
m_Name: BtnPrefab
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1813275364079888314
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1671880619992264758}
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: fa63ae52e51e2064390c2a75c12f664c, 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 &1982103501701676502
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1313,6 +1528,93 @@ MonoBehaviour:
optionalScrambleMode: 0
optionalShakeRandomnessMode: 0
optionalString:
--- !u!222 &1988465934601991813
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7245332692720103295}
m_CullTransparentMesh: 1
--- !u!1 &2086965462285735655
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3877370567018537602}
- component: {fileID: 4239072621578749216}
- component: {fileID: 7937913353350945267}
- component: {fileID: 2814462432456552503}
- component: {fileID: 187303085634958717}
- component: {fileID: 457648689321205319}
m_Layer: 5
m_Name: Connnet
m_TagString: Untagged
m_Icon: {fileID: 0}
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
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1671880619992264758}
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: 6623231731764336771}
m_Father: {fileID: 2655579637452759910}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 128.1478, y: 41.656}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &2655579637452759910
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4656565024652926694}
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: 2521152647019992497}
m_Father: {fileID: 3877370567018537602}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2802739808984475110
CanvasRenderer:
m_ObjectHideFlags: 0
@ -1321,6 +1623,155 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7740213339686398260}
m_CullTransparentMesh: 1
--- !u!114 &2814462432456552503
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2086965462285735655}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 20
m_Right: 20
m_Top: 20
m_Bottom: 0
m_ChildAlignment: 1
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 1
m_ChildControlHeight: 1
m_ChildScaleWidth: 1
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!114 &3325917066968789983
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5681206649821475691}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: "\u786E\u5B9A"
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 97936a7b3a86809479ac89371e95b079, type: 2}
m_sharedMaterial: {fileID: 168401102475399263, guid: 97936a7b3a86809479ac89371e95b079, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 16
m_fontSizeBase: 16
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 8192
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!114 &3425016141668694121
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4656565024652926694}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 15
m_ChildAlignment: 4
m_Spacing: 22
m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 0
m_ChildControlHeight: 0
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!222 &3576997835000597077
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3921544984887548570}
m_CullTransparentMesh: 1
--- !u!1 &3604560447573429497
GameObject:
m_ObjectHideFlags: 0
@ -1350,6 +1801,71 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: cabec804a45ce1941b8c1895f35d2860, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &3841773505581629585
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3921544984887548570}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0d51f3a7c41ab0346b49ae50d456bece, type: 3}
m_Name:
m_EditorClassIdentifier:
MarkType: 0
CustomComponentName: Label
CustomComment:
mComponentName: TMPro.TextMeshProUGUI
--- !u!224 &3877370567018537602
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2086965462285735655}
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: 6349304297074725759}
- {fileID: 2655579637452759910}
m_Father: {fileID: 7622962939547687553}
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: 91.49997}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.99999994}
--- !u!1 &3921544984887548570
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6349304297074725759}
- component: {fileID: 3576997835000597077}
- component: {fileID: 4601331229292980818}
- component: {fileID: 110887888300473105}
- component: {fileID: 3841773505581629585}
m_Layer: 5
m_Name: Label
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!222 &4239072621578749216
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2086965462285735655}
m_CullTransparentMesh: 1
--- !u!222 &4329888169046837703
CanvasRenderer:
m_ObjectHideFlags: 0
@ -1358,6 +1874,37 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5754390454264469586}
m_CullTransparentMesh: 1
--- !u!114 &4444983099252657014
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4656565024652926694}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0d51f3a7c41ab0346b49ae50d456bece, type: 3}
m_Name:
m_EditorClassIdentifier:
MarkType: 0
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
@ -1374,6 +1921,113 @@ MonoBehaviour:
CustomComponentName: Label
CustomComment:
mComponentName: TMPro.TextMeshProUGUI
--- !u!114 &4601331229292980818
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3921544984887548570}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, 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_text: "\u662F\u5426\u9000\u51FA\u5F53\u524D\u6A21\u5757\uFF1F"
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 97936a7b3a86809479ac89371e95b079, type: 2}
m_sharedMaterial: {fileID: 168401102475399263, guid: 97936a7b3a86809479ac89371e95b079, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 20
m_fontSizeBase: 20
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &4656565024652926694
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2655579637452759910}
- component: {fileID: 3425016141668694121}
- component: {fileID: 4444983099252657014}
m_Layer: 5
m_Name: BtnContent
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5548267066476286416
RectTransform:
m_ObjectHideFlags: 0
@ -1393,6 +2047,24 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 25}
m_SizeDelta: {x: 0, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &5681206649821475691
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6623231731764336771}
- component: {fileID: 525492089466544073}
- component: {fileID: 3325917066968789983}
m_Layer: 5
m_Name: Label
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &5754390454264469586
GameObject:
m_ObjectHideFlags: 0
@ -1430,6 +2102,68 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &6180712463440446537
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1671880619992264758}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0d51f3a7c41ab0346b49ae50d456bece, type: 3}
m_Name:
m_EditorClassIdentifier:
MarkType: 0
CustomComponentName: BtnPrefab
CustomComment:
mComponentName: UnityEngine.UI.Button
--- !u!224 &6349304297074725759
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3921544984887548570}
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: 3877370567018537602}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &6623231731764336771
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5681206649821475691}
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: 2521152647019992497}
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 &6681216128200013423
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1671880619992264758}
m_CullTransparentMesh: 1
--- !u!114 &6979315384717970559
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1468,6 +2202,68 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5773262138564131193}
m_CullTransparentMesh: 1
--- !u!114 &7231834583498103603
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1671880619992264758}
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: 0}
m_PressedSprite: {fileID: 21300000, guid: 8c77a2052664d0d4e9be892444deddd1, type: 3}
m_SelectedSprite: {fileID: 21300000, guid: 8c77a2052664d0d4e9be892444deddd1, type: 3}
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: 1813275364079888314}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!1 &7245332692720103295
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7622962939547687553}
- component: {fileID: 1988465934601991813}
- component: {fileID: 1128038912698321512}
m_Layer: 5
m_Name: Mask
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &7258947687994042621
GameObject:
m_ObjectHideFlags: 0
@ -1486,6 +2282,26 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7622962939547687553
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7245332692720103295}
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_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!1 &7740213339686398260
GameObject:
m_ObjectHideFlags: 0
@ -1525,6 +2341,44 @@ 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
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2086965462285735655}
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: 003fddd8e0543224fb849ccdbb422cd6, type: 3}
m_Type: 1
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 &8704027912026391313
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@ -1,3 +1,6 @@
using QFramework;
using System;
using System.IO;
using UnityEditor;
using UnityEngine;
@ -31,5 +34,26 @@ public class FixedMainEditor
Menu.SetChecked("Tools/强制Main场景启动", isFixedMain);
return true;
}
[MenuItem("Tools/创建时间锁")]
private static void TimerLock()
{
//创建数据资源文件
//泛型是继承自ScriptableObject的类
TimerLock asset = ScriptableObject.CreateInstance<TimerLock>();
//前一步创建的资源只是存在内存中,现在要把它保存到本地
//通过编辑器API创建一个数据资源文件第二个参数为资源文件在Assets目录下的路径
AssetDatabase.CreateAsset(asset, "Assets/TimerLock.asset");
//保存创建的资源
AssetDatabase.SaveAssets();
//刷新界面
AssetDatabase.Refresh();
}
}
#endif

View 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;
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3fa014c2238b5a942b96b9f55a3f9841
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -29,6 +29,34 @@ public class VirtualFPostProcess : IPostprocessBuildWithReport
Debug.LogWarning("未找到数据目录: " + dataFolderPath);
}
DeletAssetBundle(buildOutputPath);
// 生成时间锁
GneratorTimerLock();
}
/// <summary>
/// 生成时间锁文件
/// </summary>
public void GneratorTimerLock()
{
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");
}
}
}
}
/// <summary>
@ -64,7 +92,7 @@ public class VirtualFPostProcess : IPostprocessBuildWithReport
Debug.LogError($"Directory not found: {path}");
}
}
else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows|| EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows64)
else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows || EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows64)
{
string path = Path.Combine(buildOutPutPath, "VirtualFramwork_Data", "StreamingAssets", "AssetBundles");
if (Directory.Exists(path))

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4fec87e21a9630c46b1a6ef7dec72ea6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bb335401f53d3c94490f449b410da1ba
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,104 @@
using System;
using System.IO;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
public class DateManager : MonoBehaviour
{
private string EndTimer;//结束时间
private string RecordData;
public GameObject ui;
public TextMeshProUGUI text;
public Button btn;
private void Awake()
{
ui.gameObject.SetActive(false);
btn.onClick.AddListener(() =>
{
Application.Quit();
});
UpdateTime(ShowTip, ShowTip);
}
public void ShowTip(string str)
{
ui.SetActive(true);
text.text = str;
}
/// <summary>
/// 更新系统时间
/// </summary>
public void UpdateTime(UnityAction<string> error = null, UnityAction<string> timeOut = null, UnityAction updateTimer = 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);
updateTimer?.Invoke();
}
}
}
catch (Exception e)
{
Debug.LogError($"数据出错: {e.Message}");
error?.Invoke($"数据出错: {e.Message}");
}
if (JudgeExpire())
{
Debug.Log("请联系管理员进行升级");
timeOut?.Invoke("请联系管理员进行升级");
}
}
/// <summary>
/// 判断是否到期
/// </summary>
/// <returns></returns>
public 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 void CreatTimer()
{
//第一次获取获取系统时间
DateTime currentDateTime = DateTime.Now;
RecordData = currentDateTime.ToString("yyyy-MM-dd HH:mm:ss");
string strMerge = EndTimer + "|" + RecordData;
EncryptFileCreator.EncryptAndSaveData(strMerge, "Timer.txt");
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 718cf7f3f1b16f141ab751a37af8cae1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,44 @@
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(fullPath) == false)
{
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;
}
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 354bc54210a77764ebad2d49b5e927ba
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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);
}
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 22f7660ba2e708d4eb33622fe324499b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,73 @@
using QFramework;
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.Networking;
public class HttpRestful : MonoSingleton<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);
//}
};
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cca16177d7a134a43a4fb3320d5b8fc7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 32677377141e60248a7a2484825ce1d4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View 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;
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8f40d10c2dcbad941ac179b38fde96bd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,180 @@
using Newtonsoft.Json;
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 = JsonConvert.SerializeObject(licence);
HttpRestful.Instance.Post("https://locallicense.zxkedu.com/api/license/validate/", json, (m, n) =>
{
JsonConvert.DeserializeObject(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;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 13a2f840c2d90a44b8473ca7cf9adef1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: