Exemplo n.º 1
0
    void Init()
    {
        //yield return 1;


        GameApp.GetInstance().ClearScene();    //! 清除 GameScene

        SetUIHandler(this);
        uiPos = new MapUIPosition();
        //texPos = new ArenaMenuTexturePosition();
        Material mapMaterial = UIResourceMgr.GetInstance().GetMaterial("Map");      //! 装载地图材质

        background = new UIImage();
        background.SetTexture(mapMaterial, MapUITexturePosition.Background, AutoRect.AutoSize(MapUITexturePosition.Background));
        background.Rect = AutoRect.AutoPos(uiPos.Background);
        SetUIHandler(this);
        this.Add(background);
        for (int i = 0; i < MAP_COUNT; i++)
        {
            mapButtons[i] = new UIColoredButton();
            mapButtons[i].SetAnimatedColor(new Color(179.0f / 255f, 0, 0));            //! 场景按钮
            this.Add(mapButtons[i]);

            zombieAnimations[i] = new UIAnimatedImage();
            this.Add(zombieAnimations[i]);

            //! 僵尸动画
            zombieAnimations[i].SetAnimationFrameRate(5);
            zombieAnimations[i].AddAnimation(mapMaterial, MapUITexturePosition.ZombieAnimation1, AutoRect.AutoSize(MapUITexturePosition.ZombieAnimation1));
            zombieAnimations[i].AddAnimation(mapMaterial, MapUITexturePosition.ZombieAnimation2, AutoRect.AutoSize(MapUITexturePosition.ZombieAnimation2));
            zombieAnimations[i].AddAnimation(mapMaterial, MapUITexturePosition.ZombieAnimation3, AutoRect.AutoSize(MapUITexturePosition.ZombieAnimation3));

            mapButtons[i].Enable        = false;
            zombieAnimations[i].Visible = false;
            //Debug.Log(i);
        }

        for (int i = 0; i < MAP_COUNT; i++)
        {
            int index = infection[i];
            if (index != -1)
            {
                mapButtons[index].Enable        = true;
                zombieAnimations[index].Visible = true;
            }
        }



        mapButtons[0].SetTexture(UIButtonBase.State.Normal, mapMaterial, MapUITexturePosition.FactoryImg, AutoRect.AutoSize(MapUITexturePosition.FactoryImg));
        mapButtons[1].SetTexture(UIButtonBase.State.Normal, mapMaterial, MapUITexturePosition.HospitalImg, AutoRect.AutoSize(MapUITexturePosition.HospitalImg));
        mapButtons[2].SetTexture(UIButtonBase.State.Normal, mapMaterial, MapUITexturePosition.ParkingImg, AutoRect.AutoSize(MapUITexturePosition.ParkingImg));
        mapButtons[3].SetTexture(UIButtonBase.State.Normal, mapMaterial, MapUITexturePosition.Village, AutoRect.AutoSize(MapUITexturePosition.Village));

        mapButtons[0].SetTexture(UIButtonBase.State.Pressed, mapMaterial, MapUITexturePosition.FactoryImg, AutoRect.AutoSize(MapUITexturePosition.FactoryImg) * 2);
        mapButtons[1].SetTexture(UIButtonBase.State.Pressed, mapMaterial, MapUITexturePosition.HospitalImg, AutoRect.AutoSize(MapUITexturePosition.HospitalImg) * 2);
        mapButtons[2].SetTexture(UIButtonBase.State.Pressed, mapMaterial, MapUITexturePosition.ParkingImg, AutoRect.AutoSize(MapUITexturePosition.ParkingImg) * 2);
        mapButtons[3].SetTexture(UIButtonBase.State.Pressed, mapMaterial, MapUITexturePosition.Village, AutoRect.AutoSize(MapUITexturePosition.Village) * 2);


        mapButtons[0].Rect = AutoRect.AutoPos(uiPos.FactoryButton);
        mapButtons[1].Rect = AutoRect.AutoPos(uiPos.HospitalButton);
        mapButtons[2].Rect = AutoRect.AutoPos(uiPos.ParkingButton);
        mapButtons[3].Rect = AutoRect.AutoPos(uiPos.VillageButton);


        Rect offset  = new Rect(66, -30, 0, 0);
        Rect offset2 = new Rect(76, -30, 0, 0);
        Rect offset3 = new Rect(46, -30, 0, 0);

        zombieAnimations[0].Rect = AutoRect.AutoPos(Math.AddRect(uiPos.FactoryButton, offset3));
        zombieAnimations[1].Rect = AutoRect.AutoPos(Math.AddRect(uiPos.HospitalButton, offset));
        zombieAnimations[2].Rect = AutoRect.AutoPos(Math.AddRect(uiPos.ParkingButton, offset));
        zombieAnimations[3].Rect = AutoRect.AutoPos(Math.AddRect(uiPos.VillageButton, offset2));


        shopButton.SetTexture(UIButtonBase.State.Normal, mapMaterial, MapUITexturePosition.ShopImg, AutoRect.AutoSize(MapUITexturePosition.ShopImg));
        shopButton.SetTexture(UIButtonBase.State.Pressed, mapMaterial, MapUITexturePosition.ShopImg, AutoRect.AutoSize(MapUITexturePosition.ShopImg) * 2);

        shopButton.Rect = AutoRect.AutoPos(uiPos.ShopButton);
        this.Add(shopButton);


        Material shopMaterial = UIResourceMgr.GetInstance().GetMaterial("ShopUI");

        daysPanel = new UITextImage();
        daysPanel.SetTexture(shopMaterial,

                             ShopTexturePosition.DayLargePanel, AutoRect.AutoSize(ShopTexturePosition.DayLargePanel));
        daysPanel.Rect = AutoRect.AutoPos(uiPos.DaysPanel);
        daysPanel.SetText(ConstData.FONT_NAME0, "DAY " + GameApp.GetInstance().GetGameState().LevelNum, ColorName.fontColor_darkred);
        cashPanel = new CashPanel();
        this.Add(daysPanel);
        this.Add(cashPanel);
        cashPanel.SetCash(GameApp.GetInstance().GetGameState().GetCash());
        cashPanel.Show();

        Material arenaMenuMaterial = UIResourceMgr.GetInstance().GetMaterial("ArenaMenu");

        returnButton = new UIClickButton();
        returnButton.SetTexture(UIButtonBase.State.Normal, arenaMenuMaterial,

                                ArenaMenuTexturePosition.ReturnButtonNormal, AutoRect.AutoSize(ArenaMenuTexturePosition.ReturnButtonNormal));
        returnButton.SetTexture(UIButtonBase.State.Pressed, arenaMenuMaterial,

                                ArenaMenuTexturePosition.ReturnButtonPressed, AutoRect.AutoSize(ArenaMenuTexturePosition.ReturnButtonPressed));
        returnButton.Rect = AutoRect.AutoPos(uiPos.ReturnButton);



        optionsButton = new UIClickButton();
        optionsButton.SetTexture(UIButtonBase.State.Normal, arenaMenuMaterial,

                                 ArenaMenuTexturePosition.OptionsButton, AutoRect.AutoSize(ArenaMenuTexturePosition.OptionsButton));
        optionsButton.SetTexture(UIButtonBase.State.Pressed, arenaMenuMaterial,

                                 ArenaMenuTexturePosition.OptionsButtonPressed, AutoRect.AutoSize(ArenaMenuTexturePosition.OptionsButtonPressed));
        optionsButton.Rect = AutoRect.AutoPos(uiPos.OptionsButton);
        this.Add(optionsButton);
        this.Add(returnButton);
    }
