コード例 #1
0
        public override Rect Draw(Rect rect, object currentValue, Action <object> changeValueCallback, GUIContent label)
        {
            lockableCollection = (LockableObjectsCollection)currentValue;

            Rect currentPosition = new Rect(rect.x, rect.y, rect.width, EditorDrawingHelper.HeaderLineHeight);

            currentPosition.y += 10;

            GUI.Label(currentPosition, "Automatically unlocked objects in this step");

            for (int i = 0; i < lockableCollection.SceneObjects.Count; i++)
            {
                ISceneObject objectInScene = lockableCollection.SceneObjects[i];
                currentPosition    = DrawSceneObject(currentPosition, objectInScene);
                currentPosition.y += EditorDrawingHelper.SingleLineHeight;
            }

            currentPosition.y += EditorDrawingHelper.SingleLineHeight;
            EditorGUI.LabelField(currentPosition, "To add new TrainingSceneObject, drag it in here:");
            currentPosition.y += EditorDrawingHelper.SingleLineHeight + EditorDrawingHelper.VerticalSpacing;

            TrainingSceneObject newSceneObject = (TrainingSceneObject)EditorGUI.ObjectField(currentPosition, null, typeof(TrainingSceneObject), true);

            if (newSceneObject != null)
            {
                lockableCollection.AddSceneObject(newSceneObject);
            }
            // EditorDrawingHelper.HeaderLineHeight - 24f is just the magic number to make it properly fit...
            return(new Rect(rect.x, rect.y, rect.width, currentPosition.y - EditorDrawingHelper.HeaderLineHeight - 24f));
        }
コード例 #2
0
ファイル: LockingTests.cs プロジェクト: VaLiuM09/Creator
        public IEnumerator ObjectInConditionIsNotInManualUnlockList()
        {
            // Given a step with a condition with a LockableProperty
            ISceneObject     o1 = TestingUtils.CreateSceneObject("o1");
            LockableProperty lockableProperty = o1.GameObject.AddComponent <LockablePropertyMock>();
            LockableReferencingConditionMock lockCondition = new LockableReferencingConditionMock();

            lockCondition.Data.LockablePropertyMock = new ScenePropertyReference <ILockablePropertyMock>(o1.UniqueName);
            Step step = new BasicStepBuilder("step").AddCondition(lockCondition).Build();

            // When we create a collection referencing this step
            LockableObjectsCollection collection = new LockableObjectsCollection(step.Data);

            // Then the lockable property is not in the Manual Unlock List of the collection
            Assert.IsFalse(collection.IsInManualUnlockList(lockableProperty));

            yield return(null);
        }
コード例 #3
0
ファイル: LockingTests.cs プロジェクト: VaLiuM09/Creator
        public IEnumerator ManuallyAddedSceneObjectIsNotInAutoUnlockList()
        {
            // Given a step with a condition with a LockableProperty and a collection referencing this step
            Step step = new BasicStepBuilder("step").Build();
            LockableObjectsCollection collection = new LockableObjectsCollection(step.Data);

            // When we create a SceneObject with a lockable property
            ISceneObject     o1 = TestingUtils.CreateSceneObject("o1");
            LockableProperty lockableProperty = o1.GameObject.AddComponent <LockablePropertyMock>();

            // ...and add the SceneObject and its property to the collection
            collection.AddSceneObject(o1);
            collection.Add(lockableProperty);

            // Then the lockable property is not in the Auto Unlock List of the collection
            Assert.IsFalse(collection.IsInAutoUnlockList(lockableProperty));

            yield return(null);
        }
コード例 #4
0
ファイル: LockingTests.cs プロジェクト: VaLiuM09/Creator
        public IEnumerator RemovedPropertyIsNotInManualUnlockList()
        {
            // Given a step with a condition with a LockableProperty
            Step step = new BasicStepBuilder("step").Build();
            // ...and a collection with a manually added SceneObject and an added lockable property
            LockableObjectsCollection collection = new LockableObjectsCollection(step.Data);
            ISceneObject     o1 = TestingUtils.CreateSceneObject("o1");
            LockableProperty lockableProperty = o1.GameObject.AddComponent <LockablePropertyMock>();

            collection.AddSceneObject(o1);
            collection.Add(lockableProperty);

            // When we remove the property from the collection
            collection.Remove(lockableProperty);

            // Then the lockable property is not in the Auto Unlock List of the collection
            Assert.IsFalse(collection.IsInAutoUnlockList(lockableProperty));

            yield return(null);
        }
コード例 #5
0
 public void OnSelected()
 {
     collection = new LockableObjectsCollection(data);
 }
コード例 #6
0
 public LockablePropertyTab(GUIContent label, Step.EntityData data)
 {
     Label      = label;
     this.data  = data;
     collection = new LockableObjectsCollection(data);
 }