更新Demo

更新Demo
This commit is contained in:
ALEXTANG
2023-12-20 12:08:25 +08:00
parent 5cf6b8c034
commit f64bb37706
2996 changed files with 29677 additions and 173915 deletions

View File

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

View File

@@ -0,0 +1,52 @@
using UnityEngine;
/// <summary>
/// 防止裁剪引用。
/// <remarks>如果在主工程无引用link.xml的防裁剪也无效。</remarks>
/// </summary>
public class DisStripCode : MonoBehaviour
{
private void Awake()
{
//UnityEngine.Physics
RegisterType<Collider>();
RegisterType<Collider2D>();
RegisterType<Collision>();
RegisterType<Collision2D>();
RegisterType<CapsuleCollider2D>();
RegisterType<Rigidbody>();
RegisterType<Rigidbody2D>();
RegisterType<Ray>();
RegisterType<Ray2D>();
//UnityEngine.Graphics
RegisterType<Mesh>();
RegisterType<MeshRenderer>();
//UnityEngine.Animation
RegisterType<AnimationClip>();
RegisterType<AnimationCurve>();
RegisterType<AnimationEvent>();
RegisterType<AnimationState>();
RegisterType<Animator>();
RegisterType<Animation>();
#if UNITY_IOS || PLATFORM_IOS
/*
// IOSCamera ios下相机权限的问题用这种方法就可以解决了 问题防裁剪。
foreach (var _ in WebCamTexture.devices)
{
}
*/
#endif
}
private void RegisterType<T>()
{
#if UNITY_EDITOR && false
Debug.Log($"DisStripCode RegisterType :{typeof(T)}");
#endif
}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,102 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &8750341085829442500
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6219407630702172851}
- component: {fileID: 3884336621553324141}
- component: {fileID: 6532236131487937402}
- component: {fileID: 6072749800057847719}
m_Layer: 0
m_Name: UILoad
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6219407630702172851
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8750341085829442500}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
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, y: 0}
--- !u!223 &3884336621553324141
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8750341085829442500}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 1
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!114 &6532236131487937402
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8750341085829442500}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 750, y: 1330}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!114 &6072749800057847719
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8750341085829442500}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 55

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d6d710f0749bc734abe3d835ca0e56d9
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 617fd4393fcb12c45941d2a1850d998f
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,940 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &148945374222998995
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4652061626151979521}
- component: {fileID: 4022160420422240251}
- component: {fileID: 3123264760710792296}
m_Layer: 5
m_Name: m_imgBackGround
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4652061626151979521
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 148945374222998995}
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: 1633508802563447727}
m_RootOrder: 0
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 &4022160420422240251
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 148945374222998995}
m_CullTransparentMesh: 0
--- !u!114 &3123264760710792296
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 148945374222998995}
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: 0.039215688}
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!1 &952437499883445590
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2347891492826839465}
- component: {fileID: 3565553526528554398}
- component: {fileID: 1974897531047992226}
- component: {fileID: 2835083178279248017}
m_Layer: 5
m_Name: m_scrollbarProgress
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2347891492826839465
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 952437499883445590}
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: 947380016692030854}
m_Father: {fileID: 1633508802563447727}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 106}
m_SizeDelta: {x: -60, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3565553526528554398
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 952437499883445590}
m_CullTransparentMesh: 0
--- !u!114 &1974897531047992226
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 952437499883445590}
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: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
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 &2835083178279248017
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 952437499883445590}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2a4db7a114972834c8e4117be1d82ba3, 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: 1
m_Colors:
m_NormalColor: {r: 0.9450981, g: 0.6392157, b: 0.25490198, 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: 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: 4296679187938450242}
m_HandleRect: {fileID: 3254196395727856927}
m_Direction: 0
m_Value: 0
m_Size: 1
m_NumberOfSteps: 0
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
--- !u!1 &3947545286821712907
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1183389821019440696}
- component: {fileID: 5614918906260324741}
- component: {fileID: 8335614385525365205}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1183389821019440696
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3947545286821712907}
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: 4232232858152633415}
m_RootOrder: 0
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: -2}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5614918906260324741
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3947545286821712907}
m_CullTransparentMesh: 0
--- !u!114 &8335614385525365205
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3947545286821712907}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.9339623, g: 0.9339623, b: 0.9339623, 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_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 26
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 45
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: "\u6E05\u7A7A\u7F13\u5B58"
--- !u!1 &3963657392457004041
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8666815445422661327}
- component: {fileID: 3177628147056126464}
- component: {fileID: 625621492709539730}
- component: {fileID: 901921533740187707}
m_Layer: 5
m_Name: m_textDesc
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8666815445422661327
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3963657392457004041}
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: 1633508802563447727}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 374.99997, y: 44}
m_SizeDelta: {x: 690, y: 88}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3177628147056126464
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3963657392457004041}
m_CullTransparentMesh: 0
--- !u!114 &625621492709539730
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3963657392457004041}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, 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_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 24
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 55
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: "\u914D\u7F6E\u68C0\u6D4B\u4E2D"
--- !u!114 &901921533740187707
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3963657392457004041}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e19747de3f5aca642ab2be37e372fb86, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
m_EffectDistance: {x: 1, y: -1}
m_UseGraphicAlpha: 1
--- !u!1 &4459087193914342294
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4232232858152633415}
- component: {fileID: 5178926555052269669}
- component: {fileID: 6498306990646814329}
- component: {fileID: 8386797903619165155}
m_Layer: 5
m_Name: m_btnClear
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4232232858152633415
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4459087193914342294}
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: 1183389821019440696}
m_Father: {fileID: 1753386200549547019}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -122.8338, y: -55}
m_SizeDelta: {x: 223.6676, y: 74}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5178926555052269669
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4459087193914342294}
m_CullTransparentMesh: 0
--- !u!114 &6498306990646814329
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4459087193914342294}
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: 2761fc23b4aa7e34187ac5ffbc3fad9b, 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 &8386797903619165155
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4459087193914342294}
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: 1
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: 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: 6498306990646814329}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!1 &4664656392582353123
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1753386200549547019}
- component: {fileID: 3934019394921887810}
m_Layer: 5
m_Name: TopNode
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1753386200549547019
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4664656392582353123}
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: 4232232858152633415}
- {fileID: 3038352660368000718}
- {fileID: 8143980099109665604}
m_Father: {fileID: 1633508802563447727}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -50}
m_SizeDelta: {x: 0, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &3934019394921887810
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4664656392582353123}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c0a563c3e931db74f94f9991270a2dee, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &7836612998133337201
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 947380016692030854}
m_Layer: 5
m_Name: Sliding Area
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &947380016692030854
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7836612998133337201}
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: 3254196395727856927}
m_Father: {fileID: 2347891492826839465}
m_RootOrder: 0
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: -20, y: -20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &8067205018289099991
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8143980099109665604}
- component: {fileID: 3256589533690080240}
- component: {fileID: 7408920366768410708}
- component: {fileID: 3906250900488968538}
m_Layer: 5
m_Name: m_textResid
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8143980099109665604
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8067205018289099991}
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: 1753386200549547019}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 242, y: -70}
m_SizeDelta: {x: 400, y: 40}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3256589533690080240
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8067205018289099991}
m_CullTransparentMesh: 0
--- !u!114 &7408920366768410708
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8067205018289099991}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, 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_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 22
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 55
m_Alignment: 3
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text:
--- !u!114 &3906250900488968538
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8067205018289099991}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e19747de3f5aca642ab2be37e372fb86, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
m_EffectDistance: {x: 1, y: -1}
m_UseGraphicAlpha: 1
--- !u!1 &8606204063644072871
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3254196395727856927}
- component: {fileID: 7553620620009672016}
- component: {fileID: 4296679187938450242}
m_Layer: 5
m_Name: Handle
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3254196395727856927
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8606204063644072871}
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: 947380016692030854}
m_RootOrder: 0
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: 20, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7553620620009672016
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8606204063644072871}
m_CullTransparentMesh: 0
--- !u!114 &4296679187938450242
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8606204063644072871}
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: 10905, guid: 0000000000000000f000000000000000, type: 0}
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!1 &9130266365217219149
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1633508802563447727}
- component: {fileID: 5827342734203288403}
- component: {fileID: 4835021223508371640}
m_Layer: 5
m_Name: UILoadUpdate
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1633508802563447727
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9130266365217219149}
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: 4652061626151979521}
- {fileID: 2347891492826839465}
- {fileID: 8666815445422661327}
- {fileID: 1753386200549547019}
m_Father: {fileID: 0}
m_RootOrder: 0
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!223 &5827342734203288403
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9130266365217219149}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 2
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 1
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: -1
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!114 &4835021223508371640
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9130266365217219149}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 55
--- !u!1 &9157096376857424144
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3038352660368000718}
- component: {fileID: 6089926678751886717}
- component: {fileID: 1355718662626521362}
- component: {fileID: 64988348858103615}
m_Layer: 5
m_Name: m_textAppid
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3038352660368000718
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9157096376857424144}
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: 1753386200549547019}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 241, y: -30}
m_SizeDelta: {x: 400, y: 40}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6089926678751886717
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9157096376857424144}
m_CullTransparentMesh: 0
--- !u!114 &1355718662626521362
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9157096376857424144}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, 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_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 22
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 55
m_Alignment: 3
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text:
--- !u!114 &64988348858103615
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9157096376857424144}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e19747de3f5aca642ab2be37e372fb86, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
m_EffectDistance: {x: 1, y: -1}
m_UseGraphicAlpha: 1

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1c22fd02cc9da1040a2e71ceb8845e86
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
{
"CurrentVersion" : "",
"UpdateType": 1,
"UpdateStyle": 1,
"UpdateNotice": 1,
"HostServerURL": "",
"FallbackHostServerURL" : ""
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 85f6d17bf159b614ea2d85183b86fa79
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

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

View File

@@ -0,0 +1,182 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
using TEngine;
namespace GameMain
{
#pragma warning disable CS0649
public class LoadStyle : MonoBehaviour
{
public Button _btn_ignore;
public Button _btn_update;
public Button _btn_package;
public Text _label_ignore;
public Text _label_update;
public Text _label_package;
private Dictionary<StyleEnum, Dictionary<BtnEnum, StyleItem>> loadConfig;
private const string ConfigPath = "RawBytes/UIStyle/Style.json";
public enum StyleEnum
{
Style_Default = 0,//默认
Style_QuitApp = 1,//退出应用
Style_RestartApp = 2,//重启应用
Style_Retry = 3,//重试
Style_StartUpdate_Notice = 4,//提示更新
Style_DownLoadApk = 5,//下载底包
Style_Clear = 6,//修复客户端
Style_DownZip = 7,//继续下载压缩包
}
public enum BtnEnum
{
BtnOK = 0, //确定按钮
BtnIgnore = 1,//取消按钮
BtnOther = 2, //其他按钮
}
/// <summary>
/// 单个按钮的样式
/// </summary>
private class StyleItem
{
public Alignment Align;//对其方式
public bool Show;//是否隐藏
public string Desc;//按钮描述
}
/// <summary>
/// 对齐方式
/// </summary>
private enum Alignment
{
Left = 0,
Middle = 1,
Right = 2
}
private void Awake()
{
//设置按钮的默认描述
_label_ignore.text = LoadText.Instance.Label_Btn_Ignore;
_label_update.text = LoadText.Instance.Label_Btn_Update;
_label_package.text = LoadText.Instance.Label_Btn_Package;
InitConfig();
}
private void InitConfig()
{
// string url = AssetUtility.Config.GetConfigAsset(ConfigPath);
// if (!String.IsNullOrEmpty(url))
// {
// string finalPath = SetFilePath(url);
// InitConfigDic(finalPath);
// }
}
#region
private string SetFilePath(string path)
{
#if UNITY_ANDROID
if (path.StartsWith(Application.persistentDataPath))
path = $"file://{path}";
#elif UNITY_IOS
if (path.StartsWith(Application.persistentDataPath)||path.StartsWith(Application.streamingAssetsPath))
path = $"file://{path}";
#endif
return path;
}
private void InitConfigDic(string path)
{
UnityWebRequest www = UnityWebRequest.Get(path);
UnityWebRequestAsyncOperation request = www.SendWebRequest();
while (!request.isDone)
{
}
if (!String.IsNullOrEmpty(www.downloadHandler.text))
{
loadConfig = JsonConvert.DeserializeObject<Dictionary<StyleEnum, Dictionary<BtnEnum, StyleItem>>>(www.downloadHandler.text);
}
www.Dispose();
}
#endregion
/// <summary>
/// 设置样式
/// </summary>
/// <param name="type">样式对应的id</param>
public void SetStyle(StyleEnum type)
{
if (type == StyleEnum.Style_Default)
return;
if (loadConfig == null)
{
Log.Error("LoadConfig is null");
return;
}
var style = loadConfig[type];
if (style == null)
{
Log.Error($"LoadConfig, Can not find type:{type},please check it");
return;
}
SetButtonStyle(style);
}
/// <summary>
/// 设置按钮的描述,是否隐藏
/// </summary>
private void SetButtonStyle(Dictionary<BtnEnum, StyleItem> list)
{
foreach (var item in list)
{
switch (item.Key)
{
case BtnEnum.BtnOK:
_label_update.text = item.Value.Desc;
_btn_update.gameObject.SetActive(item.Value.Show);
SetButtonPos(item.Value.Align, _btn_update.transform);
break;
case BtnEnum.BtnIgnore:
_label_ignore.text = item.Value.Desc;
_btn_ignore.gameObject.SetActive(item.Value.Show);
SetButtonPos(item.Value.Align, _btn_ignore.transform);
break;
case BtnEnum.BtnOther:
_label_package.text = item.Value.Desc;
_btn_package.gameObject.SetActive(item.Value.Show);
SetButtonPos(item.Value.Align, _btn_package.transform);
break;
}
}
}
/// <summary>
/// 设置按钮位置
/// </summary>
private void SetButtonPos(Alignment align, Transform item)
{
switch (align)
{
case Alignment.Left:
item.SetSiblingIndex(0);
break;
case Alignment.Middle:
item.SetSiblingIndex(1);
break;
case Alignment.Right:
item.SetSiblingIndex(2);
break;
}
}
}
}

View File

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

View File

@@ -0,0 +1,140 @@
using UnityEngine;
namespace GameMain
{
public class TextMode
{
public string Label_Load_Progress = "正在下载资源文件,请耐心等待\n当前下载速度{0}/s 资源文件大小:{1}";
public string Label_Load_FirstUnpack = "首次进入游戏,正在初始化游戏资源...(此过程不消耗网络流量)";
public string Label_Load_Unpacking = "正在更新本地资源版本,请耐心等待...(此过程不消耗网络流量)";
public string Label_Load_Checking = "检测更新设置{0}...";
public string Label_Load_Checked = "最新版本检测完成";
public string Label_Load_Package = "当前使用的版本过低,请下载安装最新版本";
public string Label_Load_Plantform = "当前使用的版本过低,请前往应用商店安装最新版本";
public string Label_Load_Notice = "检测到可选资源更新,更新包大小<color=#BA3026>{0}</color>\n推荐完成更新提升游戏体验";
public string Label_Load_Force = "检测到版本更新,取消更新将导致无法进入游戏";
public string Label_Load_Force_WIFI =
"检测到有新的游戏内容需要更新,\n更新包大小<color=#BA3026>{0}</color>, \n取消更新将导致无法进入游戏您当前已为<color=#BA3026>wifi网络</color>,请开始更新";
public string Label_Load_Force_NO_WIFI =
"检测到有新的游戏内容需要更新,\n更新包大小<color=#BA3026>{0}</color>, \n取消更新将导致无法进入游戏请开始更新";
public string Label_Load_Error = "更新参数错误{0},请点击确定重新启动游戏";
public string Label_Load_FirstEntrerGame_Error = "首次进入游戏资源异常";
public string Label_Load_UnpackComplete = "正在加载最新资源文件...(此过程不消耗网络流量)";
public string Label_Load_UnPackError = "资源解压失败,请点击确定重新启动游戏";
public string Label_Load_Load_Progress = "正在载入...{0}%";
public string Label_Load_Download_Progress = "正在下载...{0}%";
public string Label_Load_Load_Complete = "载入完成";
public string Label_Load_Init = "初始化...";
public string Label_Net_UnReachable = "当前网络不可用,请检查本地网络设置后点击确认进行重试";
public string Label_Net_ReachableViaCarrierDataNetwork = "当前是移动网络,是否继续下载";
public string Label_Net_Error = "网络异常,请重试";
public string Label_Net_Changed = "网络切换,正在尝试重连,{0}次";
public string Label_Data_Empty = "数据异常";
public string Label_Memory_Low = "初始化资源加载失败,请检查本地内存是否充足";
public string Label_Memory_Low_Load = "内存是否充足,无法更新";
public string Label_Memory_UnZip_Low = "内存不足,无法解压";
public string Label_App_id = "APPVer {0}"; //"游戏版本号:{0}";
public string Label_Res_id = "ResVer {0}"; //"资源版本号:{0}";
public string Label_Clear_Comfirm = "是否清理本地资源?(清理完成后会关闭游戏且重新下载最新资源)";
public string Label_RestartApp = "本次更新需要重启应用,请点击确定重新启动游戏";
public string Label_DownLoadFailed = "网络太慢,是否继续下载";
public string Label_ClearConfig = "清除环境配置,需要重启应用";
public string Label_RegionInfoIllegal = "区服信息为空";
public string Label_RemoteUrlisNull = "热更地址为空";
public string Label_FirstPackageNotFound = "首包资源加载失败";
public string Label_RequestReginInfo = "正在请求区服信息{0}次";
public string Label_RequestTimeOut = "请求区服信息超时,是否重试?";
public string Label_Region_ArgumentError = "参数错误";
public string Label_Region_IndexOutOfRange = "索引越界";
public string Label_Region_NonConfigApplication = "未配置此应用";
public string Label_Region_SystemError = "系统异常";
public string Label_PreventionOfAddiction = "著作人权XX市TEngine有限公司 软著登记号2022SR0000000\n抵制不良游戏拒绝盗版游戏。注意自我保护谨防受骗上当。适度游戏益脑" +
"沉迷游戏伤身。合理安排时间,享受健康生活。";
public string Label_Btn_Update = "确定";
public string Label_Btn_Ignore = "取消";
public string Label_Btn_Package = "更新";
public string Label_Dlc_ConfigVerificateStage = "配置校验中...";
public string Label_Dlc_ConfigLoadingStage = "下载配置中...";
public string Label_Dlc_AssetsLoading = "下载资源中...";
public string Label_Dlc_LoadingFinish = "下载结束";
public string Label_Dlc_Load_Force_WIFI =
"检测到有新的游戏内容需要更新, 取消更新将导致无法进入游戏,您当前已为<color=#BA3026>wifi网络</color>,请开始更新";
public string Label_Dlc_Load_Force_NO_WIFI =
"检测到有新的游戏内容需要更新, 取消更新将导致无法进入游戏,请开始更新";
public string Label_Had_Update = "检测到有版本更新...";
public string Label_RequestVersionIng = "正在向服务器请求版本信息中...";
public string Label_RequestVersionInfo = "正在向服务器请求版本信息{0}次";
}
public class LoadText : TextMode
{
private static LoadText _instance;
public static LoadText Instance => _instance ??= new LoadText();
public void InitConfigData(TextAsset asset)
{
if (asset == null)
return;
TextMode loadConfig = JsonUtility.FromJson<TextMode>(asset.text);
if (loadConfig != null)
{
Label_Load_Progress = loadConfig.Label_Load_Progress;
Label_Load_FirstUnpack = loadConfig.Label_Load_FirstUnpack;
Label_Load_Unpacking = loadConfig.Label_Load_Unpacking;
Label_Load_Checking = loadConfig.Label_Load_Checking;
Label_Load_Checked = loadConfig.Label_Load_Checked;
Label_Load_Package = loadConfig.Label_Load_Package;
Label_Load_Plantform = loadConfig.Label_Load_Plantform;
Label_Load_Notice = loadConfig.Label_Load_Notice;
Label_Load_Force = loadConfig.Label_Load_Force;
Label_Load_Force_WIFI = loadConfig.Label_Load_Force_WIFI;
Label_Load_Force_NO_WIFI = loadConfig.Label_Load_Force_NO_WIFI;
Label_Load_Error = loadConfig.Label_Load_Error;
Label_Load_FirstEntrerGame_Error = loadConfig.Label_Load_FirstEntrerGame_Error;
Label_Load_UnpackComplete = loadConfig.Label_Load_UnpackComplete;
Label_Load_UnPackError = loadConfig.Label_Load_UnPackError;
Label_Load_Load_Progress = loadConfig.Label_Load_Load_Progress;
Label_Load_Download_Progress = loadConfig.Label_Load_Download_Progress;
Label_Load_Init = loadConfig.Label_Load_Init;
Label_Net_UnReachable = loadConfig.Label_Net_UnReachable;
Label_Net_Error = loadConfig.Label_Net_Error;
Label_Net_Changed = loadConfig.Label_Net_Changed;
Label_Data_Empty = loadConfig.Label_Data_Empty;
Label_Memory_Low = loadConfig.Label_Memory_Low;
Label_Memory_Low_Load = loadConfig.Label_Memory_Low_Load;
Label_Memory_UnZip_Low = loadConfig.Label_Memory_UnZip_Low;
Label_App_id = loadConfig.Label_App_id;
Label_Res_id = loadConfig.Label_Res_id;
Label_Clear_Comfirm = loadConfig.Label_Clear_Comfirm;
Label_RestartApp = loadConfig.Label_RestartApp;
Label_DownLoadFailed = loadConfig.Label_DownLoadFailed;
Label_ClearConfig = loadConfig.Label_ClearConfig;
Label_PreventionOfAddiction = loadConfig.Label_PreventionOfAddiction;
Label_RegionInfoIllegal = loadConfig.Label_RegionInfoIllegal;
Label_RemoteUrlisNull = loadConfig.Label_RemoteUrlisNull;
Label_FirstPackageNotFound = loadConfig.Label_FirstPackageNotFound;
Label_RequestReginInfo = loadConfig.Label_RequestReginInfo;
Label_Net_ReachableViaCarrierDataNetwork = loadConfig.Label_Net_ReachableViaCarrierDataNetwork;
Label_RequestTimeOut = loadConfig.Label_RequestTimeOut;
Label_Region_ArgumentError = loadConfig.Label_Region_ArgumentError;
Label_Region_IndexOutOfRange = loadConfig.Label_Region_IndexOutOfRange;
Label_Region_NonConfigApplication = loadConfig.Label_Region_NonConfigApplication;
Label_Region_SystemError = loadConfig.Label_Region_SystemError;
Label_Btn_Ignore = loadConfig.Label_Btn_Ignore;
Label_Btn_Package = loadConfig.Label_Btn_Package;
Label_Btn_Update = loadConfig.Label_Btn_Update;
}
}
}
}

View File

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

View File

@@ -0,0 +1,16 @@
using System;
namespace GameMain
{
public class LoadUpdateLogic
{
private static LoadUpdateLogic _instance;
public Action<int> DownloadCompleteAction = null;
public Action<float> DownProgressAction = null;
public Action<bool> UnpackedCompleteAction = null;
public Action<float> UnpackedProgressAction = null;
public static LoadUpdateLogic Instance => _instance ??= new LoadUpdateLogic();
}
}

View File

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

View File

@@ -0,0 +1,63 @@
using System.Collections.Generic;
using UnityEngine;
using TEngine;
namespace GameMain
{
public class UIDefine
{
public static readonly string UILoadUpdate = "UILoadUpdate";
public static readonly string UILoadTip = "UILoadTip";
}
public static class UILoadMgr
{
private static readonly Dictionary<string, System.Type> _uiMap = new Dictionary<string, System.Type>();
private static bool _isInit = false;
/// <summary>
/// 初始化。
/// </summary>
public static void Initialize()
{
if (_isInit)
{
return;
}
_uiMap.Add(UIDefine.UILoadUpdate, typeof(UILoadUpdate));
_uiMap.Add(UIDefine.UILoadTip, typeof(UILoadTip));
GameModule.UI.ShowUI<UILoadUpdate>();
_isInit = true;
}
/// <summary>
/// show ui
/// </summary>
/// <param name="uiInfo">对应的ui</param>
/// <param name="param">参数</param>
public static void Show(string uiInfo, object param = null)
{
if (string.IsNullOrEmpty(uiInfo))
return;
if (!_uiMap.ContainsKey(uiInfo))
{
Log.Error($"ui not exist: {uiInfo}");
return;
}
GameModule.UI.ShowUI(_uiMap[uiInfo], param);
}
/// <summary>
/// 隐藏ui管理器。
/// </summary>
public static void HideAll()
{
GameModule.UI.CloseWindow<UILoadTip>();
GameModule.UI.CloseWindow<UILoadUpdate>();
}
}
}

View File

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

View File

@@ -0,0 +1,143 @@
using UnityEngine.UI;
using System;
using TEngine;
namespace GameMain
{
public enum MessageShowType
{
None = 0,
OneButton = 1,
TwoButton = 2,
ThreeButton = 3,
}
[Window(UILayer.UI, fromResources: true, location: "AssetLoad/UILoadTip")]
public class UILoadTip : UIWindow
{
public Action OnOk;
public Action OnCancel;
public MessageShowType ShowType = MessageShowType.None;
#region
private Button m_btnPackage;
private Text m_textTittle;
private Text m_textInfo;
private Button m_btnIgnore;
private Button m_btnUpdate;
public override void ScriptGenerator()
{
m_btnPackage = FindChildComponent<Button>("BgImage/m_btnPackage");
m_textTittle = FindChildComponent<Text>("BgImage/m_textTittle");
m_textInfo = FindChildComponent<Text>("BgImage/m_textInfo");
m_btnIgnore = FindChildComponent<Button>("BgImage/Group/m_btnIgnore");
m_btnUpdate = FindChildComponent<Button>("BgImage/Group/m_btnUpdate");
m_btnPackage.onClick.AddListener(OnClickPackageBtn);
m_btnIgnore.onClick.AddListener(OnClickIgnoreBtn);
m_btnUpdate.onClick.AddListener(OnClickUpdateBtn);
}
#endregion
#region
private void OnClickPackageBtn()
{
if (OnOk == null)
{
m_textInfo.text = "<color=#BA3026>该按钮不应该存在</color>";
}
else
{
OnOk();
Close();
}
}
private void OnClickIgnoreBtn()
{
if (OnCancel == null)
{
m_textInfo.text = "<color=#BA3026>该按钮不应该存在</color>";
}
else
{
OnCancel();
Close();
}
}
private void OnClickUpdateBtn()
{
if (OnOk == null)
{
m_textInfo.text = "<color=#BA3026>该按钮不应该存在</color>";
}
else
{
OnOk();
Close();
}
}
#endregion
public override void OnRefresh()
{
base.OnRefresh();
m_btnIgnore.gameObject.SetActive(false);
m_btnPackage.gameObject.SetActive(false);
m_btnUpdate.gameObject.SetActive(false);
switch (ShowType)
{
case MessageShowType.OneButton:
m_btnUpdate.gameObject.SetActive(true);
break;
case MessageShowType.TwoButton:
m_btnUpdate.gameObject.SetActive(true);
m_btnIgnore.gameObject.SetActive(true);
break;
case MessageShowType.ThreeButton:
m_btnIgnore.gameObject.SetActive(true);
m_btnPackage.gameObject.SetActive(true);
m_btnUpdate.gameObject.SetActive(true);
break;
}
m_textInfo.text = UserData.ToString();
}
/// <summary>
/// 显示提示框,目前最多支持三个按钮
/// </summary>
/// <param name="desc">描述</param>
/// <param name="showtype">类型MessageShowType</param>
/// <param name="style">StyleEnum</param>
/// <param name="onOk">点击事件</param>
/// <param name="onCancel">取消事件</param>
/// <param name="onPackage">更新事件</param>
public static void ShowMessageBox(string desc, MessageShowType showtype = MessageShowType.OneButton,
LoadStyle.StyleEnum style = LoadStyle.StyleEnum.Style_Default,
Action onOk = null,
Action onCancel = null,
Action onPackage = null)
{
var operation = GameModule.UI.ShowUI<UILoadTip>(desc);
if (operation == null || operation.Window == null)
{
return;
}
var ui = operation.Window as UILoadTip;
ui.OnOk = onOk;
ui.OnCancel = onCancel;
ui.ShowType = showtype;
ui.OnRefresh();
var loadStyleUI = ui.gameObject.GetComponent<LoadStyle>();
if (loadStyleUI)
{
loadStyleUI.SetStyle(style);
}
}
}
}

View File

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

View File

@@ -0,0 +1,134 @@
using UnityEngine;
using UnityEngine.UI;
using TEngine;
using Version = TEngine.Version;
namespace GameMain
{
[Window(UILayer.UI, fromResources: true, location: "AssetLoad/UILoadUpdate",fullScreen:true)]
public class UILoadUpdate : UIWindow
{
private Scrollbar m_scrollbarProgress;
#region
private Image m_imgBackGround;
private Text m_textDesc;
private Button m_btnClear;
private Text m_textAppid;
private Text m_textResid;
public override void ScriptGenerator()
{
m_imgBackGround = FindChildComponent<Image>("m_imgBackGround");
m_textDesc = FindChildComponent<Text>("m_textDesc");
m_btnClear = FindChildComponent<Button>("TopNode/m_btnClear");
m_textAppid = FindChildComponent<Text>("TopNode/m_textAppid");
m_textResid = FindChildComponent<Text>("TopNode/m_textResid");
m_scrollbarProgress = FindChildComponent<Scrollbar>("m_scrollbarProgress");
m_btnClear.onClick.AddListener(OnClickClearBtn);
}
#endregion
public override void OnCreate()
{
base.OnCreate();
LoadUpdateLogic.Instance.DownloadCompleteAction += DownLoad_Complete_Action;
LoadUpdateLogic.Instance.DownProgressAction += DownLoad_Progress_Action;
LoadUpdateLogic.Instance.UnpackedCompleteAction += Unpacked_Complete_Action;
LoadUpdateLogic.Instance.UnpackedProgressAction += Unpacked_Progress_Action;
m_btnClear.gameObject.SetActive(true);
}
public override void RegisterEvent()
{
base.RegisterEvent();
AddUIEvent(RuntimeId.ToRuntimeId("RefreshVersion"),RefreshVersion);
}
public override void OnRefresh()
{
base.OnRefresh();
}
#region
private void OnClickClearBtn()
{
OnStop(null);
UILoadTip.ShowMessageBox(LoadText.Instance.Label_Clear_Comfirm, MessageShowType.TwoButton,
LoadStyle.StyleEnum.Style_Clear,
() =>
{
GameModule.Resource.ClearSandbox();
Application.Quit();
}, () => { OnContinue(null); });
}
#endregion
private void RefreshVersion()
{
m_textAppid.text = string.Format(LoadText.Instance.Label_App_id, Version.GameVersion);
m_textResid.text = string.Format(LoadText.Instance.Label_Res_id, GameModule.Resource.GetPackageVersion());
}
public virtual void OnContinue(GameObject obj)
{
// LoadMgr.Instance.StartDownLoad();
}
public virtual void OnStop(GameObject obj)
{
// LoadMgr.Instance.StopDownLoad();
}
/// <summary>
/// 下载进度完成
/// </summary>
/// <param name="type"></param>
protected virtual void DownLoad_Complete_Action(int type)
{
Log.Info("DownLoad_Complete");
}
/// <summary>
/// 下载进度更新
/// </summary>
/// <param name="progress"></param>
protected virtual void DownLoad_Progress_Action(float progress)
{
m_scrollbarProgress.gameObject.SetActive(true);
m_scrollbarProgress.size = progress;
}
/// <summary>
/// 解压缩完成回调
/// </summary>
/// <param name="type"></param>
protected virtual void Unpacked_Complete_Action(bool type)
{
m_scrollbarProgress.gameObject.SetActive(true);
m_textDesc.text = LoadText.Instance.Label_Load_UnpackComplete;
}
/// <summary>
/// 解压缩进度更新
/// </summary>
/// <param name="progress"></param>
protected virtual void Unpacked_Progress_Action(float progress)
{
m_scrollbarProgress.gameObject.SetActive(true);
m_textDesc.text = LoadText.Instance.Label_Load_Unpacking;
m_scrollbarProgress.size = progress;
}
public override void OnDestroy()
{
base.OnDestroy();
OnStop(null);
LoadUpdateLogic.Instance.DownloadCompleteAction -= DownLoad_Complete_Action;
LoadUpdateLogic.Instance.DownProgressAction -= DownLoad_Progress_Action;
}
}
}

View File

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

View File

@@ -0,0 +1,75 @@
/// <summary>
/// APP更新类型。
/// </summary>
public enum UpdateType
{
None = 0,
//资源更新
ResourceUpdate = 1,
//底包更新
PackageUpdate = 2,
}
/// <summary>
/// 强制更新类型。
/// </summary>
public enum UpdateStyle
{
None = 0,
Force = 1, //强制(不更新无法进入游戏。)
Optional = 2, //非强制(不更新可以进入游戏。)
}
/// <summary>
/// 是否提示更新。
/// </summary>
public enum UpdateNotice
{
None = 0,
Notice = 1, //提示
NoNotice = 2, //非提示
}
public enum GameStatus
{
First = 0,
AssetLoad = 1
}
/// <summary>
/// 版本更新数据。
/// </summary>
public class UpdateData
{
/// <summary>
/// 当前版本信息。
/// </summary>
public string CurrentVersion;
/// <summary>
/// 是否底包更新。
/// </summary>
public UpdateType UpdateType;
/// <summary>
/// 是否强制更新。
/// </summary>
public UpdateStyle UpdateStyle;
/// <summary>
/// 是否提示。
/// </summary>
public UpdateNotice UpdateNotice;
/// <summary>
/// 热更资源地址。
/// </summary>
public string HostServerURL;
/// <summary>
/// 备用热更资源地址。
/// </summary>
public string FallbackHostServerURL;
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 659f1c3c86074fa7969834a382bfaae3
timeCreated: 1695138297

View File

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

View File

@@ -0,0 +1,14 @@
namespace GameMain
{
public abstract class ProcedureBase : TEngine.ProcedureBase
{
/// <summary>
/// 获取流程是否使用原生对话框
/// 在一些特殊的流程(如游戏逻辑对话框资源更新完成前的流程)中,可以考虑调用原生对话框进行消息提示行为
/// </summary>
public abstract bool UseNativeDialog
{
get;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 531a832bf8dfd734395de52f4141082f
timeCreated: 1528026158
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,34 @@
using TEngine;
using ProcedureOwner = TEngine.IFsm<TEngine.IProcedureManager>;
namespace GameMain
{
/// <summary>
/// 流程 => 清理缓存。
/// </summary>
public class ProcedureClearCache:ProcedureBase
{
public override bool UseNativeDialog { get; }
private ProcedureOwner _procedureOwner;
protected override void OnEnter(ProcedureOwner procedureOwner)
{
_procedureOwner = procedureOwner;
Log.Info("清理未使用的缓存文件!");
UILoadMgr.Show(UIDefine.UILoadUpdate,$"清理未使用的缓存文件...");
var operation = GameModule.Resource.ClearUnusedCacheFilesAsync();
operation.Completed += Operation_Completed;
}
private void Operation_Completed(YooAsset.AsyncOperationBase obj)
{
UILoadMgr.Show(UIDefine.UILoadUpdate,$"清理完成 即将进入游戏...");
ChangeState<ProcedureLoadAssembly>(_procedureOwner);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b9e990ba01f24ac584014438abc7f3b7
timeCreated: 1679635352

View File

@@ -0,0 +1,201 @@
using System;
using System.Threading;
using Cysharp.Threading.Tasks;
using TEngine;
using UnityEngine;
using UnityEngine.Networking;
using YooAsset;
using ProcedureOwner = TEngine.IFsm<TEngine.IProcedureManager>;
using Utility = TEngine.Utility;
namespace GameMain
{
public class ProcedureCreateDownloader : ProcedureBase
{
private int _curTryCount;
private const int MaxTryCount = 3;
public override bool UseNativeDialog { get; }
private ProcedureOwner _procedureOwner;
private ResourceDownloaderOperation _downloader;
private int _totalDownloadCount;
private string _totalSizeMb;
protected override void OnEnter(ProcedureOwner procedureOwner)
{
_procedureOwner = procedureOwner;
Log.Info("创建补丁下载器");
UILoadMgr.Show(UIDefine.UILoadUpdate,$"创建补丁下载器...");
CreateDownloader().Forget();
}
private async UniTaskVoid CreateDownloader()
{
await UniTask.Delay(TimeSpan.FromSeconds(0.5f));
_downloader = GameModule.Resource.CreateResourceDownloader();
if (_downloader.TotalDownloadCount == 0)
{
Log.Info("Not found any download files !");
ChangeState<ProcedureDownloadOver>(_procedureOwner);
}
else
{
//A total of 10 files were found that need to be downloaded
Log.Info($"Found total {_downloader.TotalDownloadCount} files that need download ");
// 发现新更新文件后,挂起流程系统
// 注意:开发者需要在下载前检测磁盘空间不足
_totalDownloadCount = _downloader.TotalDownloadCount;
long totalDownloadBytes = _downloader.TotalDownloadBytes;
float sizeMb = totalDownloadBytes / 1048576f;
sizeMb = Mathf.Clamp(sizeMb, 0.1f, float.MaxValue);
_totalSizeMb = sizeMb.ToString("f1");
if (!SettingsUtils.EnableUpdateData())
{
UILoadTip.ShowMessageBox($"Found update patch files, Total count {_totalDownloadCount} Total size {_totalSizeMb}MB", MessageShowType.TwoButton,
LoadStyle.StyleEnum.Style_StartUpdate_Notice
, StartDownFile, Application.Quit);
}
else
{
RequestUpdateData().Forget();
}
}
}
void StartDownFile()
{
ChangeState<ProcedureDownloadFile>(_procedureOwner);
}
/// <summary>
/// 请求更新配置数据。
/// </summary>
private async UniTaskVoid RequestUpdateData()
{
Log.Warning("On RequestVersion");
_curTryCount++;
if (_curTryCount > MaxTryCount)
{
UILoadTip.ShowMessageBox(LoadText.Instance.Label_Net_Error, MessageShowType.TwoButton,
LoadStyle.StyleEnum.Style_Retry,
() =>
{
_curTryCount = 0;
RequestUpdateData().Forget();
}, Application.Quit);
return;
}
var checkVersionUrl = SettingsUtils.GetUpdateDataUrl();
UILoadMgr.Show(UIDefine.UILoadUpdate, string.Format(LoadText.Instance.Label_Load_Checking, _curTryCount));
if (string.IsNullOrEmpty(checkVersionUrl))
{
Log.Error("LoadMgr.RequestVersion, remote url is empty or null");
UILoadTip.ShowMessageBox(LoadText.Instance.Label_RemoteUrlisNull, MessageShowType.OneButton,
LoadStyle.StyleEnum.Style_QuitApp,
Application.Quit);
return;
}
Log.Info("RequestUpdateData, proxy:" + checkVersionUrl);
var updateDataStr = await Utility.Http.Get(checkVersionUrl);
try
{
UpdateData updateData = Utility.Json.ToObject<UpdateData>(updateDataStr);
ShowUpdateType(updateData);
}
catch (Exception e)
{
Log.Fatal(e);
throw;
}
}
/// <summary>
/// 显示更新方式
/// </summary>
/// <returns></returns>
private void ShowUpdateType(UpdateData data)
{
UILoadMgr.Show(UIDefine.UILoadUpdate, LoadText.Instance.Label_Load_Checked);
//底包更新
if (data.UpdateType == UpdateType.PackageUpdate)
{
UILoadTip.ShowMessageBox(LoadText.Instance.Label_Load_Package, MessageShowType.OneButton,
LoadStyle.StyleEnum.Style_DownLoadApk,
() =>
{
Log.Info("自定义下载APK");
Application.Quit();
});
}
//资源更新
else if (data.UpdateType == UpdateType.ResourceUpdate)
{
//强制
if (data.UpdateStyle == UpdateStyle.Force)
{
//提示
if (data.UpdateNotice == UpdateNotice.Notice)
{
NetworkReachability networkReachability = Application.internetReachability;
string desc = LoadText.Instance.Label_Load_Force_WIFI;
if (networkReachability == NetworkReachability.ReachableViaCarrierDataNetwork)
{
desc = LoadText.Instance.Label_Load_Force_NO_WIFI;
}
desc = string.Format(desc, $"{_totalSizeMb}MB");
UILoadTip.ShowMessageBox(desc, MessageShowType.TwoButton,
LoadStyle.StyleEnum.Style_StartUpdate_Notice,
StartDownFile, Application.Quit);
}
//不提示
else if (data.UpdateNotice == UpdateNotice.NoNotice)
{
StartDownFile();
}
}
//非强制
else if (data.UpdateStyle == UpdateStyle.Optional)
{
//提示
if (data.UpdateNotice == UpdateNotice.Notice)
{
UILoadTip.ShowMessageBox(string.Format(LoadText.Instance.Label_Load_Notice,$"{_totalSizeMb}MB"), MessageShowType.TwoButton,
LoadStyle.StyleEnum.Style_StartUpdate_Notice,
StartDownFile, () =>
{
ChangeState<ProcedureLoadAssembly>(_procedureOwner);
});
}
//不提示
else if (data.UpdateNotice == UpdateNotice.NoNotice)
{
StartDownFile();
}
}
else
{
Log.Error("LoadMgr._CheckUpdate, style is error,code:" + data.UpdateStyle);
}
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2323d6b64e5a4a1195b9ed1795a64bdd
timeCreated: 1679634708

View File

@@ -0,0 +1,91 @@
using System;
using Cysharp.Threading.Tasks;
using TEngine;
using YooAsset;
using ProcedureOwner = TEngine.IFsm<TEngine.IProcedureManager>;
using Utility = TEngine.Utility;
namespace GameMain
{
public class ProcedureDownloadFile:ProcedureBase
{
public override bool UseNativeDialog { get; }
private ProcedureOwner _procedureOwner;
private float _lastUpdateDownloadedSize;
private float CurrentSpeed
{
get
{
float interval = GameTime.deltaTime;
var sizeDiff = GameModule.Resource.Downloader.CurrentDownloadBytes - _lastUpdateDownloadedSize;
_lastUpdateDownloadedSize = GameModule.Resource.Downloader.CurrentDownloadBytes;
var speed = (float)Math.Floor(sizeDiff / interval);
return speed;
}
}
protected override void OnEnter(ProcedureOwner procedureOwner)
{
_procedureOwner = procedureOwner;
Log.Info("开始下载更新文件!");
UILoadMgr.Show(UIDefine.UILoadUpdate,$"开始下载更新文件...");
BeginDownload().Forget();
}
private async UniTaskVoid BeginDownload()
{
var downloader = GameModule.Resource.Downloader;
// 注册下载回调
downloader.OnDownloadErrorCallback = OnDownloadErrorCallback;
downloader.OnDownloadProgressCallback = OnDownloadProgressCallback;
downloader.BeginDownload();
await downloader;
// 检测下载结果
if (downloader.Status != EOperationStatus.Succeed)
return;
ChangeState<ProcedureDownloadOver>(_procedureOwner);
}
private void OnDownloadErrorCallback(string fileName, string error)
{
UILoadTip.ShowMessageBox($"Failed to download file : {fileName}", MessageShowType.TwoButton,
LoadStyle.StyleEnum.Style_Default
, () => { ChangeState<ProcedureCreateDownloader>(_procedureOwner); }, UnityEngine.Application.Quit);
}
private void OnDownloadProgressCallback(int totalDownloadCount, int currentDownloadCount, long totalDownloadBytes, long currentDownloadBytes)
{
string currentSizeMb = (currentDownloadBytes / 1048576f).ToString("f1");
string totalSizeMb = (totalDownloadBytes / 1048576f).ToString("f1");
// UILoadMgr.Show(UIDefine.UILoadUpdate,$"{currentDownloadCount}/{totalDownloadCount} {currentSizeMb}MB/{totalSizeMb}MB");
string descriptionText = Utility.Text.Format("正在更新,已更新{0},总更新{1},已更新大小{2},总更新大小{3},更新进度{4},当前网速{5}/s",
currentDownloadCount.ToString(),
totalDownloadCount.ToString(),
Utility.File.GetByteLengthString(currentDownloadBytes),
Utility.File.GetByteLengthString(totalDownloadBytes),
GameModule.Resource.Downloader.Progress,
Utility.File.GetLengthString((int)CurrentSpeed));
LoadUpdateLogic.Instance.DownProgressAction?.Invoke(GameModule.Resource.Downloader.Progress);
UILoadMgr.Show(UIDefine.UILoadUpdate,descriptionText);
int needTime = 0;
if (CurrentSpeed > 0)
{
needTime = (int)((totalDownloadBytes - currentDownloadBytes) / CurrentSpeed);
}
TimeSpan ts = new TimeSpan(0, 0, needTime);
string timeStr = ts.ToString(@"mm\:ss");
string updateProgress = Utility.Text.Format("剩余时间 {0}({1}/s)", timeStr, Utility.File.GetLengthString((int)CurrentSpeed));
Log.Info(updateProgress);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 19b2799aad474898b96d8551856e6b40
timeCreated: 1679642638

View File

@@ -0,0 +1,31 @@
using TEngine;
using ProcedureOwner = TEngine.IFsm<TEngine.IProcedureManager>;
namespace GameMain
{
public class ProcedureDownloadOver:ProcedureBase
{
public override bool UseNativeDialog { get; }
private bool _needClearCache;
protected override void OnEnter(ProcedureOwner procedureOwner)
{
Log.Info("下载完成!!!");
UILoadMgr.Show(UIDefine.UILoadUpdate,$"下载完成...");
}
protected override void OnUpdate(ProcedureOwner procedureOwner, float elapseSeconds, float realElapseSeconds)
{
if (_needClearCache)
{
ChangeState<ProcedureClearCache>(procedureOwner);
}
else
{
ChangeState<ProcedureLoadAssembly>(procedureOwner);
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b3998cede0874b49afc170062e554c34
timeCreated: 1679635148

View File

@@ -0,0 +1,162 @@
using System;
using Cysharp.Threading.Tasks;
using TEngine;
using UnityEngine;
using YooAsset;
using ProcedureOwner = TEngine.IFsm<TEngine.IProcedureManager>;
using Utility = TEngine.Utility;
namespace GameMain
{
/// <summary>
/// 流程 => 初始化Package。
/// </summary>
public class ProcedureInitPackage : ProcedureBase
{
public override bool UseNativeDialog { get; }
private ProcedureOwner _procedureOwner;
protected override void OnEnter(ProcedureOwner procedureOwner)
{
base.OnEnter(procedureOwner);
_procedureOwner = procedureOwner;
//Fire Forget立刻触发UniTask初始化Package
InitPackage(procedureOwner).Forget();
}
private async UniTaskVoid InitPackage(ProcedureOwner procedureOwner)
{
if (GameModule.Resource.PlayMode == EPlayMode.HostPlayMode ||
GameModule.Resource.PlayMode == EPlayMode.WebPlayMode)
{
if (SettingsUtils.EnableUpdateData())
{
UpdateData updateData = await RequestUpdateData();
if (updateData != null)
{
if (!string.IsNullOrEmpty(updateData.HostServerURL))
{
SettingsUtils.FrameworkGlobalSettings.HostServerURL = updateData.HostServerURL;
}
if (!string.IsNullOrEmpty(updateData.FallbackHostServerURL))
{
SettingsUtils.FrameworkGlobalSettings.FallbackHostServerURL =
updateData.FallbackHostServerURL;
}
}
}
}
var initializationOperation = GameModule.Resource.InitPackage();
await UniTask.Delay(TimeSpan.FromSeconds(1f));
await initializationOperation.ToUniTask();
if (initializationOperation.Status == EOperationStatus.Succeed)
{
//热更新阶段文本初始化
LoadText.Instance.InitConfigData(null);
GameEvent.Send(RuntimeId.ToRuntimeId("RefreshVersion"));
EPlayMode playMode = GameModule.Resource.PlayMode;
// 编辑器模式。
if (playMode == EPlayMode.EditorSimulateMode)
{
Log.Info("Editor resource mode detected.");
ChangeState<ProcedurePreload>(procedureOwner);
}
// 单机模式。
else if (playMode == EPlayMode.OfflinePlayMode)
{
Log.Info("Package resource mode detected.");
ChangeState<ProcedureInitResources>(procedureOwner);
}
// 可更新模式。
else if (playMode == EPlayMode.HostPlayMode)
{
// 打开启动UI。
UILoadMgr.Show(UIDefine.UILoadUpdate);
Log.Info("Updatable resource mode detected.");
ChangeState<ProcedureUpdateVersion>(procedureOwner);
}
// 可更新模式。
else if (playMode == EPlayMode.WebPlayMode)
{
Log.Info("WebPlayMode resource mode detected.");
ChangeState<ProcedurePreload>(procedureOwner);
}
else
{
Log.Error("UnKnow resource mode detected Please check???");
}
}
else
{
// 打开启动UI。
UILoadMgr.Show(UIDefine.UILoadUpdate);
Log.Error($"{initializationOperation.Error}");
// 打开启动UI。
UILoadMgr.Show(UIDefine.UILoadUpdate, $"资源初始化失败!");
UILoadTip.ShowMessageBox(
$"资源初始化失败!点击确认重试 \n \n <color=#FF0000>原因{initializationOperation.Error}</color>",
MessageShowType.TwoButton,
LoadStyle.StyleEnum.Style_Retry
, () => { Retry(procedureOwner); }, UnityEngine.Application.Quit);
}
}
private void Retry(ProcedureOwner procedureOwner)
{
// 打开启动UI。
UILoadMgr.Show(UIDefine.UILoadUpdate, $"重新初始化资源中...");
InitPackage(procedureOwner).Forget();
}
/// <summary>
/// 请求更新配置数据。
/// </summary>
private async UniTask<UpdateData> RequestUpdateData()
{
// 打开启动UI。
UILoadMgr.Show(UIDefine.UILoadUpdate);
var checkVersionUrl = SettingsUtils.GetUpdateDataUrl();
if (string.IsNullOrEmpty(checkVersionUrl))
{
Log.Error("LoadMgr.RequestVersion, remote url is empty or null");
return null;
}
Log.Info("RequestUpdateData, proxy:" + checkVersionUrl);
try
{
var updateDataStr = await Utility.Http.Get(checkVersionUrl);
UpdateData updateData = Utility.Json.ToObject<UpdateData>(updateDataStr);
return updateData;
}
catch (Exception e)
{
// 打开启动UI。
UILoadTip.ShowMessageBox("请求配置数据失败!点击确认重试", MessageShowType.TwoButton,
LoadStyle.StyleEnum.Style_Retry
, () => { InitPackage(_procedureOwner).Forget(); }, Application.Quit);
Log.Warning(e);
return null;
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0fc41b358bdc498681a63f72ad8942c8
timeCreated: 1679639147

View File

@@ -0,0 +1,46 @@
using System;
using Cysharp.Threading.Tasks;
using TEngine;
using ProcedureOwner = TEngine.IFsm<TEngine.IProcedureManager>;
namespace GameMain
{
public class ProcedureInitResources : ProcedureBase
{
private bool m_InitResourcesComplete = false;
public override bool UseNativeDialog => true;
protected override void OnEnter(ProcedureOwner procedureOwner)
{
base.OnEnter(procedureOwner);
m_InitResourcesComplete = false;
UILoadMgr.Show(UIDefine.UILoadUpdate,"初始化资源中...");
// 注意:使用单机模式并初始化资源前,需要先构建 AssetBundle 并复制到 StreamingAssets 中,否则会产生 HTTP 404 错误
OnInitResourcesComplete().Forget();
}
protected override void OnUpdate(ProcedureOwner procedureOwner, float elapseSeconds, float realElapseSeconds)
{
base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);
if (!m_InitResourcesComplete)
{
// 初始化资源未完成则继续等待
return;
}
ChangeState<ProcedurePreload>(procedureOwner);
}
private async UniTaskVoid OnInitResourcesComplete()
{
await UniTask.Delay(TimeSpan.FromSeconds(1f));
m_InitResourcesComplete = true;
Log.Info("Init resources complete.");
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 49285f361d08436aab23bdf729c10ea0
timeCreated: 1679635748

View File

@@ -0,0 +1,84 @@
using TEngine;
using YooAsset;
using ProcedureOwner = TEngine.IFsm<TEngine.IProcedureManager>;
namespace GameMain
{
/// <summary>
/// 流程 => 启动器。
/// </summary>
public class ProcedureLaunch : ProcedureBase
{
public override bool UseNativeDialog => true;
protected override void OnEnter(ProcedureOwner procedureOwner)
{
base.OnEnter(procedureOwner);
//热更新UI初始化
UILoadMgr.Initialize();
// 语言配置:设置当前使用的语言,如果不设置,则默认使用操作系统语言
InitLanguageSettings();
// 声音配置:根据用户配置数据,设置即将使用的声音选项
InitSoundSettings();
}
protected override void OnUpdate(ProcedureOwner procedureOwner, float elapseSeconds, float realElapseSeconds)
{
base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);
// 运行一帧即切换到 Splash 展示流程
ChangeState<ProcedureSplash>(procedureOwner);
}
private void InitLanguageSettings()
{
if (GameModule.Resource.PlayMode == EPlayMode.EditorSimulateMode && GameModule.Base.EditorLanguage == Language.Unspecified)
{
// 编辑器资源模式直接使用 Inspector 上设置的语言
return;
}
Language language = GameModule.Localization.Language;
if (GameModule.Setting.HasSetting(Constant.Setting.Language))
{
try
{
string languageString = GameModule.Setting.GetString(Constant.Setting.Language);
language = (Language)System.Enum.Parse(typeof(Language), languageString);
}
catch(System.Exception exception)
{
Log.Error("Init language error, reason {0}",exception.ToString());
}
}
if (language != Language.English
&& language != Language.ChineseSimplified
&& language != Language.ChineseTraditional)
{
// 若是暂不支持的语言,则使用英语
language = Language.English;
GameModule.Setting.SetString(Constant.Setting.Language, language.ToString());
GameModule.Setting.Save();
}
GameModule.Localization.Language = language;
Log.Info("Init language settings complete, current language is '{0}'.", language.ToString());
}
private void InitSoundSettings()
{
GameModule.Audio.MusicEnable = !GameModule.Setting.GetBool(Constant.Setting.MusicMuted, false);
GameModule.Audio.MusicVolume = GameModule.Setting.GetFloat(Constant.Setting.MusicVolume, 1f);
GameModule.Audio.SoundEnable = !GameModule.Setting.GetBool(Constant.Setting.SoundMuted, false);
GameModule.Audio.SoundVolume = GameModule.Setting.GetFloat(Constant.Setting.SoundVolume, 1f);
GameModule.Audio.UISoundEnable = !GameModule.Setting.GetBool(Constant.Setting.UISoundMuted, false);
GameModule.Audio.UISoundVolume = GameModule.Setting.GetFloat(Constant.Setting.UISoundVolume, 1f);
Log.Info("Init sound settings complete.");
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d6c3d65d0c3a2104383e82700116b3d1
timeCreated: 1528026159
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,285 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using HybridCLR;
using UnityEngine;
using TEngine;
using System.Reflection;
using YooAsset;
namespace GameMain
{
/// <summary>
/// 流程加载器 - 代码初始化
/// </summary>
public class ProcedureLoadAssembly : ProcedureBase
{
/// <summary>
/// 是否需要加载热更新DLL
/// </summary>
public bool NeedLoadDll => (int)GameModule.Resource.PlayMode > (int)EPlayMode.EditorSimulateMode;
private bool m_enableAddressable = true;
public override bool UseNativeDialog => true;
private int m_LoadAssetCount;
private int m_LoadMetadataAssetCount;
private int m_FailureAssetCount;
private int m_FailureMetadataAssetCount;
private bool m_LoadAssemblyComplete;
private bool m_LoadMetadataAssemblyComplete;
private bool m_LoadAssemblyWait;
#pragma warning disable CS0414
private bool m_LoadMetadataAssemblyWait;
#pragma warning restore CS0414
private Assembly m_MainLogicAssembly;
private List<Assembly> m_HotfixAssemblys;
private IFsm<IProcedureManager> m_procedureOwner;
protected override void OnEnter(IFsm<IProcedureManager> procedureOwner)
{
base.OnEnter(procedureOwner);
Log.Debug("HyBridCLR ProcedureLoadAssembly OnEnter");
m_procedureOwner = procedureOwner;
m_LoadAssemblyComplete = false;
m_HotfixAssemblys = new List<Assembly>();
//AOT Assembly加载原始metadata
if (SettingsUtils.HybridCLRCustomGlobalSettings.Enable)
{
#if !UNITY_EDITOR
m_LoadMetadataAssemblyComplete = false;
LoadMetadataForAOTAssembly();
#else
m_LoadMetadataAssemblyComplete = true;
#endif
}
else
{
m_LoadMetadataAssemblyComplete = true;
}
if (!NeedLoadDll || GameModule.Resource.PlayMode == EPlayMode.EditorSimulateMode)
{
m_MainLogicAssembly = GetMainLogicAssembly();
}
else
{
if (SettingsUtils.HybridCLRCustomGlobalSettings.Enable)
{
foreach (string hotUpdateDllName in SettingsUtils.HybridCLRCustomGlobalSettings.HotUpdateAssemblies)
{
var assetLocation = hotUpdateDllName;
if (!m_enableAddressable)
{
assetLocation = Utility.Path.GetRegularPath(
Path.Combine(
"Assets",
SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetPath,
$"{hotUpdateDllName}{SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetExtension}"));
}
Log.Debug($"LoadAsset: [ {assetLocation} ]");
m_LoadAssetCount++;
GameModule.Resource.LoadAssetAsync<TextAsset>(assetLocation,LoadAssetSuccess);
}
m_LoadAssemblyWait = true;
}
else
{
m_MainLogicAssembly = GetMainLogicAssembly();
}
}
if (m_LoadAssetCount == 0)
{
m_LoadAssemblyComplete = true;
}
}
protected override void OnUpdate(IFsm<IProcedureManager> procedureOwner, float elapseSeconds, float realElapseSeconds)
{
base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);
if (!m_LoadAssemblyComplete)
{
return;
}
if (!m_LoadMetadataAssemblyComplete)
{
return;
}
AllAssemblyLoadComplete();
}
private void AllAssemblyLoadComplete()
{
ChangeState<ProcedureStartGame>(m_procedureOwner);
#if UNITY_EDITOR
m_MainLogicAssembly = GetMainLogicAssembly();
#endif
if (m_MainLogicAssembly == null)
{
Log.Fatal($"Main logic assembly missing.");
return;
}
var appType = m_MainLogicAssembly.GetType("GameApp");
if (appType == null)
{
Log.Fatal($"Main logic type 'GameMain' missing.");
return;
}
var entryMethod = appType.GetMethod("Entrance");
if (entryMethod == null)
{
Log.Fatal($"Main logic entry method 'Entrance' missing.");
return;
}
object[] objects = new object[] { new object[] { m_HotfixAssemblys } };
entryMethod.Invoke(appType, objects);
}
private Assembly GetMainLogicAssembly()
{
Assembly mainLogicAssembly = null;
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
{
if (string.Compare(SettingsUtils.HybridCLRCustomGlobalSettings.LogicMainDllName, $"{assembly.GetName().Name}.dll",
StringComparison.Ordinal) == 0)
{
mainLogicAssembly = assembly;
}
foreach (var hotUpdateDllName in SettingsUtils.HybridCLRCustomGlobalSettings.HotUpdateAssemblies)
{
if (hotUpdateDllName == $"{assembly.GetName().Name}.dll")
{
m_HotfixAssemblys.Add(assembly);
}
}
if (mainLogicAssembly != null && m_HotfixAssemblys.Count == SettingsUtils.HybridCLRCustomGlobalSettings.HotUpdateAssemblies.Count)
{
break;
}
}
return mainLogicAssembly;
}
/// <summary>
/// 加载代码资源成功回调。
/// </summary>
/// <param name="assetOperationHandle">资源操作句柄。</param>
private void LoadAssetSuccess(AssetOperationHandle assetOperationHandle)
{
m_LoadAssetCount--;
var assetName = assetOperationHandle.AssetObject.name;
Log.Debug($"LoadAssetSuccess, assetName: [ {assetName} ]");
var textAsset = assetOperationHandle.AssetObject as TextAsset;
if (textAsset == null)
{
Log.Warning($"Load text asset [ {assetName} ] failed.");
return;
}
try
{
var assembly = Assembly.Load(textAsset.bytes);
if (string.Compare(SettingsUtils.HybridCLRCustomGlobalSettings.LogicMainDllName, assetName, StringComparison.Ordinal) == 0)
{
m_MainLogicAssembly = assembly;
}
m_HotfixAssemblys.Add(assembly);
Log.Debug($"Assembly [ {assembly.GetName().Name} ] loaded");
}
catch (Exception e)
{
m_FailureAssetCount++;
Log.Fatal(e);
throw;
}
finally
{
m_LoadAssemblyComplete = m_LoadAssemblyWait && 0 == m_LoadAssetCount;
}
assetOperationHandle.Dispose();
}
/// <summary>
/// 为Aot Assembly加载原始metadata 这个代码放Aot或者热更新都行。
/// 一旦加载后如果AOT泛型函数对应native实现不存在则自动替换为解释模式执行。
/// </summary>
public void LoadMetadataForAOTAssembly()
{
// 可以加载任意aot assembly的对应的dll。但要求dll必须与unity build过程中生成的裁剪后的dll一致而不能直接使用原始dll。
// 我们在BuildProcessor_xxx里添加了处理代码这些裁剪后的dll在打包时自动被复制到 {项目目录}/HybridCLRData/AssembliesPostIl2CppStrip/{Target} 目录。
// 注意补充元数据是给AOT dll补充元数据而不是给热更新dll补充元数据。
// 热更新dll不缺元数据不需要补充如果调用LoadMetadataForAOTAssembly会返回错误
if (SettingsUtils.HybridCLRCustomGlobalSettings.AOTMetaAssemblies.Count == 0)
{
m_LoadMetadataAssemblyComplete = true;
return;
}
foreach (string aotDllName in SettingsUtils.HybridCLRCustomGlobalSettings.AOTMetaAssemblies)
{
var assetLocation = aotDllName;
if (!m_enableAddressable)
{
assetLocation = Utility.Path.GetRegularPath(
Path.Combine(
"Assets",
SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetPath,
$"{aotDllName}{SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetExtension}"));
}
Log.Debug($"LoadMetadataAsset: [ {assetLocation} ]");
m_LoadMetadataAssetCount++;
GameModule.Resource.LoadAssetAsync<TextAsset>(assetLocation,LoadMetadataAssetSuccess);
}
m_LoadMetadataAssemblyWait = true;
}
/// <summary>
/// 加载元数据资源成功回调。
/// </summary>
/// <param name="assetOperationHandle">资源操作句柄。</param>
private unsafe void LoadMetadataAssetSuccess(AssetOperationHandle assetOperationHandle)
{
m_LoadMetadataAssetCount--;
string assetName = assetOperationHandle.AssetObject.name;
Log.Debug($"LoadMetadataAssetSuccess, assetName: [ {assetName} ]");
var textAsset = assetOperationHandle.AssetObject as TextAsset;
if (null == textAsset)
{
Log.Debug($"LoadMetadataAssetSuccess:Load text asset [ {assetName} ] failed.");
return;
}
try
{
byte[] dllBytes = textAsset.bytes;
fixed (byte* ptr = dllBytes)
{
// 加载assembly对应的dll会自动为它hook。一旦Aot泛型函数的native函数不存在用解释器版本代码
HomologousImageMode mode = HomologousImageMode.SuperSet;
LoadImageErrorCode err = (LoadImageErrorCode)HybridCLR.RuntimeApi.LoadMetadataForAOTAssembly(dllBytes,mode);
Log.Warning($"LoadMetadataForAOTAssembly:{assetName}. mode:{mode} ret:{err}");
}
}
catch (Exception e)
{
m_FailureMetadataAssetCount++;
Log.Fatal(e.Message);
throw;
}
finally
{
m_LoadMetadataAssemblyComplete = m_LoadMetadataAssemblyWait && 0 == m_LoadMetadataAssetCount;
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 38e1de092fdb401c955859d7d60d1b5a
timeCreated: 1675668724

View File

@@ -0,0 +1,170 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Cysharp.Threading.Tasks;
using TEngine;
using UnityEngine;
using YooAsset;
using ProcedureOwner = TEngine.IFsm<TEngine.IProcedureManager>;
namespace GameMain
{
/// <summary>
/// 预加载流程
/// </summary>
public class ProcedurePreload : ProcedureBase
{
private float _progress = 0f;
private readonly Dictionary<string, bool> _loadedFlag = new Dictionary<string, bool>();
public override bool UseNativeDialog => true;
private readonly bool _needProLoadConfig = true;
private bool _hadInitConfigXml = false;
protected override void OnEnter(ProcedureOwner procedureOwner)
{
base.OnEnter(procedureOwner);
_loadedFlag.Clear();
if (GameModule.Resource.PlayMode == EPlayMode.EditorSimulateMode)
{
_hadInitConfigXml = true;
}
UILoadMgr.Show(UIDefine.UILoadUpdate, Utility.Text.Format(LoadText.Instance.Label_Load_Load_Progress, 0));
GameEvent.Send("UILoadUpdate.RefreshVersion");
PreloadResources().Forget();
}
protected override void OnUpdate(ProcedureOwner procedureOwner, float elapseSeconds, float realElapseSeconds)
{
base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);
var totalCount = _loadedFlag.Count <= 0 ? 1 : _loadedFlag.Count;
var loadCount = _loadedFlag.Count <= 0 ? 1 : 0;
foreach (KeyValuePair<string, bool> loadedFlag in _loadedFlag)
{
if (!loadedFlag.Value)
{
break;
}
else
{
loadCount++;
}
}
if (_loadedFlag.Count != 0)
{
UILoadMgr.Show(UIDefine.UILoadUpdate, Utility.Text.Format(LoadText.Instance.Label_Load_Load_Progress, (float)loadCount / totalCount * 100));
}
else
{
LoadUpdateLogic.Instance.DownProgressAction?.Invoke(_progress);
string progressStr = $"{_progress * 100:f1}";
if (Math.Abs(_progress - 1f) < 0.001f)
{
UILoadMgr.Show(UIDefine.UILoadUpdate, LoadText.Instance.Label_Load_Load_Complete);
}
else
{
UILoadMgr.Show(UIDefine.UILoadUpdate, Utility.Text.Format(LoadText.Instance.Label_Load_Load_Progress, progressStr));
}
}
if (loadCount < totalCount)
{
return;
}
if (_hadInitConfigXml == false)
{
return;
}
ChangeState<ProcedureLoadAssembly>(procedureOwner);
}
public IEnumerator SmoothValue(float value, float duration, Action callback = null)
{
float time = 0f;
while (time < duration)
{
time += GameTime.deltaTime;
var result = Mathf.Lerp(0, value, time / duration);
_progress = result;
yield return new WaitForEndOfFrame();
}
_progress = value;
callback?.Invoke();
}
private async UniTaskVoid PreloadResources()
{
await SmoothValue(1f, 1.2f).ToUniTask(GameModule.Procedure);
await UniTask.Delay(TimeSpan.FromSeconds(2.5f));
if (_needProLoadConfig)
{
LoadAllConfig();
}
else
{
_hadInitConfigXml = true;
}
}
private void LoadAllConfig()
{
if (GameModule.Resource.PlayMode == EPlayMode.EditorSimulateMode)
{
_hadInitConfigXml = true;
return;
}
AssetInfo[] assetInfos = GameModule.Resource.GetAssetInfos("PRELOAD");
foreach (var assetInfo in assetInfos)
{
LoadConfig(assetInfo.Address);
}
#if UNITY_WEBGL
AssetInfo[] webAssetInfos = GameModule.Resource.GetAssetInfos("WEBGL_PRELOAD");
foreach (var assetInfo in webAssetInfos)
{
LoadConfig(assetInfo.Address);
}
#endif
_hadInitConfigXml = true;
}
private void LoadConfig(string configName)
{
_loadedFlag.Add(configName, false);
GameModule.Resource.LoadAssetAsync<TextAsset>(configName, OnLoadSuccess);
}
private void OnLoadSuccess(AssetOperationHandle assetOperationHandle)
{
if (assetOperationHandle == null)
{
return;
}
var location = assetOperationHandle.GetAssetInfo().Address;
_loadedFlag[location] = true;
GameModule.Resource.PushPreLoadAsset(location, assetOperationHandle.AssetObject);
Log.Info("Load config '{0}' OK.", location);
assetOperationHandle.Dispose();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3510902f458c4bd48422c40d10138549
timeCreated: 1665578910

View File

@@ -0,0 +1,27 @@
using UnityEngine;
using ProcedureOwner = TEngine.IFsm<TEngine.IProcedureManager>;
namespace GameMain
{
/// <summary>
/// 流程 => 闪屏。
/// </summary>
public class ProcedureSplash : ProcedureBase
{
public override bool UseNativeDialog => true;
protected override void OnEnter(ProcedureOwner procedureOwner)
{
base.OnEnter(procedureOwner);
}
protected override void OnUpdate(ProcedureOwner procedureOwner, float elapseSeconds, float realElapseSeconds)
{
base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);
// 播放 Splash 动画
//Splash.Active(splashTime:3f);
//初始化资源包
ChangeState<ProcedureInitPackage>(procedureOwner);
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 139ec26f4972a8147a39d4bb34d5fcaa
timeCreated: 1528026159
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,23 @@
using System;
using Cysharp.Threading.Tasks;
using TEngine;
namespace GameMain
{
public class ProcedureStartGame : ProcedureBase
{
public override bool UseNativeDialog { get; }
protected override void OnEnter(IFsm<IProcedureManager> procedureOwner)
{
base.OnEnter(procedureOwner);
StartGame().Forget();
}
private async UniTaskVoid StartGame()
{
await UniTask.Yield();
UILoadMgr.HideAll();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: db61ddc0f5f34d639fae224363a3ac49
timeCreated: 1665628052

View File

@@ -0,0 +1,50 @@
using System;
using Cysharp.Threading.Tasks;
using TEngine;
using YooAsset;
using ProcedureOwner = TEngine.IFsm<TEngine.IProcedureManager>;
namespace GameMain
{
/// <summary>
/// 流程 => 用户尝试更新清单
/// </summary>
public class ProcedureUpdateManifest: ProcedureBase
{
public override bool UseNativeDialog { get; }
protected override void OnEnter(ProcedureOwner procedureOwner)
{
Log.Info("更新资源清单!!!");
UILoadMgr.Show(UIDefine.UILoadUpdate,$"更新清单文件...");
UpdateManifest(procedureOwner).Forget();
}
private async UniTaskVoid UpdateManifest(ProcedureOwner procedureOwner)
{
await UniTask.Delay(TimeSpan.FromSeconds(0.5f));
var operation = GameModule.Resource.UpdatePackageManifestAsync(GameModule.Resource.PackageVersion);
await operation.ToUniTask();
if(operation.Status == EOperationStatus.Succeed)
{
//更新成功
//注意:保存资源版本号作为下次默认启动的版本!
operation.SavePackageVersion();
ChangeState<ProcedureCreateDownloader>(procedureOwner);
}
else
{
Log.Error(operation.Error);
UILoadTip.ShowMessageBox($"用户尝试更新清单失败!点击确认重试 \n \n <color=#FF0000>原因{operation.Error}</color>", MessageShowType.TwoButton,
LoadStyle.StyleEnum.Style_Retry
, () => { ChangeState<ProcedureUpdateManifest>(procedureOwner); }, UnityEngine.Application.Quit);
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3f0ff55ed6ee4711a65cc396946bb43f
timeCreated: 1679634395

View File

@@ -0,0 +1,84 @@
using System;
using Cysharp.Threading.Tasks;
using UnityEngine;
using TEngine;
using YooAsset;
using ProcedureOwner = TEngine.IFsm<TEngine.IProcedureManager>;
namespace GameMain
{
/// <summary>
/// 流程 => 用户尝试更新静态版本
/// </summary>
public class ProcedureUpdateVersion : ProcedureBase
{
public override bool UseNativeDialog => true;
private ProcedureOwner _procedureOwner;
protected override void OnEnter(ProcedureOwner procedureOwner)
{
_procedureOwner = procedureOwner;
base.OnEnter(procedureOwner);
UILoadMgr.Show(UIDefine.UILoadUpdate, $"更新静态版本文件...");
//检查设备是否能够访问互联网
if (Application.internetReachability == NetworkReachability.NotReachable)
{
Log.Warning("The device is not connected to the network");
UILoadMgr.Show(UIDefine.UILoadUpdate, LoadText.Instance.Label_Net_UnReachable);
UILoadTip.ShowMessageBox(LoadText.Instance.Label_Net_UnReachable, MessageShowType.TwoButton,
LoadStyle.StyleEnum.Style_Retry,
GetStaticVersion().Forget,
() => { ChangeState<ProcedureInitResources>(procedureOwner); });
}
UILoadMgr.Show(UIDefine.UILoadUpdate, LoadText.Instance.Label_RequestVersionIng);
// 用户尝试更新静态版本。
GetStaticVersion().Forget();
}
/// <summary>
/// 向用户尝试更新静态版本。
/// </summary>
private async UniTaskVoid GetStaticVersion()
{
await UniTask.Delay(TimeSpan.FromSeconds(0.5f));
var operation = GameModule.Resource.UpdatePackageVersionAsync();
try
{
await operation.ToUniTask();
if (operation.Status == EOperationStatus.Succeed)
{
//线上最新版本operation.PackageVersion
GameModule.Resource.PackageVersion = operation.PackageVersion;
Log.Debug($"Updated package Version : from {GameModule.Resource.GetPackageVersion()} to {operation.PackageVersion}");
ChangeState<ProcedureUpdateManifest>(_procedureOwner);
}
else
{
OnGetStaticVersionError(operation.Error);
}
}
catch (Exception e)
{
OnGetStaticVersionError(e.Message);
}
}
private void OnGetStaticVersionError(string error)
{
Log.Error(error);
UILoadTip.ShowMessageBox($"用户尝试更新静态版本失败!点击确认重试 \n \n <color=#FF0000>原因{error}</color>", MessageShowType.TwoButton,
LoadStyle.StyleEnum.Style_Retry
, () => { ChangeState<ProcedureUpdateVersion>(_procedureOwner); }, UnityEngine.Application.Quit);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6f0ff5df84e44adcb8064f46662a1b10
timeCreated: 1665651883