Inheritance: GamePanel
Esempio n. 1
0
 public virtual void ConfirmUpgrade(UpgradePanel uPanel)
 {
     this.uPanel                = uPanel;
     uPanel.Nametxt.text        = description.Name;
     uPanel.resourceIcon.sprite = resource;
     MergeAdjacentRooms(this);
 }
Esempio n. 2
0
        internal static void OpenUpgradeUI()
        {
            UpgradePanel ui    = new UpgradePanel();
            UIState      state = new UIState();

            state.Append(ui);
            UpgradePanelUI.SetState(state);
        }
Esempio n. 3
0
 public override void ConfirmUpgrade(UpgradePanel uPanel)
 {
     uPanel.upgradeBtn.onClick.RemoveAllListeners();
     base.ConfirmUpgrade(uPanel);
     uPanel.storage.text            = "Storage";
     uPanel.currentProduction.text  = resourcePerTime.ToString();
     uPanel.upgradedProduction.text = " +" + upgradedResourcePerTime.ToString();
     uPanel.upgradedStorage.text    = " +" + upgradedStorage.ToString();
 }
Esempio n. 4
0
 protected void Awake()
 {
     spawner          = Camera.main.GetComponent <SpawnOnMouseClick>();
     pusher           = Camera.main.GetComponent <PushOnMouseClick>();
     panner           = Camera.main.GetComponent <CameraPan>();
     musicManager     = GetComponent <MusicManager>();
     tutorial         = GetComponent <Tutorial>();
     simulatedObjects = new List <Gravitation>();
     canvas           = GameObject.FindGameObjectWithTag("Canvas").GetComponent <Canvas>();
     upgradePanel     = GameObject.FindGameObjectWithTag("UpgradePanel").GetComponent <UpgradePanel>();
     messageBox       = GameObject.FindGameObjectWithTag("MessageBox").GetComponent <MessageBox>();
 }
    public override void ConfirmUpgrade(UpgradePanel uPanel)
    {
        base.ConfirmUpgrade(uPanel);
        uPanel.upgradeBtn.interactable = false;
        uPanel.currentStorage.text     = resourceStorage.MaxChemistry.ToString();

        if (lvl < 2)
        {
            uPanel.upgradeBtn.interactable = true;
            uPanel.upgradeBtn.onClick.AddListener(delegate { Upgrade(++lvl); });
        }
    }
Esempio n. 6
0
 public override void ConfirmUpgrade(UpgradePanel uPanel) //view
 {
     uPanel.upgradeBtn.onClick.RemoveAllListeners();
     base.ConfirmUpgrade(uPanel);
     uPanel.storage.text            = "Storage";
     uPanel.production.text         = "Production";
     uPanel.currentProduction.text  = resourcePerTime.ToString();
     uPanel.upgradedProduction.text = " +" + upgradedResourcePerTime.ToString();
     uPanel.upgradedStorage.text    = " +" + upgradedStorage.ToString();
     upgradeCost      = (int)((description.buyPrice / 2) + (lvl) * (description.buyPrice / 5));
     uPanel.cost.text = upgradeCost.ToString() + " $";
 }
 public override void ConfirmUpgrade(UpgradePanel uPanel)
 {
     base.ConfirmUpgrade(uPanel);
     uPanel.upgradeBtn.interactable = false;
     uPanel.currentStorage.text     = (GameController.instance.researcher.ResearchSpeed).ToString() + " %";
     uPanel.storage.text            = "Speed";
     if (lvl < 2)
     {
         uPanel.upgradeBtn.interactable = true;
         uPanel.upgradeBtn.onClick.AddListener(delegate { Upgrade(++lvl); });
     }
 }
Esempio n. 8
0
 public override void ConfirmUpgrade(UpgradePanel uPanel)
 {
     base.ConfirmUpgrade(uPanel);
     uPanel.upgradeBtn.interactable = false;
     uPanel.currentStorage.text     = (productionTime).ToString() + " s";
     uPanel.storage.text            = "Wait";
     uPanel.upgradedStorage.text    = (productionTime - timeReducer).ToString() + " s";
     if (lvl < 2)
     {
         uPanel.upgradeBtn.interactable = true;
         uPanel.upgradeBtn.onClick.AddListener(delegate { Upgrade(++lvl); });
     }
 }
