public void Setup(Destination d, TourBuilderScriptable tb)
 {
     instance     = tb;
     dest         = d;
     ansText.text = dest.label;
     target       = tb.nodes[d.dest];
 }
Example #2
0
        /// <summary>
        /// Setup the node prefab with specific deserialized object n
        /// </summary>
        /// <param name="n">Deserialized Node object to setup</param>
        /// <param name="tb">Tour Builder that is building this node</param>
        public void Setup(Node n, TourBuilderScriptable tb)
        {
            instance          = tb;
            node              = n;
            questionText.text = node.label;

            transform.SetPositionAndRotation(node.position, Quaternion.Euler(node.rotation));
            instance.nodes[node.nodeId] = this;

            SetupNode();
        }
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            GUILayout.Label("Tour Sources", EditorStyles.boldLabel);

            loadFromWebsite = EditorGUILayout.BeginToggleGroup("Load from Online ID?", loadFromWebsite);
            tourId          = EditorGUILayout.TextField("Tour ID", tourId);
            EditorGUILayout.EndToggleGroup();
            loadFromWebsite = !EditorGUILayout.BeginToggleGroup("Load from static file?", !loadFromWebsite);
            jsonFile        = EditorGUILayout.ObjectField("File to use", jsonFile, typeof(TextAsset), false);
            EditorGUILayout.EndToggleGroup();


            tb = (TourBuilderScriptable)target;
            if (GUILayout.Button("Reset"))
            {
                tb.ResetTour();
                loadStatus = "Status";
                EditorApplication.update -= EditorUpdate;
            }
            if (GUILayout.Button("Load Tour"))
            {
                Tour t;
                if (loadFromWebsite)
                {
                    www = Receiver.GetFromId(tourId);
                    www.SendWebRequest();
                    loadStatus = "Loading from website...";
                    EditorApplication.update += EditorUpdate;
                }
                else
                {
                    loadStatus = "Loaded from file";
                    TextAsset json = (TextAsset)jsonFile;
                    t = Serialize.Utility.CreateFromJSON(json.text);
                    tb.LoadTour(t);
                }
            }
            if (GUILayout.Button("Build Tour"))
            {
                tb.BuildTour();
                loadStatus = "Built!";
            }
            EditorGUILayout.HelpBox(loadStatus, MessageType.Info);
        }
Example #4
0
 public void Setup(Tour t, TourBuilderScriptable tb)
 {
     instance      = tb;
     tour          = t;
     tourName.text = tour.name;
 }