Ejemplo n.º 1
0
 public void SetTank(int index)
 {
     if (index >= 0 && index < tanks.Length)
     {
         CurrentTank = Variables.instance.GetTank(index);
         bool flag = PlayerDataManager.IsTankLocked(CurrentTank);
         lockedContainer.SetActive(flag);
         if (!flag)
         {
             PlayerDataManager.SetSelectedTank(index);
         }
         tankIndex = index;
         nextTankButton.gameObject.SetActive(tankIndex != tanks.Length - 1);
         prevTankButton.gameObject.SetActive(tankIndex != 0);
         playButton.gameObject.SetActive(!flag);
         UpdateUpgradeData();
         currentBoosters = PlayerDataManager.GetTankBoosters(CurrentTank);
         SetTankBooster();
         openBoosterPopupButton.gameObject.SetActive(PlayerDataManager.GetTankCardCount(CurrentTank) > 0);
         for (int i = 0; i < paintItems.Length; i++)
         {
             bool flag2 = PlayerDataManager.SkinLocked(CurrentTank, i);
             paintItems[i].priceText.text      = CurrentTank.tankSkins[i].price.ToString();
             paintItems[i].nameText.text       = ScriptLocalization.Get(CurrentTank.tankSkins[i].name);
             paintItems[i].previewImage.sprite = CurrentTank.tankSkins[i].uiPreview;
             paintItems[i].buyButton.gameObject.SetActive(flag2 && !PlayerDataManager.IsTankLocked(Variables.instance.GetTank(index)));
             paintItems[i].okImage.enabled   = false;
             paintItems[i].lockImage.enabled = false;
             paintItems[i].frame.enabled     = false;
         }
         SetTankSkin(PlayerDataManager.GetSelectedSkin(CurrentTank));
     }
 }
Ejemplo n.º 2
0
    public void SetValues(Tank tank, int count, bool useNew = true, bool useStackSize = true, bool deductCount = false, bool useTankName = true, bool isNew = false)
    {
        image.sprite      = tank.card;
        background.sprite = MenuController.GetMenu <ShopMenu>().GetCardBackground(tank.rarity, small: true);
        int tankUpgradeLevel = PlayerDataManager.GetTankUpgradeLevel(tank);
        int max = Manager <PlayerDataManager> .instance.variables.tankLevelMinMax.max;
        int num = PlayerDataManager.GetTankCardCount(tank) - (deductCount ? count : 0);
        int tankLevelUpCardsCumulative = Manager <PlayerDataManager> .instance.variables.GetTankLevelUpCardsCumulative(tank.rarity, tankUpgradeLevel - 1);

        int tankLevelUpCardsCumulative2 = Manager <PlayerDataManager> .instance.variables.GetTankLevelUpCardsCumulative(tank.rarity, tankUpgradeLevel);

        levelText.text = string.Format("{0} {1}", ScriptLocalization.Get("Level"), tankUpgradeLevel + 1);
        countBlueContainer.SetActive(num < tankLevelUpCardsCumulative2);
        countGreenContainer.SetActive(num >= tankLevelUpCardsCumulative2 && tankUpgradeLevel < max);
        countRedContainer.SetActive(tankUpgradeLevel == max);
        string text = $"{num - tankLevelUpCardsCumulative}/{tankLevelUpCardsCumulative2 - tankLevelUpCardsCumulative}";

        countBlueText.text  = text;
        countGreenText.text = text;
        if (num < tankLevelUpCardsCumulative2 && tankLevelUpCardsCumulative2 > tankLevelUpCardsCumulative)
        {
            countBlueImage.fillAmount = (float)(num - tankLevelUpCardsCumulative) / (float)(tankLevelUpCardsCumulative2 - tankLevelUpCardsCumulative);
        }
        footerText.gameObject.SetActive(useTankName);
        footerText.text    = ScriptLocalization.Get(tank.name);
        stackSizeText.text = "X" + count.ToString();
        stackSizeContainer.gameObject.SetActive(useStackSize);
        newBorderContainer.SetActive(useNew && isNew);
        newIconContainer.SetActive(useNew && isNew);
        newTextContainer.SetActive(useNew && isNew);
    }
        public override void OnGotFocus()
        {
            base.OnGotFocus();
            restartButton.SetActive(NetGame.isServer);
            inviteButton.SetActive(NetGame.isServer && NetGame.instance.transport.CanSendInvite());
            if (!ExitText)
            {
                Debug.LogWarning("EXIT BUTTON reference not set in editor");
                return;
            }
            if (NetGame.isServer)
            {
                ExitText.SetText(ScriptLocalization.Get("MENU/PAUSE/EXIT TO LOBBY"));
            }
            else
            {
                ExitText.SetText(ScriptLocalization.Get("MENU/PAUSE/EXIT TO MAIN MENU"));
            }
            informationBox.gameObject.SetActive(value: true);
            NetGame.instance.transport.RegisterForLobbyData(OnLobbyDataUpdate);
            lobbyRefreshTimer = 0f;
            WorkshopItemSource currentLevelType = Game.instance.currentLevelType;

            if (currentLevelType == WorkshopItemSource.BuiltIn || currentLevelType == WorkshopItemSource.EditorPick)
            {
                workshopLevelButton.gameObject.SetActive(value: false);
                return;
            }
            workshopLevelButton.gameObject.SetActive(value: true);
            NetGame.instance.transport.RegisterForGameOverlayActivation(OnGameOverlayActivation);
        }
