IEnumerator HandleAsyncLogin() { uiLoginPanel.gameObject.SetActive(true); yield return(TweenManager.AddTween(panelShowTween.CreateTransition(step => { uiLoginPanel.anchoredPosition3D = Vector3.LerpUnclamped(new Vector2(0, 5000), new Vector3(560, 80, -70), step); }))); if (!string.IsNullOrEmpty(PlayerPrefs.GetString("friend_name", ""))) { uiLoginNameInput.text = PlayerPrefs.GetString("friend_name"); uiLoginPassInput.text = PlayerPrefs.GetString("friend_pass"); OnLoginButtonClicked(); } isLoginFinished = false; // eventSystem.enabled = true; // pointer.SetActive(true); while (!isLoginFinished) { yield return(null); } // eventSystem.enabled = false; // pointer.SetActive(false); yield return(TweenManager.AddTween(panelHideTween.CreateTransition(step => { uiLoginPanel.anchoredPosition3D = Vector3.LerpUnclamped(new Vector3(560, 80, -70), new Vector2(0, -5000), step); }))); uiLoginPanel.gameObject.SetActive(false); }
public static void Flash(FlashFxConfig config, Vector3 position) { Light light = null; foreach (var canditate in lightList) { if (!canditate.enabled) { light = canditate; light.enabled = true; break; } } if (light == null) { var go = new GameObject("FlashLight", typeof(Light)); light = go.GetComponent <Light>(); light.transform.parent = Instance.transform; lightList.Add(light); } light.transform.position = position; light.color = config.color; light.intensity = config.intensity; light.range = config.range; TweenManager.AddTween(new Tween(config.tween.duration, config.tween.easingType, config.tween.easingPhase, step => { light.intensity = Mathf.Lerp(config.intensity, 0, step); }, () => { light.enabled = false; })); }
public void SetResults( string title, string version, string acc, bool isScoreNew, int score, int perfect, int great, int good, int bad, int miss, bool isComboNew, int combo, bool isFullCombo) { acc = acc.Replace(" ", ""); StringLerp titleLerp = new StringLerp("", title), versionLerp = new StringLerp("", version.ToUpper()), accLerp = new StringLerp("0<size=15>%</size>", acc.Insert(acc.Length - 1, "<size=15>") + "</size>"), scoreLerp = new StringLerp("0", score.ToString()), perfectLerp = new StringLerp("0", perfect.ToString()), greatLerp = new StringLerp("0", great.ToString()), goodLerp = new StringLerp("0", good.ToString()), badLerp = new StringLerp("0", bad.ToString()), missLerp = new StringLerp("0", miss.ToString()), comboLerp = new StringLerp("0", combo.ToString()); uiScoreNewText.gameObject.SetActive(isScoreNew); uiComboNewText.gameObject.SetActive(isComboNew); uiFullComboText.gameObject.SetActive(isFullCombo); uiRankText.text = "--"; TweenManager.AddTween(tween.CreateTransition(step => { uiTitleText.text = titleLerp.Lerp(step); uiVersionText.text = versionLerp.Lerp(step); uiAccText.text = accLerp.Lerp(step); uiScoreText.text = scoreLerp.Lerp(step); uiPerfectText.text = perfectLerp.Lerp(step); uiGreatText.text = greatLerp.Lerp(step); uiGoodText.text = goodLerp.Lerp(step); uiBadText.text = badLerp.Lerp(step); uiMissText.text = missLerp.Lerp(step); uiComboText.text = comboLerp.Lerp(step); })); }
void Start() { Instance = this; uiScoreTextTween.isDead = true; uiScoreTextTween.doStayAlive = true; uiScoreTextTween.SetTransition(step => { float size = 1.5f + (1f - step) * 1f; uiScoreText.transform.localScale = new Vector3(size, size, size); }); TweenManager.AddTween(uiScoreTextTween, false); uiComboTextTween.isDead = true; uiComboTextTween.doStayAlive = true; uiComboTextTween.SetTransition(step => { float size = 1f + (1f - step) * 0.2f; uiComboText.transform.localScale = new Vector3(size, size, size); }); TweenManager.AddTween(uiComboTextTween, false); uiIncTextTween.isDead = true; uiIncTextTween.doStayAlive = true; uiIncTextTween.SetTransition(step => { // float size = 1.5f + (1f - step) * 0.2f; float size = (1f - step) * 1.5f; uiIncText.transform.localScale = new Vector3(size, size, size); }); TweenManager.AddTween(uiIncTextTween, false); }
void Start() { textChangeTween.isDead = true; textChangeTween.doStayAlive = true; TweenManager.AddTween(textChangeTween.SetTransition(step => { for (int i = 0; i < rankCol.Length && i < rankColLerps.Length; i++) { if (rankColLerps[i] != null) { rankCol[i].text = rankColLerps[i].Lerp(step); } } for (int i = 0; i < nameCol.Length && i < nameColLerps.Length; i++) { if (nameColLerps[i] != null) { nameCol[i].text = nameColLerps[i].Lerp(step); } } for (int i = 0; i < scoreCol.Length && i < scoreColLerps.Length; i++) { if (scoreColLerps[i] != null) { scoreCol[i].text = scoreColLerps[i].Lerp(step); } } }), false); }
IEnumerator HandleCloseHintPanel() { yield return(Wait(5)); TweenManager.AddTween(new Tween(4, Uif.EasingType.Circ, Uif.EasingPhase.In, step => { uiHintPanel.anchoredPosition3D = Vector3.LerpUnclamped(Vector3.zero, new Vector3(0, 0, 10000), step); }, () => uiHintPanel.gameObject.SetActive(false))); }
public void SetRank(string rank) { var rankLerp = new StringLerp("0<size=10>" + rank.Substring(rank.Length - 2).ToUpper() + "</size>", rank.ToUpper().Insert(rank.Length - 2, "<size=10>") + "</size>"); TweenManager.AddTween(tween.CreateTransition(step => { uiRankText.text = rankLerp.Lerp(step); })); }
IEnumerator Start() { eventSystem.enabled = false; yield return(Wait(2)); uiWelcomePanel.gameObject.SetActive(true); yield return(TweenManager.AddTween(panelShowTween.CreateTransition(step => { uiWelcomePanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 5000), new Vector2(0, 0), step); }))); yield return(Wait(2)); yield return(TweenManager.AddTween(panelHideTween.CreateTransition(step => { uiWelcomePanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 0), new Vector2(0, -5000), step); }))); uiWelcomePanel.gameObject.SetActive(false); uiLoginPanel.gameObject.SetActive(true); yield return(TweenManager.AddTween(panelShowTween.CreateTransition(step => { uiLoginPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 5000), new Vector2(0, 80), step); }))); eventSystem.enabled = true; while (!isLoginFinished) { yield return(null); } eventSystem.enabled = false; yield return(TweenManager.AddTween(panelHideTween.CreateTransition(step => { uiLoginPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 80), new Vector2(0, -5000), step); }))); uiLoginPanel.gameObject.SetActive(false); uiSongPanel.gameObject.SetActive(true); yield return(TweenManager.AddTween(panelShowTween.CreateTransition(step => { uiSongPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 5000), new Vector2(0, 0), step); }))); eventSystem.enabled = true; while (!isSongSelectFinished) { yield return(null); } eventSystem.enabled = false; yield return(TweenManager.AddTween(panelHideTween.CreateTransition(step => { uiSongPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 0), new Vector2(0, -5000), step); }))); uiSongPanel.gameObject.SetActive(false); uiCamera.enabled = false; }
} //END Start //--------------------------------------------// private void AddToTweenManager() //--------------------------------------------// { //Check if this tween needs to be added to the TweenManager //This can happen when a tween is created outside of the TweenManager system by //dropping a bxrTween component onto gameObject or by using a BlockEvent TweenManager.AddTween( this ); } //END AddToTweenManager
public virtual void Start() { // dont add ourself twice! if (_isCurrentlyManagedByTweenManager) { _isPaused = false; return; } TweenManager.AddTween(this); _isCurrentlyManagedByTweenManager = true; _isPaused = false; }
IEnumerator Start() { eventSystem.enabled = false; yield return(Wait(1)); uiWelcomePanel.gameObject.SetActive(true); yield return(TweenManager.AddTween(panelShowTween.CreateTransition(step => { uiWelcomePanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 5000), new Vector2(0, 0), step); }))); // yield return Wait(1); TweenManager.AddTween(panelHideTween.CreateTransition(step => { uiWelcomePanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 0), new Vector2(0, -5000), step); })); uiWelcomePanel.gameObject.SetActive(false); SONG_SELECT: uiSongPanel.gameObject.SetActive(true); yield return(TweenManager.AddTween(panelShowTween.CreateTransition(step => { uiSongPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 5000), new Vector2(0, 0), step); }))); uiSongPanel.GetComponent <SongUiController>().FetchProgress(); if (!isLoginFinished) { StartCoroutine(HandleAsyncLogin()); } eventSystem.enabled = true; pointer.SetActive(true); isSongSelectFinished = false; selectedFileType = -1; while (!isSongSelectFinished) { yield return(null); } eventSystem.enabled = false; pointer.SetActive(false); yield return(TweenManager.AddTween(panelHideTween.CreateTransition(step => { uiSongPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 0), new Vector2(0, -5000), step); }))); if (!isLoginFinished) { OnLoginCancelButtonClicked(); } uiSongPanel.gameObject.SetActive(false); // uiCamera.enabled = false; uiRankPanel.gameObject.SetActive(true); uiScorePanel.gameObject.SetActive(true); uiHintPanel.gameObject.SetActive(true); rankPanelController.SetRank(new RankInfo[0]); yield return(TweenManager.AddTween(panelShowTween.CreateTransition(step => { uiRankPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 5000), new Vector2(-400, 0), step); uiScorePanel.anchoredPosition3D = Vector3.LerpUnclamped(new Vector3(0, 5000, 0), new Vector3(0, 70, 100), step); uiHintPanel.anchoredPosition3D = Vector3.LerpUnclamped(new Vector3(0, 0, 5000), Vector3.zero, step); }))); StartCoroutine(HandleCloseHintPanel()); rank.name = GlobalStatic.Name; rank.rank = "--"; rank.score = 0; ranks.Clear(); ranks.Add(rank); rankPanelController.SetRank(ranks.ToArray()); LiveNote[] notes = null; if (selectedFileType == 0) { notes = osuFile.GetLiveNotes((x, y) => new Vector2((x - 0.5f) * 4, y * 1.5f - 0.5f)); musicPlayer.Play(System.IO.Path.Combine(osuFile.path, osuFile.AudioFilename)); } else // selectedFileType == 1 { using (var mapAsset = new FResource <TextAsset>("maps/" + live.map_path.Replace(".json", ""))) { var map = JsonUtility.FromJson <ApiLiveMap>(mapAsset.asset.text); System.Array.Sort(map.lane); notes = map.GetLiveNotes((x, _) => LlpLiveStarter.slots[Mathf.RoundToInt(x)] * 0.75f, 2); } musicPlayer.Play(System.IO.Path.Combine(Application.persistentDataPath, live.bgm_path)); } livePlayer.notes = notes; livePlayer.StartGame(); SONG_START: uiErrorText.text = ""; StartCoroutine(HandleRankInit()); isSongFinished = false; while (!isSongFinished) { yield return(null); } yield return(TweenManager.AddTween(panelHideTween.CreateTransition(step => { uiRankPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(-400, 0), new Vector2(0, 5000), step); uiScorePanel.anchoredPosition3D = Vector3.LerpUnclamped(new Vector3(0, 70, 100), new Vector3(0, 5000, 0), step); }))); uiResultPanel.gameObject.SetActive(true); acc = (300f * livePlayer.perfect + 200f * livePlayer.great + 100f * livePlayer.good + 50f * livePlayer.bad) / (300f * livePlayer.total); resultPanelUiController.SetResults(mapName, mapVersion, acc.ToString("P0"), false, livePlayer.score, livePlayer.perfect, livePlayer.great, livePlayer.good, livePlayer.bad, livePlayer.miss, false, livePlayer.maxCombo, livePlayer.maxCombo >= livePlayer.total); yield return(TweenManager.AddTween(panelShowTween.CreateTransition(step => { uiResultPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 5000), new Vector2(0, 0), step); }))); if (GlobalStatic.IsLoggedIn) { StartCoroutine(HandleSubmitResult()); } willRetry = willShowMenu = false; eventSystem.enabled = true; pointer.SetActive(true); // uiCamera.enabled = true; while (!willRetry && !willShowMenu) { yield return(null); } // uiCamera.enabled = false; eventSystem.enabled = false; pointer.SetActive(false); yield return(TweenManager.AddTween(panelHideTween.CreateTransition(step => { uiResultPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 0), new Vector2(0, 5000), step); }))); if (willRetry) { livePlayer.StartGame(); MusicPlayer.Restart(); yield return(TweenManager.AddTween(panelShowTween.CreateTransition(step => { uiRankPanel.anchoredPosition = Vector2.LerpUnclamped(new Vector2(0, 5000), new Vector2(-400, 0), step); uiScorePanel.anchoredPosition3D = Vector3.LerpUnclamped(new Vector3(0, 5000, 0), new Vector3(0, 70, 100), step); }))); goto SONG_START; } else { goto SONG_SELECT; } }
void KillBlock(LiveBlock block) { double offset = Math.Abs(block.startTime - MusicPlayer.LiveTime); if (offset <= TimeGood) { combo += 1; if (combo > maxCombo) { maxCombo = combo; } } else { combo = 0; } float inc = block.isParallel ? BaseParaScore : BaseNormalScore; inc *= GetScoreOffsetAddon(offset) * GetScoreComboAddon(combo); score += (int)inc; AudioFxConfig audioConfig; Material material; string text; // float scale; if (offset <= TimePerfect) { // scale = 2; material = perfectMaterial; text = perfectText; audioConfig = block.isLong ? specialAudioConfigs[Random.Range(0, specialAudioConfigs.Length)] : perfectAudioConfigs[Random.Range(0, perfectAudioConfigs.Length)]; } else if (offset <= TimeGreat) { // scale = 1.5f; material = greatMaterial; text = greatText; audioConfig = greatAudioConfigs[Random.Range(0, greatAudioConfigs.Length)]; } else if (offset <= TimeGood) { // scale = 1; material = goodMaterial; text = goodText; audioConfig = goodAudioConfigs[Random.Range(0, goodAudioConfigs.Length)]; } else // if (offset <= TimeBad) // scale = 0.5f; { material = badMaterial; text = badText; audioConfig = badAudioConfigs[Random.Range(0, badAudioConfigs.Length)]; } var blockPosition = block.transform.position; hitParticleFxPreset.configs[0].count = combo << 1; // 0th must be CubeCoin ParticleFxPool.Emit(hitParticleFxPreset, blockPosition, block.transform.rotation); FlashFxPool.Flash(hitFlashFxConfig, blockPosition); AudioFxPool.Play(audioConfig, blockPosition); uiScoreText.material = material; uiIncText.material = material; uiComboText.material = material; uiScoreText.text = score.ToString("N0"); uiIncText.text = "+" + inc.ToString("N0"); uiComboText.text = string.Format(combo == 0 ? "x {0:N0} x" : combo == maxCombo ? "^ {0:N0} ^" : "+ {0:N0} +", combo); uiScoreTextTween.isDead = false; uiScoreTextTween.time = 0; uiComboTextTween.isDead = false; uiComboTextTween.time = 0; uiIncTextTween.isDead = false; uiIncTextTween.time = 0; block.Die(); block.uiComboText.material = material; block.uiJudgeText.material = material; block.uiScoreText.material = material; block.uiScoreText.text = string.Format("+{0:N0}", inc); block.uiJudgeText.text = text; if (combo > 10) { block.uiComboText.text = string.Format("{0:N0}", combo); } TweenManager.AddTween(new Tween(recycleInterval, textTween.easingType, textTween.easingPhase, step => { float inverse = (1f - step); // * scale; var size = new Vector3(inverse, inverse, inverse); // block.uiScoreText.color = new Color(1, 1, 1, inverse); // block.uiJudgeText.color = new Color(1, 1, 1, inverse); // block.uiComboText.color = new Color(1, 1, 1, inverse); block.uiScoreText.transform.localScale = size; block.uiJudgeText.transform.localScale = size; block.uiComboText.transform.localScale = size; })); }