Esempio n. 1
0
        public static void _ExportGameDataByMenuItem(int dataType, ToyMakerTaskSettings.ToyMakerTask exportSetting, GKToyData curData)
        {
            string destPath;

            // 导出路径.
            if (1 == dataType)
            {
                // 客户端.
                destPath = exportSetting._defaultClientPath;
                if (!Directory.Exists(destPath))
                {
                    do
                    {
                        destPath = EditorUtility.OpenFolderPanel(_GetLocalization("Save path"), Application.dataPath, _GetLocalization("Select save path."));
                    } while (!Directory.Exists(destPath));
                    exportSetting._defaultClientPath = destPath;
                }
                GKToyMakerTaskDataExporter.ExportClientData(curData, destPath, curData.name);
            }
            else
            {
                // 服务器.
                destPath = exportSetting._defaultServerPath;
                if (!Directory.Exists(destPath))
                {
                    do
                    {
                        destPath = EditorUtility.OpenFolderPanel(_GetLocalization("Save path"), Application.dataPath, _GetLocalization("Select save path."));
                    } while (!Directory.Exists(destPath));
                    exportSetting._defaultServerPath = destPath;
                }
                GKToyMakerTaskDataExporter.ExportServerData(curData, destPath, curData.name);
            }
        }
Esempio n. 2
0
        public static void ExportTaskServerData()
        {
            ToyMakerTaskSettings.ToyMakerTask exportSetting = GK.LoadResource <ToyMakerTaskSettings>("Settings/ToyMakerTaskSettings").toyMakerBase;
            DirectoryInfo directoryInfo = new DirectoryInfo(exportSetting._defaultOverlordPath);

            FileInfo[]        files = directoryInfo.GetFiles("*.asset", SearchOption.TopDirectoryOnly);
            GKToyExternalData externalData;

            for (int i = 0; i < files.Length; i++)
            {
                externalData = AssetDatabase.LoadMainAssetAtPath(string.Format("{0}/{1}", exportSetting._defaultOverlordPath, files[i].Name)) as GKToyExternalData;
                if (null != externalData)
                {
                    _ExportGameDataByMenuItem(2, exportSetting, externalData.data);
                }
            }
        }