Ejemplo n.º 4
0
        private void OnKick(string txt)
        {
            if (string.IsNullOrEmpty(txt))
            {
                CommandRegistry.ShowCurrentHelp();
                return;
            }
            if (!NetGame.isServer)
            {
                string str = ScriptLocalization.Get("XTRA/NetChat_OnlyHost");
                Print(str);
                return;
            }
            NetHost client = GetClient(txt);

            if (client != null)
            {
                if (client == NetGame.instance.local)
                {
                    string str2 = ScriptLocalization.Get("XTRA/NetChat_NoKickMe");
                    Print(str2);
                }
                else
                {
                    NetGame.instance.Kick(client);
                }
            }
        }
Ejemplo n.º 5
0
    private void SetSelectedBooster(string id)
    {
        selectedBoosterId = id;
        if (PlayerDataManager.SetSelectedBooster(Variables.instance.GetTank(PlayerDataManager.GetSelectedTank()), id))
        {
            boosterBackButtonIcon.sprite = checkmarkIcon;
            boosterBackButtonIcon.SetNativeSize();
        }
        Booster booster = PlayerDataManager.GetBooster(id);

        boosterPopupBoosterName.text   = $"{ScriptLocalization.Get(booster.tankName)} {ScriptLocalization.Get(booster.type.ToString())}";
        boosterUpgradeCoinsText.text   = Variables.instance.GetBoosterLevelUpPriceForNextLevel(booster.Level).ToString();
        boosterPopupBoosterIcon.sprite = booster.bigCard;
        for (int i = 0; i < boosterItems.Length; i++)
        {
            bool flag = boosterItems[i].id.Equals(id);
            boosterItems[i].selected.enabled = flag;
            if (flag)
            {
                SetBoosterUIData(boosterItems[i], booster);
                PlayerDataManager.SetBoosterSeen(booster.id, val: true);
            }
        }
        MenuController.GetMenu <GarageMenu>().SetTankBooster();
        TankPrefs.Save();
        PlayerDataManager.SaveToCloudOnNextInterval = true;
    }
Ejemplo n.º 6
0
 private IEnumerator ConfigureCoop()
 {
     while (NetGame.instance.local.players.Count < 2)
     {
         explanation.SetActive(value: false);
         playButton.gameObject.SetActive(value: false);
         reconfigureButton.gameObject.SetActive(value: false);
         GetComponent <AutoNavigation>().defaultItem = backButton;
         GetComponent <AutoNavigation>().Invalidate();
         backButton.Select();
         leftPrompt.text  = ScriptLocalization.Get("MENU/COOP/P1Raise");
         rightPrompt.text = string.Empty;
         while (!PlayerManager.instance.p1Locked)
         {
             yield return(null);
         }
         leftPrompt.text  = GetDeviceName(PlayerManager.instance.p1Device);
         rightPrompt.text = ((PlayerManager.instance.p1Device != null) ? ScriptLocalization.Get("MENU/COOP/P2Raise") : ScriptLocalization.Get("MENU/COOP/P2RaiseController"));
         while (PlayerManager.instance.p1Locked && !PlayerManager.instance.p2Locked)
         {
             yield return(null);
         }
     }
     explanation.SetActive(value: true);
     leftPrompt.text  = GetDeviceName(PlayerManager.instance.p1Device);
     rightPrompt.text = GetDeviceName(PlayerManager.instance.p2Device);
     playButton.gameObject.SetActive(value: true);
     reconfigureButton.gameObject.SetActive(value: true);
     GetComponent <AutoNavigation>().defaultItem = playButton;
     GetComponent <AutoNavigation>().Invalidate();
     playButton.Select();
     coroutine = null;
 }
