コード例 #1
0
 public void ApplyTo(DynamicBookLinks.Page[] pages)
 {
     for (int i = 0; i < pages.Length; i++)
     {
         if (this._pagesState[i]._state)
         {
             if (pages[i]._prevButton)
             {
                 pages[i]._prevButton.MyPageNew = this._pagesState[i]._prevButtonTarget;
             }
             if (pages[i]._nextButton)
             {
                 pages[i]._nextButton.MyPageNew = this._pagesState[i]._nextButtonTarget;
             }
             if (pages[i]._prevButtonText)
             {
                 pages[i]._prevButtonText._key = this._pagesState[i]._prevButtonKey;
                 pages[i]._prevButtonText.SetText(UiTranslationDatabase.TranslateKey(this._pagesState[i]._prevButtonKey, this._pagesState[i]._prevButtonKey, true));
             }
             if (pages[i]._nextButtonText)
             {
                 pages[i]._nextButtonText._key = this._pagesState[i]._nextButtonKey;
                 pages[i]._nextButtonText.SetText(UiTranslationDatabase.TranslateKey(this._pagesState[i]._nextButtonKey, this._pagesState[i]._nextButtonKey, true));
             }
         }
         if (!pages[i]._prevButton && pages[i]._nextButton && !pages[i]._nextButtonText && pages[i]._go.activeSelf != this._pagesState[i]._state)
         {
             pages[i]._go.SetActive(this._pagesState[i]._state);
         }
     }
 }
コード例 #2
0
ファイル: TickOffSystem.cs プロジェクト: K07H/The-Forest
 public void DoneMessage(object o)
 {
     TickOffSystem.EntryType type = (o as TickOffSystem.Entry)._type;
     if (type != TickOffSystem.EntryType.CollectItem)
     {
         if (type != TickOffSystem.EntryType.InspectAnimal)
         {
             if (type == TickOffSystem.EntryType.InspectPlant)
             {
                 this.LogMessage(UiTranslationDatabase.TranslateKey(this._inspectedPlantMessageKey, "NEW PLANT DISCOVERED", true));
             }
         }
         else
         {
             this.LogMessage(UiTranslationDatabase.TranslateKey(this._inspectedAnimalMessageKey, "NEW ANIMAL DISCOVERED", true));
         }
     }
     else
     {
         this.LogMessage(UiTranslationDatabase.TranslateKey(this._collectedItemMessageKey, "NEW PLANT DISCOVERED", true));
     }
     if (this._tickOffTab)
     {
         this._tickOffTab.Highlight(null);
     }
     LocalPlayer.Sfx.PlayTaskCompleted();
 }
コード例 #3
0
ファイル: CoopSteamNGUI.cs プロジェクト: DevZhav/The-Forest
 private void Awake()
 {
     this.ResetDSFlags();
     UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
     if (LoadAsync.Scenery)
     {
         Blur blur = (!LoadAsync.Scenery) ? null : LoadAsync.Scenery.GetComponentInChildren <Blur>();
         if (blur)
         {
             blur.enabled = true;
         }
     }
     BoltLauncher.SetUdpPlatform(new SteamPlatform());
     TheForest.Utils.Input.player.controllers.maps.SetMapsEnabled(false, ControllerType.Keyboard, "Default");
     TheForest.Utils.Input.player.controllers.maps.SetMapsEnabled(true, ControllerType.Keyboard, "Menu");
     TheForest.Utils.Input.player.controllers.maps.SetMapsEnabled(true, ControllerType.Joystick, "Menu");
     if (!SteamManager.Initialized)
     {
         if (GameSetup.IsMpServer)
         {
             this.OpenScreen(CoopSteamNGUI.Screens.LobbySetup);
         }
         else
         {
             this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser);
         }
         this.SetLoadingText(UiTranslationDatabase.TranslateKey("STEAM_NOT_INITIALIZED", "Steam not initialized", this._allCapsTexts));
         return;
     }
     this.RefreshUI();
     if (GameSetup.IsMpServer)
     {
         this._hostGameName    = PlayerPrefs.GetString("MpGameName", this._hostGameName);
         this._hostMaxPlayers  = PlayerPrefs.GetInt("MpGamePlayerCount", this.GetHostPlayersMax()).ToString();
         this._hostFriendsOnly = (PlayerPrefs.GetInt("MpGameFriendsOnly", (!this._hostFriendsOnly) ? 0 : 1) == 1);
         this._lobbySetupScreen._gameNameInput.value     = this._hostGameName;
         this._lobbySetupScreen._playerCountInput.value  = this._hostMaxPlayers;
         this._lobbySetupScreen._privateOnlyToggle.value = this._hostFriendsOnly;
         this.OpenScreen(CoopSteamNGUI.Screens.LobbySetup);
     }
     else
     {
         CoopLobbyManager.QueryList(this._showFriendGames);
         this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser);
     }
     if (AutoJoinAfterMPInvite.LobbyID != null && (CoopLobby.Instance == null || CoopLobby.Instance.Info.LobbyId.ToString() != AutoJoinAfterMPInvite.LobbyID))
     {
         CoopLobbyInfo lobby = new CoopLobbyInfo(ulong.Parse(AutoJoinAfterMPInvite.LobbyID));
         AutoJoinAfterMPInvite.LobbyID = null;
         if (GameSetup.IsSavedGame)
         {
             this.OnClientContinueGame(lobby);
         }
         else
         {
             this.OnClientNewGame(lobby);
         }
     }
 }
