IEnumerator Start() { yield return(new WaitForEndOfFrame()); Debug.Log("StartDBController.cs 시작"); _hiddenMenuControl = GameObject.Find("HiddenMenu").GetComponent <HiddenMenuControl>(); /* * HiddenMenu에서 TotalTable 설정(?)을 마침. */ yield return(StartCoroutine(_hiddenMenuControl.Hidden_Start())); foreach (string file in saveFileName) { //같은 파일 이름으로 key 값이 설정 되있어야함. if (playedDic.ContainsKey(file) && keyDic.ContainsKey(file)) { GameObject tmp = Instantiate(_sampleButton) as GameObject; tmp.name = file; //실행 횟수를 추가하기 위해 GameObject를 검색해야함. tmp.transform.GetChild(0).GetComponent <Text>().text = "<color=#0000ff>" + keyDic[file] + ". </color>" + file + " : <color=#ff0000>" + playedDic[file] + "</color>"; tmp.transform.GetChild(2).GetComponent <Text>().text = timeDic[file]; tmp.transform.SetParent(_saveContent); tmp.transform.localScale = new Vector3(0.9f, 0.9f, 1); _vrCanvas._saveFileName.Add(file); //VRCanvas DataBase 파일 이름 리스트에 추가 _vrAndroidCanvas._saveFileName.Add(file); //VRCanvas DataBase 파일 이름 리스트에 추가 } } StartCoroutine(_vrCanvas.Init()); //VRCanvas 초기화 코루틴 함수 실행 StartCoroutine(_vrAndroidCanvas.Init()); //VRCanvas 초기화 코루틴 함수 실행 _clickedItemControl = GameObject.Find("ClickedItemCanvas").GetComponent <ClickedItemControl>(); _currentSearch._fileTable = new Dictionary <int, Dictionary <string, GameObject> >(); _allSearch._fileTable = new Dictionary <string, List <GameObject> >(); yield return(StartCoroutine(_clickedItemControl.ClickedItem_Start())); _pathText.text = _filePath = "."; contentInfo.Add(0, _voiceContent); /* * Directory 컨텐츠 생성 */ foreach (string dir_name in directoryName) { if (!directoryString.ContainsKey(dir_name)) { continue; } int idx = directoryString[dir_name]; if (!directoryPoint.ContainsKey(idx)) { continue; } int prev_idx = directoryPoint[idx]; Transform _parent = _viewPort; Transform tmp_content = Instantiate(_content); if (!contentInfo.ContainsKey(idx)) { tmp_content.SetParent(_viewPort); tmp_content.name = dir_name; tmp_content.localScale = new Vector3(1, 1, 1); tmp_content.GetComponent <RectTransform>().localPosition = new Vector3(0, 0, 0); tmp_content.GetComponent <RectTransform>().offsetMax = new Vector2(0, 0); tmp_content.GetChild(0).GetComponent <VoiceDirectoryButton>()._key = idx; tmp_content.GetChild(0).GetComponent <VoiceDirectoryButton>()._prev_key = prev_idx; tmp_content.gameObject.SetActive(false); contentInfo.Add(idx, tmp_content); } } StartCoroutine(MakePath(0, "")); /* * Directory 버튼 생성 */ foreach (string dir_name in directoryName) { if (!directoryString.ContainsKey(dir_name)) { continue; } int idx = directoryString[dir_name]; if (!directoryPoint.ContainsKey(idx) || !contentInfo.ContainsKey(idx) || !directoryTime.ContainsKey(idx) || !directoryTime[idx].ContainsKey(dir_name)) { continue; } int prev_idx = directoryPoint[idx]; if (!contentInfo.ContainsKey(prev_idx) || !contentInfo.ContainsKey(idx)) { continue; } if (idx == 0 && prev_idx == 0) { continue; } Transform _parent = contentInfo[prev_idx]; if (prev_idx == 0) { _parent.gameObject.SetActive(true); } GameObject tmp_btn = Instantiate(_directorySampleBtn) as GameObject; tmp_btn.name = dir_name; tmp_btn.transform.SetParent(_parent); tmp_btn.transform.GetChild(0).GetComponent <Text>().text = dir_name; tmp_btn.transform.GetChild(2).GetComponent <Text>().text = directoryTime[idx][dir_name]; tmp_btn.transform.GetComponent <VoiceDirectoryButton>()._key = idx; tmp_btn.transform.GetComponent <VoiceDirectoryButton>()._prev_key = prev_idx; tmp_btn.transform.GetComponent <VoiceDirectoryButton>()._change_btn = false; tmp_btn.SetActive(true); tmp_btn.transform.localScale = new Vector3(0.9f, 0.9f, 1); string _lower = dir_name.ToLower(); if (!_currentSearch._fileTable.ContainsKey(prev_idx)) { Dictionary <string, GameObject> sg = new Dictionary <string, GameObject>(); _currentSearch._fileTable.Add(prev_idx, sg); } if (!_currentSearch._fileTable[prev_idx].ContainsKey(_lower)) { tmp_btn = Instantiate(_directorySampleBtn) as GameObject; tmp_btn.name = _lower; tmp_btn.transform.SetParent(_current_content); tmp_btn.transform.GetChild(0).GetComponent <Text>().text = dir_name; tmp_btn.transform.GetChild(2).GetComponent <Text>().text = directoryTime[idx][dir_name]; tmp_btn.transform.GetComponent <VoiceDirectoryButton>()._key = idx; tmp_btn.transform.GetComponent <VoiceDirectoryButton>()._prev_key = prev_idx; tmp_btn.transform.GetComponent <VoiceDirectoryButton>()._change_btn = false; tmp_btn.SetActive(false); tmp_btn.transform.localScale = new Vector3(0.9f, 0.9f, 1); _currentSearch._fileTable[prev_idx].Add(_lower, tmp_btn); } if (!_allSearch._fileTable.ContainsKey(_lower)) { _allSearch._fileTable[_lower] = new List <GameObject>(); } tmp_btn = Instantiate(_directorySampleBtn) as GameObject; tmp_btn.name = _lower; tmp_btn.transform.SetParent(_all_content); tmp_btn.transform.GetChild(0).GetComponent <Text>().text = dir_name; tmp_btn.transform.GetChild(2).GetComponent <Text>().text = directoryTime[idx][dir_name]; tmp_btn.transform.GetComponent <VoiceDirectoryButton>()._key = idx; tmp_btn.transform.GetComponent <VoiceDirectoryButton>()._prev_key = prev_idx; tmp_btn.transform.GetComponent <VoiceDirectoryButton>()._change_btn = false; tmp_btn.SetActive(false); tmp_btn.transform.localScale = new Vector3(0.9f, 0.9f, 1); _allSearch._fileTable[_lower].Add(tmp_btn); } /* * file 버튼 생성 */ foreach (string dir_name in directoryName) { if (!directoryString.ContainsKey(dir_name)) { continue; } int idx = directoryString[dir_name]; if (!fileInfo.ContainsKey(idx) || !fileTime.ContainsKey(idx) || !audioInfo.ContainsKey(idx)) { continue; } Transform _parent = contentInfo[idx]; foreach (string file_name in fileInfo[idx]) { string[] tmp_name = file_name.Split('.'); if (!fileTime[idx].ContainsKey(file_name) || !audioInfo[idx].ContainsKey(tmp_name[0])) { continue; } GameObject tmp_btn = Instantiate(_fileSampleBtn) as GameObject; tmp_btn.name = file_name; tmp_btn.transform.SetParent(_parent); tmp_btn.transform.GetChild(0).GetComponent <Text>().text = file_name; tmp_btn.transform.GetChild(2).GetComponent <Text>().text = fileTime[idx][file_name]; tmp_btn.GetComponent <AudioSource>().clip = audioInfo[idx][tmp_name[0]]; tmp_btn.GetComponent <VoiceFileButton>()._key = idx; tmp_btn.GetComponent <VoiceFileButton>()._file_name = tmp_name[0]; tmp_btn.SetActive(true); tmp_btn.transform.localScale = new Vector3(0.9f, 0.9f, 1); string _lower = file_name.ToLower(); if (!_currentSearch._fileTable.ContainsKey(idx)) { Dictionary <string, GameObject> sg = new Dictionary <string, GameObject>(); _currentSearch._fileTable.Add(idx, sg); } if (!_currentSearch._fileTable[idx].ContainsKey(_lower)) { tmp_btn = Instantiate(_fileSampleBtn) as GameObject; tmp_btn.name = _lower; tmp_btn.transform.SetParent(_current_content); tmp_btn.transform.GetChild(0).GetComponent <Text>().text = file_name; tmp_btn.transform.GetChild(2).GetComponent <Text>().text = fileTime[idx][file_name]; tmp_btn.GetComponent <AudioSource>().clip = audioInfo[idx][tmp_name[0]]; tmp_btn.GetComponent <VoiceFileButton>()._key = idx; tmp_btn.GetComponent <VoiceFileButton>()._file_name = tmp_name[0]; tmp_btn.SetActive(false); tmp_btn.transform.localScale = new Vector3(0.9f, 0.9f, 1); _currentSearch._fileTable[idx].Add(_lower, tmp_btn); } if (!_allSearch._fileTable.ContainsKey(_lower)) { _allSearch._fileTable[_lower] = new List <GameObject>(); } tmp_btn = Instantiate(_fileSampleBtn) as GameObject; tmp_btn.name = _lower; tmp_btn.transform.SetParent(_all_content); tmp_btn.transform.GetChild(0).GetComponent <Text>().text = file_name; tmp_btn.transform.GetChild(2).GetComponent <Text>().text = fileTime[idx][file_name]; tmp_btn.GetComponent <AudioSource>().clip = audioInfo[idx][tmp_name[0]]; tmp_btn.GetComponent <VoiceFileButton>()._key = idx; tmp_btn.GetComponent <VoiceFileButton>()._file_name = tmp_name[0]; tmp_btn.SetActive(false); tmp_btn.transform.localScale = new Vector3(0.9f, 0.9f, 1); _allSearch._fileTable[_lower].Add(tmp_btn); } } _allSearch.root = new AllSearch.Trie(); //idxInfo.Sort(); foreach (int i in idxInfo) { if (directoryInteger.ContainsKey(i)) { _allSearch.root.insert(directoryInteger[i] + '\0', 0); } if (fileInfo.ContainsKey(i)) { foreach (string str in fileInfo[i]) { _allSearch.root.insert(str + '\0', 0); } } } }
void Start() { dir_path = Static.STATIC.dir_path; _hiddenMenuControl = GameObject.Find("HiddenMenu").GetComponent <HiddenMenuControl>(); }