示例#1
0
    public override void Show()
    {
        currentSelectionWeaponIndex = 0;
        weaponScroller.Clear();
        weaponScroller.SetImageSpacing(AutoRect.AutoSize(WeaponsLogoTexturePosition.WeaponLogoSpacing));

        for (int i = 0; i < weaponList.Count; i++)
        {
            if (weaponList[i].Exist == WeaponExistState.Owned)
            {
                UIImage        uiImage = new UIImage();
                TexturePosInfo info    = WeaponsLogoTexturePosition.GetWeaponTextureRect(i);
                uiImage.SetTexture(info.m_Material, info.m_TexRect);
                weaponScroller.Add(uiImage);
            }
        }
        weaponScroller.EnableScroll();
        Material shopMaterial = UIResourceMgr.GetInstance().GetMaterial("ShopUI");

        weaponScroller.AddOverlay(shopMaterial, new Rect(720, 610, 160, 75));
        Material avatarLogoMaterial = UIResourceMgr.GetInstance().GetMaterial("Avatar");

        weaponScroller.SetMaskImage(avatarLogoMaterial, AvatarTexturePosition.Mask);

        weaponScroller.Show();

        base.Show();
        avatarFrame.ChangeAvatar(GameApp.GetInstance().GetGameState().Avatar);
        avatarFrame.Show();


        cashPanel.SetCash(gameState.GetCash());
        UpdateWeaponInfo();
        weaponInfoPanel.Show();
    }
示例#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 void Select(bool bSelect)
 {
     selectPanelButton.Set(bSelect);
     if (bSelect)
     {
         buttonText.SetColor(ColorName.fontColor_yellow);
         currentValueText.SetColor(ColorName.fontColor_yellow);
         nextValueText.SetColor(ColorName.fontColor_yellow);
         arrowImage.SetTexture(arenaMaterial, ArenaMenuTexturePosition.ArrowSelected, AutoRect.AutoSize(ArenaMenuTexturePosition.ArrowSelected));
         for (int i = 0; i < 10; i++)
         {
             starsBackground[i].SetTexture(arenaMaterial, ArenaMenuTexturePosition.StarEmptySelected, AutoRect.AutoSize(ArenaMenuTexturePosition.StarEmptySelected));
             stars[i].SetTexture(arenaMaterial, ArenaMenuTexturePosition.StarFullSelected, AutoRect.AutoSize(ArenaMenuTexturePosition.StarFullSelected));
         }
     }
     else
     {
         buttonText.SetColor(ColorName.fontColor_orange);
         currentValueText.SetColor(ColorName.fontColor_orange);
         nextValueText.SetColor(ColorName.fontColor_orange);
         arrowImage.SetTexture(arenaMaterial, ArenaMenuTexturePosition.Arrow, AutoRect.AutoSize(ArenaMenuTexturePosition.Arrow));
         for (int i = 0; i < 10; i++)
         {
             starsBackground[i].SetTexture(arenaMaterial, ArenaMenuTexturePosition.StarEmpty, AutoRect.AutoSize(ArenaMenuTexturePosition.StarEmpty));
             stars[i].SetTexture(arenaMaterial, ArenaMenuTexturePosition.StarFull, AutoRect.AutoSize(ArenaMenuTexturePosition.StarFull));
         }
     }
 }
示例#4
0
 public void SetMaskImage(Material material, Rect texRect)
 {
     for (int i = 0; i < m_MaskList.Count; i++)
     {
         UIImage image = m_MaskList[i];
         image.SetTexture(material, texRect, AutoRect.AutoSize(texRect));
     }
 }
示例#5
0
    // Use this for initialization
    public EquipmentUI()
    {
        uiPos = new EquipmentUIPosition();
        //texPos = new EquipmentTexturePosition();


        arenaMenuMaterial = UIResourceMgr.GetInstance().GetMaterial("ArenaMenu");
        background        = new UIImage();
        background.SetTexture(arenaMenuMaterial, ArenaMenuTexturePosition.Background);
        background.Rect = AutoRect.AutoPos(uiPos.Background);

        /*
         * titleImage = new UIImage();
         * titleImage.SetTexture(weaponUpgradeMaterial, WeaponUpgradeTexturePosition.TitleImage);
         * titleImage.Rect = uiPos.TitleImage;
         */

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



        selectionImage = new UIImage();


        /*
         * weaponInfoText = new UIText();
         * weaponInfoText.Set(ConstData.FONT_NAME2, "", ColorName.fontColor_darkorange);
         * weaponInfoText.Rect = uiPos.WeaponInfoText;
         */



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

        this.Add(returnButton);
        //this.Add(weaponInfoText);


        uiInited = true;

        Init();
        selectionImage.Enable = false;
        this.Add(selectionImage);
        //weaponInfoText.Set(ConstData.FONT_NAME2, weaponList[0].Info, ColorName.fontColor_darkorange);
        UpdateWeaponInfo();

        SetUIHandler(this);

        Hide();
    }
示例#6
0
 public void SetCenterFrameTexture(Material material, Rect rect)
 {
     m_CenterFrameImage.SetTexture(material, rect, AutoRect.AutoSize(rect));
     if (m_Dir == ScrollerDir.Vertical)
     {
         float x = (m_ClipRect.x + 0.5f * m_ClipRect.width) - 0.5f * rect.width;
         float y = (m_ClipRect.y + 0.5f * m_ClipRect.height) - 0.5f * rect.height;
         m_CenterFrameImage.Rect = new Rect(x, y, rect.width, rect.height);
     }
 }
示例#7
0
 public void SetBackgroundTexture(Material material, Rect textRect, Rect posRect)
 {
     m_BackgroundImg.SetTexture(material, textRect, AutoRect.AutoSize(textRect));
     m_BackgroundImg.Rect = posRect;
     m_Text.Rect          = posRect;
     if (m_TipText != null)
     {
         m_TipText.Rect = posRect;
     }
 }
示例#8
0
    //ammo
    public void UpdateInfo(string cStr, string nStr, int weaponTypeIndex)
    {
        Material buttonsMaterial = UIResourceMgr.GetInstance().GetMaterial("Buttons");
        Rect     brect           = ButtonsTexturePosition.GetBulletsLogoRect(weaponTypeIndex);

        bulletLogo.SetTexture(buttonsMaterial, brect, AutoRect.AutoSize(brect));
        arrowImage.Visible = false;
        bulletLogo.Visible = true;
        currentValueText.SetText(cStr);
        nextValueText.SetText(nStr);
        UpdateStar(0);
        UpdateStarBackground(0);
    }
示例#9
0
    public void UpdateBulletLogo(int wTypeIndex)
    {
        if ((WeaponType)wTypeIndex == WeaponType.Saw)
        {
            bulletLogo.Visible = false;
        }
        else
        {
            bulletLogo.Visible = true;
            Material buttonsMaterial = UIResourceMgr.GetInstance().GetMaterial("Buttons");

            Rect brect = ButtonsTexturePosition.GetBulletsLogoRect(wTypeIndex);
            bulletLogo.SetTexture(buttonsMaterial, brect, AutoRect.AutoSize(brect));
        }
    }
示例#10
0
    public void SetWeaponLogo(WeaponType weaponType)
    {
        if (uiInited)
        {
            int  weaponLogoIndex = GameApp.GetInstance().GetGameState().GetWeaponIndex(player.GetWeapon());
            Rect weaponlogoRect  = GameUITexturePosition.GetWeaponLogoRect(weaponLogoIndex);
            weaponLogo.SetTexture(UIButtonBase.State.Normal, gameuiMaterial, weaponlogoRect, AutoRect.AutoSize(weaponlogoRect));
            weaponLogo.SetTexture(UIButtonBase.State.Pressed, gameuiMaterial, weaponlogoRect, AutoRect.AutoSize(weaponlogoRect));

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

            Rect bulletlogoRect = ButtonsTexturePosition.GetBulletsLogoRect((int)player.GetWeapon().GetWeaponType());
            bulletsLogo.SetTexture(buttonsMaterial, bulletlogoRect, AutoRect.AutoSize(bulletlogoRect));
        }
    }
示例#11
0
    public ReviewDialog()
        : base(DialogMode.YES_OR_NO)
    {
        Material dialogUIMaterial = UIResourceMgr.GetInstance().GetMaterial("Dialog");
        Material buttonsMaterial  = UIResourceMgr.GetInstance().GetMaterial("Buttons");

        SetBackgroundTexture(dialogUIMaterial, DialogTexturePosition.Dialog, AutoRect.AutoPos(new Rect((960 - 574) / 2f, (640 - 306) / 2f, 574f, 306f)));
        SetTextAreaOffset(AutoRect.AutoValuePos(new Rect(80, 70, -100, -90)));

        SetText(ConstData.FONT_NAME2, "\n                REVIEW US \nLIKE THIS GAME? WANT MORE UPDATES? PLEASE REVIEW US.", ColorName.fontColor_darkorange);
        SetButtonTexture(buttonsMaterial, ButtonsTexturePosition.ButtonNormal, ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.TinySizeButton));

        SetYesButtonOffset(AutoRect.AutoValuePos(new Vector2(70, 0)), AutoRect.AutoSize(ButtonsTexturePosition.TinySizeButton));
        SetNoButtonOffset(AutoRect.AutoValuePos(new Vector2(300, 0)), AutoRect.AutoSize(ButtonsTexturePosition.TinySizeButton));
        SetYesButtonText(ConstData.FONT_NAME2, "YES", ColorName.fontColor_orange);
        SetNoButtonText(ConstData.FONT_NAME2, "NO,THANKS", ColorName.fontColor_orange);
    }