コード例 #4
0
 private string GetCurrentFeeling()
 {
     if (this._currentFeelingAlpha < 0.5f)
     {
         return(UiTranslationDatabase.TranslateKey(this._currentFeeling._feelingName, this._currentFeeling._feelingName, true));
     }
     return(UiTranslationDatabase.TranslateKey(this._defaultFeeling, this._defaultFeeling, true));
 }
コード例 #5
0
ファイル: HintText.cs プロジェクト: K07H/The-Forest
    private void Awake()
    {
        int num = UnityEngine.Random.Range(0, this.texts.Length - 1);

        this.name         = UiTranslationDatabase.TranslateKey("HINT_" + num, this.texts[num], true);
        this.MyLabel      = base.gameObject.GetComponent <UILabel>();
        this.MyLabel.text = this.name;
    }
コード例 #6
0
 public void OnHostStartGame()
 {
     this.SetLoadingText(UiTranslationDatabase.TranslateKey("STARTING_SERVER___", "Starting Server...", this._allCapsTexts));
     if (GameSetup.IsNewGame)
     {
         PlaneCrashAudioState.Spawn();
     }
     base.gameObject.AddComponent <CoopSteamServerStarter>().gui = this;
 }
コード例 #7
0
 private void UpdateLobby()
 {
     if (!CoopLobby.IsInLobby)
     {
         this.OnBack();
         return;
     }
     if (CoopLobby.Instance == null || CoopLobby.Instance.Info == null || CoopLobby.Instance.Info.Destroyed)
     {
         this.SetErrorText(UiTranslationDatabase.TranslateKey("LOBBY_DESTROYED", "Lobby Destroyed", this._allCapsTexts));
         this.OnBack();
         CoopLobby.LeaveActive();
         return;
     }
     if (!CoopLobby.Instance.Info.IsOwner && CoopLobby.Instance.Info.ServerId.IsValid())
     {
         if (!BoltNetwork.isClient && !base.gameObject.GetComponent <CoopSteamClientStarter>())
         {
             base.gameObject.AddComponent <CoopSteamClientStarter>().gui = this;
             if (GameSetup.IsNewGame)
             {
                 PlaneCrashAudioState.Spawn();
             }
             this.SetLoadingText(UiTranslationDatabase.TranslateKey("STARTING_CLIENT___", "Starting Client...", this._allCapsTexts));
         }
     }
     else
     {
         bool  foundHost = false;
         ulong ownerId   = SteamMatchmaking.GetLobbyOwner(CoopLobby.Instance.Info.LobbyId).m_SteamID;
         this._lobbyScreen._playerCountLabel.text = StringEx.TryFormat(UiTranslationDatabase.TranslateKey("PLAYER_CURRENT_OVER_MAX", "PLAYERS: {0} / {1}", this._allCapsTexts), new object[]
         {
             CoopLobby.Instance.MemberCount,
             CoopLobby.Instance.Info.MemberLimit
         });
         this._lobbyScreen._playerListLabel.text = CoopLobby.Instance.AllMembers.Select(delegate(CSteamID x)
         {
             string text = SteamFriends.GetFriendPersonaName(x);
             bool flag   = x.m_SteamID == ownerId;
             if (flag)
             {
                 text     += " (Host)";
                 foundHost = true;
             }
             return(text);
         }).Aggregate((string a, string b) => a + "\n" + b);
         if (!foundHost)
         {
             this.OnBack();
         }
     }
 }
