@@ -51,6 +51,11 @@ private static void OpenAssetBundleWindow()
51
51
52
52
private string _buildPath = "" ;
53
53
private BuildTarget _buildTarget = BuildTarget . StandaloneWindows ;
54
+ private ZipMode _zipMode = ZipMode . LZMA ;
55
+ private EncryptMode _encryptMode = EncryptMode . AES ;
56
+ private int _assetVersion = 1 ;
57
+
58
+ private bool _showSetting = false ;
54
59
55
60
private GUIStyle _box = new GUIStyle ( "Box" ) ;
56
61
private GUIStyle _preButton = new GUIStyle ( "PreButton" ) ;
@@ -60,6 +65,7 @@ private static void OpenAssetBundleWindow()
60
65
private GUIStyle _miniButtonLeft = new GUIStyle ( "MiniButtonLeft" ) ;
61
66
private GUIStyle _miniButtonRight = new GUIStyle ( "MiniButtonRight" ) ;
62
67
private GUIStyle _oLMinus = new GUIStyle ( "OL Minus" ) ;
68
+ private GUIStyle _flownode0on = new GUIStyle ( "flow node 0 on" ) ;
63
69
#endregion
64
70
65
71
private void Init ( )
@@ -71,8 +77,11 @@ private void Init()
71
77
_assetBundle = new AssetBundleInfo ( ) ;
72
78
AssetBundleTool . ReadAssetBundleConfig ( _assetBundle , _validAssets ) ;
73
79
74
- _buildPath = EditorPrefs . GetString ( Application . productName + "_BuildPath" , "" ) ;
75
- _buildTarget = ( BuildTarget ) EditorPrefs . GetInt ( Application . productName + "_BuildTarget" , 5 ) ;
80
+ _buildPath = EditorPrefs . GetString ( Application . productName + "_BuildPath" , "" ) ;
81
+ _buildTarget = ( BuildTarget ) EditorPrefs . GetInt ( Application . productName + "_BuildTarget" , 5 ) ;
82
+ _zipMode = ( ZipMode ) EditorPrefs . GetInt ( Application . productName + "_ZipMode" , 0 ) ;
83
+ _encryptMode = ( EncryptMode ) EditorPrefs . GetInt ( Application . productName + "_EncryptMode" , 1 ) ;
84
+ _assetVersion = EditorPrefs . GetInt ( Application . productName + "_AssetVersion" , 1 ) ;
76
85
77
86
Resources . UnloadUnusedAssets ( ) ;
78
87
}
@@ -91,6 +100,7 @@ private void OnGUI()
91
100
AssetBundlesGUI ( ) ;
92
101
CurrentAssetBundlesGUI ( ) ;
93
102
AssetsGUI ( ) ;
103
+ SettingGUI ( ) ;
94
104
}
95
105
private void TitleGUI ( )
96
106
{
@@ -129,10 +139,7 @@ private void TitleGUI()
129
139
}
130
140
}
131
141
GUI . enabled = true ;
132
-
133
- _hideInvalidAsset = GUI . Toggle ( new Rect ( 360 , 5 , 100 , 15 ) , _hideInvalidAsset , "Hide Invalid" ) ;
134
- _hideBundleAsset = GUI . Toggle ( new Rect ( 460 , 5 , 100 , 15 ) , _hideBundleAsset , "Hide Bundled" ) ;
135
-
142
+
136
143
if ( GUI . Button ( new Rect ( 250 , 25 , 60 , 15 ) , "Open" , _preButton ) )
137
144
{
138
145
AssetBundleTool . OpenFolder ( _buildPath ) ;
@@ -143,19 +150,26 @@ private void TitleGUI()
143
150
if ( path . Length != 0 )
144
151
{
145
152
_buildPath = path ;
146
- EditorPrefs . SetString ( Application . productName + "_BuildPath" , _buildPath ) ;
153
+ EditorPrefs . SetString ( Application . productName + "_BuildPath" , _buildPath ) ;
147
154
}
148
155
}
149
156
150
157
GUI . Label ( new Rect ( 370 , 25 , 70 , 15 ) , "Build Path:" ) ;
151
158
_buildPath = GUI . TextField ( new Rect ( 440 , 25 , 300 , 15 ) , _buildPath ) ;
152
159
153
- BuildTarget buildTarget = ( BuildTarget ) EditorGUI . EnumPopup ( new Rect ( ( int ) position . width - 205 , 5 , 150 , 15 ) , _buildTarget , _preDropDown ) ;
154
- if ( buildTarget != _buildTarget )
160
+ if ( GUI . Button ( new Rect ( 250 , 45 , 100 , 15 ) , "Expand All" , _preButton ) )
155
161
{
156
- _buildTarget = buildTarget ;
157
- EditorPrefs . SetInt ( Application . productName + "_BuildTarget" , ( int ) _buildTarget ) ;
162
+ AssetBundleTool . ExpandFolder ( _asset , true ) ;
158
163
}
164
+ if ( GUI . Button ( new Rect ( 350 , 45 , 100 , 15 ) , "Shrink All" , _preButton ) )
165
+ {
166
+ AssetBundleTool . ExpandFolder ( _asset , false ) ;
167
+ }
168
+
169
+ _hideInvalidAsset = GUI . Toggle ( new Rect ( 460 , 45 , 100 , 15 ) , _hideInvalidAsset , "Hide Invalid" ) ;
170
+ _hideBundleAsset = GUI . Toggle ( new Rect ( 560 , 45 , 100 , 15 ) , _hideBundleAsset , "Hide Bundled" ) ;
171
+
172
+ _showSetting = GUI . Toggle ( new Rect ( ( int ) position . width - 135 , 5 , 80 , 15 ) , _showSetting , "Setting" , _preButton ) ;
159
173
160
174
if ( GUI . Button ( new Rect ( ( int ) position . width - 55 , 5 , 50 , 15 ) , "Build" , _preButton ) )
161
175
{
@@ -279,8 +293,8 @@ private void CurrentAssetBundlesGUI()
279
293
}
280
294
private void AssetsGUI ( )
281
295
{
282
- _assetViewRect = new Rect ( 250 , 45 , ( int ) position . width - 255 , ( int ) position . height - 50 ) ;
283
- _assetScrollRect = new Rect ( 250 , 45 , ( int ) position . width - 255 , _assetViewHeight ) ;
296
+ _assetViewRect = new Rect ( 250 , 65 , ( int ) position . width - 255 , ( int ) position . height - 70 ) ;
297
+ _assetScrollRect = new Rect ( 250 , 65 , ( int ) position . width - 255 , _assetViewHeight ) ;
284
298
_assetScroll = GUI . BeginScrollView ( _assetViewRect , _assetScroll , _assetScrollRect ) ;
285
299
GUI . BeginGroup ( _assetScrollRect , _box ) ;
286
300
@@ -351,7 +365,52 @@ private void AssetGUI(AssetInfo asset, int indentation)
351
365
AssetGUI ( asset . ChildAssetInfo [ i ] , indentation + 1 ) ;
352
366
}
353
367
}
354
- }
368
+ }
369
+ private void SettingGUI ( )
370
+ {
371
+ if ( _showSetting )
372
+ {
373
+ GUI . BeginGroup ( new Rect ( ( int ) position . width / 2 - 125 , ( int ) position . height / 2 - 65 , 250 , 130 ) , "" , _flownode0on ) ;
374
+
375
+ GUI . Label ( new Rect ( 5 , 5 , 80 , 20 ) , "Build Target: " ) ;
376
+ BuildTarget buildTarget = ( BuildTarget ) EditorGUI . EnumPopup ( new Rect ( 90 , 5 , 155 , 20 ) , _buildTarget , _preDropDown ) ;
377
+ if ( buildTarget != _buildTarget )
378
+ {
379
+ _buildTarget = buildTarget ;
380
+ EditorPrefs . SetInt ( Application . productName + "_BuildTarget" , ( int ) _buildTarget ) ;
381
+ }
382
+
383
+ GUI . Label ( new Rect ( 5 , 30 , 80 , 20 ) , "Zip Mode: " ) ;
384
+ ZipMode zipMode = ( ZipMode ) EditorGUI . EnumPopup ( new Rect ( 90 , 30 , 155 , 20 ) , _zipMode , _preDropDown ) ;
385
+ if ( zipMode != _zipMode )
386
+ {
387
+ _zipMode = zipMode ;
388
+ EditorPrefs . SetInt ( Application . productName + "_ZipMode" , ( int ) _zipMode ) ;
389
+ }
390
+
391
+ GUI . Label ( new Rect ( 5 , 55 , 80 , 20 ) , "Encrypt: " ) ;
392
+ EncryptMode encryptMode = ( EncryptMode ) EditorGUI . EnumPopup ( new Rect ( 90 , 55 , 155 , 20 ) , _encryptMode , _preDropDown ) ;
393
+ if ( encryptMode != _encryptMode )
394
+ {
395
+ _encryptMode = encryptMode ;
396
+ EditorPrefs . SetInt ( Application . productName + "_EncryptMode" , ( int ) _encryptMode ) ;
397
+ }
398
+
399
+ GUI . Label ( new Rect ( 5 , 80 , 150 , 20 ) , "Asset Version: " + _assetVersion ) ;
400
+ if ( GUI . Button ( new Rect ( 150 , 80 , 95 , 20 ) , "Reset" , _preButton ) )
401
+ {
402
+ _assetVersion = 1 ;
403
+ EditorPrefs . SetInt ( Application . productName + "_AssetVersion" , _assetVersion ) ;
404
+ }
405
+
406
+ if ( GUI . Button ( new Rect ( 100 , 105 , 50 , 20 ) , "Sure" , _preButton ) )
407
+ {
408
+ _showSetting = false ;
409
+ }
410
+
411
+ GUI . EndGroup ( ) ;
412
+ }
413
+ }
355
414
}
356
415
357
416
/// <summary>
@@ -372,4 +431,38 @@ public enum FileType
372
431
/// </summary>
373
432
InValidFile
374
433
}
434
+
435
+ /// <summary>
436
+ /// 压缩模式
437
+ /// </summary>
438
+ public enum ZipMode
439
+ {
440
+ /// <summary>
441
+ /// 不压缩
442
+ /// </summary>
443
+ Uncompressed = 1 ,
444
+ /// <summary>
445
+ /// LZMA压缩
446
+ /// </summary>
447
+ LZMA = 0 ,
448
+ /// <summary>
449
+ /// LZ4压缩
450
+ /// </summary>
451
+ LZ4 = 256
452
+ }
453
+
454
+ /// <summary>
455
+ /// 加密模式
456
+ /// </summary>
457
+ public enum EncryptMode
458
+ {
459
+ /// <summary>
460
+ /// 不加密
461
+ /// </summary>
462
+ None ,
463
+ /// <summary>
464
+ /// AES加密
465
+ /// </summary>
466
+ AES
467
+ }
375
468
}
0 commit comments