public void SelectLanguage(Dropdown sel_lang) { cur_language = sel_lang.value; Debug.Log(cur_language); cur_text.text = list_text[cur_language]; SaveLoadData.SaveData("selected_language", cur_language); }
public void EndGame() { Debug.Log("EndGame"); StopAllCoroutines(); ready_now = false; total_errors.text = error_count.ToString(); total_time_text.text = timer_text.text; timer_text.enabled = false; timer_min = 0; HitEvent.Invoke(); if (!pause) { record_int[4]++; SaveLoadData.SaveData("round_counter", record_int[4].ToString()); switch (width_row_number) { case 3: if (timer_sec < record_int[0]) { record_int[0] = timer_sec; SaveLoadData.SaveData("3x3", record_int[0].ToString()); } break; case 4: if (timer_sec < record_int[1]) { record_int[1] = timer_sec; SaveLoadData.SaveData("4x4", record_int[1].ToString()); } break; case 5: if (timer_sec < record_int[2]) { record_int[2] = timer_sec; SaveLoadData.SaveData("5x5", record_int[2].ToString()); } break; case 6: if (timer_sec < record_int[3]) { record_int[3] = timer_sec; SaveLoadData.SaveData("6x6", record_int[3].ToString()); } break; } } else { pause = false; } for (int i = numbers_panel.childCount; i > 0; i--) { DestroyImmediate(numbers_panel.GetChild(0).gameObject); } }
public void PrivacyAgree(int agree) { SaveLoadData.SaveData("agree_privacy_polit", agree); if (agree == 0) { Application.Quit(); } }
void Start() { string dataCountry = SaveLoadData.LoadData(nameVarCodeCountry, true); if (dataCountry == "" || dataCountry == "Null") SaveLoadData.SaveData(nameVarCodeCountry, ToCountryCode(Application.systemLanguage), true); if (Input.location.isEnabledByUser) StartCoroutine(getGeographicalCoordinatesCoroutine()); }
public void GameOver() { //If the player dies and his final score is higher than the current highscore //Set a new highscore if (PlayerInformation.Score >= PlayerInformation.HighScore) { PlayerInformation.HighScore = PlayerInformation.Score; } _deathSound.PlaySound(); _scoreSaver.SaveData(); _gameOverPanel.SetActive(true); }
private IEnumerator getGeographicalCoordinatesCoroutine() { Input.location.Start(); int maximumWait = 20; while (Input.location.status == LocationServiceStatus.Initializing && maximumWait > 0) { yield return new WaitForSeconds(1); maximumWait--; } if (maximumWait < 1 || Input.location.status == LocationServiceStatus.Failed) { Input.location.Stop(); yield break; } float latitude = Input.location.lastData.latitude; float longitude = Input.location.lastData.longitude; //Viet Nam //float latitude = 10.83333f;//vi do //float longitude = 106.63278f;//kinh do Input.location.Stop(); string link = "https://maps.googleapis.com/maps/api/geocode/xml?latlng=" + latitude + "," + longitude + "&sensor=true"; print(link); WWW www = new WWW(link); //while (!www.isDone) //{ // yield return new WaitForSeconds(0.1f); //} yield return www; if (www.error != null) yield break; XmlDocument reverseGeocodeResult = new XmlDocument(); reverseGeocodeResult.LoadXml(www.text); if (reverseGeocodeResult.GetElementsByTagName("status").Item(0).ChildNodes.Item(0).Value != "OK") yield break; string countryCode = null; bool countryFound = false; foreach (XmlNode eachAdressComponent in reverseGeocodeResult.GetElementsByTagName("result").Item(0).ChildNodes) { if (eachAdressComponent.Name == "address_component") { foreach (XmlNode eachAddressAttribute in eachAdressComponent.ChildNodes) { if (eachAddressAttribute.Name == "short_name") countryCode = eachAddressAttribute.FirstChild.Value; if (eachAddressAttribute.Name == "type" && eachAddressAttribute.FirstChild.Value == "country") countryFound = true; } if (countryFound) break; } } if (countryFound && countryCode != null) SaveLoadData.SaveData(nameVarCodeCountry, countryCode, true); }
private void OnEnable() { saveData = delegate { SaveLoadData.SaveData(dataPath, SaveLoadData.genericOperatorContainer); }; loadData = delegate { SaveLoadData.LoadData(dataPath); }; operatorList = new List <GenericOperator>(); }
public void SaveAllData() { for (int i = 0; i < catHolder.Length; i++) { gameSave.stateSave[i] = catHolder[i].GetComponent <CatControll>().state; }//存貓咪資料 for (int i = 0; i < catNum.Length; i++) { gameSave.catNum[i] = catNum[i]; }//存貓咪隊伍編排資料 for (int i = 0; i < catBuyYet.Length; i++) { gameSave.catBuyYet[i] = catBuyYet[i]; }//存以購買貓咪資料 for (int i = 0; i < level.Length; i++) { gameSave.level[i] = level[i]; }//存現在已完成關卡資料 for (int i = 0; i < mission.Length; i++) { gameSave.mission[i] = mission[i]; }//存現在已完成章節資料 for (int i = 0; i < ItemHolder.instance.globleItems.Count; i++) { gameSave.item_id[i] = ItemHolder.instance.globleItems[i].id; gameSave.item_Use[i] = ItemHolder.instance.globleItems[i].itemUse; gameSave.item_amount[i] = ItemHolder.instance.globleItems[i].amount; gameSave.itemOrder[i] = ItemHolder.instance.globleItems[i].order; }//存現有道具資料 for (int i = 0; i < QuestHolder.instance.quest.Count; i++) { gameSave.quest_complete[i] = QuestHolder.instance.quest[i].isComplete; gameSave.quest_reward[i] = QuestHolder.instance.quest[i].isReward; gameSave.quest_id[i] = QuestHolder.instance.quest[i].id; }//存現在任務資料 for (int i = 0; i < everTeach.Length; i++) { gameSave.everTeach[i] = everTeach[i]; }//存是否教學過 for (int i = 0; i < ItemHolder.instance.storeCount.Length; i++) { gameSave.storeCount[i] = ItemHolder.instance.storeCount[i]; }//存是否買過 gameSave.item_all = ItemHolder.instance.amount; gameSave.gold = gold; gameSave.exp = exp; gameSave.recordTime = DateTime.Now; gameSave.enegy = enegy; gameSave.nowStory = nowStory; gameSave.nowUnlockCat = nowUnlockCat; gameSave.everSave = true; gameSave.daliybonus = daliyBonus; gameSave.FishAuto = FishHolder.instance.fishValue.AutoisOn; gameSave.recordFishingTime = FishHolder.instance.fishValue.fishDate; for (int i = 0; i < FishHolder.instance.fishValue.fishAmount.Length; i++) { gameSave.fishAmount[i] = FishHolder.instance.fishValue.fishAmount[i]; } for (int i = 0; i < FishHolder.instance.fishValue.fishBaitAmount.Length; i++) { gameSave.fishBaitAmount[i] = FishHolder.instance.fishValue.fishBaitAmount[i]; } gameSave.rodQuality = FishHolder.instance.fishValue.rodQuality; gameSave.baitQuality = FishHolder.instance.fishValue.baitQuality; SaveLoadData.SaveData(gameSave); }//存檔