コード例 #8
0
    public void OnClientConnectDs(gameserveritem_t server)
    {
        bool flag = server.m_nPlayers >= server.m_nMaxPlayers;

        string[] array = server.GetGameTags().Split(new char[]
        {
            ';'
        });
        string item  = (array == null || array.Length <= 0) ? string.Empty : array[0];
        string a     = (array == null || array.Length <= 1) ? "-1" : array[1];
        bool   flag2 = a != "__E3C26D06F07B6AB14EC25F4823E9A30D6B4ED0450527C1E768739D96C9F061AE";

        if (flag2 || flag)
        {
            this._joinDsScreen._adminPassword.gameObject.SetActive(false);
            this._joinDsScreen._password.gameObject.SetActive(false);
            this._joinDsScreen._newButtonLabel.transform.parent.gameObject.SetActive(false);
            this._joinDsScreen._continueButtonLabel.transform.parent.gameObject.SetActive(false);
        }
        else
        {
            this._joinDsScreen._newButtonLabel.transform.parent.gameObject.SetActive(true);
            if (this.PreviouslyPlayedServers.Contains(item))
            {
                this._joinDsScreen._continueButtonLabel.transform.parent.gameObject.SetActive(true);
                this._joinDsScreen._continueButtonLabel.text = UiTranslationDatabase.TranslateKey("CONTINUE", "Continue", this._allCapsTexts);
            }
            else
            {
                this._joinDsScreen._continueButtonLabel.transform.parent.gameObject.SetActive(false);
            }
            this._joinDsScreen._adminPassword.gameObject.SetActive(true);
            this._joinDsScreen._password.gameObject.SetActive(server.m_bPassword);
        }
        this._joinDsScreen._prefabDbVersionMissmatch.SetActive(flag2);
        this._joinDsScreen._prefabServerIsFull.SetActive(flag && !flag2);
        this._joinDsScreen._serverName.text = server.GetServerName();
        this.JoiningServer          = server;
        this._joinDsScreen._ip.text = server.m_NetAdr.GetConnectionAddressString();
        if (this._joinDsScreen._ping)
        {
            this._joinDsScreen._ping.text = server.m_nPing + "ms";
        }
        this._joinDsScreen._playerLimit.text = StringEx.TryFormat("{0} / {1}", new object[]
        {
            server.m_nPlayers,
            server.m_nMaxPlayers
        });
        this._joinDsScreen._password.value      = string.Empty;
        this._joinDsScreen._adminPassword.value = string.Empty;
        this.OpenScreen(CoopSteamNGUI.Screens.JoinDS);
    }
コード例 #9
0
 private void OnFailedEnterLobby(string reason)
 {
     this.ClearLoadingAndError();
     this.OnBack();
     if (reason == "FULL")
     {
         this._lobbyFullMessage.SetActive(true);
     }
     else
     {
         this.SetErrorText(UiTranslationDatabase.TranslateKey("COULD_NOT_JOIN_STEAM_LOBBY", "Could not join Steam lobby.", this._allCapsTexts));
     }
 }
コード例 #10
0
        private InputActionRow GetNewUIRow(InputAction action, string name)
        {
            InputActionRow inputActionRow = UnityEngine.Object.Instantiate <InputActionRow>(this._inputActionRowPrefab);

            inputActionRow.transform.parent        = this._table.transform;
            inputActionRow.transform.localPosition = Vector3.zero;
            inputActionRow.transform.localScale    = Vector3.one;
            inputActionRow._action = action;
            name = name.ToUpperInvariant();
            name = UiTranslationDatabase.TranslateKey(name, name, true);
            inputActionRow._label.text = name;
            this._actionRowMappingCount[inputActionRow] = 0;
            return(inputActionRow);
        }
コード例 #11
0
        private void AddNewUIActionCategory(string name)
        {
            UILabel uilabel = UnityEngine.Object.Instantiate <UILabel>(this._inputActionCategoryPrefab);

            uilabel.transform.parent        = this._table.transform;
            uilabel.transform.localPosition = Vector3.zero;
            uilabel.transform.localScale    = Vector3.one;
            if (this._table.transform.childCount == 1)
            {
                uilabel.height = 40;
            }
            name         = name.ToUpperInvariant();
            name         = UiTranslationDatabase.TranslateKey(name, name, true);
            uilabel.text = name;
        }
コード例 #12
0
 private void Start()
 {
     if (!SteamDSConfig.isDedicatedServer)
     {
         if (FMOD_StudioSystem.instance && FMOD_StudioSystem.instance.System != null)
         {
             UnityUtil.ERRCHECK(FMOD_StudioSystem.instance.System.getVCA("vca:/SFX", out this.SFXControl));
             UnityUtil.ERRCHECK(FMOD_StudioSystem.instance.System.getBus("bus:/Music", out this.MusicBus));
             this.GetExtraMusicBuses();
         }
         else
         {
             UnityEngine.Debug.LogError("FMOD_StudioSystem.instance or FMOD_StudioSystem.instance.System is null, failed to initialize SFXControl & MusicBus");
         }
         UiTranslationDatabase.SetLanguage(PlayerPreferences.Language);
     }
 }
