Beispiel #1
0
        public static void OpenMonoLuaScriptEditor(luaMonoBehaviour parentBehaviour)
        {
            string targetPath = Application.dataPath + "/" + CustomLuaMonoEditor.MonoScriptsPath;
            LuaMonoScriptEditorWindow window = (LuaMonoScriptEditorWindow)EditorWindow.GetWindow(typeof(LuaMonoScriptEditorWindow));

            if (string.IsNullOrEmpty(window.ScriptAuthor))
            {
                window.ScriptAuthor = SystemInfo.deviceName;
            }
            window.ParentBehaviour = parentBehaviour;
            window.ScriptName      = parentBehaviour.gameObject.name;
            window.ScriptModule    = window.ScriptName;
            window.AddFuncToScript("Awake");
            window.AddFuncToScript("Start");
            window.AddFuncToScript("Update");
            window.initialize(targetPath);
        }
Beispiel #2
0
    /// <summary>
    /// 获取组件所在根窗口的绑定脚本路径
    /// </summary>
    /// <param name="obj"></param>
    /// <returns></returns>
    static string getLuaFilePath(Object obj)
    {
        string           targetPath = Application.dataPath + "/";
        luaMonoBehaviour luaBeh     = getWidgetRoot(obj).GetComponent <luaMonoBehaviour>();

        if (luaBeh == null)
        {
            Debug.LogError("UIRoot can not find LuaMonoBehaviour");
            return("");
        }
        string monoPath = luaBeh.bindScript;

        if (string.IsNullOrEmpty(monoPath))
        {
            Debug.LogError("UIRoot<LuaMonoBehaviour> can not find lua file");
            return("");
        }

        string file = targetPath + monoPath;

        return(file);
    }
Beispiel #3
0
        /////////////////////////////////////////////////////////////////////////////

        public void OnEnable()
        {
            info = (luaMonoBehaviour)target;
        }