Exemplo n.º 2
0
    public ArenaMenuPanel()
    {
        uiPos         = new ArenaMenuUIPosition();
        BattlePressed = false;
        Material arenaMenuMaterial = UIResourceMgr.GetInstance().GetMaterial("ArenaMenu");
        Material buttonsMaterial   = UIResourceMgr.GetInstance().GetMaterial("Buttons");

        background = new UIImage();
        background.SetTexture(arenaMenuMaterial,

                              ArenaMenuTexturePosition.Background, AutoRect.AutoSize(ArenaMenuTexturePosition.Background));
        background.Rect = AutoRect.AutoPos(uiPos.Background);


        /*
         * avatarPanel = new UITextImage();
         * avatarPanel.SetTexture(arenaMenuMaterial,
         *
         * ArenaMenuTexturePosition.AvatarImage);
         * avatarPanel.Rect = uiPos.AvatarPanel;
         * avatarPanel.SetText(ConstData.FONT_NAME1, AvatarInfo.AVATAR_NAME[(int)GameApp.GetInstance().GetGameState().Avatar], ColorName.fontColor_darkred);
         */

        Material shopMaterial = UIResourceMgr.GetInstance().GetMaterial("ShopUI");

        daysPanel = new UITextImage();
        daysPanel.SetTexture(shopMaterial,

                             ShopTexturePosition.DayLargePanel, AutoRect.AutoSize(ShopTexturePosition.DayLargePanel));
        daysPanel.Rect = AutoRect.AutoPos(uiPos.DaysPanel);
        daysPanel.SetText(ConstData.FONT_NAME0, "DAY " + GameApp.GetInstance().GetGameState().LevelNum, ColorName.fontColor_darkred);


        cashPanel = new CashPanel();

        upgradeButton = new UITextButton();
        upgradeButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial,

                                 ButtonsTexturePosition.ButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.MiddleSizeButton));
        upgradeButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial,

                                 ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.MiddleSizeButton));
        upgradeButton.Rect = AutoRect.AutoPos(uiPos.UpgradeButton);
        upgradeButton.SetText(ConstData.FONT_NAME1, " ARMORY", ColorName.fontColor_orange);


        equipmentButton = new UITextButton();
        equipmentButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial,

                                   ButtonsTexturePosition.ButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.MiddleSizeButton));
        equipmentButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial,

                                   ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.MiddleSizeButton));
        equipmentButton.Rect = AutoRect.AutoPos(uiPos.EquipmentButton);
        equipmentButton.SetText(ConstData.FONT_NAME1, " EQUIP", ColorName.fontColor_orange);



        avatarButton = new UITextButton();
        avatarButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial,

                                ButtonsTexturePosition.ButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.MiddleSizeButton));

        avatarButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial,

                                ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.MiddleSizeButton));
        avatarButton.Rect = AutoRect.AutoPos(uiPos.AvatarButton);
        avatarButton.SetText(ConstData.FONT_NAME1, " CHARACTER", ColorName.fontColor_orange);



        battleButton = new UITextButton();
        battleButton.SetTexture(UIButtonBase.State.Normal, shopMaterial,

                                ShopTexturePosition.MapButtonNormal, AutoRect.AutoSize(ShopTexturePosition.MapButtonNormal));
        battleButton.SetTexture(UIButtonBase.State.Pressed, shopMaterial,

                                ShopTexturePosition.MapButtonPressed, AutoRect.AutoSize(ShopTexturePosition.MapButtonPressed));
        battleButton.Rect = AutoRect.AutoPos(uiPos.BattleButton);
        battleButton.SetText(ConstData.FONT_NAME0, " MAP", ColorName.fontColor_orange);



        returnButton = new UIClickButton();
        returnButton.SetTexture(UIButtonBase.State.Normal, arenaMenuMaterial,

                                ArenaMenuTexturePosition.ReturnButtonNormal, AutoRect.AutoSize(ArenaMenuTexturePosition.ReturnButtonNormal));
        returnButton.SetTexture(UIButtonBase.State.Pressed, arenaMenuMaterial,

                                ArenaMenuTexturePosition.ReturnButtonPressed, AutoRect.AutoSize(ArenaMenuTexturePosition.ReturnButtonPressed));
        returnButton.Rect = AutoRect.AutoPos(uiPos.ReturnButton);



        optionsButton = new UIClickButton();
        optionsButton.SetTexture(UIButtonBase.State.Normal, arenaMenuMaterial,

                                 ArenaMenuTexturePosition.OptionsButton, AutoRect.AutoSize(ArenaMenuTexturePosition.OptionsButton));
        optionsButton.SetTexture(UIButtonBase.State.Pressed, arenaMenuMaterial,

                                 ArenaMenuTexturePosition.OptionsButtonPressed, AutoRect.AutoSize(ArenaMenuTexturePosition.OptionsButtonPressed));
        optionsButton.Rect = AutoRect.AutoPos(uiPos.OptionsButton);

        Material startMenuMaterial = UIResourceMgr.GetInstance().GetMaterial("StartMenu");

        leaderButton = new UITextButton();
        leaderButton.SetTexture(UIButtonBase.State.Normal, startMenuMaterial,

                                StartMenuTexturePosition.AcheivementButtonNormal, AutoRect.AutoSize(StartMenuTexturePosition.AcheivementButtonNormal) * 1.3f);
        leaderButton.SetTexture(UIButtonBase.State.Pressed, startMenuMaterial,

                                StartMenuTexturePosition.AcheivementButtonPressed, AutoRect.AutoSize(StartMenuTexturePosition.AcheivementButtonPressed) * 1.3f);

        leaderButton.Rect = AutoRect.AutoPos(uiPos.AchievementButton);


        achieveButton = new UITextButton();
        achieveButton.SetTexture(UIButtonBase.State.Normal, startMenuMaterial,

                                 StartMenuTexturePosition.LeaderBoardsButtonNormal, AutoRect.AutoSize(StartMenuTexturePosition.LeaderBoardsButtonNormal) * 1.3f);
        achieveButton.SetTexture(UIButtonBase.State.Pressed, startMenuMaterial,

                                 StartMenuTexturePosition.LeaderBoardsButtonPressed, AutoRect.AutoSize(StartMenuTexturePosition.LeaderBoardsButtonPressed) * 1.3f);

        achieveButton.Rect = AutoRect.AutoPos(uiPos.LeaderBoardButton);



        if (AutoRect.GetPlatform() == Platform.IPad)
        {
            avatar3DFrame = new Avatar3DFrame(AutoRect.AutoPos(new Rect(0, 10, 500, 600)), new Vector3(-1.299798f * 0.9f, -0.9672753f * 1f, 3.420711f), new Vector3(1.5f, 1.5f, 1.5f) * 0.9f);
        }
        else
        {
            avatar3DFrame = new Avatar3DFrame(AutoRect.AutoPos(new Rect(0, 10, 500, 600)), new Vector3(-1.299798f, -1.0672753f, 3.420711f), new Vector3(1.5f, 1.5f, 1.5f));
        }

        ui = GameObject.Find("ArenaMenuUI").GetComponent <ArenaMenuUI>();

        this.Add(background);
        //this.Add(avatarPanel);
        this.Add(daysPanel);
        this.Add(cashPanel);
        this.Add(upgradeButton);
        this.Add(equipmentButton);
        //this.Add(optionsButton);
        this.Add(battleButton);
        this.Add(avatarButton);
        //this.Add(returnButton);
        this.Add(leaderButton);
        this.Add(achieveButton);
        this.Add(avatar3DFrame);

        SetUIHandler(this);

        startTime = Time.time;
    }
