Esempio n. 1
0
    public JSONProperty Serialize()
    {
        JSONProperty json = new JSONProperty {
            type = type
        };

        switch (type)
        {
        case Type.Bool:
            json.boolValue = (reference as Ref <bool>).asValue;
            break;

        case Type.Float:
            json.floatValue = (reference as Ref <float>).asValue;
            break;

        case Type.Key:
            json.keyValue = (int)(reference as Ref <KeyCode>).asValue;
            break;

        default:
            break;
        }
        return(json);
    }
Esempio n. 2
0
    public void Deserialize(JSONProperty _json)
    {
        if (type == _json.type)
        {
            switch (type)
            {
            case Type.Bool:
                (reference as Ref <bool>).asRef[0] = _json.boolValue;
                break;

            case Type.Float:
                (reference as Ref <float>).asRef[0] = _json.floatValue;
                break;

            case Type.Key:
                (reference as Ref <KeyCode>).asRef[0] = (KeyCode)_json.keyValue;
                break;

            default:
                break;
            }
        }
    }