private string GetTargetPath(string targetPath, string sourceFile, IMusicDecode decode) { FileInfo finfo = new FileInfo(sourceFile); if (string.IsNullOrWhiteSpace(targetPath)) { targetPath = AppSave.FormatPath(finfo.DirectoryName); } StringBuilder retName = new StringBuilder(); string fName = finfo.Name.Substring(0, finfo.Name.Length - finfo.Extension.Length); string newExName = decode.Format; int index = 0; do { retName.Clear(); retName.Append(targetPath); retName.Append(fName); if (index > 0) { retName.Append("("); retName.Append(index.ToString()); retName.Append(")"); } retName.Append("."); retName.Append(newExName); index++; } while (File.Exists(retName.ToString())); return(retName.ToString()); }
void Start() { appSave = SaveSystem.GetInstance().appSave; if (appSave.elfaEndDay) { appSave.elfaBattle = true; } if (appSave.orcEndDay) { appSave.orcBattle = true; } if (appSave.sereiaEndDay) { appSave.sereiaBattle = true; } if (appSave.humanoEndDay) { appSave.humanoBattle = true; } SaveSystem.GetInstance().SaveState(); audioManager = FindObjectOfType <AudioManager>(); battleUI = GetComponent <BattleUIManager>(); curTurn = 1; defenseOn = false; state = BattleState.START; StartCoroutine(SetupBattle()); }
void Start() { audioManager = GameObject.FindGameObjectWithTag("persistentData").GetComponent <AudioManager>(); canJump = true; canMakePoint = true; totalPossiblePoints = 0; point = 0; totalTime = Timer.totalTime; timer = this.GetComponent <Timer>(); minPos = baixo.transform.position.y; maxPos = cima.transform.position.y; randomMaxPos = maxPos - 0.35f; randomMinPos = minPos + 0.35f; outOfSquareBounds = true; AppSave appSave = SaveSystem.GetInstance().appSave; if (appSave.tutorialMinigame3) { appSave.tutorialMinigame3 = false; SaveSystem.GetInstance().SaveState(); tutorial.SetActive(true); Time.timeScale = 0f; Pause.isPaused = true; } }
private void WorldCup_Load(object sender, EventArgs e) { string language = ""; try { language = AppSave.LanguageConfLoad(); } catch (FileNotFoundException) { language = "error"; } catch (Exception ex) { MessageBox.Show($"Error:\n {ex.Message}"); } pbIntro.Image = Resources.WC_Logo; btnEn.Visible = false; btnHr.Visible = false; if (language == "error") { btnEn.Visible = true; btnHr.Visible = true; } else { UpdateConfig("language", language); timerMain.Tick += TimerMain_Tick; timerMain.Interval = 500; timerMain.Start(); } }
void Start() { fade.canvasRenderer.SetAlpha(1.0f); FadeIn(); audioManager = GetComponent <AudioManager>(); settingsPage = GetComponent <SettingsPage>(); appSave = SaveSystem.GetInstance().appSave; int c; c = appSave.love; loveImage[c].gameObject.SetActive(true); if (c == 0) { path = "elfa_"; } else if (c == 1) { path = "orc_"; } else if (c == 2) { path = "sereia_"; } else { path = "humano_"; } StartCoroutine(TypingEffect(c)); }
public void createContact(CharacterBase character) { appSave = SaveSystem.GetInstance().appSave; GameObject contact = Instantiate(contactPrefab, messagePanel.transform); if (character.name == "Amarillys") { contact.gameObject.tag = "Elf"; } else if (character.name == "Bruce") { contact.gameObject.tag = "Orc"; } else if (character.name == "Clarissa") { contact.gameObject.tag = "Sereia"; } else { contact.gameObject.tag = "Humano"; } contact.transform.GetChild(0).GetChild(0).gameObject.GetComponent <Image>().sprite = character.MensagemImage; contact.transform.GetChild(0).GetChild(1).gameObject.GetComponent <TextMeshProUGUI>().text = character.name; Image popUp = contact.transform.GetChild(0).GetChild(2).gameObject.GetComponent <Image>(); contact.SetActive(true); //setando o botao GameObject characterPanel = getCharacterPanel(character); Button button = contact.transform.GetChild(0).GetComponent <Button>(); button.onClick.AddListener(() => openMessage(characterPanel, popUp, character)); foreach (CharacterBase blocked in appSave.blockedCharacters) { if (character.name == blocked.name) { contact.transform.GetChild(0).GetChild(1).gameObject.GetComponent <TextMeshProUGUI>().text = "BLOQUEADO"; button.interactable = false; } } if (!tinderData.curContacts.Contains(character)) { character.popUp = true; tinderData.curContacts.Add(character); SaveSystem.GetInstance().appSave.curContacts.Add(character); SaveSystem.GetInstance().SaveState(); } else if (character.popUp) { chatButtonPopUpImage.gameObject.SetActive(true); popUp.enabled = true; } else { popUp.enabled = false; } }
private void tutorialOn() { AppSave appsave = SaveSystem.GetInstance().appSave; if (appsave.tutorialTinder) { //yield return new WaitForSeconds(0.3f); tinderTutorial.SetActive(true); appsave.tutorialTinder = false; SaveSystem.GetInstance().SaveState(); } }
private void SetLanguage(string language) { UpdateConfig("language", language); try { AppSave.LanguageConfSave(language); } catch (Exception ex) { MessageBox.Show(ex.Message); } Application.Restart(); }
private void btnEng_Click(object sender, RoutedEventArgs e) { Culture = "en-US"; App.ChangeCulture(new CultureInfo(Culture)); try { AppSave.LanguageConfSave(Culture); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private async void Window_Loaded(object sender, RoutedEventArgs e) { try { size = AppSave.SizeConfLoad(); } catch (Exception ex) { MessageBox.Show(ex.Message); } SetSize(size); PokreniAnimaciju(); await DataLoad(); }
//retorna true se conseguiu ler, senão false public bool LoadState() { string path = SavePath; string versionPath = VersionSavePath; //checar se existe save if (!File.Exists(path) || !File.Exists(versionPath)) { return(false); } //verifica versão do save using (StreamReader streamReader = File.OpenText(versionPath)) { string str = streamReader.ReadToEnd(); try { float ver = float.Parse(str); if (ver < saveVersion) { //versão do save desatualizada Debug.LogWarning("Warning: old save version"); return(ValidateOldSave()); } } catch (Exception e) { Debug.LogWarning("Warning: invalid save-version format" + e.Message); return(ValidateOldSave()); } } try { byte[] buffer = File.ReadAllBytes(path); for (int i = 0; i < buffer.Length; i++) { buffer[i] = (Byte)((~buffer[i]) & 0xFF); //faço um simples not. Não é seguro, mas é o suficiente pra ninguém editar na mão o arquivo } string jsonString = Encoding.UTF8.GetString(buffer); appSave = ScriptableObject.CreateInstance <AppSave>(); JsonUtility.FromJsonOverwrite(jsonString, appSave); return(true); } catch (Exception e) { Debug.LogWarning("Unable to load savefile " + e.Message); return(false); } }
private void CheckSave() { savedTeam = AppSave.TeamLoad(); if (savedTeam != null && savedTeam.code != "none") { int index = 0; foreach (var item in cmbHomeTeam.Items) { if (item.ToString() == savedTeam.ToString()) { cmbHomeTeam.SelectedIndex = index; } index++; } } }
private void btnDecode_Click(object sender, EventArgs e) { if (_thdDecode != null) { EnableDecode(false); return; } if (string.IsNullOrWhiteSpace(cmbTarget.Text)) { MessageBox.Show("请填入输出目录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (lstFiles.Items.Count <= 0) { MessageBox.Show("请选择要输出的文件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string targetPath = cmbTarget.Text; if (cmbTarget.Text == "<歌曲同目录>") { targetPath = null; } if (targetPath != null) { targetPath = AppSave.FormatPath(targetPath); if (!Directory.Exists(targetPath)) { try { Directory.CreateDirectory(targetPath); }catch (Exception ex) { MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } _save.OutputPath = targetPath; _save.Save(); pb.Maximum = lstFiles.Items.Count; EnableDecode(true); _thdDecode = new Thread(new ThreadStart(ToDecode)); _thdDecode.Start(); }
private void FrmMain_Load(object sender, EventArgs e) { _save.Load(); if (string.IsNullOrWhiteSpace(_save.LastLoad)) { _save.LastLoad = AppSave.GetBaseRoot(); } ofd.InitialDirectory = _save.LastLoad; if (!string.IsNullOrWhiteSpace(_save.OutputPath)) { cmbTarget.Text = _save.OutputPath; } EnableDecode(false); SetTitle(); }
public void blockContact(string tag) { int childCount = messagePanel.transform.childCount; appSave = SaveSystem.GetInstance().appSave; for (int i = 1; i < childCount; i++) { if (messagePanel.transform.GetChild(i).gameObject.tag == tag) { messagePanel.transform.GetChild(i).gameObject.transform.GetChild(0).gameObject.GetComponent <Button>().interactable = false; messagePanel.transform.GetChild(i).gameObject.transform.GetChild(0).gameObject.transform.GetChild(1).GetComponent <TextMeshProUGUI>().text = "BLOQUEADO"; CharacterBase curContact = tinderData.curContacts[i - 1]; appSave.blockedCharacters.Add(curContact); SaveSystem.GetInstance().SaveState(); break; } } }
void Awake() { if (instance != null) { //não pode haver 2 desse script em cena GameObject.Destroy(this.gameObject); } else { instance = this; //tenta dar load if (!LoadState()) { //se falhou, instancia novo save e o salva appSave = GameObject.Instantiate(emptySave); SaveState(); appSave.elfaJson = ""; appSave.orcJson = ""; appSave.sereiaJson = ""; appSave.humanoJson = ""; appSave.elfaEndDay = false; appSave.orcEndDay = false; appSave.sereiaEndDay = false; appSave.humanoEndDay = false; appSave.askTutorialOn = true; appSave.elfaPoints = 0; appSave.humanoPoints = 0; appSave.sereiaPoints = 0; appSave.orcPoints = 0; appSave.love = 0; appSave.elfaBattle = false; appSave.orcBattle = false; appSave.sereiaBattle = false; appSave.humanoBattle = false; appSave.matchesNumber = 0; appSave.blockedCharacters.Clear(); appSave.renewDay = false; string path = Path.Combine(Application.persistentDataPath, saveFileName + ".dat"); Debug.Log("new save on path:" + path); } } DontDestroyOnLoad(this.gameObject); }
private void Awake() { appsave = SaveSystem.GetInstance().appSave; if (appsave.playerAtk == 0) { attack = playerBase.attack; defense = playerBase.defense; velocity = playerBase.velocity; maxEnergy = 10 + Mathf.Floor(velocity / 35); } else { attack = appsave.playerAtk; defense = appsave.playerDef; velocity = appsave.playerVel; maxEnergy = 10 + Mathf.Floor(velocity / 35); } //maxHealth = playerBase.maxHealth; }
void Start() { appSave = SaveSystem.GetInstance().appSave; if (appSave.tutorialMinigame1) { appSave.tutorialMinigame1 = false; SaveSystem.GetInstance().SaveState(); tutorial.SetActive(true); Time.timeScale = 0f; Pause.isPaused = true; } audioManager = FindObjectOfType <AudioManager>(); _y3 = squareImg3.gameObject.transform.position.y; img.Add(squareImg1); img.Add(squareImg2); img.Add(squareImg3); img.Add(squareImg4); squarePos = _y3 - _y3 / 2; _storeString.Add(new List <string> { "0", "0" }); _storeString.Add(new List <string> { "0", "0" }); _storeString.Add(new List <string> { "0", "0" }); _storeString.Add(new List <string> { "0", "0" }); aux.Add(0); aux.Add(1); aux.Add(2); aux.Add(3); point = 0; resetDrawsTime = 3.5f; totalDraws = 0; sortMany(); StartCoroutine(sortThenErase(resetDrawsTime)); }
private void setFullScreen() { mainWindow.WindowState = WindowState.Maximized; btnBall.Width = 120; btnBall.Height = 120; btnCro.Width = 95; btnCro.Height = 85; btnEng.Width = 95; btnEng.Height = 85; btnEng.Margin = new Thickness(0, 10, 180, 0); size = "fullscreen"; try { AppSave.ScreenSave(size); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void SetCulture() { string culture; try { culture = AppSave.LanguageConfLoad(); if (culture == "hr-HR" || culture == "en-US") { var cultureInfo = new CultureInfo(culture); Thread.CurrentThread.CurrentCulture = cultureInfo; Thread.CurrentThread.CurrentUICulture = cultureInfo; CultureInfo.DefaultThreadCurrentCulture = cultureInfo; CultureInfo.DefaultThreadCurrentUICulture = cultureInfo; FrameworkElement.LanguageProperty.OverrideMetadata( typeof(FrameworkElement), new FrameworkPropertyMetadata( XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); } else { var cultureInfo = new CultureInfo("en-US"); Thread.CurrentThread.CurrentCulture = cultureInfo; Thread.CurrentThread.CurrentUICulture = cultureInfo; CultureInfo.DefaultThreadCurrentCulture = cultureInfo; CultureInfo.DefaultThreadCurrentUICulture = cultureInfo; FrameworkElement.LanguageProperty.OverrideMetadata( typeof(FrameworkElement), new FrameworkPropertyMetadata( XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); } } catch (Exception) { //log } }
void Awake() { GameObject[] objs = GameObject.FindGameObjectsWithTag("persistentData"); if (objs.Length > 1) { Destroy(this.gameObject); } DontDestroyOnLoad(this.gameObject); appSave = SaveSystem.GetInstance().appSave; if (appSave.matchesNumber > 0) { tinderCharacters.Clear(); foreach (CharacterBase character in appSave.tinderCharacters) { tinderCharacters.Add(character); } curContacts.Clear(); foreach (CharacterBase contact in appSave.curContacts) { curContacts.Add(contact); } } else { foreach (CharacterBase character in tinderCharacters) { appSave.tinderCharacters.Add(character); } } if (appSave.curDay == 0) { curDay = 1; } else { curDay = appSave.curDay; } }
private void setMinimum() { mainWindow.WindowState = WindowState.Normal; mainWindow.Width = 1024; mainWindow.Height = 768; btnBall.Width = 65; btnBall.Height = 65; btnCro.Width = 40; btnCro.Height = 36; btnEng.Width = 40; btnEng.Height = 35; btnEng.Margin = new Thickness(0, 10, 70, 0); size = "minimum"; CenterWindowOnScreen(); try { AppSave.ScreenSave(size); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void setMedium() { mainWindow.WindowState = WindowState.Normal; mainWindow.Width = 1440; mainWindow.Height = 900; btnBall.Width = 83; btnBall.Height = 83; btnCro.Width = 70; btnCro.Height = 62; btnEng.Width = 70; btnEng.Height = 62; btnEng.Margin = new Thickness(0, 10, 115, 0); size = "medium"; CenterWindowOnScreen(); try { AppSave.ScreenSave(size); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void Start() { appSave = SaveSystem.GetInstance().appSave; if (name == "Amarillys") { minAffinity = minAffinityElfa; } else if (name == "Bruce") { minAffinity = minAffinityOrc; } else if (name == "Clarissa") { minAffinity = minAffinitySereia; } else { minAffinity = minAffinityHumano; } min.Add(minAffinityElfa); min.Add(minAffinityOrc); min.Add(minAffinitySereia); min.Add(minAffinityHumano); }
void Start() { audioManager = GameObject.FindGameObjectWithTag("persistentData").GetComponent <AudioManager>(); //maxWaveNumber = 5; //escalation = 0.73f; spawnRate = 1f; //initialBallQuantity = 13; ballsToSpawn = initialBallQuantity; totalBallsSpawned = initialBallQuantity; waveNumber = 0; waveFinished = true; allWavesFinished = false; waves_txt.text = "Nivel: " + waveNumber.ToString(); AppSave appsave = SaveSystem.GetInstance().appSave; if (appsave.tutorialMinigame2) { appsave.tutorialMinigame2 = false; SaveSystem.GetInstance().SaveState(); tutorial.SetActive(true); Time.timeScale = 0f; Pause.isPaused = true; } }
private void SetLanguage(string language) { UpdateConfig("language", language); AppSave.LanguageConfSave(language); Application.Restart(); }
void OnEnable() { appSave = SaveSystem.GetInstance().appSave; tinderData = GameObject.FindGameObjectWithTag("persistentData").GetComponent <TinderData>(); contactManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <contactsManager>(); addAffinity = GameObject.FindGameObjectWithTag("GameManager").GetComponent <AddAffinity>(); storedMessages = new List <string>(); newDay = false; if (this.gameObject.tag == "Elf") { story = new Story(inkJSONAsset[tinderData.elfaDay].text); storedMessages = appSave.elfa; if (appSave.elfaJson != "") { story.state.LoadJson(appSave.elfaJson); } else { if (appSave.elfaBattle) { newDay = false; } else { newDay = true; } } } else if (this.gameObject.tag == "Orc") { story = new Story(inkJSONAsset[tinderData.orcDay].text); storedMessages = appSave.orc; if (appSave.orcJson != "") { story.state.LoadJson(appSave.orcJson); } else { if (appSave.orcBattle) { newDay = false; } else { newDay = true; } } } else if (this.gameObject.tag == "Sereia") { story = new Story(inkJSONAsset[tinderData.sereiaDay].text); storedMessages = appSave.sereia; if (appSave.sereiaJson != "") { story.state.LoadJson(appSave.sereiaJson); } else { if (appSave.sereiaBattle) { newDay = false; } else { newDay = true; } } } else { story = new Story(inkJSONAsset[tinderData.humanoDay].text); storedMessages = appSave.humano; if (appSave.humanoJson != "") { story.state.LoadJson(appSave.humanoJson); } else { if (appSave.humanoBattle) { newDay = false; } else { newDay = true; } } } if (appSave.renewDay) { newDay = true; } }
//1 - message //2 - won battle //3 - lost battle void Start() { appSave = SaveSystem.GetInstance().appSave; }
private void Start() { audioManager = GetComponent <AudioManager>(); appSave = SaveSystem.GetInstance().appSave; }