예제 #1
0
    public void SetButtonTexture(Material material, Rect normalRect, Rect pressedRect, Vector2 textureSize)
    {
        if (m_Mode == DialogMode.YES_OR_NO)
        {
            m_YesButton.SetTexture(UIButtonBase.State.Normal, material, normalRect, textureSize);
            m_YesButton.SetTexture(UIButtonBase.State.Pressed, material, pressedRect, textureSize);

            m_NoButton.SetTexture(UIButtonBase.State.Normal, material, normalRect, textureSize);
            m_NoButton.SetTexture(UIButtonBase.State.Pressed, material, pressedRect, textureSize);
        }
    }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        ResolutionConstant.R = ((float)Screen.width) / 960f;
        UIResourceMgr.GetInstance().LoadStartMenuUIMaterials();    //! 加载开始菜单需要的材质


        uiPos = new StartMenuUIPosition();
        //texPos = new StartMenuTexturePosition();

        //! UIManager
        m_UIManager = gameObject.AddComponent <UIManager>() as UIManager;
        m_UIManager.SetParameter(8, 1, false);
        m_UIManager.SetUIHandler(this);                     //! HandleEvent
        m_UIManager.CLEAR = true;

        startMenuMaterial = UIResourceMgr.GetInstance().GetMaterial("StartMenu");      //! StartMenu 材质
        //startMenu2Material = UIResourceMgr.GetInstance().GetMaterial("StartMenu2");
        Material buttonsMaterial = UIResourceMgr.GetInstance().GetMaterial("Buttons"); //! Button材质

        background = new UIImage();
        background.SetTexture(startMenuMaterial, StartMenuTexturePosition.Background, AutoRect.AutoSize(StartMenuTexturePosition.Background));
        background.Rect = AutoRect.AutoPos(uiPos.Background);


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

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

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

        startButton.Rect = AutoRect.AutoPos(uiPos.StartButton);
        startButton.SetText(ConstData.FONT_NAME1, " NEW GAME", ColorName.fontColor_orange);

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

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

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

        continueButton.Rect = AutoRect.AutoPos(uiPos.ContinueButton);

        continueButton.SetText(ConstData.FONT_NAME1, " CONTINUE", ColorName.fontColor_orange);



        gameDialog = new GameDialog(UIDialog.DialogMode.YES_OR_NO);
        gameDialog.SetText(ConstData.FONT_NAME2, "\n\nAre You Sure You Want To Erase Your Progress And Start A New Game?", ColorName.fontColor_darkorange);
        gameDialog.SetDialogEventHandler(this);


        m_UIManager.Add(background);
        m_UIManager.Add(startButton);
        m_UIManager.Add(continueButton);

        m_UIManager.Add(gameDialog);

        GameApp.GetInstance().Init();
        GameCenterInterface.Login();

        string path = Application.dataPath + "/../../Documents/";

        if (File.Exists(path + "MySavedGame.game"))
        {
        }
        else
        {
            continueButton.Visible = false;
            continueButton.Enable  = false;
        }

        FlurryTAd.ShowTAd(true);
    }