Ejemplo n.º 7
0
 private void SetNewCard(int i)
 {
     elements[i].teaserContainer.SetActive(value: true);
     elements[i].teaserContainer.GetComponent <Image>().sprite = MenuController.GetMenu <ShopMenu>().GetCardBackground(shopItems[i].rarity, small: true);
     elements[i].stackSizeText.text = ScriptLocalization.Get(shopItems[i].rarity + "Tank");
     elements[i].footerText.gameObject.SetActive(value: false);
 }
Ejemplo n.º 8
0
 protected override void Update()
 {
     base.Update();
     if (video != null && videoStarted && video.isPlaying && subtitles != null)
     {
         float audiosourceTime = this.audiosourceTime;
         if (currentLine != null)
         {
             if (!currentLine.ShouldShow(audiosourceTime))
             {
                 subtitleText.text = null;
             }
             currentLine = null;
         }
         if (currentLine == null)
         {
             currentLine = subtitles.GetLineToDisplay(audiosourceTime);
             if (currentLine != null && Options.audioSubtitles > 0)
             {
                 subtitleText.text = ScriptLocalization.Get("SUBTITLES/" + currentLine.key);
             }
         }
     }
     if (video != null && videoStarted && !video.isPlaying)
     {
         VideoLogButton item = selectedItem;
         selectedItem = null;
         SelectItem(item);
     }
 }
Ejemplo n.º 9
0
 private void GetInformationStrings()
 {
     for (int i = 0; i < sNumberInformationStrings; i++)
     {
         sLocalisedStrings[i] = ScriptLocalization.Get(sInformationStrings[i]);
     }
 }
Ejemplo n.º 10
0
        private NetHost GetClient(string txt)
        {
            if (string.IsNullOrEmpty(txt))
            {
                return(null);
            }
            string[] array = txt.Split(new char[1]
            {
                ' '
            }, StringSplitOptions.RemoveEmptyEntries);
            if (array.Length != 1)
            {
                return(null);
            }
            int result = 0;

            if (int.TryParse(array[0], out result))
            {
                if (result == 1)
                {
                    return(NetGame.instance.server);
                }
                if (result - 2 < NetGame.instance.readyclients.Count && result > 1)
                {
                    return(NetGame.instance.readyclients[result - 2]);
                }
            }
            string arg = ScriptLocalization.Get("XTRA/NetChat_NoPlayer");

            Print($"{arg} {result}");
            OnList();
            return(null);
        }
Ejemplo n.º 11
0
    public void SetData(Booster b, bool isSelected, int givenCount = 0, bool isNew = false)
    {
        id = b.id;
        selected.enabled = isSelected;
        if (b.type == BoosterGameplayType.None)
        {
            icon.sprite = originalSprite;
        }
        else
        {
            icon.sprite = b.card;
        }
        icon.SetNativeSize();
        bool num = PlayerDataManager.CanLevelUpBooster(b);

        maxProgress.gameObject.SetActive(b.MaxLevel);
        countProgress.gameObject.SetActive(!b.MaxLevel);
        levelUpReadyProgress.gameObject.SetActive(!b.MaxLevel);
        TextMeshProUGUI textMeshProUGUI = num ? countTextWithLevelUp : countText;

        if (!b.MaxLevel)
        {
            textMeshProUGUI.text = b.Count - b.ThisLevelCount + "/" + (b.NextLevelCount - b.ThisLevelCount);
        }
        float num2 = (float)(b.Count - b.ThisLevelCount) / (float)(b.NextLevelCount - b.ThisLevelCount);

        if (num2 >= 1f)
        {
            countProgress.gameObject.SetActive(value: false);
            levelUpReadyProgress.gameObject.SetActive(value: true);
        }
        else
        {
            countProgress.gameObject.SetActive(value: true);
            levelUpReadyProgress.gameObject.SetActive(value: false);
            countProgress.fillAmount = Mathf.Clamp01(num2);
        }
        levelText.text = ScriptLocalization.Get("Level") + " " + (b.Level + 1);
        if (nameText != null)
        {
            nameText.text = ScriptLocalization.Get(b.tankName) + "\n" + ScriptLocalization.Get(b.type.ToString());
        }
        if (shortNameText != null)
        {
            shortNameText.text = ScriptLocalization.Get(b.type.ToString());
        }
        if (givenCountContainer != null)
        {
            givenCountContainer.SetActive(givenCount > 0);
            if (givenCount > 0)
            {
                givenCountText.text = givenCount.ToString() + "x";
            }
        }
        if (newContainer != null)
        {
            newContainer.SetActive(isNew);
        }
    }