Esempio n. 9
0
    protected override void Init()
    {
        base.Init();
        instance = this;

        //BtnClose = UnityUtil.FindCtrl<UIButton>(gameObject, "CloseBtn");

        //EventDelegate.Set(BtnClose.onClick, this.OnCloseBtn);

        SprIcon = UnityUtil.FindCtrl <UISprite>(gameObject, "Icon");
        LabName = UnityUtil.FindCtrl <UILabel>(gameObject, "Name");
        LabLv   = UnityUtil.FindCtrl <UILabel>(gameObject, "Lv");

        DerExp = UnityUtil.FindCtrl <UISlider>(gameObject, "ExpBar");

        Globe.allHeroDic.TryGetValue(Globe.selectHero.hero_id, out vo);
        Globe.heroInfoDic.TryGetValue(Globe.selectHero.hero_id, out play);

        GameObject BottleMultList = UnityUtil.FindObjectRecursively(gameObject, "BottleMultList");

        for (int i = 0; i < 6; i++)
        {
            GameObject  go   = UnityUtil.FindObjectRecursively(BottleMultList, "item" + i.ToString());
            UpgradeItem item = new UpgradeItem();
            item.goItem       = go;
            item.SprBg        = go.GetComponent <UISprite>();
            item.SprIcon      = UnityUtil.FindCtrl <UISprite>(go, "MailBtn");
            item.LabCount     = UnityUtil.FindCtrl <UILabel>(go, "Count");
            item.LabExpNumber = UnityUtil.FindCtrl <UILabel>(go, "EXPLabel");

            LisUpgradeItem.Add(item);
        }

        SprIcon.spriteName = vo.icon_name;

        //TODO dele
        HeroData1 data = new HeroData1();

        data.Name   = vo.name;
        data.Lv     = play.Level;
        data.ExpMax = 1000 * play.Level;
        data.ExpNow = play.CurrentExp;
        Open(data);

        isOne = true;
    }
Esempio n. 10
0
 /// <summary>Displays the popup.</summary>
 public override void Display()
 {
     //instantiate a list of the upgrade panels which the player hasn't yet bought
     if (panels == null)
     {
         panels = new List <UpgradePanel>();
     }
     for (int upgradeIndex = 0; upgradeIndex < GameData.instance.numberOfUpgrades; upgradeIndex++)
     {
         if (!PlayerManager.instance.HasBoughtUpgrade(upgradeIndex))
         {
             UpgradePanel panel = Instantiate(upgradePanelPrefab, scrollViewContent);
             panel.Initialize(upgradeIndex);
             panels.Add(panel);
         }
     }
     //and set the popup to be visible
     SetVisibleInteractable(true);
 }
Esempio n. 11
0
    public override void ConfirmUpgrade(UpgradePanel uPanel) //view
    {
        uPanel.upgradeBtn.onClick.RemoveAllListeners();
        base.ConfirmUpgrade(uPanel);
        uPanel.storage.text            = "Efficiency";
        uPanel.production.text         = string.Empty;
        uPanel.currentProduction.text  = string.Empty;
        uPanel.upgradedProduction.text = string.Empty;
        uPanel.upgradedStorage.text    = " +" + upgradedEfficiency.ToString();
        uPanel.currentStorage.text     = GameController.instance.player.skills.toxicityReducer.ToString();
        upgradeCost      = (int)((description.buyPrice / 2) + (lvl) * (description.buyPrice / 5));
        uPanel.cost.text = upgradeCost.ToString() + " $";

        uPanel.upgradeBtn.interactable = false;
        if (lvl < 2)
        {
            uPanel.upgradeBtn.interactable = true;
            uPanel.upgradeBtn.onClick.AddListener(delegate { Upgrade(++lvl); });
        }
    }
Esempio n. 12
0
 public void OnMaythe4th()
 {
     Maythe4thButton.SetActive(false);
     UpgradePanel.SetActive(true);
     Time.timeScale = 0;
 }
Esempio n. 13
0
 public void CloseUpgradePanel()
 {
     _upgradeScreenActive = false;
     _upgradeInterface    = null;
     _upgradePanel        = null;
 }
Esempio n. 14
0
 public void OpenUpgradePanel()
 {
     _upgradeScreenActive = true;
     _upgradeInterface    = new UpgradeInterface(this);
     _upgradePanel        = new UpgradePanel(this, _upgradeInterface);
 }
Esempio n. 15
0
 //初始化
 public void Init()
 {
     Instanc = this;
     gameObject.SetActive(false);
 }
Esempio n. 16
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();
    }
Esempio n. 17
0
 public void BackToMenuFromUpgrades()
 {
     MainMenuPanel.SetActive(true);
     UpgradePanel.SetActive(false);
     Upgrades.HideTurrets();
 }
Esempio n. 18
0
 public void OpenUpgrades()
 {
     UpgradePanel.SetActive(true);
     MainMenuPanel.SetActive(false);
     Upgrades.BasicTurret();
 }
Esempio n. 19
0
 private void Awake()
 {
     Instance = this;
 }
Esempio n. 20
0
 public void OnMayNot()
 {
     UpgradePanel.SetActive(false);
     Maythe4thButton.SetActive(true);
     Time.timeScale = 1;
 }