Ejemplo n.º 1
0
        public void Play()
        {
            if (AdeProjectManager.Instance.CurrentProjectMetadata == null || !ArcGameplayManager.Instance.IsLoaded)
            {
                AdeToast.Instance.Show("请先加载谱面");
                return;
            }

            if (switchingMode)
            {
                return;
            }
            switchingMode = true;

            GameplayManager.Play();
            TopBar.DOAnchorPosY(TopBar.sizeDelta.y, ModeSwitchDuration).SetEase(ToPlayerModeEase);
            BottomBar.DOAnchorPosY(-BottomBar.sizeDelta.y, ModeSwitchDuration).SetEase(ToPlayerModeEase);
            LeftBar.DOAnchorPosX(-LeftBar.sizeDelta.x, ModeSwitchDuration).SetEase(ToPlayerModeEase);
            RightBar.DOAnchorPosX(RightBar.sizeDelta.x, ModeSwitchDuration).SetEase(ToPlayerModeEase).OnComplete(() => { switchingMode = false; });
            GameplayCamera.DORect(new Rect(0, 0, 1, 1), ModeSwitchDuration).SetEase(ToPlayerModeEase);

            PauseButtonImage.sprite = PausePause;
            PauseButton.spriteState = new SpriteState()
            {
                pressedSprite = PausePausePressed
            };
            InfoCanvasGroup.interactable = false;

            TimingSliderHandle.sprite = GlowSliderSprite;

            AdeClickToCreate.Instance.CancelAddLongNote();
            AdeClickToCreate.Instance.Mode = ClickToCreateMode.Idle;

            IsEditorMode = false;
        }
Ejemplo n.º 2
0
        public void Pause()
        {
            if (switchingMode)
            {
                return;
            }
            switchingMode = true;

            GameplayManager.Pause();
            TopBar.DOAnchorPosY(0, ModeSwitchDuration).SetEase(ToEditorModeEase);
            BottomBar.DOAnchorPosY(0, ModeSwitchDuration).SetEase(ToEditorModeEase);
            LeftBar.DOAnchorPosX(0, ModeSwitchDuration).SetEase(ToEditorModeEase);
            RightBar.DOAnchorPosX(0, ModeSwitchDuration).SetEase(ToEditorModeEase).OnComplete(() => { switchingMode = false; });
            GameplayCamera.DORect(EditorModeGameplayCameraRect, ModeSwitchDuration).SetEase(ToEditorModeEase);

            PauseButtonImage.sprite = PausePlay;
            PauseButton.spriteState = new SpriteState()
            {
                pressedSprite = PausePlayPressed
            };
            InfoCanvasGroup.interactable = true;

            TimingSliderHandle.sprite = DefaultSliderSprite;

            IsEditorMode = true;
        }
 public void UpdateResolution()
 {
     if (GameplayCamera)
     {
         TopBar.DOComplete();
         BottomBar.DOComplete();
         LeftBar.DOComplete();
         RightBar.DOComplete();
         GameplayCamera.DOComplete();
         GameplayCamera.rect = IsEditorMode ? EditorModeGameplayCameraRect : new Rect(0, 0, 1, 1);
         ArcCameraManager.Instance.ResetCamera();
     }
 }
