public void CreateProject() { CurrentProject = new LanotaliumProject(); ProjectWizard.SetActive(true); InitializeProjectWizard(); LimTutorialManager.ShowTutorial("FirstProject3"); }
//Load private void InitializeProjectWizard(string ProjectFilePath) { ChartPath.text = null; isCreateProject = false; string ProjectFileString = File.ReadAllText(ProjectFilePath); CurrentProject = JsonConvert.DeserializeObject <LanotaliumProject>(ProjectFileString); ProjectWizard.SetActive(true); if (CurrentProject == null) { DialogUtils.MessageBox.ShowMessage(LimLanguageManager.TextDict["Project_InvalidProjectFile"]); InitializeProjectWizard(); return; } Name.text = CurrentProject.Name; Designer.text = CurrentProject.Designer; MusicPath.text = CurrentProject.MusicPath; ChartPath.text = CurrentProject.ChartPath; if (CurrentProject.BGACount() == 0) { DialogUtils.MessageBox.ShowMessage(LimLanguageManager.TextDict["Project_InvalidProjectFile"]); InitializeProjectWizard(); return; } StartCoroutine(InitializeProjectWizardCoroutinePart()); }
private void Start() { try { CleanUpEvent.Invoke(); CleanUpEvent.RemoveAllListeners(); if (Environment.GetCommandLineArgs().Length == 2 && !LapDirectOpened) { if (!File.Exists(Environment.GetCommandLineArgs()[1])) { return; } string ProjectFileString = File.ReadAllText(Environment.GetCommandLineArgs()[1]); CurrentProject = JsonConvert.DeserializeObject <LanotaliumProject>(ProjectFileString); if (CurrentProject == null) { return; } LapPath = Environment.GetCommandLineArgs()[1]; StartCoroutine(LoadCurrentProject()); LapDirectOpened = true; return; } if (LimChartZoneManager.OpenDownloadedChart) { LimChartZoneManager.OpenDownloadedChart = false; CurrentProject = JsonConvert.DeserializeObject <LanotaliumProject>(File.ReadAllText(LimChartZoneManager.DownloadedChartLapPath)); if (CurrentProject == null) { return; } LapPath = LimChartZoneManager.DownloadedChartLapPath; StartCoroutine(LoadCurrentProject()); return; } LimQuitBox.OnQuitBoxConfirmed.AddListener(SaveProject); if (CurrentProject != null) { SaveProjectFile(); } } catch (Exception) { } }
private void Update() { if (Input.GetKey(KeyCode.LeftControl)) { if (Input.GetKeyDown(KeyCode.O)) { LoadProject(); } else if (Input.GetKeyDown(KeyCode.S)) { SaveProject(); } } if (HasNewDroppedLapFile) { HasNewDroppedLapFile = false; foreach (string P in DroppedLapPaths) { if (Path.GetExtension(P) == ".lap") { LapPath = P; InitializeProjectWizard(P); return; } if (!File.Exists(P) && Directory.Exists(P)) { try { FileStream fs = new FileStream(P + "/info.bytes", FileMode.Open); BinaryReader br = new BinaryReader(fs); LanotaliumProject lp = new LanotaliumProject { Name = br.ReadString(), Designer = br.ReadString() }; br.Close(); fs.Close(); lp.ChartPath = Directory.GetFiles(P, "*.txt")[0]; lp.MusicPath = Directory.GetFiles(P, "*.ogg")[0]; if (File.Exists(P + "/background_linear.jpg")) { lp.BGA2Path = P + "/background.jpg"; lp.BGA1Path = P + "/background_gray.jpg"; lp.BGA0Path = P + "/background_linear.jpg"; } else if (File.Exists(P + "/background_gray.jpg")) { lp.BGA1Path = P + "/background.jpg"; lp.BGA0Path = P + "/background_gray.jpg"; } else { lp.BGA0Path = P + "/background.jpg"; } File.WriteAllText(P + "/project.lap", JsonConvert.SerializeObject(lp)); LapPath = P + "/project.lap"; InitializeProjectWizard(LapPath); return; } catch (Exception) { } } } } }