コード例 #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 void SetOverlay(int iconID, int overlayID)
    {
        int index = iconID;

        if (overlayID != -1)
        {
            TexturePosInfo info = m_overlayInfoList[overlayID];

            m_overlayImageList[index].SetTexture(info.m_Material, info.m_TexRect);
            m_overlayImageList[index].Visible = true;
        }
        else
        {
            m_overlayImageList[index].Visible = false;
        }
    }
コード例 #3
0
ファイル: UIAnimatedImage.cs プロジェクト: kidundead/ow
    public override void Draw()
    {
        Enable = false;
        TexturePosInfo info = animationTexturesList[currentFrame];

        SetTexture(info.m_Material, info.m_TexRect, info.m_Size);


        base.Draw();


        if (Time.time - lastFrameChangeTime > (1.0f / frameRate))
        {
            currentFrame++;
            if (currentFrame == animationTexturesList.Count)
            {
                currentFrame = 0;
            }
            lastFrameChangeTime = Time.time;
        }
    }
コード例 #4
0
ファイル: UITexturePositions.cs プロジェクト: kidundead/ow
    public static TexturePosInfo GetWeaponTextureRect(int index)
    {
        TexturePosInfo info = new TexturePosInfo();

        if (index < 10)
        {
            info.m_Material = UIResourceMgr.GetInstance().GetMaterial("Weapons");

            int x = 438 * (index % 2);
            int y = 192 * (index / 2);
            info.m_TexRect = AutoRect.AutoTex(new Rect(x, y, 438, 192));
        }
        else
        {
            info.m_Material = UIResourceMgr.GetInstance().GetMaterial("Weapons2");
            index          -= 10;
            int x = 438 * (index % 2);
            int y = 192 * (index / 2);
            info.m_TexRect = AutoRect.AutoTex(new Rect(x, y, 438, 192));
        }

        return(info);
    }
コード例 #5
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();
    }
コード例 #6
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);
    }