修改assets

This commit is contained in:
Bob.Song
2025-11-12 17:49:44 +08:00
parent 6808da81b8
commit 5440af548e
954 changed files with 792 additions and 64396 deletions

View File

@@ -12,5 +12,532 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 9fa072029bab4df48fef4d84ac836775, type: 3}
m_Name: AssetCaches
m_EditorClassIdentifier:
Assets: []
Assets:
- Path: Assets/Resources/gfx/rods/syberia/bolo_10021/bolo_10021_LB400.prefab
Address: Rod/bolo_10021_LB400
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rods/syberia/carp_10046/carp_10046_360H.prefab
Address: Rod/carp_10046_360H
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rods/syberia/carp_10046/carp_10046_360XH.prefab
Address: Rod/carp_10046_360XH
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rods/syberia/cast_10018/cast_10018_CST60MH.prefab
Address: Rod/cast_10018_CST60MH
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rods/syberia/cast_10018/cast_10018_CST78H.prefab
Address: Rod/cast_10018_CST78H
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rods/syberia/cast_10018/cast_10018_CST86XH.prefab
Address: Rod/cast_10018_CST86XH
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rods/syberia/feeder_10048/feeder_10048_FD390.prefab
Address: Rod/feeder_10048_FD390
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rods/syberia/feeder_10048/feeder_10048_FD420.prefab
Address: Rod/feeder_10048_FD420
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rods/syberia/jerk_10043/jerk_10043_JR60XH.prefab
Address: Rod/jerk_10043_JR60XH
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rods/syberia/jerk_10043/jerk_10043_JR68XH.prefab
Address: Rod/jerk_10043_JR68XH
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rods/syberia/mark_10168/mark_10168_3LB.prefab
Address: Rod/mark_10168_3LB
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rods/syberia/mark_10168/mark_10168_4LB.prefab
Address: Rod/mark_10168_4LB
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rods/syberia/match_10025/match_10025_M130H.prefab
Address: Rod/match_10025_M130H
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rods/syberia/match_10025/match_10025_M140H.prefab
Address: Rod/match_10025_M140H
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rods/syberia/match_10025/match_10025_M150MH.prefab
Address: Rod/match_10025_M150MH
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rods/syberia/picker_10052/picker_10052_P300-MH.prefab
Address: Rod/picker_10052_P300-MH
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rods/syberia/spin_10034/spin_10034_S60H.prefab
Address: Rod/spin_10034_S60H
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rods/syberia/spin_10034/spin_10034_S60H2.prefab
Address: Rod/spin_10034_S60H2
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rods/syberia/spod_10133/spod_10133_3LB.prefab
Address: Rod/spod_10133_3LB
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rods/syberia/spod_10133/spod_10133_4_5LB.prefab
Address: Rod/spod_10133_4_5LB
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rods/syberia/tele_10037/tele_10037_t13.prefab
Address: Rod/tele_10037_t13
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rod_pods/rod_pod/rod_pod.prefab
Address: Rod/rod_pod
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rod_pods/rod_pod_03/rod_pod_03al.prefab
Address: Rod/rod_pod_03al
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rod_pods/rod_pod_03/rod_pod_03b.prefab
Address: Rod/rod_pod_03b
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rod_pods/rod_pod_03/rod_pod_03bm.prefab
Address: Rod/rod_pod_03bm
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rod_pods/rod_pod_03/rod_pod_03c.prefab
Address: Rod/rod_pod_03c
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rod_pods/rod_pod_03/rod_pod_03dg.prefab
Address: Rod/rod_pod_03dg
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rod_pods/rod_pod_03/rod_pod_03g.prefab
Address: Rod/rod_pod_03g
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rod_pods/rod_pod_03/rod_pod_03r.prefab
Address: Rod/rod_pod_03r
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rod_rings/rumoi/rumoi_oxiline_spin.prefab
Address: Rod/rumoi_oxiline_spin
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Path: Assets/Resources/gfx/rod_rings/smt/smt_pure_ceramic_bolo.prefab
Address: Rod/smt_pure_ceramic_bolo
Type: GameObject
Bundle: main/rod.bundle
Tags:
Group:
Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
Bundles: []

View File

@@ -12,4 +12,100 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: fb797276877142dfb00042b5dc5064ba, type: 3}
m_Name: CollectorSetting
m_EditorClassIdentifier:
Packages: []
Packages:
- Name: Main
Enable: 1
Default: 1
BundleOptions: 256
Groups:
- Name: UI
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors: []
FilterEnum: 0
Filter: '*'
- Name: Rod
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors:
- {fileID: 102900000, guid: c25f5c6290af83046864490728fe8a4e, type: 3}
- {fileID: 102900000, guid: 45d122b30f8a6fe4caec588296da62dd, type: 3}
- {fileID: 102900000, guid: dc6a8d376a06e49409e88727f7e81f10, type: 3}
FilterEnum: 0
Filter: '*'
- Name: Bait
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors: []
FilterEnum: 0
Filter: '*'
- Name: Bobber
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors: []
FilterEnum: 0
Filter: '*'
- Name: Hook
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors: []
FilterEnum: 0
Filter: '*'
- Name: Line
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors: []
FilterEnum: 0
Filter: '*'
- Name: Lure
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors: []
FilterEnum: 0
Filter: '*'
- Name: Reel
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors: []
FilterEnum: 0
Filter: '*'
- Name: Weight
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors: []
FilterEnum: 0
Filter: '*'
- Name: Item
Enable: 1
BundleMode: 0
AddressMode: 2
Tags:
Collectors: []
FilterEnum: 0
Filter: '*'
- Name: Map
Enable: 1
BundleMode: 3
AddressMode: 2
Tags:
Collectors: []
FilterEnum: 2
Filter: t:Scene

View File

@@ -0,0 +1,24 @@
%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: 2050440665, guid: a4865f1ab4504ed8a368670db22f409c, type: 3}
m_Name: TypeRegistryUserConfig
m_EditorClassIdentifier: Sirenix.OdinInspector.Editor.dll::Sirenix.Config.TypeRegistryUserConfig
shownTypes:
serializedCollection: []
hiddenTypes:
serializedCollection: []
addedIllegalTypes:
serializedCollection: []
typeSettings:
serializedDictionary: []
typePriorities:
serializedDictionary: []

View File

@@ -1,8 +1,8 @@
fileFormatVersion: 2
guid: d2f9d2e7e9670e04eb4febfdd9139d6e
folderAsset: yes
DefaultImporter:
guid: 227f4c14ecdde7041ae3ae3e713e6fc8
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -352,7 +352,7 @@ Canvas:
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 0
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 1
@@ -370,6 +370,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1879421340}
- {fileID: 1833561914}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@@ -865,6 +866,142 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1833561913
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1833561914}
- component: {fileID: 1833561916}
- component: {fileID: 1833561915}
m_Layer: 5
m_Name: Text (TMP)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1833561914
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1833561913}
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: 386239072}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1833561915
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1833561913}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: New Text
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 36
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_TextWrappingMode: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 0
m_ActiveFontFeatures: 6e72656b
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_EmojiFallbackSupport: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &1833561916
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1833561913}
m_CullTransparentMesh: 1
--- !u!1 &1879421339
GameObject:
m_ObjectHideFlags: 0

View File

@@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using System.Globalization;
using Fantasy.Async;
namespace NBC
{

View File

@@ -48,7 +48,7 @@ namespace NBC
{
return assetProvider.Asset as T;
}
return null;
}

View File

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

View File

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

View File