Exemplo n.º 3
0
    public PauseMenuUI()
    {
        uiPos = new PauseMenuUIPosition();

        gameState = GameApp.GetInstance().GetGameState();


        buttonsMaterial = UIResourceMgr.GetInstance().GetMaterial("Buttons");
        gameuiMaterial  = UIResourceMgr.GetInstance().GetMaterial("GameUI");
        background      = new UIImage();
        background.SetTexture(gameuiMaterial,

                              GameUITexturePosition.Dialog, AutoRect.AutoSize(GameUITexturePosition.DialogSize));
        background.Rect = AutoRect.AutoPos(uiPos.Background);


        pauseLabel = new UITextImage();
        pauseLabel.SetTexture(buttonsMaterial,

                              ButtonsTexturePosition.Label, AutoRect.AutoSize(ButtonsTexturePosition.Label));
        pauseLabel.Rect = AutoRect.AutoPos(uiPos.PauseLabel);
        pauseLabel.SetText(ConstData.FONT_NAME1, " PAUSE", ColorName.fontColor_orange);


        soundLabel = new UITextImage();
        soundLabel.SetTexture(buttonsMaterial,

                              ButtonsTexturePosition.Label, AutoRect.AutoSize(ButtonsTexturePosition.Label));
        soundLabel.Rect = AutoRect.AutoPos(uiPos.SoundLabel);
        soundLabel.SetText(ConstData.FONT_NAME1, " SOUND", ColorName.fontColor_orange);



        resumeButton = new UITextButton();
        resumeButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial,

                                ButtonsTexturePosition.ButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.SmallSizeButton));
        resumeButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial,

                                ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.SmallSizeButton));
        resumeButton.Rect = AutoRect.AutoPos(uiPos.ResumeButton);
        resumeButton.SetText(ConstData.FONT_NAME1, " RESUME", ColorName.fontColor_orange);


        musicButtonOff = new UITextSelectButton();
        musicButtonOff.SetTexture(UIButtonBase.State.Normal, buttonsMaterial,

                                  ButtonsTexturePosition.SoundButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.SoundButtonNormal));
        musicButtonOff.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial,

                                  ButtonsTexturePosition.SoundButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.SoundButtonPressed));
        musicButtonOff.Rect = AutoRect.AutoPos(uiPos.MusicButtonOff);
        musicButtonOff.SetText(ConstData.FONT_NAME1, " OFF", ColorName.fontColor_orange);



        musicButtonOn = new UITextSelectButton();
        musicButtonOn.SetTexture(UIButtonBase.State.Normal, buttonsMaterial,

                                 ButtonsTexturePosition.SoundButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.SoundButtonNormal));
        musicButtonOn.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial,

                                 ButtonsTexturePosition.SoundButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.SoundButtonPressed));
        musicButtonOn.Rect = AutoRect.AutoPos(uiPos.MusicButtonOn);
        musicButtonOn.SetText(ConstData.FONT_NAME1, " ON", ColorName.fontColor_orange);

        if (gameState.MusicOn)
        {
            musicButtonOn.Set(true);
            musicButtonOff.Set(false);
        }
        else
        {
            musicButtonOn.Set(false);
            musicButtonOff.Set(true);
        }



        returnButton = new UITextButton();
        returnButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial,

                                ButtonsTexturePosition.ButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.SmallSizeButton));
        returnButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial,

                                ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.SmallSizeButton));
        returnButton.Rect = AutoRect.AutoPos(uiPos.ReturnButton);
        returnButton.SetText(ConstData.FONT_NAME1, " QUIT", ColorName.fontColor_orange);


        mask = new UIImage();
        mask.SetTexture(gameuiMaterial, GameUITexturePosition.Mask, AutoRect.AutoSize(uiPos.Mask));
        mask.Rect = AutoRect.AutoValuePos(uiPos.Mask);



        this.Add(mask);
        this.Add(background);

        //this.Add(pauseLabel);

        this.Add(soundLabel);



        this.Add(musicButtonOff);
        this.Add(musicButtonOn);

        this.Add(resumeButton);
        this.Add(returnButton);



        this.SetUIHandler(this);

        Hide();
    }