示例#12
0
    public IAPDialog(DialogMode mode)
        : base(mode)
    {
        SetTextAreaOffset(AutoRect.AutoValuePos(new Rect(80, 80, -20, -106)));
        SetText(ConstData.FONT_NAME1, "", ColorName.fontColor_darkorange);
        Material material = UIResourceMgr.GetInstance().GetMaterial("ArenaMenu");

        this.SetText(NOT_ENOUGH_CASH);
        SetButtonTexture(material, ArenaMenuTexturePosition.GetMoneyButtonNormal, ArenaMenuTexturePosition.GetMoneyButtonPressed, AutoRect.AutoSize(ArenaMenuTexturePosition.GetMoneyButtonPressed));

        SetYesButtonOffset(AutoRect.AutoValuePos(new Vector2(26, -42)), AutoRect.AutoSize(ArenaMenuTexturePosition.GetMoneyButtonPressed));
        this.DisableNoButton();
        this.SetYesButtonText("");
        this.SetNoButtonText("");

        this.SetCloseButtonTexture(material, ArenaMenuTexturePosition.CloseButtonNormal, ArenaMenuTexturePosition.CloseButtonPressed);
        this.SetCloseButtonOffset(AutoRect.AutoValuePos(new Vector2(-16, 224)), AutoRect.AutoSize(ArenaMenuTexturePosition.CloseButtonNormal));
    }
示例#13
0
    public DayInfoPanel()
    {
        dayImg   = new UIImage();
        material = UIResourceMgr.GetInstance().GetMaterial("GameUI");
        Material buttonMaterial = UIResourceMgr.GetInstance().GetMaterial("Buttons");

        dayImg.SetTexture(buttonMaterial, ButtonsTexturePosition.Day, AutoRect.AutoSize(ButtonsTexturePosition.Day));
        dayImg.Rect   = AutoRect.AutoPos(Day);
        dayImg.Enable = false;
        Day           = AutoRect.AutoPos(Day);
        Add(dayImg);
        for (int i = 0; i < 3; i++)
        {
            numberImg[i]        = new UIImage();
            numberImg[i].Rect   = GetNumberPos(i);
            numberImg[i].Enable = false;
            Add(numberImg[i]);
        }
    }
示例#14
0
    public IAPLockPanel()
    {
        maskImage = new UIImage();
        Material material = UIResourceMgr.GetInstance().GetMaterial("Avatar");

        maskImage.SetTexture(material, AvatarTexturePosition.Mask, AutoRect.AutoSize(ArenaMenuTexturePosition.Background));
        maskImage.Rect = AutoRect.AutoPos(new Rect(0, 0, 960, 640));

        block      = new UIBlock();
        block.Rect = AutoRect.AutoPos(new Rect(0, 0, 960, 640));

        spinner = new UIImage();
        Material arenaMaterial = UIResourceMgr.GetInstance().GetMaterial("ArenaMenu");

        spinner.SetTexture(arenaMaterial, ArenaMenuTexturePosition.Spinner, AutoRect.AutoSize(ArenaMenuTexturePosition.Spinner));
        spinner.Rect = AutoRect.AutoPos(new Rect(0, 0, 960, 640));

        Add(maskImage);
        Add(spinner);
        Add(block);
    }
示例#15
0
    public override void UpdateLogic()
    {
        if (gameover.Visible)
        {
            Material buttonsMaterial = UIResourceMgr.GetInstance().GetMaterial("Buttons");

            float size = (0.1f + (Time.time - startTime) * 0.9f);
            if (Time.time - startTime > 1.2f)
            {
                size = (0.1f + (1.2f) * 0.9f) - (Time.time - startTime - 1.2f) * 0.2f;
                if (size <= 1)
                {
                    size = 1;
                    retryButton.Visible = true;
                    quitButton.Visible  = true;
                }
            }

            gameover.SetTexture(gameuiMaterial, GameUITexturePosition.GameOver, AutoRect.AutoSize(GameUITexturePosition.GameOver) * size);
        }
    }
