Ejemplo n.º 1
0
    private void OpenConfig()
    {
        string      sModuleName = GetType().Name;
        XmlDocument xmlDoc      = new XmlDocument();

        try
        {
            var kFile = ATHelper_File.FindFileInAT(sModuleName + ".xml");
            if (kFile != null)
            {
                m_sConfigPath = kFile.FullName;
                xmlDoc.Load(m_sConfigPath);
            }
            else
            {
                kFile         = ATHelper_File.FindFileInAT(sModuleName + ".cs");
                m_sConfigPath = Path.Combine(kFile.DirectoryName, sModuleName + ".xml");
                XmlTextWriter xmlWriter;
                xmlWriter            = new XmlTextWriter(m_sConfigPath, Encoding.Unicode);
                xmlWriter.Formatting = Formatting.Indented;
                xmlWriter.WriteStartDocument();
                xmlWriter.WriteStartElement(sModuleName);
                xmlWriter.WriteEndElement();
                xmlWriter.Close();

                xmlDoc.Load(m_sConfigPath);
            }
        }
        catch (System.Exception ex)
        {
            UnityEngine.Debug.LogError("Error Module:" + sModuleName);
            UnityEngine.Debug.LogError(ex);
        }
        Config = xmlDoc;
    }
 public override void Init()
 {
     m_kSB = new StringBuilder(2000);
     if (GetConfig <string>(Config_UnityPath, ref Path_Unity))
     {
         Path_Assemblies = ATHelper_File.CorrectPath(Path.Combine(Path_Unity, InnerPath_Managed));
     }
 }
