public void showSeiryoku() { /*--------------------*/ /*Show Daimyo Seiryoku*/ /*--------------------*/ Entity_kuni_mst kuniMst = Resources.Load("Data/kuni_mst") as Entity_kuni_mst; Entity_daimyo_mst daimyoMst = Resources.Load("Data/daimyo_mst") as Entity_daimyo_mst; string seiryoku = PlayerPrefs.GetString("seiryoku"); List <string> seiryokuList = new List <string> (); char[] delimiterChars = { ',' }; seiryokuList = new List <string> (seiryoku.Split(delimiterChars)); string kuniPath = "Prefabs/Map/kuni/"; GameObject kuniIconView = GameObject.Find("KuniIconView"); GameObject KuniMap = GameObject.Find("KuniMap"); myDaimyo = PlayerPrefs.GetInt("myDaimyo"); Daimyo daimyo = new Daimyo(); myDaimyoName = daimyo.getName(myDaimyo); string gameClearDaimyo = PlayerPrefs.GetString("gameClearDaimyo"); List <string> gameClearDaimyoList = new List <string> (); if (gameClearDaimyo != null && gameClearDaimyo != "") { if (gameClearDaimyo.Contains(",")) { gameClearDaimyoList = new List <string> (gameClearDaimyo.Split(delimiterChars)); } else { gameClearDaimyoList.Add(gameClearDaimyo); } } for (int i = 0; i < kuniMst.param.Count; i++) { int kuniId = kuniMst.param [i].kunId; string newKuniPath = kuniPath + kuniId.ToString(); int locationX = kuniMst.param [i].locationX; int locationY = kuniMst.param [i].locationY; GameObject kuni = Instantiate(Resources.Load(newKuniPath)) as GameObject; kuni.transform.SetParent(kuniIconView.transform); kuni.name = kuniId.ToString(); kuni.transform.localScale = new Vector2(1, 1); kuni.GetComponent <Button>().enabled = false; //Seiryoku Handling int daimyoId = int.Parse(seiryokuList [kuniId - 1]); string daimyoName = daimyoMst.param [daimyoId - 1].daimyoName; int daimyoBusyoIdTemp = daimyoMst.param [daimyoId - 1].busyoId; //Color Handling float colorR = (float)daimyoMst.param [daimyoId - 1].colorR; float colorG = (float)daimyoMst.param [daimyoId - 1].colorG; float colorB = (float)daimyoMst.param [daimyoId - 1].colorB; Color kuniColor = new Color(colorR / 255f, colorG / 255f, colorB / 255f, 255f / 255f); KuniMap.transform.FindChild(kuni.name).GetComponent <Image> ().color = kuniColor; //Daimyo Kamon Image string imagePath = "Prefabs/Kamon/" + daimyoId.ToString(); kuni.GetComponent <Image> ().sprite = Resources.Load(imagePath, typeof(Sprite)) as Sprite; RectTransform kuniTransform = kuni.GetComponent <RectTransform> (); kuniTransform.anchoredPosition = new Vector3(locationX, locationY, 0); //My daimyo Check if (daimyoId == myDaimyo) { string myDaimyoPath = "Prefabs/Kamon/MyDaimyoKamon/" + myDaimyo.ToString(); kuni.GetComponent <Image> ().sprite = Resources.Load(myDaimyoPath, typeof(Sprite)) as Sprite; } //Clear Flg if (gameClearDaimyoList.Contains(daimyoId.ToString())) { kuni.GetComponent <SendParam> ().clearFlg = true; } } }
public void OnClick() { int hyourou = PlayerPrefs.GetInt("hyourou"); AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> (); if (name == "AtkOrderBtn") { if (hyourou >= 10) { audioSources [0].Play(); //Common //Back string returnPath = "Prefabs/Bakuhu/Return"; GameObject returnObj = Instantiate(Resources.Load(returnPath)) as GameObject; returnObj.transform.SetParent(board.transform); returnObj.transform.localScale = new Vector2(1, 1); returnObj.transform.localPosition = new Vector2(-560, 290); returnObj.name = "bakuhuReturn"; //Disabled scrollView.SetActive(false); //Base Obj string basePath = "Prefabs/Bakuhu/Base"; GameObject baseObj = Instantiate(Resources.Load(basePath)) as GameObject; baseObj.transform.SetParent(board.transform); baseObj.transform.localScale = new Vector2(1, 1); baseObj.name = "BakuhuBase"; returnObj.GetComponent <BakuhuMenuReturn> ().deleteObj = baseObj; returnObj.GetComponent <BakuhuMenuReturn> ().scrollView = scrollView; returnObj.GetComponent <BakuhuMenuReturn> ().board = board; if (Application.systemLanguage != SystemLanguage.Japanese) { board.transform.FindChild("popText").GetComponent <Text> ().text = "Attack Order"; } else { board.transform.FindChild("popText").GetComponent <Text>().text = "討伐令"; } string textPath = "Prefabs/Bakuhu/ToubatsuText"; GameObject textObj = Instantiate(Resources.Load(textPath)) as GameObject; textObj.transform.SetParent(baseObj.transform); textObj.transform.localScale = new Vector2(0.12f, 0.15f); textObj.transform.localPosition = new Vector2(0, 206); textObj.name = "ToubatsuText"; //View daimyo kuni string seiryoku = PlayerPrefs.GetString("seiryoku"); List <string> seiryokuList = new List <string> (); char[] delimiterChars = { ',' }; seiryokuList = new List <string> (seiryoku.Split(delimiterChars)); string kuniPath = "Prefabs/Map/Kuni/"; Entity_kuni_mst kuniMst = Resources.Load("Data/kuni_mst") as Entity_kuni_mst; Entity_daimyo_mst daimyoMst = Resources.Load("Data/daimyo_mst") as Entity_daimyo_mst; int myDaimyo = PlayerPrefs.GetInt("myDaimyo"); string kuniIconPath = "Prefabs/Bakuhu/BakuhuKuniMap"; GameObject kuniMapView = Instantiate(Resources.Load(kuniIconPath)) as GameObject; kuniMapView.transform.SetParent(baseObj.transform); kuniMapView.transform.localScale = new Vector2(0.8f, 0.65f); string kuniMapPath = "Prefabs/Bakuhu/BakuhuKuniIconView"; GameObject kuniIconView = Instantiate(Resources.Load(kuniMapPath)) as GameObject; kuniIconView.transform.SetParent(baseObj.transform); kuniIconView.transform.localScale = new Vector2(0.8f, 0.65f); kuniIconView.name = "BakuhuKuniIconView"; List <int> kuniQtyByDaimyoId = new List <int> () { 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, 0, 0 }; int myKuniQty = GameObject.Find("GameController").GetComponent <MainStageController> ().myKuniQty; bool myKuniQtyIsBiggestFlg = true; for (int i = 0; i < kuniMst.param.Count; i++) { int kuniId = kuniMst.param [i].kunId; string newKuniPath = kuniPath + kuniId.ToString(); int locationX = kuniMst.param [i].locationX; int locationY = kuniMst.param [i].locationY; GameObject kuni = Instantiate(Resources.Load(newKuniPath)) as GameObject; kuni.transform.SetParent(kuniIconView.transform); kuni.name = kuniId.ToString(); kuni.transform.localScale = new Vector2(1, 1); //Seiryoku Handling int daimyoId = int.Parse(seiryokuList [kuniId - 1]); if (daimyoId == myDaimyo) { kuni.SetActive(false); float colorR = (float)daimyoMst.param [daimyoId - 1].colorR; float colorG = (float)daimyoMst.param [daimyoId - 1].colorG; float colorB = (float)daimyoMst.param [daimyoId - 1].colorB; Color kuniColor = new Color(colorR / 255f, colorG / 255f, colorB / 255f, 255f / 255f); kuniMapView.transform.FindChild(kuni.name).GetComponent <Image> ().color = kuniColor; } else { Daimyo daimyoScript = new Daimyo(); string daimyoName = daimyoScript.getName(daimyoId); kuni.GetComponent <SendParam> ().bakuhuFlg = true; kuni.GetComponent <SendParam> ().kuniId = kuniId; kuni.GetComponent <SendParam> ().daimyoId = daimyoId; kuni.GetComponent <SendParam> ().daimyoName = daimyoName; int daimyoBusyoIdTemp = daimyoMst.param [daimyoId - 1].busyoId; kuni.GetComponent <SendParam> ().daimyoBusyoId = daimyoBusyoIdTemp; /*Kuni Qty Start*/ int kuniQty = 0; if (kuniQtyByDaimyoId [daimyoId - 1] == 0) { kuniQty = getKuniQty(daimyoId, seiryokuList); kuniQtyByDaimyoId [daimyoId - 1] = kuniQty; } else { kuniQty = kuniQtyByDaimyoId [daimyoId - 1]; } kuni.GetComponent <SendParam> ().kuniQty = kuniQty; if (kuniQty >= myKuniQty) { myKuniQtyIsBiggestFlg = false; } /*Kuni Qty End*/ //Color Handling float colorR = (float)daimyoMst.param [daimyoId - 1].colorR; float colorG = (float)daimyoMst.param [daimyoId - 1].colorG; float colorB = (float)daimyoMst.param [daimyoId - 1].colorB; Color kuniColor = new Color(colorR / 255f, colorG / 255f, colorB / 255f, 255f / 255f); kuniMapView.transform.FindChild(kuni.name).GetComponent <Image> ().color = kuniColor; //Daimyo Kamon Image string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString(); kuni.GetComponent <Image> ().sprite = Resources.Load(imagePath, typeof(Sprite)) as Sprite; RectTransform kuniTransform = kuni.GetComponent <RectTransform> (); kuniTransform.anchoredPosition = new Vector3(locationX, locationY, 0); } } returnObj.GetComponent <BakuhuMenuReturn> ().myKuniQtyIsBiggestFlg = myKuniQtyIsBiggestFlg; } else { //Hyourou NG audioSources [4].Play(); Message msg = new Message(); //msg.makeMessageOnBoard (msg.getMessage(7)); msg.hyourouMovieMessage(); } } else if (name == "DfcOrderBtn") { //Boueirei if (hyourou >= 10) { //Gunzei Exist Check int bakuhuTobatsuDaimyoId = PlayerPrefs.GetInt("bakuhuTobatsuDaimyoId"); bool gunzeiFlg = false; KuniInfo kuni = new KuniInfo(); string seiryoku = PlayerPrefs.GetString("seiryoku"); List <string> seiryokuList = new List <string> (); char[] delimiterChars = { ',' }; char[] delimiterChars2 = { ':' }; seiryokuList = new List <string> (seiryoku.Split(delimiterChars)); int myDaimyo = PlayerPrefs.GetInt("myDaimyo"); //Used Engun List List <string> dstEngunDaimyoIdList = new List <string>(); foreach (GameObject obs in GameObject.FindGameObjectsWithTag("Gunzei")) { string dstEngunDaimyoId = obs.GetComponent <Gunzei>().dstEngunDaimyoId; List <string> tmpDstEngunDaimyoIdList = new List <string>(); if (dstEngunDaimyoId != null && dstEngunDaimyoId != "") { if (dstEngunDaimyoId.Contains(":")) { tmpDstEngunDaimyoIdList = new List <string>(dstEngunDaimyoId.Split(delimiterChars2)); } else { tmpDstEngunDaimyoIdList.Add(dstEngunDaimyoId); } } dstEngunDaimyoIdList.AddRange(tmpDstEngunDaimyoIdList); } List <string> okGunzeiList = new List <string> (); //key1:engunSrcKuni1:engunSrcKuni2...,key2:engunSrcKuni1:engunSrcKuni2.... foreach (GameObject obs in GameObject.FindGameObjectsWithTag("Gunzei")) { int checkDaimyoId = obs.GetComponent <Gunzei> ().dstDaimyoId; if (checkDaimyoId != bakuhuTobatsuDaimyoId) { int dstKuni = obs.GetComponent <Gunzei> ().dstKuni; int srcDaimyoId = obs.GetComponent <Gunzei> ().srcDaimyoId; int dstDaimyoId = obs.GetComponent <Gunzei> ().dstDaimyoId; List <int> openKuniList = new List <int> (); openKuniList = kuni.getMappingKuni(dstKuni); string tmpString = ""; List <int> usedDaimyoList = new List <int> (); for (int i = 0; i < openKuniList.Count; i++) { int tmpDaimyoId = int.Parse(seiryokuList [openKuniList [i] - 1]); if (tmpDaimyoId != myDaimyo && tmpDaimyoId != srcDaimyoId && tmpDaimyoId != dstDaimyoId) { if (!usedDaimyoList.Contains(tmpDaimyoId)) { if (!dstEngunDaimyoIdList.Contains(tmpDaimyoId.ToString())) { gunzeiFlg = true; usedDaimyoList.Add(tmpDaimyoId); if (tmpString == "") { tmpString = obs.name + ":" + openKuniList [i]; } else { tmpString = tmpString + ":" + openKuniList [i]; } } } } } if (tmpString != "") { okGunzeiList.Add(tmpString); } } } if (gunzeiFlg) { audioSources [0].Play(); //Common //Back string returnPath = "Prefabs/Bakuhu/Return"; GameObject returnObj = Instantiate(Resources.Load(returnPath)) as GameObject; returnObj.transform.SetParent(board.transform); returnObj.transform.localScale = new Vector2(1, 1); returnObj.transform.localPosition = new Vector2(-560, 290); returnObj.name = "bakuhuReturn"; if (Application.systemLanguage != SystemLanguage.Japanese) { board.transform.FindChild("popText").GetComponent <Text> ().text = "Defence Order"; } else { board.transform.FindChild("popText").GetComponent <Text>().text = "防衛令"; } //Disabled scrollView.SetActive(false); //Base Obj string basePath = "Prefabs/Bakuhu/Base"; GameObject baseObj = Instantiate(Resources.Load(basePath)) as GameObject; baseObj.transform.SetParent(board.transform); baseObj.transform.localScale = new Vector2(1, 1); baseObj.name = "BakuhuBase"; returnObj.GetComponent <BakuhuMenuReturn> ().deleteObj = baseObj; returnObj.GetComponent <BakuhuMenuReturn> ().scrollView = scrollView; returnObj.GetComponent <BakuhuMenuReturn> ().board = board; string boubiScrollPath = "Prefabs/Bakuhu/BoueiScrollView"; GameObject boueiScrollObj = Instantiate(Resources.Load(boubiScrollPath)) as GameObject; boueiScrollObj.transform.SetParent(baseObj.transform); boueiScrollObj.transform.localScale = new Vector2(1, 1); boueiScrollObj.transform.localPosition = new Vector2(0, 0); GameObject content = boueiScrollObj.transform.FindChild("Content").gameObject; string uniSlotPath = "Prefabs/Bakuhu/BoueiSlot"; string daimyoBusyoPath = "Prefabs/Player/Sprite/unit"; Daimyo daimyo = new Daimyo(); for (int i = 0; i < okGunzeiList.Count; i++) { string tmp = okGunzeiList [i]; List <string> okGunzeiUnitList = new List <string> (); okGunzeiUnitList = new List <string> (tmp.Split(delimiterChars2)); string key = okGunzeiUnitList [0]; GameObject gunzei = GameObject.Find(key).gameObject; int dstDaimyoId = gunzei.GetComponent <Gunzei> ().dstDaimyoId; int dstDaimyoBusyoId = daimyo.getDaimyoBusyoId(dstDaimyoId); string dstDaimyoName = daimyo.getName(dstDaimyoId); int srcDaimyoId = gunzei.GetComponent <Gunzei> ().srcDaimyoId; int srcDaimyoBusyoId = daimyo.getDaimyoBusyoId(srcDaimyoId); string srcDaimyoName = daimyo.getName(srcDaimyoId); int dstKuniId = gunzei.GetComponent <Gunzei> ().dstKuni; string kuniName = kuni.getKuniName(dstKuniId); for (int j = 1; j < okGunzeiUnitList.Count; j++) { int engunKuniId = int.Parse(okGunzeiUnitList [j]); int engunDaimyoId = int.Parse(seiryokuList [engunKuniId - 1]); int engunDaimyoBusyoId = daimyo.getDaimyoBusyoId(engunDaimyoId); string engunDaimyoName = daimyo.getName(engunDaimyoId); GameObject slot = Instantiate(Resources.Load(uniSlotPath)) as GameObject; slot.transform.SetParent(content.transform); slot.transform.localScale = new Vector2(1, 1); if (Application.systemLanguage != SystemLanguage.Japanese) { slot.transform.FindChild("Kuni").GetComponent <Text> ().text = kuniName + " Defence"; } else { slot.transform.FindChild("Kuni").GetComponent <Text>().text = kuniName + "防衛"; } string dfcDaimyoPath = daimyoBusyoPath + dstDaimyoBusyoId.ToString(); slot.transform.FindChild("Dfc").transform.FindChild("Image").GetComponent <Image> ().sprite = Resources.Load(dfcDaimyoPath, typeof(Sprite)) as Sprite; string atkDaimyoPath = daimyoBusyoPath + srcDaimyoBusyoId.ToString(); slot.transform.FindChild("Atk").transform.FindChild("Image").GetComponent <Image> ().sprite = Resources.Load(atkDaimyoPath, typeof(Sprite)) as Sprite; string engnDaimyoPath = daimyoBusyoPath + engunDaimyoBusyoId.ToString(); slot.transform.FindChild("Egn").transform.FindChild("Image").GetComponent <Image> ().sprite = Resources.Load(engnDaimyoPath, typeof(Sprite)) as Sprite; slot.transform.FindChild("DfcName").GetComponent <Text> ().text = dstDaimyoName; slot.transform.FindChild("AtkName").GetComponent <Text> ().text = srcDaimyoName; slot.transform.FindChild("EgnName").GetComponent <Text> ().text = engunDaimyoName; if (Application.systemLanguage != SystemLanguage.Japanese) { slot.transform.FindChild("Exp").GetComponent <Text>().text = "Request " + engunDaimyoName + " for reinforcement"; } else { slot.transform.FindChild("Exp").GetComponent <Text>().text = engunDaimyoName + "に援軍の出兵支持を出す。"; } //Param GameObject btn = slot.transform.FindChild("BoueiBtn").gameObject; btn.GetComponent <DoBouei> ().key = key; btn.GetComponent <DoBouei> ().engunDaimyoId = engunDaimyoId; btn.GetComponent <DoBouei> ().engunKuniId = engunKuniId; btn.GetComponent <DoBouei> ().engunDaimyoName = engunDaimyoName; btn.GetComponent <DoBouei> ().dfcDaimyoId = dstDaimyoId; btn.GetComponent <DoBouei> ().slot = slot; btn.GetComponent <DoBouei> ().kuniName = kuniName; } } } else { audioSources [4].Play(); Message msg = new Message(); msg.makeMessageOnBoard(msg.getMessage(99)); } } else { audioSources [4].Play(); //Hyourou NG Message msg = new Message(); //msg.makeMessageOnBoard (msg.getMessage(7)); msg.hyourouMovieMessage(); } } else if (name == "RelationshipBtn") { //Boueirei if (hyourou >= 5) { int bakuhuTobatsuDaimyoId = PlayerPrefs.GetInt("bakuhuTobatsuDaimyoId"); //Not Last Daimyo check string seiryoku = PlayerPrefs.GetString("seiryoku"); List <string> seiryokuList = new List <string> (); char[] delimiterChars = { ',' }; seiryokuList = new List <string> (seiryoku.Split(delimiterChars)); int myDaimyo = PlayerPrefs.GetInt("myDaimyo"); bool isLastDaimyoFlg = false; List <string> checkedDaimyoList = new List <string> (); foreach (string tmp in seiryokuList) { if (tmp != myDaimyo.ToString()) { if (!checkedDaimyoList.Contains(tmp)) { checkedDaimyoList.Add(tmp); } } } //include other 2 daimyos = 3 if (checkedDaimyoList.Count >= 2) { isLastDaimyoFlg = true; } if (isLastDaimyoFlg) { audioSources [0].Play(); //OK //Common //Back string returnPath = "Prefabs/Bakuhu/Return"; GameObject returnObj = Instantiate(Resources.Load(returnPath)) as GameObject; returnObj.transform.SetParent(board.transform); returnObj.transform.localScale = new Vector2(1, 1); returnObj.transform.localPosition = new Vector2(-560, 290); returnObj.name = "bakuhuReturn"; if (Application.systemLanguage != SystemLanguage.Japanese) { board.transform.FindChild("popText").GetComponent <Text> ().text = "Defence Order"; } else { board.transform.FindChild("popText").GetComponent <Text>().text = "防衛令"; } //Disabled scrollView.SetActive(false); //Base Obj string basePath = "Prefabs/Bakuhu/Base"; GameObject baseObj = Instantiate(Resources.Load(basePath)) as GameObject; baseObj.transform.SetParent(board.transform); baseObj.transform.localScale = new Vector2(1, 1); baseObj.name = "BakuhuBase"; returnObj.GetComponent <BakuhuMenuReturn> ().deleteObj = baseObj; returnObj.GetComponent <BakuhuMenuReturn> ().scrollView = scrollView; returnObj.GetComponent <BakuhuMenuReturn> ().board = board; if (Application.systemLanguage != SystemLanguage.Japanese) { board.transform.FindChild("popText").GetComponent <Text> ().text = "Mediation"; } else { board.transform.FindChild("popText").GetComponent <Text>().text = "仲裁"; } //Scroll string scrollPath = "Prefabs/Bakuhu/CyusaiScrollView"; GameObject uprScroll = Instantiate(Resources.Load(scrollPath)) as GameObject; uprScroll.transform.SetParent(baseObj.transform); uprScroll.transform.localPosition = new Vector2(0, 95); uprScroll.transform.localScale = new Vector2(1, 1); uprScroll.name = "CyusaiScrollViewUpper"; GameObject uprContent = uprScroll.transform.FindChild("Content").gameObject; GameObject btnScroll = Instantiate(Resources.Load(scrollPath)) as GameObject; btnScroll.transform.SetParent(baseObj.transform); btnScroll.transform.localPosition = new Vector2(0, -170); btnScroll.transform.localScale = new Vector2(1, 1); btnScroll.name = "CyusaiScrollViewBottom"; GameObject btnContent = btnScroll.transform.FindChild("Content").gameObject; //Upper Scroll string slotPath = "Prefabs/Bakuhu/CyusaiSlot"; Daimyo daimyo = new Daimyo(); foreach (string daimyoId in checkedDaimyoList) { GameObject uprSlot = Instantiate(Resources.Load(slotPath)) as GameObject; uprSlot.transform.SetParent(uprContent.transform); uprSlot.transform.localScale = new Vector2(1, 1); uprSlot.GetComponent <CyusaiDaimyoSelect> ().daimyoId = daimyoId; uprSlot.GetComponent <CyusaiDaimyoSelect> ().checkedDaimyoList = checkedDaimyoList; uprSlot.GetComponent <CyusaiDaimyoSelect> ().uprContent = uprContent; uprSlot.GetComponent <CyusaiDaimyoSelect> ().btnContent = btnContent; int daimyoBusyoId = daimyo.getDaimyoBusyoId(int.Parse(daimyoId)); string daimyoName = daimyo.getName(int.Parse(daimyoId)); uprSlot.GetComponent <CyusaiDaimyoSelect> ().daimyoName = daimyoName; string daimyoBusyoPath = "Prefabs/Player/Sprite/unit" + daimyoBusyoId.ToString(); uprSlot.transform.FindChild("Image").transform.FindChild("Image").GetComponent <Image> ().sprite = Resources.Load(daimyoBusyoPath, typeof(Sprite)) as Sprite; uprSlot.transform.FindChild("DaimyoName").GetComponent <Text> ().text = daimyoName; } string cyusaiTxtPath = "Prefabs/Bakuhu/CyusaiText"; GameObject cTxt = Instantiate(Resources.Load(cyusaiTxtPath)) as GameObject; cTxt.transform.SetParent(btnContent.transform); cTxt.transform.localScale = new Vector2(0.12f, 0.15f); cTxt.name = "CyusaiText"; } else { audioSources [4].Play(); Message msg = new Message(); msg.makeMessageOnBoard(msg.getMessage(100)); } } else { audioSources [4].Play(); //Hyourou NG Message msg = new Message(); //msg.makeMessageOnBoard (msg.getMessage(7)); msg.hyourouMovieMessage(); } } else if (name == "SobujiKessenBtn") { if (hyourou >= 30) { bool myKuniQtyIsTwiceFlg = GameObject.Find("GameController").GetComponent <MainStageController> ().myKuniQtyIsTwiceFlg; if (myKuniQtyIsTwiceFlg) { audioSources [0].Play(); //Confirm Button //Back Cover 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.anchoredPosition3D = new Vector3(0, 0, 0); //Message Box GameObject soubujireiConfirmObj = Instantiate(soubujireiConfirm) as GameObject; soubujireiConfirmObj.transform.SetParent(GameObject.Find("Map").transform); soubujireiConfirmObj.transform.localScale = new Vector2(1, 1); RectTransform msgTransform = soubujireiConfirmObj.GetComponent <RectTransform> (); msgTransform.anchoredPosition3D = new Vector3(0, 0, 0); msgTransform.name = "SoubujireiConfirmObj"; GameObject YesBtn = soubujireiConfirmObj.transform.FindChild("YesButton").gameObject; GameObject NoBtn = soubujireiConfirmObj.transform.FindChild("NoButton").gameObject; YesBtn.GetComponent <DoSoubujirei> ().board = board; YesBtn.GetComponent <DoSoubujirei> ().confirm = soubujireiConfirmObj; YesBtn.GetComponent <DoSoubujirei> ().back = back; NoBtn.GetComponent <DoSoubujirei> ().confirm = soubujireiConfirmObj; NoBtn.GetComponent <DoSoubujirei> ().back = back; } else { audioSources [4].Play(); Message msg = new Message(); msg.makeMessageOnBoard(msg.getMessage(101)); } } else { audioSources [4].Play(); //Hyourou NG Message msg = new Message(); //msg.makeMessageOnBoard (msg.getMessage(7)); msg.hyourouMovieMessage(); } } else if (name == "KessenBtn") { if (hyourou >= hyourouNo) { audioSources [0].Play(); //Confirm Button //Back Cover 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.anchoredPosition3D = new Vector3(0, 0, 0); //Message Box string msgPath = "Prefabs/Bakuhu/KessenConfirm"; GameObject msg = Instantiate(Resources.Load(msgPath)) as GameObject; msg.transform.SetParent(GameObject.Find("Map").transform); msg.transform.localScale = new Vector2(1, 1); RectTransform msgTransform = msg.GetComponent <RectTransform> (); msgTransform.anchoredPosition3D = new Vector3(0, 0, 0); msgTransform.name = "KessenConfirm"; if (Application.systemLanguage != SystemLanguage.Japanese) { msg.transform.FindChild("Text").GetComponent <Text>().text = "Operate final war with " + daimyoName + "."; } else { msg.transform.FindChild("Text").GetComponent <Text>().text = daimyoName + "に決戦を仕掛けます"; } GameObject YesBtn = msg.transform.FindChild("YesButton").gameObject; GameObject NoBtn = msg.transform.FindChild("NoButton").gameObject; YesBtn.GetComponent <DoKessen> ().daimyoId = daimyoId; YesBtn.GetComponent <DoKessen> ().daimyoName = daimyoName; YesBtn.GetComponent <DoKessen> ().kuniId = kuniId; YesBtn.GetComponent <DoKessen> ().needHyourouNo = hyourouNo; NoBtn.GetComponent <DoKessen> ().confirm = msg; NoBtn.GetComponent <DoKessen> ().back = back; YesBtn.transform.FindChild("hyourouIcon").transform.FindChild("hyourouNoValue").GetComponent <Text> ().text = hyourouNo.ToString(); } else { audioSources [4].Play(); //Hyourou NG Message msg = new Message(); //msg.makeMessageOnBoard (msg.getMessage(7)); msg.hyourouMovieMessage(); } } }
public void makeDaimyoSeiryoku() { Destroy(fin.gameObject); string kuniMapPath = "Prefabs/clearOrGameOver/KuniMap"; GameObject KuniMap = Instantiate(Resources.Load(kuniMapPath)) as GameObject; KuniMap.transform.SetParent(panel.transform); KuniMap.transform.localScale = new Vector2(1, 1); string kuniIconViewPath = "Prefabs/clearOrGameOver/KuniIconView"; GameObject kuniIconView = Instantiate(Resources.Load(kuniIconViewPath)) as GameObject; kuniIconView.transform.SetParent(panel.transform); kuniIconView.transform.localScale = new Vector2(1, 1); string messagePath = "Prefabs/clearOrGameOver/FixedMessage"; GameObject msg = Instantiate(Resources.Load(messagePath)) as GameObject; msg.transform.SetParent(panel.transform); msg.transform.localScale = new Vector2(1, 1); msg.transform.localPosition = new Vector2(0, 380); //Show Entity_kuni_mst kuniMst = Resources.Load("Data/kuni_mst") as Entity_kuni_mst; Entity_daimyo_mst daimyoMst = Resources.Load("Data/daimyo_mst") as Entity_daimyo_mst; string seiryoku = "1,2,3,4,5,6,7,8,3,4,9,10,12,11,13,14,15,16,3,17,18,17,19,8,19,19,20,21,22,23,24,25,26,27,28,29,30,31,31,32,33,34,35,35,36,37,38,38,38,38,31,31,31,39,40,41,41,41,41,42,43,44,45,45,46"; List <string> seiryokuList = new List <string> (); char[] delimiterChars = { ',' }; seiryokuList = new List <string> (seiryoku.Split(delimiterChars)); string kuniQtybyDaimyo = "1,1,3,2,1,1,1,2,1,1,1,1,1,1,1,1,2,1,3,1,1,1,1,1,1,1,1,1,1,1,5,1,1,1,2,1,1,4,1,1,4,1,1,1,2,1"; List <string> KuniQtyList = new List <string> (); KuniQtyList = new List <string> (kuniQtybyDaimyo.Split(delimiterChars)); string gameClearDaimyo = PlayerPrefs.GetString("gameClearDaimyo"); List <string> gameClearDaimyoList = new List <string> (); if (gameClearDaimyo != null && gameClearDaimyo != "") { if (gameClearDaimyo.Contains(",")) { gameClearDaimyoList = new List <string> (gameClearDaimyo.Split(delimiterChars)); } else { gameClearDaimyoList.Add(gameClearDaimyo); } } string myBusyo = PlayerPrefs.GetString("myBusyo"); List <string> myBusyoList = new List <string> (); if (myBusyo != null && myBusyo != "") { if (myBusyo.Contains(",")) { myBusyoList = new List <string> (myBusyo.Split(delimiterChars)); } else { myBusyoList.Add(myBusyo); } } string kuniPath = "Prefabs/Map/kuni/"; KuniInfo kuniScript = new KuniInfo(); Daimyo daimyoScript = new Daimyo(); for (int i = 0; i < kuniMst.param.Count; i++) { int kuniId = kuniMst.param [i].kunId; string newKuniPath = kuniPath + kuniId.ToString(); int locationX = kuniMst.param [i].locationX; int locationY = kuniMst.param [i].locationY; GameObject kuni = Instantiate(Resources.Load(newKuniPath)) as GameObject; kuni.transform.SetParent(kuniIconView.transform); kuni.name = kuniId.ToString(); kuni.GetComponent <SendParam> ().kuniId = kuniId; kuni.GetComponent <SendParam> ().kuniName = kuniScript.getKuniName(kuniId); kuni.transform.localScale = new Vector2(1, 1); kuni.GetComponent <SendParam> ().naiseiItem = kuniMst.param [i].naisei; //Seiryoku Handling int daimyoId = int.Parse(seiryokuList [kuniId - 1]); string daimyoName = daimyoScript.getName(daimyoId); int daimyoBusyoIdTemp = daimyoMst.param [daimyoId - 1].busyoId; kuni.GetComponent <SendParam> ().daimyoId = daimyoId; kuni.GetComponent <SendParam> ().daimyoName = daimyoName; kuni.GetComponent <SendParam> ().daimyoBusyoId = daimyoBusyoIdTemp; kuni.GetComponent <SendParam> ().kuniQty = int.Parse(KuniQtyList [daimyoId - 1]); if (gameClearDaimyoList.Contains(daimyoId.ToString())) { kuni.GetComponent <SendParam> ().gameClearFlg = true; } if (myBusyoList.Contains(daimyoBusyoIdTemp.ToString())) { kuni.GetComponent <SendParam> ().busyoHaveFlg = true; } //Color Handling float colorR = (float)daimyoMst.param [daimyoId - 1].colorR; float colorG = (float)daimyoMst.param [daimyoId - 1].colorG; float colorB = (float)daimyoMst.param [daimyoId - 1].colorB; Color kuniColor = new Color(colorR / 255f, colorG / 255f, colorB / 255f, 255f / 255f); KuniMap.transform.FindChild(kuni.name).GetComponent <Image> ().color = kuniColor; //Daimyo Kamon Image string imagePath = "Prefabs/Kamon/" + daimyoId.ToString(); kuni.GetComponent <Image> ().sprite = Resources.Load(imagePath, typeof(Sprite)) as Sprite; RectTransform kuniTransform = kuni.GetComponent <RectTransform> (); kuniTransform.anchoredPosition = new Vector3(locationX, locationY, 0); } }
public void dataMake(bool busyoExitFlg, int newDaimyo, int newDaimyoBusyo, string heisyu, bool sameDaimyoFlg) { /*******************************/ /***** Base Value *****/ /*******************************/ System.DateTime now = System.DateTime.Now; PlayerPrefs.SetString("lasttime", now.ToString()); //PlayerPrefs.SetInt ("hyourou",100); //PlayerPrefs.SetInt ("money",10000); PlayerPrefs.SetString("yearSeason", "1560,1"); PlayerPrefs.DeleteKey("gameClearFlg"); PlayerPrefs.DeleteKey("gameClearItemGetFlg"); PlayerPrefs.DeleteKey("gameOverFlg"); PlayerPrefs.DeleteKey("kuniClearedFlg"); /*******************************/ /***** Delete History *****/ /*******************************/ PlayerPrefs.DeleteKey("TrackTotalKassenNo"); PlayerPrefs.DeleteKey("TrackWinNo"); PlayerPrefs.DeleteKey("TrackTettaiNo"); PlayerPrefs.DeleteKey("TrackBiggestDaimyoId"); PlayerPrefs.DeleteKey("TrackBiggestDaimyoHei"); PlayerPrefs.DeleteKey("TrackMyBiggestHei"); PlayerPrefs.DeleteKey("TrackNewBusyoHireNo"); PlayerPrefs.DeleteKey("TrackEarnMoney"); PlayerPrefs.DeleteKey("TrackGetMoneyNo"); PlayerPrefs.DeleteKey("TrackGetHyourouNo"); PlayerPrefs.DeleteKey("TrackGetSozaiNo"); PlayerPrefs.DeleteKey("TrackBuildMoneyNo"); PlayerPrefs.DeleteKey("TrackJyosyuNinmeiNo"); PlayerPrefs.DeleteKey("TrackTabibitoNo"); PlayerPrefs.DeleteKey("TrackIjinNo"); PlayerPrefs.DeleteKey("HstNanbansen"); PlayerPrefs.DeleteKey("TrackGaikouNo"); PlayerPrefs.DeleteKey("TrackGaikouMoneyNo"); PlayerPrefs.DeleteKey("TrackDoumeiNo"); PlayerPrefs.DeleteKey("TrackCyouteiNo"); PlayerPrefs.DeleteKey("TrackSyouninNo"); PlayerPrefs.DeleteKey("TrackToubatsuNo"); PlayerPrefs.DeleteKey("TrackBouryakuNo"); PlayerPrefs.DeleteKey("TrackBouryakuSuccessNo"); PlayerPrefs.DeleteKey("TrackCyouhouNo"); PlayerPrefs.DeleteKey("TrackRyugenNo"); PlayerPrefs.DeleteKey("TrackGihouHei"); PlayerPrefs.DeleteKey("TrackCyouryakuNo"); PlayerPrefs.DeleteKey("TrackLinkCutNo"); PlayerPrefs.DeleteKey("TrackSyuppeiNo"); /*******************************/ /***** Delete Temp Value *****/ /*******************************/ PlayerPrefs.DeleteKey("playerEngunList"); PlayerPrefs.DeleteKey("enemyEngunList"); PlayerPrefs.DeleteKey("playerKyoutouList"); PlayerPrefs.DeleteKey("tempKyoutouList"); PlayerPrefs.DeleteKey("keyHistory"); PlayerPrefs.DeleteKey("metsubou"); HPCounter deleteGunzeiScript = new HPCounter(); for (int i = 1; i < 66; i++) { string kuniTemp = "kuni" + i.ToString(); PlayerPrefs.DeleteKey(kuniTemp); string jyosyuTemp = "jyosyu" + i.ToString(); PlayerPrefs.DeleteKey(jyosyuTemp); string naiseiLoginDateTemp = "naiseiLoginDate" + i.ToString(); PlayerPrefs.DeleteKey(naiseiLoginDateTemp); string naiseiTabibitoCounterTemp = "naiseiTabibitoCounter" + i.ToString(); PlayerPrefs.DeleteKey(naiseiTabibitoCounterTemp); string cyouhouTemp = "cyouhou" + i.ToString(); PlayerPrefs.DeleteKey(cyouhouTemp); string linkuctTmp = "linkcut" + i.ToString(); PlayerPrefs.DeleteKey(linkuctTmp); //Delete Enemy Gunzei deleteGunzeiScript.deleteEnemyGunzeiData(i); } PlayerPrefs.DeleteKey("cyouhou"); PlayerPrefs.DeleteKey("lastSeasonChangeTime"); PlayerPrefs.DeleteKey("doneCyosyuFlg"); PlayerPrefs.DeleteKey("twiceHeiFlg"); PlayerPrefs.DeleteKey("rdmEventTimer"); PlayerPrefs.DeleteKey("fromNaiseiFlg"); PlayerPrefs.DeleteKey("fromKassenFlg"); PlayerPrefs.DeleteKey("kassenWinLoseFlee"); PlayerPrefs.DeleteKey("kessenFlg"); PlayerPrefs.DeleteKey("kessenHyourou"); PlayerPrefs.DeleteKey("winChecker"); PlayerPrefs.DeleteKey("isAttackedFlg"); PlayerPrefs.DeleteKey("isKessenFlg"); /*******************************/ /***** Cyoutei & Bakuhu Value *****/ /*******************************/ PlayerPrefs.DeleteKey("cyoutekiDaimyo"); PlayerPrefs.DeleteKey("cyouteiPoint"); PlayerPrefs.SetInt("syogunDaimyoId", 14); PlayerPrefs.DeleteKey("bakuhuTobatsuDaimyoId"); PlayerPrefs.DeleteKey("soubujireiFlg"); /*******************************/ /***** Busyo Value *****/ /*******************************/ //Jyosyu Delete Entity_busyo_mst busyoMst = Resources.Load("Data/busyo_mst") as Entity_busyo_mst; for (int i = 0; i < busyoMst.param.Count; i++) { int busyoId = i + 1; string daimyoTemp = "jyosyuHei" + busyoId; string daimyoTemp2 = "jyosyuBusyo" + busyoId; PlayerPrefs.DeleteKey(daimyoTemp); PlayerPrefs.DeleteKey(daimyoTemp2); } PlayerPrefs.Flush(); char[] delimiterChars = { ',' }; if (!sameDaimyoFlg) { //Old Daimyo //Delete Previous Daimyo Busyo in the case of it has never been gotten by Gacya int preDaimyoBusyoId = PlayerPrefs.GetInt("myDaimyoBusyo"); string gacyaDaimyoHst = PlayerPrefs.GetString("gacyaDaimyoHst"); List <string> gacyaDaimyoHstList = new List <string> (); if (gacyaDaimyoHst != null && gacyaDaimyoHst != "") { if (gacyaDaimyoHst.Contains(",")) { gacyaDaimyoHstList = new List <string> (gacyaDaimyoHst.Split(delimiterChars)); } else { gacyaDaimyoHstList.Add(gacyaDaimyoHst); } } if (!gacyaDaimyoHstList.Contains(preDaimyoBusyoId.ToString())) { //delete daimyo //delete my busyo string myBusyo = PlayerPrefs.GetString("myBusyo"); List <string> myBusyoList = new List <string> (); if (myBusyo.Contains(",")) { myBusyoList = new List <string> (myBusyo.Split(delimiterChars)); } else { myBusyoList.Add(myBusyo); } myBusyoList.Remove(preDaimyoBusyoId.ToString()); string myNewBusyo = ""; for (int i = 0; i < myBusyoList.Count; i++) { if (i == 0) { myNewBusyo = myBusyoList [i]; } else { myNewBusyo = myNewBusyo + "," + myBusyoList [i]; } } PlayerPrefs.SetString("myBusyo", myNewBusyo); int myBusyoQty = PlayerPrefs.GetInt("myBusyoQty"); myBusyoQty = myBusyoQty - 1; PlayerPrefs.SetInt("myBusyoQty", myBusyoQty); PlayerPrefs.Flush(); //delete jinkei int jinkeiMaxId = 4; int slotMaxId = 25; bool soudaisyoSetFlg = false; for (int i = 1; i <= jinkeiMaxId; i++) { for (int j = 1; j <= slotMaxId; j++) { string tmp = i.ToString() + "map" + j.ToString(); if (PlayerPrefs.HasKey(tmp)) { int busyoId = PlayerPrefs.GetInt(tmp); if (busyoId == preDaimyoBusyoId) { PlayerPrefs.DeleteKey(tmp); } else { if (!soudaisyoSetFlg) { string sJinkeiId = "soudaisyo" + i.ToString(); PlayerPrefs.SetInt(sJinkeiId, busyoId); } } } } } //kahou check string tempBusyo = "kahou" + preDaimyoBusyoId; string busyoKahou = PlayerPrefs.GetString(tempBusyo); string[] busyoKahouList = busyoKahou.Split(delimiterChars); for (int k = 0; k < busyoKahouList.Length; k++) { int kahouId = int.Parse(busyoKahouList[k]); if (kahouId != 0) { //back kahou data string tmp = ""; if (k == 0) { tmp = "Bugu"; } else if (k == 1) { tmp = "Kabuto"; } else if (k == 2) { tmp = "Gusoku"; } else if (k == 3) { tmp = "Meiba"; } else if (k == 4) { tmp = "Cyadougu"; } else if (k == 5) { tmp = "Cyadougu"; } else if (k == 6) { tmp = "Heihousyo"; } else if (k == 7) { tmp = "Chishikisyo"; } string temp = "available" + tmp; string availableKahou = PlayerPrefs.GetString(temp); if (availableKahou == null || availableKahou == "") { availableKahou = kahouId.ToString(); } else { availableKahou = availableKahou + "," + kahouId.ToString(); } PlayerPrefs.SetString(temp, availableKahou); PlayerPrefs.SetString(tempBusyo, "0,0,0,0,0,0,0,0"); } } PlayerPrefs.Flush(); } //New Daimyo if (!busyoExitFlg) { //Player dosen't have this daimyo busyo //busyo int myBusyoQty = PlayerPrefs.GetInt("myBusyoQty"); myBusyoQty = myBusyoQty + 1; PlayerPrefs.SetInt("myBusyoQty", myBusyoQty); string myBusyo = PlayerPrefs.GetString("myBusyo"); if (myBusyo != null && myBusyo != "") { myBusyo = myBusyo + "," + newDaimyoBusyo.ToString(); } else { myBusyo = newDaimyoBusyo.ToString(); } PlayerPrefs.SetString("myBusyo", myBusyo); if (!PlayerPrefs.HasKey(newDaimyoBusyo.ToString())) { PlayerPrefs.SetInt(newDaimyoBusyo.ToString(), 1); string tempHei = "hei" + newDaimyoBusyo.ToString(); string tempSenpou = "senpou" + newDaimyoBusyo.ToString(); string tempSaku = "saku" + newDaimyoBusyo.ToString(); string tempKahou = "kahou" + newDaimyoBusyo.ToString(); string tempExp = "exp" + newDaimyoBusyo.ToString(); string valueHei = heisyu + ":1:1:1"; PlayerPrefs.SetString(tempHei, valueHei); PlayerPrefs.SetInt(tempSenpou, 1); PlayerPrefs.SetInt(tempSaku, 1); PlayerPrefs.SetString(tempKahou, "0,0,0,0,0,0,0,0"); PlayerPrefs.SetInt(tempExp, 0); } //jinkei //if there is no busyo in active jinkei int jinkei = PlayerPrefs.GetInt("jinkei"); bool jinkeiBusyoExistFlg = false; for (int i = 1; i <= 25; i++) { string tmp = jinkei.ToString() + "map" + i.ToString(); if (PlayerPrefs.HasKey(tmp)) { jinkeiBusyoExistFlg = true; } } if (!jinkeiBusyoExistFlg) { string tmpMap = ""; if (jinkei == 1) { tmpMap = jinkei.ToString() + "map11"; } else if (jinkei == 2) { tmpMap = jinkei.ToString() + "map11"; } else if (jinkei == 3) { tmpMap = jinkei.ToString() + "map14"; } else if (jinkei == 4) { tmpMap = jinkei.ToString() + "map12"; } PlayerPrefs.SetInt(tmpMap, newDaimyoBusyo); } } } //My Daimyo Busyo PlayerPrefs.SetInt("myDaimyo", newDaimyo); PlayerPrefs.SetInt("myDaimyoBusyo", newDaimyoBusyo); PlayerPrefs.DeleteKey("usedBusyo"); /*******************************/ /***** Kuni Value *****/ /*******************************/ string newSeiryoku = "1,2,3,4,5,6,7,8,3,4,9,10,12,11,13,14,15,16,3,17,18,17,19,8,19,19,20,21,22,23,24,25,26,27,28,29,30,31,31,32,33,34,35,35,36,37,38,38,38,38,31,31,31,39,40,41,41,41,41,42,43,44,45,45,46"; PlayerPrefs.SetString("seiryoku", newSeiryoku); List <string> seiryokuList = new List <string> (); seiryokuList = new List <string> (newSeiryoku.Split(delimiterChars)); string newClearedKuni = ""; for (int i = 0; i < seiryokuList.Count; i++) { string tempDaimyoId = seiryokuList[i]; if (tempDaimyoId == newDaimyo.ToString()) { int kuniId = i + 1; if (newClearedKuni == null || newClearedKuni == "") { newClearedKuni = kuniId.ToString(); } else { newClearedKuni = newClearedKuni + "," + kuniId.ToString(); } } } PlayerPrefs.SetString("clearedKuni", newClearedKuni); List <string> clearedKuniList = new List <string> (); if (newClearedKuni.Contains(",")) { clearedKuniList = new List <string> (newClearedKuni.Split(delimiterChars)); } else { clearedKuniList.Add(newClearedKuni); } //New Open Kuni KuniInfo kuni = new KuniInfo(); PlayerPrefs.DeleteKey("openKuni"); PlayerPrefs.Flush(); foreach (string kuniId in clearedKuniList) { kuni.registerOpenKuni(int.Parse(kuniId)); string temp = "kuni" + kuniId; PlayerPrefs.SetString(temp, "1,2,3,4,5,6,7,8,9,10"); string tempNaisei = "naisei" + kuniId; if (!PlayerPrefs.HasKey(tempNaisei)) { PlayerPrefs.SetString(tempNaisei, "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"); } PlayerPrefs.Flush(); } //Add Cleared Kuni to OpenKuni string tempOpenKuni = PlayerPrefs.GetString("openKuni"); tempOpenKuni = tempOpenKuni + "," + newClearedKuni; PlayerPrefs.SetString("openKuni", tempOpenKuni); PlayerPrefs.Flush(); /*******************************/ /***** Cyouryaku Value *****/ /*******************************/ string cyouryaku = PlayerPrefs.GetString("cyouryaku"); List <string> cyouryakuList = new List <string> (); if (cyouryaku != null && cyouryaku != "") { if (cyouryaku.Contains(",")) { cyouryakuList = new List <string> (cyouryaku.Split(delimiterChars)); } else { cyouryakuList.Add(cyouryaku); } } for (int i = 0; i < cyouryakuList.Count; i++) { PlayerPrefs.DeleteKey(cyouryakuList[i]); } PlayerPrefs.DeleteKey("cyouryaku"); /*******************************/ /***** Gaikou Value *****/ /*******************************/ //My Gaikou Gaikou gaikou = new Gaikou(); for (int l = 1; l < 47; l++) { int value = gaikou.getGaikouValue(newDaimyo, l); string temp = "gaikou" + l.ToString(); PlayerPrefs.SetInt(temp, value); string metsubouTemp = "metsubou" + l.ToString(); PlayerPrefs.DeleteKey(metsubouTemp); } //Other Daimyo Gaikou for (int x = 2; x < 47; x++) { for (int y = 2; y < 47; y++) { if (x != y) { string temp = x.ToString() + "gaikou" + y.ToString(); string temp2 = x.ToString() + "key" + y.ToString(); PlayerPrefs.DeleteKey(temp); PlayerPrefs.DeleteKey(temp2); } } } /*******************************/ /***** Shisya *****/ /*******************************/ PlayerPrefs.DeleteKey("shisyaFlg"); PlayerPrefs.DeleteKey("shisya1"); PlayerPrefs.DeleteKey("shisya2"); PlayerPrefs.DeleteKey("shisya3"); PlayerPrefs.DeleteKey("shisya4"); PlayerPrefs.DeleteKey("shisya5"); PlayerPrefs.DeleteKey("shisya6"); PlayerPrefs.DeleteKey("shisya7"); PlayerPrefs.DeleteKey("shisya8"); PlayerPrefs.DeleteKey("shisya9"); PlayerPrefs.DeleteKey("shisya10"); PlayerPrefs.DeleteKey("shisya11"); PlayerPrefs.DeleteKey("shisya12"); PlayerPrefs.DeleteKey("shisya13"); PlayerPrefs.DeleteKey("shisya14"); PlayerPrefs.DeleteKey("shisya15"); PlayerPrefs.DeleteKey("shisya16"); PlayerPrefs.DeleteKey("shisya17"); PlayerPrefs.DeleteKey("shisya18"); PlayerPrefs.DeleteKey("shisya19"); PlayerPrefs.DeleteKey("shisya20"); PlayerPrefs.DeleteKey("shisya21"); /*******************************/ /***** Doumei *****/ /*******************************/ //Delete doumei history Entity_daimyo_mst daimyoMst = Resources.Load("Data/daimyo_mst") as Entity_daimyo_mst; for (int i = 0; i < daimyoMst.param.Count; i++) { int daimyoId = daimyoMst.param[i].daimyoId; string temp = "doumei" + daimyoId; PlayerPrefs.DeleteKey(temp); } PlayerPrefs.Flush(); PlayerPrefs.DeleteKey("doumei"); string newMyDoumei = ""; Entity_doumei_mst doumeiMst = Resources.Load("Data/doumei_mst") as Entity_doumei_mst; for (int i = 0; i < doumeiMst.param.Count; i++) { int srcDaimyoId = doumeiMst.param[i].doumeiSrc; int dstDaimyoId = doumeiMst.param[i].doumeiDst; if (srcDaimyoId == newDaimyo) { if (newMyDoumei != null && newMyDoumei != "") { newMyDoumei = newMyDoumei + "," + dstDaimyoId; } else { newMyDoumei = dstDaimyoId.ToString(); } } else { string temp = "doumei" + srcDaimyoId; string previous = PlayerPrefs.GetString(temp); if (previous != null && previous != "") { previous = previous + "," + dstDaimyoId; PlayerPrefs.SetString(temp, previous); } else { PlayerPrefs.SetString(temp, dstDaimyoId.ToString()); } } } PlayerPrefs.SetString("doumei", newMyDoumei); PlayerPrefs.Flush(); Application.LoadLevel("mainStage"); }
public string getBusyoList(int powerType, int activeDaimyoId, int activeBusyoQty, int activeBusyoLv, int activeButaiQty, int activeButaiLv) { string returnString = ""; //busyoA-busyoB-busyoC...,totalhei int totalHei = 0; Entity_daimyo_mst daimyoMst = Resources.Load("Data/daimyo_mst") as Entity_daimyo_mst; int daimyoBusyoId = daimyoMst.param[activeDaimyoId - 1].busyoId; /*Busyo Master Setting Start*/ //Active Busyo List List <string> metsubouDaimyoList = new List <string>(); string metsubouTemp = "metsubou" + activeDaimyoId; string metsubouDaimyoString = PlayerPrefs.GetString(metsubouTemp); char[] delimiterChars2 = { ',' }; if (metsubouDaimyoString != null && metsubouDaimyoString != "") { if (metsubouDaimyoString.Contains(",")) { metsubouDaimyoList = new List <string>(metsubouDaimyoString.Split(delimiterChars2)); } else { metsubouDaimyoList = new List <string>(metsubouDaimyoString.Split(delimiterChars2)); } } metsubouDaimyoList.Add(activeDaimyoId.ToString()); Entity_busyo_mst busyoMst = Resources.Load("Data/busyo_mst") as Entity_busyo_mst; List <int> busyoList = new List <int>(); for (int i = 0; i < busyoMst.param.Count; i++) { int busyoId = busyoMst.param[i].id; int daimyoId = busyoMst.param[i].daimyoId; if (metsubouDaimyoList.Contains(daimyoId.ToString())) { if (busyoId != daimyoBusyoId) { busyoList.Add(busyoId); } } } //minus if (usedBusyoList.Count > 0) { busyoList.RemoveAll(usedBusyoList.Contains); } /*Busyo Master Setting End*/ /*Random Shuffle*/ for (int i = 0; i < busyoList.Count; i++) { int temp = busyoList[i]; int randomIndex = UnityEngine.Random.Range(0, busyoList.Count); busyoList[i] = busyoList[randomIndex]; busyoList[randomIndex] = temp; } int min = (activeBusyoQty - 1) / 2; if (min < 1) { min = 1; } int max = activeBusyoQty - 1; activeBusyoQty = UnityEngine.Random.Range(min, max); for (int i = 0; i < activeBusyoQty; i++) { int busyoId = 0; if (busyoList.Count > i) { if (!usedBusyoList.Contains(busyoList[i])) { busyoId = busyoList[i]; usedBusyoList.Add(busyoId); } else { busyoId = 35; } } else { busyoId = 35; } if (i == 0) { returnString = busyoId.ToString(); } else { returnString = returnString + ":" + busyoId.ToString(); } totalHei = totalHei + getHei(busyoId, activeBusyoLv, activeButaiQty, activeButaiLv); } returnString = returnString + "," + totalHei.ToString(); return(returnString); }
public void showTenkahubuZukan(GameObject Content) { Entity_daimyo_mst daimyoMst = Resources.Load("Data/daimyo_mst") as Entity_daimyo_mst; Color backColor = new Color(95f / 255f, 95f / 255f, 95f / 255f, 210f / 255f); //Black Color kamonColor = new Color(105f / 255f, 105f / 255f, 105f / 255f, 135f / 255f); //Black string gameClearDaimyo = PlayerPrefs.GetString("gameClearDaimyo"); List <string> gameClearDaimyoList = new List <string> (); char[] delimiterChars = { ',' }; if (gameClearDaimyo != null && gameClearDaimyo != "") { if (gameClearDaimyo.Contains(",")) { gameClearDaimyoList = new List <string> (gameClearDaimyo.Split(delimiterChars)); } else { gameClearDaimyoList.Add(gameClearDaimyo); } } string gameClearDaimyoHard = PlayerPrefs.GetString("gameClearDaimyoHard"); List <string> gameClearDaimyoHardList = new List <string>(); if (gameClearDaimyoHard != null && gameClearDaimyoHard != "") { if (gameClearDaimyoHard.Contains(",")) { gameClearDaimyoHardList = new List <string>(gameClearDaimyoHard.Split(delimiterChars)); } else { gameClearDaimyoHardList.Add(gameClearDaimyoHard); } } string tenkahubuPath = "Prefabs/Item/Tenkahubu/tenkahubu"; string nameWhitePath = "Prefabs/Zukan/NameWhite"; string nameBlackPath = "Prefabs/Zukan/NameBlack"; for (int i = 0; i < daimyoMst.param.Count; i++) { int daimyoId = daimyoMst.param[i].daimyoId; GameObject tenkahubuIcon = Instantiate(Resources.Load(tenkahubuPath)) as GameObject; tenkahubuIcon.transform.SetParent(Content.transform); tenkahubuIcon.transform.localScale = new Vector2(1, 1); tenkahubuIcon.transform.localPosition = new Vector3(0, 0, 0); GameObject kamonIcon = tenkahubuIcon.transform.FindChild("kamon").gameObject; string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString(); kamonIcon.GetComponent <Image> ().sprite = Resources.Load(imagePath, typeof(Sprite)) as Sprite; RectTransform kamonRect = kamonIcon.GetComponent <RectTransform>(); kamonRect.anchoredPosition3D = new Vector3(80, -95, 0); kamonRect.sizeDelta = new Vector3(100, 100, 0); GameObject tenkaIcon = tenkahubuIcon.transform.FindChild("Image").gameObject; RectTransform tenkaRect = tenkaIcon.GetComponent <RectTransform>(); tenkaRect.anchoredPosition3D = new Vector3(20, 10, 0); tenkaRect.sizeDelta = new Vector3(80, 100, 0); if (!gameClearDaimyoList.Contains(daimyoId.ToString())) { tenkahubuIcon.GetComponent <Image>().color = backColor; kamonIcon.GetComponent <Image>().color = kamonColor; tenkahubuIcon.transform.FindChild("Image").GetComponent <Image>().enabled = false; GameObject nameObj = Instantiate(Resources.Load(nameWhitePath)) as GameObject; nameObj.transform.SetParent(tenkahubuIcon.transform); nameObj.transform.localScale = new Vector2(0.25f, 0.25f); if (Application.systemLanguage != SystemLanguage.Japanese) { nameObj.GetComponent <Text>().text = daimyoMst.param[i].daimyoNameEng; } else { nameObj.GetComponent <Text>().text = daimyoMst.param[i].daimyoName; } nameObj.transform.localPosition = new Vector2(0, 60); Destroy(tenkahubuIcon.transform.FindChild("Hard").gameObject); } else { GameObject nameObj = Instantiate(Resources.Load(nameBlackPath)) as GameObject; nameObj.transform.SetParent(tenkahubuIcon.transform); nameObj.transform.localScale = new Vector2(0.25f, 0.25f); if (Application.systemLanguage != SystemLanguage.Japanese) { nameObj.GetComponent <Text>().text = daimyoMst.param[i].daimyoNameEng; } else { nameObj.GetComponent <Text>().text = daimyoMst.param[i].daimyoName; } nameObj.transform.localPosition = new Vector2(0, 60); if (!gameClearDaimyoHardList.Contains((daimyoId.ToString()))) { Destroy(tenkahubuIcon.transform.FindChild("Hard").gameObject); } } } //Qty int NowQty = gameClearDaimyoList.Count; int AllQty = daimyoMst.param.Count; float percent = (float)NowQty / (float)AllQty * 100; GameObject.Find("NowQty").GetComponent <Text> ().text = NowQty.ToString(); GameObject.Find("AllQty").GetComponent <Text> ().text = AllQty.ToString() + "(" + percent.ToString("F1") + "%)"; }
public void kuniScrollView(GameObject baseObj, string targetDaimyo, GameObject btn) { GameObject content = baseObj.transform.FindChild("scroll").transform.FindChild("Content").gameObject; string seiryoku = PlayerPrefs.GetString("seiryoku"); char[] delimiterChars = { ',' }; List <string> seiryokuList = new List <string>(); seiryokuList = new List <string> (seiryoku.Split(delimiterChars)); //my kuni int myDaimyo = PlayerPrefs.GetInt("myDaimyo"); string myKuni = PlayerPrefs.GetString("clearedKuni"); List <int> myKuniList = new List <int>(); if (myKuni.Contains(",")) { List <string> tempMyKuniList = new List <string> (myKuni.Split(delimiterChars)); myKuniList = tempMyKuniList.ConvertAll(x => int.Parse(x)); } else { myKuniList.Add(int.Parse(myKuni)); } //doumei daimyo's opne kuni KuniInfo kuni = new KuniInfo(); List <int> doumeiOpenKuniList = new List <int>(); List <int> doumeiKuniList = new List <int>(); for (int i = 0; i < seiryokuList.Count; i++) { string tempDaimyo = seiryokuList[i]; if (tempDaimyo == targetDaimyo) { int doumeiKuniId = i + 1; doumeiKuniList.Add(doumeiKuniId); doumeiOpenKuniList.AddRange(kuni.getMappingKuni(doumeiKuniId)); } } //"doumei daimyo's opne kuni" minus "my kuni" List <int> doumeiOpenKuniMinusMyKuniList = new List <int>(); foreach (int n in doumeiOpenKuniList) { if (!myKuniList.Contains(n)) { doumeiOpenKuniMinusMyKuniList.Add(n); } } //"doumei daimyo's doumei check string tempDoumei = "doumei" + targetDaimyo; string doumei = PlayerPrefs.GetString(tempDoumei); List <string> doumeiList = new List <string>(); if (doumei.Contains(",")) { doumeiList = new List <string> (doumei.Split(delimiterChars)); } else { doumeiList.Add(doumei); } if (doumei != null && doumei != "") { for (int t = 0; t < doumeiOpenKuniMinusMyKuniList.Count; t++) { //foreach (int n in doumeiOpenKuniMinusMyKuniList) { string checkDaimyoId = seiryokuList [doumeiOpenKuniMinusMyKuniList[t] - 1]; if (doumeiList.Contains(checkDaimyoId)) { doumeiOpenKuniMinusMyKuniList.Remove(doumeiOpenKuniMinusMyKuniList[t]); } } } //Compare "doumei open" with "my open" string myOpenKuni = PlayerPrefs.GetString("openKuni"); List <int> myOpenKuniList = new List <int>(); if (myOpenKuni.Contains(",")) { List <string> tempMyOpenKuniList = new List <string> (myOpenKuni.Split(delimiterChars)); myOpenKuniList = tempMyOpenKuniList.ConvertAll(x => int.Parse(x)); } else { myOpenKuniList.Add(int.Parse(myOpenKuni)); } List <int> sameTargetKuniList = new List <int>(); foreach (int n in myOpenKuniList) { if (doumeiOpenKuniMinusMyKuniList.Contains(n)) { if (!doumeiKuniList.Contains(n)) { if (!sameTargetKuniList.Contains(n)) { sameTargetKuniList.Add(n); } } } } /*Slot making*/ string temp = "gaikou" + targetDaimyo; int myYukoudo = PlayerPrefs.GetInt(temp); //Get Chiryaku Daimyo daimyoScript = new Daimyo(); Entity_daimyo_mst daimyoMst = Resources.Load("Data/daimyo_mst") as Entity_daimyo_mst; int myDaimyoBusyoId = daimyoMst.param [myDaimyo - 1].busyoId; BusyoInfoGet busyo = new BusyoInfoGet(); int chiryaku = busyo.getMaxDfc(myDaimyoBusyoId); //StatusGet sts = new StatusGet(); //int lv = PlayerPrefs.GetInt (myDaimyoBusyoId.ToString()); //float chiryaku = (float)sts.getDfc(myDaimyoBusyoId,lv); //chiryaku = chiryaku *10; string slotPath = "Prefabs/Map/common/kuniSlot"; for (int i = 0; i < sameTargetKuniList.Count; i++) { GameObject prefab = Instantiate(Resources.Load(slotPath)) as GameObject; prefab.transform.SetParent(content.transform); prefab.transform.localScale = new Vector3(1, 1, 1); int kuniId = sameTargetKuniList[i]; int daimyoId = int.Parse(seiryokuList [kuniId - 1]); // daimyoName = daimyoMst.param [daimyoId - 1].daimyoName; string daimyoName = daimyoScript.getName(daimyoId); string theirYukouTemp = ""; if (int.Parse(targetDaimyo) < daimyoId) { theirYukouTemp = targetDaimyo + "gaikou" + daimyoId.ToString(); } else { theirYukouTemp = daimyoId.ToString() + "gaikou" + targetDaimyo; } int theirYukoudo = PlayerPrefs.GetInt(theirYukouTemp); string kuniName = kuni.getKuniName(kuniId); prefab.transform.FindChild("KuniValue").GetComponent <Text>().text = kuniName; prefab.transform.FindChild("DaimyoValue").GetComponent <Text>().text = daimyoName; prefab.GetComponent <GaikouKuniSelect>().Content = content; prefab.GetComponent <GaikouKuniSelect>().Btn = btn; prefab.GetComponent <GaikouKuniSelect>().myYukoudo = myYukoudo; prefab.GetComponent <GaikouKuniSelect>().chiryaku = chiryaku; prefab.GetComponent <GaikouKuniSelect>().kuniDiff = kuniDiff; prefab.GetComponent <GaikouKuniSelect>().theirYukoudo = theirYukoudo; prefab.GetComponent <GaikouKuniSelect>().kuniName = kuniName; prefab.GetComponent <GaikouKuniSelect>().targetKuniId = kuniId; if (i == 0) { prefab.GetComponent <GaikouKuniSelect>().OnClick(); } } if (sameTargetKuniList.Count == 0) { string msgPath = "Prefabs/Map/gaikou/NoKyoutouMsg"; GameObject msg = Instantiate(Resources.Load(msgPath)) as GameObject; msg.transform.SetParent(GameObject.Find("scroll").transform); msg.transform.localScale = new Vector3(0.17f, 0.2f, 1); RectTransform msgTransform = msg.GetComponent <RectTransform> (); msgTransform.anchoredPosition = new Vector3(-260, -115, 0); GameObject a = baseObj.transform.FindChild("RequiredMoney").gameObject; GameObject b = baseObj.transform.FindChild("KyoutouRatio").gameObject; Destroy(a); Destroy(b); btn.GetComponent <Button>().enabled = false; Color NGClorBtn = new Color(133 / 255f, 133 / 255f, 80 / 255f, 255f / 255f); Color NGClorTxt = new Color(90 / 255f, 90 / 255f, 40 / 255f, 255f / 255f); btn.GetComponent <Image>().color = NGClorBtn; btn.transform.FindChild("Text").GetComponent <Text>().color = NGClorTxt; btn.transform.FindChild("hyourouIcon").GetComponent <Image>().color = NGClorBtn; btn.transform.FindChild("hyourouIcon").transform.FindChild("hyourouNoValue").GetComponent <Text>().color = NGClorTxt; btn.transform.FindChild("hyourouIcon").transform.FindChild("hyourouNoValue").transform.FindChild("syouhiText").GetComponent <Text>().color = NGClorTxt; } }