Ejemplo n.º 4
0
        public virtual void Draw(Vector2 OFFSET)
        {
            if (MobDowns.Current < 42 && MobTops.Current < 42 && MobLefts.Current < 42 && MobRights.Current < 42)
            {
                backGround.Draw(OFFSET);
                mainChar.Draw(OFFSET);

                // power
                #region
                power.Draw(OFFSET);
                if (powerCycle >= 500)
                {
                    power01.Draw(OFFSET);
                }
                if (powerCycle >= 700)
                {
                    power02.Draw(OFFSET);
                }
                if (powerCycle >= 900)
                {
                    power03.Draw(OFFSET);
                }
                if (powerCycle >= 1100)
                {
                    power04.Draw(OFFSET);
                }
                if (powerCycle == 1300)
                {
                    flat = true;
                }
                if (flat)
                {
                    if (powerCycle >= 1300)
                    {
                        powerfull01.Draw(OFFSET);
                    }
                    if (powerCycle >= 1320)
                    {
                        powerfull02.Draw(OFFSET);
                    }
                    if (powerCycle >= 1340)
                    {
                        powerfull03.Draw(OFFSET);
                    }
                    if (powerCycle >= 1360)
                    {
                        powerfull04.Draw(OFFSET);
                        isPower    = true;
                        powerCycle = 1320;
                    }
                }
                if (GameGlobals.gameTimePassed % 1670 == 0 && powerCycle > 1300)
                {
                    isPower = false; powerCycle = 0;
                }
                if (GameGlobals.gameTimePassed % 1700 == 0 && powerCycle > 1300)
                {
                    flat = false;
                }
                #endregion

                // draw Mobs
                MobTops.Draw(OFFSET);
                TopBar.Draw(new Vector2(MobTops.pos.X - 70, MobTops.pos.Y - 160));
                if (GameGlobals.gameTimePassed >= 1000)
                {
                    MobDowns.Draw(OFFSET);
                    DownBar.Draw(new Vector2(MobDowns.pos.X - 100, MobDowns.pos.Y - 200));

                    if (GameGlobals.gameTimePassed >= 1500)
                    {
                        MobLefts.Draw(OFFSET);
                        LeftBar.Draw(new Vector2(MobLefts.pos.X - 70, MobLefts.pos.Y - 190));
                    }

                    if (GameGlobals.gameTimePassed >= 2200)
                    {
                        MobRights.Draw(OFFSET);
                        RightBar.Draw(new Vector2(MobRights.pos.X - 70, MobRights.pos.Y - 165));
                    }
                }

                //draw projectile
                for (int i = 0; i < Projectile2Ds.Count; i++)
                {
                    Projectile2Ds[i].Draw(OFFSET);
                }
                if (isPower)
                {
                    for (int i = 0; i < projectile2DforMainChars.Count; i++)
                    {
                        projectile2DforMainChars[i].Draw(OFFSET);
                    }
                }
            }
            else
            {
                //GameGlobals.score = GameGlobals.score + 5;
                if (textCycle >= 0)
                {
                    backGroundEndGame.Draw(OFFSET);
                    textCycle++;
                }
                if (textCycle >= 25)
                {
                    GameOver01.Draw(OFFSET);
                    textCycle++;
                }
                if (textCycle >= 50)
                {
                    GameOver02.Draw(OFFSET);
                    textCycle++;
                }
                if (textCycle >= 75)
                {
                    GameOver03.Draw(OFFSET);
                    textCycle++;
                }
                if (textCycle >= 90)
                {
                    textCycle = 0;
                }
                ResetBtn.Draw(OFFSET);
                ExitBtn.Draw(OFFSET);
                if (GameGlobals.score != 0)
                {
                    E0 = GameGlobals.score % 10;
                    GameGlobals.score = GameGlobals.score / 10;
                    E1 = GameGlobals.score % 10;
                    GameGlobals.score = GameGlobals.score / 10;
                    E2 = GameGlobals.score % 10;
                    GameGlobals.score = GameGlobals.score / 10;
                    E3 = GameGlobals.score % 10;
                    GameGlobals.score = GameGlobals.score / 10;
                }
                if (E0 == 5)
                {
                    scoreE00.Draw(OFFSET);
                }
                if (E0 == 0)
                {
                    scoreE00.Draw(OFFSET);
                }
                if (E1 == 0)
                {
                    scoreE10.Draw(OFFSET);
                }
                if (E1 == 1)
                {
                    scoreE11.Draw(OFFSET);
                }
                if (E1 == 2)
                {
                    scoreE12.Draw(OFFSET);
                }
                if (E1 == 3)
                {
                    scoreE13.Draw(OFFSET);
                }
                if (E1 == 4)
                {
                    scoreE14.Draw(OFFSET);
                }
                if (E1 == 5)
                {
                    scoreE15.Draw(OFFSET);
                }
                if (E1 == 6)
                {
                    scoreE16.Draw(OFFSET);
                }
                if (E1 == 7)
                {
                    scoreE17.Draw(OFFSET);
                }
                if (E1 == 8)
                {
                    scoreE18.Draw(OFFSET);
                }
                if (E1 == 9)
                {
                    scoreE19.Draw(OFFSET);
                }
                if (E2 == 0)
                {
                    scoreE20.Draw(OFFSET);
                }
                if (E2 == 1)
                {
                    scoreE21.Draw(OFFSET);
                }
                if (E2 == 2)
                {
                    scoreE22.Draw(OFFSET);
                }
                if (E2 == 3)
                {
                    scoreE23.Draw(OFFSET);
                }
                if (E2 == 4)
                {
                    scoreE24.Draw(OFFSET);
                }
                if (E2 == 5)
                {
                    scoreE25.Draw(OFFSET);
                }
                if (E2 == 6)
                {
                    scoreE26.Draw(OFFSET);
                }
                if (E2 == 7)
                {
                    scoreE27.Draw(OFFSET);
                }
                if (E2 == 8)
                {
                    scoreE28.Draw(OFFSET);
                }
                if (E2 == 9)
                {
                    scoreE29.Draw(OFFSET);
                }
                //ResetScript.Draw(OFFSET);
                //ExitScript.Draw(OFFSET);
                //if (GameGlobals.score % 10 == 0) score00.Draw(OFFSET); else score05.Draw(OFFSET);
            }
            Globals.spriteBatch.DrawString(tester, GameGlobals.score.ToString(), new Vector2(1000, 1000), Color.Red, 0, OFFSET, 2, new SpriteEffects(), 0);

            // countscore
            #region
            if (GameGlobals.score != 0 && MobDowns.Current < 42 && MobTops.Current < 42 && MobLefts.Current < 42 && MobRights.Current < 42)
            {
                if (GameGlobals.score % 5 == 0)
                {
                    score05.Draw(OFFSET);
                }
                if (GameGlobals.score % 10 == 0)
                {
                    score00.Draw(OFFSET);
                }
                if (GameGlobals.score >= 10)
                {
                    score01.Draw(OFFSET);
                }
                if (GameGlobals.score >= 20)
                {
                    score02.Draw(OFFSET);
                }
                if (GameGlobals.score >= 30)
                {
                    score03.Draw(OFFSET);
                }
                if (GameGlobals.score >= 40)
                {
                    score04.Draw(OFFSET);
                }
                if (GameGlobals.score >= 50)
                {
                    score052nd.Draw(OFFSET);
                }
                if (GameGlobals.score >= 60)
                {
                    score06.Draw(OFFSET);
                }
                if (GameGlobals.score >= 70)
                {
                    score07.Draw(OFFSET);
                }
                if (GameGlobals.score >= 80)
                {
                    score08.Draw(OFFSET);
                }
                if (GameGlobals.score >= 90)
                {
                    score09.Draw(OFFSET);
                }
                if (GameGlobals.score >= 100)
                {
                    score013rd.Draw(OFFSET);
                    if (GameGlobals.score < 110)
                    {
                        score002nd.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 110)
                    {
                        score01.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 120)
                    {
                        score02.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 130)
                    {
                        score03.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 140)
                    {
                        score04.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 150)
                    {
                        score052nd.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 160)
                    {
                        score06.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 170)
                    {
                        score07.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 180)
                    {
                        score08.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 190)
                    {
                        score09.Draw(OFFSET);
                    }
                }
                if (GameGlobals.score >= 200)
                {
                    score023rd.Draw(OFFSET);
                    if (GameGlobals.score < 210)
                    {
                        score002nd.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 210)
                    {
                        score01.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 220)
                    {
                        score02.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 230)
                    {
                        score03.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 240)
                    {
                        score04.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 250)
                    {
                        score052nd.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 260)
                    {
                        score06.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 270)
                    {
                        score07.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 280)
                    {
                        score08.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 290)
                    {
                        score09.Draw(OFFSET);
                    }
                }
                if (GameGlobals.score >= 300)
                {
                    score033rd.Draw(OFFSET);
                    if (GameGlobals.score < 310)
                    {
                        score002nd.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 310)
                    {
                        score01.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 320)
                    {
                        score02.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 330)
                    {
                        score03.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 340)
                    {
                        score04.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 350)
                    {
                        score052nd.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 360)
                    {
                        score06.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 370)
                    {
                        score07.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 380)
                    {
                        score08.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 390)
                    {
                        score09.Draw(OFFSET);
                    }
                }

                if (GameGlobals.score >= 400)
                {
                    score043rd.Draw(OFFSET);
                    if (GameGlobals.score < 410)
                    {
                        score002nd.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 410)
                    {
                        score01.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 420)
                    {
                        score02.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 430)
                    {
                        score03.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 440)
                    {
                        score04.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 450)
                    {
                        score052nd.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 460)
                    {
                        score06.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 470)
                    {
                        score07.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 480)
                    {
                        score08.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 490)
                    {
                        score09.Draw(OFFSET);
                    }
                }
                if (GameGlobals.score >= 500)
                {
                    score053rd.Draw(OFFSET);
                    if (GameGlobals.score < 510)
                    {
                        score002nd.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 510)
                    {
                        score01.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 520)
                    {
                        score02.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 530)
                    {
                        score03.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 540)
                    {
                        score04.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 550)
                    {
                        score052nd.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 560)
                    {
                        score06.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 570)
                    {
                        score07.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 580)
                    {
                        score08.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 590)
                    {
                        score09.Draw(OFFSET);
                    }
                }
                if (GameGlobals.score >= 600)
                {
                    score063rd.Draw(OFFSET);
                    if (GameGlobals.score < 610)
                    {
                        score002nd.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 610)
                    {
                        score01.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 620)
                    {
                        score02.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 630)
                    {
                        score03.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 640)
                    {
                        score04.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 650)
                    {
                        score052nd.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 660)
                    {
                        score06.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 670)
                    {
                        score07.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 680)
                    {
                        score08.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 690)
                    {
                        score09.Draw(OFFSET);
                    }
                }
                if (GameGlobals.score >= 700)
                {
                    score073rd.Draw(OFFSET);
                    if (GameGlobals.score < 710)
                    {
                        score002nd.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 710)
                    {
                        score01.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 720)
                    {
                        score02.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 730)
                    {
                        score03.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 740)
                    {
                        score04.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 750)
                    {
                        score052nd.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 760)
                    {
                        score06.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 770)
                    {
                        score07.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 780)
                    {
                        score08.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 790)
                    {
                        score09.Draw(OFFSET);
                    }
                }
                if (GameGlobals.score >= 800)
                {
                    score083rd.Draw(OFFSET);
                    if (GameGlobals.score < 810)
                    {
                        score002nd.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 810)
                    {
                        score01.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 820)
                    {
                        score02.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 830)
                    {
                        score03.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 840)
                    {
                        score04.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 850)
                    {
                        score052nd.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 860)
                    {
                        score06.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 870)
                    {
                        score07.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 880)
                    {
                        score08.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 890)
                    {
                        score09.Draw(OFFSET);
                    }
                }
                if (GameGlobals.score >= 900)
                {
                    score093rd.Draw(OFFSET);
                    if (GameGlobals.score < 910)
                    {
                        score002nd.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 910)
                    {
                        score01.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 920)
                    {
                        score02.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 930)
                    {
                        score03.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 940)
                    {
                        score04.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 950)
                    {
                        score052nd.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 960)
                    {
                        score06.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 970)
                    {
                        score07.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 980)
                    {
                        score08.Draw(OFFSET);
                    }
                    if (GameGlobals.score >= 990)
                    {
                        score09.Draw(OFFSET);
                    }
                }
                if (GameGlobals.score >= 1000)
                {
                    if (GameGlobals.score < 1010)
                    {
                        score002nd.Draw(OFFSET);
                    }
                    if (GameGlobals.score < 1100)
                    {
                        score003rd.Draw(OFFSET);
                    }
                    score014th.Draw(OFFSET);
                }
            }
            #endregion
        }
