private void ParseBackground(string fileData, int curIndex, out int index) { while (fileData[curIndex] != '<') { curIndex += 1; } string fileName = ReadUntilTagEnd(fileData, curIndex + 1, out curIndex); Sprite sprite = Resources.Load <Sprite>("Sprites/Conversations/Backgrounds/" + fileName); preLoadedSprites.Add(fileName, sprite); ConversationFileDataBackground data = new ConversationFileDataBackground(); data.fileName = fileName; data.firstCode = "Background"; convDatas.Add(data); index = curIndex; }
//다음 텍스트를 보이는 것과 관련된 가공을 맡는다. public void ShowText() { if (curConvIndex < convDatas.Count) { string code = convDatas[curConvIndex].firstCode; if (convText.CanBeUsed) { while (code != "Conversation" && curConvIndex < convDatas.Count) { switch (code) { case "Background": ConversationFileDataBackground data = (ConversationFileDataBackground)convDatas[curConvIndex]; Sprite sprite; preLoadedSprites.TryGetValue(data.fileName, out sprite); background.sprite = sprite; break; case "Align": convText.ClearText(); ParseAlignData(); break; case "Prefab": ParsePrefab((ConversationFileDataPrefab)convDatas[curConvIndex]); break; case "File": string link = ((ConversationFileDataFile)convDatas[curConvIndex]).fileName; InitConversationDatas(); ParseConvFile(link); ShowText(); return; case "Standing": ParseStandingCgExecute((ConversationFileDataStanding)convDatas[curConvIndex]); break; case "End": EventManager.Instance.EventEnded(); return; case "Bgm": ConversationFileDataBGM bgmData = (ConversationFileDataBGM)convDatas[curConvIndex]; SoundManager.Instance.PlayBackground(bgmData.musicName); break; default: Debug.LogError("CAN'T Parse Tag " + code); break; } curConvIndex += 1; code = convDatas[curConvIndex].firstCode; } ConversationFileDataConv convData = (ConversationFileDataConv)convDatas[curConvIndex]; if (convText.setNewString(convData.convSummary)) { string talker; talkerName.TryGetValue(convData.talkerCode, out talker); if (convData.talkerCode == -1) { Color clr = talkerBack.color; clr.a = 0; talkerBack.color = clr; } else { Color clr = talkerBack.color; clr.a = 1; talkerBack.color = clr; } talkerText.text = talker; if (convData.hasDistracter) { StartCoroutine(CorCheckDistracter(curConvIndex)); } curConvIndex += 1; } } else { convText.ShowWholeText(); } } else if (curConvIndex == convDatas.Count) { convText.ShowWholeText(); } }