示例#1
0
    //////////////////////////////////////////
    /// SetModel()
    /// Sets the model that this view is for.
    //////////////////////////////////////////
    public void SetModel( DefaultModel i_model ) {
        // null check for safety
        ModelToView = i_model;
        if ( i_model == null ) {
            Debug.LogError( "PropertyView has null model: " + PropertyName );
        }

        // if the model doesn't have the property, we want to create it
        bool bHas = ModelToView.HasProperty( PropertyName );
        if ( bHas == false )
            ModelToView.CreateProperty( PropertyName );

        // get and save the property's guid for message listening
        Property property = ModelToView.GetProperty( PropertyName );
        System.Guid guid = property.GetID();
        SetPropertyID( guid, !bHas );
    }
示例#2
0
    //////////////////////////////////////////
    /// SetModel()
    /// Sets the model that this view is for.
    //////////////////////////////////////////
    public void SetModel(DefaultModel i_model)
    {
        // null check for safety
        ModelToView = i_model;
        if (i_model == null)
        {
            Debug.LogError("PropertyView has null model: " + PropertyName);
        }

        // if the model doesn't have the property, we want to create it
        bool bHas = ModelToView.HasProperty(PropertyName);

        if (bHas == false)
        {
            ModelToView.CreateProperty(PropertyName);
        }

        // get and save the property's guid for message listening
        Property property = ModelToView.GetProperty(PropertyName);

        System.Guid guid = property.GetID();
        SetPropertyID(guid, !bHas);
    }