private void Awake() { if (instance == null) { instance = this; } }
/// <summary> /// 检测进度条变化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ProgressSlider_ValueChanged(object sender, RangeBaseValueChangedEventArgs e) { if (e.OldValue > e.NewValue || e.NewValue - e.OldValue > 1) { DanmakuManager.Clear(); return; } var danmakus = danmakuList.FindAll((d) => d.Position >= e.OldValue && d.Position < e.NewValue); foreach (var danmaku in danmakus) { DanmakuManager.AddDanmaku(danmaku.Content.Trim(), danmaku.TextColor, danmaku.Type); } }
IEnumerator FadeOut(float duration) { if (fadeout) { yield break; } fadeout = true; DanmakuManager.Unregister(gameObject); SpriteRenderer spriteRenderer = GetComponentInChildren <SpriteRenderer>(); for (float t = 0; t < duration; t += Time.deltaTime) { Color color = spriteRenderer.color; color.a = 1 - t / duration; spriteRenderer.color = color; yield return(0); } Destroy(gameObject); }
private void Media_CurrentStateChanged(object sender, RoutedEventArgs e) { var i = Media.CurrentState; switch (i) { case MediaElementState.Playing: { PlayPauseButton.Focus(FocusState.Programmatic); StatusText.Visibility = Visibility.Collapsed; Status.Visibility = Visibility.Collapsed; PlayPauseSymbol.Symbol = Symbol.Pause; SettingHelper.IsScreenAlwaysOn = true; DanmakuManager.Resume(); break; } case MediaElementState.Paused: { goto case MediaElementState.Closed; } case MediaElementState.Stopped: { goto case MediaElementState.Closed; } case MediaElementState.Closed: { //修改按钮图标 PlayPauseSymbol.Symbol = Symbol.Play; //取消屏幕常亮 SettingHelper.IsScreenAlwaysOn = false; DanmakuManager.Pause(); break; } } }
/// <summary> /// 发送弹幕 /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void DanmakuSender_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args) { string content = args.QueryText.Trim(); if (content.Length == 0) { return; } string cid = param.Tid + '-' + param.Hid + "-1-" + param.Part; DanmakuManager.DanmakuType type; switch (Mode.SelectedIndex) { case 0: type = DanmakuManager.DanmakuType.Scrollable; break; case 1: type = DanmakuManager.DanmakuType.Top; break; case 2: type = DanmakuManager.DanmakuType.Bottom; break; default: type = DanmakuManager.DanmakuType.Scrollable; break; } DanmakuManager.SendDanmaku(content, ((SolidColorBrush)ColorPreview.Fill).Color, ProgressSlider.Value, cid, type); (sender as AutoSuggestBox).Text = ""; }
IEnumerator CardCoroutine() { GetComponent <WhiteScreenManager>().Flash(Color.white, 0.06f, 0.2f); yield return(new WaitForSeconds(0.06f)); DanmakuManager.ClearDanmaku(); GetComponent <SaigyoujiYuyuko>().petals2.Stop(); GetComponent <SpriteRenderer>().enabled = false; GetComponent <CardEffectManager>().EndCard(); GetComponent <SaigyoujiYuyuko>().Oogi(false); GetComponent <SaigyoujiYuyuko>().Ring(false); GetComponent <BackgroundManager>().SetBackground(5); GameObject.Find("Player").GetComponentInChildren <AudioManager>().StopBGM(); GameObject.Find("Player").GetComponentInChildren <AudioManager>().PlayEnepSE(); yield return(new WaitForSeconds(4f)); GetComponent <CardEffectManager>().WordsAppear(); yield return(new WaitForSeconds(6f)); GetComponent <WhiteScreenManager>().Flash(Color.white, 0.5f, 0.5f); GetComponent <SaigyoujiYuyuko>().MoveTo(new Vector3(0f, 0f, 100f)); yield return(new WaitForSeconds(0.5f)); GetComponent <SaigyoujiYuyuko>().Ring(true); GetComponent <CardEffectManager>().StartCard("「反魂蝶 -参分咲-」", true); GetComponent <BackgroundManager>().SetBackground(1); yield return(new WaitForSeconds(1.5f)); GameObject.Find("Player").GetComponentInChildren <AudioManager>().PlayBGM2(); yield return(new WaitForSeconds(3f)); for (int cnt = 3; cnt < 11; cnt++) { CreateLasers(cnt); StartCoroutine(CreateSpheres1()); yield return(new WaitForSeconds(2.25f)); StartCoroutine(CreateSpheres2()); yield return(new WaitForSeconds(2.25f)); CreateSphere3(); yield return(new WaitForSeconds(2.5f)); } CreateLasers(11); StartCoroutine(CreateSpheres1()); yield return(new WaitForSeconds(1f)); Time.timeScale = 0.5f; yield return(new WaitForSeconds(2f)); GetComponent <WhiteScreenManager>().Flash(Color.white, 1f, 0.5f); yield return(new WaitForSeconds(1f)); Time.timeScale = 1f; GetComponent <CardEffectManager>().EndCard(); GetComponent <SaigyoujiYuyuko>().Ring(false); GetComponent <SaigyoujiYuyuko>().Tamashi(false); GetComponent <BackgroundManager>().SetBackground(5); DanmakuManager.ClearDanmaku(); yield return(new WaitForSeconds(4f)); GetComponent <CardEffectManager2>().AllClearAppear(); yield return(new WaitForSeconds(5f)); GameObject.Find("Player").GetComponentInChildren <AudioManager>().FadeOut(4f); yield return(new WaitForSeconds(3f)); GetComponent <WhiteScreenManager>().Flash(Color.white, 1f, 1e20f); yield return(new WaitForSeconds(1.5f)); GameObject.Find("Player").GetComponentInChildren <GameController>().ReturnToTitle(); }
void Start() { DanmakuManager.Register(gameObject); }