Пример #1
0
        public override void update()
        {
            CswNbtMetaDataObjectClass ControlZoneOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ControlZoneClass );
            CswNbtMetaDataObjectClass FireExemptSetOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.FireClassExemptAmountSetClass );
            if( null != ControlZoneOC & null != FireExemptSetOC )
            {
                CswNbtMetaDataObjectClassProp FireClassSetOCP = ControlZoneOC.getObjectClassProp( CswNbtObjClassControlZone.PropertyName.FireClassSetName );

                //make fire exempt set required
                _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( FireClassSetOCP, CswEnumNbtObjectClassPropAttributes.isrequired, CswConvert.ToDbVal( true ) );
                
                //find the default fire exempt set
                CswNbtObjClassFireClassExemptAmountSet DefaultExemptSet = null;
                foreach( CswNbtObjClassFireClassExemptAmountSet FireExemptSet in FireExemptSetOC.getNodes( true, false, false, true ) )
                {
                    if( FireExemptSet.NodeName == "Default" )
                    {
                        DefaultExemptSet = FireExemptSet;
                        break;
                    }
                }
                if( null == DefaultExemptSet )
                {
                    DefaultExemptSet = FireExemptSetOC.getNodes( true, false, false, true ).FirstOrDefault();
                }

                //set "default" as the default exempt set on control zones
                _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue(
                    FireClassSetOCP, 
                    DefaultExemptSet.NodeId.PrimaryKey, 
                    CswEnumNbtSubFieldName.NodeID 
                );

                //set the default for all control zones that currently have nothing set
                foreach( CswNbtObjClassControlZone ControlZone in ControlZoneOC.getNodes( true, false, false, true ) )
                {
                    ControlZone.FireClassSetName.RelatedNodeId = ControlZone.FireClassSetName.RelatedNodeId ?? DefaultExemptSet.NodeId;
                    ControlZone.postChanges( false );
                }

            }
        } // update()
	// Use this for initialization
	void Start () {
		parent = transform.parent.gameObject;
		zone = parent.GetComponent<ControlZone>();
	}
Пример #3
0
	// Use this for initialization
	void Start () {
		zone = transform.parent.gameObject;
		controlZone = zone.GetComponent<ControlZone>();
	}