示例#1
0
    static int ReferenceParamList(RealStatePtr L)
    {
        string parameterName;

        Contents.PropertyType propertyType = Contents.PropertyType.GameObject;
        try
        {
            int paramCount = LuaAPI.lua_gettop(L);
            parameterName = LuaAPI.lua_tostring(L, 2);
            propertyType  = (Contents.PropertyType)LuaAPI.lua_tonumber(L, 3);
        }
        catch (Exception e)
        {
            return(LuaAPI.luaL_error(L, "c# exception:" + e));
        }
        contents.ReferenceParameterList(parameterName, propertyType);
        if (recordedBehaviour)
        {
            callRecords.Add(() =>
            {
                contents.ReferenceParameterList(parameterName, propertyType);
            });
        }
        return(0);
    }
示例#2
0
        public bool ReferenceProperty(string propertyName, Contents.PropertyType propertyType)
        {
            SerializedProperty property = contents.GetProperty(propertyName, propertyType);
            Type referenceType          = null;

            switch (propertyType)
            {
            case PropertyType.AudioClip:
                referenceType = typeof(AudioClip);
                break;

            case PropertyType.GameObject:
                referenceType = typeof(GameObject);
                break;

            case PropertyType.Material:
                referenceType = typeof(Material);
                break;

            case PropertyType.Sprite:
                referenceType = typeof(Sprite);
                break;

            case PropertyType.TextAsset:
                referenceType = typeof(TextAsset);
                break;

            case PropertyType.Texture:
                referenceType = typeof(Texture);
                break;

            case PropertyType.Shader:
                referenceType = typeof(Shader);
                break;
            }
            property.objectReferenceValue = EditorGUILayout.ObjectField(new GUIContent(propertyName), property.objectReferenceValue, referenceType, true);
            bool hasReference = property.objectReferenceValue != null || property.exposedReferenceValue != null;

            return(hasReference);
        }