public bool ReadTextData(int _chapterNum, int _sceneNum) { string chapterStr = _chapterNum < 10 ? "0" + _chapterNum.ToString() : _chapterNum.ToString(); string sceneStr = _sceneNum < 10 ? "0" + _sceneNum.ToString() : _sceneNum.ToString(); //Debug.Log("Data/Chapter" + chapterStr + "/chapter" + chapterStr + "-scene" + sceneStr); List <Dictionary <string, object> > data = CSVReader.Read("Data/Chapter" + chapterStr + "/chapter" + chapterStr + "-scene" + sceneStr); //파일이름. if (data.Count <= 0) { return(false); } List <LeftText> texts = new List <LeftText>(); //data[i]["EXP"] <이런식으로 하면 i번째 exp를 헤더로 가진 녀석이 리턴됨 for (int i = 0; i < data.Count; i++) { string postxt = data[i]["Position"].ToString(); int pos = 0; if (postxt != "") { pos = int.Parse(postxt); } LeftText tx = new LeftText(data[i]["Text"].ToString(), data[i]["Character"].ToString(), data[i]["Face"].ToString(), pos, data[i]["Background"].ToString()); texts.Add(tx); } TextPrint.instance.TextStart(texts.ToArray()); return(true); }
public void TextStart(string[] _texts) //string[]을 받고 텍스트 이벤트 자체를 실행시켜주는 함수 { #region 거의 사용안될 예정이라 접어둠 nowTextActive = true; for (int i = 0; i < _texts.Length; i++) { var leftT = new LeftText(_texts[i]); leftTextList.Add(leftT); } if (!now_TextListCoroutine_active && leftTextList.Count > 0) { StartCoroutine(TextListCoroutine()); } #endregion }
public MainPage() { InitializeComponent(); var compositor = this.Visual().Compositor; // Create background visuals. var leftBackgroundVisual = compositor.CreateSpriteVisual(); leftBackgroundVisual.Brush = compositor.CreateColorBrush(Colors.Crimson); LeftGridBackgroundVisualWrapper.SetChildVisual(leftBackgroundVisual); var middleBackgroundVisual = compositor.CreateSpriteVisual(); middleBackgroundVisual.Brush = compositor.CreateColorBrush(Colors.Gold); MiddleGridBackgroundVisualWrapper.SetChildVisual(middleBackgroundVisual); var rightBackgroundVisual = compositor.CreateSpriteVisual(); rightBackgroundVisual.Brush = compositor.CreateColorBrush(Colors.DarkOrchid); RightGridBackgroundVisualWrapper.SetChildVisual(rightBackgroundVisual); // Sync background visual dimensions. LeftGridBackgroundVisualWrapper.SizeChanged += (s, e) => leftBackgroundVisual.Size = e.NewSize.ToVector2(); MiddleGridBackgroundVisualWrapper.SizeChanged += (s, e) => middleBackgroundVisual.Size = e.NewSize.ToVector2(); RightGridBackgroundVisualWrapper.SizeChanged += (s, e) => rightBackgroundVisual.Size = e.NewSize.ToVector2(); // Enable implilcit Offset and Size animations. LeftText.EnableImplicitAnimation(VisualPropertyType.Offset, 400); MiddleText.EnableImplicitAnimation(VisualPropertyType.Offset, 400); RightText.EnableImplicitAnimation(VisualPropertyType.Offset, 400); LeftGrid.EnableImplicitAnimation(VisualPropertyType.Offset, 400); MiddleGrid.EnableImplicitAnimation(VisualPropertyType.Offset, 400); RightGrid.EnableImplicitAnimation(VisualPropertyType.Offset, 400); leftBackgroundVisual.EnableImplicitAnimation(VisualPropertyType.Size, 400); middleBackgroundVisual.EnableImplicitAnimation(VisualPropertyType.Size, 400); rightBackgroundVisual.EnableImplicitAnimation(VisualPropertyType.Size, 400); // Enable implicit Visible/Collapsed animations. LeftGrid.EnableFluidVisibilityAnimation(showFromScale: 0.6f, hideToScale: 0.8f, showDuration: 400, hideDuration: 250); MiddleGrid.EnableFluidVisibilityAnimation(showFromScale: 0.6f, hideToScale: 0.8f, showDelay: 200, showDuration: 400, hideDuration: 250); RightGrid.EnableFluidVisibilityAnimation(showFromScale: 0.6f, hideToScale: 0.8f, showDelay: 400, showDuration: 400, hideDuration: 250); }
IEnumerator TextListCoroutine() //받은 텍스트 리스트를 가지고 텍스트 자체를 출력해주는 함수 { now_TextListCoroutine_active = true; textObj.SetActive(true); textEndObj.SetActive(false); nowLeftTextIndex = 0; while (true) { if (leftTextList.Count <= 0) { break; } nowLeftText = leftTextList[nowLeftTextIndex]; if (now_TextLoop_active) { if (nowLeftTextIndex < leftTextList.Count) { nowLeftTextIndex++; } else { nowLeftTextIndex = 0; } } if (!now_TextLoop_active) { for (int i = 0; i <= nowLeftTextIndex; i++) { leftTextList.RemoveAt(0); } } if (now_TextSelect_idx != -1) // 선택지 검사 { if (nowLeftText.text.Length >= 6) { int selNum = IsThisSelectedText(nowLeftText.text); if (selNum == -1) { now_TextSelect_idx = -1; } else if (selNum == now_TextSelect_idx + 1) { nowLeftText.text = nowLeftText.text.Substring(6, nowLeftText.text.Length - 6); } else if (selNum != now_TextSelect_idx + 1) { continue; } } } if (nowLeftText.text.Length >= 1) { if (nowLeftText.text[0] == '#') //시작 글자가 #일 경우 커맨드 입력으로. { TextCommandActive(nowLeftText.text); continue; } } //배경을 설정합니다. BackgroundSet(nowLeftText.bgName); //컷씬을 표시합니다. var character = CharaOK(nowLeftText.charaName); if (character != null) { FaceImgSet(character, nowLeftText.charaFaceName, nowLeftText.charaPos); } //텍스트를 출력함. if (nowLeftText.charaName != "효과") { if (nowLeftText.text.Length > 0 && nowLeftText.text[0] == '[') // 선택지 출력 { now_TextSelect_OK = false; TextSelectCall(nowLeftText.text); yield return(new WaitUntil(() => now_TextSelect_OK)); } else // 기본 텍스트 출력 { nextText = TextCodeCommand(nowLeftText.text); if (nowLeftText.charaName == "이름없음") { nowName.text = ""; } else { nowName.text = nowLeftText.charaName; } nowText.text = ""; TextWriteInvoke(); yield return(new WaitUntil(() => !now_TextWriteInvoke_active)); yield return(new WaitUntil(() => textEndObj.activeSelf)); yield return(new WaitUntil(() => GetButtonDown)); textEndObj.SetActive(false); } } } now_TextListCoroutine_active = false; textObj.SetActive(false); nowTextActive = false; }