void ShowOneSentence() { ClearChildContent(m_SentenceHOContent.transform); int startIndex = 0; m_SentenceHOContent.GetComponent <RectTransform>().sizeDelta = new Vector2(StartWidth, StartPosY + (Interval + ItemHeight) * m_HitObjects.Count); foreach (CO co in m_Sentences[m_CurrentSelectSentence.m_Index - 1].m_COList) { GameObject obj = Instantiate(ResourceLoadUtils.Load <GameObject>("TeachTool/HitObjectItem")); obj.transform.SetParent(m_SentenceHOContent.transform); obj.transform.localScale = Vector2.one; obj.GetComponent <RectTransform>().localPosition = new Vector3(ItemXPos, -StartPosY - (ItemHeight + Interval) * startIndex, 0); TeachHitObjectItem tho = obj.GetComponent <TeachHitObjectItem>(); tho.Init(this, TeachHitObjectItem.Type.RightBox, co.m_Index); tho.SetString(co.ToString()); startIndex++; } }
void CreateSentenceBoxContent() { ClearChildContent(m_SentenceContent.transform); int startIndex = 0; m_SentenceContent.GetComponent <RectTransform>().sizeDelta = new Vector2(StartWidth, StartPosY + (Interval + ItemHeight) * m_HitObjects.Count); foreach (CleanSentence cs in m_Sentences) { GameObject obj = Instantiate(ResourceLoadUtils.Load <GameObject>("TeachTool/HitObjectItem")); obj.transform.SetParent(m_SentenceContent.transform); obj.transform.localScale = Vector2.one; obj.GetComponent <RectTransform>().localPosition = new Vector3(ItemXPos, -StartPosY - (ItemHeight + Interval) * startIndex, 0); TeachHitObjectItem item = obj.GetComponent <TeachHitObjectItem>(); item.Init(this, TeachHitObjectItem.Type.Sentence, cs.m_Index); item.SetString(cs.ToString()); startIndex++; } }