Ejemplo n.º 12
0
 private static string Translate(string text)
 {
     if (text.StartsWith("#"))
     {
         return(ScriptLocalization.Get(text.Substring(1)));
     }
     return(text);
 }
Ejemplo n.º 13
0
 private void SetUp(string title, string description, string confirm, string cancel, Action onConfirm, Action onCancel)
 {
     titleText.text       = ((!title.Contains("/")) ? title : ScriptLocalization.Get(title));
     descriptionText.text = ((!description.Contains("/")) ? description : ScriptLocalization.Get(description));
     confirmText.text     = ScriptLocalization.Get(confirm);
     cancelText.text      = ScriptLocalization.Get(cancel);
     this.onConfirm       = onConfirm;
     this.onCancel        = onCancel;
 }
Ejemplo n.º 14
0
 private string GetMetaStrings(StringBuilder builder, MetaStrings metaString, string value)
 {
     builder.Length = 0;
     builder.Append(ScriptLocalization.Get(metaStringsValues[(int)metaString]));
     builder.Append(':');
     builder.Append(' ');
     builder.AppendLine(value);
     return(builder.ToString());
 }
Ejemplo n.º 15
0
    private static string ErrorToString(string error)
    {
        string text = ScriptLocalization.Get("MULTIPLAYER/" + error);

        if (string.IsNullOrEmpty(text))
        {
            return(error);
        }
        return(text);
    }
Ejemplo n.º 16
0
    public static string T(string key)
    {
        string text = ScriptLocalization.Get(key);

        if (string.IsNullOrEmpty(text))
        {
            return(key);
        }
        return(text);
    }
Ejemplo n.º 17
0
 private void InitPromotion()
 {
     gameOverAdventureContainer.SetActive(value: false);
     gameOverArenaContainer.SetActive(value: false);
     gameOverArena2v2Container.SetActive(value: false);
     //shareButton.gameObject.SetActive(PlayerDataManager.SelectedGameMode == GameMode.Adventure);
     promotionContainer.SetActive(value: true);
     if (!PlayerDataManager.IsSelectedGameModePvP)
     {
         if (MenuBase <GameEndMenu> .instance.ranks.DidLevelUp)
         {
             TankAnalytics.PlayerPromotion(ranks.ranks[ranks.ranks.Count - 1]);
         }
         int currentXp = oldXp + scoreGotten + 1;
         int index     = (nextRank != null) ? (ranks.ranks.Count - 2) : (ranks.ranks.Count - 1);
         // Debug.Log("当前军衔是:"+ranks.ranks[index].name);
         //promotionRankText.text = ScriptLocalization.Get(ranks.ranks[index].name);
         promotionRankText.text = "<color=black>" + ranks.ranks[index].name;
         newRank.sprite         = ranks.ranks[index].sprite;
         newRank.SetNativeSize();
         SetXpBar(ranks, currentXp, promotionXpBarFill, promotionXpIndicator, promotionPrevRank, promotionNextRank, promotionXpContainer, null);
         if (MenuBase <GameEndMenu> .instance.nextRank != null)
         {
             float num        = oldXp + scoreGotten;
             float num2       = (prevRank != null) ? (num - (float)prevRank.xp) : num;
             float num3       = (prevRank != null) ? (nextRank.xp - prevRank.xp) : nextRank.xp;
             float fillAmount = num2 / num3;
             promotionXpBarFill.fillAmount = fillAmount;
             Vector2 anchoredPosition = promotionXpIndicator.rectTransform.anchoredPosition;
             anchoredPosition.x = promotionXpBarFill.rectTransform.rect.width * promotionXpBarFill.fillAmount;
             promotionXpIndicator.rectTransform.anchoredPosition = anchoredPosition;
         }
     }
     else
     {
         int       rating        = PlayerDataManager.GetRating(PlayerDataManager.SelectedGameMode);
         RankStats prevRankStats = Variables.instance.GetPrevRankStats(rating);
         RankStats rankStats     = Variables.instance.GetRankStats(rating);
         RankStats nextRankStats = Variables.instance.GetNextRankStats(rating);
         float     num4          = (float)(rating - prevRankStats.maxTrophies) / (float)(rankStats.maxTrophies - prevRankStats.maxTrophies);
         promotionXpBarFill.fillAmount = num4;
         Vector2 anchoredPosition2 = promotionXpIndicator.rectTransform.anchoredPosition;
         anchoredPosition2.x = promotionXpBarFill.rectTransform.rect.width * num4;
         promotionXpIndicator.rectTransform.anchoredPosition = anchoredPosition2;
         promotionRankText.text = ScriptLocalization.Get(rankStats.name);
         newRank.sprite         = ((PlayerDataManager.SelectedGameMode == GameMode.Arena2v2) ? rankStats.sprite2v2 : rankStats.sprite);
         newRank.SetNativeSize();
         promotionPrevRank.sprite = rankStats.smallSprite;
         promotionPrevRank.SetNativeSize();
         promotionNextRank.sprite = nextRankStats.smallSprite;
         promotionNextRank.SetNativeSize();
     }
     StartCoroutine(PromotionAnimation());
     MenuController.instance.StartCoroutine(AudioManager.FadeMusicForSound("promotion"));
 }
