Exemplo n.º 1
0
        public void InvokeEntityActionCorrectly()
        {
            // Arrange
            DCLBuilderInWorldEntity testEntity = new GameObject("_DCLBuilderInWorldEntity").AddComponent <DCLBuilderInWorldEntity>();

            testEntity.entityUniqueId = "testId";
            EntityListAdapter testEntityListAdapter = new GameObject("_EntityListAdapter").AddComponent <EntityListAdapter>();

            testEntity.entityUniqueId = "testId";
            EntityAction            testEntityAction          = EntityAction.SHOW;
            DCLBuilderInWorldEntity returnedEntity            = null;
            EntityListAdapter       returnedEntityListAdapter = null;
            EntityAction            retournedEntityAction     = EntityAction.DELETE;

            inspectorView.OnEntityActionInvoked += (action, entityToApply, adapter) =>
            {
                retournedEntityAction     = action;
                returnedEntity            = entityToApply;
                returnedEntityListAdapter = adapter;
            };

            // Act
            inspectorView.EntityActionInvoked(testEntityAction, testEntity, testEntityListAdapter);

            // Assert
            Assert.AreEqual(testEntity.entityUniqueId, returnedEntity.entityUniqueId, "The entity does not match!!");
            Assert.AreEqual(testEntityListAdapter, returnedEntityListAdapter, "The entity list adapter does not match!!");
            Assert.AreEqual(testEntityAction, retournedEntityAction, "The entity action does not match!!");
        }
Exemplo n.º 2
0
    public override void AddAdapters()
    {
        base.AddAdapters();

        foreach (DCLBuilderInWorldEntity entity in contentList)
        {
            EntityListAdapter adapter = Instantiate(entityListAdapter, contentPanelTransform).GetComponent <EntityListAdapter>();
            adapter.SetContent(entity);
            adapter.OnActionInvoked += EntityActionInvoked;
            adapter.OnEntityRename  += EntityRename;
        }
    }
Exemplo n.º 3
0
 public override void RemoveAdapters()
 {
     for (int i = 0; i < contentPanelTransform.transform.childCount; i++)
     {
         EntityListAdapter toRemove = contentPanelTransform.transform.GetChild(i).gameObject.GetComponent <EntityListAdapter>();
         if (toRemove != null)
         {
             toRemove.OnActionInvoked -= EntityActionInvoked;
             toRemove.OnEntityRename  -= EntityRename;
         }
         Destroy(toRemove.gameObject);
     }
 }
Exemplo n.º 4
0
    public override void AddAdapters()
    {
        base.AddAdapters();

        foreach (DCLBuilderInWorldEntity entity in contentList)
        {
            EntityListAdapter adapter = Instantiate(entityListAdapter, contentPanelTransform).GetComponent <EntityListAdapter>();
            adapter.SetContent(entity);
            adapter.OnActionInvoked += EntityActionInvoked;
            adapter.OnEntityRename  += EntityRename;
        }

        if (dynamicScrollSensitivity != null)
        {
            dynamicScrollSensitivity.RecalculateSensitivity();
        }
    }
Exemplo n.º 5
0
    public void EntityActionInvoked(EntityAction action, BIWEntity entityToApply, EntityListAdapter adapter)
    {
        switch (action)
        {
        case EntityAction.SELECT:

            OnEntityClick?.Invoke(entityToApply);
            break;

        case EntityAction.LOCK:

            OnEntityLock?.Invoke(entityToApply);
            break;

        case EntityAction.DELETE:

            OnEntityDelete?.Invoke(entityToApply);
            break;

        case EntityAction.SHOW:
            OnEntityChangeVisibility?.Invoke(entityToApply);
            break;
        }
    }
Exemplo n.º 6
0
 public void EntityActionInvoked(EntityAction action, BIWEntity entityToApply, EntityListAdapter adapter)
 {
     OnEntityActionInvoked?.Invoke(action, entityToApply, adapter);
 }
Exemplo n.º 7
0
 public void EntityActionInvoked(EntityAction action, DCLBuilderInWorldEntity entityToApply, EntityListAdapter adapter)
 {
     OnActionInvoked?.Invoke(action, entityToApply, adapter);
 }