public static void SetSFXVolume() { SoundControl.SetSoundVolume(sfx? 1 : 0); string saveddata = JSONMaker.MakeSaveFile(); PlayerPrefs.SetString("PlayerSavedData", saveddata); }
//Joao2409 public static void SavePlayerData() { string saveddata = JSONMaker.MakeSaveFile(); // Debug.Log ("onloading "+saveddata); PlayerPrefs.SetString("PlayerSavedData", saveddata); }
public void FemaleCharacterShown() { SoundControl.PlaySFX(GlobalData.SFX_Paths[0], false, true, true); PlayerData.picked_playerid = 1; GirlCharacter.GetComponent <Image>().color = new Color(255f, 255f, 255f, 255f); BoyCharacter.GetComponent <Image>().color = new Color(0.7647f, 0.7647f, 0.7647f, 255f); string saveddata = JSONMaker.MakeSaveFile(); PlayerPrefs.SetString("PlayerSavedData", saveddata); }
//JoaoResetData void ResetAllData() { PlayerData.current_energy = 50; PlayerData.energy_queue.Clear(); PlayerData.level_state = 0; PlayerData.picked_playerid = 0; PlayerData.playername = ""; PlayerData.lastunlockeddificulty = 0; PlayerData.lastunlockedlevel = 1; GlobalData.LevelsUnlocked = new Dictionary <int, List <bool> >() { { 0, new List <bool>() { true, false, false, false, false, false, false, false, false, false } }, { 1, new List <bool>() { true, false, false, false, false, false, false, false, false, false } }, { 2, new List <bool>() { true, false, false, false, false, false, false, false, false, false } } }; GlobalData.DifficultiesUnlocked = new List <bool>() { true, false, false }; updateMusicSFXImages(); string saveddata = JSONMaker.MakeSaveFile(); PlayerPrefs.SetString("PlayerSavedData", saveddata); GameObject.Find("MainMenu").transform.Find("PlayMenu").transform.Find("LevelSelectMenu").transform.Find("InputNameBG").transform.Find("InputName").GetComponent <InputField>().text = PlayerData.playername; }
public MainWindow() { settings_Path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\PC Camera" + slash; string[] names = { "Time_Interval", "Images_Save_Location" }; string[] values = { time_interval.ToString(), img_path }; InitializeComponent(); // location + dir + @"PC Images\" + time + " PC.jpg" CameraChoice _CameraChoice = new CameraChoice(); CameraControl cam = new CameraControl(); _CameraChoice.UpdateDeviceList(); var moniker = _CameraChoice.Devices[0].Mon; ResolutionList resolutions = Camera.GetResolutionList(moniker); DirCheck(); //settings folder maker if (!Directory.Exists(settings_Path)) { Directory.CreateDirectory(settings_Path); } //logger = new Logger(location + current_dir + "log file.txt", current_time); //if setting file exists if (!File.Exists(settings_Path + settings_file_name)) { // Create a file to write to. JSONMaker maker = new JSONMaker(names.Length, names, values, settings_Path + settings_file_name); } //using (StreamReader sr = File.OpenText(settings_Path + settings_file_name)) { read = new Reader.Reader(settings_Path + settings_file_name); //string s = ""; //s = sr.ReadLine(); time_interval = Convert.ToInt32(read.ReturnValueOf("Time_Interval")); img_path = read.ReturnValueOf("Images_Save_Location"); time_out.Text += Convert.ToString(time_interval) + "\n"; time_out.Text += Convert.ToString(img_path) + "\n"; LogCheck(); } Res.Text += "Resolutions " + "\n"; logger.Information("Resolutions", current_time); foreach (Resolution r in resolutions) { Res.Text += Convert.ToString(r + "\n"); logger.Information(Convert.ToString(r), current_time); } cam.SetCamera(moniker, resolutions[0]); Res.Text += "Starting Camera" + "\n"; logger.Information("Starting Camera", current_time); var timer = new System.Timers.Timer { Interval = (1000 * 60) * time_interval }; //this will run the ontimed function when time is elapsed timer.Elapsed += ontimed; temp = "current mins are set to: "; Res.Text += temp + Convert.ToString(time_interval) + "\n"; logger.Information(temp + time_interval, current_time); //this starts the timer timer.Start(); void ontimed(object sender, System.Timers.ElapsedEventArgs e) { //the time at which the image got taken current_time = DateTime.Now.ToString("dddd dd MMMM yyyy hh.mm tt"); //the location at which the mage will be stored along with the generic location //it is used to store images according to each day current_dir = DateTime.Now.ToString("dddd dd MMMM yyyy") + "\\"; this.Dispatcher.Invoke(() => { try { DirCheck(); LogCheck(); user_image(current_time, current_dir); pc_img(current_time, current_dir); Log_info("Image captured at time ", current_time); if (check == true) { Log_mins("minutes updated to ", current_time, time_interval); temp = "current mins are set to: "; Res.Text += temp + Convert.ToString(time_interval) + "\n"; logger.Information(temp + time_interval, current_time); check = false; } timer.Interval = (1000 * 60) * time_interval; } catch (Exception ex) { time_out.Text += ex.ToString() + "\n"; logger.Error(ex, current_time); } }); } void pc_img(string time, string dir) { var image = ScreenCapture.CaptureDesktop(); image.Save(img_path + dir + @"PC Images\" + time + " PC.jpg", ImageFormat.Jpeg); { /* * System.Drawing.Rectangle bounds = Screen.GetBounds(System.Drawing.Point.Empty); * using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height)) * { * using (Graphics g = Graphics.FromImage(bitmap)) * { * g.CopyFromScreen(System.Drawing.Point.Empty, System.Drawing.Point.Empty, bounds.Size); * } * bitmap.Save("D:\\test.jpg", ImageFormat.Jpeg); * } */ } } void user_image(string time, string dir) { this.Dispatcher.Invoke(() => { try { image_taker(time, dir); } catch (Exception ex) { time_out.Text = ex.ToString(); } }); } void image_taker(string time, string dir) { try { //image taker // cam.SetCamera(moniker, resolutions[0]); cam.SnapshotSourceImage().Save(img_path + dir + @"User Images\" + time + " User.png"); // cam.Dispose(); } catch (Exception ex) { time_out.Text += ex.ToString() + "\n"; logger.Error(ex, current_time); } } void Log_info(string info, string time) { time_out.Text += info + time + "\n"; logger.Information(info, time); } void Log_mins(string info, string time, int mins) { time_out.Text += info + mins + "\n"; logger.Information(info + mins, time); } void DirCheck() { //checks for directories if (!Directory.Exists(img_path + current_dir + @"PC Images\")) { Directory.CreateDirectory(img_path + current_dir + @"PC Images\"); } if (!Directory.Exists(img_path + current_dir + @"User Images\")) { Directory.CreateDirectory(img_path + current_dir + @"User Images\"); } } void LogCheck() { //checks for the log file if (logger == null || !logger.Exists()) { logger = new Logger(img_path + current_dir + "log file.txt", current_time); } } }