示例#16
0
    protected void UpdateItemsUI()
    {
        if (page == 0)
        {
            for (int i = 0; i < 3; i++)
            {
                itemButton[i].SetTexture(UIButtonBase.State.Normal, shop2Material,

                                         ShopTexturePosition.GetIAPLogoRect(i), AutoRect.AutoSize(ShopTexturePosition.GetIAPLogoRect(i)));
                itemButton[i].SetTexture(UIButtonBase.State.Pressed, shop2Material,

                                         ShopTexturePosition.GetIAPLogoRect(i), AutoRect.AutoSize(ShopTexturePosition.GetIAPLogoRect(i)));

                itemText[i].SetText(itemList[0][i].Desc);
            }

            itemButton[2].Visible = true;
            itemButton[2].Enable  = true;
            itemText[2].Visible   = true;
            itemText[2].Enable    = true;
        }
        else if (page == 1)
        {
            for (int i = 0; i < 2; i++)
            {
                itemButton[i].SetTexture(UIButtonBase.State.Normal, shop2Material,

                                         ShopTexturePosition.GetIAPLogoRect(i + 3), AutoRect.AutoSize(ShopTexturePosition.GetIAPLogoRect(i + 3)));
                itemButton[i].SetTexture(UIButtonBase.State.Pressed, shop2Material,

                                         ShopTexturePosition.GetIAPLogoRect(i + 3), AutoRect.AutoSize(ShopTexturePosition.GetIAPLogoRect(i + 3)));

                itemText[i].SetText(itemList[0][i + 3].Desc);
            }
            itemButton[2].Visible = false;
            itemButton[2].Enable  = false;
            itemText[2].Visible   = false;
            itemText[2].Enable    = false;
        }
    }
示例#17
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);
    }
示例#18
0
文件: AvatarUI.cs 项目: kidundead/ow
    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);
    }
示例#19
0
    public GameDialog(DialogMode mode)
        : base(mode)
    {
        Material dialogUIMaterial = UIResourceMgr.GetInstance().GetMaterial("Dialog");
        Material buttonsMaterial  = UIResourceMgr.GetInstance().GetMaterial("Buttons");

        SetBackgroundTexture(dialogUIMaterial, DialogTexturePosition.Dialog, AutoRect.AutoPos(new Rect((960 - 574) / 2f, (640 - 306) / 2f, 574f, 306f)));
        SetTextAreaOffset(AutoRect.AutoValuePos(new Rect(80, 70, -100, -90)));
        if (mode == DialogMode.YES_OR_NO)
        {
            SetText(ConstData.FONT_NAME2, "", ColorName.fontColor_darkorange);
            SetButtonTexture(buttonsMaterial, ButtonsTexturePosition.ButtonNormal, ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.TinySizeButton));

            SetYesButtonOffset(AutoRect.AutoValuePos(new Vector2(70, 0)), AutoRect.AutoSize(ButtonsTexturePosition.TinySizeButton));
            SetNoButtonOffset(AutoRect.AutoValuePos(new Vector2(300, 0)), AutoRect.AutoSize(ButtonsTexturePosition.TinySizeButton));
            SetYesButtonText(ConstData.FONT_NAME2, "YES", ColorName.fontColor_orange);
            SetNoButtonText(ConstData.FONT_NAME2, "NO", ColorName.fontColor_orange);
        }
        else if (mode == DialogMode.TAP_TO_DISMISS)
        {
            SetTipTextOffset(AutoRect.AutoValuePos(new Rect(180, -260, 0, 0)));
            SetTipText(ConstData.FONT_NAME2, "TAP TO DISMISS", ColorName.fontColor_darkorange);
        }
    }
示例#20
0
    public void AddGrid(Rect gridRect, Material backMaterial, Rect backTexPos)
    {
        UIDragIcon icon = new UIDragIcon();

        icon.m_Background      = new UIImage();
        icon.m_Background.Rect = gridRect;
        icon.m_Background.SetTexture(backMaterial, backTexPos, AutoRect.AutoSize(backTexPos));
        icon.m_Background.SetParent(this);
        icon.m_Background.Enable = false;

        icon.m_Image      = new UIImage();
        icon.m_Image.Rect = gridRect;
        icon.m_Image.SetParent(this);
        icon.m_Image.Enable = false;



        icon.m_UIMove        = new UIMove();
        icon.m_UIMove.Rect   = gridRect;
        icon.m_UIMove.Enable = true;
        this.Add(icon.m_UIMove);
        m_IconRect = gridRect;
        m_dragIcons.Add(icon);
    }
