【工程配置文件】工具添加

dev_chengFeng
gaoxin 2021-02-23 16:20:25 +08:00
parent ab0a82f981
commit 4dacf3081e
3 changed files with 143 additions and 1 deletions

View File

@ -1,4 +1,10 @@
{"subChannel":"1",
"buglyId":"261348dcd3",
"channel":"pc",
"serverUrl":"http://60.1.1.23:8080/"}
"serverUrl":"http://60.1.1.23:8080/",
"func":{
"Func_1":{"desc":"", "versionCode:"", isActive:""}
}
}

View File

@ -0,0 +1,125 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Linq;
using GameEditor.Core;
using GameEditor.GameEditor.PlayerBuilder;
using GameLogic;
using System.Diagnostics;
using ResUpdate;
using System.Threading;
namespace GameEditor.FrameTool {
public class ConfigWindow : EditorWindow
{
string m_ExcelPath = EditorPrefs.GetString("m_ExcelPath");
// Add menu named "My Window" to the Window menu
[MenuItem("Build/Config")]
static void Init()
{
// Get existing open window or if none, make a new one:
ConfigWindow window = (ConfigWindow)EditorWindow.GetWindow(typeof(ConfigWindow));
window.Show();
window.InitWindow();
}
void InitWindow()
{
InitSize();
InitGames();
}
/// <summary>
/// 初始化大小
/// </summary>
void InitSize()
{
minSize = new Vector2(300, 400);
maxSize = new Vector2(300, 650);
}
/// <summary>
/// 初始化游戏
/// </summary>
void InitGames()
{
}
void OnGUI()
{
EditorGUILayout.BeginVertical();
EditorGUILayout.Space();
EditorGUILayout.LabelField("Config文件路径");
EditorGUILayout.BeginHorizontal();
m_ExcelPath = EditorGUILayout.TextField("", m_ExcelPath);
if (GUILayout.Button("加载", GUILayout.Width(60f)))
{
}
if (GUILayout.Button("打开目录", GUILayout.Width(60f)))
{
OpenDirectory(m_ExcelPath);
}
EditorGUILayout.EndHorizontal();
//if (excelArr != null && excelArr.Length > 0)
//{
// excelIndex = EditorGUILayout.Popup("选择excel文件", excelIndex, excelArr);
//}
}
static string shellPath;
public static void OpenDirectory(string path)
{
if (string.IsNullOrEmpty(path)) return;
if (!Directory.Exists(path))
{
UnityEngine.Debug.LogError("No Directory: " + path);
return;
}
//Application.dataPath 只能在主线程中获取
int lastIndex = Application.dataPath.LastIndexOf("/");
shellPath = Application.dataPath.Substring(0, lastIndex) + "/Shell/";
// 新开线程防止锁死
Thread newThread = new Thread(new ParameterizedThreadStart(CmdOpenDirectory));
newThread.Start(path);
}
private static void CmdOpenDirectory(object obj)
{
Process p = new Process();
#if UNITY_EDITOR_WIN
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.Arguments = "/c start " + obj.ToString();
#elif UNITY_EDITOR_OSX
p.StartInfo.FileName = "bash";
string shPath = shellPath + "openDir.sh";
p.StartInfo.Arguments = shPath + " " + obj.ToString();
#endif
//UnityEngine.Debug.Log(p.StartInfo.Arguments);
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
p.WaitForExit();
p.Close();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 430a2ef9ef9800c4d8bff3f5edc235e1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: