Пример #1
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);
    }
Пример #2
0
    void SelectWeapon(int weaponID, int selectRectIndex)
    {
        bool alreadySelected = false;

        for (int j = 0; j < SELECTION_NUM; j++)
        {
            if (rectToWeaponMap[j] != -1)
            {
                if (rectToWeaponMap[j] == weaponID)
                {
                    alreadySelected = true;
                }
            }
        }

        if (!alreadySelected)
        {
            int oldWeaponID = rectToWeaponMap[selectRectIndex];
            if (oldWeaponID != -1)
            {
                weaponList[oldWeaponID].IsSelectedForBattle = false;
            }
            weaponList[weaponID].IsSelectedForBattle = true;
            Material weaponIconMaterial = UIResourceMgr.GetInstance().GetMaterial("Weapons3");
            Rect     rect = WeaponsLogoTexturePosition.GetWeaponIconTextureRect(weaponID);
            battleWeaponGrid.SetGridTexture(selectRectIndex, weaponIconMaterial, rect);
            battleWeaponGrid.SetGridTexturePosition(selectRectIndex, selectRectIndex);
            rectToWeaponMap[selectRectIndex] = weaponID;

            avatarFrame.ChangeAvatar(GameApp.GetInstance().GetGameState().Avatar);
        }
    }
Пример #3
0
    /*
     * public void DestroyTexture(string name)
     * {
     *  for (int i = materialList.Count - 1; i > 0; i--)
     *  {
     *      MaterialInfo info = materialList[i] as MaterialInfo;
     *      if (info.name == name)
     *      {
     *
     *
     *          GameObject.Destroy(info.material.mainTexture);
     *          //materialList.Remove(info);
     *          Debug.Log("Destroy Texture:" + name);
     *          return;
     *      }
     *  }
     * }
     */

    public void LoadStartMenuUIMaterials()
    {
        UIResourceMgr.GetInstance().GetMaterial("StartMenu");
        UIResourceMgr.GetInstance().GetMaterial("Dialog");
        UIResourceMgr.GetInstance().GetMaterial("Buttons");
        UIResourceMgr.GetInstance().PrintExistingMaterials();
    }
Пример #4
0
 public void LoadMapUIMaterials()
 {
     UIResourceMgr.GetInstance().GetMaterial("ShopUI");
     UIResourceMgr.GetInstance().GetMaterial("Buttons");
     UIResourceMgr.GetInstance().GetMaterial("Map");
     UIResourceMgr.GetInstance().GetMaterial("ArenaMenu");
 }
Пример #5
0
 public void UnloadAllUIMaterials()
 {
     materialList.Clear();
     Resources.UnloadUnusedAssets();
     //Debug.Log("UI    All Resources Cleared");
     UIResourceMgr.GetInstance().PrintExistingMaterials();
 }
Пример #6
0
    // Use this for initialization
    void Start()
    {
        FlurryTAd.ShowTAd(true);

        startTime = Time.time;

        uiPos = new TrinitiUIPosition();
        //texPos = new StartMenuTexturePosition();


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

        trinitiMaterial = UIResourceMgr.GetInstance().GetMaterial("yuyue");
        background      = new UIImage();
        background.SetTexture(trinitiMaterial, StartMenuTexturePosition.Background, new Vector2(Screen.width, Screen.height));
        background.Rect = AutoRect.AutoPos(uiPos.Background);

        //! background.Rect = new Rect(0, 0, Screen.width, Screen.height);


        m_UIManager.Add(background);

        GameCenterInterface.Login();
    }
Пример #7
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();
    }
Пример #8
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();
    }
Пример #9
0
 public void SetUnlockWeapon(Weapon w)
 {
     if (w != null)
     {
         Material material        = UIResourceMgr.GetInstance().GetMaterial("GameUI");
         int      weaponLogoIndex = GameApp.GetInstance().GetGameState().GetWeaponIndex(w);
         Rect     weaponlogoRect  = GameUITexturePosition.GetWeaponLogoRect(weaponLogoIndex);
         unlockWeaponImage.SetTexture(material, weaponlogoRect);
     }
 }
Пример #10
0
 public void SetUnlockWeapon(Weapon w)
 {
     if (w != null)
     {
         Material material        = UIResourceMgr.GetInstance().GetMaterial("GameUI");
         int      weaponLogoIndex = GameApp.GetInstance().GetGameState().GetWeaponIndex(w);
         Rect     weaponlogoRect  = new Rect(weaponLogoIndex % 5 * 194, weaponLogoIndex / 5 * 112 + 512, 194, 112);
         unlockWeaponImage.SetTexture(material, weaponlogoRect);
         unlockWeaponText.Visible = true;
     }
 }
Пример #11
0
    // Update is called once per frame
    void Update()
    {
        /*
         * if (Camera.mainCamera != null)
         * {
         *  if (!Camera.mainCamera.audio.isPlaying)
         *  {
         *      Camera.mainCamera.audio.Play();
         *  }
         * }
         */



        if (FadeAnimationScript.GetInstance().FadeOutComplete())
        {
            foreach (UITouchInner touch in iPhoneInputMgr.MockTouches())
            {
                if (m_UIManager != null)
                {
                    if (m_UIManager.HandleInput(touch))
                    {
                        continue;
                    }
                }
            }
        }

        if (fadeTimer.Ready())
        {
            if (FadeAnimationScript.GetInstance().FadeInComplete())
            {
                if (fadeTimer.Name == "Start")
                {
                    UIResourceMgr.GetInstance().UnloadAllUIMaterials();
                    //GameApp.GetInstance().GetGameState().MenuMusicTime = Camera.mainCamera.audio.time;
                    //! Application.LoadLevel(SceneName.MAP);
                    SceneManager.LoadScene(SceneName.MAP);
                }
                else if (fadeTimer.Name == "Continue")
                {
                    if (!GameApp.GetInstance().Load())
                    {
                        GameApp.GetInstance().GetGameState().InitWeapons();  //! 初始化武器
                    }
                    UIResourceMgr.GetInstance().UnloadAllUIMaterials();
                    //GameApp.GetInstance().GetGameState().MenuMusicTime = Camera.mainCamera.audio.time;
                    //! Application.LoadLevel(SceneName.MAP);
                    SceneManager.LoadScene(SceneName.MAP);
                }
                fadeTimer.Do();
            }
        }
    }
Пример #12
0
    public void LoadAllUIMaterials()
    {
        UIResourceMgr.GetInstance().GetMaterial("ArenaMenu");
        UIResourceMgr.GetInstance().GetMaterial("Buttons");
        UIResourceMgr.GetInstance().GetMaterial("ShopUI");
        UIResourceMgr.GetInstance().GetMaterial("Weapons");
        UIResourceMgr.GetInstance().GetMaterial("Weapons2");
        UIResourceMgr.GetInstance().GetMaterial("Weapons3");
        UIResourceMgr.GetInstance().GetMaterial("Avatar");
        UIResourceMgr.GetInstance().GetMaterial("Dialog");

        UIResourceMgr.GetInstance().PrintExistingMaterials();
    }
Пример #13
0
 void PutBattleWeapons()
 {
     for (int i = 0; i < SELECTION_NUM; i++)
     {
         int weaponID = rectToWeaponMap[i];
         if (weaponID != -1)
         {
             Material weaponIconMaterial = UIResourceMgr.GetInstance().GetMaterial("Weapons3");
             Rect     rect = WeaponsLogoTexturePosition.GetWeaponIconTextureRect(weaponID);
             battleWeaponGrid.SetGridTexture(i, weaponIconMaterial, rect);
         }
     }
 }
Пример #14
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);
    }
Пример #15
0
 public void HandleEvent(UIControl control, int command, float wparam, float lparam)
 {
     if (control == retryButton)
     {
         GameApp.GetInstance().Save();
         Application.LoadLevel(SceneName.SCENE_ARENA);
     }
     else if (control == quitButton)
     {
         UIResourceMgr.GetInstance().UnloadAllUIMaterials();
         Application.LoadLevel(SceneName.MAP);
         GameApp.GetInstance().Save();
     }
 }
Пример #16
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));
        }
    }
Пример #17
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));
        }
    }
Пример #18
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);
    }
Пример #19
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));
    }
Пример #20
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]);
        }
    }
Пример #21
0
    void Awake()
    {
        if (GameObject.Find("ResourceConfig") == null)
        {
            GameObject resourceConfig = Object.Instantiate(Resources.Load("ResourceConfig")) as GameObject;
            resourceConfig.name = "ResourceConfig";
            DontDestroyOnLoad(resourceConfig);
        }


        UIResourceMgr.GetInstance().LoadAllGameUIMaterials();
        gameuiMaterial = UIResourceMgr.GetInstance().GetMaterial("GameUI");

        if (Application.loadedLevelName == SceneName.SCENE_TUTORIAL)
        {
            dialog = new GameDialog(UIDialog.DialogMode.TAP_TO_DISMISS);
            dialog.SetText(ConstData.FONT_NAME2, "", ColorName.fontColor_darkorange);
            dialog.SetDialogEventHandler(this);
        }
    }
Пример #22
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);
        }
    }
Пример #23
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);
    }
Пример #24
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);
    }
Пример #25
0
    IEnumerator Init()
    {
        yield return(1);

        UIResourceMgr.GetInstance().LoadAllUIMaterials();
        //if (GameApp.GetInstance().GetGameState().FirstTimeGame)
        {
            if (Time.time - startTime < 1.5f)
            {
                yield return(new WaitForSeconds(1.5f - (Time.time - startTime)));
            }
        }

        GameApp.GetInstance().ClearScene();

        //uiPos = new ArenaMenuUIPosition();
        //texPos = new ArenaMenuTexturePosition();



        panels[MenuName.ARENA] = new ArenaMenuPanel();
        //panels[MenuName.OPTIONS] = new OptionsMenuUI();
        panels[MenuName.UPGRADE]   = new WeaponUpgradeUI();
        panels[MenuName.EQUIPMENT] = new EquipmentUI();
        panels[MenuName.AVATAR]    = new AvatarUI();
        panels[MenuName.SHOP]      = new ShopUI();
        for (int i = 0; i < MenuName.MENU_COUNT; i++)
        {
            m_UIManager.Add(panels[i]);
        }

        panels[MenuName.ARENA].Show();

        Transform audioFolderTrans = transform.Find("Audio");

        audioPlayer.AddAudio(audioFolderTrans, "Button");
        audioPlayer.AddAudio(audioFolderTrans, "Upgrade");
        audioPlayer.AddAudio(audioFolderTrans, "Battle");
        GameApp.GetInstance().GetGameState().Achievement.SubmitAllToGameCenter();
    }
Пример #26
0
    public AvatarInfoPanel()
    {
        AvatarUIPosition uiPos          = new AvatarUIPosition();
        Material         dialogMaterial = UIResourceMgr.GetInstance().GetMaterial("Dialog");

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



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

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



        Add(infoText);
    }
Пример #27
0
    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);
    }
Пример #28
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);
        }
    }
Пример #29
0
    IEnumerator Init()
    {
        yield return(1);

        UIResourceMgr.GetInstance().LoadMapUIMaterials();
        //if (GameApp.GetInstance().GetGameState().FirstTimeGame)
        {
            if (Time.time - startTime < 3.0f && !GameApp.GetInstance().GetGameState().FromShopMenu)
            {
                yield return(new WaitForSeconds(3.0f - (Time.time - startTime)));
            }
        }
        FadeAnimationScript.GetInstance().FadeOutBlack();
        GameApp.GetInstance().GetGameState().FromShopMenu = false;

        mapPanel = new MapUIPanel();
        m_UIManager.Add(mapPanel);
        mapPanel.Start();
        mapPanel.Show();


        optionsUI = new OptionsMenuUI();
        m_UIManager.Add(optionsUI);
    }
Пример #30
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);
    }