Exemplo n.º 4
0
    // Use this for initialization
    public GameOverUI()
    {
        uiPos  = new GameOverUIPosition();
        texPos = new GameOverTexturePosition();

        gameState      = GameApp.GetInstance().GetGameState();
        selectedWeapon = gameState.GetWeapons()[0];

        gameuiMaterial = UIResourceMgr.GetInstance().GetMaterial("GameUI");
        Material buttonsMaterial = UIResourceMgr.GetInstance().GetMaterial("Buttons");

        retryButton = new UITextButton();

        retryButton.Rect = AutoRect.AutoPos(uiPos.RetryButton);
        retryButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial, ButtonsTexturePosition.ButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.ButtonNormal));
        retryButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial, ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.ButtonPressed));
        retryButton.SetText(ConstData.FONT_NAME1, "RETRY", ColorName.fontColor_orange);

        quitButton = new UITextButton();

        quitButton.Rect = AutoRect.AutoPos(uiPos.QuitButton);
        quitButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial, ButtonsTexturePosition.ButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.ButtonNormal));
        quitButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial, ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.ButtonPressed));
        quitButton.SetText(ConstData.FONT_NAME1, "QUIT", ColorName.fontColor_orange);


        dialogImage = new UIImage();
        dialogImage.SetTexture(gameuiMaterial,

                               GameUITexturePosition.Dialog, AutoRect.AutoSize(GameUITexturePosition.Dialog));

        dialogImage.Rect = AutoRect.AutoPos(uiPos.DialogImage);

        mask = new UIImage();
        mask.SetTexture(gameuiMaterial, GameUITexturePosition.Mask, AutoRect.AutoSize(uiPos.Mask));
        mask.Rect = AutoRect.AutoValuePos(uiPos.Mask);

        gameoverLabel = new UITextImage();
        gameoverLabel.SetTexture(buttonsMaterial,

                                 ButtonsTexturePosition.Label, ButtonsTexturePosition.LargeLabelSize * 0.1f);


        gameoverLabel.Rect = AutoRect.AutoPos(uiPos.GameOverLabel);
        //gameoverLabel.SetText(ConstData.FONT_NAME1, " GAME OVER", ColorName.fontColor_orange);



        cashText = new UIText();
        cashText.Set(ConstData.FONT_NAME1, "Cash", ColorName.fontColor_orange);
        cashText.Rect = AutoRect.AutoPos(uiPos.CashText);


        /*
         * surviveTimeText = new UIText();
         * surviveTimeText.Set(ConstData.FONT_NAME2, "TIME ", ColorName.fontColor_darkorange);
         * surviveTimeText.Rect = uiPos.SurviveTimeText;
         */

        firstLineText = new UIText();
        firstLineText.Set(ConstData.FONT_NAME1, "GAME OVER", ColorName.fontColor_darkorange);
        firstLineText.AlignStyle = UIText.enAlignStyle.center;
        firstLineText.Rect       = AutoRect.AutoPos(uiPos.FirstLineText);

        /*
         * scoreText = new UIText();
         * scoreText.Set(ConstData.FONT_NAME2, "KILLS   "+GameApp.GetInstance().GetGameScene().Killed, ColorName.fontColor_darkorange);
         * scoreText.Rect = uiPos.ScoreText;
         */


        gameover = new UIImage();
        gameover.SetTexture(gameuiMaterial, GameUITexturePosition.GameOver, AutoRect.AutoSize(GameUITexturePosition.GameOver) * 0.1f);
        gameover.Rect       = AutoRect.AutoPos(uiPos.GameOver);
        gameover.Visible    = false;
        gameover.Enable     = false;
        retryButton.Visible = false;
        quitButton.Visible  = false;
        //this.Add(dialogImage);
        //this.Add(gameoverLabel);
        this.Add(mask);
        //this.Add(firstLineText);
        //this.Add(scoreText);
        this.Add(retryButton);
        this.Add(quitButton);
        this.Add(gameover);

        this.SetUIHandler(this);

        uiInited = true;
        GameScene gameScene = GameApp.GetInstance().GetGameScene();

        if (gameScene.GetQuest() != null)
        {
            surviveTimeText.SetText("SurviveTime " + gameScene.GetQuest().GetQuestInfo());
            firstLineText.SetText("Kills " + gameScene.Killed);
        }
    }
