Esempio n. 1
0
    public static string FieldGUI_Type(SingleField data, string labelContent = "字段内容")
    {
        string content = "";

        switch (data.m_type)
        {
        case FieldType.String:
        case FieldType.StringArray:
        case FieldType.BoolArray:
        case FieldType.IntArray:
        case FieldType.FloatArray:
        case FieldType.Vector2Array:
        case FieldType.Vector3Array:
            content = EditorGUILayout.TextField(labelContent, data.GetString());
            break;

        case FieldType.Int:
            content = EditorGUILayout.IntField(labelContent, data.GetInt()).ToString();
            break;

        case FieldType.Float:
            content = EditorGUILayout.FloatField(labelContent, data.GetFloat()).ToString();
            break;

        case FieldType.Bool:
            content = EditorGUILayout.Toggle(labelContent, data.GetBool()).ToString();
            break;

        case FieldType.Vector3:
            content = EditorGUILayout.Vector3Field(labelContent, data.GetVector3()).ToSaveString();
            break;

        case FieldType.Vector2:
            content = EditorGUILayout.Vector2Field(labelContent, data.GetVector2()).ToSaveString();
            break;

        case FieldType.Color:
            content = EditorGUILayout.ColorField(labelContent, data.GetColor()).ToSaveString();
            break;

        case FieldType.Enum:
            if (data.m_enumType != "" && data.m_enumType != null)
            {
                content = EditorGUILayout.EnumPopup(labelContent, data.GetEnum()).ToString();
            }
            break;
        }

        if (data.m_content != content)
        {
            data.m_content = content;
        }

        return(content);
    }
Esempio n. 2
0
 static int GetInt(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         SingleField obj = (SingleField)ToLua.CheckObject(L, 1, typeof(SingleField));
         int         o   = obj.GetInt();
         LuaDLL.lua_pushinteger(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }