mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
Compare commits
85 Commits
TEngine3.1
...
TEngine_Fa
Author | SHA1 | Date | |
---|---|---|---|
![]() |
cf4b43c50b | ||
![]() |
13cc62f3f1 | ||
![]() |
95dfac5294 | ||
![]() |
14e95107c9 | ||
![]() |
caf5b2b54e | ||
![]() |
285483034e | ||
![]() |
1cdd8b63b4 | ||
![]() |
4c748df7ac | ||
![]() |
e1229b5a4b | ||
![]() |
b937fb1a37 | ||
![]() |
87ab99b363 | ||
![]() |
e3a47393f4 | ||
![]() |
75725314ad | ||
![]() |
d3ed2b21b9 | ||
![]() |
ec34dfbb16 | ||
![]() |
bd76e3a651 | ||
![]() |
278c8f23be | ||
![]() |
42568db2ab | ||
![]() |
b033c59b00 | ||
![]() |
04a43a3f11 | ||
![]() |
54214cdd0b | ||
![]() |
fa870b6228 | ||
![]() |
8a49d3437b | ||
![]() |
f19b889deb | ||
![]() |
d55f6e29d9 | ||
![]() |
8e4af31f26 | ||
![]() |
58a4b3e043 | ||
![]() |
576bf3bb48 | ||
![]() |
d282b81546 | ||
![]() |
d6dcd8851c | ||
![]() |
bbea9c4cee | ||
![]() |
b1ccb1fd53 | ||
![]() |
0f2ad3c71d | ||
![]() |
0e6851e691 | ||
![]() |
75b9956261 | ||
![]() |
401c397fc8 | ||
![]() |
94b314e91f | ||
![]() |
a6573d9336 | ||
![]() |
abf5357f49 | ||
![]() |
aab353cca3 | ||
![]() |
e13071c4db | ||
![]() |
e071c20214 | ||
![]() |
bf73ce333b | ||
![]() |
d7a60002d4 | ||
![]() |
61f657322d | ||
![]() |
33223dc02e | ||
![]() |
0661c59877 | ||
![]() |
7c74e10857 | ||
![]() |
db935bfb5f | ||
![]() |
dc6b7bb21e | ||
![]() |
d32f3cb768 | ||
![]() |
a32ab30444 | ||
![]() |
aa0d40c758 | ||
![]() |
5239b89326 | ||
![]() |
53f0ecb6c1 | ||
![]() |
ea9447d0ea | ||
![]() |
0c6d59f53e | ||
![]() |
9986e22d18 | ||
![]() |
7deb049769 | ||
![]() |
fce8bd4d60 | ||
![]() |
7ec14c670f | ||
![]() |
efe3d2b25b | ||
![]() |
2107282368 | ||
![]() |
fb26ea2297 | ||
![]() |
9ac150425f | ||
![]() |
36d2c146b0 | ||
![]() |
774b73bbbf | ||
![]() |
32366eb127 | ||
![]() |
a843617e5f | ||
![]() |
46b139f7cf | ||
![]() |
e6ff1dec3f | ||
![]() |
4429732010 | ||
![]() |
60a5caebae | ||
![]() |
f7c95d8216 | ||
![]() |
98dcb80942 | ||
![]() |
30192d52cf | ||
![]() |
b7b2262d53 | ||
![]() |
d1c93f15d6 | ||
![]() |
1ac1ff7d56 | ||
![]() |
863788f303 | ||
![]() |
74790c7486 | ||
![]() |
1c223c8ad0 | ||
![]() |
e75b3a4e66 | ||
![]() |
91b0995911 | ||
![]() |
14c886ea8f |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -130,3 +130,4 @@ Bin/
|
||||
|
||||
#Server_Config
|
||||
DotNet/Config/GameConfig
|
||||
DotNet/Config/ProtoBuf/OpCode.Cache
|
||||
|
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c930bcf75e933064db8511b88e39d216
|
||||
guid: 6a824de3af698c34bb4343dbb911498b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
8
Assets/AssetRaw/Configs/bytes.meta
Normal file
8
Assets/AssetRaw/Configs/bytes.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: afddbfe87a53e9049bf031ee18842f87
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,85 +1,5 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &99681264163055430
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6931044727624756224}
|
||||
- component: {fileID: 3459913616456895755}
|
||||
- component: {fileID: 3314925424923711536}
|
||||
m_Layer: 5
|
||||
m_Name: m_textInfo
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6931044727624756224
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 99681264163055430}
|
||||
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: 205567445133409828}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 1, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 91.35828}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3459913616456895755
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 99681264163055430}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3314925424923711536
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 99681264163055430}
|
||||
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: 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: 20
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 1
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text:
|
||||
--- !u!1 &200028900962926734
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -160,7 +80,7 @@ MonoBehaviour:
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: "\u8F93\u5165\u7528\u6237\u540D"
|
||||
--- !u!1 &867330116831009509
|
||||
--- !u!1 &228610304149681099
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@@ -168,35 +88,89 @@ GameObject:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4167822937073975279}
|
||||
- component: {fileID: 2661482540827288745}
|
||||
- component: {fileID: 8059956825526392220}
|
||||
- component: {fileID: 6750364511045006514}
|
||||
- component: {fileID: 4295640278102793288}
|
||||
m_Layer: 5
|
||||
m_Name: Sliding Area
|
||||
m_Name: Viewport
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &4167822937073975279
|
||||
--- !u!224 &2661482540827288745
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 867330116831009509}
|
||||
m_GameObject: {fileID: 228610304149681099}
|
||||
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: 2822172956986517463}
|
||||
m_Father: {fileID: 6625053874581620453}
|
||||
- {fileID: 5225285352838474515}
|
||||
m_Father: {fileID: 2913277243696531993}
|
||||
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}
|
||||
m_SizeDelta: {x: 0, y: -17}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!222 &8059956825526392220
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 228610304149681099}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &6750364511045006514
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 228610304149681099}
|
||||
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: 10917, 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 &4295640278102793288
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 228610304149681099}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_ShowMaskGraphic: 0
|
||||
--- !u!1 &987942439051806727
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -277,7 +251,7 @@ MonoBehaviour:
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text:
|
||||
--- !u!1 &1128107678303727112
|
||||
--- !u!1 &1354977820134472711
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@@ -285,125 +259,49 @@ GameObject:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6625053874581620453}
|
||||
- component: {fileID: 7920198895917174325}
|
||||
- component: {fileID: 1252844165034735494}
|
||||
- component: {fileID: 7751190632459406769}
|
||||
- component: {fileID: 5910359893906513543}
|
||||
- component: {fileID: 5407814213624276446}
|
||||
m_Layer: 5
|
||||
m_Name: Scrollbar Vertical
|
||||
m_Name: m_itemTemp
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6625053874581620453
|
||||
--- !u!224 &5910359893906513543
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1128107678303727112}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_GameObject: {fileID: 1354977820134472711}
|
||||
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: 4167822937073975279}
|
||||
m_Father: {fileID: 6950316414753065386}
|
||||
m_RootOrder: 1
|
||||
- {fileID: 1620476634722495211}
|
||||
m_Father: {fileID: 5225285352838474515}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 20, y: 0.000015259}
|
||||
m_Pivot: {x: 1, y: 1}
|
||||
--- !u!222 &7920198895917174325
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1128107678303727112}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1252844165034735494
|
||||
m_SizeDelta: {x: 163, y: 300}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!114 &5407814213624276446
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1128107678303727112}
|
||||
m_GameObject: {fileID: 1354977820134472711}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: 29af6e9bda3402e4eba67bb72531e618, 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: 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 &7751190632459406769
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1128107678303727112}
|
||||
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: 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: 1221139505962229183}
|
||||
m_HandleRect: {fileID: 2822172956986517463}
|
||||
m_Direction: 2
|
||||
m_Value: 0
|
||||
m_Size: 1
|
||||
m_NumberOfSteps: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
Padding: 0
|
||||
--- !u!1 &1517610079850641450
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -564,6 +462,133 @@ MonoBehaviour:
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: "\u6CE8\u518C"
|
||||
--- !u!1 &2294538527106005025
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2913277243696531993}
|
||||
- component: {fileID: 7710575040041964180}
|
||||
- component: {fileID: 6581535211515335702}
|
||||
- component: {fileID: 7476014482463418513}
|
||||
- component: {fileID: 2372447356726108403}
|
||||
m_Layer: 5
|
||||
m_Name: m_scrollRect
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2913277243696531993
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2294538527106005025}
|
||||
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: 2661482540827288745}
|
||||
m_Father: {fileID: 2683445927021212027}
|
||||
m_RootOrder: 2
|
||||
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: -185.26123}
|
||||
m_SizeDelta: {x: 0, y: 370.5225}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7710575040041964180
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2294538527106005025}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &6581535211515335702
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2294538527106005025}
|
||||
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.392}
|
||||
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: 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 &7476014482463418513
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2294538527106005025}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1aa08ab6e0800fa44ae55d278d1423e3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Content: {fileID: 5225285352838474515}
|
||||
m_Horizontal: 1
|
||||
m_Vertical: 0
|
||||
m_MovementType: 1
|
||||
m_Elasticity: 0.1
|
||||
m_Inertia: 1
|
||||
m_DecelerationRate: 0.135
|
||||
m_ScrollSensitivity: 1
|
||||
m_Viewport: {fileID: 2661482540827288745}
|
||||
m_HorizontalScrollbar: {fileID: 0}
|
||||
m_VerticalScrollbar: {fileID: 0}
|
||||
m_HorizontalScrollbarVisibility: 2
|
||||
m_VerticalScrollbarVisibility: 2
|
||||
m_HorizontalScrollbarSpacing: -3
|
||||
m_VerticalScrollbarSpacing: -3
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!114 &2372447356726108403
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2294538527106005025}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: dd536d252034dd74b87b436507ec44f7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
itemPrefabDataList: []
|
||||
arrangeType: 2
|
||||
supportScrollBar: 1
|
||||
itemSnapEnable: 0
|
||||
viewPortSnapPivot: {x: 0, y: 0}
|
||||
itemSnapPivot: {x: 0, y: 0}
|
||||
--- !u!1 &2683445925571829816
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -671,9 +696,9 @@ RectTransform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 6950316414753065386}
|
||||
- {fileID: 2734507746760885577}
|
||||
- {fileID: 3818961499522768759}
|
||||
- {fileID: 2913277243696531993}
|
||||
m_Father: {fileID: 2683445925571829817}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -1116,7 +1141,7 @@ RectTransform:
|
||||
m_Children:
|
||||
- {fileID: 1376866687255549051}
|
||||
m_Father: {fileID: 2683445927021212027}
|
||||
m_RootOrder: 1
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
@@ -1262,97 +1287,6 @@ MonoBehaviour:
|
||||
pressedScale: {x: 0.95, y: 0.95, z: 0.95}
|
||||
duration: 0.1
|
||||
needRemoveAllTween: 1
|
||||
--- !u!1 &4316178753519714167
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1891477315646888193}
|
||||
- component: {fileID: 5879102155965158337}
|
||||
- component: {fileID: 8203107606952135234}
|
||||
- component: {fileID: 8213615779585061549}
|
||||
m_Layer: 5
|
||||
m_Name: Viewport
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1891477315646888193
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4316178753519714167}
|
||||
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: 1766356475428725500}
|
||||
m_Father: {fileID: 6950316414753065386}
|
||||
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: 1}
|
||||
--- !u!222 &5879102155965158337
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4316178753519714167}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &8203107606952135234
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4316178753519714167}
|
||||
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: 10917, 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 &8213615779585061549
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4316178753519714167}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_ShowMaskGraphic: 0
|
||||
--- !u!1 &4436822588635160366
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1572,115 +1506,6 @@ MonoBehaviour:
|
||||
pressedScale: {x: 0.95, y: 0.95, z: 0.95}
|
||||
duration: 0.1
|
||||
needRemoveAllTween: 1
|
||||
--- !u!1 &5163362076385105452
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6950316414753065386}
|
||||
- component: {fileID: 693582444088145824}
|
||||
- component: {fileID: 2430355853573420865}
|
||||
- component: {fileID: 4282330504859036445}
|
||||
m_Layer: 5
|
||||
m_Name: m_goScrollView
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6950316414753065386
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5163362076385105452}
|
||||
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: 1891477315646888193}
|
||||
- {fileID: 6625053874581620453}
|
||||
m_Father: {fileID: 2683445927021212027}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 142.37941, y: -246.96753}
|
||||
m_SizeDelta: {x: 284.7588, y: 493.9349}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &693582444088145824
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5163362076385105452}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &2430355853573420865
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5163362076385105452}
|
||||
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.392}
|
||||
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: 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 &4282330504859036445
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5163362076385105452}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1aa08ab6e0800fa44ae55d278d1423e3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Content: {fileID: 1766356475428725500}
|
||||
m_Horizontal: 0
|
||||
m_Vertical: 1
|
||||
m_MovementType: 1
|
||||
m_Elasticity: 0.1
|
||||
m_Inertia: 1
|
||||
m_DecelerationRate: 0.135
|
||||
m_ScrollSensitivity: 1
|
||||
m_Viewport: {fileID: 1891477315646888193}
|
||||
m_HorizontalScrollbar: {fileID: 0}
|
||||
m_VerticalScrollbar: {fileID: 7751190632459406769}
|
||||
m_HorizontalScrollbarVisibility: 2
|
||||
m_VerticalScrollbarVisibility: 2
|
||||
m_HorizontalScrollbarSpacing: -3
|
||||
m_VerticalScrollbarSpacing: -3
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!1 &5314664002961178086
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1714,89 +1539,13 @@ RectTransform:
|
||||
- {fileID: 1106430378647148480}
|
||||
- {fileID: 8401360966016205532}
|
||||
m_Father: {fileID: 2683445927021212027}
|
||||
m_RootOrder: 2
|
||||
m_RootOrder: 1
|
||||
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 &6110186098461980524
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2822172956986517463}
|
||||
- component: {fileID: 1893953740262017174}
|
||||
- component: {fileID: 1221139505962229183}
|
||||
m_Layer: 5
|
||||
m_Name: Handle
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2822172956986517463
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6110186098461980524}
|
||||
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: 4167822937073975279}
|
||||
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 &1893953740262017174
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6110186098461980524}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1221139505962229183
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6110186098461980524}
|
||||
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 &7135572807202764412
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1944,7 +1693,7 @@ MonoBehaviour:
|
||||
m_CaretWidth: 1
|
||||
m_ReadOnly: 0
|
||||
m_ShouldActivateOnSelect: 1
|
||||
--- !u!1 &7277374689422034622
|
||||
--- !u!1 &8297792320047316563
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@@ -1952,9 +1701,83 @@ GameObject:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1766356475428725500}
|
||||
- component: {fileID: 7443401408893521434}
|
||||
- component: {fileID: 695462780974354670}
|
||||
- component: {fileID: 1620476634722495211}
|
||||
- component: {fileID: 3309228999550946613}
|
||||
- component: {fileID: 581887214916487053}
|
||||
m_Layer: 5
|
||||
m_Name: Sp
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1620476634722495211
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8297792320047316563}
|
||||
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: 5910359893906513543}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3309228999550946613
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8297792320047316563}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &581887214916487053
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8297792320047316563}
|
||||
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: 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 &8523066568731304380
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5225285352838474515}
|
||||
m_Layer: 5
|
||||
m_Name: m_tfContent
|
||||
m_TagString: Untagged
|
||||
@@ -1962,104 +1785,27 @@ GameObject:
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1766356475428725500
|
||||
--- !u!224 &5225285352838474515
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7277374689422034622}
|
||||
m_GameObject: {fileID: 8523066568731304380}
|
||||
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: 205567445133409828}
|
||||
m_Father: {fileID: 1891477315646888193}
|
||||
- {fileID: 5910359893906513543}
|
||||
m_Father: {fileID: 2661482540827288745}
|
||||
m_RootOrder: 0
|
||||
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: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 300}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!114 &7443401408893521434
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7277374689422034622}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 1
|
||||
m_Spacing: 0
|
||||
m_ChildForceExpandWidth: 1
|
||||
m_ChildForceExpandHeight: 1
|
||||
m_ChildControlWidth: 1
|
||||
m_ChildControlHeight: 0
|
||||
m_ChildScaleWidth: 0
|
||||
m_ChildScaleHeight: 0
|
||||
m_ReverseArrangement: 0
|
||||
--- !u!114 &695462780974354670
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7277374689422034622}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_HorizontalFit: 0
|
||||
m_VerticalFit: 2
|
||||
--- !u!1 &8738425861440261120
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 205567445133409828}
|
||||
m_Layer: 5
|
||||
m_Name: m_itemNetLog
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &205567445133409828
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8738425861440261120}
|
||||
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: 6931044727624756224}
|
||||
m_Father: {fileID: 1766356475428725500}
|
||||
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: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &8765138137118890297
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@@ -64,6 +64,14 @@ namespace TEngine.Core
|
||||
LoadAssembly(assemblyName, assembly);
|
||||
}
|
||||
|
||||
public static IEnumerable<int> ForEachAssemblyName()
|
||||
{
|
||||
foreach (var (key, _) in AssemblyList)
|
||||
{
|
||||
yield return key;
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<Type> ForEach()
|
||||
{
|
||||
foreach (var (_, assemblyInfo) in AssemblyList)
|
||||
|
@@ -6,5 +6,7 @@ namespace TEngine.Core
|
||||
public const uint ErrNotFoundRoute = 100000003; // 没有找到Route消息
|
||||
public const uint ErrRouteTimeout = 100000004; // 发送Route消息超时
|
||||
public const uint Error_NotFindEntity = 100000008; // 没有找到Entity
|
||||
public const uint Error_CopyTimeout = 100000009; // CopyTimeout不能小于或等于0
|
||||
public const uint Error_Transfer = 100000010;// 传送发生了错误
|
||||
}
|
||||
}
|
@@ -70,6 +70,10 @@ public static class Define
|
||||
/// </summary>
|
||||
public static string ClientCustomExportDirectory;
|
||||
/// <summary>
|
||||
/// SceneConfig.xlsx的位置
|
||||
/// </summary>
|
||||
public static string SceneConfigPath;
|
||||
/// <summary>
|
||||
/// 自定义导出代码存放的程序集
|
||||
/// </summary>
|
||||
public static string CustomExportAssembly;
|
||||
@@ -79,7 +83,8 @@ public static class Define
|
||||
public static readonly HashSet<string> ColTypeSet = new HashSet<string>()
|
||||
{
|
||||
"", "0", "bool", "byte", "short", "ushort", "int", "uint", "long", "ulong", "float", "string", "AttrConfig",
|
||||
"short[]", "int[]", "long[]", "float[]", "string[]"
|
||||
"IntDictionaryConfig", "StringDictionaryConfig",
|
||||
"short[]", "int[]", "long[]", "float[]", "string[]","uint[]"
|
||||
};
|
||||
/// <summary>
|
||||
/// Excel生成代码模板的位置
|
||||
|
@@ -13,6 +13,7 @@ using Newtonsoft.Json;
|
||||
|
||||
// ReSharper disable SuspiciousTypeConversion.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
// ReSharper disable ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
|
||||
|
||||
namespace TEngine
|
||||
{
|
||||
@@ -194,14 +195,14 @@ namespace TEngine
|
||||
|
||||
public static T Create<T>(Scene scene, bool isRunEvent = true) where T : Entity, new()
|
||||
{
|
||||
var entity = Create<T>(scene.RouteId, isRunEvent);
|
||||
var entity = Create<T>(scene.LocationId, isRunEvent);
|
||||
entity.Scene = scene;
|
||||
return entity;
|
||||
}
|
||||
|
||||
public static T Create<T>(Scene scene, long id, bool isRunEvent = true) where T : Entity, new()
|
||||
{
|
||||
var entity = Create<T>(id, scene.RouteId, isRunEvent);
|
||||
var entity = Create<T>(id, scene.LocationId, isRunEvent);
|
||||
entity.Scene = scene;
|
||||
return entity;
|
||||
}
|
||||
@@ -235,12 +236,12 @@ namespace TEngine
|
||||
return entity;
|
||||
}
|
||||
|
||||
private static T Create<T>(long id, uint routeId, bool isRunEvent = true) where T : Entity, new()
|
||||
protected static T Create<T>(long id, uint locationId, bool isRunEvent = true) where T : Entity, new()
|
||||
{
|
||||
return Create<T>(id, IdFactory.NextEntityId(routeId), isRunEvent);
|
||||
return Create<T>(id, IdFactory.NextEntityId(locationId), isRunEvent);
|
||||
}
|
||||
|
||||
private static T Create<T>(long id, long runtimeId, bool isRunEvent = true) where T : Entity, new()
|
||||
protected static T Create<T>(long id, long runtimeId, bool isRunEvent = true) where T : Entity, new()
|
||||
{
|
||||
var entity = Rent<T>(typeof(T));
|
||||
entity.Id = id;
|
||||
@@ -264,13 +265,6 @@ namespace TEngine
|
||||
return entity;
|
||||
}
|
||||
|
||||
protected static Scene CreateScene(long id, bool isRunEvent = true)
|
||||
{
|
||||
var entity = Create<Scene>(id, id, isRunEvent);
|
||||
entity.Scene = entity;
|
||||
return entity;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Members
|
||||
@@ -293,12 +287,12 @@ namespace TEngine
|
||||
[BsonIgnore]
|
||||
[JsonIgnore]
|
||||
[IgnoreDataMember]
|
||||
public Scene Scene { get; private set; }
|
||||
public Scene Scene { get; protected set; }
|
||||
|
||||
[BsonIgnore]
|
||||
[JsonIgnore]
|
||||
[IgnoreDataMember]
|
||||
public Entity Parent { get; private set; }
|
||||
public Entity Parent { get; protected set; }
|
||||
|
||||
[BsonElement("t")]
|
||||
[BsonIgnoreIfNull]
|
||||
@@ -321,7 +315,7 @@ namespace TEngine
|
||||
|
||||
public T AddComponent<T>() where T : Entity, new()
|
||||
{
|
||||
var entity = Create<T>(Id, Scene.RouteId, false);
|
||||
var entity = Create<T>(Id, Scene.LocationId, false);
|
||||
AddComponent(entity);
|
||||
EntitiesSystem.Instance.Awake(entity);
|
||||
EntitiesSystem.Instance.StartUpdate(entity);
|
||||
@@ -330,7 +324,7 @@ namespace TEngine
|
||||
|
||||
public T AddComponent<T>(long id) where T : Entity, new()
|
||||
{
|
||||
var entity = Create<T>(id, Scene.RouteId, false);
|
||||
var entity = Create<T>(id, Scene.LocationId, false);
|
||||
AddComponent(entity);
|
||||
EntitiesSystem.Instance.Awake(entity);
|
||||
EntitiesSystem.Instance.StartUpdate(entity);
|
||||
@@ -409,9 +403,57 @@ namespace TEngine
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetComponent
|
||||
#if TENGINE_NET
|
||||
#region ForEach
|
||||
public IEnumerable<Entity> ForEachSingleCollection
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (var (_, treeEntity) in _tree)
|
||||
{
|
||||
if (treeEntity is not ISupportedSingleCollection)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
yield return treeEntity;
|
||||
}
|
||||
}
|
||||
}
|
||||
public IEnumerable<Entity> ForEachTransfer
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_tree != null)
|
||||
{
|
||||
foreach (var (_, treeEntity) in _tree)
|
||||
{
|
||||
if (treeEntity is ISupportedSingleCollection || treeEntity is ISupportedTransfer)
|
||||
{
|
||||
yield return treeEntity;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_multiDb != null)
|
||||
{
|
||||
foreach (var treeEntity in _multiDb)
|
||||
{
|
||||
if (treeEntity is not ISupportedTransfer)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
yield return treeEntity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#endif
|
||||
|
||||
public DictionaryPool<Type, Entity> GetTree => _tree;
|
||||
#region GetComponent
|
||||
public T GetParent<T>() where T : Entity, new()
|
||||
{
|
||||
return (T)Parent;
|
||||
}
|
||||
|
||||
public T GetComponent<T>() where T : Entity, new()
|
||||
{
|
||||
@@ -538,7 +580,7 @@ namespace TEngine
|
||||
{
|
||||
Scene = scene;
|
||||
#if TENGINE_NET
|
||||
RuntimeId = IdFactory.NextEntityId(scene.RouteId);
|
||||
RuntimeId = IdFactory.NextEntityId(scene.LocationId);
|
||||
#else
|
||||
RuntimeId = IdFactory.NextRunTimeId();
|
||||
#endif
|
||||
|
30
Assets/GameScripts/DotNet/Core/Entitas/EntityReference.cs
Normal file
30
Assets/GameScripts/DotNet/Core/Entitas/EntityReference.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
// ReSharper disable ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
|
||||
namespace TEngine
|
||||
{
|
||||
public readonly struct EntityReference<T> where T : Entity
|
||||
{
|
||||
private readonly T _entity;
|
||||
private readonly long _runTimeId;
|
||||
|
||||
private EntityReference(T t)
|
||||
{
|
||||
_entity = t;
|
||||
_runTimeId = t.RuntimeId;
|
||||
}
|
||||
|
||||
public static implicit operator EntityReference<T>(T t)
|
||||
{
|
||||
return new EntityReference<T>(t);
|
||||
}
|
||||
|
||||
public static implicit operator T(EntityReference<T> v)
|
||||
{
|
||||
if (v._entity == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return v._entity.RuntimeId != v._runTimeId ? null : v._entity;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c827c6f914b64f5d9eb0a1f29cc2c018
|
||||
timeCreated: 1691083017
|
@@ -0,0 +1,8 @@
|
||||
#if TENGINE_NET
|
||||
namespace TEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Entity支持传送。
|
||||
/// </summary>
|
||||
public interface ISupportedTransfer { }
|
||||
#endif
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 06770f37cdfc480fb0c270ea93a10d26
|
||||
timeCreated: 1691083054
|
@@ -9,19 +9,19 @@ using TEngine.Core.DataBase;
|
||||
#pragma warning disable CS8618
|
||||
namespace TEngine
|
||||
{
|
||||
public sealed class Scene : Entity, INotSupportedPool
|
||||
public class Scene : Entity, INotSupportedPool
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public uint RouteId { get; private set; }
|
||||
public uint LocationId { get; private set; }
|
||||
#if TENGINE_UNITY
|
||||
public Session Session { get; private set; }
|
||||
public SceneConfigInfo SceneInfo { get; private set; }
|
||||
#endif
|
||||
#if TENGINE_NET
|
||||
public int SceneType { get; private set; }
|
||||
public int SceneSubType { get; private set; }
|
||||
public World World { get; private set; }
|
||||
public Server Server { get; private set; }
|
||||
public uint SceneConfigId { get; private set; }
|
||||
public SceneConfigInfo SceneInfo => ConfigTableManage.SceneConfig(SceneConfigId);
|
||||
#endif
|
||||
public static readonly List<Scene> Scenes = new List<Scene>();
|
||||
|
||||
@@ -33,11 +33,12 @@ namespace TEngine
|
||||
}
|
||||
|
||||
Name = null;
|
||||
RouteId = 0;
|
||||
this.LocationId = 0;
|
||||
#if TENGINE_NET
|
||||
World = null;
|
||||
Server = null;
|
||||
SceneConfigId = 0;
|
||||
SceneType = 0;
|
||||
SceneSubType = 0;
|
||||
#endif
|
||||
#if TENGINE_UNITY
|
||||
SceneInfo = null;
|
||||
@@ -59,14 +60,27 @@ namespace TEngine
|
||||
}
|
||||
}
|
||||
#if TENGINE_UNITY
|
||||
public static Scene Create()
|
||||
{
|
||||
var sceneId = IdFactory.NextRunTimeId();
|
||||
var scene = Create<Scene>(sceneId, sceneId);
|
||||
scene.Scene = scene;
|
||||
scene.Parent = scene;
|
||||
Scenes.Add(scene);
|
||||
return scene;
|
||||
}
|
||||
|
||||
public static Scene Create(string name)
|
||||
{
|
||||
var runTimeId = IdFactory.NextRunTimeId();
|
||||
var scene = CreateScene(runTimeId);
|
||||
var sceneId = IdFactory.NextRunTimeId();
|
||||
var scene = Create<Scene>(sceneId, sceneId);
|
||||
scene.Scene = scene;
|
||||
scene.Parent = scene;
|
||||
scene.Name = name;
|
||||
Scenes.Add(scene);
|
||||
return scene;
|
||||
}
|
||||
|
||||
public void CreateSession(string remoteAddress, NetworkProtocolType networkProtocolType, Action onConnectComplete, Action onConnectFail,Action onConnectDisconnect, int connectTimeout = 5000)
|
||||
{
|
||||
var address = NetworkHelper.ToIPEndPoint(remoteAddress);
|
||||
@@ -77,96 +91,96 @@ namespace TEngine
|
||||
}
|
||||
#else
|
||||
/// <summary>
|
||||
/// 创建一个Scene
|
||||
/// 创建一个Scene。
|
||||
/// </summary>
|
||||
/// <param name="server"></param>
|
||||
/// <param name="outerBindIp"></param>
|
||||
/// <param name="sceneInfo"></param>
|
||||
/// <param name="runEvent"></param>
|
||||
/// <param name="onSetNetworkComplete"></param>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="sceneType"></param>
|
||||
/// <param name="sceneSubType"></param>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <returns></returns>
|
||||
public static async FTask<Scene> Create(Server server, string outerBindIp, SceneConfigInfo sceneInfo, Action<Session> onSetNetworkComplete = null, bool runEvent = true)
|
||||
public static async FTask<T> Create<T>(Scene scene, int sceneType, int sceneSubType) where T : Scene, new()
|
||||
{
|
||||
var scene = CreateScene(sceneInfo.EntityId);
|
||||
sceneInfo.Scene = scene;
|
||||
scene.Name = sceneInfo.Name;
|
||||
scene.RouteId = sceneInfo.RouteId;
|
||||
scene.Server = server;
|
||||
scene.SceneConfigId = sceneInfo.Id;
|
||||
var newScene = Create<T>(scene);
|
||||
newScene.Scene = newScene;
|
||||
newScene.Parent = scene;
|
||||
newScene.SceneType = sceneType;
|
||||
newScene.SceneSubType = sceneSubType;
|
||||
newScene.Server = scene.Server;
|
||||
newScene.LocationId = scene.Server.Id;
|
||||
|
||||
if (sceneInfo.WorldId != 0)
|
||||
if (scene.World != null)
|
||||
{
|
||||
// 有可能不需要数据库、所以这里默认0的情况下就不创建数据库了
|
||||
scene.World = World.Create(sceneInfo.WorldId);
|
||||
newScene.World = scene.World;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(sceneInfo.NetworkProtocol) && !string.IsNullOrEmpty(outerBindIp) && sceneInfo.OuterPort != 0)
|
||||
if (sceneType > 0)
|
||||
{
|
||||
await EventSystem.Instance.PublishAsync(new OnCreateScene(newScene));
|
||||
}
|
||||
|
||||
Scenes.Add(newScene);
|
||||
return newScene;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建一个Scene。
|
||||
/// </summary>
|
||||
/// <param name="server"></param>
|
||||
/// <param name="sceneType"></param>
|
||||
/// <param name="sceneSubType"></param>
|
||||
/// <param name="sceneId"></param>
|
||||
/// <param name="worldId"></param>
|
||||
/// <param name="networkProtocol"></param>
|
||||
/// <param name="outerBindIp"></param>
|
||||
/// <param name="outerPort"></param>
|
||||
/// <returns></returns>
|
||||
public static async FTask<Scene> Create(Server server, int sceneType = 0, int sceneSubType = 0, long sceneId = 0, uint worldId = 0, string networkProtocol = null, string outerBindIp = null, int outerPort = 0)
|
||||
{
|
||||
if (sceneId == 0)
|
||||
{
|
||||
sceneId = new EntityIdStruct(server.Id, 0, 0);
|
||||
}
|
||||
|
||||
var scene = Create<Scene>(sceneId, sceneId);
|
||||
scene.Scene = scene;
|
||||
scene.Parent = scene;
|
||||
scene.SceneType = sceneType;
|
||||
scene.SceneSubType = sceneSubType;
|
||||
scene.Server = server;
|
||||
scene.LocationId = server.Id;
|
||||
|
||||
if (worldId != 0)
|
||||
{
|
||||
// 有可能不需要数据库、所以这里默认0的情况下就不创建数据库了
|
||||
scene.World = World.Create(worldId);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(networkProtocol) && !string.IsNullOrEmpty(outerBindIp) && outerPort != 0)
|
||||
{
|
||||
// 设置Scene的网络、目前只支持KCP和TCP
|
||||
var networkProtocolType = Enum.Parse<NetworkProtocolType>(sceneInfo.NetworkProtocol);
|
||||
var networkProtocolType = Enum.Parse<NetworkProtocolType>(networkProtocol);
|
||||
var serverNetworkComponent = scene.AddComponent<ServerNetworkComponent>();
|
||||
var address = NetworkHelper.ToIPEndPoint($"{outerBindIp}:{sceneInfo.OuterPort}");
|
||||
var address = NetworkHelper.ToIPEndPoint($"{outerBindIp}:{outerPort}");
|
||||
serverNetworkComponent.Initialize(networkProtocolType, NetworkTarget.Outer, address);
|
||||
}
|
||||
|
||||
if (runEvent && sceneInfo.SceneType != null)
|
||||
if (sceneType > 0)
|
||||
{
|
||||
switch (sceneInfo.SceneType)
|
||||
{
|
||||
case "Addressable":
|
||||
{
|
||||
scene.AddComponent<AddressableManageComponent>();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// 没有SceneType目前只有代码创建的Scene才会这样、目前只有Server的Scene是这样
|
||||
await EventSystem.Instance.PublishAsync(new OnCreateScene(sceneInfo, onSetNetworkComplete));
|
||||
break;
|
||||
}
|
||||
}
|
||||
await EventSystem.Instance.PublishAsync(new OnCreateScene(scene));
|
||||
}
|
||||
|
||||
Scenes.Add(scene);
|
||||
return scene;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 一般用于创建临时Scene、如果不是必要不建议使用这个接口
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="server"></param>
|
||||
/// <param name="entityId"></param>
|
||||
/// <param name="sceneConfigId"></param>
|
||||
/// <param name="networkProtocol"></param>
|
||||
/// <param name="outerBindIp"></param>
|
||||
/// <param name="outerPort"></param>
|
||||
/// <param name="runEvent"></param>
|
||||
/// <param name="onSetNetworkComplete"></param>
|
||||
/// <returns></returns>
|
||||
public static async FTask<Scene> Create(string name, Server server, long entityId, uint sceneConfigId = 0, string networkProtocol = null, string outerBindIp = null, int outerPort = 0, Action<Session> onSetNetworkComplete = null, bool runEvent = true)
|
||||
{
|
||||
var sceneInfo = new SceneConfigInfo()
|
||||
{
|
||||
Name = name,
|
||||
EntityId = entityId,
|
||||
Id = sceneConfigId,
|
||||
NetworkProtocol = networkProtocol,
|
||||
OuterPort = outerPort,
|
||||
WorldId = ((EntityIdStruct)entityId).WordId
|
||||
};
|
||||
|
||||
return await Create(server, outerBindIp, sceneInfo, onSetNetworkComplete, runEvent);
|
||||
}
|
||||
|
||||
public static List<SceneConfigInfo> GetSceneInfoByRouteId(uint routeId)
|
||||
public static List<SceneConfigInfo> GetSceneInfoByServerConfigId(uint serverConfigId)
|
||||
{
|
||||
var list = new List<SceneConfigInfo>();
|
||||
var allSceneConfig = ConfigTableManage.AllSceneConfig();
|
||||
|
||||
foreach (var sceneConfigInfo in allSceneConfig)
|
||||
{
|
||||
if (sceneConfigInfo.RouteId != routeId)
|
||||
if (sceneConfigInfo.ServerConfigId != serverConfigId)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@@ -5,13 +5,11 @@ namespace TEngine
|
||||
{
|
||||
public struct OnCreateScene
|
||||
{
|
||||
public readonly SceneConfigInfo SceneInfo;
|
||||
public readonly Action<Session> OnSetNetworkComplete;
|
||||
public readonly Scene Scene;
|
||||
|
||||
public OnCreateScene(SceneConfigInfo sceneInfo, Action<Session> onSetNetworkComplete)
|
||||
public OnCreateScene(Scene scene)
|
||||
{
|
||||
SceneInfo = sceneInfo;
|
||||
OnSetNetworkComplete = onSetNetworkComplete;
|
||||
Scene = scene;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,89 @@
|
||||
#if TENGINE_NET
|
||||
using System.Text;
|
||||
using TEngine.Core;
|
||||
using TEngine.Helper;
|
||||
|
||||
namespace TEngine.CustomExport;
|
||||
|
||||
public sealed class SceneTypeConfigToEnum : ACustomExport
|
||||
{
|
||||
public override void Run()
|
||||
{
|
||||
var fullPath = FileHelper.GetFullPath("../../../Config/Excel/Server/SceneConfig.xlsx");
|
||||
using var excelPackage = ExcelHelper.LoadExcel(fullPath);
|
||||
var sceneType = new Dictionary<string, string>();
|
||||
var sceneSubType = new Dictionary<string, string>();
|
||||
var sceneTypeConfig = excelPackage.Workbook.Worksheets["SceneTypeConfig"];
|
||||
|
||||
for (var row = 3; row <= sceneTypeConfig.Dimension.Rows; row++)
|
||||
{
|
||||
var sceneTypeId = sceneTypeConfig.GetCellValue(row, 1);
|
||||
var sceneTypeStr = sceneTypeConfig.GetCellValue(row, 2);
|
||||
|
||||
if (string.IsNullOrEmpty(sceneTypeId) || string.IsNullOrEmpty(sceneTypeStr))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
sceneType.Add(sceneTypeId, sceneTypeStr);
|
||||
}
|
||||
|
||||
var sceneSubTypeConfig = excelPackage.Workbook.Worksheets["SceneSubTypeConfig"];
|
||||
|
||||
for (var row = 3; row <= sceneSubTypeConfig.Dimension.Rows; row++)
|
||||
{
|
||||
var sceneSubTypeId = sceneSubTypeConfig.GetCellValue(row, 1);
|
||||
var sceneSubTypeStr = sceneSubTypeConfig.GetCellValue(row, 2);
|
||||
|
||||
if (string.IsNullOrEmpty(sceneSubTypeId) || string.IsNullOrEmpty(sceneSubTypeStr))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
sceneSubType.Add(sceneSubTypeId, sceneSubTypeStr);
|
||||
}
|
||||
|
||||
if (sceneType.Count > 0 || sceneSubType.Count > 0)
|
||||
{
|
||||
Write(CustomExportType.Server, sceneType, sceneSubType);
|
||||
}
|
||||
}
|
||||
|
||||
private void Write(CustomExportType customExportType, Dictionary<string, string> sceneTypes, Dictionary<string, string> sceneSubType)
|
||||
{
|
||||
var strBuilder = new StringBuilder();
|
||||
var dicBuilder = new StringBuilder();
|
||||
|
||||
strBuilder.AppendLine("namespace TEngine\n{");
|
||||
strBuilder.AppendLine("\t// 生成器自动生成,请不要手动编辑。");
|
||||
strBuilder.AppendLine("\tpublic static class SceneType\n\t{");
|
||||
dicBuilder.AppendLine("\n\t\tpublic static readonly Dictionary<string, int> SceneTypeDic = new Dictionary<string, int>()\n\t\t{");
|
||||
|
||||
foreach (var (sceneTypeId, sceneTypeStr) in sceneTypes)
|
||||
{
|
||||
dicBuilder.AppendLine($"\t\t\t{{ \"{sceneTypeStr}\", {sceneTypeId} }},");
|
||||
strBuilder.AppendLine($"\t\tpublic const int {sceneTypeStr} = {sceneTypeId};");
|
||||
}
|
||||
|
||||
dicBuilder.AppendLine("\t\t};");
|
||||
strBuilder.Append(dicBuilder);
|
||||
strBuilder.AppendLine("\t}\n");
|
||||
|
||||
strBuilder.AppendLine("\t// 生成器自动生成,请不要手动编辑。");
|
||||
strBuilder.AppendLine("\tpublic static class SceneSubType\n\t{");
|
||||
|
||||
dicBuilder.Clear();
|
||||
dicBuilder.AppendLine("\n\t\tpublic static readonly Dictionary<string, int> SceneSubTypeDic = new Dictionary<string, int>()\n\t\t{");
|
||||
foreach (var (sceneSubTypeId, sceneSubTypeStr) in sceneSubType)
|
||||
{
|
||||
dicBuilder.AppendLine($"\t\t\t{{ \"{sceneSubTypeStr}\", {sceneSubTypeId} }},");
|
||||
strBuilder.AppendLine($"\t\tpublic const int {sceneSubTypeStr} = {sceneSubTypeId};");
|
||||
}
|
||||
dicBuilder.AppendLine("\t\t};");
|
||||
strBuilder.Append(dicBuilder);
|
||||
strBuilder.AppendLine("\t}\n}");
|
||||
|
||||
Write("SceneType.cs", strBuilder.ToString(), customExportType);
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d254c1aefb624046ab545bd8cebbe57c
|
||||
timeCreated: 1690561569
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2da9efac32374cb1a88c500e7ed43344
|
||||
timeCreated: 1691084274
|
@@ -0,0 +1,32 @@
|
||||
using System.Collections.Generic;
|
||||
using ProtoBuf;
|
||||
|
||||
namespace TEngine.Core
|
||||
{
|
||||
[ProtoContract]
|
||||
public class IntDictionaryConfig
|
||||
{
|
||||
[ProtoMember(1, IsRequired = true)]
|
||||
public Dictionary<int, int> Dic;
|
||||
|
||||
public int this[int key] => GetValue(key);
|
||||
|
||||
public bool TryGetValue(int key, out int value)
|
||||
{
|
||||
value = default;
|
||||
|
||||
if (!Dic.ContainsKey(key))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
value = Dic[key];
|
||||
return true;
|
||||
}
|
||||
|
||||
private int GetValue(int key)
|
||||
{
|
||||
return Dic.TryGetValue(key, out var value) ? value : default;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 34b41344fd6e462bae371207cdf8a5cd
|
||||
timeCreated: 1691084286
|
@@ -0,0 +1,32 @@
|
||||
using System.Collections.Generic;
|
||||
using ProtoBuf;
|
||||
|
||||
namespace TEngine.Core
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed class StringDictionaryConfig
|
||||
{
|
||||
[ProtoMember(1, IsRequired = true)]
|
||||
public Dictionary<int, string> Dic;
|
||||
|
||||
public string this[int key] => GetValue(key);
|
||||
|
||||
public bool TryGetValue(int key, out string value)
|
||||
{
|
||||
value = default;
|
||||
|
||||
if (!Dic.ContainsKey(key))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
value = Dic[key];
|
||||
return true;
|
||||
}
|
||||
|
||||
private string GetValue(int key)
|
||||
{
|
||||
return Dic.TryGetValue(key, out var value) ? value : default;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a26ad73832de4b3e986ddb58426bcced
|
||||
timeCreated: 1691084294
|
@@ -1,12 +1,34 @@
|
||||
#if TENGINE_NET
|
||||
namespace TEngine.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 导出类型枚举,用于标识不同类型的导出操作。
|
||||
/// </summary>
|
||||
public enum ExportType
|
||||
{
|
||||
/// <summary>
|
||||
/// 无导出类型。
|
||||
/// </summary>
|
||||
None = 0,
|
||||
ProtoBuf = 1, // 导出ProtoBuf
|
||||
AllExcelIncrement = 2, // 所有-增量导出Excel
|
||||
AllExcel = 3, // 所有-全量导出Excel
|
||||
Max, // 这个一定放最后
|
||||
/// <summary>
|
||||
/// 导出ProtoBuf类型。
|
||||
/// </summary>
|
||||
ProtoBuf = 1,
|
||||
/// <summary>
|
||||
/// 导出网络协议并重新生成OpCode。
|
||||
/// </summary>
|
||||
ProtoBufAndOpCodeCache = 2,
|
||||
/// <summary>
|
||||
/// 所有数据的增量导出Excel类型。
|
||||
/// </summary>
|
||||
AllExcelIncrement = 3,
|
||||
/// <summary>
|
||||
/// 所有数据的全量导出Excel类型。
|
||||
/// </summary>
|
||||
AllExcel = 4,
|
||||
/// <summary>
|
||||
/// 导出类型枚举的最大值,一定要放在最后。
|
||||
/// </summary>
|
||||
Max,
|
||||
}
|
||||
#endif
|
||||
|
@@ -4,17 +4,12 @@ using System.Reflection;
|
||||
using System.Runtime.Loader;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using TEngine.CustomExport;
|
||||
using TEngine.DataStructure;
|
||||
using TEngine.Core;
|
||||
using Newtonsoft.Json;
|
||||
using OfficeOpenXml;
|
||||
using TEngine.Helper;
|
||||
using static System.String;
|
||||
#pragma warning disable CS8625
|
||||
#pragma warning disable CS8604
|
||||
#pragma warning disable CS8602
|
||||
#pragma warning disable CS8601
|
||||
#pragma warning disable CS8600
|
||||
#pragma warning disable CS8618
|
||||
|
||||
namespace TEngine.Core;
|
||||
|
||||
@@ -29,9 +24,13 @@ public sealed class ExcelExporter
|
||||
private readonly ConcurrentDictionary<string, ExcelTable> _excelTables = new ConcurrentDictionary<string, ExcelTable>();
|
||||
private readonly ConcurrentDictionary<string, ExcelWorksheet> _worksheets = new ConcurrentDictionary<string, ExcelWorksheet>();
|
||||
|
||||
public ExcelExporter(ExportType exportType)
|
||||
static ExcelExporter()
|
||||
{
|
||||
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
||||
}
|
||||
|
||||
public ExcelExporter(ExportType exportType)
|
||||
{
|
||||
var versionFilePath = Define.ExcelVersionFile;
|
||||
|
||||
switch (exportType)
|
||||
@@ -87,6 +86,9 @@ public sealed class ExcelExporter
|
||||
}
|
||||
}
|
||||
|
||||
// 添加生成SceneType的自定义导出
|
||||
task.Add(Task.Run(new SceneTypeConfigToEnum().Run));
|
||||
|
||||
Task.WaitAll(task.ToArray());
|
||||
}
|
||||
|
||||
@@ -226,7 +228,7 @@ public sealed class ExcelExporter
|
||||
{
|
||||
// 列名字第一个字符是#不参与导出
|
||||
|
||||
var colName = GetCellValue(worksheet, 5, col);
|
||||
var colName = worksheet.GetCellValue(5, col);
|
||||
if (colName.StartsWith("#", StringComparison.Ordinal))
|
||||
{
|
||||
continue;
|
||||
@@ -234,14 +236,14 @@ public sealed class ExcelExporter
|
||||
|
||||
// 数值列不参与导出
|
||||
|
||||
var numericalCol = GetCellValue(worksheet, 3, col);
|
||||
var numericalCol = worksheet.GetCellValue(3, col);
|
||||
if (numericalCol != "" && numericalCol != "0")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var serverType = GetCellValue(worksheet, 1, col);
|
||||
var clientType = GetCellValue(worksheet, 2, col);
|
||||
var serverType = worksheet.GetCellValue(1, col);
|
||||
var clientType = worksheet.GetCellValue(2, col);
|
||||
var isExportServer = !IsNullOrEmpty(serverType) && serverType != "0";
|
||||
var isExportClient = !IsNullOrEmpty(clientType) && clientType != "0";
|
||||
|
||||
@@ -350,7 +352,7 @@ public sealed class ExcelExporter
|
||||
|
||||
foreach (var colIndex in cols)
|
||||
{
|
||||
var colName = GetCellValue(excelWorksheet, 5, colIndex);
|
||||
var colName = excelWorksheet.GetCellValue(5, colIndex);
|
||||
|
||||
if (colNameSet.Contains(colName))
|
||||
{
|
||||
@@ -363,19 +365,19 @@ public sealed class ExcelExporter
|
||||
|
||||
if (isServer)
|
||||
{
|
||||
colType = GetCellValue(excelWorksheet, 1, colIndex);
|
||||
colType = excelWorksheet.GetCellValue(1, colIndex);
|
||||
|
||||
if (IsNullOrEmpty(colType) || colType == "0")
|
||||
{
|
||||
colType = GetCellValue(excelWorksheet, 2, colIndex);
|
||||
colType = excelWorksheet.GetCellValue(2, colIndex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
colType = GetCellValue(excelWorksheet, 2, colIndex);
|
||||
colType = excelWorksheet.GetCellValue(2, colIndex);
|
||||
}
|
||||
|
||||
var remarks = GetCellValue(excelWorksheet, 4, colIndex);
|
||||
var remarks = excelWorksheet.GetCellValue(4, colIndex);
|
||||
|
||||
fileBuilder.Append($"\n\t\t[ProtoMember({++index}, IsRequired = true)]\n");
|
||||
fileBuilder.Append(
|
||||
@@ -436,12 +438,12 @@ public sealed class ExcelExporter
|
||||
|
||||
for (var row = 7; row <= rows; row++)
|
||||
{
|
||||
if (GetCellValue(excelWorksheet, row, 1).StartsWith("#", StringComparison.Ordinal))
|
||||
if (excelWorksheet.GetCellValue(row, 1).StartsWith("#", StringComparison.Ordinal))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var id = GetCellValue(excelWorksheet, row, 3);
|
||||
var id = excelWorksheet.GetCellValue(row, 3);
|
||||
|
||||
if (idCheck.Contains(id))
|
||||
{
|
||||
@@ -525,21 +527,21 @@ public sealed class ExcelExporter
|
||||
{
|
||||
string colType;
|
||||
var colIndex = cols[i];
|
||||
var colName = GetCellValue(excelWorksheet, 5, colIndex);
|
||||
var value = GetCellValue(excelWorksheet, row, colIndex);
|
||||
var colName = excelWorksheet.GetCellValue(5, colIndex);
|
||||
var value = excelWorksheet.GetCellValue(row, colIndex);
|
||||
|
||||
if (isServer)
|
||||
{
|
||||
colType = GetCellValue(excelWorksheet, 1, colIndex);
|
||||
colType = excelWorksheet.GetCellValue(1, colIndex);
|
||||
|
||||
if (IsNullOrEmpty(colType) || colType == "0")
|
||||
{
|
||||
colType = GetCellValue(excelWorksheet, 2, colIndex);
|
||||
colType = excelWorksheet.GetCellValue(2, colIndex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
colType = GetCellValue(excelWorksheet, 2, colIndex);
|
||||
colType = excelWorksheet.GetCellValue(2, colIndex);
|
||||
}
|
||||
|
||||
try
|
||||
@@ -574,7 +576,7 @@ public sealed class ExcelExporter
|
||||
return worksheet;
|
||||
}
|
||||
|
||||
worksheet = new ExcelPackage(name).Workbook.Worksheets[0];
|
||||
worksheet = ExcelHelper.LoadExcel(name).Workbook.Worksheets[0];
|
||||
|
||||
if (isAddToDic)
|
||||
{
|
||||
@@ -585,26 +587,6 @@ public sealed class ExcelExporter
|
||||
return worksheet;
|
||||
}
|
||||
|
||||
private string GetCellValue(ExcelWorksheet sheet, int row, int column)
|
||||
{
|
||||
var cell = sheet.Cells[row, column];
|
||||
|
||||
try
|
||||
{
|
||||
if (cell.Value == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
var s = cell.GetValue<string>();
|
||||
return s.Trim();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new Exception($"Rows {row} Columns {column} Content {cell.Text} {e}");
|
||||
}
|
||||
}
|
||||
|
||||
private void SetNewValue(PropertyInfo propertyInfo, AProto config, string type, string value)
|
||||
{
|
||||
if (IsNullOrWhiteSpace(value))
|
||||
@@ -753,20 +735,34 @@ public sealed class ExcelExporter
|
||||
|
||||
return;
|
||||
}
|
||||
// case "AttrConfig":
|
||||
// {
|
||||
// if (value.Trim() == "" || value.Trim() == "{}")
|
||||
// {
|
||||
// propertyInfo.SetValue(config, null);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// var attr = new AttrConfig {KV = JsonConvert.DeserializeObject<Dictionary<int, int>>(value)};
|
||||
//
|
||||
// propertyInfo.SetValue(config, attr);
|
||||
//
|
||||
// return;
|
||||
// }
|
||||
case "IntDictionaryConfig":
|
||||
{
|
||||
if (value.Trim() == "" || value.Trim() == "{}")
|
||||
{
|
||||
propertyInfo.SetValue(config, null);
|
||||
return;
|
||||
}
|
||||
|
||||
var attr = new IntDictionaryConfig {Dic = JsonConvert.DeserializeObject<Dictionary<int, int>>(value)};
|
||||
|
||||
propertyInfo.SetValue(config, attr);
|
||||
|
||||
return;
|
||||
}
|
||||
case "StringDictionaryConfig":
|
||||
{
|
||||
if (value.Trim() == "" || value.Trim() == "{}")
|
||||
{
|
||||
propertyInfo.SetValue(config, null);
|
||||
return;
|
||||
}
|
||||
|
||||
var attr = new StringDictionaryConfig {Dic = JsonConvert.DeserializeObject<Dictionary<int, string>>(value)};
|
||||
|
||||
propertyInfo.SetValue(config, attr);
|
||||
|
||||
return;
|
||||
}
|
||||
default:
|
||||
throw new NotSupportedException($"不支持此类型: {type}");
|
||||
}
|
||||
|
@@ -33,8 +33,6 @@ namespace TEngine.Core
|
||||
{
|
||||
var configFile = GetConfigPath(dataConfig);
|
||||
var bytes = File.ReadAllBytes(configFile);
|
||||
// var data = (AProto) ProtoBufHelper.FromBytes(typeof(T), bytes, 0, bytes.Length);
|
||||
// var data = ProtoBufHelper.FromBytes<T>(bytes, 0, bytes.Length);
|
||||
var data = (T)ProtoBufHelper.FromBytes(typeof(T), bytes, 0, bytes.Length);
|
||||
data.AfterDeserialization();
|
||||
ConfigDic[dataConfig] = data;
|
||||
|
@@ -3,16 +3,21 @@ using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Loader;
|
||||
using System.Text;
|
||||
using TEngine.Core;
|
||||
using TEngine.Helper;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
#pragma warning disable CS8601
|
||||
|
||||
#pragma warning disable CS8618
|
||||
|
||||
namespace TEngine.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 数据导出器,用于执行导出操作。
|
||||
/// </summary>
|
||||
public sealed class Exporter
|
||||
{
|
||||
/// <summary>
|
||||
/// 开始执行数据导出操作。
|
||||
/// </summary>
|
||||
public void Start()
|
||||
{
|
||||
Console.OutputEncoding = Encoding.UTF8;
|
||||
@@ -25,8 +30,9 @@ public sealed class Exporter
|
||||
|
||||
LogInfo("请输入你想要做的操作:");
|
||||
LogInfo("1:导出网络协议(ProtoBuf)");
|
||||
LogInfo("2:增量导出Excel(包含常量枚举)");
|
||||
LogInfo("3:全量导出Excel(包含常量枚举)");
|
||||
LogInfo("2:导出网络协议并重新生成OpCode(ProtoBuf)");
|
||||
LogInfo("3:增量导出Excel(包含常量枚举)");
|
||||
LogInfo("4:全量导出Excel(包含常量枚举)");
|
||||
|
||||
var keyChar = Console.ReadKey().KeyChar;
|
||||
|
||||
@@ -39,13 +45,17 @@ public sealed class Exporter
|
||||
|
||||
LogInfo("");
|
||||
exportType = (ExportType) key;
|
||||
// LoadConfig();
|
||||
|
||||
switch (exportType)
|
||||
{
|
||||
case ExportType.ProtoBuf:
|
||||
{
|
||||
_ = new ProtoBufExporter();
|
||||
_ = new ProtoBufExporter(false);
|
||||
break;
|
||||
}
|
||||
case ExportType.ProtoBufAndOpCodeCache:
|
||||
{
|
||||
_ = new ProtoBufExporter(true);
|
||||
break;
|
||||
}
|
||||
case ExportType.AllExcel:
|
||||
@@ -61,58 +71,19 @@ public sealed class Exporter
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
#if old
|
||||
// private void LoadConfig()
|
||||
// {
|
||||
// const string settingsName = "TEngineSettings.json";
|
||||
// var currentDirectory = Directory.GetCurrentDirectory();
|
||||
//
|
||||
// if (!File.Exists(Path.Combine(currentDirectory, settingsName)))
|
||||
// {
|
||||
// throw new FileNotFoundException($"not found {settingsName} in OutputDirectory");
|
||||
// }
|
||||
//
|
||||
// var configurationRoot = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory())
|
||||
// .AddJsonFile(settingsName)
|
||||
// .Build();
|
||||
// // ProtoBuf文件所在的位置文件夹位置
|
||||
// ProtoBufDefine.ProtoBufDirectory = configurationRoot["Export:ProtoBufDirectory:Value"];
|
||||
// // ProtoBuf生成到服务端的文件夹位置
|
||||
// ProtoBufDefine.ServerDirectory = configurationRoot["Export:ProtoBufServerDirectory:Value"];
|
||||
// // ProtoBuf生成到客户端的文件夹位置
|
||||
// ProtoBufDefine.ClientDirectory = configurationRoot["Export:ProtoBufClientDirectory:Value"];
|
||||
// // ProtoBuf生成代码模板的位置
|
||||
// ProtoBufDefine.ProtoBufTemplatePath = configurationRoot["Export:ProtoBufTemplatePath:Value"];
|
||||
// // Excel配置文件根目录
|
||||
// ExcelDefine.ProgramPath = configurationRoot["Export:ExcelProgramPath:Value"];
|
||||
// // Excel版本文件的位置
|
||||
// ExcelDefine.ExcelVersionFile = configurationRoot["Export:ExcelVersionFile:Value"];
|
||||
// // Excel生成服务器代码的文件夹位置
|
||||
// ExcelDefine.ServerFileDirectory = configurationRoot["Export:ExcelServerFileDirectory:Value"];
|
||||
// // Excel生成客户端代码文件夹位置
|
||||
// ExcelDefine.ClientFileDirectory = configurationRoot["Export:ExcelClientFileDirectory:Value"];
|
||||
// // Excel生成服务器二进制数据文件夹位置
|
||||
// ExcelDefine.ServerBinaryDirectory = configurationRoot["Export:ExcelServerBinaryDirectory:Value"];
|
||||
// // Excel生成客户端二进制数据文件夹位置
|
||||
// ExcelDefine.ClientBinaryDirectory = configurationRoot["Export:ExcelClientBinaryDirectory:Value"];
|
||||
// // Excel生成服务器Json数据文件夹位置
|
||||
// ExcelDefine.ServerJsonDirectory = configurationRoot["Export:ExcelServerJsonDirectory:Value"];
|
||||
// // Excel生成客户端Json数据文件夹位置
|
||||
// ExcelDefine.ClientJsonDirectory = configurationRoot["Export:ExcelClientJsonDirectory:Value"];
|
||||
// // Excel生成代码模板的位置
|
||||
// ExcelDefine.ExcelTemplatePath = configurationRoot["Export:ExcelTemplatePath:Value"];
|
||||
// // 服务器自定义导出代码文件夹位置
|
||||
// ExcelDefine.ServerCustomExportDirectory = configurationRoot["Export:ServerCustomExportDirectory:Value"];
|
||||
// // 客户端自定义导出代码文件夹位置
|
||||
// ExcelDefine.ClientCustomExportDirectory = configurationRoot["Export:ClientCustomExportDirectory:Value"];
|
||||
// }
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// 输出信息到控制台。
|
||||
/// </summary>
|
||||
/// <param name="msg">要输出的信息。</param>
|
||||
public static void LogInfo(string msg)
|
||||
{
|
||||
Console.WriteLine(msg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 输出错误信息到控制台。
|
||||
/// </summary>
|
||||
/// <param name="msg">要输出的错误信息。</param>
|
||||
public static void LogError(string msg)
|
||||
{
|
||||
ConsoleColor color = Console.ForegroundColor;
|
||||
@@ -121,6 +92,10 @@ public sealed class Exporter
|
||||
Console.ForegroundColor = color;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 输出异常信息到控制台。
|
||||
/// </summary>
|
||||
/// <param name="e">要输出的异常。</param>
|
||||
public static void LogError(Exception e)
|
||||
{
|
||||
ConsoleColor color = Console.ForegroundColor;
|
||||
|
@@ -0,0 +1,60 @@
|
||||
#if TENGINE_NET
|
||||
using TEngine.Helper;
|
||||
|
||||
namespace TEngine.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 网络协议操作码缓存。
|
||||
/// </summary>
|
||||
public class OpCodeCache
|
||||
{
|
||||
private readonly List<uint> _opCodes = new List<uint>();
|
||||
private readonly SortedDictionary<string, uint> _opcodeCache;
|
||||
private readonly SortedDictionary<string, uint> _saveOpCodeCache = new();
|
||||
private readonly string _opcodeCachePath = $"{Define.ProtoBufDirectory}OpCode.Cache";
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数,用于初始化网络协议操作码缓存。
|
||||
/// </summary>
|
||||
public OpCodeCache(bool regenerate)
|
||||
{
|
||||
if (File.Exists(_opcodeCachePath) && !regenerate)
|
||||
{
|
||||
var readAllText = File.ReadAllText(_opcodeCachePath);
|
||||
_opcodeCache = readAllText.Deserialize<SortedDictionary<string, uint>>();
|
||||
_opCodes.AddRange(_opcodeCache.Values);
|
||||
}
|
||||
else
|
||||
{
|
||||
_opcodeCache = new SortedDictionary<string, uint>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存网络协议操作码。
|
||||
/// </summary>
|
||||
public void Save()
|
||||
{
|
||||
File.WriteAllText(_opcodeCachePath, _saveOpCodeCache.ToJson());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据className获得OpCode、如果是新增的会产生一个新的OpCode。
|
||||
/// </summary>
|
||||
/// <param name="className">协议名。</param>
|
||||
/// <param name="opcode">操作码。</param>
|
||||
/// <returns></returns>
|
||||
public uint GetOpcodeCache(string className, ref uint opcode)
|
||||
{
|
||||
if (!_opcodeCache.TryGetValue(className, out var opCode))
|
||||
{
|
||||
while (_opCodes.Contains(++opcode)) { }
|
||||
opCode = opcode;
|
||||
_opCodes.Add(opCode);
|
||||
}
|
||||
|
||||
_saveOpCodeCache.Add(className, opCode);
|
||||
return opCode;
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e0f0d02da06c4ca981417bfe43162809
|
||||
timeCreated: 1693928511
|
@@ -1,27 +1,52 @@
|
||||
#if TENGINE_NET
|
||||
using System.Text;
|
||||
using TEngine.Core.Network;
|
||||
#pragma warning disable CS8604
|
||||
#pragma warning disable CS8602
|
||||
#pragma warning disable CS8600
|
||||
#pragma warning disable CS8618
|
||||
using TEngine.Helper;
|
||||
|
||||
namespace TEngine.Core;
|
||||
|
||||
/// <summary>
|
||||
/// ProtoBuf操作码类型枚举
|
||||
/// </summary>
|
||||
public enum ProtoBufOpCodeType
|
||||
{
|
||||
/// <summary>
|
||||
/// 无
|
||||
/// </summary>
|
||||
None = 0,
|
||||
/// <summary>
|
||||
/// 外部操作码类型
|
||||
/// </summary>
|
||||
Outer = 1,
|
||||
/// <summary>
|
||||
/// 内部操作码类型
|
||||
/// </summary>
|
||||
Inner = 2,
|
||||
/// <summary>
|
||||
/// 使用BSON的内部操作码类型
|
||||
/// </summary>
|
||||
InnerBson = 3,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 操作码信息类
|
||||
/// </summary>
|
||||
public sealed class OpcodeInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 操作码
|
||||
/// </summary>
|
||||
public uint Code;
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ProtoBuf导出器类
|
||||
/// </summary>
|
||||
public sealed class ProtoBufExporter
|
||||
{
|
||||
private uint _aMessage;
|
||||
@@ -32,10 +57,13 @@ public sealed class ProtoBufExporter
|
||||
private uint _aRouteResponse;
|
||||
private string _serverTemplate;
|
||||
private string _clientTemplate;
|
||||
|
||||
private readonly OpCodeCache _opCodeCache;
|
||||
private readonly List<OpcodeInfo> _opcodes = new();
|
||||
|
||||
public ProtoBufExporter()
|
||||
/// <summary>
|
||||
/// 构造函数,用于初始化导出器
|
||||
/// </summary>
|
||||
public ProtoBufExporter(bool regenerateOpCodeCache)
|
||||
{
|
||||
Console.OutputEncoding = Encoding.UTF8;
|
||||
|
||||
@@ -49,6 +77,23 @@ public sealed class ProtoBufExporter
|
||||
Directory.CreateDirectory(Define.ProtoBufClientDirectory);
|
||||
}
|
||||
|
||||
if (!Directory.Exists($"{Define.ProtoBufDirectory}Outer"))
|
||||
{
|
||||
Directory.CreateDirectory($"{Define.ProtoBufDirectory}Outer");
|
||||
}
|
||||
|
||||
if (!Directory.Exists($"{Define.ProtoBufDirectory}Inner"))
|
||||
{
|
||||
Directory.CreateDirectory($"{Define.ProtoBufDirectory}Inner");
|
||||
}
|
||||
|
||||
if (!Directory.Exists($"{Define.ProtoBufDirectory}InnerBosn"))
|
||||
{
|
||||
Directory.CreateDirectory($"{Define.ProtoBufDirectory}InnerBosn");
|
||||
}
|
||||
|
||||
_opCodeCache = new OpCodeCache(regenerateOpCodeCache);
|
||||
|
||||
var tasks = new Task[2];
|
||||
tasks[0] = Task.Run(RouteType);
|
||||
tasks[1] = Task.Run(async () =>
|
||||
@@ -59,18 +104,14 @@ public sealed class ProtoBufExporter
|
||||
await Start(ProtoBufOpCodeType.InnerBson);
|
||||
});
|
||||
Task.WaitAll(tasks);
|
||||
_opCodeCache.Save();
|
||||
}
|
||||
|
||||
private async Task Start(ProtoBufOpCodeType opCodeType)
|
||||
{
|
||||
var protoFile = "";
|
||||
List<string> files = new List<string>();
|
||||
var opCodeName = "";
|
||||
var parameter = "";
|
||||
var className = "";
|
||||
var isMsgHead = false;
|
||||
OpcodeInfo opcodeInfo = null;
|
||||
string responseTypeStr = null;
|
||||
string customRouteType = null;
|
||||
_opcodes.Clear();
|
||||
var file = new StringBuilder();
|
||||
var saveDirectory = new Dictionary<string, string>();
|
||||
@@ -86,9 +127,11 @@ public sealed class ProtoBufExporter
|
||||
_aRouteRequest = Opcode.OuterRouteRequest;
|
||||
_aRouteResponse = Opcode.OuterRouteResponse;
|
||||
opCodeName = "OuterOpcode";
|
||||
protoFile = $"{Define.ProtoBufDirectory}OuterMessage.proto";
|
||||
saveDirectory.Add(Define.ProtoBufServerDirectory, _serverTemplate);
|
||||
saveDirectory.Add(Define.ProtoBufClientDirectory, _clientTemplate);
|
||||
var protoBufFiles = FileHelper.GetDirectoryFile(
|
||||
$"{Define.ProtoBufDirectory}Outer", "*.proto", SearchOption.AllDirectories);
|
||||
files.AddRange(protoBufFiles);
|
||||
break;
|
||||
}
|
||||
case ProtoBufOpCodeType.Inner:
|
||||
@@ -101,8 +144,9 @@ public sealed class ProtoBufExporter
|
||||
_aRouteRequest = Opcode.InnerRouteRequest + 1000;
|
||||
_aRouteResponse = Opcode.InnerRouteResponse + 1000;
|
||||
opCodeName = "InnerOpcode";
|
||||
protoFile = $"{Define.ProtoBufDirectory}InnerMessage.proto";
|
||||
saveDirectory.Add(Define.ProtoBufServerDirectory, _serverTemplate);
|
||||
var protoBufFiles = FileHelper.GetDirectoryFile($"{Define.ProtoBufDirectory}Inner", "*.proto", SearchOption.AllDirectories);
|
||||
files.AddRange(protoBufFiles);
|
||||
break;
|
||||
}
|
||||
case ProtoBufOpCodeType.InnerBson:
|
||||
@@ -115,16 +159,28 @@ public sealed class ProtoBufExporter
|
||||
_aRouteRequest = Opcode.InnerBsonRouteRequest + 1000;
|
||||
_aRouteResponse = Opcode.InnerBsonRouteResponse + 1000;
|
||||
opCodeName = "InnerBsonOpcode";
|
||||
protoFile = $"{Define.ProtoBufDirectory}InnerBsonMessage.proto";
|
||||
saveDirectory.Add(Define.ProtoBufServerDirectory, _serverTemplate);
|
||||
var protoBufFiles = FileHelper.GetDirectoryFile($"{Define.ProtoBufDirectory}InnerBosn", "*.proto", SearchOption.AllDirectories);
|
||||
files.AddRange(protoBufFiles);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var protoFileText = await File.ReadAllTextAsync(protoFile);
|
||||
#region GenerateProtoFiles
|
||||
foreach (var filePath in files)
|
||||
{
|
||||
var parameter = "";
|
||||
var className = "";
|
||||
var isMsgHead = false;
|
||||
string responseTypeStr = null;
|
||||
string customRouteType = null;
|
||||
|
||||
var protoFileText = await File.ReadAllTextAsync(filePath);
|
||||
|
||||
foreach (var line in protoFileText.Split('\n'))
|
||||
{
|
||||
bool hadOpCode = true;
|
||||
|
||||
var currentLine = line.Trim();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(currentLine))
|
||||
@@ -154,17 +210,20 @@ public sealed class ProtoBufExporter
|
||||
switch (parameterArray.Length)
|
||||
{
|
||||
case 2:
|
||||
responseTypeStr = parameterArray[1].Trim();
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
if (parameter == "ICustomRouteMessage")
|
||||
{
|
||||
customRouteType = parameterArray[1].Trim();
|
||||
|
||||
if (parameterArray.Length == 3)
|
||||
{
|
||||
responseTypeStr = parameterArray[2].Trim();
|
||||
break;
|
||||
}
|
||||
|
||||
responseTypeStr = parameterArray[1].Trim();
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
responseTypeStr = parameterArray[1].Trim();
|
||||
customRouteType = parameterArray[2].Trim();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -192,9 +251,13 @@ public sealed class ProtoBufExporter
|
||||
{
|
||||
file.AppendLine("\n\t{");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(parameter) || parameter == "IMessage")
|
||||
if (string.IsNullOrWhiteSpace(parameter))
|
||||
{
|
||||
opcodeInfo.Code += ++_aMessage;
|
||||
hadOpCode = false;
|
||||
}
|
||||
else if(parameter == "IMessage")
|
||||
{
|
||||
opcodeInfo.Code = _opCodeCache.GetOpcodeCache(className, ref _aMessage);
|
||||
file.AppendLine($"\t\tpublic uint OpCode() {{ return {opCodeName}.{className}; }}");
|
||||
}
|
||||
else
|
||||
@@ -238,13 +301,13 @@ public sealed class ProtoBufExporter
|
||||
case "IRequest":
|
||||
case "IBsonRequest":
|
||||
{
|
||||
opcodeInfo.Code += ++_aRequest;
|
||||
opcodeInfo.Code = _opCodeCache.GetOpcodeCache(className, ref _aRequest);
|
||||
break;
|
||||
}
|
||||
case "IResponse":
|
||||
case "IBsonResponse":
|
||||
{
|
||||
opcodeInfo.Code += ++_aResponse;
|
||||
opcodeInfo.Code = _opCodeCache.GetOpcodeCache(className, ref _aResponse);
|
||||
file.AppendLine("\t\t[ProtoMember(91, IsRequired = true)]");
|
||||
file.AppendLine("\t\tpublic uint ErrorCode { get; set; }");
|
||||
break;
|
||||
@@ -253,15 +316,15 @@ public sealed class ProtoBufExporter
|
||||
{
|
||||
if (parameter.EndsWith("RouteMessage") || parameter == "IRouteMessage")
|
||||
{
|
||||
opcodeInfo.Code += ++_aRouteMessage;
|
||||
opcodeInfo.Code = _opCodeCache.GetOpcodeCache(className, ref _aRouteMessage);
|
||||
}
|
||||
else if (parameter.EndsWith("RouteRequest") || parameter == "IRouteRequest")
|
||||
{
|
||||
opcodeInfo.Code += ++_aRouteRequest;
|
||||
opcodeInfo.Code = _opCodeCache.GetOpcodeCache(className, ref _aRouteRequest);
|
||||
}
|
||||
else if (parameter.EndsWith("RouteResponse") || parameter == "IRouteResponse")
|
||||
{
|
||||
opcodeInfo.Code += ++_aRouteResponse;
|
||||
opcodeInfo.Code = _opCodeCache.GetOpcodeCache(className, ref _aRouteResponse);
|
||||
file.AppendLine("\t\t[ProtoMember(91, IsRequired = true)]");
|
||||
file.AppendLine("\t\tpublic uint ErrorCode { get; set; }");
|
||||
}
|
||||
@@ -271,7 +334,10 @@ public sealed class ProtoBufExporter
|
||||
}
|
||||
}
|
||||
|
||||
if (hadOpCode)
|
||||
{
|
||||
_opcodes.Add(opcodeInfo);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
case "}":
|
||||
@@ -302,7 +368,7 @@ public sealed class ProtoBufExporter
|
||||
}
|
||||
}
|
||||
|
||||
var csName = $"{Path.GetFileNameWithoutExtension(protoFile)}.cs";
|
||||
var csName = $"{Path.GetFileNameWithoutExtension(filePath)}.cs";
|
||||
|
||||
foreach (var (directory, template) in saveDirectory)
|
||||
{
|
||||
@@ -312,7 +378,11 @@ public sealed class ProtoBufExporter
|
||||
}
|
||||
|
||||
file.Clear();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GenerateOpCode
|
||||
file.Clear();
|
||||
file.AppendLine("namespace TEngine");
|
||||
file.AppendLine("{");
|
||||
file.AppendLine($"\tpublic static partial class {opCodeName}");
|
||||
@@ -333,6 +403,7 @@ public sealed class ProtoBufExporter
|
||||
var csFile = Path.Combine(directory, $"{opCodeName}.cs");
|
||||
await File.WriteAllTextAsync(csFile, file.ToString());
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
private async Task RouteType()
|
||||
@@ -424,7 +495,9 @@ public sealed class ProtoBufExporter
|
||||
"int32[]" => "int[] { }",
|
||||
"int64[]" => "long[] { }",
|
||||
"int32" => "int",
|
||||
"uint32" => "uint",
|
||||
"int64" => "long",
|
||||
"uint64" => "ulong",
|
||||
_ => type
|
||||
};
|
||||
}
|
||||
@@ -449,6 +522,9 @@ public sealed class ProtoBufExporter
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载模板
|
||||
/// </summary>
|
||||
private void LoadTemplate()
|
||||
{
|
||||
string[] lines = File.ReadAllLines(Define.ProtoBufTemplatePath, Encoding.UTF8);
|
||||
|
34
Assets/GameScripts/DotNet/Core/Helper/ExcelHelper.cs
Normal file
34
Assets/GameScripts/DotNet/Core/Helper/ExcelHelper.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
#if TENGINE_NET
|
||||
using OfficeOpenXml;
|
||||
|
||||
namespace TEngine.Helper;
|
||||
|
||||
public static class ExcelHelper
|
||||
{
|
||||
public static ExcelPackage LoadExcel(string name)
|
||||
{
|
||||
return new ExcelPackage(name);
|
||||
}
|
||||
|
||||
public static string GetCellValue(this ExcelWorksheet sheet, int row, int column)
|
||||
{
|
||||
ExcelRange cell = sheet.Cells[row, column];
|
||||
|
||||
try
|
||||
{
|
||||
if (cell.Value == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
string s = cell.GetValue<string>();
|
||||
|
||||
return s.Trim();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new Exception($"Rows {row} Columns {column} Content {cell.Text} {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2ea3356f30cb40949949691a0e258a05
|
||||
timeCreated: 1690561972
|
@@ -1,16 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace TEngine.Core
|
||||
namespace TEngine
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件操作助手类,提供了各种文件操作方法。
|
||||
/// </summary>
|
||||
public static class FileHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 拷贝文件到目标路径、如果目标目录不存在会自动创建目录
|
||||
/// 获取相对路径的完整路径。
|
||||
/// </summary>
|
||||
/// <param name="sourceFile"></param>
|
||||
/// <param name="destinationFile"></param>
|
||||
/// <param name="overwrite"></param>
|
||||
/// <param name="relativePath">相对路径。</param>
|
||||
/// <returns>完整路径。</returns>
|
||||
public static string GetFullPath(string relativePath)
|
||||
{
|
||||
return Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), relativePath));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将文件复制到目标路径,如果目标目录不存在会自动创建目录。
|
||||
/// </summary>
|
||||
/// <param name="sourceFile">源文件路径。</param>
|
||||
/// <param name="destinationFile">目标文件路径。</param>
|
||||
/// <param name="overwrite">是否覆盖已存在的目标文件。</param>
|
||||
public static void Copy(string sourceFile, string destinationFile, bool overwrite)
|
||||
{
|
||||
var directoriesByFilePath = GetDirectoriesByFilePath(destinationFile);
|
||||
@@ -29,10 +42,10 @@ namespace TEngine.Core
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取文件路径内的所有文件夹路径
|
||||
/// 获取文件路径内的所有文件夹路径。
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="filePath">文件路径。</param>
|
||||
/// <returns>文件夹路径列表。</returns>
|
||||
public static List<string> GetDirectoriesByFilePath(string filePath)
|
||||
{
|
||||
var dir = "";
|
||||
@@ -49,11 +62,11 @@ namespace TEngine.Core
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 把文件夹里所有内容拷贝的目标位置
|
||||
/// 将文件夹内的所有内容复制到目标位置。
|
||||
/// </summary>
|
||||
/// <param name="sourceDirectory"></param>
|
||||
/// <param name="destinationDirectory"></param>
|
||||
/// <param name="overwrite"></param>
|
||||
/// <param name="sourceDirectory">源文件夹路径。</param>
|
||||
/// <param name="destinationDirectory">目标文件夹路径。</param>
|
||||
/// <param name="overwrite">是否覆盖已存在的文件。</param>
|
||||
public static void CopyDirectory(string sourceDirectory, string destinationDirectory, bool overwrite)
|
||||
{
|
||||
// 创建目标文件夹
|
||||
@@ -91,9 +104,21 @@ namespace TEngine.Core
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清除文件夹里的所有文件
|
||||
/// 获取目录下的所有文件
|
||||
/// </summary>
|
||||
/// <param name="folderPath"></param>
|
||||
/// <param name="folderPath">文件夹路径。</param>
|
||||
/// <param name="searchPattern">需要查找的文件通配符</param>
|
||||
/// <param name="searchOption">查找的类型</param>
|
||||
/// <returns></returns>
|
||||
public static string[] GetDirectoryFile(string folderPath, string searchPattern, SearchOption searchOption)
|
||||
{
|
||||
return Directory.GetFiles(folderPath, searchPattern, searchOption);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空文件夹内的所有文件。
|
||||
/// </summary>
|
||||
/// <param name="folderPath">文件夹路径。</param>
|
||||
public static void ClearDirectoryFile(string folderPath)
|
||||
{
|
||||
if (!Directory.Exists(folderPath))
|
||||
|
@@ -179,9 +179,8 @@ public sealed class MongoHelper : Singleton<MongoHelper>
|
||||
|
||||
public void SerializeTo<T>(T t, MemoryStream stream)
|
||||
{
|
||||
var bytes = t.ToBson();
|
||||
|
||||
stream.Write(bytes, 0, bytes.Length);
|
||||
using var writer = new BsonBinaryWriter(stream, BsonBinaryWriterSettings.Defaults);
|
||||
BsonSerializer.Serialize(writer, typeof(T), t);
|
||||
}
|
||||
|
||||
public T Clone<T>(T t)
|
||||
|
191
Assets/GameScripts/DotNet/Core/Helper/StringHelper.cs
Normal file
191
Assets/GameScripts/DotNet/Core/Helper/StringHelper.cs
Normal file
@@ -0,0 +1,191 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace TEngine
|
||||
{
|
||||
public static class StringHelper
|
||||
{
|
||||
public static IEnumerable<byte> ToBytes(this string str)
|
||||
{
|
||||
byte[] byteArray = Encoding.Default.GetBytes(str);
|
||||
return byteArray;
|
||||
}
|
||||
|
||||
public static byte[] ToByteArray(this string str)
|
||||
{
|
||||
byte[] byteArray = Encoding.Default.GetBytes(str);
|
||||
return byteArray;
|
||||
}
|
||||
|
||||
public static byte[] ToUtf8(this string str)
|
||||
{
|
||||
byte[] byteArray = Encoding.UTF8.GetBytes(str);
|
||||
return byteArray;
|
||||
}
|
||||
|
||||
public static byte[] HexToBytes(this string hexString)
|
||||
{
|
||||
if (hexString.Length % 2 != 0)
|
||||
{
|
||||
throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, "The binary key cannot have an odd number of digits: {0}",
|
||||
hexString));
|
||||
}
|
||||
|
||||
var hexAsBytes = new byte[hexString.Length / 2];
|
||||
for (int index = 0; index < hexAsBytes.Length; index++)
|
||||
{
|
||||
string byteValue = "";
|
||||
byteValue += hexString[index * 2];
|
||||
byteValue += hexString[index * 2 + 1];
|
||||
hexAsBytes[index] = byte.Parse(byteValue, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
return hexAsBytes;
|
||||
}
|
||||
|
||||
public static string Fmt(this string text, params object[] args)
|
||||
{
|
||||
return string.Format(text, args);
|
||||
}
|
||||
|
||||
public static string ListToString<T>(this List<T> list)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (T t in list)
|
||||
{
|
||||
sb.Append(t);
|
||||
sb.Append(",");
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static string ArrayToString<T>(this T[] args)
|
||||
{
|
||||
if (args == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
string argStr = " [";
|
||||
for (int arrIndex = 0; arrIndex < args.Length; arrIndex++)
|
||||
{
|
||||
argStr += args[arrIndex];
|
||||
if (arrIndex != args.Length - 1)
|
||||
{
|
||||
argStr += ", ";
|
||||
}
|
||||
}
|
||||
|
||||
argStr += "]";
|
||||
return argStr;
|
||||
}
|
||||
|
||||
public static string ArrayToString<T>(this T[] args, int index, int count)
|
||||
{
|
||||
if (args == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
string argStr = " [";
|
||||
for (int arrIndex = index; arrIndex < count + index; arrIndex++)
|
||||
{
|
||||
argStr += args[arrIndex];
|
||||
if (arrIndex != args.Length - 1)
|
||||
{
|
||||
argStr += ", ";
|
||||
}
|
||||
}
|
||||
|
||||
argStr += "]";
|
||||
return argStr;
|
||||
}
|
||||
|
||||
public static string PrintProto(this AProto proto, int stackIndex = 0, string propertyInfoName = "", bool isList = false, int listIndex = 0)
|
||||
{
|
||||
if (proto == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
StringBuilder _stringBuilder = new StringBuilder();
|
||||
_stringBuilder.Clear();
|
||||
|
||||
Type type = proto.GetType();
|
||||
_stringBuilder.Append($"\n");
|
||||
for (int i = 0; i < stackIndex; i++)
|
||||
{
|
||||
_stringBuilder.Append("\t");
|
||||
}
|
||||
|
||||
propertyInfoName = isList ? $"[{propertyInfoName}][{listIndex}]" : $"[{propertyInfoName}]";
|
||||
_stringBuilder.Append(stackIndex == 0? $"[{type.Name}]" : propertyInfoName);
|
||||
|
||||
var bindingFlags = BindingFlags.Public | BindingFlags.Instance;
|
||||
var propertyInfos = type.GetProperties(bindingFlags);
|
||||
for (var i = 0; i < propertyInfos.Length; ++i)
|
||||
{
|
||||
var propertyInfo = propertyInfos[i];
|
||||
|
||||
if (propertyInfo.PropertyType.BaseType == typeof (AProto))
|
||||
{
|
||||
_stringBuilder.Append(PrintProto((AProto)propertyInfo.GetValue(proto), stackIndex + 1, propertyInfo.Name));
|
||||
}
|
||||
else if (propertyInfo.PropertyType.IsList() && propertyInfo.PropertyType.IsGenericType)
|
||||
{
|
||||
object value = propertyInfo.GetValue(proto, null);
|
||||
if (value != null)
|
||||
{
|
||||
Type objType = value.GetType();
|
||||
int count = Convert.ToInt32(objType.GetProperty("Count").GetValue(value, null));
|
||||
for (int j = 0; j < count; j++)
|
||||
{
|
||||
object item = objType.GetProperty("Item").GetValue(value, new object[] { j });
|
||||
_stringBuilder.Append(PrintProto((AProto)item, stackIndex + 1, propertyInfo.Name, isList: true, listIndex: j));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_stringBuilder.Append($"\n");
|
||||
for (int j = 0; j < stackIndex + 1; j++)
|
||||
{
|
||||
_stringBuilder.Append("\t");
|
||||
}
|
||||
|
||||
_stringBuilder.Append($"[{propertyInfo.Name}]");
|
||||
_stringBuilder.Append(": ");
|
||||
_stringBuilder.Append(propertyInfo.GetValue(proto));
|
||||
}
|
||||
}
|
||||
|
||||
return _stringBuilder.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断类型是否为可操作的列表类型
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsList(this Type type)
|
||||
{
|
||||
if (typeof (System.Collections.IList).IsAssignableFrom(type))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach (var it in type.GetInterfaces())
|
||||
{
|
||||
if (it.IsGenericType && typeof (IList<>) == it.GetGenericTypeDefinition())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 989d4686a599e7047bba6f0cbb1bb5e7
|
||||
guid: c253fa0108e29234f9198e6b720bdbf7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
@@ -14,26 +14,26 @@ namespace TEngine.Core
|
||||
|
||||
public uint Time{ get; private set; }
|
||||
public uint Sequence{ get; private set; }
|
||||
public uint RouteId { get; private set; }
|
||||
public uint LocationId { get; private set; }
|
||||
|
||||
public ushort AppId => (ushort)(RouteId >> 10 & RouteIdStruct.MaskAppId);
|
||||
public ushort WordId=> (ushort)(RouteId & RouteIdStruct.MaskWordId);
|
||||
public ushort AppId => (ushort)(this.LocationId >> 10 & RouteIdStruct.MaskAppId);
|
||||
public ushort WordId=> (ushort)(this.LocationId & RouteIdStruct.MaskWordId);
|
||||
|
||||
public const int MaskRouteId = 0x3FFFF;
|
||||
public const int MaskSequence = 0xFFFF;
|
||||
|
||||
public EntityIdStruct(uint routeId, uint time, uint sequence)
|
||||
public EntityIdStruct(uint locationId, uint time, uint sequence)
|
||||
{
|
||||
Time = time;
|
||||
Sequence = sequence;
|
||||
RouteId = routeId;
|
||||
LocationId = locationId;
|
||||
}
|
||||
|
||||
public static implicit operator long(EntityIdStruct entityIdStruct)
|
||||
{
|
||||
ulong result = 0;
|
||||
result |= entityIdStruct.Sequence;
|
||||
result |= (ulong)entityIdStruct.RouteId << 16;
|
||||
result |= (ulong)entityIdStruct.LocationId << 16;
|
||||
result |= (ulong)entityIdStruct.Time << 34;
|
||||
return (long)result;
|
||||
}
|
||||
@@ -46,7 +46,7 @@ namespace TEngine.Core
|
||||
Sequence = (uint) (result & MaskSequence)
|
||||
};
|
||||
result >>= 16;
|
||||
idStruct.RouteId = (uint) (result & 0x3FFFF);
|
||||
idStruct.LocationId = (uint) (result & 0x3FFFF);
|
||||
result >>= 18;
|
||||
idStruct.Time = (uint) result;
|
||||
return idStruct;
|
||||
|
@@ -32,7 +32,7 @@ namespace TEngine.Core
|
||||
return new RuntimeIdStruct(_lastRunTimeIdTime, _lastRunTimeIdSequence);
|
||||
}
|
||||
|
||||
public static long NextEntityId(uint routeId)
|
||||
public static long NextEntityId(uint locationId)
|
||||
{
|
||||
var time = (uint)((TimeHelper.Now - Epoch2023) / 1000);
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace TEngine.Core
|
||||
_lastEntityIdSequence = 0;
|
||||
}
|
||||
|
||||
return new EntityIdStruct(routeId, _lastEntityIdTime, _lastEntityIdSequence);
|
||||
return new EntityIdStruct(locationId, _lastEntityIdTime, _lastEntityIdSequence);
|
||||
}
|
||||
|
||||
public static uint GetRouteId(long entityId)
|
||||
|
@@ -51,7 +51,7 @@ public class SessionIdleCheckerComponent: Entity
|
||||
return;
|
||||
}
|
||||
|
||||
Log.Warning($"session timeout id:{Id}");
|
||||
Log.Warning($"session timeout id:{Id} timeNow:{timeNow} _session.LastReceiveTime:{_session.LastReceiveTime} _timeOut:{_timeOut}");
|
||||
_session.Dispose();
|
||||
}
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ namespace TEngine.Core.Network
|
||||
{
|
||||
None = 0,
|
||||
KCP = 1,
|
||||
TCP = 2
|
||||
TCP = 2,
|
||||
WebSocket = 3,
|
||||
}
|
||||
}
|
@@ -2,7 +2,9 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
#if !UNITY_WEBGL
|
||||
using System.Net.Sockets;
|
||||
#endif
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
@@ -49,6 +51,7 @@ namespace TEngine.Core
|
||||
return $"{self.Address}:{self.Port}";
|
||||
}
|
||||
|
||||
#if !UNITY_WEBGL
|
||||
public static void SetSioUdpConnReset(Socket socket)
|
||||
{
|
||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
@@ -70,5 +73,6 @@ namespace TEngine.Core
|
||||
|
||||
socket.IOControl(SIO_UDP_CONNRESET, new[] {Convert.ToByte(false)}, null);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
@@ -2,16 +2,16 @@ namespace TEngine
|
||||
{
|
||||
public class SceneConfigInfo
|
||||
{
|
||||
public Scene Scene;
|
||||
public long EntityId;
|
||||
|
||||
public uint Id;
|
||||
public string SceneType;
|
||||
public string Name;
|
||||
public string NetworkProtocol;
|
||||
public uint RouteId;
|
||||
public long EntityId;
|
||||
public int SceneType;
|
||||
public int SceneSubType;
|
||||
public string SceneTypeStr;
|
||||
public string SceneSubTypeStr;
|
||||
public uint ServerConfigId;
|
||||
public uint WorldId;
|
||||
public int OuterPort;
|
||||
public string NetworkProtocol;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -103,13 +103,13 @@ namespace TEngine
|
||||
|
||||
private static readonly Dictionary<uint, Server> Servers = new Dictionary<uint, Server>();
|
||||
|
||||
public static async FTask Create(uint routeId)
|
||||
public static async FTask Create(uint serverConfigId)
|
||||
{
|
||||
var serverConfigInfo = ConfigTableManage.ServerConfig(routeId);
|
||||
var serverConfigInfo = ConfigTableManage.ServerConfig(serverConfigId);
|
||||
|
||||
if (serverConfigInfo == null)
|
||||
{
|
||||
Log.Error($"not found server by Id:{routeId}");
|
||||
Log.Error($"not found server by Id:{serverConfigId}");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -121,14 +121,14 @@ namespace TEngine
|
||||
return;
|
||||
}
|
||||
|
||||
var sceneInfos = Scene.GetSceneInfoByRouteId(routeId);
|
||||
await Create(routeId, machineConfigInfo.InnerBindIP, serverConfigInfo.InnerPort, machineConfigInfo.OuterBindIP, sceneInfos);
|
||||
// Log.Info($"ServerId:{routeId} is start complete");
|
||||
var sceneInfos = Scene.GetSceneInfoByServerConfigId(serverConfigId);
|
||||
await Create(serverConfigId, machineConfigInfo.InnerBindIP, serverConfigInfo.InnerPort, machineConfigInfo.OuterBindIP, sceneInfos);
|
||||
// Log.Info($"ServerId:{serverConfigId} is start complete");
|
||||
}
|
||||
|
||||
public static async FTask<Server> Create(uint routeId, string innerBindIp, int innerPort, string outerBindIp, List<SceneConfigInfo> sceneInfos)
|
||||
public static async FTask<Server> Create(uint serverConfigId, string innerBindIp, int innerPort, string outerBindIp, List<SceneConfigInfo> sceneInfos)
|
||||
{
|
||||
if (Servers.TryGetValue(routeId, out var server))
|
||||
if (Servers.TryGetValue(serverConfigId, out var server))
|
||||
{
|
||||
return server;
|
||||
}
|
||||
@@ -137,10 +137,10 @@ namespace TEngine
|
||||
|
||||
server = new Server
|
||||
{
|
||||
Id = routeId
|
||||
Id = serverConfigId
|
||||
};
|
||||
|
||||
server.Scene = await Scene.Create($"ServerScene{routeId}", server, new EntityIdStruct(routeId, 0, 0));
|
||||
server.Scene = await Scene.Create(server);
|
||||
|
||||
// 创建网络、Server下的网络只能是内部网络、外部网络是在Scene中定义
|
||||
|
||||
@@ -155,16 +155,17 @@ namespace TEngine
|
||||
|
||||
foreach (var sceneConfig in sceneInfos)
|
||||
{
|
||||
await Scene.Create(server, outerBindIp, sceneConfig);
|
||||
await Scene.Create(server, sceneConfig.SceneType, sceneConfig.SceneSubType, sceneConfig.EntityId,
|
||||
sceneConfig.WorldId, sceneConfig.NetworkProtocol, outerBindIp, sceneConfig.OuterPort);
|
||||
}
|
||||
|
||||
Servers.Add(routeId, server);
|
||||
Servers.Add(serverConfigId, server);
|
||||
return server;
|
||||
}
|
||||
|
||||
public static Server Get(uint routeId)
|
||||
public static Server Get(uint serverConfigId)
|
||||
{
|
||||
return Servers.TryGetValue(routeId, out var server) ? server : null;
|
||||
return Servers.TryGetValue(serverConfigId, out var server) ? server : null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@@ -1,3 +1,4 @@
|
||||
#if !UNITY_WEBGL
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace TEngine.Core.Network
|
||||
@@ -49,3 +50,4 @@ namespace TEngine.Core.Network
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -14,6 +14,7 @@ namespace TEngine.Core.Network
|
||||
{
|
||||
switch (networkProtocolType)
|
||||
{
|
||||
#if !UNITY_WEBGL
|
||||
case NetworkProtocolType.KCP:
|
||||
{
|
||||
Network = new KCPClientNetwork(Scene, networkTarget);
|
||||
@@ -24,6 +25,7 @@ namespace TEngine.Core.Network
|
||||
Network = new TCPClientNetwork(Scene, networkTarget);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
throw new NotSupportedException($"Unsupported NetworkProtocolType:{networkProtocolType}");
|
||||
|
@@ -13,6 +13,7 @@ namespace TEngine.Core.Network
|
||||
{
|
||||
switch (networkProtocolType)
|
||||
{
|
||||
#if !UNITY_WEBGL
|
||||
case NetworkProtocolType.KCP:
|
||||
{
|
||||
Network = new KCPServerNetwork(Scene, networkTarget, address);
|
||||
@@ -25,6 +26,7 @@ namespace TEngine.Core.Network
|
||||
// Log.Info($"NetworkProtocol:TCP IPEndPoint:{address}");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
throw new NotSupportedException($"Unsupported NetworkProtocolType:{networkProtocolType}");
|
||||
|
@@ -12,22 +12,21 @@ namespace TEngine.Core.Network
|
||||
|
||||
foreach (var sceneConfigInfo in sceneConfigInfos)
|
||||
{
|
||||
if (sceneConfigInfo.SceneType == "Addressable")
|
||||
if (sceneConfigInfo.SceneTypeStr == "Addressable")
|
||||
{
|
||||
AddressableScenes.Add(sceneConfigInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static async FTask AddAddressable(Scene scene, long addressableId, long routeId)
|
||||
public static async FTask AddAddressable(Scene scene, long addressableId, long routeId, bool isLock = true)
|
||||
{
|
||||
var addressableScene = AddressableScenes[(int)addressableId % AddressableScenes.Count];
|
||||
var response = await MessageHelper.CallInnerRoute(scene, addressableScene.EntityId,
|
||||
new I_AddressableAdd_Request
|
||||
{
|
||||
AddressableId = addressableId, RouteId = routeId
|
||||
AddressableId = addressableId, RouteId = routeId, IsLock = isLock
|
||||
});
|
||||
|
||||
if (response.ErrorCode != 0)
|
||||
{
|
||||
Log.Error($"AddAddressable error is {response.ErrorCode}");
|
||||
|
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TEngine.Core.Network
|
||||
@@ -8,13 +9,28 @@ namespace TEngine.Core.Network
|
||||
private readonly Dictionary<long, WaitCoroutineLock> _locks = new();
|
||||
private readonly CoroutineLockQueueType _addressableLock = new CoroutineLockQueueType("AddressableLock");
|
||||
|
||||
public async FTask Add(long addressableId, long routeId)
|
||||
public async FTask Add(long addressableId, long routeId, bool isLock)
|
||||
{
|
||||
using (await _addressableLock.Lock(addressableId))
|
||||
WaitCoroutineLock waitCoroutineLock = null;
|
||||
|
||||
try
|
||||
{
|
||||
if (isLock)
|
||||
{
|
||||
waitCoroutineLock = await _addressableLock.Lock(addressableId);
|
||||
}
|
||||
|
||||
_addressable[addressableId] = routeId;
|
||||
Log.Debug($"AddressableManageComponent Add addressableId:{addressableId} routeId:{routeId}");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
waitCoroutineLock?.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public async FTask<long> Get(long addressableId)
|
||||
@@ -31,6 +47,7 @@ namespace TEngine.Core.Network
|
||||
using (await _addressableLock.Lock(addressableId))
|
||||
{
|
||||
_addressable.Remove(addressableId);
|
||||
Log.Debug($"Addressable Remove addressableId: {addressableId} _addressable:{_addressable.Count}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@ namespace TEngine.Core.Network
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
public FTask Register()
|
||||
public FTask Register(bool isLock = true)
|
||||
{
|
||||
if (Parent == null)
|
||||
{
|
||||
@@ -36,7 +36,7 @@ namespace TEngine.Core.Network
|
||||
#if TENGINE_DEVELOP
|
||||
Log.Debug($"AddressableMessageComponent Register addressableId:{AddressableId} RouteId:{Parent.RuntimeId}");
|
||||
#endif
|
||||
return AddressableHelper.AddAddressable(Scene, AddressableId, Parent.RuntimeId);
|
||||
return AddressableHelper.AddAddressable(Scene, AddressableId, Parent.RuntimeId, isLock);
|
||||
}
|
||||
|
||||
public FTask Lock()
|
||||
|
@@ -5,7 +5,7 @@ public sealed class I_AddressableAddHandler : RouteRPC<Scene, I_AddressableAdd_R
|
||||
{
|
||||
protected override async FTask Run(Scene scene, I_AddressableAdd_Request request, I_AddressableAdd_Response response, Action reply)
|
||||
{
|
||||
await scene.GetComponent<AddressableManageComponent>().Add(request.AddressableId, request.RouteId);
|
||||
await scene.GetComponent<AddressableManageComponent>().Add(request.AddressableId, request.RouteId, request.IsLock);
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -41,7 +41,7 @@ namespace TEngine.Core.Network
|
||||
scene = entity.Scene;
|
||||
}
|
||||
|
||||
Log.Error($"SceneWorld:{session.Scene.World.Id} SceneRouteId:{scene.RouteId} SceneType:{scene.SceneInfo.SceneType} EntityId {tEntity.Id} : Error {e}");
|
||||
Log.Error($"SceneWorld:{session.Scene.World.Id} ServerConfigId:{scene.Server?.Id} SceneType:{scene.SceneType} EntityId {tEntity.Id} : Error {e}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace TEngine.Core.Network
|
||||
scene = entity.Scene;
|
||||
}
|
||||
|
||||
Log.Error($"SceneWorld:{session.Scene.World.Id} SceneRouteId:{scene.RouteId} SceneType:{scene.SceneInfo.SceneType} EntityId {tEntity.Id} : Error {e}");
|
||||
Log.Error($"SceneWorld:{session.Scene.World?.Id} ServerConfigId:{scene.Server?.Id} SceneType:{scene.SceneType} EntityId {tEntity.Id} : Error {e}");
|
||||
response.ErrorCode = CoreErrorCode.ErrRpcFail;
|
||||
}
|
||||
finally
|
||||
@@ -144,7 +144,7 @@ namespace TEngine.Core.Network
|
||||
scene = entity.Scene;
|
||||
}
|
||||
|
||||
Log.Error($"SceneWorld:{session.Scene.World?.Id} SceneRouteId:{scene.RouteId} SceneType:{scene.SceneInfo.SceneType} EntityId {tEntity.Id} : Error {e}");
|
||||
Log.Error($"SceneWorld:{session.Scene.World.Id} ServerConfigId:{scene.Server?.Id} SceneType:{scene.SceneType} EntityId {tEntity.Id} : Error {e}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -207,7 +207,7 @@ namespace TEngine.Core.Network
|
||||
scene = entity.Scene;
|
||||
}
|
||||
|
||||
Log.Error($"SceneWorld:{session.Scene.World.Id} SceneRouteId:{scene.RouteId} SceneType:{scene.SceneInfo.SceneType} EntityId {tEntity.Id} : Error {e}");
|
||||
Log.Error($"SceneWorld:{session.Scene.World?.Id} ServerConfigId:{scene.Server?.Id} SceneType:{scene.SceneType} EntityId {tEntity.Id} : Error {e}");
|
||||
response.ErrorCode = CoreErrorCode.ErrRpcFail;
|
||||
}
|
||||
finally
|
||||
|
@@ -78,7 +78,7 @@ namespace TEngine.Core.Network
|
||||
{
|
||||
if (DisposePackInfo)
|
||||
{
|
||||
packInfo.Dispose();
|
||||
NetworkThread.Instance.SynchronizationContext.Post(packInfo.Dispose);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ public static class MessageHelper
|
||||
}
|
||||
|
||||
EntityIdStruct entityIdStruct = entityId;
|
||||
var session = scene.Server.GetSession(entityIdStruct.RouteId);
|
||||
var session = scene.Server.GetSession(entityIdStruct.LocationId);
|
||||
session.Send(message, 0, entityId);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public static class MessageHelper
|
||||
}
|
||||
|
||||
EntityIdStruct entityIdStruct = entityId;
|
||||
var session = scene.Server.GetSession(entityIdStruct.RouteId);
|
||||
var session = scene.Server.GetSession(entityIdStruct.LocationId);
|
||||
session.Send(message, 0, routeTypeOpCode, entityId);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public static class MessageHelper
|
||||
|
||||
EntityIdStruct entityIdStruct = entityId;
|
||||
var rpcId = ++_rpcId;
|
||||
var session = scene.Server.GetSession(entityIdStruct.RouteId);
|
||||
var session = scene.Server.GetSession(entityIdStruct.LocationId);
|
||||
var requestCallback = FTask<IResponse>.Create(false);
|
||||
RequestCallback.Add(rpcId, MessageSender.Create(rpcId, requestType, requestCallback));
|
||||
session.Send(request, rpcId, routeTypeOpCode, entityId);
|
||||
@@ -98,7 +98,7 @@ public static class MessageHelper
|
||||
|
||||
EntityIdStruct entityIdStruct = entityId;
|
||||
var rpcId = ++_rpcId;
|
||||
var session = scene.Server.GetSession(entityIdStruct.RouteId);
|
||||
var session = scene.Server.GetSession(entityIdStruct.LocationId);
|
||||
var requestCallback = FTask<IResponse>.Create(false);
|
||||
RequestCallback.Add(rpcId, MessageSender.Create(rpcId, request, requestCallback));
|
||||
session.Send(request, rpcId, entityId);
|
||||
|
@@ -63,6 +63,8 @@ namespace TEngine
|
||||
public long AddressableId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public long RouteId { get; set; }
|
||||
[ProtoMember(3)]
|
||||
public bool IsLock { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class I_AddressableAdd_Response : AProto, IRouteResponse
|
||||
|
@@ -9,6 +9,7 @@ namespace TEngine.Core.Network
|
||||
{
|
||||
try
|
||||
{
|
||||
DisposePackInfo = false;
|
||||
switch (packInfo.ProtocolCode)
|
||||
{
|
||||
case > Opcode.InnerRouteResponse:
|
||||
@@ -46,7 +47,7 @@ namespace TEngine.Core.Network
|
||||
}
|
||||
finally
|
||||
{
|
||||
packInfo.Dispose();
|
||||
NetworkThread.Instance.SynchronizationContext.Post(packInfo.Dispose);
|
||||
}
|
||||
|
||||
await FTask.CompletedTask;
|
||||
|
@@ -103,7 +103,7 @@ namespace TEngine.Core.Network
|
||||
}
|
||||
finally
|
||||
{
|
||||
packInfo.Dispose();
|
||||
NetworkThread.Instance.SynchronizationContext.Post(packInfo.Dispose);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -120,7 +120,7 @@ namespace TEngine.Core.Network
|
||||
}
|
||||
finally
|
||||
{
|
||||
packInfo.Dispose();
|
||||
NetworkThread.Instance.SynchronizationContext.Post(packInfo.Dispose);
|
||||
}
|
||||
|
||||
throw new NotSupportedException($"Received unsupported message protocolCode:{packInfo.ProtocolCode} messageType:{messageType}");
|
||||
|
@@ -1,3 +1,4 @@
|
||||
#if !UNITY_WEBGL
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.Collections.Generic;
|
||||
@@ -55,7 +56,6 @@ namespace TEngine.Core.Network
|
||||
ThreadSynchronizationContext.Main.Post(OnConnectDisconnect);
|
||||
}
|
||||
|
||||
_socket.Disconnect(false);
|
||||
_socket.Close();
|
||||
}
|
||||
|
||||
@@ -566,3 +566,4 @@ namespace TEngine.Core.Network
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -1,3 +1,4 @@
|
||||
#if !UNITY_WEBGL
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -460,3 +461,4 @@ namespace TEngine.Core.Network
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -1,3 +1,4 @@
|
||||
#if !UNITY_WEBGL
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.IO;
|
||||
@@ -233,3 +234,4 @@ namespace TEngine.Core.Network
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -1,3 +1,4 @@
|
||||
#if !UNITY_WEBGL
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -539,3 +540,4 @@ namespace TEngine.Core.Network
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -1,3 +1,4 @@
|
||||
#if !UNITY_WEBGL
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -236,3 +237,4 @@ namespace TEngine.Core.Network
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -1,3 +1,4 @@
|
||||
#if !UNITY_WEBGL
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Sockets;
|
||||
@@ -347,3 +348,4 @@ namespace TEngine.Core.Network
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -1,6 +1,8 @@
|
||||
#if TENGINE_NET
|
||||
using System.Buffers;
|
||||
using TEngine.DataStructure;
|
||||
using MongoDB.Bson.Serialization;
|
||||
using MongoDB.Bson.Serialization.Serializers;
|
||||
// ReSharper disable ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
|
||||
|
||||
namespace TEngine.Core.Network;
|
||||
@@ -199,8 +201,17 @@ public sealed class InnerPacketParser : APacketParser
|
||||
{
|
||||
if (message is IBsonMessage)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
MongoHelper.Instance.SerializeTo(message, memoryStream);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Fatal(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ProtoBufHelper.ToStream(message, memoryStream);
|
||||
|
@@ -92,7 +92,7 @@ public class SingleCollection : Singleton<SingleCollection>
|
||||
|
||||
using var collections = ListPool<Entity>.Create();
|
||||
|
||||
foreach (var (_, treeEntity) in entity.GetTree)
|
||||
foreach (var treeEntity in entity.ForEachSingleCollection)
|
||||
{
|
||||
if (treeEntity is not ISupportedSingleCollection)
|
||||
{
|
||||
|
@@ -3,7 +3,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
#if UNITY_WEBGL
|
||||
using Cysharp.Threading.Tasks;
|
||||
#else
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
using TEngine.DataStructure;
|
||||
#pragma warning disable CS8601
|
||||
#pragma warning disable CS8604
|
||||
@@ -25,10 +29,10 @@ namespace TEngine.Core
|
||||
private static void Load(int assemblyName)
|
||||
{
|
||||
var count = 0;
|
||||
#if !UNITY_WEBGL
|
||||
var task = new List<Task>();
|
||||
|
||||
#endif
|
||||
UnLoad(assemblyName);
|
||||
|
||||
foreach (var singletonType in AssemblyManager.ForEach(assemblyName, typeof(ISingleton)))
|
||||
{
|
||||
var instance = (ISingleton) Activator.CreateInstance(singletonType);
|
||||
@@ -38,7 +42,11 @@ namespace TEngine.Core
|
||||
|
||||
if (initializeMethodInfo != null)
|
||||
{
|
||||
#if !UNITY_WEBGL
|
||||
task.Add((Task) initializeMethodInfo.Invoke(instance, null));
|
||||
#else
|
||||
initializeMethodInfo.Invoke(instance, null);
|
||||
#endif
|
||||
}
|
||||
|
||||
registerMethodInfo?.Invoke(instance, new object[] {instance});
|
||||
@@ -58,7 +66,9 @@ namespace TEngine.Core
|
||||
Singletons.Enqueue(assemblyName, instance);
|
||||
}
|
||||
|
||||
#if !UNITY_WEBGL
|
||||
Task.WaitAll(task.ToArray());
|
||||
#endif
|
||||
Log.Info($"assembly:{assemblyName} load Singleton count:{count}");
|
||||
}
|
||||
|
||||
|
@@ -36,46 +36,43 @@ public static class TEngineSettingsHelper
|
||||
private static void LoadProtoConfig(IConfigurationRoot root)
|
||||
{
|
||||
// ProtoBuf文件所在的位置文件夹位置
|
||||
Define.ProtoBufDirectory = root["Export:ProtoBufDirectory:Value"].GetFullPath();
|
||||
Define.ProtoBufDirectory = FileHelper.GetFullPath(root["Export:ProtoBufDirectory:Value"]);
|
||||
// ProtoBuf生成到服务端的文件夹位置
|
||||
Define.ProtoBufServerDirectory = root["Export:ProtoBufServerDirectory:Value"].GetFullPath();
|
||||
Define.ProtoBufServerDirectory = FileHelper.GetFullPath(root["Export:ProtoBufServerDirectory:Value"]);
|
||||
// ProtoBuf生成到客户端的文件夹位置
|
||||
Define.ProtoBufClientDirectory = root["Export:ProtoBufClientDirectory:Value"].GetFullPath();
|
||||
Define.ProtoBufClientDirectory = FileHelper.GetFullPath(root["Export:ProtoBufClientDirectory:Value"]);
|
||||
// ProtoBuf生成代码模板的位置
|
||||
Define.ProtoBufTemplatePath = root["Export:ProtoBufTemplatePath:Value"].GetFullPath();
|
||||
Define.ProtoBufTemplatePath = FileHelper.GetFullPath(root["Export:ProtoBufTemplatePath:Value"]);
|
||||
}
|
||||
|
||||
private static void LoadExcelConfig(IConfigurationRoot root)
|
||||
{
|
||||
// Excel配置文件根目录
|
||||
Define.ExcelProgramPath = root["Export:ExcelProgramPath:Value"].GetFullPath();
|
||||
Define.ExcelProgramPath = FileHelper.GetFullPath(root["Export:ExcelProgramPath:Value"]);
|
||||
// Excel版本文件的位置
|
||||
Define.ExcelVersionFile = root["Export:ExcelVersionFile:Value"].GetFullPath();
|
||||
Define.ExcelVersionFile = FileHelper.GetFullPath(root["Export:ExcelVersionFile:Value"]);
|
||||
// Excel生成服务器代码的文件夹位置
|
||||
Define.ExcelServerFileDirectory = root["Export:ExcelServerFileDirectory:Value"].GetFullPath();
|
||||
Define.ExcelServerFileDirectory = FileHelper.GetFullPath(root["Export:ExcelServerFileDirectory:Value"]);
|
||||
// Excel生成客户端代码文件夹位置
|
||||
Define.ExcelClientFileDirectory = root["Export:ExcelClientFileDirectory:Value"].GetFullPath();
|
||||
Define.ExcelClientFileDirectory = FileHelper.GetFullPath(root["Export:ExcelClientFileDirectory:Value"]);
|
||||
// Excel生成服务器二进制数据文件夹位置
|
||||
Define.ExcelServerBinaryDirectory = root["Export:ExcelServerBinaryDirectory:Value"].GetFullPath();
|
||||
Define.ExcelServerBinaryDirectory = FileHelper.GetFullPath(root["Export:ExcelServerBinaryDirectory:Value"]);
|
||||
// Excel生成客户端二进制数据文件夹位置
|
||||
Define.ExcelClientBinaryDirectory = root["Export:ExcelClientBinaryDirectory:Value"].GetFullPath();
|
||||
Define.ExcelClientBinaryDirectory = FileHelper.GetFullPath(root["Export:ExcelClientBinaryDirectory:Value"]);
|
||||
// Excel生成服务器Json数据文件夹位置
|
||||
Define.ExcelServerJsonDirectory = root["Export:ExcelServerJsonDirectory:Value"].GetFullPath();
|
||||
Define.ExcelServerJsonDirectory = FileHelper.GetFullPath(root["Export:ExcelServerJsonDirectory:Value"]);
|
||||
// Excel生成客户端Json数据文件夹位置
|
||||
Define.ExcelClientJsonDirectory = root["Export:ExcelClientJsonDirectory:Value"].GetFullPath();
|
||||
Define.ExcelClientJsonDirectory = FileHelper.GetFullPath(root["Export:ExcelClientJsonDirectory:Value"]);
|
||||
// Excel生成代码模板的位置
|
||||
Define.ExcelTemplatePath = root["Export:ExcelTemplatePath:Value"].GetFullPath();
|
||||
Define.ExcelTemplatePath = FileHelper.GetFullPath(root["Export:ExcelTemplatePath:Value"]);
|
||||
// 服务器自定义导出代码文件夹位置
|
||||
Define.ServerCustomExportDirectory = root["Export:ServerCustomExportDirectory:Value"].GetFullPath();
|
||||
Define.ServerCustomExportDirectory = FileHelper.GetFullPath(root["Export:ServerCustomExportDirectory:Value"]);
|
||||
// 客户端自定义导出代码
|
||||
Define.ClientCustomExportDirectory = root["Export:ClientCustomExportDirectory:Value"].GetFullPath();
|
||||
Define.ClientCustomExportDirectory = FileHelper.GetFullPath(root["Export:ClientCustomExportDirectory:Value"]);
|
||||
// SceneConfig.xlsx的位置
|
||||
Define.SceneConfigPath = FileHelper.GetFullPath(root["Export:SceneConfigPath:Value"]);
|
||||
// 自定义导出代码存放的程序集
|
||||
Define.CustomExportAssembly = root["Export:CustomExportAssembly:Value"].GetFullPath();
|
||||
}
|
||||
|
||||
private static string GetFullPath(this string relativePath)
|
||||
{
|
||||
return Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), relativePath));
|
||||
Define.CustomExportAssembly = FileHelper.GetFullPath(root["Export:CustomExportAssembly:Value"]);
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -1,12 +1,13 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TEngine
|
||||
{
|
||||
/// <summary>
|
||||
/// 通过LogicSys来驱动且具备Unity完整生命周期的单例(不继承MonoBehaviour)。
|
||||
/// <remarks>Update、FixUpdate以及LateUpdate这些敏感帧更新需要加上对应的Attribute以最优化性能。</remarks>
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <typeparam name="T">完整生命周期的类型。</typeparam>
|
||||
public abstract class BehaviourSingleton<T> : BaseBehaviourSingleton where T : BaseBehaviourSingleton, new()
|
||||
{
|
||||
private static T _instance;
|
||||
@@ -45,11 +46,6 @@ namespace TEngine
|
||||
{
|
||||
}
|
||||
|
||||
public virtual bool IsHaveLateUpdate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void Start()
|
||||
{
|
||||
}
|
||||
@@ -159,7 +155,6 @@ namespace TEngine
|
||||
{
|
||||
var listStart = _listStart;
|
||||
var listToUpdate = _listUpdate;
|
||||
var listToLateUpdate = _listLateUpdate;
|
||||
if (listStart.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < listStart.Count; i++)
|
||||
@@ -169,12 +164,6 @@ namespace TEngine
|
||||
|
||||
inst.IsStart = true;
|
||||
inst.Start();
|
||||
listToUpdate.Add(inst);
|
||||
|
||||
if (inst.IsHaveLateUpdate())
|
||||
{
|
||||
listToLateUpdate.Add(inst);
|
||||
}
|
||||
}
|
||||
|
||||
listStart.Clear();
|
||||
|
@@ -1,3 +1,4 @@
|
||||
#if !UNITY_WEBGL
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
@@ -22,7 +23,6 @@ using System.Linq;
|
||||
*******************************************************************************/
|
||||
namespace GameBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Loom多线程通信。
|
||||
/// <remarks></remarks>
|
||||
@@ -188,3 +188,4 @@ namespace GameBase
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab10a5a730054c5aaa942164c750abfb
|
||||
timeCreated: 1689576189
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94212c40840344b5bd6ba4fc82097d47
|
||||
timeCreated: 1689576337
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 78e93a657ea64d5d97000e8b6cc83ffc
|
||||
timeCreated: 1689576342
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3212280593954784b888cf6e9fa088a8
|
||||
timeCreated: 1689584199
|
@@ -1,11 +0,0 @@
|
||||
using TEngine;
|
||||
|
||||
namespace GameLogic.BattleDemo
|
||||
{
|
||||
/// <summary>
|
||||
/// Actor属性数据管理。
|
||||
/// </summary>
|
||||
public class ActorData : EntityLogicComponent
|
||||
{
|
||||
}
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a344b822c96449a29d78fb64b02c762d
|
||||
timeCreated: 1689584206
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc314cd9682f4c1d8a870e2b4c6a5c88
|
||||
timeCreated: 1689584122
|
@@ -1,86 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TEngine;
|
||||
|
||||
namespace GameLogic.BattleDemo
|
||||
{
|
||||
/// <summary>
|
||||
/// 实体类的Buff管理。
|
||||
/// </summary>
|
||||
public class BuffComponent:EntityLogicComponent
|
||||
{
|
||||
private readonly Dictionary<int, BufferItem> _allBuff = new Dictionary<int, BufferItem>();
|
||||
private readonly List<BufferItem> _listBuff = new List<BufferItem>();
|
||||
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
foreach (var bufferItem in _listBuff)
|
||||
{
|
||||
BufferItem.Release(bufferItem);
|
||||
}
|
||||
_listBuff.Clear();
|
||||
_allBuff.Clear();
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加Buff。
|
||||
/// </summary>
|
||||
/// <param name="buffId">BuffId。</param>
|
||||
/// <param name="caster">施法者。</param>
|
||||
/// <param name="addStackNum">增加层数。</param>
|
||||
/// <param name="skillId">技能Id。</param>
|
||||
/// <returns></returns>
|
||||
public bool AddBuff(int buffId, EntityLogic caster, int addStackNum = 1, uint skillId = 0)
|
||||
{
|
||||
BufferItem bufferItem = BufferItem.Alloc(buffId);
|
||||
if (bufferItem == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
RefreshBuffAttr();
|
||||
UpdateBuffState();
|
||||
_allBuff.Add(buffId, bufferItem);
|
||||
_listBuff.Add(bufferItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除Buff。
|
||||
/// </summary>
|
||||
/// <param name="buffID">BuffID。</param>
|
||||
/// <param name="caster">移除施放来源。</param>
|
||||
public void RmvBuff(int buffID, EntityLogic caster)
|
||||
{
|
||||
if (_allBuff.TryGetValue(buffID, out BufferItem buffItem))
|
||||
{
|
||||
RemoveBuffFromList(buffItem);
|
||||
RefreshBuffAttr();
|
||||
UpdateBuffState();
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveBuffFromList(BufferItem buffItem)
|
||||
{
|
||||
Log.Info("remove buff: {0}", buffItem.BuffID);
|
||||
BufferItem.Release(buffItem);
|
||||
_allBuff.Remove(buffItem.BuffID);
|
||||
_listBuff.Remove(buffItem);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刷新Buff带来的属性。
|
||||
/// </summary>
|
||||
private void RefreshBuffAttr()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刷新Buff改变的状态。
|
||||
/// </summary>
|
||||
private void UpdateBuffState()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 29088ba5001247628aefb072c6d82705
|
||||
timeCreated: 1689582372
|
@@ -1,62 +0,0 @@
|
||||
using GameConfig.Battle;
|
||||
using TEngine;
|
||||
|
||||
namespace GameLogic.BattleDemo
|
||||
{
|
||||
/// <summary>
|
||||
/// Buff实例。
|
||||
/// </summary>
|
||||
public class BufferItem:IMemory
|
||||
{
|
||||
/// <summary>
|
||||
/// BuffId。
|
||||
/// </summary>
|
||||
public int BuffID => BuffConfig?.BuffID ?? 0;
|
||||
|
||||
/// <summary>
|
||||
/// BUff配置表。
|
||||
/// </summary>
|
||||
public BuffConfig BuffConfig { private set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 清理内存。
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
BuffConfig = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成Buff实例。
|
||||
/// </summary>
|
||||
/// <param name="buffId">buffId。</param>
|
||||
/// <returns>Buff实例。</returns>
|
||||
public static BufferItem Alloc(int buffId)
|
||||
{
|
||||
Log.Debug($"Alloc buffItem buffId:{buffId}");
|
||||
BuffConfig buffConfig = ConfigLoader.Instance.Tables.TbBuff.Get(buffId);
|
||||
if (buffConfig == null)
|
||||
{
|
||||
Log.Warning($"Alloc buffItem Failed ! buffId:{buffId}");
|
||||
return null;
|
||||
}
|
||||
|
||||
BufferItem ret = MemoryPool.Acquire<BufferItem>();
|
||||
ret.BuffConfig = buffConfig;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 释放Buff实例。
|
||||
/// </summary>
|
||||
/// <param name="bufferItem"></param>
|
||||
public static void Release(BufferItem bufferItem)
|
||||
{
|
||||
if (bufferItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
MemoryPool.Release(bufferItem);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8915b9545484419eb2642a69d4056daf
|
||||
timeCreated: 1689584322
|
@@ -1,39 +0,0 @@
|
||||
using TEngine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameLogic.BattleDemo
|
||||
{
|
||||
/// <summary>
|
||||
/// 实体创建预数据。
|
||||
/// </summary>
|
||||
public class EntityCreateData:IMemory
|
||||
{
|
||||
public ActorEntityType actorEntityType;
|
||||
|
||||
public bool HasBornPos = false;
|
||||
|
||||
public Vector3 BornPos;
|
||||
|
||||
public Vector3 BornForward;
|
||||
|
||||
/// <summary>
|
||||
/// 设置出生点。
|
||||
/// </summary>
|
||||
/// <param name="bornPos"></param>
|
||||
/// <param name="forward"></param>
|
||||
public void SetBornPos(Vector3 bornPos, Vector3 forward)
|
||||
{
|
||||
HasBornPos = true;
|
||||
BornPos = bornPos;
|
||||
BornForward = forward;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
actorEntityType = ActorEntityType.None;
|
||||
HasBornPos = false;
|
||||
BornPos = Vector3.zero;
|
||||
BornForward = Vector3.zero;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ba847c6eb944645a4b693f1a432d933
|
||||
timeCreated: 1689583498
|
@@ -1,65 +0,0 @@
|
||||
using TEngine;
|
||||
|
||||
namespace GameLogic.BattleDemo
|
||||
{
|
||||
/// <summary>
|
||||
/// 逻辑层实体。
|
||||
/// </summary>
|
||||
public abstract class EntityLogic : Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// 逻辑层实体类型。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public abstract ActorEntityType GetActorEntityType();
|
||||
|
||||
/// <summary>
|
||||
/// 是否是战斗起始的Actor。
|
||||
/// <remarks>,比如双方参与战斗的玩家,或者技能编辑器里的Caster。</remarks>
|
||||
/// </summary>
|
||||
public bool IsStartActor;
|
||||
|
||||
public EntityCreateData CreateData { private set; get; }
|
||||
|
||||
public virtual string GetActorName()
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
#region 缓存常用组件
|
||||
public ActorData ActorData { protected set; get; }
|
||||
|
||||
public BuffComponent BuffComponent { protected set; get; }
|
||||
public SkillCasterComponent SkillCaster { protected set; get; }
|
||||
#endregion
|
||||
|
||||
#region 生命周期
|
||||
|
||||
internal bool LogicCreate(EntityCreateData entityCreateData)
|
||||
{
|
||||
CreateData = entityCreateData;
|
||||
OnLogicCreate();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected virtual void OnLogicCreate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
internal void LogicDestroy()
|
||||
{
|
||||
OnLogicDestroy();
|
||||
if (CreateData != null)
|
||||
{
|
||||
MemoryPool.Release(CreateData);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnLogicDestroy()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e7b01c5b166445d680dc411dfbe5c781
|
||||
timeCreated: 1689576203
|
@@ -1,12 +0,0 @@
|
||||
using TEngine;
|
||||
|
||||
namespace GameLogic.BattleDemo
|
||||
{
|
||||
/// <summary>
|
||||
/// 逻辑层组件实体。
|
||||
/// </summary>
|
||||
public abstract class EntityLogicComponent: Entity
|
||||
{
|
||||
public EntityLogic Owner => (EntityLogic)Parent;
|
||||
}
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 92574294d8144f218f323f63f72a8374
|
||||
timeCreated: 1689585864
|
@@ -1,143 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TEngine;
|
||||
|
||||
namespace GameLogic.BattleDemo
|
||||
{
|
||||
/// <summary>
|
||||
/// 实体类型。
|
||||
/// </summary>
|
||||
public enum ActorEntityType
|
||||
{
|
||||
None,
|
||||
Player,
|
||||
Monster,
|
||||
Pet,
|
||||
Npc,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 逻辑层实体管理器。
|
||||
/// </summary>
|
||||
public class EntityLogicMgr
|
||||
{
|
||||
private static readonly Dictionary<long, EntityLogic> EntityLogicPool = new Dictionary<long, EntityLogic>();
|
||||
private static readonly List<EntityLogic> ListEntityLogics = new List<EntityLogic>();
|
||||
|
||||
public static event Action<EntityLogic> OnEntityCreate;
|
||||
public static event Action<EntityLogic> OnEntityDestroy;
|
||||
|
||||
public static List<EntityLogic> GetAllActor(ref List<EntityLogic> temp)
|
||||
{
|
||||
if (temp == null)
|
||||
{
|
||||
temp = new List<EntityLogic>();
|
||||
}
|
||||
temp.AddRange(ListEntityLogics);
|
||||
return temp;
|
||||
}
|
||||
|
||||
public static List<EntityLogic> GetTypeActor(ref List<EntityLogic> temp,ActorEntityType type)
|
||||
{
|
||||
if (temp == null)
|
||||
{
|
||||
temp = new List<EntityLogic>();
|
||||
}
|
||||
|
||||
foreach (var actor in ListEntityLogics)
|
||||
{
|
||||
if (actor.GetActorEntityType() == type)
|
||||
{
|
||||
temp.Add(actor);
|
||||
}
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
public static EntityLogic CreateEntityLogic(EntityCreateData entityCreateData, bool isStartActor = false)
|
||||
{
|
||||
if (entityCreateData == null)
|
||||
{
|
||||
Log.Error("create actor failed, create data is null");
|
||||
return null;
|
||||
}
|
||||
var actor = CreateActorEntityObject(entityCreateData.actorEntityType);
|
||||
if (actor == null)
|
||||
{
|
||||
Log.Error("create actor failed, create data is {0}", entityCreateData);
|
||||
return null;
|
||||
}
|
||||
|
||||
actor.IsStartActor = isStartActor;
|
||||
if (!actor.LogicCreate(entityCreateData))
|
||||
{
|
||||
DestroyActor(actor);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (OnEntityCreate != null)
|
||||
{
|
||||
OnEntityCreate(actor);
|
||||
}
|
||||
|
||||
Log.Debug("entityLogic created: {0}", actor.GetActorName());
|
||||
return actor;
|
||||
}
|
||||
|
||||
private static EntityLogic CreateActorEntityObject(ActorEntityType actorType)
|
||||
{
|
||||
EntityLogic entityLogic = null;
|
||||
|
||||
switch (actorType)
|
||||
{
|
||||
case ActorEntityType.Player:
|
||||
{
|
||||
entityLogic = Entity.Create<PlayerEntity>(GameApp.Instance.Scene);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
Log.Error("unknown actor type:{0}", actorType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (entityLogic != null)
|
||||
{
|
||||
EntityLogicPool.Add(entityLogic.RuntimeId, entityLogic);
|
||||
ListEntityLogics.Add(entityLogic);
|
||||
}
|
||||
return entityLogic;
|
||||
}
|
||||
|
||||
|
||||
public static bool DestroyActor(long runtimeId)
|
||||
{
|
||||
EntityLogicPool.TryGetValue(runtimeId, out EntityLogic entityLogic);
|
||||
if (entityLogic != null)
|
||||
{
|
||||
return DestroyActor(entityLogic);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool DestroyActor(EntityLogic entityLogic)
|
||||
{
|
||||
Log.Debug("on destroy entityLogic {0}", entityLogic.RuntimeId);
|
||||
|
||||
|
||||
var runtimeId = entityLogic.RuntimeId;
|
||||
Log.Assert(EntityLogicPool.ContainsKey(runtimeId));
|
||||
|
||||
if (OnEntityDestroy != null)
|
||||
{
|
||||
OnEntityDestroy(entityLogic);
|
||||
}
|
||||
|
||||
entityLogic.LogicDestroy();
|
||||
EntityLogicPool.Remove(runtimeId);
|
||||
ListEntityLogics.Remove(entityLogic);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 513b12007c8f408698d12aee22fc44db
|
||||
timeCreated: 1689579220
|
@@ -1,18 +0,0 @@
|
||||
namespace GameLogic.BattleDemo
|
||||
{
|
||||
public class PlayerEntity : EntityLogic
|
||||
{
|
||||
public override ActorEntityType GetActorEntityType()
|
||||
{
|
||||
return ActorEntityType.Player;
|
||||
}
|
||||
|
||||
protected override void OnLogicCreate()
|
||||
{
|
||||
base.OnLogicCreate();
|
||||
ActorData = AddComponent<ActorData>();
|
||||
BuffComponent = AddComponent<BuffComponent>();
|
||||
SkillCaster = AddComponent<SkillCasterComponent>();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9939517fe9f04f0d9c0c544fbdd43564
|
||||
timeCreated: 1689576650
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d126355d2da45c8899a7a4fff5d376c
|
||||
timeCreated: 1689584135
|
@@ -1,35 +0,0 @@
|
||||
using TEngine;
|
||||
|
||||
namespace GameLogic.BattleDemo
|
||||
{
|
||||
/// <summary>
|
||||
/// 技能释放组件。
|
||||
/// </summary>
|
||||
public class SkillCasterComponent:EntityLogicComponent
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 播放技能。
|
||||
/// </summary>
|
||||
/// <param name="skillId">技能Id。</param>
|
||||
/// <param name="target">目标。</param>
|
||||
/// <param name="checkCd">是否检测CD。</param>
|
||||
/// <param name="forceCaster">是否强制释放。</param>
|
||||
/// <returns>是否播放成功。</returns>
|
||||
internal void PlaySkill(int skillId, EntityLogic target = null, bool forceCaster = false, bool checkCd = true)
|
||||
{
|
||||
Log.Assert(skillId > 0, $"ActorName: {Owner.GetActorName()}");
|
||||
Log.Debug("Start Play SKill[{0}]", skillId);
|
||||
|
||||
var skillBaseConfig = ConfigLoader.Instance.Tables.TbSkill.Get(skillId);
|
||||
|
||||
if (skillBaseConfig == null)
|
||||
{
|
||||
Log.Error("GetSkillBaseConfig Failed, invalid skillID: {0}", skillId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b445989d175457db064ef74adeb4181
|
||||
timeCreated: 1689582410
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c20684aa6954a80abe88ef8ee599800
|
||||
timeCreated: 1689585664
|
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace GameLogic.BattleDemo
|
||||
{
|
||||
/// <summary>
|
||||
/// 技能表现数据。
|
||||
/// <remarks>表现数据再由SkillElementData组成。</remarks>
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class SkillDisplayData
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ffa4d74525b4c55ac6013a4372c6d42
|
||||
timeCreated: 1689586727
|
@@ -1,232 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using GameConfig.Battle;
|
||||
using TEngine;
|
||||
|
||||
namespace GameLogic.BattleDemo
|
||||
{
|
||||
public enum SkillPlayStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// 初始状态。
|
||||
/// </summary>
|
||||
PlayInit,
|
||||
|
||||
/// <summary>
|
||||
/// 技能施法前摇。
|
||||
/// <remarks>播放动作阶段。</remarks>
|
||||
/// </summary>
|
||||
PlayingAim,
|
||||
|
||||
/// <summary>
|
||||
/// 播放技能阶段,该阶段同时只能有一个技能播放。
|
||||
/// </summary>
|
||||
PlayingFront,
|
||||
|
||||
/// <summary>
|
||||
/// 后台播放阶段,前台播放完后,可能还有一些元素要继续生效,这个时候转为后台播放阶段。
|
||||
/// 同时玩家可以释放新的技能。
|
||||
/// </summary>
|
||||
PlayingBack,
|
||||
|
||||
/// <summary>
|
||||
/// 播放完毕,等待播放.
|
||||
/// </summary>
|
||||
PlayingToFree
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 技能播放的数据。
|
||||
/// </summary>
|
||||
public class SkillPlayData:IMemory
|
||||
{
|
||||
/// <summary>
|
||||
/// 技能内存Id,代表该玩家当前的唯一技能Id。
|
||||
/// </summary>
|
||||
public uint skillGid = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 技能的配置Id。
|
||||
/// </summary>
|
||||
public uint skillId;
|
||||
|
||||
/// <summary>
|
||||
/// 技能的配置。
|
||||
/// </summary>
|
||||
public SkillBaseConfig skillBaseConfig;
|
||||
|
||||
/// <summary>
|
||||
/// 技能表现ID.
|
||||
/// </summary>
|
||||
public int skillDisplayId;
|
||||
|
||||
/// <summary>
|
||||
/// 技能表现数据。
|
||||
/// </summary>
|
||||
public SkillDisplayData skillDisplayData;
|
||||
|
||||
/// <summary>
|
||||
/// 是否已经创建过visual表现层。
|
||||
/// </summary>
|
||||
public bool HasVisualPlayData = false;
|
||||
|
||||
/// <summary>
|
||||
/// 开始时间。
|
||||
/// </summary>
|
||||
public float startTime;
|
||||
|
||||
/// <summary>
|
||||
/// 开始技能进入后台的时间。
|
||||
/// </summary>
|
||||
public float startBackTime;
|
||||
|
||||
private SkillPlayStatus _status = SkillPlayStatus.PlayInit;
|
||||
|
||||
/// <summary>
|
||||
/// 播放状态
|
||||
/// </summary>
|
||||
public SkillPlayStatus Status
|
||||
{
|
||||
set
|
||||
{
|
||||
if (_status != value)
|
||||
{
|
||||
_status = value;
|
||||
if (_status == SkillPlayStatus.PlayingBack)
|
||||
{
|
||||
startBackTime = GameTime.time;
|
||||
}
|
||||
}
|
||||
}
|
||||
get => _status;
|
||||
}
|
||||
|
||||
public bool IsFrontStatus => _status == SkillPlayStatus.PlayingAim || _status == SkillPlayStatus.PlayingFront;
|
||||
|
||||
public bool IsRunningStatus => _status == SkillPlayStatus.PlayingFront || _status == SkillPlayStatus.PlayingBack;
|
||||
|
||||
private EntityLogic _casterActor = null;
|
||||
private SkillCasterComponent _skillCaster = null;
|
||||
|
||||
/// <summary>
|
||||
/// 获取技能施法者。
|
||||
/// </summary>
|
||||
public EntityLogic CasterActor
|
||||
{
|
||||
get => _casterActor;
|
||||
|
||||
set
|
||||
{
|
||||
_casterActor = value;
|
||||
_skillCaster = _casterActor.SkillCaster;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取施法者的运行时ID。
|
||||
/// </summary>
|
||||
public long CasterId
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_casterActor != null)
|
||||
{
|
||||
return _casterActor.RuntimeId;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 目标对象。
|
||||
/// </summary>
|
||||
public EntityLogic targetActor;
|
||||
|
||||
/// <summary>
|
||||
/// 获取技能播放模块。
|
||||
/// </summary>
|
||||
internal SkillCasterComponent SkillCaster => _skillCaster;
|
||||
|
||||
/// <summary>
|
||||
/// 处理动画元素。
|
||||
/// </summary>
|
||||
internal SkillAnimationHandle animHandle;
|
||||
|
||||
/// <summary>
|
||||
/// 技能元素处理列表。
|
||||
/// </summary>
|
||||
internal List<SkillElementHandle> handleList = new List<SkillElementHandle>();
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
skillId = 0;
|
||||
skillGid = 0;
|
||||
skillDisplayId = 0;
|
||||
skillDisplayData = null;
|
||||
skillBaseConfig = null;
|
||||
|
||||
Status = SkillPlayStatus.PlayInit;
|
||||
startTime = 0;
|
||||
startBackTime = 0;
|
||||
|
||||
CasterActor = null;
|
||||
targetActor = null;
|
||||
DestroyAllElement();
|
||||
}
|
||||
|
||||
private void DestroyAllElement()
|
||||
{
|
||||
//销毁所有的ElementHandle
|
||||
foreach (var elemHandle in handleList)
|
||||
{
|
||||
elemHandle?.Destroy();
|
||||
}
|
||||
handleList.Clear();
|
||||
animHandle = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加技能元素处理。
|
||||
/// </summary>
|
||||
/// <param name="handle">技能元素处理。</param>
|
||||
/// <returns>是否增加成功。</returns>
|
||||
internal bool AddElementHandle(SkillElementHandle handle)
|
||||
{
|
||||
string errField = null;
|
||||
string checkResult = handle.CheckElementConfig(ref errField);
|
||||
if (!string.IsNullOrEmpty(checkResult))
|
||||
{
|
||||
Log.Warning("skill Element config[{0}] error: {1}, RandomSkillLibraryId[{2}]", handle.GetType().ToString(), checkResult, skillId);
|
||||
return false;
|
||||
}
|
||||
handleList.Add(handle);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建表现层技能对象。
|
||||
/// </summary>
|
||||
internal void CreateVisualObject()
|
||||
{
|
||||
if (HasVisualPlayData)
|
||||
{
|
||||
return;
|
||||
}
|
||||
HasVisualPlayData = true;
|
||||
//发送给visual事件
|
||||
//TODO
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销毁表现层技能对象。
|
||||
/// </summary>
|
||||
internal void DestroyVisualObject()
|
||||
{
|
||||
if (HasVisualPlayData && _casterActor != null)
|
||||
{
|
||||
HasVisualPlayData = false;
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 05013b249849443eb8c5cb10491233ed
|
||||
timeCreated: 1689586140
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 29cd06d7bab9405481fc35365616dac3
|
||||
timeCreated: 1689587459
|
@@ -1,7 +0,0 @@
|
||||
namespace GameLogic.BattleDemo
|
||||
{
|
||||
public abstract class SkillElementData
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d6aefa939104f9d89a18ab78e385d05
|
||||
timeCreated: 1689587502
|
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace GameLogic.BattleDemo
|
||||
{
|
||||
[Serializable]
|
||||
public enum SkillTriggerEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// 无触发。
|
||||
/// </summary>
|
||||
NoneEvent,
|
||||
|
||||
/// <summary>
|
||||
/// 时间点触发。
|
||||
/// </summary>
|
||||
TimeEvent,
|
||||
|
||||
/// <summary>
|
||||
/// 施法结束触发。
|
||||
/// </summary>
|
||||
AnimStopEvent,
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user