public void OnTabDragging(TabButton tab, PointerEventData eventData) { int index = tabButtons_.IndexOf(tab); tab.transform.localPosition += new Vector3(0, eventData.delta.y); if (tab.transform.localPosition.y > 0) { tab.transform.localPosition = new Vector3(tab.transform.localPosition.x, 0); } float tabmax = -(tabButtons_.Count * DesiredTabHeight); if (tab.transform.localPosition.y < tabmax) { tab.transform.localPosition = new Vector3(tab.transform.localPosition.x, tabmax); } int desiredIndex = Mathf.Clamp((int)(-tab.transform.localPosition.y / DesiredTabHeight), 0, tabButtons_.Count - 1); if (index != desiredIndex) { tabButtons_.Remove(tab); tabButtons_.Insert(desiredIndex, tab); int sign = (int)Mathf.Sign(desiredIndex - index); for (int i = index; i != desiredIndex; i += sign) { AnimManager.AddAnim(tabButtons_[i].gameObject, GetTabPosition(tabButtons_[i]), ParamType.Position, AnimType.Time, GameContext.Config.AnimTime); } } }
public void AdjustLayout(Direction dir = Direction.XY) { if (Binding != null) { AnimManager.AddAnim(Binding, CalcTargetPosition(dir), ParamType.Position, AnimType.Time, GameContext.Config.AnimTime); } }
public void OnDoneChanged(TaggedLine taggedLine) { // move to target position if (taggedLine.IsDone) { if (lines_.Contains(taggedLine)) { int index = lines_.IndexOf(taggedLine); lines_.Remove(taggedLine); doneLines_.Insert(0, taggedLine); AnimLinesToTargetPosition(index, lines_.Count - 1); AnimManager.AddAnim(taggedLine, GetTargetPosition(taggedLine), ParamType.Position, AnimType.Time, GameContext.Config.AnimTime); taggedLine.transform.SetAsLastSibling(); } } else { if (doneLines_.Contains(taggedLine)) { int index = doneLines_.IndexOf(taggedLine); doneLines_.Remove(taggedLine); lines_.Add(taggedLine); AnimDoneLinesToTargetPosition(0, index - 1); AnimManager.AddAnim(taggedLine, GetTargetPosition(taggedLine), ParamType.Position, AnimType.Time, GameContext.Config.AnimTime); taggedLine.transform.SetAsLastSibling(); } } }
public void OnDoneChanged(bool withAnim = true) { if (IsDone) { strikeLine_.gameObject.SetActive(true); checkMark_.gameObject.SetActive(true); listMark_.SetColor(Color.clear); UpdateStrikeLine(); if (withAnim) { strikeLine_.Rate = 0.0f; AnimManager.AddAnim(strikeLine_, 1.0f, ParamType.GaugeRate, AnimType.Time, 0.15f); checkMark_.Check(); } } else { strikeLine_.gameObject.SetActive(false); checkMark_.gameObject.SetActive(false); listMark_.SetColor(Color.black); } SetColor(GetTargetColor()); tagParent_.OnDoneChanged(this); }
public void OnDraggingLine(TaggedLine taggedLine, PointerEventData eventData) { if (lines_.Contains(taggedLine)) { int index = lines_.IndexOf(taggedLine); taggedLine.transform.localPosition += new Vector3(0, eventData.delta.y, 0); float currentY = -(taggedLine.transform.localPosition.y - this.transform.localPosition.y); bool overed = currentY < -GameContext.TagList.Margin || Height + GameContext.TagList.Margin < currentY; GameContext.TagList.OnOverDraggingLine(taggedLine, eventData, overed); if (-GameContext.TagList.Margin < currentY && currentY < Height + GameContext.TagList.Margin) { int desiredIndex = Mathf.Clamp((int)(currentY / GameContext.Config.TagLineHeight), 0, lines_.Count - 1); if (index != desiredIndex) { lines_.Remove(taggedLine); lines_.Insert(desiredIndex, taggedLine); int sign = (int)Mathf.Sign(desiredIndex - index); for (int i = index; i != desiredIndex; i += sign) { AnimManager.AddAnim(lines_[i], GetTargetPosition(lines_[i]), ParamType.Position, AnimType.Time, GameContext.Config.AnimTime); } } } } }
public void SetIsDone(bool isDone, bool withAnim = true) { strikeLine_.gameObject.SetActive(isDone && BindedLine.IsClone == false); checkMark_.gameObject.SetActive(false); Foreground = GetDesiredTextColor(); if (isDone) { //listMark_.gameObject.SetActive(false); OnTextLengthChanged(); if (withAnim) { if (BindedLine.IsClone == false) { strikeLine_.Rate = 0.0f; AnimManager.AddAnim(strikeLine_, 1.0f, ParamType.GaugeRate, AnimType.Time, 0.15f); } checkMark_.Check(); } foreach (TagText tagText in tagTexts_) { BindedLine.Tree.TagHeapManager.BackToHeap(tagText); } tagTexts_.Clear(); } }
public void AdjustLayoutRecursive(int startIndex = 0, Predicate <Line> predToBreak = null) { if (0 <= startIndex && startIndex < Count) { Vector3 target = children_[startIndex].CalcTargetPosition(); float heightPerLine = GameContext.Config.HeightPerLine; for (int i = startIndex; i < Count; ++i) { if (predToBreak != null && predToBreak(children_[i])) { return; } if (children_[i].Field != null) { if (target == children_[i].Field.transform.localPosition && AnimManager.IsAnimating(children_[i].Binding) == false) { // これ以下は高さが変わっていないので、再計算は不要 return; } children_[i].TargetPosition = target; AnimManager.AddAnim(children_[i].Binding, target, ParamType.Position, AnimType.Time, GameContext.Config.AnimTime); } target.y -= (1 + children_[i].VisibleChildCount) * heightPerLine; } } if (parent_ != null) { parent_.AdjustLayoutRecursive(Index + 1, predToBreak); } }
public void OnEndDragTag(TagParent tagParent) { if (tagParents_.Contains(tagParent)) { AddTagOrder(tagParent.Tag, tagParents_.IndexOf(tagParent)); AnimManager.AddAnim(tagParent, GetTargetPosition(tagParent), ParamType.Position, AnimType.Time, GameContext.Config.AnimTime); } }
public void OnBeginDragTag(TagParent tagParent) { if (tagParents_.Contains(tagParent)) { AnimManager.AddAnim(tagParent, WidthMargin + 5.0f, ParamType.PositionX, AnimType.Time, GameContext.Config.AnimTime); tagParent.transform.SetAsLastSibling(); } }
public void Check() { Line1.Rate = 0; Line2.Rate = 0; AnimManager.AddAnim(Line1, 1.0f, ParamType.GaugeRate, AnimType.Time, 0.05f); AnimManager.AddAnim(Line2, 1.5f, ParamType.GaugeRate, AnimType.Time, 0.1f, 0.05f); AnimManager.AddAnim(Line2, 1.0f, ParamType.GaugeRate, AnimType.Time, 0.05f, 0.15f); }
public void SetGravityPoint(float power) { Gravity = power; AnimManager.AddAnim(Current, Gravity / MaxGravity, ParamType.GaugeRate, AnimType.Time, 0.1f); AnimManager.AddAnim(Next, Gravity / MaxGravity, ParamType.GaugeRate, AnimType.Time, 0.1f); AnimManager.AddAnim(Prev, Gravity / MaxGravity, ParamType.GaugeRate, AnimType.Time, 0.1f, 0.5f); OldGravity = Gravity; }
public void Close() { isOpened_ = false; OpenButton.transform.parent.gameObject.SetActive(true); CloseButton.transform.parent.gameObject.SetActive(false); AnimManager.RemoveOtherAnim(scrollRect_); AnimManager.AddAnim(scrollRect_, -1, ParamType.SizeDeltaX, AnimType.BounceOut, 0.2f); GameContext.Window.OnHeaderWidthChanged(); RemoveAllDones(); }
public void Open() { isOpened_ = true; OpenButton.transform.parent.gameObject.SetActive(false); CloseButton.transform.parent.gameObject.SetActive(true); AnimManager.RemoveOtherAnim(scrollRect_); AnimManager.AddAnim(scrollRect_, GameContext.Config.TagListWidth, ParamType.SizeDeltaX, AnimType.Time, 0.1f); GameContext.Window.OnHeaderWidthChanged(); RemoveAllDones(); }
public void RemoveTaggedLine(TaggedLine taggedLine) { bool needSelectionUpdate = false; if (taggedLine == selectedLine_) { needSelectionUpdate = true; } int index = lines_.IndexOf(taggedLine); if (index >= 0) { lines_.Remove(taggedLine); } else { index = 0; } AnimLinesToTargetPosition(index, lines_.Count - 1); index = doneLines_.IndexOf(taggedLine); if (index >= 0) { doneLines_.Remove(taggedLine); } else { index = 0; } AnimDoneLinesToTargetPosition(index, doneLines_.Count - 1); if (isPinned_ || lines_.Count > 0 || doneLines_.Count > 0) { float animTime = 0.2f; float delayTime = 0.0f; if (taggedLine.IsDoneAnimating) { delayTime = 0.2f; } AnimManager.AddAnim(taggedLine, 0.0f, ParamType.AlphaColor, AnimType.Time, animTime, delay: delayTime, endOption: AnimEndOption.Deactivate); if (needSelectionUpdate) { UpdateSelection(taggedLine.BindedLine.IsDone ? doneLines_ : lines_); } } else { OnLineDisabled(taggedLine); GameContext.TagList.OnTagEmpty(this); } GameContext.TagList.UpdateLayoutElement(); }
public void SetColor(Color color, float animTime) { if (animTime > 0) { AnimManager.AddAnim(gameObject, color, ParamType.Color, AnimType.Time, animTime); } else { SetColor(color); } }
protected override void OnFocused() { if (isEditing_ == false) { isEditing_ = true; underLine_.gameObject.SetActive(true); underLine_.SetColor(Foreground); underLine_.Rate = 0.0f; AnimManager.AddAnim(underLine_, 1.0f, ParamType.GaugeRate, AnimType.Time, 0.15f); AnimManager.AddAnim(this, 0.4f, ParamType.TextAlphaColor, AnimType.Time, 0.15f); } }
public void SetWidth(float width, float animTime = 0) { if (animTime > 0) { AnimManager.AddAnim(gameObject, width, ParamType.GaugeWidth, AnimType.Time, animTime); } else { Width = width; SetVerticesDirty(); } }
public void SetRate(float rate, float animTime = 0) { if (animTime > 0) { AnimManager.AddAnim(gameObject, rate, ParamType.GaugeRate, AnimType.Time, animTime); } else { Rate = rate; SetVerticesDirty(); } }
public void SetLength(float length, float animTime = 0) { if (animTime > 0) { AnimManager.AddAnim(gameObject, length, ParamType.GaugeLength, AnimType.Time, animTime); } else { Length = length; SetVerticesDirty(); } }
public void SetColor(Color color, float animTime) { if (animTime > 0) { AnimManager.AddAnim(gameObject, color, ParamType.Color, AnimType.Time, animTime); } else { LineColor = color; LineMesh.GetComponent <Renderer>().material.color = LineColor; } }
public void AdjustLayoutInChildren() { if (Count > 0) { Vector3 target = children_[0].CalcTargetPosition(); for (int i = 0; i < Count; ++i) { if (children_[i].Binding != null) { children_[i].TargetPosition = target; AnimManager.AddAnim(children_[i].Binding, target, ParamType.Position, AnimType.Time, GameContext.Config.AnimTime); } target.y -= (1 + children_[i].VisibleChildCount) * GameContext.Config.HeightPerLine; } } }
public void Saved() { if (isSaving_) { isSaving_ = false; Text = "saved!"; AnimManager.AddAnim(textComponent_, 0.0f, ParamType.TextAlphaColor, AnimType.Time, 0.6f, 0.2f); check_.gameObject.SetActive(true); AnimManager.RemoveOtherAnim(check_); check_.Check(); AnimManager.AddAnim(check_, 0.0f, ParamType.AlphaColor, AnimType.Time, 0.6f, initValue: 1.0f); circle_.gameObject.SetActive(false); AnimManager.RemoveOtherAnim(circle_); } }
public void StartSaving() { if (isSaving_ == false) { isSaving_ = true; this.gameObject.SetActive(true); Text = "saving..."; AnimManager.RemoveOtherAnim(textComponent_); AnimManager.AddAnim(textComponent_, 1.0f, ParamType.TextAlphaColor, AnimType.Time, 0.0f); circle_.gameObject.SetActive(true); AnimManager.RemoveOtherAnim(circle_); AnimManager.AddAnim(circle_, 360.0f, ParamType.RotationZ, AnimType.Time, 1.0f, endOption: AnimEndOption.Loop, initValue: 0.0f); check_.gameObject.SetActive(false); AnimManager.RemoveOtherAnim(check_); } }
void AnimDoneLinesToTargetPosition(int startIndex, int endIndex) { if (startIndex > endIndex) { int start = endIndex; endIndex = startIndex; startIndex = start; } if (startIndex < 0 || doneLines_.Count <= endIndex) { return; } for (int i = startIndex; i <= endIndex; ++i) { AnimManager.RemoveOtherAnim(doneLines_[i], ParamType.Position); AnimManager.AddAnim(doneLines_[i], GetTargetPosition(doneLines_[i]), ParamType.Position, AnimType.Time, GameContext.Config.AnimTime); } }
public void OnEndDragLine(TaggedLine taggedLine) { if (lines_.Contains(taggedLine)) { float currentY = -(taggedLine.transform.localPosition.y - this.transform.localPosition.y); bool overed = currentY < -GameContext.TagList.Margin || Height + GameContext.TagList.Margin < currentY; if (overed) { selectedLine_ = null; selectedIndex_ = -1; } else { taggedLine.transform.parent = LineParent.transform; selectedIndex_ = lines_.IndexOf(taggedLine); AnimManager.AddAnim(taggedLine, GetTargetPosition(taggedLine), ParamType.Position, AnimType.Time, GameContext.Config.AnimTime); } GameContext.TagList.OnEndOverDragLine(taggedLine, overed); } }
public void UpdateLayoutElement() { float sum = TopMargin; for (int i = 0; i < tagParents_.Count; ++i) { AnimManager.AddAnim(tagParents_[i], new Vector3(WidthMargin, -sum), ParamType.Position, AnimType.Time, GameContext.Config.AnimTime); sum += tagParents_[i].Height; if (i == tagOvelayDesiredIndex_) { TagMoveOverlay.transform.localPosition = new Vector3(0, -sum - GameContext.Config.TagLineHeight / 2); sum += GameContext.Config.TagLineHeight; } sum += Margin; } TagMoveOverlay.SetActive(tagOvelayDesiredIndex_ >= 0); layout_.preferredHeight = sum; contentSizeFitter_.SetLayoutVertical(); }
public void OnDraggingTag(TagParent tagParent, PointerEventData eventData) { if (tagParents_.Contains(tagParent)) { int index = tagParents_.IndexOf(tagParent); tagParent.transform.localPosition += new Vector3(0, eventData.delta.y, 0); int desiredIndex = GetDesiredTagIndex(tagParent.transform.localPosition.y); if (index != desiredIndex) { tagParents_.Remove(tagParent); tagParents_.Insert(desiredIndex, tagParent); int sign = (int)Mathf.Sign(desiredIndex - index); for (int i = index; i != desiredIndex; i += sign) { AnimManager.AddAnim(tagParents_[i], GetTargetPosition(tagParents_[i]), ParamType.Position, AnimType.Time, GameContext.Config.AnimTime); } } } }
IEnumerator AnimToTargetVisualCoroutine() { yield return(new WaitForEndOfFrame()); if (textField_ != null && textField_.BindedLine != null) { this.interactable = textField_ != null && textField_.BindedLine.Count > 0; (targetGraphic as UIMidairPrimitive).SetColor(TargetColor); targetGraphic.CrossFadeColor(Color.white, 0, true, true); AnimManager.AddAnim(targetGraphic, interactable && isOn ? 0 : 90, ParamType.RotationZ, AnimType.Time, GameContext.Config.AnimTime); if (verticalLine_ != null) { float lineHeight = 0; if (textField_ != null) { lineHeight = textField_.BindedLine.VisibleChildCount * GameContext.Config.HeightPerLine; } AnimManager.AddAnim(verticalLine_, lineHeight, ParamType.GaugeLength, AnimType.Time, GameContext.Config.AnimTime); verticalLine_.rectTransform.sizeDelta = new Vector2(1, lineHeight); } } wasAnimRequested_ = false; }
private void OnTextEdited() { if (isEditing_) { isEditing_ = false; AnimManager.AddAnim(underLine_, 0.0f, ParamType.GaugeRate, AnimType.BounceOut, 0.15f, endOption: AnimEndOption.Deactivate); int newDate = -1; if (int.TryParse(text, out newDate)) { if (1 <= newDate && newDate <= 31) { DateTime newDateTime = new DateTime(dateUI_.Date.Year, dateUI_.Date.Month, newDate, dateUI_.Date.Hour, dateUI_.Date.Minute, dateUI_.Date.Second); if (newDateTime < DateTime.Today) { dateUI_.OnDateChanged(newDateTime); } else { newDate = -1; } } else { newDate = -1; } } if (newDate < 0) { text = dateUI_.Date.Day.ToString(); AnimManager.AddAnim(this, 1.0f, ParamType.TextAlphaColor, AnimType.Time, 0.15f); } } }
public void AnimToTargetVisual() { (targetGraphic as UIMidairPrimitive).SetColor(TargetColor); targetGraphic.CrossFadeColor(Color.white, 0, true, true); AnimManager.AddAnim(targetGraphic, interactable && isOn ? 0 : 90, ParamType.RotationZ, AnimType.Time, GameContext.Config.AnimTime); }