public void OnClick() { if (name == "YesButton") { //Kainin //Delete Key int kuniId = GameObject.Find ("NaiseiController").GetComponent<NaiseiController> ().activeKuniId; string temp = "jyosyu" + kuniId; int busyoId = PlayerPrefs.GetInt (temp); PlayerPrefs.DeleteKey(temp); //JyosyuHei Kainin string temp2 = "jyosyuHei" + busyoId; PlayerPrefs.DeleteKey(temp2); PlayerPrefs.Flush (); //Close GameObject.Find ("TouchBack").GetComponent<CloseBoard>().onClick(); //Initialization //Message Message msg = new Message(); string text = "城主を解任致しました。"; msg.makeMessage(text); //Initialization NaiseiController naisei = new NaiseiController (); naisei.Start (); }else if(name == "NoButton"){ //Close GameObject.Find ("TouchBack").GetComponent<CloseBoard>().onClick(); } }
public void OnClick() { Debug.Log ("RequiredItem Check Not Yet"); //Jyosyu Ninmei int kuniId = GameObject.Find ("NaiseiController").GetComponent<NaiseiController> ().activeKuniId; string temp = "jyosyu" + kuniId; PlayerPrefs.SetInt (temp, int.Parse(busyoId)); //Jyosyu Heiryoku string temp2 = "jyosyuHei" + busyoId; int jyosyuHei = int.Parse(GameObject.Find ("AshigaruValue").GetComponent<Text> ().text); PlayerPrefs.SetInt (temp2, jyosyuHei); PlayerPrefs.Flush (); //Delete Box Destroy (GameObject.Find ("board(Clone)")); Destroy (GameObject.Find ("Back(Clone)")); //Message MessageBusyo msg = new MessageBusyo(); string text = "城主に任命致しました。"; string type = "ninmei"; msg.makeMessage(text,int.Parse(busyoId), type); //Initialization NaiseiController naisei = new NaiseiController (); naisei.Start (); }
public void OnClick() { AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> (); if (name == "YesButton") { audioSources [4].Play(); //Kainin //Delete Key if (Application.loadedLevelName == "naisei") { kuniId = GameObject.Find("NaiseiController").GetComponent <NaiseiController> ().activeKuniId; } string temp = "jyosyu" + kuniId; int busyoId = PlayerPrefs.GetInt(temp); PlayerPrefs.DeleteKey(temp); //JyosyuHei Kainin string temp2 = "jyosyuHei" + busyoId; PlayerPrefs.DeleteKey(temp2); string temp3 = "jyosyuBusyo" + busyoId; PlayerPrefs.DeleteKey(temp3); PlayerPrefs.Flush(); //Close GameObject.Find("TouchBack").GetComponent <CloseBoard>().onClick(); //Initialization //Message Message msg = new Message(); msg.makeMessage(msg.getMessage(87)); //Initialization if (Application.loadedLevelName == "naisei") { NaiseiController naisei = new NaiseiController(); naisei.Start(); } else if (Application.loadedLevelName == "busyo") { SyoguScene syogu = new SyoguScene(); syogu.createSyoguView(busyoId.ToString()); } } else if (name == "NoButton") { //Close audioSources [1].Play(); GameObject.Find("TouchBack").GetComponent <CloseBoard>().onClick(); } }
public void OnClick() { AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> (); if (name == "YesButton") { Message msg = new Message(); //check int meiseiItem = PlayerPrefs.GetInt("meisei"); if (meiseiItem >= 1) { audioSources [3].Play(); meiseiItem = meiseiItem - 1; PlayerPrefs.SetInt("meisei", meiseiItem); NaiseiController script = GameObject.Find("NaiseiController").GetComponent <NaiseiController> (); int kuniId = script.activeKuniId; string tmp1 = "naiseiLoginDate" + kuniId.ToString(); string tmp2 = "naiseiTabibitoCounter" + kuniId.ToString(); PlayerPrefs.DeleteKey(tmp1); PlayerPrefs.DeleteKey(tmp2); int tabibitoMaxNo = int.Parse(GameObject.Find("TabibitoMaxValue").GetComponent <Text> ().text); GameObject.Find("TabibitoCountDownValue").GetComponent <Text> ().text = tabibitoMaxNo.ToString(); script.remain = tabibitoMaxNo; float specialRatio = script.specialRatio; //specialRatio = specialRatio * 2; specialRatio = 20; script.specialRatio = specialRatio; PlayerPrefs.SetBool("questDailyFlg151", true); PlayerPrefs.Flush(); //Extension Mark Handling MainStageController main = new MainStageController(); main.questExtension(); msg.makeMessage(msg.getMessage(121)); } else { audioSources [4].Play(); msg.makeMessage(msg.getMessage(120)); } } else { audioSources [1].Play(); } touchBackObj.GetComponent <CloseOneBoard> ().OnClick(); }
public void OnClick() { AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource>(); if (name == "YesButton") { Message msg = new Message(); //check int busyoDama = PlayerPrefs.GetInt("busyoDama"); if (busyoDama >= 100) { if (GameObject.Find("SwithTown")) { GameObject.Find("SwithTown").GetComponent <SwitchTown>().spdUpFlg = true; } GameObject.Find("Panel").transform.FindChild("Button").GetComponent <BackMain>().spdUpFlg = true; audioSources[3].Play(); busyoDama = busyoDama - 100; PlayerPrefs.SetInt("busyoDama", busyoDama); PlayerPrefs.Flush(); //Okuni string tabibitoPath = "Prefabs/Naisei/Tabibito/bunka1"; GameObject prefab = Instantiate(Resources.Load(tabibitoPath)) as GameObject; prefab.transform.SetParent(GameObject.Find("Panel").transform); prefab.transform.localPosition = new Vector2(0, 80); prefab.transform.localScale = new Vector2(1, 1); prefab.GetComponent <TabibitoMove>().enabled = false; NaiseiController script = GameObject.Find("NaiseiController").GetComponent <NaiseiController>(); script.tabibitoSecMst = 0.5f; msg.makeMessage(msg.getMessage(141)); Destroy(baseBtnObj); } else { audioSources[4].Play(); msg.makeMessage(msg.getMessage(2)); } } else { audioSources[1].Play(); } touchBackObj.GetComponent <CloseOneBoard>().OnClick(); }
public void OnClick() { AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource>(); if (name == "YesButton") { audioSources[3].Play(); //Change Sprite & Register Data int shiroId = item.GetComponent <ItemInfo>().itemId; string itemName = item.GetComponent <ItemInfo>().itemName; string imagePath = "Prefabs/Naisei/Shiro/Sprite/" + shiroId; string effectPath = "Prefabs/EffectAnime/point_up"; GameObject naiseiView = GameObject.Find("NaiseiView").gameObject; foreach (Transform chld in naiseiView.transform) { if (chld.GetComponent <AreaButton>().type == "shiro") { chld.GetComponent <Image>().sprite = Resources.Load(imagePath, typeof(Sprite)) as Sprite; GameObject effect = Instantiate(Resources.Load(effectPath)) as GameObject; effect.transform.SetParent(chld.transform); effect.transform.localScale = new Vector2(100, 100); effect.transform.localPosition = new Vector3(0, 0, 0); } } NaiseiController NaiseiControllerScript = GameObject.Find("NaiseiController").GetComponent <NaiseiController>(); string shiroTmp = "shiro" + NaiseiControllerScript.activeKuniId; PlayerPrefs.SetInt(shiroTmp, shiroId); PlayerPrefs.Flush(); //Buf NaiseiControllerScript.tabibitoSecMst = 1.5f; //Reduce Item Shiro shiro = new Shiro(); shiro.deleteShiro(shiroId, 1); //Close touchBack.GetComponent <CloseBoard>().onClick(); } else if (name == "NoButton") { //Close audioSources[1].Play(); Destroy(touchBack); } }
public void OnClick() { List <string> avlNaiseiList = new List <string> (); char[] delimiterChars = { ':' }; NaiseiController script = GameObject.Find("NaiseiController").GetComponent <NaiseiController> (); string shigen = script.shigen; if (shigen != "null") { if (shigen.Contains(":")) { avlNaiseiList = new List <string> (shigen.Split(delimiterChars)); } else { avlNaiseiList.Add(shigen); } } if (avlNaiseiList.Contains("tp") && avlNaiseiList.Contains("kb") && avlNaiseiList.Contains("snb")) { Message msg = new Message(); if (Application.systemLanguage != SystemLanguage.Japanese) { msg.makeMessage("You have already transferred technology of Gun, Hourse, Ninja."); } else { msg.makeMessage("この国に鉄砲、騎馬、忍技術は伝達済みです。"); } } else { BusyoStatusButton pop = new BusyoStatusButton(); pop.commonPopup(26); if (Application.systemLanguage != SystemLanguage.Japanese) { GameObject.Find("popText").GetComponent <Text> ().text = "Tech Transfer"; } else { GameObject.Find("popText").GetComponent <Text>().text = "技術伝達"; } } }
public void OnClick () { if (name == "YesButton") { //Kainin //Delete Key if (Application.loadedLevelName == "naisei") { kuniId = GameObject.Find ("NaiseiController").GetComponent<NaiseiController> ().activeKuniId; } string temp = "jyosyu" + kuniId; int busyoId = PlayerPrefs.GetInt (temp); PlayerPrefs.DeleteKey(temp); //JyosyuHei Kainin string temp2 = "jyosyuHei" + busyoId; PlayerPrefs.DeleteKey(temp2); string temp3 = "jyosyuBusyo" + busyoId; PlayerPrefs.DeleteKey(temp3); PlayerPrefs.Flush (); //Close GameObject.Find ("TouchBack").GetComponent<CloseBoard>().onClick(); //Initialization //Message Message msg = new Message(); string text = "城主を解任致しました。"; msg.makeMessage(text); //Initialization if (Application.loadedLevelName == "naisei") { NaiseiController naisei = new NaiseiController (); naisei.Start (); }else if(Application.loadedLevelName == "busyo"){ SyoguScene syogu = new SyoguScene(); syogu.createSyoguView(busyoId.ToString()); } }else if(name == "NoButton"){ //Close GameObject.Find ("TouchBack").GetComponent<CloseBoard>().onClick(); } }
public void OnClick() { MainStageController MainStageController = GameObject.Find("GameController").GetComponent <MainStageController>(); //SE AudioSource sound = GameObject.Find("SEController").GetComponent <AudioSource> (); sound.PlayOneShot(sound.clip); //Initialization totalMoney = 0; kozanMoney = 0; totalHyourou = 0; totalYRL = 0; totalKBL = 0; totalYML = 0; totalTPL = 0; totalYRM = 0; totalKBM = 0; totalYMM = 0; totalTPM = 0; totalYRH = 0; totalKBH = 0; totalYMH = 0; totalTPH = 0; totalSNBL = 0; totalSNBM = 0; totalSNBH = 0; /*Popup*/ string backPath = "Prefabs/Busyo/back"; GameObject back = Instantiate(Resources.Load(backPath)) as GameObject; back.transform.SetParent(GameObject.Find("Map").transform); back.transform.localScale = new Vector2(1, 1); RectTransform backTransform = back.GetComponent <RectTransform> (); backTransform.anchoredPosition = new Vector3(0, 0, 0); //Popup Screen string popupPath = "Prefabs/Busyo/board"; GameObject popup = Instantiate(Resources.Load(popupPath)) as GameObject; popup.transform.SetParent(GameObject.Find("Map").transform); popup.transform.localScale = new Vector2(1, 1); RectTransform popupTransform = popup.GetComponent <RectTransform> (); popupTransform.anchoredPosition = new Vector3(0, 0, 0); popup.name = "board"; //qa string qaPath = "Prefabs/Common/Question"; GameObject qa = Instantiate(Resources.Load(qaPath)) as GameObject; qa.transform.SetParent(popup.transform); qa.transform.localScale = new Vector2(1, 1); RectTransform qaTransform = qa.GetComponent <RectTransform> (); qaTransform.anchoredPosition = new Vector3(-540, 285, 0); qa.name = "qa"; qa.GetComponent <QA> ().qaId = 2; //Pop text string popTextPath = "Prefabs/Busyo/popText"; GameObject popText = Instantiate(Resources.Load(popTextPath)) as GameObject; popText.transform.SetParent(popup.transform); popText.transform.localScale = new Vector2(0.35f, 0.35f); RectTransform popTextTransform = popText.GetComponent <RectTransform> (); popTextTransform.anchoredPosition = new Vector3(0, 260, 0); popText.name = "popText"; if (Application.systemLanguage != SystemLanguage.Japanese) { popText.GetComponent <Text>().text = "Finance"; } else { popText.GetComponent <Text> ().text = "内政状況"; } //Cyosyu string cyosyuPath = "Prefabs/Cyosyu/CyosyuObj"; GameObject CyosyuObj = Instantiate(Resources.Load(cyosyuPath)) as GameObject; CyosyuObj.transform.SetParent(popup.transform); CyosyuObj.transform.localScale = new Vector2(1, 1); string seiryoku = PlayerPrefs.GetString("seiryoku"); List <string> seiryokuList = new List <string> (); List <string> mySeiryokuList = new List <string> (); char[] delimiterChars = { ',' }; seiryokuList = new List <string> (seiryoku.Split(delimiterChars)); int myDaimyoId = PlayerPrefs.GetInt("myDaimyo"); //Get my Kuni for (int i = 0; i < seiryokuList.Count; i++) { int seiryokuId = int.Parse(seiryokuList [i]); if (seiryokuId == myDaimyoId) { int kuniId = i + 1; mySeiryokuList.Add(kuniId.ToString()); } } //Kuni Loop Start int naiseiBldg = 0; int syogyo = 0; int nogyo = 0; int gunjyu = 0; int ashigaru = 0; int boubi = 0; int bukkyo = 0; int kirisuto = 0; int bunka = 0; //seiryoku loop for (int i = 0; i < mySeiryokuList.Count; i++) { int kuniKozan = 0; int kuniSyogyo = 0; int kuniId = int.Parse(mySeiryokuList[i]); string temp = "kuni" + mySeiryokuList[i]; string clearedKuni = PlayerPrefs.GetString(temp); //Shiro Qty if (clearedKuni != null && clearedKuni != "") { List <string> shiroList = new List <string>(); shiroList = new List <string>(clearedKuni.Split(delimiterChars)); shiro = shiroList.Count; //Kuni Name Entity_kuni_mst kuniMst = Resources.Load("Data/kuni_mst") as Entity_kuni_mst; kuniName = kuniMst.param[kuniId - 1].kuniName; string naiseiTemp = "naisei" + mySeiryokuList[i]; string naiseiString = PlayerPrefs.GetString(naiseiTemp); if (PlayerPrefs.HasKey(naiseiTemp)) { List <string> naiseiList = new List <string>(); naiseiList = new List <string>(naiseiString.Split(delimiterChars)); char[] delimiterChars2 = { ':' }; List <string> deletePanelList = new List <string>(); for (int j = 1; j < naiseiList.Count; j++) { List <string> naiseiContentList = new List <string>(); naiseiContentList = new List <string>(naiseiList[j].Split(delimiterChars2)); if (naiseiContentList[0] != "0") { //Exist Entity_naisei_mst naiseiMst = Resources.Load("Data/naisei_mst") as Entity_naisei_mst; string type = naiseiMst.param [int.Parse(naiseiContentList[0])].code; naiseiBldg = naiseiBldg + 1; //Effect by Level List <int> naiseiEffectList = new List <int>(); NaiseiController naisei = new NaiseiController(); naiseiEffectList = naisei.getNaiseiList(type, int.Parse(naiseiContentList[1])); //Status if (type == "shop") { kuniSyogyo = kuniSyogyo + naiseiEffectList[0]; } else if (type == "kzn") { kuniKozan = kuniKozan + naiseiEffectList[0]; } else if (type == "ta") { nogyo = nogyo + naiseiEffectList[0]; totalHyourou = totalHyourou + naiseiEffectList[0]; } else if (type == "yr") { if (int.Parse(naiseiContentList[1]) < 11) { //Low gunjyu = gunjyu + naiseiEffectList[0]; totalYRL = totalYRL + naiseiEffectList[0]; } else if (int.Parse(naiseiContentList[1]) < 16) { //Middle gunjyu = gunjyu + naiseiEffectList[0]; totalYRM = totalYRM + naiseiEffectList[0]; } else if (15 <= int.Parse(naiseiContentList[1])) { //High gunjyu = gunjyu + naiseiEffectList[0]; totalYRH = totalYRH + naiseiEffectList[0]; } } else if (type == "kb") { if (int.Parse(naiseiContentList[1]) < 11) { //Low gunjyu = gunjyu + naiseiEffectList[0]; totalKBL = totalKBL + naiseiEffectList[0]; } else if (int.Parse(naiseiContentList[1]) < 16) { //Middle gunjyu = gunjyu + naiseiEffectList[0]; totalKBM = totalKBM + naiseiEffectList[0]; } else if (15 <= int.Parse(naiseiContentList[1])) { //High gunjyu = gunjyu + naiseiEffectList[0]; totalKBH = totalKBH + naiseiEffectList[0]; } } else if (type == "ym") { if (int.Parse(naiseiContentList[1]) < 11) { //Low gunjyu = gunjyu + naiseiEffectList[0]; totalYML = totalYML + naiseiEffectList[0]; } else if (int.Parse(naiseiContentList[1]) < 16) { //Middle gunjyu = gunjyu + naiseiEffectList[0]; totalYMM = totalYMM + naiseiEffectList[0]; } else if (15 <= int.Parse(naiseiContentList[1])) { //High gunjyu = gunjyu + naiseiEffectList[0]; totalYMH = totalYMH + naiseiEffectList[0]; } } else if (type == "tp") { if (int.Parse(naiseiContentList[1]) < 11) { //Low gunjyu = gunjyu + naiseiEffectList[0]; totalTPL = totalTPL + naiseiEffectList[0]; } else if (int.Parse(naiseiContentList[1]) < 16) { //Middle gunjyu = gunjyu + naiseiEffectList[0]; totalTPM = totalTPM + naiseiEffectList[0]; } else if (15 <= int.Parse(naiseiContentList[1])) { //High gunjyu = gunjyu + naiseiEffectList[0]; totalTPH = totalTPH + naiseiEffectList[0]; } } else if (type == "snb") { if (int.Parse(naiseiContentList[1]) < 11) { //Low gunjyu = gunjyu + naiseiEffectList[0]; totalSNBL = totalSNBL + naiseiEffectList[0]; } else if (int.Parse(naiseiContentList[1]) < 16) { //Middle gunjyu = gunjyu + naiseiEffectList[0]; totalSNBM = totalSNBM + naiseiEffectList[0]; } else if (15 <= int.Parse(naiseiContentList[1])) { //High gunjyu = gunjyu + naiseiEffectList[0]; totalSNBH = totalSNBH + naiseiEffectList[0]; } } else if (type == "trd") { boubi = boubi + naiseiEffectList[0]; } else if (type == "nbn") { kirisuto = kirisuto + naiseiEffectList[0]; } else if (type == "kgy") { bunka = bunka + naiseiEffectList [0]; } else if (type == "bky") { bukkyo = bukkyo + naiseiEffectList [0]; } else if (type == "hsy") { ashigaru = ashigaru + naiseiEffectList [0]; } } } //Shiro int shiroLv = int.Parse(naiseiList[0]); NaiseiController naise = new NaiseiController(); List <int> naiseiShiroEffectList = new List <int>(); naiseiShiroEffectList = naise.getNaiseiList("shiro", shiroLv); ashigaru = ashigaru + naiseiShiroEffectList[0]; boubi = boubi + naiseiShiroEffectList[0]; //Jyosyu Addition string jyosyuTemp = "jyosyu" + kuniId; if (PlayerPrefs.HasKey(jyosyuTemp)) { int jyosyuId = PlayerPrefs.GetInt(jyosyuTemp); StatusGet sts = new StatusGet(); int lv = PlayerPrefs.GetInt(jyosyuId.ToString()); float naiseiSts = (float)sts.getDfc(jyosyuId, lv); float hpSts = (float)sts.getHp(jyosyuId, lv); float atkSts = (float)sts.getAtk(jyosyuId, lv); float tempKuniSyogyo = (float)kuniSyogyo; tempKuniSyogyo = tempKuniSyogyo + (tempKuniSyogyo * naiseiSts / 200); kuniSyogyo = (int)tempKuniSyogyo; float tempKuniKozan = (float)kuniKozan; tempKuniKozan = tempKuniKozan + (tempKuniKozan * naiseiSts / 200); kuniKozan = (int)tempKuniKozan; } } } kozanMoney = kozanMoney + kuniKozan; totalMoney = totalMoney + kuniSyogyo; syogyo = syogyo + (kuniKozan * 4 + kuniSyogyo); }//Kuni Loop Finish /*visualize*/ //Upper Board GameObject spring = CyosyuObj.transform.FindChild("spring").gameObject; spring.transform.FindChild("TargetMoney").transform.FindChild("Value").GetComponent <Text>().text = (totalMoney + kozanMoney).ToString(); GameObject summerWinter = CyosyuObj.transform.FindChild("summerWinter").gameObject; summerWinter.transform.FindChild("TargetMoney").transform.FindChild("Value").GetComponent <Text>().text = kozanMoney.ToString(); GameObject TargetGunjyu = summerWinter.transform.FindChild("TargetGunjyu").gameObject; if (totalYRH != 0) { TargetGunjyu.transform.FindChild("YR").transform.FindChild("CyouheiYRValueH").GetComponent <Text>().text = totalYRH.ToString(); } if (totalYRM != 0) { TargetGunjyu.transform.FindChild("YR").transform.FindChild("CyouheiYRValueM").GetComponent <Text>().text = totalYRM.ToString(); } if (totalYRL != 0) { TargetGunjyu.transform.FindChild("YR").transform.FindChild("CyouheiYRValueL").GetComponent <Text>().text = totalYRL.ToString(); } if (totalKBH != 0) { TargetGunjyu.transform.FindChild("KB").transform.FindChild("CyouheiKBValueH").GetComponent <Text>().text = totalKBH.ToString(); } if (totalKBM != 0) { TargetGunjyu.transform.FindChild("KB").transform.FindChild("CyouheiKBValueM").GetComponent <Text>().text = totalKBM.ToString(); } if (totalKBL != 0) { TargetGunjyu.transform.FindChild("KB").transform.FindChild("CyouheiKBValueL").GetComponent <Text>().text = totalKBL.ToString(); } if (totalYMH != 0) { TargetGunjyu.transform.FindChild("YM").transform.FindChild("CyouheiYMValueH").GetComponent <Text>().text = totalYMH.ToString(); } if (totalYMM != 0) { TargetGunjyu.transform.FindChild("YM").transform.FindChild("CyouheiYMValueM").GetComponent <Text>().text = totalYMM.ToString(); } if (totalYML != 0) { TargetGunjyu.transform.FindChild("YM").transform.FindChild("CyouheiYMValueL").GetComponent <Text>().text = totalYML.ToString(); } if (totalTPH != 0) { TargetGunjyu.transform.FindChild("TP").transform.FindChild("CyouheiTPValueH").GetComponent <Text>().text = totalTPH.ToString(); } if (totalTPM != 0) { TargetGunjyu.transform.FindChild("TP").transform.FindChild("CyouheiTPValueM").GetComponent <Text>().text = totalTPM.ToString(); } if (totalTPL != 0) { TargetGunjyu.transform.FindChild("TP").transform.FindChild("CyouheiTPValueL").GetComponent <Text>().text = totalTPL.ToString(); } if (totalSNBH != 0) { TargetGunjyu.transform.FindChild("SNB").transform.FindChild("SNBValueH").GetComponent <Text>().text = totalSNBH.ToString(); } if (totalSNBM != 0) { TargetGunjyu.transform.FindChild("SNB").transform.FindChild("SNBValueM").GetComponent <Text>().text = totalSNBM.ToString(); } if (totalSNBL != 0) { TargetGunjyu.transform.FindChild("SNB").transform.FindChild("SNBValueL").GetComponent <Text>().text = totalSNBL.ToString(); } GameObject autumn = CyosyuObj.transform.FindChild("autumn").gameObject; autumn.transform.FindChild("TargetMoney").transform.FindChild("Value").GetComponent <Text>().text = kozanMoney.ToString(); autumn.transform.FindChild("TargetHyourou").transform.FindChild("Value").GetComponent <Text>().text = totalHyourou.ToString(); //Color int nowSeason = MainStageController.nowSeason; if (nowSeason == 1) { summerWinter.transform.FindChild("summer").gameObject.AddComponent <TextBlinker>(); } else if (nowSeason == 2) { autumn.transform.FindChild("autumn").gameObject.AddComponent <TextBlinker>(); } else if (nowSeason == 3) { summerWinter.transform.FindChild("winter").gameObject.AddComponent <TextBlinker>(); } else if (nowSeason == 4) { spring.transform.FindChild("spring").gameObject.AddComponent <TextBlinker>(); } //Lower Board GameObject status = CyosyuObj.transform.FindChild("statusBack").gameObject; //Kamon string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + myDaimyoId.ToString(); GameObject kamon = status.transform.FindChild("Kamon").gameObject; kamon.GetComponent <Image> ().sprite = Resources.Load(imagePath, typeof(Sprite)) as Sprite; if (Application.systemLanguage == SystemLanguage.Japanese) { kamon.transform.FindChild("Value").GetComponent <Text> ().text = GameObject.Find("DaimyoValue").GetComponent <Text> ().text + " 国状況"; } else { kamon.transform.FindChild("Value").GetComponent <Text>().text = GameObject.Find("DaimyoValue").GetComponent <Text>().text + " Status"; } //Kuni status.transform.FindChild("Shiro").transform.FindChild("No").GetComponent <Text>().text = mySeiryokuList.Count.ToString(); //Naisei Bldg. status.transform.FindChild("Naisei").transform.FindChild("No").GetComponent <Text>().text = (naiseiBldg + mySeiryokuList.Count).ToString(); //Tabibito int tabibitoQty = PlayerPrefs.GetInt("HstTabibito"); status.transform.FindChild("Tabibito").transform.FindChild("No").GetComponent <Text>().text = tabibitoQty.ToString(); //Nanbansen int nanbansenQty = PlayerPrefs.GetInt("HstNanbansen"); status.transform.FindChild("Ship").transform.FindChild("No").GetComponent <Text>().text = nanbansenQty.ToString(); //Syogyo status.transform.FindChild("StatusSyogyo").transform.FindChild("SyogyoValue").GetComponent <Text>().text = syogyo.ToString(); //Nogyo status.transform.FindChild("StatusNougyo").transform.FindChild("NougyoValue").GetComponent <Text>().text = nogyo.ToString(); //Gunjyu status.transform.FindChild("StatusGunjyu").transform.FindChild("GunjyuValue").GetComponent <Text>().text = (gunjyu * 2).ToString(); //Ashigaru status.transform.FindChild("StatusAshigaru").transform.FindChild("AshigaruValue").GetComponent <Text>().text = ashigaru.ToString(); //Boubi status.transform.FindChild("StatusBoubi").transform.FindChild("BoubiValue").GetComponent <Text>().text = boubi.ToString(); //Bukkyo status.transform.FindChild("StatusBukkyo").transform.FindChild("BukkyoValue").GetComponent <Text>().text = bukkyo.ToString(); //Kirisuto status.transform.FindChild("StatusKirisuto").transform.FindChild("KirisutoValue").GetComponent <Text>().text = kirisuto.ToString(); //Bunka status.transform.FindChild("StatusBunka").transform.FindChild("BunkaValue").GetComponent <Text>().text = bunka.ToString(); //tutorial if (Application.loadedLevelName == "tutorialMain") { Destroy(transform.FindChild("point_up").gameObject); TutorialController TutorialController = new TutorialController(); Vector2 vect = new Vector2(0, 50); GameObject closeObj = popup.transform.FindChild("close").gameObject; GameObject animObj = TutorialController.SetPointer(closeObj, vect); animObj.transform.localScale = new Vector2(120, 120); GameObject SubButtonViewLeft = GameObject.Find("SubButtonViewLeft").gameObject; GameObject.Find("SeiryokuInfo").transform.SetParent(SubButtonViewLeft.transform); } }
public void OnClick () { //Initialization totalMoney = 0; totalHyourou = 0; totalYRL = 0; totalKBL = 0; totalYML = 0; totalTPL = 0; totalYRM = 0; totalKBM = 0; totalYMM = 0; totalTPM = 0; totalYRH = 0; totalKBH = 0; totalYMH = 0; totalTPH = 0; /*Popup*/ string backPath = "Prefabs/Busyo/back"; GameObject back = Instantiate (Resources.Load (backPath)) as GameObject; back.transform.SetParent(GameObject.Find ("Map").transform); back.transform.localScale = new Vector2 (1, 1); RectTransform backTransform = back.GetComponent<RectTransform> (); backTransform.anchoredPosition = new Vector3 (0, 0, 0); //Popup Screen string popupPath = "Prefabs/Busyo/board"; GameObject popup = Instantiate (Resources.Load (popupPath)) as GameObject; popup.transform.SetParent(GameObject.Find ("Map").transform); popup.transform.localScale = new Vector2 (1, 1); RectTransform popupTransform = popup.GetComponent<RectTransform> (); popupTransform.anchoredPosition = new Vector3 (0, 0, 0); popup.name = "board"; //Pop text string popTextPath = "Prefabs/Busyo/popText"; GameObject popText = Instantiate (Resources.Load (popTextPath)) as GameObject; popText.transform.SetParent(popup.transform); popText.transform.localScale = new Vector2 (0.35f, 0.35f); RectTransform popTextTransform = popText.GetComponent<RectTransform> (); popTextTransform.anchoredPosition = new Vector3 (0, 260, 0); popText.name = "popText"; popText.GetComponent<Text> ().text = "内政状況"; //Scroll View string scrollPath = "Prefabs/Map/seiryoku/KuniScrollView"; GameObject scroll = Instantiate (Resources.Load (scrollPath)) as GameObject; scroll.transform.SetParent(popup.transform); scroll.transform.localScale = new Vector2 (1, 1); scroll.name = "KuniScrollView"; RectTransform scrollTransform = scroll.GetComponent<RectTransform> (); scrollTransform.anchoredPosition = new Vector3 (0, -80, 0); //Header string headerPath = "Prefabs/Map/seiryoku/GetTargetBack"; GameObject header = Instantiate (Resources.Load (headerPath)) as GameObject; header.transform.SetParent(popup.transform); header.transform.localScale = new Vector2 (1, 1); header.name = "GetTargetBack"; RectTransform headerTransform = header.GetComponent<RectTransform> (); headerTransform.anchoredPosition = new Vector3 (0, 185, 0); //Button string btnPath = "Prefabs/Map/seiryoku/GetAllShigenBtn"; GameObject btn = Instantiate (Resources.Load (btnPath)) as GameObject; btn.transform.SetParent(popup.transform); btn.transform.localScale = new Vector2 (1, 1); btn.name = "GetAllShigenBtn"; RectTransform btnTransform = btn.GetComponent<RectTransform> (); btnTransform.anchoredPosition = new Vector3 (420, 185, 0); /*Slot Preparation*/ //Check Open Kuni string openKuniString = PlayerPrefs.GetString ("openKuni"); char[] delimiterChars = {','}; List<string> openKuniList = new List<string> (); if (openKuniString.Contains (",")) { openKuniList = new List<string> (openKuniString.Split (delimiterChars)); } else { openKuniList.Add(openKuniString); } for (int i=0; i<openKuniList.Count; i++) { int kuniId = int.Parse(openKuniList[i]); string temp = "kuni" + openKuniList[i]; string clearedKuni = PlayerPrefs.GetString (temp); //Shiro Qty if(clearedKuni != null && clearedKuni != ""){ List<string> shiroList = new List<string>(); shiroList = new List<string>(clearedKuni.Split (delimiterChars)); shiro = shiroList.Count; //Kuni Name Entity_kuni_mst kuniMst = Resources.Load ("Data/kuni_mst") as Entity_kuni_mst; kuniName = kuniMst.param[kuniId-1].kuniName; string naiseiTemp = "naisei" + openKuniList[i]; string naiseiString = PlayerPrefs.GetString (naiseiTemp); if (PlayerPrefs.HasKey (naiseiTemp)) { int syogyo = 0; int nogyo = 0; int gunjyuYRL = 0; int gunjyuYRM = 0; int gunjyuYRH = 0; int gunjyuKBL = 0; int gunjyuKBM = 0; int gunjyuKBH = 0; int gunjyuYML = 0; int gunjyuYMM = 0; int gunjyuYMH = 0; int gunjyuTPL = 0; int gunjyuTPM = 0; int gunjyuTPH = 0; List<string> naiseiList = new List<string>(); naiseiList = new List<string>(naiseiString.Split (delimiterChars)); char[] delimiterChars2 = {':'}; List<string> deletePanelList = new List<string>(); for(int j=1; j<naiseiList.Count;j++){ List<string> naiseiContentList = new List<string>(); naiseiContentList = new List<string>(naiseiList[j].Split (delimiterChars2)); if(naiseiContentList[0] != "0"){ //Exist Entity_naisei_mst naiseiMst = Resources.Load ("Data/naisei_mst") as Entity_naisei_mst; string type = naiseiMst.param [int.Parse(naiseiContentList[0])].code; //Effect by Level List<int> naiseiEffectList = new List<int>(); NaiseiController naisei = new NaiseiController(); naiseiEffectList = naisei.getNaiseiList(type, int.Parse(naiseiContentList[1])); //Status if(type == "shop" || type == "kouzan"){ syogyo = syogyo + naiseiEffectList[0]; totalMoney = totalMoney + naiseiEffectList[0]; }else if(type == "ta"){ nogyo = nogyo + naiseiEffectList[0]; totalHyourou = totalHyourou + naiseiEffectList[0]; }else if(type == "yr"){ if(int.Parse(naiseiContentList[1])<9){ //Low gunjyuYRL = gunjyuYRL + naiseiEffectList[0]; totalYRL = totalYRL + naiseiEffectList[0]; }else if(int.Parse(naiseiContentList[1]) < 15){ //Middle gunjyuYRM = gunjyuYRM + naiseiEffectList[0]; totalYRM = totalYRM + naiseiEffectList[0]; }else if(15 <= int.Parse(naiseiContentList[1])){ //High gunjyuYRH = gunjyuYRH + naiseiEffectList[0]; totalYRH = totalYRH + naiseiEffectList[0]; } }else if(type == "kb"){ if(int.Parse(naiseiContentList[1])<9){ //Low gunjyuKBL = gunjyuKBL + naiseiEffectList[0]; totalKBL = totalKBL + naiseiEffectList[0]; }else if(int.Parse(naiseiContentList[1]) < 15){ //Middle gunjyuKBM = gunjyuKBM + naiseiEffectList[0]; totalKBM = totalKBM + naiseiEffectList[0]; }else if(15 <= int.Parse(naiseiContentList[1])){ //High gunjyuKBH = gunjyuKBH + naiseiEffectList[0]; totalKBH = totalKBH + naiseiEffectList[0]; } }else if(type == "ym"){ if(int.Parse(naiseiContentList[1])<9){ //Low gunjyuYML = gunjyuYML + naiseiEffectList[0]; totalYML = totalYML + naiseiEffectList[0]; }else if(int.Parse(naiseiContentList[1]) < 15){ //Middle gunjyuYMM = gunjyuYMM + naiseiEffectList[0]; totalYMM = totalYMM + naiseiEffectList[0]; }else if(15 <= int.Parse(naiseiContentList[1])){ //High gunjyuYMH = gunjyuYMH + naiseiEffectList[0]; totalYMH = totalYMH + naiseiEffectList[0]; } }else if(type == "tp"){ if(int.Parse(naiseiContentList[1])<9){ //Low gunjyuTPL = gunjyuTPL + naiseiEffectList[0]; totalTPL = totalTPL + naiseiEffectList[0]; }else if(int.Parse(naiseiContentList[1]) < 15){ //Middle gunjyuTPM = gunjyuTPM + naiseiEffectList[0]; totalTPM = totalTPM + naiseiEffectList[0]; }else if(15 <= int.Parse(naiseiContentList[1])){ //High gunjyuTPH = gunjyuTPH + naiseiEffectList[0]; totalTPH = totalTPH + naiseiEffectList[0]; } } } } //Make Slot string slotPath = "Prefabs/Map/seiryoku/KuniSlot"; GameObject kuniSlot = Instantiate (Resources.Load (slotPath)) as GameObject; kuniSlot.transform.SetParent(GameObject.Find ("Content").transform); kuniSlot.transform.localScale = new Vector2 (1, 1); kuniSlot.name = "KuniSlot" + kuniId; //Jyosyu Addition string jyosyuTemp = "jyosyu" + kuniId; if (PlayerPrefs.HasKey (jyosyuTemp)) { int jyosyuId = PlayerPrefs.GetInt (jyosyuTemp); StatusGet sts = new StatusGet(); int lv = PlayerPrefs.GetInt (jyosyuId.ToString()); float naiseiSts = (float)sts.getDfc(jyosyuId,lv); float hpSts = (float)sts.getHp(jyosyuId,lv); float atkSts = (float)sts.getAtk(jyosyuId,lv); float tempSyogyo = (float)syogyo; tempSyogyo = tempSyogyo + (tempSyogyo * naiseiSts/200); float tempNogyo = (float)nogyo; tempNogyo = tempNogyo + (tempNogyo * naiseiSts/200); syogyo = (int)tempSyogyo; nogyo = (int)tempNogyo; } kuniSlot.transform.FindChild("KuniNameBack").transform.FindChild("KuniNameValue").GetComponent<Text>().text = kuniName; kuniSlot.transform.FindChild("Shiro").transform.FindChild("ShiroValue").GetComponent<Text>().text = shiro.ToString(); kuniSlot.transform.FindChild("Money").transform.FindChild("MoneyValue").GetComponent<Text>().text = syogyo.ToString(); kuniSlot.transform.FindChild("Hyourou").transform.FindChild("HyourouValue").GetComponent<Text>().text = nogyo.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("YR").transform.FindChild("CyouheiYRValueL").GetComponent<Text>().text = gunjyuYRL.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("YR").transform.FindChild("CyouheiYRValueM").GetComponent<Text>().text = gunjyuYRM.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("YR").transform.FindChild("CyouheiYRValueH").GetComponent<Text>().text = gunjyuYRH.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("KB").transform.FindChild("CyouheiKBValueL").GetComponent<Text>().text = gunjyuKBL.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("KB").transform.FindChild("CyouheiKBValueM").GetComponent<Text>().text = gunjyuKBM.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("KB").transform.FindChild("CyouheiKBValueH").GetComponent<Text>().text = gunjyuKBH.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("YM").transform.FindChild("CyouheiYMValueL").GetComponent<Text>().text = gunjyuYML.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("YM").transform.FindChild("CyouheiYMValueM").GetComponent<Text>().text = gunjyuYMM.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("YM").transform.FindChild("CyouheiYMValueH").GetComponent<Text>().text = gunjyuYMH.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("TP").transform.FindChild("CyouheiTPValueL").GetComponent<Text>().text = gunjyuTPL.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("TP").transform.FindChild("CyouheiTPValueM").GetComponent<Text>().text = gunjyuTPM.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("TP").transform.FindChild("CyouheiTPValueH").GetComponent<Text>().text = gunjyuTPH.ToString(); } } }//Kuni Loop Finish //Set Total Amount GameObject btnObj = GameObject.Find ("GetAllShigenBtn").gameObject; btnObj.GetComponent<GetAllShigen> ().totalMoney = totalMoney; btnObj.GetComponent<GetAllShigen> ().totalHyourou = totalHyourou; btnObj.GetComponent<GetAllShigen> ().totalYRL = totalYRL; btnObj.GetComponent<GetAllShigen> ().totalKBL = totalKBL; btnObj.GetComponent<GetAllShigen> ().totalYML = totalYML; btnObj.GetComponent<GetAllShigen> ().totalTPL = totalTPL; btnObj.GetComponent<GetAllShigen> ().totalYRM = totalYRM; btnObj.GetComponent<GetAllShigen> ().totalKBM = totalKBM; btnObj.GetComponent<GetAllShigen> ().totalYMM = totalYMM; btnObj.GetComponent<GetAllShigen> ().totalTPM = totalTPM; btnObj.GetComponent<GetAllShigen> ().totalYRH = totalYRH; btnObj.GetComponent<GetAllShigen> ().totalKBH = totalKBH; btnObj.GetComponent<GetAllShigen> ().totalYMH = totalYMH; btnObj.GetComponent<GetAllShigen> ().totalTPH = totalTPH; }
public void OnClick () { Message msgLine = new Message (); int nowMoney = PlayerPrefs.GetInt ("money"); if (nowMoney < 1000) { string text = "金が不足しておるようですぞ。"; msgLine.makeMessage(text); } else { int nowHyourou = PlayerPrefs.GetInt("hyourou"); if(nowHyourou<10){ string text = "兵糧が不足しておるようですぞ。"; msgLine.makeMessage(text); }else{ //Reduce Money & Hyourou int newMoney = nowMoney - 1000; int newHyourou = nowHyourou - 10; PlayerPrefs.SetInt("money",newMoney); PlayerPrefs.SetInt("hyourou",newHyourou); //Jyosyu Ninmei if (Application.loadedLevelName == "naisei") { kuniId = GameObject.Find ("NaiseiController").GetComponent<NaiseiController> ().activeKuniId; } string temp = "jyosyu" + kuniId; PlayerPrefs.SetInt (temp, int.Parse (busyoId)); //Jyosyu Heiryoku string temp2 = "jyosyuHei" + busyoId; if (Application.loadedLevelName == "naisei") { jyosyuHei = int.Parse (GameObject.Find ("AshigaruValue").GetComponent<Text> ().text); } PlayerPrefs.SetInt (temp2, jyosyuHei); //Jyosyu Busyo for KuniId string temp3 = "jyosyuBusyo" + busyoId; PlayerPrefs.SetInt (temp3, kuniId); PlayerPrefs.Flush (); //Delete Box Destroy (GameObject.Find ("board(Clone)")); Destroy (GameObject.Find ("Back(Clone)")); //Message MessageBusyo msg = new MessageBusyo (); string text = "城主に任命致しました。"; string type = "ninmei"; msg.makeMessage (text, int.Parse (busyoId), type); //Initialization if (Application.loadedLevelName == "naisei") { NaiseiController naisei = new NaiseiController (); naisei.Start (); }else if(Application.loadedLevelName == "busyo"){ SyoguScene syogu = new SyoguScene(); syogu.createSyoguView(busyoId.ToString()); } } } }
public void OnClick() { AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> (); Message msgLine = new Message(); int nowMoney = PlayerPrefs.GetInt("money"); if (nowMoney < 1000) { audioSources [4].Play(); msgLine.makeMessage(msgLine.getMessage(6)); } else { int nowHyourou = PlayerPrefs.GetInt("hyourou"); if (nowHyourou < 10) { audioSources [4].Play(); //msgLine.makeMessage(msgLine.getMessage(7)); msgLine.hyourouMovieMessage(); GameObject.Find("close").GetComponent <CloseBoard>().onClick(); } else { audioSources [3].Play(); //Reduce Money & Hyourou int newMoney = nowMoney - 1000; int newHyourou = nowHyourou - 10; PlayerPrefs.SetInt("money", newMoney); PlayerPrefs.SetInt("hyourou", newHyourou); //Jyosyu Ninmei if (Application.loadedLevelName == "naisei") { kuniId = GameObject.Find("NaiseiController").GetComponent <NaiseiController> ().activeKuniId; } string temp = "jyosyu" + kuniId; PlayerPrefs.SetInt(temp, int.Parse(busyoId)); //Jyosyu Heiryoku string temp2 = "jyosyuHei" + busyoId; if (Application.loadedLevelName == "naisei") { jyosyuHei = int.Parse(GameObject.Find("AshigaruValue").GetComponent <Text> ().text); } PlayerPrefs.SetInt(temp2, jyosyuHei); //Track int TrackJyosyuNinmeiNo = PlayerPrefs.GetInt("TrackJyosyuNinmeiNo", 0); TrackJyosyuNinmeiNo = TrackJyosyuNinmeiNo + 1; PlayerPrefs.SetInt("TrackJyosyuNinmeiNo", TrackJyosyuNinmeiNo); //Jyosyu Busyo for KuniId string temp3 = "jyosyuBusyo" + busyoId; PlayerPrefs.SetInt(temp3, kuniId); PlayerPrefs.SetBool("questSpecialFlg9", true); PlayerPrefs.Flush(); //Delete Box Destroy(GameObject.Find("board(Clone)")); Destroy(GameObject.Find("Back(Clone)")); //Message MessageBusyo msg = new MessageBusyo(); string text = msgLine.getMessage(88); string type = "ninmei"; msg.makeMessage(text, int.Parse(busyoId), type); //Initialization if (Application.loadedLevelName == "naisei") { NaiseiController naisei = new NaiseiController(); naisei.Start(); } else if (Application.loadedLevelName == "busyo") { SyoguScene syogu = new SyoguScene(); syogu.createSyoguView(busyoId.ToString()); } } } }
public void OnClick() { AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> (); if (name == "YesButton") { //Destroy audioSources [6].Play(); string temp = "naisei" + activeKuniId.ToString(); if (PlayerPrefs.HasKey(temp)) { //Get Data string naiseiString = PlayerPrefs.GetString(temp); List <string> naiseiList = new List <string>(); char[] delimiterChars = { ',' }; naiseiList = new List <string>(naiseiString.Split(delimiterChars)); string targetValue = "0:0"; naiseiList[areaId] = targetValue; //Remake string string newNaiseiString = ""; for (int i = 0; i < naiseiList.Count; i++) { if (i + 1 != naiseiList.Count) { newNaiseiString = newNaiseiString + naiseiList[i] + ","; } else { newNaiseiString = newNaiseiString + naiseiList[i]; } } PlayerPrefs.SetString(temp, newNaiseiString); PlayerPrefs.Flush(); Message msg = new Message(); msg.makeMessage(msg.getMessage(118)); //Close Tab GameObject.Find("close").GetComponent <CloseBoard> ().onClick(); //Initialization NaiseiController naisei = new NaiseiController(); naisei.Start(); //Animation GameObject naiseiView = GameObject.Find("NaiseiView").gameObject; Vector2 areaPosition = naiseiView.transform.FindChild(areaId.ToString()).transform.localPosition; string animPath = "Prefabs/Naisei/DestroyAnim"; GameObject destroyObj = Instantiate(Resources.Load(animPath)) as GameObject; destroyObj.transform.SetParent(naiseiView.transform); destroyObj.transform.localScale = new Vector2(200, 100); destroyObj.transform.localPosition = new Vector2(areaPosition.x + 10, areaPosition.y + 65); } } else if (name == "NoButton") { //Close audioSources [1].Play(); GameObject.Find("TouchBack").GetComponent <CloseBoard>().onClick(); } }
public void OnClick(){ BusyoStatusButton bsb = new BusyoStatusButton (); if (name == "kanni") { if(kanniId ==0){ string myKanni = PlayerPrefs.GetString("myKanni"); if(myKanni != null && myKanni !=""){ bsb.commonPopup (); GameObject.Find ("popText").GetComponent<Text> ().text ="官位一覧"; string scrollPath = "Prefabs/Busyo/KanniScrollView"; GameObject scroll = Instantiate (Resources.Load (scrollPath)) as GameObject; scroll.transform.SetParent(GameObject.Find ("board(Clone)").transform); scroll.transform.localScale = new Vector2 (1, 1); scroll.name = "KanniScrollView"; RectTransform scrollTransform = scroll.GetComponent<RectTransform> (); scrollTransform.anchoredPosition3D = new Vector3 (0, 0, 0); List<string> myKanniList = new List<string> (); if(myKanni.Contains(",")){ char[] delimiterChars = {','}; myKanniList = new List<string> (myKanni.Split (delimiterChars)); }else{ myKanniList.Add(myKanni); } myKanniList.Sort(); string pathSlot = "Prefabs/Busyo/KanniSlot"; Kanni kanni = new Kanni(); GameObject content = scroll.transform.FindChild("KanniContent").gameObject; for(int i=0; i<myKanniList.Count; i++){ GameObject slot = Instantiate (Resources.Load (pathSlot)) as GameObject; slot.transform.SetParent(content.transform); slot.transform.localScale = new Vector2 (1, 1); int kanniIdTmp = int.Parse(myKanniList[i]); string kanniName = kanni.getKanni(kanniIdTmp); string kanniIkai = kanni.getIkai(kanniIdTmp); string EffectLabel = kanni.getEffectLabel(kanniIdTmp); int effect = kanni.getEffect(kanniIdTmp); slot.transform.FindChild("Name").GetComponent<Text>().text = kanniIkai + "\t" + kanniName; slot.transform.FindChild("EffectLabel").GetComponent<Text>().text = EffectLabel; slot.transform.FindChild("EffectValue").GetComponent<Text>().text = "+" + effect.ToString() + "%"; GameObject btn = slot.transform.FindChild("GiveButton").gameObject; btn.GetComponent<GiveKanni>().busyoId = busyoId; btn.GetComponent<GiveKanni>().kanniId = kanniIdTmp; } }else{ Message msg = new Message(); msg.makeMessage("官位を持っておりませんぞ。\n山城国にある朝廷を訪れてみましょう。"); } }else{ string backPath = "Prefabs/Busyo/back"; GameObject back = Instantiate (Resources.Load (backPath)) as GameObject; back.transform.SetParent(GameObject.Find ("Panel").transform); back.transform.localScale = new Vector2 (1, 1); RectTransform backTransform = back.GetComponent<RectTransform> (); backTransform.anchoredPosition3D = new Vector3 (0, 0, 0); string removePath = "Prefabs/Busyo/KanniRemoveConfirm"; GameObject remove = Instantiate (Resources.Load (removePath)) as GameObject; remove.transform.SetParent(GameObject.Find ("Panel").transform); remove.transform.localScale = new Vector2 (1, 1); remove.transform.localPosition = new Vector3(0,0,0); remove.name = "KanniRemoveConfirm"; BusyoInfoGet busyo = new BusyoInfoGet(); string busyoName = busyo.getName(int.Parse(busyoId)); remove.transform.FindChild("YesButton").GetComponent<DoRemoveKanni>().busyoId = busyoId; remove.transform.FindChild("RemoveText").GetComponent<Text>().text = busyoName + "殿の官位を\n罷免なさるのですか?"; } }else if(name == "jyosyu"){ if(jyosyuKuniId ==0){ //Available Kuni string openKuniString = PlayerPrefs.GetString ("openKuni"); char[] delimiterChars = {','}; List<string> openKuniList = new List<string> (); if (openKuniString.Contains (",")) { openKuniList = new List<string> (openKuniString.Split (delimiterChars)); } else { openKuniList.Add(openKuniString); } List<string> okKuniList = new List<string> (); for (int i=0; i<openKuniList.Count; i++) { int kuniId = int.Parse(openKuniList[i]); string temp = "kuni" + kuniId.ToString(); string clearedKuni = PlayerPrefs.GetString (temp); //Shiro Qty if(clearedKuni != null && clearedKuni != ""){ //Jyosyu Exist Check string jyosyuTmp = "jyosyu" + kuniId.ToString(); if(!PlayerPrefs.HasKey(jyosyuTmp)){ okKuniList.Add(kuniId.ToString()); } } } if(okKuniList.Count != 0){ bsb.commonPopup (); GameObject.Find ("popText").GetComponent<Text> ().text ="国一覧"; string scrollPath = "Prefabs/Busyo/KanniScrollView"; GameObject scroll = Instantiate (Resources.Load (scrollPath)) as GameObject; scroll.transform.SetParent(GameObject.Find ("board(Clone)").transform); scroll.transform.localScale = new Vector2 (1, 1); scroll.name = "KanniScrollView"; RectTransform scrollTransform = scroll.GetComponent<RectTransform> (); scrollTransform.anchoredPosition3D = new Vector3 (0, 0, 0); string pathSlot = "Prefabs/Busyo/ShiroSlot"; GameObject content = scroll.transform.FindChild("KanniContent").gameObject; KuniInfo kuni = new KuniInfo(); for(int i=0; i<okKuniList.Count; i++){ GameObject slot = Instantiate (Resources.Load (pathSlot)) as GameObject; slot.transform.SetParent(content.transform); slot.transform.localScale = new Vector2 (1, 1); int kuniId = int.Parse(okKuniList[i]); string kuniName = kuni.getKuniName(kuniId); slot.transform.FindChild("Name").GetComponent<Text>().text = kuniName; //Status int jyosyuHei = 0; string naiseiTemp = "naisei" + kuniId.ToString(); string naiseiString = PlayerPrefs.GetString (naiseiTemp); List<string> naiseiList = new List<string>(); naiseiList = new List<string>(naiseiString.Split (delimiterChars)); char[] delimiterChars2 = {':'}; Entity_naisei_mst naiseiMst = Resources.Load ("Data/naisei_mst") as Entity_naisei_mst; NaiseiController naisei = new NaiseiController(); string shiroLv = naiseiList[0]; List<int> shiroEffectList = new List<int>(); shiroEffectList = naisei.getNaiseiList("shiro", int.Parse(shiroLv)); jyosyuHei = shiroEffectList[0]; for(int j=1; j<naiseiList.Count;j++){ List<string> naiseiContentList = new List<string>(); naiseiContentList = new List<string>(naiseiList[j].Split (delimiterChars2)); if(naiseiContentList[0] != "0"){ string type = naiseiMst.param [int.Parse(naiseiContentList[0])].code; if(type == "hsy"){ List<int> naiseiEffectList = new List<int>(); naiseiEffectList = naisei.getNaiseiList(type, int.Parse(naiseiContentList[1])); jyosyuHei = jyosyuHei + naiseiEffectList[0]; } } } slot.transform.FindChild("EffectValue").GetComponent<Text>().text = "+" + jyosyuHei.ToString(); GameObject btn = slot.transform.FindChild("GiveButton").gameObject; btn.GetComponent<DoNinmei>().busyoId = busyoId; btn.GetComponent<DoNinmei>().kuniId = kuniId; btn.GetComponent<DoNinmei>().jyosyuHei = jyosyuHei; } }else{ Message msg = new Message(); msg.makeMessage("任命可能な国はありませんぞ。\nまずは城を落としなされ。"); } }else{ string backPath = "Prefabs/Common/TouchBack"; GameObject back = Instantiate (Resources.Load (backPath)) as GameObject; back.transform.SetParent(GameObject.Find ("Panel").transform); back.transform.localScale = new Vector2 (1, 1); RectTransform backTransform = back.GetComponent<RectTransform> (); backTransform.anchoredPosition3D = new Vector3 (0, 0, 0); back.name = "TouchBack"; //Message Box string msgPath = "Prefabs/Naisei/KaininConfirm"; GameObject msg = Instantiate (Resources.Load (msgPath)) as GameObject; msg.transform.SetParent(back.transform); msg.transform.localScale = new Vector2 (1, 1); RectTransform msgTransform = msg.GetComponent<RectTransform> (); msgTransform.anchoredPosition3D = new Vector3 (0, 0, 0); msgTransform.name = "kaininConfirm"; msg.transform.FindChild("YesButton").GetComponent<DoKainin>().kuniId = jyosyuKuniId; //Message Text Mod GameObject msgObj = msg.transform.FindChild ("KaininText").gameObject; int myDaimyoBusyo = PlayerPrefs.GetInt ("myDaimyoBusyo"); string msgText = msgObj.GetComponent<Text> ().text; if (myDaimyoBusyo == int.Parse(busyoId)) { msgText = msgText.Replace("A殿を", "自らを"); } else { msgText = msgText.Replace("A", jyosyuName); } msgObj.GetComponent<Text> ().text = msgText; } } }
// Use this for initialization public void OnClick() { AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> (); //Money Check Message msg = new Message(); int nowMoney = PlayerPrefs.GetInt("money"); int nowHyourou = PlayerPrefs.GetInt("hyourou"); if (nowMoney < requiredMoney) { //Error //Message audioSources [4].Play(); msg.makeMessage(msg.getMessage(6)); } else { if (nowHyourou < requiredHyourou) { //Error audioSources [4].Play(); //msg.makeMessage(msg.getMessage(7)); msg.hyourouMovieMessage(); GameObject.Find("close").GetComponent <CloseBoard>().onClick(); } else { audioSources [3].Play(); activeKuniId = GameObject.Find("NaiseiController").GetComponent <NaiseiController> ().activeKuniId; string temp = "naisei" + activeKuniId.ToString(); //Defalt=> 1,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0 string naiseiString = PlayerPrefs.GetString(temp); List <string> naiseiList = new List <string> (); char[] delimiterChars = { ',' }; naiseiList = new List <string> (naiseiString.Split(delimiterChars)); string newNaiseiString = ""; for (int i = 0; i < naiseiList.Count; i++) { if (i == panelId) { string newParam = naiseiId.ToString() + ":1"; newNaiseiString = newNaiseiString + "," + newParam; } else { if (newNaiseiString == "") { newNaiseiString = naiseiList [i]; } else { newNaiseiString = newNaiseiString + "," + naiseiList [i]; } } } bool tutorialDoneFlg = PlayerPrefs.GetBool("tutorialDoneFlg"); if (!tutorialDoneFlg || Application.loadedLevelName != "tutorialNaisei") { /*Reduce Money & Hyourou*/ //Money int resultMoney = nowMoney - requiredMoney; int resultHyourou = nowHyourou - requiredHyourou; PlayerPrefs.SetInt("money", resultMoney); PlayerPrefs.SetInt("hyourou", resultHyourou); //Track int TrackBuildMoneyNo = PlayerPrefs.GetInt("TrackBuildMoneyNo", 0); TrackBuildMoneyNo = TrackBuildMoneyNo + requiredMoney; PlayerPrefs.SetInt("TrackBuildMoneyNo", TrackBuildMoneyNo); PlayerPrefs.SetString(temp, newNaiseiString); PlayerPrefs.SetBool("questDailyFlg16", true); PlayerPrefs.Flush(); } //Message string OKtext = ""; if (Application.systemLanguage != SystemLanguage.Japanese) { OKtext = "You built " + naiseiName + ".\n The country is thriving."; } else { OKtext = naiseiName + "を建築しましたぞ。\n国が栄えますな。"; } msg.makeMessage(OKtext); //Close Tab if (Application.loadedLevelName == "tutorialNaisei") { Destroy(GameObject.Find("Back(Clone)").gameObject); Destroy(GameObject.Find("board(Clone)").gameObject); PlayerPrefs.SetInt("tutorialId", 3); PlayerPrefs.Flush(); } else { GameObject.Find("close").GetComponent <CloseBoard> ().onClick(); } //Initialization NaiseiController naisei = new NaiseiController(); naisei.Start(); if (Application.loadedLevelName == "tutorialNaisei") { GameObject tBtnObj = GameObject.Find("tButton").gameObject; Destroy(tBtnObj.transform.FindChild("12").gameObject); GameObject NaiseiViewObj = GameObject.Find("NaiseiView").gameObject; GameObject builtObj = NaiseiViewObj.transform.FindChild("12").gameObject; builtObj.transform.SetParent(tBtnObj.transform); builtObj.GetComponent <Button>().enabled = false; } } } }
public void OnClick () { //Money Check Message msg = new Message(); int nowMoney = PlayerPrefs.GetInt ("money"); int nowHyourou = PlayerPrefs.GetInt ("hyourou"); if (nowMoney < requiredMoney) { //Error //Message string Text = "金が不足しております。"; msg.makeMessage (Text); } else { if (nowHyourou < requiredHyourou) { //Error string Text = "兵糧が不足しております。"; msg.makeMessage(Text); } else { //Update string temp = "naisei" + activeKuniId.ToString (); if (PlayerPrefs.HasKey (temp)) { //Money Reduce nowMoney = nowMoney - requiredMoney; PlayerPrefs.SetInt ("money", nowMoney); //Hyourou Reduce nowHyourou = nowHyourou - requiredHyourou; PlayerPrefs.SetInt ("hyourou", nowHyourou); /*Update Lv*/ //Get Data string naiseiString = PlayerPrefs.GetString (temp); List<string> naiseiList = new List<string>(); char[] delimiterChars = {','}; naiseiList = new List<string>(naiseiString.Split (delimiterChars)); //replace vtarget column's value by area id if(areaId.Contains("shiro")){ //shiro naiseiList[0] = targetLv.ToString(); }else{ //the other string targetValue = naiseiId.ToString() + ":" + targetLv.ToString(); naiseiList[int.Parse(areaId)] = targetValue; } //Remake string string newNaiseiString = ""; for(int i=0; i<naiseiList.Count; i++){ if(i+1 != naiseiList.Count){ newNaiseiString = newNaiseiString + naiseiList[i] + ","; }else{ newNaiseiString = newNaiseiString + naiseiList[i]; } } PlayerPrefs.SetString (temp,newNaiseiString); PlayerPrefs.Flush(); }else{ Debug.Log ("no possible error"); } //Message string OKtext = naiseiName + "を開発しましたぞ。\nますます国が栄えますな。"; msg.makeMessage (OKtext); //Close Tab GameObject.Find ("close").GetComponent<CloseBoard> ().onClick (); //Initialization NaiseiController naisei = new NaiseiController (); naisei.Start (); } } }
public void OnClick() { AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> (); //Money Check Message msg = new Message(); int nowMoney = PlayerPrefs.GetInt("money"); int nowHyourou = PlayerPrefs.GetInt("hyourou"); if (nowMoney < requiredMoney) { //Error //Message audioSources [4].Play(); msg.makeMessage(msg.getMessage(6)); } else { if (nowHyourou < requiredHyourou) { //Error audioSources [4].Play(); //msg.makeMessage(msg.getMessage(7)); msg.hyourouMovieMessage(); GameObject.Find("close").GetComponent <CloseBoard>().onClick(); } else { audioSources [3].Play(); //Update //Track int TrackBuildMoneyNo = PlayerPrefs.GetInt("TrackBuildMoneyNo", 0); TrackBuildMoneyNo = TrackBuildMoneyNo + requiredMoney; PlayerPrefs.SetInt("TrackBuildMoneyNo", TrackBuildMoneyNo); string temp = "naisei" + activeKuniId.ToString(); if (PlayerPrefs.HasKey(temp)) { //Money Reduce nowMoney = nowMoney - requiredMoney; PlayerPrefs.SetInt("money", nowMoney); //Hyourou Reduce nowHyourou = nowHyourou - requiredHyourou; PlayerPrefs.SetInt("hyourou", nowHyourou); /*Update Lv*/ //Get Data string naiseiString = PlayerPrefs.GetString(temp); List <string> naiseiList = new List <string>(); char[] delimiterChars = { ',' }; naiseiList = new List <string>(naiseiString.Split(delimiterChars)); //replace vtarget column's value by area id if (areaId.Contains("shiro")) { //shiro naiseiList[0] = targetLv.ToString(); } else { //the other string targetValue = naiseiId.ToString() + ":" + targetLv.ToString(); naiseiList[int.Parse(areaId)] = targetValue; } //Remake string string newNaiseiString = ""; for (int i = 0; i < naiseiList.Count; i++) { if (i + 1 != naiseiList.Count) { newNaiseiString = newNaiseiString + naiseiList[i] + ","; } else { newNaiseiString = newNaiseiString + naiseiList[i]; } } PlayerPrefs.SetString(temp, newNaiseiString); PlayerPrefs.SetBool("questDailyFlg16", true); PlayerPrefs.Flush(); } else { Debug.Log("no possible error"); } //Message string OKtext = ""; if (Application.systemLanguage != SystemLanguage.Japanese) { OKtext = "You upgraded " + naiseiName + ".\n The country is thriving."; } else { OKtext = naiseiName + "を開発しましたぞ。\nますます国が栄えますな。"; } GameObject msgObj = msg.makeMessage(OKtext); //Close Tab GameObject.Find("close").GetComponent <CloseBoard> ().onClick(); //Initialization NaiseiController naisei = new NaiseiController(); naisei.Start(); NaiseiController naiseiObjScript = GameObject.Find("NaiseiController").GetComponent <NaiseiController>(); naiseiObjScript.total = int.Parse(GameObject.Find("Tabibito").transform.FindChild("TabibitoMaxValue").GetComponent <Text>().text); naiseiObjScript.remain = int.Parse(GameObject.Find("Tabibito").transform.FindChild("TabibitoCountDownValue").GetComponent <Text>().text); } } }
// Use this for initialization public void OnClick () { //Money Check Message msg = new Message(); int nowMoney = PlayerPrefs.GetInt ("money"); int nowHyourou = PlayerPrefs.GetInt ("hyourou"); if (nowMoney < requiredMoney) { //Error //Message string Text = "金が不足しております。"; msg.makeMessage(Text); } else { if (nowHyourou < requiredHyourou) { //Error string Text = "兵糧が不足しております。"; msg.makeMessage(Text); } else { activeKuniId = GameObject.Find ("NaiseiController").GetComponent<NaiseiController> ().activeKuniId; string temp = "naisei" + activeKuniId.ToString (); //Defalt=> 1,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0 string naiseiString = PlayerPrefs.GetString (temp); List<string> naiseiList = new List<string> (); char[] delimiterChars = {','}; naiseiList = new List<string> (naiseiString.Split (delimiterChars)); string newNaiseiString = ""; for (int i=0; i<naiseiList.Count; i++) { if (i == panelId) { string newParam = naiseiId.ToString () + ":1"; newNaiseiString = newNaiseiString + "," + newParam; } else { if (newNaiseiString == "") { newNaiseiString = naiseiList [i]; } else { newNaiseiString = newNaiseiString + "," + naiseiList [i]; } } } /*Reduce Money & Hyourou*/ //Money int resultMoney = nowMoney - requiredMoney; int resultHyourou = nowHyourou - requiredHyourou; PlayerPrefs.SetInt("money",resultMoney); PlayerPrefs.SetInt("hyourou",resultHyourou); PlayerPrefs.SetString (temp, newNaiseiString); PlayerPrefs.Flush(); //Message string OKtext = naiseiName + "を建築しましたぞ。\n国が栄えますな。"; msg.makeMessage (OKtext); //Close Tab GameObject.Find ("close").GetComponent<CloseBoard> ().onClick (); //Initialization NaiseiController naisei = new NaiseiController (); naisei.Start (); } } }
public void OnClick() { AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource>(); //Item Check Message msg = new Message(); string tempParam = ""; int qty = 0; if (techId == 1) { tempParam = "transferTP"; } else if (techId == 2) { tempParam = "transferKB"; } else if (techId == 3) { tempParam = "transferSNB"; } qty = PlayerPrefs.GetInt(tempParam); int nowHyourou = PlayerPrefs.GetInt("hyourou"); if (qty < 1) { //Error //Message msg.makeMessage(msg.getMessage(129)); audioSources[4].Play(); } else { if (nowHyourou < requiredHyourou) { //Error msg.makeMessage(msg.getMessage(7)); audioSources[4].Play(); } else { audioSources[3].Play(); activeKuniId = GameObject.Find("NaiseiController").GetComponent <NaiseiController> ().activeKuniId; string temp = "naisei" + activeKuniId.ToString(); //Defalt=> 1,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0 string naiseiString = PlayerPrefs.GetString(temp); List <string> naiseiList = new List <string> (); char[] delimiterChars = { ',' }; naiseiList = new List <string> (naiseiString.Split(delimiterChars)); string newNaiseiString = ""; for (int i = 0; i < naiseiList.Count; i++) { if (i == panelId) { string newParam = naiseiId.ToString() + ":1"; newNaiseiString = newNaiseiString + "," + newParam; } else { if (newNaiseiString == "") { newNaiseiString = naiseiList [i]; } else { newNaiseiString = newNaiseiString + "," + naiseiList [i]; } } } /*Reduce Item & Hyourou*/ //Item int resultItem = qty - 1; int resultHyourou = nowHyourou - requiredHyourou; PlayerPrefs.SetInt(tempParam, resultItem); PlayerPrefs.SetInt("hyourou", resultHyourou); PlayerPrefs.SetString(temp, newNaiseiString); PlayerPrefs.Flush(); //Message string OKtext = ""; if (Application.systemLanguage != SystemLanguage.Japanese) { OKtext = "You built " + naiseiName + ".\n The country is thriving."; } else { OKtext = naiseiName + "を建築しましたぞ。\n国が栄えますな。"; } msg.makeMessage(OKtext); //Close Tab GameObject.Find("close").GetComponent <CloseBoard> ().onClick(); //Initialization NaiseiController naisei = new NaiseiController(); naisei.Start(); } } }