示例#1
0
    static int Find(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                WidgetReference    obj  = (WidgetReference)ToLua.CheckObject <WidgetReference>(L, 1);
                string             arg0 = ToLua.CheckString(L, 2);
                UnityEngine.Object o    = obj.Find(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 3)
            {
                WidgetReference    obj  = (WidgetReference)ToLua.CheckObject <WidgetReference>(L, 1);
                string             arg0 = ToLua.CheckString(L, 2);
                string             arg1 = ToLua.CheckString(L, 3);
                UnityEngine.Object o    = obj.Find(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: WidgetReference.Find"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#2
0
    void Clear()
    {
        WidgetReference w = (WidgetReference)target;

        w.ClearComponents();
        Apply();
    }
示例#3
0
    void Apply()
    {
        WidgetReference w = (WidgetReference)target;

        if (PrefabUtility.GetPrefabType(w.gameObject) == PrefabType.PrefabInstance)
        {
            GameObject prefabObj    = PrefabUtility.FindPrefabRoot(w.gameObject);
            UObect     prefabParent = PrefabUtility.GetPrefabParent(prefabObj);
            string     path         = AssetDatabase.GetAssetPath(prefabParent);
            assetPathProp.stringValue = path;
            EditorGUILayout.TextField("AssetPath", assetPathProp.stringValue);
            PrefabUtility.ReplacePrefab(prefabObj, prefabParent, ReplacePrefabOptions.ConnectToPrefab);
        }
    }