Example #1
0
 private void Start()
 {
     switch (SteamApps.GetCurrentGameLanguage())
     {
     case "schinese":
         GetComponent <Text>().text = TextCn.Replace("\\n", "\n");
         break;
     }
 }
Example #2
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here

            Font = Content.Load <SpriteFont>(@"Font");

            if (!SteamAPI.Init())
            {
                Console.WriteLine("SteamAPI.Init() failed!");
            }
            else
            {
                // Steam is running
                IsSteamRunning = true;

                // It's important that the next call happens AFTER the call to SteamAPI.Init().
                InitializeCallbacks();

                SteamUtils.SetOverlayNotificationPosition(ENotificationPosition.k_EPositionTopRight);
                // Uncomment the next line to adjust the OverlayNotificationPosition.
                //SteamUtils.SetOverlayNotificationInset(400, 0);

                // Set collactible data.
                CurrentLanguage    = $"CurrentGameLanguage: {SteamApps.GetCurrentGameLanguage()}";
                AvailableLanguages = $"Languages: {SteamApps.GetAvailableGameLanguages()}";
                UserStats          = $"Reqesting Current Stats - {SteamUserStats.RequestCurrentStats()}";
                mNumberOfCurrentPlayers.Set(SteamUserStats.GetNumberOfCurrentPlayers());
                var hSteamApiCall = SteamUserStats.FindLeaderboard("Quickest Win");
                mCallResultFindLeaderboard.Set(hSteamApiCall);

                string folder;
                var    length = SteamApps.GetAppInstallDir(SteamUtils.GetAppID(), out folder, 260);
                InstallDir = $"AppInstallDir: {length} {folder}";

                // Get your Steam Avatar (Image) as a Texture2D.
                UserAvatar = GetSteamUserAvatar(GraphicsDevice);

                // Get your trimmed Steam User Name.
                var untrimmedUserName = SteamFriends.GetPersonaName();
                // Remove unsupported chars like emojis or other stuff our font cannot handle.
                untrimmedUserName = ReplaceUnsupportedChars(Font, untrimmedUserName);
                SteamUserName     = untrimmedUserName.Trim();

                Exiting += Game1_Exiting;
            }
        }
Example #3
0
        public static string SystemLanguageFolderName()
        {
            if (SteamManager.Initialized)
            {
                string text = SteamApps.GetCurrentGameLanguage().CapitalizeFirst();
                if (SupportedAutoSelectLanguages.Contains(text))
                {
                    return(text);
                }
            }
            string text2 = Application.systemLanguage.ToString();

            if (SupportedAutoSelectLanguages.Contains(text2))
            {
                return(text2);
            }
            return(DefaultLangFolderName);
        }
    private static bool SetSteamLanguage(Action <string> action, SupportedLanguages supportedLanguages, ref string languageName)
    {
        if (!SteamManager.Initialized)
        {
            return(false);
        }
        string steamLanguage = SteamApps.GetCurrentGameLanguage();

        foreach (var item in supportedLanguages.items)
        {
            if (item.steamAPIName == steamLanguage)
            {
                languageName = item.languageName;
                action.Invoke(languageName);
                return(true);
            }
        }
        return(false);
    }
Example #5
0
        // Token: 0x0600697B RID: 27003 RVA: 0x00209EC0 File Offset: 0x002080C0
        public void Initialize()
        {
            this.CGKDLKBBECC = this.LoadLocalizeFileHelper();
            string localization = "english";

            try
            {
                if (!string.IsNullOrEmpty(SteamApps.GetCurrentGameLanguage()))
                {
                    localization = SteamApps.GetCurrentGameLanguage();
                }
            }
            catch (Exception ex)
            {
                Debug.Log("[LocalizationService] Error: " + ex.ToString());
            }
            this.Localization = localization;
            Debug.Log("[LocalizationService] Localization: " + this.Localization);
            this.inited = true;
        }
Example #6
0
        // Token: 0x06006970 RID: 26992 RVA: 0x002099D0 File Offset: 0x00207BD0
        public void KKFMEHJPPAD()
        {
            this.CGKDLKBBECC = this.LoadLocalizeFileHelper();
            string dpnhodjhgjl = "achievements.26.progress";

            try
            {
                if (!string.IsNullOrEmpty(SteamApps.GetCurrentGameLanguage()))
                {
                    dpnhodjhgjl = SteamApps.GetCurrentGameLanguage();
                }
            }
            catch (Exception ex)
            {
                Debug.Log("Anomaly_Far" + ex.ToString());
            }
            this.EGLJBEKHBND(dpnhodjhgjl);
            Debug.Log("[Right]" + this.DGMCAJMBOBC());
            this.inited = false;
        }
