static void AutoLuaGameObject(MenuCommand command) { GameObject go = command.context as GameObject; UIWidget wid = go.GetComponent <UIWidget>(); Object gObj = null; if (wid != null) { gObj = wid; } else { gObj = go.GetComponent <UIPanel>(); } string findPath = getWidgetPath(gObj); string comptName = command.context.name; string comptType = command.context.GetType().ToString(); comptType = comptType.Substring(comptType.LastIndexOf(".") + 1); string file = getLuaFilePath(gObj); LuaAutoComponentEditorWindow window = (LuaAutoComponentEditorWindow)EditorWindow.GetWindow(typeof(LuaAutoComponentEditorWindow)); window.position = new Rect(960, 540, 515, 135); window.ComptName = comptName; window.ComptType = comptType; window.ComptPath = findPath; window.initialize(file); }
static void AutoLuaComponent(MenuCommand command) { string findPath = getWidgetPath(command.context); string comptName = command.context.name; string comptType = command.context.GetType().ToString(); comptType = comptType.Substring(comptType.LastIndexOf(".") + 1); string file = getLuaFilePath(command.context); LuaAutoComponentEditorWindow window = (LuaAutoComponentEditorWindow)EditorWindow.GetWindow(typeof(LuaAutoComponentEditorWindow)); window.position = new Rect(960, 540, 515, 135); window.ComptName = comptName; window.ComptType = comptType; window.ComptPath = findPath; window.initialize(file); }