Пример #1
0
 public void SetText(string font, string text, Color color)
 {
     m_Text.Set(font, text, color);
     m_Text.AlignStyle = UIText.enAlignStyle.center;
     m_Text.Rect       = Rect;
     m_Text.SetParent(this);
 }
Пример #2
0
    public CashPanel()
    {
        Material arenaMaterial = UIResourceMgr.GetInstance().GetMaterial("ArenaMenu");

        WeaponUpgradeUIPosition uiPos = new WeaponUpgradeUIPosition();

        backPanel = new UITextImage();
        backPanel.SetTexture(arenaMaterial, ArenaMenuTexturePosition.CashPanel, AutoRect.AutoSize(ArenaMenuTexturePosition.CashPanel));
        backPanel.Rect = AutoRect.AutoPos(uiPos.CashPanel);

        costPanel = new UITextImage();
        costPanel.SetTexture(arenaMaterial, ArenaMenuTexturePosition.CashPanel, AutoRect.AutoSize(ArenaMenuTexturePosition.CashPanel));
        costPanel.Rect = AutoRect.AutoPos(uiPos.CostPanel);

        cashText = new UIText();
        cashText.Set(ConstData.FONT_NAME2, "", ColorName.fontColor_darkorange);
        cashText.AlignStyle = UIText.enAlignStyle.left;
        cashText.Rect       = AutoRect.AutoPos(new Rect(uiPos.CashPanel.x + 40, uiPos.CashPanel.y, uiPos.CashPanel.width * 0.6f, uiPos.CashPanel.height - 10));

        costText = new UIText();
        costText.Set(ConstData.FONT_NAME2, "", ColorName.fontColor_red);
        costText.AlignStyle = UIText.enAlignStyle.center;
        costText.Rect       = AutoRect.AutoPos(new Rect(uiPos.CostPanel.x + 40, uiPos.CostPanel.y, uiPos.CostPanel.width * 0.6f, uiPos.CostPanel.height - 10));
        costPanel.Visible   = false;
        costPanel.Enable    = false;
        this.Add(backPanel);
        this.Add(costPanel);
        this.Add(cashText);
        this.Add(costText);
    }
Пример #3
0
    public LoadingPanel()
    {
        m_LoadingText = new UIText();
        m_LoadingText.Set(ConstData.FONT_NAME1, "LOADING...", ColorName.fontColor_darkorange);
        m_LoadingText.AlignStyle = UIText.enAlignStyle.center;
        m_LoadingText.Rect       = AutoRect.AutoPos(new Rect(0, 70, 960, 100));



        m_desc = new UIText();
        m_desc.Set(ConstData.FONT_NAME2, "YOUR TOWN HAS BEEN INFECTED...\n\nALL YOUR FAMILY, FRIENDS, AND CO-WORKERS HAVE TURNED INTO ZOMBIES.\n\nFIGHT FOR YOUR LIFE.\n\nFIGHT FOR AS LONG AS YOU CAN...", Color.white);
        m_desc.AlignStyle = UIText.enAlignStyle.center;
        m_desc.Rect       = AutoRect.AutoPos(new Rect(0, 120, 960, 640));
        string path = Application.dataPath + "/../../Documents/";

        this.Add(m_desc);
        if (GameApp.GetInstance().GetGameState().FirstTimeGame&& Application.loadedLevelName != SceneName.ARENA_MENU)
        {
        }
        else
        {
            this.Add(m_LoadingText);
            int size = AvatarInfo.TIPS_INO.Length;
            int rnd  = Random.RandomRange(0, size);
            m_desc.Rect = AutoRect.AutoPos(new Rect(0, 0, 960, 640));
            m_desc.SetText(AvatarInfo.TIPS_INO[rnd]);
        }
    }
Пример #4
0
 public override void Show()
 {
     //GameApp.GetInstance().GetGameScene().BonusWeapon = GameApp.GetInstance().GetGameState().GetWeapons()[2];
     SetUnlockWeapon(GameApp.GetInstance().GetGameScene().BonusWeapon);
     firstLineText.Set(ConstData.FONT_NAME2, GameApp.GetInstance().GetGameScene().BonusWeapon.Name + " IS AVAILABLE FOR PURCHASE!", ColorName.fontColor_darkorange);
     base.Show();
 }