Example #7
0
        public static string GetCodeForActiveLanguage(List <LocaleActivator.LanguageInfo> supportedLanguages)
        {
            Console.WriteLine("Scanning for language code...");
            if (PlatformAPISettings.Running)
            {
                string currentGameLanguage = SteamApps.GetCurrentGameLanguage();
                for (int index = 0; index < supportedLanguages.Count; ++index)
                {
                    if (supportedLanguages[index].SteamCode == currentGameLanguage)
                    {
                        Console.WriteLine("Matched Steam Language Code : " + currentGameLanguage);
                        return(supportedLanguages[index].Code);
                    }
                }
            }
            CultureInfo originalCultureInfo = Game1.OriginalCultureInfo;

            for (int index = 0; index < supportedLanguages.Count; ++index)
            {
                if (supportedLanguages[index].Code == originalCultureInfo.Name)
                {
                    Console.WriteLine("Found exact language match for " + originalCultureInfo.Name);
                    return(supportedLanguages[index].Code);
                }
            }
            for (int index = 0; index < supportedLanguages.Count; ++index)
            {
                string str = supportedLanguages[index].Code.Substring(0, 2);
                if (originalCultureInfo.Name.StartsWith(str))
                {
                    Console.WriteLine("Found close enough language match for " + str);
                    return(supportedLanguages[index].Code);
                }
            }
            Console.WriteLine("No language match found for " + originalCultureInfo.Name + " - " + originalCultureInfo.DisplayName + ". Reverting to English...");
            return("en-us");
        }
    private void OnEnable()
    {
        if (s_instance == null)
        {
            s_instance = this;
        }
        if (!m_bInitialized)
        {
            return;
        }
        string @string = PlayerPrefs.GetString("Language", string.Empty);

        if (!string.IsNullOrEmpty(@string))
        {
            LocalizationManager.CurrentLanguage = @string;
            if (LocalizationManager.HasLanguage(@string))
            {
                return;
            }
        }
        if (m_SteamAPIWarningMessageHook == null)
        {
            m_SteamAPIWarningMessageHook = SteamAPIDebugTextHook;
            SteamClient.SetWarningMessageHook(m_SteamAPIWarningMessageHook);
        }
        string text = SteamApps.GetCurrentGameLanguage();

        if (text.Equals("schinese"))
        {
            text = "Chinese Simplified";
        }
        if (string.IsNullOrEmpty(text))
        {
            text = "English";
        }
        LocalizationManager.CurrentLanguage = text;
    }