コード例 #13
0
        private bool CheckUpgradeBonus(Receipe r, out bool useFakeWeaponView)
        {
            useFakeWeaponView = false;
            if (r._weaponStatUpgrades != null && r._weaponStatUpgrades.Length > 0)
            {
                WeaponStatUpgrade.Types type = r._weaponStatUpgrades[0]._type;
                switch (type)
                {
                case WeaponStatUpgrade.Types.FlareGunAmmo:
                    this._title.text  = UiTranslationDatabase.TranslateKey("UPGRADE__AMMO", "{0} AMMO", true);
                    useFakeWeaponView = false;
                    return(true);

                default:
                    if (type != WeaponStatUpgrade.Types.BurningAmmo)
                    {
                        return(false);
                    }
                    break;

                case WeaponStatUpgrade.Types.PoisonnedAmmo:
                    this._title.text = UiTranslationDatabase.TranslateKey("UPGRADE_POISONED_", "Poisoned {0}", true);
                    return(true);

                case WeaponStatUpgrade.Types.BurningWeaponExtra:
                    this._title.text = UiTranslationDatabase.TranslateKey("UPGRADE_EXTRA_BURNING_", "Extra burning {0}", true);
                    return(true);

                case WeaponStatUpgrade.Types.Incendiary:
                    break;

                case WeaponStatUpgrade.Types.BoneAmmo:
                    this._title.text = UiTranslationDatabase.TranslateKey("UPGRADE_BONE_", "Bone {0}", true);
                    return(true);

                case WeaponStatUpgrade.Types.PoisonnedWeapon:
                    this._title.text  = UiTranslationDatabase.TranslateKey("UPGRADE_POISONED_", "Poisoned {0}", true);
                    useFakeWeaponView = true;
                    return(true);
                }
                this._title.text = UiTranslationDatabase.TranslateKey("UPGRADE_INCENDIARY_", "Incendiary {0}", true);
                return(true);
            }
            return(false);
        }
コード例 #14
0
        private static string GetActionUIText(InputAction action, bool negativeAxis = false)
        {
            if (action == null)
            {
                return("NULL");
            }
            string text = action.descriptiveName;

            if (action.type == InputActionType.Axis)
            {
                text = "____" + ((!negativeAxis) ? action.positiveDescriptiveName : action.negativeDescriptiveName);
            }
            if (text.NullOrEmpty())
            {
                text = action.name;
            }
            return(UiTranslationDatabase.TranslateKey(text.ToUpper(), text.ToUpperInvariant(), true).Trim());
        }
コード例 #15
0
    public void OnHostLobbySetup()
    {
        this._hostGameName    = this._lobbySetupScreen._gameNameInput.value;
        this._hostMaxPlayers  = this._lobbySetupScreen._playerCountInput.value;
        this._hostFriendsOnly = this._lobbySetupScreen._privateOnlyToggle.value;
        PlayerPrefs.SetString("MpGameName", this._hostGameName);
        PlayerPrefs.SetInt("MpGamePlayerCount", this.GetHostPlayersMax());
        PlayerPrefs.SetInt("MpGameFriendsOnly", (!this._hostFriendsOnly) ? 0 : 1);
        PlayerPrefs.Save();
        bool flag = CoopSteamServer.Start(delegate
        {
            this.SetLoadingText(UiTranslationDatabase.TranslateKey("CREATING_LOBBY___", "Creating Lobby...", this._allCapsTexts));
            CoopLobbyManager.Create(this.GetHostGameName(), this.GetHostPlayersMax(), this._hostFriendsOnly, delegate
            {
                if (string.IsNullOrEmpty(CoopLobby.Instance.Info.Guid) && GameSetup.IsNewGame)
                {
                    CoopLobby.Instance.SetGuid(Guid.NewGuid().ToString());
                }
                CoopLobby.Instance.SetPrefabDbVersion("E3C26D06F07B6AB14EC25F4823E9A30D6B4ED0450527C1E768739D96C9F061AE");
                this._lobbyScreen._gameNameLabel.text = StringEx.TryFormat(UiTranslationDatabase.TranslateKey("LOBBY_GAME_NAME", "LOBBY: {0}", this._allCapsTexts), new object[]
                {
                    CoopLobby.Instance.Info.Name.ToUpperInvariant()
                });
                this.OpenScreen(CoopSteamNGUI.Screens.Lobby);
            }, delegate
            {
                this.ClearLoadingAndError();
                this.SetErrorText(UiTranslationDatabase.TranslateKey("COULD_NOT_CREATE_STEAM_LOBBY", "Could not create Steam lobby.", this._allCapsTexts));
            });
        }, delegate
        {
            this.SetErrorText(UiTranslationDatabase.TranslateKey("COULD_NOT_CONNECT_TO_STEAM_MASTER_SERVER", "Could not connect to Steam master server.", this._allCapsTexts));
        });

        if (flag)
        {
            this.SetLoadingText(UiTranslationDatabase.TranslateKey("TALKING_TO_STEAM___", "Talking To Steam...", this._allCapsTexts));
        }
        else
        {
            this.SetErrorText(UiTranslationDatabase.TranslateKey("COULD_NOT_START_STEAM_GAME_SERVER", "Could not start Steam game server.", this._allCapsTexts));
        }
    }
