public override void Draw(GameTime gameTime)
        {
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            spriteBatch.Begin();

            spriteBatch.Draw(TextureManager.GetTexture2D(ETexture2D.MenuBG), new Rectangle(-10, 0, 850, 650), Color.White);
            spriteBatch.Draw(TextureManager.GetTexture2D(ETexture2D.Name), new Rectangle(0, 0, 800, 250), Color.White);
            spriteBatch.Draw(TextureManager.GetTexture2D(ETexture2D.Waves), new Rectangle(-10, 300, 850, 350), Color.White);

            spriteBatch.Draw(TextureManager.GetTexture2D(ETexture2D.Tentacle), new Rectangle(250, 180, 600, 164), new Rectangle(0, 0, 600, 164), Color.White, 0,
                             new Vector2(), SpriteEffects.None, 1);
            spriteBatch.Draw(TextureManager.GetTexture2D(ETexture2D.Tentacle), new Rectangle(-100, 240, 600, 164), new Rectangle(0, 0, 600, 164), Color.White, 0,
                             new Vector2(), SpriteEffects.FlipHorizontally, 1);

            spriteBatch.Draw(TextureManager.GetTexture2D(ETexture2D.Rect2), cRectPosition, Color.White);

            spriteBatch.Draw(TextureManager.GetTexture2D(ETexture2D.CSLogo), new Rectangle(10, (600 - 104 - 10), 144, 104), Color.White);

            SongButton.Draw(spriteBatch);
            SoundButton.Draw(spriteBatch);

            btStarting.Draw(spriteBatch);
            btAbout.Draw(spriteBatch);
            btHelping.Draw(spriteBatch);
            btExiting.Draw(spriteBatch);

            spriteBatch.End();

            if (!IsActive)
            {
                ScreenManager.FadeBackBufferToBlack(0.6f);
            }
        }
Exemple #2
0
    private void _CreateButton(string path, string name)
    {
        PackedScene SongButton = GD.Load("res://Scenes/SongButton/SongButton.tscn") as PackedScene;
        SongButton  button     = (SongButton)SongButton.Instance();

        button.Connect("mouse_entered", this, nameof(OnButtonMouseEnter));
        button.Connect("Leaving", this, nameof(Cleanup));
        button.SongName = name.ToUpper();
        button.ShybPath = path;
        _Buttons.Add((TextureButton)button);
    }
 public void loadSongs(Song[] songList)
 {
     Debug.Log("load Songs");
     for (int i = 0; i < 9; i++)
     {
         SongButton songBtn = songContainer.transform.GetChild(i).GetComponent <SongButton>();
         Song       song    = songList[i];
         songBtn.initial(song.name, song.file);
     }
     changeToSongTab();
 }
Exemple #4
0
 void Start()
 {
     Object[] songs = Resources.LoadAll("SongData/") as Object[];
     foreach (TextAsset song in songs)
     {
         SongButton button = (SongButton)Instantiate(buttonPrefab);
         button.transform.SetParent(transform);
         button.transform.GetChild(0).GetComponent <Text>().text = song.text.Split('\n')[0].Substring("Song Name: ".Length).Trim();
         button.file = song;
     }
 }
 // create buttons from songList
 private void AddButtons()
 {
     SortSongList();
     for (int i = 0; i < songList.Count; i++)
     {
         SongInfo   songInfo  = songList[i];
         GameObject newButton = Instantiate(Resources.Load("Prefabs/menu/SongButton")) as GameObject;
         newButton.transform.SetParent(contentPanel);
         SongButton songButton = newButton.GetComponent <SongButton>();
         songButton.Setup(songInfo);
     }
 }
Exemple #6
0
    void Start()
    {
        GameObject manager = GameObject.Find("SongManager(Clone)");

        if (manager == null)
        {
            Instantiate(managerPrefab);
        }

        foreach (AudioSource song in songs)
        {
            GameObject selectButton = Instantiate(buttonPrefab, gridList.transform);
            SongButton selectScript = selectButton.GetComponent <SongButton> ();

            selectScript.audioInButton = song;
        }
    }
        public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);

            if (IsActive)
            {
                btStarting.Update(gameTime);
                btAbout.Update(gameTime);
                btHelping.Update(gameTime);
                btExiting.Update(gameTime);

                SongButton.Update(gameTime);
                SoundButton.Update(gameTime);

                if (fVEC != 0)
                {
                    if (bIsButtonGoingUp)
                    {
                        fVEC = -10;
                    }
                    else
                    {
                        fVEC = 5;
                    }

                    btStarting.RectY += fVEC;
                    btAbout.RectY    += fVEC;
                    btExiting.RectY  += fVEC;
                    btHelping.RectY  += fVEC;

                    if (btStarting.RectY <= 320)
                    {
                        bIsButtonGoingUp = false;
                    }

                    if ((btStarting.RectY >= cRectPosition.Y + 50) && (!bIsButtonGoingUp))
                    {
                        fVEC = 0;
                    }
                }
            }
        }
