Esempio n. 1
0
        /// <summary>
        /// Displays all summary information that EVE currently knows.
        /// </summary>
        public void DisplayParticipantDetails()
        {
            MenuUtils.ClearList(_dynamicField);


            var envs    = _log.GetSceneNames(_launchManager.ExperimentName);// _log.GetListOfEnvironments(_sessionId).Distinct().ToArray(); ;
            var timeSec = new TimeSpan[envs.Length];


            _fields.Find("SessionInformation").Find("SessionId").GetComponent <Text>().text = _sessionId.ToString();

            for (var k = 0; k < envs.Length; k++)
            {
                var sceneDescription = GameObjectUtils.InstatiatePrefab("Prefabs/Menus/Lists/SceneEntry");
                MenuUtils.PlaceElement(sceneDescription, _dynamicField);

                sceneDescription.transform.Find("SceneInformation").Find("SceneLabel")
                .GetComponent <Text>().text = "Scene " + k + ":";
                sceneDescription.transform.Find("SceneInformation").Find("SceneValue")
                .GetComponent <Text>().text = envs[k].Name;
                timeSec[k] = TimeSpan.FromSeconds(0);
                var times = _log.GetSceneTime(k, _sessionId);
                if (times[0] != null && times[1] != null)
                {
                    timeSec[k] = TimeUtils.TimeSpanDifference(times[0], times[1]);
                }
                else if (times[0].Length > 0)
                {
                    timeSec[k] = TimeUtils.TimeSpanDifference(times[0], times[0]);
                }

                sceneDescription.transform.Find("Statistics").Find("TimeInformation").Find("TimeValue")
                .GetComponent <Text>().text = timeSec[k].TotalSeconds.ToString();

                var xyzTable = _log.GetPath(_sessionId, k);
                if (xyzTable[0].Count <= 0)
                {
                    continue;
                }
                var distance = MenuUtils.ComputeParticipantPathDistance(xyzTable);
                sceneDescription.transform.Find("Statistics").Find("DistanceInformation").Find("DistanceValue")
                .GetComponent <Text>().text = distance.ToString();

                //make replay button
                var replayButton   = sceneDescription.transform.Find("Buttons").Find("ReplayButton").GetComponent <Button>();
                var localSceneId   = k;
                var localSceneName = envs[k];
                var localSessionId = _sessionId;
                replayButton.onClick.AddListener(() => Replay(localSessionId, localSceneId, localSceneName.Name));

                //make show map button
                _map = gameObject.GetComponent <PopUpEvaluationMap>();
                var showMapButton = sceneDescription.transform.Find("Buttons").Find("ShowMapButton").GetComponent <Button>();
                showMapButton.onClick.AddListener(() => ShowMap(localSessionId, localSceneId, localSceneName.Name));
            }
        }