//Coroutine######################################################################### private IEnumerator RebuildLayout(BottomUIButtonCotroller _caller) { while (true) { LayoutRebuilder.ForceRebuildLayoutImmediate(this.ButtonParent); for (int i = 0; i < this.ButtonArray.Length; ++i) { this.ButtonArray[i].UpdateButtonFrontPos(); } if (_caller.transform.localScale.x == BottomUIButtonCotroller.CLICKED_SCALE_X) { break; } yield return(null); } }
private IEnumerator MoveButtonCover(BottomUIButtonCotroller _caller) { while (true) { Vector2 moveDir = _caller.RectTransform.localPosition - this.ButtonCover.localPosition; if (_caller.transform.localScale.x == BottomUIButtonCotroller.CLICKED_SCALE_X && moveDir.magnitude <= BUTTONCOVER_MOVE_SPEED * Time.deltaTime) { this.ButtonCover.localPosition = _caller.RectTransform.localPosition; break; } this.ButtonCover.localPosition += (Vector3)moveDir * BUTTONCOVER_MOVE_SPEED * Time.deltaTime; yield return(null); } this.buttonCoverMoveCoroutine = null; }
public void SetCurrentButton(BottomUIButtonCotroller _caller) { this.currentButtonType = _caller.Type; for (int i = 0; i < this.ButtonArray.Length; ++i) { if (this.ButtonArray[i] != _caller) { this.ButtonArray[i].Declick(); } } StartCoroutine(RebuildLayout(_caller)); if (this.buttonCoverMoveCoroutine != null) { StopCoroutine(this.buttonCoverMoveCoroutine); } this.buttonCoverMoveCoroutine = StartCoroutine(MoveButtonCover(_caller)); }