public override void OnInspectorGUI()
        {
            BBGoGUI.BeginEnable(!Application.isPlaying);
            {
                m_target.deployDataUrl = EditorGUILayout.TextField(new GUIContent(Localization.GetString("final_patch_deploy_url")), m_target.deployDataUrl);
                m_target.channel       = EditorGUILayout.TextField(new GUIContent(Localization.GetString("final_patch_deploy_channel")), m_target.channel);
            }
            BBGoGUI.EndEnable();

            if (!Application.isPlaying)
            {
                EditorGUILayout.HelpBox(Localization.GetString("final_patch_playing_mode_tip"), MessageType.Info);
            }
            else
            {
                m_poolFoldout = EditorGUILayout.Foldout(m_poolFoldout, Localization.GetString("final_patch_game_object_pool_label"));
                if (m_poolFoldout)
                {
                    foreach (var pool in FinalPool.Pools.Values)
                    {
                        EditorGUILayout.BeginVertical(GUI.skin.box);
                        {
                            EditorGUILayout.LabelField(Localization.GetString("final_patch_pool_asset_name_label"), pool.AssetName);
                            EditorGUILayout.LabelField(Localization.GetString("final_patch_pool_ref_count_label"), pool.ReferenceCount.ToString());
                            EditorGUILayout.LabelField(Localization.GetString("final_patch_pool_free_count_label"), pool.FreeCount.ToString());
                            if (pool.AutoRelease)
                            {
                                BBGoGUI.BeginEnable(pool.ReferenceCount == 0);
                                {
                                    EditorGUILayout.LabelField(Localization.GetString("final_patch_pool_release_countdown_label"), pool.ReferenceCount > 0 ? pool.AutoReleaseDuration.ToString() : (pool.ExpiredTime - Time.time).ToString());
                                }
                                BBGoGUI.EndEnable();
                            }
                        }
                        EditorGUILayout.EndVertical();
                    }
                }

                m_cacheFoldout = EditorGUILayout.Foldout(m_cacheFoldout, Localization.GetString("final_patch_cache_label"));
                if (m_cacheFoldout)
                {
                    foreach (var cache in FinalLoader.AssetNameCaches.Values)
                    {
                        EditorGUILayout.BeginVertical(GUI.skin.box);
                        {
                            EditorGUILayout.LabelField(Localization.GetString("final_patch_cache_name_label"), cache.Name);
                            EditorGUILayout.LabelField(Localization.GetString("final_patch_cache_state_label"), cache.AssetState.ToString());
                            EditorGUILayout.LabelField(Localization.GetString("final_patch_cache_ref_count_label"), cache.ReferenceCount.ToString());
                        }
                        EditorGUILayout.EndVertical();
                    }
                }
            }
        }
Example #2
0
        public void OnGUI()
        {
            CalcHasEditChannel();
            DrawToolbar();
            m_searchText = BBGoGUI.SearchField(m_searchText);
            EditorGUILayout.Space();

            for (int i = 0; m_managerWindow.FinalPatchEditorData.builds != null && i < m_managerWindow.FinalPatchEditorData.builds.Count; i++)
            {
                DrawBuild(m_managerWindow.FinalPatchEditorData.builds[i]);
            }
        }
Example #3
0
 private void DrawToolbar()
 {
     EditorGUILayout.BeginHorizontal();
     BBGoGUI.BeginEnable(!m_hasEdit);
     if (GUILayout.Button(Localization.GetString("build_tab_new"), BBGoGUI.styleBreadcrumbLeft))
     {
         m_managerWindow.FinalPatchEditorData.builds.Add(new BuildVersion()
         {
             isEdit = true
         });
     }
     BBGoGUI.EndEnable();
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.Space();
 }