コード例 #16
0
    private void Update()
    {
        DateTime d = new DateTime(this.Year, this.Month, this.Day, this.Hour, 0, 0);

        this.TimeRemaining = d - DateTime.UtcNow + new TimeSpan(8, 0, 0);
        if (this.TimeRemaining.TotalSeconds > 0.0)
        {
            this.Ibl.text = string.Format(UiTranslationDatabase.TranslateKey(this.TimeFormatKey, "{0} DAYS {1} HOURS {2} MINUTES {3} SECONDS", false), new object[]
            {
                this.TimeRemaining.Days,
                this.TimeRemaining.Hours,
                this.TimeRemaining.Minutes,
                this.TimeRemaining.Seconds
            });
        }
        else
        {
            this.Ibl.text  = UiTranslationDatabase.TranslateKey(this.TimeElapsedText, "NEW PATCH RELEASING SOON             ", false);
            this.Ibl.color = this.TimeElapsedColor;
        }
    }
コード例 #17
0
    private string GetActionText(InputMappingIcons.Actions actionTarget)
    {
        if (actionTarget == InputMappingIcons.Actions.None)
        {
            return(string.Empty);
        }
        string text = actionTarget.ToString();

        if (TheForest.Utils.Input.GetState(InputState.Menu))
        {
            text = this.GetActionText(text, this.MenuTranslations);
        }
        else if (TheForest.Utils.Input.GetState(InputState.Inventory))
        {
            text = this.GetActionText(text, this.InventoryTranslations);
        }
        else if (TheForest.Utils.Input.GetState(InputState.World))
        {
            text = this.GetActionText(text, this.WorldTranslations);
        }
        text = text.ToUpper();
        return(UiTranslationDatabase.TranslateKey(text, text, true));
    }
コード例 #18
0
 public void OnClientNewGame(CoopLobbyInfo lobby)
 {
     if (CoopLobby.IsInLobby)
     {
         CoopLobby.LeaveActive();
     }
     GameSetup.SetInitType(InitTypes.New);
     GameSetup.SetMpType(MpTypes.Client);
     this.RefreshUI();
     if (this._currentScreen == CoopSteamNGUI.Screens.InviteReceivedScreen)
     {
         this._currentScreen = this._prevScreen;
         this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser);
     }
     else if (this._currentScreen == CoopSteamNGUI.Screens.JoinP2P)
     {
         this._currentScreen = this._prevScreen;
         this.OpenScreen(CoopSteamNGUI.Screens.GameBrowser);
     }
     try
     {
         this.SetLoadingText(StringEx.TryFormat(UiTranslationDatabase.TranslateKey("JOINING_LOBBY_0____", "Joining Lobby {0}...", this._allCapsTexts), new object[]
         {
             lobby.Name
         }));
     }
     catch
     {
     }
     lobby.UpdateData();
     CoopLobbyManager.Join(lobby, delegate
     {
         lobby.UpdateData();
         this.ClearLoadingAndError();
     }, new Action <string>(this.OnFailedEnterLobby));
 }
