初始化工程
This commit is contained in:
parent
b13cfa4295
commit
f242607587
11
.gitignore
vendored
11
.gitignore
vendored
@ -72,3 +72,14 @@ crashlytics-build.properties
|
||||
/[Aa]ssets/[Ss]treamingAssets/aa.meta
|
||||
/[Aa]ssets/[Ss]treamingAssets/aa/*
|
||||
|
||||
client/Temp/
|
||||
client/obj/
|
||||
client/Logs/
|
||||
client/Library/
|
||||
/.svn
|
||||
|
||||
# 忽略以 ~$ 开头的文件
|
||||
~$*
|
||||
|
||||
# 忽略 .swp 文件
|
||||
*.swp
|
BIN
art/Asesprite/test1.png
Normal file
BIN
art/Asesprite/test1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 208 B |
BIN
art/Asesprite/test2.png
Normal file
BIN
art/Asesprite/test2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 192 B |
BIN
art/Asesprite/test3.png
Normal file
BIN
art/Asesprite/test3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 245 B |
6
client/.vsconfig
Normal file
6
client/.vsconfig
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": "1.0",
|
||||
"components": [
|
||||
"Microsoft.VisualStudio.Workload.ManagedGame"
|
||||
]
|
||||
}
|
8
client/Assets/Animations.meta
Normal file
8
client/Assets/Animations.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1241dc14af592024aa9ab64e8048bd7d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
133
client/Assets/Animations/Crossfade.controller
Normal file
133
client/Assets/Animations/Crossfade.controller
Normal file
@ -0,0 +1,133 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1107 &-7916067724275492367
|
||||
AnimatorStateMachine:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Base Layer
|
||||
m_ChildStates:
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: -5299397905356680967}
|
||||
m_Position: {x: 300, y: 120, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1330560659825833870}
|
||||
m_Position: {x: 300, y: 200, z: 0}
|
||||
m_ChildStateMachines: []
|
||||
m_AnyStateTransitions: []
|
||||
m_EntryTransitions: []
|
||||
m_StateMachineTransitions: {}
|
||||
m_StateMachineBehaviours: []
|
||||
m_AnyStatePosition: {x: 50, y: 20, z: 0}
|
||||
m_EntryPosition: {x: 50, y: 120, z: 0}
|
||||
m_ExitPosition: {x: 800, y: 120, z: 0}
|
||||
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||
m_DefaultState: {fileID: -5299397905356680967}
|
||||
--- !u!1102 &-5299397905356680967
|
||||
AnimatorState:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Crossfade_End
|
||||
m_Speed: 1
|
||||
m_CycleOffset: 0
|
||||
m_Transitions:
|
||||
- {fileID: 4547078136675365319}
|
||||
m_StateMachineBehaviours: []
|
||||
m_Position: {x: 50, y: 50, z: 0}
|
||||
m_IKOnFeet: 0
|
||||
m_WriteDefaultValues: 1
|
||||
m_Mirror: 0
|
||||
m_SpeedParameterActive: 0
|
||||
m_MirrorParameterActive: 0
|
||||
m_CycleOffsetParameterActive: 0
|
||||
m_TimeParameterActive: 0
|
||||
m_Motion: {fileID: 7400000, guid: 95df84cbd7b7ae94bb5fe2c630c92fb0, type: 2}
|
||||
m_Tag:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
m_TimeParameter:
|
||||
--- !u!91 &9100000
|
||||
AnimatorController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Crossfade
|
||||
serializedVersion: 5
|
||||
m_AnimatorParameters:
|
||||
- m_Name: Start
|
||||
m_Type: 9
|
||||
m_DefaultFloat: 0
|
||||
m_DefaultInt: 0
|
||||
m_DefaultBool: 0
|
||||
m_Controller: {fileID: 0}
|
||||
m_AnimatorLayers:
|
||||
- serializedVersion: 5
|
||||
m_Name: Base Layer
|
||||
m_StateMachine: {fileID: -7916067724275492367}
|
||||
m_Mask: {fileID: 0}
|
||||
m_Motions: []
|
||||
m_Behaviours: []
|
||||
m_BlendingMode: 0
|
||||
m_SyncedLayerIndex: -1
|
||||
m_DefaultWeight: 0
|
||||
m_IKPass: 0
|
||||
m_SyncedLayerAffectsTiming: 0
|
||||
m_Controller: {fileID: 9100000}
|
||||
--- !u!1102 &1330560659825833870
|
||||
AnimatorState:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Crossfade_Start
|
||||
m_Speed: 1
|
||||
m_CycleOffset: 0
|
||||
m_Transitions: []
|
||||
m_StateMachineBehaviours: []
|
||||
m_Position: {x: 50, y: 50, z: 0}
|
||||
m_IKOnFeet: 0
|
||||
m_WriteDefaultValues: 1
|
||||
m_Mirror: 0
|
||||
m_SpeedParameterActive: 0
|
||||
m_MirrorParameterActive: 0
|
||||
m_CycleOffsetParameterActive: 0
|
||||
m_TimeParameterActive: 0
|
||||
m_Motion: {fileID: 7400000, guid: ca0d0e7cdd20a0c40adfec69794b8241, type: 2}
|
||||
m_Tag:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
m_TimeParameter:
|
||||
--- !u!1101 &4547078136675365319
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_Conditions:
|
||||
- m_ConditionMode: 1
|
||||
m_ConditionEvent: Start
|
||||
m_EventTreshold: 0
|
||||
m_DstStateMachine: {fileID: 0}
|
||||
m_DstState: {fileID: 1330560659825833870}
|
||||
m_Solo: 0
|
||||
m_Mute: 0
|
||||
m_IsExit: 0
|
||||
serializedVersion: 3
|
||||
m_TransitionDuration: 0
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0.75
|
||||
m_HasExitTime: 0
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
m_CanTransitionToSelf: 1
|
8
client/Assets/Animations/Crossfade.controller.meta
Normal file
8
client/Assets/Animations/Crossfade.controller.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b69cf703391f7b44581fa87e6d9efd64
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 9100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
260
client/Assets/Animations/Crossfade_End.anim
Normal file
260
client/Assets/Animations/Crossfade_End.anim
Normal file
@ -0,0 +1,260 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!74 &7400000
|
||||
AnimationClip:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Crossfade_End
|
||||
serializedVersion: 7
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves: []
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves:
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Alpha
|
||||
path: Image
|
||||
classID: 225
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Interactable
|
||||
path: Image
|
||||
classID: 225
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_BlocksRaycasts
|
||||
path: Image
|
||||
classID: 225
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 60
|
||||
m_WrapMode: 0
|
||||
m_Bounds:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0, y: 0, z: 0}
|
||||
m_ClipBindingConstant:
|
||||
genericBindings:
|
||||
- serializedVersion: 2
|
||||
path: 83635035
|
||||
attribute: 1574349066
|
||||
script: {fileID: 0}
|
||||
typeID: 225
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 83635035
|
||||
attribute: 4287062452
|
||||
script: {fileID: 0}
|
||||
typeID: 225
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 83635035
|
||||
attribute: 3739863151
|
||||
script: {fileID: 0}
|
||||
typeID: 225
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 0
|
||||
pptrCurveMapping: []
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 1
|
||||
m_OrientationOffsetY: 0
|
||||
m_Level: 0
|
||||
m_CycleOffset: 0
|
||||
m_HasAdditiveReferencePose: 0
|
||||
m_LoopTime: 0
|
||||
m_LoopBlend: 0
|
||||
m_LoopBlendOrientation: 0
|
||||
m_LoopBlendPositionY: 0
|
||||
m_LoopBlendPositionXZ: 0
|
||||
m_KeepOriginalOrientation: 0
|
||||
m_KeepOriginalPositionY: 1
|
||||
m_KeepOriginalPositionXZ: 0
|
||||
m_HeightFromFeet: 0
|
||||
m_Mirror: 0
|
||||
m_EditorCurves:
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Alpha
|
||||
path: Image
|
||||
classID: 225
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Interactable
|
||||
path: Image
|
||||
classID: 225
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_BlocksRaycasts
|
||||
path: Image
|
||||
classID: 225
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_Events: []
|
8
client/Assets/Animations/Crossfade_End.anim.meta
Normal file
8
client/Assets/Animations/Crossfade_End.anim.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95df84cbd7b7ae94bb5fe2c630c92fb0
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
260
client/Assets/Animations/Crossfade_Start.anim
Normal file
260
client/Assets/Animations/Crossfade_Start.anim
Normal file
@ -0,0 +1,260 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!74 &7400000
|
||||
AnimationClip:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Crossfade_Start
|
||||
serializedVersion: 7
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves: []
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves:
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Alpha
|
||||
path: Image
|
||||
classID: 225
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_BlocksRaycasts
|
||||
path: Image
|
||||
classID: 225
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Interactable
|
||||
path: Image
|
||||
classID: 225
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 60
|
||||
m_WrapMode: 0
|
||||
m_Bounds:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0, y: 0, z: 0}
|
||||
m_ClipBindingConstant:
|
||||
genericBindings:
|
||||
- serializedVersion: 2
|
||||
path: 83635035
|
||||
attribute: 1574349066
|
||||
script: {fileID: 0}
|
||||
typeID: 225
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 83635035
|
||||
attribute: 3739863151
|
||||
script: {fileID: 0}
|
||||
typeID: 225
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 0
|
||||
- serializedVersion: 2
|
||||
path: 83635035
|
||||
attribute: 4287062452
|
||||
script: {fileID: 0}
|
||||
typeID: 225
|
||||
customType: 0
|
||||
isPPtrCurve: 0
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 0
|
||||
pptrCurveMapping: []
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 1
|
||||
m_OrientationOffsetY: 0
|
||||
m_Level: 0
|
||||
m_CycleOffset: 0
|
||||
m_HasAdditiveReferencePose: 0
|
||||
m_LoopTime: 0
|
||||
m_LoopBlend: 0
|
||||
m_LoopBlendOrientation: 0
|
||||
m_LoopBlendPositionY: 0
|
||||
m_LoopBlendPositionXZ: 0
|
||||
m_KeepOriginalOrientation: 0
|
||||
m_KeepOriginalPositionY: 1
|
||||
m_KeepOriginalPositionXZ: 0
|
||||
m_HeightFromFeet: 0
|
||||
m_Mirror: 0
|
||||
m_EditorCurves:
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 136
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Alpha
|
||||
path: Image
|
||||
classID: 225
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_BlocksRaycasts
|
||||
path: Image
|
||||
classID: 225
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 1
|
||||
inSlope: Infinity
|
||||
outSlope: Infinity
|
||||
tangentMode: 103
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_Interactable
|
||||
path: Image
|
||||
classID: 225
|
||||
script: {fileID: 0}
|
||||
flags: 0
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_Events: []
|
8
client/Assets/Animations/Crossfade_Start.anim.meta
Normal file
8
client/Assets/Animations/Crossfade_Start.anim.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca0d0e7cdd20a0c40adfec69794b8241
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
client/Assets/Ether.meta
Normal file
8
client/Assets/Ether.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53aa8fed99c496142a18f59b4e3ca747
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
client/Assets/Ether/Editor.meta
Normal file
8
client/Assets/Ether/Editor.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d110e486a862ab84aada30669e4825c5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
85
client/Assets/Ether/Editor/ConfirmWindow.cs
Normal file
85
client/Assets/Ether/Editor/ConfirmWindow.cs
Normal file
@ -0,0 +1,85 @@
|
||||
/********************************************************************
|
||||
文件:ConfirmWindow.cs
|
||||
作者:梦语
|
||||
邮箱:1982614048@qq.com
|
||||
日期:2024/02/21 16:24:12
|
||||
功能:编辑器确认框
|
||||
*********************************************************************/
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
/// <summary>
|
||||
/// 确认框配置
|
||||
/// </summary>
|
||||
public static class ConfirmConfig
|
||||
{
|
||||
public static string tips; //显示的提示
|
||||
public static Action confirmAction; //确认回调
|
||||
public static Action cancelAction; //取消回调
|
||||
|
||||
public static void ShowConfirmWindow()
|
||||
{
|
||||
if (confirmAction != null)
|
||||
{
|
||||
EditorWindow.GetWindowWithRect<ConfirmWindow>(new Rect(0, 0, 300, 100), true, "确认操作", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 确认框弹窗
|
||||
/// </summary>
|
||||
public class ConfirmWindow : EditorWindow
|
||||
{
|
||||
GUIStyle fontTitleStyle = new GUIStyle();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
fontTitleStyle.alignment = TextAnchor.MiddleCenter;
|
||||
fontTitleStyle.fontSize = 15;
|
||||
fontTitleStyle.normal.textColor = new Color(255, 255, 255);
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Space(20);
|
||||
if (ConfirmConfig.tips == null)
|
||||
{
|
||||
ConfirmConfig.tips = "是否确认该操作?";
|
||||
}
|
||||
GUILayout.Label(ConfirmConfig.tips, fontTitleStyle);
|
||||
|
||||
GUILayout.Space(20);
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Space(50);
|
||||
if (GUILayout.Button("确定", GUILayout.Width(80)))
|
||||
{
|
||||
ConfirmConfig.confirmAction?.Invoke();
|
||||
Close();
|
||||
}
|
||||
GUILayout.Space(50);
|
||||
if (GUILayout.Button("取消", GUILayout.Width(80)))
|
||||
{
|
||||
ConfirmConfig.cancelAction?.Invoke();
|
||||
Close();
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
ConfirmConfig.confirmAction = null;
|
||||
ConfirmConfig.tips = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
11
client/Assets/Ether/Editor/ConfirmWindow.cs.meta
Normal file
11
client/Assets/Ether/Editor/ConfirmWindow.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a8a3a467c6dc72438c51e28683ad425
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
21
client/Assets/Ether/Editor/EtherEditor.asmdef
Normal file
21
client/Assets/Ether/Editor/EtherEditor.asmdef
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "EtherEditor",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:789b9b4ca718ab343bc113cff404bcce",
|
||||
"GUID:75469ad4d38634e559750d17036d5f7c",
|
||||
"GUID:002c1bbed08fa44d282ef34fd5edb138",
|
||||
"GUID:b8e24fd1eb19b4226afebb2810e3c19b"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
7
client/Assets/Ether/Editor/EtherEditor.asmdef.meta
Normal file
7
client/Assets/Ether/Editor/EtherEditor.asmdef.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f716c3cfa97f8d4bb5abb0809a10755
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
client/Assets/Ether/Editor/Extension.meta
Normal file
8
client/Assets/Ether/Editor/Extension.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c271d20f19f0e84cb6efab8b8cabd31
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
42
client/Assets/Ether/Editor/Extension/InspectorViewer.cs
Normal file
42
client/Assets/Ether/Editor/Extension/InspectorViewer.cs
Normal file
@ -0,0 +1,42 @@
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public class InspectorViewer : VisualElement
|
||||
{
|
||||
public new class UxmlFactory : UxmlFactory<InspectorViewer, VisualElement.UxmlTraits> { }
|
||||
|
||||
Editor editor;
|
||||
|
||||
internal void UpdateSelection(EtherNodeView nodeView)
|
||||
{
|
||||
Clear();
|
||||
Object.DestroyImmediate(editor);
|
||||
editor = Editor.CreateEditor(nodeView.node);
|
||||
IMGUIContainer container = new IMGUIContainer(() =>
|
||||
{
|
||||
if (nodeView.node && editor.target)
|
||||
{
|
||||
// 使用 BeginGUI 和 EndGUI 来包裹 OnInspectorGUI 调用
|
||||
EditorGUILayout.BeginVertical();
|
||||
editor.OnInspectorGUI();
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
// 检查是否点击了 Inspector 区域
|
||||
if (Event.current.type == EventType.MouseDown &&
|
||||
GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition))
|
||||
{
|
||||
Event.current.Use(); // 标记事件已被使用,阻止冒泡
|
||||
}
|
||||
}
|
||||
});
|
||||
Add(container);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
11
client/Assets/Ether/Editor/Extension/InspectorViewer.cs.meta
Normal file
11
client/Assets/Ether/Editor/Extension/InspectorViewer.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e732fb0ebf94ff40b1bb13b6a1c01d0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
24
client/Assets/Ether/Editor/Extension/SplitViewer.cs
Normal file
24
client/Assets/Ether/Editor/Extension/SplitViewer.cs
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public class SplitViewer : TwoPaneSplitView
|
||||
{
|
||||
public new class UxmlFactory : UxmlFactory<SplitViewer, TwoPaneSplitView.UxmlTraits> { }
|
||||
|
||||
public SplitViewer()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
private void Init()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
11
client/Assets/Ether/Editor/Extension/SplitViewer.cs.meta
Normal file
11
client/Assets/Ether/Editor/Extension/SplitViewer.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a533648da5d89af499978fc0094e7efc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
client/Assets/Ether/Editor/Frames.meta
Normal file
8
client/Assets/Ether/Editor/Frames.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 727ef86d82981b645809f394db91d417
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
268
client/Assets/Ether/Editor/Frames/FrameCodeGenerate.cs
Normal file
268
client/Assets/Ether/Editor/Frames/FrameCodeGenerate.cs
Normal file
@ -0,0 +1,268 @@
|
||||
/********************************************************************
|
||||
文件: FrameCodeGenerate.cs
|
||||
作者: 梦语
|
||||
邮箱: 1982614048@qq.com
|
||||
创建时间: 2024/03/29 17:28:19
|
||||
最后修改: 梦语
|
||||
最后修改时间: 2024/04/04 16:34:30
|
||||
功能: 生成界面基类
|
||||
*********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public class FrameCodeGenerate
|
||||
{
|
||||
public enum ComponentType
|
||||
{
|
||||
Image,
|
||||
Go,
|
||||
Btn,
|
||||
BtnEx,
|
||||
Text,
|
||||
SRContent,
|
||||
ScrollRect,
|
||||
Animator,
|
||||
Trans,
|
||||
}
|
||||
|
||||
private static Dictionary<ComponentType, string> relationDic = new Dictionary<ComponentType, string>()
|
||||
{
|
||||
{ ComponentType.Image, "Image" },
|
||||
{ ComponentType.Go, "GameObject" },
|
||||
{ ComponentType.Trans, "Transform" },
|
||||
{ ComponentType.Btn, "Button" },
|
||||
{ ComponentType.BtnEx, "ButtonEx" },
|
||||
{ ComponentType.Text, "TextMeshProUGUI" },
|
||||
{ ComponentType.SRContent, "ScrollContent" },
|
||||
{ ComponentType.ScrollRect, "ScrollRect" },
|
||||
{ ComponentType.Animator, "Animator" },
|
||||
};
|
||||
|
||||
[MenuItem("Assets/生成FrameBase(=-=)", false, 19)]
|
||||
private static void CodeGenerate()
|
||||
{
|
||||
GameObject selectedPrefab = Selection.activeGameObject;
|
||||
if (selectedPrefab != null && PrefabUtility.IsPartOfAnyPrefab(selectedPrefab))
|
||||
{
|
||||
|
||||
Transform[] childs = selectedPrefab.GetComponentsInChildren<Transform>(true);
|
||||
|
||||
Dictionary<string, (string, List<ComponentType>)> componentDic = new Dictionary<string, (string, List<ComponentType>)>();
|
||||
|
||||
foreach (Transform child in childs)
|
||||
{
|
||||
if (child.name == selectedPrefab.name)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
(string, List<ComponentType>) childComponent = CheckClildName(child);
|
||||
string childPath = GetChildPath(child);
|
||||
if (!componentDic.ContainsKey(childPath))
|
||||
{
|
||||
componentDic.Add(childPath, childComponent);
|
||||
}
|
||||
}
|
||||
|
||||
GenerateFrameBase(selectedPrefab, componentDic);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("当前没有选中预制体!");
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("Assets/生成FrameBase(=-=)", true, 19)]
|
||||
public static bool CodeGenerateShow()
|
||||
{
|
||||
GameObject selectedPrefab = Selection.activeGameObject;
|
||||
if (selectedPrefab != null && PrefabUtility.IsPartOfAnyPrefab(selectedPrefab))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查子物体的名字,获取对应的组件
|
||||
/// </summary>
|
||||
/// <param name="child"></param>
|
||||
/// <returns></returns>
|
||||
private static (string, List<ComponentType>) CheckClildName(Transform child)
|
||||
{
|
||||
string input = child.name;
|
||||
string pattern = @"<(.*?)>";
|
||||
|
||||
List<ComponentType> childTypeList = new List<ComponentType>();
|
||||
string childName = input;
|
||||
|
||||
MatchCollection matches = Regex.Matches(input, pattern);
|
||||
foreach (Match match in matches)
|
||||
{
|
||||
childName = childName.Replace(match.Groups[0].Value, "");
|
||||
string content = match.Groups[1].Value;
|
||||
|
||||
if (Enum.TryParse(content, out ComponentType parsedEnum))
|
||||
{
|
||||
if (Enum.IsDefined(typeof(ComponentType), parsedEnum))
|
||||
{
|
||||
childTypeList.Add(parsedEnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (childName, childTypeList);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取子物体的路径
|
||||
/// </summary>
|
||||
/// <param name="child"></param>
|
||||
/// <returns></returns>
|
||||
private static string GetChildPath(Transform child)
|
||||
{
|
||||
string path = child.name;
|
||||
Transform parent = child.parent;
|
||||
while (parent != null)
|
||||
{
|
||||
path = parent.name + "/" + path;
|
||||
parent = parent.parent;
|
||||
}
|
||||
|
||||
//去除本身的路径
|
||||
int slashIndex = path.IndexOf("/");
|
||||
if (slashIndex >= 0)
|
||||
{
|
||||
path = path.Substring(slashIndex + 1);
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
private static string templeteFileName = Application.dataPath + $"/Ether/Editor/Frames/FrameTemplete.txt";
|
||||
|
||||
/// <summary>
|
||||
/// 生成FrameBase
|
||||
/// </summary>
|
||||
/// <param name="componentDic"></param>
|
||||
private static void GenerateFrameBase(GameObject selectedPrefab, Dictionary<string, (string, List<ComponentType>)> componentDic)
|
||||
{
|
||||
string selectPath = AssetDatabase.GetAssetPath(selectedPrefab);
|
||||
string framePart = "Prefabs";
|
||||
|
||||
int selectIndex = selectPath.IndexOf(framePart);
|
||||
string framePrefabPath = selectPath.Substring(selectIndex).Replace(".prefab", "");
|
||||
|
||||
Debug.Log($"selectPath:{selectPath}");
|
||||
|
||||
string frameTemplete = FileTools.ReadFile(templeteFileName);
|
||||
|
||||
Debug.Log(frameTemplete);
|
||||
|
||||
(string, string) generateComponentCode = GenerateComponentCodeStr(componentDic);
|
||||
|
||||
string pattern = @"\$(.*?)\$";
|
||||
|
||||
MatchCollection matches = Regex.Matches(frameTemplete, pattern);
|
||||
|
||||
foreach (Match match in matches)
|
||||
{
|
||||
string property = match.Groups[0].Value; //带$的原字符串
|
||||
string content = match.Groups[1].Value; //仅两个$中的内容
|
||||
|
||||
string replaceStr = "";
|
||||
|
||||
switch (content)
|
||||
{
|
||||
case "FrameBaseName":
|
||||
replaceStr = $"{selectedPrefab.name}Base";
|
||||
break;
|
||||
case "PrefabPath":
|
||||
replaceStr = framePrefabPath;
|
||||
break;
|
||||
case "PropertyList":
|
||||
replaceStr = generateComponentCode.Item1;
|
||||
break;
|
||||
case "PropertyInitList":
|
||||
replaceStr = generateComponentCode.Item2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//Debug.Log(content);
|
||||
|
||||
frameTemplete = frameTemplete.Replace(property, replaceStr);
|
||||
}
|
||||
|
||||
string basePath = Application.dataPath + $"/Scripts/AutoGenerated/FrameBase/{selectedPrefab.name}Base.cs";
|
||||
|
||||
if (File.Exists(basePath)) File.Delete(basePath);
|
||||
|
||||
FileTools.WriteFile(basePath, frameTemplete);
|
||||
|
||||
AssetDatabase.Refresh();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
private static (string, string) GenerateComponentCodeStr(Dictionary<string, (string, List<ComponentType>)> componentDic)
|
||||
{
|
||||
string define = "";
|
||||
string code = "";
|
||||
|
||||
string name = "";
|
||||
foreach (var component in componentDic)
|
||||
{
|
||||
name = component.Value.Item1;
|
||||
|
||||
foreach (var type in component.Value.Item2)
|
||||
{
|
||||
string tempType;
|
||||
if (relationDic.ContainsKey(type))
|
||||
{
|
||||
tempType = relationDic[type];
|
||||
}
|
||||
else
|
||||
{
|
||||
tempType = type.ToString();
|
||||
}
|
||||
define += $"protected {tempType} _{type}{name};\n\t\t";
|
||||
code += GetCodeByComponentType(type, tempType, name, component.Key);
|
||||
}
|
||||
}
|
||||
|
||||
return (define, code);
|
||||
}
|
||||
|
||||
private static string GetCodeByComponentType(ComponentType type, string componentName, string name, string path)
|
||||
{
|
||||
string code = "";
|
||||
switch (type)
|
||||
{
|
||||
case ComponentType.Go:
|
||||
code = $"_{type}{name} = GetChild(\"{path}\").gameObject;\n\t\t\t";
|
||||
break;
|
||||
case ComponentType.Image:
|
||||
case ComponentType.Btn:
|
||||
case ComponentType.BtnEx:
|
||||
case ComponentType.Text:
|
||||
default:
|
||||
code = $"_{type}{name} = GetComponent<{componentName}>(\"{path}\");\n\t\t\t";
|
||||
break;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
11
client/Assets/Ether/Editor/Frames/FrameCodeGenerate.cs.meta
Normal file
11
client/Assets/Ether/Editor/Frames/FrameCodeGenerate.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 89905d56becc6d247905937fcb0bbed0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
19
client/Assets/Ether/Editor/Frames/FrameTemplete.txt
Normal file
19
client/Assets/Ether/Editor/Frames/FrameTemplete.txt
Normal file
@ -0,0 +1,19 @@
|
||||
//=================================================== 代码自动创建,禁止手动修改 ===================================================
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public class $FrameBaseName$ : FrameBase
|
||||
{
|
||||
public override string PrefabPath { get; } = "$PrefabPath$";
|
||||
$PropertyList$
|
||||
protected override void OnInit()
|
||||
{
|
||||
$PropertyInitList$
|
||||
}
|
||||
}
|
||||
}
|
7
client/Assets/Ether/Editor/Frames/FrameTemplete.txt.meta
Normal file
7
client/Assets/Ether/Editor/Frames/FrameTemplete.txt.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c9df44b4d2f31d4d863e84bbebb2bc7
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
client/Assets/Ether/Editor/Input.meta
Normal file
8
client/Assets/Ether/Editor/Input.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3949494a94dc80b44a7cf3ce7f78f4cf
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
48
client/Assets/Ether/Editor/Input/GenerateInputScript.cs
Normal file
48
client/Assets/Ether/Editor/Input/GenerateInputScript.cs
Normal file
@ -0,0 +1,48 @@
|
||||
|
||||
//using System.Collections;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Text;
|
||||
//using UnityEngine;
|
||||
|
||||
//namespace Ether
|
||||
//{
|
||||
// public static class GenerateInputScript
|
||||
// {
|
||||
// private static string inputFunctionCfgPath = PathTools.InputFunctionConfig;
|
||||
// private static string generatePath = PathTools.EtherInputTypePath;
|
||||
// private static string tempPath = PathTools.InputActionDataTempPath;
|
||||
|
||||
// public static bool Generate()
|
||||
// {
|
||||
// if (!FileTools.FileExists(inputFunctionCfgPath))
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// if (!FileTools.ReadFileForJson(PathTools.InputFunctionConfig, out InputFunctionConfig inputFunctionCfg))
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// List<InputFunctionClass> functionList = inputFunctionCfg.functionList;
|
||||
|
||||
// string template = FileTools.ReadFile(tempPath);
|
||||
|
||||
// string str = "";
|
||||
|
||||
// foreach (InputFunctionClass function in functionList)
|
||||
// {
|
||||
// if (!string.IsNullOrEmpty(function.inputKeyName))
|
||||
// {
|
||||
// str += "\t\t" + function.inputKeyName + ",\n";
|
||||
// }
|
||||
// }
|
||||
|
||||
// string outStr = template.Replace("%Content%", str);
|
||||
|
||||
// FileTools.WriteFile(generatePath, outStr);
|
||||
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
//}
|
11
client/Assets/Ether/Editor/Input/GenerateInputScript.cs.meta
Normal file
11
client/Assets/Ether/Editor/Input/GenerateInputScript.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ee1f1c5ee3fff845b14a0ff83a10e2b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
11
client/Assets/Ether/Editor/Input/InputActionDataTemp.txt
Normal file
11
client/Assets/Ether/Editor/Input/InputActionDataTemp.txt
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public enum EtherInputType
|
||||
{
|
||||
%Content%
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7b038daa103f9b438bc038118534040
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
173
client/Assets/Ether/Editor/Input/InputEditor.cs
Normal file
173
client/Assets/Ether/Editor/Input/InputEditor.cs
Normal file
@ -0,0 +1,173 @@
|
||||
//using Ether;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using UnityEditor;
|
||||
//using UnityEngine;
|
||||
//using UnityEngine.UIElements;
|
||||
|
||||
//public class InputEditor : EditorWindow
|
||||
//{
|
||||
// [SerializeField]
|
||||
// private VisualTreeAsset m_VisualTreeAsset = default;
|
||||
|
||||
// [SerializeField]
|
||||
// private VisualTreeAsset inputEditorItem = default;
|
||||
|
||||
// [SerializeField]
|
||||
// private StyleSheet styleSheet = default;
|
||||
|
||||
// [MenuItem("配置/输入系统/输入配置")]
|
||||
// public static void ShowExample()
|
||||
// {
|
||||
// InputEditor wnd = GetWindow<InputEditor>();
|
||||
// wnd.titleContent = new GUIContent("输入配置");
|
||||
// }
|
||||
|
||||
// VisualElement root;
|
||||
// ListView listView;
|
||||
|
||||
// public void CreateGUI()
|
||||
// {
|
||||
// root = rootVisualElement;
|
||||
|
||||
// m_VisualTreeAsset.CloneTree(root);
|
||||
|
||||
// root.styleSheets.Add(styleSheet);
|
||||
|
||||
// listView = root.Q<ListView>("ItemList");
|
||||
|
||||
// LoadItemListData();
|
||||
// SetListViewData();
|
||||
|
||||
// root.Q<VisualElement>("BtnList").Q<Button>("SaveBtn").clicked += () =>
|
||||
// {
|
||||
// Debug.Log("点击了确认按钮");
|
||||
// ConfirmConfig.tips = "是否确认保存当前设置?";
|
||||
// ConfirmConfig.confirmAction = () =>
|
||||
// {
|
||||
// lastItemList = JsonTools.Clone(itemList);
|
||||
// if (!FileTools.WriteFileForJson(PathTools.InputFunctionConfig, new InputFunctionConfig()
|
||||
// {
|
||||
// functionList = itemList,
|
||||
// }))
|
||||
// {
|
||||
// Debug.LogError("保存当前设置失败!");
|
||||
// ShowNotification(new GUIContent("保存当前设置失败!"));
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (GenerateInputScript.Generate())
|
||||
// {
|
||||
// ShowNotification(new GUIContent("已保存当前设置!"));
|
||||
// AssetDatabase.Refresh();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Debug.LogError("生成对应输入配置代码出错!");
|
||||
// ShowNotification(new GUIContent("生成对应输入配置代码出错!"));
|
||||
// }
|
||||
// };
|
||||
// ConfirmConfig.ShowConfirmWindow();
|
||||
|
||||
// };
|
||||
|
||||
// root.Q<VisualElement>("BtnList").Q<Button>("ResetBtn").clicked += () =>
|
||||
// {
|
||||
// Debug.Log("点击了还原按钮");
|
||||
// ConfirmConfig.tips = "是否还原成打开时的设置?";
|
||||
// ConfirmConfig.confirmAction = () =>
|
||||
// {
|
||||
// ShowNotification(new GUIContent("已还原成打开时的设置!"));
|
||||
// itemList.Clear();
|
||||
// foreach (var item in lastItemList)
|
||||
// {
|
||||
// List<string> tempList = new List<string>();
|
||||
|
||||
// itemList.Add(new InputFunctionClass()
|
||||
// {
|
||||
// inputKeyType = item.inputKeyType,
|
||||
// inputKeyName = item.inputKeyName,
|
||||
// });
|
||||
// }
|
||||
|
||||
// listView.Rebuild();
|
||||
// };
|
||||
// ConfirmConfig.ShowConfirmWindow();
|
||||
// };
|
||||
|
||||
// root.Q<VisualElement>("BtnList").Q<Button>("ClearBtn").clicked += () =>
|
||||
// {
|
||||
// Debug.Log("点击了清空按钮");
|
||||
// ConfirmConfig.tips = "是否清空当前设置?";
|
||||
// ConfirmConfig.confirmAction = () =>
|
||||
// {
|
||||
// ShowNotification(new GUIContent("已清空当前设置!"));
|
||||
// itemList.Clear();
|
||||
// listView.Rebuild();
|
||||
// };
|
||||
// ConfirmConfig.ShowConfirmWindow();
|
||||
// };
|
||||
// }
|
||||
|
||||
// private void LoadItemListData()
|
||||
// {
|
||||
// string functionCfgPath = PathTools.InputFunctionConfig;
|
||||
// if (!FileTools.FileExists(functionCfgPath))
|
||||
// {
|
||||
// itemList = new List<InputFunctionClass>();
|
||||
// lastItemList = new List<InputFunctionClass>();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (FileTools.ReadFileForJson<InputFunctionConfig>(functionCfgPath, out InputFunctionConfig cfg))
|
||||
// {
|
||||
// itemList = cfg.functionList;
|
||||
// lastItemList = JsonTools.Clone(itemList);
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// private List<InputFunctionClass> itemList;
|
||||
// private List<InputFunctionClass> lastItemList;
|
||||
|
||||
// /// <summary>
|
||||
// /// 设置listview数据
|
||||
// /// </summary>
|
||||
// private void SetListViewData()
|
||||
// {
|
||||
// Func<VisualElement> makeItem = () => inputEditorItem.CloneTree();
|
||||
|
||||
// Action<VisualElement, int> bindItem = (item, index) =>
|
||||
// {
|
||||
// if (index < itemList.Count)
|
||||
// {
|
||||
// if (itemList[index] == null)
|
||||
// {
|
||||
// itemList[index] = new InputFunctionClass();
|
||||
// }
|
||||
|
||||
// EnumField actionType = item.Q<EnumField>("ActionType");
|
||||
// TextField actionName = item.Q<TextField>("ActionName");
|
||||
// actionType.value = itemList[index].inputKeyType;
|
||||
// actionName.value = itemList[index].inputKeyName;
|
||||
// actionType.RegisterValueChangedCallback(evt =>
|
||||
// {
|
||||
// itemList[index].inputKeyType = (InputKeyType)evt.newValue;
|
||||
// });
|
||||
|
||||
// actionName.RegisterValueChangedCallback(evt =>
|
||||
// {
|
||||
// itemList[index].inputKeyName = evt.newValue;
|
||||
// });
|
||||
// }
|
||||
// };
|
||||
|
||||
// listView.fixedItemHeight = 90; //根据需要高度调整数值
|
||||
// listView.itemsSource = itemList;
|
||||
// listView.makeItem = makeItem;
|
||||
// listView.bindItem = bindItem;
|
||||
|
||||
// }
|
||||
|
||||
//}
|
15
client/Assets/Ether/Editor/Input/InputEditor.cs.meta
Normal file
15
client/Assets/Ether/Editor/Input/InputEditor.cs.meta
Normal file
@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 20e327c9f600a8c4782da1373b9fce62
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- m_ViewDataDictionary: {instanceID: 0}
|
||||
- m_VisualTreeAsset: {fileID: 9197481963319205126, guid: f709e8115a35ffc40aef21b8ba61c48a, type: 3}
|
||||
- inputEditorItem: {fileID: 9197481963319205126, guid: e51d256dd33335c459b8ca98544a00e2, type: 3}
|
||||
- styleSheet: {fileID: 7433441132597879392, guid: 66ba05d591f03bb4fa2ca4c50f26fab0, type: 3}
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
0
client/Assets/Ether/Editor/Input/InputEditor.uss
Normal file
0
client/Assets/Ether/Editor/Input/InputEditor.uss
Normal file
11
client/Assets/Ether/Editor/Input/InputEditor.uss.meta
Normal file
11
client/Assets/Ether/Editor/Input/InputEditor.uss.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 66ba05d591f03bb4fa2ca4c50f26fab0
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
||||
disableValidation: 0
|
9
client/Assets/Ether/Editor/Input/InputEditor.uxml
Normal file
9
client/Assets/Ether/Editor/Input/InputEditor.uxml
Normal file
@ -0,0 +1,9 @@
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
|
||||
<Style src="project://database/Assets/Ether/Editor/Input/InputEditor.uss?fileID=7433441132597879392&guid=66ba05d591f03bb4fa2ca4c50f26fab0&type=3#InputEditor" />
|
||||
<ui:VisualElement name="BtnList" style="flex-grow: 1; height: 50px; min-height: 50px; max-height: 50px; flex-direction: row; align-items: center; justify-content: center;">
|
||||
<ui:Button text="保存" parse-escape-sequences="true" display-tooltip-when-elided="true" name="SaveBtn" style="height: 37px; width: 33%; -unity-font: resource('Font/AlimamaDongFangDaKai'); -unity-font-definition: initial; font-size: 18px; margin-right: 0; margin-left: 0; padding-right: 6px; padding-left: 6px;" />
|
||||
<ui:Button text="还原" parse-escape-sequences="true" display-tooltip-when-elided="true" name="ResetBtn" style="height: 37px; width: 33%; -unity-font: resource('Font/AlimamaDongFangDaKai'); -unity-font-definition: initial; font-size: 18px; margin-left: 0; margin-right: 0;" />
|
||||
<ui:Button text="清空" parse-escape-sequences="true" display-tooltip-when-elided="true" name="ClearBtn" style="height: 37px; width: 33%; -unity-font: resource('Font/AlimamaDongFangDaKai'); -unity-font-definition: initial; font-size: 18px; margin-left: 0; margin-right: 0;" />
|
||||
</ui:VisualElement>
|
||||
<ui:ListView focusable="true" show-add-remove-footer="true" virtualization-method="FixedHeight" show-border="false" selection-type="Single" reorderable="false" show-bound-collection-size="true" show-alternating-row-backgrounds="All" name="ItemList" fixed-item-height="90" style="flex-grow: 1; flex-basis: auto; height: auto; max-height: initial; min-height: auto; -unity-font-definition: initial; -unity-font: resource('Font/AlimamaDongFangDaKai'); font-size: 30px;" />
|
||||
</ui:UXML>
|
10
client/Assets/Ether/Editor/Input/InputEditor.uxml.meta
Normal file
10
client/Assets/Ether/Editor/Input/InputEditor.uxml.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f709e8115a35ffc40aef21b8ba61c48a
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
4
client/Assets/Ether/Editor/Input/InputEditorItem.uxml
Normal file
4
client/Assets/Ether/Editor/Input/InputEditorItem.uxml
Normal file
@ -0,0 +1,4 @@
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
|
||||
<ui:EnumField label="事件类型" type="Ether.InputKeyType, Ether" name="ActionType" include-obsolete-values="true" style="flex-grow: 0; flex-shrink: 0; height: 44px; align-items: center; font-size: 16px; -unity-font: resource('Font/AlimamaDongFangDaKai'); -unity-font-definition: initial;" />
|
||||
<ui:TextField picking-mode="Ignore" label="事件名称" name="ActionName" style="font-size: 16px; -unity-font: resource('Font/AlimamaDongFangDaKai'); -unity-font-definition: initial; height: 37px; align-items: flex-start;" />
|
||||
</ui:UXML>
|
10
client/Assets/Ether/Editor/Input/InputEditorItem.uxml.meta
Normal file
10
client/Assets/Ether/Editor/Input/InputEditorItem.uxml.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e51d256dd33335c459b8ca98544a00e2
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
8
client/Assets/Ether/Editor/Tools.meta
Normal file
8
client/Assets/Ether/Editor/Tools.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eb540cbe63a7aa24587662b421cad1da
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
client/Assets/Ether/Editor/Tools/Build.meta
Normal file
8
client/Assets/Ether/Editor/Tools/Build.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 930c9a9b4060559489fd2cb8f6829393
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
49
client/Assets/Ether/Editor/Tools/Build/BuildEditor.cs
Normal file
49
client/Assets/Ether/Editor/Tools/Build/BuildEditor.cs
Normal file
@ -0,0 +1,49 @@
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public class BuildEditor
|
||||
{
|
||||
[MenuItem("打包/windows")]
|
||||
public static void BuildWindows()
|
||||
{
|
||||
List<string> sceneList = new List<string>();
|
||||
|
||||
for (int i = 0; i < EditorSceneManager.sceneCountInBuildSettings; i++)
|
||||
{
|
||||
string scenePath = SceneUtility.GetScenePathByBuildIndex(i);
|
||||
if (!string.IsNullOrEmpty(scenePath))
|
||||
{
|
||||
Debug.Log($"添加场景:{scenePath}");
|
||||
sceneList.Add(scenePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string projectRootPath = new DirectoryInfo(Application.dataPath).Parent.FullName;
|
||||
|
||||
if (Directory.Exists($"{projectRootPath}/Build/Windows/"))
|
||||
{
|
||||
Directory.Delete($"{projectRootPath}/Build/Windows/", true);
|
||||
}
|
||||
|
||||
BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions()
|
||||
{
|
||||
scenes = sceneList.ToArray(),
|
||||
target = BuildTarget.StandaloneWindows64,
|
||||
subtarget = (int)StandaloneBuildSubtarget.Player,
|
||||
locationPathName = $"{projectRootPath}/Build/Windows/client.exe",
|
||||
};
|
||||
BuildPipeline.BuildPlayer(buildPlayerOptions);
|
||||
Application.OpenURL($"{projectRootPath}/Build/Windows");
|
||||
Debug.Log("打包windows成功");
|
||||
}
|
||||
}
|
||||
}
|
11
client/Assets/Ether/Editor/Tools/Build/BuildEditor.cs.meta
Normal file
11
client/Assets/Ether/Editor/Tools/Build/BuildEditor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eb577864003f433429aae4414033c420
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
client/Assets/Ether/Editor/Tools/ExporterEditor.meta
Normal file
8
client/Assets/Ether/Editor/Tools/ExporterEditor.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f46615625cf602544bde3140a4881abe
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
45
client/Assets/Ether/Editor/Tools/ExporterEditor/Exporter.cs
Normal file
45
client/Assets/Ether/Editor/Tools/ExporterEditor/Exporter.cs
Normal file
@ -0,0 +1,45 @@
|
||||
/****************************************************
|
||||
文件: Exporter.cs
|
||||
作者: signing
|
||||
邮箱: 1982614048@qq.com
|
||||
日期: 2021/6/24 12:3:55
|
||||
功能: 导出UnityPackage
|
||||
*****************************************************/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
namespace Ether
|
||||
{
|
||||
public partial class Exporter
|
||||
{
|
||||
[MenuItem("工具/导出框架 UnityPackage", false, 2)]
|
||||
private static void MenuClicked()
|
||||
{
|
||||
var generatePackageName = GenerateUnityPackageName();
|
||||
EditorUtility.DisplayProgressBar("导出Ztrix UnityPackage", "正在导出UnityPackage,请耐心等待。。。", 0);
|
||||
ExportPackage("Assets/Ztrix", generatePackageName + ".unitypackage");
|
||||
EditorUtility.DisplayProgressBar("导出Ztrix UnityPackage", "导出UnityPackage完成!", 1);
|
||||
Debug.Log("导出UnityPackage完成!");
|
||||
OpenInFolder(Path.Combine(Application.dataPath, "../"));
|
||||
EditorUtility.ClearProgressBar();
|
||||
}
|
||||
|
||||
public static string GenerateUnityPackageName()
|
||||
{
|
||||
return "Ether_" + DateTime.Now.ToString("yyyyMMdd_HHmm");
|
||||
}
|
||||
|
||||
public static void ExportPackage(string assetPathName, string fileName)
|
||||
{
|
||||
AssetDatabase.ExportPackage(assetPathName, fileName, ExportPackageOptions.Recurse);
|
||||
}
|
||||
|
||||
public static void OpenInFolder(string folderPath)
|
||||
{
|
||||
Application.OpenURL("file:///" + folderPath);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81f3fd4085f68c948a4cb1b35e2ff7d9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
client/Assets/Ether/Editor/Tools/OpenCachePath.meta
Normal file
8
client/Assets/Ether/Editor/Tools/OpenCachePath.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb11be9001f595d489d49d256c06152e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,28 @@
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public class OpenCachePathEditor
|
||||
{
|
||||
static string persistentCachePath = Application.persistentDataPath;
|
||||
|
||||
[MenuItem("工具/打开缓存路径", false, 1)]
|
||||
public static void OpenCachePath()
|
||||
{
|
||||
if (Directory.Exists(persistentCachePath))
|
||||
{
|
||||
Application.OpenURL(persistentCachePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"缓存路径:{persistentCachePath} 不存在,为您打开上级目录");
|
||||
Application.OpenURL(persistentCachePath + "/../");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68ffab3d9647cda46bced1508bc0643b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
client/Assets/Ether/Editor/Tools/SceneEditor.meta
Normal file
8
client/Assets/Ether/Editor/Tools/SceneEditor.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 92cf5753b56a59c4e91990acd754aac8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,72 @@
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEditor.ShortcutManagement;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public class JumpSceneEditor
|
||||
{
|
||||
[MenuItem("工具/场景/打开Boot场景")]
|
||||
[Shortcut("打开Boot场景", KeyCode.F5)]
|
||||
public static void JumpBootScene()
|
||||
{
|
||||
// 此处替换为您的场景名称
|
||||
string sceneName = "Boot";
|
||||
|
||||
// 检查场景是否已经加载
|
||||
string scenePath = SceneExists(sceneName);
|
||||
if (string.IsNullOrEmpty(scenePath))
|
||||
{
|
||||
// 如果场景未加载,使用MenuItem的快捷方式加载场景
|
||||
EditorApplication.ExecuteMenuItem("File/Build Settings...");
|
||||
// 这里可以添加代码自动选中您的启动场景并点击"Load Scene"按钮
|
||||
// 例如:
|
||||
// var sceneList = (SerializedObject)FindObjectOfType(typeof(SerializedObject));
|
||||
// sceneList.Update();
|
||||
// var sceneIndex = sceneList.FindProperty("sceneList");
|
||||
// sceneIndex.InsertArrayElementAtIndex(0); // 在列表开头添加新场景
|
||||
// sceneIndex.GetArrayElementAtIndex(0).objectReferenceValue = AssetDatabase.LoadMainAssetAtPath("Assets/YourScene.unity");
|
||||
// sceneList.ApplyModifiedProperties();
|
||||
// EditorApplication.ExecuteMenuItem("File/Open Scene");
|
||||
}
|
||||
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
// 打开或激活场景
|
||||
if (EditorSceneManager.GetActiveScene().path != scenePath)
|
||||
{
|
||||
EditorSceneManager.OpenScene(scenePath, OpenSceneMode.Single);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorApplication.EnterPlaymode();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorApplication.ExitPlaymode();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static string SceneExists(string sceneName)
|
||||
{
|
||||
// 检查场景是否存在
|
||||
foreach (var scene in EditorBuildSettings.scenes)
|
||||
{
|
||||
string path = scene.path;
|
||||
string name = Path.GetFileNameWithoutExtension(path);
|
||||
if (name == sceneName)
|
||||
{
|
||||
return path;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fdd55f0c5932f1f4193a190c6a175384
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
130
client/Assets/Ether/Editor/Tools/SceneEditor/SceneEditor.cs
Normal file
130
client/Assets/Ether/Editor/Tools/SceneEditor/SceneEditor.cs
Normal file
@ -0,0 +1,130 @@
|
||||
|
||||
using Ether;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEditor.ShortcutManagement;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class SceneEditor : EditorWindow
|
||||
{
|
||||
[SerializeField]
|
||||
private VisualTreeAsset m_VisualTreeAsset = default;
|
||||
|
||||
[SerializeField]
|
||||
private StyleSheet styleSheet = default;
|
||||
|
||||
static SceneEditor instance;
|
||||
|
||||
[MenuItem("工具/场景/场景设置")]
|
||||
[Shortcut("场景设置", KeyCode.F6)]
|
||||
public static void ShowExample()
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = GetWindow<SceneEditor>();
|
||||
instance.titleContent = new GUIContent("场景设置");
|
||||
}
|
||||
else
|
||||
{
|
||||
instance.Close();
|
||||
instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
VisualElement root;
|
||||
|
||||
string bootScenePath;
|
||||
Button bootBtn;
|
||||
DropdownField cutSceneDropDown;
|
||||
Dictionary<string, string> sceneDic = new Dictionary<string, string>();
|
||||
|
||||
public void CreateGUI()
|
||||
{
|
||||
root = rootVisualElement;
|
||||
|
||||
m_VisualTreeAsset.CloneTree(root);
|
||||
root.styleSheets.Add(styleSheet);
|
||||
|
||||
bootScenePath = JumpSceneEditor.SceneExists("Boot");
|
||||
|
||||
bootBtn = root.Q<VisualElement>("Root").Q<Button>("BootBtn");
|
||||
bootBtn.clicked += () =>
|
||||
{
|
||||
JumpSceneEditor.JumpBootScene();
|
||||
};
|
||||
|
||||
Button selectSceneBtn = root.Q<VisualElement>("Root").Q<Button>("SelectSceneBtn");
|
||||
selectSceneBtn.clicked += () =>
|
||||
{
|
||||
SceneAsset asset = AssetDatabase.LoadAssetAtPath<SceneAsset>(sceneDic[cutSceneDropDown.value]);
|
||||
|
||||
EditorUtility.FocusProjectWindow();
|
||||
EditorGUIUtility.PingObject(asset);
|
||||
Selection.activeObject = asset;
|
||||
};
|
||||
|
||||
SetDropdown();
|
||||
}
|
||||
|
||||
private void SetDropdown()
|
||||
{
|
||||
cutSceneDropDown = root.Q<VisualElement>("Root").Q<DropdownField>("CutSceneDropDown");
|
||||
|
||||
int showIndex = 0;
|
||||
var scenes = EditorBuildSettings.scenes;
|
||||
//初始化数组
|
||||
string[] sceneNames = new string[scenes.Length];
|
||||
|
||||
for (int i = 0; i < sceneNames.Length; i++)
|
||||
{
|
||||
string path = scenes[i].path;
|
||||
|
||||
string sceneName = Path.GetFileNameWithoutExtension(path);
|
||||
sceneDic.Add(sceneName, path);
|
||||
|
||||
sceneNames[i] = sceneName;
|
||||
if (Path.GetFileNameWithoutExtension(EditorSceneManager.GetActiveScene().path) == sceneName)
|
||||
{
|
||||
showIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
cutSceneDropDown.choices = sceneNames.ToList();
|
||||
cutSceneDropDown.index = showIndex;
|
||||
cutSceneDropDown.RegisterValueChangedCallback(evt =>
|
||||
{
|
||||
string sceneName = evt.newValue;
|
||||
EditorSceneManager.OpenScene(sceneDic[sceneName], OpenSceneMode.Single);
|
||||
});
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
if (string.IsNullOrEmpty(bootScenePath) || bootBtn == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
// 打开或激活场景
|
||||
if (EditorSceneManager.GetActiveScene().path != bootScenePath)
|
||||
{
|
||||
bootBtn.text = "返回Boot场景";
|
||||
}
|
||||
else
|
||||
{
|
||||
bootBtn.text = "运行游戏";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bootBtn.text = "退出游戏";
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b4a1471d4d2764543a5ac770f1b7b251
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- m_ViewDataDictionary: {instanceID: 0}
|
||||
- m_VisualTreeAsset: {fileID: 9197481963319205126, guid: 4979e78cf344b5e458b3012c2fac286c, type: 3}
|
||||
- styleSheet: {fileID: 7433441132597879392, guid: f03517f3eb081dd49b93d060d345d3c6, type: 3}
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,5 @@
|
||||
.custom-label {
|
||||
font-size: 20px;
|
||||
-unity-font-style: bold;
|
||||
color: rgb(68, 138, 255);
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f03517f3eb081dd49b93d060d345d3c6
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
||||
disableValidation: 0
|
@ -0,0 +1,8 @@
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
|
||||
<Style src="project://database/Assets/Ether/Editor/Tools/SceneEditor/SceneEditor.uss?fileID=7433441132597879392&guid=f03517f3eb081dd49b93d060d345d3c6&type=3#SceneEditor" />
|
||||
<ui:VisualElement name="Root" style="flex-grow: 1;">
|
||||
<ui:Button text="返回Boot场景" parse-escape-sequences="true" display-tooltip-when-elided="true" name="BootBtn" style="height: 55px; -unity-font-definition: initial; -unity-font: resource('Font/AlimamaDongFangDaKai'); font-size: 24px; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px;" />
|
||||
<ui:Button text="选择当前场景资源" parse-escape-sequences="true" display-tooltip-when-elided="true" name="SelectSceneBtn" style="height: 36px; -unity-font-definition: initial; -unity-font: resource('Font/AlimamaDongFangDaKai'); font-size: 20px; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px;" />
|
||||
<ui:DropdownField label="切换场景" index="-1" choices="System.Collections.Generic.List`1[System.String]" name="CutSceneDropDown" style="height: 68px; align-self: auto; align-items: center; justify-content: flex-start; -unity-font: resource('Font/AlimamaDongFangDaKai'); -unity-font-definition: initial; font-size: 24px; margin-right: 12px; margin-left: 13px;" />
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4979e78cf344b5e458b3012c2fac286c
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
8
client/Assets/Ether/Editor/Tools/SelectEditor.meta
Normal file
8
client/Assets/Ether/Editor/Tools/SelectEditor.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f5240a443c8db5544a9fac9d46d78103
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,31 @@
|
||||
/****************************************************
|
||||
文件: SelectionCount.cs
|
||||
作者: signing
|
||||
邮箱: 1982614048@qq.com
|
||||
日期: 2021/6/25 9:22:19
|
||||
功能: 显示选中物体个数
|
||||
*****************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public class SelectionCount
|
||||
{
|
||||
[MenuItem("工具/获取选择物体个数 %#e", false, 3)]
|
||||
public static void GetSelectionCount()
|
||||
{
|
||||
//选中的所有物体
|
||||
GameObject[] objs = Selection.gameObjects;
|
||||
Debug.Log(string.Format("已选择 {0} 个物体", objs.Length));
|
||||
}
|
||||
|
||||
[MenuItem("工具/获取选择物体个数 %#e", true, 3)]
|
||||
public static bool GetSelectionCount2()
|
||||
{
|
||||
return Selection.activeTransform != null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8125eaab6e25f79409ec46abf401bbcf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
client/Assets/Ether/Editor/Tools/SelectPrefabEditor.meta
Normal file
8
client/Assets/Ether/Editor/Tools/SelectPrefabEditor.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4352a854bd5093e4caf41d6f007a14be
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,56 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
public class SelectedPrefabTool : EditorWindow
|
||||
{
|
||||
[MenuItem("工具/预制体路径查找工具", false, 4)]
|
||||
public static void ShowWindow()
|
||||
{
|
||||
EditorWindow.GetWindow(typeof(SelectedPrefabTool), false, "预制体路径查找工具");
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
GameObject selectedPrefab = Selection.activeGameObject;
|
||||
if (selectedPrefab != null && PrefabUtility.IsPartOfAnyPrefab(selectedPrefab))
|
||||
{
|
||||
GUILayout.Label("当前选中预制体: " + GetPrefabPath(selectedPrefab));
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
GUILayout.Label("该预制体子物体路径:");
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
Transform[] childs = selectedPrefab.GetComponentsInChildren<Transform>();
|
||||
|
||||
foreach (Transform child in childs)
|
||||
{
|
||||
GUILayout.Label(GetChildPath(child));
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Label("当前没有选中预制体!");
|
||||
}
|
||||
}
|
||||
|
||||
private string GetPrefabPath(GameObject prefab)
|
||||
{
|
||||
string path = AssetDatabase.GetAssetPath(prefab);
|
||||
return path;
|
||||
}
|
||||
|
||||
private string GetChildPath(Transform child)
|
||||
{
|
||||
string path = child.name;
|
||||
Transform parent = child.parent;
|
||||
while (parent != null)
|
||||
{
|
||||
path = parent.name + "/" + path;
|
||||
parent = parent.parent;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6b0e4c8ce8fd03346aa1f7bde4cc6a69
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
20
client/Assets/Ether/Ether.asmdef
Normal file
20
client/Assets/Ether/Ether.asmdef
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "Ether",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f",
|
||||
"GUID:75469ad4d38634e559750d17036d5f7c",
|
||||
"GUID:4c25c05f410a3a447a75c3b0909152ef",
|
||||
"GUID:237cbb5df8d2d4f479a9e1f12e52df95",
|
||||
"GUID:2a81c6962524d424a8ef5072bd3b0fa0"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
7
client/Assets/Ether/Ether.asmdef.meta
Normal file
7
client/Assets/Ether/Ether.asmdef.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 789b9b4ca718ab343bc113cff404bcce
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
client/Assets/Ether/Package.meta
Normal file
8
client/Assets/Ether/Package.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a33213df4e6e4b4ca2e9b220805714a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
client/Assets/Ether/Package/EtherNode.meta
Normal file
8
client/Assets/Ether/Package/EtherNode.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c4d57efbeecc04f4a97dd6e8a589b158
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
client/Assets/Ether/Package/EtherNode/Editor.meta
Normal file
8
client/Assets/Ether/Package/EtherNode/Editor.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 363a43838168ae248967611f9f0fd9c6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"reference": "GUID:2f716c3cfa97f8d4bb5abb0809a10755"
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7bf47b06cb58f34499d0b6dee1f27a4c
|
||||
AssemblyDefinitionReferenceImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc323e80903be3d4f8acc7f0b77cc425
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,103 @@
|
||||
using Animancer.Editor;
|
||||
using Ether;
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Callbacks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class EtherNodeEditor : EditorWindow
|
||||
{
|
||||
static EtherNodeEditor curWindow;
|
||||
|
||||
public EtherNodeGraphViewer nodeGraphViewer;
|
||||
public InspectorViewer inspectorViewer;
|
||||
|
||||
[SerializeField]
|
||||
private VisualTreeAsset m_VisualTreeAsset = default;
|
||||
|
||||
private EtherNodeGraph selectedGraph;
|
||||
|
||||
[MenuItem("配置/EtherNode编辑器")]
|
||||
public static void ShowExample()
|
||||
{
|
||||
curWindow = GetWindow<EtherNodeEditor>();
|
||||
curWindow.titleContent = new GUIContent("EtherNode编辑器");
|
||||
}
|
||||
|
||||
[OnOpenAsset]
|
||||
public static bool OnOpenAsset(int instanceId, int line)
|
||||
{
|
||||
if (Selection.activeObject is EtherNodeGraph)
|
||||
{
|
||||
if (curWindow != null)
|
||||
{
|
||||
curWindow.Close();
|
||||
curWindow = null;
|
||||
}
|
||||
ShowExample();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
VisualElement root;
|
||||
public void CreateGUI()
|
||||
{
|
||||
// Each editor window contains a root VisualElement object
|
||||
root = rootVisualElement;
|
||||
|
||||
m_VisualTreeAsset.CloneTree(root);
|
||||
|
||||
VisualElement inspector = root.Q<VisualElement>("Root").Q<VisualElement>("Inspector");
|
||||
|
||||
nodeGraphViewer = root.Q<EtherNodeGraphViewer>();
|
||||
inspectorViewer = root.Q<InspectorViewer>();
|
||||
nodeGraphViewer.OnNodeSelected = OnNodeSelected;
|
||||
if (!selectedGraph)
|
||||
{
|
||||
selectedGraph = Selection.activeObject as EtherNodeGraph;
|
||||
}
|
||||
//OnSelectionChange();
|
||||
if (selectedGraph)
|
||||
{
|
||||
nodeGraphViewer.PopulateView(selectedGraph);
|
||||
EtherNodeGraphWindowTitleAttribute attr = selectedGraph.GetType().GetAttribute<EtherNodeGraphWindowTitleAttribute>();
|
||||
if (attr != null)
|
||||
{
|
||||
titleContent = new GUIContent(attr.title);
|
||||
}
|
||||
}
|
||||
|
||||
Label title = root.Q<VisualElement>("Root").Q<VisualElement>("Inspector").Q<Label>("Title");
|
||||
title.text = selectedGraph ? selectedGraph.name : "没有选择对应的Graph";
|
||||
|
||||
// 添加点击事件
|
||||
title.RegisterCallback<ClickEvent>(evt =>
|
||||
{
|
||||
if (selectedGraph)
|
||||
{
|
||||
Selection.activeObject = selectedGraph;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void OnNodeSelected(EtherNodeView view)
|
||||
{
|
||||
inspectorViewer.UpdateSelection(view);
|
||||
}
|
||||
|
||||
//private void OnSelectionChange()
|
||||
//{
|
||||
// EtherNodeGraph tree = Selection.activeObject as EtherNodeGraph;
|
||||
// if (tree)
|
||||
// {
|
||||
// nodeTreeViewer.PopulateView(tree);
|
||||
// }
|
||||
//}
|
||||
|
||||
//private void OnInspectorUpdate()
|
||||
//{
|
||||
// nodeTreeViewer?.UpdateNodeStates();
|
||||
//}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4acc7200530bbf34fb8ba3ce2890809e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- m_VisualTreeAsset: {fileID: 9197481963319205126, guid: a16f85c1b2021c14295eb1cf3455f268, type: 3}
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,192 @@
|
||||
|
||||
using Sirenix.Utilities;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Experimental.GraphView;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
/// <summary>
|
||||
/// 节点视图底图
|
||||
/// </summary>
|
||||
public class EtherNodeGraphViewer : GraphView
|
||||
{
|
||||
public Action<EtherNodeView> OnNodeSelected;
|
||||
|
||||
public new class UxmlFactory : UxmlFactory<EtherNodeGraphViewer, GraphView.UxmlTraits> { }
|
||||
|
||||
EtherNodeGraph graph;
|
||||
|
||||
public EtherNodeGraph Graph { get { return graph; } }
|
||||
|
||||
public EtherNodeGraphViewer()
|
||||
{
|
||||
Insert(0, new GridBackground());
|
||||
ContentZoomer contentZoomer = new ContentZoomer();
|
||||
contentZoomer.minScale = 0.15f;
|
||||
contentZoomer.maxScale = 2f;
|
||||
this.AddManipulator(contentZoomer); //缩放
|
||||
this.AddManipulator(new ContentDragger()); //拖拽
|
||||
this.AddManipulator(new SelectionDragger()); //点击拖拽
|
||||
this.AddManipulator(new RectangleSelector()); //框选
|
||||
var styleSheet = AssetDatabase.LoadAssetAtPath<StyleSheet>("Assets/Ether/Package/EtherNode/Editor/UI/NodeTreeViewer.uss");
|
||||
styleSheets.Add(styleSheet);
|
||||
Undo.undoRedoPerformed += OnUndoRedo;
|
||||
|
||||
EventCenter.AddListener("EtherNodeEditorDeleteNode", () => { PopulateView(graph); });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 右键点击菜单
|
||||
/// </summary>
|
||||
public override void BuildContextualMenu(ContextualMenuPopulateEvent evt)
|
||||
{
|
||||
evt.menu.ClearItems();
|
||||
//var types = TypeCache.GetTypesDerivedFrom(tree.GetNodeType());
|
||||
Type nodeType = graph.GetNodeType();
|
||||
var types = CommonTools.GetChildTypes(nodeType);
|
||||
|
||||
Vector2 createPosition = (evt.currentTarget as VisualElement).ChangeCoordinatesTo(contentViewContainer, evt.localMousePosition);
|
||||
|
||||
List<(EtherNodeMenuNameAttribute, Type)> list = new List<(EtherNodeMenuNameAttribute, Type)>();
|
||||
foreach (var type in types)
|
||||
{
|
||||
if (!type.IsAbstract)
|
||||
{
|
||||
EtherNodeMenuNameAttribute attr = type.GetAttribute<EtherNodeMenuNameAttribute>();
|
||||
if (attr == null)
|
||||
{
|
||||
attr = new EtherNodeMenuNameAttribute(type.Name, 999);
|
||||
}
|
||||
list.Add((attr, type));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
list.Sort((a, b) =>
|
||||
{
|
||||
return b.Item1.order.CompareTo(a.Item1.order);
|
||||
});
|
||||
|
||||
if (list.Count > 0)
|
||||
{
|
||||
foreach (var tuple in list)
|
||||
{
|
||||
evt.menu.AppendAction($"创建{tuple.Item1.menuName}", (a) => CreateNode(tuple.Item2, createPosition));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnUndoRedo()
|
||||
{
|
||||
PopulateView(graph);
|
||||
AssetDatabase.SaveAssets();
|
||||
}
|
||||
|
||||
private void CreateNode(Type type, Vector2 createPos)
|
||||
{
|
||||
if (graph == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EtherNode node = graph.CreateNode(type, createPos);
|
||||
CreateNodeView(node);
|
||||
}
|
||||
|
||||
private void CreateNodeView(EtherNode node)
|
||||
{
|
||||
EtherNodeView nodeView = new EtherNodeView(node);
|
||||
nodeView.OnNodeSelected = OnNodeSelected;
|
||||
EtherNodeGraphViewer nodeGraphViewer = this;
|
||||
AddElement(nodeView);
|
||||
Undo.undoRedoPerformed += () =>
|
||||
{
|
||||
PopulateView(graph);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
internal void PopulateView(EtherNodeGraph tree)
|
||||
{
|
||||
this.graph = tree;
|
||||
graphViewChanged -= OnGraphViewChange;
|
||||
DeleteElements(graphElements);
|
||||
graphViewChanged += OnGraphViewChange;
|
||||
tree.allNodeDic.ForEach(n => { CreateNodeView(n.Value); });
|
||||
tree.allNodeDic.ForEach(n =>
|
||||
{
|
||||
var children = tree.GetChildren(n.Value);
|
||||
children.ForEach(c =>
|
||||
{
|
||||
EtherNodeView parentView = FindNodeView(n.Value);
|
||||
EtherNodeView childView = FindNodeView(c);
|
||||
Edge edge = parentView.output.ConnectTo(childView.input);
|
||||
AddElement(edge);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private GraphViewChange OnGraphViewChange(GraphViewChange graphViewChange)
|
||||
{
|
||||
if (graphViewChange.elementsToRemove != null)
|
||||
{
|
||||
graphViewChange.elementsToRemove.ForEach(elem =>
|
||||
{
|
||||
EtherNodeView nodeView = elem as EtherNodeView;
|
||||
if (nodeView != null)
|
||||
{
|
||||
graph.DeleteNode(nodeView.node);
|
||||
}
|
||||
|
||||
Edge edge = elem as Edge;
|
||||
if (edge != null)
|
||||
{
|
||||
EtherNodeView parentView = edge.output.node as EtherNodeView;
|
||||
EtherNodeView childView = edge.input.node as EtherNodeView;
|
||||
graph.RemoveChild(parentView.node, childView.node);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (graphViewChange.edgesToCreate != null)
|
||||
{
|
||||
graphViewChange.edgesToCreate.ForEach(edge =>
|
||||
{
|
||||
EtherNodeView parentView = edge.output.node as EtherNodeView;
|
||||
EtherNodeView childView = edge.input.node as EtherNodeView;
|
||||
graph.AddChild(parentView.node, childView.node);
|
||||
});
|
||||
}
|
||||
|
||||
return graphViewChange;
|
||||
}
|
||||
|
||||
private EtherNodeView FindNodeView(EtherNode node)
|
||||
{
|
||||
return GetNodeByGuid(node.guid) as EtherNodeView;
|
||||
}
|
||||
|
||||
public override List<Port> GetCompatiblePorts(Port startPort, NodeAdapter nodeAdapter)
|
||||
{
|
||||
return ports.ToList().Where(endport => endport.direction != startPort.direction && endport.node != startPort.node).ToList();
|
||||
}
|
||||
|
||||
//public void UpdateNodeStates()
|
||||
//{
|
||||
// nodes.ForEach(n =>
|
||||
// {
|
||||
// EtherNodeView view = n as EtherNodeView;
|
||||
// view.SetNodeState();
|
||||
// });
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b77be85ac024dcd4a9e0df55abdf341d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,159 @@
|
||||
|
||||
using Animancer.Editor;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.Plastic.Antlr3.Runtime.Tree;
|
||||
using Unity.VisualScripting.Antlr3.Runtime.Tree;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Experimental.GraphView;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public class EtherNodeView : Node
|
||||
{
|
||||
public EtherNode node;
|
||||
|
||||
public Port input;
|
||||
|
||||
public Port output;
|
||||
|
||||
public Action<EtherNodeView> OnNodeSelected;
|
||||
|
||||
InspectorViewer inspectorViewer;
|
||||
|
||||
public EtherNodeView(EtherNode node) : base("Assets/Ether/Package/EtherNode/Editor/UI/NodeView.uxml")
|
||||
{
|
||||
this.node = node;
|
||||
this.title = node.nodeName;
|
||||
this.viewDataKey = node.guid;
|
||||
style.left = node.position.x;
|
||||
style.top = node.position.y;
|
||||
CreateInputPorts();
|
||||
CreateOutputPorts();
|
||||
inspectorViewer = this.Q<InspectorViewer>();
|
||||
inspectorViewer.UpdateSelection(this);
|
||||
Button refreshBtn = new Button();
|
||||
refreshBtn.name = "RefreshBtn";
|
||||
refreshBtn.text = "刷新节点";
|
||||
refreshBtn.clicked += () =>
|
||||
{
|
||||
this.title = node.nodeName;
|
||||
};
|
||||
inspectorViewer.Add(refreshBtn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 右键点击菜单
|
||||
/// </summary>
|
||||
public override void BuildContextualMenu(ContextualMenuPopulateEvent evt)
|
||||
{
|
||||
evt.menu.ClearItems();
|
||||
EtherNodeMenuNameAttribute menuNameAttr = node.GetType().GetAttribute<EtherNodeMenuNameAttribute>();
|
||||
|
||||
if (menuNameAttr != null)
|
||||
{
|
||||
evt.menu.AppendAction($"删除{menuNameAttr.menuName}", (a) => { DeleteNode(); });
|
||||
}
|
||||
// 阻止事件冒泡
|
||||
evt.StopPropagation();
|
||||
|
||||
}
|
||||
|
||||
private void DeleteNode()
|
||||
{
|
||||
EtherNodeGraphViewer graph = GetFirstAncestorOfType<EtherNodeGraphViewer>();
|
||||
if (graph != null)
|
||||
{
|
||||
graph.RemoveElement(this);
|
||||
graph.Graph.DeleteNode(node);
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateInputPorts()
|
||||
{
|
||||
Type nodeType = node.GetType();
|
||||
if (nodeType.IsSubclassOf(typeof(EtherMultiNode)))
|
||||
{
|
||||
input = InstantiatePort(Orientation.Vertical, Direction.Input, Port.Capacity.Multi, typeof(bool));
|
||||
}
|
||||
else if (nodeType.IsSubclassOf(typeof(EtherSingleNode)))
|
||||
{
|
||||
input = InstantiatePort(Orientation.Vertical, Direction.Input, Port.Capacity.Single, typeof(bool));
|
||||
}
|
||||
else
|
||||
{
|
||||
input = InstantiatePort(Orientation.Vertical, Direction.Input, Port.Capacity.Multi, typeof(bool));
|
||||
}
|
||||
if (input != null)
|
||||
{
|
||||
input.portName = "";
|
||||
input.style.flexDirection = FlexDirection.Column;
|
||||
inputContainer.Add(input);
|
||||
|
||||
}
|
||||
}
|
||||
private void CreateOutputPorts()
|
||||
{
|
||||
Type nodeType = node.GetType();
|
||||
if (nodeType.IsSubclassOf(typeof(EtherMultiNode)))
|
||||
{
|
||||
output = InstantiatePort(Orientation.Vertical, Direction.Output, Port.Capacity.Multi, typeof(bool));
|
||||
}
|
||||
else if (nodeType.IsSubclassOf(typeof(EtherSingleNode)))
|
||||
{
|
||||
output = InstantiatePort(Orientation.Vertical, Direction.Output, Port.Capacity.Single, typeof(bool));
|
||||
}
|
||||
else
|
||||
{
|
||||
output = InstantiatePort(Orientation.Vertical, Direction.Output, Port.Capacity.Multi, typeof(bool));
|
||||
}
|
||||
if (output != null)
|
||||
{
|
||||
output.portName = "";
|
||||
output.style.flexDirection = FlexDirection.ColumnReverse;
|
||||
outputContainer.Add(output);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSelected()
|
||||
{
|
||||
base.OnSelected();
|
||||
OnNodeSelected?.Invoke(this);
|
||||
Selection.activeObject = node;
|
||||
}
|
||||
|
||||
public override void SetPosition(Rect newPos)
|
||||
{
|
||||
Undo.RecordObject(node, "Node Tree (SetPosition)");
|
||||
base.SetPosition(newPos);
|
||||
node.position.x = newPos.x;
|
||||
node.position.y = newPos.y;
|
||||
EditorUtility.SetDirty(node);
|
||||
}
|
||||
|
||||
//public void SetNodeState()
|
||||
//{
|
||||
// RemoveFromClassList("running");
|
||||
// if (Application.isPlaying)
|
||||
// {
|
||||
// switch (node.state)
|
||||
// {
|
||||
// case EtherNode.State.Running:
|
||||
// if (node.started)
|
||||
// {
|
||||
// AddToClassList("running");
|
||||
// }
|
||||
// break;
|
||||
// case EtherNode.State.Waiting:
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4f892e423e109524eb47079a24b96ae1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
client/Assets/Ether/Package/EtherNode/Editor/UI.meta
Normal file
8
client/Assets/Ether/Package/EtherNode/Editor/UI.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dad331c9c31fa1d4ca790fce576f590b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,5 @@
|
||||
.custom-label {
|
||||
font-size: 20px;
|
||||
-unity-font-style: bold;
|
||||
color: rgb(68, 138, 255);
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe51ba4de39a7c048a97b7d0f5f858dc
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
||||
disableValidation: 0
|
@ -0,0 +1,11 @@
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
|
||||
<Ether.SplitViewer name="Root" fixed-pane-initial-dimension="300" style="flex-direction: column; white-space: nowrap; align-items: auto; flex-shrink: 1; flex-grow: 1;">
|
||||
<ui:VisualElement name="Inspector" style="flex-grow: 1;">
|
||||
<ui:Label tabindex="-1" text="Inspector" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Title" style="background-color: rgba(40, 40, 40, 0); -unity-font: resource('Font/AlimamaDongFangDaKai'); -unity-font-definition: initial; font-size: 18px; min-height: 30px; justify-content: flex-start; padding-top: 2px; padding-right: 0; padding-bottom: 0; padding-left: 5px; border-bottom-color: rgb(79, 78, 78); border-bottom-width: 1px;" />
|
||||
<Ether.InspectorViewer name="InspectorViewer" style="flex-grow: 1;" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="ShowNodeView" style="flex-grow: 1;">
|
||||
<Ether.EtherNodeGraphViewer focusable="true" name="EtherNodeGraphViewer" style="flex-grow: 1;" />
|
||||
</ui:VisualElement>
|
||||
</Ether.SplitViewer>
|
||||
</ui:UXML>
|
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a16f85c1b2021c14295eb1cf3455f268
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
@ -0,0 +1,6 @@
|
||||
GridBackground{
|
||||
--grid-background-color: rgb(40,40,40);
|
||||
--line-color: rgba(193,196,192,0.1);
|
||||
--thick-line-color: rgba(193,196,192,0.1);
|
||||
--spacing: 15;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c3f0b89ac95e6aa48910d13c9da3225b
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
||||
disableValidation: 0
|
130
client/Assets/Ether/Package/EtherNode/Editor/UI/NodeView.uss
Normal file
130
client/Assets/Ether/Package/EtherNode/Editor/UI/NodeView.uss
Normal file
@ -0,0 +1,130 @@
|
||||
#input {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-grow: 1;
|
||||
padding-top: 0;
|
||||
max-height: 40px;
|
||||
border-bottom-color: rgb(125, 125, 125);
|
||||
border-bottom-width: 0;
|
||||
padding-bottom: 0;
|
||||
border-top-width: 0;
|
||||
border-right-width: 0;
|
||||
border-left-width: 0;
|
||||
min-height: 40px;
|
||||
height: 40px;
|
||||
width: 350px;
|
||||
max-width: 350px;
|
||||
min-width: 350px;
|
||||
}
|
||||
|
||||
#output {
|
||||
flex-grow: 0;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-top-color: rgb(126, 126, 126);
|
||||
border-top-width: 0;
|
||||
border-right-width: 0;
|
||||
border-bottom-width: 0;
|
||||
border-left-width: 0;
|
||||
max-height: 40px;
|
||||
min-height: 20px;
|
||||
max-width: 100%;
|
||||
width: 100%;
|
||||
min-width: 100%;
|
||||
padding-top: 0;
|
||||
padding-right: 0;
|
||||
padding-bottom: 0;
|
||||
padding-left: 0;
|
||||
overflow: visible;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#BackGround {
|
||||
flex-grow: 1;
|
||||
border-left-color: rgb(32, 32, 32);
|
||||
border-right-color: rgb(32, 32, 32);
|
||||
border-top-color: rgb(32, 32, 32);
|
||||
border-bottom-color: rgb(32, 32, 32);
|
||||
background-color: rgb(56, 56, 56);
|
||||
border-top-width: 2px;
|
||||
border-right-width: 2px;
|
||||
border-bottom-width: 2px;
|
||||
border-left-width: 2px;
|
||||
border-top-left-radius: 5px;
|
||||
border-top-right-radius: 5px;
|
||||
border-bottom-right-radius: 5px;
|
||||
border-bottom-left-radius: 5px;
|
||||
padding-top: 15px;
|
||||
padding-right: 10px;
|
||||
padding-bottom: 15px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
:hover > #BackGround {
|
||||
border-top-width: 3px;
|
||||
border-right-width: 3px;
|
||||
border-bottom-width: 3px;
|
||||
border-left-width: 3px;
|
||||
border-left-color: rgb(217, 217, 217);
|
||||
border-right-color: rgb(217, 217, 217);
|
||||
border-top-color: rgb(217, 217, 217);
|
||||
border-bottom-color: rgb(217, 217, 217);
|
||||
}
|
||||
|
||||
:selected > #BackGround {
|
||||
border-left-color: rgb(217, 217, 217);
|
||||
border-right-color: rgb(217, 217, 217);
|
||||
border-top-color: rgb(217, 217, 217);
|
||||
border-bottom-color: rgb(217, 217, 217);
|
||||
border-top-width: 3px;
|
||||
border-right-width: 3px;
|
||||
border-bottom-width: 3px;
|
||||
border-left-width: 3px;
|
||||
}
|
||||
|
||||
#title-label {
|
||||
-unity-font: resource('Font/AlimamaDongFangDaKai');
|
||||
-unity-font-definition: initial;
|
||||
-unity-text-align: middle-center;
|
||||
font-size: 16px;
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 10px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 0;
|
||||
margin-right: 0;
|
||||
margin-left: 0;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
#InspectorViewer {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
#Content {
|
||||
border-left-color: rgb(81, 81, 81);
|
||||
border-right-color: rgb(81, 81, 81);
|
||||
border-top-color: rgb(81, 81, 81);
|
||||
border-bottom-color: rgb(81, 81, 81);
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
padding-right: 15px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
.running#NodeState {
|
||||
border-left-color: rgb(15, 236, 3);
|
||||
border-right-color: rgb(15, 236, 3);
|
||||
border-top-color: rgb(15, 236, 3);
|
||||
border-bottom-color: rgb(15, 236, 3);
|
||||
border-top-width: 2px;
|
||||
border-right-width: 2px;
|
||||
border-bottom-width: 2px;
|
||||
border-left-width: 2px;
|
||||
border-top-left-radius: 5px;
|
||||
border-top-right-radius: 5px;
|
||||
border-bottom-right-radius: 5px;
|
||||
border-bottom-left-radius: 5px;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48c060da4fae30d4fba178920c5a0673
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
||||
disableValidation: 0
|
@ -0,0 +1,12 @@
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="True">
|
||||
<Style src="project://database/Assets/Ether/Package/EtherNode/Editor/UI/NodeView.uss?fileID=7433441132597879392&guid=48c060da4fae30d4fba178920c5a0673&type=3#NodeView" />
|
||||
<ui:VisualElement name="BackGround">
|
||||
<ui:VisualElement name="input" />
|
||||
<ui:VisualElement name="Content" style="flex-grow: 1;">
|
||||
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" name="title-label" style="margin-bottom: 0;" />
|
||||
<Ether.InspectorViewer name="InspectorViewer" style="flex-grow: 1;" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="output" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="NodeState" style="flex-grow: 1; position: absolute;" />
|
||||
</ui:UXML>
|
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6ae96967fbf413547978739fb0bfe75c
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
8
client/Assets/Ether/Package/EtherNode/Runtime.meta
Normal file
8
client/Assets/Ether/Package/EtherNode/Runtime.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32d108301d065844884396fbc1b200e0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
client/Assets/Ether/Package/EtherNode/Runtime/Core.meta
Normal file
8
client/Assets/Ether/Package/EtherNode/Runtime/Core.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aac044086ab514045a222db4d3ac0cde
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b28f980c047dcc478bbe4a389e4e419
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,12 @@
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public class EtherMultiNode : EtherNode
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba27abb7f3ce51944b4222d040e77ba3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,73 @@
|
||||
|
||||
using Sirenix.OdinInspector;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public abstract class EtherNode : ScriptableObject
|
||||
{
|
||||
[HideInInspector]
|
||||
public string guid;
|
||||
|
||||
[LabelText("节点名称"), PropertyOrder(-1)]
|
||||
public string nodeName;
|
||||
|
||||
[FoldoutGroup("基础属性", 1000)]
|
||||
[LabelText("位置")]
|
||||
public Vector2 position;
|
||||
|
||||
[FoldoutGroup("基础属性", 1000)]
|
||||
[LabelText("父节点列表")]
|
||||
public List<EtherNode> parents = new List<EtherNode>();
|
||||
|
||||
[FoldoutGroup("基础属性", 1000)]
|
||||
[LabelText("子节点列表")]
|
||||
public List<EtherNode> children = new List<EtherNode>();
|
||||
|
||||
//public enum State { Running, Waiting }
|
||||
//public State state = State.Waiting;
|
||||
//public bool started = false;
|
||||
//public EtherNode OnUpdate()
|
||||
//{
|
||||
// if (!started)
|
||||
// {
|
||||
// OnStart();
|
||||
// started = true;
|
||||
// }
|
||||
// EtherNode currentNode = LogicUpdate();
|
||||
// if (state != State.Running)
|
||||
// {
|
||||
// OnStop();
|
||||
// started = false;
|
||||
// }
|
||||
// return currentNode;
|
||||
//}
|
||||
//public abstract EtherNode LogicUpdate();
|
||||
//public abstract void OnStart();
|
||||
//public abstract void OnStop();
|
||||
}
|
||||
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
|
||||
public class EtherNodeMenuNameAttribute : Attribute
|
||||
{
|
||||
public string menuName;
|
||||
public int order;
|
||||
|
||||
public EtherNodeMenuNameAttribute(string menuName)
|
||||
{
|
||||
this.menuName = menuName;
|
||||
this.order = 0;
|
||||
}
|
||||
|
||||
public EtherNodeMenuNameAttribute(string menuName, int order)
|
||||
{
|
||||
this.menuName = menuName;
|
||||
this.order = order;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d94b3c32514e20e4992492b01fb10160
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,25 @@
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ether
|
||||
{
|
||||
public abstract class EtherSingleNode : EtherNode
|
||||
{
|
||||
//public override EtherNode LogicUpdate()
|
||||
//{
|
||||
// return this;
|
||||
//}
|
||||
|
||||
//public override void OnStart()
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
//public override void OnStop()
|
||||
//{
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c5ceb369463ef9d488721372989baa79
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user