aframeComponent.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. "use strict";
  2. // VWF & A-Frame view driver
  3. // Copyright 2017 Krestianstvo.org project
  4. //
  5. // Copyright 2012 United States Government, as represented by the Secretary of Defense, Under
  6. // Secretary of Defense (Personnel & Readiness).
  7. //
  8. // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  9. // in compliance with the License. You may obtain a copy of the License at
  10. //
  11. // http://www.apache.org/licenses/LICENSE-2.0
  12. //
  13. // Unless required by applicable law or agreed to in writing, software distributed under the License
  14. // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  15. // or implied. See the License for the specific language governing permissions and limitations under
  16. // the License.
  17. /// vwf/view/lesson creates a view interface for instruction text.
  18. ///
  19. /// @module vwf/view/aframe
  20. /// @requires vwf/view
  21. define(["module", "vwf/view"], function (module, view) {
  22. return view.load(module, {
  23. // == Module Definition ====================================================================
  24. initialize: function (options) {
  25. var self = this;
  26. this.nodes = {};
  27. this.state.appInitialized = false;
  28. if (typeof options == "object") {
  29. this.rootSelector = options["application-root"];
  30. }
  31. else {
  32. this.rootSelector = options;
  33. }
  34. },
  35. // initializedNode: function( nodeID, childID ) {
  36. // },
  37. createdNode: function (nodeID, childID, childExtendsID, childImplementsIDs,
  38. childSource, childType, childIndex, childName, callback /* ( ready ) */) {
  39. var node = this.state.nodes[childID];
  40. // If the "nodes" object does not have this object in it, it must not be one that
  41. // this driver cares about
  42. if (!node) {
  43. return;
  44. }
  45. if(this.state.nodes[childID]) {
  46. this.nodes[childID] = {id:childID,extends:childExtendsID};
  47. }
  48. else if (this.state.nodes[childID] && this.state.nodes[childID].aframeObj) {
  49. this.nodes[childID] = {id:childID,extends:childExtendsID};
  50. }
  51. },
  52. initializedNode: function( nodeID, childID ) {
  53. var node = this.state.nodes[childID];
  54. if (!node) {
  55. return;
  56. }
  57. },
  58. createdProperty: function (nodeId, propertyName, propertyValue) {
  59. return this.satProperty(nodeId, propertyName, propertyValue);
  60. },
  61. initializedProperty: function (nodeId, propertyName, propertyValue) {
  62. return this.satProperty(nodeId, propertyName, propertyValue);
  63. },
  64. satProperty: function (nodeId, propertyName, propertyValue) {
  65. var node = this.state.nodes[ nodeId ];
  66. if ( !( node && node.aframeObj ) ) {
  67. return;
  68. }
  69. switch (propertyName) {
  70. case "color":
  71. if (propertyValue) {
  72. // self.kernel.callMethod (nodeId, 'initLang');
  73. console.log("sat color "+ propertyValue)
  74. }
  75. break;
  76. }
  77. },
  78. // firedEvent: function (nodeID, eventName, eventParameters) {
  79. // },
  80. ticked: function (vwfTime) {
  81. }
  82. });
  83. });