This commit is contained in:
parent
8ef5c7ec0a
commit
947e52e748
|
@ -13,7 +13,7 @@ MonoBehaviour:
|
|||
m_Name: Apple
|
||||
m_EditorClassIdentifier:
|
||||
displayName: Apple
|
||||
description: "\u5403\u7684,\u597D\u5403,\u76EE\u524D\u4E5F\u53EA\u6709\u8FD9\u4E2A\u5AB8"
|
||||
description: "\u5403\u7684,\u597D\u5403,\u76EE\u524D\u4E5F\u53EA\u6709\u8FD9\u4E2A\u5403"
|
||||
addressablePath: Assets/Apple
|
||||
prefab: {fileID: 8313153688960597523, guid: 373d78c28a8f6024cada3a296368b6c5, type: 3}
|
||||
squareIcon: {fileID: 0}
|
||||
|
@ -21,9 +21,19 @@ MonoBehaviour:
|
|||
quality: 0
|
||||
factoryProperties:
|
||||
- rid: 6077775448293769231
|
||||
- rid: 806583097028509696
|
||||
- rid: 806583097028509697
|
||||
references:
|
||||
version: 2
|
||||
RefIds:
|
||||
- rid: 806583097028509696
|
||||
type: {class: PlayerEatAddHunger, ns: BITFALL.Player.Survival, asm: BITFALL.Player.Survival}
|
||||
data:
|
||||
value: 30
|
||||
- rid: 806583097028509697
|
||||
type: {class: PlayerEatAddThirst, ns: BITFALL.Player.Survival, asm: BITFALL.Player.Survival}
|
||||
data:
|
||||
value: 15
|
||||
- rid: 6077775448293769231
|
||||
type: {class: ItemWeight, ns: BITFALL, asm: BITFALL.Item}
|
||||
data:
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 092c80c0770597e448a316790a23c45b, type: 3}
|
||||
m_Name: NewAssetableGun
|
||||
m_EditorClassIdentifier:
|
||||
displayName: "\u5F13\u7BAD"
|
||||
description:
|
||||
adressablePath:
|
||||
prefab: {fileID: 0}
|
||||
squareIcon: {fileID: 0}
|
||||
rectangleIcon: {fileID: 0}
|
||||
quality: 0
|
||||
factoryProperties: []
|
||||
fireMode:
|
||||
rid: 5474080328485961732
|
||||
references:
|
||||
version: 2
|
||||
RefIds:
|
||||
- rid: 5474080328485961732
|
||||
type: {class: ArrowFireMode, ns: BITFALL, asm: BITFALL.Equip}
|
||||
data:
|
||||
fireRate: 0
|
|
@ -113,6 +113,114 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 1e8b78ac948f05a46a6d8339a503172b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1830975438145633075
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7405549464400997227}
|
||||
- component: {fileID: 292995024711154069}
|
||||
- component: {fileID: 4927581695030145725}
|
||||
- component: {fileID: 6238993905318509038}
|
||||
m_Layer: 11
|
||||
m_Name: Trigger
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7405549464400997227
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1830975438145633075}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 8689468775364940481}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &292995024711154069
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1830975438145633075}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 099996f054b64cb499431974f59539f2, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
ignores: []
|
||||
detectedLayer:
|
||||
allow: 1
|
||||
value:
|
||||
serializedVersion: 2
|
||||
m_Bits: 3073
|
||||
allowStatic: 0
|
||||
useRigidbody: 0
|
||||
onDetected:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
onLost:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!135 &4927581695030145725
|
||||
SphereCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1830975438145633075}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Radius: 0.5
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!54 &6238993905318509038
|
||||
Rigidbody:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1830975438145633075}
|
||||
serializedVersion: 4
|
||||
m_Mass: 1
|
||||
m_Drag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_CenterOfMass: {x: 0, y: 0, z: 0}
|
||||
m_InertiaTensor: {x: 1, y: 1, z: 1}
|
||||
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ImplicitCom: 1
|
||||
m_ImplicitTensor: 1
|
||||
m_UseGravity: 0
|
||||
m_IsKinematic: 1
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 0
|
||||
m_CollisionDetection: 0
|
||||
--- !u!1 &2316171592450128199
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -173,6 +281,71 @@ ParentConstraint:
|
|||
m_Sources:
|
||||
- sourceTransform: {fileID: 1442339378216051523}
|
||||
weight: 1
|
||||
--- !u!1 &3108965799473629031
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8689468775364940481}
|
||||
- component: {fileID: 8753127180639222938}
|
||||
m_Layer: 6
|
||||
m_Name: Interactive
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &8689468775364940481
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3108965799473629031}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 6046397886957618850}
|
||||
- {fileID: 7405549464400997227}
|
||||
m_Father: {fileID: 1454371083438646063}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &8753127180639222938
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3108965799473629031}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8b7c7e7c8cf1efe4aac0c8eddbd05e1c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
detectLayer:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
autoUpdate: 0
|
||||
ignoreColliders: []
|
||||
sensors:
|
||||
- rid: 8000561823951618115
|
||||
- rid: 8000561823951618116
|
||||
references:
|
||||
version: 2
|
||||
RefIds:
|
||||
- rid: 8000561823951618115
|
||||
type: {class: SensorMonoProxy, ns: BITKit.Sensors, asm: BITKit.Sensor}
|
||||
data:
|
||||
monoBehaviour: {fileID: 683819896383064737}
|
||||
- rid: 8000561823951618116
|
||||
type: {class: SensorMonoProxy, ns: BITKit.Sensors, asm: BITKit.Sensor}
|
||||
data:
|
||||
monoBehaviour: {fileID: 292995024711154069}
|
||||
--- !u!1 &3237588652320484027
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -246,7 +419,7 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
locationAdditive: {fileID: 843716438194269699}
|
||||
--- !u!1 &3860413339810838485
|
||||
--- !u!1 &3979507243906087761
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
|
@ -254,30 +427,157 @@ GameObject:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4948179496462251987}
|
||||
m_Layer: 0
|
||||
m_Name: Cameras
|
||||
- component: {fileID: 6046397886957618850}
|
||||
- component: {fileID: 5006884359828512013}
|
||||
- component: {fileID: 683819896383064737}
|
||||
m_Layer: 6
|
||||
m_Name: Ray
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4948179496462251987
|
||||
--- !u!4 &6046397886957618850
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3860413339810838485}
|
||||
m_GameObject: {fileID: 3979507243906087761}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -0.000000074505806, y: 0.100000024, z: 0.27000034}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 8689468775364940481}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1773428102 &5006884359828512013
|
||||
ParentConstraint:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3979507243906087761}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Weight: 1
|
||||
m_TranslationAtRest: {x: 0, y: 0.100000024, z: 0.27000034}
|
||||
m_RotationAtRest: {x: 0, y: 0, z: 0}
|
||||
m_TranslationOffsets:
|
||||
- {x: 0, y: 0, z: 0}
|
||||
m_RotationOffsets:
|
||||
- {x: 0, y: 0, z: 0}
|
||||
m_AffectTranslationX: 1
|
||||
m_AffectTranslationY: 1
|
||||
m_AffectTranslationZ: 1
|
||||
m_AffectRotationX: 1
|
||||
m_AffectRotationY: 1
|
||||
m_AffectRotationZ: 1
|
||||
m_Active: 1
|
||||
m_IsLocked: 1
|
||||
m_Sources:
|
||||
- sourceTransform: {fileID: 2648601869858448235}
|
||||
weight: 1
|
||||
--- !u!114 &683819896383064737
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3979507243906087761}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d84842fd060cf0d4f9d37b89de002e94, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
detectLayer:
|
||||
serializedVersion: 2
|
||||
m_Bits: 1281
|
||||
autoUpdate: 1
|
||||
ignoreColliders:
|
||||
- {fileID: 4913029694326725564}
|
||||
- {fileID: 2535427447243961047}
|
||||
- {fileID: 4785396917302097201}
|
||||
- {fileID: 101485516966416300}
|
||||
- {fileID: 3255011718976672257}
|
||||
- {fileID: 3120329137509935603}
|
||||
- {fileID: 249278523129607908}
|
||||
- {fileID: 1029788718056087775}
|
||||
- {fileID: 6035404674063517733}
|
||||
- {fileID: 8789266898436862045}
|
||||
- {fileID: 1506499515248164262}
|
||||
- {fileID: 6114270260412555645}
|
||||
- {fileID: 7793736517518798290}
|
||||
- {fileID: 3913058026966681000}
|
||||
- {fileID: 3696523136612942006}
|
||||
- {fileID: 8115773999238634209}
|
||||
- {fileID: 450682905738775250}
|
||||
- {fileID: 2333814134730013267}
|
||||
- {fileID: 4691545282947803975}
|
||||
- {fileID: 2807122339532505514}
|
||||
- {fileID: 1287739094561733551}
|
||||
- {fileID: 2838866964234946490}
|
||||
distance: 2
|
||||
--- !u!1 &4384995658573422445
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1224507104424488257}
|
||||
- component: {fileID: 5065039288452667069}
|
||||
m_Layer: 6
|
||||
m_Name: Camera
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1224507104424488257
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4384995658573422445}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1.1, z: 0.27}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 2648601869858448235}
|
||||
m_Father: {fileID: 1032268046141691441}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5592345712141467330}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1773428102 &5065039288452667069
|
||||
ParentConstraint:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4384995658573422445}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Weight: 1
|
||||
m_TranslationAtRest: {x: 0, y: 1.1, z: 0.27}
|
||||
m_RotationAtRest: {x: 0, y: 0, z: 0}
|
||||
m_TranslationOffsets:
|
||||
- {x: 0, y: 0, z: 0}
|
||||
m_RotationOffsets:
|
||||
- {x: 0, y: 0, z: 0}
|
||||
m_AffectTranslationX: 1
|
||||
m_AffectTranslationY: 1
|
||||
m_AffectTranslationZ: 1
|
||||
m_AffectRotationX: 1
|
||||
m_AffectRotationY: 1
|
||||
m_AffectRotationZ: 1
|
||||
m_Active: 1
|
||||
m_IsLocked: 1
|
||||
m_Sources:
|
||||
- sourceTransform: {fileID: 0}
|
||||
weight: 1
|
||||
--- !u!1 &4826102346843731729
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -310,6 +610,7 @@ GameObject:
|
|||
- component: {fileID: 4784073750897180643}
|
||||
- component: {fileID: 1608125748610314370}
|
||||
- component: {fileID: 654815362101145199}
|
||||
- component: {fileID: 3378207073039450111}
|
||||
m_Layer: 6
|
||||
m_Name: Player
|
||||
m_TagString: Untagged
|
||||
|
@ -335,6 +636,8 @@ Transform:
|
|||
- {fileID: 6612761407172796542}
|
||||
- {fileID: 5933364228218466648}
|
||||
- {fileID: 5592345712141467330}
|
||||
- {fileID: 1454371083438646063}
|
||||
- {fileID: 2648601869858448235}
|
||||
- {fileID: 8651890009485409793}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
@ -594,13 +897,15 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 8de7270cf1d43f64fafdc3413158cea3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
distance: 1.6
|
||||
layerMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 1025
|
||||
interactiveAction: {fileID: -6545430087105536054, guid: e0e9267cab824e8489fc27d83f1d07b7,
|
||||
type: 3}
|
||||
cameraTransform: {fileID: 4948179496462251987}
|
||||
sensor:
|
||||
rid: 8000561823951618114
|
||||
references:
|
||||
version: 2
|
||||
RefIds:
|
||||
- rid: 8000561823951618114
|
||||
type: {class: SensorMonoProxy, ns: BITKit.Sensors, asm: BITKit.Sensor}
|
||||
data:
|
||||
monoBehaviour: {fileID: 8753127180639222938}
|
||||
--- !u!114 &8779190875762967169
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -615,6 +920,8 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
equips:
|
||||
index: -1
|
||||
InitialFov: 60
|
||||
virtualCamera: {fileID: 3926401271228594272}
|
||||
--- !u!114 &7063041954768829124
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1141,7 +1448,7 @@ MonoBehaviour:
|
|||
rid: 6077775334095717178
|
||||
adsProvider:
|
||||
rid: 6077775219685064711
|
||||
cameraTransform: {fileID: 4948179496462251987}
|
||||
locationAdditive: {fileID: 4486952052422082421}
|
||||
ExpectRun:
|
||||
shouldBe: 0
|
||||
being: 0
|
||||
|
@ -1158,11 +1465,14 @@ MonoBehaviour:
|
|||
shouldBe: 0
|
||||
being: 0
|
||||
force: 0
|
||||
expectClimb:
|
||||
ExpectClimb:
|
||||
shouldBe: {x: 0, y: 0, z: 0}
|
||||
being: {x: 0, y: 0, z: 0}
|
||||
force: {x: 0, y: 0, z: 0}
|
||||
CurrentCameraPosition:
|
||||
shouldBe: {x: 0, y: 0, z: 0}
|
||||
being: {x: 0, y: 0, z: 0}
|
||||
force: {x: 0, y: 0, z: 0}
|
||||
CurrentCameraPosition: {x: 0, y: 0, z: 0}
|
||||
references:
|
||||
version: 2
|
||||
RefIds:
|
||||
|
@ -1271,23 +1581,30 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 8f081715e8ceeb94bbdc4130c01dec63, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
survivalStates:
|
||||
- rid: 6077775449957859676
|
||||
- rid: 6077775449957859679
|
||||
- rid: 6077775449957859680
|
||||
initialElements:
|
||||
- rid: 806583097028509698
|
||||
- rid: 806583097028509699
|
||||
references:
|
||||
version: 2
|
||||
RefIds:
|
||||
- rid: 6077775449957859676
|
||||
type: {class: PlayerHunger, ns: BITFALL.Player.Survival, asm: BITFALL.Player.Survival}
|
||||
data:
|
||||
value: 100
|
||||
- rid: 6077775449957859679
|
||||
type: {class: PlayerHydration, ns: BITFALL.Player.Survival, asm: BITFALL.Player.Survival}
|
||||
- rid: 806583097028509698
|
||||
type: {class: PlayerSurvivalHunger, ns: BITFALL.Player.Survival, asm: BITFALL.Player.Survival}
|
||||
data:
|
||||
- rid: 6077775449957859680
|
||||
type: {class: PlayerHealth, ns: BITFALL.Player.Survival, asm: BITFALL.Player.Survival}
|
||||
- rid: 806583097028509699
|
||||
type: {class: PlayerSurvivalThirst, ns: BITFALL.Player.Survival, asm: BITFALL.Player.Survival}
|
||||
data:
|
||||
--- !u!114 &3378207073039450111
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4826102346843731729}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1533234bcda0c0a439d3e6ecec2fdf70, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &4826102347057741775
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1351,6 +1668,7 @@ Transform:
|
|||
m_Children:
|
||||
- {fileID: 3956412582329371354}
|
||||
- {fileID: 2367504132869257504}
|
||||
- {fileID: 1224507104424488257}
|
||||
m_Father: {fileID: 4826102346843731735}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &5109089032073275973
|
||||
|
@ -1363,7 +1681,7 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 5933364228218466648}
|
||||
m_Layer: 0
|
||||
m_Name: Ancher
|
||||
m_Name: Anchor
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
@ -1558,14 +1876,14 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5894150100871518858}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1.1, z: 0.27000016}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 4757170763641365326}
|
||||
- {fileID: 2019605867538852436}
|
||||
m_Father: {fileID: 4948179496462251987}
|
||||
m_Father: {fileID: 4826102346843731735}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &4486952052422082421
|
||||
MonoBehaviour:
|
||||
|
@ -1579,6 +1897,38 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: f0e3ba1501e26894d93927485d22f749, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &5992778876066711549
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1454371083438646063}
|
||||
m_Layer: 6
|
||||
m_Name: Sensor
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1454371083438646063
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5992778876066711549}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 8689468775364940481}
|
||||
m_Father: {fileID: 4826102346843731735}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &6338142688441315228
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1798,7 +2148,6 @@ Transform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 4948179496462251987}
|
||||
- {fileID: 6708843809861981616}
|
||||
m_Father: {fileID: 4826102346843731735}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
@ -2636,7 +2985,6 @@ MonoBehaviour:
|
|||
_currentStateName:
|
||||
animator: {fileID: 4676489320873285128}
|
||||
bulletInitialOffset: {x: 0, y: 0, z: 0}
|
||||
initialAimFov: 60
|
||||
recoilSpring:
|
||||
damp: 20
|
||||
frequence: 15
|
||||
|
@ -3757,7 +4105,6 @@ MonoBehaviour:
|
|||
_currentStateName:
|
||||
animator: {fileID: 4874137276923287036}
|
||||
bulletInitialOffset: {x: 0, y: 0, z: 0}
|
||||
initialAimFov: 60
|
||||
recoilSpring:
|
||||
damp: 20
|
||||
frequence: 15
|
||||
|
@ -4228,6 +4575,11 @@ PrefabInstance:
|
|||
propertyPath: m_LocalPosition.y
|
||||
value: 0.59999996
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5560914069738189739, guid: d6020a576e13b6d43bd1143a33ff7f8e,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5560914069738189739, guid: d6020a576e13b6d43bd1143a33ff7f8e,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
|
@ -4398,6 +4750,11 @@ PrefabInstance:
|
|||
propertyPath: m_LocalRotation.z
|
||||
value: 0.00000009362675
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8632246090726818035, guid: d6020a576e13b6d43bd1143a33ff7f8e,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0.099999905
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8632246090726818035, guid: d6020a576e13b6d43bd1143a33ff7f8e,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
|
@ -4503,6 +4860,72 @@ PrefabInstance:
|
|||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: d6020a576e13b6d43bd1143a33ff7f8e, type: 3}
|
||||
--- !u!65 &450682905738775250 stripped
|
||||
BoxCollider:
|
||||
m_CorrespondingSourceObject: {fileID: 8993225578722754716, guid: d6020a576e13b6d43bd1143a33ff7f8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 8831416701600696910}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!65 &1287739094561733551 stripped
|
||||
BoxCollider:
|
||||
m_CorrespondingSourceObject: {fileID: 7733113017178567137, guid: d6020a576e13b6d43bd1143a33ff7f8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 8831416701600696910}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!65 &2333814134730013267 stripped
|
||||
BoxCollider:
|
||||
m_CorrespondingSourceObject: {fileID: 6551647997124587549, guid: d6020a576e13b6d43bd1143a33ff7f8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 8831416701600696910}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!65 &2807122339532505514 stripped
|
||||
BoxCollider:
|
||||
m_CorrespondingSourceObject: {fileID: 6664087569342041060, guid: d6020a576e13b6d43bd1143a33ff7f8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 8831416701600696910}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!65 &2838866964234946490 stripped
|
||||
BoxCollider:
|
||||
m_CorrespondingSourceObject: {fileID: 6767450936845290996, guid: d6020a576e13b6d43bd1143a33ff7f8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 8831416701600696910}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!65 &3696523136612942006 stripped
|
||||
BoxCollider:
|
||||
m_CorrespondingSourceObject: {fileID: 5315319060946176760, guid: d6020a576e13b6d43bd1143a33ff7f8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 8831416701600696910}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!65 &3913058026966681000 stripped
|
||||
BoxCollider:
|
||||
m_CorrespondingSourceObject: {fileID: 5531131967229890534, guid: d6020a576e13b6d43bd1143a33ff7f8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 8831416701600696910}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!65 &4691545282947803975 stripped
|
||||
BoxCollider:
|
||||
m_CorrespondingSourceObject: {fileID: 4293277488221511945, guid: d6020a576e13b6d43bd1143a33ff7f8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 8831416701600696910}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!65 &6114270260412555645 stripped
|
||||
BoxCollider:
|
||||
m_CorrespondingSourceObject: {fileID: 3338643810006379315, guid: d6020a576e13b6d43bd1143a33ff7f8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 8831416701600696910}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!65 &7793736517518798290 stripped
|
||||
BoxCollider:
|
||||
m_CorrespondingSourceObject: {fileID: 1632436817039861660, guid: d6020a576e13b6d43bd1143a33ff7f8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 8831416701600696910}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!65 &8115773999238634209 stripped
|
||||
BoxCollider:
|
||||
m_CorrespondingSourceObject: {fileID: 733659858160898223, guid: d6020a576e13b6d43bd1143a33ff7f8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 8831416701600696910}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!4 &8651890009485409793 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 188815475637777487, guid: d6020a576e13b6d43bd1143a33ff7f8e,
|
||||
|
|
|
@ -130,6 +130,7 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
appId: 1934920
|
||||
allowCharacters: {fileID: 4900000, guid: 409d2554d9447844482d62f16b64f38b, type: 3}
|
||||
--- !u!114 &4083894557606377552
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -349,6 +350,7 @@ GameObject:
|
|||
- component: {fileID: 8311590516829563825}
|
||||
- component: {fileID: 1065754268735149804}
|
||||
- component: {fileID: 7537076544790306598}
|
||||
- component: {fileID: 3308036563096021723}
|
||||
m_Layer: 0
|
||||
m_Name: Inventory
|
||||
m_TagString: Untagged
|
||||
|
@ -371,6 +373,8 @@ Transform:
|
|||
m_Children:
|
||||
- {fileID: 6086108802571393202}
|
||||
- {fileID: 8241740732650587288}
|
||||
- {fileID: 6601483182092177668}
|
||||
- {fileID: 2599914361793321970}
|
||||
m_Father: {fileID: 5885585653203836409}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &8311590516829563825
|
||||
|
@ -474,6 +478,27 @@ MonoBehaviour:
|
|||
- rid: 6077775405181829477
|
||||
type: {class: UnityPlayerServiceService, ns: BITKit.Entities.Player, asm: BITKit.Entities.Player}
|
||||
data:
|
||||
--- !u!114 &3308036563096021723
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1883062383340693149}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1b0fdae2669e6db438a8f53e0bd359c4, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
playerService:
|
||||
rid: 806583097028509792
|
||||
survivalEventBuilder: {fileID: 5156887789142102549}
|
||||
references:
|
||||
version: 2
|
||||
RefIds:
|
||||
- rid: 806583097028509792
|
||||
type: {class: UnityPlayerServiceService, ns: BITKit.Entities.Player, asm: BITKit.Entities.Player}
|
||||
data:
|
||||
--- !u!1 &2147395572312168785
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -642,12 +667,12 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3710001671762204080}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1868127212333961775}
|
||||
m_Father: {fileID: 4146873518232350710}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &5156887789142102549
|
||||
MonoBehaviour:
|
||||
|
@ -662,18 +687,17 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
visualElementProvider:
|
||||
rid: 6077775449957859858
|
||||
rid: 806583097977995357
|
||||
visualTreeAsset: {fileID: 9197481963319205126, guid: b75c1744172f96e4cb694204bfd48b98,
|
||||
type: 3}
|
||||
clearOnStart: 1
|
||||
references:
|
||||
version: 2
|
||||
RefIds:
|
||||
- rid: 6077775449957859858
|
||||
type: {class: GetVisualElementFromUIDocument, ns: , asm: BITKit.UX}
|
||||
- rid: 806583097977995357
|
||||
type: {class: GetVisualElementFromUXElement, ns: , asm: BITKit.UX}
|
||||
data:
|
||||
document: {fileID: 5757643392578433631}
|
||||
path: survival-container
|
||||
_uxElement: {fileID: 6238134801233401184}
|
||||
--- !u!1 &3757054412361474464
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -733,6 +757,64 @@ MonoBehaviour:
|
|||
type: {class: GetNameFromGameobject, ns: BITKit, asm: BITKit}
|
||||
data:
|
||||
gameobject: {fileID: 3757054412361474464}
|
||||
--- !u!1 &3776864789349530740
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2599914361793321970}
|
||||
- component: {fileID: 6238134801233401184}
|
||||
m_Layer: 0
|
||||
m_Name: survival-container
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2599914361793321970
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3776864789349530740}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4146873518232350710}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &6238134801233401184
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3776864789349530740}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d0864e489ffa52240821dff61c1e5f5c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
document: {fileID: 8311590516829563825}
|
||||
bindName:
|
||||
bindNameProvider:
|
||||
rid: 806583097977995333
|
||||
lerpPosition:
|
||||
allow: 0
|
||||
value: 0
|
||||
references:
|
||||
version: 2
|
||||
RefIds:
|
||||
- rid: 806583097977995333
|
||||
type: {class: GetNameFromGameobject, ns: BITKit, asm: BITKit}
|
||||
data:
|
||||
gameobject: {fileID: 3776864789349530740}
|
||||
--- !u!1 &3982569034385566475
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -896,7 +978,6 @@ GameObject:
|
|||
- component: {fileID: 807107954657273499}
|
||||
- component: {fileID: 1471813233237706529}
|
||||
- component: {fileID: 2655126492240795381}
|
||||
- component: {fileID: 8688891611846657049}
|
||||
m_Layer: 0
|
||||
m_Name: HUD
|
||||
m_TagString: Untagged
|
||||
|
@ -926,7 +1007,7 @@ Transform:
|
|||
- {fileID: 8053823424171020504}
|
||||
- {fileID: 5292556015733965988}
|
||||
- {fileID: 8643080168626239556}
|
||||
- {fileID: 6601483182092177668}
|
||||
- {fileID: 78207825956730707}
|
||||
m_Father: {fileID: 5885585653203836409}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &5757643392578433631
|
||||
|
@ -972,6 +1053,7 @@ MonoBehaviour:
|
|||
steamService:
|
||||
rid: 6077775449957859446
|
||||
crosshairImage: {fileID: 7197977614289111421}
|
||||
crosshairParentImage: {fileID: 1020875659093885614}
|
||||
playerNameLabel: {fileID: 3634826882621984808}
|
||||
playerAvatarImage: {fileID: 2959116518108072906}
|
||||
healthBar: {fileID: 5395886693158660034}
|
||||
|
@ -1084,56 +1166,6 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
dialogueBuilder: {fileID: 7594065398024844307}
|
||||
--- !u!114 &8688891611846657049
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4194669936323273822}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1b0fdae2669e6db438a8f53e0bd359c4, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
playerService:
|
||||
rid: 6077775449957859681
|
||||
survivalEventIcons:
|
||||
reorderableList:
|
||||
canAdd: 1
|
||||
canRemove: 1
|
||||
draggable: 1
|
||||
expandable: 1
|
||||
multipleSelection: 1
|
||||
isExpanded: 1
|
||||
label:
|
||||
m_Text: Keys
|
||||
m_Image: {fileID: 0}
|
||||
m_Tooltip:
|
||||
headerHeight: 18
|
||||
footerHeight: 13
|
||||
slideEasing: 0.15
|
||||
verticalSpacing: 2
|
||||
showDefaultBackground: 1
|
||||
elementDisplayType: 0
|
||||
elementNameProperty:
|
||||
elementNameOverride:
|
||||
elementIcon: {fileID: 0}
|
||||
reqReferences: {fileID: 0}
|
||||
isExpanded: 1
|
||||
_keyValues:
|
||||
- PlayerFeelHungryEvent
|
||||
_keys:
|
||||
- PlayerFeelHungryEvent
|
||||
_values:
|
||||
- {fileID: 21300000, guid: a928ab2792f614544a3190c83422940d, type: 3}
|
||||
survivalEventBuilder: {fileID: 5156887789142102549}
|
||||
references:
|
||||
version: 2
|
||||
RefIds:
|
||||
- rid: 6077775449957859681
|
||||
type: {class: UnityPlayerServiceService, ns: BITKit.Entities.Player, asm: BITKit.Entities.Player}
|
||||
data:
|
||||
--- !u!1 &4420906603671594769
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -2141,6 +2173,64 @@ MonoBehaviour:
|
|||
type: {class: GetNameFromGameobject, ns: BITKit, asm: BITKit}
|
||||
data:
|
||||
gameobject: {fileID: 8331712092059622214}
|
||||
--- !u!1 &8400809357771810395
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 78207825956730707}
|
||||
- component: {fileID: 1020875659093885614}
|
||||
m_Layer: 0
|
||||
m_Name: crosshair-container
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &78207825956730707
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8400809357771810395}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1868127212333961775}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1020875659093885614
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8400809357771810395}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d0864e489ffa52240821dff61c1e5f5c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
document: {fileID: 5757643392578433631}
|
||||
bindName:
|
||||
bindNameProvider:
|
||||
rid: 806583076553490476
|
||||
lerpPosition:
|
||||
allow: 0
|
||||
value: 0
|
||||
references:
|
||||
version: 2
|
||||
RefIds:
|
||||
- rid: 806583076553490476
|
||||
type: {class: GetNameFromGameobject, ns: BITKit, asm: BITKit}
|
||||
data:
|
||||
gameobject: {fileID: 8400809357771810395}
|
||||
--- !u!1 &8464585526938570570
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -2500,6 +2590,13 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
command: 'connect '
|
||||
format:
|
||||
rid: -2
|
||||
references:
|
||||
version: 2
|
||||
RefIds:
|
||||
- rid: -2
|
||||
type: {class: , ns: , asm: }
|
||||
--- !u!1 &9122664184921607688
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -1357,7 +1357,7 @@ Mesh:
|
|||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: pb_Mesh96614
|
||||
m_Name: pb_Mesh35364
|
||||
serializedVersion: 11
|
||||
m_SubMeshes:
|
||||
- serializedVersion: 2
|
||||
|
@ -7000,7 +7000,7 @@ Mesh:
|
|||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: pb_Mesh96782
|
||||
m_Name: pb_Mesh35550
|
||||
serializedVersion: 11
|
||||
m_SubMeshes:
|
||||
- serializedVersion: 2
|
||||
|
@ -8391,6 +8391,7 @@ Transform:
|
|||
- {fileID: 1088581386}
|
||||
- {fileID: 567279688}
|
||||
- {fileID: 1854426442}
|
||||
- {fileID: 1849087175}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &1677499543
|
||||
|
@ -9115,7 +9116,7 @@ Mesh:
|
|||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: pb_Mesh96446
|
||||
m_Name: pb_Mesh35196
|
||||
serializedVersion: 11
|
||||
m_SubMeshes:
|
||||
- serializedVersion: 2
|
||||
|
@ -9363,6 +9364,128 @@ Transform:
|
|||
type: 3}
|
||||
m_PrefabInstance: {fileID: 1829613427}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &1849087174
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1849087175}
|
||||
- component: {fileID: 1849087178}
|
||||
- component: {fileID: 1849087177}
|
||||
- component: {fileID: 1849087176}
|
||||
- component: {fileID: 1849087179}
|
||||
m_Layer: 0
|
||||
m_Name: Cube (4)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1849087175
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1849087174}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 13.25, y: 0.5, z: 1.25}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1671777019}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!65 &1849087176
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1849087174}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &1849087177
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1849087174}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!33 &1849087178
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1849087174}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!114 &1849087179
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1849087174}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7067e5585ba8eaf4ca786967e0f1dd15, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
OnImpact:
|
||||
Targets:
|
||||
- Target: {fileID: 1849087179}
|
||||
MethodName: "\u68C0\u6D4B\u72B6\u6001"
|
||||
--- !u!1 &1854426436
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -10772,6 +10895,7 @@ GameObject:
|
|||
- component: {fileID: 2065719288}
|
||||
- component: {fileID: 2065719289}
|
||||
- component: {fileID: 2065719290}
|
||||
- component: {fileID: 2065719291}
|
||||
m_Layer: 0
|
||||
m_Name: "\u547C\u53EB\u64A4\u79BB"
|
||||
m_TagString: Untagged
|
||||
|
@ -10845,6 +10969,33 @@ MonoBehaviour:
|
|||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
collider: {fileID: 2065719289}
|
||||
--- !u!54 &2065719291
|
||||
Rigidbody:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2065719287}
|
||||
serializedVersion: 4
|
||||
m_Mass: 1
|
||||
m_Drag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_CenterOfMass: {x: 0, y: 0, z: 0}
|
||||
m_InertiaTensor: {x: 1, y: 1, z: 1}
|
||||
m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ImplicitCom: 1
|
||||
m_ImplicitTensor: 1
|
||||
m_UseGravity: 0
|
||||
m_IsKinematic: 1
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 0
|
||||
m_CollisionDetection: 0
|
||||
--- !u!1001 &2115485082
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -10930,7 +11081,7 @@ Mesh:
|
|||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: pb_Mesh96742
|
||||
m_Name: pb_Mesh35500
|
||||
serializedVersion: 11
|
||||
m_SubMeshes:
|
||||
- serializedVersion: 2
|
||||
|
@ -12169,6 +12320,16 @@ PrefabInstance:
|
|||
propertyPath: m_LocalRotation.z
|
||||
value: 0.029754566
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1224507104424488257, guid: e5d265393747af741b4f5d719598831a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1224507104424488257, guid: e5d265393747af741b4f5d719598831a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0.27
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1237757284718978460, guid: e5d265393747af741b4f5d719598831a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
|
@ -12984,11 +13145,21 @@ PrefabInstance:
|
|||
propertyPath: m_LocalRotation.z
|
||||
value: 0.016139772
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4009095720910715365, guid: e5d265393747af741b4f5d719598831a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4009095720910715365, guid: e5d265393747af741b4f5d719598831a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0.554667
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4009095720910715365, guid: e5d265393747af741b4f5d719598831a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4009095720910715365, guid: e5d265393747af741b4f5d719598831a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
|
@ -13474,11 +13645,21 @@ PrefabInstance:
|
|||
propertyPath: m_RotationOffsets.Array.data[0].x
|
||||
value: -89.89347
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5718097820043900847, guid: e5d265393747af741b4f5d719598831a,
|
||||
type: 3}
|
||||
propertyPath: m_TranslationOffsets.Array.data[0].x
|
||||
value: 0.0049767494
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5718097820043900847, guid: e5d265393747af741b4f5d719598831a,
|
||||
type: 3}
|
||||
propertyPath: m_TranslationOffsets.Array.data[0].y
|
||||
value: 0.00015735626
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5718097820043900847, guid: e5d265393747af741b4f5d719598831a,
|
||||
type: 3}
|
||||
propertyPath: m_TranslationOffsets.Array.data[0].z
|
||||
value: -0.0021240711
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5788104773034667456, guid: e5d265393747af741b4f5d719598831a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
|
@ -14721,79 +14902,6 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 45e653bab7fb20e499bda25e1b646fea, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1001 &4967360553653707449
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 4967360553763134876, guid: afc3896ae91cb60479e82dc81a530310,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 12
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4967360553763134876, guid: afc3896ae91cb60479e82dc81a530310,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4967360553763134876, guid: afc3896ae91cb60479e82dc81a530310,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4967360553763134876, guid: afc3896ae91cb60479e82dc81a530310,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4967360553763134876, guid: afc3896ae91cb60479e82dc81a530310,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4967360553763134876, guid: afc3896ae91cb60479e82dc81a530310,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4967360553763134876, guid: afc3896ae91cb60479e82dc81a530310,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4967360553763134876, guid: afc3896ae91cb60479e82dc81a530310,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4967360553763134876, guid: afc3896ae91cb60479e82dc81a530310,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4967360553763134876, guid: afc3896ae91cb60479e82dc81a530310,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4967360553763134876, guid: afc3896ae91cb60479e82dc81a530310,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4967360553763134877, guid: afc3896ae91cb60479e82dc81a530310,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: BITAvatar
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: afc3896ae91cb60479e82dc81a530310, type: 3}
|
||||
--- !u!1001 &5787881318544397413
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -15500,7 +15608,6 @@ SceneRoots:
|
|||
- {fileID: 1719111407}
|
||||
- {fileID: 106239822}
|
||||
- {fileID: 458258641}
|
||||
- {fileID: 4967360553653707449}
|
||||
- {fileID: 4826102347101476322}
|
||||
- {fileID: 959529734}
|
||||
- {fileID: 4058533053404731553}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Security;
|
||||
using UnityEngine;
|
||||
|
|
@ -12,7 +12,8 @@
|
|||
"GUID:30cdc242b1ac6a944a460f4ab0b77b88",
|
||||
"GUID:f51ebe6a0ceec4240a699833d6309b23",
|
||||
"GUID:d525ad6bd40672747bde77962f1c401e",
|
||||
"GUID:49b49c76ee64f6b41bf28ef951cb0e50"
|
||||
"GUID:49b49c76ee64f6b41bf28ef951cb0e50",
|
||||
"GUID:ef0bb553b58b90b488bdbe8672e3be0b"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BITFALL.Player.Inventory;
|
||||
using UnityEngine;
|
||||
using BITKit;
|
||||
using BITKit.Entities;
|
||||
|
@ -20,7 +21,7 @@ namespace BITFALL
|
|||
/// 支持,护甲,头盔和背包等
|
||||
/// </summary>
|
||||
[CustomType(typeof(IPlayerEquipContainer))]
|
||||
public class PlayerEquipContainer : EntityComponent, TaskSubscriber<IBasicItem>, IPlayerEquipContainer
|
||||
public class PlayerEquipContainer : EntityComponent, IPlayerEquipContainer
|
||||
{
|
||||
private readonly Dictionary<IEquipmentSlot, IBasicItem> dictionary = new();
|
||||
private IBasicItemContainer inventory;
|
||||
|
@ -44,8 +45,9 @@ namespace BITFALL
|
|||
public override void OnStart()
|
||||
{
|
||||
base.OnStart();
|
||||
entity.RegisterCallback<TaskSubscriber<IBasicItem>>(this);
|
||||
inventory = entity.Get<IBasicItemContainer>();
|
||||
var playerInventory = entity.Get<IPlayerInventory>();
|
||||
playerInventory.OnUseItem += TryExecute;
|
||||
}
|
||||
|
||||
public Action<IEquipmentSlot, IBasicItem> OnEquip { get; set; }
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
@ -7,17 +8,13 @@ using UnityEngine.UIElements;
|
|||
using System.Text;
|
||||
using BITKit.Entities;
|
||||
using System.Linq;
|
||||
using BITFALL.Player.Inventory;
|
||||
|
||||
namespace BITFALL
|
||||
{
|
||||
public class PlayerInventory : EntityInventory,ISelectableCallback,TaskPublisher<IBasicItem>
|
||||
[CustomType(typeof(IPlayerInventory))]
|
||||
public class PlayerInventory : EntityInventory,ISelectableCallback,IPlayerInventory
|
||||
{
|
||||
public override void Initialize(IEntity entity)
|
||||
{
|
||||
base.Initialize(entity);
|
||||
entity.Set<IBasicItemContainer>(this);
|
||||
entity.Set<TaskPublisher<IBasicItem>>(this);
|
||||
}
|
||||
public override void OnStart()
|
||||
{
|
||||
base.OnStart();
|
||||
|
@ -35,7 +32,7 @@ namespace BITFALL
|
|||
item.Picked();
|
||||
}
|
||||
}
|
||||
else if(trans.TryGetComponentAny<IBasicItemContainer>(out var container))
|
||||
else if(trans.TryGetComponentAny<IBasicItemContainer>(out _))
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -48,18 +45,15 @@ namespace BITFALL
|
|||
void ISelectableCallback.OnInactive(ISelectable selectable)
|
||||
{
|
||||
}
|
||||
public bool Execute(IBasicItem value)
|
||||
public bool TryUseItem(IBasicItem item)
|
||||
{
|
||||
foreach (var excutor in entity.GetCallbacks<TaskSubscriber<IBasicItem>>())
|
||||
{
|
||||
if(excutor.TryExecute(value))
|
||||
{
|
||||
Remove(value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
if (OnUseItem is null) return false;
|
||||
if (!OnUseItem.CastAsFunc().Any(func => func.Invoke(item))) return false;
|
||||
Remove(item);
|
||||
return true;
|
||||
}
|
||||
|
||||
public event Func<IBasicItem, bool> OnUseItem;
|
||||
}
|
||||
#if UNITY_EDITOR
|
||||
[UnityEditor.CustomEditor(typeof(PlayerInventory))]
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
"GUID:42a9827d94e00374aa52e51f0a1b035c",
|
||||
"GUID:d525ad6bd40672747bde77962f1c401e",
|
||||
"GUID:49b49c76ee64f6b41bf28ef951cb0e50",
|
||||
"GUID:9354affc93e0f3e4a904785e7d4c0f59"
|
||||
"GUID:9354affc93e0f3e4a904785e7d4c0f59",
|
||||
"GUID:ef0bb553b58b90b488bdbe8672e3be0b"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
|
@ -8,6 +8,7 @@ using UnityEngine.InputSystem;
|
|||
using static UnityEditor.Progress;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using BITFALL.Player.Inventory;
|
||||
using BITKit.Entities.Player;
|
||||
using UnityEngine.InputSystem.Interactions;
|
||||
using Debug = UnityEngine.Debug;
|
||||
|
@ -15,7 +16,7 @@ using Debug = UnityEngine.Debug;
|
|||
namespace BITFALL
|
||||
{
|
||||
[CustomType(typeof(IPlayerEquipSelector))]
|
||||
public class PlayerEquipSelector : EntityComponent,TaskSubscriber<IBasicItem>,IEntityInventoryCallback,IPlayerEquipSelector
|
||||
public class PlayerEquipSelector : EntityComponent,IEntityInventoryCallback,IPlayerEquipSelector
|
||||
{
|
||||
[Header(Constant.Header.Components)]
|
||||
public EntityEquipment equipment;
|
||||
|
@ -40,7 +41,7 @@ namespace BITFALL
|
|||
{
|
||||
base.OnStart();
|
||||
|
||||
entity.RegisterCallback<TaskSubscriber<IBasicItem>>(this);
|
||||
entity.Get<IPlayerInventory>().OnUseItem += TryExecute;
|
||||
|
||||
inventory = entity.Get<IBasicItemContainer>();
|
||||
}
|
||||
|
@ -83,9 +84,7 @@ namespace BITFALL
|
|||
UpdateEquip();
|
||||
Equip(-1);
|
||||
}
|
||||
int TaskSubscriber<IBasicItem>.Priority => 0;
|
||||
|
||||
bool TaskSubscriber<IBasicItem>.TryExecute(IBasicItem value)
|
||||
private bool TryExecute(IBasicItem value)
|
||||
{
|
||||
var asset = value.GetAssetable();
|
||||
if (IsSupportItem(value) is false) return false;
|
|
@ -17,7 +17,9 @@
|
|||
"GUID:900280954c76a0d41bc47cef37f91107",
|
||||
"GUID:1235ca61e7f433b408ed5a68767e7123",
|
||||
"GUID:0a8b74b3309f0cc44bdd9a796253baef",
|
||||
"GUID:8d74bfb2f67c5c14a810215b78383d40"
|
||||
"GUID:8d74bfb2f67c5c14a810215b78383d40",
|
||||
"GUID:96f476e982d6fb945bfc9140ba094b7f",
|
||||
"GUID:4307f53044263cf4b835bd812fc161a4"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
|
|
@ -68,7 +68,6 @@ namespace BITFALL.Guns
|
|||
//简单设置
|
||||
[Header(Constant.Header.Settings)]
|
||||
[SerializeField] private Vector3 bulletInitialOffset;
|
||||
[SerializeField] private int initialAimFov = 60;
|
||||
[SerializeField] private SpringEulerAngle recoilSpring=new();
|
||||
|
||||
// 输入系统
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Data.Odbc;
|
||||
using BITFALL.Player.Equip;
|
||||
using BITFALL.Player.Movement;
|
||||
using BITKit;
|
||||
using BITKit.Entities;
|
||||
|
@ -147,10 +148,12 @@ namespace BITFALL.Guns.States
|
|||
public class Aim : GunState
|
||||
{
|
||||
private IEntityMovement _entityMovement;
|
||||
private IEquipService _equipService;
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
_entityMovement = root.Entity.Get<IEntityMovement>();
|
||||
_equipService = root.Entity.Get<IEquipService>();
|
||||
}
|
||||
|
||||
public override void OnStateEntry(IState old)
|
||||
|
@ -165,7 +168,7 @@ namespace BITFALL.Guns.States
|
|||
root.animator.CrossFade(BITGun._Aim, 0.16f);
|
||||
break;
|
||||
}
|
||||
|
||||
_equipService.Zoom.Allow = true;
|
||||
_entityMovement.ExecuteCommand<PlayerCancelRunCommand>();
|
||||
}
|
||||
|
||||
|
@ -188,6 +191,13 @@ namespace BITFALL.Guns.States
|
|||
{
|
||||
root.TransitionState<Movement>();
|
||||
}
|
||||
_equipService.Zoom.Value = root.aimAction.action.ReadValue<float>();
|
||||
}
|
||||
|
||||
public override void OnStateExit(IState old, IState newState)
|
||||
{
|
||||
base.OnStateExit(old, newState);
|
||||
_equipService.Zoom.Allow = false;
|
||||
}
|
||||
|
||||
public override void OnMovementStateChanged(IEntityMovementState old, IEntityMovementState newState)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using BITFALL.Player.Equip;
|
||||
using BITKit;
|
||||
using BITKit.Entities;
|
||||
using UnityEngine;
|
||||
|
@ -18,15 +19,23 @@ namespace BITFALL.Player.Movement
|
|||
private Quaternion currentRotation;
|
||||
private Vector3 currentPosition;
|
||||
private IEntityMovement _movement;
|
||||
private IEquipService _equipService;
|
||||
public override void OnAwake()
|
||||
{
|
||||
_movement = entity.Get<IEntityMovement>();
|
||||
_equipService = entity.Get<IEquipService>();
|
||||
}
|
||||
|
||||
public override void OnLateUpdate(float deltaTime)
|
||||
{
|
||||
var velocity = _movement.LocomotionBasedVelocity;
|
||||
var angularVelocity = _movement.AngularVelocity;
|
||||
|
||||
if (_equipService.Zoom.Allow)
|
||||
{
|
||||
velocity = default;
|
||||
angularVelocity = default;
|
||||
}
|
||||
|
||||
currentPosition = Vector3.Lerp(currentPosition,velocity * posValue,posDelta * deltaTime);
|
||||
currentRotation = Quaternion.Lerp(currentRotation,Quaternion.Euler(angularVelocity * rotValue),rotDelta * deltaTime);
|
||||
|
|
|
@ -27,8 +27,9 @@ namespace BITFALL.Entities.Player.Movement
|
|||
|
||||
[SerializeReference, SubclassSelector]
|
||||
private IProvider adsProvider;
|
||||
|
||||
[SerializeField] private LocationAdditive locationAdditive;
|
||||
|
||||
[SerializeField] private Transform cameraTransform;
|
||||
public Vector3 ViewCenter { get; set; }
|
||||
public Quaternion ViewRotation { get; set; }
|
||||
public Vector3 LocomotionBasedVelocity { get;private set; }
|
||||
|
@ -43,8 +44,8 @@ namespace BITFALL.Entities.Player.Movement
|
|||
public ExpectState<bool> ExpectJump;
|
||||
public ExpectState<bool> ExpectCrouch;
|
||||
public ExpectState<bool> ExpectSprint;
|
||||
public ExpectState<Vector3> expectClimb;
|
||||
public Vector3 CurrentCameraPosition;
|
||||
public ExpectState<Vector3> ExpectClimb;
|
||||
public ExpectState<Vector3> CurrentCameraPosition;
|
||||
private readonly ValidHandle allowMovement = new();
|
||||
private readonly ValidHandle allowRun = new();
|
||||
private IEntityPhysics physics;
|
||||
|
@ -53,7 +54,6 @@ namespace BITFALL.Entities.Player.Movement
|
|||
private Vector3 keepVelocity;
|
||||
public override void OnAwake()
|
||||
{
|
||||
CurrentCameraPosition = initialCameraPosition;
|
||||
_health = entity.Get<IHealth>();
|
||||
_health.OnSetAlive += OnSetAlive;
|
||||
physics = entity.Get<IEntityPhysics>();
|
||||
|
@ -126,7 +126,7 @@ namespace BITFALL.Entities.Player.Movement
|
|||
var playerConfig = Data.Get<PlayerConfig>() ?? new PlayerConfig();
|
||||
var ads = adsProvider.Get<float>();
|
||||
if (ads is 0) ads = 1;
|
||||
var raw = context.ReadValue<Vector2>() * playerConfig.sensitivity * playerConfig.m_yaw * ads;
|
||||
var raw = context.ReadValue<Vector2>() * playerConfig.Sensitivity * playerConfig.M_Yaw * ads;
|
||||
var lookInput = LookInput;
|
||||
lookInput.x -= raw.y;
|
||||
lookInput.y += raw.x;
|
||||
|
@ -148,7 +148,7 @@ namespace BITFALL.Entities.Player.Movement
|
|||
ExpectCrouch.Reset();
|
||||
if (climbClosePoint.TryGetClosePoint(out var closePoint))
|
||||
{
|
||||
expectClimb.shouldBe = closePoint;
|
||||
ExpectClimb.shouldBe = closePoint;
|
||||
TransitionState<Climb>();
|
||||
}
|
||||
}
|
||||
|
@ -188,8 +188,10 @@ namespace BITFALL.Entities.Player.Movement
|
|||
public override void OnUpdate(float deltaTime)
|
||||
{
|
||||
CurrentState?.BeforeUpdateMovement(deltaTime);
|
||||
|
||||
CurrentState?.AfterUpdateMovement(deltaTime);
|
||||
}
|
||||
|
||||
|
||||
public override void OnFixedUpdate(float deltaTime)
|
||||
{
|
||||
var currentVelocity = actor.Velocity;
|
||||
|
@ -215,13 +217,19 @@ namespace BITFALL.Entities.Player.Movement
|
|||
public override void OnLateUpdate(float deltaTime)
|
||||
{
|
||||
if (allowMovement.Allow is false) return;
|
||||
var rotation = Quaternion.Euler(LookInput);
|
||||
cameraTransform.rotation = rotation;
|
||||
CurrentState?.AfterUpdateMovement(deltaTime);
|
||||
cameraTransform.localPosition = Vector3.Lerp(cameraTransform.localPosition,CurrentCameraPosition,5 * deltaTime);
|
||||
var additiveTransform = locationAdditive.transform;
|
||||
|
||||
var rotation = Quaternion.Euler(LookInput);
|
||||
|
||||
locationAdditive.SetGlobalRotation(rotation);
|
||||
|
||||
CurrentCameraPosition.being = Vector3.Lerp(CurrentCameraPosition.being,CurrentCameraPosition.shouldBe,5 * deltaTime);
|
||||
|
||||
locationAdditive.AddPosition(CurrentCameraPosition);
|
||||
|
||||
ViewCenter = cameraTransform.position;
|
||||
ViewRotation = rotation;
|
||||
|
||||
ViewCenter = additiveTransform.position + additiveTransform.forward;
|
||||
}
|
||||
|
||||
public void AddViewEuler(float2 euler)
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace BITFALL.Entities.Player.Movement.States
|
|||
[SerializeField] protected float initialJumpForce = 5f;
|
||||
public override void BeforeUpdateMovement(float deltaTime)
|
||||
{
|
||||
characterController.CurrentCameraPosition = initialCameraPosition;
|
||||
characterController.CurrentCameraPosition.shouldBe = initialCameraPosition;
|
||||
}
|
||||
|
||||
public override void UpdateVelocity(ref Vector3 currentVelocity,float deltaTime)
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace BITFALL.Entities.Player.Movement.States
|
|||
}
|
||||
public override void OnStateUpdate(float deltaTime)
|
||||
{
|
||||
if (Vector3.Distance(characterController.expectClimb.shouldBe, characterController.transform.position) < 0.1f || actor.IsStable)
|
||||
if (Vector3.Distance(characterController.ExpectClimb.shouldBe, characterController.transform.position) < 0.1f || actor.IsStable)
|
||||
{
|
||||
characterController.TransitionState<Walk>();
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ namespace BITFALL.Entities.Player.Movement.States
|
|||
|
||||
public override void UpdateVelocity(ref Vector3 currentVelocity, float deltaTime)
|
||||
{
|
||||
currentVelocity =(characterController.expectClimb.shouldBe - characterController.transform.position)*lerpDelta;
|
||||
currentVelocity =(characterController.ExpectClimb.shouldBe - characterController.transform.position)*lerpDelta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
"GUID:d525ad6bd40672747bde77962f1c401e",
|
||||
"GUID:49b49c76ee64f6b41bf28ef951cb0e50",
|
||||
"GUID:26fc13cbbc427414f9af2143d581330a",
|
||||
"GUID:f51ebe6a0ceec4240a699833d6309b23"
|
||||
"GUID:f51ebe6a0ceec4240a699833d6309b23",
|
||||
"GUID:ef0bb553b58b90b488bdbe8672e3be0b",
|
||||
"GUID:677cd05ca06c46b4395470200b1acdad",
|
||||
"GUID:30cdc242b1ac6a944a460f4ab0b77b88"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using BITFALL.Player.Inventory;
|
||||
using BITKit;
|
||||
using BITKit.Entities;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITFALL.Player.Survival
|
||||
{
|
||||
public class PlayerEatService : EntityComponent
|
||||
{
|
||||
private IPlayerSurvivalService _survival;
|
||||
private IPlayerInventory _inventory;
|
||||
public override void OnStart()
|
||||
{
|
||||
base.OnStart();
|
||||
_inventory = entity.Get<IPlayerInventory>();
|
||||
_inventory.OnUseItem += OnUseItem;
|
||||
_survival = entity.Get<IPlayerSurvivalService>();
|
||||
}
|
||||
|
||||
private bool OnUseItem(IBasicItem arg)
|
||||
{
|
||||
switch (arg)
|
||||
{
|
||||
case var _ when arg.GetAssetable().TryGetProperty<PlayerEatAddHunger>(out var addHunger) &&
|
||||
_survival.Elements.TryGetAny(x => x is PlayerSurvivalHunger, out var hunger):
|
||||
hunger.Value += addHunger.Value;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -8,47 +8,25 @@ using UnityEngine;
|
|||
|
||||
namespace BITFALL.Player.Survival
|
||||
{
|
||||
[CustomType(typeof(IPlayerSurvival))]
|
||||
public class PlayerSurvival : EntityComponent, IPlayerSurvival
|
||||
[CustomType(typeof(IPlayerSurvivalService))]
|
||||
public class PlayerSurvivalService : EntityComponent, IPlayerSurvivalService
|
||||
{
|
||||
[SerializeReference, SubclassSelector] private IPlayerSurvivalState[] survivalStates;
|
||||
private readonly IntervalUpdate interval = new(1);
|
||||
private bool initialized;
|
||||
private CancellationToken _cancellationToken;
|
||||
public IPlayerSurvivalElement[] Elements { get; set; } = Array.Empty<IPlayerSurvivalElement>();
|
||||
[SerializeReference, SubclassSelector] private IPlayerSurvivalElement[] initialElements = Array.Empty<IPlayerSurvivalElement>();
|
||||
|
||||
private IntervalUpdate _interval = new(1);
|
||||
public override void OnAwake()
|
||||
{
|
||||
_cancellationToken = entity.Get<CancellationToken>();
|
||||
foreach (var x in survivalStates)
|
||||
{
|
||||
x.OnStateInitialize();
|
||||
}
|
||||
Elements = initialElements;
|
||||
}
|
||||
public override async void OnStart()
|
||||
|
||||
public override void OnUpdate(float deltaTime)
|
||||
{
|
||||
foreach (var x in survivalStates)
|
||||
if (_interval.AllowUpdate is false) return;
|
||||
foreach (var x in Elements)
|
||||
{
|
||||
await x.OnStateInitializeAsync(_cancellationToken);
|
||||
}
|
||||
foreach (var x in survivalStates)
|
||||
{
|
||||
x.OnStateInitialized();
|
||||
}
|
||||
initialized = true;
|
||||
}
|
||||
public override void OnFixedUpdate(float deltaTime)
|
||||
{
|
||||
if (interval.AllowUpdate is false || initialized is false) return;
|
||||
foreach (var x in survivalStates)
|
||||
{
|
||||
x.ProcessState();
|
||||
if(x.TryGetNewEvent(out var newEvent))
|
||||
OnSurvivalEventOpened?.Invoke(newEvent);
|
||||
if(x.TryGetClosedEvent(out var closedEvent))
|
||||
OnSurvivalEventClosed?.Invoke(closedEvent);
|
||||
x.Value -= 1;
|
||||
}
|
||||
}
|
||||
public event Action<IPlayerSurvivalState> OnSurvivalStateChanged;
|
||||
public event Action<IPlayerSurvivalEvent> OnSurvivalEventOpened;
|
||||
public event Action<IPlayerSurvivalEvent> OnSurvivalEventClosed;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,19 +36,13 @@ namespace BITFALL.Scenes
|
|||
if(EditorApplication.isPlaying is false)
|
||||
return;
|
||||
#endif
|
||||
rigidbodyComponent.Velocity = animator.velocity;
|
||||
rigidbodyComponent.AngularVelocity = animator.angularVelocity;
|
||||
rigidbodyComponent.MoveAndRotate(currentPosition,currentRotation);
|
||||
}
|
||||
private void OnAnimatorMove()
|
||||
{
|
||||
animator.ApplyBuiltinRootMotion();
|
||||
#if UNITY_EDITOR
|
||||
// if (EditorApplication.isPlaying is false)
|
||||
// {
|
||||
// transform.position = animator.rootPosition;
|
||||
// transform.rotation = animator.rootRotation;
|
||||
// }
|
||||
#endif
|
||||
|
||||
currentPosition = animator.rootPosition;
|
||||
currentRotation = animator.rootRotation;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
"GUID:2289059ddf1745b4d80a0f184af99d6b",
|
||||
"GUID:9354affc93e0f3e4a904785e7d4c0f59",
|
||||
"GUID:1bb4187526a9431478feccaef064696a",
|
||||
"GUID:26fc13cbbc427414f9af2143d581330a"
|
||||
"GUID:26fc13cbbc427414f9af2143d581330a",
|
||||
"GUID:96f476e982d6fb945bfc9140ba094b7f",
|
||||
"GUID:ef0bb553b58b90b488bdbe8672e3be0b"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using BITFALL.Player.Equip;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using UnityEngine.InputSystem;
|
||||
|
@ -9,6 +10,7 @@ using BITKit.UX;
|
|||
using BITKit.Entities;
|
||||
using BITKit.Entities.Player;
|
||||
using BITKit.Steamwork;
|
||||
using UnityEditor;
|
||||
|
||||
namespace BITFALL.UX
|
||||
{
|
||||
|
@ -22,6 +24,7 @@ namespace BITFALL.UX
|
|||
|
||||
[Header(Constant.Header.Components)]
|
||||
[SerializeField] private UXImage crosshairImage;
|
||||
[SerializeField] private UXImage crosshairParentImage;
|
||||
[SerializeField] private UXLabel playerNameLabel;
|
||||
[SerializeField] private UXImage playerAvatarImage;
|
||||
[SerializeField] private UXBar healthBar;
|
||||
|
@ -33,6 +36,8 @@ namespace BITFALL.UX
|
|||
public UXLabel nameLabel;
|
||||
private IHealth _health;
|
||||
protected IEntityMovement _entityMovement;
|
||||
|
||||
private IEquipService _equipService;
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
@ -85,6 +90,8 @@ namespace BITFALL.UX
|
|||
playerNameLabel.Set(steamService.Name);
|
||||
var avatar = await steamService.GetAvatarAsync(cancellationToken);
|
||||
playerAvatarImage.SetTexture(avatar);
|
||||
|
||||
_equipService = entity.Get<IEquipService>();
|
||||
}
|
||||
private void OnInventory(InputAction.CallbackContext context)
|
||||
{
|
||||
|
@ -98,6 +105,11 @@ namespace BITFALL.UX
|
|||
{
|
||||
if (playerService.LocalPlayer is null) return;
|
||||
crosshairImage.SetPosition(_entityMovement.ViewCenter + _entityMovement.ViewRotation * Vector3.forward);
|
||||
|
||||
if(_equipService is null) return;
|
||||
|
||||
var currentCrosshairOpacity = crosshairParentImage.visualElement.style.opacity.value;
|
||||
crosshairParentImage.visualElement.style.opacity = Mathf.Lerp(currentCrosshairOpacity, _equipService.Zoom.Allow ? 0 : 1, Time.deltaTime * 5);
|
||||
}
|
||||
|
||||
private static void OnReturn(InputAction.CallbackContext context)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using BITFALL.Player.Inventory;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using UnityEngine.InputSystem;
|
||||
|
@ -146,7 +147,7 @@ namespace BITFALL.UX
|
|||
}
|
||||
private void UseItem(IBasicItem item)
|
||||
{
|
||||
_entity.Get<TaskPublisher<IBasicItem>>().Execute(item);
|
||||
_entity.Get<IPlayerInventory>().TryUseItem(item);
|
||||
}
|
||||
private void DropItem(IBasicItem item)
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@ using BITFALL.Player.Survival;
|
|||
using BITKit.Entities;
|
||||
using BITKit.Entities.Player;
|
||||
using BITKit.UX;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using RotaryHeart.Lib.SerializableDictionary;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TextCore.Text;
|
||||
|
@ -16,46 +17,33 @@ namespace BITFALL.UX
|
|||
public class UXSurvival : MonoBehaviour
|
||||
{
|
||||
[SerializeReference,SubclassSelector] private IPlayerService playerService;
|
||||
[SerializeField] private SerializableDictionaryBase<string,Sprite> survivalEventIcons;
|
||||
[SerializeField] private UXBuilder survivalEventBuilder;
|
||||
private readonly ConcurrentDictionary<string,UXContainer> spawnedSurvivalEvents = new();
|
||||
private IPlayerSurvival _playerSurvival;
|
||||
private void Awake()
|
||||
private readonly ConcurrentDictionary<IPlayerSurvivalElement,UXContainer> spawnedSurvivalEvents = new();
|
||||
private IPlayerSurvivalService _playerSurvival;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
playerService.OnPlayerInitialized += OnPlayerInitialized;
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
playerService.OnPlayerInitialized -= OnPlayerInitialized;
|
||||
}
|
||||
private void OnPlayerInitialized(Entity obj)
|
||||
{
|
||||
_playerSurvival = obj.Get<IPlayerSurvival>();
|
||||
|
||||
_playerSurvival.OnSurvivalEventOpened += OnSurvivalEventOpened;
|
||||
_playerSurvival.OnSurvivalEventClosed += OnSurvivalEventClosed;
|
||||
}
|
||||
|
||||
private void OnSurvivalEventClosed(IPlayerSurvivalEvent obj)
|
||||
private async void OnPlayerInitialized(Entity obj)
|
||||
{
|
||||
if (spawnedSurvivalEvents.TryRemove(obj.GetType().Name, out var container))
|
||||
await UniTask.Yield();
|
||||
_playerSurvival = obj.Get<IPlayerSurvivalService>();
|
||||
foreach (var x in _playerSurvival.Elements)
|
||||
{
|
||||
container.visualElement.RemoveFromHierarchy();
|
||||
spawnedSurvivalEvents.GetOrAdd(x, Create);
|
||||
}
|
||||
}
|
||||
private void OnSurvivalEventOpened(IPlayerSurvivalEvent obj)
|
||||
{
|
||||
spawnedSurvivalEvents.GetOrAdd(obj.GetType().Name, (x)=>Create(obj));
|
||||
}
|
||||
private UXContainer Create(IPlayerSurvivalEvent playerSurvivalEvent)
|
||||
private UXContainer Create(IPlayerSurvivalElement arg)
|
||||
{
|
||||
var container = survivalEventBuilder.BuildAsContainer();
|
||||
var key = playerSurvivalEvent.GetType().Name;
|
||||
if (survivalEventIcons.TryGetValue(key, out var sprite))
|
||||
{
|
||||
container.icon.style.backgroundImage = new StyleBackground(sprite);
|
||||
}
|
||||
container.contextLabel.text = playerSurvivalEvent.Title;
|
||||
container.Get<Label>(0).text = arg.Name;
|
||||
container.SetProcess(arg.Value);
|
||||
|
||||
arg.OnValueChanged += value => container.SetProcess(value*0.01f);
|
||||
|
||||
spawnedSurvivalEvents.TryAdd(arg,container);
|
||||
return container;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<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="False">
|
||||
<ui:Template name="BITQuestElement" src="project://database/Assets/BITKit/Unity/UX/BITQuestElement.uxml?fileID=9197481963319205126&guid=e76b752484c652b44afef2ac0afd5dd6&type=3#BITQuestElement" />
|
||||
<ui:Template name="DialogueLabel" src="project://database/Assets/Artists/UX/DialogueLabel.uxml?fileID=9197481963319205126&guid=3ff4d7289dadb214fbfb566f1312a6e0&type=3#DialogueLabel" />
|
||||
<ui:Template name="Survival-Template" src="project://database/Assets/Artists/UX/Survival-Template.uxml?fileID=9197481963319205126&guid=b75c1744172f96e4cb694204bfd48b98&type=3#Survival-Template" />
|
||||
<Style src="project://database/Assets/BITKit/Unity/UX/BITQuest.uss?fileID=7433441132597879392&guid=5c2d746d52de8e340b788034994ee23e&type=3#BITQuest" />
|
||||
<Style src="project://database/Assets/BITKit/Unity/UX/Common/Common.uss?fileID=7433441132597879392&guid=a3a69d3518fd02b489e721f3c5b0b539&type=3#Common" />
|
||||
<ui:VisualElement name="Profiler" class="pa-16" style="position: absolute; flex-direction: row;">
|
||||
|
@ -20,11 +19,11 @@
|
|||
<ui:VisualElement name="interactive-container" class="flex-center" style="left: 128px;">
|
||||
<ui:Label text="互动" display-tooltip-when-elided="true" name="name-label" style="background-color: rgb(210, 210, 210); padding-left: 8px; padding-right: 8px; padding-top: 4px; padding-bottom: 4px; color: rgb(7, 7, 7);" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="CrossHair" class="root">
|
||||
<ui:VisualElement name="crosshair-image" style="margin-left: auto; margin-right: auto; margin-top: auto; margin-bottom: auto; background-color: rgba(255, 255, 255, 0.5); width: 8px; height: 8px; border-top-left-radius: 110px; border-bottom-left-radius: 110px; border-top-right-radius: 110px; border-bottom-right-radius: 110px;" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="CrossHair" class="root">
|
||||
<ui:VisualElement name="crosshair-image--fixed" class="flex-center" style="width: 64px; height: 64px; background-image: url('project://database/Assets/Artists/Arts/Icons/Crosshair_No_Dot.png?fileID=2800000&guid=507fe62dcf74ad84d966ea70a924771e&type=3#Crosshair_No_Dot');" />
|
||||
<ui:VisualElement name="crosshair-container" class="root">
|
||||
<ui:VisualElement name="crosshair-image--fixed" style="margin-left: auto; margin-right: auto; margin-top: auto; margin-bottom: auto; background-color: rgba(255, 255, 255, 0.5); width: 8px; height: 8px; border-top-left-radius: 110px; border-bottom-left-radius: 110px; border-top-right-radius: 110px; border-bottom-right-radius: 110px;" />
|
||||
<ui:VisualElement class="root">
|
||||
<ui:VisualElement name="crosshair-image" class="flex-center" style="width: 64px; height: 64px; background-image: url('project://database/Assets/Artists/Arts/Icons/Crosshair_No_Dot.png?fileID=2800000&guid=507fe62dcf74ad84d966ea70a924771e&type=3#Crosshair_No_Dot');" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="equips-container" style="position: absolute; right: 64px; bottom: 64px;">
|
||||
<ui:VisualElement name="currentEquip-image" style="background-image: url('project://database/Assets/Artists/Arts/Icons/Items/ICON_M4A1_Full.png?fileID=2800000&guid=8c4b3d8772ae2a54eaba9d401a095089&type=3#ICON_M4A1_Full'); -unity-background-scale-mode: scale-to-fit; width: 256px; height: 128px;" />
|
||||
|
@ -47,8 +46,5 @@
|
|||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="survival-container" style="top: 8px;">
|
||||
<ui:Instance template="Survival-Template" name="Survival-Template" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<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="False">
|
||||
<ui:Template name="Container" src="project://database/Assets/Artists/UX/Container.uxml?fileID=9197481963319205126&guid=9700c94aaf0e5c048a3106e389bf16f4&type=3#Container" />
|
||||
<ui:Template name="ItemContainer" src="project://database/Assets/Artists/UX/ItemContainer.uxml?fileID=9197481963319205126&guid=6e7ac9656332fa2489cc7fe4a9f0bf81&type=3#ItemContainer" />
|
||||
<ui:Template name="Survival-Template" src="project://database/Assets/Artists/UX/Survival-Template.uxml?fileID=9197481963319205126&guid=b75c1744172f96e4cb694204bfd48b98&type=3#Survival-Template" />
|
||||
<Style src="project://database/Assets/Artists/UX/Inventory.uss?fileID=7433441132597879392&guid=48b2564db1f95a443b921af9745fd92a&type=3#Inventory" />
|
||||
<Style src="project://database/Assets/BITKit/Unity/UX/Common/Common.uss?fileID=7433441132597879392&guid=a3a69d3518fd02b489e721f3c5b0b539&type=3#Common" />
|
||||
<ui:VisualElement name="Background" picking-mode="Ignore" style="position: absolute; left: 0; top: -2px; right: 0; bottom: 2px; background-color: rgba(0, 0, 0, 0.78); justify-content: center;" />
|
||||
|
@ -15,7 +16,7 @@
|
|||
<ui:VisualElement name="inventory-window" picking-mode="Ignore" style="align-items: flex-start; display: flex; flex-direction: row; justify-content: space-between;">
|
||||
<ui:VisualElement name="equips-container" style="display: flex; margin-left: 0; margin-right: 0; background-color: rgb(32, 32, 32); padding-left: 16px; padding-right: 16px; padding-top: 16px; padding-bottom: 16px;">
|
||||
<ui:Label text="已装备配置" display-tooltip-when-elided="true" class="title" style="display: flex;" />
|
||||
<ui:VisualElement name="equip-container" style="width: 768px; height: 768px; display: flex; padding-left: 24px; padding-right: 24px; padding-top: 24px; padding-bottom: 24px; flex-direction: column; align-items: flex-start; justify-content: flex-start; flex-wrap: nowrap; background-color: rgb(16, 16, 16);">
|
||||
<ui:VisualElement name="equip-container" style="width: 768px; height: 768px; display: flex; padding-left: 24px; padding-right: 24px; padding-top: 24px; padding-bottom: 24px; flex-direction: column; align-items: stretch; justify-content: flex-start; flex-wrap: nowrap; background-color: rgb(16, 16, 16);">
|
||||
<ui:VisualElement name="Weapons">
|
||||
<ui:Label text="武器装备" display-tooltip-when-elided="true" class="title" />
|
||||
<ui:VisualElement style="flex-direction: row;">
|
||||
|
@ -56,6 +57,9 @@
|
|||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="survival-container" style="flex-grow: 1;">
|
||||
<ui:Instance template="Survival-Template" name="Survival-Template" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="player-status" style="display: flex; visibility: visible; overflow: visible;" />
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements">
|
||||
<ui:VisualElement name="survival-template" style="flex-direction: row;">
|
||||
<ui:VisualElement name="icon-image" style="width: 32px; height: 32px; background-color: rgb(255, 255, 255);" />
|
||||
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" name="context-label" />
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
|
||||
<ui:VisualElement style="flex-direction: row; margin-left: 4px; margin-right: 4px; margin-top: 4px; margin-bottom: 4px;">
|
||||
<ui:Label tabindex="-1" text="Label" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Label--0" />
|
||||
<ui:VisualElement style="flex-grow: 1; background-color: rgba(255, 255, 255, 0.13); height: 32px; justify-content: space-between; flex-direction: row;">
|
||||
<ui:VisualElement name="fill-bar" style="width: 64%; background-color: rgba(255, 255, 255, 0.96);" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
|
|
|
@ -1,3 +1,17 @@
|
|||
{
|
||||
"name": "BITFALL.Player.Equip"
|
||||
}
|
||||
"name": "BITFALL.Player.Equip",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||
"GUID:709caf8d7fb6ef24bbba0ab9962a3ad0"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
|
@ -1,18 +1,12 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class IEquipService : MonoBehaviour
|
||||
using BITKit;
|
||||
namespace BITFALL.Player.Equip
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
public interface IEquipService
|
||||
{
|
||||
IOptional<float> Zoom { get; }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"name": "BITFALL.Player.Inventory",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||
"GUID:677cd05ca06c46b4395470200b1acdad"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using BITKit;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITFALL.Player.Inventory
|
||||
{
|
||||
public interface IPlayerInventory
|
||||
{
|
||||
bool TryUseItem(IBasicItem item);
|
||||
event Func<IBasicItem, bool> OnUseItem;
|
||||
}
|
||||
}
|
||||
|
|
@ -8,62 +8,34 @@ using UnityEngine;
|
|||
|
||||
namespace BITFALL.Player.Survival
|
||||
{
|
||||
public interface IPlayerSurvivalService
|
||||
{
|
||||
IPlayerSurvivalElement[] Elements { get; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 玩家生存接口
|
||||
/// </summary>
|
||||
public interface IPlayerSurvival
|
||||
public interface IPlayerSurvivalElement
|
||||
{
|
||||
/// <summary>
|
||||
/// 当玩家生存元素更新时
|
||||
/// </summary>
|
||||
event Action<IPlayerSurvivalState> OnSurvivalStateChanged;
|
||||
/// <summary>
|
||||
/// 当玩家进入状态时
|
||||
/// </summary>
|
||||
event Action<IPlayerSurvivalEvent> OnSurvivalEventOpened;
|
||||
/// <summary>
|
||||
/// 当玩家退出状态时
|
||||
/// </summary>
|
||||
event Action<IPlayerSurvivalEvent> OnSurvivalEventClosed;
|
||||
string Name { get; }
|
||||
public int Value { get; set; }
|
||||
event Action<int> OnValueChanged;
|
||||
}
|
||||
/// <summary>
|
||||
/// 玩家生存元素,例如生命值、饥饿值、水分值等
|
||||
/// </summary>
|
||||
public interface IPlayerSurvivalState
|
||||
{
|
||||
/// <summary>
|
||||
/// 初始化状态
|
||||
/// </summary>
|
||||
void OnStateInitialize();
|
||||
/// <summary>
|
||||
/// 初始化异步状态
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">取消令牌</param>
|
||||
/// <returns></returns>
|
||||
UniTask OnStateInitializeAsync(CancellationToken cancellationToken);
|
||||
/// <summary>
|
||||
/// 已完成初始化
|
||||
/// </summary>
|
||||
void OnStateInitialized();
|
||||
/// <summary>
|
||||
/// 处理状态,类似于Update
|
||||
/// </summary>
|
||||
void ProcessState();
|
||||
/// <summary>
|
||||
/// 尝试获取新的状态事件
|
||||
/// </summary>
|
||||
bool TryGetNewEvent(out IPlayerSurvivalEvent newState);
|
||||
/// <summary>
|
||||
/// 尝试获取已关闭的状态事件
|
||||
/// </summary>
|
||||
bool TryGetClosedEvent(out IPlayerSurvivalEvent closedState);
|
||||
}
|
||||
/// <summary>
|
||||
/// 玩家生存时间,例如饿了,渴了和生病了
|
||||
/// </summary>
|
||||
public interface IPlayerSurvivalEvent
|
||||
{
|
||||
string Title { get; }
|
||||
string Message { get; }
|
||||
public abstract class PlayerSurvivalElement:IPlayerSurvivalElement{
|
||||
public virtual string Name=>GetType().Name;
|
||||
private int _value = 100;
|
||||
public int Value {
|
||||
get => _value;
|
||||
set
|
||||
{
|
||||
_value = Mathf.Clamp(value, 0, 100);
|
||||
OnValueChanged?.Invoke(value);
|
||||
}
|
||||
}
|
||||
public event Action<int> OnValueChanged;
|
||||
}
|
||||
[Serializable]
|
||||
public sealed class PlayerSurvivalHunger:PlayerSurvivalElement{}
|
||||
[Serializable]
|
||||
public sealed class PlayerSurvivalThirst:PlayerSurvivalElement{}
|
||||
}
|
||||
|
|
|
@ -1,105 +0,0 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using BITKit;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITFALL.Player.Survival
|
||||
{
|
||||
public abstract class PlayerSurvivalState:IPlayerSurvivalState
|
||||
{
|
||||
public virtual void OnStateInitialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual UniTask OnStateInitializeAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
public virtual void OnStateInitialized()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void ProcessState()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual bool TryGetNewEvent(out IPlayerSurvivalEvent newState)
|
||||
{
|
||||
newState = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool TryGetClosedEvent(out IPlayerSurvivalEvent closedState)
|
||||
{
|
||||
closedState = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 递减的玩家生存状态
|
||||
/// </summary>
|
||||
public abstract class PlayerSurvivalDecrementState:PlayerSurvivalState
|
||||
{
|
||||
[SerializeField] protected int value;
|
||||
public override void ProcessState()
|
||||
{
|
||||
value = Mathf.Clamp(value - 1, 0, 100);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 玩家饥饿值
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class PlayerHunger : PlayerSurvivalDecrementState
|
||||
{
|
||||
private bool _isHungry;
|
||||
public override bool TryGetNewEvent(out IPlayerSurvivalEvent newState)
|
||||
{
|
||||
newState = null;
|
||||
if (_isHungry|| value >= 50) return false;
|
||||
_isHungry = true;
|
||||
newState = new PlayerFeelHungryEvent();
|
||||
BIT4Log.Log<PlayerHunger>("玩家饿了");
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool TryGetClosedEvent(out IPlayerSurvivalEvent closedState)
|
||||
{
|
||||
if(_isHungry && value >= 50)
|
||||
{
|
||||
_isHungry = false;
|
||||
closedState = new PlayerFeelHungryEvent();
|
||||
BIT4Log.Log<PlayerHunger>("玩家不饿了");
|
||||
return true;
|
||||
}
|
||||
closedState = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 玩家水分值
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class PlayerHydration : PlayerSurvivalState
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// 玩家健康值
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class PlayerHealth : PlayerSurvivalState
|
||||
{
|
||||
|
||||
}
|
||||
public class PlayerFeelHungryEvent : IPlayerSurvivalEvent
|
||||
{
|
||||
public string Title => "饿了";
|
||||
public string Message =>"你饿了,找点东西吃吧";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using BITKit;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITFALL.Player.Survival
|
||||
{
|
||||
public abstract class PlayerEatAdd:IProperty
|
||||
{
|
||||
[SerializeField] private int value;
|
||||
public int Value => value;
|
||||
}
|
||||
[Serializable]
|
||||
public class PlayerEatAddHunger:PlayerEatAdd{}
|
||||
[Serializable]
|
||||
public class PlayerEatAddThirst:PlayerEatAdd{}
|
||||
[Serializable]
|
||||
public class PlayerEatAddHealth:PlayerEatAdd{}
|
||||
[Serializable]
|
||||
public class PlayerEatAddStamina:PlayerEatAdd{}
|
||||
[Serializable]
|
||||
public class PlayerEatAddEnergy:PlayerEatAdd{}
|
||||
[Serializable]
|
||||
public class PlayerEatAddSanity:PlayerEatAdd{}
|
||||
[Serializable]
|
||||
public class PlayerEatAddTemperature:PlayerEatAdd{}
|
||||
[Serializable]
|
||||
public class PlayerEatAddWetness:PlayerEatAdd{}
|
||||
}
|
|
@ -7,6 +7,7 @@ using Cysharp.Threading.Tasks;
|
|||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
// ReSharper disable StringLiteralTypo
|
||||
#if NET5_0_OR_GREATER
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
#endif
|
||||
|
@ -19,6 +20,10 @@ namespace BITKit
|
|||
}
|
||||
public class BITApp
|
||||
{
|
||||
public static async UniTask SwitchToMainThread()
|
||||
{
|
||||
await UniTask.SwitchToSynchronizationContext(SynchronizationContext);
|
||||
}
|
||||
public static class Time
|
||||
{
|
||||
public static float DeltaTime { get; internal set; }
|
||||
|
@ -59,7 +64,89 @@ namespace BITKit
|
|||
"TextCopy",
|
||||
"Blazored",
|
||||
"TextCopy",
|
||||
"mattatz"
|
||||
"mattatz",
|
||||
"TrailsFX",
|
||||
"Knife",
|
||||
"Needle",
|
||||
"NiceIO",
|
||||
"AndroidPlayerBuildProgram",
|
||||
"DocCodeExamples",
|
||||
"System",
|
||||
"UnityEngine",
|
||||
"Unity",
|
||||
"Microsoft",
|
||||
"UnityEditor",
|
||||
"Google",
|
||||
"Mono",
|
||||
"ZXing",
|
||||
"ImmersiveVRTools",
|
||||
"MonKey",
|
||||
"FLib",
|
||||
"Kcp",
|
||||
"Udx",
|
||||
"Sirenix",
|
||||
"TMPro",
|
||||
"RotaryHeart",
|
||||
"Cinemachine",
|
||||
"ParadoxNotion",
|
||||
"Net",
|
||||
"VSCodeEditor",
|
||||
"AOT",
|
||||
"UnityEditorInternal",
|
||||
"UnityEngineInternal",
|
||||
"JetBrains",
|
||||
"Bee",
|
||||
"NotInvited",
|
||||
"HighlightPlus",
|
||||
"DG",
|
||||
"Hierarchy2",
|
||||
"Cysharp",
|
||||
"JetBrains",
|
||||
"Packages",
|
||||
"Newtonsoft_X",
|
||||
"Binding",
|
||||
"NodeCanvas",
|
||||
"SaveDuringPlay",
|
||||
"LimWorks",
|
||||
"MagicaCloth2",
|
||||
"FastScriptReload",
|
||||
"ParrelSync",
|
||||
"KinematicCharacterController",
|
||||
"LimWorksEditor",
|
||||
"BuildComponent",
|
||||
"dnlib",
|
||||
"BigIntegerLibrary",
|
||||
"Ionic",
|
||||
"log4net",
|
||||
"ImmersiveVrToolsCommon",
|
||||
"NUnit",
|
||||
"HarmonyLib",
|
||||
"MonoMod",
|
||||
"WebDav",
|
||||
"PlasticGui",
|
||||
"Codice",
|
||||
"GluonGui",
|
||||
"PlasticPipe",
|
||||
"XDiffGui",
|
||||
"MacFsWatcher",
|
||||
"MacUI",
|
||||
"PlayerBuildProgramLibrary",
|
||||
"ExCSS",
|
||||
"ScriptCompilationBuildProgram",
|
||||
"BeeBuildProgramCommon",
|
||||
"Accessibility",
|
||||
"CodiceApp",
|
||||
"Newtonsoft",
|
||||
"MergetoolGui",
|
||||
"TreeEditor",
|
||||
"MackySoft",
|
||||
"FullscreenEditor",
|
||||
"mattatz",
|
||||
"AYellowpaper",
|
||||
"kcp2k",
|
||||
"MeshCombineStudio",
|
||||
"AmazingAssets",
|
||||
"Utilities"
|
||||
};
|
||||
}
|
||||
#if NET5_0_OR_GREATER
|
||||
|
@ -144,7 +231,8 @@ namespace BITKit
|
|||
public static InitializationState State;
|
||||
public static Assembly[] Assemblies;
|
||||
public static AppSettings Settings { get; protected set; }
|
||||
public static async void Start(string appName = nameof(BITApp),AppSettings settings=default)
|
||||
private static DateTime InitialTime { get; set; }=DateTime.Now;
|
||||
public static async UniTask Start(string appName = nameof(BITApp),AppSettings settings=default)
|
||||
{
|
||||
Time.TimeAsDouble = 0;
|
||||
Time.DeltaTime = 1 / 60f;
|
||||
|
@ -153,7 +241,7 @@ namespace BITKit
|
|||
CancellationTokenSource = new CancellationTokenSource();
|
||||
AppName = appName;
|
||||
ThreadHelper.LogCurrentThread();
|
||||
|
||||
InitialTime = DateTime.Now;
|
||||
await Init();
|
||||
}
|
||||
private static async Task Init()
|
||||
|
@ -182,10 +270,16 @@ namespace BITKit
|
|||
reflectionHelperWatch.Start();
|
||||
await ReflectionHelper.Init();
|
||||
reflectionHelperWatch.Stop();
|
||||
|
||||
Stopwatch commandWatch = new();
|
||||
await BITCommands.InitializeAsync();
|
||||
commandWatch.Stop();
|
||||
|
||||
|
||||
stopwatch.Stop();
|
||||
State = InitializationState.Initialized;
|
||||
BIT4Log.Log<BITApp>($"已完成初始化,耗时:{stopwatch.ElapsedMilliseconds}ms");
|
||||
BIT4Log.Log<BITApp>($"反射初始化耗时:{reflectionHelperWatch.ElapsedMilliseconds}ms");
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
|
@ -196,11 +290,18 @@ namespace BITKit
|
|||
}
|
||||
public static void Stop()
|
||||
{
|
||||
var runTime = DateTime.Now - InitialTime;
|
||||
|
||||
BIT4Log.Log<BITApp>($"正在停止{nameof(BITApp)}");
|
||||
CancellationTokenSource.Cancel();
|
||||
State = InitializationState.None;
|
||||
|
||||
BITCommands.Dispose();
|
||||
|
||||
BIT4Log.Log<BITApp>($"已停止{nameof(BITApp)}");
|
||||
BIT4Log.Log<BITApp>($"运行时间:{runTime}");
|
||||
BIT4Log.Log<BITApp>("Exit Code:0");
|
||||
|
||||
}
|
||||
public static void Run(string path, string WorkingDirectory = "")
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#if NETCOREAPP
|
||||
using System;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
namespace BITKit;
|
||||
|
||||
public class BITAppForNet
|
||||
|
@ -18,7 +18,7 @@ public class BITAppForNet
|
|||
BIT4Log.OnSetConsoleColor += color => Console.ForegroundColor = color;
|
||||
BIT4Log.OnNextLine += Console.WriteLine;
|
||||
|
||||
BITApp.Start(name);
|
||||
await BITApp.Start(name);
|
||||
await BITBinary.Start();
|
||||
}
|
||||
public static UniTask DisposeAsync()
|
||||
|
|
|
@ -9,4 +9,14 @@ namespace BITKit
|
|||
{
|
||||
|
||||
}
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = true, Inherited = true)]
|
||||
public class CustomTypeAttribute : System.Attribute
|
||||
{
|
||||
public readonly Type Type;
|
||||
public CustomTypeAttribute(Type type)
|
||||
{
|
||||
|
||||
Type = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
using System;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace BITKit.Auth
|
||||
{
|
||||
/// <summary>
|
||||
/// 授权服务
|
||||
/// </summary>
|
||||
public interface IAuthService
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否已授权
|
||||
/// </summary>
|
||||
bool IsAuthorized { get; }
|
||||
/// <summary>
|
||||
/// 是否正在授权
|
||||
/// </summary>
|
||||
bool IsAuthorizing { get; }
|
||||
/// <summary>
|
||||
/// 异步开始授权
|
||||
/// </summary>
|
||||
/// <param name="token">令牌</param>
|
||||
UniTask AuthorizeAsync(string token);
|
||||
/// <summary>
|
||||
/// 异步取消授权
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
UniTask CancelAuthorizationAsync();
|
||||
/// <summary>
|
||||
/// 开始授权的回调
|
||||
/// </summary>
|
||||
event Action<string> OnAuthorize;
|
||||
/// <summary>
|
||||
/// 已授权的回调
|
||||
/// </summary>
|
||||
event Action<string> OnAuthorized;
|
||||
/// <summary>
|
||||
/// 取消授权的回调
|
||||
/// </summary>
|
||||
event Action<string> UnAuthorize;
|
||||
/// <summary>
|
||||
/// 授权失败的回调
|
||||
/// </summary>
|
||||
event Action<string> OnAuthorizeFailure;
|
||||
}
|
||||
public abstract class AuthServiceImplement:IAuthService
|
||||
{
|
||||
protected abstract IAuthService service { get; }
|
||||
bool IAuthService.IsAuthorized => service.IsAuthorized;
|
||||
|
||||
bool IAuthService.IsAuthorizing => service.IsAuthorizing;
|
||||
|
||||
UniTask IAuthService.AuthorizeAsync(string token)
|
||||
{
|
||||
return service.AuthorizeAsync(token);
|
||||
}
|
||||
|
||||
UniTask IAuthService.CancelAuthorizationAsync()
|
||||
{
|
||||
return service.CancelAuthorizationAsync();
|
||||
}
|
||||
|
||||
event Action<string> IAuthService.OnAuthorize
|
||||
{
|
||||
add => service.OnAuthorize += value;
|
||||
remove => service.OnAuthorize -= value;
|
||||
}
|
||||
|
||||
event Action<string> IAuthService.OnAuthorized
|
||||
{
|
||||
add => service.OnAuthorized += value;
|
||||
remove => service.OnAuthorized -= value;
|
||||
}
|
||||
|
||||
event Action<string> IAuthService.UnAuthorize
|
||||
{
|
||||
add => service.UnAuthorize += value;
|
||||
remove => service.UnAuthorize -= value;
|
||||
}
|
||||
|
||||
event Action<string> IAuthService.OnAuthorizeFailure
|
||||
{
|
||||
add => service.OnAuthorizeFailure += value;
|
||||
remove => service.OnAuthorizeFailure -= value;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
#if UNITY
|
||||
#if NET5_0_OR_GREATER
|
||||
#else
|
||||
using UnityEngine;
|
||||
#endif
|
||||
using System;
|
||||
|
@ -6,7 +7,9 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using Cysharp.Threading.Tasks;
|
||||
#if NET5_0_OR_GREATER
|
||||
using Microsoft.SqlServer.Server;
|
||||
#endif
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BITKit
|
||||
|
@ -14,27 +17,37 @@ namespace BITKit
|
|||
public class BITBinary
|
||||
{
|
||||
private static readonly Dictionary<string, INetMessageReader> netReaders = new();
|
||||
private static readonly List<Type> serializableTypes = new();
|
||||
#if NET5_0_OR_GREATER
|
||||
public static readonly List<Type> serializableTypes = new();
|
||||
#endif
|
||||
|
||||
public static async UniTask Start()
|
||||
{
|
||||
netReaders.Clear();
|
||||
#if NET5_0_OR_GREATER
|
||||
serializableTypes.Clear();
|
||||
#endif
|
||||
foreach (var x in await ReflectionHelper.GetInstances<INetMessageReader>())
|
||||
{
|
||||
var typeName = x.GetMessageType().FullName;
|
||||
if (typeName == null) continue;
|
||||
netReaders.Add(typeName, x);
|
||||
BIT4Log.Log<BITBinary>($"已注册类型:{typeName}");
|
||||
}
|
||||
#if NET5_0_OR_GREATER
|
||||
var serializes = await ReflectionHelper.GetInstances<IBinarySerialize>();
|
||||
#if UNITY
|
||||
serializes = serializes.Where(x => x is not UnityEngine.Object);
|
||||
#else
|
||||
|
||||
#endif
|
||||
foreach (var x in serializes)
|
||||
{
|
||||
serializableTypes.Add(x.GetType());
|
||||
BIT4Log.Log<BITBinary>($"已注册类型:{x.GetType().FullName}");
|
||||
}
|
||||
// #if NET5_0_OR_GREATER
|
||||
// #else
|
||||
// serializes = serializes.Where(x => x is not UnityEngine.Object);
|
||||
// #endif
|
||||
// foreach (var x in serializes)
|
||||
// {
|
||||
// serializableTypes.Add(x.GetType());
|
||||
// BIT4Log.Log<BITBinary>($"已注册类型:{x.GetType().FullName}");
|
||||
// }
|
||||
}
|
||||
|
||||
public static object Read<T>(byte[] buffer) => (T)ReadAsValue(buffer);
|
||||
|
@ -60,18 +73,12 @@ namespace BITKit
|
|||
|
||||
var typeName = reader.ReadString();
|
||||
if (netReaders.TryGetValue(typeName, out var netReader))
|
||||
{
|
||||
return netReader.ReadBinaryAsObject(reader);
|
||||
}
|
||||
var json = reader.ReadString();
|
||||
json = reader.ReadString();
|
||||
try
|
||||
{
|
||||
|
||||
if (BITSharp.TryGetTypeFromFullName(typeName, out var type))
|
||||
{
|
||||
return JsonConvert.DeserializeObject(json, type);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
@ -119,10 +126,12 @@ namespace BITKit
|
|||
{
|
||||
netReader.WriteBinaryAsObject(writer,value);
|
||||
}
|
||||
#if NET5_0_OR_GREATER
|
||||
else if( value is IBinarySerialize serialize)
|
||||
{
|
||||
serialize.Write(writer);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
//throw new Exception($"没有找到{value.GetType().Name}的Binary写入方法");
|
||||
|
@ -139,10 +148,12 @@ namespace BITKit
|
|||
{
|
||||
return true;
|
||||
}
|
||||
else if (serializableTypes.Any(x => x.FullName == typeName))
|
||||
#if NET5_0_OR_GREATER
|
||||
else if (serializableTypes.Any(x => x.FullName == typeName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,19 @@ namespace BITKit
|
|||
}
|
||||
public static async void Excute(string cmd)
|
||||
{
|
||||
var cmdSplit = cmd.Split("|");
|
||||
if (cmdSplit.Length is 1 or 0)
|
||||
{
|
||||
cmdSplit = cmd.Split("\n");
|
||||
}
|
||||
if (cmdSplit.Length > 1)
|
||||
{
|
||||
foreach (var x in cmdSplit)
|
||||
{
|
||||
Excute(x);
|
||||
}
|
||||
return;
|
||||
}
|
||||
await UniTask.SwitchToThreadPool();
|
||||
await TaskHelper.WaitUntil(() => state is InitializationState.Initialized);
|
||||
var split = cmd.Split(" ").ToList();
|
||||
|
@ -87,27 +100,24 @@ namespace BITKit
|
|||
}
|
||||
static Dictionary<string, MethodInfo> methodInfos = new();
|
||||
static InitializationState state;
|
||||
[ExcuteOnStart]
|
||||
public static void Start()
|
||||
public static async UniTask InitializeAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
Init();
|
||||
await Init();
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
|
||||
BIT4Log.LogException(e);
|
||||
}
|
||||
|
||||
}
|
||||
[ExcuteOnStop]
|
||||
public static void Stop()
|
||||
public static void Dispose()
|
||||
{
|
||||
state = 0;
|
||||
methodInfos.Clear();
|
||||
}
|
||||
static async void Init()
|
||||
private static async UniTask Init()
|
||||
{
|
||||
state = InitializationState.Initializing;
|
||||
await UniTask.SwitchToThreadPool();
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Security.Cryptography;
|
||||
namespace BITKit.Crypto
|
||||
{
|
||||
public class BITCrypto:ICryptography
|
||||
{
|
||||
public string Salt { get; set; } = "2196F3";
|
||||
public string Hash(string password)
|
||||
{
|
||||
var data = System.Text.Encoding.UTF8.GetBytes(password + Salt);
|
||||
return Convert.ToBase64String(data);
|
||||
}
|
||||
|
||||
public bool Verify(string password, string hash)
|
||||
{
|
||||
return Hash(password) == hash;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
namespace BITKit.Crypto
|
||||
{
|
||||
/// <summary>
|
||||
/// 加密接口
|
||||
/// </summary>
|
||||
public interface ICryptography
|
||||
{
|
||||
/// <summary>
|
||||
/// 盐
|
||||
/// </summary>
|
||||
public string Salt { get; set; }
|
||||
/// <summary>
|
||||
/// 获取Hash
|
||||
/// </summary>
|
||||
/// <param name="password"></param>
|
||||
/// <returns></returns>
|
||||
public string Hash(string password);
|
||||
/// <summary>
|
||||
/// 验证密码是否有效
|
||||
/// </summary>
|
||||
/// <param name="password">明文密码</param>
|
||||
/// <param name="hash"></param>
|
||||
/// <returns></returns>
|
||||
public bool Verify(string password, string hash);
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -3,7 +3,10 @@ using System.Collections.Generic;
|
|||
|
||||
namespace BITKit
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 双缓冲区
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public interface IDoubleBuffer<T>
|
||||
{
|
||||
T Current { get; }
|
||||
|
@ -11,7 +14,10 @@ namespace BITKit
|
|||
event Action<T> OnRelease;
|
||||
bool TryGetRelease(out T result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="IDoubleBuffer{T}"/>
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class DoubleBuffer<T> : IDoubleBuffer<T>
|
||||
{
|
||||
public T Current
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
using System.Threading;
|
||||
using System;
|
||||
using System.ComponentModel.Design;
|
||||
#if NET5_0_OR_GREATER
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
#endif
|
||||
namespace BITKit.Core.Entites
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -8,14 +12,11 @@ namespace BITKit.Core.Entites
|
|||
public interface IEntity
|
||||
{
|
||||
ulong Id { get; }
|
||||
#if NET5_0_OR_GREATER
|
||||
bool TryGetComponent<T>(out T component) where T : IEntityComponent;
|
||||
CancellationToken CancellationToken { get; }
|
||||
bool TryGetComponent<T>(out T component);
|
||||
IEntityComponent[] Components { get; }
|
||||
bool RegisterComponent<T>(T component) where T : IEntityComponent;
|
||||
#else
|
||||
|
||||
#endif
|
||||
|
||||
bool RegisterComponent<T>(T component);
|
||||
IServiceProvider ServiceProvider { get; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 基本实体组件
|
||||
|
@ -24,6 +25,9 @@ namespace BITKit.Core.Entites
|
|||
{
|
||||
Type BaseType { get; }
|
||||
IEntity Entity { get; set; }
|
||||
#if NET5_0_OR_GREATER
|
||||
void BuildService(IServiceCollection serviceCollection);
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// 基本实体服务
|
||||
|
@ -61,24 +65,28 @@ namespace BITKit.Core.Entites
|
|||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
IEntity Get(ulong id);
|
||||
|
||||
/// <summary>
|
||||
/// 查询Entity,例如
|
||||
/// </summary>
|
||||
/// <para>var rotationEntities=EntitiesService.Query<RotationComponent></para>
|
||||
IEntity[] Query<T>() where T : IEntityComponent;
|
||||
IEntity[] Query<T>();
|
||||
|
||||
/// <summary>
|
||||
/// 查询1个组件
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <returns></returns>
|
||||
T[] QueryComponents<T>() where T : IEntityComponent;
|
||||
T[] QueryComponents<T>();
|
||||
|
||||
/// <summary>
|
||||
/// 查询2个组件
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <returns></returns>
|
||||
ValueTuple<T,T1>[] QueryComponents<T,T1>()where T : IEntityComponent where T1 : IEntityComponent;
|
||||
ValueTuple<T, T1>[] QueryComponents<T, T1>();
|
||||
|
||||
/// <summary>
|
||||
/// 查询3个组件
|
||||
/// </summary>
|
||||
|
@ -86,7 +94,7 @@ namespace BITKit.Core.Entites
|
|||
/// <typeparam name="T1"></typeparam>
|
||||
/// <typeparam name="T2"></typeparam>
|
||||
/// <returns></returns>
|
||||
ValueTuple<T,T1,T2>[] QueryComponents<T,T1,T2>() where T : IEntityComponent where T1 : IEntityComponent where T2 : IEntityComponent;
|
||||
|
||||
ValueTuple<T, T1, T2>[] QueryComponents<T, T1, T2>();
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BITKit
|
||||
{
|
||||
public static class FuncExtensions
|
||||
{
|
||||
public static IEnumerable<Func<T0,T1>> CastAsFunc<T0,T1>(this Func<T0,T1> self)
|
||||
{
|
||||
return self.GetInvocationList().Cast<Func<T0, T1>>();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BITKit
|
||||
{
|
||||
public static class HttpClientExtensions
|
||||
{
|
||||
public static async UniTask<string> PostJsonAsync(this HttpClient self, string requestUrl, object value , CancellationToken cancellationToken=default)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(value);
|
||||
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
var response =await self.PostAsync(requestUrl, content, cancellationToken);
|
||||
return await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -33,6 +33,8 @@ namespace BITKit.Apps
|
|||
/// </summary>
|
||||
event Action<string> OnDownloadComplete;
|
||||
|
||||
event Action OnDetectedLatestVersion;
|
||||
|
||||
/// <summary>
|
||||
/// 下载最新版本
|
||||
/// </summary>
|
||||
|
|
|
@ -44,6 +44,19 @@ namespace BITKit
|
|||
return list;
|
||||
}
|
||||
|
||||
public static bool TryGetIndexOf<T>(this IEnumerable<T> self, Func<T, bool> factory, out int index)
|
||||
{
|
||||
index = -1;
|
||||
var enumerable = self as T[] ?? self.ToArray();
|
||||
for (var i = 0; i < enumerable.Length; i++)
|
||||
{
|
||||
var item = enumerable.ElementAt(i);
|
||||
if (!factory.Invoke(item)) continue;
|
||||
index = i;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static bool Contains<T>(IEnumerable<T> a, IEnumerable<T> b)
|
||||
{
|
||||
foreach (var x in b)
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
namespace BITKit
|
||||
// ReSharper restore CheckNamespace
|
||||
{
|
||||
public record ContextModel
|
||||
{
|
||||
public static ContextModel Get(object data)
|
||||
{
|
||||
return new ContextModel()
|
||||
{
|
||||
StatusCode = 200,
|
||||
Message = "success",
|
||||
Data = data
|
||||
};
|
||||
}
|
||||
public static ContextModel Error(string message)
|
||||
{
|
||||
return new ContextModel()
|
||||
{
|
||||
StatusCode = 500,
|
||||
Message = message,
|
||||
Data = false
|
||||
};
|
||||
}
|
||||
public static ContextModel GetFromJson(string json)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = new ContextModel();
|
||||
var jObject = JObject.Parse(json);
|
||||
if(jObject.TryGetValue("status_code",out var statusCode))
|
||||
result.StatusCode = statusCode.Value<int>();
|
||||
if(jObject.TryGetValue("message",out var message))
|
||||
result.Message = message.Value<string>();
|
||||
if (jObject.TryGetValue("data", out var data))
|
||||
result.Data = data;
|
||||
return JsonConvert.DeserializeObject<ContextModel>(json);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
BIT4Log.Warning(json);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public static implicit operator string(ContextModel self)
|
||||
{
|
||||
return self.ToString();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this);
|
||||
}
|
||||
|
||||
[JsonProperty("status_code")]
|
||||
public int StatusCode;
|
||||
[JsonProperty("message")]
|
||||
public string Message=string.Empty;
|
||||
[JsonProperty("data")]
|
||||
public object Data=string.Empty;
|
||||
[JsonIgnore]
|
||||
public bool IsSuccess => StatusCode is 200 or 0;
|
||||
public bool TryAs<T>(out T value)
|
||||
{
|
||||
switch (Data)
|
||||
{
|
||||
case T t:
|
||||
value = t;
|
||||
return true;
|
||||
case JToken jToken:
|
||||
value = jToken.ToObject<T>();
|
||||
return true;
|
||||
default:
|
||||
value = default;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
using Newtonsoft.Json;
|
||||
// ReSharper disable CheckNamespace
|
||||
namespace BITKit
|
||||
// ReSharper restore CheckNamespace
|
||||
{
|
||||
public record ContextModel
|
||||
{
|
||||
public static ContextModel Get(object data)
|
||||
{
|
||||
return new ContextModel()
|
||||
{
|
||||
code = 200,
|
||||
message = "success",
|
||||
data = data
|
||||
};
|
||||
}
|
||||
public static ContextModel Error(object data)
|
||||
{
|
||||
return new ContextModel()
|
||||
{
|
||||
code = 500,
|
||||
message = "failed",
|
||||
data = data
|
||||
};
|
||||
}
|
||||
public static implicit operator string(ContextModel self)
|
||||
{
|
||||
return JsonConvert.SerializeObject(self);
|
||||
}
|
||||
public int code;
|
||||
public string message=string.Empty;
|
||||
public object data=string.Empty;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
#if UNITY
|
||||
#else
|
||||
#if NET5_0_OR_GREATER
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
#else
|
||||
#endif
|
||||
using System;
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace BITKit.Net.Http
|
||||
{
|
||||
public interface IHttpListenerService
|
||||
{
|
||||
bool IsListening { get; }
|
||||
int Port { get; set; }
|
||||
public event Func<HttpListenerRequest,HttpContent> OnRequest;
|
||||
void Start();
|
||||
void Stop();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
|
||||
namespace BITKit.Net.Http
|
||||
{
|
||||
public class HttpListenerService:IHttpListenerService
|
||||
{
|
||||
public bool IsListening=>_httpListener.IsListening;
|
||||
public int Port { get; set; }
|
||||
private readonly HttpListener _httpListener = new();
|
||||
public event Func<HttpListenerRequest,HttpContent> OnRequest;
|
||||
private readonly CancellationTokenSource _cancellationTokenSource = new();
|
||||
private CancellationToken _cancellationToken=>_cancellationTokenSource.Token;
|
||||
|
||||
public HttpListenerService()
|
||||
{
|
||||
Port = 7001;
|
||||
}
|
||||
public HttpListenerService(int port)
|
||||
{
|
||||
Port = port;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
if (HttpListener.IsSupported is false)
|
||||
{
|
||||
throw new NotImplementedException("HttpListener is not supported this platform");
|
||||
}
|
||||
_httpListener.AuthenticationSchemes = AuthenticationSchemes.Anonymous;
|
||||
//_httpListener.Prefixes.Add($"http://localhost:{Port}/");
|
||||
#if NET5_0_OR_GREATER
|
||||
_httpListener.Prefixes.Add($"http://localhost:{Port}/");
|
||||
#else
|
||||
_httpListener.Prefixes.Add($"http://*:{Port}/");
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Thread thread = new(Process);
|
||||
thread.Start();
|
||||
}
|
||||
public void Stop()
|
||||
{
|
||||
_cancellationTokenSource.Cancel();
|
||||
_httpListener.Stop();
|
||||
BIT4Log.Log<IHttpListenerService>("Is Trying To Stop");
|
||||
}
|
||||
private void Process()
|
||||
{
|
||||
_httpListener.Start();
|
||||
BIT4Log.Log<IHttpListenerService>($"{Port}\tIs Listening");
|
||||
while (_cancellationToken.IsCancellationRequested is false)
|
||||
{
|
||||
var result = _httpListener.BeginGetContext(ListenerCallback, _httpListener);
|
||||
result.AsyncWaitHandle.WaitOne();
|
||||
}
|
||||
BIT4Log.Log<IHttpListenerService>($"{Port}\tStopped");
|
||||
}
|
||||
|
||||
private void ListenerCallback(IAsyncResult result)
|
||||
{
|
||||
if (_cancellationToken.IsCancellationRequested) return;
|
||||
|
||||
var context = _httpListener.EndGetContext(result);
|
||||
var request = context.Request;
|
||||
|
||||
var response = context.Response;
|
||||
|
||||
|
||||
var output = response.OutputStream;
|
||||
|
||||
if (request.RawUrl is "/favicon.ico")
|
||||
{
|
||||
output.Close();
|
||||
response.Close();
|
||||
return;
|
||||
}
|
||||
|
||||
// 启用CORS
|
||||
response.Headers.Add("Access-Control-Allow-Origin", "*"); // 允许任何来源访问,生产环境应更具体设置
|
||||
response.Headers.Add("Access-Control-Allow-Methods", "*"); // 允许的HTTP方法
|
||||
response.Headers.Add("Access-Control-Allow-Headers", "*"); // 允许的标头
|
||||
|
||||
|
||||
var content = OnRequest?.Invoke(request);
|
||||
|
||||
var buffer = StringHelper.GetBytes(ContextModel.Error("没有注册请求事件"));
|
||||
if (content is not null)
|
||||
{
|
||||
#if NET5_0_OR_GREATER
|
||||
buffer = content!.ReadAsByteArrayAsync(_cancellationToken).Result;
|
||||
#else
|
||||
buffer = content!.ReadAsByteArrayAsync().Result;
|
||||
#endif
|
||||
}
|
||||
response.ContentLength64 = buffer.Length;
|
||||
output.Write(buffer);
|
||||
output.Close();
|
||||
response.Close();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
|
||||
namespace BITKit.Net.LAN
|
||||
{
|
||||
public interface ILANBroadcaster
|
||||
{
|
||||
int Port { get; set; }
|
||||
byte[] Buffer { get; set; }
|
||||
event Action<EndPoint, string> OnReceive;
|
||||
void StartBroadcast();
|
||||
void StopBroadcast();
|
||||
void StartListen();
|
||||
void StopListen();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace BITKit.Net.LAN
|
||||
{
|
||||
/// <summary>
|
||||
/// 基于UDP的LAN广播
|
||||
/// </summary>
|
||||
public class UdpBasedLanBroadcaster : ILANBroadcaster
|
||||
{
|
||||
public int Port { get; set; }
|
||||
public byte[] Buffer { get; set; } = StringHelper.GetBytes("Hello World");
|
||||
private bool _isBroadcasting;
|
||||
private bool _isListening;
|
||||
|
||||
public UdpBasedLanBroadcaster()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public event Action<EndPoint, string> OnReceive;
|
||||
|
||||
public void StartBroadcast()
|
||||
{
|
||||
_isBroadcasting = true;
|
||||
Thread thread = new(Process)
|
||||
{
|
||||
IsBackground = true
|
||||
};
|
||||
thread.Start();
|
||||
BIT4Log.Log<ILANBroadcaster>($"开始广播端口{Port}");
|
||||
}
|
||||
|
||||
public void StopBroadcast()
|
||||
{
|
||||
_isBroadcasting = false;
|
||||
BIT4Log.Log<ILANBroadcaster>($"停止广播端口 {Port}");
|
||||
}
|
||||
|
||||
public void StartListen()
|
||||
{
|
||||
_isListening = true;
|
||||
var thread = new Thread(ReceiveThread)
|
||||
{
|
||||
IsBackground = true
|
||||
};
|
||||
thread.Start();
|
||||
BIT4Log.Log<ILANBroadcaster>($"开始监听端口:{Port}");
|
||||
}
|
||||
|
||||
public void StopListen()
|
||||
{
|
||||
_isListening = false;
|
||||
BIT4Log.Log<ILANBroadcaster>($"停止监听端口{Port}");
|
||||
}
|
||||
|
||||
|
||||
private void Process()
|
||||
{
|
||||
var udpClient = new UdpClient(new IPEndPoint(IPAddress.Any, 0));
|
||||
|
||||
var endpoint = new IPEndPoint(IPAddress.Broadcast, Port);
|
||||
//其实 IPAddress.Broadcast 就是 255.255.255.255
|
||||
//下面代码与上面有相同的作用
|
||||
//IPEndPoint endpoint = new IPEndPoint(IPAddress.Parse("255.255.255.255"), 8080);
|
||||
try
|
||||
{
|
||||
while (_isBroadcasting)
|
||||
{
|
||||
udpClient.Send(Buffer, Buffer.Length, endpoint);
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
BIT4Log.LogException(e);
|
||||
}
|
||||
udpClient.Dispose();
|
||||
}
|
||||
|
||||
private void ReceiveThread()
|
||||
{
|
||||
try
|
||||
{
|
||||
var udpClient = new UdpClient(new IPEndPoint(IPAddress.Any, Port));
|
||||
var endpoint = new IPEndPoint(IPAddress.Any, 0);
|
||||
while (_isListening)
|
||||
{
|
||||
var buf = udpClient.Receive(ref endpoint);
|
||||
var msg = Encoding.Default.GetString(buf);
|
||||
if (OnReceive is not null)
|
||||
OnReceive(endpoint, msg);
|
||||
else
|
||||
BIT4Log.Log<ILANBroadcaster>($"Receive From {endpoint}:\t{msg}");
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
BIT4Log.LogException(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,11 +7,11 @@
|
|||
}
|
||||
public interface IOptional<T>
|
||||
{
|
||||
bool Allow { get; }
|
||||
T Value { get; }
|
||||
bool Allow { get; set; }
|
||||
T Value { get; set; }
|
||||
}
|
||||
[System.Serializable]
|
||||
public record Optional<T> : IOptional<T>
|
||||
public class Optional<T> : IOptional<T>
|
||||
{
|
||||
#if NET5_0_OR_GREATER
|
||||
bool allow;
|
||||
|
@ -23,8 +23,18 @@
|
|||
T value;
|
||||
#endif
|
||||
public bool Allow { get => allow; set => allow = value;}
|
||||
public T Value { get => value; set => this.value = value; }
|
||||
public void SetValueThenAllow(T newValue) => value = newValue;
|
||||
public T Value
|
||||
{
|
||||
get => value;
|
||||
set=>this.value=value;
|
||||
}
|
||||
|
||||
public void SetValueThenAllow(T newValue)
|
||||
{
|
||||
value = newValue;
|
||||
allow = true;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
Allow = false;
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
namespace BITKit
|
||||
using System;
|
||||
|
||||
namespace BITKit
|
||||
{
|
||||
/// <summary>
|
||||
/// 订阅者,发布者下发任务给支持并优先级最高的订阅者
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
[Obsolete]
|
||||
public interface TaskSubscriber<in T>
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -22,6 +25,7 @@
|
|||
/// 发布接口,向发布者下发任务
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
[Obsolete("Use Func Instanced",true)]
|
||||
public interface TaskPublisher<in T>
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
// ReSharper disable UnassignedGetOnlyAutoProperty
|
||||
|
||||
namespace BITKit.UX
|
||||
{
|
||||
|
@ -44,7 +45,7 @@ namespace BITKit.UX
|
|||
}
|
||||
public abstract class UXPanelImplement:IUXPanel
|
||||
{
|
||||
private IUXPanel _iuxPanelImplementation1;
|
||||
protected virtual IUXPanel _iuxPanelImplementation1 { get; }
|
||||
protected abstract IUXPanel _iuxPanelImplementation { get; }
|
||||
public bool IsAnimate => _iuxPanelImplementation.IsAnimate;
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace BITKit
|
|||
public const string Status = "Status";
|
||||
public const string State = "State";
|
||||
public const string Settings = "Settings";
|
||||
public const string Services = "Services";
|
||||
public const string AudioClip = "AudioClip";
|
||||
public const string AudioSource = "AudioSource";
|
||||
public const string Paths = "Paths";
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
{
|
||||
string Get();
|
||||
string Value => Get();
|
||||
string Replace(string value) => Get().Replace("{x}",value);
|
||||
}
|
||||
|
||||
public interface IReference<T>
|
||||
|
@ -37,9 +38,12 @@
|
|||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[UnityEngine.TextArea]
|
||||
#endif
|
||||
public string value;
|
||||
public override string Get() => value;
|
||||
public override string ToString() => value;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
|
|
|
@ -5,17 +5,12 @@ namespace BITKit
|
|||
{
|
||||
public class ValidHandle
|
||||
{
|
||||
public ValidHandle() { Init(); }
|
||||
public ValidHandle() {}
|
||||
public ValidHandle(Action<bool> boolDelegate)
|
||||
{
|
||||
AddListener(boolDelegate);
|
||||
Init();
|
||||
EventOnEnableChanged?.Invoke(enableHandle);
|
||||
}
|
||||
void Init()
|
||||
{
|
||||
AddListener(OnInoke);
|
||||
}
|
||||
public static implicit operator bool(ValidHandle validHandle)
|
||||
{
|
||||
return validHandle.enableHandle;
|
||||
|
@ -24,8 +19,6 @@ namespace BITKit
|
|||
public bool Allow => this;
|
||||
|
||||
private bool enableHandle;
|
||||
private int enableElementCount;
|
||||
private int disableElementCount;
|
||||
private readonly List<object> objs = new List<object>();
|
||||
private readonly List<object> disableObjs = new List<object>();
|
||||
private bool tempEnable;
|
||||
|
@ -43,7 +36,7 @@ namespace BITKit
|
|||
}
|
||||
CheckEnable();
|
||||
}
|
||||
protected virtual void CheckEnable()
|
||||
protected void CheckEnable()
|
||||
{
|
||||
tempEnable = objs.Count > 0 && disableObjs.Count == 0;
|
||||
if (tempEnable != enableHandle)
|
||||
|
@ -51,13 +44,8 @@ namespace BITKit
|
|||
enableHandle = tempEnable;
|
||||
if (EventOnEnableChanged is not null)
|
||||
EventOnEnableChanged.Invoke(enableHandle);
|
||||
OnEnable(enableHandle);
|
||||
|
||||
}
|
||||
enableElementCount = objs.Count;
|
||||
disableElementCount = disableObjs.Count;
|
||||
}
|
||||
protected virtual void OnEnable(bool enable) { }
|
||||
public virtual void RemoveElement(object obj)
|
||||
{
|
||||
if (objs.Contains(obj))
|
||||
|
@ -93,7 +81,7 @@ namespace BITKit
|
|||
}
|
||||
CheckEnable();
|
||||
}
|
||||
public virtual void RemoveDisableElements(object obj)
|
||||
public void RemoveDisableElements(object obj)
|
||||
{
|
||||
if (disableObjs.Contains(obj))
|
||||
{
|
||||
|
@ -104,7 +92,7 @@ namespace BITKit
|
|||
}
|
||||
CheckEnable();
|
||||
}
|
||||
public virtual void SetElements(object obj, bool add = true)
|
||||
public void SetElements(object obj, bool add = true)
|
||||
{
|
||||
if (add)
|
||||
{
|
||||
|
@ -126,29 +114,33 @@ namespace BITKit
|
|||
RemoveDisableElements(obj);
|
||||
}
|
||||
}
|
||||
public virtual void Invoke()
|
||||
public void Invoke()
|
||||
{
|
||||
bool enable = disableObjs.Count == 0 && objs.Count > 0;
|
||||
EventOnEnableChanged.Invoke(enable);
|
||||
var enable = disableObjs.Count == 0 && objs.Count > 0;
|
||||
EventOnEnableChanged?.Invoke(enable);
|
||||
}
|
||||
public virtual void Invoke(bool value)
|
||||
public void Invoke(bool value)
|
||||
{
|
||||
EventOnEnableChanged.Invoke(value);
|
||||
EventOnEnableChanged?.Invoke(value);
|
||||
}
|
||||
public virtual void OnInoke(bool value)
|
||||
{
|
||||
|
||||
}
|
||||
public virtual void AddListener(Action<bool> action)
|
||||
public void AddListener(Action<bool> action)
|
||||
{
|
||||
EventOnEnableChanged+= action;
|
||||
}
|
||||
public virtual void RemoveListener(Action<bool> action)
|
||||
public void RemoveListener(Action<bool> action)
|
||||
{
|
||||
if(EventOnEnableChanged is not null && action is not null)
|
||||
{
|
||||
EventOnEnableChanged -= action;
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
objs.Clear();
|
||||
disableObjs.Clear();
|
||||
Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ namespace BITKit
|
|||
[BITCommand]
|
||||
public static void Set(string key, string value)
|
||||
{
|
||||
Data.Set(key, value);
|
||||
if (Guid.TryParse(value, out var guidResult))
|
||||
{
|
||||
Data.Set(key, guidResult);
|
||||
|
@ -35,6 +34,10 @@ namespace BITKit
|
|||
{
|
||||
Data.Set(key, intResult);
|
||||
}
|
||||
else
|
||||
{
|
||||
Data.Set(key, value);
|
||||
}
|
||||
}
|
||||
[BITCommand]
|
||||
public static void SetContainer(string key, string typeName, string json)
|
||||
|
|
|
@ -32,6 +32,12 @@ namespace BITKit
|
|||
|
||||
return GetPath(paths);
|
||||
}
|
||||
public static void EnsureDirectoryCreated(string path)
|
||||
{
|
||||
path = Path.GetDirectoryName(path);
|
||||
if (Directory.Exists(path) is true) return;
|
||||
if (path != null) Directory.CreateDirectory(path);
|
||||
}
|
||||
|
||||
public static string GetFilePath(params string[] paths)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "BITKit.EntityFramework",
|
||||
"rootNamespace": "",
|
||||
"references": [],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [
|
||||
"NET5_0_OR_GREATER"
|
||||
],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
#if NET5_0_OR_GREATER
|
||||
using System;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BITKit;
|
||||
|
||||
public interface IDatabaseContext<T> where T : class
|
||||
{
|
||||
void Add(T entity);
|
||||
UniTask AddAsync(T entity);
|
||||
void Remove(T entity);
|
||||
T[] GetArray();
|
||||
bool TrySearch(Func<T, bool> searchFactory, out T result);
|
||||
bool TrySearchArray(Func<T, bool> searchFactory, out T[] result);
|
||||
}
|
||||
|
||||
public abstract class EntityFrameworkContext<T>:DbContext ,IDatabaseContext<T> where T : class
|
||||
{
|
||||
protected DbSet<T> context { get; private set; }
|
||||
|
||||
public void Add(T entity)
|
||||
{
|
||||
context.Add(entity);
|
||||
SaveChanges();
|
||||
}
|
||||
|
||||
public async UniTask AddAsync(T entity)
|
||||
{
|
||||
await context.AddAsync(entity);
|
||||
await SaveChangesAsync();
|
||||
}
|
||||
|
||||
public void Remove(T entity)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public T[] GetArray()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool TrySearch(Func<T, bool> searchFactory, out T result)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool TrySearchArray(Func<T, bool> searchFactory, out T[] result)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,19 @@
|
|||
#if NET5_0_OR_GREATER
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BITKit;
|
||||
|
||||
public class MySQLContext<T>:DbContext where T:class
|
||||
{
|
||||
protected readonly string _connectSql;
|
||||
protected DbSet<T> context { get; private set; }
|
||||
public MySQLContext(string connectSql) : base()
|
||||
{
|
||||
_connectSql = connectSql;
|
||||
}
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
optionsBuilder.UseMySQL("_connectSql");
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,82 @@
|
|||
#if NET5_0_OR_GREATER
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BITKit;
|
||||
|
||||
|
||||
|
||||
public class SqlLiteContext<T> : DbContext,IDatabaseContext<T> where T : class
|
||||
{
|
||||
public DbSet<T> context { get; private set; }
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
var sql = SQLiteContextHelper.GetConnectionString<T>();
|
||||
optionsBuilder.UseSqlite(sql);
|
||||
}
|
||||
public virtual void Add(T entity)
|
||||
{
|
||||
context.Add(entity);
|
||||
SaveChanges();
|
||||
}
|
||||
|
||||
public UniTask AddAsync(T entity)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual void Remove(T entity)
|
||||
{
|
||||
context.Remove(entity);
|
||||
SaveChanges();
|
||||
}
|
||||
public virtual T[] GetArray()
|
||||
{
|
||||
return context.ToArray();
|
||||
}
|
||||
public virtual bool TrySearch(Func<T,bool> searchFactory,out T result)
|
||||
{
|
||||
result = context.FirstOrDefault(searchFactory);
|
||||
return result != null;
|
||||
}
|
||||
/// <summary>
|
||||
/// 搜索数组
|
||||
/// </summary>
|
||||
/// <param name="searchFactory"></param>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool TrySearchArray(Func<T, bool> searchFactory, out T[] result)
|
||||
{
|
||||
result = context.Where(searchFactory).ToArray();
|
||||
return result.Length > 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SQLiteContextHelper
|
||||
{
|
||||
private const string _database = "Database";
|
||||
|
||||
public static string GetConnectionString(string key)
|
||||
{
|
||||
GetConnectionSqlAndPath(key,out var connectionSql,out var path);
|
||||
BIT4Log.Log($"已创建数据库链接:{path}");
|
||||
return connectionSql;
|
||||
}
|
||||
|
||||
public static string GetConnectionString<T>()
|
||||
{
|
||||
GetConnectionSqlAndPath(typeof(T).Name,out var connectionSql,out var path);
|
||||
BIT4Log.Log<T>($"已创建数据库链接:{path}");
|
||||
return connectionSql;
|
||||
}
|
||||
|
||||
public static void GetConnectionSqlAndPath(string name,out string connectionSql,out string path)
|
||||
{
|
||||
PathHelper.GetFolderPath(_database);
|
||||
path = PathHelper.GetPath(_database, $"{name}.db");
|
||||
connectionSql = $"Data Source={path}";
|
||||
}
|
||||
}
|
||||
#endif
|
File diff suppressed because one or more lines are too long
|
@ -26,6 +26,7 @@ RenderTexture:
|
|||
m_UseDynamicScale: 0
|
||||
m_BindMS: 0
|
||||
m_EnableCompatibleFormat: 1
|
||||
m_EnableRandomWrite: 0
|
||||
m_TextureSettings:
|
||||
serializedVersion: 2
|
||||
m_FilterMode: 1
|
||||
|
|
|
@ -76,7 +76,7 @@ Transform:
|
|||
m_GameObject: {fileID: 4263150313831602955}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: 0.99025595, z: -0.1392595, w: 0}
|
||||
m_LocalPosition: {x: 2.14, y: 1.942205, z: -0.5443456}
|
||||
m_LocalPosition: {x: 2.1400003, y: 1.942205, z: -0.5443456}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
|
@ -255,7 +255,7 @@ MonoBehaviour:
|
|||
m_RotationOrder: 4
|
||||
cameraDistanceLimit: {x: 1, y: 64}
|
||||
allowInput:
|
||||
rid: 6077775057159979015
|
||||
rid: 8000561620556709889
|
||||
touchesCount: 0
|
||||
isParallelVector: 0
|
||||
lookInput: {x: 0, y: 0, z: 0}
|
||||
|
@ -263,8 +263,8 @@ MonoBehaviour:
|
|||
references:
|
||||
version: 2
|
||||
RefIds:
|
||||
- rid: 6077775057159979015
|
||||
type: {class: AllowTouchWhenPointerNotOverUI, ns: BITKit.UX, asm: BITKit.UX.OnScreen}
|
||||
- rid: 8000561620556709889
|
||||
type: {class: AllowCondition, ns: BITKit, asm: BITKit.Node}
|
||||
data:
|
||||
--- !u!1 &4263150314961711450
|
||||
GameObject:
|
||||
|
|
|
@ -50,6 +50,8 @@ namespace BITKit
|
|||
remove => ApplicationService.OnDownloadComplete -= value;
|
||||
}
|
||||
|
||||
public event Action OnDetectedLatestVersion;
|
||||
|
||||
public UniTask<string> DownloadLatestVersionAsync()
|
||||
{
|
||||
return _applicationServiceImplementation.DownloadLatestVersionAsync();
|
||||
|
@ -104,6 +106,12 @@ namespace BITKit
|
|||
remove => OnDownloadComplete -= value;
|
||||
}
|
||||
|
||||
public event Action OnDetectedLatestVersion
|
||||
{
|
||||
add => Singleton.OnDetectedLatestVersion += value;
|
||||
remove => Singleton.OnDetectedLatestVersion -= value;
|
||||
}
|
||||
|
||||
private UnityWebRequest downloadRequest;
|
||||
|
||||
private CancellationTokenSource _cancellationTokenSource;
|
||||
|
|
|
@ -2,7 +2,6 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Remoting.Contexts;
|
||||
using UnityEngine;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -79,10 +78,8 @@ namespace BITKit
|
|||
BIT4Log.OnLog += Debug.Log;
|
||||
BIT4Log.OnWarning += Debug.LogWarning;
|
||||
BIT4Log.OnException += Debug.LogException;
|
||||
|
||||
var settings = Addressables.LoadAssetAsync<ScriptableObject>("Assets/BITKit/Unity/Configs/AppSettings.asset").WaitForCompletion() as BITSettingsSO;
|
||||
//启动BITApp
|
||||
BITApp.Start(Application.productName, settings!.appSettings);
|
||||
BITApp.Start(Application.productName, new BITApp.AppSettings()).Forget();
|
||||
|
||||
AllowCursor = new();
|
||||
AllowTouchSupport = new();
|
||||
|
|
|
@ -1,10 +1,17 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
namespace BITKit
|
||||
{
|
||||
public class BITSettingsSO : ScriptableObject
|
||||
{
|
||||
public BITApp.AppSettings appSettings;
|
||||
|
||||
[ContextMenu(nameof(Print))]
|
||||
public void Print()
|
||||
{
|
||||
GUIUtility.systemCopyBuffer = JsonConvert.SerializeObject(appSettings.blackList, Formatting.Indented);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -196,8 +196,8 @@ namespace BITKit
|
|||
private void Update()
|
||||
{
|
||||
//var debuger = DI.Get<IDebuger>();
|
||||
var playerConfig = PlayerConfig.singleton;
|
||||
var sensitivity = playerConfig.touchSensitivity;
|
||||
var playerConfig = PlayerConfig.Singleton;
|
||||
var sensitivity = playerConfig.TouchSensitivity;
|
||||
|
||||
//debuger.Log(nameof(Touch.activeTouches), Touch.activeTouches.Count.ToString());
|
||||
touchesCount = Touch.activeTouches.Count;
|
||||
|
@ -229,8 +229,8 @@ namespace BITKit
|
|||
private void OnView(InputAction.CallbackContext context)
|
||||
{
|
||||
if (allowInput.OnCheck() is false) return;
|
||||
var playerConfig = PlayerConfig.singleton;
|
||||
var sensitivity = playerConfig.sensitivity * playerConfig.m_yaw;
|
||||
var playerConfig = PlayerConfig.Singleton;
|
||||
var sensitivity = playerConfig.Sensitivity * playerConfig.M_Yaw;
|
||||
var delta = context.ReadValue<Vector2>();
|
||||
switch (context.control.device)
|
||||
{
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITKit
|
||||
{
|
||||
public class ExcuteCommand : MonoBehaviour
|
||||
{
|
||||
public string command;
|
||||
public void Excute()
|
||||
{
|
||||
Data.Set("Cmd", command);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITKit
|
||||
{
|
||||
public class ExecuteCommand : MonoBehaviour
|
||||
{
|
||||
public string command;
|
||||
[SerializeReference, SubclassSelector] private IReference format;
|
||||
public void Execute()
|
||||
{
|
||||
Data.Set("Cmd", command);
|
||||
}
|
||||
public void Execute(string cmd)
|
||||
{
|
||||
if(format!=null)
|
||||
cmd = format.Value.Replace("{x}",cmd);
|
||||
BITCommands.Excute(cmd);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,11 +5,10 @@ namespace BITKit
|
|||
{
|
||||
public record PlayerConfig
|
||||
{
|
||||
[SaveData]
|
||||
public static PlayerConfig singleton = new();
|
||||
public float sensitivity = 1.81f;
|
||||
public float touchSensitivity = 0.22f;
|
||||
public float m_yaw = 0.022f;
|
||||
public float fov = 75;
|
||||
public static readonly PlayerConfig Singleton = new();
|
||||
public float Sensitivity = 1.81f;
|
||||
public float TouchSensitivity = 0.22f;
|
||||
public float M_Yaw = 0.022f;
|
||||
public float Fov = 75;
|
||||
}
|
||||
}
|
|
@ -5,7 +5,6 @@ using UnityEngine.SceneManagement;
|
|||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine.Pool;
|
||||
using BITModel;
|
||||
namespace BITKit
|
||||
{
|
||||
public class UnityDiagnostics : MonoBehaviour, IDiagnostics
|
||||
|
|
|
@ -14,7 +14,9 @@
|
|||
"GUID:28c2d6a6727d47442a24a353f0d37846",
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||
"GUID:d525ad6bd40672747bde77962f1c401e",
|
||||
"GUID:be17a8778dbfe454890ed8279279e153"
|
||||
"GUID:be17a8778dbfe454890ed8279279e153",
|
||||
"GUID:96f476e982d6fb945bfc9140ba094b7f",
|
||||
"GUID:4307f53044263cf4b835bd812fc161a4"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
|
|
@ -5,6 +5,9 @@ using BITKit;
|
|||
using BITKit.Animations;
|
||||
using BITKit.StateMachine;
|
||||
using System.Linq;
|
||||
using BITFALL.Player.Equip;
|
||||
using Cinemachine;
|
||||
|
||||
namespace BITKit.Entities
|
||||
{
|
||||
public interface IEquipBase : IEntryElement, IAwake, IStart, IUpdate
|
||||
|
@ -31,10 +34,17 @@ namespace BITKit.Entities
|
|||
public virtual void EquipEvent(string eventName){}
|
||||
public virtual void AnimationEvent(string eventName){}
|
||||
}
|
||||
public class EntityEquipment : EntityComponent
|
||||
[CustomType(typeof(IEquipService))]
|
||||
public class EntityEquipment : EntityComponent,IEquipService
|
||||
{
|
||||
public EntryGroup<IEquipBase> equips = new();
|
||||
public IOptional<float> Zoom { get; } = new Optional<float>(){Value = 1};
|
||||
|
||||
public float InitialFov;
|
||||
|
||||
[SerializeField] private CinemachineVirtualCamera virtualCamera;
|
||||
protected IEquipBase entryComplete;
|
||||
private PlayerConfig playerConfig;
|
||||
public override void OnStart()
|
||||
{
|
||||
base.OnStart();
|
||||
|
@ -56,6 +66,13 @@ namespace BITKit.Entities
|
|||
{
|
||||
entryComplete.OnUpdate(deltaTime);
|
||||
}
|
||||
|
||||
var current = virtualCamera.m_Lens.FieldOfView;
|
||||
current= Mathf.Lerp(current,Zoom.Allow ? InitialFov / Zoom.Value : PlayerConfig.Singleton.Fov , deltaTime * 5);
|
||||
current = Mathf.Clamp(current, 10, PlayerConfig.Singleton.Fov);
|
||||
virtualCamera.m_Lens.FieldOfView = current;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -6,7 +6,10 @@
|
|||
"GUID:709caf8d7fb6ef24bbba0ab9962a3ad0",
|
||||
"GUID:f822dbf6fdfd4a5469cccaa2e4eed3b6",
|
||||
"GUID:f51ebe6a0ceec4240a699833d6309b23",
|
||||
"GUID:75469ad4d38634e559750d17036d5f7c"
|
||||
"GUID:75469ad4d38634e559750d17036d5f7c",
|
||||
"GUID:d525ad6bd40672747bde77962f1c401e",
|
||||
"GUID:49b49c76ee64f6b41bf28ef951cb0e50",
|
||||
"GUID:508392158bd966c4d9c21e19661a441d"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using BITKit.Sensors;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.InputSystem.Interactions;
|
||||
|
@ -6,24 +7,16 @@ namespace BITKit.Entities.Player
|
|||
public class EntityInteractive : EntityPlayerComponent
|
||||
{
|
||||
[Header(Constant.Header.Settings)]
|
||||
public float distance;
|
||||
public LayerMask layerMask;
|
||||
|
||||
[Header(Constant.Header.Input)]
|
||||
public InputActionReference interactiveAction;
|
||||
private readonly InputActionGroup inputActionGroup = new();
|
||||
|
||||
[Header(Constant.Header.Gameobjects)]
|
||||
[SerializeField] private Transform cameraTransform;
|
||||
[SerializeReference, SubclassSelector] private ISensor sensor;
|
||||
|
||||
[Header(Constant.Header.InternalVariables)]
|
||||
private ISelectable selected;
|
||||
private IntervalUpdate cd = new(0.08f);
|
||||
public override void OnUpdate(float deltaTime)
|
||||
{
|
||||
if (Physics.Raycast(cameraTransform.position,cameraTransform.forward, out var raycastHit, distance, layerMask,QueryTriggerInteraction.Collide))
|
||||
if (sensor.Get().TryGetAny(x=>x.TryGetComponentAny<ISelectable>(out _),out var detected))
|
||||
{
|
||||
if (raycastHit.transform.TryGetComponentAny<ISelectable>(out var _detected))
|
||||
if (detected.TryGetComponentAny<ISelectable>(out var _detected))
|
||||
{
|
||||
if (_detected == selected)
|
||||
{
|
||||
|
@ -68,7 +61,7 @@ namespace BITKit.Entities.Player
|
|||
}
|
||||
public void Interactive(InputAction.CallbackContext context)
|
||||
{
|
||||
if (context.interaction is not PressInteraction || !context.performed) return;
|
||||
if (context.interaction is not PressInteraction || !context.performed || cd.AllowUpdate is false) return;
|
||||
var _selected = selected;
|
||||
if (_selected is not MonoBehaviour monoBehaviour) return;
|
||||
if (monoBehaviour.TryGetComponentAny<IAction>(out var action))
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"name": "BITKit.Entities.Value",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||
"GUID:709caf8d7fb6ef24bbba0ab9962a3ad0"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITKit.Entities.Value
|
||||
{
|
||||
/// <summary>
|
||||
/// 实体属性接口,通常用于角色的可被数值化的属性
|
||||
/// </summary>
|
||||
public interface IEntityValue
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -17,8 +17,21 @@ namespace BITKit.Entities
|
|||
private readonly Processor processor = new();
|
||||
public IEntityComponent[] entityComponents { get; set; }
|
||||
public ulong Id { get; private set; }
|
||||
public CancellationToken CancellationToken => _cancellationToken;
|
||||
|
||||
Core.Entites.IEntityComponent[] Core.Entites.IEntity.Components => _components;
|
||||
|
||||
bool Core.Entites.IEntity.RegisterComponent<T>(T component)
|
||||
{
|
||||
throw new InvalidOperationException("Unity Entity can't register component");
|
||||
}
|
||||
|
||||
IServiceProvider Core.Entites.IEntity.ServiceProvider=> throw new InvalidOperationException("Unity Entity can't register component");
|
||||
|
||||
private CancellationToken _cancellationToken;
|
||||
private bool isInitialized;
|
||||
private Core.Entites.IEntityComponent[] _components => entityComponents;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Id = (ulong)Guid.NewGuid().GetHashCode();
|
||||
|
|
|
@ -41,22 +41,22 @@ public class UnityEntitiesServiceSingleton:IEntitiesService
|
|||
|
||||
public IEntity Get(ulong id) => UnityEntitiesService.Get(id);
|
||||
|
||||
public IEntity[] Query<T>() where T : IEntityComponent
|
||||
public IEntity[] Query<T>()
|
||||
{
|
||||
return UnityEntitiesService.Query<T>();
|
||||
}
|
||||
|
||||
public T[] QueryComponents<T>() where T : IEntityComponent
|
||||
public T[] QueryComponents<T>()
|
||||
{
|
||||
return UnityEntitiesService.QueryComponents<T>();
|
||||
}
|
||||
|
||||
public (T, T1)[] QueryComponents<T, T1>() where T : IEntityComponent where T1 : IEntityComponent
|
||||
public (T, T1)[] QueryComponents<T, T1>()
|
||||
{
|
||||
return UnityEntitiesService.QueryComponents<T, T1>();
|
||||
}
|
||||
|
||||
public (T, T1, T2)[] QueryComponents<T, T1, T2>() where T : IEntityComponent where T1 : IEntityComponent where T2 : IEntityComponent
|
||||
public (T, T1, T2)[] QueryComponents<T, T1, T2>()
|
||||
{
|
||||
return UnityEntitiesService.QueryComponents<T, T1, T2>();
|
||||
}
|
||||
|
@ -64,13 +64,12 @@ public class UnityEntitiesServiceSingleton:IEntitiesService
|
|||
|
||||
public class UnityEntitiesService : MonoBehaviour,IEntitiesService
|
||||
{
|
||||
[RuntimeInitializeOnLoadMethod]
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
private static void Initialize()
|
||||
{
|
||||
Dictionary.Clear();
|
||||
RegisterQueue.Clear();
|
||||
UnRegisterQueue.Clear();
|
||||
|
||||
}
|
||||
public static bool Register(IEntity entity)
|
||||
{
|
||||
|
@ -127,12 +126,12 @@ public class UnityEntitiesService : MonoBehaviour,IEntitiesService
|
|||
public static IEntity Get(ulong id)=>Dictionary[id];
|
||||
IEntity IEntitiesService.Get(ulong id)=>Get(id);
|
||||
IEntity[] IEntitiesService.Query<T>()=>Query<T>();
|
||||
public static IEntity[] Query<T>() where T : IEntityComponent
|
||||
public static IEntity[] Query<T>()
|
||||
{
|
||||
return Entities.Where(x => ((Entity)x).TryGetComponentAny<T>(out _)).ToArray();
|
||||
}
|
||||
T[] IEntitiesService.QueryComponents<T>()=>QueryComponents<T>();
|
||||
public static T[] QueryComponents<T>() where T : IEntityComponent
|
||||
public static T[] QueryComponents<T>()
|
||||
{
|
||||
var list = ListPool<T>.Get();
|
||||
foreach (var iEntity in Entities)
|
||||
|
@ -150,7 +149,7 @@ public class UnityEntitiesService : MonoBehaviour,IEntitiesService
|
|||
return value;
|
||||
}
|
||||
(T, T1)[] IEntitiesService.QueryComponents<T,T1>()=>QueryComponents<T,T1>();
|
||||
public static (T, T1)[] QueryComponents<T, T1>() where T : IEntityComponent where T1 : IEntityComponent
|
||||
public static (T, T1)[] QueryComponents<T, T1>()
|
||||
{
|
||||
var list = ListPool<(T t, T1 t1)>.Get();
|
||||
foreach (var iEntity in Entities)
|
||||
|
@ -168,7 +167,7 @@ public class UnityEntitiesService : MonoBehaviour,IEntitiesService
|
|||
return value;
|
||||
}
|
||||
(T, T1, T2)[] IEntitiesService.QueryComponents<T,T1,T2>()=>QueryComponents<T,T1,T2>();
|
||||
public static (T, T1, T2)[] QueryComponents<T, T1, T2>() where T : IEntityComponent where T1 : IEntityComponent where T2 : IEntityComponent
|
||||
public static (T, T1, T2)[] QueryComponents<T, T1, T2>()
|
||||
{
|
||||
var list = ListPool<(T t, T1 t1, T2 t2)>.Get();
|
||||
foreach (var iEntity in Entities)
|
||||
|
|
|
@ -25,7 +25,6 @@ namespace BITKit.Entities.Editor
|
|||
rootVisualElement.styleSheets.Add(BITEditorUtils.InspectorStyleSheet);
|
||||
rootVisualElement.styleSheets.Add(BITEditorUtils.Style);
|
||||
rootVisualElement.AddToClassList("pa-8");
|
||||
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
|
|
@ -0,0 +1,141 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor.UIElements;
|
||||
#if UNITY_EDITOR
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEditor;
|
||||
#endif
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace BITKit.Events
|
||||
{
|
||||
[Serializable]
|
||||
public class UnityEventData
|
||||
{
|
||||
public Object Target;
|
||||
public string MethodName;
|
||||
}
|
||||
[Serializable]
|
||||
public class UnityEvent
|
||||
{
|
||||
public List<UnityEventData> Targets = new List<UnityEventData>();
|
||||
|
||||
public void Invoke(params object[] objects)
|
||||
{
|
||||
foreach (var x in Targets)
|
||||
{
|
||||
x.Target.GetType().GetMethod(x.MethodName)?.Invoke(x.Target,objects);
|
||||
}
|
||||
}
|
||||
}
|
||||
#if UNITY_EDITOR
|
||||
[CustomPropertyDrawer(typeof(UnityEvent))]
|
||||
public class UnityEventDataPropertyDrawer:PropertyDrawer
|
||||
{
|
||||
private VisualElement root;
|
||||
|
||||
private UnityEvent agent;
|
||||
|
||||
private SerializedProperty _property;
|
||||
|
||||
public override VisualElement CreatePropertyGUI(SerializedProperty property)
|
||||
{
|
||||
_property = property;
|
||||
agent = property.Get<UnityEvent>();
|
||||
|
||||
root = new VisualElement
|
||||
{
|
||||
style =
|
||||
{
|
||||
paddingLeft = 10,
|
||||
paddingTop = 10,
|
||||
paddingRight = 10,
|
||||
paddingBottom = 10,
|
||||
}
|
||||
};
|
||||
|
||||
root.styleSheets.Add(BITEditorUtils.InspectorStyleSheet);
|
||||
|
||||
Update();
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
root.Clear();
|
||||
|
||||
var targets = _property.FindPropertyRelative(nameof(UnityEvent.Targets));
|
||||
|
||||
_property.serializedObject.Update();
|
||||
|
||||
var label = root.Create<Label>();
|
||||
|
||||
label.text = _property.displayName;
|
||||
|
||||
var flex = root.Create<VisualElement>();
|
||||
|
||||
flex.style.flexDirection = FlexDirection.Row;
|
||||
|
||||
var containers = new[] { flex.Create<VisualElement>(), flex.Create<VisualElement>(),flex.Create<VisualElement>() };
|
||||
|
||||
containers[1].style.flexGrow = 1;
|
||||
|
||||
for (var i = 0; i < targets.arraySize; i++)
|
||||
{
|
||||
var x = agent.Targets[i];
|
||||
|
||||
var objectField = containers[0].Create<ObjectField>();
|
||||
var field = containers[1].Create<DropdownField>();
|
||||
var removeButton = containers[2].Create<Button>();
|
||||
|
||||
|
||||
var data = targets.GetArrayElementAtIndex(i);
|
||||
var target = data.FindPropertyRelative(nameof(UnityEventData.Target));
|
||||
|
||||
objectField.BindProperty(target);
|
||||
|
||||
if (x.Target is not null)
|
||||
{
|
||||
field.choices = x.Target.GetType().GetMethods().Select(x => x.Name).ToList();
|
||||
}
|
||||
|
||||
field.value = x.MethodName;
|
||||
field.RegisterValueChangedCallback(changeEvent =>
|
||||
{
|
||||
x.MethodName = changeEvent.newValue;
|
||||
});
|
||||
|
||||
|
||||
field.style.flexGrow = 1;
|
||||
|
||||
removeButton.text = "X";
|
||||
removeButton.clicked+=()=>{
|
||||
agent.Targets.Remove(x);
|
||||
Update();
|
||||
};
|
||||
}
|
||||
|
||||
var addButton = root.Create<Button>();
|
||||
|
||||
addButton.text = "Add";
|
||||
|
||||
addButton.clicked += () =>
|
||||
{
|
||||
agent.Targets.Add(new());
|
||||
Update();
|
||||
};
|
||||
|
||||
var invokeButton = root.Create<Button>();
|
||||
invokeButton.text = "Invoke";
|
||||
invokeButton.clicked +=()=> agent.Invoke();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
// ReSharper disable UnassignedField.Local
|
||||
|
||||
namespace BITKit.Http
|
||||
{
|
||||
[Serializable]
|
||||
public class HttpAction : IAction
|
||||
{
|
||||
private static readonly HttpClient _httpClient = new();
|
||||
[SerializeReference, SubclassSelector] private IReference url;
|
||||
public void Execute()
|
||||
{
|
||||
_httpClient.GetAsync(url.Value).AsUniTask().Forget();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -17,9 +17,11 @@ namespace BITKit.Http
|
|||
[Header(Constant.Header.Settings)]
|
||||
[SerializeReference,SubclassSelector] private IReference url;
|
||||
[SerializeField] private double interval;
|
||||
[SerializeField] private CollisionDetectionMode detectionMode;
|
||||
|
||||
[Header(Constant.Header.Output)]
|
||||
[SerializeField] private UnityEvent<string> output;
|
||||
[SerializeField] private UnityEvent<string> onException;
|
||||
|
||||
[Header(Constant.Header.Debug)]
|
||||
[SerializeField, ReadOnly] private double time;
|
||||
|
@ -39,6 +41,14 @@ AutoReset = true
|
|||
{
|
||||
timer.Interval = interval*1000;
|
||||
timer.Elapsed += (x, y) => OnUpdate();
|
||||
timer.AutoReset = detectionMode switch
|
||||
{
|
||||
CollisionDetectionMode.ContinuousDynamic => true,
|
||||
CollisionDetectionMode.ContinuousSpeculative => true,
|
||||
CollisionDetectionMode.Continuous => true,
|
||||
CollisionDetectionMode.Discrete => false,
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
timer.Start();
|
||||
}
|
||||
private void OnDestroy()
|
||||
|
@ -50,14 +60,24 @@ AutoReset = true
|
|||
{
|
||||
Stopwatch stopwatch = new();
|
||||
stopwatch.Start();
|
||||
await _httpClient.GetStringAsync(url.Value);
|
||||
//var result = await _httpClient.GetStringAsync(url.Value);
|
||||
var response = await _httpClient.GetAsync(url.Value, _cancellationToken);
|
||||
var result =await response.Content.ReadAsStringAsync();
|
||||
_cancellationToken.ThrowIfCancellationRequested();
|
||||
#if UNITY_EDITOR
|
||||
if (UnityEditor.EditorApplication.isPlaying is false) return;
|
||||
#endif
|
||||
|
||||
stopwatch.Stop();
|
||||
time =System.TimeSpan.FromMilliseconds(stopwatch.ElapsedMilliseconds).TotalSeconds;
|
||||
output.Invoke(url.Value);
|
||||
await UniTask.SwitchToMainThread(_cancellationToken);
|
||||
if (response.StatusCode is not System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
onException.Invoke(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
output.Invoke(result);
|
||||
}
|
||||
if(timer.AutoReset==false)
|
||||
timer.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,22 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
// ReSharper disable InvertIf
|
||||
namespace BITKit
|
||||
{
|
||||
public class LocationAdditive : MonoBehaviour
|
||||
{
|
||||
public Vector3 GlobalPosition { get; private set; }
|
||||
public Vector3 GlobalEuler { get; private set; }
|
||||
public Vector3 GlobalRotation { get; private set; }
|
||||
|
||||
private Vector3 currentPosition;
|
||||
private Vector3 currentEuler;
|
||||
|
||||
private Vector3 globalPosition;
|
||||
private Quaternion globalRotation;
|
||||
public void AddPosition(Vector3 value)
|
||||
{
|
||||
currentPosition += value;
|
||||
|
@ -16,18 +25,44 @@ namespace BITKit
|
|||
{
|
||||
currentEuler += value;
|
||||
}
|
||||
public void SetGlobalPosition(Vector3 value)
|
||||
{
|
||||
globalPosition = value;
|
||||
}
|
||||
public void SetGlobalRotation(Quaternion value)
|
||||
{
|
||||
globalRotation = value;
|
||||
}
|
||||
public void LateUpdate()
|
||||
{
|
||||
if (currentEuler.IsDefault() is false)
|
||||
switch (currentEuler,globalRotation)
|
||||
{
|
||||
transform.localEulerAngles = currentEuler;
|
||||
currentEuler = default;
|
||||
case var (euler,rotation) when euler.IsDefault() is false && rotation.IsDefault():
|
||||
transform.localRotation = Quaternion.Euler(euler);
|
||||
break;
|
||||
case var (euler,rotation) when euler.IsDefault() && rotation.IsDefault() is false:
|
||||
transform.rotation = globalRotation = rotation;
|
||||
break;
|
||||
case var (euler,rotation) when euler.IsDefault() is false && rotation.IsDefault() is false:
|
||||
transform.rotation = globalRotation = rotation * Quaternion.Euler(euler);
|
||||
break;
|
||||
}
|
||||
if (currentPosition.IsDefault() is false)
|
||||
|
||||
switch (currentPosition,globalPosition)
|
||||
{
|
||||
transform.localPosition = currentPosition;
|
||||
currentPosition = default;
|
||||
case var (position,global) when position.IsDefault() is false && global.IsDefault():
|
||||
transform.localPosition = position;
|
||||
break;
|
||||
case var (position,global) when position.IsDefault() && global.IsDefault() is false:
|
||||
transform.position =globalPosition= global;
|
||||
break;
|
||||
case var (position,global) when position.IsDefault() is false && global.IsDefault() is false:
|
||||
transform.position = globalPosition = global + position;
|
||||
break;
|
||||
}
|
||||
|
||||
currentEuler = Vector3.zero;
|
||||
currentPosition = Vector3.zero;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"name": "BITKit.Net.Http",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||
"GUID:709caf8d7fb6ef24bbba0ab9962a3ad0"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using BITKit.Entities;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITKit.Net.Http
|
||||
{
|
||||
[CustomType(typeof(IHttpListenerService))]
|
||||
public class UnityBasedHttpListenerService : EntityComponent,IHttpListenerService
|
||||
{
|
||||
[SerializeField] private int port = 8080;
|
||||
[SerializeField] private bool autoStart = true;
|
||||
|
||||
private readonly IHttpListenerService _service = new HttpListenerService();
|
||||
public bool IsListening => _service.IsListening;
|
||||
|
||||
public int Port
|
||||
{
|
||||
get => _service.Port;
|
||||
set => _service.Port = port = value;
|
||||
}
|
||||
|
||||
public event Func<HttpListenerRequest, HttpContent> OnRequest
|
||||
{
|
||||
add => _service.OnRequest += value;
|
||||
remove => _service.OnRequest -= value;
|
||||
}
|
||||
|
||||
public override void OnStart()
|
||||
{
|
||||
if (!autoStart) return;
|
||||
_service.Port = port;
|
||||
_service.Start();
|
||||
}
|
||||
|
||||
public override void OnDestroyComponent()
|
||||
{
|
||||
_service.Stop();
|
||||
}
|
||||
|
||||
void IHttpListenerService.Start()
|
||||
{
|
||||
_service.Port = port;
|
||||
_service.Start();
|
||||
}
|
||||
void IHttpListenerService.Stop()
|
||||
{
|
||||
_service.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue