コード例 #1
0
ファイル: SoundButtonDemo.cs プロジェクト: mkbiltek2019/refer
    public SoundButtonDemo()
    {
        Text = "SoundButton Demonstration";

        SoundButton btn = new SoundButton();

        btn.Parent   = this;
        btn.Location = new Point(50, 25);
        btn.AutoSize = true;
        btn.Text     = "SoundButton with File";
        btn.Click   += ButtonOnClick;
        btn.WaveFile = Path.Combine(
            Environment.GetEnvironmentVariable("windir"),
            "Media\\tada.wav");

        btn          = new SoundButton();
        btn.Parent   = this;
        btn.Location = new Point(50, 125);
        btn.AutoSize = true;
        btn.Text     = "SoundButton with URI";
        btn.Click   += ButtonOnClick;
        btn.WaveFile = "http://www.oaklandzoo.org/atoz/azlinsnd.wav";

        btn            = new SoundButton();
        btn.Parent     = this;
        btn.Location   = new Point(50, 225);
        btn.AutoSize   = true;
        btn.Text       = "SoundButton with Resource";
        btn.Click     += ButtonOnClick;
        btn.WaveStream = GetType().Assembly.GetManifestResourceStream(
            "SoundButtonDemo.MakeItSo.wav");
    }
コード例 #2
0
 // handled by UI button (rename to OnPauseButtonPressed!)
 public void OnPauseButtonPressed()
 {
     Pause();
     PauseMenu.SetActive(true);
     PauseButton.SetActive(false);
     SoundButton.SetActive(true);
 }
コード例 #3
0
        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);
            }
        }
        public MenuState(Game1 game) : base(game)
        {
            _startButttonTexture = Globals.ContentLoader.Load <Texture2D>("Buttons/Start_BTN");
            _endButttonTexture   = Globals.ContentLoader.Load <Texture2D>("Buttons/Exit_BTN");


            #region StartGameButton
            _newGameButton = new RegularButton(_startButttonTexture, new Vector2(Globals.WindowWidth / 2 - _startButttonTexture.Width / 2, Globals.WindowHeight / 2 - _startButttonTexture.Height))
            {
            };
            _newGameButton.Click += NewGameButton_Click;
            #endregion

            #region ExitButton
            _exitButton = new RegularButton(_endButttonTexture, new Vector2(Globals.WindowWidth / 2 - _endButttonTexture.Width / 2, Globals.WindowHeight / 2 + _endButttonTexture.Height / 2))
            {
            };
            _exitButton.Click += ExitButton_Click;
            #endregion

            #region SoundButton
            _soundButton = new SoundButton()
            {
            };
            _soundButton.Click += _soundButton_Click;
            #endregion

            Components = new List <IComponent>()
            {
                _newGameButton,
                _exitButton,
                _soundButton
            };
            Globals.MusicPlayer.PlaySong(Globals.MainTheme);
        }
コード例 #5
0
    void Awake()
    {
        musicButton = transform.Find("ButtonPanel/MusicButton").GetComponent <SoundButton>();
        soundButton = transform.Find("ButtonPanel/SoundButton").GetComponent <SoundButton>();

        board = GameObject.Find("Board").GetComponent <Board>();
    }
コード例 #6
0
ファイル: LobbyController.cs プロジェクト: xAdamQ/Basra
    private async UniTaskVoid Initialize()
    {
        Controller.I.AddRpcContainer(this);
        // Controller.I.OnAppPause += DestroyLobby;

        await UniTask.DelayFrame(1);

        var containerRoot = new GameObject("Lobby").transform;

        new LobbyReferences();

        LobbyReferences.I.Canvas = (await Addressables.InstantiateAsync("canvas", containerRoot))
                                   .GetComponent <Transform>();

        await FriendsView.Create();

        SoundButton.Create();

        await PersonalActiveUserView.Create();

        await RoomRequester.Create();

        await Shop.Create(LobbyReferences.I.Canvas, ItemType.Cardback);

        await Shop.Create(LobbyReferences.I.Canvas, ItemType.Background);

#if HMS
        IapShop.Create();
#endif

        Background.I.SetForLobby();
    }
コード例 #7
0
        private void LoadSounds()
        {
            ResourceSet resourceSet = Properties.Resources.ResourceManager.GetResourceSet(CultureInfo.CurrentUICulture, true, true);
            Random random = new Random();
            foreach (DictionaryEntry entry in resourceSet)
            {
                string resourceKey = entry.Key.ToString();
                object resource = entry.Value;

                try
                {
                    SoundButton button = new SoundButton();
                    button.Text = resourceKey.Replace("_", " ");
                    button.AutoSize = true;
                    button.ForeColor = InvertColor(button.BackColor);
                    button.AutoSizeMode = AutoSizeMode.GrowAndShrink;
                    button.AudioOutput.Stream = (UnmanagedMemoryStream)resource;
                    button.Primary = RandomColor(random, 100);
                    button.Secondary = RandomColor(random, 100);
                    button.Angle = 90;
                    button.Font = new Font("Moire", 16f, FontStyle.Bold);
                    flowLayoutPanel1.Controls.Add(button);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Soundboard couldn't load a resource: {0}\nMessage: {1}", resourceKey, ex.Message);
                }

            }
        }
コード例 #8
0
 // handled by UI button (rename to OnResumeButtonPressed!)
 public void OnResume()
 {
     Resume();
     PauseMenu.SetActive(false);
     PauseButton.SetActive(true);
     SoundButton.SetActive(false);
 }
コード例 #9
0
 // Start is called before the first frame update
 void Start()
 {
     FireballShot   = FireBallContainer.GetComponent <AudioSource>();
     BackgroundShot = MusicContainer.GetComponent <AudioSource>();
     SoundSR        = SoundButton.GetComponent <SpriteRenderer>();
     MusicSR        = MusicButton.GetComponent <SpriteRenderer>();
 }
コード例 #10
0
 void Start()
 {
     soundButton = FindObjectOfType <SoundButton>();
     musicButton = FindObjectOfType <MusicButton>();
     musicPlayer = FindObjectOfType <MusicPlayer>();
     audioSource = musicPlayer.GetComponent <AudioSource>();
     audioSource.ignoreListenerPause = true;
     volume       = audioSource.volume;
     buttonSwitch = GetComponent <AudioSource>();
 }
コード例 #11
0
    public void ShowHelpScene()
    {
        // Disable Play button
        PlayButton.SetActive(false);
        SoundButton.SetActive(false);
        ShopButton.SetActive(false);

        // Show Help scene
        HelpScene.SetActive(true);
    }
コード例 #12
0
ファイル: SoundButton.cs プロジェクト: ADAGamesJam/ludender42
 private void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
 }
コード例 #13
0
        public DeathState(Game1 _game) : base(_game)
        {
            #region Load Content
            Texture2D _restartBtnTexture = Globals.ContentLoader.Load <Texture2D>("Buttons/Replay_BTN");
            Texture2D _exitBtnTexture    = Globals.ContentLoader.Load <Texture2D>("Buttons/Close_BTN");
            Texture2D _headerTexture     = Globals.ContentLoader.Load <Texture2D>("Headers/LostHeader");
            #endregion

            #region Create components

            #region buttons

            #region RestartButton
            button _reStartBtn = new RegularButton(_restartBtnTexture, new Vector2(Globals.WindowWidth / 3 - _restartBtnTexture.Width / 2, Globals.WindowHeight / 3 + _restartBtnTexture.Height / 2))
            {
            };
            _reStartBtn.Click += _reStartBtn_Click;
            #endregion

            #region ExitButton
            button _exitBtn = new RegularButton(_exitBtnTexture, new Vector2(Globals.WindowWidth / 3 * 2 - _exitBtnTexture.Width / 2, Globals.WindowHeight / 3 + _exitBtnTexture.Height / 2))
            {
            };
            _exitBtn.Click += _exitBtn_Click;
            #endregion

            #region SoundBtn
            button _soundBtn = new SoundButton();
            _soundBtn.Click += _soundBtn_Click;
            #endregion
            #endregion

            #region Header

            #region Death header
            Header _deathHeader = new Header(_headerTexture)
            {
                Position = new Vector2(Globals.WindowWidth / 2 - _headerTexture.Width / 2, Globals.WindowHeight / 6 + _headerTexture.Height / 2),
            };
            #endregion
            #endregion
            #endregion

            #region Add buttons to the list
            Components = new List <IComponent>()
            {
                _reStartBtn,
                _exitBtn,
                _deathHeader,
                _soundBtn,
            };
            #endregion
        }
コード例 #14
0
 public void SwitchSound()
 {
     if (PlayerPrefs.GetString("Sound") == "Off")
     {
         PlayerPrefs.SetString("Sound", "On");
         SoundButton.GetComponent <Image>().sprite = SoundOnSprite;
     }
     else
     {
         PlayerPrefs.SetString("Sound", "Off");
         SoundButton.GetComponent <Image>().sprite = SoundOffSprite;
     }
 }
コード例 #15
0
    public void CloseCreditsPanel()
    {
        SoundManagerMainMenu.instance.ButtonSoundPlay();
        CreditsPanel.SetActive(false);
        // ADManager.instance.StopBannerAd();

        AchievementButton.SetActive(true);
        DailyRewardButton.SetActive(true);
        ShopButton.SetActive(true);
        LeaderBoardButton.SetActive(true);
        SoundButton.SetActive(true);
        CreditButton.SetActive(true);
    }
コード例 #16
0
    public void OpenCreditsPanel()
    {
        SoundManagerMainMenu.instance.ButtonSoundPlay();
        CreditsPanel.SetActive(true);
        ADManager.instance.DisplayInterstitialAfterSomeTime();
        ADManager.instance.DisplayRewardedAfterSomeTime();
        // ADManager.instance.Display_Banner();

        AchievementButton.SetActive(false);
        DailyRewardButton.SetActive(false);
        ShopButton.SetActive(false);
        LeaderBoardButton.SetActive(false);
        SoundButton.SetActive(false);
        CreditButton.SetActive(false);
    }
コード例 #17
0
    public void Achievement()
    {
        AchievenmentListIngame.instance.AchievementViewer();

        DailyRewardButton.SetActive(!IsAchievement);
        ShopButton.SetActive(!IsAchievement);
        LeaderBoardButton.SetActive(!IsAchievement);
        MenuP.SetActive(!IsAchievement);
        CoinP.SetActive(!IsAchievement);
        HighCoinP.SetActive(!IsAchievement);
        SoundButton.SetActive(!IsAchievement);
        CreditButton.SetActive(!IsAchievement);
        SoundManagerMainMenu.instance.ButtonSoundPlay();
        ADManager.instance.DisplayInterstitialAfterSomeTime();
        ADManager.instance.DisplayRewardedAfterSomeTime();
    }
コード例 #18
0
    public void ShopCut()
    {
        ShopPanel.SetActive(false);

        AchievementButton.SetActive(true);
        DailyRewardButton.SetActive(true);
        LeaderBoardButton.SetActive(true);
        SoundButton.SetActive(true);
        CreditButton.SetActive(true);

        MenuP.SetActive(true);
        CoinP.SetActive(true);
        HighCoinP.SetActive(true);
        SoundManagerMainMenu.instance.ButtonSoundPlay();
        //   ADManager.instance.StopBannerAd();
    }
コード例 #19
0
    public void cutLBpanel()
    {
        LBpanel.SetActive(false);
        LB.SetActive(false);
        LB2.SetActive(false);

        AchievementButton.SetActive(true);
        DailyRewardButton.SetActive(true);
        ShopButton.SetActive(true);
        LeaderBoardButton.SetActive(true);
        SoundButton.SetActive(true);
        CreditButton.SetActive(true);

        MenuP.SetActive(true);
        CoinP.SetActive(true);
        HighCoinP.SetActive(true);
        SoundManagerMainMenu.instance.ButtonSoundPlay();
    }
コード例 #20
0
        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;
                    }
                }
            }
        }
