// Use this for initialization void Start() { menuVariables = GameObject.Find("EventSystem").GetComponent <MenuVariables>(); scanTime = scanPeriod; processTime = processPeriod; webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper>(); #if UNITY_WEBGL && !UNITY_EDITOR getFilePath_Coroutine = GetFilePath(); StartCoroutine(getFilePath_Coroutine); #else if (!string.IsNullOrEmpty(classes)) { classes_filepath = Utils.getFilePath("dnn/" + classes); } if (!string.IsNullOrEmpty(config)) { config_filepath = Utils.getFilePath("dnn/" + config); } if (!string.IsNullOrEmpty(model)) { model_filepath = Utils.getFilePath("dnn/" + model); } Run(); #endif }
// Use this for initialization void Start() { menuVariables = GameObject.Find("EventSystem").GetComponent <MenuVariables>(); webCamTextureToMatHelper = gameObject.GetComponent <WebCamTextureToMatHelper>(); #if UNITY_WEBGL && !UNITY_EDITOR getFilePath_Coroutine = GetFilePath(); StartCoroutine(getFilePath_Coroutine); #else if (!string.IsNullOrEmpty(classes)) { classes_filepath = Utils.getFilePath("dnn/" + classes); } if (!string.IsNullOrEmpty(config)) { config_filepath = Utils.getFilePath("dnn/" + config); } if (!string.IsNullOrEmpty(model)) { model_filepath = Utils.getFilePath("dnn/" + model); } Run(); EnglishText.text = "EN"; SpanishText.text = "ES"; FrenchText.text = "FR"; GermanText.text = "DE"; ItalianText.text = "IT"; #endif }
public void SaveProgress() { //Debug.Log("Saving Progress"); MenuVariables.selectedQuestionaryObj.lastAnsweredQuestion = currentQuestion; //Debug.Log("Saving currentQuestion: " + currentQuestion.ToString()); MenuVariables.selectedQuestionaryObj.correctAnswers = rightAnswers; //Debug.Log("Saving rightAnswers: " + rightAnswers.ToString()); MenuVariables.SaveQuestionary(); //Debug.Log("Finished Saving Progress"); }
void UpdateSave(int grade, bool bestScore) { if (bestScore) { MenuVariables.selectedQuestionaryObj.bestscore = grade; } float average = (float)(MenuVariables.selectedQuestionaryObj.averagescore * MenuVariables.selectedQuestionaryObj.timesAnswered); average += grade; MenuVariables.selectedQuestionaryObj.timesAnswered++; average /= MenuVariables.selectedQuestionaryObj.timesAnswered; MenuVariables.selectedQuestionaryObj.averagescore = (int)average; MenuVariables.selectedQuestionaryObj.lastAnsweredQuestion = 0; MenuVariables.selectedQuestionaryObj.correctAnswers = 0; MenuVariables.SaveQuestionary(); }
public void ClearProgress() { MenuVariables.RemoveAllProgress(); }
// Use this for initialization void Awake() { MenuVariables.InitVariables(); StartApp(); }
// Use this for initialization void Start () { textMesh = GetComponent<TextMesh>(); color = textMesh.color; sceneVariables = sceneVariablesObject.GetComponent<MenuVariables>(); }
private void LoadMenuVariables() { if (saveAs == saveFormat.playerprefs) { if (PlayerPrefs.HasKey("graphicsPrefsSaved"))//to check if there are any. { qualityLevelSlider.value = PlayerPrefs.GetInt("graphicsSlider"); antiAliasSlider.value = PlayerPrefs.GetInt("antiAliasSlider"); shadowResolutionSlider.value = PlayerPrefs.GetInt("shadowResolutionSlider"); textureQualitySlider.value = PlayerPrefs.GetInt("textureQualitySlider"); anisotropicModeSlider.value = PlayerPrefs.GetInt("anisotropicModeSlider"); anisotropicLevelSlider.value = PlayerPrefs.GetInt("anisotropicLevelSlider"); wantedResX = PlayerPrefs.GetInt("wantedResolutionX"); wantedResY = PlayerPrefs.GetInt("wantedResolutionY"); currentResolutionText.text = wantedResX + "x" + wantedResY; int toggle = PlayerPrefs.GetInt("FPSToggle"); if (toggle == 1) { FPSToggle.isOn = true; showFPS = true; } else { FPSToggle.isOn = false; showFPS = false; } toggle = PlayerPrefs.GetInt("windowedModeToggle"); if (toggle == 1) { windowedModeToggle.isOn = true; } else { windowedModeToggle.isOn = false; } toggle = PlayerPrefs.GetInt("vSyncToggle"); if (toggle == 1) { vSyncToggle.isOn = true; } else { vSyncToggle.isOn = false; } } else //no player prefs are saved. { //if nothing was saved use the full screen resolutions wantedResX = Screen.width; wantedResY = Screen.height; currentResolutionText.text = Screen.width + "x" + Screen.height;//sets the text of the Screen Resolution button to the res we start with. } } else if (saveAs == saveFormat.iniFile) { if (File.Exists(saveFileDataPath))//to check if the file exists. { string loadedVasrJS = File.ReadAllText(saveFileDataPath); saveVars = JsonUtility.FromJson <MenuVariables>(loadedVasrJS); qualityLevelSlider.value = saveVars.Qualitylevel; antiAliasSlider.value = saveVars.AntiAliaslevel; anisotropicModeSlider.value = saveVars.AnisotropicMode; anisotropicLevelSlider.value = saveVars.AnisotropicLevel; shadowResolutionSlider.value = saveVars.ShadowResolution; textureQualitySlider.value = saveVars.TextureQuality; wantedResX = saveVars.ResolutionX; wantedResY = saveVars.ResolutionY; currentResolutionText.text = wantedResX + "x" + wantedResY; FPSToggle.isOn = saveVars.ShowFPS; showFPS = saveVars.ShowFPS; windowedModeToggle.isOn = saveVars.WindowedMode; vSyncToggle.isOn = saveVars.VSync; loadedVasrJS = null; saveVars = null; } else //no settings were saved. { //if nothing was saved use the full screen resolutions wantedResX = Screen.width; wantedResY = Screen.height; currentResolutionText.text = Screen.width + "x" + Screen.height; } } }
public void SaveMenuVariables() { if (saveAs == saveFormat.playerprefs) { PlayerPrefs.SetInt("graphicsPrefsSaved", 0); PlayerPrefs.SetInt("graphicsSlider", Mathf.RoundToInt(qualityLevelSlider.value)); PlayerPrefs.SetInt("antiAliasSlider", Mathf.RoundToInt(antiAliasSlider.value)); PlayerPrefs.SetInt("shadowResolutionSlider", Mathf.RoundToInt(shadowResolutionSlider.value)); PlayerPrefs.SetInt("textureQualitySlider", Mathf.RoundToInt(textureQualitySlider.value)); PlayerPrefs.SetInt("anisotropicModeSlider", Mathf.RoundToInt(anisotropicModeSlider.value)); PlayerPrefs.SetInt("anisotropicLevelSlider", Mathf.RoundToInt(anisotropicLevelSlider.value)); PlayerPrefs.SetInt("wantedResolutionX", wantedResX); PlayerPrefs.SetInt("wantedResolutionY", wantedResY); int toggle = 0; if (!showFPS) { toggle = 0; } else { toggle = 1; } PlayerPrefs.SetInt("FPSToggle", toggle); if (vSyncToggle.isOn) { toggle = 1; } else { toggle = 0; } PlayerPrefs.SetInt("vSyncToggle", toggle); if (windowedModeToggle.isOn) { toggle = 1; } else { toggle = 0; } PlayerPrefs.SetInt("windowedModeToggle", toggle); } else if (saveAs == saveFormat.iniFile) { saveVars = new MenuVariables { Qualitylevel = Mathf.RoundToInt(qualityLevelSlider.value), ShowFPS = showFPS, ResolutionX = wantedResX, ResolutionY = wantedResY, WindowedMode = windowedModeToggle.isOn, VSync = vSyncToggle.isOn, AntiAliaslevel = Mathf.RoundToInt(antiAliasSlider.value), ShadowResolution = Mathf.RoundToInt(shadowResolutionSlider.value), TextureQuality = Mathf.RoundToInt(textureQualitySlider.value), AnisotropicMode = Mathf.RoundToInt(anisotropicModeSlider.value), AnisotropicLevel = Mathf.RoundToInt(anisotropicLevelSlider.value), Warning = "Edit this file at your own risk!" }; string saveVasrJS = JsonUtility.ToJson(saveVars, true); File.WriteAllText(saveFileDataPath, saveVasrJS); saveVasrJS = null; saveVars = null; } }