public void StartSaveCall( ) // this call does the work, passed in when thread is created, executes on thread.start { ThreadRunning = true; ThreadComplete = false; try { // create a playback file InteractPlaybackList list = new InteractPlaybackList(); list.Save(record); // now save this file list.SaveXML(filePath); } catch { error = "error"; } ThreadRunning = false; ThreadComplete = true; }
void OnGUI() { if ( ShowGUI == false ) return; GUILayout.BeginArea(new Rect(0,40,600,300)); if ( state != State.Playing ) { GUILayout.Box ("INTERACT PLAYBACK"); if ( GUILayout.Button ("Save") ) { // create a logrecord LogRecord record = new LogRecord(); record.Add(LogMgr.GetInstance().GetCurrent()); record.SetDateTime(); // create a playback file InteractPlaybackList list = new InteractPlaybackList(); list.Save(record); // now save this file list.SaveXML(null); } if ( GUILayout.Button ("Load") ) { debug = true; if ( state != State.Playing ) { // now create a playback list InteractPlaybackList list = new InteractPlaybackList(); list.LoadXML(null); // save start RestartWithList(list); //StartList(list); } else { UnityEngine.Debug.LogError("InteractPlaybackMgr.Update() : can't start new playback while one is in progress!!"); } } } else if ( state == State.Playing ) { GUILayout.Box ("INTERACT PLAYBACK : " + InteractPlaybackFileMgr.GetInstance().Filename); if ( GUILayout.Button ("Stop") ) { state = State.Complete; Time.timeScale = 1.0f; } GUILayout.BeginHorizontal(); if ( GUILayout.Button ("1x")) Time.timeScale = 1.0f; if ( GUILayout.Button ("2x")) Time.timeScale = 2.0f; if ( GUILayout.Button ("5x")) Time.timeScale = 5.0f; GUILayout.EndHorizontal(); } if ( state != State.Playing || currentIdx == -1 || debug == false ) { if ( restartTime != 0.0f && RestartOnDoneOrError == true) GUILayout.Button("Playback Complete, Restarting in " + ((int)(restartTime-elapsedTime)).ToString () + " seconds..."); GUILayout.EndArea(); return; } GUILayout.Space(10); if ( (currentIdx-1) >= 0 ) GUILayout.Label(" PB.curr=" + List.Items[currentIdx-1].Debug ());//InteractName + "," + List.Items[currentIdx].Character); GUILayout.Label(" PB.wait=" + List.Items[currentIdx].Debug ());//InteractName + "," + List.Items[currentIdx].Character); if ( (currentIdx+1) < List.Items.Count ) GUILayout.Label(" PB.next=" + List.Items[currentIdx+1].Debug ()); //InteractName + "," + List.Items[currentIdx+1].Character); GUILayout.EndArea(); }