コード例 #21
0
    public void LogClick()
    {
        LogInt = PlayerPrefs.GetInt("LogInt", 0);
        PlayerPrefs.SetInt("SettingsInt", 0);

        if (LogInt % 2 == 0)
        {
            LogStatus.SetActive(true);

            VibrationButton.SetActive(false);
            //MusicButton.SetActive(false);
            SoundButton.SetActive(false);
        }
        if (LogInt % 2 == 1)
        {
            LogStatus.SetActive(false);
        }
        LogInt = LogInt + 1;
        PlayerPrefs.SetInt("LogInt", LogInt);
    }
コード例 #22
0
    public void LBbuttonClicked()
    {
        LBpanel.SetActive(true);
        LB.SetActive(true);
        LB2.SetActive(true);

        AchievementButton.SetActive(false);
        DailyRewardButton.SetActive(false);
        ShopButton.SetActive(false);
        LeaderBoardButton.SetActive(false);
        SoundButton.SetActive(false);
        CreditButton.SetActive(false);

        MenuP.SetActive(false);
        CoinP.SetActive(false);
        HighCoinP.SetActive(false);
        SoundManagerMainMenu.instance.ButtonSoundPlay();
        ADManager.instance.DisplayInterstitialAfterSomeTime();
        ADManager.instance.DisplayRewardedAfterSomeTime();
    }
コード例 #23
0
 private void Start()
 {
     //check if sound and music are on
     if (PlayerPrefs.GetString("Music") == "Off")
     {
         MusicButton.GetComponent <Image>().sprite = MusicOffSprite;
     }
     else
     {
         MusicButton.GetComponent <Image>().sprite = MusicOnSprite;
     }
     if (PlayerPrefs.GetString("Sound") == "Off")
     {
         SoundButton.GetComponent <Image>().sprite = SoundOffSprite;
     }
     else
     {
         SoundButton.GetComponent <Image>().sprite = SoundOnSprite;
     }
 }
コード例 #24
0
    void ChangeSoundSettings()
    {
        audioManager.GetComponent <AudioManager>().Play("button");
        Color soundColor = SoundButton.GetComponent <Image>().color;

        if (soundOn)
        {
            soundOn = false;
            audioManager.GetComponent <AudioManager>().StopSounds();
            playOrStopSounds.GetComponentInChildren <TMPro.TextMeshProUGUI>().text = "PLAY SOUNDS";
            soundAlpha = 0.33f;
            soundColor = new Color(soundColor.r, soundColor.g, soundColor.b, 0.33f);
        }
        else
        {
            soundOn = true;
            audioManager.GetComponent <AudioManager>().PlaySounds();
            playOrStopSounds.GetComponentInChildren <TMPro.TextMeshProUGUI>().text = "STOP SOUNDS";
            soundAlpha = 1f;
            soundColor = new Color(soundColor.r, soundColor.g, soundColor.b, 1f);
        }
        SoundButton.GetComponent <Image>().color = soundColor;
    }
コード例 #25
0
ファイル: LevelScreen.cs プロジェクト: Fedaykin1/Games
        public override void LoadContent()
        {
            base.LoadContent();

            info_bulle           = "Your number of moves (min number of moves to succeed)";
            position_texte_score = new Vector2(16, 8);

            design_button   = new DesignButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\design"), new Vector2(4 * 32, 0));
            fire_button     = new FireButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\fire"), new Vector2(5 * 32, 0));
            water_button    = new WaterButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\water"), new Vector2(6 * 32, 0));
            music_button    = new MusicButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\music"), new Vector2(8 * 32, 0));
            sound_button    = new SoundButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\sound"), new Vector2(9 * 32, 0));
            refresh_button  = new ReloadButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\refresh"), new Vector2(11 * 32, 0));
            previous_button = new PreviousButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\previous"), new Vector2(13 * 32, 0));
            next_button     = new NextButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\next"), new Vector2(14 * 32, 0));
            menu_button     = new MenuButton(ScreenManager.Instance.Content.Load <Texture2D>(@"Graphics\Buttons\menu"), new Vector2(16 * 32, 0));

            MapManager.Instance.LoadContent();
            LevelManager.Instance.LoadContent();
            Actor.Instance.LoadContent();

            InitializeMusic();
        }
