IEnumerator UpdateTextLengthCoroutine() { yield return(new WaitForEndOfFrame()); TextGenerator gen = textComponent_.cachedTextGenerator; float charLength = gen.characters[gen.characters.Count - 1].cursorPos.x - gen.characters[0].cursorPos.x; float maxWidth = GameContext.Config.TagListWidth - GameContext.Config.TagCommaInterval; if (charLength > maxWidth) { int maxCharCount = 0; for (int i = 1; i < gen.characters.Count; ++i) { if (maxWidth < gen.characters[i].cursorPos.x - gen.characters[0].cursorPos.x) { maxCharCount = i - 1; charLength = gen.characters[i - 1].cursorPos.x - gen.characters[0].cursorPos.x; break; } } Text = Text.Substring(0, maxCharCount) + "..."; } strikeLine_.SetLength(charLength); shouldUpdateTextLength_ = false; }
protected override void OnUpdatedTextRectLength() { float charLength = GetFullTextRectLength(); if (BindedLine.IsComment == false && strikeLine_.gameObject.activeInHierarchy) { strikeLine_.SetLength(charLength + 5); } checkMark_.gameObject.SetActive(BindedLine.IsDone); if (checkMark_.gameObject.activeSelf) { checkMark_.SetPositionX(charLength); } float rectHeight = RectHeight; foreach (TagText tagText in tagTexts_) { int index = text.LastIndexOf(tagText.Text); float x = GetTextRectLength(index - 1); tagText.Rect.anchoredPosition = new Vector2(x + textComponent.rectTransform.offsetMin.x, 0); float width = GetTextRectLength(index + tagText.Text.Length - 1) - x; tagText.Rect.sizeDelta = new Vector2(width, rectHeight); } }
protected override void UpdateAnimValue() { if (gauge_ != null) { switch (Param) { case ParamType.GaugeLength: gauge_.Length = currentValueFloat; break; case ParamType.GaugeRate: gauge_.SetRate(currentValueFloat); break; case ParamType.GaugeWidth: gauge_.SetWidth(currentValueFloat); break; } } else if (uigauge_ != null) { switch (Param) { case ParamType.GaugeLength: uigauge_.SetLength(currentValueFloat); break; case ParamType.GaugeRate: uigauge_.SetRate(currentValueFloat); break; case ParamType.GaugeWidth: uigauge_.SetWidth(currentValueFloat); break; } } }