public void UpdateLists() { fileIO = FindObjectOfType <JsonFileIO>(); List <string> options = fileIO.GetCharacterList(); int tmp = fileIO.ReturnCharacterIndex(CharacterName); if (options.Count != NameDropDown.options.Count) { NameDropDown.ClearOptions(); NameDropDown.AddOptions(options); } for (int i = 0; i < NameDropDown.options.Count; i++) { if (i >= options.Count) { NameDropDown.ClearOptions(); NameDropDown.AddOptions(options); break; } if (options[i] != NameDropDown.options[i].text) { NameDropDown.ClearOptions(); NameDropDown.AddOptions(options); } } NameDropDown.value = tmp; if (NameDropDown.value >= NameDropDown.options.Count) { NameDropDown.value = 0; } }
void Start() { menuSystem = FindObjectOfType <MenuSystem>(); fileIO = FindObjectOfType <JsonFileIO>(); ManageVariables(ActionType, true); SetValues(); }
public void SetValue(TMP_InputField input) { Menu menu = new Menu(); menu.MenuName = SentencesMenu.GetComponent <ItemMenu>().MenuName; SentencesMenu.GetComponent <ItemMenu>().title.text = "Sentence data: Sentences(" + ChapterName + ")"; menu.MenuObject = SentencesMenu.transform; int index = 0; foreach (Menu item in MenuSystem.menus) { if (item.MenuObject == menu.MenuObject) { index = MenuSystem.menus.IndexOf(item); } } MenuSystem.menus[index].MenuName = input.text + "Sentences"; if (fileIO == null) { fileIO = FindObjectOfType <JsonFileIO>(); } ChapterName = input.text; UpdateMenuNames(fileIO.ChapterMenu.MenuName); }
public ConfigurationViewModel() { // ComboBoxの初期値を設定するにはItemsSourceで利用しているインスタンスの中から指定する必要がある SelectedSwatch = new ReactivePropertySlim <Swatch>(Swatches.FirstOrDefault(s => s.Name == ThemeService.CurrentTheme.Name)); SelectedSwatch.Subscribe(s => ChangeTheme(s)).AddTo(CompositeDisposable); var backupPath = UserConfigurationManager.Instance.GetConfiguration <BackupPathConfig>(ConfigKey.BackupPath); BackupPath = new ReactivePropertySlim <string>(backupPath?.DirectoryPath); var favorites = UserConfigurationManager.Instance.GetConfiguration <FavoriteWorkTasksConfig>(ConfigKey.FavoriteWorkTask); FavoriteWorkTasks = new ObservableCollection <FavoriteWorkTask>(favorites?.FavoriteWorkTasks ?? new FavoriteWorkTask[0]); var maps = UserConfigurationManager.Instance.GetConfiguration <ScheduleTitleMapConfig>(ConfigKey.ScheduleTitleMap)?.ScheduleTitleMaps; if (maps == null || maps.Count() == 0) { // 新設定が未登録なら旧設定をとる var config = JsonFileIO.Deserialize <TimeRecorderConfiguration>("TimeRecorderConfiguration.json") ?? new TimeRecorderConfiguration(); maps = config.WorkTaskBuilderConfig.TitleMappers?.Select(t => t.ConvertToScheduleTitleMap()).ToArray(); } ScheduleTitleMaps = new ObservableCollection <ScheduleTitleMap>(maps ?? new ScheduleTitleMap[0]); ShowFavoriteDescription = new ReactivePropertySlim <bool>(FavoriteWorkTasks.Count == 0); ShowScheduleDescription = new ReactivePropertySlim <bool>(ScheduleTitleMaps.Count == 0); var url = UserConfigurationManager.Instance.GetConfiguration <WorkingHourImportApiUrlConfig>(ConfigKey.WorkingHourImportApiUrl); WorkingHourImportUrl = new ReactivePropertySlim <string>(url?.URL); }
private void Start() { menuSystem = FindObjectOfType <MenuSystem>(); fileIO = FindObjectOfType <JsonFileIO>(); SetValue(ChoiceTextInput); SetValue(ChoiceChapterInput); }
public static T ReadConfig <T>(string fullFilePath) where T : ConfigurationBase { if (!File.Exists(fullFilePath)) { throw new FileNotFoundException($"Could not locate '{fullFilePath}'"); } EventLogger.Info($"Reading configuration from {fullFilePath}"); return(JsonFileIO.Read <T>(fullFilePath)); }
public void Save() { if (Placement.HasValue == false) { return; } JsonFileIO.Serialize(new WindowPlacementJSON(Placement.Value), _FileName); }
void Start() { FileIO = FindObjectOfType <JsonFileIO>(); if (StartMenu == "") { StartMenu = menus[0].MenuName; } LoadMenu(StartMenu); }
public void Reload() { if (File.Exists(_FileName) == false) { return; } var config = JsonFileIO.Deserialize <WindowPlacementJSON>(_FileName); Placement = config?.ConvertToInteropStruct(); }
// Start is called before the first frame update void Start() { SetValues(); MenuSystem = FindObjectOfType <MenuSystem>(); fileIO = FindObjectOfType <JsonFileIO>(); if (ChoicesMenu != null || SentenceActionsMenu != null) { return; } CreateMenus(); }
public ImportTaskFromCalendarUseCase BuildImportTaskFromCalendarUseCase() { // 設定を再起動なしで反映させるために都度生成する var config = JsonFileIO.Deserialize <TimeRecorderConfiguration>("TimeRecorderConfiguration.json") ?? new TimeRecorderConfiguration(); var maps = UserConfigurationManager.Instance.GetConfiguration <ScheduleTitleMapConfig>(ConfigKey.ScheduleTitleMap); return(new ImportTaskFromCalendarUseCase( ContainerHelper.Resolver.Resolve <IWorkTaskRepository>(), ContainerHelper.Resolver.Resolve <IScheduledEventRepository>(), ContainerHelper.Resolver.Resolve <IWorkingTimeRangeRepository>(), config.WorkTaskBuilderConfig, maps?.ScheduleTitleMaps)); }
public void Save(AiInfo saveEntity) { var entitys = GetEntitys(); var entity = entitys.Where(m => m.FileName == saveEntity.FileName).FirstOrDefault(); if (entity != null) { entity.DisplayName = saveEntity.DisplayName; } else { entitys.Add(saveEntity); } JsonFileIO.WriteFile(AppPath.GetAiInfosFilePath(), Encoding.UTF8, entitys); }
void Start() { MenuSystem = FindObjectOfType <MenuSystem>(); fileIO = FindObjectOfType <JsonFileIO>(); List <string> options = new List <string>(); options.Add("None"); NextChapterList.AddOptions(options); if (SentencesMenu != null) { return; } CreateSentencesMenu(MenuSystem.currentlyLodadedMenu); }
public void SetValues() { fileIO = FindObjectOfType <JsonFileIO>(); List <string> options = new List <string>(); options.Add("None"); options.AddRange(fileIO.ReturnAllChapters().ToArray()); int tmp = NextChapter + 1; Debug.Log(options.Count); if (options.Count != NextChapterList.options.Count) { NextChapterList.ClearOptions(); NextChapterList.AddOptions(options); } for (int i = 0; i < NextChapterList.options.Count; i++) { if (i >= options.Count) { NextChapterList.ClearOptions(); NextChapterList.AddOptions(options); break; } if (options[i] != NextChapterList.options[i].text) { NextChapterList.ClearOptions(); NextChapterList.AddOptions(options); } } NextChapterList.value = tmp; if (NextChapterList.value >= NextChapterList.options.Count) { NextChapterList.value = 0; } }
public void UpdateLists() { fileIO = FindObjectOfType <JsonFileIO>(); List <string> options = fileIO.ReturnAllChapters(); options.RemoveAt(0); int tmp = ChoiceChapter; if (options.Count != ChoiceChapterInput.options.Count) { ChoiceChapterInput.ClearOptions(); ChoiceChapterInput.AddOptions(options); } for (int i = 0; i < ChoiceChapterInput.options.Count; i++) { if (i >= options.Count) { ChoiceChapterInput.ClearOptions(); ChoiceChapterInput.AddOptions(options); break; } if (options[i] != ChoiceChapterInput.options[i].text) { ChoiceChapterInput.ClearOptions(); ChoiceChapterInput.AddOptions(options); } } ChoiceChapterInput.value = tmp; if (ChoiceChapterInput.value >= ChoiceChapterInput.options.Count) { ChoiceChapterInput.value = 0; } }
public void ReadConfig(string fullFilePath, bool withTracing = false) { string jsonText; using (StreamReader fileStream = FileReader.CreateStream(fullFilePath)) { jsonText = fileStream.ReadToEnd(); } ITraceWriter traceWriter = withTracing ? new DiagnosticsTraceWriter { LevelFilter = TraceLevel.Verbose } : null; try { JsonConvert.PopulateObject(jsonText, this, JsonFileIO.CreateSettingsWithConvertersForClass(GetType(), traceWriter)); } catch (JsonSerializationException e) { OnError(new ValueEventArgs <string>(e.Message)); } }
public void SetDropdownValues() { if (fileIO == null) { fileIO = FindObjectOfType <JsonFileIO>(); } TMP_Dropdown.DropdownEvent tmp1 = CharacterNameDropdown.onValueChanged; TMP_Dropdown.DropdownEvent tmp2 = StateNameDropdown.onValueChanged; TMP_Dropdown.DropdownEvent tmp3 = BGMNameDropdown.onValueChanged; TMP_Dropdown.DropdownEvent tmp4 = CGDropdown.onValueChanged; TMP_Dropdown.DropdownEvent tmp5 = BGDropdown.onValueChanged; CharacterNameDropdown.onValueChanged = new TMP_Dropdown.DropdownEvent(); StateNameDropdown.onValueChanged = new TMP_Dropdown.DropdownEvent(); BGMNameDropdown.onValueChanged = new TMP_Dropdown.DropdownEvent(); CGDropdown.onValueChanged = new TMP_Dropdown.DropdownEvent(); BGDropdown.onValueChanged = new TMP_Dropdown.DropdownEvent(); List <string> options = fileIO.GetCharacterList(); int tmp = fileIO.ReturnCharacterIndex(CharacterName); if (options.Count != CharacterNameDropdown.options.Count) { CharacterNameDropdown.ClearOptions(); CharacterNameDropdown.AddOptions(options); } for (int i = 0; i < CharacterNameDropdown.options.Count; i++) { if (i >= options.Count) { CharacterNameDropdown.ClearOptions(); CharacterNameDropdown.AddOptions(options); break; } if (options[i] != CharacterNameDropdown.options[i].text) { CharacterNameDropdown.ClearOptions(); CharacterNameDropdown.AddOptions(options); } } CharacterNameDropdown.value = tmp; if (CharacterNameDropdown.value >= CharacterNameDropdown.options.Count) { CharacterNameDropdown.value = 0; } options = fileIO.GetCharacterStates(CharacterName); tmp = fileIO.ReturnCharacterStateIndex(CharacterName, StateName); if (options.Count != StateNameDropdown.options.Count) { StateNameDropdown.ClearOptions(); StateNameDropdown.AddOptions(options); } for (int i = 0; i < StateNameDropdown.options.Count; i++) { if (i >= options.Count) { StateNameDropdown.ClearOptions(); StateNameDropdown.AddOptions(options); break; } if (options[i] != StateNameDropdown.options[i].text) { StateNameDropdown.ClearOptions(); StateNameDropdown.AddOptions(options); } } StateNameDropdown.value = tmp; if (StateNameDropdown.value >= StateNameDropdown.options.Count) { StateNameDropdown.value = 0; } options = fileIO.GetBGMList(); tmp = BGMName; if (options.Count != BGMNameDropdown.options.Count) { BGMNameDropdown.ClearOptions(); BGMNameDropdown.AddOptions(options); } for (int i = 0; i < BGMNameDropdown.options.Count; i++) { if (i >= options.Count) { BGMNameDropdown.ClearOptions(); BGMNameDropdown.AddOptions(options); break; } if (options[i] != BGMNameDropdown.options[i].text) { BGMNameDropdown.ClearOptions(); BGMNameDropdown.AddOptions(options); } } BGMNameDropdown.value = tmp; if (BGMNameDropdown.value >= BGMNameDropdown.options.Count) { BGMNameDropdown.value = 0; } options = fileIO.GetArtworkList(0); tmp = CG; if (options.Count != CGDropdown.options.Count) { CGDropdown.ClearOptions(); CGDropdown.AddOptions(options); } for (int i = 0; i < CGDropdown.options.Count; i++) { if (i >= options.Count) { CGDropdown.ClearOptions(); CGDropdown.AddOptions(options); break; } if (options[i] != CGDropdown.options[i].text) { CGDropdown.ClearOptions(); CGDropdown.AddOptions(options); } } CGDropdown.value = tmp; if (CGDropdown.value >= CGDropdown.options.Count) { CGDropdown.value = 0; } options = fileIO.GetArtworkList(1); tmp = BG; if (options.Count != BGDropdown.options.Count) { BGDropdown.ClearOptions(); BGDropdown.AddOptions(options); } for (int i = 0; i < BGDropdown.options.Count; i++) { if (i >= options.Count) { BGDropdown.ClearOptions(); BGDropdown.AddOptions(options); break; } if (options[i] != BGDropdown.options[i].text) { BGDropdown.ClearOptions(); BGDropdown.AddOptions(options); } } BGDropdown.value = tmp; if (BGDropdown.value >= BGDropdown.options.Count) { BGDropdown.value = 0; } CharacterNameDropdown.onValueChanged = tmp1; StateNameDropdown.onValueChanged = tmp2; BGMNameDropdown.onValueChanged = tmp3; CGDropdown.onValueChanged = tmp4; BGDropdown.onValueChanged = tmp5; }
public List <AiInfo> GetEntitys() { return(JsonFileIO.ReadAllLine <List <AiInfo> >(AppPath.GetAiInfosFilePath(), Encoding.UTF8)); }
public void WriteConfig(string fullFilePath) { JsonFileIO.Write(fullFilePath, this); EventLogger.Info($"Configuration saved to {fullFilePath}"); }
// Start is called before the first frame update void Start() { jsonFileIO = FindObjectOfType <JsonFileIO>(); ProjectName.text = FilePath; }