void Awake() { this.configFilePath = Application.dataPath + HumanNaviConfig.FolderPath + HumanNaviConfig.ConfigFileName; this.configInfo = new HumanNaviConfigInfo(); if (File.Exists(configFilePath)) { // File open StreamReader streamReader = new StreamReader(configFilePath, Encoding.UTF8); this.configInfo = JsonUtility.FromJson <HumanNaviConfigInfo>(streamReader.ReadToEnd()); streamReader.Close(); } else { SIGVerseLogger.Warn("HumanNavi config file does not exists."); this.configInfo.teamName = "XXXX"; this.configInfo.sessionTimeLimit = 300; this.configInfo.maxNumberOfTrials = 1; this.configInfo.recoverUsingScoreFile = false; this.configInfo.executionMode = (int)ExecutionMode.Competition; this.configInfo.playbackType = WorldPlaybackCommon.PlaybackTypeNone; this.configInfo.language = "English"; List <TaskInfo> taskInfoList = new List <TaskInfo>(); taskInfoList.Add(new TaskInfo() { environment = "Default_Environment", target = "petbottle_500ml_empty_01", destination = "trashbox_01" }); this.configInfo.taskInfoList = taskInfoList; this.configInfo.guidanceMessageForPractice = ""; this.configInfo.photonServerMachine = false; // Photon this.configInfo.photonAppIdRuntime = ""; this.configInfo.photonUseNameServer = false; this.configInfo.photonServerIP = ""; this.configInfo.photonPort = 5055; // Copied Avatar this.configInfo.showImitator = true; this.configInfo.isImitatorTarget = false; this.SaveConfig(); } this.scoreFilePath = Application.dataPath + HumanNaviConfig.FolderPath + HumanNaviConfig.ScoreFileName; this.scores = new List <int>(); if (this.configInfo.recoverUsingScoreFile) { // File open StreamReader streamReader = new StreamReader(scoreFilePath, Encoding.UTF8); string line; while ((line = streamReader.ReadLine()) != null) { string scoreStr = line.Trim(); if (scoreStr == string.Empty) { continue; } this.scores.Add(Int32.Parse(scoreStr)); } streamReader.Close(); this.numberOfTrials = this.scores.Count; if (this.configInfo.playbackType != WorldPlaybackCommon.PlaybackTypePlay) { if (this.numberOfTrials >= this.configInfo.maxNumberOfTrials) { SIGVerseLogger.Error("this.numberOfTrials >= this.configFileInfo.maxNumberOfTrials"); Application.Quit(); } } } else { this.numberOfTrials = 0; } if (this.configInfo.playbackType == WorldPlaybackCommon.PlaybackTypePlay) { this.numberOfTrials = this.configInfo.playbackTrialNum; } switch (this.configInfo.language) { case "English": { this.ttsLanguageId = Language.English; break; } case "Japanese": { this.ttsLanguageId = Language.Japanese; break; } default: { this.ttsLanguageId = Language.English; break; } } }
void Awake() { this.configFilePath = Application.dataPath + FileName; this.configInfo = new HumanNaviConfigInfo(); if (File.Exists(configFilePath)) { // File open StreamReader streamReader = new StreamReader(configFilePath, Encoding.UTF8); this.configInfo = JsonUtility.FromJson <HumanNaviConfigInfo>(streamReader.ReadToEnd()); streamReader.Close(); } else { SIGVerseLogger.Warn("HumanNavi config file does not exists."); this.configInfo.maxNumberOfTrials = 1; this.configInfo.recoverUsingScoreFile = false; this.configInfo.executionMode = 1; this.configInfo.playbackType = WorldPlaybackCommon.PlaybackTypeNone; this.configInfo.language = "English"; List <TaskInfo> taskInfoList = new List <TaskInfo>(); taskInfoList.Add(new TaskInfo() { environment = "Default_Environment", target = "petbottle_500ml_empty_01", destination = "trashbox_01" }); this.configInfo.taskInfoList = taskInfoList; this.SaveConfig(); } this.scoreFilePath = Application.dataPath + HumanNaviConfig.ScoreFileName; this.scores = new List <int>(); if (this.configInfo.recoverUsingScoreFile) { // File open StreamReader streamReader = new StreamReader(scoreFilePath, Encoding.UTF8); string line; while ((line = streamReader.ReadLine()) != null) { string scoreStr = line.Trim(); if (scoreStr == string.Empty) { continue; } this.scores.Add(Int32.Parse(scoreStr)); } streamReader.Close(); this.numberOfTrials = this.scores.Count; if (this.numberOfTrials >= this.configInfo.maxNumberOfTrials) { SIGVerseLogger.Error("this.numberOfTrials >= this.configFileInfo.maxNumberOfTrials"); Application.Quit(); } } else { this.numberOfTrials = 0; } if (this.configInfo.playbackType == WorldPlaybackCommon.PlaybackTypePlay) { this.numberOfTrials = this.configInfo.playbackTrialNum; } switch (this.configInfo.language) { case "Japanese": { this.language_id = 6; break; } case "English": { this.language_id = 8; break; } default: { this.language_id = 8; break; } } }