コード例 #26
0
        public void init(Microsoft.Xna.Framework.Content.ContentManager Content, Action inGameCallback, Action backToMenuCallback, Action reinitCallback)
        {
            base.init(Content);
            sideMenuBack = Content.Load <Texture2D>(".\\Sprites\\GUI\\backMenuShape");


            soundButton = new SoundButton(inGameCallback);
            soundButton.init(Content);

            homeButton = new HomeButton(backToMenuCallback);
            homeButton.init(Content);

            backButton = new BackButton(reinitCallback);
            backButton.init(Content);

            playButton = new InGamePlayButton(inGameCallback);
            playButton.init(Content);

            buttonList = new LinkedList <SimpleButton>();
            buttonList.AddLast(playButton);
            buttonList.AddLast(soundButton);
            buttonList.AddLast(homeButton);
            buttonList.AddLast(backButton);


            playButton.position.Y = 375f;
            playButton.position.X = 800f;

            soundButton.position.Y = 40f;
            soundButton.position.X = 815f;

            homeButton.position.Y = 175f;
            homeButton.position.X = 815f;

            backButton.position.Y = 255f;
            backButton.position.X = 815f;
        }
コード例 #27
0
        public void init(Microsoft.Xna.Framework.Content.ContentManager Content, Action inGameCallback, Action backToMenuCallback, Action reinitCallback, Action shopCallback, Action backToPreGameCallback)
        {
            base.init(Content);
            sideMenuBack = Content.Load <Texture2D>(".\\Sprites\\GUI\\backEndGame");


            soundButton = new SoundButton(inGameCallback);
            soundButton.init(Content);

            homeButton = new HomeButton(backToMenuCallback);
            homeButton.init(Content);

            backButton = new ArrowButton(backToPreGameCallback);
            backButton.init(Content);

            playButton = new InGamePlayButton(reinitCallback);
            playButton.init(Content);

            shopButton = new SimpleButton(new ButtonModel(".\\Sprites\\GUI\\shopButton\\shopButton", ".\\Sprites\\GUI\\shopButton\\shopButtonXML", null), "", new Point(), shopCallback);
            shopButton.init(Content);
            shopButton.position.Y = 480;
            shopButton.position.X = 400 - shopButton.texture.Width / 2;
            shopButton.tweener    = new Tweener(shopButton.position.Y, 270f, TimeSpan.FromSeconds(1.0f), Back.EaseOut);
            shopButton.tweener.Start();


            buttonList = new LinkedList <SimpleButton>();
            buttonList.AddLast(soundButton);
            buttonList.AddLast(homeButton);
            buttonList.AddLast(backButton);
            buttonList.AddLast(playButton);
            buttonList.AddLast(shopButton);

            levelScore = new IncrementalLabel(0, ButtonFactory.spriteFont);
            levelScore.init(Content);
            levelScore.fontSize = 1.2f;
            levelScore.mask     = true;

            totalScore = new IncrementalLabel(GameModel.currentPoints, ButtonFactory.spriteFont);
            totalScore.init(Content);
            totalScore.fontSize = 0.8f;

            maxMush = new IncrementalLabel(0, ButtonFactory.spriteFont);
            maxMush.init(Content);
            maxMush.fontSize = 0.6f;
            //maxMush.mask = true;

            maxSpecial = new IncrementalLabel(0, ButtonFactory.spriteFont);
            maxSpecial.init(Content);
            maxSpecial.fontSize = 0.6f;
            // maxSpecial.mask = true;

            maxBoobs = new IncrementalLabel(0, ButtonFactory.spriteFont);
            maxBoobs.init(Content);
            maxBoobs.fontSize = 0.6f;
            //maxBoobs.mask = true;

            maxCombo = new IncrementalLabel(0, ButtonFactory.spriteFont);
            maxCombo.init(Content);
            maxCombo.fontSize = 0.6f;
            //maxCombo.mask = true;

            maxJump = new IncrementalLabel(0, ButtonFactory.spriteFont);
            maxJump.init(Content);
            maxJump.fontSize = 0.6f;
            //maxJump.mask = true;


            soundButton.position.X = 700f;

            homeButton.position.X = 515f;


            playButton.position.X = sideMenuPos.X + sideMenuBack.Width / 2 - playButton.texture.Width / 4;
            playButton.position.Y = -100;

            backButton.position.X = sideMenuPos.X + 10f;

            sideMenuPos.Y          = -480f;
            soundButton.position.Y = -140f;
        }
        public VictoryState(Game1 _game, int _CollectedItems) : base(_game)
        {
            #region Load Content
            Texture2D _nextLevelBtnTexture = Globals.ContentLoader.Load <Texture2D>("Buttons/Play_BTN");
            Texture2D _exitBtnTexture      = Globals.ContentLoader.Load <Texture2D>("Buttons/Close_BTN");
            Texture2D _replayBtnTexture    = Globals.ContentLoader.Load <Texture2D>("Buttons/Replay_BTN");
            Texture2D _headerTexture       = Globals.ContentLoader.Load <Texture2D>("Headers/WonHeader");
            Texture2D _emptyStarTexture    = Globals.ContentLoader.Load <Texture2D>("Score/Star_empty");
            Texture2D _goldStarTexture     = Globals.ContentLoader.Load <Texture2D>("Score/Star_filled");
            #endregion

            #region Assing value to the fields
            _positionStars = (int)(Globals.WindowHeight * (1.0 / 4)) - _emptyStarTexture.Height / 2 + 10;
            _positionBtns  = (int)(Globals.WindowHeight * (3.0 / 4)) - _nextLevelBtnTexture.Height / 2 + 50;
            #endregion

            #region Create Compontents

            #region Buttons

            #region Replay button
            button _replayLevelBtn = new RegularButton(_replayBtnTexture, new Vector2((int)(Globals.WindowWidth * (1.5 / 6)) - _replayBtnTexture.Width / 2, _positionBtns))
            {
            };
            _replayLevelBtn.Click += _replayLevelBtn_Click;
            #endregion

            #region Next level button
            button _nextLevelBtn = new RegularButton(_nextLevelBtnTexture, new Vector2((int)(Globals.WindowWidth * (3.0 / 6)) - _nextLevelBtnTexture.Width / 2, _positionBtns))
            {
            };
            _nextLevelBtn.Click += _nextLevelBtn_Click;
            #endregion

            #region Exit button
            button _exitBtn = new RegularButton(_exitBtnTexture, new Vector2((int)(Globals.WindowWidth * (4.5 / 6)) - _nextLevelBtnTexture.Width / 2, _positionBtns))
            {
            };
            _exitBtn.Click += _exitBtn_Click;
            #endregion

            #region Sound button
            button _soundBtn = new SoundButton(new Vector2(25, 25));
            _soundBtn.Click += _soundBtn_Click;
            #endregion
            #endregion

            #region Header
            Header _victoryHeader = new Header(_headerTexture)
            {
                Position = new Vector2(Globals.WindowWidth / 2 - _headerTexture.Width / 2, Globals.WindowHeight / 2 - _headerTexture.Height / 2 + 50),
            };
            #endregion

            #region Score
            Star _firstStar = new Star(_emptyStarTexture)
            {
                Position = new Vector2((int)(Globals.WindowWidth / 1.2 - _emptyStarTexture.Width / 2 - 50), _positionStars),
            };
            Star _secondStar = new Star(_emptyStarTexture)
            {
                Position = new Vector2(Globals.WindowWidth / 2 - _emptyStarTexture.Width / 2, _positionStars - 50),
            };
            Star _thirdStar = new Star(_emptyStarTexture)
            {
                Position = new Vector2(Globals.WindowWidth / 6 - _emptyStarTexture.Width / 2 + 50, _positionStars),
            };
            #endregion
            #endregion

            #region Add components to the list

            Components = new List <IComponent>()
            {
                _replayLevelBtn,
                _nextLevelBtn,
                _exitBtn,
                _victoryHeader,
                _secondStar,
                _thirdStar,
                _firstStar,
                _soundBtn,
            };
            int i = 1;
            //Show number of collected stars
            foreach (IComponent _component in Components)
            {
                if (_component is Star && i <= _CollectedItems)
                {
                    Star _star = _component as Star;
                    _star.StarTexture = _goldStarTexture;
                    i++;
                }
            }
            #endregion
        }
