void HandleUpdate() { timeUntilTransition -= Time.deltaTime; if (timeUntilTransition < 0) { timeLeftInTransition = transitionTime + timeUntilTransition; float percent = Mathf.Clamp01((transitionTime - timeLeftInTransition) / transitionTime); NodeInfo current = infos[currentIndex]; NodeInfo next = infos[(currentIndex + 1) % infos.Count]; if (next.node.container == null) { AddChild(next.node); } current.node.alpha = 1.0f - RXMath.GetSubPercent(percent, 0.0f, 0.55f); next.node.alpha = RXMath.GetSubPercent(percent, 0.45f, 1.0f); if (timeLeftInTransition < 0) { current.node.RemoveFromContainer(); currentIndex = (currentIndex + 1) % infos.Count; timeUntilTransition = infos[currentIndex].showDuration; } } }
private void HandleBuildInChange() { float amount = buildInTweenable.amount; handleBox.scale = RXEase.ExpoOut(RXMath.GetSubPercent(amount, 0.0f, 0.4f)); nameBox.scale = RXEase.ExpoOut(RXMath.GetSubPercent(amount, 0.15f, 0.55f)); scoreBox.scale = RXEase.ExpoOut(RXMath.GetSubPercent(amount, 0.3f, 0.7f)); minusBox.scale = RXEase.ExpoOut(RXMath.GetSubPercent(amount, 0.45f, 0.85f)) * (1.0f - _resetTweenable.amount); plusBox.scale = RXEase.ExpoOut(RXMath.GetSubPercent(amount, 0.6f, 1.0f)) * (1.0f - _resetTweenable.amount); }
private void HandleUpdate() { if (ResetGroup.instance != null) { _scoreTarget = ResetGroup.instance.zeroBox.resetAmount; } else { _scoreTarget = slot.player.score; } _easedScore += ((float)_scoreTarget - _easedScore) / 6.0f; int newScore = Mathf.RoundToInt(_easedScore); if (newScore != _displayScore) { _displayScore = newScore; _scoreLabel.text = _displayScore.ToString(); DoLayout(); } if (mathMode.amount > 0 && !_isMathMode) { _isMathMode = true; StartMathMode(); } else if (mathMode.amount == 0 && _isMathMode) { _isMathMode = false; EndMathMode(); } if (_isMathMode) { _baseLabel.alpha = RXMath.GetSubPercent(mathMode.amount, 0.4f, 1.0f); _signIcon.alpha = RXMath.GetSubPercent(mathMode.amount, 0.5f, 1.0f); _deltaLabel.alpha = RXMath.GetSubPercent(mathMode.amount, 0.6f, 1.0f); _equalsIcon.alpha = RXMath.GetSubPercent(mathMode.amount, 0.7f, 1.0f); float scorePercent = RXEase.Linear(RXMath.GetSubPercent(mathMode.amount, 0.0f, 0.8f)); float scoreTargetX = _scoreLabelFullX + (_scoreLabelCompactX - _scoreLabelFullX) * scorePercent; _scoreLabel.scale = _scoreLabelFullScale + (_scoreLabelCompactScale - _scoreLabelFullScale) * scorePercent; _scoreLabel.x += (scoreTargetX - _scoreLabel.x) * 0.5f; _deltaLabel.x += (_deltaTargetX - _deltaLabel.x) * 0.5f; _baseLabel.x += (_baseTargetX - _baseLabel.x) * 0.5f; _signIcon.x += (_signTargetX - _signIcon.x) * 0.5f; _equalsIcon.x += (_equalsTargetX - _equalsIcon.x) * 0.5f; } else { _scoreLabel.x = _scoreLabelFullX; _scoreLabel.scale = _scoreLabelFullScale; } }
void HandleDeleteModeChange() { float amount = deleteModeTweenable.amount; Cell fullCell = CellManager.GetCellFromGrid(2, 7, 2, 2); float qMarkWidth = QUESTION_MARK_WIDTH; //question mark width float skullWidth = SKULL_WIDTH; //skull width float skullPadding = Config.PADDING_M; //padding between skull and right side float innerWidth = 0; innerWidth += skullWidth; innerWidth += skullPadding; innerWidth += Config.GRID_SPACING; //grid spacing innerWidth += Config.PADDING_L; //left side text padding innerWidth += nameBox.nameLabel.textRect.width * nameBox.nameLabel.scale; innerWidth += Config.PADDING_L * nameBox.nameLabel.scale; //padding between text and question mark innerWidth += qMarkWidth * nameBox.nameLabel.scale; Debug.Log("full cell width " + fullCell.width); float remainingWidth = fullCell.width - innerWidth; float halfRemaining = remainingWidth / 2; float deleteBoxTargetWidth = Mathf.Max(CellManager.GetGridColWidth(), halfRemaining + skullWidth + skullPadding); float nameBoxTargetWidth = fullCell.width - deleteBoxTargetWidth; float deleteBoxTargetX = fullCell.x - fullCell.width / 2 + deleteBoxTargetWidth / 2; float nameBoxTargetX = fullCell.x + fullCell.width / 2 - nameBoxTargetWidth / 2; //make sure the gap is filled deleteBoxTargetWidth += 2; deleteBoxTargetX += 1; //make the delete cell fill the gap float deletePercent = RXMath.GetSubPercent(amount, 0.0f, 0.8f); float namePercent = RXMath.GetSubPercent(amount, 0.0f, 0.8f); deleteBox.x = deleteBox.anchorCell.x + (deleteBoxTargetX - deleteBox.anchorCell.x) * RXEase.ExpoInOut(deletePercent); deleteBox.width = deleteBox.anchorCell.width + (deleteBoxTargetWidth - deleteBox.anchorCell.width) * RXEase.ExpoInOut(deletePercent); nameBox.x = nameBox.anchorCell.x + (nameBoxTargetX - nameBox.anchorCell.x) * RXEase.ExpoInOut(namePercent); nameBox.width = nameBox.anchorCell.width + (nameBoxTargetWidth - nameBox.anchorCell.width) * RXEase.ExpoInOut(namePercent); Debug.Log("deleteBox x is " + deleteBox.x + " going from " + deleteBox.anchorCell.x + " to " + deleteBoxTargetX + " perc " + deletePercent); float skullPercent = RXMath.GetSubPercent(amount, 0.0f, 1.0f); float skullTargetX = deleteBoxTargetWidth / 2 - skullPadding - skullWidth / 2; deleteSkull.x = 0 + (skullTargetX - 0) * RXEase.ExpoInOut(skullPercent); deleteQMark.alpha = RXMath.GetSubPercent(amount, 0.5f, 1.0f); ////////// //ok and cancel buttons ////////// float okPercent = RXMath.GetSubPercent(amount, 0.0f, 0.3f); float okX = Config.HALF_WIDTH + okBox.anchorCell.width; okBox.x = okBox.anchorCell.x + (okX - okBox.anchorCell.x) * RXEase.ExpoInOut(okPercent); float deleteCancelPercent = RXMath.GetSubPercent(amount, 0.5f, 0.95f); float deleteOkPercent = RXMath.GetSubPercent(amount, 0.65f, 1.0f); float bottomY = -Config.HALF_HEIGHT - CellManager.GetGridRowHeight(); deleteCancelBox.y = bottomY + (deleteCancelBox.anchorCell.y - bottomY) * RXEase.ExpoOut(deleteCancelPercent); deleteOkBox.y = bottomY + (deleteOkBox.anchorCell.y - bottomY) * RXEase.ExpoOut(deleteOkPercent); }