Ejemplo n.º 18
0
 public static string TagStrings(string baseID, int value, bool english = false)
 {
     tagBuilder.Length = 0;
     tagBuilder.Append(baseID);
     tagBuilder.Append(value);
     if (english)
     {
         return(LocalizationManager.GetTermTranslation(tagBuilder.ToString(), 3));
     }
     return(ScriptLocalization.Get(tagBuilder.ToString()));
 }
Ejemplo n.º 19
0
 public void PlayClick()
 {
     if (MenuSystem.CanInvoke)
     {
         string    text     = ScriptLocalization.Get("SUBTITLES/" + selectedItem.videoRepositoryItem.name);
         TextAsset videoSrt = HFFResources.instance.GetVideoSrt(selectedItem.videoRepositoryItem.name + "Srt");
         subtitles = new SrtSubtitles();
         subtitles.Load(selectedItem.videoRepositoryItem.name, videoSrt.text);
         videoSrt = null;
         LoadMovie();
     }
 }
Ejemplo n.º 20
0
 private void AddEditorPickLevel(ulong number, string name)
 {
     levelRepo.AddItem(WorkshopItemSource.EditorPick, new BuiltinLevelMetadata
     {
         folder       = "editorpick:" + number,
         workshopId   = number,
         levelType    = WorkshopItemSource.EditorPick,
         itemType     = WorkshopItemType.Level,
         internalName = name,
         title        = ScriptLocalization.Get("LEVEL/" + name),
         _thumbPath   = "res:LevelImages/" + name
     });
 }
Ejemplo n.º 21
0
    private void OnEnable()
    {
        boosterBackButtonIcon.sprite = crossIcon;
        boosterBackButtonIcon.SetNativeSize();
        Tank currentTank = MenuController.GetMenu <GarageMenu>().CurrentTank;

        currentBoosters        = PlayerDataManager.GetTankBoosters(currentTank);
        boosterHeaderText.text = ScriptLocalization.Get(currentTank.name + "Boosters");
        selectedBoosterId      = PlayerDataManager.GetSelectedBoosterId(currentTank);
        int i = 0;

        if (currentBoosters != null && currentBoosters.Length != 0)
        {
            for (int j = 0; j < currentBoosters.Length; j++)
            {
                Booster cb = currentBoosters[j];
                if (cb.type != 0)
                {
                    if (selectedBoosterId == null || selectedBoosterId.Length == 0)
                    {
                        SetSelectedBooster(cb.id);
                    }
                    SetBoosterUIData(boosterItems[i], cb, !PlayerDataManager.GetBoosterSeen(cb.id));
                    if (cb.Count == 0)
                    {
                        boosterItems[i].GetComponent <CanvasGroup>().alpha = 0.5f;
                    }
                    else
                    {
                        boosterItems[i].GetComponent <CanvasGroup>().alpha = 1f;
                    }
                    boosterItems[i].button.onClick.RemoveAllListeners();
                    boosterItems[i].button.onClick.AddListener(delegate
                    {
                        SetSelectedBooster(cb.id);
                    });
                    i++;
                }
            }
        }
        for (; i < boosterItems.Length; i++)
        {
            boosterItems[i].gameObject.SetActive(value: false);
        }
        if (selectedBoosterId != null && selectedBoosterId.Length > 0)
        {
            SetSelectedBooster(selectedBoosterId);
        }
    }