Пример #5
0
    public UnlockPanel()
    {
        unlockWeaponText  = new UIText();
        unlockAvatarImage = new UIImage();
        unlockAvatarText  = new UIText();

        unlockWeaponImage      = new UIImage();
        unlockWeaponImage.Rect = new Rect(240, 220, 194, 112);
        unlockWeaponText.Set(ConstData.FONT_NAME2, " IS AVAILABLE!", ColorName.fontColor_yellow);
        unlockWeaponText.AlignStyle = UIText.enAlignStyle.center;
        unlockWeaponText.Rect       = new Rect(440, 220, 294, 112);
        unlockWeaponText.Visible    = false;
        this.Add(unlockWeaponImage);
        this.Add(unlockWeaponText);
        this.Add(unlockAvatarImage);
        this.Add(unlockAvatarText);
    }
Пример #6
0
    public WeaponInfoPanel()
    {
        EquipmentUIPosition uiPos          = new EquipmentUIPosition();
        Material            dialogMaterial = UIResourceMgr.GetInstance().GetMaterial("Dialog");

        background = new UIImage();
        background.SetTexture(dialogMaterial, DialogTexturePosition.TextBox, AutoRect.AutoSize(DialogTexturePosition.TextBox));
        background.Rect   = AutoRect.AutoPos(uiPos.WeaponInfoPanel);
        background.Enable = false;
        Add(background);


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

        bulletLogo = new UIImage();
        Rect brect = ButtonsTexturePosition.GetBulletsLogoRect(1);

        bulletLogo.SetTexture(buttonsMaterial, brect, AutoRect.AutoSize(brect));
        bulletLogo.Rect    = AutoRect.AutoPos(new Rect(uiPos.WeaponInfoPanel.x + 250, uiPos.WeaponInfoPanel.y + 48, 44, 52));
        bulletLogo.Visible = false;
        bulletLogo.Enable  = false;
        Add(bulletLogo);


        infoText = new UIText();
        infoText.Set(ConstData.FONT_NAME3, "", ColorName.fontColor_darkorange);

        infoText.Rect = AutoRect.AutoPos(new Rect(uiPos.WeaponInfoPanel.x + 50, uiPos.WeaponInfoPanel.y, uiPos.WeaponInfoPanel.width, uiPos.WeaponInfoPanel.height - 40));



        Add(infoText);

        bulletText = new UIText();
        bulletText.Set(ConstData.FONT_NAME3, "", ColorName.fontColor_darkorange);
        bulletText.AlignStyle = UIText.enAlignStyle.left;
        bulletText.Rect       = AutoRect.AutoPos(new Rect(uiPos.WeaponInfoPanel.x + 300, uiPos.WeaponInfoPanel.y - 62, 144, 152));

        Add(bulletText);
    }
Пример #7
0
    public AvatarInfoPanel()
    {
        AvatarUIPosition uiPos          = new AvatarUIPosition();
        Material         dialogMaterial = UIResourceMgr.GetInstance().GetMaterial("Dialog");

        background = new UIImage();
        background.SetTexture(dialogMaterial, DialogTexturePosition.TextBox, AutoRect.AutoSize(DialogTexturePosition.TextBox));
        background.Rect   = AutoRect.AutoPos(uiPos.AvatarInfoPanel);
        background.Enable = false;
        Add(background);



        infoText = new UIText();
        infoText.Set(ConstData.FONT_NAME3, "", ColorName.fontColor_darkorange);

        infoText.Rect = AutoRect.AutoPos(new Rect(uiPos.AvatarInfoPanel.x + 50, uiPos.AvatarInfoPanel.y + 10, uiPos.AvatarInfoPanel.width - 70, uiPos.AvatarInfoPanel.height - 40));



        Add(infoText);
    }
