void CaptureComplete(object sender, EventArgs e) {
		if ((!captureVideo) && (!captureParams)) {
			return;
		}

		if ((eventIndex != -1) && (inputFile != string.Empty)) {
			string fullPath = Path.GetFullPath(Application.dataPath + inputFile);
			if (File.Exists(fullPath + ".py")) {
				string[] args = new string[] {
					fullPath.Remove(fullPath.LastIndexOf('/') + 1),
					inputFile.Substring(inputFile.LastIndexOf('/') + 1), eventIndex.ToString(),
					PlayerPrefs.GetString("Listener Port")
				};
				string result = Marshal.PtrToStringAuto(CommunicationsBridge.PythonCall(
					Application.dataPath + "/Externals/python/", "auto_event_script", "send_next_event_to_port",
					args, args.Length));
				eventIndex = Convert.ToInt32(result);
			}
			else {
				Debug.Log(string.Format("File {0} does not exist!",
					Path.GetFullPath(Application.dataPath + inputFile)));
			}
		}
		else {
			EnableObjects();
			GameObject.Find("VoxWorld").GetComponent<ObjectSelector>().SendMessage("ResetScene");
		}
	}
예제 #2
0
            // Use this for initialization
            void Start()
            {
                em             = gameObject.GetComponent <EventManager>();
                commBridge     = GameObject.Find("CommunicationsBridge").GetComponent <CommunicationsBridge>();
                objectSelector = GameObject.Find("VoxWorld").GetComponent <ObjectSelector>();

                em.QueueEmpty += QueueEmpty;
            }
예제 #3
0
            // Use this for initialization
            void Start()
            {
                relationTracker = gameObject.GetComponent <RelationTracker>();
                em         = gameObject.GetComponent <EventManager>();
                commBridge = GameObject.Find("CommunicationsBridge").GetComponent <CommunicationsBridge>();

                em.QueueEmpty += QueueEmpty;
            }
예제 #4
0
    // Use this for initialization
    void Start()
    {
        recorder        = gameObject.GetComponent <FlashbackRecorder>();
        inputController = GameObject.Find("IOController").GetComponent <InputController>();
        eventManager    = GameObject.Find("BehaviorController").GetComponent <EventManager>();
        objSelector     = GameObject.Find("VoxWorld").GetComponent <ObjectSelector>();
        commBridge      = GameObject.Find("CommunicationsBridge").GetComponent <CommunicationsBridge>();
        preds           = GameObject.Find("BehaviorController").GetComponent <Predicates>();

        refExpGenerator = GameObject.Find("ReferringExpressionGenerator")
                          .GetComponent <ReferringExpressionGenerator>();

        captureVideo   = (PlayerPrefs.GetInt("Capture Video") == 1);
        captureParams  = (PlayerPrefs.GetInt("Capture Params") == 1);
        captureMode    = (VideoCaptureMode)PlayerPrefs.GetInt("Video Capture Mode");
        filenameScheme = (VideoCaptureFilenameType)PlayerPrefs.GetInt("Video Capture Filename Type");
        sortByEvent    = (PlayerPrefs.GetInt("Sort By Event String") == 1);
        filenamePrefix = PlayerPrefs.GetString("Custom Video Filename Prefix");
        dbFile         = PlayerPrefs.GetString("Video Capture DB");
        videoDir       = PlayerPrefs.GetString("Video Output Directory");

        if ((!captureVideo) && (!captureParams))
        {
            return;
        }

        if (videoDir != string.Empty)
        {
            recorder.SetOutputDirectory(Path.GetFullPath(Application.dataPath + videoDir));
        }

        if (captureMode == VideoCaptureMode.PerEvent)
        {
            refExpGenerator.ItemsSituated += StartCaptureProcess;

            intervalWaitTimer          = new Timer(intervalWaitTime);
            intervalWaitTimer.Enabled  = false;
            intervalWaitTimer.Elapsed += WaitComplete;

            eventTimeoutTimer          = new Timer(eventTimeoutTime);
            eventTimeoutTimer.Enabled  = false;
            eventTimeoutTimer.Elapsed += StopCapture;

            FileWritten += CaptureComplete;
        }
    }
	void StartAutoInput(object sender, EventArgs e) {
		if (inputFile != string.Empty) {
			string fullPath = Path.GetFullPath(Application.dataPath + inputFile);
			if (File.Exists(fullPath + ".py")) {
				string[] args = new string[] {
					fullPath.Remove(fullPath.LastIndexOf('/') + 1),
					inputFile.Substring(inputFile.LastIndexOf('/') + 1), eventIndex.ToString(),
					PlayerPrefs.GetString("Listener Port")
				};
				string result = Marshal.PtrToStringAuto(CommunicationsBridge.PythonCall(
					Application.dataPath + "/Externals/python/", "auto_event_script", "send_next_event_to_port",
					args, args.Length));
				eventIndex = Convert.ToInt32(result);
			}
			else {
				Debug.Log(string.Format("File {0} does not exist!",
					Path.GetFullPath(Application.dataPath + inputFile)));
			}
		}
	}