Ejemplo n.º 22
0
 private void LobbyGuns()
 {
     lobbyGuns = !lobbyGuns;
     if (lobbyGuns)
     {
         string str = ScriptLocalization.Get("XTRA/gunsOn");
         NetChat.Print(str);
     }
     else
     {
         string str2 = ScriptLocalization.Get("XTRA/gunsOff");
         NetChat.Print(str2);
     }
     PlayerPrefs.SetInt("lobbyGuns", lobbyGuns ? 1 : 0);
     SetValue(total, goal, lastGoal, prize);
 }
Ejemplo n.º 23
0
 private void OnList()
 {
     if (!NetGame.isNetStarted)
     {
         string str = ScriptLocalization.Get("XTRA/NetChat_OnlyMP");
         Print(str);
     }
     else
     {
         int num = 1;
         Print(string.Format("{0} {1} {2}", num++, NetGame.instance.server.name, (!NetGame.instance.server.mute) ? string.Empty : ScriptLocalization.Get("XTRA/NetChat_Muted")));
         foreach (NetHost readyclient in NetGame.instance.readyclients)
         {
             Print(string.Format("{0} {1} {2}", num++, readyclient.name, (!readyclient.mute) ? string.Empty : ScriptLocalization.Get("XTRA/NetChat_Muted")));
         }
     }
 }
Ejemplo n.º 24
0
    private string GetDeviceName(InputDevice device)
    {
        if (device == null)
        {
            return(ScriptLocalization.Get("MENU/COOP/MouseAndKeys"));
        }
        ReadOnlyCollection <InputDevice> devices = InputManager.Devices;

        for (int i = 0; i < devices.Count; i++)
        {
            if (devices[i] == device)
            {
                return(string.Format(ScriptLocalization.Get("MENU/COOP/Controller"), i + 1));
            }
        }
        return(string.Empty);
    }
Ejemplo n.º 25
0
    public static void SetWeMissYou()
    {
        string[] array = new string[3]
        {
            "weMissYouTraditional",
            "weMissYouIncentive",
            "weMissYouCompetitive"
        };
        string[] array2 = array;
        for (int i = 0; i < array2.Length; i++)
        {
            RemoveNotificationsOfType(array2[i]);
        }
        string text = array[UnityEngine.Random.Range(0, array.Length)];

        ScheduleNotification(ScriptLocalization.Get(text), text, DateTime.Now + TimeSpan.FromDays(7.0));
    }
Ejemplo n.º 26
0
    public string GetText()
    {
        bool flag = false;

        for (int i = 0; i < NetGame.instance.players.Count; i++)
        {
            flag |= !NetGame.instance.players[i].controls.mouseControl;
        }
        if (flag && !string.IsNullOrEmpty(term))
        {
            return(ScriptLocalization.Get(term));
        }
        if (!flag && !string.IsNullOrEmpty(keyboardTerm))
        {
            return(ScriptLocalization.Get(keyboardTerm));
        }
        return(null);
    }
    private void Start()
    {
        pressPrompt.text = ScriptLocalization.Get((!ControllerAvailable) ? keybaordStartTerm : controllerStartTerm);
        string text = ScriptLocalization.Get(writtenByTerm);
        bool   flag = true;
        int    i    = 0;

        for (int length = text.Length; i < length; i++)
        {
            int num = text[i];
            if ((num < 32 || num >= 127) && num != 201)
            {
                flag = false;
                break;
            }
        }
        writtenByLabel.font = ((!flag) ? menuSDFFont : writtenByFont);
        writtenByLabel.text = text;
    }
 public void RebindSettings()
 {
     if (NetGame.isServer)
     {
         bool friendly = NetGame.friendly;
         friendly = true;
         string str = ScriptLocalization.Get("MULTIPLAYER/LOBBY.SETTINGS") + "\r\n<size=75%>";
         str += string.Format(ScriptLocalization.Get("MULTIPLAYER/LOBBY.MaxPlayers"), Options.lobbyMaxPlayers);
         if (friendly && Options.lobbyInviteOnly > 0)
         {
             str = str + ", " + ScriptLocalization.Get("MULTIPLAYER/LOBBY.InviteOnly");
         }
         if (Options.lobbyJoinInProgress > 0)
         {
             str = str + ", " + ScriptLocalization.Get("MULTIPLAYER/LOBBY.GameInProgress");
         }
         str += "</size>";
         settingsText.text = str;
     }
 }