コード例 #29
0
 void ButtonClicked(SoundButton button)
 {
     SoundKit.Instance.PlayOneShot(ButtonClick);
 }
コード例 #30
0
        public override void build()
        {
            base.build();

            loadScreen.init(content);
            //SALVAR O CENARIO ATUAL
            RufusModel     temp  = GameModel.levelsModels.ElementAt(GameModel.currentLevelID);
            LevelBehaviour temp2 = (LevelBehaviour)(temp.behaviour);

            currentLevelModel = temp2.levelModel;

            background = new BackLevelView(currentLevelModel.bgPath);
            if (currentLevelModel.clouds != null)
            {
                background.addClouds(currentLevelModel.clouds);
            }
            background.setColor(currentLevelModel.color);

            background.init(content);
            addChild(background);
            background.start();
            outt = false;

            ButtonModel playModel = new ButtonModel(".\\Sprites\\GUI\\readyButton\\readyButton", ".\\Sprites\\GUI\\readyButton\\readyButtonXML", null);

            playButton = new SimpleButton(playModel, "", new Point(), gotoGame);
            playButton.init(content);
            playButton.position.Y = 570;
            playButton.position.X = 400 - playButton.texture.Width / 2;
            playButton.tweener    = new Tweener(playButton.position.Y, 350f, TimeSpan.FromSeconds(1.0f), Back.EaseOut);
            playButton.tweener.Start();

            locationButton = new SimpleButton(new ButtonModel(".\\Sprites\\GUI\\locationButton\\locationButton", ".\\Sprites\\GUI\\locationButton\\locationButtonXML", null), "", new Point(), changeLevelModel);
            locationButton.init(content);
            locationButton.position.Y = 480;
            locationButton.position.X = 400 - locationButton.texture.Width / 2;
            locationButton.tweener    = new Tweener(locationButton.position.Y, 260f, TimeSpan.FromSeconds(1.0f), Back.EaseOut);
            locationButton.tweener.Start();

            backButton = new HomeButton(gotoInit);
            backButton.init(content);
            backButton.position.Y = 40;
            backButton.position.X = 40;
            // backButton.tweener = new Tweener(backButton.position.Y, 40f, TimeSpan.FromSeconds(1.0f), Back.EaseOut);
            // backButton.tweener.Start();

            changeLevel = new ArrowButton(changeRufus);
            changeLevel.init(content);
            changeLevel.position.Y    = -40;
            changeLevel.position.X    = 490;
            changeLevel.spriteEffects = SpriteEffects.FlipHorizontally;
            changeLevel.scale         = new Vector2(.8f);
            changeLevel.tweener       = new Tweener(changeLevel.position.Y, 120f, TimeSpan.FromSeconds(1.0f), Cubic.EaseOut);
            changeLevel.tweener.Start();

            changeLevelBack = new ArrowButton(changeRufusBack);
            changeLevelBack.init(content);
            changeLevelBack.position.Y    = -40;
            changeLevelBack.position.X    = 268;
            changeLevelBack.spriteEffects = SpriteEffects.None;
            changeLevelBack.scale         = new Vector2(.8f);
            changeLevelBack.tweener       = new Tweener(changeLevel.position.Y, 120f, TimeSpan.FromSeconds(1.0f), Cubic.EaseOut);
            changeLevelBack.tweener.Start();

            backRufusBox = new SimpleButton(new ButtonModel(".\\Sprites\\GUI\\backChoiceRufus", "", null), "", new Point(), openCard);
            backRufusBox.init(content);
            backRufusBox.position.Y = -backRufusBox.texture.Height;
            backRufusBox.position.X = 400 - backRufusBox.texture.Width / 2;
            backRufusBox.tweener    = new Tweener(backRufusBox.position.Y, 40f, TimeSpan.FromSeconds(1.0f), Cubic.EaseOut);
            backRufusBox.tweener.Start();


            rufusImage = new StaticObject(GameModel.rufusModels.ElementAt(GameModel.currentRufusID).largePath);
            rufusImage.init(content);
            rufusImage.position.Y = backRufusBox.position.Y + rufusImage.texture.Height / 2 + backRufusBox.texture.Height / 2;
            rufusImage.position.X = 400 - rufusImage.texture.Width / 2;

            soundButton = new SoundButton(null);
            soundButton.init(content);
            soundButton.position.X = 700f;
            soundButton.position.Y = 40f;

            helpButton = new HelpButton(null);
            helpButton.init(content);
            helpButton.position.X = 600f;
            helpButton.position.Y = 40f;

            addChild(backRufusBox);
            addChild(playButton);
            addChild(changeLevel);
            addChild(changeLevelBack);
            addChild(locationButton);
            addChild(backButton);
            addChild(rufusImage);
            addChild(soundButton);
            addChild(helpButton);
        }
