Ejemplo n.º 1
0
    private void OnClick(Button button)
    {
        bool success = true;

        foreach (Toggle toggle in m_toggleArr)
        {
            if (toggle.Select)
            {
                if (m_isWnd == true)
                {
                    string WndName = Path.GetFileNameWithoutExtension(toggle.Data as string);
                    if (!UIWndCode.CreateWnd(WndName, "WndBase", true))
                    {
                        EditorUtility.DisplayDialog("错误", "生成" + toggle.Label + "代码时出现错误,请查看LOG", "确认");
                        success = false;
                    }
                }
                else
                {
                    string WndName = Path.GetFileNameWithoutExtension(toggle.Data as string);
                    if (!UIItemCode.CreateItem(WndName, "WndItem", true))
                    {
                        EditorUtility.DisplayDialog("错误", "生成" + toggle.Label + "代码时出现错误,请查看LOG", "确认");
                        success = false;
                    }
                }
            }
        }

        if (success)
        {
            EditorUtility.DisplayDialog("成功", "代码创建成功", "确认");
            AssetDatabase.Refresh();
        }
    }
Ejemplo n.º 2
0
    void OnGUI()
    {
        this.title   = "生成item及代码";
        this.minSize = new Vector2(480, 500);

        GUI.Label(new Rect(0, 50, 100, 20), "Item名称:");
        m_ItemName = GUI.TextField(new Rect(100, 50, 200, 20), m_ItemName, 18);

        if (GUI.Button(new Rect(10, 80, 100, 30), "生成Item"))
        {
            UIItemCode.CreateItem(m_ItemName, "WndItem", true);
        }
    }