Example #9
0
 /// <summary>
 /// <para>Gets the current language that the user has set.
 /// This falls back to the Steam UI language if the user hasn't explicitly picked a language for the title.</para>
 /// <a href="https://partner.steamgames.com/doc/api/ISteamApps#GetCurrentGameLanguage">https://partner.steamgames.com/doc/api</a>
 /// </summary>
 /// <returns></returns>
 public static string GetCurrentGameLanguage()
 {
     return(SteamApps.GetCurrentGameLanguage());
 }
    public void RenderOnGUI()
    {
        GUILayout.Label("SteamApps.BIsSubscribed() : " + SteamApps.BIsSubscribed());
        GUILayout.Label("SteamApps.BIsLowViolence() : " + SteamApps.BIsLowViolence());
        GUILayout.Label("SteamApps.BIsCybercafe() : " + SteamApps.BIsCybercafe());
        GUILayout.Label("SteamApps.BIsVACBanned() : " + SteamApps.BIsVACBanned());
        GUILayout.Label("SteamApps.GetCurrentGameLanguage() : " + SteamApps.GetCurrentGameLanguage());
        GUILayout.Label("SteamApps.GetAvailableGameLanguages() : " + SteamApps.GetAvailableGameLanguages());
        GUILayout.Label("SteamApps.BIsSubscribedApp(SteamUtils.GetAppID()) : " + SteamApps.BIsSubscribedApp(SteamUtils.GetAppID()));
        GUILayout.Label("SteamApps.BIsDlcInstalled(110902) : " + SteamApps.BIsDlcInstalled((AppId_t)110902));         // pieterw test DLC
        GUILayout.Label("SteamApps.GetEarliestPurchaseUnixTime(SteamUtils.GetAppID()) : " + SteamApps.GetEarliestPurchaseUnixTime(SteamUtils.GetAppID()));
        GUILayout.Label("SteamApps.BIsSubscribedFromFreeWeekend() : " + SteamApps.BIsSubscribedFromFreeWeekend());
        GUILayout.Label("SteamApps.GetDLCCount() : " + SteamApps.GetDLCCount());

        for (int iDLC = 0; iDLC < SteamApps.GetDLCCount(); ++iDLC)
        {
            AppId_t AppID;
            bool    Available;
            string  Name;
            bool    ret = SteamApps.BGetDLCDataByIndex(iDLC, out AppID, out Available, out Name, 128);
            GUILayout.Label("SteamApps.BGetDLCDataByIndex(" + iDLC + ", out AppID, out Available, out Name, 128) : " + ret + " -- " + AppID + " -- " + Available + " -- " + Name);
        }

        if (GUILayout.Button("SteamApps.InstallDLC(110902)"))
        {
            SteamApps.InstallDLC((AppId_t)110902);             // pieterw test DLC
        }

        if (GUILayout.Button("SteamApps.UninstallDLC(110902)"))
        {
            SteamApps.UninstallDLC((AppId_t)110902);             // pieterw test DLC
        }

        if (GUILayout.Button("SteamApps.RequestAppProofOfPurchaseKey(SteamUtils.GetAppID())"))
        {
            SteamApps.RequestAppProofOfPurchaseKey(SteamUtils.GetAppID());
        }

        {
            string Name;
            bool   ret = SteamApps.GetCurrentBetaName(out Name, 128);
            if (Name == null)
            {
                Name = "";
            }
            GUILayout.Label("SteamApps.GetCurrentBetaName(out Name, 128) : " + ret + " -- " + Name);
        }

        if (GUILayout.Button("SteamApps.MarkContentCorrupt(true)"))
        {
            print("SteamApps.MarkContentCorrupt(true) : " + SteamApps.MarkContentCorrupt(true));
        }

        if (GUILayout.Button("SteamApps.GetInstalledDepots(SteamUtils.GetAppID(), Depots, 32)"))
        {
            DepotId_t[] Depots = new DepotId_t[32];
            uint        ret    = SteamApps.GetInstalledDepots(SteamUtils.GetAppID(), Depots, 32);
            for (int i = 0; i < ret; ++i)
            {
                print("SteamApps.GetInstalledDepots(SteamUtils.GetAppID(), Depots, 32) : " + ret + " -- #" + i + " -- " + Depots[i]);
            }
        }

        {
            string Folder;
            uint   ret = SteamApps.GetAppInstallDir(SteamUtils.GetAppID(), out Folder, 260);
            if (Folder == null)
            {
                Folder = "";
            }

            GUILayout.Label("SteamApps.GetAppInstallDir(480, out Folder, 260) : " + ret + " -- " + Folder);
        }

        GUILayout.Label("SteamApps.BIsAppInstalled(480) : " + SteamApps.BIsAppInstalled(SteamUtils.GetAppID()));
        GUILayout.Label("SteamApps.GetAppOwner() : " + SteamApps.GetAppOwner());

        // Run the test and then use steam://run/480//?test=testing;param2=value2; in your browser to try this out
        GUILayout.Label("SteamApps.GetLaunchQueryParam(\"test\") : " + SteamApps.GetLaunchQueryParam("test"));

        {
            ulong BytesDownloaded;
            ulong BytesTotal;
            bool  ret = SteamApps.GetDlcDownloadProgress((AppId_t)110902, out BytesDownloaded, out BytesTotal);
            GUILayout.Label("SteamApps.GetDlcDownloadProgress((AppId_t)110902, out BytesDownloaded, out BytesTotal): " + ret + " -- " + BytesDownloaded + " -- " + BytesTotal);
        }

        GUILayout.Label("SteamApps.GetAppBuildId(): " + SteamApps.GetAppBuildId());
#if _PS3
        if (GUILayout.Button("SteamApps.RegisterActivationCode(\"???\")"))
        {
            SteamAPICall_t handle = SteamApps.RegisterActivationCode("???");
            new CallResult <RegisterActivationCodeResponse_t>(OnRegisterActivationCodeResponse, handle);
            new CallResult <AppProofOfPurchaseKeyResponse_t>(OnAppProofOfPurchaseKeyResponse, handle);
        }
#endif
    }