Exemple #8
0
        public override void Update()
        {
            if (active != null)
            {
                Visual.Update();
                if (Globals.nextBlock.p >= Globals.wave.get_data_p() + Globals.wave.get_data_size())
                {
                    Globals.wave.reset();
                }
            }
            if (focused)
            {
                //SCROLL UPDATE
                songbar.Update();
                int Offset = songbar.ScaledMove();

                //BUTTON UPDATE
                foreach (SongButton song in Songs)
                {
                    song.Move(new Vector2(-Offset, 0));
                    song.Update();
                }


                Point pos = Globals.currentMouseState.Position;
                foreach (SongButton s in Songs)
                {
                    //Checks for mouse hovering over songbuttons
                    if (s.Collide(pos))//check collision
                    {
                        if (Globals.currentMouseState.LeftButton == ButtonState.Released &&
                            clicked == s &&//THIS METHOD MAKES SURE YOU CANNOT RESELECT THE SAME SONG
                            Math.Pow((pressedpoint - Globals.currentMouseState.Position).X, 2) + Math.Pow((pressedpoint - Globals.currentMouseState.Position).Y, 2) < 10000)
                        {
                            if (active != s)
                            {
                                active = s;
                                bg     = s.texture;
                                if (Globals.wave != null)
                                {
                                    Globals.wave.reset();         //reset previous song
                                }
                                Globals.wave      = active.music; //new song
                                Globals.waveAudio = new Audio(Globals.wave, 0);
                                Visual            = new Visualizer(Globals.wave);
                            }
                        }
                        if (Globals.currentMouseState.LeftButton == ButtonState.Pressed &&
                            Globals.previousMouseState.LeftButton == ButtonState.Released)
                        {
                            clicked      = s;
                            pressedpoint = Globals.currentMouseState.Position;
                        }
                        if (Globals.currentMouseState.LeftButton == ButtonState.Released)
                        {
                            clicked = null;
                        }

                        s.Glow();//applies a glow effect
                    }
                }
                //DRAGGING SCREEN     move the screen with mouse/touchscreen
                if (Globals.currentMouseState.LeftButton == ButtonState.Pressed &&
                    0 < Globals.currentMouseState.Position.Y &&
                    Globals.currentMouseState.Position.Y < Options.Resolutions.Y * 4 / 5 &&
                    !songbar.pressed)
                {
                    if (Globals.currentMouseState.Position.X - Globals.previousMouseState.Position.X > 250)//added to avoid bug when click, release,click
                    {
                        dragspeed = 1;
                    }
                    else if (Globals.currentMouseState.Position.X - Globals.previousMouseState.Position.X < -250)
                    {
                        dragspeed = -1;
                    }
                    else
                    {
                        dragspeed = (Globals.currentMouseState.Position.X - Globals.previousMouseState.Position.X) / 4;
                    }
                }
                if (Globals.currentMouseState.LeftButton == ButtonState.Released)
                {
                    if (dragspeed > 0)
                    {
                        dragspeed -= .4;
                        if (dragspeed < .3)
                        {
                            dragspeed = 0;
                        }
                    }
                    else if (dragspeed < 0)
                    {
                        dragspeed += .4;
                        if (dragspeed > -.3)
                        {
                            dragspeed = 0;
                        }
                    }
                }
                songbar.bar.X -= (int)dragspeed;
                songbar.Update();

                //Button update-check for collisions
                if (Globals.previousMouseState.LeftButton == ButtonState.Pressed && Globals.currentMouseState.LeftButton == ButtonState.Released)
                {
                    if (Play.Collide(pos))
                    {
                        //this.manager.RegisterScene("Play", new LevelScene());
                        this.manager.AlmostCurrentScenes.Add("Background");
                        this.manager.AlmostCurrentScenes.Add("Level");
                        Globals.pathToCurrentMap         = active.dmlfile;
                        Globals.songname                 = active.title;
                        this.manager.transitioningScenes = true;
                        this.manager.FocusOn("Level");
                    }
                    if (Back.Collide(pos))
                    {
                        this.manager.AlmostCurrentScenes.Add("Background");
                        this.manager.AlmostCurrentScenes.Add("Main Menu");
                        this.manager.FocusOn("Main Menu");
                        this.manager.transitioningScenes = true;
                    }
                }
            }
        }
Exemple #9
0
    private void Start()
    {
        scrollRectTransform = GetComponent <RectTransform>();
        contentPanel        = GetComponent <ScrollRect>().content;
        contentPanel.GetComponent <RectTransform>().sizeDelta = new Vector2(contentPanel.rect.width, contentPanel.transform.childCount * buttonHeight);

        musicController = GameController.Instance.MusicController;
        buttonHeight    = buttonPrefab.GetComponent <RectTransform>().rect.height;
        List <Button> SongButtons = new List <Button>();

        for (int i = 0; i < musicController.Songs.Length; i++)
        {
            GameObject button = Instantiate(buttonPrefab, contentPanel.transform);
            button.GetComponent <RectTransform>().localPosition = new Vector3(0f, i * -buttonHeight);
            SongButtons.Add(button.GetComponent <Button>());
        }

        for (int i = 0; i < SongButtons.Count; i++)
        {
            Navigation navigation = new Navigation();
            navigation.mode = Navigation.Mode.Explicit;

            if (i > 0)
            {
                navigation.selectOnUp = SongButtons[i - 1];
            }

            if (i < (SongButtons.Count - 1))
            {
                navigation.selectOnDown = SongButtons[i + 1];
            }

            if (i == 0)
            {
                navigation.selectOnUp = PlaybackButtons[1];
            }

            SongButtons[i].navigation = navigation;
            SongButtons[i].GetComponentInChildren <TextMeshProUGUI>().SetText(musicController.Songs[i].Name);
            SongButton songButton = SongButtons[i].GetComponent <SongButton>();
            songButton.Index = i;
            pauseMenu.SongButtonImages.Add(songButton.PlayingImage);
        }

        for (int i = 0; i < PlaybackButtons.Length; i++)
        {
            Navigation navigation = new Navigation();
            navigation.mode         = Navigation.Mode.Explicit;
            navigation.selectOnDown = SongButtons[0];
            navigation.selectOnUp   = backButton;

            if (i < (PlaybackButtons.Length - 1))
            {
                navigation.selectOnRight = PlaybackButtons[i + 1];
            }

            if (i > 0)
            {
                navigation.selectOnLeft = PlaybackButtons[i - 1];
            }

            PlaybackButtons[i].navigation = navigation;
        }
    }