コード例 #19
0
        public bool ShowReceipe(Receipe recipe, HudGui.InventoryItemInfo iii)
        {
            if (recipe._type == Receipe.Types.Craft)
            {
                this._title.text = ((iii == null) ? ItemDatabase.ItemById(recipe._productItemID)._name : UiTranslationDatabase.TranslateKey(iii._titleTextTranslationKey, iii._titleText, true));
                if (recipe._productItemAmount > 1)
                {
                    UILabel title = this._title;
                    title.text = title.text + " x" + recipe._productItemAmount;
                }
            }
            else
            {
                bool flag;
                if (!this.CheckUpgradeBonus(recipe, out flag))
                {
                    int    itemID = recipe._ingredients[1]._itemID;
                    string name   = ItemDatabase.ItemById(itemID)._name;
                    switch (name)
                    {
                    case "Feather":
                        this._title.text = UiTranslationDatabase.TranslateKey("UPGRADE_SPEED_", "+Speed {0}", true);
                        iii = this._weaponFakeInfo;
                        goto IL_3AA;

                    case "Tooth":
                        this._title.text = UiTranslationDatabase.TranslateKey("UPGRADE_DAMAGE_SPEED_", "+Damage -Speed {0}", true);
                        iii = this._weaponFakeInfo;
                        goto IL_3AA;

                    case "Booze":
                        this._title.text = UiTranslationDatabase.TranslateKey("UPGRADE_DAMAGE_", "+Damage {0}", true);
                        iii = this._weaponFakeInfo;
                        goto IL_3AA;

                    case "TreeSap":
                        this._title.text = UiTranslationDatabase.TranslateKey("UPGRADE_STICKY_", "Sticky {0}", true);
                        goto IL_3AA;

                    case "Cloth":
                        this._title.text = UiTranslationDatabase.TranslateKey("UPGRADE_BURNING_", "Burning {0}", true);
                        iii = this._weaponFakeInfo;
                        goto IL_3AA;

                    case "OrangePaint":
                        this._title.text = UiTranslationDatabase.TranslateKey("UPGRADE_ORANGE_", "Orange {0}", true);
                        goto IL_3AA;

                    case "BluePaint":
                        this._title.text = UiTranslationDatabase.TranslateKey("UPGRADE_BLUE_", "Blue {0}", true);
                        goto IL_3AA;

                    case "Battery":
                        this._title.text = UiTranslationDatabase.TranslateKey("UPGRADE_RECHARGED_", "Recharged {0}", true);
                        goto IL_3AA;

                    case "PlasticTorch":
                        this._title.text = UiTranslationDatabase.TranslateKey("EXTENSION_LIGHT", "{0} with light", true);
                        goto IL_3AA;

                    case "Cassette 1":
                    case "Cassette 2":
                    case "Cassette 3":
                    case "Cassette 4":
                    case "Cassette 5":
                        this._title.text = UiTranslationDatabase.TranslateKey(Scene.HudGui.InventoryItemsInfoCache[itemID]._titleTextTranslationKey, Scene.HudGui.InventoryItemsInfoCache[itemID]._titleText, true) + " {0}";
                        goto IL_3AA;

                    case "CamcorderTape1":
                    case "CamcorderTape2":
                    case "CamcorderTape3":
                    case "CamcorderTape4":
                    case "CamcorderTape5":
                    case "CamcorderTape6":
                        return(false);
                    }
                    this._title.text = "{0}";
                    IL_3AA :;
                }
                else if (flag)
                {
                    iii = this._weaponFakeInfo;
                }
                this._title.text = string.Format(this._title.text, (iii == null) ? ItemDatabase.ItemById(recipe._productItemID)._name : UiTranslationDatabase.TranslateKey(iii._titleTextTranslationKey, iii._titleText, true));
            }
            int i = this._ingredientTextures.Length - 1;

            foreach (ReceipeIngredient receipeIngredient in recipe._ingredients)
            {
                HudGui.InventoryItemInfo itemInfo = Scene.HudGui.GetItemInfo(receipeIngredient._itemID);
                if (itemInfo != null)
                {
                    this._ingredientTextures[i].mainTexture = itemInfo._icon;
                    if (receipeIngredient._amount > 1)
                    {
                        this._ingredientCountLabels[i].text    = receipeIngredient._amount.ToString();
                        this._ingredientCountLabels[i].enabled = true;
                    }
                    else
                    {
                        this._ingredientCountLabels[i].enabled = false;
                    }
                    if (!this._ingredientTextures[i].gameObject.activeSelf)
                    {
                        this._ingredientTextures[i].gameObject.SetActive(true);
                    }
                    i--;
                }
            }
            if (iii == this._weaponFakeInfo)
            {
                this._ingredientTextures[this._ingredientTextures.Length - 1].mainTexture = this._weaponFakeInfo._icon;
                this._ingredientCountLabels[this._ingredientTextures.Length - 1].enabled  = false;
            }
            while (i >= 0)
            {
                if (this._ingredientTextures[i].gameObject.activeSelf)
                {
                    this._ingredientTextures[i].gameObject.SetActive(false);
                }
                i--;
            }
            this._iconCantCarry.enabled = !recipe.CanCarryProduct;
            this.ShowCrossOff(!recipe.CanCarryProduct, ReceipeProductView._cantCarryProductColor);
            this._ingredientGrid.repositionNow = true;
            return(true);
        }
コード例 #20
0
ファイル: DynamicBookPages.cs プロジェクト: K07H/The-Forest
 private static void RefreshLabelTranslation(UiTranslationTextMesh label, string defaultText)
 {
     label.SetText(UiTranslationDatabase.TranslateKey(label._key, defaultText, true));
 }