Пример #8
0
    public UpgradePanel(Rect rect, int index)
    {
        arenaMaterial = UIResourceMgr.GetInstance().GetMaterial("ArenaMenu");


        selectPanelButton = new UISelectButton();
        selectPanelButton.SetTexture(UIButtonBase.State.Normal, arenaMaterial,

                                     ArenaMenuTexturePosition.UpgradeButtonNormal, AutoRect.AutoSize(ArenaMenuTexturePosition.UpgradeButtonNormal));
        selectPanelButton.SetTexture(UIButtonBase.State.Pressed, arenaMaterial,

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

        selectPanelButton.SetTexture(UIButtonBase.State.Disabled, arenaMaterial,

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


        selectPanelButton.Rect = AutoRect.AutoPos(rect);

        arrowImage = new UIImage();
        arrowImage.SetTexture(arenaMaterial, ArenaMenuTexturePosition.Arrow, AutoRect.AutoSize(ArenaMenuTexturePosition.Arrow));
        arrowImage.Rect = AutoRect.AutoPos(new Rect(rect.x + 276, rect.y + 62, 36, 26));


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

        bulletLogo = new UIImage();
        Rect brect = ButtonsTexturePosition.GetBulletsLogoRect(1);

        bulletLogo.SetTexture(buttonsMaterial, brect, AutoRect.AutoSize(brect));
        bulletLogo.Rect    = AutoRect.AutoPos(new Rect(rect.x + 156, rect.y + 46, 44, 52));
        bulletLogo.Visible = false;
        bulletLogo.Enable  = false;



        buttonText = new UIText();
        buttonText.Set(ConstData.FONT_NAME2, "", ColorName.fontColor_orange);
        buttonText.Rect = AutoRect.AutoPos(new Rect(rect.x + 56, rect.y + 25, 175, 68));


        currentValueText = new UIText();
        currentValueText.Set(ConstData.FONT_NAME2, "", ColorName.fontColor_orange);
        currentValueText.Rect       = AutoRect.AutoPos(new Rect(688, 526 - 100 * index, 92, 32));
        currentValueText.AlignStyle = UIText.enAlignStyle.right;

        nextValueText = new UIText();
        nextValueText.Set(ConstData.FONT_NAME2, "", ColorName.fontColor_orange);
        nextValueText.Rect       = AutoRect.AutoPos(new Rect(810, 526 - 100 * index, 92, 32));
        nextValueText.AlignStyle = UIText.enAlignStyle.left;


        for (int i = 0; i < 10; i++)
        {
            starsBackground[i] = new UIImage();


            starsBackground[i].SetTexture(arenaMaterial, ArenaMenuTexturePosition.StarEmpty, AutoRect.AutoSize(ArenaMenuTexturePosition.StarEmpty));

            stars[i] = new UIImage();
            stars[i].SetTexture(arenaMaterial, ArenaMenuTexturePosition.StarFull, AutoRect.AutoSize(ArenaMenuTexturePosition.StarFull));

            int x = 572 + i * 24;
            int y = 490 - index * 100;

            starsBackground[i].Rect   = AutoRect.AutoPos(new Rect(x, y, 24, 22));
            starsBackground[i].Enable = false;

            stars[i].Rect   = AutoRect.AutoPos(new Rect(x, y, 24, 22));
            stars[i].Enable = false;
        }


        Add(selectPanelButton);
        Add(arrowImage);
        Add(bulletLogo);
        Add(buttonText);
        Add(currentValueText);
        Add(nextValueText);

        for (int i = 0; i < 10; i++)
        {
            Add(starsBackground[i]);
        }

        for (int i = 0; i < 10; i++)
        {
            Add(stars[i]);
        }
    }
Пример #9
0
    public CreditsMenuUI()
    {
        uiPos     = new CreditsMenuUIPosition();
        texPos    = new CreditsMenuTexturePosition();
        gameState = GameApp.GetInstance().GetGameState();



        if (enableBackground)
        {
            backgroundMenuMaterial = UIResourceMgr.GetInstance().GetMaterial("ArenaMenu");
            Material creditsMaterial = UIResourceMgr.GetInstance().GetMaterial("Credits");

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

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


            titleImage = new UIImage();
            titleImage.SetTexture(backgroundMenuMaterial, texPos.TitleImage);
            titleImage.Rect = uiPos.TitleImage;



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

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

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

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

        /*
         * dialog = new UIImage();
         * dialog.SetTexture(creditsMenuMaterial,
         *
         * texPos.Dialog);
         * dialog.Rect = uiPos.Dialog;
         */



        okButton = new UIClickButton();
        okButton.SetTexture(UIButtonBase.State.Normal, creditsMenuMaterial,

                            texPos.RightButtonNormal);
        okButton.SetTexture(UIButtonBase.State.Pressed, creditsMenuMaterial,

                            texPos.RightButtonPressed);


        okButton.Rect = uiPos.RightButton;



        designerText = new UIText();
        designerText.Set(ConstData.FONT_NAME1, "DESIGNER", ColorName.fontColor_orange);
        designerText.Rect = uiPos.DesignerText;



        artistText = new UIText();
        artistText.Set(ConstData.FONT_NAME1, "ARTIST", ColorName.fontColor_orange);
        artistText.Rect = uiPos.ArtistText;

        programmerText = new UIText();
        programmerText.Set(ConstData.FONT_NAME1, "PROGRAMMER", ColorName.fontColor_orange);
        programmerText.Rect = uiPos.ProgrammerText;


        qaText = new UIText();
        qaText.Set(ConstData.FONT_NAME1, "QA", ColorName.fontColor_orange);
        qaText.Rect = uiPos.QAText;


        if (enableBackground)
        {
            this.Add(background);

            this.Add(returnButton);
            //this.Add(titleImage);
            //this.Add(dialog);
        }
        else
        {
            //this.Add(dialog);
            this.Add(okButton);
        }


        //this.Add(designerText);
        //this.Add(artistText);
        //this.Add(programmerText);
        //this.Add(qaText);
        Hide();


        GameObject obj = GameObject.Find("ArenaMenuUI");

        if (obj != null)
        {
            ui = obj.GetComponent <ArenaMenuUI>();
        }
        this.SetUIHandler(this);
        //gameObject.SetActiveRecursively(false);
    }
Пример #10
0
    // Use this for initialization
    public ShopUI()
    {
        shop = new Shop();
        shop.CreateIAPShopData();
        itemList = shop.GetIAPList();
        for (int i = 0; i < (int)IAPType.Count; i++)
        {
            currentScroll[i] = 0;
        }

        uiPos = new ShopUIPosition();
        //texPos = new ShopTexturePosition();


        arenaMaterial  = UIResourceMgr.GetInstance().GetMaterial("ArenaMenu");
        dialogMaterial = UIResourceMgr.GetInstance().GetMaterial("ShopUI");
        shop2Material  = UIResourceMgr.GetInstance().GetMaterial("ShopUI2");
        background     = new UIImage();
        background.SetTexture(arenaMaterial,

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

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

                               ShopTexturePosition.Dialog, AutoRect.AutoSize(ShopTexturePosition.Dialog));
        dialogImage.Rect = AutoRect.AutoPos(uiPos.Dialog);

        titleImage = new UIImage();
        titleImage.SetTexture(arenaMaterial, ArenaMenuTexturePosition.ShopTitleImage, AutoRect.AutoSize(ArenaMenuTexturePosition.ShopTitleImage));
        titleImage.Rect = AutoRect.AutoPos(uiPos.TitleImage);


        cashPanel = new CashPanel();



        for (int i = 0; i < BUTTON_NUM; i++)
        {
            itemButton[i] = new UIClickButton();

            /*
             * itemButton[i].SetTexture(UIButtonBase.State.Normal, dialogMaterial,
             *
             * itemList[i][currentScroll[i]].textureRect, AutoRect.AutoSize(itemList[i][currentScroll[i]].textureRect));
             * itemButton[i].SetTexture(UIButtonBase.State.Pressed, dialogMaterial,
             *
             * itemList[i][currentScroll[i]].textureRect, AutoRect.AutoSize(itemList[i][currentScroll[i]].textureRect));
             */
            itemButton[i].Rect = AutoRect.AutoPos(new Rect(102 + 251 * i, 640 - 448, 252, 354));



            soldoutLogo[i] = new UIImage();
            soldoutLogo[i].SetTexture(dialogMaterial, ShopTexturePosition.SoldOutLogo);
            soldoutLogo[i].Rect    = new Rect(110 + 270 * i, 640 - 350, 160, 82);
            soldoutLogo[i].Enable  = false;
            soldoutLogo[i].Visible = false;
            itemText[i]            = new UIText();
            itemText[i].Set(ConstData.FONT_NAME2, itemList[0][currentScroll[i]].Desc, ColorName.fontColor_orange);
            itemText[i].AlignStyle = UIText.enAlignStyle.center;
            itemText[i].Rect       = AutoRect.AutoPos(new Rect(104 + 252 * i, 114, 240, 90));

            /*
             * if (itemList[i][currentScroll[i]].Name == IAPName.AutoMissle && GameApp.GetInstance().GetGameState().IsWeaponOwned(WeaponType.Sniper))
             * {
             *  soldoutLogo[i].Visible = true;
             *
             * }
             * if (itemList[i][currentScroll[i]].Name == IAPName.EnegyArmor && GameApp.GetInstance().GetGameState().GetAvatarData(AvatarType.EnegyArmor) == AvatarState.Avaliable)
             * {
             *  soldoutLogo[i].Visible = true;
             *
             * }
             */
        }



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


        categoryText = new UIText();
        categoryText.Set(ConstData.FONT_NAME1, "CASH BAG    WEAPON     AVATAR", ColorName.fontColor_orange);
        categoryText.Rect = uiPos.CategoryText;



        iapLockPanel = new IAPLockPanel();


        this.Add(background);
        this.Add(dialogImage);
        //this.Add(titleImage);

        for (int i = 0; i < BUTTON_NUM; i++)
        {
            this.Add(itemButton[i]);
            this.Add(itemText[i]);
            this.Add(soldoutLogo[i]);
        }

        this.Add(cashPanel);
        this.Add(returnButton);

        leftArrowButton = new UIClickButton();
        leftArrowButton.SetTexture(UIButtonBase.State.Normal, dialogMaterial,

                                   ShopTexturePosition.ArrowNormal, AutoRect.AutoSize(ShopTexturePosition.ArrowNormal));
        leftArrowButton.SetTexture(UIButtonBase.State.Pressed, dialogMaterial,

                                   ShopTexturePosition.ArrowPressed, AutoRect.AutoSize(ShopTexturePosition.ArrowPressed));
        leftArrowButton.Rect = AutoRect.AutoPos(uiPos.LeftButton);

        rightArrowButton = new UIClickButton();
        rightArrowButton.SetTexture(UIButtonBase.State.Normal, dialogMaterial,

                                    ShopTexturePosition.RightArrowNormal, AutoRect.AutoSize(ShopTexturePosition.RightArrowNormal));
        rightArrowButton.SetTexture(UIButtonBase.State.Pressed, dialogMaterial,

                                    ShopTexturePosition.RightArrowPressed, AutoRect.AutoSize(ShopTexturePosition.RightArrowPressed));
        rightArrowButton.Rect = AutoRect.AutoPos(uiPos.RightButton);

        this.Add(leftArrowButton);

        this.Add(rightArrowButton);
        this.Add(iapLockPanel);


        this.SetUIHandler(this);

        UpdateItemsUI();
        Hide();
    }
Пример #11
0
    // Use this for initialization
    public NewItemUI()
    {
        uiPos = new NewItemUIPosition();

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

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



        /*
         * retryButton = new UITextButton();
         *
         * retryButton.Rect = uiPos.RetryButton;
         * retryButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial, ButtonsTexturePosition.ButtonNormal);
         * retryButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial, ButtonsTexturePosition.ButtonPressed);
         * retryButton.SetText(ConstData.FONT_NAME1, "RETRY", ColorName.fontColor_orange);
         *
         * quitButton = new UITextButton();
         *
         * quitButton.Rect = uiPos.QuitButton;
         * quitButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial, ButtonsTexturePosition.ButtonNormal);
         * quitButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial, ButtonsTexturePosition.ButtonPressed);
         * quitButton.SetText(ConstData.FONT_NAME1, "QUIT", ColorName.fontColor_orange);
         */

        Material dialogMaterial = UIResourceMgr.GetInstance().GetMaterial("Dialog");


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

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

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

        unlockWeaponImage      = new UIImage();
        unlockWeaponImage.Rect = AutoRect.AutoPos(uiPos.WeaponLogo);

        newitemLabel = new UIImage();
        newitemLabel.SetTexture(buttonsMaterial,

                                ButtonsTexturePosition.Label, AutoRect.AutoSize(ButtonsTexturePosition.Label));

        newitemLabel.Rect = AutoRect.AutoPos(uiPos.NewItemLabel);

        newitemLabelText = new UIText();
        newitemLabelText.Set(ConstData.FONT_NAME2, " NEW ITEM", ColorName.fontColor_orange);
        newitemLabelText.Rect = AutoRect.AutoPos(uiPos.NewItemLabelText);


        cashText = new UIText();
        cashText.Set(ConstData.FONT_NAME1, "Cash", ColorName.fontColor_yellow);
        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_NAME2, "", 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;
         */


        this.Add(dialogImage);
        this.Add(newitemLabel);
        this.Add(newitemLabelText);
        this.Add(unlockWeaponImage);
        this.Add(firstLineText);
        //this.Add(scoreText);
        //this.Add(retryButton);
        //this.Add(quitButton);


        this.SetUIHandler(this);

        uiInited = true;
    }
Пример #12
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);
        }
    }