示例#21
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;
    }
示例#22
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);
    }
示例#23
0
 public void SetGridTexture(int gridID, Material material, Rect textRect)
 {
     m_dragIcons[gridID].m_Image.Visible = true;
     m_dragIcons[gridID].m_Image.SetTexture(material, textRect, AutoRect.AutoSize(textRect));
 }
示例#24
0
    public void HandleEvent(UIControl control, int command, float wparam, float lparam)
    {
        if (control == returnButton)
        {
            AudioPlayer.PlayAudio(ArenaMenuUI.GetInstance().GetComponent <AudioSource>());
            GameApp.GetInstance().Save();
            Hide();
            GameObject.Find("ArenaMenuUI").GetComponent <ArenaMenuUI>().GetPanel(MenuName.ARENA).Show();
        }
        else if (control == weaponScroller)
        {
            int index = (int)wparam;
            //scroller at
            if (command == (int)UIImageScroller.Command.ScrollSelect)
            {
                currentSelectionWeaponIndex = gameState.GetWeaponByOwnedIndex(index);
                UpdateWeaponInfo();
            }
            // long press
            else if (command == (int)UIImageScroller.Command.PressSelect)
            {
                if (gameState != null)
                {
                    Material weaponIconMaterial = UIResourceMgr.GetInstance().GetMaterial("Weapons3");
                    Rect     rect = WeaponsLogoTexturePosition.GetWeaponIconTextureRect(currentSelectionWeaponIndex);
                    selectionImage.SetTexture(weaponIconMaterial, rect, AutoRect.AutoSize(rect));
                    selectionImage.Rect = weaponScroller.GetCenterRect();
                }
            }
            //long end
            else if (command == (int)UIImageScroller.Command.PressEnd)
            {
                selectionImage.Rect = new Rect(-1000, -1000, 200, 200);
                for (int i = 0; i < SELECTION_NUM; i++)
                {
                    if (selectionRect[i].Contains(new Vector2(wparam, lparam)))
                    {
                        SelectWeapon(currentSelectionWeaponIndex, i);
                        break;
                    }
                }
            }
            //drag move
            else if (command == (int)UIImageScroller.Command.DragMove)
            {
                selectionImage.Rect = new Rect(wparam - 438 * 1.2f / 2, lparam - 192 * 1.2f / 2, 438 * 1.2f, 192 * 1.2f);
            }
        }
        else if (control == battleWeaponGrid)
        {
            if (command == (int)UIDragGrid.Command.DragOutSide)
            {
                int i = (int)wparam;
                if (InBattleWeaponCount() > 1)
                {
                    int weaponID = rectToWeaponMap[i];
                    if (weaponID != -1)
                    {
                        weaponList[weaponID].IsSelectedForBattle = false;

                        rectToWeaponMap[i] = -1;
                        battleWeaponGrid.HideGridTexture(i);
                        avatarFrame.ChangeAvatar(GameApp.GetInstance().GetGameState().Avatar);
                    }
                }
                else
                {
                    battleWeaponGrid.SetGridTexturePosition(i, i);
                }
            }
            else if (command == (int)UIDragGrid.Command.DragExchange)
            {
                int i = (int)wparam;
                int j = (int)lparam;

                int temp = rectToWeaponMap[i];
                rectToWeaponMap[i] = rectToWeaponMap[j];
                rectToWeaponMap[j] = temp;

                if (rectToWeaponMap[i] != -1)
                {
                    Material weaponIconMaterial = UIResourceMgr.GetInstance().GetMaterial("Weapons3");
                    Rect     rect = WeaponsLogoTexturePosition.GetWeaponIconTextureRect(rectToWeaponMap[i]);
                    battleWeaponGrid.SetGridTexture(i, weaponIconMaterial, rect);


                    battleWeaponGrid.SetGridTexturePosition(i, i);
                }
                else
                {
                    battleWeaponGrid.HideGridTexture(i);
                }

                if (rectToWeaponMap[j] != -1)
                {
                    Material weaponIconMaterial = UIResourceMgr.GetInstance().GetMaterial("Weapons3");
                    Rect     rect = WeaponsLogoTexturePosition.GetWeaponIconTextureRect(rectToWeaponMap[j]);
                    battleWeaponGrid.SetGridTexture(j, weaponIconMaterial, rect);


                    battleWeaponGrid.SetGridTexturePosition(j, j);
                }
                else
                {
                    battleWeaponGrid.HideGridTexture(j);
                }
                avatarFrame.ChangeAvatar(GameApp.GetInstance().GetGameState().Avatar);
            }
        }
        else if (control == getMoreMoneyButton)
        {
            AudioPlayer.PlayAudio(ArenaMenuUI.GetInstance().GetComponent <AudioSource>());
            Hide();
            ShopUI shopUI = GameObject.Find("ArenaMenuUI").GetComponent <ArenaMenuUI>().GetPanel(MenuName.SHOP) as ShopUI;
            shopUI.SetFromPanel(this);
            shopUI.Show();
        }
    }
