예제 #1
0
    public void SetIsLockedValue(bool isLocked)
    {
        bool foundComponent = false;

        foreach (KeyValuePair <Type, ISharedComponent> kvp in rootEntity.sharedComponents)
        {
            if (kvp.Value.GetClassId() == (int)CLASS_ID.LOCKED_ON_EDIT)
            {
                ((DCLLockedOnEdit)kvp.Value).SetIsLocked(isLocked);
                foundComponent = true;
            }
        }

        if (!foundComponent)
        {
            ParcelScene     scene        = rootEntity.scene as ParcelScene;
            DCLLockedOnEdit entityLocked = (DCLLockedOnEdit)scene.SharedComponentCreate(Guid.NewGuid().ToString(), Convert.ToInt32(CLASS_ID.LOCKED_ON_EDIT));
            entityLocked.SetIsLocked(isLocked);
            scene.SharedComponentAttach(rootEntity.entityId, entityLocked.id);
        }
    }