Пример #13
0
 public void SetTipText(string font, string text, Color color)
 {
     m_TipText.Set(font, text, color);
 }
Пример #14
0
    // Use this for initialization
    IEnumerator Start()
    {
        yield return(0);

        uiPos = new UIPosition();
        //texPos = new GameUITexturePosition();

        float screenRatioX = ((float)Screen.width) / 960.00f;

        buttonRect = new Rect[4];
        buttonRect[ButtonNames.WEAPON_SWITCH] = new Rect(650, 540, 205, 89);
        buttonRect[ButtonNames.BOMB]          = new Rect(0.4f * Screen.width, 0.25f * Screen.height, 0.24f * Screen.width, 0.08f * Screen.height);
        buttonRect[ButtonNames.CONTINUE]      = new Rect(0.4f * Screen.width, 0.25f * Screen.height, 0.14f * Screen.width, 0.14f * Screen.height);
        buttonRect[ButtonNames.START_OVER]    = new Rect(0.4f * Screen.width, 0.25f * Screen.height, 0.14f * Screen.width, 0.14f * Screen.height);


        if (AutoRect.GetPlatform() == Platform.IPad)
        {
            uiPos.PlayerLogo           = new Rect(-16 - 32, 566 + 64, 116, 81);
            uiPos.PlayerLogoBackground = new Rect(0 - 32, 556 + 64, 134, 88);
            uiPos.HPBackground         = new Rect(94 - 32, 590 - 12 + 64, 288, 50);
            uiPos.HPImage = new Rect(94 - 32, 590 - 12 + 64, 288, 50);
            uiPos.WeaponLogoBackground = new Rect(960 - 148 + 32, 640 - 74 + 54, 148, 88);
            uiPos.WeaponLogo           = new Rect(960 - 180 + 32, 640 - 84 + 64, 194, 112);
            uiPos.BulletsLogo          = new Rect(960 - 420 + 32, 640 - 94 + 64, 194, 112);
            uiPos.WeaponInfo           = new Rect(656 + 32, 558 + 64, 100, 64);
            uiPos.PauseButton          = new Rect(408, 588, 160, 166);
            uiPos.CashText             = new Rect(0, 576 + 64, 1024, 64);
            uiPos.Mask   = new Rect(0, 0, 1024, 768);
            uiPos.Switch = new Rect(960 - 268 + 32, 640 - 90 + 12 + 64, 148, 88);
        }



        gameScene = GameApp.GetInstance().GetGameScene();
        player    = gameScene.GetPlayer();

        m_UIManager = gameObject.AddComponent <UIManager>() as UIManager;
        m_UIManager.SetParameter(8, 1, false);
        m_UIManager.SetUIHandler(this);



        int  avatarLogoIndex = (int)player.GetAvatarType();
        Rect logoRect        = GameUITexturePosition.GetAvatarLogoRect(avatarLogoIndex);

        //Player Logo
        playerLogoImage      = new UIImage();
        playerLogoImage.Rect = AutoRect.AutoPos(uiPos.PlayerLogo);

        playerLogoImage.SetTexture(gameuiMaterial, logoRect, AutoRect.AutoSize(logoRect));
        //playerLogoImage.SetTextureSize(new Vector2(texPos.PlayerLogo.width, texPos.PlayerLogo.height));

        //HP
        hpBackground = new UIImage();
        hpBackground.SetTexture(gameuiMaterial, GameUITexturePosition.HPBackground, AutoRect.AutoSize(GameUITexturePosition.HPBackground));
        hpBackground.Rect = AutoRect.AutoPos(uiPos.HPBackground);


        dayclear = new UIImage();
        dayclear.SetTexture(gameuiMaterial, GameUITexturePosition.DayClear, AutoRect.AutoSize(GameUITexturePosition.DayClear));
        dayclear.Rect    = AutoRect.AutoPos(uiPos.DayClear);
        dayclear.Visible = false;
        dayclear.Enable  = false;
        hpImage          = new UIImage();
        hpImage.SetTexture(gameuiMaterial, GameUITexturePosition.HPImage, AutoRect.AutoSize(GameUITexturePosition.HPImage));


        playerLogoBackgroundImage = new UIImage();
        playerLogoBackgroundImage.SetTexture(gameuiMaterial, GameUITexturePosition.PlayerLogoBackground, AutoRect.AutoSize(GameUITexturePosition.PlayerLogoBackground));
        playerLogoBackgroundImage.Rect = AutoRect.AutoPos(uiPos.PlayerLogoBackground);

        //Weapon Switch
        weaponBackground      = new UIImage();
        weaponBackground.Rect = AutoRect.AutoPos(uiPos.WeaponLogoBackground);
        weaponBackground.SetTexture(gameuiMaterial, GameUITexturePosition.WeaponLogoBackground, AutoRect.AutoSize(GameUITexturePosition.WeaponLogoBackground));


        int  weaponLogoIndex = GameApp.GetInstance().GetGameState().GetWeaponIndex(player.GetWeapon());
        Rect weaponlogoRect  = GameUITexturePosition.GetWeaponLogoRect(weaponLogoIndex);

        weaponLogo      = new UIClickButton();
        weaponLogo.Rect = AutoRect.AutoPos(uiPos.WeaponLogo);
        weaponLogo.SetTexture(UIButtonBase.State.Normal, gameuiMaterial, weaponlogoRect, AutoRect.AutoSize(weaponlogoRect));
        weaponLogo.SetTexture(UIButtonBase.State.Pressed, gameuiMaterial, weaponlogoRect, AutoRect.AutoSize(weaponlogoRect));


        switchImg      = new UIImage();
        switchImg.Rect = AutoRect.AutoPos(uiPos.Switch);
        switchImg.SetTexture(gameuiMaterial, GameUITexturePosition.Switch, AutoRect.AutoSize(GameUITexturePosition.Switch));
        switchImg.Enable = true;

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

        bulletsLogo      = new UIImage();
        bulletsLogo.Rect = AutoRect.AutoPos(uiPos.BulletsLogo);
        Rect bulletlogoRect = ButtonsTexturePosition.GetBulletsLogoRect((int)player.GetWeapon().GetWeaponType());

        bulletsLogo.SetTexture(buttonsMaterial, bulletlogoRect, AutoRect.AutoSize(bulletlogoRect));
        bulletsLogo.Enable = false;



        InputController inputController = player.InputController;
        //Move Joystick
        Vector2 thumbCenter = inputController.ThumbCenter;

        joystickImage      = new UIImage();
        joystickImage.Rect = new Rect((thumbCenter.x - inputController.ThumbRadius), ((Screen.height - thumbCenter.y) - inputController.ThumbRadius), AutoRect.AutoValue(169), AutoRect.AutoValue(168));
        joystickImage.SetTexture(gameuiMaterial, GameUITexturePosition.MoveJoystick, AutoRect.AutoSize(GameUITexturePosition.MoveJoystick));

        joystickThumb = new UIImage();
        joystickThumb.SetTexture(gameuiMaterial, GameUITexturePosition.MoveJoystickThumb, AutoRect.AutoSize(GameUITexturePosition.MoveJoystickThumb));

        thumbCenter             = inputController.ShootThumbCenter;
        shootjoystickImage      = new UIImage();
        shootjoystickImage.Rect = new Rect((thumbCenter.x - inputController.ThumbRadius), ((Screen.height - thumbCenter.y) - inputController.ThumbRadius), AutoRect.AutoValue(169), AutoRect.AutoValue(168));
        shootjoystickImage.SetTexture(gameuiMaterial, GameUITexturePosition.ShootJoystick, AutoRect.AutoSize(GameUITexturePosition.ShootJoystick));
        shootjoystickImage.SetRotation(Mathf.Deg2Rad * 180);

        shootjoystickThumb = new UIImage();
        shootjoystickThumb.SetTexture(gameuiMaterial, GameUITexturePosition.ShootJoystickThumb, AutoRect.AutoSize(GameUITexturePosition.ShootJoystickThumb));


        pauseButton      = new UIClickButton();
        pauseButton.Rect = AutoRect.AutoPos(uiPos.PauseButton);
        pauseButton.SetTexture(UIButtonBase.State.Normal, gameuiMaterial, GameUITexturePosition.PauseButtonNormal, AutoRect.AutoSize(GameUITexturePosition.PauseButtonNormal));
        pauseButton.SetTexture(UIButtonBase.State.Pressed, gameuiMaterial, GameUITexturePosition.PauseButtonPressed, AutoRect.AutoSize(GameUITexturePosition.PauseButtonPressed));


        //Cash
        cashText = new UIText();
        //cashText.Rect = new Rect(0.05f * Screen.width, 0.75f * Screen.height, 400, 50);
        cashText.AlignStyle = UIText.enAlignStyle.center;
        cashText.Rect       = AutoRect.AutoPos(uiPos.CashText);
        cashText.Set(ConstData.FONT_NAME1, "$" + GameApp.GetInstance().GetGameState().GetCash().ToString("N0"), ColorName.fontColor_orange);



        //Weapon Info
        weaponInfoText            = new UIText();
        weaponInfoText.AlignStyle = UIText.enAlignStyle.left;

        weaponInfoText.Rect = AutoRect.AutoPos(uiPos.WeaponInfo);
        weaponInfoText.Set(ConstData.FONT_NAME2, fpsStr, ColorName.fontColor_darkorange);



        fpsText            = new UIText();
        fpsText.AlignStyle = UIText.enAlignStyle.left;
        fpsText.Rect       = AutoRect.AutoPos(uiPos.LevelInfo);
        fpsText.Set(ConstData.FONT_NAME3, "", Color.white);

        dayInfoPanel = new DayInfoPanel();
        dayInfoPanel.SetDay(GameApp.GetInstance().GetGameState().LevelNum);

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

        Vector2 size = AutoRect.AutoSize(GameUITexturePosition.SemiMaskSize);
        Rect    pos  = AutoRect.AutoPos(uiPos.RightSemiMask);

        if (AutoRect.GetPlatform() == Platform.IPad)
        {
            size = new Vector2(512, 768);
            pos  = new Rect(512, 0, 512, 768);
        }
        semiMask = new UIImage();
        semiMask.SetTexture(gameuiMaterial, GameUITexturePosition.Mask, size);
        semiMask.Rect = pos;



        unlockPanel = new UnlockPanel();


        m_UIManager.Add(dayInfoPanel);
        m_UIManager.Add(hpBackground);
        m_UIManager.Add(hpImage);
        m_UIManager.Add(playerLogoBackgroundImage);
        m_UIManager.Add(playerLogoImage);
        m_UIManager.Add(joystickImage);
        m_UIManager.Add(joystickThumb);
        m_UIManager.Add(shootjoystickImage);
        m_UIManager.Add(shootjoystickThumb);
        m_UIManager.Add(weaponBackground);
        m_UIManager.Add(weaponLogo);
        m_UIManager.Add(switchImg);
        m_UIManager.Add(pauseButton);
        m_UIManager.Add(semiMask);
        if (Application.loadedLevelName == SceneName.SCENE_TUTORIAL)
        {
            m_UIManager.Add(dialog);
        }
        m_UIManager.Add(bulletsLogo);
        m_UIManager.Add(weaponInfoText);
        //m_UIManager.Add(cashText);
        m_UIManager.Add(mask);

        m_UIManager.Add(dayclear);
        //m_UIManager.Add(fpsText);

        m_UIManager.Add(unlockPanel);


        semiMask.Enable  = false;
        semiMask.Visible = false;
        dayInfoPanel.Show();
        uiInited = true;

        EnableTutorialOKButton(false);
        mask.Enable  = false;
        mask.Visible = false;

        SetWeaponLogo(player.GetWeapon().GetWeaponType());

        panels[GameUIName.PAUSE] = new PauseMenuUI();
        ((PauseMenuUI)panels[GameUIName.PAUSE]).SetGameUIScript(this);

        panels[GameUIName.GAME_OVER] = new GameOverUI();
        panels[GameUIName.NEW_ITEM]  = new NewItemUI();

        //unlockPanel.Show();
        for (int i = 0; i < GameUIName.UI_COUNT; i++)
        {
            m_UIManager.Add(panels[i]);
        }
        startTime = Time.time;
    }