diff --git a/.gitignore b/.gitignore index e37ec6c5..f4ef4f0f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ /[Oo]bj/ /[Bb]uild/ /[Bb]uilds/ +/[Aa]rchived[Bb]uilds/ /[Ll]ogs/ /[Uu]ser[Ss]ettings/ diff --git a/Assets/Resources/DefaultDailyLeaderboardPlayers.asset b/Assets/Resources/DefaultDailyLeaderboardPlayers.asset index 15596e6a..7bd89651 100644 --- a/Assets/Resources/DefaultDailyLeaderboardPlayers.asset +++ b/Assets/Resources/DefaultDailyLeaderboardPlayers.asset @@ -13,93 +13,93 @@ MonoBehaviour: m_Name: DefaultDailyLeaderboardPlayers m_EditorClassIdentifier: Players: - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 12" + - Name: "\u0414\u0430\u043D\u044C\u043A\u0430" Score: 1013 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 56" + - Name: "\u0427\u0435\u043C\u043F\u0438\u043E\u043D" Score: 985 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 776" + - Name: "\u0414\u0438\u043C\u0430\u0441\u0438\u043A" Score: 966 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 45" + - Name: "\u0412\u0430\u043B\u0435\u043D\u0442\u0438\u043D \u0421\u0435\u0440\u0433\u0435\u0435\u0432\u0438\u0447" Score: 959 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 488" + - Name: "\u041A\u0438\u0440\u0430 \u041B." Score: 921 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 321" + - Name: "\u041B\u0443\u0447\u0448\u0435 \u043B\u0443\u0447\u0448\u0435\u0433\u043E" Score: 899 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 512" + - Name: "\u041A\u043E\u043B\u0431\u0430\u0441\u043A\u0430" Score: 885 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 907" + - Name: "\u041A\u0438\u0431\u043E\u0440\u0433 2000" Score: 843 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 33" + - Name: "\u041B\u0443\u0447\u0448\u0438\u0439" Score: 820 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 98" + - Name: "\u0412\u0412\u0412\u0430\u043D\u044C\u043A\u0430" Score: 809 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 154" + - Name: "\u041F\u0443\u043F\u0441\u0438\u043A" Score: 801 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 244" + - Name: "\u0417\u043B\u044E\u043A\u0430" Score: 791 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 7" + - Name: "\u041A\u043B\u0443\u0431\u043D\u0438\u0447\u043A\u0430" Score: 780 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 17" + - Name: "\u041A\u043E\u0442\u044D" Score: 741 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 311" + - Name: "\u041D\u0430\u0444\u0430\u043D\u044C\u043A\u0430" Score: 739 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 915" + - Name: "\u0426\u0432\u0435\u0442\u043E\u0447\u0435\u043A" Score: 723 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 98" + - Name: "\u041A\u0438\u0440\u043F\u0438\u0447" Score: 720 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 12" + - Name: "\u041B\u0443\u043D\u0442\u0438\u043A" Score: 678 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 665" + - Name: "\u0414\u0438\u043C \u0414\u0438\u043C\u044B\u0447" Score: 667 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 457" + - Name: "\u0421\u0443\u043F\u0435\u0440\u043C\u0435\u043D" Score: 657 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 367" + - Name: "\u0414\u044D\u043D" Score: 644 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 126" + - Name: "\u041F\u0430\u0442\u0440\u0438\u043A" Score: 632 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 341" + - Name: "\u0411\u0430\u0442\u043E\u043D" Score: 610 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 4" + - Name: "\u0417\u0435\u043B\u0435\u0431\u043E\u0431\u0430" Score: 590 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 889" + - Name: "\u041F\u0438\u043E\u043D\u0435\u0440" Score: 589 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 642" + - Name: "\u0411\u0430\u0440\u043E\u043D" Score: 565 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 712" + - Name: "\u0411\u0440\u0443\u043D\u043E" Score: 543 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 762" + - Name: "\u041A\u043E\u043B\u043B\u0438" Score: 532 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 102" + - Name: "\u0414\u0430\u0448\u0430" Score: 512 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 8" + - Name: "\u041A\u044D\u0442" Score: 499 UnlockedMonumets: [] diff --git a/Assets/Resources/DefaultGlobalLeaderboardPlayers.asset b/Assets/Resources/DefaultGlobalLeaderboardPlayers.asset index f9bda1fd..8c61d4d2 100644 --- a/Assets/Resources/DefaultGlobalLeaderboardPlayers.asset +++ b/Assets/Resources/DefaultGlobalLeaderboardPlayers.asset @@ -13,93 +13,93 @@ MonoBehaviour: m_Name: DefaultGlobalLeaderboardPlayers m_EditorClassIdentifier: Players: - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 12" + - Name: "\u0414\u0430\u043D\u044C\u043A\u0430" Score: 1013 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 56" + - Name: "\u0427\u0435\u043C\u043F\u0438\u043E\u043D" Score: 985 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 776" + - Name: "\u0414\u0438\u043C\u0430\u0441\u0438\u043A" Score: 966 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 45" + - Name: "\u0412\u0430\u043B\u0435\u043D\u0442\u0438\u043D \u0421\u0435\u0440\u0433\u0435\u0435\u0432\u0438\u0447" Score: 959 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 488" + - Name: "\u041A\u0438\u0440\u0430 \u041B." Score: 921 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 321" + - Name: "\u041B\u0443\u0447\u0448\u0435 \u043B\u0443\u0447\u0448\u0435\u0433\u043E" Score: 899 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 512" + - Name: "\u041A\u043E\u043B\u0431\u0430\u0441\u043A\u0430" Score: 885 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 907" + - Name: "\u041A\u0438\u0431\u043E\u0440\u0433 2000" Score: 843 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 33" + - Name: "\u041B\u0443\u0447\u0448\u0438\u0439" Score: 820 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 98" + - Name: "\u0412\u0412\u0412\u0430\u043D\u044C\u043A\u0430" Score: 809 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 154" + - Name: "\u041F\u0443\u043F\u0441\u0438\u043A" Score: 801 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 244" + - Name: "\u0417\u043B\u044E\u043A\u0430" Score: 791 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 7" + - Name: "\u041A\u043B\u0443\u0431\u043D\u0438\u0447\u043A\u0430" Score: 780 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 17" + - Name: "\u041A\u043E\u0442\u044D" Score: 741 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 311" + - Name: "\u041D\u0430\u0444\u0430\u043D\u044C\u043A\u0430" Score: 739 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 915" + - Name: "\u0426\u0432\u0435\u0442\u043E\u0447\u0435\u043A" Score: 723 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 98" + - Name: "\u041A\u0438\u0440\u043F\u0438\u0447" Score: 720 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 12" + - Name: "\u041B\u0443\u043D\u0442\u0438\u043A" Score: 678 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 665" + - Name: "\u0414\u0438\u043C \u0414\u0438\u043C\u044B\u0447" Score: 667 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 457" + - Name: "\u0421\u0443\u043F\u0435\u0440\u043C\u0435\u043D" Score: 657 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 367" + - Name: "\u0414\u044D\u043D" Score: 644 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 126" + - Name: "\u041F\u0430\u0442\u0440\u0438\u043A" Score: 632 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 341" + - Name: "\u0411\u0430\u0442\u043E\u043D" Score: 610 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 4" + - Name: "\u0417\u0435\u043B\u0435\u0431\u043E\u0431\u0430" Score: 590 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 889" + - Name: "\u041F\u0438\u043E\u043D\u0435\u0440" Score: 589 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 642" + - Name: "\u0411\u0430\u0440\u043E\u043D" Score: 565 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 712" + - Name: "\u0411\u0440\u0443\u043D\u043E" Score: 543 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 762" + - Name: "\u041A\u043E\u043B\u043B\u0438" Score: 532 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 102" + - Name: "\u0414\u0430\u0448\u0430" Score: 512 UnlockedMonumets: [] - - Name: "\u041F\u0435\u043D\u0437\u0435\u043D\u0435\u0446 8" + - Name: "\u041A\u044D\u0442" Score: 499 UnlockedMonumets: [] diff --git a/Assets/Scripts/LeaderboardController.cs b/Assets/Scripts/LeaderboardController.cs index 5bfd2863..9b8631bd 100644 --- a/Assets/Scripts/LeaderboardController.cs +++ b/Assets/Scripts/LeaderboardController.cs @@ -19,6 +19,10 @@ public class LeaderboardController : MonoBehaviour public UnityEvent> OnDailyInit; public UnityEvent> OnGlobalInit; + private bool _resetDaily = false; + private bool _resetGlobal = false; + + private void Awake() { //transform.parent = null; @@ -34,12 +38,24 @@ public class LeaderboardController : MonoBehaviour } } - private void Start() + private IEnumerator Start() { - //yield return new WaitForSeconds(1); + yield return new WaitForSeconds(10); + if(_resetDaily) + PlayerPrefs.SetString(DAILY_ID, string.Empty); + if(_resetGlobal) + PlayerPrefs.SetString(GLOBAL_ID, string.Empty); InitLeaderboards(); } + private void Update() + { + if(Input.GetKeyDown(KeyCode.J)) + _resetDaily = true; + if(Input.GetKeyDown(KeyCode.K)) + _resetGlobal = true; + } + public void InitLeaderboards() { InitDailyLeaderboard(); diff --git a/Assets/Scripts/SaveLoadController.cs b/Assets/Scripts/SaveLoadController.cs index a16648f5..492149cf 100644 --- a/Assets/Scripts/SaveLoadController.cs +++ b/Assets/Scripts/SaveLoadController.cs @@ -38,9 +38,9 @@ public class SaveLoadController : MonoBehaviour using (FileStream fs = File.Create(fullFilePath)) { - BinaryFormatter bf = new BinaryFormatter(); var json = JsonUtility.ToJson(so); - bf.Serialize(fs, json); + byte[] info = new System.Text.UTF8Encoding(true).GetBytes(json); + fs.Write(info, 0, info.Length); fs.Close(); } @@ -48,7 +48,37 @@ public class SaveLoadController : MonoBehaviour return true; } - public bool Load(ref T so, string filename) where T : ScriptableObject + public T Load(ref T so, string filename) where T : ScriptableObject + { + string fullDirPath = Application.persistentDataPath + DIR_PATH; + string fullFilePath = Application.persistentDataPath + DIR_PATH + $"{filename}.txt"; + + Debug.Log($"LOAD:{fullFilePath}"); + + if (!Directory.Exists(fullDirPath)) + { + Directory.CreateDirectory(fullDirPath); + } + + if (File.Exists(fullFilePath)) + { + using (FileStream fs = File.Open(fullFilePath, FileMode.Open)) + { + using (StreamReader reader = new StreamReader(fs)) + { + var file = reader.ReadToEnd(); + so = ScriptableObject.CreateInstance(); + JsonUtility.FromJsonOverwrite(file, so); + fs.Close(); + } + } + } + + Debug.Log($"LOAD:SUCCESS"); + return default; + } + + public bool LoadOld(ref T so, string filename) where T : ScriptableObject { string fullDirPath = Application.persistentDataPath + DIR_PATH; string fullFilePath = Application.persistentDataPath + DIR_PATH + $"{filename}.txt"; diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 36dccb33..b69e66ac 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -266,13 +266,13 @@ PlayerSettings: androidSupportedAspectRatio: 1 androidMaxAspectRatio: 2.1 applicationIdentifier: - Android: com.DefaultCompany.VRProject3 + Android: com.Bogg.Art.Piter-VR Standalone: com.Bogg.Art.Piter-VR buildNumber: Standalone: 0 iPhone: 0 tvOS: 0 - overrideDefaultApplicationIdentifier: 0 + overrideDefaultApplicationIdentifier: 1 AndroidBundleVersionCode: 1 AndroidMinSdkVersion: 23 AndroidTargetSdkVersion: 0