예제 #3
0
    // Use this for initialization
    public WeaponUpgradeUI()
    {
        uiPos = new WeaponUpgradeUIPosition();

        GameApp.GetInstance().Init();
        gameState          = GameApp.GetInstance().GetGameState();
        currentWeaponIndex = -1;
        selectedWeapon     = null;


        weaponList = GameApp.GetInstance().GetGameState().GetWeapons();


        arenaMaterial = UIResourceMgr.GetInstance().GetMaterial("ArenaMenu");



        background = new UIImage();
        background.SetTexture(arenaMaterial, ArenaMenuTexturePosition.Background, AutoRect.AutoSize(ArenaMenuTexturePosition.Background));
        background.Rect = AutoRect.AutoPos(uiPos.Background);



        for (int i = 0; i < 4; i++)
        {
            upgradePanels[i] = new UpgradePanel(new Rect(500, 465 - i * 100, 424, 108), i);
            upgradePanels[i].Show();
        }
        upgradePanels[0].SetButtonText("DAMAGE");
        upgradePanels[1].SetButtonText("FIRE RATE");
        upgradePanels[2].SetButtonText("ACCURACY");
        upgradePanels[3].SetButtonText("AMMO");



        returnButton = new UIClickButton();
        returnButton.SetTexture(UIButtonBase.State.Normal, arenaMaterial,
                                ArenaMenuTexturePosition.ReturnButtonNormal, AutoRect.AutoSize(ArenaMenuTexturePosition.ReturnButtonNormal));
        returnButton.SetTexture(UIButtonBase.State.Pressed, arenaMaterial,

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



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

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

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

                                 ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.ButtonPressed));
        upgradeButton.Rect = AutoRect.AutoPos(uiPos.UpgradeButton);


        getMoreMoneyButton = new UITextButton();
        getMoreMoneyButton.SetTexture(UIButtonBase.State.Normal, arenaMaterial,

                                      ArenaMenuTexturePosition.GetMoneyButtonNormal, AutoRect.AutoSize(ArenaMenuTexturePosition.GetMoneyButtonSmallSize));
        getMoreMoneyButton.SetTexture(UIButtonBase.State.Pressed, arenaMaterial,

                                      ArenaMenuTexturePosition.GetMoneyButtonPressed, AutoRect.AutoSize(ArenaMenuTexturePosition.GetMoneyButtonSmallSize));
        getMoreMoneyButton.Rect = AutoRect.AutoPos(uiPos.GetMoreMoneyButton);


        cashPanel = new CashPanel();



        upgradeButton.SetText(ConstData.FONT_NAME0, " UPGRADE", ColorName.fontColor_orange);

        UpdateWeaponInfo();
        InitSelection();



        this.Add(background);



        this.Add(returnButton);
        this.Add(getMoreMoneyButton);
        this.Add(upgradeButton);

        for (int i = 0; i < 4; i++)
        {
            this.Add(upgradePanels[i]);
        }

        weaponUI  = UIResourceMgr.GetInstance().GetMaterial("Weapons");
        weaponUI2 = UIResourceMgr.GetInstance().GetMaterial("Weapons2");

        weaponScroller = new UIImageScroller(AutoRect.AutoPos(new Rect(0, 0, 500, 640)), AutoRect.AutoPos(new Rect(10, 120, 500, 440)), 1, AutoRect.AutoSize(WeaponsLogoTexturePosition.WeaponLogoSize), ScrollerDir.Vertical, true);
        weaponScroller.SetImageSpacing(AutoRect.AutoSize(WeaponsLogoTexturePosition.WeaponLogoSpacing));
        Material shopMaterial = UIResourceMgr.GetInstance().GetMaterial("ShopUI");

        Material avatarMaterial = UIResourceMgr.GetInstance().GetMaterial("Avatar");

        weaponScroller.SetCenterFrameTexture(avatarMaterial, AvatarTexturePosition.Frame);


        weaponScroller.AddOverlay(shopMaterial, ShopTexturePosition.LockedLogo);
        weaponScroller.AddOverlay(shopMaterial, ShopTexturePosition.BuyLogo);


        UIImage        uiImage = new UIImage();
        TexturePosInfo info    = WeaponsLogoTexturePosition.GetWeaponTextureRect(weaponList.Count);

        uiImage.SetTexture(info.m_Material, info.m_TexRect, AutoRect.AutoSize(info.m_TexRect));
        uiImage.Rect = info.m_TexRect;
        weaponScroller.Add(uiImage);


        for (int i = 0; i < weaponList.Count; i++)
        {
            uiImage = new UIImage();
            info    = WeaponsLogoTexturePosition.GetWeaponTextureRect(i);
            uiImage.SetTexture(info.m_Material, info.m_TexRect, AutoRect.AutoSize(info.m_TexRect));
            uiImage.Rect = info.m_TexRect;
            weaponScroller.Add(uiImage);
        }


        this.Add(weaponScroller);
        weaponScroller.EnableScroll();
        this.Add(cashPanel);
        for (int i = 0; i < weaponList.Count; i++)
        {
            if (weaponList[i].Exist == WeaponExistState.Locked)
            {
                weaponScroller.SetOverlay(i + 1, 0);
            }
            else if (weaponList[i].Exist == WeaponExistState.Unlocked)
            {
                weaponScroller.SetOverlay(i + 1, 1);
            }
        }

        Material avatarLogoMaterial = UIResourceMgr.GetInstance().GetMaterial("Avatar");

        weaponScroller.SetMaskImage(avatarLogoMaterial, AvatarTexturePosition.Mask);

        weaponScroller.Show();


        iapDialog = new IAPDialog(UIDialog.DialogMode.YES_OR_NO);

        iapDialog.SetDialogEventHandler(this);

        this.Add(iapDialog);


        cashPanel.Show();

        SetUIHandler(this);

        uiInited = true;
        Hide();
    }
예제 #4
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;
    }
예제 #5
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);
        }
    }
예제 #6
0
파일: PauseMenuUI.cs 프로젝트: kidundead/ow
    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();
    }
