File tree Expand file tree Collapse file tree 6 files changed +23
-33
lines changed Expand file tree Collapse file tree 6 files changed +23
-33
lines changed Original file line number Diff line number Diff line change 4
4
5
5
### Add the lines below to ` Packages/manifest.json `
6
6
7
- for version ` 1.0.8 `
7
+ for version ` 1.0.9 `
8
8
``` csharp
9
- " com.virtuesky.sunflower" : " https://github.com/VirtueSky/sunflower.git#1.0.8 " ,
9
+ " com.virtuesky.sunflower" : " https://github.com/VirtueSky/sunflower.git#1.0.9 " ,
10
10
```
11
11
12
12
- If you are missing some of the libraries used in the package, you can download them [ here] ( https://drive.google.com/drive/folders/1OdT5EfMDfkQsEleMM6C2-HHav9o0neTS )
Original file line number Diff line number Diff line change @@ -142,20 +142,8 @@ protected virtual void Reset()
142
142
[ ContextMenu ( "GetTickerAndPools" ) ]
143
143
void GetTickerAndPools ( )
144
144
{
145
- ticker = AssetUtils . FindAssetAtFolder < Ticker > ( new string [ ] { "Assets" } ) . FirstOrDefault ( ) ;
146
- if ( ticker == null )
147
- {
148
- ScriptableSetting . CreateSettingAssets < Ticker > ( ) ;
149
- ticker = AssetUtils . FindAssetAtFolder < Ticker > ( new string [ ] { "Assets" } ) . FirstOrDefault ( ) ;
150
- }
151
-
152
- pools = AssetUtils . FindAssetAtFolder < Pools > ( new string [ ] { "Assets" } ) . FirstOrDefault ( ) ;
153
- if ( pools == null )
154
- {
155
- ScriptableSetting . CreateSettingAssets < Pools > ( ) ;
156
- pools = AssetUtils . FindAssetAtFolder < Pools > ( new string [ ] { "Assets" } ) . FirstOrDefault ( ) ;
157
- }
158
-
145
+ ticker = ScriptableSetting . CreateAndGetScriptableAsset < Ticker > ( ) ;
146
+ pools = ScriptableSetting . CreateAndGetScriptableAsset < Pools > ( ) ;
159
147
EditorUtility . SetDirty ( this ) ;
160
148
}
161
149
#endif
Original file line number Diff line number Diff line change @@ -142,20 +142,8 @@ protected virtual void Reset()
142
142
[ ContextMenu ( "GetTickerAndPools" ) ]
143
143
void GetTickerAndPools ( )
144
144
{
145
- ticker = AssetUtils . FindAssetAtFolder < Ticker > ( new string [ ] { "Assets" } ) . FirstOrDefault ( ) ;
146
- if ( ticker == null )
147
- {
148
- ScriptableSetting . CreateSettingAssets < Ticker > ( ) ;
149
- ticker = AssetUtils . FindAssetAtFolder < Ticker > ( new string [ ] { "Assets" } ) . FirstOrDefault ( ) ;
150
- }
151
-
152
- pools = AssetUtils . FindAssetAtFolder < Pools > ( new string [ ] { "Assets" } ) . FirstOrDefault ( ) ;
153
- if ( pools == null )
154
- {
155
- ScriptableSetting . CreateSettingAssets < Pools > ( ) ;
156
- pools = AssetUtils . FindAssetAtFolder < Pools > ( new string [ ] { "Assets" } ) . FirstOrDefault ( ) ;
157
- }
158
-
145
+ ticker = ScriptableSetting . CreateAndGetScriptableAsset < Ticker > ( ) ;
146
+ pools = ScriptableSetting . CreateAndGetScriptableAsset < Pools > ( ) ;
159
147
EditorUtility . SetDirty ( this ) ;
160
148
}
161
149
#endif
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ namespace VirtueSky.EditorControl
7
7
#if UNITY_EDITOR
8
8
public class WindowControl : EditorWindow
9
9
{
10
- [ MenuItem ( "DataControl /Clear Data %F1" ) ]
10
+ [ MenuItem ( "GameControl /Clear Data %F1" ) ]
11
11
public static void ClearAllData ( )
12
12
{
13
13
GameData . DelDataInStorage ( ) ;
@@ -16,7 +16,7 @@ public static void ClearAllData()
16
16
Debug . Log ( $ "<color=Green>Clear data succeed</color>") ;
17
17
}
18
18
19
- [ MenuItem ( "DataControl /Save Data %F2" ) ]
19
+ [ MenuItem ( "GameControl /Save Data %F2" ) ]
20
20
public static void SaveData ( )
21
21
{
22
22
GameData . Save ( ) ;
Original file line number Diff line number Diff line change 1
1
using System . IO ;
2
+ using System . Linq ;
2
3
using UnityEngine ;
4
+ using VirtueSky . Utils ;
3
5
4
6
namespace VirtueSky . EditorUtils
5
7
{
@@ -28,5 +30,17 @@ public static string DefaultResourcesPath()
28
30
29
31
return defaultResourcePath ;
30
32
}
33
+
34
+ public static T CreateAndGetScriptableAsset < T > ( ) where T : ScriptableObject
35
+ {
36
+ var so = AssetUtils . FindAssetAtFolder < T > ( new string [ ] { "Assets" } ) . FirstOrDefault ( ) ;
37
+ if ( so == null )
38
+ {
39
+ ScriptableSetting . CreateSettingAssets < T > ( ) ;
40
+ so = AssetUtils . FindAssetAtFolder < T > ( new string [ ] { "Assets" } ) . FirstOrDefault ( ) ;
41
+ }
42
+
43
+ return so ;
44
+ }
31
45
}
32
46
}
Original file line number Diff line number Diff line change 2
2
"name" : " com.virtuesky.sunflower" ,
3
3
"displayName" : " Sunflower" ,
4
4
"description" : " Core ScriptableObject Architecture for building Unity games" ,
5
- "version" : " 1.0.8 " ,
5
+ "version" : " 1.0.9 " ,
6
6
"unity" : " 2021.3" ,
7
7
"category" : " virtuesky" ,
8
8
"keywords" : [
You can’t perform that action at this time.
0 commit comments