// Use this for initialization public void PrepareBusyoScrollMenu(List <string> jinkeiBusyo_list) { //Clear Previous Unit foreach (Transform chd in GameObject.Find("Content").transform) { //Delete Destroy(chd.gameObject); } //Scroll View Change string myBusyoString = PlayerPrefs.GetString("myBusyo"); char[] delimiterChars = { ',' }; List <string> myBusyo_list = new List <string>(); if (myBusyoString.Contains(",")) { myBusyo_list = new List <string>(myBusyoString.Split(delimiterChars)); } else { myBusyo_list.Add(myBusyoString); } for (int i = 0; i < jinkeiBusyo_list.Count; i++) { myBusyo_list.Remove(jinkeiBusyo_list[i]); } //Instantiate scroll view string scrollPath = "Prefabs/Jinkei/Slot"; BusyoInfoGet busyoScript = new BusyoInfoGet(); for (int j = 0; j < myBusyo_list.Count; j++) { //Slot GameObject prefab = Instantiate(Resources.Load(scrollPath)) as GameObject; prefab.transform.SetParent(GameObject.Find("Content").transform); prefab.transform.localScale = new Vector3(1, 1, 1); prefab.transform.localPosition = new Vector3(0, 0, 0); prefab.name = "Slot"; prefab.GetComponent <LayoutElement>().minHeight = 110; prefab.GetComponent <LayoutElement>().minWidth = 110; //Busyo if (Application.loadedLevelName == "preKassen") { string busyoPath = "Prefabs/Player/Unit/BusyoUnit"; GameObject busyo = Instantiate(Resources.Load(busyoPath)) as GameObject; busyo.name = myBusyo_list[j]; //Add Kamon string KamonPath = "Prefabs/Jinkei/Kamon"; GameObject kamon = Instantiate(Resources.Load(KamonPath)) as GameObject; kamon.transform.SetParent(busyo.transform); kamon.transform.localScale = new Vector2(0.1f, 0.1f); kamon.transform.localPosition = new Vector2(-15, -12); int daimyoId = busyoScript.getDaimyoId(int.Parse(busyo.name)); if (daimyoId == 0) { daimyoId = busyoScript.getDaimyoHst(int.Parse(busyo.name)); } string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString(); kamon.GetComponent <Image>().sprite = Resources.Load(imagePath, typeof(Sprite)) as Sprite; //Add Heisyu string heisyu = busyoScript.getHeisyu(int.Parse(busyo.name)); string heisyuPath = "Prefabs/Jinkei/" + heisyu; GameObject heisyuObj = Instantiate(Resources.Load(heisyuPath)) as GameObject; heisyuObj.transform.SetParent(busyo.transform, false); heisyuObj.transform.localPosition = new Vector2(10, -10); heisyuObj.transform.SetAsFirstSibling(); busyo.transform.SetParent(prefab.transform); busyo.transform.localScale = new Vector3(3, 3, 3); busyo.name = myBusyo_list[j].ToString(); busyo.AddComponent <Senryoku>().GetPlayerSenryoku(busyo.name); busyo.transform.localPosition = new Vector3(0, 0, 0); } else if (Application.loadedLevelName == "preKaisen") { preKaisen prekasienScript = new preKaisen(); int busyoId = int.Parse(myBusyo_list[j]); string path = "Prefabs/Player/Unit/Ship"; GameObject tsyBusyo = Instantiate(Resources.Load(path)) as GameObject; tsyBusyo.name = busyoId.ToString(); prekasienScript.getShipSprite(tsyBusyo, busyoId); //Add Kamon string KamonPath = "Prefabs/Jinkei/Kamon"; GameObject kamon = Instantiate(Resources.Load(KamonPath)) as GameObject; kamon.transform.SetParent(tsyBusyo.transform); kamon.transform.localScale = new Vector2(0.1f, 0.1f); kamon.transform.localPosition = new Vector2(-15, -12); int daimyoId = busyoScript.getDaimyoId(int.Parse(tsyBusyo.name)); if (daimyoId == 0) { daimyoId = busyoScript.getDaimyoHst(int.Parse(tsyBusyo.name)); } string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString(); kamon.GetComponent <Image>().sprite = Resources.Load(imagePath, typeof(Sprite)) as Sprite; tsyBusyo.transform.SetParent(prefab.transform); tsyBusyo.transform.localScale = new Vector3(3, 3, 3); tsyBusyo.name = myBusyo_list[j].ToString(); tsyBusyo.AddComponent <Senryoku>().GetPlayerSenryoku(tsyBusyo.name); tsyBusyo.transform.localPosition = new Vector3(0, 0, 0); } } }
public void OnClick() { AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> (); audioSources [0].Play(); string pathOfBack = "Prefabs/Common/TouchBack"; GameObject back = Instantiate(Resources.Load(pathOfBack)) as GameObject; back.transform.parent = GameObject.Find("Panel").transform; back.transform.localScale = new Vector2(1, 1); back.transform.localPosition = new Vector2(0, 0); string pathOfPop = "Prefabs/Zukan/busyoPop"; GameObject pop = Instantiate(Resources.Load(pathOfPop)) as GameObject; pop.transform.parent = GameObject.Find("Panel").transform; pop.transform.localScale = new Vector2(1, 1); pop.transform.localPosition = new Vector2(0, 0); //Kamon GameObject kamon = pop.transform.FindChild("kamon").gameObject; string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString(); kamon.GetComponent <Image> ().sprite = Resources.Load(imagePath, typeof(Sprite)) as Sprite; //Busyo Icon string busyoPath = "Prefabs/Player/Unit/BusyoUnit"; GameObject busyo = Instantiate(Resources.Load(busyoPath)) as GameObject; busyo.name = busyoId.ToString(); busyo.transform.SetParent(pop.transform); busyo.transform.localScale = new Vector2(7, 7); busyo.GetComponent <DragHandler>().enabled = false; RectTransform busyoRect = busyo.GetComponent <RectTransform>(); busyoRect.anchoredPosition3D = new Vector3(180, 400, 0); busyoRect.sizeDelta = new Vector2(40, 40); busyo.transform.FindChild("Text").GetComponent <Text> ().enabled = false; //Ship Rank string shipPath = "Prefabs/Busyo/ShipSts"; GameObject ShipObj = Instantiate(Resources.Load(shipPath)) as GameObject; ShipObj.transform.SetParent(busyo.transform); preKaisen kaisenScript = new preKaisen(); int shipId = kaisenScript.getShipSprite(ShipObj, busyoId); ShipObj.transform.localPosition = new Vector3(-10, -15, 0); ShipObj.transform.localScale = new Vector2(0.2f, 0.2f); if (Application.systemLanguage != SystemLanguage.Japanese) { if (shipId == 1) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "High"; } else if (shipId == 2) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Mid"; } else if (shipId == 3) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Low"; } } else { if (shipId == 1) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "上"; } else if (shipId == 2) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "中"; } else if (shipId == 3) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "下"; } } //Name GameObject.Find("busyoNameValue").GetComponent <Text> ().text = busyoName; string heisyuName = ""; Message msg = new Message(); if (heisyu == "YR") { heisyuName = msg.getMessage(56); } else if (heisyu == "KB") { heisyuName = msg.getMessage(55); } else if (heisyu == "YM") { heisyuName = msg.getMessage(58); } else if (heisyu == "TP") { heisyuName = msg.getMessage(57); } GameObject.Find("ChildNameValue").GetComponent <Text> ().text = heisyuName; int newHp = hp * 100; GameObject.Find("TosotsuValue").GetComponent <Text> ().text = newHp.ToString(); int newAtk = atk * 10; GameObject.Find("BuyuuValue").GetComponent <Text> ().text = newAtk.ToString(); int newDfc = dfc * 10; GameObject.Find("ChiryakuValue").GetComponent <Text> ().text = newDfc.ToString(); GameObject.Find("SpeedValue").GetComponent <Text> ().text = spd.ToString(); //Senpou Entity_senpou_mst senpouMst = Resources.Load("Data/senpou_mst") as Entity_senpou_mst; if (Application.systemLanguage != SystemLanguage.Japanese) { GameObject.Find("SenpouValue").GetComponent <Text>().text = senpouMst.param[senpouId - 1].nameEng; } else { GameObject.Find("SenpouValue").GetComponent <Text>().text = senpouMst.param[senpouId - 1].name; } int senpouStatus = senpouMst.param [senpouId - 1].lv20; int each = (int)senpouMst.param [senpouId - 1].each; int ratio = (int)senpouMst.param [senpouId - 1].ratio; int term = (int)senpouMst.param [senpouId - 1].term; string senpouExp = ""; if (Application.systemLanguage != SystemLanguage.Japanese) { senpouExp = senpouMst.param [senpouId - 1].effectionEng; } else { senpouExp = senpouMst.param[senpouId - 1].effection; } if (Application.systemLanguage != SystemLanguage.Japanese) { senpouExp = senpouExp.Replace("ABC", senpouStatus.ToString()); senpouExp = senpouExp.Replace("DEF", each.ToString()); senpouExp = senpouExp.Replace("GHI", ratio.ToString()); senpouExp = senpouExp.Replace("JKL", term.ToString()); } else { senpouExp = senpouExp.Replace("A", senpouStatus.ToString()); senpouExp = senpouExp.Replace("B", each.ToString()); senpouExp = senpouExp.Replace("C", ratio.ToString()); senpouExp = senpouExp.Replace("D", term.ToString()); } GameObject.Find("SenpouExpValue").GetComponent <Text>().text = senpouExp; //Saku Saku saku = new Saku(); List <string> sakuList = new List <string>(); sakuList = saku.getSakuInfoLvMax(busyoId); string sakuPath = "Prefabs/Saku/saku" + sakuList[0]; GameObject sakuIcon = Instantiate(Resources.Load(sakuPath)) as GameObject; GameObject StatusSaku = GameObject.Find("StatusSaku").gameObject; foreach (Transform n in StatusSaku.transform) { if (n.tag == "Saku") { GameObject.Destroy(n.gameObject); } } sakuIcon.transform.SetParent(StatusSaku.transform); sakuIcon.transform.localScale = new Vector2(0.85f, 0.85f); sakuIcon.GetComponent <Button>().enabled = false; RectTransform sakuIcon_transform = sakuIcon.GetComponent <RectTransform>(); sakuIcon_transform.anchoredPosition = new Vector3(-360, 0, 0); StatusSaku.transform.FindChild("SakuExp").transform.FindChild("SakuExpValue").GetComponent <Text>().text = sakuList[2]; }
public void OnClick() { AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> (); audioSources [2].Play(); /*Busyo View*/ //Delete Previous foreach (Transform n in GameObject.Find("BusyoView").transform) { GameObject.Destroy(n.gameObject); } //Jinkei Flg if (jinkeiFlg) { string iconPath = "Prefabs/Busyo/Jinkei"; GameObject jinkei = Instantiate(Resources.Load(iconPath)) as GameObject; jinkei.transform.SetParent(GameObject.Find("BusyoView").transform); jinkei.transform.localScale = new Vector2(0.3f, 0.3f); jinkei.transform.localPosition = new Vector2(220, 200); jinkei.name = "jinkei"; } //Make New Busyo string busyoId; busyoId = this.name.Remove(0, 4); string path = "Prefabs/Player/Unit/BusyoUnit"; GameObject Busyo = Instantiate(Resources.Load(path)) as GameObject; Busyo.name = busyoId.ToString(); Busyo.transform.SetParent(GameObject.Find("BusyoView").transform); Busyo.transform.localScale = new Vector2(4, 4); Busyo.GetComponent <DragHandler> ().enabled = false; RectTransform rect_transform = Busyo.GetComponent <RectTransform>(); rect_transform.anchoredPosition3D = new Vector3(300, 200, 0); rect_transform.sizeDelta = new Vector2(100, 100); //Ship Rank string shipPath = "Prefabs/Busyo/ShipSts"; GameObject ShipObj = Instantiate(Resources.Load(shipPath)) as GameObject; ShipObj.transform.SetParent(Busyo.transform); preKaisen kaisenScript = new preKaisen(); int shipId = kaisenScript.getShipSprite(ShipObj, int.Parse(busyoId)); ShipObj.transform.localPosition = new Vector3(-40, -40, 0); ShipObj.transform.localScale = new Vector2(0.4f, 0.4f); if (Application.systemLanguage != SystemLanguage.Japanese) { if (shipId == 1) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "High"; } else if (shipId == 2) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Mid"; } else if (shipId == 3) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Low"; } } else { if (shipId == 1) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "上"; } else if (shipId == 2) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "中"; } else if (shipId == 3) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "下"; } } //Text Modification GameObject text = Busyo.transform.FindChild("Text").gameObject; text.GetComponent <Text> ().color = new Color(255, 255, 255, 255); RectTransform text_transform = text.GetComponent <RectTransform>(); text_transform.anchoredPosition3D = new Vector3(-70, 30, 0); text_transform.sizeDelta = new Vector2(630, 120); text.transform.localScale = new Vector2(0.2f, 0.2f); //Rank Text Modification GameObject rank = Busyo.transform.FindChild("Rank").gameObject; RectTransform rank_transform = rank.GetComponent <RectTransform>(); rank_transform.anchoredPosition3D = new Vector3(20, -50, 0); rank_transform.sizeDelta = new Vector2(200, 200); rank.GetComponent <Text>().fontSize = 200; /*Busyo Status*/ NowOnBusyo NowOnBusyoScript = GameObject.Find("GameScene").GetComponent <NowOnBusyo> (); BusyoInfoGet busyoInfoGetScript = new BusyoInfoGet(); if (GameObject.Find("GameScene").GetComponent <NowOnButton> ().onButton == "Ronkou") { int lv = PlayerPrefs.GetInt(busyoId); StatusGet sts = new StatusGet(); int hp = sts.getHp(int.Parse(busyoId), lv); int atk = sts.getAtk(int.Parse(busyoId), lv); int dfc = sts.getDfc(int.Parse(busyoId), lv); int spd = sts.getSpd(int.Parse(busyoId), lv); int adjHp = hp * 100; int adjAtk = atk * 10; int adjDfc = dfc * 10; //add lv string addLvTmp = "addlv" + busyoId.ToString(); if (PlayerPrefs.HasKey(addLvTmp)) { string addLvValue = "+" + PlayerPrefs.GetString(addLvTmp); GameObject.Find("addLvValue").GetComponent <Text>().text = addLvValue.ToString(); } else { GameObject.Find("addLvValue").GetComponent <Text>().text = ""; } int maxLv = 100 + PlayerPrefs.GetInt(addLvTmp); GameObject.Find("LvValue").GetComponent <Text> ().text = lv.ToString(); GameObject.Find("TosotsuValue").GetComponent <Text> ().text = adjHp.ToString(); GameObject.Find("BuyuuValue").GetComponent <Text> ().text = adjAtk.ToString(); GameObject.Find("ChiryakuValue").GetComponent <Text> ().text = adjDfc.ToString(); GameObject.Find("SpeedValue").GetComponent <Text> ().text = spd.ToString(); //Exp string expId = "exp" + busyoId.ToString(); string expString = ""; int nowExp = PlayerPrefs.GetInt(expId); Exp exp = new Exp(); int requiredExp = 0; if (lv != maxLv) { requiredExp = exp.getExpforNextLv(lv); } else { requiredExp = exp.getExpLvMax(maxLv); } expString = nowExp + "/" + requiredExp; GameObject.Find("ExpValue").GetComponent <Text> ().text = expString; //Kahou status KahouStatusGet kahouSts = new KahouStatusGet(); string[] KahouStatusArray = kahouSts.getKahouForStatus(busyoId, adjHp, adjAtk, adjDfc, spd); int totalBusyoHp = 0; //Kanni string kanniTmp = "kanni" + busyoId; float addAtkByKanni = 0; float addHpByKanni = 0; float addDfcByKanni = 0; if (PlayerPrefs.HasKey(kanniTmp)) { int kanniId = PlayerPrefs.GetInt(kanniTmp); if (kanniId != 0) { Kanni kanni = new Kanni(); string kanniIkai = kanni.getIkai(kanniId); string kanniName = kanni.getKanni(kanniId); GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text> ().text = kanniIkai + "\n" + kanniName; //Status string kanniTarget = kanni.getEffectTarget(kanniId); int effect = kanni.getEffect(kanniId); if (kanniTarget == "atk") { addAtkByKanni = ((float)adjAtk * (float)effect) / 100; } else if (kanniTarget == "hp") { addHpByKanni = ((float)adjHp * (float)effect) / 100; } else if (kanniTarget == "dfc") { addDfcByKanni = ((float)adjDfc * (float)effect) / 100; } } else { if (Application.systemLanguage != SystemLanguage.Japanese) { GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text>().text = "No Rank"; } else { GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text>().text = "官位無し"; } } } else { if (Application.systemLanguage != SystemLanguage.Japanese) { GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text> ().text = "No Rank"; } else { GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text>().text = "官位無し"; } } //Jyosyu string jyosyuTmp = "jyosyuBusyo" + busyoId; if (PlayerPrefs.HasKey(jyosyuTmp)) { int kuniId = PlayerPrefs.GetInt(jyosyuTmp); KuniInfo kuni = new KuniInfo(); string kuniName = kuni.getKuniName(kuniId); if (Application.systemLanguage != SystemLanguage.Japanese) { GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text> ().text = kuniName + "\nLord"; } else { GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text>().text = kuniName + "\n城主"; } } else { if (Application.systemLanguage != SystemLanguage.Japanese) { GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text>().text = "No Feud"; } else { GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text>().text = "城無し"; } } //Show Additional Status int finalAtk = int.Parse(KahouStatusArray [0]) + Mathf.FloorToInt(addAtkByKanni); int finalHp = int.Parse(KahouStatusArray [1]) + Mathf.FloorToInt(addHpByKanni); int finalDfc = int.Parse(KahouStatusArray [2]) + Mathf.FloorToInt(addDfcByKanni); int finalSpd = int.Parse(KahouStatusArray [3]); GameObject.Find("KahouAtkValue").GetComponent <Text> ().text = "+" + finalAtk.ToString(); GameObject.Find("KahouHpValue").GetComponent <Text>().text = "+" + finalHp.ToString(); totalBusyoHp = adjHp + finalHp; GameObject.Find("KahouDfcValue").GetComponent <Text>().text = "+" + finalDfc.ToString(); GameObject.Find("KahouSpdValue").GetComponent <Text>().text = "+" + finalSpd.ToString(); //Butai Status string heiId = "hei" + busyoId.ToString(); string chParam = PlayerPrefs.GetString(heiId, "0"); if (chParam == "0" || chParam == "") { StatusGet statusScript = new StatusGet(); string heisyu = statusScript.getHeisyu(int.Parse(busyoId)); chParam = heisyu + ":1:1:1"; PlayerPrefs.SetString(heiId, chParam); PlayerPrefs.Flush(); } if (chParam.Contains(":")) { char[] delimiterChars = { ':' }; string[] ch_list = chParam.Split(delimiterChars); string ch_type = ch_list [0]; int ch_num = int.Parse(ch_list [1]); int ch_lv = int.Parse(ch_list [2]); float ch_status = float.Parse(ch_list [3]); string heisyu = ""; Message msg = new Message(); if (ch_type == "KB") { heisyu = msg.getMessage(55); } else if (ch_type == "YR") { heisyu = msg.getMessage(56); } else if (ch_type == "TP") { heisyu = msg.getMessage(57); } else if (ch_type == "YM") { heisyu = msg.getMessage(58); } GameObject.Find("ChildNameValue").GetComponent <Text> ().text = heisyu; GameObject.Find("ChildQtyValue").GetComponent <Text> ().text = ch_num.ToString(); GameObject.Find("ChildLvValue").GetComponent <Text> ().text = ch_lv.ToString(); //Jyosyu Handling JyosyuHeiryoku jyosyuHei = new JyosyuHeiryoku(); float addHei = (float)jyosyuHei.GetJyosyuHeiryoku(busyoId); float hei = ch_status * 10; GameObject.Find("ChildHeiryokuValue").GetComponent <Text>().text = hei.ToString(); float newHei = finalHp + addHei; GameObject.Find("KahouHpValue").GetComponent <Text>().text = "+" + newHei.ToString(); int chAtkDfc = (int)sts.getChAtkDfc((int)hei, totalBusyoHp); string chAtkDfcString = chAtkDfc.ToString() + "/" + chAtkDfc.ToString(); GameObject.Find("ChildStatusValue").GetComponent <Text> ().text = chAtkDfcString; //Child Image foreach (Transform n in GameObject.Find("Img").transform) { GameObject.Destroy(n.gameObject); } string chPath = "Prefabs/Player/Unit/" + ch_type; GameObject chObj = Instantiate(Resources.Load(chPath)) as GameObject; chObj.transform.SetParent(GameObject.Find("Img").transform); RectTransform chTransform = chObj.GetComponent <RectTransform> (); chTransform.anchoredPosition3D = new Vector3(-200, -50, 0); chTransform.sizeDelta = new Vector2(40, 40); chObj.transform.localScale = new Vector2(4, 4); GameObject chigyo = GameObject.Find("ButtonCyouhei"); if (ch_num < 20) { chigyo.GetComponent <Image> ().color = OKClorBtn; chigyo.transform.FindChild("Text").GetComponent <Text> ().color = OKClorTxt; chigyo.GetComponent <Button>().enabled = true; chigyo.GetComponent <BusyoStatusButton> ().ch_type = ch_type; chigyo.GetComponent <BusyoStatusButton> ().ch_heisyu = heisyu; chigyo.GetComponent <BusyoStatusButton> ().ch_num = ch_num; chigyo.GetComponent <BusyoStatusButton> ().ch_status = chAtkDfc; chigyo.GetComponent <BusyoStatusButton> ().ch_hp = hei; chigyo.GetComponent <BusyoStatusButton> ().pa_hp = totalBusyoHp / 100; } else { //MAX chigyo.GetComponent <Image> ().color = NGClorBtn; chigyo.transform.FindChild("Text").GetComponent <Text> ().color = NGClorTxt; chigyo.GetComponent <Button>().enabled = false; } GameObject kunren = GameObject.Find("ButtonKunren"); if (ch_lv < 100) { kunren.GetComponent <Image> ().color = OKClorBtn; kunren.transform.FindChild("Text").GetComponent <Text> ().color = OKClorTxt; kunren.GetComponent <Button>().enabled = true; kunren.GetComponent <BusyoStatusButton> ().ch_type = ch_type; kunren.GetComponent <BusyoStatusButton> ().ch_heisyu = heisyu; kunren.GetComponent <BusyoStatusButton> ().ch_lv = ch_lv; kunren.GetComponent <BusyoStatusButton> ().ch_num = ch_num; kunren.GetComponent <BusyoStatusButton> ().ch_status = chAtkDfc; kunren.GetComponent <BusyoStatusButton> ().ch_hp = hei; kunren.GetComponent <BusyoStatusButton> ().pa_hp = totalBusyoHp / 100; } else { //MAX kunren.GetComponent <Image> ().color = NGClorBtn; kunren.transform.FindChild("Text").GetComponent <Text> ().color = NGClorTxt; kunren.GetComponent <Button>().enabled = false; } } //Parametor Setting NowOnBusyoScript.OnBusyo = busyoId; NowOnBusyoScript.OnBusyoName = busyoInfoGetScript.getName(int.Parse(busyoId)); } else if (GameObject.Find("GameScene").GetComponent <NowOnButton> ().onButton == "Senpou") { NowOnBusyoScript.OnBusyo = busyoId; NowOnBusyoScript.OnBusyoName = busyoInfoGetScript.getName(int.Parse(busyoId)); SenpouScene scene = new SenpouScene(); scene.createSenpouStatusView(busyoId); scene.createSakuStatusView(busyoId); } else if (GameObject.Find("GameScene").GetComponent <NowOnButton> ().onButton == "Kahou") { NowOnBusyoScript.OnBusyo = busyoId; NowOnBusyoScript.OnBusyoName = busyoInfoGetScript.getName(int.Parse(busyoId)); KahouScene kahou = new KahouScene(); kahou.createKahouStatusView(busyoId); } else if (GameObject.Find("GameScene").GetComponent <NowOnButton> ().onButton == "Syogu") { NowOnBusyoScript.OnBusyo = busyoId; NowOnBusyoScript.OnBusyoName = busyoInfoGetScript.getName(int.Parse(busyoId)); SyoguScene syogu = new SyoguScene(); syogu.createSyoguView(busyoId); } }
public void OnClick() { AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> (); audioSources [0].Play(); //Panel GameObject.Find("Touyou").GetComponent <Canvas>().sortingLayerName = "unit"; //Pop View BusyoStatusButton pop = new BusyoStatusButton(); GameObject board = pop.commonPopup(27); if (Application.systemLanguage != SystemLanguage.Japanese) { GameObject.Find("popText").GetComponent <Text> ().text = "Samurai Recruitment"; } else { GameObject.Find("popText").GetComponent <Text>().text = "武将登用"; } //Kamon string kamonPath = "Prefabs/Touyou/kamon"; GameObject kamon = Instantiate(Resources.Load(kamonPath)) as GameObject; kamon.transform.SetParent(board.transform); kamon.transform.localScale = new Vector2(1, 1); kamon.transform.localPosition = new Vector2(-310, 0); BusyoInfoGet busyoScript = new BusyoInfoGet(); int daimyoId = busyoScript.getDaimyoId(busyoId); if (daimyoId == 0) { daimyoId = busyoScript.getDaimyoHst(busyoId); } string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString(); kamon.GetComponent <Image> ().sprite = Resources.Load(imagePath, typeof(Sprite)) as Sprite; //Busyo View string path = "Prefabs/Player/Unit/BusyoUnit"; GameObject Busyo = Instantiate(Resources.Load(path)) as GameObject; Busyo.name = busyoId.ToString(); Busyo.transform.SetParent(board.transform); Busyo.transform.localScale = new Vector2(3.5f, 3.5f); Busyo.GetComponent <DragHandler>().enabled = false; RectTransform busyo_transform = Busyo.GetComponent <RectTransform>(); busyo_transform.anchoredPosition = new Vector3(350, 300, 0); busyo_transform.sizeDelta = new Vector2(100, 100); //Ship Rank string shipPath = "Prefabs/Busyo/ShipSts"; GameObject ShipObj = Instantiate(Resources.Load(shipPath)) as GameObject; ShipObj.transform.SetParent(Busyo.transform); preKaisen kaisenScript = new preKaisen(); int shipId = kaisenScript.getShipSprite(ShipObj, busyoId); ShipObj.transform.localPosition = new Vector3(-40, -40, 0); ShipObj.transform.localScale = new Vector2(0.5f, 0.5f); if (Application.systemLanguage != SystemLanguage.Japanese) { if (shipId == 1) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "High"; } else if (shipId == 2) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Mid"; } else if (shipId == 3) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Low"; } } else { if (shipId == 1) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "上"; } else if (shipId == 2) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "中"; } else if (shipId == 3) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "下"; } } //Text Modification Busyo.transform.FindChild("Text").gameObject.GetComponent <Text>().enabled = false; //Rank Text Modification GameObject rank = Busyo.transform.FindChild("Rank").gameObject; RectTransform rank_transform = rank.GetComponent <RectTransform>(); rank_transform.anchoredPosition = new Vector3(0, -50, 0); rank_transform.sizeDelta = new Vector2(200, 200); rank.GetComponent <Text>().fontSize = 200; /*Status*/ string statusPath = "Prefabs/Touyou/busyoStatus"; GameObject status = Instantiate(Resources.Load(statusPath)) as GameObject; status.transform.SetParent(board.transform); status.transform.localScale = new Vector2(1, 1); RectTransform status_transform = status.GetComponent <RectTransform>(); status_transform.anchoredPosition = new Vector3(245, -40, 0); Entity_busyo_mst busyoMst = Resources.Load("Data/busyo_mst") as Entity_busyo_mst; Entity_senpou_mst senpouMst = Resources.Load("Data/senpou_mst") as Entity_senpou_mst; string busyoName = busyoScript.getName(busyoId); GameObject.Find("busyoNameValue").GetComponent <Text>().text = busyoName; GameObject.Find("TosotsuValue").GetComponent <Text>().text = busyoMst.param [busyoId - 1].minHp.ToString() + "00"; GameObject.Find("BuyuuValue").GetComponent <Text> ().text = busyoMst.param [busyoId - 1].minAtk.ToString() + "0"; GameObject.Find("ChiryakuValue").GetComponent <Text>().text = busyoMst.param [busyoId - 1].minDfc.ToString() + "0"; GameObject.Find("SpeedValue").GetComponent <Text>().text = busyoMst.param [busyoId - 1].minSpd.ToString(); string heisyuType = busyoMst.param [busyoId - 1].heisyu; string heisyu = ""; Message msg = new Message(); if (heisyuType == "KB") { heisyu = msg.getMessage(55); } else if (heisyuType == "YR") { heisyu = msg.getMessage(56); } else if (heisyuType == "TP") { heisyu = msg.getMessage(57); } else if (heisyuType == "YM") { heisyu = msg.getMessage(58); } GameObject.Find("ChildNameValue").GetComponent <Text>().text = heisyu; int senpouId = busyoMst.param [busyoId - 1].senpou_id; if (Application.systemLanguage != SystemLanguage.Japanese) { GameObject.Find("SenpouValue").GetComponent <Text>().text = senpouMst.param[senpouId - 1].nameEng; } else { GameObject.Find("SenpouValue").GetComponent <Text>().text = senpouMst.param[senpouId - 1].name; } int senpouStatus = senpouMst.param [senpouId - 1].lv1; int each = (int)senpouMst.param [senpouId - 1].each; int ratio = (int)senpouMst.param [senpouId - 1].ratio; int term = (int)senpouMst.param [senpouId - 1].term; string senpouExp = ""; if (Application.systemLanguage != SystemLanguage.Japanese) { senpouExp = senpouMst.param [senpouId - 1].effectionEng; } else { senpouExp = senpouMst.param[senpouId - 1].effection; } if (Application.systemLanguage != SystemLanguage.Japanese) { senpouExp = senpouExp.Replace("ABC", senpouStatus.ToString()); senpouExp = senpouExp.Replace("DEF", each.ToString()); senpouExp = senpouExp.Replace("GHI", ratio.ToString()); senpouExp = senpouExp.Replace("JKL", term.ToString()); } else { senpouExp = senpouExp.Replace("A", senpouStatus.ToString()); senpouExp = senpouExp.Replace("B", each.ToString()); senpouExp = senpouExp.Replace("C", ratio.ToString()); senpouExp = senpouExp.Replace("D", term.ToString()); } GameObject.Find("SenpouExpValue").GetComponent <Text>().text = senpouExp; /*Saku*/ Saku saku = new Saku(); List <string> sakuList = new List <string>(); sakuList = saku.getSakuInfo(busyoId); //Icon string sakuPath = "Prefabs/Saku/saku" + sakuList[0]; GameObject sakuIcon = Instantiate(Resources.Load(sakuPath)) as GameObject; GameObject StatusSaku = status.transform.FindChild("StatusSaku").gameObject; foreach (Transform n in StatusSaku.transform) { if (n.tag == "Saku") { GameObject.Destroy(n.gameObject); } } sakuIcon.transform.SetParent(StatusSaku.transform); sakuIcon.transform.localScale = new Vector2(0.7f, 0.7f); sakuIcon.GetComponent <Button>().enabled = false; RectTransform sakuIcon_transform = sakuIcon.GetComponent <RectTransform>(); sakuIcon_transform.anchoredPosition = new Vector3(-235, 0, 0); StatusSaku.transform.FindChild("SakuExp").transform.FindChild("SakuExpValue").GetComponent <Text>().text = sakuList[2]; /*daimyo busyo check*/ Daimyo daimyo = new Daimyo(); daimyoFlg = daimyo.daimyoBusyoCheck(busyoId); //pass data to button GameObject touyouBtn = GameObject.Find("TouyouButton").gameObject; touyouBtn.GetComponent <DoTouyou> ().busyoId = busyoId; touyouBtn.GetComponent <DoTouyou> ().busyoName = busyoName; touyouBtn.GetComponent <DoTouyou> ().heisyu = heisyuType; touyouBtn.GetComponent <DoTouyou> ().sequence = int.Parse(name); touyouBtn.GetComponent <DoTouyou> ().rank = busyoRank; touyouBtn.GetComponent <DoTouyou> ().daimyoFlg = daimyoFlg; //Tutorial if (Application.loadedLevelName == "tutorialTouyou") { TutorialController tutorialScript = new TutorialController(); Vector2 vect = new Vector2(0, 50); GameObject btn = tutorialScript.SetPointer(touyouBtn, vect); btn.transform.localScale = new Vector2(150, 150); } //Hired Check if (Application.loadedLevelName != "tutorialTouyou") { string myBusyo = PlayerPrefs.GetString("myBusyo"); char[] delimiterChars = { ',' }; if (myBusyo != null && myBusyo != "") { List <string> myBusyoList = new List <string>(); if (myBusyo.Contains(",")) { myBusyoList = new List <string>(myBusyo.Split(delimiterChars)); } else { myBusyoList.Add(myBusyo); } if (myBusyoList.Contains(busyoId.ToString())) { msg.makeMessage(msg.getMessage(137)); } } //Zukan Check string zukanBusyoHst = PlayerPrefs.GetString("zukanBusyoHst"); if (zukanBusyoHst != null && zukanBusyoHst != "") { List <string> myZukanList = new List <string>(); if (zukanBusyoHst.Contains(",")) { myZukanList = new List <string>(zukanBusyoHst.Split(delimiterChars)); } else { myZukanList.Add(zukanBusyoHst); } if (myZukanList.Contains(busyoId.ToString())) { string zukanPath = "Prefabs/Touyou/Zukan"; GameObject zukan = Instantiate(Resources.Load(zukanPath)) as GameObject; zukan.transform.SetParent(board.transform); zukan.transform.localScale = new Vector2(1, 1); zukan.transform.localPosition = new Vector2(-41, 167); } } } }
public void OnClick() { AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> (); audioSources [0].Play(); Resources.UnloadUnusedAssets(); ButtonColorChanger(name); if (Application.loadedLevelName == "preKassen") { preKassen preKassenScript = GameObject.Find("GameScene").GetComponent <preKassen>(); int jinkei = 0; if (name == "Gyorin") { jinkei = 1; } else if (name == "Kakuyoku") { jinkei = 2; } else if (name == "Engetsu") { jinkei = 3; } else if (name == "Gankou") { jinkei = 4; } int weatherId = preKassenScript.weatherId; bool isAttackedFlg = preKassenScript.isAttackedFlg; preKassenScript.prekassenPlayerJinkei(jinkei, weatherId, isAttackedFlg, true); } else if (Application.loadedLevelName == "preKaisen") { preKaisen preKassenScript = GameObject.Find("GameScene").GetComponent <preKaisen>(); int jinkei = 0; if (name == "Gyorin") { jinkei = 1; } else if (name == "Kakuyoku") { jinkei = 2; } else if (name == "Engetsu") { jinkei = 3; } else if (name == "Gankou") { jinkei = 4; } int weatherId = preKassenScript.weatherId; bool isAttackedFlg = preKassenScript.isAttackedFlg; preKassenScript.prekassenPlayerJinkei(jinkei, weatherId, isAttackedFlg, true); } else { GameObject kakuteiButton = GameObject.Find("KakuteiButton"); GameObject gameScene = GameObject.Find("GameScene") as GameObject; int busyoQty = 0; //Clear Previous Unit foreach (GameObject obs in GameObject.FindGameObjectsWithTag("Slot")) { if (obs.transform.childCount > 0) { //Delete DestroyImmediate(obs.transform.GetChild(0).gameObject); } } //魚鱗 BusyoInfoGet busyoScript = new BusyoInfoGet(); if (name == "Gyorin") { int soudaisyo = PlayerPrefs.GetInt("soudaisyo1"); List <string> jinkeiBusyo_list = new List <string>(); kakuteiButton.GetComponent <Jinkei>().selectedJinkei = 1; foreach (GameObject obs in GameObject.FindGameObjectsWithTag("Slot")) { //Enable 1,2,7,8,11,12,13,14,17,18,21,22 if (obs.name == "Slot1" || obs.name == "Slot2" || obs.name == "Slot7" || obs.name == "Slot8" || obs.name == "Slot11" || obs.name == "Slot12" || obs.name == "Slot13" || obs.name == "Slot14" || obs.name == "Slot17" || obs.name == "Slot18" || obs.name == "Slot21" || obs.name == "Slot22") { obs.GetComponent <Image>().enabled = true; string mapId = "1map" + obs.name.Substring(4); if (PlayerPrefs.HasKey(mapId)) { busyoQty = busyoQty + 1; int busyoId = PlayerPrefs.GetInt(mapId); //Instantiate string path = "Prefabs/Player/Unit/BusyoUnit"; GameObject chldBusyo = Instantiate(Resources.Load(path)) as GameObject; chldBusyo.name = busyoId.ToString(); chldBusyo.transform.parent = obs.transform; chldBusyo.name = busyoId.ToString(); chldBusyo.transform.localScale = new Vector2(4, 4); chldBusyo.AddComponent <Senryoku>().GetPlayerSenryoku(chldBusyo.name); jinkeiBusyo_list.Add(busyoId.ToString()); chldBusyo.transform.localPosition = new Vector3(0, 0, 0); //Button chldBusyo.AddComponent <Button>(); chldBusyo.AddComponent <Soudaisyo>(); chldBusyo.GetComponent <Button>().onClick.AddListener(chldBusyo.GetComponent <Soudaisyo>().OnClick); //soudaisyo if (soudaisyo == int.Parse(chldBusyo.name)) { chldBusyo.GetComponent <Soudaisyo>().OnClick(); } //Add Kamon string KamonPath = "Prefabs/Jinkei/Kamon"; GameObject kamon = Instantiate(Resources.Load(KamonPath)) as GameObject; kamon.transform.SetParent(chldBusyo.transform); kamon.transform.localScale = new Vector2(0.1f, 0.1f); kamon.transform.localPosition = new Vector2(-15, -12); int daimyoId = busyoScript.getDaimyoId(int.Parse(chldBusyo.name)); if (daimyoId == 0) { daimyoId = busyoScript.getDaimyoHst(int.Parse(chldBusyo.name)); } string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString(); kamon.GetComponent <Image>().sprite = Resources.Load(imagePath, typeof(Sprite)) as Sprite; //Add Heisyu string heisyu = busyoScript.getHeisyu(int.Parse(chldBusyo.name)); string heisyuPath = "Prefabs/Jinkei/" + heisyu; GameObject heisyuObj = Instantiate(Resources.Load(heisyuPath)) as GameObject; heisyuObj.transform.SetParent(chldBusyo.transform, false); heisyuObj.transform.localPosition = new Vector2(10, -10); heisyuObj.transform.SetAsFirstSibling(); } //Disable 3,4,5,6,9,15,16,19,20,23,24,25 } else { obs.GetComponent <Image>().enabled = false; if (obs.transform.IsChildOf(obs.transform)) { foreach (Transform n in obs.transform) { GameObject.Destroy(n.gameObject); } } } } gameScene.GetComponent <JinkeiScene>().UnitOnScrollView(jinkeiBusyo_list); //鶴翼 } else if (name == "Kakuyoku") { int soudaisyo = PlayerPrefs.GetInt("soudaisyo2"); List <string> jinkeiBusyo_list = new List <string>(); kakuteiButton.GetComponent <Jinkei>().selectedJinkei = 2; foreach (GameObject obs in GameObject.FindGameObjectsWithTag("Slot")) { //Enable 3,4,5,7,8,11,12,17,18,23,24,25 if (obs.name == "Slot3" || obs.name == "Slot4" || obs.name == "Slot5" || obs.name == "Slot7" || obs.name == "Slot8" || obs.name == "Slot11" || obs.name == "Slot12" || obs.name == "Slot17" || obs.name == "Slot18" || obs.name == "Slot23" || obs.name == "Slot24" || obs.name == "Slot25") { obs.GetComponent <Image>().enabled = true; string mapId = "2map" + obs.name.Substring(4); if (PlayerPrefs.HasKey(mapId)) { busyoQty = busyoQty + 1; int busyoId = PlayerPrefs.GetInt(mapId); //Instantiate string path = "Prefabs/Player/Unit/BusyoUnit"; GameObject chldBusyo = Instantiate(Resources.Load(path)) as GameObject; chldBusyo.name = busyoId.ToString(); chldBusyo.transform.parent = obs.transform; chldBusyo.name = busyoId.ToString(); chldBusyo.transform.localScale = new Vector2(4, 4); chldBusyo.AddComponent <Senryoku>().GetPlayerSenryoku(chldBusyo.name); jinkeiBusyo_list.Add(busyoId.ToString()); chldBusyo.transform.localPosition = new Vector3(0, 0, 0); //Button chldBusyo.AddComponent <Button>(); chldBusyo.AddComponent <Soudaisyo>(); chldBusyo.GetComponent <Button>().onClick.AddListener(chldBusyo.GetComponent <Soudaisyo>().OnClick); //soudaisyo if (soudaisyo == int.Parse(chldBusyo.name)) { chldBusyo.GetComponent <Soudaisyo>().OnClick(); } //Add Kamon string KamonPath = "Prefabs/Jinkei/Kamon"; GameObject kamon = Instantiate(Resources.Load(KamonPath)) as GameObject; kamon.transform.SetParent(chldBusyo.transform); kamon.transform.localScale = new Vector2(0.1f, 0.1f); kamon.transform.localPosition = new Vector2(-15, -12); int daimyoId = busyoScript.getDaimyoId(int.Parse(chldBusyo.name)); if (daimyoId == 0) { daimyoId = busyoScript.getDaimyoHst(int.Parse(chldBusyo.name)); } string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString(); kamon.GetComponent <Image>().sprite = Resources.Load(imagePath, typeof(Sprite)) as Sprite; //Add Heisyu string heisyu = busyoScript.getHeisyu(int.Parse(chldBusyo.name)); string heisyuPath = "Prefabs/Jinkei/" + heisyu; GameObject heisyuObj = Instantiate(Resources.Load(heisyuPath)) as GameObject; heisyuObj.transform.SetParent(chldBusyo.transform, false); heisyuObj.transform.localPosition = new Vector2(10, -10); heisyuObj.transform.SetAsFirstSibling(); } //Disable 1,2,6,9,10,13,14,15,16,19,20,21 } else { obs.GetComponent <Image>().enabled = false; if (obs.transform.IsChildOf(obs.transform)) { foreach (Transform n in obs.transform) { GameObject.Destroy(n.gameObject); } } } } gameScene.GetComponent <JinkeiScene>().UnitOnScrollView(jinkeiBusyo_list); //偃月 } else if (name == "Engetsu") { int soudaisyo = PlayerPrefs.GetInt("soudaisyo3"); List <string> jinkeiBusyo_list = new List <string>(); kakuteiButton.GetComponent <Jinkei>().selectedJinkei = 3; foreach (GameObject obs in GameObject.FindGameObjectsWithTag("Slot")) { //Enable 3,7,8,9,11,12,14,15,16,20,21,25 if (obs.name == "Slot3" || obs.name == "Slot7" || obs.name == "Slot8" || obs.name == "Slot9" || obs.name == "Slot11" || obs.name == "Slot12" || obs.name == "Slot14" || obs.name == "Slot15" || obs.name == "Slot16" || obs.name == "Slot20" || obs.name == "Slot21" || obs.name == "Slot25") { obs.GetComponent <Image>().enabled = true; string mapId = "3map" + obs.name.Substring(4); if (PlayerPrefs.HasKey(mapId)) { busyoQty = busyoQty + 1; int busyoId = PlayerPrefs.GetInt(mapId); //Instantiate string path = "Prefabs/Player/Unit/BusyoUnit"; GameObject chldBusyo = Instantiate(Resources.Load(path)) as GameObject; chldBusyo.name = busyoId.ToString(); chldBusyo.transform.parent = obs.transform; chldBusyo.name = busyoId.ToString(); chldBusyo.transform.localScale = new Vector2(4, 4); chldBusyo.AddComponent <Senryoku>().GetPlayerSenryoku(chldBusyo.name); jinkeiBusyo_list.Add(busyoId.ToString()); chldBusyo.transform.localPosition = new Vector3(0, 0, 0); //Button chldBusyo.AddComponent <Button>(); chldBusyo.AddComponent <Soudaisyo>(); chldBusyo.GetComponent <Button>().onClick.AddListener(chldBusyo.GetComponent <Soudaisyo>().OnClick); //soudaisyo if (soudaisyo == int.Parse(chldBusyo.name)) { chldBusyo.GetComponent <Soudaisyo>().OnClick(); } //Add Kamon string KamonPath = "Prefabs/Jinkei/Kamon"; GameObject kamon = Instantiate(Resources.Load(KamonPath)) as GameObject; kamon.transform.SetParent(chldBusyo.transform); kamon.transform.localScale = new Vector2(0.1f, 0.1f); kamon.transform.localPosition = new Vector2(-15, -12); int daimyoId = busyoScript.getDaimyoId(int.Parse(chldBusyo.name)); if (daimyoId == 0) { daimyoId = busyoScript.getDaimyoHst(int.Parse(chldBusyo.name)); } string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString(); kamon.GetComponent <Image>().sprite = Resources.Load(imagePath, typeof(Sprite)) as Sprite; //Add Heisyu string heisyu = busyoScript.getHeisyu(int.Parse(chldBusyo.name)); string heisyuPath = "Prefabs/Jinkei/" + heisyu; GameObject heisyuObj = Instantiate(Resources.Load(heisyuPath)) as GameObject; heisyuObj.transform.SetParent(chldBusyo.transform, false); heisyuObj.transform.localPosition = new Vector2(10, -10); heisyuObj.transform.SetAsFirstSibling(); } //Disable 1,2,4,5,6,10,13,17,18,19,22,23,24 } else { obs.GetComponent <Image>().enabled = false; if (obs.transform.IsChildOf(obs.transform)) { foreach (Transform n in obs.transform) { GameObject.Destroy(n.gameObject); } } } } gameScene.GetComponent <JinkeiScene>().UnitOnScrollView(jinkeiBusyo_list); //雁行 } else if (name == "Gankou") { int soudaisyo = PlayerPrefs.GetInt("soudaisyo4"); List <string> jinkeiBusyo_list = new List <string>(); kakuteiButton.GetComponent <Jinkei>().selectedJinkei = 4; foreach (GameObject obs in GameObject.FindGameObjectsWithTag("Slot")) { //Enable 1,2,7,8,12,13,14,18,19,20,24,25 if (obs.name == "Slot1" || obs.name == "Slot2" || obs.name == "Slot7" || obs.name == "Slot8" || obs.name == "Slot12" || obs.name == "Slot13" || obs.name == "Slot14" || obs.name == "Slot18" || obs.name == "Slot19" || obs.name == "Slot20" || obs.name == "Slot24" || obs.name == "Slot25") { obs.GetComponent <Image>().enabled = true; string mapId = "4map" + obs.name.Substring(4); if (PlayerPrefs.HasKey(mapId)) { busyoQty = busyoQty + 1; int busyoId = PlayerPrefs.GetInt(mapId); //Instantiate string path = "Prefabs/Player/Unit/BusyoUnit"; GameObject chldBusyo = Instantiate(Resources.Load(path)) as GameObject; chldBusyo.name = busyoId.ToString(); chldBusyo.transform.parent = obs.transform; chldBusyo.name = busyoId.ToString(); chldBusyo.transform.localScale = new Vector2(4, 4); chldBusyo.AddComponent <Senryoku>().GetPlayerSenryoku(chldBusyo.name); jinkeiBusyo_list.Add(busyoId.ToString()); chldBusyo.transform.localPosition = new Vector3(0, 0, 0); //Button chldBusyo.AddComponent <Button>(); chldBusyo.AddComponent <Soudaisyo>(); chldBusyo.GetComponent <Button>().onClick.AddListener(chldBusyo.GetComponent <Soudaisyo>().OnClick); //soudaisyo if (soudaisyo == int.Parse(chldBusyo.name)) { chldBusyo.GetComponent <Soudaisyo>().OnClick(); } //Add Kamon string KamonPath = "Prefabs/Jinkei/Kamon"; GameObject kamon = Instantiate(Resources.Load(KamonPath)) as GameObject; kamon.transform.SetParent(chldBusyo.transform); kamon.transform.localScale = new Vector2(0.1f, 0.1f); kamon.transform.localPosition = new Vector2(-15, -12); int daimyoId = busyoScript.getDaimyoId(int.Parse(chldBusyo.name)); if (daimyoId == 0) { daimyoId = busyoScript.getDaimyoHst(int.Parse(chldBusyo.name)); } string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString(); kamon.GetComponent <Image>().sprite = Resources.Load(imagePath, typeof(Sprite)) as Sprite; //Add Heisyu string heisyu = busyoScript.getHeisyu(int.Parse(chldBusyo.name)); string heisyuPath = "Prefabs/Jinkei/" + heisyu; GameObject heisyuObj = Instantiate(Resources.Load(heisyuPath)) as GameObject; heisyuObj.transform.SetParent(chldBusyo.transform, false); heisyuObj.transform.localPosition = new Vector2(10, -10); heisyuObj.transform.SetAsFirstSibling(); } //Disable 3,4,5,6,9,10,11,15,16,17,21,22,23 } else { obs.GetComponent <Image>().enabled = false; if (obs.transform.IsChildOf(obs.transform)) { foreach (Transform n in obs.transform) { GameObject.Destroy(n.gameObject); } } } } gameScene.GetComponent <JinkeiScene>().UnitOnScrollView(jinkeiBusyo_list); } //Qty of Busyo on Status GameObject.Find("jinkeiQtyValue").GetComponent <Text> ().text = busyoQty.ToString(); JinkeiPowerEffection powerEffection = new JinkeiPowerEffection(); powerEffection.UpdateSenryoku(); } }
public void createBusyoView(string busyoId) { string path = "Prefabs/Player/Unit/BusyoUnit"; GameObject Busyo = Instantiate(Resources.Load(path)) as GameObject; Busyo.name = busyoId; Busyo.transform.SetParent(GameObject.Find("BusyoView").transform); Busyo.transform.localScale = new Vector2(4, 4); RectTransform rect_transform = Busyo.GetComponent <RectTransform>(); rect_transform.anchoredPosition3D = new Vector3(300, 200, 0); rect_transform.sizeDelta = new Vector2(100, 100); Busyo.GetComponent <DragHandler> ().enabled = false; //Ship Rank string shipPath = "Prefabs/Busyo/ShipSts"; GameObject ShipObj = Instantiate(Resources.Load(shipPath)) as GameObject; ShipObj.transform.SetParent(Busyo.transform); preKaisen kaisenScript = new preKaisen(); int shipId = kaisenScript.getShipSprite(ShipObj, int.Parse(busyoId)); ShipObj.transform.localPosition = new Vector3(-40, -40, 0); ShipObj.transform.localScale = new Vector2(0.4f, 0.4f); if (Application.systemLanguage != SystemLanguage.Japanese) { if (shipId == 1) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "High"; } else if (shipId == 2) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Mid"; } else if (shipId == 3) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Low"; } } else { if (shipId == 1) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "上"; } else if (shipId == 2) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "中"; } else if (shipId == 3) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "下"; } } //Text Modification GameObject text = Busyo.transform.FindChild("Text").gameObject; text.GetComponent <Text> ().color = new Color(255, 255, 255, 255); RectTransform text_transform = text.GetComponent <RectTransform>(); text_transform.anchoredPosition3D = new Vector3(-70, 30, 0); text_transform.sizeDelta = new Vector2(630, 120); text.transform.localScale = new Vector2(0.2f, 0.2f); //Keep busyo name BusyoInfoGet busyoScript = new BusyoInfoGet(); string busyoName = busyoScript.getName(int.Parse(busyoId)); GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyoName = busyoName; //Rank Text Modification GameObject rank = Busyo.transform.FindChild("Rank").gameObject; RectTransform rank_transform = rank.GetComponent <RectTransform>(); rank_transform.anchoredPosition3D = new Vector3(20, -50, 0); rank_transform.sizeDelta = new Vector2(200, 200); rank.GetComponent <Text>().fontSize = 200; }
public void OnClick() { if (Application.loadedLevelName != "tutorialHyojyo") { //Get Senryoku Senryoku Senryoku = null; foreach (Transform child in transform) { Senryoku = child.GetComponent <Senryoku>(); busyoId = int.Parse(child.name); } BusyoInfoGet BusyoInfoGet = new BusyoInfoGet(); busyoName = BusyoInfoGet.getName(busyoId); hp = Senryoku.totalHp; atk = Senryoku.totalAtk; dfc = Senryoku.totalDfc; spd = Senryoku.totalSpd; daimyoId = Senryoku.belongDaimyoId; lv = Senryoku.lv; chQty = Senryoku.chQty; heisyu = BusyoInfoGet.getHeisyu(busyoId); sakuId = BusyoInfoGet.getSakuId(busyoId); AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource>(); audioSources[0].Play(); string pathOfBack = "Prefabs/Common/TouchBack"; GameObject back = Instantiate(Resources.Load(pathOfBack)) as GameObject; back.transform.parent = GameObject.Find("Panel").transform; back.transform.localScale = new Vector2(1, 1); back.transform.localPosition = new Vector2(0, 0); string pathOfPop = "Prefabs/Jinkei/busyoDetail"; GameObject pop = Instantiate(Resources.Load(pathOfPop)) as GameObject; pop.transform.parent = GameObject.Find("Panel").transform; pop.transform.localScale = new Vector2(1, 1); pop.transform.localPosition = new Vector2(0, 0); //Kamon GameObject kamon = pop.transform.FindChild("kamon").gameObject; string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString(); kamon.GetComponent <Image>().sprite = Resources.Load(imagePath, typeof(Sprite)) as Sprite; //Busyo Icon string busyoPath = "Prefabs/Player/Unit/BusyoUnit"; GameObject busyo = Instantiate(Resources.Load(busyoPath)) as GameObject; busyo.name = busyoId.ToString(); busyo.transform.SetParent(pop.transform); busyo.transform.localScale = new Vector2(7, 7); busyo.GetComponent <DragHandler>().enabled = false; RectTransform busyoRect = busyo.GetComponent <RectTransform>(); busyoRect.anchoredPosition3D = new Vector3(180, 400, 0); busyoRect.sizeDelta = new Vector2(40, 40); busyo.transform.FindChild("Text").GetComponent <Text>().enabled = false; //Ship Rank string shipPath = "Prefabs/Busyo/ShipSts"; GameObject ShipObj = Instantiate(Resources.Load(shipPath)) as GameObject; ShipObj.transform.SetParent(busyo.transform); preKaisen kaisenScript = new preKaisen(); int shipId = kaisenScript.getShipSprite(ShipObj, busyoId); ShipObj.transform.localPosition = new Vector3(-10, -15, 0); ShipObj.transform.localScale = new Vector2(0.2f, 0.2f); if (Application.systemLanguage != SystemLanguage.Japanese) { if (shipId == 1) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "High"; } else if (shipId == 2) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Mid"; } else if (shipId == 3) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Low"; } } else { if (shipId == 1) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "上"; } else if (shipId == 2) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "中"; } else if (shipId == 3) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "下"; } } //Name pop.transform.FindChild("busyoNameValue").GetComponent <Text>().text = busyoName; pop.transform.FindChild("lvValue").GetComponent <Text>().text = lv.ToString(); string heisyuName = ""; Message msg = new Message(); if (heisyu == "YR") { heisyuName = msg.getMessage(56); } else if (heisyu == "KB") { heisyuName = msg.getMessage(55); } else if (heisyu == "YM") { heisyuName = msg.getMessage(58); } else if (heisyu == "TP") { heisyuName = msg.getMessage(57); } pop.transform.FindChild("childNameValue").GetComponent <Text>().text = heisyuName; pop.transform.FindChild("childNum").GetComponent <Text>().text = chQty.ToString(); pop.transform.FindChild("hpValue").GetComponent <Text>().text = hp.ToString(); pop.transform.FindChild("atkValue").GetComponent <Text>().text = atk.ToString(); pop.transform.FindChild("dfcValue").GetComponent <Text>().text = dfc.ToString(); pop.transform.FindChild("spdValue").GetComponent <Text>().text = spd.ToString(); //Senpou StatusGet sts = new StatusGet(); ArrayList senpouArray = sts.getOriginalSenpou(busyoId, false); int senpouId = (int)senpouArray[0]; string senpouTyp = senpouArray[1].ToString(); string senpouName = senpouArray[2].ToString(); string senpouExp = senpouArray[3].ToString(); float senpouEach = (float)senpouArray[4]; float senpouRatio = (float)senpouArray[5]; float senpouTerm = (float)senpouArray[6]; int senpouStatus = (int)senpouArray[7]; int senpouLv = (int)senpouArray[8]; //Kahou Adjustment KahouStatusGet kahouSts = new KahouStatusGet(); string[] KahouSenpouArray = kahouSts.getKahouForSenpou(busyoId.ToString(), senpouStatus); string kahouTyp = KahouSenpouArray[0]; string adjSenpouStatus = senpouStatus.ToString(); if (kahouTyp != null) { if (kahouTyp == "Attack") { int kahouStatus = int.Parse(KahouSenpouArray[1]); adjSenpouStatus = adjSenpouStatus + "<color=#35d74bFF>(+" + kahouStatus.ToString() + ")</color>"; } else { Debug.Log("Not Yet except for Attack"); } } //Explanation Modification if (Application.systemLanguage != SystemLanguage.Japanese) { senpouExp = senpouExp.Replace("ABC", adjSenpouStatus); senpouExp = senpouExp.Replace("DEF", senpouEach.ToString()); senpouExp = senpouExp.Replace("GHI", senpouRatio.ToString()); senpouExp = senpouExp.Replace("JKL", senpouTerm.ToString()); } else { senpouExp = senpouExp.Replace("A", adjSenpouStatus); senpouExp = senpouExp.Replace("B", senpouEach.ToString()); senpouExp = senpouExp.Replace("C", senpouRatio.ToString()); senpouExp = senpouExp.Replace("D", senpouTerm.ToString()); } //Fill fields by got Senpou Value pop.transform.FindChild("senpouNameValue").GetComponent <Text>().text = senpouName; pop.transform.FindChild("senpouExpValue").GetComponent <Text>().text = senpouExp; pop.transform.FindChild("senpouLvValue").GetComponent <Text>().text = senpouLv.ToString(); //Saku Saku saku = new Saku(); List <string> sakuList = new List <string>(); sakuList = saku.getSakuInfo(busyoId); string sakuPath = "Prefabs/Saku/saku" + sakuList[0]; GameObject sakuIcon = Instantiate(Resources.Load(sakuPath)) as GameObject; foreach (Transform n in pop.transform) { if (n.tag == "Saku") { GameObject.Destroy(n.gameObject); } } sakuIcon.transform.SetParent(pop.transform); sakuIcon.transform.localScale = new Vector2(0.5f, 0.5f); sakuIcon.GetComponent <Button>().enabled = false; RectTransform sakuIcon_transform = sakuIcon.GetComponent <RectTransform>(); sakuIcon_transform.anchoredPosition = new Vector3(-220, -185, 0); sakuIcon_transform.transform.SetSiblingIndex(30); pop.transform.FindChild("sakuExpValue").GetComponent <Text>().text = sakuList[2]; pop.transform.FindChild("sakuLvValue").GetComponent <Text>().text = sakuList[3]; //adjust if (Application.loadedLevelName == "preKaisen") { foreach (Transform chld in pop.transform) { if (chld.GetComponent <ReplaceSpriteNameRank>()) { string busyoImagePath = "Prefabs/Player/Sprite/unit" + busyoId; chld.GetComponent <Image>().sprite = Resources.Load(busyoImagePath, typeof(Sprite)) as Sprite; } } } } }