예제 #6
0
파일: SceneHelper.cs 프로젝트: VoxML/Jarvis
            public static IEnumerator LoadScene(string sceneName)
            {
                yield return(null);

                AsyncOperation ao = SceneManager.LoadSceneAsync(sceneName);

                ao.allowSceneActivation = true;

                while (!ao.isDone)
                {
                    yield return(null);
                }

                CommunicationsBridge commBridge = GameObject.Find("CommunicationsBridge").GetComponent <CommunicationsBridge>();

                commBridge.OpenPortInternal(PlayerPrefs.GetString("Listener Port"));

#if UNITY_IOS
                Screen.SetResolution(1280, 960, true);
                Debug.Log(Screen.currentResolution);
#endif
            }
예제 #7
0
 // Use this for initialization
 void Start()
 {
     commBridge  = GameObject.Find("CommunicationsBridge").GetComponent <CommunicationsBridge>();
     _ksimSocket = (KSIMSocket)commBridge.FindSocketConnectionByLabel("KSIM");
 }
	// Use this for initialization
	void Start() {
		recorder = gameObject.GetComponent<FlashbackRecorder>();
		inputController = GameObject.Find("IOController").GetComponent<InputController>();
		eventManager = GameObject.Find("BehaviorController").GetComponent<EventManager>();
		objSelector = GameObject.Find("VoxWorld").GetComponent<ObjectSelector>();
		commBridge = GameObject.Find("CommunicationsBridge").GetComponent<CommunicationsBridge>();
		preds = GameObject.Find("BehaviorController").GetComponent<Predicates>();

		captureVideo = (PlayerPrefs.GetInt("Capture Video") == 1);
		captureParams = (PlayerPrefs.GetInt("Capture Params") == 1);
		captureMode = (VideoCaptureMode) PlayerPrefs.GetInt("Video Capture Mode");
		resetScene = (PlayerPrefs.GetInt("Reset Between Events") == 1);
		eventResetCounter = PlayerPrefs.GetInt("Event Reset Counter");
		filenameScheme = (VideoCaptureFilenameType) PlayerPrefs.GetInt("Video Capture Filename Type");
		sortByEvent = (PlayerPrefs.GetInt("Sort By Event String") == 1);
		filenamePrefix = PlayerPrefs.GetString("Custom Video Filename Prefix");
		dbFile = PlayerPrefs.GetString("Video Capture DB");
		inputFile = PlayerPrefs.GetString("Auto Events List");
		eventIndex = PlayerPrefs.GetInt("Start Index");
		videoDir = PlayerPrefs.GetString("Video Output Directory");

		if ((!captureVideo) && (!captureParams)) {
			return;
		}

		if (videoDir != string.Empty) {
			recorder.SetOutputDirectory(Path.GetFullPath(Application.dataPath + videoDir));
		}

		InitObjectDisabling();

		eventObjs = new List<GameObject>();

		if (captureMode == VideoCaptureMode.PerEvent) {
            // TODO: Default Listener Port no longer active, switch to Commander
			commBridge.PortOpened += StartAutoInput;

			inputController.InputReceived += PrepareScene;
			inputController.InputReceived += InputStringReceived;
			inputController.ParseComplete += ParseReceived;

			eventManager.ObjectsResolved += ObjectsResolved;
			eventManager.ObjectsResolved += FilterSpecifiedManner;
			eventManager.ObjectsResolved += EnableAffectedObjects;
			eventManager.ObjectsResolved += InsertWaitPeriod;
			//eventManager.ObjectsResolved += StartCapture;
			eventManager.SatisfactionCalculated += SatisfactionCalculated;
			eventManager.SatisfactionCalculated += EnableAffectedObjects;
			eventManager.SatisfactionCalculated += InsertWaitPeriod;
			//eventManager.SatisfactionCalculated += StartCapture;
			//eventManager.ExecuteEvent += EnableAffectedObjects;
			//eventManager.EventInserted += EventInserted;
			eventManager.ExecuteEvent += StartCapture;
			eventManager.QueueEmpty += EventComplete;

			preds.waitTimer.Elapsed += WaitComplete;
			preds.PrepareLog += PrepareLog;
			preds.ParamsCalculated += ParametersCalculated;

			eventTimeoutTimer = new Timer(eventTimeoutTime);
			eventTimeoutTimer.Enabled = false;
			eventTimeoutTimer.Elapsed += EventTimedOut;
			eventTimeoutTimer.Elapsed += StopCapture;

			eventCompleteWaitTimer = new Timer(eventCompleteWaitTime);
			eventCompleteWaitTimer.Enabled = false;
			eventCompleteWaitTimer.Elapsed += StopCapture;

			FileWritten += CaptureComplete;
		}
	}