Example #4
0
        public void OnGUI()
        {
            CalcHasEditChannel();
            DrawToolbar();

            if (m_deployData != null)
            {
                m_searchText = BBGoGUI.SearchField(m_searchText);
                EditorGUILayout.Space();

                for (int i = 0; m_deployData.Channels != null && i < m_deployData.Channels.Count; i++)
                {
                    DrawChannel(m_deployData.Channels[i]);
                }
            }
        }
Example #5
0
        private void DrawToolbar()
        {
            bool newDeployData    = false;
            bool selectDeployData = false;
            bool newChannel       = false;

            EditorGUILayout.BeginHorizontal();
            if (m_deployData == null)
            {
                newDeployData    = GUILayout.Button(Localization.GetString("deploy_tab_new_data"), BBGoGUI.styleBreadcrumbLeft);
                selectDeployData = GUILayout.Button(Localization.GetString("deploy_tab_select_data"), BBGoGUI.styleBreadcrumbMid);
            }
            else
            {
                BBGoGUI.BeginEnable(!m_hasEdit);
                newChannel = GUILayout.Button(Localization.GetString("deploy_tab_new_channel"), BBGoGUI.styleBreadcrumbLeft);
                BBGoGUI.EndEnable();
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();

            if (newDeployData)
            {
                CreateDeployData(EditorUtility.SaveFolderPanel(Localization.GetString("deploy_tab_new_data"), string.Empty, string.Empty));
            }
            if (selectDeployData)
            {
                LoadDeployData(EditorUtility.OpenFilePanel(Localization.GetString("deploy_tab_select_data"), "Assets", string.Empty));
            }
            if (newChannel)
            {
                if (m_deployData.Channels == null)
                {
                    m_deployData.Channels = new List <ChannelData>();
                }
                m_deployData.Channels.Add(new ChannelData()
                {
                    IsEdit = true
                });
            }
        }
Example #6
0
        public void OnGUI()
        {
            LocalizationPopup();
            EditorGUI.BeginChangeCheck();
            {
                //build settings
                EditorGUILayout.LabelField(Localization.GetString("advanced_tab_build_label"));
                EditorGUI.indentLevel++;
                {
                    EditorGUILayout.BeginHorizontal();
                    {
                        EditorGUILayout.LabelField(m_contentAssetPath, new GUIContent(m_managerWindow.FinalPatchEditorData.assetPath));
                        if (GUILayout.Button(m_contentBrowse, BBGoGUI.styleCompactButton, m_contentOptions))
                        {
                            string path = EditorUtility.OpenFolderPanel("", "", "Assets");
                            if (!string.IsNullOrEmpty(path))
                            {
                                Uri pathUri = new Uri(path);
                                Uri rootUri = new Uri(Application.dataPath.Remove(Application.dataPath.LastIndexOf("Assets")));
                                path = rootUri.MakeRelativeUri(pathUri).ToString();
                                if (path.StartsWith("../"))
                                {
                                    Debug.LogErrorFormat(Localization.GetString("msg_select_asset_path_failure"), path);
                                }
                                else
                                {
                                    m_managerWindow.FinalPatchEditorData.assetPath = path;
                                }
                            }
                        }
                    }
                    EditorGUILayout.EndHorizontal();

                    m_managerWindow.FinalPatchEditorData.extractDuplicatedDependency = EditorGUILayout.Toggle(m_contentExtractDuplicated, m_managerWindow.FinalPatchEditorData.extractDuplicatedDependency);
                    m_managerWindow.FinalPatchData.bundleBytesOffset       = (ulong)EditorGUILayout.IntSlider(m_contentBundleOffset, (int)m_managerWindow.FinalPatchData.bundleBytesOffset, 0, 255);
                    m_managerWindow.FinalPatchEditorData.buildCallbackType = BBGoGUI.SubTypeField(m_contentBuildCallback, m_managerWindow.FinalPatchEditorData.buildCallbackType, typeof(IBuildEditorCallback), true);
                    m_managerWindow.FinalPatchData.pathConverterType       = BBGoGUI.SubTypeField(m_contentPathConverter, m_managerWindow.FinalPatchData.pathConverterType, typeof(IPathConverter), false);
                }
                EditorGUI.indentLevel--;

                //patch settings
                EditorGUILayout.Space();
                EditorGUILayout.LabelField(Localization.GetString("advanced_tab_patch_label"));
                EditorGUI.indentLevel++;
                {
                    m_managerWindow.FinalPatchData.patchAutoPatch = EditorGUILayout.BeginToggleGroup(m_contentAutoPatch, m_managerWindow.FinalPatchData.patchAutoPatch);
                    {
                        EditorGUI.indentLevel++;
                        {
                            m_managerWindow.FinalPatchData.patchRetryCount    = EditorGUILayout.IntSlider(Localization.GetString("advanced_tab_patch_retry_count_label"), m_managerWindow.FinalPatchData.patchRetryCount, 0, 5);
                            m_managerWindow.FinalPatchData.patchRetryInterval = EditorGUILayout.IntSlider(Localization.GetString("advanced_tab_patch_retry_interval_label"), m_managerWindow.FinalPatchData.patchRetryInterval, 0, 10);
                        }
                        EditorGUI.indentLevel--;
                    }
                    EditorGUILayout.EndToggleGroup();
                }
                EditorGUI.indentLevel--;

                //pool settings
                EditorGUILayout.Space();
                EditorGUILayout.LabelField(Localization.GetString("advanced_tab_pool_label"));
                EditorGUI.indentLevel++;
                {
                    m_managerWindow.FinalPatchData.poolMaxCache          = EditorGUILayout.IntField(Localization.GetString("advanced_tab_max_cache_label"), m_managerWindow.FinalPatchData.poolMaxCache);
                    m_managerWindow.FinalPatchData.poolEnableAutoRelease = EditorGUILayout.BeginToggleGroup(m_contentAutoRelease, m_managerWindow.FinalPatchData.poolEnableAutoRelease);
                    {
                        EditorGUI.indentLevel++;
                        {
                            m_managerWindow.FinalPatchData.poolAutoReleaseDuration = EditorGUILayout.FloatField(Localization.GetString("advanced_tab_auto_release_delay_label"), m_managerWindow.FinalPatchData.poolAutoReleaseDuration);
                        }
                        EditorGUI.indentLevel--;
                    }
                    EditorGUILayout.EndToggleGroup();
                }
                EditorGUI.indentLevel--;

                //other settings
                EditorGUILayout.Space();
                EditorGUILayout.LabelField(Localization.GetString("advanced_tab_other_label"));
                EditorGUI.indentLevel++;
                {
                    m_managerWindow.FinalPatchData.applyEditorMode = EditorGUILayout.Toggle(m_contentApplyEditorMode, m_managerWindow.FinalPatchData.applyEditorMode);
                    EditorGUILayout.BeginHorizontal();
                    {
                        string persistentBundlePath = $"{Application.persistentDataPath}/{FinalPatchConst.ASSET_BUNDLE_SUBDIRECTORY_NAME}";
                        EditorGUILayout.LabelField(Localization.GetString("advanced_tab_persistent_path_label"), persistentBundlePath);
                        if (GUILayout.Button(m_contentReveal, BBGoGUI.styleCompactButton, m_contentOptions))
                        {
                            EditorUtility.RevealInFinder(persistentBundlePath);
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                }
                EditorGUI.indentLevel--;
            }
            if (EditorGUI.EndChangeCheck())
            {
                m_managerWindow.FinalPatchData.Save();
                m_managerWindow.FinalPatchEditorData.Save();
            }
        }
Example #7
0
        private void DrawChannel(ChannelData channelData)
        {
            if (channelData == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(m_searchText) &&
                channelData.Name?.Contains(m_searchText) == false)
            {
                return;
            }

            bool delete  = false;
            bool save    = false;
            bool edit    = false;
            bool discard = false;

            EditorGUILayout.BeginVertical(GUI.skin.box);
            {
                EditorGUILayout.BeginHorizontal();
                {
                    channelData.Foldout = EditorGUILayout.Foldout(channelData.Foldout, $"{channelData.Name}: {channelData.Build}[{channelData.Version}]") || channelData.IsEdit;
                }
                EditorGUILayout.EndHorizontal();
                if (channelData.Foldout)
                {
                    if (channelData.IsEdit)
                    {
                        bool canSave = true;

                        if (string.IsNullOrEmpty(channelData.Name) || m_deployData.Channels.Find((c) => c != channelData && c.Name == channelData.Name) != null)
                        {
                            canSave          = false;
                            channelData.Name = BBGoGUI.ErrorTextField(Localization.GetString("deploy_tab_channel_name"), channelData.Name)?.Trim();
                        }
                        else
                        {
                            channelData.Name = EditorGUILayout.TextField(Localization.GetString("deploy_tab_channel_name"), channelData.Name)?.Trim();
                        }

                        if (string.IsNullOrEmpty(channelData.URL))
                        {
                            canSave         = false;
                            channelData.URL = BBGoGUI.ErrorTextField(Localization.GetString("deploy_tab_channel_url"), channelData.URL)?.Trim();
                        }
                        else
                        {
                            channelData.URL = EditorGUILayout.TextField(Localization.GetString("deploy_tab_channel_url"), channelData.URL)?.Trim();
                        }

                        int buildIndex = m_managerWindow.FinalPatchEditorData.builds.FindIndex((buildData) => { return(buildData.name == channelData.Build); });
                        if (buildIndex < 0)
                        {
                            canSave    = false;
                            buildIndex = BBGoGUI.ErrorPopup(Localization.GetString("deploy_tab_channel_build"), buildIndex, m_managerWindow.FinalPatchEditorData.builds.ConvertAll((patchVersion) => { return(patchVersion.name); }).ToArray());
                        }
                        else
                        {
                            buildIndex = EditorGUILayout.Popup(Localization.GetString("deploy_tab_channel_build"), buildIndex, m_managerWindow.FinalPatchEditorData.builds.ConvertAll((patchVersion) => { return(patchVersion.name); }).ToArray());
                        }
                        BuildVersion buildVersion = null;
                        if (buildIndex >= 0)
                        {
                            buildVersion      = m_managerWindow.FinalPatchEditorData.builds[buildIndex];
                            channelData.Build = buildVersion.name;
                        }
                        else
                        {
                            channelData.Build = null;
                        }

                        BBGoGUI.BeginEnable(!string.IsNullOrEmpty(channelData.Build));
                        {
                            if (buildVersion != null)
                            {
                                channelData.Version = EditorGUILayout.IntSlider(Localization.GetString("deploy_tab_channel_version"), channelData.Version, 0, buildVersion.version);
                            }
                            else
                            {
                                channelData.Version = EditorGUILayout.IntSlider(Localization.GetString("deploy_tab_channel_version"), 0, 0, 0);
                            }
                        }
                        BBGoGUI.EndEnable();
                        EditorGUILayout.Space();

                        EditorGUILayout.BeginHorizontal();
                        {
                            EditorGUILayout.Space();
                            BBGoGUI.BeginEnable(canSave);
                            {
                                save = GUILayout.Button(m_contentSave, BBGoGUI.styleCompactButton, m_contentOptions);
                            }
                            BBGoGUI.EndEnable();
                            discard = GUILayout.Button(m_contentDiscard, BBGoGUI.styleCompactButton, m_contentOptions);
                        }
                        EditorGUILayout.EndHorizontal();
                    }
                    else
                    {
                        EditorGUILayout.LabelField(Localization.GetString("deploy_tab_channel_name"), channelData.Name);
                        EditorGUILayout.LabelField(Localization.GetString("deploy_tab_channel_url"), channelData.URL);
                        EditorGUILayout.LabelField(Localization.GetString("deploy_tab_channel_build"), channelData.Build);
                        EditorGUILayout.LabelField(Localization.GetString("deploy_tab_channel_version"), channelData.Version.ToString());

                        EditorGUILayout.Space();
                        BBGoGUI.BeginEnable(!m_hasEdit);
                        {
                            EditorGUILayout.BeginHorizontal();
                            {
                                EditorGUILayout.Space();
                                edit  |= GUILayout.Button(m_contentEdit, BBGoGUI.styleCompactButton, m_contentOptions);
                                delete = GUILayout.Button(m_contentDelete, BBGoGUI.styleCompactButton, m_contentOptions);
                            }
                            EditorGUILayout.EndHorizontal();
                        }
                        BBGoGUI.EndEnable();
                    }
                }
            }
            EditorGUILayout.EndVertical();

            if (edit)
            {
                channelData.IsEdit = true;
            }

            if (discard)
            {
                LoadDeployData(PlayerPrefs.GetString(FinalPatchConst.KEY_DEPLOY_DATA));
                GUI.FocusControl(null);
            }

            if (save)
            {
                channelData.IsEdit = false;
                SaveData();
                GUI.FocusControl(null);
            }

            if (delete)
            {
                bool comfirmDelete = EditorUtility.DisplayDialog(Localization.GetString("deploy_tab_delete_channel_comfirm_title"),
                                                                 Localization.GetString("deploy_tab_delete_channel_comfirm_message"),
                                                                 Localization.GetString("deploy_tab_delete_channel_comfirm_yes"),
                                                                 Localization.GetString("deploy_tab_delete_channel_comfirm_no"));
                if (comfirmDelete)
                {
                    m_deployData.Channels.Remove(channelData);
                    SaveData();
                }
            }
        }
Example #8
0
        private void DrawBuild(BuildVersion buildVersion)
        {
            if (!string.IsNullOrEmpty(m_searchText) &&
                (!buildVersion.name.Contains(m_searchText) && !buildVersion.description.Contains(m_searchText)))
            {
                return;
            }

            bool   browse      = false;
            bool   copy        = false;
            bool   build       = false;
            bool   edit        = false;
            bool   delete      = false;
            bool   save        = false;
            bool   discard     = false;
            string foldoutName = $"{buildVersion.name}[{buildVersion.version}]";

            EditorGUILayout.BeginVertical(GUI.skin.box);
            {
                EditorGUILayout.BeginHorizontal();
                {
                    buildVersion.foldout = EditorGUILayout.Foldout(buildVersion.foldout, foldoutName) || buildVersion.isEdit;
                    BBGoGUI.BeginEnable(!m_hasEdit);
                    {
                        browse = GUILayout.Button(m_contentReveal, BBGoGUI.styleCompactButton, m_contentOptions);
                        copy   = GUILayout.Button(m_contentCopy, BBGoGUI.styleCompactButton, m_contentOptions);
                        build  = GUILayout.Button(m_contentBuild, BBGoGUI.styleCompactButton, m_contentOptions);
                    }
                    BBGoGUI.EndEnable();
                }
                EditorGUILayout.EndHorizontal();
                if (buildVersion.foldout)
                {
                    if (buildVersion.isEdit)
                    {
                        bool canSave = true;

                        if (string.IsNullOrEmpty(buildVersion.name) || m_managerWindow.FinalPatchEditorData.builds.Find((b) => b != buildVersion && b.name == buildVersion.name) != null)
                        {
                            canSave           = false;
                            buildVersion.name = BBGoGUI.ErrorTextField(Localization.GetString("build_tab_build_name"), buildVersion.name)?.Trim();
                        }
                        else
                        {
                            buildVersion.name = EditorGUILayout.TextField(Localization.GetString("build_tab_build_name"), buildVersion.name)?.Trim();
                        }

                        buildVersion.description = EditorGUILayout.TextField(Localization.GetString("build_tab_build_desc"), buildVersion.description);
                        buildVersion.buildTarget = (BuildTarget)EditorGUILayout.EnumPopup(Localization.GetString("build_tab_build_target"), buildVersion.buildTarget);
                        EditorGUILayout.LabelField(Localization.GetString("build_tab_build_version"), buildVersion.version.ToString());
                        EditorGUILayout.Space();

                        EditorGUILayout.BeginHorizontal();
                        {
                            EditorGUILayout.Space();
                            BBGoGUI.BeginEnable(canSave);
                            {
                                save = GUILayout.Button(m_contentSave, BBGoGUI.styleCompactButton, m_contentOptions);
                            }
                            BBGoGUI.EndEnable();
                            discard = GUILayout.Button(m_contentDiscard, BBGoGUI.styleCompactButton, m_contentOptions);
                        }
                        EditorGUILayout.EndHorizontal();
                    }
                    else
                    {
                        EditorGUILayout.LabelField(Localization.GetString("build_tab_build_name"), buildVersion.name);
                        EditorGUILayout.LabelField(Localization.GetString("build_tab_build_desc"), buildVersion.description);
                        EditorGUILayout.LabelField(Localization.GetString("build_tab_build_target"), buildVersion.buildTarget.ToString());
                        EditorGUILayout.LabelField(Localization.GetString("build_tab_build_version"), buildVersion.version.ToString());
                        EditorGUILayout.Space();

                        EditorGUILayout.BeginHorizontal();
                        {
                            EditorGUILayout.Space();
                            BBGoGUI.BeginEnable(!m_hasEdit);
                            {
                                edit   = GUILayout.Button(m_contentEdit, BBGoGUI.styleCompactButton, m_contentOptions);
                                delete = GUILayout.Button(m_contentDelete, BBGoGUI.styleCompactButton, m_contentOptions);
                            }
                            BBGoGUI.EndEnable();
                        }
                        EditorGUILayout.EndHorizontal();
                    }
                }
            }
            EditorGUILayout.EndVertical();

            if (browse)
            {
                EditorUtility.RevealInFinder(string.Format($"{FinalPatchConst.ROOT_PATH}/{buildVersion.name}"));
            }
            if (copy)
            {
                CopyToStreamingAssets(buildVersion);
            }
            if (build)
            {
                Build(buildVersion, buildVersion.version + 1);
            }
            if (save)
            {
                buildVersion.isEdit = false;
                m_managerWindow.FinalPatchEditorData.Save();
                GUI.FocusControl(null);
            }
            if (discard)
            {
                Resources.UnloadAsset(m_managerWindow.FinalPatchEditorData);
                m_managerWindow.FinalPatchEditorData = FinalPatchEditorData.Load();
                GUI.FocusControl(null);
            }
            if (edit)
            {
                buildVersion.isEdit = true;
            }
            if (delete)
            {
                bool comfirmDelete = EditorUtility.DisplayDialog(Localization.GetString("build_tab_delete_comfirm_title"),
                                                                 Localization.GetString("build_tab_delete_comfirm_message"),
                                                                 Localization.GetString("build_tab_delete_comfirm_yes"),
                                                                 Localization.GetString("build_tab_delete_comfirm_no"));
                if (comfirmDelete)
                {
                    string dir = string.Format($"{FinalPatchConst.ROOT_PATH}/{buildVersion.name}");
                    if (Directory.Exists(dir))
                    {
                        Directory.Delete(dir, true);
                    }
                    m_managerWindow.FinalPatchEditorData.builds.Remove(buildVersion);
                    m_managerWindow.FinalPatchEditorData.Save();
                }
            }
        }
Example #9
0
 private void OnGUI()
 {
     BBGoGUI.Tab(m_mainTabSet);
 }