void Start() { gameActive = false; //----------------------Data Mining ------------------------ OLDrecords = new RecordsMG(); NewRecords = new RecordsMG(); string path = "/PlayerRecordsMG.json"; OLDrecords = JsonUtility.FromJson <RecordsMG>(File.ReadAllText(Application.persistentDataPath + path)); Debug.Log("Total OLDfalse = " + OLDrecords.TotalFalse); Debug.Log("Total OLDtrue = " + OLDrecords.TotalTrue); Debug.Log("Total OLDAvgReactTime = " + OLDrecords.AvgReactTime); Debug.Log("OLDRecordScore = " + OLDrecords.RecordScore); Debug.Log("OLDPlayerType = " + OLDrecords.PlayerType); Debug.Log("OLDresult = " + OLDrecords.result); if (OLDrecords.result == 1) { startingTime = 50f; velocity = 1.0f; Debug.Log("player type Begginer: " + OLDrecords.result); } if (OLDrecords.result == 2) { startingTime = 45f; velocity = 3.0f; Debug.Log("player type Intermediate: " + OLDrecords.result); } if (OLDrecords.result == 3) { startingTime = 40f; velocity = 9.0f; Debug.Log("player type Proffesional: " + OLDrecords.result); } //---------------------------- //Time.timeScale = 0f; // spawncript.GetComponent<Spawner>().enabled = false; nextgamebtn.gameObject.SetActive(false); source = gameObject.AddComponent <AudioSource>(); currentTime = startingTime; butt[0].gameObject.SetActive(false); butt[1].gameObject.SetActive(false); butt[2].gameObject.SetActive(false); avgNum.gameObject.SetActive(false); //butt[0].interactable = false; //butt[1].interactable = false; }
public void Detect_Type(RecordsMG records) { Debug.Log("PlayerType_detect func value = " + records.PlayerType); if (records.PlayerType < 50f) { Debug.Log("Player Type = Begginer.(Type1)"); records.result = 1; } if (records.PlayerType >= 50f && records.PlayerType < 63f) { Debug.Log("Player Type = Intermediate.(Type2)"); records.result = 2; } if (records.PlayerType > 63f) { Debug.Log("Player Type = Proffesional.(Type3)"); records.result = 3; } }
public void PushRecords(RecordsMG newrecords, RecordsMG oldrecords) { newrecords.TotalFalse = Euclidean_Distance(oldrecords.TotalFalse, newrecords.TotalFalse); newrecords.TotalTrue = Euclidean_Distance(oldrecords.TotalTrue, newrecords.TotalTrue); newrecords.AvgReactTime = Euclidean_Distance(oldrecords.AvgReactTime, newrecords.AvgReactTime); newrecords.RecordScore = Euclidean_Distance(oldrecords.RecordScore, newrecords.RecordScore); newrecords.PlayerType = (newrecords.TotalFalse + newrecords.TotalTrue + newrecords.AvgReactTime + newrecords.RecordScore) / 4f; newrecords.PlayerType = Euclidean_Distance(oldrecords.PlayerType, newrecords.PlayerType); newrecords.Detect_Type(newrecords); Debug.Log(Application.persistentDataPath); Debug.Log("Total false = " + newrecords.TotalFalse); Debug.Log("Total true = " + newrecords.TotalTrue); Debug.Log("Total AvgReactTime = " + newrecords.AvgReactTime); Debug.Log("RecordScore = " + newrecords.RecordScore); Debug.Log("PlayerType = " + newrecords.PlayerType); string path = "/PlayerRecordsMG.json"; string jsonData = JsonUtility.ToJson(newrecords, true); File.WriteAllText(Application.persistentDataPath + path, jsonData); }
void Awake() { if (!PlayerPrefs.HasKey("FileFlag")) { PlayerPrefs.SetInt("FileFlag", fileflag); records = new Records(); recordsmm = new RecordsMM(); recordsmg = new RecordsMG(); string path = "/PlayerRecords.json"; string jsonData = JsonUtility.ToJson(records, true); File.WriteAllText(Application.persistentDataPath + path, jsonData); path = "/PlayerRecordsMM.json"; string jsonData1 = JsonUtility.ToJson(recordsmm, true); File.WriteAllText(Application.persistentDataPath + path, jsonData1); path = "/PlayerRecordsMG.json"; string jsonData2 = JsonUtility.ToJson(recordsmg, true); File.WriteAllText(Application.persistentDataPath + path, jsonData2); SaveGame(); Debug.Log("Dosyalar Oluşturuldu."); } //PlayerPrefs.DeleteKey("FileFlag"); if (!loadflag) { LoadGame(); loadflag = true; } if (HourDetect.resetflag) { app_open_count = new bool[] { false, false, false }; HourDetect.resetflag = false; } if (!game_opened) // Her menüye dönüldüğünde aşağıdaki for çalışmasın diye { for (int i = 0; i < 3; i++) //Oyuna günlük kaç kere girildiğini sayan for. { game_opened = true; Debug.Log("For'a girdim"); if (!app_open_count[i]) { Debug.Log("If'e girdim"); app_open_count[i] = true; break; } counter = i; } if (counter == 2) { game_accesable = false; //For üç kere döndüğünde oyuna girilme hakkı bitmiş demektir. Debug.Log("Oyuna girişin kapandı"); } } if (!game_accesable) { denypanel.gameObject.SetActive(true); } SaveGame(); }