예제 #9
0
            void Start()
            {
                GameObject bc = GameObject.Find("BehaviorController");

                eventManager = bc.GetComponent <EventManager>();
                macros       = bc.GetComponent <Macros>();

                objSelector = GameObject.Find("VoxWorld").GetComponent <ObjectSelector>();
                //exitToMenu = GameObject.Find ("VoxWorld").GetComponent<ExitToMenuUIButton> ();

                commBridge = GameObject.Find("CommunicationsBridge").GetComponent <CommunicationsBridge>();

                labelStyle              = new GUIStyle("Label");
                textFieldStyle          = new GUIStyle("TextField");
                buttonStyle             = new GUIStyle("Button");
                labelStyle.fontSize     = fontSize;
                textFieldStyle.fontSize = fontSize;
                buttonStyle.fontSize    = fontSize;

                fontSizeModifier = (int)(fontSize / defaultFontSize);

                inputWidth = (Convert.ToInt32(Screen.width - inputMargin) > inputMaxWidth)
                                ? inputMaxWidth
                                : Convert.ToInt32(Screen.width - inputMargin);
                inputHeight = Convert.ToInt32(20.0f * (float)fontSizeModifier);

                if (alignment == Alignment.Left)
                {
                    if (placement == Placement.Top)
                    {
                        inputRect = new Rect(5, 5, inputWidth, inputHeight);
                    }
                    else if (placement == Placement.Bottom)
                    {
                        inputRect = new Rect(5, Screen.height - inputHeight - 5, inputWidth, inputHeight);
                    }
                }
                else if (alignment == Alignment.Center)
                {
                    if (placement == Placement.Top)
                    {
                        inputRect = new Rect((int)((Screen.width / 2) - (inputWidth / 2)), 5, inputWidth, inputHeight);
                    }
                    else if (placement == Placement.Bottom)
                    {
                        inputRect = new Rect((int)((Screen.width / 2) - (inputWidth / 2)),
                                             Screen.height - inputHeight - 5, inputWidth, inputHeight);
                    }
                }
                else if (alignment == Alignment.Right)
                {
                    if (placement == Placement.Top)
                    {
                        inputRect = new Rect(Screen.width - (5 + inputWidth), 5, inputWidth, inputHeight);
                    }
                    else if (placement == Placement.Bottom)
                    {
                        inputRect = new Rect(Screen.width - (5 + inputWidth),
                                             Screen.height - inputHeight - 5, inputWidth, inputHeight);
                    }
                }

                //inputRect = new Rect (5, 5, 50, 25);
                //		inputHeight = (int)(20*fontSizeModifier);
                //
                //		inputRect = new Rect (5, 5, (int)(365*fontSizeModifier), inputHeight);
            }
예제 #10
0
 // Use this for initialization
 void Start()
 {
     commBridge = GameObject.Find("CommunicationsBridge").GetComponent <CommunicationsBridge>();
     //_wordcloudrestclient = (EpistemicState)commBridge.FindRestClientByLabel("EpiSim");
     _cloudSocket = (WordCloudRestClient)commBridge.FindRestClientByLabel("EpiSim");
 }
예제 #11
0
파일: NLUIOClient.cs 프로젝트: VoxML/Jarvis
 // Use this for initialization
 void Start()
 {
     commBridge = GameObject.Find("CommunicationsBridge").GetComponent <CommunicationsBridge>();
     //_nlurestclient = (EpistemicState)commBridge.FindRestClientByLabel("EpiSim");
     _nluSocket = (NLURestClient)commBridge.FindRestClientByLabel("EpiSim");
 }
예제 #12
0
 // Use this for initialization
 void Start()
 {
     commBridge    = GameObject.Find("CommunicationsBridge").GetComponent <CommunicationsBridge>();
     _fusionSocket = (FusionSocket)commBridge.FindSocketConnectionByLabel("Fusion");
 }