コード例 #1
0
        //Updates the UI
        protected virtual void UpdateTankStats(int index)
        {
            TankTypeDefinition tankData = TankLibrary.s_Instance.GetTankDataForIndex(index);

            if (m_Capitalize)
            {
                m_TankName.text = tankData.name.ToUpperInvariant();
            }
            else
            {
                m_TankName.text = tankData.name;
            }

            if (m_SpeedSlider != null)
            {
                m_SpeedSlider.UpdateValue(tankData.speedRating);
            }

            if (m_RefireRateSlider != null)
            {
                m_RefireRateSlider.UpdateValue(tankData.refireRating);
            }
            if (m_ArmorSlider != null)
            {
                m_ArmorSlider.UpdateValue(tankData.armourRating);
            }
        }
コード例 #2
0
        /// <summary>
        /// DEPRECATED: Temporarily unlocks this tank in response to watching an advert.
        /// </summary>
        private void TempUnlockTank()
        {
            TankTypeDefinition tankData = TankLibrary.s_Instance.GetTankDataForIndex(m_CurrentIndex);

            DailyUnlockManager.s_Instance.SetDailyUnlock(tankData.id);
            UpdateTankStats(m_CurrentIndex);
        }
コード例 #3
0
        /// <summary>
        /// Changes the star ratings for different tank statistics based on the tank index.
        /// </summary>
        /// <param name="index">Index of the selected tank in the TankLibrary.</param>
        protected override void UpdateTankStats(int index)
        {
            TankTypeDefinition tankData = TankLibrary.s_Instance.GetTankDataForIndex(index);

            m_TankDescription.text = tankData.description;
            m_Cost.text            = tankData.cost.ToString();

            bool isLocked = (!PlayerDataManager.s_Instance.IsTankUnlocked(index) && !DailyUnlockManager.s_Instance.IsItemTempUnlocked(tankData.id));

            m_LockedPanel.SetActive(isLocked);
            m_OkButton.interactable = !isLocked;

            base.UpdateTankStats(index);
        }
コード例 #4
0
ファイル: TankRotator.cs プロジェクト: usernamejialu/tank
        //As this class is recreated each time we enter the menu from another scene, we can rely on Start to refresh our selections.
        private IEnumerator Start()
        {
            //Alas, we must wait for the Daily unlock manager to be initialized before we can poll it for temp unlock data.
            while (!DailyUnlockManager.s_Instance.IsInitialized())
            {
                yield return(null);
            }

            //Check if the last selected tank is still valid for selection. If not, reset to default.
            int testIndex = PlayerDataManager.s_Instance.selectedTank;

            TankTypeDefinition tankData = TankLibrary.s_Instance.GetTankDataForIndex(testIndex);

            if (!PlayerDataManager.s_Instance.IsTankUnlocked(testIndex) && !DailyUnlockManager.s_Instance.IsItemTempUnlocked(tankData.id))
            {
                testIndex = 0;
                PlayerDataManager.s_Instance.selectedTank = 0;
            }

            //Loads correct tank
            LoadModelForTankIndex(testIndex);
        }
コード例 #5
0
        //Loads the correct tank model
        public void LoadModelForTankIndex(int definitionIndex)
        {
            TankTypeDefinition tankData = TankLibrary.s_Instance.GetTankDataForIndex(definitionIndex);

            ChangeTankModel(tankData.displayPrefab);
        }
コード例 #6
0
        /// <summary>
        /// Brings up the Buy modal, which will determine whether the tank can be purchased with in-game currency.
        /// </summary>
        public void TryBuyCurrentTank()
        {
            TankTypeDefinition tankData = TankLibrary.s_Instance.GetTankDataForIndex(m_CurrentIndex);

            m_BuyModal.OpenBuyModal(tankData.name, tankData.cost, BuyCurrentTank, TempUnlockTank);
        }