Exemplo n.º 5
0
    // Use this for initialization
    public OptionsMenuUI()
    {
        uiPos     = new OptionsMenuUIPosition();
        texPos    = new OptionsMenuTexturePosition();
        gameState = GameApp.GetInstance().GetGameState();


        buttonsMaterial   = UIResourceMgr.GetInstance().GetMaterial("Buttons");
        arenaMenuMaterial = UIResourceMgr.GetInstance().GetMaterial("ArenaMenu");


        background = new UIImage();
        background.SetTexture(arenaMenuMaterial,

                              ArenaMenuTexturePosition.Background, AutoRect.AutoSize(ArenaMenuTexturePosition.Background));
        background.Rect = AutoRect.AutoPos(uiPos.Background);



        daysPanel = new UITextImage();
        daysPanel.SetTexture(arenaMenuMaterial,

                             ArenaMenuTexturePosition.Panel, AutoRect.AutoSize(ArenaMenuTexturePosition.Panel));
        daysPanel.Rect = AutoRect.AutoPos(uiPos.DaysPanel);
        daysPanel.SetText(ConstData.FONT_NAME1, "DAY " + GameApp.GetInstance().GetGameState().LevelNum, ColorName.fontColor_darkorange);


        cashPanel = new CashPanel();


        soundPanel = new UITextImage();
        soundPanel.SetTexture(buttonsMaterial,

                              ButtonsTexturePosition.Label, AutoRect.AutoSize(ButtonsTexturePosition.Label));
        soundPanel.Rect = AutoRect.AutoPos(uiPos.SoundPanel);
        soundPanel.SetText(ConstData.FONT_NAME1, " SOUND", ColorName.fontColor_darkorange);

        musicButtonOff = new UITextSelectButton();
        musicButtonOff.SetTexture(UIButtonBase.State.Normal, buttonsMaterial,

                                  ButtonsTexturePosition.SoundButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.SoundButtonNormal));
        musicButtonOff.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial,

                                  ButtonsTexturePosition.SoundButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.SoundButtonPressed));
        musicButtonOff.Rect = AutoRect.AutoPos(uiPos.MusicButtonOff);
        musicButtonOff.SetText(ConstData.FONT_NAME1, " OFF", ColorName.fontColor_orange);



        musicButtonOn = new UITextSelectButton();
        musicButtonOn.SetTexture(UIButtonBase.State.Normal, buttonsMaterial,

                                 ButtonsTexturePosition.SoundButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.SoundButtonNormal));
        musicButtonOn.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial,

                                 ButtonsTexturePosition.SoundButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.SoundButtonPressed));
        musicButtonOn.Rect = AutoRect.AutoPos(uiPos.MusicButtonOn);
        musicButtonOn.SetText(ConstData.FONT_NAME1, " ON", ColorName.fontColor_orange);

        if (gameState.MusicOn)
        {
            musicButtonOn.Set(true);
            musicButtonOff.Set(false);
        }
        else
        {
            musicButtonOn.Set(false);
            musicButtonOff.Set(true);
        }



        creditsButton = new UITextButton();
        creditsButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial,

                                 ButtonsTexturePosition.ButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.MiddleSizeButton));
        creditsButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial,

                                 ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.MiddleSizeButton));

        creditsButton.Rect = AutoRect.AutoPos(uiPos.CreditsButton);
        creditsButton.SetText(ConstData.FONT_NAME1, " CREDITS", ColorName.fontColor_orange);



        shareButton = new UITextButton();
        shareButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial,

                               ButtonsTexturePosition.ButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.SmallSizeButton));
        shareButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial,

                               ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.SmallSizeButton));

        shareButton.Rect = AutoRect.AutoPos(uiPos.ShareButton);
        shareButton.SetText(ConstData.FONT_NAME1, " SHARE", ColorName.fontColor_darkorange);


        reviewButton = new UITextButton();
        reviewButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial,

                                ButtonsTexturePosition.ButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.SmallSizeButton));
        reviewButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial,

                                ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.SmallSizeButton));

        reviewButton.Rect = AutoRect.AutoPos(uiPos.ReviewButton);
        reviewButton.SetText(ConstData.FONT_NAME1, " REVIEW", ColorName.fontColor_darkorange);



        supportButton = new UITextButton();
        supportButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial,

                                 ButtonsTexturePosition.ButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.SmallSizeButton));
        supportButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial,

                                 ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.SmallSizeButton));

        supportButton.Rect = AutoRect.AutoPos(uiPos.SupportButton);
        supportButton.SetText(ConstData.FONT_NAME1, " SUPPORT", ColorName.fontColor_darkorange);

        returnButton = new UIClickButton();
        returnButton.SetTexture(UIButtonBase.State.Normal, arenaMenuMaterial,

                                ArenaMenuTexturePosition.ReturnButtonNormal, AutoRect.AutoSize(ArenaMenuTexturePosition.ReturnButtonNormal));
        returnButton.SetTexture(UIButtonBase.State.Pressed, arenaMenuMaterial,

                                ArenaMenuTexturePosition.ReturnButtonPressed, AutoRect.AutoSize(ArenaMenuTexturePosition.ReturnButtonPressed));

        returnButton.Rect = AutoRect.AutoPos(uiPos.ReturnButton);



        creditsPanel = new CreditsMenuUI();

        this.Add(background);
        this.Add(daysPanel);
        this.Add(cashPanel);
        this.Add(soundPanel);
        this.Add(musicButtonOff);
        this.Add(musicButtonOn);
        this.Add(creditsButton);
        this.Add(shareButton);
        this.Add(reviewButton);
        this.Add(supportButton);
        this.Add(returnButton);

        this.Add(creditsPanel);

        ui = MapUI.GetInstance();
        this.SetUIHandler(this);
    }