コード例 #21
0
    public override void Disconnected(BoltConnection connection)
    {
        CoopKickToken coopKickToken = connection.DisconnectToken as CoopKickToken;

        if (coopKickToken != null)
        {
            SteamClientConfig.Banned      = coopKickToken.Banned;
            SteamClientConfig.KickMessage = UiTranslationDatabase.TranslateKey(coopKickToken.KickMessage, "Kicked/Banned", false);
            CoopSteamClientStarter coopSteamClientStarter = UnityEngine.Object.FindObjectOfType <CoopSteamClientStarter>();
            if (coopSteamClientStarter)
            {
                coopSteamClientStarter.CancelInvoke("OnDisconnected");
            }
            CoopClientCallbacks.OnDisconnected = null;
            if (SteamClientDSConfig.isDedicatedClient)
            {
                BoltLauncher.Shutdown();
                UnityEngine.Object.Destroy(base.gameObject);
                SteamUser.TerminateGameConnection(SteamClientDSConfig.EndPoint.Address.Packed, SteamClientDSConfig.EndPoint.Port);
                this.ReturnToTitle();
            }
            else if (!TheForest.Utils.Scene.FinishGameLoad)
            {
                this.ReturnToTitle();
            }
        }
        else
        {
            SteamClientConfig.Banned      = false;
            SteamClientConfig.KickMessage = string.Empty;
            if (SteamClientDSConfig.isDedicatedClient)
            {
                CoopJoinDedicatedServerFailed coopJoinDedicatedServerFailed = connection.DisconnectToken as CoopJoinDedicatedServerFailed;
                if (coopJoinDedicatedServerFailed != null)
                {
                    CoopClientCallbacks.OnDisconnected            = null;
                    CoopPlayerCallbacks.WasDisconnectedFromServer = true;
                    CoopSteamClientStarter coopSteamClientStarter2 = UnityEngine.Object.FindObjectOfType <CoopSteamClientStarter>();
                    if (coopSteamClientStarter2)
                    {
                        coopSteamClientStarter2._connectionAttempts = 3;
                        coopSteamClientStarter2.CancelInvoke("OnDisconnected");
                        UnityEngine.Object.Destroy(coopSteamClientStarter2.gameObject);
                    }
                    BoltLauncher.Shutdown();
                    SteamClientConfig.KickMessage = "Incorrect password";
                    UnityEngine.Object.Destroy(base.gameObject);
                    this.ReturnToTitle();
                }
            }
            if (CoopClientCallbacks.OnDisconnected != null)
            {
                CoopClientCallbacks.OnDisconnected();
            }
        }
        if (SteamClientDSConfig.isDedicatedClient)
        {
            SteamUser.TerminateGameConnection(SteamClientDSConfig.EndPoint.Address.Packed, SteamClientDSConfig.EndPoint.Port);
            this.ReturnToTitle();
        }
    }
コード例 #22
0
    private void UpdateGameBrowser()
    {
        bool flag = false;

        if (CoopLobby.IsInLobby)
        {
            this.OpenScreen(CoopSteamNGUI.Screens.Lobby);
            this._lobbyScreen._gameNameLabel.text = StringEx.TryFormat(UiTranslationDatabase.TranslateKey("LOBBY_GAME_NAME", "LOBBY: {0}", this._allCapsTexts), new object[]
            {
                CoopLobby.Instance.Info.Name.ToUpperInvariant()
            });
            return;
        }
        this._lobbies = (from l in this._lobbies
                         where l != null && CoopLobbyManager.Lobbies.Any((CoopLobbyInfo al) => al.LobbyId.m_SteamID == l.LobbyId.m_SteamID)
                         select l).ToList <CoopLobbyInfo>();
        IEnumerable <CoopLobbyInfo> enumerable = (from nl in CoopLobbyManager.Lobbies
                                                  where !string.IsNullOrEmpty(nl.Name) && (this._allowLegacyGames || !string.IsNullOrEmpty(nl.Guid)) && !nl.IsOwner && !this._lobbies.Any((CoopLobbyInfo l) => nl.LobbyId.m_SteamID == l.LobbyId.m_SteamID)
                                                  select nl).Take(5);

        if (enumerable != null && enumerable.Any <CoopLobbyInfo>())
        {
            Vector3 localScale = this._gameBrowserScreen._rowPrefab.transform.localScale;
            foreach (CoopLobbyInfo coopLobbyInfo in enumerable)
            {
                MpGameRow mpGameRow = UnityEngine.Object.Instantiate <MpGameRow>(this._gameBrowserScreen._rowPrefab);
                mpGameRow.transform.parent     = this._gameBrowserScreen._grid.transform;
                mpGameRow.transform.localScale = localScale;
                mpGameRow._gameName.text       = coopLobbyInfo.Name;
                mpGameRow._lobby            = coopLobbyInfo;
                mpGameRow._playerLimit.text = StringEx.TryFormat("{0} / {1}", new object[]
                {
                    coopLobbyInfo.CurrentMembers,
                    coopLobbyInfo.MemberLimit
                });
                this._gameRows[coopLobbyInfo] = mpGameRow;
                mpGameRow._previousPlayed     = this._previouslyPlayedServers.Contains(mpGameRow._lobby.Guid);
                bool flag2 = false;
                if (mpGameRow._prefabDbVersionMissmatch)
                {
                    flag2 = ("E3C26D06F07B6AB14EC25F4823E9A30D6B4ED0450527C1E768739D96C9F061AE" != coopLobbyInfo.PrefabDbVersion);
                    if (mpGameRow._prefabDbVersionMissmatch.activeSelf != flag2)
                    {
                        mpGameRow._prefabDbVersionMissmatch.SetActive(flag2);
                    }
                }
                if (mpGameRow._previousPlayed)
                {
                    mpGameRow.name = ((!flag2) ? "00" : "01");
                    if (mpGameRow._newButtonLabel.transform.parent.gameObject.activeSelf != !flag2)
                    {
                        mpGameRow._newButtonLabel.transform.parent.gameObject.SetActive(!flag2);
                    }
                    mpGameRow._continueButtonLabel.text = "Continue";
                }
                else
                {
                    if (mpGameRow._newButtonLabel.transform.parent.gameObject.activeSelf)
                    {
                        mpGameRow._newButtonLabel.transform.parent.gameObject.SetActive(false);
                    }
                    mpGameRow.name = ((!flag2) ? "10" : "11");
                }
                if (mpGameRow._continueButtonLabel.transform.parent.gameObject.activeSelf != !flag2)
                {
                    mpGameRow._continueButtonLabel.transform.parent.gameObject.SetActive(!flag2);
                }
                MpGameRow mpGameRow2 = mpGameRow;
                mpGameRow2.name += coopLobbyInfo.Name.Substring(0, 6);
            }
            this._lobbies = this._lobbies.Union(enumerable).ToList <CoopLobbyInfo>();
            flag          = true;
        }
        bool flag3 = !string.IsNullOrEmpty(this._browserFilter);

        foreach (MpGameRow mpGameRow3 in this._gameRows.Values)
        {
            if (flag3)
            {
                bool flag4 = mpGameRow3._lobby.Name.ToLowerInvariant().Contains(this._browserFilter);
                if (mpGameRow3.gameObject.activeSelf != flag4)
                {
                    mpGameRow3.transform.parent = ((!flag4) ? this._gameBrowserScreen._grid.transform.parent : this._gameBrowserScreen._grid.transform);
                    mpGameRow3.gameObject.SetActive(flag4);
                    flag = true;
                }
            }
            else if (!mpGameRow3.gameObject.activeSelf)
            {
                mpGameRow3.transform.parent = this._gameBrowserScreen._grid.transform;
                mpGameRow3.gameObject.SetActive(true);
                flag = true;
            }
        }
        if (flag)
        {
            this._gameBrowserScreen._grid.Reposition();
            this._gameBrowserScreen._scrollview.UpdateScrollbars();
            this._gameBrowserScreen._scrollview.verticalScrollBar.value = 1f;
            this._gameBrowserScreen._scrollview.verticalScrollBar.value = 0f;
            if (this._gameBrowserScreen._firstSelectControl && this._gameBrowserScreen._grid.transform.childCount > 0)
            {
                this._gameBrowserScreen._firstSelectControl.ObjectToBeSelected = this._gameBrowserScreen._grid.GetChild(0).GetComponent <MpGameRow>()._continueButtonLabel.transform.parent.gameObject;
            }
        }
    }