示例#25
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]);
        }
    }
示例#26
0
    void Init()
    {
        Cursor.visible = true;

        selectionRect[0] = AutoRect.AutoPos(new Rect(28, 88, 112, 112));

        selectionRect[1] = AutoRect.AutoPos(new Rect(28 + 150, 88, 112, 112));

        selectionRect[2] = AutoRect.AutoPos(new Rect(28 + 150 * 2, 88, 112, 112));


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

        weaponUI = UIResourceMgr.GetInstance().GetMaterial("Weapons");
        Material weapon3Material = UIResourceMgr.GetInstance().GetMaterial("Weapons3");
        Rect     gridbackRect    = WeaponsLogoTexturePosition.GetWeaponIconTextureRect(13);

        battleWeaponGrid = new UIDragGrid(0);

        rectToWeaponMap = GameApp.GetInstance().GetGameState().GetRectToWeaponMap();

        for (int i = 0; i < SELECTION_NUM; i++)
        {
            battleWeaponGrid.AddGrid(selectionRect[i], weapon3Material, gridbackRect);
        }


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


        PutBattleWeapons();


        weaponScroller = new UIImageScroller(AutoRect.AutoPos(new Rect(400, 0, 550, 640)), AutoRect.AutoPos(new Rect(440, 180, 500, 369)), 1, AutoRect.AutoSize(WeaponsLogoTexturePosition.WeaponLogoSize), ScrollerDir.Vertical, true);
        weaponScroller.SetImageSpacing(AutoRect.AutoSize(WeaponsLogoTexturePosition.WeaponLogoSpacing));
        weaponScroller.EnableLongPress();


        for (int i = 0; i < weaponList.Count; i++)
        {
            if (weaponList[i].Exist == WeaponExistState.Owned)
            {
                UIImage uiImage = new UIImage();

                TexturePosInfo info = WeaponsLogoTexturePosition.GetWeaponTextureRect(i);


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

        this.Add(weaponScroller);
        weaponScroller.EnableScroll();
        Material shopMaterial = UIResourceMgr.GetInstance().GetMaterial("ShopUI");

        weaponScroller.AddOverlay(shopMaterial, ShopTexturePosition.LockedLogo);
        Material avatarLogoMaterial = UIResourceMgr.GetInstance().GetMaterial("Avatar");

        weaponScroller.SetMaskImage(avatarLogoMaterial, AvatarTexturePosition.Mask);

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

        weaponScroller.SetCenterFrameTexture(avatarMaterial, AvatarTexturePosition.Frame);



        weaponScroller.Show();
        battleWeaponGrid.Show();
        this.Add(battleWeaponGrid);



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

        this.Add(getMoreMoneyButton);


        cashPanel = new CashPanel();
        cashPanel.Show();
        this.Add(cashPanel);

        weaponInfoPanel = new WeaponInfoPanel();
        this.Add(weaponInfoPanel);


        if (AutoRect.GetPlatform() == Platform.IPad)
        {
            avatarFrame = new Avatar3DFrame(AutoRect.AutoPos(new Rect(0, 200, 500, 600)), new Vector3(-1.499798f * 0.9f, -0.6672753f * 0.9f, 4.420711f), new Vector3(1.3f, 1.3f, 1.3f) * 0.85f);
        }
        else
        {
            avatarFrame = new Avatar3DFrame(AutoRect.AutoPos(new Rect(0, 200, 500, 600)), new Vector3(-1.499798f, -0.6672753f, 4.420711f), new Vector3(1.3f, 1.3f, 1.3f));
        }



        this.Add(avatarFrame);
    }
示例#27
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();
    }
示例#28
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();
    }
示例#29
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);
    }
示例#30
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);
    }