Example #1
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);
    }
    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();
    }
    public override void OnGUI()
    {
        i = EditorGUILayout.IntField(i);

        sInfo = EditorGUILayout.TextArea(sInfo);
        if (GUILayout.Button("显示"))
        {
            ATUtils_WinAPI.ShowWindow(new IntPtr(i), 3);
        }

        if (GUILayout.Button("隐藏"))
        {
            ATUtils_WinAPI.ShowWindow(new IntPtr(i), 2);
        }

        if (GUILayout.Button("捕获ListView文本"))
        {
            var e = new ATUtils_WinAPI.ListViewCatecher.ListView();
            ATUtils_WinAPI.ListViewCatecher.DoCatch(i, e);
            foreach (var k in e.Items)
            {
                foreach (var d in k)
                {
                    UnityEngine.Debug.LogError(d);
                }
            }
        }

        if (GUILayout.Button("窗口位置"))
        {
            ATUtils_WinAPI.RECT rect = new ATUtils_WinAPI.RECT();
            ATUtils_WinAPI.GetWindowRect(i, ref rect);
            UnityEngine.Debug.LogError("L:" + rect.Left + " R:" + rect.Right + " T:" + rect.Top + " :B" + rect.Bottom);
        }

        if (GUILayout.Button("发送信息"))
        {
            ATUtils_WinAPI.SendMsg2Window(new IntPtr(i), sInfo);
        }
        if (GUILayout.Button("模拟按键"))
        {
            for (int index = 0; index < sInfo.Length; ++index)
            {
                ATUtils_WinAPI.SendMessage((IntPtr)i, ATUtils_WinAPI.WM_CHAR, sInfo[index], 0);
            }
        }

        using (var h = new ATGUILib.H())
        {
            ATGUILib.ChangeableButton("开始监听按键", !m_blisten, a =>
            {
                hook = new ATUtils_WinAPI.KeyboardHook();
                hook.KeyDownEvent += (x, y) => UnityEngine.Debug.LogError("KeyDown:" + (char)y.KeyCode);
                //hook.KeyPressEvent += (x, y) => UnityEngine.Debug.LogError("KeyPress" + y.KeyCode);
                hook.KeyUpEvent += (x, y) => UnityEngine.Debug.LogError("KeyUp:" + (char)y.KeyCode);
                hook.Start();
                m_blisten = true;
            }
                                      );

            ATGUILib.ChangeableButton("停止监听按键", m_blisten, a =>
            {
                hook.Stop();
                m_blisten = false;
            }
                                      );
        }
    }