コード例 #23
0
        private void CheckMappingConflictAndConfirm()
        {
            if (!base.enabled)
            {
                return;
            }
            this._pollInput = false;
            bool   flag  = false;
            bool   flag2 = false;
            string text  = string.Empty;

            foreach (ElementAssignmentConflictInfo elementAssignmentConflictInfo in ReInput.controllers.conflictChecking.ElementAssignmentConflicts(this._entry.ToElementAssignmentConflictCheck()))
            {
                flag = true;
                ControllerMap controllerMap = Input.player.controllers.maps.GetAllMaps(elementAssignmentConflictInfo.controllerType).First <ControllerMap>();
                if (controllerMap != null)
                {
                    ActionElementMap elementMap = controllerMap.GetElementMap(elementAssignmentConflictInfo.elementMapId);
                    if (elementMap != null)
                    {
                        int actionId = elementMap.actionId;
                        if (this._entry.actionId == actionId)
                        {
                            this.Cancel();
                            return;
                        }
                        InputAction action = ReInput.mapping.GetAction(actionId);
                        string      text2  = action.descriptiveName.IfNullOrEmpty(action.name);
                        text2 = UiTranslationDatabase.TranslateKey(text2.ToUpper(), text2, true);
                        if (!elementAssignmentConflictInfo.isUserAssignable || !action.userAssignable)
                        {
                            flag2 = true;
                            text  = text2;
                            break;
                        }
                        text = text + text2 + ", ";
                    }
                }
            }
            if (flag)
            {
                if (flag2)
                {
                    string message = this._entry.elementName + " is already in use and is protected from reassignment. You cannot remove the protected assignment, but you can still assign the action to this element. If you do so, the element will trigger multiple actions when activated.";
                    Debug.Log(message);
                    this.CancelConflictingMapping();
                }
                else
                {
                    string message2 = this._entry.elementName + " is already in use. You may replace the other conflicting assignments, add this assignment anyway which will leave multiple actions assigned to this element, or cancel this assignment.";
                    Debug.Log(message2);
                    text = text.TrimEnd(new char[]
                    {
                        ' ',
                        ','
                    });
                    this.ConfirmKeepingConflicts();
                }
                this._nextChangeTimer = Time.realtimeSinceStartup + this._interChangeDelay;
            }
            else
            {
                this.Confirm(InputMappingAction.ConflictResolution.DoNothing);
            }
        }