Ejemplo n.º 29
0
    private void UpdateUpgradeData(bool flashUpgradeText = false)
    {
        tankNameText.text = ScriptLocalization.Get(CurrentTank.name);
        //  Debug.Log("当前坦克是:"+ScriptLocalization.Get(CurrentTank.name));
        bool flag  = PlayerDataManager.IsTankLocked(CurrentTank);
        bool flag2 = PlayerDataManager.GetTankCardCount(CurrentTank) >= PlayerDataManager.GetCardsNeededForLevelUpCumulative(CurrentTank) && PlayerDataManager.GetTankUpgradeLevel(CurrentTank) < Variables.instance.tankLevelMinMax.max;
        int  coinsNeededForLevelUp = PlayerDataManager.GetCoinsNeededForLevelUp(CurrentTank);

        levelUpText.text = ScriptLocalization.Get("LevelUp");
        if (flag)
        {
            int num = Variables.instance.GetTankGemValue(CurrentTank);
            if (PlayerDataManager.HasActiveDailyOffer())
            {
                for (int i = 0; i != dailyOffers.Length; i++)
                {
                    if (dailyOffers[i] != null && dailyOffers[i].id.Equals(CurrentTank.id) && dailyOffers[i].discount > 0 && dailyOffers[i].currency == CurrencyType.Gems)
                    {
                        num = dailyOffers[i].price;
                        break;
                    }
                }
            }
            unlockPriceText.text = num.ToString();
        }
        upgradeButton.interactable = flag2;
        upgradeButton.gameObject.SetActive(!flag);
        upgradeHelperContainer.SetActive(!flag2 && !flag && PlayerDataManager.GetTankUpgradeLevel(CurrentTank) < Variables.instance.tankLevelMinMax.max);
        levelUpText.gameObject.SetActive(!flag);
        unlockButton.gameObject.SetActive(flag);
        unlockHelperContainer.SetActive(flag);
        upgradePriceText.text = ((coinsNeededForLevelUp > 0) ? "<size=50%>" + coinsNeededForLevelUp.ToString() : ScriptLocalization.Max);
        tankCard.SetValues(CurrentTank, PlayerDataManager.GetTankCardCount(CurrentTank), useNew: false, useStackSize: false, deductCount: false, useTankName: false);
        maxProgression  = Variables.instance.GetMaxProgression().maxStep;
        tankProgression = CurrentTank.GetProgression(PlayerDataManager.GetTankUpgradeLevel(CurrentTank));
        if (!MenuController.GetMenu <RewardCalendarPopup>().isActiveAndEnabled)
        {
            MenuController.UpdateTopMenu();
        }
    }
Ejemplo n.º 30
0
        private void OnMute(string txt)
        {
            if (string.IsNullOrEmpty(txt))
            {
                CommandRegistry.ShowCurrentHelp();
                return;
            }
            if (!NetGame.isNetStarted)
            {
                string str = ScriptLocalization.Get("XTRA/NetChat_OnlyMP");
                Print(str);
                return;
            }
            NetHost client = GetClient(txt);

            if (client == null)
            {
                return;
            }
            if (client == NetGame.instance.local)
            {
                string str2 = ScriptLocalization.Get("XTRA/NetChat_NoMuteMe");
                Print(str2);
                return;
            }
            client.mute = !client.mute;
            if (client.mute)
            {
                string text = ScriptLocalization.Get("XTRA/NetChat_Muted");
                Print(text);
                Print($"{text} {txt} {client.name}");
            }
            else
            {
                string text2 = ScriptLocalization.Get("XTRA/NetChat_UnMuted");
                Print(text2);
                Print($"{text2} {txt} {client.name}");
            }
        }