// Use this for initialization void Start () { heatMapGen = this.GetComponent<HeatmapGenerator> (); Texture2D tempTex; float maxTime; float outOfBoundRatio; if (PresentationData.out_HGGazeData!=null) { heatMapGen.GenerateMap (PresentationData.out_HGGazeData, 0, PresentationData.out_ExitTime, out tempTex, out maxTime, out outOfBoundRatio); heatmapHolder.GetComponent<Image> ().sprite = Sprite.Create (tempTex, new Rect(0,0,tempTex.width, tempTex.height), new Vector2(0.5f, 0.5f)); screenshotHolder.GetComponent<Image> ().sprite = Sprite.Create (PresentationData.out_Screenshot, new Rect(0,0,PresentationData.out_Screenshot.width, PresentationData.out_Screenshot.height), new Vector2(0.5f, 0.5f)); } }
// Use this for initialization void Start() { heatMapGen = this.GetComponent <HeatmapGenerator> (); Texture2D tempTex; float maxTime; float outOfBoundRatio; if (PresentationData.out_HGGazeData != null) { heatMapGen.GenerateMap(PresentationData.out_HGGazeData, 0, PresentationData.out_ExitTime, out tempTex, out maxTime, out outOfBoundRatio); heatmapHolder.GetComponent <Image> ().sprite = Sprite.Create(tempTex, new Rect(0, 0, tempTex.width, tempTex.height), new Vector2(0.5f, 0.5f)); screenshotHolder.GetComponent <Image> ().sprite = Sprite.Create(PresentationData.out_Screenshot, new Rect(0, 0, PresentationData.out_Screenshot.width, PresentationData.out_Screenshot.height), new Vector2(0.5f, 0.5f)); } }
private async Task HandleHeatmapGeneration() { /* * Master list, this is really some shit. * Tag1 * Map1 * Game1 * Game2 * Map2 * Game1 * Tag1 * Map1 * Game1 * Game2 * Map2 * Game1 */ var tagMapGameList = new List <List <List <FaceItGameInfo> > >(); //Get unique tags from all matches. var uniqueTags = _gameInfo.GroupBy(x => x.Tag.TagName).Select(x => x.First()).Select(x => x.Tag).ToList(); foreach (var tag in uniqueTags) { //This list will store a list of maps, that contains a list of matches var mapGameList = new List <List <FaceItGameInfo> >(); //Findout what unique maps we have, based on each tag var uniqueMapsPerTag = _gameInfo.GroupBy(x => x.GetMapName()).Select(x => x.First()).ToList(); foreach (var map in uniqueMapsPerTag) { //Get each match that matches the unique tag + map we are currently on. var matchesPerMapByTag = _gameInfo.Where(x => x.Tag.TagName.Equals(tag.TagName, StringComparison.CurrentCulture) && x.GetMapName().Equals(map.GetMapName())).ToList(); //Make sure we only add lists with content. if (matchesPerMapByTag.Count != 0) { //Now take the list that has matches by map, and add them to the list of tags. mapGameList.Add(matchesPerMapByTag); } } //Add to the 3d list. tagMapGameList.Add(mapGameList); } var listFiles = await HeatmapGenerator.CreateListFiles(tagMapGameList); string lists = ""; foreach (var listFile in listFiles) { lists += $"`{listFile.Name}`\n"; } await _log.LogMessage($"Generating heatmaps for the following lists:\n{lists}"); var generatedFiles = new List <List <FileInfo> >(); //List of tasks that we'll use to spawn multiple parsers. var heatmapTasks = new List <Task <List <FileInfo> > >(); foreach (var listFile in listFiles) { string seasonTag = listFile.Name.Substring(0, listFile.Name.IndexOf('_')); string radarLocation = _dataService.RSettings.ProgramSettings.FaceItDemoPath + "\\Radars\\" + seasonTag; heatmapTasks.Add(HeatmapGenerator.GenerateHeatMapsByListFile(listFile.FullName, radarLocation, seasonTag, listFile.Name.Replace(listFile.Extension, ""))); //Don't spawn more than 8 generators at a time if (heatmapTasks.Count >= 16) { var completed = await Task.WhenAny(heatmapTasks); generatedFiles.Add(await completed); heatmapTasks.Remove(completed); } } //Add the remaining tasks //Now we have a 2d array. Top level contains each map, bottom then each with a list of images. //The folder that each file is in, will be the upload target generatedFiles.AddRange((await Task.WhenAll(heatmapTasks)).ToList()); //Now we have to put all the generated files into the upload dictionary foreach (var mapList in generatedFiles) { foreach (var map in mapList) { _uploadDictionary.Add(map, map.Directory?.Name); } } }
// Use this for initialization void Start () { Debug.Log("Enter Eval Scene"); //set volume control //#if UNITY_ANDROID // unity = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); // currentActivity = unity.GetStatic<AndroidJavaObject>("currentActivity"); // currentActivity.Call("ChangeVolumeControl"); // Debug.Log("Tried to active volume button control"); //#endif //setup heatmap ApplicationChrome.statusBarState = ApplicationChrome.navigationBarState = ApplicationChrome.States.Hidden; heatMapGen = this.GetComponent<HeatmapGenerator>(); Texture2D tempTex; float maxTime; float outOfBoundRatio; if (PresentationData.out_HGGazeData != null) { heatMapGen.GenerateMap(PresentationData.out_HGGazeData, 0, PresentationData.out_ExitTime, out tempTex, out maxTime, out outOfBoundRatio); heatmapHolder.GetComponent<Image>().sprite = Sprite.Create(tempTex, new Rect(0, 0, tempTex.width, tempTex.height), new Vector2(0.5f, 0.5f)); screenshotHolder.GetComponent<Image>().sprite = Sprite.Create(PresentationData.out_Screenshot, new Rect(0, 0, PresentationData.out_Screenshot.width, PresentationData.out_Screenshot.height), new Vector2(0.5f, 0.5f)); } //set up audio source if (audioSource == null) { //UnityEngine.Debug.Log("get audio source"); audioSource = gameObject.GetComponent<AudioSource>(); } if (audioSource.clip != null) audioSource.clip = null; pcmToUnityClip = new AudioProcessingJob(); if ((PresentationData.out_RecordingFilePath != null) && (PresentationData.out_RecordingFilePath != "")) pcmToUnityClip.setUpFile(PresentationData.out_RecordingFilePath); else pcmToUnityClip.setUpFile(@"C:\Users\xunchis\record.pcm"); //pcmToUnityClip.setUpFile(@"C:\Users\jaekyunk\Desktop\VR_Rehearsal\VR_Rehearsal_app\record.pcm"); //set up slide transition data out_SlidesTransitionRecord = new List<KeyValuePair<float, int>>(); if ((PresentationData.out_SlidesTransitionRecord != null) && (PresentationData.out_SlidesTransitionRecord.Count >= 0)) out_SlidesTransitionRecord = PresentationData.out_SlidesTransitionRecord; else { //give it some test data out_SlidesTransitionRecord = new List<KeyValuePair<float, int>>(); out_SlidesTransitionRecord.Add(new KeyValuePair<float, int>(0.0f, 0)); out_SlidesTransitionRecord.Add(new KeyValuePair<float, int>(1.0f, 1)); out_SlidesTransitionRecord.Add(new KeyValuePair<float, int>(5.0f, 2)); out_SlidesTransitionRecord.Add(new KeyValuePair<float, int>(10.0f, 3)); out_SlidesTransitionRecord.Add(new KeyValuePair<float, int>(15.0f, 4)); out_SlidesTransitionRecord.Add(new KeyValuePair<float, int>(20.0f, 5)); out_SlidesTransitionRecord.Add(new KeyValuePair<float, int>(22.0f, 6)); //the last shoot out_SlidesTransitionRecord.Add(new KeyValuePair<float, int>(26.0f, 7)); out_SlidesTransitionRecord.Add(new KeyValuePair<float, int>(35.0f, 8)); out_SlidesTransitionRecord.Add(new KeyValuePair<float, int>(55.0f, 9)); out_SlidesTransitionRecord.Add(new KeyValuePair<float, int>(70.0f, 10)); out_SlidesTransitionRecord.Add(new KeyValuePair<float, int>(82.0f, 11)); } //prepare duration data slideTimingRecord = new List<KeyValuePair<int, float>>(); //for (int j = 0; j < out_SlidesTransitionRecord.Count; j++ ) //{ // UnityEngine.Debug.Log(out_SlidesTransitionRecord[j].Key + " + " + out_SlidesTransitionRecord[j].Value); //} //UnityEngine.Debug.Log("brain power!! " + out_SlidesTransitionRecord.Count + " = " + (out_SlidesTransitionRecord.Count-1/6) + ")"); startTimeForThumbnailGroup = new float[(out_SlidesTransitionRecord.Count-2)/ 6+1]; //UnityEngine.Debug.Log("startTimeForThumbnailGroup has " + (out_SlidesTransitionRecord.Count - 2) / 6 + "+1 records"); for (int i = 0; i < out_SlidesTransitionRecord.Count-1; i++) { float time = out_SlidesTransitionRecord[i].Key; int slideNo = out_SlidesTransitionRecord[i].Value; //get the duration float dur = out_SlidesTransitionRecord[i + 1].Key - time; slideTimingRecord.Add(new KeyValuePair<int, float>(slideNo, dur)); if (i % 6 == 0) { //Debug.Log("*"+i+"* Group #" + (i / 6) + " starts on " + out_SlidesTransitionRecord[i].Key); startTimeForThumbnailGroup[i / 6] = out_SlidesTransitionRecord[i].Key; } //UnityEngine.Debug.Log("transition is picked: " + dur + " (#" + slideNo + ")"); } pcmToUnityClip.setUpSlideTransitionData(slideTimingRecord); pcmToUnityClip.Start(); isProcessingAudio = true; }
public static async Task Main(string[] args) { Console.Title = "Bot Ido"; //Always download users to make sure we can always get them var config = new DiscordSocketConfig { AlwaysDownloadUsers = true }; var interactiveConfig = new InteractiveServiceConfig { DefaultTimeout = TimeSpan.FromMinutes(10) }; // Dependency injection. All objects use constructor injection. _client = new DiscordSocketClient(config); _commands = new CommandService(); _services = new ServiceCollection() .AddSingleton(_client) .AddSingleton(_commands) .AddSingleton <GuildHandler>() .AddSingleton <CommandHandler>() .AddSingleton <LogHandler>() .AddSingleton <UserHandler>() .AddSingleton <ScheduleHandler>() .AddSingleton <DataService>() .AddSingleton <Random>() .AddSingleton <GoogleCalendar>() .AddSingleton <YouTube>() .AddSingleton <ReservationService>() .AddSingleton <PlaytestService>() .AddSingleton <RconService>() .AddSingleton <SrcdsLogService>() .AddSingleton <VoiceChannelHandler>() .AddSingleton <ToolsService>() .AddSingleton <VerificationService>() .AddSingleton <IHelpService, HelpService>() .AddSingleton(s => new InteractiveService(_client, interactiveConfig)) .BuildServiceProvider(); _dataService = _services.GetRequiredService <DataService>(); _log = _services.GetRequiredService <LogHandler>(); _services.GetRequiredService <GuildHandler>(); _services.GetRequiredService <ScheduleHandler>(); await _services.GetRequiredService <CommandHandler>().InstallCommandsAsync(); _services.GetRequiredService <UserHandler>(); _services.GetRequiredService <VoiceChannelHandler>(); _services.GetRequiredService <SrcdsLogService>(); _services.GetRequiredService <ToolsService>(); //Google APIs _services.GetRequiredService <GoogleCalendar>(); _services.GetRequiredService <YouTube>(); // Remember to keep token private or to read it from an // external source! In this case, we are reading the token // from an environment variable. If you do not know how to set-up // environment variables, you may find more information on the // Internet or by using other methods such as reading from // a configuration. await _client.LoginAsync(TokenType.Bot, _services.GetRequiredService <DataService>().RSettings.ProgramSettings.BotToken); _dataService.SetLogHandler(_services.GetRequiredService <LogHandler>()); //Set handlers for static classes DatabaseUtil.SetHandlers(_services.GetRequiredService <LogHandler>(), _services.GetRequiredService <DataService>()); DownloadHandler.SetHandlers(_services.GetRequiredService <LogHandler>(), _services.GetRequiredService <DataService>()); GeneralUtil.SetHandlers(_services.GetRequiredService <LogHandler>(), _services.GetRequiredService <DataService>(), _services.GetRequiredService <Random>()); DemoParser.SetHandlers(_services.GetRequiredService <LogHandler>(), _services.GetRequiredService <DataService>()); HeatmapGenerator.SetHandlers(_services.GetRequiredService <LogHandler>(), _services.GetRequiredService <DataService>()); await _client.StartAsync(); // Block this task until the program is closed. await Task.Delay(-1); }
// Use this for initialization void Start() { Debug.Log("Enter Eval Scene"); //set volume control //#if UNITY_ANDROID // unity = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); // currentActivity = unity.GetStatic<AndroidJavaObject>("currentActivity"); // currentActivity.Call("ChangeVolumeControl"); // Debug.Log("Tried to active volume button control"); //#endif //setup heatmap ApplicationChrome.statusBarState = ApplicationChrome.navigationBarState = ApplicationChrome.States.Hidden; heatMapGen = this.GetComponent <HeatmapGenerator>(); Texture2D tempTex; float maxTime; float outOfBoundRatio; if (PresentationData.out_HGGazeData != null) { heatMapGen.GenerateMap(PresentationData.out_HGGazeData, 0, PresentationData.out_ExitTime, out tempTex, out maxTime, out outOfBoundRatio); heatmapHolder.GetComponent <Image>().sprite = Sprite.Create(tempTex, new Rect(0, 0, tempTex.width, tempTex.height), new Vector2(0.5f, 0.5f)); screenshotHolder.GetComponent <Image>().sprite = Sprite.Create(PresentationData.out_Screenshot, new Rect(0, 0, PresentationData.out_Screenshot.width, PresentationData.out_Screenshot.height), new Vector2(0.5f, 0.5f)); } //set up audio source if (audioSource == null) { //UnityEngine.Debug.Log("get audio source"); audioSource = gameObject.GetComponent <AudioSource>(); } if (audioSource.clip != null) { audioSource.clip = null; } pcmToUnityClip = new AudioProcessingJob(); if ((PresentationData.out_RecordingFilePath != null) && (PresentationData.out_RecordingFilePath != "")) { pcmToUnityClip.setUpFile(PresentationData.out_RecordingFilePath); } else { pcmToUnityClip.setUpFile(@"C:\Users\xunchis\record.pcm"); } //pcmToUnityClip.setUpFile(@"C:\Users\jaekyunk\Desktop\VR_Rehearsal\VR_Rehearsal_app\record.pcm"); //set up slide transition data out_SlidesTransitionRecord = new List <KeyValuePair <float, int> >(); if ((PresentationData.out_SlidesTransitionRecord != null) && (PresentationData.out_SlidesTransitionRecord.Count >= 0)) { out_SlidesTransitionRecord = PresentationData.out_SlidesTransitionRecord; } else { //give it some test data out_SlidesTransitionRecord = new List <KeyValuePair <float, int> >(); out_SlidesTransitionRecord.Add(new KeyValuePair <float, int>(0.0f, 0)); out_SlidesTransitionRecord.Add(new KeyValuePair <float, int>(1.0f, 1)); out_SlidesTransitionRecord.Add(new KeyValuePair <float, int>(5.0f, 2)); out_SlidesTransitionRecord.Add(new KeyValuePair <float, int>(10.0f, 3)); out_SlidesTransitionRecord.Add(new KeyValuePair <float, int>(15.0f, 4)); out_SlidesTransitionRecord.Add(new KeyValuePair <float, int>(20.0f, 5)); out_SlidesTransitionRecord.Add(new KeyValuePair <float, int>(22.0f, 6)); //the last shoot out_SlidesTransitionRecord.Add(new KeyValuePair <float, int>(26.0f, 7)); out_SlidesTransitionRecord.Add(new KeyValuePair <float, int>(35.0f, 8)); out_SlidesTransitionRecord.Add(new KeyValuePair <float, int>(55.0f, 9)); out_SlidesTransitionRecord.Add(new KeyValuePair <float, int>(70.0f, 10)); out_SlidesTransitionRecord.Add(new KeyValuePair <float, int>(82.0f, 11)); } //prepare duration data slideTimingRecord = new List <KeyValuePair <int, float> >(); //for (int j = 0; j < out_SlidesTransitionRecord.Count; j++ ) //{ // UnityEngine.Debug.Log(out_SlidesTransitionRecord[j].Key + " + " + out_SlidesTransitionRecord[j].Value); //} //UnityEngine.Debug.Log("brain power!! " + out_SlidesTransitionRecord.Count + " = " + (out_SlidesTransitionRecord.Count-1/6) + ")"); startTimeForThumbnailGroup = new float[(out_SlidesTransitionRecord.Count - 2) / 6 + 1]; //UnityEngine.Debug.Log("startTimeForThumbnailGroup has " + (out_SlidesTransitionRecord.Count - 2) / 6 + "+1 records"); for (int i = 0; i < out_SlidesTransitionRecord.Count - 1; i++) { float time = out_SlidesTransitionRecord[i].Key; int slideNo = out_SlidesTransitionRecord[i].Value; //get the duration float dur = out_SlidesTransitionRecord[i + 1].Key - time; slideTimingRecord.Add(new KeyValuePair <int, float>(slideNo, dur)); if (i % 6 == 0) { //Debug.Log("*"+i+"* Group #" + (i / 6) + " starts on " + out_SlidesTransitionRecord[i].Key); startTimeForThumbnailGroup[i / 6] = out_SlidesTransitionRecord[i].Key; } //UnityEngine.Debug.Log("transition is picked: " + dur + " (#" + slideNo + ")"); } pcmToUnityClip.setUpSlideTransitionData(slideTimingRecord); pcmToUnityClip.Start(); isProcessingAudio = true; }