Ejemplo n.º 3
0
    private void Draw_SVNUpdate()
    {
        bool bChanged = false;

        m_stkRm.Clear();

        GUILayout.BeginVertical(EditorStyles.objectFieldThumb);
        for (int i = 0; i < m_lsUpdatePath.Count; ++i)
        {
            string s = m_lsUpdatePath[i].m_sPath;
            GUILayout.BeginVertical(EditorStyles.objectFieldThumb);

            GUILayout.BeginHorizontal();
            ATGUILib.ChangeableButton("更新", !string.IsNullOrEmpty(m_lsUpdatePath[i].m_sPath), a => SVNUpdate((string)a), m_lsUpdatePath[i].m_sPath, 40);
            EditorGUI.BeginChangeCheck();
            GUI.contentColor = ATGUILib.EnhanceColor(Color.green);
            m_lsUpdatePath[i].m_sDescribe = EditorGUILayout.TextField(m_lsUpdatePath[i].m_sDescribe);
            GUI.contentColor = Color.white;
            if (EditorGUI.EndChangeCheck())
            {
                bChanged = true;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            if (ATGUILib.PathBar("更新目录", ATHelper_File.CorrectPath(ATDefine.Path_Project + "/.."), ref s, "", 190, true, false))
            {
                m_lsUpdatePath[i].m_sPath = s;
                bChanged = true;
            }
            if (GUILayout.Button("-", EditorStyles.miniButton))
            {
                bChanged = true;
                m_stkRm.Push(i);
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            GUILayout.Space(5);
        }

        for (int i = 0; i < m_stkRm.Count; ++i)
        {
            m_lsUpdatePath.RemoveAt(m_stkRm.Pop());
        }
        if (bChanged)
        {
            SetConfig <string>(c_sConfig_UpdatePath, CombinePath(m_lsUpdatePath));
        }
        GUILayout.Space(10);
        if (GUILayout.Button("新增地址"))
        {
            m_lsUpdatePath.Add(new PathDescribe("", "---设置更新目录备注---"));
        }
        GUILayout.EndVertical();

        EditorGUILayout.TextArea(sInfo);
    }
Ejemplo n.º 4
0
 public override void Init()
 {
     foreach (var path in m_lsCSVPath)
     {
         m_lsCSVFile = ATHelper_File.GetFilesInDir(path, ".csv");
         int i = 0;
         m_lsSelectedCSV.AddRange(m_lsCSVFile.Select(a => i++));
         //ATUtils.TransIEnum<int>(m_lsCSVFile, a => i++));
     }
 }
    public override void OnGUI()
    {
        if (string.IsNullOrEmpty(Path_Unity) || !new DirectoryInfo(Path_Assemblies).Exists)
        {
            string sPath = "";
            if (ATGUILib.PathBar("设置Unity路径", "", ref sPath, "", 130, true))
            {
                if (sPath.EndsWith("Editor"))
                {
                    Path_Assemblies = ATHelper_File.CorrectPath(Path.Combine(sPath, InnerPath_Managed));
                    if (new DirectoryInfo(Path_Assemblies).Exists)
                    {
                        Path_Unity = sPath;
                        SetConfig <string>(Config_UnityPath, sPath);
                    }
                    else
                    {
                        Path_Assemblies = "";
                    }
                }
            }
            return;
        }


        GUI.backgroundColor = ATGUILib.EnhanceColor(ATGUILib.LightBlue);
        EditorGUI.BeginChangeCheck();
        m_sInfo             = EditorGUILayout.TextArea(m_sInfo, GUILayout.Height(400));
        GUI.backgroundColor = Color.white;
        if (EditorGUI.EndChangeCheck())
        {
            m_kCompileResult = null;
        }

        GUILayout.Space(10);

        EditorGUILayout.TextArea(GetInfo(), GUILayout.Height(200));

        GUILayout.Space(10);

        GUILayout.BeginHorizontal();
        ATGUILib.ChangeableButton("编译", m_kCompileResult == null, Complile);
        ATGUILib.ChangeableButton("运行", m_kCompileResult != null && !m_kCompileResult.Errors.HasErrors, Run);
        GUILayout.EndHorizontal();
    }
Ejemplo n.º 6
0
    void Init()
    {
        titleContent = ATGUILib.GetGUIContent(ATHelper_File.FindFileInAT(m_sIcon).FullName, "辅助工具集");
        m_bInited    = true;
        m_lsATs.Clear();

        m_dicATID.Clear();
        var types = ATHelper_Unity.Assembly_GameEditor.GetTypes().Where(t => t.IsSubclassOf(typeof(AT_Component_Base)));

        foreach (var t in types)
        {
            var tool = System.Activator.CreateInstance(t) as AT_Component_Base;
            m_lsATs.Add(tool);
            m_dicATID[tool]     = ATGUILib.GenerateGroupID();
            m_dicATInited[tool] = false;
        }
        m_lsATs.Sort((a, b) => a.m_iSortValue.CompareTo(b.m_iSortValue));
    }
Ejemplo n.º 7
0
    void Init()
    {
        titleContent = ATGUILib.GetGUIContent(ATHelper_File.FindFileInAT(m_sIcon).FullName, "辅助工具集");
        m_bInited    = true;
        m_lsATs.Clear();

        var types = ATHelper_Unity.Assembly_GameEditor.GetTypes().Where(t => t.IsSubclassOf(typeof(AT_Component_Base)));

        foreach (var t in types)
        {
            var tool = System.Activator.CreateInstance(t) as AT_Component_Base;
            m_lsATs.Add(tool);
        }
        m_lsATs.Sort((a, b) => a.m_iSortValue.CompareTo(b.m_iSortValue));

        Config = ATHelper_Xml.OpenXml(c_sPreference);
        bool bUseGUI = false;

        Config.GetConfig(c_sUseGUI, ref bUseGUI);
        UseGUI  = bUseGUI;
        minSize = new Vector2(300, 200);
    }
Ejemplo n.º 8
0
    public override void OnGUI()
    {
        if (ATGUILib.PathBar("选择你的服务器文件", ATHelper_File.CorrectPath(sr_sBatPath), ref m_sServerPath, "bat"))
        {
            SetConfig <string>(c_sConfig_ServerPath, m_sServerPath);
        }

        GUILayout.BeginHorizontal(EditorStyles.objectFieldThumb);
        if (m_kProcess != null && m_kProcess.HasExited)
        {
            m_kProcess = null;
        }

        if (ATHelper_File.IsFileExists(m_sServerPath, ".bat") && m_kProcess == null)
        {
            if (GUILayout.Button("启动", GUILayout.Width(50)))
            {
                m_kProcess = ATHelper_Process.RunBat(m_sServerPath);
            }
        }
        else
        {
            GUILayout.Label("   启动", GUILayout.Width(50));
        }

        if (m_kProcess != null)
        {
            if (GUILayout.Button("停止", GUILayout.Width(50)))
            {
                ATHelper_Process.KillProcessTree(m_kProcess);
            }
        }
        else
        {
            GUILayout.Label("   停止", GUILayout.Width(50));
        }
        GUILayout.EndHorizontal();
    }