コード例 #1
0
 void OnGUI()
 {
     EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true));
     {
         Rect createRect = GUILayoutUtility.GetRect(new GUIContent("Version Manager"), EditorStyles.toolbarButton, GUILayout.ExpandWidth(true));
         if (GUI.Button(createRect, "Version Manager", EditorStyles.toolbarDropDown))
         {
             viewState = ViewState.Package;
         }
         Rect listRect = GUILayoutUtility.GetRect(new GUIContent("AssetBundle List"), EditorStyles.toolbarButton, GUILayout.ExpandWidth(true));
         if (GUI.Button(listRect, "AssetBundle List", EditorStyles.toolbarDropDown))
         {
             viewState = ViewState.List;
         }
     }
     EditorGUILayout.EndHorizontal();
     if (viewState == ViewState.List)
     {
         EditorGUILayout.BeginVertical();
         {
             foreach (var bundle in bm.bundles)
             {
                 var  selected = bundle == lastSelection ? true : false;
                 Rect itemRect =
                     EditorGUILayout.BeginHorizontal(selected
                         ? GameUpdaterStyle.GetStyle("SelectItem")
                         : GameUpdaterStyle.GetStyle("UnselectItem"));
                 EditorGUILayout.LabelField(bundle.name);
                 EditorGUILayout.EndHorizontal();
                 ProcessSelection(itemRect, bundle);
             }
         }
         EditorGUILayout.EndVertical();
     }
     else if (viewState == ViewState.Package)
     {
         EditorGUILayout.BeginVertical();
         {
             Config.versionFileName    = EditorGUILayout.TextField("Version File Name", Config.versionFileName);
             Config.password           = EditorGUILayout.TextField("Bundle Encrypt Key", Config.password);
             Config.bundleRelativePath = EditorGUILayout.TextField("Bundle Output Folder", Config.bundleRelativePath);
             copyToStreamingAssets     = EditorGUILayout.Toggle("Package In App", copyToStreamingAssets);
             Config.platform           = (TargetPlatform)EditorGUILayout.EnumPopup("Target Platform", Config.platform, GUILayout.MaxWidth(300));
         }
         EditorGUILayout.EndVertical();
         EditorGUILayout.BeginHorizontal();
         bool isHorizontalBlockActive = true;
         GUILayout.FlexibleSpace();
         if (GUILayout.Button("Create New Version", GUILayout.MaxWidth(150)))
         {
             bm.BuildAll();
             bm.CopyAll(copyToStreamingAssets);
             vm.CreateVersionFile(bm.bundles, copyToStreamingAssets);
             isHorizontalBlockActive = false;
         }
         GUILayout.FlexibleSpace();
         if (isHorizontalBlockActive)
         {
             EditorGUILayout.EndHorizontal();
         }
     }
 }