예제 #7
0
파일: AvatarUI.cs 프로젝트: kidundead/ow
    // Use this for initialization
    public AvatarUI()
    {
        uiPos = new AvatarUIPosition();

        /*
         * for (int i = 0; i < AvatarTexturePosition.AvatarLogo.Length; i++)
         * {
         *  int x = i % 2;
         *  int y = i / 2;
         *  AvatarTexturePosition.AvatarLogo[i] = new Rect(x * 446, y * 200, 446, 200);
         * }
         */
        AvatarTexturePosition.InitLogosTexturePos();

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

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

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



        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);


        buyButton = new UITextButton();
        buyButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial, ButtonsTexturePosition.ButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.ButtonNormal));
        buyButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial, ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.ButtonPressed));
        buyButton.Rect = AutoRect.AutoPos(uiPos.BuyButton);
        buyButton.SetText(ConstData.FONT_NAME0, " SELECT", ColorName.fontColor_orange);
        SetBuyButtonText();
        cashPanel = new CashPanel();

        getMoreMoneyButton = new UITextButton();
        getMoreMoneyButton.SetTexture(UIButtonBase.State.Normal, arenaMenuMaterial,

                                      ArenaMenuTexturePosition.GetMoneyButtonNormal, AutoRect.AutoSize(ArenaMenuTexturePosition.GetMoneyButtonSmallSize));
        getMoreMoneyButton.SetTexture(UIButtonBase.State.Pressed, arenaMenuMaterial,

                                      ArenaMenuTexturePosition.GetMoneyButtonPressed, AutoRect.AutoSize(ArenaMenuTexturePosition.GetMoneyButtonSmallSize));
        getMoreMoneyButton.Rect = AutoRect.AutoPos(uiPos.GetMoreMoneyButton);


        avatarInfoPanel = new AvatarInfoPanel();
        avatarInfoPanel.SetText("ffff");


        this.Add(background);
        //this.Add(avatarImage);
        this.Add(buyButton);


        avatarScroller = new UIImageScroller(AutoRect.AutoPos(new Rect(450, 0, 500, 640)), AutoRect.AutoPos(new Rect(442, 216, 500, 400)), 1, AutoRect.AutoSize(AvatarTexturePosition.AvatarLogoSize), ScrollerDir.Vertical, true);
        avatarScroller.SetImageSpacing(AutoRect.AutoSize(AvatarTexturePosition.AvatarLogoSpacing));
        Material shopMaterial = UIResourceMgr.GetInstance().GetMaterial("ShopUI");

        avatarScroller.AddOverlay(shopMaterial, ShopTexturePosition.SmallBuyLogo);

        for (int i = 0; i < BUTTON_NUM; i++)
        {
            UIImage aImage = new UIImage();
            aImage.SetTexture(avatarLogoMaterial, AvatarTexturePosition.AvatarLogo[BUTTON_NUM - 1 - i]);
            avatarScroller.Add(aImage);
        }
        avatarScroller.SetMaskImage(avatarLogoMaterial, AvatarTexturePosition.Mask);
        this.Add(returnButton);
        //this.Add(textBackground);
        //this.Add(avatarInfoText);



        avatarScroller.SetCenterFrameTexture(avatarLogoMaterial, AvatarTexturePosition.Frame);

        avatarScroller.EnableScroll();



        this.Add(avatarScroller);
        this.Add(avatarInfoPanel);
        this.Add(cashPanel);
        UpdateAvatarIcon();

        avatarScroller.Show();
        avatarInfoPanel.Show();
        if (AutoRect.GetPlatform() == Platform.IPad)
        {
            avatarFrame = new Avatar3DFrame(AutoRect.AutoPos(new Rect(0, 10, 400, 600)), new Vector3(-1.589703f * 0.8f, -1.1672753f * 0.9f, 4.420711f), new Vector3(1.5f, 1.5f, 1.5f) * 0.9f);
        }
        else
        {
            avatarFrame = new Avatar3DFrame(AutoRect.AutoPos(new Rect(0, 10, 400, 600)), new Vector3(-1.589703f, -1.1672753f, 4.420711f), new Vector3(1.5f, 1.5f, 1.5f));
        }


        this.Add(avatarFrame);
        this.Add(getMoreMoneyButton);

        UpdateCashPanel();

        iapDialog = new IAPDialog(UIDialog.DialogMode.YES_OR_NO);

        iapDialog.SetDialogEventHandler(this);

        this.Add(iapDialog);



        this.SetUIHandler(this);
        Hide();
    }
예제 #8
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);
    }