Ejemplo n.º 5
0
        public virtual void Update()
        {
            Globals.SoundControl.PlaySong("BackGroundMusic");
            mainChar.Update();
            GameGlobals.gameTimePassed++;
            maincharCycle++;
            powerCycle++;

            //Mob xuat hien
            MobTops.Update();
            if (GameGlobals.gameTimePassed >= 1000)
            {
                MobDowns.Update();
            }
            if (GameGlobals.gameTimePassed >= 1500)
            {
                MobLefts.Update();
            }
            if (GameGlobals.gameTimePassed >= 2200)
            {
                MobRights.Update();
            }
            TopBar.Update(MobTops.Current, MobTops.Full);
            DownBar.Update(MobDowns.Current, MobDowns.Full);
            LeftBar.Update(MobLefts.Current, MobLefts.Full);
            RightBar.Update(MobRights.Current, MobRights.Full);
            if (MobDowns.Current < 42 && MobTops.Current < 42 && MobLefts.Current < 42 && MobRights.Current < 42)
            {
                for (int i = 0; i < Projectile2Ds.Count; i++)
                {
                    Projectile2Ds[i].Update(offset, mainChar, MobTops, MobDowns, MobLefts, MobRights);
                    if (Projectile2Ds[i].done)
                    {
                        Projectile2Ds.RemoveAt(i);
                        i--;
                    }
                }
                if (isPower)
                {
                    for (int i = 0; i < projectile2DforMainChars.Count; i++)
                    {
                        projectile2DforMainChars[i].Update(offset, MobTops, MobDowns, MobLefts, MobRights);
                        if (projectile2DforMainChars[i].done)
                        {
                            projectile2DforMainChars.RemoveAt(i);
                            i--;
                        }
                    }
                }
            }
            if (MobDowns.Current >= 42 || MobTops.Current >= 42 || MobLefts.Current >= 42 || MobRights.Current >= 42)
            {
                KeyboardState keyboardState = Keyboard.GetState();
                dead = true;
                Globals.SoundControl.StopSong("BackGroundMusic");
                Globals.SoundControl.PlaySong("GameOver");
                if (keyboardState.IsKeyDown(Keys.Enter))
                {
                    GameGlobals.gameTimePassed = 0;
                    GameGlobals.score          = 0;
                    ResetWorld(null);
                }
                if (ResetBtn.Update(offset))
                {
                    GameGlobals.gameTimePassed = 0;
                    GameGlobals.score          = 0;
                    ResetWorld(null);
                }
            }


            // animation for mainChar
            #region
            if (maincharCycle <= 20)
            {
                mainChar.myModel = Globals.content.Load <Texture2D>("mainCharOpenEye");
            }
            if (maincharCycle > 20 && maincharCycle <= 40)
            {
                mainChar.myModel = Globals.content.Load <Texture2D>("mainChar04");
            }
            if (maincharCycle > 40 && maincharCycle <= 50)
            {
                mainChar.myModel = Globals.content.Load <Texture2D>("mainCharOpenEye");
            }
            if (maincharCycle > 50 && maincharCycle <= 60)
            {
                mainChar.myModel = Globals.content.Load <Texture2D>("mainChar");
            }
            if (maincharCycle > 60 && maincharCycle <= 70)
            {
                mainChar.myModel = Globals.content.Load <Texture2D>("mainChar02");
                //powerfull01.myModel = Globals.content.Load<Texture2D>("powerfull01");
            }
            if (maincharCycle > 70 && maincharCycle <= 80)
            {
                mainChar.myModel = Globals.content.Load <Texture2D>("mainChar");
                if (maincharCycle == 80)
                {
                    maincharCycle = 0;
                }
            }
            #endregion

            CountScore();
        }