@@ -1,16 +0,0 @@
using System;
using UnityEditor;
namespace NBC
{
internal static class CheckUnityVersion
{
[InitializeOnLoadMethod]
private static void OnInitializeOnLoad()
{
#if !UNITY_2021_3_OR_NEWER
Debug.LogError("Fantasy支持的最低版本为Unity2021.3.14f1c1");
#endif
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 455f338921e74471841971fd6b79db01
timeCreated: 1725943424

View File

@@ -1,49 +0,0 @@
using System.IO;
using UnityEditor;
using UnityEngine;
namespace NBC
{
[InitializeOnLoad]
public static class FantasyStartup
{
private const string ScriptAssemblies = "Library/ScriptAssemblies/";
static FantasyStartup()
{
if (!FantasySettingsScriptableObject.Instance.autoCopyAssembly)
{
return;
}
var hotUpdatePath = FantasySettingsScriptableObject.Instance.hotUpdatePath;
if (string.IsNullOrEmpty(hotUpdatePath))
{
Debug.LogError("请先在菜单Fantasy-Fantasy Settings里设置HotUpdatePath目录位置");
return;
}
if (!Directory.Exists(hotUpdatePath))
{
Directory.CreateDirectory(hotUpdatePath);
}
// ReSharper disable once StringLastIndexOfIsCultureSpecific.1
if (hotUpdatePath.LastIndexOf("/") != hotUpdatePath.Length - 1)
{
FantasySettingsScriptableObject.Instance.hotUpdatePath += "/";
hotUpdatePath = FantasySettingsScriptableObject.Instance.hotUpdatePath;
}
foreach (var instanceHotUpdateAssemblyDefinition in FantasySettingsScriptableObject.Instance.hotUpdateAssemblyDefinitions)
{
var dll = instanceHotUpdateAssemblyDefinition.name;
File.Copy($"{ScriptAssemblies}{dll}.dll", $"{hotUpdatePath}/{dll}.dll.bytes", true);
File.Copy($"{ScriptAssemblies}{dll}.pdb", $"{hotUpdatePath}/{dll}.pdb.bytes", true);
}
AssetDatabase.Refresh();
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 42156ba2865a4aa4a3e1e57b3ac9b984
timeCreated: 1688276977

View File

@@ -1,52 +0,0 @@
using System.IO;
using UnityEditor;
using UnityEngine;
namespace NBC
{
public class LinkXmlGenerator
{
private const string LinkPath = "Assets/link.xml";
// 在Unity编辑器中运行该方法来生成link.xml文件
[UnityEditor.MenuItem("Fantasy/Generate link.xml")]
public static void GenerateLinkXml()
{
using (var writer = new StreamWriter("Assets/link.xml"))
{
writer.WriteLine("<linker>");
foreach (var assembly in FantasySettingsScriptableObject.Instance.includeAssembly)
{
GenerateLinkXml(writer, assembly, LinkPath);
Debug.Log($"{assembly} Link generation completed");
}
if (FantasySettingsScriptableObject.Instance?.linkAssemblyDefinitions != null)
{
foreach (var linkAssembly in FantasySettingsScriptableObject.Instance.linkAssemblyDefinitions)
{
GenerateLinkXml(writer, linkAssembly.name, LinkPath);
Debug.Log($"{linkAssembly.name} Link generation completed");
}
}
writer.WriteLine("</linker>");
}
AssetDatabase.Refresh();
Debug.Log("link.xml generated successfully!");
}
private static void GenerateLinkXml(StreamWriter writer, string assemblyName, string outputPath)
{
var assembly = System.Reflection.Assembly.Load(assemblyName);
var types = assembly.GetTypes();
writer.WriteLine($" <assembly fullname=\"{assembly.GetName().Name}\">");
foreach (var type in types)
{
var typeName = type.FullName.Replace('<', '+').Replace('>', '+');
writer.WriteLine($" <type fullname=\"{typeName}\" preserve=\"all\"/>");
}
writer.WriteLine(" </assembly>");
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: cda4c9403de946df9c31654416193a21
timeCreated: 1722743236

View File

@@ -1,18 +0,0 @@
{
"name": "NBC.Editor",
"rootNamespace": "",
"references": [
"GUID:0b7224b83ba514121aa026f3857f820a"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 36410968656dd49358af485aad0b0c4c
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 3a6997d946f3400e8c423fe1b9245f65
timeCreated: 1688277110

View File

@@ -1,13 +0,0 @@
using UnityEditor;
namespace NBC
{
public class FantasySettings
{
[MenuItem("Fantasy/Fantasy Settings")]
public static void OpenFantasySettings()
{
SettingsService.OpenProjectSettings("Project/Fantasy Settings");
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 977a7c172c30403da60286ba39b7bc72
timeCreated: 1686913667

View File

@@ -1,102 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
namespace NBC
{
public class FantasySettingsProvider : SettingsProvider
{
private SerializedObject _serializedObject;
private SerializedProperty _autoCopyAssembly;
private SerializedProperty _hotUpdatePath;
private SerializedProperty _hotUpdateAssemblyDefinitions;
private SerializedProperty _linkAssemblyDefinitions;
private SerializedProperty _includeAssembly;
public FantasySettingsProvider() : base("Project/Fantasy Settings", SettingsScope.Project) { }
public override void OnActivate(string searchContext, VisualElement rootElement)
{
Init();
base.OnActivate(searchContext, rootElement);
}
public override void OnDeactivate()
{
base.OnDeactivate();
FantasySettingsScriptableObject.Save();
}
private void Init()
{
_serializedObject?.Dispose();
_serializedObject = new SerializedObject(FantasySettingsScriptableObject.Instance);
_autoCopyAssembly = _serializedObject.FindProperty("autoCopyAssembly");
_hotUpdatePath = _serializedObject.FindProperty("hotUpdatePath");
_hotUpdateAssemblyDefinitions = _serializedObject.FindProperty("hotUpdateAssemblyDefinitions");
_linkAssemblyDefinitions = _serializedObject.FindProperty("linkAssemblyDefinitions");
_includeAssembly = _serializedObject.FindProperty("includeAssembly");
}
public override void OnGUI(string searchContext)
{
if (_serializedObject == null || !_serializedObject.targetObject)
{
Init();
}
using (CreateSettingsWindowGUIScope())
{
_serializedObject!.Update();
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(_autoCopyAssembly);
EditorGUILayout.PropertyField(_hotUpdatePath);
EditorGUILayout.PropertyField(_hotUpdateAssemblyDefinitions);
EditorGUILayout.PropertyField(_includeAssembly);
EditorGUILayout.PropertyField(_linkAssemblyDefinitions);
// EditorGUILayout.HelpBox("默认包括Fantasy.Unity所以不需要再次指定。", MessageType.Info);
if (GUILayout.Button("GenerateLinkXml"))
{
LinkXmlGenerator.GenerateLinkXml();
}
if (EditorGUI.EndChangeCheck())
{
_serializedObject.ApplyModifiedProperties();
FantasySettingsScriptableObject.Save();
EditorApplication.RepaintHierarchyWindow();
}
base.OnGUI(searchContext);
}
}
private IDisposable CreateSettingsWindowGUIScope()
{
var unityEditorAssembly = System.Reflection.Assembly.GetAssembly(typeof(EditorWindow));
var type = unityEditorAssembly.GetType("UnityEditor.SettingsWindow+GUIScope");
return Activator.CreateInstance(type) as IDisposable;
}
static FantasySettingsProvider _provider;
[SettingsProvider]
public static SettingsProvider CreateMyCustomSettingsProvider()
{
if (FantasySettingsScriptableObject.Instance && _provider == null)
{
_provider = new FantasySettingsProvider();
using (var so = new SerializedObject(FantasySettingsScriptableObject.Instance))
{
_provider.keywords = GetSearchKeywordsFromSerializedObject(so);
}
}
return _provider;
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 047b2f13e73f413fa000bf7be979fb4a
timeCreated: 1688380387

View File

@@ -1,25 +0,0 @@
using UnityEditor;
using UnityEditor.Compilation;
using UnityEditorInternal;
using UnityEngine;
using UnityEngine.Serialization;
namespace NBC
{
[ScriptableObjectPath("ProjectSettings/FantasySettings.asset")]
public class FantasySettingsScriptableObject : ScriptableObjectSingleton<FantasySettingsScriptableObject>, ISerializationCallbackReceiver
{
[FormerlySerializedAs("AutoCopyAssembly")] [Header("自动拷贝程序集到HotUpdatePath目录中")]
public bool autoCopyAssembly = false;
[FormerlySerializedAs("HotUpdatePath")] [Header("HotUpdate目录(Unity编译后会把所有HotUpdate程序集Copy一份到这个目录下)")]
public string hotUpdatePath;
[FormerlySerializedAs("HotUpdateAssemblyDefinitions")] [Header("HotUpdate程序集")]
public AssemblyDefinitionAsset[] hotUpdateAssemblyDefinitions;
[FormerlySerializedAs("LinkAssemblyDefinitions")] [Header("指定要生成Link.xml的程序集")]
public AssemblyDefinitionAsset[] linkAssemblyDefinitions;
[FormerlySerializedAs("IncludeAssembly")] [Header("生成Link.xml时候默认包含的程序集")]
public string[] includeAssembly = new[] { "Assembly-CSharp", "Fantasy.Unity" };
public void OnBeforeSerialize() { }
public void OnAfterDeserialize() { }
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 27a37e930ca3454fb57bc895f50d2106
timeCreated: 1688277120

View File

@@ -1,100 +0,0 @@
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using UnityEditorInternal;
using UnityEngine;
// ReSharper disable AssignNullToNotNullAttribute
namespace NBC
{
public class ScriptableObjectSingleton<T> : ScriptableObject where T : ScriptableObject
{
private static T _instance;
public static T Instance
{
get
{
if (_instance == null)
{
_instance = Load();
}
return _instance;
}
}
private static T Load()
{
var scriptableObjectPath = GetScriptableObjectPath();
if (string.IsNullOrEmpty(scriptableObjectPath))
{
return null;
}
var loadSerializedFileAndForget = InternalEditorUtility.LoadSerializedFileAndForget(scriptableObjectPath);
if (loadSerializedFileAndForget.Length <= 0)
{
return CreateInstance<T>();
}
return loadSerializedFileAndForget[0] as T;
}
public static void Save(bool saveAsText = true)
{
if (_instance == null)
{
Debug.LogError("Cannot save ScriptableObjectSingleton: no instance!");
return;
}
var scriptableObjectPath = GetScriptableObjectPath();
if (string.IsNullOrEmpty(scriptableObjectPath))
{
return;
}
var directoryName = Path.GetDirectoryName(scriptableObjectPath);
if (!Directory.Exists(directoryName))
{
Directory.CreateDirectory(directoryName);
}
UnityEngine.Object[] obj = { _instance };
InternalEditorUtility.SaveToSerializedFileAndForget(obj, scriptableObjectPath, saveAsText);
}
private static string GetScriptableObjectPath()
{
var scriptableObjectPathAttribute = typeof(T).GetCustomAttribute(typeof(ScriptableObjectPathAttribute)) as ScriptableObjectPathAttribute;
return scriptableObjectPathAttribute?.ScriptableObjectPath;
}
}
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public class ScriptableObjectPathAttribute : Attribute
{
internal readonly string ScriptableObjectPath;
public ScriptableObjectPathAttribute(string scriptableObjectPath)
{
if (string.IsNullOrEmpty(scriptableObjectPath))
{
throw new ArgumentException("Invalid relative path (it is empty)");
}
if (scriptableObjectPath[0] == '/')
{
scriptableObjectPath = scriptableObjectPath.Substring(1);
}
ScriptableObjectPath = scriptableObjectPath;
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 3c77f5208dc14542ae7497d59321ef76
timeCreated: 1688278016

View File

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

View File

@@ -1,229 +0,0 @@
using UnityEngine;
using UnityEditor;
using UnityEngine.Networking;
using System.IO;
using System;
namespace UnityWebSocket.Editor
{
internal class SettingsWindow : EditorWindow
{
static SettingsWindow window = null;
[MenuItem("Tools/UnityWebSocket", priority = 100)]
internal static void Open()
{
if (window != null)
{
window.Close();
}
window = GetWindow<SettingsWindow>(true, "UnityWebSocket");
window.minSize = window.maxSize = new Vector2(600, 310);
window.Show();
window.BeginCheck();
}
private void OnGUI()
{
DrawLogo();
DrawVersion();
DrawSeparator(80);
DrawSeparator(186);
DrawHelper();
DrawFooter();
}
Texture2D logoTex = null;
private void DrawLogo()
{
if (logoTex == null)
{
logoTex = new Texture2D(66, 66);
logoTex.LoadImage(Convert.FromBase64String(LOGO_BASE64.VALUE));
for (int i = 0; i < 66; i++) for (int j = 0; j < 15; j++) logoTex.SetPixel(i, j, Color.clear);
logoTex.Apply();
}
var logoPos = new Rect(10, 10, 66, 66);
GUI.DrawTexture(logoPos, logoTex);
var title = "<color=#3A9AD8><b>UnityWebSocket</b></color>";
var titlePos = new Rect(80, 20, 500, 50);
GUI.Label(titlePos, title, TextStyle(24));
}
private void DrawSeparator(int y)
{
EditorGUI.DrawRect(new Rect(10, y, 580, 1), Color.white * 0.5f);
}
private GUIStyle TextStyle(int fontSize = 10, TextAnchor alignment = TextAnchor.UpperLeft, float alpha = 0.85f)
{
var style = new GUIStyle();
style.fontSize = fontSize;
style.normal.textColor = (EditorGUIUtility.isProSkin ? Color.white : Color.black) * alpha;
style.alignment = alignment;
style.richText = true;
return style;
}
private void DrawVersion()
{
GUI.Label(new Rect(440, 10, 150, 10), "Current Version: " + Settings.VERSION, TextStyle(alignment: TextAnchor.MiddleLeft));
if (string.IsNullOrEmpty(latestVersion))
{
GUI.Label(new Rect(440, 30, 150, 10), "Checking for Updates...", TextStyle(alignment: TextAnchor.MiddleLeft));
}
else if (latestVersion == "unknown")
{
}
else
{
GUI.Label(new Rect(440, 30, 150, 10), "Latest Version: " + latestVersion, TextStyle(alignment: TextAnchor.MiddleLeft));
if (Settings.VERSION == latestVersion)
{
if (GUI.Button(new Rect(440, 50, 150, 18), "Check Update"))
{
latestVersion = "";
changeLog = "";
BeginCheck();
}
}
else
{
if (GUI.Button(new Rect(440, 50, 150, 18), "Update to | " + latestVersion))
{
ShowUpdateDialog();
}
}
}
}
private void ShowUpdateDialog()
{
var isOK = EditorUtility.DisplayDialog("UnityWebSocket",
"Update UnityWebSocket now?\n" + changeLog,
"Update Now", "Cancel");
if (isOK)
{
UpdateVersion();
}
}
private void UpdateVersion()
{
Application.OpenURL(Settings.GITHUB + "/releases");
}
private void DrawHelper()
{
GUI.Label(new Rect(330, 200, 100, 18), "GitHub:", TextStyle(10, TextAnchor.MiddleRight));
if (GUI.Button(new Rect(440, 200, 150, 18), "UnityWebSocket"))
{
Application.OpenURL(Settings.GITHUB);
}
GUI.Label(new Rect(330, 225, 100, 18), "Report:", TextStyle(10, TextAnchor.MiddleRight));
if (GUI.Button(new Rect(440, 225, 150, 18), "Report an Issue"))
{
Application.OpenURL(Settings.GITHUB + "/issues/new");
}
GUI.Label(new Rect(330, 250, 100, 18), "Email:", TextStyle(10, TextAnchor.MiddleRight));
if (GUI.Button(new Rect(440, 250, 150, 18), Settings.EMAIL))
{
var uri = new Uri(string.Format("mailto:{0}?subject={1}", Settings.EMAIL, "UnityWebSocket Feedback"));
Application.OpenURL(uri.AbsoluteUri);
}
GUI.Label(new Rect(330, 275, 100, 18), "QQ群:", TextStyle(10, TextAnchor.MiddleRight));
if (GUI.Button(new Rect(440, 275, 150, 18), Settings.QQ_GROUP))
{
Application.OpenURL(Settings.QQ_GROUP_LINK);
}
}
private void DrawFooter()
{
EditorGUI.DropShadowLabel(new Rect(10, 230, 400, 20), "Developed by " + Settings.AUHTOR);
EditorGUI.DropShadowLabel(new Rect(10, 250, 400, 20), "All rights reserved");
}
UnityWebRequest req;
string changeLog = "";
string latestVersion = "";
void BeginCheck()
{
EditorApplication.update -= VersionCheckUpdate;
EditorApplication.update += VersionCheckUpdate;
req = UnityWebRequest.Get(Settings.GITHUB + "/releases/latest");
req.SendWebRequest();
}
private void VersionCheckUpdate()
{
#if UNITY_2020_3_OR_NEWER
if (req == null
|| req.result == UnityWebRequest.Result.ConnectionError
|| req.result == UnityWebRequest.Result.DataProcessingError
|| req.result == UnityWebRequest.Result.ProtocolError)
#elif UNITY_2018_1_OR_NEWER
if (req == null || req.isNetworkError || req.isHttpError)
#else
if (req == null || req.isError)
#endif
{
EditorApplication.update -= VersionCheckUpdate;
latestVersion = "unknown";
return;
}
if (req.isDone)
{
EditorApplication.update -= VersionCheckUpdate;
latestVersion = req.url.Substring(req.url.LastIndexOf("/") + 1).TrimStart('v');
if (Settings.VERSION != latestVersion)
{
var text = req.downloadHandler.text;
var st = text.IndexOf("content=\"" + latestVersion);
st = st > 0 ? text.IndexOf("\n", st) : -1;
var end = st > 0 ? text.IndexOf("\" />", st) : -1;
if (st > 0 && end > st)
{
changeLog = text.Substring(st + 1, end - st - 1).Trim();
changeLog = changeLog.Replace("\r", "");
changeLog = changeLog.Replace("\n", "\n- ");
changeLog = "\nCHANGE LOG: \n- " + changeLog + "\n";
}
}
Repaint();
}
}
}
internal static class LOGO_BASE64
{
internal const string VALUE = "iVBORw0KGgoAAAANSUhEUgAAAEIAAABCCAMAAADUivDaAAAAq1BMVEUAAABKmtcvjtYzl" +
"9szmNszl9syl9k0mNs0mNwzmNs0mNszl9szl9s0mNs0mNwzmNw0mNwyltk0mNw0mNwzl9s0mNsymNs0mNszmNwzmNwzm" +
"NszmNs0mNwzl9w0mNwzmNw0mNs0mNs0mNwzl9wzmNs0mNwzmNs0mNwzl90zmNszmNszl9szmNsxmNszmNszmNw0mNwzm" +
"Nw0mNs2neM4pe41mt43ouo2oOY5qfM+UHlaAAAAMnRSTlMAAwXN3sgI+/069MSCK6M/MA74h9qfFHB8STWMJ9OSdmNcI" +
"8qya1IeF+/U0EIa57mqmFTYJe4AAAN3SURBVFjD7ZbpkppAFEa/bgVBREF2kEVGFNeZsM77P1kadURnJkr8k1Qlx1Khu" +
"/pw7+2lwH/+YcgfMBBLG7VocwDamzH+wJBB8Qhjve2f0TdrGwjei6o4Ub/nM/APw5Z7vvSB/qrCrqbD6fBEVtigeMxks" +
"fX9zWbj+z1jhqgSBplQ50eGo4614WXlRAzgrRhmtSfvxAn7pB0N5ObaKKZZuU5/d37IBcBgUQwqDuf7Z2gUmVAl4NGNr" +
"/UeHxV5n39ulbaKLI86h6HilmM5M1aN126lpNhtl59yeTsp8nUMvpNC1J3bh5FtfVRk+bJrJunn5d4U4piJ/Vw9eXgsj" +
"4ZpZaCjg9waZkIpnBWLJ44OwoNu60F2UnSaEkKv4XnAlCpm6B4F/aKMDiyGi2L8SEEAVdxNLuzmgV7nFwObEe2xQVuX+" +
"RV1lWetga3w+cN1sXgvm4cJH8OEgZC1DPKhfF/BIymmQrMjq/x65FUeEkDup8GxoexZmznHCvANtXU/CAq13yimhQGtm" +
"H4VCPnBBL1fTKo3CqEcvq7Lb/OwHxWTYlyw+JmjKoVvDLVOQB4pVsM8K8smgvLCxZDlIijwyOEc+nr/msMwK0+GQWGBd" +
"tmhjv8icTds1s2ammaFh04QLLe69NK7guP6mTDMaw3o6nAX/Z7EXUskPSvWEWg4srVlp5NTDXv9Lce9HGN5eeG4nj5Yz" +
"ACteU2wQLo4MBtJfd1nw5nG1/s9zwUQ6pykL1TQjqdeuvQW0naz2XKLYL4Cwzr4vj+OQdD96CSp7Lrynp4aeFF0xdm5q" +
"6OFtFfPv7URxpWJNjd/N+3+I9+1klMav12Qtgbt9R2JaIopjkzaPtOFq4KxUpqfUMSFnQrySWjLoQzRZS4HMH84ME1ej" +
"S1YJpQZ3B+sR1uCQJSBdGdCk1eAEgORR88KK05W8dh2MA+A/SKCYu3mCJ0Ek7HBx4HHeuwYy5G3x8hSMTJcOMFbinCsn" +
"hO1V1aszGULvA0g4UFsb4VA0hAFcyo6cgLsAoT7uUtGAH5wQKQle0wuLyxLTaNyJEYwxw4wSljLK1TP8CAaOyhBMMEsj" +
"OBoXgo7VGElFkSWL+vef1RF2YNXeRWYzQBTpkhC8KaZHhuIogArkQLKClBZjU26B2IZgGz+cpZkHl8g3fYUaW/YP2kb2" +
"M/V97JY/vZN859n+QmO7XtC9Bf2jAAAAABJRU5ErkJggg==";
}
}

View File

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

View File

@@ -1,12 +0,0 @@
MIT License
Copyright (c) 2023 qq362946
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
However, the following entity is explicitly prohibited from using, copying, modifying, or distributing the Software or any of its portions:
泰课在线https://www.taikr.com/
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

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

View File

@@ -1,45 +0,0 @@
# Fantasy
#### Fantasy是基于.NET的高性能网络开发框架支持主流协议前后端分离。
#### 支持Unity/Godot/WinFrom/WPF/Console等C#客户端接入。
#### 框架支持TCP\KCP\WebSocket\http支持Unity发布成H5三种网络协议。
#### 适合需要快速上手、可扩展、分布式全平台商业级解决方案的框架。
## 导航
* [Fantasy介绍网站](https://www.code-fantasy.com/)
* [Fantasy的API文档](https://www.code-fantasy.com/doc/api/Fantasy.html)
* [入门视频观看地址](https://space.bilibili.com/382126312)
## 快速上手
* 01.快速入门
* [1.1.获得Fantasy](https://www.code-fantasy.com/top/download-fantasy/)
* [1.2.配置文件](https://www.code-fantasy.com/top/config-file/)
* [1.3.Fantasy的网络](https://www.code-fantasy.com/top/use-network/)
* [1.4.Fantasy的配置文件](https://www.code-fantasy.com/top/config-file/)
* [1.5.Fantasy的命令行参数](https://www.code-fantasy.com/top/command-line-parameter/)
* [1.6.如何升级到最新版](https://www.code-fantasy.com/top/upgrade/)
* 02.网络通信
* [2.1.配置网络协议](https://www.code-fantasy.com/network/network-protocols/)
* [2.2.客户端服务器之间发送消息](https://www.code-fantasy.com/network/session/)
* [2.3.服务器之间发送消息](https://www.code-fantasy.com/network/networkmessagingomponent/)
* [2.4.Route通信协议](https://www.code-fantasy.com/network/network-route/)
* [2.5.Addressable通信协议](https://www.code-fantasy.com/network/network-addressable/)
* 03.系统组件
* [3.1.ECS系统](https://www.code-fantasy.com/core/ecs/)
* [3.2.事件系统](https://www.code-fantasy.com/core/event/)
* [3.3.任务系统](https://www.code-fantasy.com/core/task/)
* [3.4.异步协程锁](https://www.code-fantasy.com/core/lock/)
* [3.5.数据库](https://www.code-fantasy.com/core/db/)
* [更新日志](https://www.code-fantasy.com/changelog/)
* [API文档](https://www.code-fantasy.com/doc/api/Fantasy.html)
* [常见问题](https://www.code-fantasy.com/question/)
## 优质开源项目推荐
#### <a href="https://github.com/egametang/ET"><strong>ET</strong></a> - ET框架是一整套完善的游戏开发框架。
#### <a href="https://github.com/ALEXTANGXIAO/TEngine"><strong>TEngine</strong></a> - TEngine是一个简单(新手友好开箱即用)且强大的Unity框架全平台解决方案。
#### <a href="https://github.com/FlameskyDexive/Legends-Of-Heroes"><strong>Legends-Of-Heroes</strong></a> - 一个LOL风格的球球大作战游戏基于ET使用状态同步。
## 交流与讨论:
__讨论QQ群 : Fantasy服务器开发交流群 569888673 __
## 特别鸣谢
感谢JetBrains公司提供的使用许可证
<p><a href="https://www.jetbrains.com/?from=fantasy">
<img src="https://user-images.githubusercontent.com/8274346/223466125-611c027a-61f3-4ea0-a96d-4052283da746.png" alt="JetBrains的Logo" width="20%" height="20%"></a></p>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 15d567bba8474e428130cba9e1280371
timeCreated: 1675820358

View File

@@ -1,149 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
#if UNITY_EDITOR
using System.Reflection;
#endif
namespace NBC.Asset
{
public interface IAddressableImpl
{
public void Load();
void UpdateBundleInfo(string bundleName);
VersionData GetVersionData();
PackageData GetPackageData(string packageName);
AssetInfo GetAssetInfo(string path, Type type);
BundleInfo GetBundleInfo(AssetInfo assetInfo);
BundleInfo GetBundleInfo(BundleData bundleData);
BundleInfo[] GetAllBundleInfo();
BundleInfo[] GetAllDependBundleInfos(AssetInfo assetInfo);
}
internal static class Addressable
{
public static Func<IAddressableImpl> CreateHandler { get; set; } = AddressableRuntimeImpl.CreateInstance;
private static IAddressableImpl _impl;
public static void Load()
{
CreateHandlerImpl();
_impl.Load();
}
public static void UpdateBundleInfo(string bundleName)
{
_impl.UpdateBundleInfo(bundleName);
}
#region Version
public static VersionData GetVersionData()
{
return _impl.GetVersionData();
}
public static PackageData GetPackageData(string packageName)
{
return _impl.GetPackageData(packageName);
}
#endregion
#region Asset
public static AssetInfo GetAssetInfo(string path, Type type)
{
return _impl.GetAssetInfo(path, type);
}
#endregion
#region Bundle
public static BundleInfo GetBundleInfo(AssetInfo assetInfo)
{
return _impl.GetBundleInfo(assetInfo);
}
public static BundleInfo GetBundleInfo(BundleData bundleData)
{
return _impl.GetBundleInfo(bundleData);
}
public static BundleInfo[] GetAllBundleInfo()
{
return _impl.GetAllBundleInfo();
}
public static BundleInfo[] GetAllDependBundleInfos(AssetInfo assetInfo)
{
return _impl.GetAllDependBundleInfos(assetInfo);
}
/// <summary>
/// 获取当前版本可以解压到本地缓存的bundle包
/// </summary>
/// <returns></returns>
public static BundleInfo[] GetCanUnpackBundles()
{
var bundles = GetAllBundleInfo();
return bundles.Where(bundle => bundle.LoadMode == BundleLoadMode.LoadFromStreaming).ToArray();
}
/// <summary>
/// 获取当前版本可以下载到本地的bundle包
/// </summary>
/// <returns></returns>
public static BundleInfo[] GetCanDownloadBundles()
{
var bundles = GetAllBundleInfo();
return bundles.Where(bundle => bundle.LoadMode == BundleLoadMode.LoadFromRemote).ToArray();
}
#endregion
#region
private static void CreateHandlerImpl()
{
#if UNITY_EDITOR
if (Const.Simulate)
{
_impl = GetAddressableEditImpl();
return;
}
#endif
_impl = CreateHandler();
}
#if UNITY_EDITOR
/// <summary>
/// 通过反射实例化editor下的接口实现
/// </summary>
/// <returns></returns>
private static IAddressableImpl GetAddressableEditImpl()
{
var ass = AppDomain.CurrentDomain.GetAssemblies()
.First(assembly => assembly.GetName().Name == "NBC.Asset.Editor");
var type = ass.GetType("NBC.Asset.Editor.AddressableEditImpl");
var manifestFilePath = InvokePublicStaticMethod(type, "CreateInstance") as IAddressableImpl;
return manifestFilePath;
}
private static object InvokePublicStaticMethod(System.Type type, string method, params object[] parameters)
{
var methodInfo = type.GetMethod(method, BindingFlags.Public | BindingFlags.Static);
if (methodInfo == null)
{
UnityEngine.Debug.LogError($"{type.FullName} not found method : {method}");
return null;
}
return methodInfo.Invoke(null, parameters);
}
#endif
#endregion
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: ef00a85e62d14d759a4b4cc90d922e44
timeCreated: 1675932162

View File

@@ -1,164 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEngine;
namespace NBC.Asset
{
internal class AddressableRuntimeImpl : IAddressableImpl
{
public static IAddressableImpl CreateInstance()
{
return new AddressableRuntimeImpl();
}
private VersionDataReader _versionDataReader;
private readonly Dictionary<string, AssetInfo> _assetInfos = new Dictionary<string, AssetInfo>();
private readonly Dictionary<string, BundleInfo> _bundleInfos = new Dictionary<string, BundleInfo>();
#region Init
public void Load()
{
_versionDataReader = new VersionDataReader();
}
#endregion
#region manifest Data
public VersionData GetVersionData()
{
return _versionDataReader.VersionData;
}
public PackageData GetPackageData(string packageName)
{
return _versionDataReader.PackageDataList.Find(p => p.Name == packageName);
}
#endregion
#region Assets
public AssetInfo GetAssetInfo(string path, Type type)
{
path = _versionDataReader.GetAssetRealPath(path);
var guid = Util.GetAssetGUID(path, type);
if (!_assetInfos.TryGetValue(guid, out var info))
{
var data = _versionDataReader.GetAsset(path);
if (data != null)
{
info = new AssetInfo(data, type);
_assetInfos[info.GUID] = info;
}
}
return info;
}
#endregion
#region Bundles
/// <summary>
/// 刷新bundle相关信息
/// </summary>
public void UpdateBundleInfo(string bundleName)
{
if (string.IsNullOrEmpty(bundleName))
{
foreach (var bundle in _bundleInfos.Values)
{
bundle.LoadMode = GetBundleLoadMode(bundle.Bundle);
}
}
else
{
if (_bundleInfos.TryGetValue(bundleName, out var bundleInfo))
{
bundleInfo.LoadMode = GetBundleLoadMode(bundleInfo.Bundle);
}
}
}
public BundleInfo GetBundleInfo(AssetInfo assetInfo)
{
var bundleData = _versionDataReader.GetBundleByAsset(assetInfo.Path);
return GetBundleInfo(bundleData);
}
public BundleInfo GetBundleInfo(BundleData bundleData)
{
if (bundleData == null)
throw new Exception("BundleData NOT NULL!");
if (!_bundleInfos.TryGetValue(bundleData.Name, out var bundleInfo))
{
bundleInfo = CreateBundleInfo(bundleData);
}
return bundleInfo;
}
public BundleInfo[] GetAllBundleInfo()
{
var bundles = _versionDataReader.GetAllBundle();
List<BundleInfo> list = new List<BundleInfo>(bundles.Count);
foreach (var bundle in bundles)
{
list.Add(GetBundleInfo(bundle));
}
return list.ToArray();
}
public BundleInfo[] GetAllDependBundleInfos(AssetInfo assetInfo)
{
var arr = _versionDataReader.GetAllDependBundle(assetInfo.Path);
if (arr != null)
{
List<BundleInfo> list = new List<BundleInfo>();
foreach (var bundle in arr)
{
list.Add(GetBundleInfo(bundle));
}
return list.ToArray();
}
return Array.Empty<BundleInfo>();
}
private BundleInfo CreateBundleInfo(BundleData bundleData)
{
var bundleInfo = new BundleInfo(bundleData)
{
LoadMode = GetBundleLoadMode(bundleData)
};
_bundleInfos[bundleData.Name] = bundleInfo;
return bundleInfo;
}
private BundleLoadMode GetBundleLoadMode(BundleData bundleData)
{
if (File.Exists(bundleData.CachedDataFilePath))
{
return BundleLoadMode.LoadFromCache;
}
if (StreamingAssetsUtil.FileExists(bundleData.NameHash))
{
return BundleLoadMode.LoadFromStreaming;
}
return BundleLoadMode.LoadFromRemote;
}
#endregion
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 4ad9800ddd244d50b5d4c7bc18f578b9
timeCreated: 1677723858

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 017fad8ee8a545caa126cdaad404c93d
timeCreated: 1677636239

View File

@@ -1,61 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace NBC.Asset
{
[Serializable]
public class AssetData
{
public string Name;
public int Bundle;
/// <summary>
/// 所属目录
/// </summary>
public int Dir;
// /// <summary>
// /// 依赖的bundle
// /// </summary>
// public List<int> Deps = new List<int>();
/// <summary>
/// 资源可寻址地址
/// </summary>
public string Address;
/// <summary>
/// 资源真实地址
/// </summary>
public string Path { get; set; }
/// <summary>
/// 资源Bundle
/// </summary>
public string BundleName { get; set; }
public string[] Tags { get; internal set; }
/// <summary>
/// 是否包含Tag
/// </summary>
public bool HasTag(string[] tags)
{
if (tags == null || tags.Length == 0)
return false;
if (Tags == null || Tags.Length == 0)
return false;
foreach (var tag in tags)
{
if (Tags.Contains(tag))
return true;
}
return false;
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 591cdedd5ee84c1c98d1d80d4c8f44fc
timeCreated: 1677230741

View File

@@ -1,114 +0,0 @@
using System;
using System.Collections.Generic;
namespace NBC.Asset
{
[Serializable]
public class BundleData
{
public string Name;
public string Hash;
public int Size;
// /// <summary>
// /// 加载方法
// /// </summary>
// public byte LoadMethod;
/// <summary>
/// 资源包的分类标签
/// </summary>
public string[] Tags;
/// <summary>
/// 依赖的bundleId
/// </summary>
public List<int> Deps = new List<int>();
/// <summary>
/// 所属的包裹名称
/// </summary>
public string PackageName { set; get; }
public List<string> DependBundles { get; private set; } = new List<string>();
private string _nameHash = string.Empty;
public string NameHash
{
get
{
if (!string.IsNullOrEmpty(_nameHash)) return _nameHash;
_nameHash = Util.NameAddHash(Name, Hash);
return _nameHash;
}
}
/// <summary>
/// 内置文件路径
/// </summary>
private string _streamingFilePath;
public string StreamingFilePath
{
get
{
if (string.IsNullOrEmpty(_streamingFilePath) == false)
return _streamingFilePath;
_streamingFilePath = Const.GetStreamingPath(NameHash);
return _streamingFilePath;
}
}
/// <summary>
/// 缓存的数据文件路径
/// </summary>
private string _cachedDataFilePath;
public string CachedDataFilePath
{
get
{
if (string.IsNullOrEmpty(_cachedDataFilePath) == false)
return _cachedDataFilePath;
_cachedDataFilePath = Const.GetCachePath(NameHash);
return _cachedDataFilePath;
}
}
/// <summary>
/// 远程的数据文件路径
/// </summary>
private string _remoteDataFilePath;
public string RemoteDataFilePath
{
get
{
if (string.IsNullOrEmpty(_remoteDataFilePath) == false)
return _remoteDataFilePath;
_remoteDataFilePath = Const.GetRemotePath(NameHash);
return _remoteDataFilePath;
}
}
/// <summary>
/// 临时的数据文件路径
/// </summary>
private string _tempDataFilePath;
public string TempDataFilePath
{
get
{
if (string.IsNullOrEmpty(_tempDataFilePath) == false)
return _tempDataFilePath;
_tempDataFilePath = $"{CachedDataFilePath}.temp";
return _tempDataFilePath;
}
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: de6f2556c6e147afb0269b9ca02c6260
timeCreated: 1677230723

View File

@@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace NBC.Asset
{
[Serializable]
public class PackageData
{
public string Name;
public int Def;
public List<string> Dirs;
public List<AssetData> Assets;
public List<BundleData> Bundles;
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 10936edd968649ecbf4b7a1bb20e84cf
timeCreated: 1678156381

View File

@@ -1,63 +0,0 @@
using System;
using System.Collections.Generic;
namespace NBC.Asset
{
// [Serializable]
// public class VersionPackagesData
// {
// public string Ver;
// public string Name;
// public string Hash;
// public int Size;
// public int Def;
// public string NameHash => $"{Name}_{Hash}.json";
// }
//
// [Serializable]
// public class VersionData
// {
// /// <summary>
// /// app版本号
// /// </summary>
// public string AppVer;
//
// /// <summary>
// /// 版本包
// /// </summary>
// public List<VersionPackagesData> Packages = new List<VersionPackagesData>();
//
// /// <summary>
// /// 导出时间
// /// </summary>
// public long BuildTime;
// }
[Serializable]
public class VersionPackageData
{
public List<PackageData> Packages = new List<PackageData>();
}
[Serializable]
public class VersionData
{
/// <summary>
/// app版本号
/// </summary>
public string AppVer;
/// <summary>
/// 版本包hash
/// </summary>
public string Hash;
public long Size;
/// <summary>
/// 导出时间
/// </summary>
public long BuildTime;
public string NameHash => $"packages_{Hash}.json";
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 671aac8f73924f1bae2ef7753fb6b239
timeCreated: 1675820403

View File

@@ -1,139 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEngine;
namespace NBC.Asset
{
internal class VersionDataReader
{
private readonly Dictionary<string, BundleData> _bundles = new Dictionary<string, BundleData>();
private readonly Dictionary<string, AssetData> _assets = new Dictionary<string, AssetData>();
private readonly Dictionary<string, string> _addressablePath = new Dictionary<string, string>();
public VersionData VersionData { get; private set; }
public List<PackageData> PackageDataList { get; private set; } = new List<PackageData>();
public VersionDataReader()
{
ReadVersionData();
}
public string GetAssetRealPath(string path)
{
return _addressablePath.TryGetValue(path, out var realPath) ? realPath : path;
}
public AssetData GetAsset(string path)
{
return _assets.TryGetValue(path, out var assetRef) ? assetRef : null;
}
public List<BundleData> GetAllBundle()
{
List<BundleData> list = new List<BundleData>(_bundles.Count);
list.AddRange(_bundles.Values);
return list;
}
public BundleData GetBundle(string name)
{
return _bundles.TryGetValue(name, out var bundleRef) ? bundleRef : null;
}
public BundleData GetBundleByAsset(string assetPath)
{
var asset = GetAsset(assetPath);
return asset == null ? null : GetBundle(asset.BundleName);
}
/// <summary>
/// 获取资源所需的所有bundle信息下标0为所在包
/// </summary>
/// <param name="path">资源原始地址</param>
/// <returns></returns>
public BundleData[] GetAllDependBundle(string path)
{
if (_assets.TryGetValue(path, out var assetData))
{
if (_bundles.TryGetValue(assetData.BundleName, out var bundleData))
{
var needBundle = new List<BundleData> { bundleData };
needBundle.AddRange(bundleData.DependBundles.Select(bundle => _bundles[bundle]));
return needBundle.ToArray();
}
}
return Array.Empty<BundleData>();
}
private void ReadVersionData()
{
VersionData = ReadJson<VersionData>(Const.VersionFileName);
if (VersionData != null)
{
var packageData =
ReadJson<VersionPackageData>(VersionData.NameHash);
if (packageData != null)
{
foreach (var package in packageData.Packages)
{
ReadPackage(package);
}
}
}
else
{
Debug.LogError("version data is null");
}
}
private void ReadPackage(PackageData packageData)
{
if (packageData != null)
{
foreach (var bundle in packageData.Bundles)
{
foreach (var dep in bundle.Deps)
{
var depBundle = packageData.Bundles[dep];
if (depBundle != null)
{
bundle.DependBundles.Add(depBundle.Name);
}
}
bundle.PackageName = packageData.Name;
_bundles[bundle.Name] = bundle;
}
foreach (var asset in packageData.Assets)
{
if (asset.Dir < 0 || asset.Dir >= packageData.Dirs.Count) continue;
if (asset.Bundle < 0 || asset.Bundle >= packageData.Bundles.Count) continue;
var dir = packageData.Dirs[asset.Dir];
var bundle = packageData.Bundles[asset.Bundle];
asset.Path = $"{dir}/{asset.Name}";
asset.BundleName = bundle.Name;
_assets[asset.Path] = asset;
var filePath = $"{dir}/{Path.GetFileNameWithoutExtension(asset.Name)}";
//去除后缀后,默认加入寻址
_addressablePath[filePath] = asset.Path;
if (asset.Address != asset.Path)
{
_addressablePath[asset.Address] = asset.Path;
}
}
PackageDataList.Add(packageData);
}
}
private T ReadJson<T>(string fileName) where T : new()
{
return Util.ReadJson<T>(Const.GetCachePath(fileName));
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: df6f17d0c94e4f9ca2145fab20c9052f
timeCreated: 1678083955

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: d09538ede05f44e185e003b29093c3c3
timeCreated: 1677723806

View File

@@ -1,64 +0,0 @@
using System;
namespace NBC.Asset
{
public class AssetInfo
{
private readonly AssetData _assetData;
// public AssetData Data => _assetData;
/// <summary>
/// 资源路径
/// </summary>
public string Path { private set; get; }
/// <summary>
/// 资源类型
/// </summary>
public Type AssetType { private set; get; }
private string _providerGUID;
/// <summary>
/// 唯一标识符
/// </summary>
public string GUID
{
get
{
if (!string.IsNullOrEmpty(_providerGUID))
return _providerGUID;
_providerGUID = Util.GetAssetGUID(Path, AssetType);
return _providerGUID;
}
}
public AssetInfo(AssetData assetData, System.Type assetType)
{
if (assetData == null)
throw new Exception("assetData is null!");
_assetData = assetData;
AssetType = assetType;
Path = assetData.Path;
}
public AssetInfo(AssetData assetData)
{
if (assetData == null)
throw new System.Exception("assetData is null!");
_assetData = assetData;
AssetType = null;
Path = assetData.Path;
}
public bool HasTag(string[] tags)
{
return _assetData.HasTag(tags);
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 7edf10c26d554a3d8c03c099062093dd
timeCreated: 1676965484

View File

@@ -1,40 +0,0 @@
namespace NBC.Asset
{
public class BundleInfo
{
public readonly BundleData Bundle;
public BundleLoadMode LoadMode;
public BundleInfo(BundleData bundleData)
{
Bundle = bundleData;
}
/// <summary>
/// 资源地址
/// </summary>
public string BundlePath
{
get
{
if (LoadMode == BundleLoadMode.LoadFromStreaming)
{
return Bundle.StreamingFilePath;
}
if (LoadMode == BundleLoadMode.LoadFromCache)
{
return Bundle.CachedDataFilePath;
}
if (LoadMode == BundleLoadMode.LoadFromRemote)
{
return Bundle.RemoteDataFilePath;
}
return string.Empty;
}
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 5a2f72ad8fc649bc805449e37b9540f2
timeCreated: 1677118210

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: c3d07e0b392948a6952e05b39d689112
timeCreated: 1676356201

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: e23bf04f44304300ad16382736556ec2
timeCreated: 1677058068

View File

@@ -1,56 +0,0 @@
namespace NBC.Asset
{
internal class AssetLoadFromDatabase : IAssetLoader
{
public static IAssetLoader CreateInstance()
{
return new AssetLoadFromDatabase();
}
private AssetProvider _provider;
public void Start(AssetProvider provider)
{
_provider = provider;
}
public void Update()
{
#if UNITY_EDITOR
var assetInfo = _provider.AssetInfo;
var path = assetInfo.Path;
string guid = UnityEditor.AssetDatabase.AssetPathToGUID(path);
if (string.IsNullOrEmpty(guid))
{
_provider.SetStatus(NTaskStatus.Success, $"Not found asset : {path}");
return;
}
UnityEngine.Object obj;
if (assetInfo.AssetType == null)
obj = UnityEditor.AssetDatabase.LoadMainAssetAtPath(assetInfo.Path);
else
obj = UnityEditor.AssetDatabase.LoadAssetAtPath(assetInfo.Path, assetInfo.AssetType);
if (obj == null)
{
_provider.SetStatus(NTaskStatus.Fail);
}
else
{
_provider.Asset = obj;
_provider.SetStatus(NTaskStatus.Success);
}
#endif
}
public void WaitForAsyncComplete()
{
Update();
}
public void Destroy()
{
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 73a25ea4518949d28d090a974722dbee
timeCreated: 1678286041

View File

@@ -1,144 +0,0 @@
using UnityEngine;
namespace NBC.Asset
{
internal class AssetLoaderFromBundle : IAssetLoader
{
public static IAssetLoader CreateInstance()
{
return new AssetLoaderFromBundle();
}
private enum Steps
{
LoadDependency,
LoadAsset,
}
private AssetProvider _provider;
private AssetInfo _assetInfo;
private AssetBundleRequest _cacheRequest;
private Dependency _dependency;
private Steps _steps = Steps.LoadDependency;
private bool _isWaitForAsyncComplete;
private AssetBundleRequest _assetBundleRequest;
public AssetBundle _assetBundle;
public void Start(AssetProvider provider)
{
_provider = provider;
_assetInfo = provider.AssetInfo;
_dependency = Dependency.GetAssetDependency(_assetInfo);
_dependency.Retain();
}
public void Update()
{
if (_steps == Steps.LoadDependency)
{
if (_isWaitForAsyncComplete)
{
_dependency.WaitForAsyncComplete();
}
if (!_dependency.IsDone) return;
if (!_dependency.IsSucceed)
{
Debug.LogError("error");
SetStatus("dependency fail");
}
var provider = _dependency.GetMainBundledProvider();
if (provider != null && provider.AssetBundle != null)
{
_assetBundle = provider.AssetBundle;
if (_isWaitForAsyncComplete)
{
if (_provider.IsAll)
{
SetStatus(_assetBundle.LoadAssetWithSubAssets(_assetInfo.Path, _assetInfo.AssetType));
}
else
{
SetStatus(_assetBundle.LoadAsset(_assetInfo.Path, _assetInfo.AssetType));
}
}
else
{
_assetBundleRequest = _provider.IsAll
? _assetBundle.LoadAssetWithSubAssetsAsync(_assetInfo.Path, _assetInfo.AssetType)
: _assetBundle.LoadAssetAsync(_assetInfo.Path, _assetInfo.AssetType);
_steps = Steps.LoadAsset;
}
}
else
{
//失败,后续补全失败逻辑
Debug.LogError("error1");
SetStatus("error");
}
}
else if (_steps == Steps.LoadAsset)
{
if (!_assetBundleRequest.isDone) return;
if (_provider.IsAll)
{
SetStatus(_assetBundleRequest.allAssets);
}
else
{
SetStatus(_assetBundleRequest.asset);
}
}
}
public void WaitForAsyncComplete()
{
_isWaitForAsyncComplete = true;
int frame = 1000;
while (true)
{
frame--;
if (frame == 0)
{
break;
}
Update();
if (_provider.IsDone)
break;
}
}
public void Destroy()
{
_dependency.Release();
_assetBundleRequest = null;
}
private void SetStatus(Object asset)
{
_provider.Asset = asset;
_provider.SetStatus(NTaskStatus.Success);
}
private void SetStatus(Object[] allAsset)
{
_provider.AllAsset = allAsset;
_provider.SetStatus(NTaskStatus.Success);
}
private void SetStatus(string error)
{
_provider.SetStatus(NTaskStatus.Fail, error);
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 4f15a2f6e208403e8e55d45dc7e01fd1
timeCreated: 1677551825

View File

@@ -1,113 +0,0 @@
using UnityEngine;
namespace NBC.Asset
{
internal class BundleLoaderFromDownload : IBundleLoader
{
private enum Steps
{
Download,
Load,
Check,
Done,
}
private BundledProvider _provider;
private Steps _steps = Steps.Download;
private AssetBundleCreateRequest _createRequest;
private string _downloadPath;
private string _loadPath;
private bool _isWaitForAsyncComplete;
private DownloadFileTask _downloadFileTask;
public AssetBundle Bundle { set; get; }
public void Start(BundledProvider provider)
{
_provider = provider;
var bundleData = provider.BundleInfo.Bundle;
_downloadPath = bundleData.RemoteDataFilePath;
_loadPath = bundleData.CachedDataFilePath;
_downloadFileTask = new DownloadFileTask(_downloadPath, bundleData.CachedDataFilePath);
_downloadFileTask.Run();
}
public void Update()
{
if (_steps == Steps.Download)
{
if (!_downloadFileTask.IsDone) return;
Addressable.UpdateBundleInfo(_provider.BundleInfo.Bundle.Name);
_steps = Steps.Load;
}
if (_steps == Steps.Load)
{
if (_isWaitForAsyncComplete)
Bundle = AssetBundle.LoadFromFile(_loadPath);
else
_createRequest = AssetBundle.LoadFromFileAsync(_loadPath);
_steps = Steps.Check;
}
if (_steps == Steps.Check)
{
if (_createRequest != null)
{
if (_isWaitForAsyncComplete)
{
Bundle = _createRequest.assetBundle;
}
else
{
if (!_createRequest.isDone)
return;
Bundle = _createRequest.assetBundle;
}
}
if (Bundle == null)
{
_steps = Steps.Done;
_provider.SetStatus(NTaskStatus.Fail,
$"failed load assetBundle : {_provider.BundleInfo.Bundle.Name}");
Debug.LogError(_provider.ErrorMsg);
}
else
{
_provider.SetStatus(NTaskStatus.Success);
_provider.AssetBundle = Bundle;
_steps = Steps.Done;
}
}
}
public void WaitForAsyncComplete()
{
_isWaitForAsyncComplete = true;
int frame = 1000;
while (true)
{
// 保险机制
frame--;
if (frame == 0)
{
break;
}
Update();
_downloadFileTask.Process();
if (_provider.IsDone)
break;
}
}
public void Destroy()
{
_createRequest = null;
_downloadFileTask = null;
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: b2dee1496d7247acb00dbb7af88a016c
timeCreated: 1677558190

View File

@@ -1,98 +0,0 @@
using UnityEngine;
namespace NBC.Asset
{
internal class BundleLoaderFromLocal : IBundleLoader
{
private enum Steps
{
Load,
Check,
Done,
}
private BundledProvider _provider;
private Steps _steps = Steps.Load;
private AssetBundleCreateRequest _createRequest;
private string _loadPath;
private bool _isWaitForAsyncComplete;
public AssetBundle Bundle { set; get; }
public void Start(BundledProvider provider)
{
_provider = provider;
var info = provider.BundleInfo;
_loadPath = info.BundlePath;
}
public void Update()
{
if (_steps == Steps.Load)
{
if (_isWaitForAsyncComplete)
Bundle = AssetBundle.LoadFromFile(_loadPath);
else
_createRequest = AssetBundle.LoadFromFileAsync(_loadPath);
_steps = Steps.Check;
}
if (_steps == Steps.Check)
{
if (_createRequest != null)
{
if (_isWaitForAsyncComplete)
{
Bundle = _createRequest.assetBundle;
}
else
{
if (!_createRequest.isDone)
return;
Bundle = _createRequest.assetBundle;
}
}
if (Bundle == null)
{
_steps = Steps.Done;
_provider.SetStatus(NTaskStatus.Fail,
$"failed load assetBundle : {_provider.BundleInfo.Bundle.Name}");
Debug.LogError(_provider.ErrorMsg);
}
else
{
_provider.SetStatus(NTaskStatus.Success);
_provider.AssetBundle = Bundle;
_steps = Steps.Done;
}
}
}
public void WaitForAsyncComplete()
{
_isWaitForAsyncComplete = true;
int frame = 1000;
while (true)
{
// 保险机制
frame--;
if (frame == 0)
{
break;
}
Update();
if (_provider.IsDone)
break;
}
}
public void Destroy()
{
_createRequest = null;
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: b1157be68cf14e4ea3b8dcb2eab1f59c
timeCreated: 1677552109

View File

@@ -1,10 +0,0 @@
namespace NBC.Asset
{
public interface IAssetLoader
{
void Start(AssetProvider provider);
void Update();
void WaitForAsyncComplete();
void Destroy();
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 66d37ccc10d2432497d403f43d45e6d9
timeCreated: 1677549879

View File

@@ -1,10 +0,0 @@
namespace NBC.Asset
{
internal interface IBundleLoader
{
void Start(BundledProvider provider);
void Update();
void WaitForAsyncComplete();
void Destroy();
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 033c5ad1ff974e368aac38947b3702c8
timeCreated: 1677549943

View File

@@ -1,10 +0,0 @@
namespace NBC.Asset
{
public interface ISceneLoader
{
void Start(SceneProvider provider);
void Update();
void WaitForAsyncComplete();
void Destroy();
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: de7de727380a4f8695304aded82565aa
timeCreated: 1677832119

View File

@@ -1,101 +0,0 @@
using System.IO;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace NBC.Asset
{
internal class SceneLoadFromDatabase : ISceneLoader
{
public static ISceneLoader CreateInstance()
{
return new SceneLoadFromDatabase();
}
private enum Steps
{
LoadDependency,
LoadScene,
}
private bool _isWaitForAsyncComplete;
private SceneProvider _provider;
private AssetInfo _assetInfo;
private Steps _steps;
private AsyncOperation _asyncOperation;
public void Start(SceneProvider provider)
{
_provider = provider;
_assetInfo = provider.AssetInfo;
_steps = Steps.LoadDependency;
}
public void Update()
{
#if UNITY_EDITOR
if (_steps == Steps.LoadDependency)
{
var scenePath = _assetInfo.Path;
LoadSceneParameters loadSceneParameters = new LoadSceneParameters
{
loadSceneMode = _provider.SceneMode
};
if (_isWaitForAsyncComplete)
{
UnityEditor.SceneManagement.EditorSceneManager.LoadSceneInPlayMode(scenePath, loadSceneParameters);
SetStatus();
}
else
{
_asyncOperation =
UnityEditor.SceneManagement.EditorSceneManager.LoadSceneAsyncInPlayMode(scenePath,
loadSceneParameters);
_steps = Steps.LoadScene;
}
}
else if (_steps == Steps.LoadScene)
{
if (!_asyncOperation.isDone) return;
SetStatus();
}
#endif
}
public void WaitForAsyncComplete()
{
_isWaitForAsyncComplete = true;
int frame = 1000;
while (true)
{
frame--;
if (frame == 0)
{
break;
}
Update();
if (_provider.IsDone)
break;
}
}
public void Destroy()
{
}
private void SetStatus()
{
var sceneObj = SceneManager.GetSceneAt(SceneManager.sceneCount - 1);
_provider.SceneObject = sceneObj;
_provider.SetStatus(NTaskStatus.Success);
}
private void SetStatus(string error)
{
_provider.SetStatus(NTaskStatus.Fail, error);
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 46af8c940cb3447a970be02ea0aeea4a
timeCreated: 1677833907

View File

@@ -1,144 +0,0 @@
using System.IO;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace NBC.Asset
{
internal class SceneLoaderFromBundle : ISceneLoader
{
public static ISceneLoader CreateInstance()
{
return new SceneLoaderFromBundle();
}
private enum Steps
{
LoadDependency,
LoadScene,
}
private Dependency _dependency;
private AssetInfo _assetInfo;
private Steps _steps = Steps.LoadDependency;
private SceneProvider _provider;
private bool _isWaitForAsyncComplete;
private AsyncOperation _asyncOperation;
public void Start(SceneProvider provider)
{
_provider = provider;
var newAsset = true;
if (_assetInfo == null)
{
_assetInfo = provider.AssetInfo;
}
else
{
if (_assetInfo.GUID == provider.AssetInfo.GUID)
{
newAsset = false;
}
else
{
_assetInfo = provider.AssetInfo;
}
}
if (newAsset || _dependency == null)
{
_dependency = Dependency.GetAssetDependency(_assetInfo);
_dependency.Retain();
}
_steps = Steps.LoadDependency;
}
public void Update()
{
if (_steps == Steps.LoadDependency)
{
if (_isWaitForAsyncComplete)
{
_dependency.WaitForAsyncComplete();
}
else if (!_dependency.IsDone) return;
if (!_dependency.IsSucceed)
{
Debug.LogError("error");
SetStatus("dependency fail");
}
var provider = _dependency.GetMainBundledProvider();
if (provider != null && provider.AssetBundle != null)
{
var scenePath = Path.GetFileNameWithoutExtension(_assetInfo.Path);
if (_isWaitForAsyncComplete)
{
SceneManager.LoadScene(scenePath, _provider.SceneMode);
SetStatus();
}
else
{
_asyncOperation = SceneManager.LoadSceneAsync(scenePath, _provider.SceneMode);
_asyncOperation.allowSceneActivation = true;
_steps = Steps.LoadScene;
}
}
else
{
//失败,后续补全失败逻辑
Debug.LogError("error1");
SetStatus("error");
}
}
else if (_steps == Steps.LoadScene)
{
if (!_asyncOperation.isDone) return;
SetStatus();
}
}
public void WaitForAsyncComplete()
{
_isWaitForAsyncComplete = true;
int frame = 1000;
while (true)
{
frame--;
if (frame == 0)
{
break;
}
Update();
if (_provider.IsDone)
break;
}
}
public void Destroy()
{
_dependency.Release();
_asyncOperation = null;
}
private void SetStatus()
{
var sceneObj = SceneManager.GetSceneAt(SceneManager.sceneCount - 1);
_provider.SceneObject = sceneObj;
_provider.SetStatus(NTaskStatus.Success);
}
private void SetStatus(string error)
{
_provider.SetStatus(NTaskStatus.Fail, error);
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: febc5527b0844fbc8d46f8315bafee24
timeCreated: 1678027484

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 30c848f308bc4088a66095eb6f34e549
timeCreated: 1677052587

View File

@@ -1,117 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace NBC.Asset
{
public class AssetProvider : ProviderBase
{
public static Func<IAssetLoader> CreateLoader { get; set; } = AssetLoaderFromBundle.CreateInstance;
private IAssetLoader _loader;
public AssetInfo AssetInfo { get; internal set; }
public bool IsAll { get; set; }
public UnityEngine.Object Asset { get; set; }
public UnityEngine.Object[] AllAsset { get; set; }
protected override void OnStart()
{
if (_loader == null) _loader = CreateLoader();
_loader.Start(this);
}
protected override NTaskStatus OnProcess()
{
#if DEBUG
DebugRecord();
#endif
if (IsDone) return NTaskStatus.Success;
if (IsWaitForAsyncComplete)
{
_loader.WaitForAsyncComplete();
}
else
{
_loader.Update();
}
return base.OnProcess();
}
public override void Destroy()
{
Debug.Log($"卸载资源==={AssetInfo.Path}");
base.Destroy();
_assets.Remove(this);
_loader.Destroy();
_loader = null;
}
#region Static
private static readonly List<AssetProvider> _assets = new List<AssetProvider>();
internal static List<AssetProvider> GetAssetProviders()
{
return _assets;
}
internal static void ReleaseAllAssets(bool force = true)
{
foreach (var asset in _assets)
{
asset.Release(force);
}
}
internal static void ReleaseAllAssetsByTag(string[] tags, bool force = true)
{
foreach (var asset in _assets)
{
if (asset.AssetInfo.HasTag(tags))
{
asset.Release(force);
}
}
}
internal static AssetProvider GetAssetProvider(AssetInfo assetInfo, bool isAll = false)
{
if (assetInfo == null) return null;
AssetProvider provider = null;
foreach (var asset in _assets)
{
if (asset.AssetInfo == assetInfo)
{
provider = asset;
break;
}
}
if (provider == null)
{
provider = new AssetProvider
{
AssetInfo = assetInfo,
IsAll = isAll
};
#if DEBUG
provider.InitDebugInfo();
#endif
_assets.Add(provider);
}
provider.Run();
return provider;
}
#endregion
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 7e767bd7f49546e5af835e60bc4ca363
timeCreated: 1677057856

View File

@@ -1,107 +0,0 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace NBC.Asset
{
internal class BundledProvider : ProviderBase
{
public static Func<IBundleLoader> CreateLoader { get; set; } = null;
private IBundleLoader _loader;
public BundleInfo BundleInfo;
public AssetBundle AssetBundle { get; set; }
protected override void OnStart()
{
_loader.Start(this);
}
protected override NTaskStatus OnProcess()
{
#if DEBUG
DebugRecord();
#endif
if (IsDone) return NTaskStatus.Success;
if (IsWaitForAsyncComplete)
{
_loader.WaitForAsyncComplete();
}
else
{
_loader.Update();
}
return base.OnProcess();
}
public override void Destroy()
{
Debug.Log($"卸载Bundle==={BundleInfo.Bundle.Name}");
base.Destroy();
_bundled.Remove(this);
_loader.Destroy();
if (AssetBundle != null)
{
AssetBundle.Unload(true);
AssetBundle = null;
}
_loader = null;
}
#region Static
private static readonly List<BundledProvider> _bundled = new List<BundledProvider>();
internal static List<BundledProvider> GetBundleProviders()
{
return _bundled;
}
internal static BundledProvider GetBundleProvider(BundleInfo bundleInfo)
{
BundledProvider provider = null;
foreach (var bundled in _bundled)
{
if (bundled.BundleInfo == bundleInfo)
{
provider = bundled;
break;
}
}
if (provider == null)
{
provider = new BundledProvider
{
BundleInfo = bundleInfo
};
provider._loader = GetBundleLoader(provider);
#if DEBUG
provider.InitDebugInfo();
#endif
_bundled.Add(provider);
}
provider.Run();
return provider;
}
internal static IBundleLoader GetBundleLoader(BundledProvider provider)
{
var loader = CreateLoader?.Invoke();
if (loader != null) return loader;
var bundleInfo = provider.BundleInfo;
if (bundleInfo.LoadMode == BundleLoadMode.LoadFromRemote)
{
return new BundleLoaderFromDownload();
}
return new BundleLoaderFromLocal();
}
#endregion
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 5796a93598ef48cfbe829a4fd48b1cc2
timeCreated: 1677057801

View File

@@ -1,99 +0,0 @@
using System.Collections.Generic;
namespace NBC.Asset
{
internal class Dependency
{
/// <summary>
/// 依赖的资源包加载器列表
/// </summary>
internal readonly List<BundledProvider> DependBundles;
public Dependency(List<BundledProvider> dependBundles)
{
DependBundles = dependBundles;
}
/// <summary>
/// 是否已经完成(无论成功或失败)
/// </summary>
public bool IsDone
{
get
{
foreach (var bundle in DependBundles)
{
if (!bundle.IsDone)
return false;
}
return true;
}
}
public bool IsSucceed
{
get
{
foreach (var loader in DependBundles)
{
if (loader.Status != NTaskStatus.Success)
{
return false;
}
}
return true;
}
}
public void WaitForAsyncComplete()
{
foreach (var bundle in DependBundles)
{
if (!bundle.IsDone)
bundle.WaitForAsyncComplete();
}
}
public void Retain()
{
foreach (var request in DependBundles)
{
// request.Retain();
}
}
public void Release()
{
foreach (var request in DependBundles)
{
request.Release();
}
}
public BundledProvider GetMainBundledProvider()
{
return DependBundles.Count > 0 ? DependBundles[0] : null;
}
#region Static
internal static Dependency GetAssetDependency(AssetInfo assetInfo)
{
var bundleInfos = Addressable.GetAllDependBundleInfos(assetInfo);
List<BundledProvider> list = new List<BundledProvider>();
foreach (var info in bundleInfos)
{
list.Add(BundledProvider.GetBundleProvider(info));
}
var dep = new Dependency(list);
return dep;
}
#endregion
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 1f18e197df9a4a1dbca3cb4913cb4f4d
timeCreated: 1677551909

View File

@@ -1,110 +0,0 @@
using System;
using System.Diagnostics;
using System.Globalization;
namespace NBC.Asset
{
public abstract class ProviderBase : NTask, IRecyclable
{
/// <summary>
/// 是否已经销毁
/// </summary>
public bool IsDestroyed { get; set; }
/// <summary>
/// 是否可以销毁
/// </summary>
public bool CanDestroy => IsDone && RefCount <= 0;
protected bool IsWaitForAsyncComplete { private set; get; } = false;
public void SetStatus(NTaskStatus status, string info = "")
{
Status = status;
_errorMsg = info;
}
internal virtual void Run()
{
Retain();
if (!IsDone && !IsRunning)
{
Run(TaskRunner.ProviderRunner);
}
}
#region RefCounter
/// <summary>
/// 引用计数
/// </summary>
public int RefCount { get; private set; }
public void Retain()
{
RefCount++;
}
public void Release(bool force = false)
{
RefCount--;
if (force) RefCount = 0;
if (RefCount > 0) return;
//释放资源
Recycler.Add(this);
}
#endregion
/// <summary>
/// 销毁资源对象
/// </summary>
public virtual void Destroy()
{
IsDestroyed = true;
}
/// <summary>
/// 等待异步执行完毕
/// </summary>
public void WaitForAsyncComplete()
{
IsWaitForAsyncComplete = true;
Process();
}
#region Debug
#if DEBUG
public string LoadScene = string.Empty;
public string LoadTime = string.Empty;
public long LoadTotalTime { protected set; get; }
// 加载耗时统计
private bool _isRecording;
private Stopwatch _watch;
internal void InitDebugInfo()
{
LoadScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
LoadTime = DateTime.Now.ToString("hh:mm:ss");
}
protected void DebugRecord()
{
if (_isRecording == false)
{
_isRecording = true;
_watch = Stopwatch.StartNew();
}
if (_watch == null) return;
if (!IsDone) return;
LoadTotalTime = _watch.ElapsedMilliseconds;
_watch = null;
}
#endif
#endregion
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 0582024b8cee499496844a7c5c204286
timeCreated: 1677051990

View File

@@ -1,122 +0,0 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace NBC.Asset
{
public class SceneProvider : ProviderBase
{
public static Func<ISceneLoader> CreateLoader { get; set; } = SceneLoaderFromBundle.CreateInstance;
private ISceneLoader _loader;
public AssetInfo AssetInfo { get; internal set; }
public UnityEngine.SceneManagement.Scene SceneObject { get; set; }
public LoadSceneMode SceneMode;
private AsyncOperation _asyncOp;
private int _priority;
protected override void OnStart()
{
_loader.Start(this);
}
protected override NTaskStatus OnProcess()
{
#if DEBUG
DebugRecord();
#endif
if (IsDone) return NTaskStatus.Success;
if (IsWaitForAsyncComplete)
{
_loader.WaitForAsyncComplete();
}
else
{
_loader.Update();
}
return base.OnProcess();
}
public override void Destroy()
{
base.Destroy();
_scenes.Remove(this);
_loader.Destroy();
_loader = null;
}
internal override void Run()
{
Retain();
if (!IsRunning)
{
Run(TaskRunner.ProviderRunner);
}
}
#region Static
private static readonly List<SceneProvider> _scenes = new List<SceneProvider>();
internal static List<SceneProvider> GetSceneProviders()
{
return _scenes;
}
internal static void ReleaseAllAssets(bool force = true)
{
foreach (var asset in _scenes)
{
asset.Release(force);
}
}
internal static void ReleaseAllAssetsByTag(string[] tags, bool force = true)
{
foreach (var asset in _scenes)
{
if (asset.AssetInfo.HasTag(tags))
{
asset.Release(force);
}
}
}
internal static SceneProvider GetSceneProvider(AssetInfo assetInfo, bool additive = false)
{
SceneProvider provider = null;
foreach (var scene in _scenes)
{
if (scene.AssetInfo == assetInfo)
{
provider = scene;
break;
}
}
if (provider == null)
{
provider = new SceneProvider
{
AssetInfo = assetInfo,
_loader = CreateLoader(),
SceneMode = additive ? LoadSceneMode.Additive : LoadSceneMode.Single
};
#if DEBUG
provider.InitDebugInfo();
#endif
_scenes.Add(provider);
}
provider.Run();
return provider;
}
#endregion
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 64b0e1cc71b24c5c86d2229c56991e95
timeCreated: 1677831975

View File

@@ -1,413 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using Object = UnityEngine.Object;
namespace NBC.Asset
{
public static class Assets
{
private static GameObject _monoGameObject;
private static bool _isInitialize;
private static NTaskStatus _initializeTaskStatus = NTaskStatus.None;
private static string _initializeError = string.Empty;
public static FTask Initialize()
{
if (_isInitialize)
throw new Exception($"Repeated initialization!");
return InitConfirm();
}
#region
/// <summary>
/// 清理所有缓存
/// </summary>
public static void ClearAllCache()
{
if (Directory.Exists(Const.SavePath))
{
Directory.Delete(Const.SavePath, true);
}
}
#endregion
#region
public static T Load<T>(string path) where T : Object
{
var assetProvider = LoadAsset(path, typeof(T));
if (assetProvider != null)
{
return assetProvider.Asset as T;
}
return null;
}
public static AssetProvider LoadAsset<T>(string path)
{
return LoadAsset(path, typeof(T));
}
public static AssetProvider LoadAsset(string path, Type type)
{
var req = LoadAssetAsync(path, type);
req?.WaitForAsyncComplete();
return req;
}
public static AssetProvider LoadAssetAsync<T>(string path)
{
return LoadAssetAsync(path, typeof(T));
}
public static AssetProvider LoadAssetAsync(string path, Type type)
{
var assetInfo = Addressable.GetAssetInfo(path, type);
return AssetProvider.GetAssetProvider(assetInfo);
}
public static AssetProvider LoadAssetAll<T>(string path)
{
return LoadAssetAll(path, typeof(T));
}
public static AssetProvider LoadAssetAll(string path, Type type)
{
var req = LoadAssetAllAsync(path, type);
req?.WaitForAsyncComplete();
return req;
}
public static AssetProvider LoadAssetAllAsync<T>(string path)
{
return LoadAssetAllAsync(path, typeof(T));
}
public static AssetProvider LoadAssetAllAsync(string path, Type type)
{
var assetInfo = Addressable.GetAssetInfo(path, type);
return AssetProvider.GetAssetProvider(assetInfo, true);
}
#endregion
#region
public static SceneProvider LoadScene(string path, bool additive = false)
{
var assetInfo = Addressable.GetAssetInfo(path, typeof(Scene));
if (assetInfo == null)
{
throw new Exception($"Scene is null,path={path}");
}
return SceneProvider.GetSceneProvider(assetInfo, additive);
}
#endregion
#region
/// <summary>
/// 释放所有资源
/// </summary>
/// <param name="force">强制释放</param>
public static void ReleaseAllAssets(bool force = true)
{
AssetProvider.ReleaseAllAssets(force);
SceneProvider.ReleaseAllAssets(force);
}
/// <summary>
/// 根据标签,释放所有资源
/// </summary>
/// <param name="tags">标签</param>
/// <param name="force">强制释放</param>
public static void ReleaseAllAssetsByTag(string[] tags, bool force = true)
{
AssetProvider.ReleaseAllAssetsByTag(tags, force);
SceneProvider.ReleaseAllAssetsByTag(tags, force);
}
#endregion
#region
/// <summary>
/// 可以解压的bundle包数量
/// </summary>
/// <returns></returns>
public static int CanUnpackBundleCount()
{
var arr = Addressable.GetCanUnpackBundles();
return arr != null ? arr.Length : 0;
}
/// <summary>
/// 解压资源包任务(解压本地存在的所有资源)
/// </summary>
/// <param name="run">自动运行</param>
/// <returns></returns>
public static UnpackPackagesTask CreateUnpackPackagesTask(bool run = true)
{
var task = new UnpackPackagesTask();
if (run) task.Run(TaskRunner.Def);
return task;
}
#endregion
#region
/// <summary>
/// 获取当前版本可以下载到本地的bundle包
/// </summary>
/// <returns></returns>
public static List<BundleInfo> GetCanDownloadBundles()
{
List<BundleInfo> ret = new List<BundleInfo>();
var bundles = Addressable.GetCanDownloadBundles();
foreach (var bundleInfo in bundles)
{
var bundleData = bundleInfo.Bundle;
//可优化。缓存所有packageName但该逻辑理论全局只会调用一次是否需要缓存值得考虑
if (bundleData != null && IsNeedfulPackage(bundleData.PackageName))
{
ret.Add(bundleInfo);
}
}
return ret;
}
/// <summary>
/// 主动下载需要的bundles包任务
/// </summary>
/// <param name="downloadBundles">需要下载的bundle</param>
/// <param name="run">自动运行</param>
/// <returns></returns>
public static DownloadBundlesTask CreateDownloadBundlesTask(List<BundleInfo> downloadBundles, bool run = true)
{
var task = new DownloadBundlesTask(downloadBundles);
if (run) task.Run();
return task;
}
/// <summary>
/// 创建检查更新任务
/// </summary>
/// <returns></returns>
public static CheckUpdateTask CreateCheckUpdateTask(bool run = true)
{
var task = new CheckUpdateTask();
if (run) task.Run(TaskRunner.Def);
return task;
}
/// <summary>
/// 创建版本更新任务
/// </summary>
public static UpdateVersionTask CreateUpdateVersionTask(UpdateContext context, bool run = true)
{
var task = new UpdateVersionTask(context);
if (run) task.Run();
return task;
}
#endregion
#region
private static readonly HashSet<string> _defaultPackage = new HashSet<string>();
/// <summary>
/// 添加一个包进入需要列表
/// </summary>
/// <param name="packageName"></param>
public static void AddNeedfulPackage(string packageName)
{
_defaultPackage.Add(packageName);
}
/// <summary>
/// 移除一个需要的资源包
/// </summary>
/// <param name="packageName"></param>
public static void RemoveNeedfulPackage(string packageName)
{
if (_defaultPackage.Contains(packageName)) _defaultPackage.Remove(packageName);
}
/// <summary>
/// 移除全部额外需要包
/// </summary>
public static void RemoveAllNeedful()
{
_defaultPackage.Clear();
}
/// <summary>
/// 是否需要这个资源包
/// </summary>
/// <param name="packageName"></param>
/// <returns></returns>
public static bool IsNeedfulPackage(string packageName)
{
var ret = _defaultPackage.Contains(packageName);
if (!ret)
{
var package = Addressable.GetPackageData(packageName);
if (package != null)
{
return package.Def == 1;
}
}
return ret;
}
#endregion
#region
#if DEBUG
private static DebugRemoteServer _debugRemoteServer;
public static void StartDebugRemoteServer()
{
_debugRemoteServer = _monoGameObject.AddComponent<DebugRemoteServer>();
}
public static void StopDebugRemoteServer()
{
if (_debugRemoteServer != null)
{
Object.DestroyImmediate(_debugRemoteServer);
}
}
public static DebugInfo GetDebugInfos()
{
DebugInfo info = new DebugInfo();
info.Frame = Time.frameCount;
var assetProviders = AssetProvider.GetAssetProviders();
foreach (var asset in assetProviders)
{
var i = CreateDebugAssetInfo(asset.AssetInfo, asset.IsAll);
SetDebugBaseInfo(asset, i);
info.AssetInfos.Add(i);
}
var sceneProviders = SceneProvider.GetSceneProviders();
foreach (var scene in sceneProviders)
{
var i = CreateDebugAssetInfo(scene.AssetInfo, false);
SetDebugBaseInfo(scene, i);
info.AssetInfos.Add(i);
}
var bundleProviders = BundledProvider.GetBundleProviders();
foreach (var bundle in bundleProviders)
{
var bundleInfo = new DebugBundleInfo
{
BundleName = bundle.BundleInfo.Bundle.Name
};
SetDebugBaseInfo(bundle, bundleInfo);
info.BundleInfos.Add(bundleInfo);
}
return info;
}
private static DebugAssetInfo CreateDebugAssetInfo(AssetInfo asset, bool isAll)
{
var assetInfo = new DebugAssetInfo
{
Path = asset.Path,
Type = asset.AssetType.Name,
IsAll = isAll,
};
var bundleInfos = Addressable.GetAllDependBundleInfos(asset);
foreach (var bundle in bundleInfos)
{
assetInfo.Dependency.Add(bundle.Bundle.Name);
}
return assetInfo;
}
private static void SetDebugBaseInfo(ProviderBase provider, DebugBaseInfo info)
{
info.LoadScene = provider.LoadScene;
info.Ref = provider.RefCount;
info.Status = provider.Status.ToString();
info.LoadTime = provider.LoadTime;
info.LoadTotalTime = provider.LoadTotalTime;
}
#endif
#endregion
#region Private
private static void Update()
{
TaskRunner.Update();
Recycler.Update();
}
private static async FTask InitConfirm()
{
_monoGameObject = new GameObject("Assets", typeof(Mono));
Mono.AddUpdate(Update);
InitializationTask task;
if (Const.Simulate)
{
task = new EditorInitializationTask();
AssetProvider.CreateLoader = AssetLoadFromDatabase.CreateInstance;
SceneProvider.CreateLoader = SceneLoadFromDatabase.CreateInstance;
}
else if (Const.Offline)
{
task = new OfflineInitializationTask();
}
else
{
task = new OnlineInitializationTask();
}
if (Const.IsWebGLPlatform)
{
Const.RemoteUrl = $"{Application.streamingAssetsPath}/";
}
task.OnCompleted(InitDone);
task.Run(TaskRunner.Def);
_isInitialize = true;
await task.Task;
}
/// <summary>
/// 初始化完成回调
/// </summary>
/// <param name="taskBase"></param>
private static void InitDone(ITask taskBase)
{
Debug.Log("初始化完成===");
_initializeTaskStatus = taskBase.Status;
_initializeError = taskBase.ErrorMsg;
}
#endregion
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: a339636ce1b94bcbb5163bf34c3e11b6
timeCreated: 1675930154

View File

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

View File

@@ -1,51 +0,0 @@
using System.IO;
using UnityEngine;
namespace NBC.Asset
{
public static class Const
{
public const string BundleDirName = "Bundles";
public const string VersionFileName = "version.json";
public static bool IsWebGLPlatform => Application.platform == RuntimePlatform.WebGLPlayer;
public static readonly string SavePath =
$"{Application.persistentDataPath}{Path.DirectorySeparatorChar}{BundleDirName}{Path.DirectorySeparatorChar}";
public static readonly string StreamingAssetsPath =
$"{Application.streamingAssetsPath}{Path.DirectorySeparatorChar}";
public static string RemoteUrl = "http://127.0.0.1:8181/";
public static bool Offline;
public static bool Simulate;
public static int DownloadTimeOut = 10;
public static string GetStreamingPath(string file)
{
return $"{StreamingAssetsPath}{file}";
}
public static string GetCachePath(string file)
{
return $"{SavePath}{file}";
}
public static string GetCacheTempPath(string file)
{
return $"{SavePath}{file}.temp";
}
public static string GetRemotePath(string file)
{
if (!Application.isEditor && IsWebGLPlatform)
{
return $"{RemoteUrl}/{file}";
}
return $"{RemoteUrl}{BundleDirName}/{file}";
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: de19e53b3f774094918543bbbc7318a0
timeCreated: 1624159347

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 7239be5c8a2a45ff91ff7118816b9c9b
timeCreated: 1677663981

View File

@@ -1,10 +0,0 @@
namespace NBC.Asset
{
public enum BundleLoadMode
{
None,
LoadFromStreaming,
LoadFromCache,
LoadFromRemote
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 43bdba8ab37f4164913472c931edd6e4
timeCreated: 1677663989

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: dff0030f0ed04cc6a834c994e98f2300
timeCreated: 1677125510

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 31105beb84d840a3a8aa41ec7fecf129
timeCreated: 1679673084

View File

@@ -1,41 +0,0 @@
using System;
using System.Collections.Generic;
namespace NBC.Asset
{
#if DEBUG
[Serializable]
public class DebugBaseInfo
{
public int Ref;
public string LoadScene;
public string LoadTime;
public long LoadTotalTime;
public string Status;
}
[Serializable]
public class DebugAssetInfo : DebugBaseInfo
{
public string Path;
public string Type;
public bool IsAll;
public List<string> Dependency = new List<string>();
}
[Serializable]
public class DebugBundleInfo : DebugBaseInfo
{
public string BundleName;
}
[Serializable]
public class DebugInfo
{
public int Frame;
public List<DebugAssetInfo> AssetInfos = new List<DebugAssetInfo>();
public List<DebugBundleInfo> BundleInfos = new List<DebugBundleInfo>();
}
#endif
}

Some files were not shown because too many files have changed in this diff Show More