Exemplo n.º 1
0
        public void Init()
        {
            thumbCenter.x = AutoRect.AutoX(110);
            thumbCenter.y = AutoRect.AutoY(530);
            thumbRadius   = AutoRect.AutoValue(85);


            shootThumbCenter.x = AutoRect.AutoX(852);
            shootThumbCenter.y = AutoRect.AutoY(530);

            if (AutoRect.GetPlatform() == Platform.IPad)
            {
                thumbCenter.x      = AutoRect.AutoX(66);
                shootThumbCenter.x = AutoRect.AutoX(896);
                thumbCenter.y      = AutoRect.AutoY(500);
                shootThumbCenter.y = AutoRect.AutoY(500);
            }



            thumbCenterToScreen      = new Vector2(thumbCenter.x, Screen.height - thumbCenter.y);
            shootThumbCenterToScreen = new Vector2(shootThumbCenter.x, Screen.height - shootThumbCenter.y);

            lastShootTouch = shootThumbCenterToScreen;
            for (int i = 0; i < 2; i++)
            {
                lastTouch[i] = new Touch();
            }

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

            EnableMoveInput     = true;
            EnableShootingInput = true;
            EnableTurningAround = true;
        }
Exemplo n.º 2
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);
    }
Exemplo n.º 3
0
    public ArenaMenuPanel()
    {
        uiPos         = new ArenaMenuUIPosition();
        BattlePressed = false;
        Material arenaMenuMaterial = UIResourceMgr.GetInstance().GetMaterial("ArenaMenu");
        Material buttonsMaterial   = UIResourceMgr.GetInstance().GetMaterial("Buttons");

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

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


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

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

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

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


        cashPanel = new CashPanel();

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

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

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


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

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

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



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

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

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

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



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

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

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



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

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

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



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

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

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

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

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

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

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

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


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

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

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

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



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

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

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

        SetUIHandler(this);

        startTime = Time.time;
    }
Exemplo n.º 4
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;
    }
Exemplo n.º 5
0
    // 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();
    }