コード例 #31
0
        public override void build()
        {
            base.build();
            background = new StaticObject(".\\Sprites\\rufusConcept");
            background.init(content);
            addChild(background);

            outt = false;

            ButtonModel playModel = new ButtonModel(".\\Sprites\\GUI\\playButtonNew\\playButtonNew", ".\\Sprites\\GUI\\playButtonNew\\playButtonNewXML", null);


            soundButton = new SoundButton(null);
            soundButton.init(content);
            soundButton.position.X = 700f;
            soundButton.position.Y = 40f;

            infoButton = new InfoButton(Game1.showDevCard);
            infoButton.init(content);
            infoButton.position.X = 40f;
            infoButton.position.Y = 40f;

            playButton            = new SimpleButton(playModel, "", new Point(), gotoGame);
            playButton.fontMargin = new Vector2(55, 15);
            playButton.fontScale  = 1;
            playButton.init(content);
            playButton.position.Y = 480;
            playButton.position.X = 500;
            playButton.tweener    = new Tweener(playButton.position.Y, 350f, TimeSpan.FromSeconds(1.0f), Back.EaseOut);
            playButton.tweener.Start();

            ButtonModel shopModel = new ButtonModel(".\\Sprites\\GUI\\shopButton\\shopButton", ".\\Sprites\\GUI\\shopButton\\shopButtonXML", null);

            shopButton            = new SimpleButton(shopModel, "", new Point(), gotoShop);
            shopButton.fontMargin = new Vector2(55, 15);
            shopButton.fontScale  = 1;
            shopButton.init(content);
            shopButton.position.Y = 480;
            shopButton.position.X = 148;
            shopButton.tweener    = new Tweener(shopButton.position.Y, 350f, TimeSpan.FromSeconds(1.0f), Back.EaseOut);
            shopButton.tweener.Start();

            statisticsButton = new StatisticsButton(openStatistic);
            statisticsButton.init(content);
            statisticsButton.position.Y = 480;
            statisticsButton.position.X = 40;
            statisticsButton.tweener    = new Tweener(statisticsButton.position.Y, 350f, TimeSpan.FromSeconds(1.0f), Back.EaseOut);
            statisticsButton.tweener.Start();

            ButtonModel logoModel = new ButtonModel(".\\Sprites\\GUI\\rufusLogo", "", null);

            logoButton = new SimpleButton(logoModel, "", new Point(), null);
            logoButton.init(content);
            logoButton.position.Y = -100;
            logoButton.position.X = 140;
            logoButton.tweener    = new Tweener(logoButton.position.Y, 20f, TimeSpan.FromSeconds(1.0f), Back.EaseOut);
            logoButton.tweener.Start();

            starsLabel = new IncrementalLabel(0, ButtonFactory.spriteFont);
            starsLabel.init(content);
            starsLabel.newValue(GameModel.currentPoints);
            starsLabel.position.Y = shopButton.position.Y + 25;
            starsLabel.position.X = shopButton.position.X + 72;
            starsLabel.fontSize   = 0.8f;

            addChild(playButton);
            addChild(shopButton);
            addChild(statisticsButton);
            addChild(logoButton);
            addChild(starsLabel);
            addChild(soundButton);
            addChild(infoButton);
        }