public void ExitGame() { User.SaveDate(); MyFurnitrue.SaveDate(); Story.SaveDate(); Application.Quit(); }
//욕구관리 void DesireManage() { timeSpan += Time.deltaTime; //욕구증가 if (User.status == 1) //잘 때 { User.sleep -= (5 + MyFurnitrue.stuffLv[1]) * Time.deltaTime; } if (User.sleep > 100) { User.sleep = 100; } else if (User.sleep < 0) { User.sleep = 0; } if (timeSpan > 10.0) { User.SaveDate(); MyFurnitrue.SaveDate(); Story.SaveDate(); PlayerPrefs.SetString("restdate", DateTime.Now.ToString()); PlayerPrefs.Save(); timeSpan = 0; } }
public void Buy() { List <Furnitrue> fList = MyItems.LoadFurnitrueXML(); furnitruename = GameObject.Find("Canvas/Panels/PanelQuestion").transform.GetChild(2).name; for (int i = 0; i < fList.Count; i++) { if (fList[i].name == furnitruename && GameObject.Find("House" + User.house + "/Furniture/" + fList[i].id) != null) { if (fList[i].price > User.money) { break; } GameObject.Find("House" + User.house + "/Furniture/" + fList[i].id).gameObject.SetActive(true); GameObject.Find("Canvas/Panels").transform.GetChild(6).GetChild(1).GetChild(0).GetChild(0).GetChild(i).GetChild(5).gameObject.SetActive(false); GameObject.Find("Canvas/Panels").transform.GetChild(6).GetChild(1).GetChild(0).GetChild(0).GetChild(i).GetChild(0).GetChild(0).GetComponent <Text>().text = fList[i].name + " Lv 1"; User.money -= fList[i].price; MyFurnitrue.stuffLv[i] = 1; MyFurnitrue.SaveDate(); GameObject.Find("Canvas/Panels/PanelQuestion").gameObject.SetActive(false); break; } else { Debug.Log(fList[i].id); } } }
//종료시 발생 void OnApplicationPause(bool pauseStatus) { if (pauseStatus) { User.SaveDate(); MyFurnitrue.SaveDate(); Story.SaveDate(); } }
public void StuffLevelRetain() { if (!GameObject.Find("SoundOfButton").GetComponent <AudioSource>().isPlaying&& !User.isEffectSound) { GameObject.Find("SoundOfButton").GetComponent <AudioSource>().Play(); } int i = System.Convert.ToInt32(this.name); MyFurnitrue.stuffIsLevel[i] = true; MyFurnitrue.SaveDate(); }
public void RestHome() { if (!GameObject.Find("SoundOfButton").GetComponent <AudioSource>().isPlaying&& !User.isEffectSound) { GameObject.Find("SoundOfButton").GetComponent <AudioSource>().Play(); } if (User.day) { ScriptOnGUI("피곤해... 이제 자야할 시간이야"); AlertNoGUI("아침에만 할 수 있습니다."); return; } if (User.particle - 30 < 0) { ScriptOnGUI("지금 쉴 때가 아니야!"); AlertNoGUI("파편이 부족하여 집에서 쉴 수 없습니다."); return; } User.particle -= 30; float plusheart = 0.0f; float sec = 100 / (((User.house * 1.5f) + 5)); //하트차는소요시간 for (int i = 1; i < MyFurnitrue.stuffLv.Length; i++) { plusheart += MyFurnitrue.stuffLv[i]; } plusheart += User.house * 10; plusheart += plusheart * User.itemLevel[0] * 0.01f; User.heart += (plusheart / sec) * 3600; User.day = true; User.isReport = false; User.map = 3; User.status = 0; User.sleep = 100; User.isPlay = false; User.SaveDate(); Story.SaveDate(); MyFurnitrue.SaveDate(); SceneManager.LoadSceneAsync(3); }
//클라우드 세이브 public void SaveGold() { if (!GameObject.Find("SoundOfButton").GetComponent <AudioSource>().isPlaying&& !User.isEffectSound) { GameObject.Find("SoundOfButton").GetComponent <AudioSource>().Play(); } User.SaveDate(); Story.SaveDate(); MyFurnitrue.SaveDate(); string test = ""; for (int i = 0; i < User.jsonData.Length; i++) { test += User.jsonData[i]; } string data = User.jsonData + "|" + Story.jsonStoryData + "|" + MyFurnitrue.jsonStuffData; Debug.Log(data); GoogleManager.Instance.SaveToCloud(data); }
public void StuffLevelUp() { if (!GameObject.Find("SoundOfButton").GetComponent <AudioSource>().isPlaying&& !User.isEffectSound) { GameObject.Find("SoundOfButton").GetComponent <AudioSource>().Play(); } int i = System.Convert.ToInt32(this.transform.GetChild(1).name); if (User.money - ((10000 * MyFurnitrue.stuffLv[i] * MyFurnitrue.stuffLv[i] * i)) < 0) { ScriptOnGUI("돈이 부족한걸..."); return; } if (MyFurnitrue.stuffLv[i] >= User.house * 2) { ScriptOnGUI("더욱 성장해야 올릴 수 있어!"); return; } if (MyFurnitrue.stuffLv[i] >= 10) { ScriptOnGUI("더 이상 올릴 수 없어."); return; } if (MyFurnitrue.stuffLv[i] >= MyFurnitrue.ExpTable.Length) { ScriptOnGUI("이미 끝까지 올렸어."); return; } User.money -= ((10000 * MyFurnitrue.stuffLv[i] * MyFurnitrue.stuffLv[i] * i)); MyFurnitrue.stuffLv[i] += 1; MyFurnitrue.stuffExp[i - 1] = 0; MyFurnitrue.stuffIsLevel[i] = false; MyFurnitrue.StuffManager(); MyFurnitrue.SaveDate(); }
// Update is called once per frame void Update() { if (isBuy && fade != null) { buytime += Time.deltaTime; fade.SetActive(true); //레벨업 if (isHouseLoad && buytime > 2.0f) { User.house += 1; //튜토리얼 MyFurnitrue.stuffLv[0] = User.house; User.SaveDate(); MyFurnitrue.SaveDate(); GameObject.Find("PanelMyStuff").SetActive(false); GameObject.Find("User").transform.position = new Vector3(0, 0.8f, 0); GameObject.Find("PanelHouseUp").SetActive(false); isHouseLoad = false; } if (buytime > 5.0f) { if (User.house == 1 && !PlayerPrefs.HasKey("achivement1")) { GoogleManager.Instance.CompleteHouse1(); } else if (User.house == 2 && !PlayerPrefs.HasKey("achivement2")) { GoogleManager.Instance.CompleteHouse1(); GameObject.Find("CanvasOverlay/Report").transform.GetChild(9).gameObject.SetActive(true); } else if (User.house == 3 && !PlayerPrefs.HasKey("achivement3")) { GoogleManager.Instance.CompleteHouse1(); } else if (User.house == 4 && !PlayerPrefs.HasKey("achivement4")) { GoogleManager.Instance.CompleteHouse1(); } else if (User.house == 5 && !PlayerPrefs.HasKey("achivement5")) { GoogleManager.Instance.CompleteHouse1(); } MyFurnitrue.StuffManager(); fade.SetActive(false); isBuy = false; buytime = 0.0f; if (User.house == 1 && Story.tutorialseqeuence == 2) { Story.tutorialseqeuence = 3; } Story.SaveDate(); } } }
public void LoadTextGold() { User.LoadData(); Story.LoadData(); MyFurnitrue.LoadData(); string data = User.jsonData + "|" + Story.jsonStoryData + "|" + MyFurnitrue.jsonStuffData; char[] split = { '|' }; string[] mddata = data.Split(split); string userdata = mddata[0]; string storydata = mddata[1]; string stuffdata = mddata[2]; User dat = JsonUtility.FromJson <User>(userdata); Story sty = JsonUtility.FromJson <Story>(storydata); MyFurnitrue mf = JsonUtility.FromJson <MyFurnitrue>(stuffdata); User.myname = dat.s_myname; User.money = dat.s_money; User.fatigue = dat.s_fatigue; User.knowledge = dat.s_knowledge; User.health = dat.s_health; User.charm = dat.s_charm; User.moral = dat.s_moral; User.lucky = dat.s_lucky; User.sleep = dat.s_sleep; User.particle = dat.s_particle; User.frustrate = dat.s_frustrate; User.house = dat.s_house; User.day = dat.s_day; User.night = dat.s_night; User.equip = dat.s_equip; User.storysequence = dat.s_storysequence; User.map = dat.s_map; User.heart = dat.s_heart; User.member = dat.s_member; User.memberlevel = dat.s_memberlevel; User.meter = dat.s_meter; User.skillLevel = dat.s_skillLevel; User.passiveLevel = dat.s_passiveLevel; User.healingLevel = dat.s_healingLevel; User.isReport = dat.s_isReport; User.message = dat.s_message; User.isDead = dat.s_isDead; User.bonusDate = dat.s_bonusDate; User.jobLevel = dat.s_jobLevel; User.tourLevel = dat.s_tourLevel; User.jobExp = dat.s_jobExp; User.tourExp = dat.s_tourExp; User.isEffectSound = dat.s_isEffectSound; User.isBackgroundSound = dat.s_isBackgroundSound; User.isCloud = dat.s_isCloud; User.isAds = dat.s_isAds; User.rewardSec = dat.s_rewardSec; User.jobenemylevel = dat.s_jobenemylevel; User.itemLevel = dat.s_itemLevel; Story.storyseqeuence = sty.s_storysequence; Story.tutorialseqeuence = sty.s_tutorialsequence; MyFurnitrue.stuffLv = mf.s_stuffLv; MyFurnitrue.stuffExp = mf.s_stuffExp; MyFurnitrue.stuffIsLevel = mf.s_isLevelUp; User.SaveDate(); Story.SaveDate(); MyFurnitrue.SaveDate(); User.isCloudSave = true; SceneManager.LoadSceneAsync(3); }
//클라우드 로드 public void LoadGold() { if (!GameObject.Find("SoundOfButton").GetComponent <AudioSource>().isPlaying&& !User.isEffectSound) { GameObject.Find("SoundOfButton").GetComponent <AudioSource>().Play(); } GoogleManager.Instance.LoadFromCloud((string dateToLoad) => { if (dateToLoad == null) { return; } string data = dateToLoad; char[] split = { '|' }; string[] mddata = data.Split(split); string userdata = mddata[0]; string storydata = mddata[1]; string stuffdata = mddata[2]; User dat = JsonUtility.FromJson <User>(userdata); Story sty = JsonUtility.FromJson <Story>(storydata); MyFurnitrue mf = JsonUtility.FromJson <MyFurnitrue>(stuffdata); User.myname = dat.s_myname; User.money = dat.s_money; User.fatigue = dat.s_fatigue; User.knowledge = dat.s_knowledge; User.health = dat.s_health; User.charm = dat.s_charm; User.moral = dat.s_moral; User.lucky = dat.s_lucky; User.sleep = dat.s_sleep; User.particle = dat.s_particle; User.frustrate = dat.s_frustrate; User.house = dat.s_house; User.day = dat.s_day; User.night = dat.s_night; User.equip = dat.s_equip; User.storysequence = dat.s_storysequence; User.map = dat.s_map; User.heart = dat.s_heart; User.member = dat.s_member; User.memberlevel = dat.s_memberlevel; User.meter = dat.s_meter; User.skillLevel = dat.s_skillLevel; User.passiveLevel = dat.s_passiveLevel; User.healingLevel = dat.s_healingLevel; User.isReport = dat.s_isReport; User.message = dat.s_message; User.isDead = dat.s_isDead; User.bonusDate = dat.s_bonusDate; User.jobLevel = dat.s_jobLevel; User.tourLevel = dat.s_tourLevel; User.jobExp = dat.s_jobExp; User.tourExp = dat.s_tourExp; User.isEffectSound = dat.s_isEffectSound; User.isBackgroundSound = dat.s_isBackgroundSound; User.isCloud = dat.s_isCloud; User.isAds = dat.s_isAds; User.rewardSec = dat.s_rewardSec; User.jobenemylevel = dat.s_jobenemylevel; User.itemLevel = dat.s_itemLevel; Story.storyseqeuence = sty.s_storysequence; Story.tutorialseqeuence = sty.s_tutorialsequence; MyFurnitrue.stuffLv = mf.s_stuffLv; MyFurnitrue.stuffExp = mf.s_stuffExp; MyFurnitrue.stuffIsLevel = mf.s_isLevelUp; User.SaveDate(); Story.SaveDate(); MyFurnitrue.SaveDate(); User.isCloudSave = true; SceneManager.LoadSceneAsync(3); }); }
public void Create() { Text userID = GameObject.Find("Canvas/PanelCreateCharacter/InputField/Text").GetComponent <Text>(); if (userID.text == null || userID.text == "") { alert.gameObject.SetActive(true); alert.transform.GetChild(0).GetComponent <Text>().text = "이름을 확인해주세요."; return; } else if (!User.isSelectGender) { alert.gameObject.SetActive(true); alert.transform.GetChild(0).GetComponent <Text>().text = "케릭터를 선택하세요."; return; } User.myname = userID.text; User.money = 50000; User.fatigue = 5; User.knowledge = 5; User.health = 5; User.charm = 5; User.moral = 5; User.lucky = 5; User.sleep = 0; User.frustrate = 0; User.particle = 30; User.house = 0; User.day = false; User.night = 1; User.equip = ""; User.storysequence = 1; User.map = 3; User.heart = 10; User.member = new int[4]; User.memberlevel = new int[4]; User.skillLevel = new int[9]; User.passiveLevel = new int[3]; User.healingLevel = new int[3]; User.isReport = false; User.message = new List <string>(); User.bonusDate = DateTime.Now.ToString(); User.jobLevel = 1; User.tourLevel = 1; User.jobExp = 0; User.tourExp = 0; User.rewardSec = DateTime.Now; User.jobenemylevel = 0; User.itemLevel = new int[5]; //환경설정 User.isEffectSound = false; User.isBackgroundSound = false; User.isCloud = false; User.isAds = false; MessageInit();//대사초기화 User.SaveDate(); MyFurnitrue.stuffLv = new int[12]; MyFurnitrue.stuffExp = new float[11]; MyFurnitrue.stuffIsLevel = new bool[12]; MyFurnitrue.stuffLv[0] = 1; MyFurnitrue.SaveDate(); Story.storyseqeuence = 0; Story.tutorialseqeuence = 0; Story.SaveDate(); SceneManager.LoadScene("Intro"); }