Example #11
0
    public void RenderOnGUI()
    {
        GUILayout.BeginVertical("box");
        m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(Screen.width - 215), GUILayout.Height(Screen.height - 33));

        GUILayout.Label("BIsSubscribed() : " + SteamApps.BIsSubscribed());

        GUILayout.Label("BIsLowViolence() : " + SteamApps.BIsLowViolence());

        GUILayout.Label("BIsCybercafe() : " + SteamApps.BIsCybercafe());

        GUILayout.Label("BIsVACBanned() : " + SteamApps.BIsVACBanned());

        GUILayout.Label("GetCurrentGameLanguage() : " + SteamApps.GetCurrentGameLanguage());

        GUILayout.Label("GetAvailableGameLanguages() : " + SteamApps.GetAvailableGameLanguages());

        GUILayout.Label("BIsSubscribedApp(SteamUtils.GetAppID()) : " + SteamApps.BIsSubscribedApp(SteamUtils.GetAppID()));

        GUILayout.Label("BIsDlcInstalled(TestConstants.Instance.k_AppId_PieterwTestDLC) : " + SteamApps.BIsDlcInstalled(TestConstants.Instance.k_AppId_PieterwTestDLC));

        GUILayout.Label("GetEarliestPurchaseUnixTime(SteamUtils.GetAppID()) : " + SteamApps.GetEarliestPurchaseUnixTime(SteamUtils.GetAppID()));

        GUILayout.Label("BIsSubscribedFromFreeWeekend() : " + SteamApps.BIsSubscribedFromFreeWeekend());

        GUILayout.Label("GetDLCCount() : " + SteamApps.GetDLCCount());

        for (int iDLC = 0; iDLC < SteamApps.GetDLCCount(); ++iDLC)
        {
            AppId_t AppID;
            bool    Available;
            string  Name;
            bool    ret = SteamApps.BGetDLCDataByIndex(iDLC, out AppID, out Available, out Name, 128);
            GUILayout.Label("BGetDLCDataByIndex(" + iDLC + ", out AppID, out Available, out Name, 128) : " + ret + " -- " + AppID + " -- " + Available + " -- " + Name);
        }

        if (GUILayout.Button("InstallDLC(TestConstants.Instance.k_AppId_PieterwTestDLC)"))
        {
            SteamApps.InstallDLC(TestConstants.Instance.k_AppId_PieterwTestDLC);
            print("SteamApps.InstallDLC(" + TestConstants.Instance.k_AppId_PieterwTestDLC + ")");
        }

        if (GUILayout.Button("UninstallDLC(TestConstants.Instance.k_AppId_PieterwTestDLC)"))
        {
            SteamApps.UninstallDLC(TestConstants.Instance.k_AppId_PieterwTestDLC);
            print("SteamApps.UninstallDLC(" + TestConstants.Instance.k_AppId_PieterwTestDLC + ")");
        }

        if (GUILayout.Button("RequestAppProofOfPurchaseKey(SteamUtils.GetAppID())"))
        {
            SteamApps.RequestAppProofOfPurchaseKey(SteamUtils.GetAppID());
            print("SteamApps.RequestAppProofOfPurchaseKey(" + SteamUtils.GetAppID() + ")");
        }

        {
            string Name;
            bool   ret = SteamApps.GetCurrentBetaName(out Name, 128);
            if (Name == null)
            {
                Name = "";
            }
            GUILayout.Label("GetCurrentBetaName(out Name, 128) : " + ret + " -- " + Name);
        }

        if (GUILayout.Button("MarkContentCorrupt(true)"))
        {
            bool ret = SteamApps.MarkContentCorrupt(true);
            print("SteamApps.MarkContentCorrupt(" + true + ") : " + ret);
        }

        if (GUILayout.Button("SteamApps.GetInstalledDepots(SteamUtils.GetAppID(), Depots, 32)"))
        {
            DepotId_t[] Depots = new DepotId_t[32];
            uint        ret    = SteamApps.GetInstalledDepots(SteamUtils.GetAppID(), Depots, 32);
            for (int i = 0; i < ret; ++i)
            {
                print("SteamApps.GetInstalledDepots(SteamUtils.GetAppID(), Depots, 32) : " + ret + " -- #" + i + " -- " + Depots[i]);
            }
        }

        {
            string Folder;
            uint   ret = SteamApps.GetAppInstallDir(SteamUtils.GetAppID(), out Folder, 260);
            if (Folder == null)
            {
                Folder = "";
            }
            GUILayout.Label("GetAppInstallDir(SteamUtils.GetAppID(), out Folder, 260) : " + ret + " -- " + Folder);
        }

        GUILayout.Label("BIsAppInstalled(SteamUtils.GetAppID()) : " + SteamApps.BIsAppInstalled(SteamUtils.GetAppID()));

        GUILayout.Label("GetAppOwner() : " + SteamApps.GetAppOwner());

        {
            // Run the test and then use steam://run/480//?test=testing;param2=value2; in your browser to try this out
            string ret = SteamApps.GetLaunchQueryParam("test");
            GUILayout.Label("GetLaunchQueryParam(\"test\") : " + ret);
        }

        {
            ulong BytesDownloaded;
            ulong BytesTotal;
            bool  ret = SteamApps.GetDlcDownloadProgress(TestConstants.Instance.k_AppId_PieterwTestDLC, out BytesDownloaded, out BytesTotal);
            GUILayout.Label("GetDlcDownloadProgress(TestConstants.Instance.k_AppId_PieterwTestDLC, out BytesDownloaded, out BytesTotal) : " + ret + " -- " + BytesDownloaded + " -- " + BytesTotal);
        }

        GUILayout.Label("GetAppBuildId() : " + SteamApps.GetAppBuildId());

        if (GUILayout.Button("RequestAllProofOfPurchaseKeys()"))
        {
            SteamApps.RequestAllProofOfPurchaseKeys();
            print("SteamApps.RequestAllProofOfPurchaseKeys()");
        }

        if (GUILayout.Button("GetFileDetails(\"steam_api.dll\")"))
        {
            SteamAPICall_t handle = SteamApps.GetFileDetails("steam_api.dll");
            OnFileDetailsResultCallResult.Set(handle);
            print("SteamApps.GetFileDetails(" + "\"steam_api.dll\"" + ") : " + handle);
        }

        {
            string CommandLine;
            int    ret = SteamApps.GetLaunchCommandLine(out CommandLine, 260);
            if (CommandLine == null)
            {
                CommandLine = "";
            }
            GUILayout.Label("GetLaunchCommandLine(out CommandLine, 260) : " + ret + " -- " + CommandLine);
        }

        GUILayout.Label("BIsSubscribedFromFamilySharing() : " + SteamApps.BIsSubscribedFromFamilySharing());

        GUILayout.EndScrollView();
        GUILayout.EndVertical();
    }
