History

Add logging of show/hide/getByName in tutorial

Ryan Huffman committed 10 years ago

Commit 1f2b5551 parent d9e64911 file · +11 −1Browse files

Showing the changes to tutorial/tutorial.js (1 of 1 file). Show all

Unified · Split

tutorial/tutorial.js+11−1
@@ -937,6 +937,10 @@ stepCleanupFinish.prototype = { · 936 unmodified lines
937937
938938
939939
940+function isEntityInLocalTree(entityID) {
941+ return Entities.getEntityProperties(entityID, 'visible').visible !== undefined;
942+}
943+
940944 function showEntitiesWithTag(tag) {
941945 var entities = TUTORIAL_TAG_TO_ENTITY_IDS_MAP[tag];
942946 if (entities) {
@@ -955,6 +959,7 @@ function showEntitiesWithTag(tag) { · 12 unmodified lines
955959 collisionless: collisionless,
956960 userData: JSON.stringify(data),
957961 };
962+ debug("Showing: ", entityID, ", Is in local tree: ", isEntityInLocalTree(entityID));
958963 Entities.editEntity(entityID, newProperties);
959964 }
960965 }
@@ -979,6 +984,7 @@ function showEntitiesWithTag(tag) { · 18 unmodified lines
979984 Entities.editEntity(entityID, newProperties);
980985 });
981986 }
987+
982988 function hideEntitiesWithTag(tag) {
983989 var entities = TUTORIAL_TAG_TO_ENTITY_IDS_MAP[tag];
984990 if (entities) {
@@ -994,6 +1000,8 @@ function hideEntitiesWithTag(tag) { · 9 unmodified lines
9941000 ignoreForCollisions: 1,
9951001 userData: JSON.stringify(data),
9961002 };
1003+
1004+ debug("Hiding: ", entityID, ", Is in local tree: ", isEntityInLocalTree(entityID));
9971005 Entities.editEntity(entityID, newProperties);
9981006 }
9991007 }
@@ -1020,7 +1028,9 @@ function hideEntitiesWithTag(tag) { · 20 unmodified lines
10201028 // cached list of entities. Otherwise, return undefined.
10211029 function getEntityWithName(name) {
10221030 debug("Getting entity with name:", name);
1023− return TUTORIAL_NAME_TO_ENTITY_PROPERTIES_MAP[name];
1031+ var entityID = TUTORIAL_NAME_TO_ENTITY_PROPERTIES_MAP[name];
1032+ debug("Entity id: ", entityID, ", Is in local tree: ", isEntityInLocalTree(entityID));
1033+ return entityID;
10241034 }
10251035
10261036