示例#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
    // 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();
    }
示例#3
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);
    }
示例#4
0
文件: AvatarUI.cs 项目: kidundead/ow
    // Use this for initialization
    public AvatarUI()
    {
        uiPos = new AvatarUIPosition();

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

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

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

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



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

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

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


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

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

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

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


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


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


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

        avatarScroller.AddOverlay(shopMaterial, ShopTexturePosition.SmallBuyLogo);

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



        avatarScroller.SetCenterFrameTexture(avatarLogoMaterial, AvatarTexturePosition.Frame);

        avatarScroller.EnableScroll();



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

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


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

        UpdateCashPanel();

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

        iapDialog.SetDialogEventHandler(this);

        this.Add(iapDialog);



        this.SetUIHandler(this);
        Hide();
    }