Пример #1
0
 protected static void SafeOpenJsonFile <T>(string path, T data) where T : class
 {
     FileUtil.UpdateFile(path, data);
     FileUtil.OpenFile(path);
 }
Пример #2
0
        void Present_Build()
        {
            EditorGUILayout.BeginVertical(VerticalStyle);
            if (LocalConfig.FoldDLC = EditorGUILayout.Foldout(LocalConfig.FoldDLC, "构建", true))
            {
                EditorGUILayout.BeginVertical();

                foreach (var item in DLCConfig.EditorAll)
                {
                    EditorGUILayout.BeginHorizontal();

                    EditorGUILayout.LabelField(item.Name, GUILayout.MaxWidth(100));

                    if (DLCConfig.IsSimulationEditor)
                    {
                        if (GUILayout.Button("Build Config"))
                        {
                            Builder.BuildDLCConfig(item);
                            AssetDatabase.Refresh();
                        }
                        if (GUILayout.Button("Build Bundle"))
                        {
                            Builder.BuildBundle(item);
                            EditorUtility.DisplayDialog("提示!", "恭喜! 已经打包完成!!", "确定");
                        }
                    }
                    else
                    {
                        EditorGUILayout.LabelField("请勾选编辑器模式");
                    }

                    EditorGUILayout.EndHorizontal();
                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical();
                if (GUILayout.Button("RrfreshDLC"))
                {
                    DLCConfig.RefreshDLC();
                }
                if (GUILayout.Button("RecreateDLC"))
                {
                    DLCConfig.RecreateDLC();
                    DLCConfig.RefreshDLC();
                }
                if (DLCConfig.IsSimulationEditor)
                {
                    if (GUILayout.Button("One click build"))
                    {
                        if (CheckEorr())
                        {
                            return;
                        }
                        if (!CheckDevBuildWarring())
                        {
                            return;
                        }
                        if (!CheckAuthority())
                        {
                            return;
                        }
                        RefreshData();
                        foreach (var item in DLCConfig.EditorAll)
                        {
                            Builder.BuildBundle(item);
                        }
                        Builder.BuildEXE();
                        EditorUtility.DisplayDialog("提示!", "恭喜! 已经打包完成!!", "确定");
                        EditorApplication.Beep();
                    }
                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("Build"))
                {
                    if (CheckEorr())
                    {
                        return;
                    }
                    if (!CheckDevBuildWarring())
                    {
                        return;
                    }
                    if (!CheckAuthority())
                    {
                        return;
                    }
                    RefreshData();
                    Builder.BuildEXE();
                    EditorUtility.DisplayDialog("提示!", "恭喜! 已经打包完成!!", "确定");
                }

                if (GUILayout.Button("Run game"))
                {
                    FileUtil.OpenFile(BuildConfig.ExePath);
                    CLog.Info("Run:{0}", BuildConfig.ExePath);
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();
        }