void Awake()
    {
        nextgamebtn.gameObject.SetActive(false);
        score     = 0;
        timestart = 60f;
        leveltime = 5f;

        //------Data mining---------
        NEWrecords = new RecordsMM();
        OLDrecords = new RecordsMM();

        string path = "/PlayerRecordsMM.json";

        OLDrecords = JsonUtility.FromJson <RecordsMM>(File.ReadAllText(Application.persistentDataPath + path));
        if (OLDrecords.result == 1)
        {
            leveltime = 6f;
            timestart = 65f;
            Debug.Log("player type : " + OLDrecords.result);
        }
        if (OLDrecords.result == 2)
        {
            leveltime = 4.5f;
            timestart = 55f;
            Debug.Log("player type : " + OLDrecords.result);
        }
        if (OLDrecords.result == 3)
        {
            leveltime = 4f;
            timestart = 50f;
            Debug.Log("player type : " + OLDrecords.result);
        }

        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);


        //----------------------------
    }
示例#2
0
 public void Detect_Type(RecordsMM records)
 {
     Debug.Log("PlayerType_detect func value = " + records.PlayerType);
     if (records.PlayerType < 20f)
     {
         Debug.Log("Player Type = Begginer.(Type1)");
         records.result = 1;
     }
     if (records.PlayerType >= 20f && records.PlayerType < 35f)
     {
         Debug.Log("Player Type = Intermediate.(Type2)");
         records.result = 2;
     }
     if (records.PlayerType > 35f)
     {
         Debug.Log("Player Type = Proffesional.(Type3)");
         records.result = 3;
     }
 }
示例#3
0
    public void PushRecords(RecordsMM newrecords, RecordsMM 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     = "/PlayerRecordsMM.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();
    }