예제 #1
0
        static void CreateUIScript(MenuCommand menuCommadn)
        {
            GameObject target = menuCommadn.context as GameObject;

            if (target != null && target.transform.parent.name == "UICanvas" && target.name.EndsWith("UI"))
            {
                if (target.name.StartsWith("New UI"))
                {
                    ToolsHelper.Log("请修改UI名称!!!");
                    return;
                }

                UIOutlet uiObj = target.GetComponent <UIOutlet>();
                if (uiObj != null)
                {
                    UIScriptExport.ExportUIScript(uiObj);
                    ToolsHelper.Log("生成成功!!!");
                    AssetDatabase.Refresh();
                    return;
                }
            }

            ToolsHelper.Log("请选择有效果的UI对象!!!");
        }
예제 #2
0
        static void CreateItemScript(MenuCommand menuCommadn)
        {
            GameObject target = menuCommadn.context as GameObject;

            if (target != null && (target.name.EndsWith("Item")))
            {
                UIOutlet uiObj = target.GetComponent <UIOutlet>();
                if (uiObj != null)
                {
                    UIScriptExport.ExportItemScript(uiObj);
                    ToolsHelper.Log("生成成功!!!");
                    AssetDatabase.Refresh();
                    return;
                }
            }

            if (target != null && (target.name.EndsWith("ItemP")))
            {
                ToolsHelper.Log("对于ItemP类型的Item,请在对应预设文件夹生成Item");
                return;
            }

            ToolsHelper.Log("请选择有效果的Item对象!!!,Item包含UIOutlet脚本,并且以Item命名结尾");
        }