99 lines
3.4 KiB
C#
99 lines
3.4 KiB
C#
using Thousandto.Core.Asset;
|
||
using System.Collections.Generic;
|
||
using System.IO;
|
||
using System.Text;
|
||
using UnityEditor;
|
||
using UnityEngine;
|
||
|
||
namespace Thousandto.Editor.Test
|
||
{
|
||
public static class ConfigDefine
|
||
{
|
||
private static string RootPathFormat = "Assets/GameAssets/RawResources/scene/{0}/SplitedTerrain/{1}";
|
||
private static string ScenePathFormat = "Assets/GameAssets/ExportResources/Scene/{0}.unity";
|
||
private static string SavedMeshDirName = "mesh";
|
||
private static string MatDirName = "material";
|
||
private static string PrefabDirName = "prefabs";
|
||
private static string ControlMapDirName = "control";
|
||
private static string ConfigDirName = "config";
|
||
|
||
public static string ShaderName = "Ares/SceneT4M/T4M-4TexVP";
|
||
|
||
//生成的prefab所存放的路径,在Resources目录
|
||
public static string GetSavePrefabPath(string relativePath = null)
|
||
{
|
||
var path = string.Format("Assets/GameAssets/Resources/Scene");
|
||
if (!Directory.Exists(path))
|
||
Directory.CreateDirectory(path);
|
||
|
||
path = CombinePath(path, relativePath);
|
||
return path;
|
||
}
|
||
|
||
//生成的mesh存放路径,在RawResources目录
|
||
public static string GetSaveTerrainPath(string mapName, string relativePath = null)
|
||
{
|
||
var path = string.Format(RootPathFormat, mapName, SavedMeshDirName);
|
||
if (!Directory.Exists(path))
|
||
Directory.CreateDirectory(path);
|
||
|
||
path = CombinePath(path, relativePath);
|
||
return path;
|
||
}
|
||
|
||
//Control图保存路径
|
||
public static string GetControlMapPath(string mapName, string relativePath = null)
|
||
{
|
||
var path = string.Format(RootPathFormat, mapName, ControlMapDirName);
|
||
if (!Directory.Exists(path))
|
||
Directory.CreateDirectory(path);
|
||
|
||
path = CombinePath(path, relativePath);
|
||
return path;
|
||
}
|
||
|
||
//mesh对应材质路径
|
||
public static string GetMateriaPath(string mapName, string relativePath = null)
|
||
{
|
||
var path = string.Format(RootPathFormat, mapName, MatDirName);
|
||
if (!Directory.Exists(path))
|
||
Directory.CreateDirectory(path);
|
||
|
||
path = CombinePath(path, relativePath);
|
||
return path;
|
||
}
|
||
|
||
//mesh和场景物件转换成prefab,对应的配置文件所在路径
|
||
public static string GetConfigPath(string relativePath = null)
|
||
{
|
||
var path = string.Format("Assets/GameAssets/Resources/Config");
|
||
if (!Directory.Exists(path))
|
||
Directory.CreateDirectory(path);
|
||
|
||
path = CombinePath(path, relativePath);
|
||
return path;
|
||
}
|
||
|
||
public static string GetSceneFile(string mapName)
|
||
{
|
||
return string.Format(ScenePathFormat, mapName);
|
||
}
|
||
|
||
private static string CombinePath(string path1, string path2)
|
||
{
|
||
string combinedStr = path1;
|
||
if (!string.IsNullOrEmpty(path2))
|
||
{
|
||
if (path2[0] == '/')
|
||
combinedStr = path1 + path2;
|
||
else
|
||
combinedStr = string.Format("{0}/{1}", path1, path2);
|
||
}
|
||
|
||
combinedStr = combinedStr.Replace("\\", "/");
|
||
|
||
return combinedStr;
|
||
}
|
||
}
|
||
}
|