Example #12
0
    void Start()
    {
        m_bInitialized = SteamAPI.Init();


        if (!m_bInitialized)
        {
            Debug.LogError("[Steamworks.NET] SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information.", this);

            return;
        }


        if (SteamManager.Initialized)
        {
            string name = SteamFriends.GetPersonaName();
            Debug.Log(name);

            string SteamLanguage = SteamApps.GetCurrentGameLanguage();
            Debug.Log("pase por aca");
            Debug.Log("Steam Language " + SteamLanguage);

            if (SteamLanguage == "english")
            {
                SaveManager.Instance.dataKlaus.language = "en";
            }

            if (SteamLanguage == "french")
            {
                SaveManager.Instance.dataKlaus.language = "fr";
            }

            if (SteamLanguage == "italian")
            {
                SaveManager.Instance.dataKlaus.language = "it";
            }

            if (SteamLanguage == "german")
            {
                SaveManager.Instance.dataKlaus.language = "de";
            }

            if (SteamLanguage == "spanish")
            {
                SaveManager.Instance.dataKlaus.language = "es";
            }

            if (SteamLanguage == "portuguese")
            {
                SaveManager.Instance.dataKlaus.language = "po";
                Debug.Log("It's set up to " + SaveManager.Instance.dataKlaus.language);
            }

            if (SteamLanguage == "brazilian")
            {
                SaveManager.Instance.dataKlaus.language = "pt";
            }

            if (SteamLanguage == "russian")
            {
                SaveManager.Instance.dataKlaus.language = "ru";
            }

            if (SteamLanguage == "latam")
            {
                SaveManager.Instance.dataKlaus.language = "la";
                Debug.Log("deberia ser latam");
            }



            string language = ConvertToValidLanguage(SaveManager.Instance.dataKlaus.language);

            // Si existen las instancias adecuadas, guarda el lenguaje
            if (SaveManager.HasInstance && SaveManager.Instance.dataKlaus != null)
            {
                SaveManager.Instance.dataKlaus.language = language;
            }

            SmartLocalization.LanguageManager.Instance.ChangeLanguage(language);


            //   SaveManager.Instance.dataKlaus.language = languages[dropdown.value];
            SaveManager.Instance.Save();
        }
    }
Example #13
0
 public override void OnEnter()
 {
     Result.Value = SteamApps.GetCurrentGameLanguage();
     Finish();
 }