public int getStsAndMakeInstance(int jinkei, int mapId, float rainMinusRatio, float snowMinusRatio) { //Get Status string map = jinkei.ToString() + "map" + mapId; int busyoId = PlayerPrefs.GetInt(map); string busyoString = busyoId.ToString(); int lv = PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); BusyoInfoGet busyoInfo = new BusyoInfoGet(); int shipId = busyoInfo.getShipId(busyoId); int hp = sts.getHp(busyoId, lv); int atk = sts.getAtk(busyoId, lv); int dfc = sts.getDfc(busyoId, lv); int spd = sts.getSpd(busyoId, lv); string busyoName = sts.getBusyoName(busyoId); ArrayList senpouArray = sts.getSenpou(busyoId, false); //Make Average Senpou Lv totalSenpouLv = totalSenpouLv + (int)senpouArray[8]; //Weather Minus if (rainMinusRatio != 0 || snowMinusRatio != 0) { float tmp = (float)spd * 0.5f; if (tmp < 1) { tmp = 1; } spd = Mathf.FloorToInt(tmp); } //Soudaisyo if (busyoId == soudaisyo) { soudaisyoHp = hp; soudaisyoAtk = atk; soudaisyoDfc = dfc; soudaisyoSpd = spd / 10; } //Boubi int boubi = 0; if (activeStageId == 0) { //Passive boubi = PlayerPrefs.GetInt("activeBoubi", 0); } //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeKaisenInstance(busyoId, shipId, mapId, hp, atk, dfc, spd, senpouArray, busyoName, soudaisyo, boubi, false, 0, 0); return(busyoId); }
public void getEnemyStsAndMakeInstance(int linkNo, int mapId, float rainMinusRatio, float snowMinusRatio) { string map = "emap" + mapId; int busyoId = PlayerPrefs.GetInt(map); int activeBusyoLv = PlayerPrefs.GetInt("activeBusyoLv"); int activeButaiQty = PlayerPrefs.GetInt("activeButaiQty"); int activeButaiLv = PlayerPrefs.GetInt("activeButaiLv"); StatusGet sts = new StatusGet(); BusyoInfoGet info = new BusyoInfoGet(); int shipId = info.getShipId(busyoId); int hp = sts.getHp(busyoId, activeBusyoLv); int atk = sts.getAtk(busyoId, activeBusyoLv); int dfc = sts.getDfc(busyoId, activeBusyoLv); int spd = sts.getSpd(busyoId, activeBusyoLv); string busyoName = sts.getBusyoName(busyoId); string heisyu = sts.getHeisyu(busyoId); int playerBusyoQty = PlayerPrefs.GetInt("jinkeiBusyoQty"); aveSenpouLv = Mathf.CeilToInt(totalSenpouLv / playerBusyoQty); ArrayList senpouArray = sts.getEnemySenpou(busyoId, aveSenpouLv, ""); //Weather Minus if (rainMinusRatio != 0 || snowMinusRatio != 0) { float tmp = (float)spd * 0.5f; if (tmp < 1) { tmp = 1; } spd = Mathf.FloorToInt(tmp); } bool enemyTaisyoFlg = false; if (busyoId == enemySoudaisyo) { enemyTaisyoFlg = true; } //View Object & pass status to it. EnemyInstance inst = new EnemyInstance(); inst.makeKaisenInstance(mapId, busyoId, shipId, activeButaiLv, heisyu, activeButaiQty, hp, atk, dfc, spd, busyoName, linkNo, enemyTaisyoFlg, senpouArray); }
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(){ //Common Message msg = new Message(); //Check Shinobi if (cyouhouSnbRankId != 0) { List<string> myBusyoList = new List<string> (); string myBusyoString = PlayerPrefs.GetString ("myBusyo"); if (myBusyoString.Contains (",")) { char[] delimiterChars = { ',' }; myBusyoList = new List<string> (myBusyoString.Split (delimiterChars)); } else { myBusyoList.Add (myBusyoString); } //Check Busyo if(myBusyoList.Count != 0){ scrollObj.SetActive (true); scrollObj.transform.FindChild ("Back").GetComponent<DoKousaku> ().scrollObj = scrollObj; GameObject doBtnObj = scrollObj.transform.FindChild ("Do").gameObject; doBtnObj.GetComponent<DoKousaku> ().scrollObj = scrollObj; //Make Scroll GameObject content = scrollObj.transform.FindChild("ScrollView").transform.FindChild("Content").gameObject; foreach (Transform obj in content.transform) { Destroy (obj.gameObject); } string slotPath = "Prefabs/Map/kousaku/Slot"; string dfcPath = "Prefabs/Map/kousaku/TextObj"; for(int i=0; i<myBusyoList.Count; i++){ string busyoId = myBusyoList [i]; //Slot GameObject slot = Instantiate (Resources.Load (slotPath)) as GameObject; slot.transform.SetParent(content.transform); slot.transform.localScale = new Vector3 (1, 1, 1); //Busyo string busyoPath = "Prefabs/Player/Unit/" + busyoId; GameObject busyo = Instantiate (Resources.Load (busyoPath)) as GameObject; busyo.transform.SetParent(slot.transform); busyo.transform.localScale = new Vector3 (4, 5, 0); busyo.name = busyoId; slot.name = "Slot" + busyo.name; busyo.GetComponent<DragHandler> ().enabled = false; //Chiryaku GameObject txtObj = Instantiate (Resources.Load (dfcPath)) as GameObject; txtObj.transform.SetParent(busyo.transform); txtObj.transform.localScale = new Vector3 (1, 1, 0); txtObj.transform.localPosition = new Vector3 (5, -12, 0); StatusGet sts = new StatusGet(); int lv = PlayerPrefs.GetInt (busyoId); float chiryakuSts = (float)sts.getDfc(int.Parse(busyoId),lv); chiryakuSts = chiryakuSts *10; txtObj.transform.FindChild ("Value").GetComponent<Text> ().text = chiryakuSts.ToString (); //Set Param KousakuBusyoSelect script = slot.GetComponent<KousakuBusyoSelect>(); script.busyoId = int.Parse(busyoId); script.dfc = chiryakuSts; script.doBtnObj = doBtnObj; script.content = content; //Initial Setting if (i == 0) { slot.GetComponent<KousakuBusyoSelect> ().OnClick (); } } scrollObj.transform.FindChild ("Do").GetComponent<DoKousaku> ().cyouhouSnbRankId = cyouhouSnbRankId; if (name == "CyouryakuButton") { scrollObj.transform.FindChild ("Text").GetComponent<Text> ().text = "調略"; scrollObj.transform.FindChild ("Do").transform.FindChild ("Text").GetComponent<Text> ().text = "調略"; doBtnObj.GetComponent<DoKousaku> ().linkCutFlg = false; } else { scrollObj.transform.FindChild ("Text").GetComponent<Text> ().text = "連絡線遮断"; scrollObj.transform.FindChild ("Do").transform.FindChild ("Text").GetComponent<Text> ().text = "遮断"; doBtnObj.GetComponent<DoKousaku> ().linkCutFlg = true; } }else{ msg.makeUpperMessageOnBoard ("今季に行動可能な武将はおりませぬ。\n季節が変わった後に命を下しましょう。"); } } else { msg.makeUpperMessageOnBoard ("諜報にて潜伏中の忍が必要ですぞ。"); } }
public void getEnemyStsAndMakeInstance(int linkNo, int mapId, float mntMinusRatio, float seaMinusRatio, float rainMinusRatio, float snowMinusRatio){ String map = "emap" + mapId; int busyoId = PlayerPrefs.GetInt(map); int activeBusyoLv = PlayerPrefs.GetInt ("activeBusyoLv"); int activeButaiQty = PlayerPrefs.GetInt ("activeButaiQty"); int activeButaiLv = PlayerPrefs.GetInt ("activeButaiLv"); StatusGet sts = new StatusGet (); BusyoInfoGet info = new BusyoInfoGet(); int hp = sts.getHp (busyoId, activeBusyoLv); int atk = sts.getAtk (busyoId, activeBusyoLv); int dfc = sts.getDfc (busyoId, activeBusyoLv); int spd = sts.getSpd (busyoId, activeBusyoLv); string busyoName = sts.getBusyoName (busyoId); string heisyu = sts.getHeisyu (busyoId); ArrayList senpouArray = sts.getSenpou (busyoId); //Map & Weather Minus if (mntMinusRatio != 0) { if (heisyu == "KB") { float tmp = (float)spd * mntMinusRatio; if (tmp < 1) { tmp = 1; } spd = Mathf.FloorToInt (tmp); } }else if (seaMinusRatio != 0) { if (heisyu == "TP") { float tmp = (float)dfc * seaMinusRatio; if (tmp < 1) { tmp = 1; } dfc = Mathf.FloorToInt (tmp); }else if (heisyu == "YM") { float tmp = (float)dfc * seaMinusRatio; if (tmp < 1) { tmp = 1; } dfc = Mathf.FloorToInt (tmp); } } if (rainMinusRatio != 0) { if (heisyu == "TP") { float tmp = (float)atk * rainMinusRatio; if (tmp < 1) { tmp = 1; } atk = Mathf.FloorToInt (tmp); }else if (heisyu == "YM") { float tmp = (float)atk * rainMinusRatio; if (tmp < 1) { tmp = 1; } atk = Mathf.FloorToInt (tmp); } }else if(snowMinusRatio != 0) { float tmp = (float)spd * 0.5f; if (tmp < 1) { tmp = 1; } spd = Mathf.FloorToInt (tmp); if (heisyu == "TP") { float tmp2 = (float)atk * snowMinusRatio; if (tmp2 < 1) { tmp2 = 1; } atk = Mathf.FloorToInt (tmp2); }else if (heisyu == "YM") { float tmp2 = (float)atk * snowMinusRatio; if (tmp2 < 1) { tmp2 = 1; } atk = Mathf.FloorToInt (tmp2); }else if (heisyu == "KB") { float tmp2 = (float)dfc * snowMinusRatio; if (tmp2 < 1) { tmp2 = 1; } dfc = Mathf.FloorToInt (tmp2); } } bool enemyTaisyoFlg = false; if (busyoId == enemySoudaisyo) { enemyTaisyoFlg = true; } //View Object & pass status to it. EnemyInstance inst = new EnemyInstance (); inst.makeInstance(mapId, busyoId, activeButaiLv, heisyu, activeButaiQty, hp, atk, dfc, spd, busyoName,linkNo,enemyTaisyoFlg); }
public void Start() { //Get Temp Kuni Id & Stage Id activeKuniId = PlayerPrefs.GetInt ("activeKuniId"); string temp = "naisei" + activeKuniId.ToString (); /*Initial Setting*/ //Kuni Name & jyosyu string title = ""; string kuniName = PlayerPrefs.GetString ("activeKuniName"); string jyosyuTemp = "jyosyu" + activeKuniId; //Clear Image foreach ( Transform n in GameObject.Find ("JyosyuImage").transform){ GameObject.Destroy(n.gameObject); } if (PlayerPrefs.HasKey (jyosyuTemp)) { //Jyosyu Exist jyosyuId = PlayerPrefs.GetInt (jyosyuTemp); string busyoPath = "Prefabs/Player/Unit/" + jyosyuId; GameObject busyo = Instantiate (Resources.Load (busyoPath)) as GameObject; busyo.transform.SetParent (GameObject.Find ("JyosyuImage").transform); busyo.transform.localScale = new Vector2 (4, 4); busyo.GetComponent<DragHandler>().enabled = false; RectTransform busyo_transform = busyo.GetComponent<RectTransform>(); busyo_transform.anchoredPosition = new Vector3(40,40,0); busyo_transform.sizeDelta = new Vector2( 23, 23); foreach(Transform n in busyo.transform){ GameObject.Destroy(n.gameObject); } StatusGet sts = new StatusGet(); string jyosyuName = sts.getBusyoName(jyosyuId); title = kuniName + "・" + jyosyuName; //Ninmei Button GameObject btn = GameObject.Find ("Ninmei").gameObject; btn.GetComponent<Ninmei>().kaininFlg = true; btn.transform.FindChild("NinmeiText").GetComponent<Text>().text = "城主解任"; btn.GetComponent<Ninmei>().jyosyuId = jyosyuId; btn.GetComponent<Ninmei>().jyosyuName = jyosyuName; } else { //Jyosyu Not Exist title = kuniName + "・蔵入地"; //Ninmei Button GameObject btn = GameObject.Find ("Ninmei").gameObject; btn.GetComponent<Ninmei>().kaininFlg = false; btn.transform.FindChild("NinmeiText").GetComponent<Text>().text = "城主任命"; } GameObject.Find ("StageNameValue").GetComponent<Text> ().text = title; //Money int money = PlayerPrefs.GetInt("money"); GameObject.Find ("MoneyValue").GetComponent<Text> ().text = money.ToString(); //Hyourou int hyourou = PlayerPrefs.GetInt("hyourou"); GameObject.Find ("HyourouCurrentValue").GetComponent<Text> ().text = hyourou.ToString(); //HyourouMax int hyourouMax = PlayerPrefs.GetInt("hyourouMax"); GameObject.Find ("HyourouMaxValue").GetComponent<Text> ().text = hyourouMax.ToString(); /*Open Panel*/ //Clear Previous Panel foreach ( Transform n in GameObject.Find ("NaiseiView").transform){ GameObject.Destroy(n.gameObject); } //Clear Previous Mask Panel foreach ( Transform n in GameObject.Find ("MaskView").transform){ GameObject.Destroy(n.gameObject); } //Open Panel & MaskPanel panelByShiro(activeKuniId); panelByKuniLv(); if (PlayerPrefs.HasKey (temp)) { /*initial setting*/ string naiseiString = PlayerPrefs.GetString (temp); List<string> naiseiList = new List<string>(); char[] delimiterChars = {','}; naiseiList = new List<string>(naiseiString.Split (delimiterChars)); /*Naisei Bldg Handling*/ char[] delimiterChars2 = {':'}; List<string> deletePanelList = new List<string>(); for(int i=1; i<naiseiList.Count;i++){ List<string> naiseiContentList = new List<string>(); naiseiContentList = new List<string>(naiseiList[i].Split (delimiterChars2)); if(naiseiContentList[0] != "0"){ //Exist Entity_naisei_mst naiseiMst = Resources.Load ("Data/naisei_mst") as Entity_naisei_mst; string bldgRank = ""; if(int.Parse(naiseiContentList[1])<8){ bldgRank = "s"; }else if(int.Parse(naiseiContentList[1]) < 15){ bldgRank = "m"; }else if(15 <= int.Parse(naiseiContentList[1])){ bldgRank = "l"; } //Add Delete Target deletePanelList.Add(i.ToString()); //Make New Panel string type = naiseiMst.param [int.Parse(naiseiContentList[0])].code; string bldg = type + "_" + bldgRank; string bldgPath = "Prefabs/Naisei/Bldg/" + bldg; GameObject bldgObj = Instantiate (Resources.Load (bldgPath)) as GameObject; bldgObj.transform.parent = GameObject.Find ("NaiseiView").transform; bldgObj.transform.localScale = new Vector3 (1, 1, 1); setBldg(bldgObj, i); bldgObj.name = i.ToString(); bldgObj.GetComponent<AreaButton>().blank = false; bldgObj.GetComponent<AreaButton>().type = type; bldgObj.GetComponent<AreaButton>().lv = naiseiContentList[1]; bldgObj.GetComponent<AreaButton>().naiseiId = int.Parse(naiseiContentList[0]); //Effect by Level List<int> naiseiEffectList = new List<int>(); naiseiEffectList = getNaiseiList(type, int.Parse(naiseiContentList[1])); bldgObj.GetComponent<AreaButton>().effect = naiseiEffectList[0]; bldgObj.GetComponent<AreaButton>().effectNextLv = naiseiEffectList[1]; bldgObj.GetComponent<AreaButton>().moneyNextLv = naiseiEffectList[2]; bldgObj.GetComponent<AreaButton>().requiredHyourou =naiseiMst.param [int.Parse(naiseiContentList[0])].hyourou; bldgObj.GetComponent<AreaButton>().naiseiName =naiseiMst.param [int.Parse(naiseiContentList[0])].name; //Status if(type == "shop" || type == "kouzan"){ syogyo = syogyo + naiseiEffectList[0]; }else if(type == "ta"){ nogyo = nogyo + naiseiEffectList[0]; }else if(type == "yr" ||type == "kb"||type == "tp" ||type == "ym"){ gunjyu = gunjyu + naiseiEffectList[0]; }else if(type == "ashigaru"){ ashigaru = ashigaru + naiseiEffectList[0]; }else if(type == "toride"){ boubi = boubi + naiseiEffectList[0]; }else{ Debug.Log ("Not Yet"); } } } //Clear Duplicated Panel foreach ( Transform n in GameObject.Find ("NaiseiView").transform){ if(deletePanelList.Contains(n.name)){ if(n.tag == "Area"){ GameObject.Destroy(n.gameObject); } } } /*shiro setting*/ string rank = ""; if(int.Parse(naiseiList[0])<8){ rank = "s"; setShiro(rank, naiseiList[0]); }else if(int.Parse(naiseiList[0]) < 15){ rank = "m"; setShiro(rank, naiseiList[0]); }else if(15 <= int.Parse(naiseiList[0])){ rank = "l"; setShiro(rank, naiseiList[0]); } string maskPath = "Prefabs/Naisei/MaskPanel"; GameObject maskPanel = Instantiate (Resources.Load (maskPath)) as GameObject; maskPanel.transform.parent = GameObject.Find ("MaskView").transform; maskPanel.transform.localScale = new Vector3 (1, 1, 1); RectTransform maskPanel_transform = maskPanel.GetComponent<RectTransform>(); maskPanel_transform.anchoredPosition = new Vector2(0,-20); maskPanel.name = "shiro_" + rank; //Status Handling //Status Jyosyu Modification if (PlayerPrefs.HasKey (jyosyuTemp)) { StatusGet sts = new StatusGet(); int lv = PlayerPrefs.GetInt (jyosyuId.ToString()); float naiseiSts = (float)sts.getDfc(jyosyuId,lv); float hpSts = (float)sts.getHp(jyosyuId,lv); float atkSts = (float)sts.getAtk(jyosyuId,lv); float boubiSts = (hpSts + atkSts)/2; float tempSyogyo = (float)syogyo; tempSyogyo = tempSyogyo + (tempSyogyo * naiseiSts/200); float tempNogyo = (float)nogyo; tempNogyo = tempNogyo + (tempNogyo * naiseiSts/200); float tempBoubi = (float)boubi; tempBoubi = tempBoubi + (tempBoubi * naiseiSts/200); syogyo = (int)tempSyogyo; nogyo = (int)tempNogyo; boubi = (int)tempBoubi; } GameObject.Find("SyogyoValue").GetComponent<Text>().text = syogyo.ToString(); GameObject.Find("NougyoValue").GetComponent<Text>().text = nogyo.ToString(); GameObject.Find("GunjyuValue").GetComponent<Text>().text = gunjyu.ToString(); GameObject.Find("AshigaruValue").GetComponent<Text>().text = ashigaru.ToString(); GameObject.Find("BoubiValue").GetComponent<Text>().text = boubi.ToString(); GameObject.Find("BukkyoValue").GetComponent<Text>().text = bukkyo.ToString(); GameObject.Find("KirisutoValue").GetComponent<Text>().text = kirisuto.ToString(); GameObject.Find("BunkaValue").GetComponent<Text>().text = bunka.ToString(); } else { //Error Debug.Log ("ERROR"); } }
public void OnClick() { MainStageController MainStageController = GameObject.Find("GameController").GetComponent <MainStageController>(); //SE AudioSource sound = GameObject.Find("SEController").GetComponent <AudioSource> (); sound.PlayOneShot(sound.clip); //Initialization totalMoney = 0; kozanMoney = 0; totalHyourou = 0; totalYRL = 0; totalKBL = 0; totalYML = 0; totalTPL = 0; totalYRM = 0; totalKBM = 0; totalYMM = 0; totalTPM = 0; totalYRH = 0; totalKBH = 0; totalYMH = 0; totalTPH = 0; totalSNBL = 0; totalSNBM = 0; totalSNBH = 0; /*Popup*/ string backPath = "Prefabs/Busyo/back"; GameObject back = Instantiate(Resources.Load(backPath)) as GameObject; back.transform.SetParent(GameObject.Find("Map").transform); back.transform.localScale = new Vector2(1, 1); RectTransform backTransform = back.GetComponent <RectTransform> (); backTransform.anchoredPosition = new Vector3(0, 0, 0); //Popup Screen string popupPath = "Prefabs/Busyo/board"; GameObject popup = Instantiate(Resources.Load(popupPath)) as GameObject; popup.transform.SetParent(GameObject.Find("Map").transform); popup.transform.localScale = new Vector2(1, 1); RectTransform popupTransform = popup.GetComponent <RectTransform> (); popupTransform.anchoredPosition = new Vector3(0, 0, 0); popup.name = "board"; //qa string qaPath = "Prefabs/Common/Question"; GameObject qa = Instantiate(Resources.Load(qaPath)) as GameObject; qa.transform.SetParent(popup.transform); qa.transform.localScale = new Vector2(1, 1); RectTransform qaTransform = qa.GetComponent <RectTransform> (); qaTransform.anchoredPosition = new Vector3(-540, 285, 0); qa.name = "qa"; qa.GetComponent <QA> ().qaId = 2; //Pop text string popTextPath = "Prefabs/Busyo/popText"; GameObject popText = Instantiate(Resources.Load(popTextPath)) as GameObject; popText.transform.SetParent(popup.transform); popText.transform.localScale = new Vector2(0.35f, 0.35f); RectTransform popTextTransform = popText.GetComponent <RectTransform> (); popTextTransform.anchoredPosition = new Vector3(0, 260, 0); popText.name = "popText"; if (Application.systemLanguage != SystemLanguage.Japanese) { popText.GetComponent <Text>().text = "Finance"; } else { popText.GetComponent <Text> ().text = "内政状況"; } //Cyosyu string cyosyuPath = "Prefabs/Cyosyu/CyosyuObj"; GameObject CyosyuObj = Instantiate(Resources.Load(cyosyuPath)) as GameObject; CyosyuObj.transform.SetParent(popup.transform); CyosyuObj.transform.localScale = new Vector2(1, 1); string seiryoku = PlayerPrefs.GetString("seiryoku"); List <string> seiryokuList = new List <string> (); List <string> mySeiryokuList = new List <string> (); char[] delimiterChars = { ',' }; seiryokuList = new List <string> (seiryoku.Split(delimiterChars)); int myDaimyoId = PlayerPrefs.GetInt("myDaimyo"); //Get my Kuni for (int i = 0; i < seiryokuList.Count; i++) { int seiryokuId = int.Parse(seiryokuList [i]); if (seiryokuId == myDaimyoId) { int kuniId = i + 1; mySeiryokuList.Add(kuniId.ToString()); } } //Kuni Loop Start int naiseiBldg = 0; int syogyo = 0; int nogyo = 0; int gunjyu = 0; int ashigaru = 0; int boubi = 0; int bukkyo = 0; int kirisuto = 0; int bunka = 0; //seiryoku loop for (int i = 0; i < mySeiryokuList.Count; i++) { int kuniKozan = 0; int kuniSyogyo = 0; int kuniId = int.Parse(mySeiryokuList[i]); string temp = "kuni" + mySeiryokuList[i]; string clearedKuni = PlayerPrefs.GetString(temp); //Shiro Qty if (clearedKuni != null && clearedKuni != "") { List <string> shiroList = new List <string>(); shiroList = new List <string>(clearedKuni.Split(delimiterChars)); shiro = shiroList.Count; //Kuni Name Entity_kuni_mst kuniMst = Resources.Load("Data/kuni_mst") as Entity_kuni_mst; kuniName = kuniMst.param[kuniId - 1].kuniName; string naiseiTemp = "naisei" + mySeiryokuList[i]; string naiseiString = PlayerPrefs.GetString(naiseiTemp); if (PlayerPrefs.HasKey(naiseiTemp)) { List <string> naiseiList = new List <string>(); naiseiList = new List <string>(naiseiString.Split(delimiterChars)); char[] delimiterChars2 = { ':' }; List <string> deletePanelList = new List <string>(); for (int j = 1; j < naiseiList.Count; j++) { List <string> naiseiContentList = new List <string>(); naiseiContentList = new List <string>(naiseiList[j].Split(delimiterChars2)); if (naiseiContentList[0] != "0") { //Exist Entity_naisei_mst naiseiMst = Resources.Load("Data/naisei_mst") as Entity_naisei_mst; string type = naiseiMst.param [int.Parse(naiseiContentList[0])].code; naiseiBldg = naiseiBldg + 1; //Effect by Level List <int> naiseiEffectList = new List <int>(); NaiseiController naisei = new NaiseiController(); naiseiEffectList = naisei.getNaiseiList(type, int.Parse(naiseiContentList[1])); //Status if (type == "shop") { kuniSyogyo = kuniSyogyo + naiseiEffectList[0]; } else if (type == "kzn") { kuniKozan = kuniKozan + naiseiEffectList[0]; } else if (type == "ta") { nogyo = nogyo + naiseiEffectList[0]; totalHyourou = totalHyourou + naiseiEffectList[0]; } else if (type == "yr") { if (int.Parse(naiseiContentList[1]) < 11) { //Low gunjyu = gunjyu + naiseiEffectList[0]; totalYRL = totalYRL + naiseiEffectList[0]; } else if (int.Parse(naiseiContentList[1]) < 16) { //Middle gunjyu = gunjyu + naiseiEffectList[0]; totalYRM = totalYRM + naiseiEffectList[0]; } else if (15 <= int.Parse(naiseiContentList[1])) { //High gunjyu = gunjyu + naiseiEffectList[0]; totalYRH = totalYRH + naiseiEffectList[0]; } } else if (type == "kb") { if (int.Parse(naiseiContentList[1]) < 11) { //Low gunjyu = gunjyu + naiseiEffectList[0]; totalKBL = totalKBL + naiseiEffectList[0]; } else if (int.Parse(naiseiContentList[1]) < 16) { //Middle gunjyu = gunjyu + naiseiEffectList[0]; totalKBM = totalKBM + naiseiEffectList[0]; } else if (15 <= int.Parse(naiseiContentList[1])) { //High gunjyu = gunjyu + naiseiEffectList[0]; totalKBH = totalKBH + naiseiEffectList[0]; } } else if (type == "ym") { if (int.Parse(naiseiContentList[1]) < 11) { //Low gunjyu = gunjyu + naiseiEffectList[0]; totalYML = totalYML + naiseiEffectList[0]; } else if (int.Parse(naiseiContentList[1]) < 16) { //Middle gunjyu = gunjyu + naiseiEffectList[0]; totalYMM = totalYMM + naiseiEffectList[0]; } else if (15 <= int.Parse(naiseiContentList[1])) { //High gunjyu = gunjyu + naiseiEffectList[0]; totalYMH = totalYMH + naiseiEffectList[0]; } } else if (type == "tp") { if (int.Parse(naiseiContentList[1]) < 11) { //Low gunjyu = gunjyu + naiseiEffectList[0]; totalTPL = totalTPL + naiseiEffectList[0]; } else if (int.Parse(naiseiContentList[1]) < 16) { //Middle gunjyu = gunjyu + naiseiEffectList[0]; totalTPM = totalTPM + naiseiEffectList[0]; } else if (15 <= int.Parse(naiseiContentList[1])) { //High gunjyu = gunjyu + naiseiEffectList[0]; totalTPH = totalTPH + naiseiEffectList[0]; } } else if (type == "snb") { if (int.Parse(naiseiContentList[1]) < 11) { //Low gunjyu = gunjyu + naiseiEffectList[0]; totalSNBL = totalSNBL + naiseiEffectList[0]; } else if (int.Parse(naiseiContentList[1]) < 16) { //Middle gunjyu = gunjyu + naiseiEffectList[0]; totalSNBM = totalSNBM + naiseiEffectList[0]; } else if (15 <= int.Parse(naiseiContentList[1])) { //High gunjyu = gunjyu + naiseiEffectList[0]; totalSNBH = totalSNBH + naiseiEffectList[0]; } } else if (type == "trd") { boubi = boubi + naiseiEffectList[0]; } else if (type == "nbn") { kirisuto = kirisuto + naiseiEffectList[0]; } else if (type == "kgy") { bunka = bunka + naiseiEffectList [0]; } else if (type == "bky") { bukkyo = bukkyo + naiseiEffectList [0]; } else if (type == "hsy") { ashigaru = ashigaru + naiseiEffectList [0]; } } } //Shiro int shiroLv = int.Parse(naiseiList[0]); NaiseiController naise = new NaiseiController(); List <int> naiseiShiroEffectList = new List <int>(); naiseiShiroEffectList = naise.getNaiseiList("shiro", shiroLv); ashigaru = ashigaru + naiseiShiroEffectList[0]; boubi = boubi + naiseiShiroEffectList[0]; //Jyosyu Addition string jyosyuTemp = "jyosyu" + kuniId; if (PlayerPrefs.HasKey(jyosyuTemp)) { int jyosyuId = PlayerPrefs.GetInt(jyosyuTemp); StatusGet sts = new StatusGet(); int lv = PlayerPrefs.GetInt(jyosyuId.ToString()); float naiseiSts = (float)sts.getDfc(jyosyuId, lv); float hpSts = (float)sts.getHp(jyosyuId, lv); float atkSts = (float)sts.getAtk(jyosyuId, lv); float tempKuniSyogyo = (float)kuniSyogyo; tempKuniSyogyo = tempKuniSyogyo + (tempKuniSyogyo * naiseiSts / 200); kuniSyogyo = (int)tempKuniSyogyo; float tempKuniKozan = (float)kuniKozan; tempKuniKozan = tempKuniKozan + (tempKuniKozan * naiseiSts / 200); kuniKozan = (int)tempKuniKozan; } } } kozanMoney = kozanMoney + kuniKozan; totalMoney = totalMoney + kuniSyogyo; syogyo = syogyo + (kuniKozan * 4 + kuniSyogyo); }//Kuni Loop Finish /*visualize*/ //Upper Board GameObject spring = CyosyuObj.transform.FindChild("spring").gameObject; spring.transform.FindChild("TargetMoney").transform.FindChild("Value").GetComponent <Text>().text = (totalMoney + kozanMoney).ToString(); GameObject summerWinter = CyosyuObj.transform.FindChild("summerWinter").gameObject; summerWinter.transform.FindChild("TargetMoney").transform.FindChild("Value").GetComponent <Text>().text = kozanMoney.ToString(); GameObject TargetGunjyu = summerWinter.transform.FindChild("TargetGunjyu").gameObject; if (totalYRH != 0) { TargetGunjyu.transform.FindChild("YR").transform.FindChild("CyouheiYRValueH").GetComponent <Text>().text = totalYRH.ToString(); } if (totalYRM != 0) { TargetGunjyu.transform.FindChild("YR").transform.FindChild("CyouheiYRValueM").GetComponent <Text>().text = totalYRM.ToString(); } if (totalYRL != 0) { TargetGunjyu.transform.FindChild("YR").transform.FindChild("CyouheiYRValueL").GetComponent <Text>().text = totalYRL.ToString(); } if (totalKBH != 0) { TargetGunjyu.transform.FindChild("KB").transform.FindChild("CyouheiKBValueH").GetComponent <Text>().text = totalKBH.ToString(); } if (totalKBM != 0) { TargetGunjyu.transform.FindChild("KB").transform.FindChild("CyouheiKBValueM").GetComponent <Text>().text = totalKBM.ToString(); } if (totalKBL != 0) { TargetGunjyu.transform.FindChild("KB").transform.FindChild("CyouheiKBValueL").GetComponent <Text>().text = totalKBL.ToString(); } if (totalYMH != 0) { TargetGunjyu.transform.FindChild("YM").transform.FindChild("CyouheiYMValueH").GetComponent <Text>().text = totalYMH.ToString(); } if (totalYMM != 0) { TargetGunjyu.transform.FindChild("YM").transform.FindChild("CyouheiYMValueM").GetComponent <Text>().text = totalYMM.ToString(); } if (totalYML != 0) { TargetGunjyu.transform.FindChild("YM").transform.FindChild("CyouheiYMValueL").GetComponent <Text>().text = totalYML.ToString(); } if (totalTPH != 0) { TargetGunjyu.transform.FindChild("TP").transform.FindChild("CyouheiTPValueH").GetComponent <Text>().text = totalTPH.ToString(); } if (totalTPM != 0) { TargetGunjyu.transform.FindChild("TP").transform.FindChild("CyouheiTPValueM").GetComponent <Text>().text = totalTPM.ToString(); } if (totalTPL != 0) { TargetGunjyu.transform.FindChild("TP").transform.FindChild("CyouheiTPValueL").GetComponent <Text>().text = totalTPL.ToString(); } if (totalSNBH != 0) { TargetGunjyu.transform.FindChild("SNB").transform.FindChild("SNBValueH").GetComponent <Text>().text = totalSNBH.ToString(); } if (totalSNBM != 0) { TargetGunjyu.transform.FindChild("SNB").transform.FindChild("SNBValueM").GetComponent <Text>().text = totalSNBM.ToString(); } if (totalSNBL != 0) { TargetGunjyu.transform.FindChild("SNB").transform.FindChild("SNBValueL").GetComponent <Text>().text = totalSNBL.ToString(); } GameObject autumn = CyosyuObj.transform.FindChild("autumn").gameObject; autumn.transform.FindChild("TargetMoney").transform.FindChild("Value").GetComponent <Text>().text = kozanMoney.ToString(); autumn.transform.FindChild("TargetHyourou").transform.FindChild("Value").GetComponent <Text>().text = totalHyourou.ToString(); //Color int nowSeason = MainStageController.nowSeason; if (nowSeason == 1) { summerWinter.transform.FindChild("summer").gameObject.AddComponent <TextBlinker>(); } else if (nowSeason == 2) { autumn.transform.FindChild("autumn").gameObject.AddComponent <TextBlinker>(); } else if (nowSeason == 3) { summerWinter.transform.FindChild("winter").gameObject.AddComponent <TextBlinker>(); } else if (nowSeason == 4) { spring.transform.FindChild("spring").gameObject.AddComponent <TextBlinker>(); } //Lower Board GameObject status = CyosyuObj.transform.FindChild("statusBack").gameObject; //Kamon string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + myDaimyoId.ToString(); GameObject kamon = status.transform.FindChild("Kamon").gameObject; kamon.GetComponent <Image> ().sprite = Resources.Load(imagePath, typeof(Sprite)) as Sprite; if (Application.systemLanguage == SystemLanguage.Japanese) { kamon.transform.FindChild("Value").GetComponent <Text> ().text = GameObject.Find("DaimyoValue").GetComponent <Text> ().text + " 国状況"; } else { kamon.transform.FindChild("Value").GetComponent <Text>().text = GameObject.Find("DaimyoValue").GetComponent <Text>().text + " Status"; } //Kuni status.transform.FindChild("Shiro").transform.FindChild("No").GetComponent <Text>().text = mySeiryokuList.Count.ToString(); //Naisei Bldg. status.transform.FindChild("Naisei").transform.FindChild("No").GetComponent <Text>().text = (naiseiBldg + mySeiryokuList.Count).ToString(); //Tabibito int tabibitoQty = PlayerPrefs.GetInt("HstTabibito"); status.transform.FindChild("Tabibito").transform.FindChild("No").GetComponent <Text>().text = tabibitoQty.ToString(); //Nanbansen int nanbansenQty = PlayerPrefs.GetInt("HstNanbansen"); status.transform.FindChild("Ship").transform.FindChild("No").GetComponent <Text>().text = nanbansenQty.ToString(); //Syogyo status.transform.FindChild("StatusSyogyo").transform.FindChild("SyogyoValue").GetComponent <Text>().text = syogyo.ToString(); //Nogyo status.transform.FindChild("StatusNougyo").transform.FindChild("NougyoValue").GetComponent <Text>().text = nogyo.ToString(); //Gunjyu status.transform.FindChild("StatusGunjyu").transform.FindChild("GunjyuValue").GetComponent <Text>().text = (gunjyu * 2).ToString(); //Ashigaru status.transform.FindChild("StatusAshigaru").transform.FindChild("AshigaruValue").GetComponent <Text>().text = ashigaru.ToString(); //Boubi status.transform.FindChild("StatusBoubi").transform.FindChild("BoubiValue").GetComponent <Text>().text = boubi.ToString(); //Bukkyo status.transform.FindChild("StatusBukkyo").transform.FindChild("BukkyoValue").GetComponent <Text>().text = bukkyo.ToString(); //Kirisuto status.transform.FindChild("StatusKirisuto").transform.FindChild("KirisutoValue").GetComponent <Text>().text = kirisuto.ToString(); //Bunka status.transform.FindChild("StatusBunka").transform.FindChild("BunkaValue").GetComponent <Text>().text = bunka.ToString(); //tutorial if (Application.loadedLevelName == "tutorialMain") { Destroy(transform.FindChild("point_up").gameObject); TutorialController TutorialController = new TutorialController(); Vector2 vect = new Vector2(0, 50); GameObject closeObj = popup.transform.FindChild("close").gameObject; GameObject animObj = TutorialController.SetPointer(closeObj, vect); animObj.transform.localScale = new Vector2(120, 120); GameObject SubButtonViewLeft = GameObject.Find("SubButtonViewLeft").gameObject; GameObject.Find("SeiryokuInfo").transform.SetParent(SubButtonViewLeft.transform); } }
public void enemyEngunInstance(string enemyEngunList, float mntMinusRatio, float seaMinusRatio, float rainMinusRatio, float snowMinusRatio) { List <string> daimyoEnguniList = new List <string> (); char[] delimiterChars = { ':' }; char[] delimiterChars2 = { '-' }; if (enemyEngunList.Contains(":")) { daimyoEnguniList = new List <string> (enemyEngunList.Split(delimiterChars)); } else { daimyoEnguniList.Add(enemyEngunList); } for (int i = 0; i < daimyoEnguniList.Count; i++) { StatusGet sts = new StatusGet(); string daimyoEngunString = daimyoEnguniList[i]; List <string> unitEnguniList = new List <string> (); unitEnguniList = new List <string> (daimyoEngunString.Split(delimiterChars2)); int busyoId = int.Parse(unitEnguniList[1]); string heisyu = sts.getHeisyu(busyoId); if (busyoId != 0) { int busyoLv = int.Parse(unitEnguniList[2]); int butaiQty = int.Parse(unitEnguniList[3]); int butaiLv = int.Parse(unitEnguniList[4]); int hp = sts.getHp(busyoId, busyoLv); int atk = sts.getAtk(busyoId, busyoLv); int dfc = sts.getDfc(busyoId, busyoLv); int spd = sts.getSpd(busyoId, busyoLv); string busyoName = sts.getBusyoName(busyoId); int aveSenpouLv = 0; if (Application.loadedLevelName != "kaisen") { aveSenpouLv = GameObject.Find("GameScene").GetComponent <GameScene> ().aveSenpouLv; } else { aveSenpouLv = GameObject.Find("GameScene").GetComponent <KaisenScene>().aveSenpouLv; } ArrayList senpouArray = sts.getEnemySenpou(busyoId, aveSenpouLv, ""); if (mntMinusRatio != 0) { if (heisyu == "KB") { float tmp = (float)spd * mntMinusRatio; if (tmp < 1) { tmp = 1; } spd = Mathf.FloorToInt(tmp); } } else if (seaMinusRatio != 0) { if (heisyu == "TP") { float tmp = (float)dfc * seaMinusRatio; if (tmp < 1) { tmp = 1; } dfc = Mathf.FloorToInt(tmp); } else if (heisyu == "YM") { float tmp = (float)dfc * seaMinusRatio; if (tmp < 1) { tmp = 1; } dfc = Mathf.FloorToInt(tmp); } } if (rainMinusRatio != 0) { if (heisyu == "TP") { float tmp = (float)atk * rainMinusRatio; if (tmp < 1) { tmp = 1; } atk = Mathf.FloorToInt(tmp); } else if (heisyu == "YM") { float tmp = (float)atk * rainMinusRatio; if (tmp < 1) { tmp = 1; } atk = Mathf.FloorToInt(tmp); } } else if (snowMinusRatio != 0) { float tmp = (float)spd * 0.5f; if (tmp < 1) { tmp = 1; } spd = Mathf.FloorToInt(tmp); if (heisyu == "TP") { float tmp2 = (float)atk * snowMinusRatio; if (tmp2 < 1) { tmp2 = 1; } atk = Mathf.FloorToInt(tmp2); } else if (heisyu == "YM") { float tmp2 = (float)atk * snowMinusRatio; if (tmp2 < 1) { tmp2 = 1; } atk = Mathf.FloorToInt(tmp2); } else if (heisyu == "KB") { float tmp2 = (float)dfc * snowMinusRatio; if (tmp2 < 1) { tmp2 = 1; } dfc = Mathf.FloorToInt(tmp2); } } //View Object & pass status to it. EnemyInstance inst = new EnemyInstance(); BusyoInfoGet info = new BusyoInfoGet(); string ch_type = info.getHeisyu(busyoId); int mapId = 22; if (Application.loadedLevelName != "kaisen") { inst.makeInstance(mapId, busyoId, butaiLv, ch_type, butaiQty, hp, atk, dfc, spd, busyoName, 0, false, senpouArray, ""); } else { BusyoInfoGet busyoScript = new BusyoInfoGet(); int shipId = busyoScript.getShipId(busyoId); inst.makeKaisenInstance(mapId, busyoId, shipId, butaiLv, ch_type, butaiQty, hp, atk, dfc, spd, busyoName, 0, false, senpouArray); } } } Message msg = new Message(); msg.makeKassenMessage(msg.getMessage(131)); }
public void enemyEngunInstance(string enemyEngunList){ List<string> daimyoEnguniList = new List<string> (); char[] delimiterChars = {':'}; char[] delimiterChars2 = {'-'}; if(enemyEngunList.Contains(":")){ daimyoEnguniList = new List<string> (enemyEngunList.Split (delimiterChars)); }else{ daimyoEnguniList.Add(enemyEngunList); } for(int i=0; i<daimyoEnguniList.Count; i++){ string daimyoEngunString = daimyoEnguniList[i]; List<string> unitEnguniList = new List<string> (); unitEnguniList = new List<string> (daimyoEngunString.Split (delimiterChars2)); int busyoId = int.Parse(unitEnguniList[0]); if(busyoId!=0){ int busyoLv = int.Parse(unitEnguniList[1]); int butaiQty = int.Parse(unitEnguniList[2]); int butaiLv = int.Parse(unitEnguniList[3]); StatusGet sts = new StatusGet (); int hp = sts.getHp (busyoId, busyoLv); int atk = sts.getAtk (busyoId, busyoLv); int dfc = sts.getDfc (busyoId, busyoLv); int spd = sts.getSpd (busyoId, busyoLv); string busyoName = sts.getBusyoName (busyoId); ArrayList senpouArray = sts.getSenpou (busyoId); //View Object & pass status to it. EnemyInstance inst = new EnemyInstance (); BusyoInfoGet info = new BusyoInfoGet (); string ch_type = info.getHeisyu (busyoId); int mapId = 22; inst.makeInstance(mapId, busyoId, butaiLv, ch_type, butaiQty, hp, atk, dfc, spd, busyoName, 0, false); } } Message msg = new Message (); string text = "敵軍の援軍が到着しましたぞ!"; msg.makeKassenMessage (text); }
public void Start () { //Get Temp Kuni Id & Stage Id activeKuniId = PlayerPrefs.GetInt ("activeKuniId"); string temp = "naisei" + activeKuniId.ToString (); /*Initial Setting*/ //Kuni Name & jyosyu string title = ""; string kuniName = PlayerPrefs.GetString ("activeKuniName"); string jyosyuTemp = "jyosyu" + activeKuniId; //Clear Image foreach ( Transform n in GameObject.Find ("JyosyuImage").transform){ GameObject.Destroy(n.gameObject); } if (PlayerPrefs.HasKey (jyosyuTemp)) { //Jyosyu Exist jyosyuId = PlayerPrefs.GetInt (jyosyuTemp); string busyoPath = "Prefabs/Player/Unit/" + jyosyuId; GameObject busyo = Instantiate (Resources.Load (busyoPath)) as GameObject; busyo.transform.SetParent (GameObject.Find ("JyosyuImage").transform); busyo.transform.localScale = new Vector2 (4, 4); busyo.GetComponent<DragHandler>().enabled = false; RectTransform busyo_transform = busyo.GetComponent<RectTransform>(); busyo_transform.anchoredPosition3D = new Vector3(40,40,0); busyo_transform.sizeDelta = new Vector2( 23, 23); foreach(Transform n in busyo.transform){ GameObject.Destroy(n.gameObject); } StatusGet sts = new StatusGet(); string jyosyuName = sts.getBusyoName(jyosyuId); title = kuniName + "・" + jyosyuName; //Ninmei Button GameObject btn = GameObject.Find ("Ninmei").gameObject; btn.GetComponent<Ninmei>().kaininFlg = true; btn.transform.FindChild("NinmeiText").GetComponent<Text>().text = "城主解任"; btn.GetComponent<Ninmei>().jyosyuId = jyosyuId; btn.GetComponent<Ninmei>().jyosyuName = jyosyuName; } else { //Jyosyu Not Exist title = kuniName + "・蔵入地"; //Ninmei Button GameObject btn = GameObject.Find ("Ninmei").gameObject; btn.GetComponent<Ninmei>().kaininFlg = false; btn.transform.FindChild("NinmeiText").GetComponent<Text>().text = "城主任命"; } GameObject.Find ("StageNameValue").GetComponent<Text> ().text = title; //Money int money = PlayerPrefs.GetInt("money"); GameObject.Find ("MoneyValue").GetComponent<Text> ().text = money.ToString(); //Hyourou int hyourou = PlayerPrefs.GetInt("hyourou"); GameObject.Find ("HyourouCurrentValue").GetComponent<Text> ().text = hyourou.ToString(); //HyourouMax int hyourouMax = PlayerPrefs.GetInt("hyourouMax"); GameObject.Find ("HyourouMaxValue").GetComponent<Text> ().text = hyourouMax.ToString(); //Naisei Icon List KuniInfo kuni = new KuniInfo (); shigen = kuni.getKuniNaisei (activeKuniId); //Sea or Tree isSeaFlg = kuni.getKuniIsSeaFlg (activeKuniId); GameObject otherObj = GameObject.Find ("Other").gameObject; if (isSeaFlg) { if(otherObj.transform.FindChild("treeUpper") != null){ otherObj.transform.FindChild("treeUpper").gameObject.SetActive(false); } } else { if(otherObj.transform.FindChild("sea") != null){ otherObj.transform.FindChild("sea").gameObject.SetActive(false); } } /*Open Panel*/ //Clear Previous Panel foreach ( Transform n in GameObject.Find ("NaiseiView").transform){ GameObject.Destroy(n.gameObject); } //Clear Previous Mask Panel foreach ( Transform n in GameObject.Find ("MaskView").transform){ GameObject.Destroy(n.gameObject); } //Open Panel & MaskPanel panelByShiro(activeKuniId); panelByKuniLv(); if (PlayerPrefs.HasKey (temp)) { /*initial setting*/ string naiseiString = PlayerPrefs.GetString (temp); List<string> naiseiList = new List<string>(); char[] delimiterChars = {','}; naiseiList = new List<string>(naiseiString.Split (delimiterChars)); /*Naisei Bldg Handling*/ char[] delimiterChars2 = {':'}; List<string> deletePanelList = new List<string>(); Entity_naisei_mst naiseiMst = Resources.Load ("Data/naisei_mst") as Entity_naisei_mst; for(int i=1; i<naiseiList.Count;i++){ List<string> naiseiContentList = new List<string>(); naiseiContentList = new List<string>(naiseiList[i].Split (delimiterChars2)); if(naiseiContentList[0] != "0"){ //Exist string bldgRank = ""; if(int.Parse(naiseiContentList[1])<8){ bldgRank = "s"; }else if(int.Parse(naiseiContentList[1]) < 15){ bldgRank = "m"; }else if(15 <= int.Parse(naiseiContentList[1])){ bldgRank = "l"; } //Add Delete Target deletePanelList.Add(i.ToString()); //Make New Panel string type = naiseiMst.param [int.Parse(naiseiContentList[0])].code; string bldg = type + "_" + bldgRank; string bldgPath = "Prefabs/Naisei/Bldg/" + bldg; GameObject bldgObj = Instantiate (Resources.Load (bldgPath)) as GameObject; bldgObj.transform.parent = GameObject.Find ("NaiseiView").transform; bldgObj.transform.localScale = new Vector3 (1, 1, 1); setBldg(bldgObj, i); bldgObj.name = i.ToString(); bldgObj.GetComponent<AreaButton>().blank = false; bldgObj.GetComponent<AreaButton>().type = type; bldgObj.GetComponent<AreaButton>().lv = naiseiContentList[1]; bldgObj.GetComponent<AreaButton>().naiseiId = int.Parse(naiseiContentList[0]); //Effect by Level List<int> naiseiEffectList = new List<int>(); naiseiEffectList = getNaiseiList(type, int.Parse(naiseiContentList[1])); if(type != "kzn"){ if(type != "yr" &&type != "kb"&&type != "tp" &&type != "ym" &&type !="snb"){ bldgObj.GetComponent<AreaButton>().effect = naiseiEffectList[0]; bldgObj.GetComponent<AreaButton>().effectNextLv = naiseiEffectList[1]; }else{ bldgObj.GetComponent<AreaButton>().effect = naiseiEffectList[0] * 2; bldgObj.GetComponent<AreaButton>().effectNextLv = naiseiEffectList[1] * 2; } }else{ bldgObj.GetComponent<AreaButton>().effect = naiseiEffectList[0] * 4; bldgObj.GetComponent<AreaButton>().effectNextLv = naiseiEffectList[1] * 4; } bldgObj.GetComponent<AreaButton>().moneyNextLv = naiseiEffectList[2]; bldgObj.GetComponent<AreaButton>().requiredHyourou =naiseiMst.param [int.Parse(naiseiContentList[0])].hyourou; bldgObj.GetComponent<AreaButton>().naiseiName =naiseiMst.param [int.Parse(naiseiContentList[0])].name; //Status if(type == "shop"){ syogyo = syogyo + naiseiEffectList[0]; }else if(type == "ta"){ nogyo = nogyo + naiseiEffectList[0]; }else if(type == "yr" ||type == "kb"||type == "tp" ||type == "ym"||type == "snb"){ int tempCalc = naiseiEffectList[0] * 2; gunjyu = gunjyu + tempCalc; }else if(type == "ashigaru"){ ashigaru = ashigaru + naiseiEffectList[0]; }else if(type == "trd"){ boubi = boubi + naiseiEffectList[0]; }else if(type == "kzn"){ int tempCalc = naiseiEffectList[0] * 4; syogyo = syogyo + tempCalc; }else if(type == "nbn"){ int tempCalc = naiseiEffectList[0]; kirisuto = kirisuto + tempCalc; }else if(type == "kgy"){ int tempCalc = naiseiEffectList[0]; bunka = bunka + tempCalc; }else if(type == "bky"){ int tempCalc = naiseiEffectList[0]; bukkyo = bukkyo + tempCalc; }else if(type == "hsy"){ int tempCalc = naiseiEffectList[0]; ashigaru = ashigaru + tempCalc; }else{ Debug.Log ("Not Yet"); } } } //Clear Duplicated Panel foreach ( Transform n in GameObject.Find ("NaiseiView").transform){ if(deletePanelList.Contains(n.name)){ if(n.tag == "Area"){ GameObject.Destroy(n.gameObject); } } } /*shiro setting*/ string rank = ""; if(int.Parse(naiseiList[0])<8){ rank = "s"; setShiro(rank, naiseiList[0]); }else if(int.Parse(naiseiList[0]) < 15){ rank = "m"; setShiro(rank, naiseiList[0]); }else if(15 <= int.Parse(naiseiList[0])){ rank = "l"; setShiro(rank, naiseiList[0]); } string maskPath = "Prefabs/Naisei/MaskPanel"; GameObject maskPanel = Instantiate (Resources.Load (maskPath)) as GameObject; maskPanel.transform.parent = GameObject.Find ("MaskView").transform; maskPanel.transform.localScale = new Vector3 (1, 1, 1); RectTransform maskPanel_transform = maskPanel.GetComponent<RectTransform>(); maskPanel_transform.anchoredPosition3D = new Vector3(0,-20,0); maskPanel.name = "shiro_" + rank; //Status Handling //Status Jyosyu Modification if (PlayerPrefs.HasKey (jyosyuTemp)) { StatusGet sts = new StatusGet(); int lv = PlayerPrefs.GetInt (jyosyuId.ToString()); float naiseiSts = (float)sts.getDfc(jyosyuId,lv); float hpSts = (float)sts.getHp(jyosyuId,lv); float atkSts = (float)sts.getAtk(jyosyuId,lv); float boubiSts = (hpSts + atkSts)/2; float tempSyogyo = (float)syogyo; tempSyogyo = tempSyogyo + (tempSyogyo * naiseiSts/200); float tempNogyo = (float)nogyo; tempNogyo = tempNogyo + (tempNogyo * naiseiSts/200); float tempBoubi = (float)boubi; tempBoubi = tempBoubi + (tempBoubi * naiseiSts/200); syogyo = (int)tempSyogyo; nogyo = (int)tempNogyo; boubi = (int)tempBoubi; } GameObject.Find("SyogyoValue").GetComponent<Text>().text = syogyo.ToString(); GameObject.Find("NougyoValue").GetComponent<Text>().text = nogyo.ToString(); GameObject.Find("GunjyuValue").GetComponent<Text>().text = gunjyu.ToString(); GameObject.Find("AshigaruValue").GetComponent<Text>().text = ashigaru.ToString(); GameObject.Find("BoubiValue").GetComponent<Text>().text = boubi.ToString(); GameObject.Find("BukkyoValue").GetComponent<Text>().text = bukkyo.ToString(); GameObject.Find("KirisutoValue").GetComponent<Text>().text = kirisuto.ToString(); GameObject.Find("BunkaValue").GetComponent<Text>().text = bunka.ToString(); GameObject.Find("BukkyoValue").GetComponent<Text>().text = bukkyo.ToString(); //jyosyu status update if (PlayerPrefs.HasKey (jyosyuTemp)) { int jyosyuId = PlayerPrefs.GetInt (jyosyuTemp); string heiTmp = "jyosyuHei" + jyosyuId; PlayerPrefs.SetInt (heiTmp,ashigaru); } string boubiTmp = "boubi" + activeKuniId; PlayerPrefs.SetInt (boubiTmp,boubi); } else { //Error Debug.Log ("ERROR"); } /***************************/ /*Tabibito Controller Start*/ /***************************/ tabibitoObj = GameObject.Find ("Tabibito").gameObject; loginTemp = "naiseiLoginDate" + activeKuniId.ToString (); string loginTimeString = PlayerPrefs.GetString (loginTemp); if (loginTimeString == null || loginTimeString == "") { loginTimeString = System.DateTime.Today.ToString (); PlayerPrefs.SetString (loginTemp,loginTimeString); PlayerPrefs.Flush(); } System.DateTime loginTime = System.DateTime.Parse (loginTimeString); System.TimeSpan span = System.DateTime.Today - loginTime; double spanDay = span.TotalDays; string counterTemp = "naiseiTabibitoCounter" + activeKuniId.ToString (); if (spanDay >= 1) { //Reset PlayerPrefs.SetInt (counterTemp,0); PlayerPrefs.Flush(); counter = 0; }else{ //Get Counted No counter = PlayerPrefs.GetInt (counterTemp,0); } //Set Tabibito Max total = (boubi + bukkyo + kirisuto + bunka)/10; remain = total - counter; tabibitoObj.transform.FindChild ("TabibitoMaxValue").GetComponent<Text> ().text = total.ToString (); tabibitoObj.transform.FindChild ("TabibitoCountDownValue").GetComponent<Text> ().text = remain.ToString (); /***************************/ /*Tabibito Controller End */ /***************************/ }
public void makeSimpleEnemy(int busyoId, GameObject battleArea, int xAdjust, GameObject YesBtn) { string path = "Prefabs/Player/" + busyoId; GameObject prefab = Instantiate(Resources.Load(path)) as GameObject; prefab.name = busyoId.ToString(); prefab.transform.SetParent(battleArea.transform); prefab.transform.localScale = new Vector2(-0.4f, 0.6f); prefab.GetComponent <SpriteRenderer>().sortingLayerName = "UI"; prefab.GetComponent <SpriteRenderer>().sortingOrder = 350; /**Player to Enemy**/ prefab.tag = "Enemy"; prefab.layer = LayerMask.NameToLayer("Enemy"); /**Player to Enemy End**/ float xAdjust2 = (float)xAdjust / 5; prefab.transform.localPosition = new Vector2(9 - xAdjust2, 1.8f); prefab.GetComponent <Rigidbody2D>().gravityScale = 1; //Set Scirpt Destroy(prefab.GetComponent <PlayerHP>()); Destroy(prefab.GetComponent <SenpouController>()); Destroy(prefab.GetComponent <LineLocation>()); if (prefab.GetComponent <HomingLong>()) { Destroy(prefab.GetComponent <HomingLong>()); prefab.AddComponent <Homing>(); } if (prefab.GetComponent <AttackLong>()) { Destroy(prefab.GetComponent <AttackLong>()); } else { Destroy(prefab.GetComponent <PlayerAttack>()); } Destroy(prefab.GetComponent <PlayerHP>()); prefab.AddComponent <SimpleAttack>(); prefab.AddComponent <SimpleHP>(); prefab.AddComponent <Homing>(); prefab.GetComponent <Homing>().speed = 50; prefab.GetComponent <Homing>().enabled = false; YesBtn.GetComponent <StartSimpleKassen>().busyoObjList.Add(prefab); //Parametor StartKassen stksn = GameObject.Find("BattleButton").GetComponent <StartKassen>(); int lv = stksn.activeBusyoLv; string busyoString = busyoId.ToString(); StatusGet sts = new StatusGet(); int hp = 100 * sts.getHp(busyoId, lv); int atk = 10 * sts.getAtk(busyoId, lv); int dfc = 10 * sts.getDfc(busyoId, lv); float spd = sts.getSpd(busyoId, lv); //Child Parametor int chlv = stksn.activeButaiLv; int chQty = stksn.activeButaiQty; EnemyInstance enemyInstance = new EnemyInstance(); string ch_type = sts.getHeisyu(busyoId); int ch_status = enemyInstance.getChildStatus(lv, ch_type, 0); int totalChldHp = 0; int totalChldAtk = 0; int totalChldDfc = 0; int atkDfc = (int)sts.getChAtkDfc(ch_status, hp); totalChldHp = ch_status * chQty; totalChldAtk = atkDfc * chQty; totalChldDfc = atkDfc * chQty; //Set value hp = hp + totalChldHp; atk = atk + totalChldAtk; dfc = dfc + totalChldDfc; prefab.GetComponent <Homing>().speed = spd / 20; prefab.GetComponent <SimpleAttack>().atk = atk; prefab.GetComponent <SimpleHP>().dfc = dfc; prefab.GetComponent <SimpleAttack>().baseAtk = atk; prefab.GetComponent <SimpleHP>().baseDfc = dfc; prefab.GetComponent <SimpleHP>().life = hp; }
public void GetPlayerSenryoku(string busyoId) { //Parent 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; KahouStatusGet kahouSts = new KahouStatusGet (); string[] KahouStatusArray =kahouSts.getKahouForStatus (busyoId,adjHp,adjAtk,adjDfc,spd); int totalBusyoHp =0; int totalBusyoAtk =0; int totalBusyoDfc =0; for(int i=0;i<KahouStatusArray.Length;i++){ string status = KahouStatusArray[i]; if(i==0){ //Attack totalBusyoAtk = adjAtk + int.Parse(status); }else if(i==1){ //HP totalBusyoHp = adjHp + int.Parse(status); }else if(i==2){ //DFC totalBusyoDfc = adjDfc + int.Parse(status); } } //Child string heiId = "hei" + busyoId.ToString (); string chParam = PlayerPrefs.GetString (heiId, "0"); char[] delimiterChars = {':'}; string[] ch_list = chParam.Split (delimiterChars); int ch_num = int.Parse (ch_list [1]); int ch_status = int.Parse (ch_list [3]); int totalChldHp = 0; int totalChldAtk = 0; int totalChldDfc = 0; JyosyuHeiryoku jyosyuHei = new JyosyuHeiryoku (); int addHei = jyosyuHei.GetJyosyuHeiryoku (busyoId.ToString()); totalChldHp = (ch_status * 10 + addHei) * ch_num; totalChldAtk = (ch_status + totalBusyoHp/200) * ch_num; totalChldDfc = (ch_status + totalBusyoHp/200) * ch_num; //Set value totalHp = totalBusyoHp + totalChldHp; totalAtk = totalBusyoAtk + totalChldAtk; totalDfc = totalBusyoDfc + totalChldDfc; }
public void makeSimplePlayer(int busyoId, bool soudaisyoFlg, GameObject battleArea, int xAdjust, GameObject YesBtn) { string path = "Prefabs/Player/" + busyoId; GameObject prefab = Instantiate(Resources.Load(path)) as GameObject; prefab.name = busyoId.ToString(); prefab.transform.SetParent(battleArea.transform); prefab.transform.localScale = new Vector2(0.4f, 0.6f); prefab.GetComponent <SpriteRenderer>().sortingLayerName = "UI"; prefab.GetComponent <SpriteRenderer>().sortingOrder = 350; if (soudaisyoFlg) { prefab.transform.localPosition = new Vector2(1.0f, 1.8f); } else { float xAdjust2 = (float)xAdjust / 20; prefab.transform.localPosition = new Vector2(3 - xAdjust2, 1.8f); } prefab.GetComponent <Rigidbody2D>().gravityScale = 1; //Set Scirpt Destroy(prefab.GetComponent <PlayerHP>()); Destroy(prefab.GetComponent <SenpouController>()); Destroy(prefab.GetComponent <UnitMover>()); Destroy(prefab.GetComponent <Kunkou>()); Destroy(prefab.GetComponent <LineLocation>()); if (prefab.GetComponent <AttackLong>()) { Destroy(prefab.GetComponent <AttackLong>()); } else { Destroy(prefab.GetComponent <PlayerAttack>()); } Destroy(prefab.GetComponent <PlayerHP>()); prefab.AddComponent <SimpleAttack>(); prefab.AddComponent <SimpleHP>(); prefab.AddComponent <Homing>(); prefab.GetComponent <Homing>().enabled = false; YesBtn.GetComponent <StartSimpleKassen>().busyoObjList.Add(prefab); //Parametor string busyoString = busyoId.ToString(); int lv = PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = 100 * sts.getHp(busyoId, lv); int atk = 10 * sts.getAtk(busyoId, lv); int dfc = 10 * sts.getDfc(busyoId, lv); float spd = sts.getSpd(busyoId, lv); JyosyuHeiryoku jyosyuHei = new JyosyuHeiryoku(); int addJyosyuHei = jyosyuHei.GetJyosyuHeiryoku(busyoId.ToString()); KahouStatusGet kahouSts = new KahouStatusGet(); string[] KahouStatusArray = kahouSts.getKahouForStatus(busyoId.ToString(), hp, atk, dfc, (int)spd); 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(); //Status string kanniTarget = kanni.getEffectTarget(kanniId); int effect = kanni.getEffect(kanniId); if (kanniTarget == "atk") { addAtkByKanni = ((float)atk * (float)effect) / 100; } else if (kanniTarget == "hp") { addHpByKanni = ((float)hp * (float)effect) / 100; } else if (kanniTarget == "dfc") { addDfcByKanni = ((float)dfc * (float)effect) / 100; } } } atk = atk + int.Parse(KahouStatusArray[0]) + Mathf.FloorToInt(addAtkByKanni); hp = hp + int.Parse(KahouStatusArray[1]) + Mathf.FloorToInt(addHpByKanni) + addJyosyuHei; dfc = dfc + int.Parse(KahouStatusArray[2]) + Mathf.FloorToInt(addDfcByKanni); //Child Parametor string heiId = "hei" + busyoId.ToString(); string chParam = PlayerPrefs.GetString(heiId, "0"); if (chParam == "0" || chParam == "") { StatusGet statusScript = new StatusGet(); string heisyu = statusScript.getHeisyu(busyoId); chParam = heisyu + ":1:1:1"; PlayerPrefs.SetString(heiId, chParam); PlayerPrefs.Flush(); } char[] delimiterChars = { ':' }; if (chParam.Contains(":")) { string[] ch_list = chParam.Split(delimiterChars); int chQty = int.Parse(ch_list[1]); int chlv = int.Parse(ch_list[2]); int ch_status = int.Parse(ch_list[3]); int totalChldHp = 0; int totalChldAtk = 0; int totalChldDfc = 0; ch_status = ch_status * 10; int atkDfc = (int)sts.getChAtkDfc(ch_status, hp); totalChldHp = ch_status * chQty; totalChldAtk = atkDfc * chQty; totalChldDfc = atkDfc * chQty; //Set value hp = hp + totalChldHp; atk = atk + totalChldAtk; dfc = dfc + totalChldDfc; } prefab.GetComponent <Homing>().speed = spd / 20; prefab.GetComponent <SimpleAttack>().atk = atk; prefab.GetComponent <SimpleHP>().dfc = dfc; prefab.GetComponent <SimpleAttack>().baseAtk = atk; prefab.GetComponent <SimpleHP>().baseDfc = dfc; prefab.GetComponent <SimpleHP>().life = hp; //check int myDaimyoBusyo = PlayerPrefs.GetInt("myDaimyoBusyo"); if (busyoId == myDaimyoBusyo) { myDaimyoBusyoFlg = true; } }
public void ScrollView(GameObject obj, GameObject btnObj) { string scrollPath = "Prefabs/Map/common/ScrollView"; GameObject scroll = Instantiate(Resources.Load(scrollPath)) as GameObject; scroll.transform.SetParent(obj.transform); scroll.transform.localScale = new Vector3(1, 1, 1); RectTransform scroll_transform = scroll.GetComponent <RectTransform>(); scroll_transform.anchoredPosition = new Vector3(0, 130, 0); scroll.name = "scroll"; List <string> myBusyoList = new List <string>(); string myBusyoString = PlayerPrefs.GetString("myBusyo"); char[] delimiterChars = { ',' }; myBusyoList = new List <string>(myBusyoString.Split(delimiterChars)); //reduce used busyo List <string> usedBusyoList = new List <string>(); string usedBusyo = PlayerPrefs.GetString("usedBusyo"); if (usedBusyo != null && usedBusyo != "") { usedBusyoList = new List <string> (usedBusyo.Split(delimiterChars)); myBusyoList.RemoveAll(usedBusyo.Contains); } string slotPath = "Prefabs/Map/common/Slot"; string chiryakuPath = "Prefabs/Map/common/Chiryaku"; GameObject contents = scroll.transform.FindChild("Content").gameObject; for (int i = 0; i < myBusyoList.Count; i++) { string myBusyoId = myBusyoList[i]; //Slot GameObject prefab = Instantiate(Resources.Load(slotPath)) as GameObject; prefab.transform.SetParent(contents.transform); prefab.transform.localScale = new Vector3(1, 1, 1); prefab.GetComponent <GaikouBusyoSelect>().DoBtn = btnObj; prefab.GetComponent <GaikouBusyoSelect>().Content = contents; prefab.GetComponent <GaikouBusyoSelect>().kuniDiff = kuniDiff; prefab.GetComponent <GaikouBusyoSelect>().daimyoBusyoAtk = daimyoBusyoAtk; prefab.GetComponent <GaikouBusyoSelect>().daimyoBusyoDfc = daimyoBusyoDfc; prefab.GetComponent <GaikouBusyoSelect>().busyoId = int.Parse(myBusyoId); //Busyo string busyoPath = "Prefabs/Player/Unit/BusyoUnit"; GameObject busyo = Instantiate(Resources.Load(busyoPath)) as GameObject; busyo.name = myBusyoId; busyo.transform.SetParent(prefab.transform); busyo.transform.localScale = new Vector3(4, 5, 4); busyo.name = myBusyoList [i].ToString(); RectTransform text_transform = busyo.transform.FindChild("Text").GetComponent <RectTransform>(); text_transform.anchoredPosition = new Vector3(-32, 12, 0); prefab.name = "Slot" + busyo.name; //Get Chiryaku StatusGet sts = new StatusGet(); int lv = 0; bool hardFlg = PlayerPrefs.GetBool("hardFlg"); if (hardFlg) { lv = 1; } else { lv = PlayerPrefs.GetInt(myBusyoId); } float chiryakuSts = (float)sts.getDfc(int.Parse(myBusyoId), lv); chiryakuSts = chiryakuSts * 10; GameObject chiryaku = Instantiate(Resources.Load(chiryakuPath)) as GameObject; chiryaku.transform.SetParent(busyo.transform); chiryaku.transform.FindChild("value").GetComponent <Text>().text = chiryakuSts.ToString(); chiryaku.transform.localScale = new Vector3(1, 1, 1); chiryaku.transform.localPosition = new Vector3(0, 0, 0); busyo.GetComponent <DragHandler> ().enabled = false; //Deffault Busyo Click if (i == 0) { prefab.GetComponent <GaikouBusyoSelect>().OnClick(); } } }
public void OnClick() { //Common Message msg = new Message(); AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> (); //Check Shinobi if (cyouhouSnbRankId != 0) { char[] delimiterChars = { ',' }; List <string> myBusyoList = new List <string> (); string myBusyoString = PlayerPrefs.GetString("myBusyo"); if (myBusyoString.Contains(",")) { myBusyoList = new List <string> (myBusyoString.Split(delimiterChars)); } else { myBusyoList.Add(myBusyoString); } //reduce used busyo List <string> usedBusyoList = new List <string>(); string usedBusyo = PlayerPrefs.GetString("usedBusyo"); if (usedBusyo != null && usedBusyo != "") { usedBusyoList = new List <string> (usedBusyo.Split(delimiterChars)); myBusyoList.RemoveAll(usedBusyo.Contains); } //Check Busyo if (myBusyoList.Count != 0) { audioSources [0].Play(); scrollObj.SetActive(true); scrollObj.transform.FindChild("Back").GetComponent <DoKousaku> ().scrollObj = scrollObj; GameObject doBtnObj = scrollObj.transform.FindChild("Do").gameObject; doBtnObj.GetComponent <DoKousaku> ().scrollObj = scrollObj; //Make Scroll GameObject content = scrollObj.transform.FindChild("ScrollView").transform.FindChild("Content").gameObject; foreach (Transform obj in content.transform) { Destroy(obj.gameObject); } string slotPath = "Prefabs/Map/kousaku/Slot"; string dfcPath = "Prefabs/Map/kousaku/TextObj"; for (int i = 0; i < myBusyoList.Count; i++) { string busyoId = myBusyoList [i]; //Slot GameObject slot = Instantiate(Resources.Load(slotPath)) as GameObject; slot.transform.SetParent(content.transform); slot.transform.localScale = new Vector3(1, 1, 1); //Busyo string busyoPath = "Prefabs/Player/Unit/BusyoUnit"; GameObject busyo = Instantiate(Resources.Load(busyoPath)) as GameObject; busyo.name = busyoId; busyo.transform.SetParent(slot.transform); busyo.transform.localScale = new Vector3(4, 5, 0); busyo.name = busyoId; slot.name = "Slot" + busyo.name; busyo.GetComponent <DragHandler> ().enabled = false; //Chiryaku GameObject txtObj = Instantiate(Resources.Load(dfcPath)) as GameObject; txtObj.transform.SetParent(busyo.transform); txtObj.transform.localScale = new Vector3(1, 1, 0); txtObj.transform.localPosition = new Vector3(5, -12, 0); StatusGet sts = new StatusGet(); int lv = PlayerPrefs.GetInt(busyoId); float chiryakuSts = (float)sts.getDfc(int.Parse(busyoId), lv); chiryakuSts = chiryakuSts * 10; txtObj.transform.FindChild("Value").GetComponent <Text> ().text = chiryakuSts.ToString(); //Set Param KousakuBusyoSelect script = slot.GetComponent <KousakuBusyoSelect>(); script.busyoId = int.Parse(busyoId); script.dfc = chiryakuSts; script.doBtnObj = doBtnObj; script.content = content; //Initial Setting if (i == 0) { slot.GetComponent <KousakuBusyoSelect> ().OnClick(); } } scrollObj.transform.FindChild("Do").GetComponent <DoKousaku> ().cyouhouSnbRankId = cyouhouSnbRankId; if (name == "CyouryakuButton") { scrollObj.transform.FindChild("Question").GetComponent <QA>().qaId = 31; if (Application.systemLanguage == SystemLanguage.Japanese) { scrollObj.transform.FindChild("Text").GetComponent <Text> ().text = "調略"; scrollObj.transform.FindChild("Do").transform.FindChild("Text").GetComponent <Text> ().text = "調略"; } else { scrollObj.transform.FindChild("Text").GetComponent <Text>().text = "Win Over"; scrollObj.transform.FindChild("Do").transform.FindChild("Text").GetComponent <Text>().text = "Win Over"; } doBtnObj.GetComponent <DoKousaku>().linkCutFlg = false; } else { scrollObj.transform.FindChild("Question").GetComponent <QA>().qaId = 30; if (Application.systemLanguage == SystemLanguage.Japanese) { scrollObj.transform.FindChild("Text").GetComponent <Text> ().text = "連絡線遮断"; scrollObj.transform.FindChild("Do").transform.FindChild("Text").GetComponent <Text>().text = "遮断"; } else { scrollObj.transform.FindChild("Text").GetComponent <Text>().text = "Link Cut"; scrollObj.transform.FindChild("Do").transform.FindChild("Text").GetComponent <Text>().text = "Cut"; } doBtnObj.GetComponent <DoKousaku> ().linkCutFlg = true; } } else { audioSources [4].Play(); msg.makeUpperMessageOnBoard(msg.getMessage(8)); } } else { audioSources [4].Play(); msg.makeUpperMessageOnBoard(msg.getMessage(51)); } }
//doramatic charactor // Use this for initialization void Start() { //map生成 Instantiate(mapPrefab); Instantiate(treePrefab); Instantiate(wallPrefab); /*プレイヤー配置*/ //ユーザ陣形データのロード int jinkei =PlayerPrefs.GetInt("jinkei",0); //1.魚麟 if (jinkei == 1) { if(PlayerPrefs.HasKey("1map1")){ int mapId = 1; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("1map2")){ int mapId = 2; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("1map7")){ int mapId = 7; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("1map8")){ int mapId = 8; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("1map11")){ int mapId = 11; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("1map12")){ int mapId = 12; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("1map13")){ int mapId = 13; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("1map14")){ int mapId = 14; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("1map17")){ int mapId = 17; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("1map18")){ int mapId = 18; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("1map21")){ int mapId = 21; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("1map22")){ int mapId = 22; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } //2.鶴翼 }else if(jinkei == 2){ if(PlayerPrefs.HasKey("2map3")){ int mapId = 3; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("2map4")){ int mapId = 4; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("2map5")){ int mapId = 5; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("2map7")){ int mapId = 7; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("2map8")){ int mapId = 8; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("2map11")){ int mapId = 11; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("2map12")){ int mapId = 12; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("2map17")){ int mapId = 17; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("2map18")){ int mapId = 18; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("2map23")){ int mapId = 23; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("2map24")){ int mapId = 24; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("2map25")){ int mapId = 25; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } } //3.偃月 else if(jinkei == 3){ if(PlayerPrefs.HasKey("3map3")){ int mapId = 3; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("3map7")){ int mapId = 7; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("3map8")){ int mapId = 8; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("3map9")){ int mapId = 9; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("3map11")){ int mapId = 11; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("3map12")){ int mapId = 12; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("3map14")){ int mapId = 14; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("3map15")){ int mapId = 15; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("3map16")){ int mapId = 16; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("3map20")){ int mapId = 20; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("3map21")){ int mapId = 21; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("3map25")){ int mapId = 25; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } } //4.雁行 else if(jinkei == 4){ if(PlayerPrefs.HasKey("4map1")){ int mapId = 1; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("4map2")){ int mapId = 2; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("4map7")){ int mapId = 7; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("4map8")){ int mapId = 8; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("4map12")){ int mapId = 12; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("4map13")){ int mapId = 13; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("4map14")){ int mapId = 14; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("4map18")){ int mapId = 18; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("4map19")){ int mapId = 19; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("4map20")){ int mapId = 20; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("4map24")){ int mapId = 24; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } if(PlayerPrefs.HasKey("4map25")){ int mapId = 25; String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoInt = PlayerPrefs.GetInt(map); string busyoString = busyoInt.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet(); int hp = sts.getHp(busyoInt,lv); int atk = sts.getAtk(busyoInt,lv); int dfc = sts.getDfc(busyoInt,lv); int spd = sts.getSpd(busyoInt,lv); string busyoName = sts.getBusyoName(busyoInt); ArrayList senpouArray = sts.getSenpou(busyoInt); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName); } } /*エネミー配置*/ //stageId取得しマスタ判別 int tempStageId = PlayerPrefs.GetInt("activeStageId",0); int kuniId = PlayerPrefs.GetInt("activeKuniId",0); Entity_stage_mst stageMst = Resources.Load ("Data/stage_mst") as Entity_stage_mst; //y=10(X-1)+z-1 int stageId = 10*(kuniId - 1) + tempStageId; int enemyJinkei = stageMst.param[stageId - 1].jinkei; int enemyLv = stageMst.param[stageId - 1].lv; int[] enemyArray = new int[25]; enemyArray[0] = stageMst.param[stageId - 1].map1; enemyArray[1] = stageMst.param[stageId - 1].map2; enemyArray[2] = stageMst.param[stageId - 1].map3; enemyArray[3] = stageMst.param[stageId - 1].map4; enemyArray[4] = stageMst.param[stageId - 1].map5; enemyArray[5] = stageMst.param[stageId - 1].map6; enemyArray[6] = stageMst.param[stageId - 1].map7; enemyArray[7] = stageMst.param[stageId - 1].map8; enemyArray[8] = stageMst.param[stageId - 1].map9; enemyArray[9] = stageMst.param[stageId - 1].map10; enemyArray[10] = stageMst.param[stageId - 1].map11; enemyArray[11] = stageMst.param[stageId - 1].map12; enemyArray[12] = stageMst.param[stageId - 1].map13; enemyArray[13] = stageMst.param[stageId - 1].map14; enemyArray[14] = stageMst.param[stageId - 1].map15; enemyArray[15] = stageMst.param[stageId - 1].map16; enemyArray[16] = stageMst.param[stageId - 1].map17; enemyArray[17] = stageMst.param[stageId - 1].map18; enemyArray[18] = stageMst.param[stageId - 1].map19; enemyArray[19] = stageMst.param[stageId - 1].map20; enemyArray[20] = stageMst.param[stageId - 1].map21; enemyArray[21] = stageMst.param[stageId - 1].map22; enemyArray[22] = stageMst.param[stageId - 1].map23; enemyArray[23] = stageMst.param[stageId - 1].map24; enemyArray[24] = stageMst.param[stageId - 1].map25; int ch_num = stageMst.param[stageId - 1].chQty; int ch_lv = stageMst.param[stageId - 1].lv; for(int i=0; i < enemyArray.Length; i++ ){ if(enemyArray[i] != 0){ int enemyMapId = i+1; int EnemyMap = enemyArray[i]; StatusGet sts = new StatusGet(); int hp = sts.getHp(EnemyMap,enemyLv); int atk = sts.getAtk(EnemyMap,enemyLv); int dfc = sts.getDfc(EnemyMap,enemyLv); int spd = sts.getSpd(EnemyMap,enemyLv); BusyoInfoGet info = new BusyoInfoGet(); String busyoName = info.getName(EnemyMap); String ch_type = info.getHeisyu(EnemyMap); EnemyInstance inst = new EnemyInstance(); inst.makeInstance(enemyMapId, EnemyMap, ch_lv, ch_type, ch_num, hp, atk, dfc, spd, busyoName); } } //HP bar //Instantiate(hpBarPlayerPrefab); //Instantiate(hpBarEnemyPrefab); //合戦開始エフェクト string pathBack = "Prefabs/PreKassen/backGround"; GameObject back = Instantiate(Resources.Load (pathBack)) as GameObject; back.transform.localScale = new Vector2 (30, 15); string pathLight = "Prefabs/PreKassen/lightning"; GameObject light = Instantiate(Resources.Load (pathLight)) as GameObject; light.transform.localScale = new Vector2 (10, 10); }
public void GetPlayerSenryoku(string busyoId){ //Parent 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; KahouStatusGet kahouSts = new KahouStatusGet (); string[] KahouStatusArray =kahouSts.getKahouForStatus (busyoId,adjHp,adjAtk,adjDfc,spd); int totalBusyoHp =0; int totalBusyoAtk =0; int totalBusyoDfc =0; string kanniTmp = "kanni" + busyoId; float addAtkByKanni = 0; float addHpByKanni = 0; float addDfcByKanni = 0; if (PlayerPrefs.HasKey (kanniTmp)) { int kanniId = PlayerPrefs.GetInt (kanniTmp); Kanni kanni = new Kanni (); //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; } } totalBusyoAtk = adjAtk + int.Parse(KahouStatusArray[0]) + Mathf.FloorToInt (addAtkByKanni); totalBusyoHp = adjHp + int.Parse(KahouStatusArray[1]) + Mathf.FloorToInt (addHpByKanni); totalBusyoDfc = adjDfc + int.Parse(KahouStatusArray[2]) + Mathf.FloorToInt (addDfcByKanni); //Child string heiId = "hei" + busyoId.ToString (); string chParam = PlayerPrefs.GetString (heiId, "0"); char[] delimiterChars = {':'}; string[] ch_list = chParam.Split (delimiterChars); int ch_num = int.Parse (ch_list [1]); chlv = int.Parse (ch_list [2]); int ch_status = int.Parse (ch_list [3]); int totalChldHp = 0; int totalChldAtk = 0; int totalChldDfc = 0; ch_status = ch_status * 10; int atkDfc = (int)sts.getChAtkDfc(ch_status, totalBusyoHp); JyosyuHeiryoku jyosyuHei = new JyosyuHeiryoku (); int addHei = jyosyuHei.GetJyosyuHeiryoku (busyoId.ToString()); totalChldHp = ch_status * ch_num; totalChldAtk = atkDfc * ch_num; totalChldDfc = atkDfc * ch_num; //Set value totalHp = totalBusyoHp + totalChldHp; totalAtk = totalBusyoAtk + totalChldAtk; totalDfc = totalBusyoDfc + totalChldDfc; }
public void playerEngunInstance(string playerEngunList){ List<string> daimyoEnguniList = new List<string> (); char[] delimiterChars = {':'}; char[] delimiterChars2 = {'-'}; if(playerEngunList.Contains(":")){ daimyoEnguniList = new List<string> (playerEngunList.Split (delimiterChars)); }else{ daimyoEnguniList.Add(playerEngunList); } for(int i=0; i<daimyoEnguniList.Count; i++){ string daimyoEngunString = daimyoEnguniList[i]; List<string> unitEnguniList = new List<string> (); unitEnguniList = new List<string> (daimyoEngunString.Split (delimiterChars2)); int busyoId = int.Parse(unitEnguniList[0]); if(busyoId!=0){ int busyoLv = int.Parse(unitEnguniList[1]); int butaiQty = int.Parse(unitEnguniList[2]); int butaiLv = int.Parse(unitEnguniList[3]); StatusGet sts = new StatusGet (); int hp = sts.getHp (busyoId, busyoLv); int atk = sts.getAtk (busyoId, busyoLv); int dfc = sts.getDfc (busyoId, busyoLv); int spd = sts.getSpd (busyoId, busyoLv); string busyoName = sts.getBusyoName (busyoId); ArrayList senpouArray = sts.getSenpou (busyoId); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance (); inst.makeEngunInstance(busyoId, hp, atk, dfc, spd, senpouArray, busyoName, butaiQty, butaiLv); } } Message msg = new Message (); string text = "自軍の援軍が到着しましたぞ!"; msg.makeKassenMessage (text); }
public void createBusyoStatusView(string busyoId){ 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; 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 != 100) { requiredExp = exp.getExpforNextLv (lv); } else { requiredExp = exp.getExpLv100(); } 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); 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 { 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); GameObject.Find ("StatusJyosyu").transform.FindChild ("Value").GetComponent<Text> ().text = kuniName + "\n城主"; } 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"); 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 = ""; if (ch_type == "KB") { heisyu = "騎馬隊"; } else if (ch_type == "YR") { heisyu = "槍隊"; } else if (ch_type == "TP") { heisyu = "鉄砲隊"; } else if (ch_type == "YM") { heisyu = "弓隊"; } 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; string heiText = hei.ToString() + "<size=150><Color=#35D74BFF>+" + addHei + "</Color></size>"; GameObject.Find ("ChildHeiryokuValue").GetComponent<Text> ().text = heiText; 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"); 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; GameObject kunren = GameObject.Find ("ButtonKunren"); kunren.GetComponent<BusyoStatusButton> ().ch_type = ch_type; kunren.GetComponent<BusyoStatusButton> ().ch_heisyu = heisyu; kunren.GetComponent<BusyoStatusButton> ().ch_lv = ch_lv; kunren.GetComponent<BusyoStatusButton> ().ch_status = chAtkDfc; kunren.GetComponent<BusyoStatusButton> ().ch_hp = hei ; kunren.GetComponent<BusyoStatusButton> ().ch_num = ch_num; kunren.GetComponent<BusyoStatusButton> ().pa_hp = totalBusyoHp/100; //Parametor Setting GameObject.Find ("GameScene").GetComponent<NowOnBusyo>().OnBusyo = busyoId; }
public void OnClick(){ //Ninmei if (kaininFlg == false) { //Make Jyosyu List string openKuniString = PlayerPrefs.GetString ("openKuni"); List<string> openKuniList = new List<string> (); char[] delimiterChars = {','}; openKuniList = new List<string> (openKuniString.Split (delimiterChars)); List<string> jyosyuList = new List<string> (); for (int i=0; i<openKuniList.Count; i++) { string temp = "jyosyu" + openKuniList [i]; if (PlayerPrefs.HasKey (temp)) { int jyosyuId = PlayerPrefs.GetInt (temp); jyosyuList.Add (jyosyuId.ToString ()); } } //Available Jyosyu List string myBusyoString = PlayerPrefs.GetString ("myBusyo"); List<string> myBusyoList = new List<string> (); myBusyoList = new List<string> (myBusyoString.Split (delimiterChars)); //Reduce MyBusyo - CurrentJyosyu myBusyoList.RemoveAll (jyosyuList.Contains); //Reduce MyDaimyo //int myDaimyo = PlayerPrefs.GetInt("myDaimyo"); //Daimyo daimyo = new Daimyo(); //int myDaimyoBusyo = daimyo.getDaimyoBusyoId(myDaimyo); //myBusyoList.Remove(myDaimyoBusyo.ToString()); if(myBusyoList.Count > 0){ BusyoStatusButton pop = new BusyoStatusButton (); pop.commonPopup (); GameObject.Find ("popText").GetComponent<Text> ().text = "城主任命"; //Set Scroll View string scrollPath = "Prefabs/Naisei/ScrollView"; GameObject scroll = Instantiate (Resources.Load (scrollPath)) as GameObject; scroll.transform.SetParent (GameObject.Find ("board(Clone)").transform); scroll.transform.localScale = new Vector2 (1, 1); scroll.name = "ScrollView"; RectTransform scrollTransform = scroll.GetComponent<RectTransform> (); scrollTransform.anchoredPosition3D = new Vector3 (0, 0, 0); //Show Available List foreach (string avl in myBusyoList) { string slotPath = "Prefabs/Naisei/BusyoSlot"; GameObject slot = Instantiate (Resources.Load (slotPath)) as GameObject; slot.transform.SetParent (scroll.transform.FindChild ("NaiseiContent").transform); slot.transform.localScale = new Vector2 (1, 1); string busyoPath = "Prefabs/Player/Unit/" + avl; GameObject busyo = Instantiate (Resources.Load (busyoPath)) as GameObject; busyo.transform.SetParent (slot.transform.FindChild ("Busyo").transform); busyo.transform.localScale = new Vector2 (3.5f, 3.5f); RectTransform busyo_transform = busyo.GetComponent<RectTransform> (); busyo_transform.anchoredPosition3D = new Vector3 (0, -300, 0); busyo_transform.sizeDelta = new Vector2 (200, 200); busyo.GetComponent<DragHandler> ().enabled = false; GameObject text = busyo.transform.FindChild ("Text").gameObject; text.transform.localScale = new Vector2 (0.6f, 0.6f); RectTransform text_transform = text.GetComponent<RectTransform> (); text_transform.anchoredPosition3D = new Vector3 (-200, 65, 0); GameObject rank = busyo.transform.FindChild ("Rank").gameObject; rank.transform.localScale = new Vector2 (1, 1); RectTransform rank_transform = rank.GetComponent<RectTransform> (); rank_transform.anchoredPosition3D = new Vector3 (30, -100, 0); //Status StatusGet sts = new StatusGet (); int lv = PlayerPrefs.GetInt (avl); float naiseiStsTemp = (float)sts.getDfc (int.Parse (avl), lv); float naiseiSts = naiseiStsTemp / 2; float hpSts = (float)sts.getHp (int.Parse (avl), lv); float atkSts = (float)sts.getAtk (int.Parse (avl), lv); float boubiStatusTemp = (hpSts + atkSts) / 2; float boubiStatus = boubiStatusTemp / 2; slot.transform.FindChild ("Busyo").transform.FindChild ("NaiseiEffectValue").GetComponent<Text> ().text = "+" + naiseiSts.ToString ("f1") + "%"; slot.transform.FindChild ("Busyo").transform.FindChild ("BoubiEffectValue").GetComponent<Text> ().text = "+" + boubiStatus.ToString ("f1") + "%"; //Lv string lvPath = "Prefabs/Naisei/Lv"; GameObject lvObj = Instantiate (Resources.Load (lvPath)) as GameObject; lvObj.transform.SetParent (busyo.transform); lvObj.GetComponent<Text> ().text = "Lv" + lv; lvObj.transform.localScale = new Vector2 (0.1f, 0.1f); RectTransform lv_transform = lvObj.GetComponent<RectTransform> (); lv_transform.anchoredPosition3D = new Vector3 (130, -70, 0); //Button slot.transform.FindChild ("Busyo").transform.FindChild ("NinmeiButton").GetComponent<DoNinmei> ().busyoId = avl; } }else{ Message msg = new Message(); string text = "城主に任命可能な武将がおりませぬぞ。\t配下武将を登用して下され。"; msg.makeMessage(text); } } else { //Kainin //Common Process //Back Cover string backPath = "Prefabs/Common/TouchBack"; GameObject back = Instantiate (Resources.Load (backPath)) as GameObject; back.transform.SetParent(GameObject.Find ("Panel").transform); back.transform.localScale = new Vector2 (1, 1); RectTransform backTransform = back.GetComponent<RectTransform> (); backTransform.anchoredPosition3D = new Vector3 (0, 0, 0); back.name = "TouchBack"; //Message Box string msgPath = "Prefabs/Naisei/KaininConfirm"; GameObject msg = Instantiate (Resources.Load (msgPath)) as GameObject; msg.transform.SetParent(back.transform); msg.transform.localScale = new Vector2 (1, 1); RectTransform msgTransform = msg.GetComponent<RectTransform> (); msgTransform.anchoredPosition3D = new Vector3 (0, 0, 0); msgTransform.name = "kaininConfirm"; //Message Text Mod GameObject msgObj = msg.transform.FindChild ("KaininText").gameObject; int myDaimyoBusyo = PlayerPrefs.GetInt ("myDaimyoBusyo"); string msgText = msgObj.GetComponent<Text> ().text; if (myDaimyoBusyo == jyosyuId) { msgText = msgText.Replace("A", "自らを"); } else { msgText = msgText.Replace("A", jyosyuName); } msgObj.GetComponent<Text> ().text = msgText; } }
//doramatic charactor // Use this for initialization void Start () { //map生成 Instantiate(mapPrefab); Instantiate(treePrefab); Instantiate(wallPrefab); /*プレイヤー配置*/ //ユーザ陣形データのロード int jinkei =PlayerPrefs.GetInt("jinkei",0); //1.魚麟 if (jinkei == 1) { if(PlayerPrefs.HasKey("1map1")){ int mapId = 1; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("1map2")){ int mapId = 2; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("1map7")){ int mapId = 7; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("1map8")){ int mapId = 8; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("1map11")){ int mapId = 11; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("1map12")){ int mapId = 12; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("1map13")){ int mapId = 13; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("1map14")){ int mapId = 14; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("1map17")){ int mapId = 17; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("1map18")){ int mapId = 18; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("1map21")){ int mapId = 21; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("1map22")){ int mapId = 22; getStsAndMakeInstance(jinkei,mapId); } //2.鶴翼 }else if(jinkei == 2){ if(PlayerPrefs.HasKey("2map3")){ int mapId = 3; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("2map4")){ int mapId = 4; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("2map5")){ int mapId = 5; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("2map7")){ int mapId = 7; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("2map8")){ int mapId = 8; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("2map11")){ int mapId = 11; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("2map12")){ int mapId = 12; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("2map17")){ int mapId = 17; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("2map18")){ int mapId = 18; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("2map23")){ int mapId = 23; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("2map24")){ int mapId = 24; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("2map25")){ int mapId = 25; getStsAndMakeInstance(jinkei,mapId); } } //3.偃月 else if(jinkei == 3){ if(PlayerPrefs.HasKey("3map3")){ int mapId = 3; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("3map7")){ int mapId = 7; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("3map8")){ int mapId = 8; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("3map9")){ int mapId = 9; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("3map11")){ int mapId = 11; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("3map12")){ int mapId = 12; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("3map14")){ int mapId = 14; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("3map15")){ int mapId = 15; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("3map16")){ int mapId = 16; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("3map20")){ int mapId = 20; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("3map21")){ int mapId = 21; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("3map25")){ int mapId = 25; getStsAndMakeInstance(jinkei,mapId); } } //4.雁行 else if(jinkei == 4){ if(PlayerPrefs.HasKey("4map1")){ int mapId = 1; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("4map2")){ int mapId = 2; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("4map7")){ int mapId = 7; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("4map8")){ int mapId = 8; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("4map12")){ int mapId = 12; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("4map13")){ int mapId = 13; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("4map14")){ int mapId = 14; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("4map18")){ int mapId = 18; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("4map19")){ int mapId = 19; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("4map20")){ int mapId = 20; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("4map24")){ int mapId = 24; getStsAndMakeInstance(jinkei,mapId); } if(PlayerPrefs.HasKey("4map25")){ int mapId = 25; getStsAndMakeInstance(jinkei,mapId); } } /*エネミー配置*/ //stageId取得しマスタ判別 int tempStageId = PlayerPrefs.GetInt("activeStageId",0); int kuniId = PlayerPrefs.GetInt("activeKuniId",0); Entity_stage_mst stageMst = Resources.Load ("Data/stage_mst") as Entity_stage_mst; //y=10(X-1)+z-1 int stageId = 10*(kuniId - 1) + tempStageId; //Jinkei Random List<int> jinkeiList = new List<int> (){1,2,3,4}; int enemyJinkei = UnityEngine.Random.Range(1,jinkeiList.Count + 1); /*Dynamic Enemy Setting Start*/ int activeDaimyoId = PlayerPrefs.GetInt("activeDaimyoId"); int activeBusyoQty = PlayerPrefs.GetInt ("activeBusyoQty"); int activeBusyoLv = PlayerPrefs.GetInt ("activeBusyoLv"); int activeButaiQty = PlayerPrefs.GetInt ("activeButaiQty"); int activeButaiLv = PlayerPrefs.GetInt ("activeButaiLv"); Entity_daimyo_mst daimyoMst = Resources.Load ("Data/daimyo_mst") as Entity_daimyo_mst; int daimyoBusyoId = daimyoMst.param[activeDaimyoId-1].busyoId; //Dimyo Setting int taisyoMapId = 0; List<int> mapList = new List<int>(); if (enemyJinkei == 1) { taisyoMapId = 15; mapList = new List<int>(){4,5,8,9,12,13,14,18,19,24,25}; }else if (enemyJinkei == 2) { taisyoMapId = 15; mapList = new List<int>(){1,2,3,8,9,14,18,19,21,22,23}; }else if (enemyJinkei == 3) { taisyoMapId = 14; mapList = new List<int>(){1,5,6,10,11,12,15,17,18,19,23}; }else if (enemyJinkei == 4) { taisyoMapId = 14; mapList = new List<int>(){4,5,8,9,12,13,16,17,18,21,22}; } StatusGet sts = new StatusGet(); int hp = sts.getHp(daimyoBusyoId,activeBusyoLv); int atk = sts.getAtk(daimyoBusyoId,activeBusyoLv); int dfc = sts.getDfc(daimyoBusyoId,activeBusyoLv); int spd = sts.getSpd(daimyoBusyoId,activeBusyoLv); BusyoInfoGet info = new BusyoInfoGet(); String daimyoBusyoName = info.getName(daimyoBusyoId); String daimyoType = info.getHeisyu(daimyoBusyoId); EnemyInstance inst = new EnemyInstance(); inst.makeInstance(taisyoMapId, daimyoBusyoId, activeButaiLv, daimyoType, activeButaiQty, hp, atk, dfc, spd, daimyoBusyoName); //Busyo Setting //Make busyo list 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(daimyoId == activeDaimyoId){ if(busyoId != daimyoBusyoId){ busyoList.Add (busyoId); } } } //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; } for (int i = 0; i < mapList.Count; i++) { int temp = mapList[i]; int randomIndex = UnityEngine.Random.Range(0, mapList.Count); mapList[i] = mapList[randomIndex]; mapList[randomIndex] = temp; } for(int j=0; j<activeBusyoQty-1; j++){ int randomBusyoId = busyoList[j]; int mapId = mapList[j]; //Status if(randomBusyoId !=0){ int busyoHp = sts.getHp(randomBusyoId,activeBusyoLv); int busyoAtk = sts.getAtk(randomBusyoId,activeBusyoLv); int busyoDfc = sts.getDfc(randomBusyoId,activeBusyoLv); int busyoSpd = sts.getSpd(randomBusyoId,activeBusyoLv); String busyoName = info.getName(randomBusyoId); String busyoType = info.getHeisyu(randomBusyoId); inst.makeInstance(mapId, randomBusyoId, activeButaiLv, busyoType, activeButaiQty, busyoHp, busyoAtk, busyoDfc, busyoSpd, busyoName); } } /*Dynamic Enemy Setting Finish*/ //合戦開始エフェクト string pathBack = "Prefabs/PreKassen/backGround"; GameObject back = Instantiate(Resources.Load (pathBack)) as GameObject; back.transform.localScale = new Vector2 (30, 15); string pathLight = "Prefabs/PreKassen/lightning"; GameObject light = Instantiate(Resources.Load (pathLight)) as GameObject; light.transform.localScale = new Vector2 (10, 10); }
public void OnClick(){ //SE sound = GameObject.Find ("SEController").GetComponent<AudioSource> (); sound.PlayOneShot (sound.clip); /*Common Process*/ 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); if (Application.loadedLevelName != "clearOrGameOver") { string pathOfBoard = "Prefabs/Map/smallBoard"; GameObject board = Instantiate (Resources.Load (pathOfBoard)) as GameObject; board.transform.parent = GameObject.Find ("Panel").transform; board.transform.localScale = new Vector2 (1, 1); /*Value Setting*/ //Kuni Name GameObject.Find ("kuniName").GetComponent<Text> ().text = kuniName; //Daimyo Name GameObject.Find ("DaimyoNameValue").GetComponent<Text> ().text = daimyoName; //Kamon string kamonPath = "Prefabs/Kamon/" + daimyoId.ToString (); GameObject kamon = GameObject.Find ("KamonBack"); kamon.GetComponent<Image> ().sprite = Resources.Load (kamonPath, typeof(Sprite)) as Sprite; //Daimyo Busyo View string busyoPath = "Prefabs/Player/Unit/" + daimyoBusyoId; GameObject busyo = Instantiate (Resources.Load (busyoPath)) as GameObject; busyo.transform.SetParent (kamon.transform); busyo.transform.localScale = new Vector2 (1, 1); busyo.GetComponent<DragHandler> ().enabled = false; RectTransform busyoTransform = busyo.GetComponent<RectTransform> (); busyoTransform.anchoredPosition = new Vector3 (90, 100, 0); busyoTransform.sizeDelta = new Vector2 (180, 200); foreach (Transform n in busyo.transform) { GameObject.Destroy (n.gameObject); } //Doumei if (doumeiFlg) { string doumeiPath = "Prefabs/Common/Doumei"; GameObject doumei = Instantiate (Resources.Load (doumeiPath)) as GameObject; doumei.transform.SetParent (kamon.transform); doumei.transform.localScale = new Vector2 (1, 1); RectTransform doumeiTransform = doumei.GetComponent<RectTransform> (); doumeiTransform.anchoredPosition = new Vector3 (-50, 80, 0); doumei.name = "Doumei"; } //Naisei Shigen Icon List<string> naiseiIconList = new List<string> (); char[] delimiterChars = {':'}; if (naiseiItem != "null" && naiseiItem != "") { if (naiseiItem.Contains (":")) { naiseiIconList = new List<string> (naiseiItem.Split (delimiterChars)); } else { naiseiIconList.Add (naiseiItem); } //Base string nasieiBasePath = "Prefabs/Map/Common/NaiseiList"; GameObject naiseiBase = Instantiate (Resources.Load (nasieiBasePath)) as GameObject; naiseiBase.transform.SetParent (board.transform); naiseiBase.transform.localScale = new Vector2 (1, 1); RectTransform naiseiBaseTransform = naiseiBase.GetComponent<RectTransform> (); naiseiBaseTransform.anchoredPosition = new Vector3 (405, -80, 0); //Icon string nasieiIconPath = "Prefabs/Map/Common/NaiseiItem"; for (int i=0; i<naiseiIconList.Count; i++) { GameObject naiseiIcon = Instantiate (Resources.Load (nasieiIconPath)) as GameObject; naiseiIcon.transform.SetParent (naiseiBase.transform); naiseiIcon.transform.localScale = new Vector2 (1, 1); string naiseiName = naiseiIconList [i]; if (naiseiName == "kb") { naiseiIcon.transform.FindChild ("Text").GetComponent<Text> ().text = "馬"; } else if (naiseiName == "tp") { naiseiIcon.transform.FindChild ("Text").GetComponent<Text> ().text = "砲"; } else if (naiseiName == "kzn") { naiseiIcon.transform.FindChild ("Text").GetComponent<Text> ().text = "鉱"; } else if (naiseiName == "snb") { naiseiIcon.transform.FindChild ("Text").GetComponent<Text> ().text = "忍"; } else if (naiseiName == "nbn") { naiseiIcon.transform.FindChild ("Text").GetComponent<Text> ().text = "南"; } else if (naiseiName == "mkd") { naiseiIcon.transform.FindChild ("Text").GetComponent<Text> ().text = "帝"; } } } //Heiryoku Calc GameObject yukouValue = GameObject.Find ("YukouValue"); GameObject atkBtn = GameObject.Find ("AttackButton"); GameObject gaikouBtn = GameObject.Find ("GaikouButton"); GameObject bouryakuhouBtn = GameObject.Find ("BouryakuButton"); Color NGClorBtn = new Color (133 / 255f, 133 / 255f, 80 / 255f, 255f / 255f); Color NGClorTxt = new Color (90 / 255f, 90 / 255f, 40 / 255f, 255f / 255f); if (clearFlg == false) { if (cyouhouSnbRankId != 0) { GameObject.Find ("HeiryokuValue").GetComponent<Text> ().text = heiryoku.ToString (); //Shinobi Icon string shinobiItemPath = "Prefabs/Item/Shinobi/Shinobi"; GameObject shinobi = Instantiate (Resources.Load (shinobiItemPath)) as GameObject; shinobi.transform.SetParent (board.transform); shinobi.transform.localScale = new Vector2 (0.25f, 0.31f); shinobi.name = "shinobi"; RectTransform snbTransform = shinobi.GetComponent<RectTransform> (); snbTransform.anchoredPosition = new Vector3 (-251, 250, 0); shinobi.GetComponent<Button> ().enabled = false; if (cyouhouSnbRankId == 1) { Color lowColor = new Color (0f / 255f, 0f / 255f, 219f / 255f, 255f / 255f); shinobi.GetComponent<Image>().color = lowColor; shinobi.transform.FindChild("ShinobiRank").GetComponent<Text>().text = "下"; } else if (cyouhouSnbRankId == 2) { Color midColor = new Color (94f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); shinobi.GetComponent<Image>().color = midColor; shinobi.transform.FindChild("ShinobiRank").GetComponent<Text>().text = "中"; } else if (cyouhouSnbRankId == 3) { Color highColor = new Color (84f / 255f, 103f / 255f, 0f / 255f, 255f / 255f); shinobi.GetComponent<Image>().color = highColor; shinobi.transform.FindChild("ShinobiRank").GetComponent<Text>().text = "上"; } } else { GameObject.Find ("HeiryokuValue").GetComponent<Text> ().text = "?"; } //Yukoudo yukouValue.GetComponent<Text> ().text = myYukouValue.ToString (); //Cyouhou atkBtn.GetComponent<AttackNaiseiView> ().cyouhouSnbRankId = cyouhouSnbRankId; } else { //Cleard GameObject.Find ("HeiryokuValue").GetComponent<Text> ().text = heiryoku.ToString (); //Yukoudo yukouValue.GetComponent<Text> ().text = "-"; //Enable Gaiko & Cyouhou gaikouBtn.GetComponent<Image> ().color = NGClorBtn; gaikouBtn.GetComponent<Button> ().enabled = false; gaikouBtn.transform.FindChild ("Text").GetComponent<Text> ().color = NGClorTxt; bouryakuhouBtn.GetComponent<Image> ().color = NGClorBtn; bouryakuhouBtn.GetComponent<Button> ().enabled = false; bouryakuhouBtn.transform.FindChild ("Text").GetComponent<Text> ().color = NGClorTxt; atkBtn.transform.FindChild ("Text").GetComponent<Text> ().text = "内政"; } //Enable to Attack if (openFlg == false) { atkBtn.GetComponent<Image> ().color = NGClorBtn; atkBtn.GetComponent<Button> ().enabled = false; atkBtn.transform.FindChild ("Text").GetComponent<Text> ().color = NGClorTxt; } //Doumei Flg if (doumeiFlg) { atkBtn.GetComponent<AttackNaiseiView> ().doumeiFlg = doumeiFlg; gaikouBtn.GetComponent<GaikouView> ().doumeiFlg = doumeiFlg; atkBtn.GetComponent<Image> ().color = NGClorBtn; atkBtn.GetComponent<Button> ().enabled = false; atkBtn.transform.FindChild ("Text").GetComponent<Text> ().color = NGClorTxt; } //Set Hidden Value GameObject close = GameObject.Find ("close").gameObject; close.GetComponent<CloseBoard> ().title = kuniName; close.GetComponent<CloseBoard> ().daimyoId = daimyoId; close.GetComponent<CloseBoard> ().daimyoBusyoId = daimyoBusyoId; close.GetComponent<CloseBoard> ().daimyoBusyoName = daimyoName; close.GetComponent<CloseBoard> ().doumeiFlg = doumeiFlg; close.GetComponent<CloseBoard> ().kuniQty = kuniQty; close.GetComponent<CloseBoard> ().kuniId = kuniId; close.GetComponent<CloseBoard> ().daimyoBusyoAtk = daimyoBusyoAtk; close.GetComponent<CloseBoard> ().daimyoBusyoDfc = daimyoBusyoDfc; close.GetComponent<CloseBoard> ().yukoudo = myYukouValue; close.GetComponent<CloseBoard> ().naiseiItem = naiseiItem; bool cyouhouFlg = false; if (cyouhouSnbRankId !=0) { cyouhouFlg = true; } close.GetComponent<CloseBoard> ().cyouhouFlg = cyouhouFlg; close.GetComponent<CloseBoard> ().cyouhouSnbRankId = cyouhouSnbRankId; //Set Button Value AttackNaiseiView attkNaiseView = GameObject.Find ("AttackButton").GetComponent<AttackNaiseiView> (); attkNaiseView.kuniId = kuniId; attkNaiseView.kuniName = kuniName; attkNaiseView.myDaimyoId = GameObject.Find ("GameController").GetComponent<MainStageController> ().myDaimyo; attkNaiseView.daimyoId = daimyoId; attkNaiseView.daimyoName = daimyoName; attkNaiseView.openFlg = openFlg; attkNaiseView.clearFlg = clearFlg; attkNaiseView.activeBusyoQty = busyoQty; attkNaiseView.activeBusyoLv = busyoLv; attkNaiseView.activeButaiQty = butaiQty; attkNaiseView.activeButaiLv = butaiLv; //Cyoutei Button if(kuniId == 16){ //Yamashiro string pathOfButton = "Prefabs/Cyoutei/CyouteiIcon"; GameObject btn = Instantiate (Resources.Load (pathOfButton)) as GameObject; btn.transform.SetParent(board.transform); btn.transform.localScale = new Vector2 (1, 1); btn.transform.localPosition = new Vector2 (225, -220); btn.name = "CyouteiIcon"; btn.GetComponent<CyouteiPop>().yukoudo = myYukouValue; btn.GetComponent<CyouteiPop>().myDaimyoFlg = clearFlg; btn.GetComponent<CyouteiPop>().occupiedDaimyoName = daimyoName; } //Syounin Button if(kuniId == 38 || kuniId == 39 || kuniId == 58){ //Hakata or Sakai string pathOfButton = "Prefabs/Syounin/SyouninIcon"; GameObject btn = Instantiate (Resources.Load (pathOfButton)) as GameObject; btn.transform.SetParent(board.transform); btn.transform.localScale = new Vector2 (1, 1); btn.transform.localPosition = new Vector2 (225, -220); btn.name = "SyouninIcon"; btn.GetComponent<SyouninPop>().yukoudo = myYukouValue; btn.GetComponent<SyouninPop>().myDaimyoFlg = clearFlg; btn.GetComponent<SyouninPop>().occupiedDaimyoName = daimyoName; if(kuniId == 38 || kuniId == 39){ btn.transform.FindChild("Text").GetComponent<Text>().text = "堺"; btn.GetComponent<SyouninPop>().sakaiFlg = true; }else if(kuniId == 58){ btn.transform.FindChild("Text").GetComponent<Text>().text = "博多"; } } } else { //Select Initial Daimyo Screen string pathOfBoard = "Prefabs/clearOrGameOver/DaimyoSelectBoard"; GameObject board = Instantiate (Resources.Load (pathOfBoard)) as GameObject; board.transform.parent = GameObject.Find ("Panel").transform; board.transform.localScale = new Vector2 (1, 1); GameObject selectBtn = board.transform.FindChild("SelectButton").gameObject; //Kuni Name GameObject.Find ("kuniName").GetComponent<Text> ().text = kuniName; //Daimyo Name GameObject.Find ("DaimyoNameValue").GetComponent<Text> ().text = daimyoName; //Kamon string kamonPath = "Prefabs/Kamon/" + daimyoId.ToString (); GameObject kamon = GameObject.Find ("KamonBack"); kamon.GetComponent<Image> ().sprite = Resources.Load (kamonPath, typeof(Sprite)) as Sprite; //Daimyo Busyo View string busyoPath = "Prefabs/Player/Unit/" + daimyoBusyoId; GameObject busyo = Instantiate (Resources.Load (busyoPath)) as GameObject; busyo.transform.SetParent (kamon.transform); busyo.transform.localScale = new Vector2 (1, 1); busyo.GetComponent<DragHandler> ().enabled = false; RectTransform busyoTransform = busyo.GetComponent<RectTransform> (); busyoTransform.anchoredPosition = new Vector3 (90, 100, 0); busyoTransform.sizeDelta = new Vector2 (180, 200); foreach (Transform n in busyo.transform) { GameObject.Destroy (n.gameObject); } //Kuni Qty GameObject.Find ("KuniQtyValue").GetComponent<Text> ().text = kuniQty.ToString(); //Once Cleared Flg if(gameClearFlg){ GameObject.Find ("KouryakuFlg").transform.FindChild("Label").GetComponent<Text> ().text = "攻略済"; } //Status //Daimyo Have Flg char[] delimiterChars = {':'}; int lv = 0; StatusGet sts = new StatusGet(); if(busyoHaveFlg){ //Updated Status lv = PlayerPrefs.GetInt(daimyoBusyoId.ToString()); //Ch string heiId = "hei" + daimyoBusyoId.ToString (); string chParam = PlayerPrefs.GetString (heiId, "0"); string[] ch_list = chParam.Split (delimiterChars); GameObject.Find ("ButaiQtyValue").GetComponent<Text> ().text = ch_list [1]; GameObject.Find ("ButaiLvValue").GetComponent<Text> ().text = ch_list [2]; }else{ //Default Status lv = 1; GameObject.Find ("ButaiQtyValue").GetComponent<Text> ().text = "1"; GameObject.Find ("ButaiLvValue").GetComponent<Text> ().text = "1"; } //Hp int hp = sts.getHp(daimyoBusyoId, lv); hp = hp * 100; GameObject.Find ("HPValue").GetComponent<Text> ().text = hp.ToString(); //Atk int atk = sts.getAtk(daimyoBusyoId, lv); atk = atk * 10; GameObject.Find ("AtkValue").GetComponent<Text> ().text = atk.ToString(); //Dfc int dfc = sts.getDfc(daimyoBusyoId, lv); dfc = dfc * 10; GameObject.Find ("DfcValue").GetComponent<Text> ().text = dfc.ToString(); //Spd int spd = sts.getSpd(daimyoBusyoId, lv); GameObject.Find ("SpdValue").GetComponent<Text> ().text = spd.ToString(); //Heisyu string heisyu = sts.getHeisyu(daimyoBusyoId); string heisyuKanji = ""; if(heisyu=="YR"){ heisyuKanji = "槍"; }else if(heisyu=="KB"){ heisyuKanji = "騎馬"; }else if(heisyu=="YM"){ heisyuKanji = "弓"; }else if(heisyu=="TP"){ heisyuKanji = "鉄砲"; } GameObject.Find ("HeisyuValue").GetComponent<Text> ().text = heisyuKanji.ToString(); //Naisei Shigen Icon List<string> naiseiIconList = new List<string> (); if (naiseiItem != "null" && naiseiItem != "") { if (naiseiItem.Contains (":")) { naiseiIconList = new List<string> (naiseiItem.Split (delimiterChars)); } else { naiseiIconList.Add (naiseiItem); } //Base string nasieiBasePath = "Prefabs/Map/Common/NaiseiList"; GameObject naiseiBase = Instantiate (Resources.Load (nasieiBasePath)) as GameObject; naiseiBase.transform.SetParent (board.transform); naiseiBase.transform.localScale = new Vector2 (1, 1); RectTransform naiseiBaseTransform = naiseiBase.GetComponent<RectTransform> (); naiseiBaseTransform.anchoredPosition = new Vector3 (405, -80, 0); //Icon string nasieiIconPath = "Prefabs/Map/Common/NaiseiItem"; for (int i=0; i<naiseiIconList.Count; i++) { GameObject naiseiIcon = Instantiate (Resources.Load (nasieiIconPath)) as GameObject; naiseiIcon.transform.SetParent (naiseiBase.transform); naiseiIcon.transform.localScale = new Vector2 (1, 1); string naiseiName = naiseiIconList [i]; if (naiseiName == "kb") { naiseiIcon.transform.FindChild ("Text").GetComponent<Text> ().text = "馬"; } else if (naiseiName == "tp") { naiseiIcon.transform.FindChild ("Text").GetComponent<Text> ().text = "砲"; } else if (naiseiName == "kzn") { naiseiIcon.transform.FindChild ("Text").GetComponent<Text> ().text = "鉱"; } else if (naiseiName == "snb") { naiseiIcon.transform.FindChild ("Text").GetComponent<Text> ().text = "忍"; } else if (naiseiName == "nbn") { naiseiIcon.transform.FindChild ("Text").GetComponent<Text> ().text = "南"; } else if (naiseiName == "mkd") { naiseiIcon.transform.FindChild ("Text").GetComponent<Text> ().text = "帝"; } else if (naiseiName == "syn") { naiseiIcon.transform.FindChild ("Text").GetComponent<Text> ().text = "商"; } } } selectBtn.GetComponent<SelectDaimyo>().daimyoId = daimyoId; selectBtn.GetComponent<SelectDaimyo>().daimyoName = daimyoName; selectBtn.GetComponent<SelectDaimyo>().daimyoBusyoId = daimyoBusyoId; selectBtn.GetComponent<SelectDaimyo>().busyoHaveFlg = busyoHaveFlg; selectBtn.GetComponent<SelectDaimyo>().heisyu = heisyu; } }
public void getStsAndMakeInstance(int jinkei, int mapId){ String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoId = PlayerPrefs.GetInt(map); string busyoString = busyoId.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet (); int hp = sts.getHp (busyoId, lv); int atk = sts.getAtk (busyoId, lv); int dfc = sts.getDfc (busyoId, lv); int spd = sts.getSpd (busyoId, lv); string busyoName = sts.getBusyoName (busyoId); ArrayList senpouArray = sts.getSenpou (busyoId); //View Object & pass status to it. PlayerInstance inst = new PlayerInstance (); inst.makeInstance (busyoId, mapId, hp, atk, dfc, spd, senpouArray, busyoName); }
public void playerEngunInstance(string playerEngunList, float mntMinusRatio, float seaMinusRatio, float rainMinusRatio, float snowMinusRatio) { List <string> daimyoEnguniList = new List <string> (); char[] delimiterChars = { ':' }; char[] delimiterChars2 = { '-' }; if (playerEngunList.Contains(":")) { daimyoEnguniList = new List <string> (playerEngunList.Split(delimiterChars)); } else { daimyoEnguniList.Add(playerEngunList); } for (int i = 0; i < daimyoEnguniList.Count; i++) { StatusGet sts = new StatusGet(); string daimyoEngunString = daimyoEnguniList[i]; List <string> unitEnguniList = new List <string> (); unitEnguniList = new List <string> (daimyoEngunString.Split(delimiterChars2)); int busyoId = int.Parse(unitEnguniList[1]); string heisyu = sts.getHeisyu(busyoId); if (busyoId != 0) { int busyoLv = int.Parse(unitEnguniList[2]); int butaiQty = int.Parse(unitEnguniList[3]); int butaiLv = int.Parse(unitEnguniList[4]); int hp = sts.getHp(busyoId, busyoLv); int atk = sts.getAtk(busyoId, busyoLv); int dfc = sts.getDfc(busyoId, busyoLv); int spd = sts.getSpd(busyoId, busyoLv); string busyoName = sts.getBusyoName(busyoId); ArrayList senpouArray = sts.getSenpou(busyoId, true); if (mntMinusRatio != 0) { if (heisyu == "KB") { float tmp = (float)spd * mntMinusRatio; if (tmp < 1) { tmp = 1; } spd = Mathf.FloorToInt(tmp); } } else if (seaMinusRatio != 0) { if (heisyu == "TP") { float tmp = (float)dfc * seaMinusRatio; if (tmp < 1) { tmp = 1; } dfc = Mathf.FloorToInt(tmp); } else if (heisyu == "YM") { float tmp = (float)dfc * seaMinusRatio; if (tmp < 1) { tmp = 1; } dfc = Mathf.FloorToInt(tmp); } } if (rainMinusRatio != 0) { if (heisyu == "TP") { float tmp = (float)atk * rainMinusRatio; if (tmp < 1) { tmp = 1; } atk = Mathf.FloorToInt(tmp); } else if (heisyu == "YM") { float tmp = (float)atk * rainMinusRatio; if (tmp < 1) { tmp = 1; } atk = Mathf.FloorToInt(tmp); } } else if (snowMinusRatio != 0) { float tmp = (float)spd * 0.5f; if (tmp < 1) { tmp = 1; } spd = Mathf.FloorToInt(tmp); if (heisyu == "TP") { float tmp2 = (float)atk * snowMinusRatio; if (tmp2 < 1) { tmp2 = 1; } atk = Mathf.FloorToInt(tmp2); } else if (heisyu == "YM") { float tmp2 = (float)atk * snowMinusRatio; if (tmp2 < 1) { tmp2 = 1; } atk = Mathf.FloorToInt(tmp2); } else if (heisyu == "KB") { float tmp2 = (float)dfc * snowMinusRatio; if (tmp2 < 1) { tmp2 = 1; } dfc = Mathf.FloorToInt(tmp2); } } //View Object & pass status to it. PlayerInstance inst = new PlayerInstance(); if (Application.loadedLevelName != "kaisen") { inst.makeEngunInstance(busyoId, hp, atk, dfc, spd, senpouArray, busyoName, butaiQty, butaiLv); } else { BusyoInfoGet busyoScript = new BusyoInfoGet(); int shipId = busyoScript.getShipId(busyoId); inst.makeKaisenInstance(busyoId, shipId, 25, hp, atk, dfc, spd, senpouArray, busyoName, butaiQty, butaiLv, true, butaiQty, butaiLv); } } } //auto check if (GameObject.Find("AutoBtn")) { if (GameObject.Find("AutoBtn").GetComponent <AutoAttack>().onFlg) { AutoAttack autoScript = new AutoAttack(); autoScript.changeAutoScript(); } } Message msg = new Message(); msg.makeKassenMessage(msg.getMessage(130)); }
public void OnClick() { AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> (); //Ninmei if (kaininFlg == false) { //Make Jyosyu List string openKuniString = PlayerPrefs.GetString("openKuni"); List <string> openKuniList = new List <string> (); char[] delimiterChars = { ',' }; openKuniList = new List <string> (openKuniString.Split(delimiterChars)); List <string> jyosyuList = new List <string> (); for (int i = 0; i < openKuniList.Count; i++) { string temp = "jyosyu" + openKuniList [i]; if (PlayerPrefs.HasKey(temp)) { int jyosyuId = PlayerPrefs.GetInt(temp); jyosyuList.Add(jyosyuId.ToString()); } } //Available Jyosyu List string myBusyoString = PlayerPrefs.GetString("myBusyo"); List <string> myBusyoList = new List <string> (); myBusyoList = new List <string> (myBusyoString.Split(delimiterChars)); //Reduce MyBusyo - CurrentJyosyu myBusyoList.RemoveAll(jyosyuList.Contains); //Reduce MyDaimyo //int myDaimyo = PlayerPrefs.GetInt("myDaimyo"); //Daimyo daimyo = new Daimyo(); //int myDaimyoBusyo = daimyo.getDaimyoBusyoId(myDaimyo); //myBusyoList.Remove(myDaimyoBusyo.ToString()); if (myBusyoList.Count > 0) { audioSources [0].Play(); BusyoStatusButton pop = new BusyoStatusButton(); pop.commonPopup(19); if (Application.systemLanguage != SystemLanguage.Japanese) { GameObject.Find("popText").GetComponent <Text> ().text = "Feudatory"; } else { GameObject.Find("popText").GetComponent <Text>().text = "城主任命"; } //Set Scroll View string scrollPath = "Prefabs/Naisei/ScrollView"; GameObject scroll = Instantiate(Resources.Load(scrollPath)) as GameObject; scroll.transform.SetParent(GameObject.Find("board(Clone)").transform); scroll.transform.localScale = new Vector2(1, 1); scroll.name = "ScrollView"; RectTransform scrollTransform = scroll.GetComponent <RectTransform> (); scrollTransform.anchoredPosition3D = new Vector3(0, 0, 0); //Show Available List foreach (string avl in myBusyoList) { string slotPath = "Prefabs/Naisei/BusyoSlot"; GameObject slot = Instantiate(Resources.Load(slotPath)) as GameObject; slot.transform.SetParent(scroll.transform.FindChild("NaiseiContent").transform); slot.transform.localScale = new Vector2(1, 1); string busyoPath = "Prefabs/Player/Unit/BusyoUnit"; GameObject busyo = Instantiate(Resources.Load(busyoPath)) as GameObject; busyo.name = avl; busyo.transform.SetParent(slot.transform.FindChild("Busyo").transform); busyo.transform.localScale = new Vector2(3.5f, 3.5f); RectTransform busyo_transform = busyo.GetComponent <RectTransform> (); busyo_transform.anchoredPosition3D = new Vector3(0, -300, 0); busyo_transform.sizeDelta = new Vector2(200, 200); busyo.GetComponent <DragHandler> ().enabled = false; GameObject text = busyo.transform.FindChild("Text").gameObject; text.transform.localScale = new Vector2(0.6f, 0.6f); RectTransform text_transform = text.GetComponent <RectTransform> (); text_transform.anchoredPosition3D = new Vector3(-200, 65, 0); GameObject rank = busyo.transform.FindChild("Rank").gameObject; rank.transform.localScale = new Vector2(1, 1); RectTransform rank_transform = rank.GetComponent <RectTransform> (); rank_transform.anchoredPosition3D = new Vector3(30, -100, 0); //Status StatusGet sts = new StatusGet(); int lv = PlayerPrefs.GetInt(avl); float naiseiStsTemp = (float)sts.getDfc(int.Parse(avl), lv); float naiseiSts = naiseiStsTemp / 2; float hpSts = (float)sts.getHp(int.Parse(avl), lv); float atkSts = (float)sts.getAtk(int.Parse(avl), lv); float boubiStatusTemp = (hpSts + atkSts) / 2; float boubiStatus = boubiStatusTemp / 2; slot.transform.FindChild("Busyo").transform.FindChild("NaiseiEffectValue").GetComponent <Text> ().text = "+" + naiseiSts.ToString("f1") + "%"; slot.transform.FindChild("Busyo").transform.FindChild("BoubiEffectValue").GetComponent <Text> ().text = "+" + boubiStatus.ToString("f1") + "%"; //Lv string lvPath = "Prefabs/Naisei/Lv"; GameObject lvObj = Instantiate(Resources.Load(lvPath)) as GameObject; lvObj.transform.SetParent(busyo.transform); lvObj.GetComponent <Text> ().text = "Lv" + lv; lvObj.transform.localScale = new Vector2(0.1f, 0.1f); RectTransform lv_transform = lvObj.GetComponent <RectTransform> (); lv_transform.anchoredPosition3D = new Vector3(130, -70, 0); //Button slot.transform.FindChild("Busyo").transform.FindChild("NinmeiButton").GetComponent <DoNinmei> ().busyoId = avl; } } else { audioSources [4].Play(); Message msg = new Message(); msg.makeMessage(msg.getMessage(119)); } } else { audioSources [0].Play(); //Kainin //Common Process //Back Cover string backPath = "Prefabs/Common/TouchBack"; GameObject back = Instantiate(Resources.Load(backPath)) as GameObject; back.transform.SetParent(GameObject.Find("Panel").transform); back.transform.localScale = new Vector2(1, 1); RectTransform backTransform = back.GetComponent <RectTransform> (); backTransform.anchoredPosition3D = new Vector3(0, 0, 0); back.name = "TouchBack"; //Message Box string msgPath = "Prefabs/Naisei/KaininConfirm"; GameObject msg = Instantiate(Resources.Load(msgPath)) as GameObject; msg.transform.SetParent(back.transform); msg.transform.localScale = new Vector2(1, 1); RectTransform msgTransform = msg.GetComponent <RectTransform> (); msgTransform.anchoredPosition3D = new Vector3(0, 0, 0); msgTransform.name = "kaininConfirm"; //Message Text Mod GameObject msgObj = msg.transform.FindChild("KaininText").gameObject; int myDaimyoBusyo = PlayerPrefs.GetInt("myDaimyoBusyo"); string msgText = ""; if (myDaimyoBusyo == jyosyuId) { if (Application.systemLanguage != SystemLanguage.Japanese) { msgText = "My lord, do you want to resign the lord of this country?"; } else { msgText = "御館様、自らを城主から解任なさいますか?"; } } else { if (Application.systemLanguage != SystemLanguage.Japanese) { msgText = "My lord, do you want to remove " + jyosyuName + " from the lord of this country?"; } else { msgText = "御館様、" + jyosyuName + "殿を城主から解任なさいますか?"; } } msgObj.GetComponent <Text> ().text = msgText; } }
public int getStsAndMakeInstance(int jinkei, int mapId, float mntMinusRatio, float seaMinusRatio, float rainMinusRatio, float snowMinusRatio){ String map = jinkei.ToString() + "map" + mapId; //Get Status int busyoId = PlayerPrefs.GetInt(map); string busyoString = busyoId.ToString(); int lv =PlayerPrefs.GetInt(busyoString); StatusGet sts = new StatusGet (); int hp = sts.getHp (busyoId, lv); int atk = sts.getAtk (busyoId, lv); int dfc = sts.getDfc (busyoId, lv); int spd = sts.getSpd (busyoId, lv); string busyoName = sts.getBusyoName (busyoId); ArrayList senpouArray = sts.getSenpou (busyoId); //Map & Weather Minus string heisyu = sts.getHeisyu (busyoId); if (mntMinusRatio != 0) { if (heisyu == "KB") { float tmp = (float)spd * mntMinusRatio; if (tmp < 1) { tmp = 1; } spd = Mathf.FloorToInt (tmp); } }else if (seaMinusRatio != 0) { if (heisyu == "TP") { float tmp = (float)dfc * seaMinusRatio; if (tmp < 1) { tmp = 1; } dfc = Mathf.FloorToInt (tmp); }else if (heisyu == "YM") { float tmp = (float)dfc * seaMinusRatio; if (tmp < 1) { tmp = 1; } dfc = Mathf.FloorToInt (tmp); } } if (rainMinusRatio != 0) { if (heisyu == "TP") { float tmp = (float)atk * rainMinusRatio; if (tmp < 1) { tmp = 1; } atk = Mathf.FloorToInt (tmp); }else if (heisyu == "YM") { float tmp = (float)atk * rainMinusRatio; if (tmp < 1) { tmp = 1; } atk = Mathf.FloorToInt (tmp); } }else if(snowMinusRatio != 0) { float tmp = (float)spd * 0.5f; if (tmp < 1) { tmp = 1; } spd = Mathf.FloorToInt (tmp); if (heisyu == "TP") { float tmp2 = (float)atk * snowMinusRatio; if (tmp2 < 1) { tmp2 = 1; } atk = Mathf.FloorToInt (tmp2); }else if (heisyu == "YM") { float tmp2 = (float)atk * snowMinusRatio; if (tmp2 < 1) { tmp2 = 1; } atk = Mathf.FloorToInt (tmp2); }else if (heisyu == "KB") { float tmp2 = (float)dfc * snowMinusRatio; if (tmp2 < 1) { tmp2 = 1; } dfc = Mathf.FloorToInt (tmp2); } } if (busyoId == soudaisyo) { soudaisyoHp = hp; soudaisyoAtk = atk; soudaisyoDfc = dfc; soudaisyoSpd = spd; } int boubi = 0; if (activeStageId == 0) { //Passive boubi = PlayerPrefs.GetInt("activeBoubi", 0); } //View Object & pass status to it. PlayerInstance inst = new PlayerInstance (); inst.makeInstance (busyoId, mapId, hp, atk, dfc, spd, senpouArray, busyoName, soudaisyo, boubi); return busyoId; }
public void createBusyoStatusView(string busyoId) { bool tutorialDoneFlg = PlayerPrefs.GetBool("tutorialDoneFlg"); int lv = 1; if (!tutorialDoneFlg || Application.loadedLevelName != "tutorialBusyo") { 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 = 0; if (!tutorialDoneFlg || Application.loadedLevelName != "tutorialBusyo") { 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 int totalBusyoHp = 0; int finalAtk = 0; int finalHp = 0; int finalDfc = 0; int finalSpd = 0; if (tutorialDoneFlg && Application.loadedLevelName != "tutorialBusyo") { KahouStatusGet kahouSts = new KahouStatusGet(); string[] KahouStatusArray = kahouSts.getKahouForStatus(busyoId, adjHp, adjAtk, adjDfc, spd); //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 finalAtk = int.Parse(KahouStatusArray [0]) + Mathf.FloorToInt(addAtkByKanni); finalHp = int.Parse(KahouStatusArray [1]) + Mathf.FloorToInt(addHpByKanni); finalDfc = int.Parse(KahouStatusArray [2]) + Mathf.FloorToInt(addDfcByKanni); 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(); } 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 = "官位無し"; } 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 = "城無し"; } } //Butai Status string heiId = "hei" + busyoId.ToString(); string chParam = ""; if (!tutorialDoneFlg || Application.loadedLevelName != "tutorialBusyo") { chParam = PlayerPrefs.GetString(heiId, "0"); } else { //retry tutorial chParam = "TP: 1:1:1"; } if (chParam == "0" || chParam == "") { StatusGet statusScript = new StatusGet(); string chParamHeisyu = statusScript.getHeisyu(int.Parse(busyoId)); chParam = chParamHeisyu + ":1:1:1"; PlayerPrefs.SetString(heiId, chParam); PlayerPrefs.Flush(); } 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_status = chAtkDfc; kunren.GetComponent <BusyoStatusButton> ().ch_hp = hei; kunren.GetComponent <BusyoStatusButton> ().ch_num = ch_num; 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 GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyo = busyoId; //Jinkei Flg GameObject BusyoView = GameObject.Find("BusyoView"); if (!BusyoView.transform.FindChild("jinkei")) { if (jinkeiBusyoCheck(int.Parse(busyoId))) { 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"; } } }
public void createBusyoStatusView(string busyoId) { 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; 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= exp.getExpforNextLv(lv); 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; for(int i=0;i<KahouStatusArray.Length;i++){ string status = KahouStatusArray[i]; if(i==0){ //Attack GameObject.Find ("KahouAtkValue").GetComponent<Text>().text = "+" + status; }else if(i==1){ //HP GameObject.Find ("KahouHpValue").GetComponent<Text>().text = "+" + status; totalBusyoHp = adjHp + int.Parse(status); }else if(i==2){ //DFC GameObject.Find ("KahouDfcValue").GetComponent<Text>().text = "+" + status; }else if(i==3){ //SPD GameObject.Find ("KahouSpdValue").GetComponent<Text>().text = "+" + status; } } //Butai Status string heiId = "hei" + busyoId.ToString (); string chParam = PlayerPrefs.GetString (heiId, "0"); 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 = ""; if (ch_type == "KB") { heisyu = "騎馬隊"; } else if (ch_type == "YR") { heisyu = "槍隊"; } else if (ch_type == "TP") { heisyu = "鉄砲隊"; } else if (ch_type == "YM") { heisyu = "弓隊"; } 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; string heiText = hei.ToString() + "<size=150><Color=#35D74BFF>+" + addHei + "</Color></size>"; GameObject.Find ("ChildHeiryokuValue").GetComponent<Text> ().text = heiText; float chAtkDfc = ch_status + totalBusyoHp / 200; 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.anchoredPosition = new Vector3 (-200, -50, 0); chTransform.sizeDelta = new Vector2 (40, 40); chObj.transform.localScale = new Vector2 (4, 4); //Child Status Transfer to Button//Keep busyo name GameObject kanjyo = GameObject.Find ("ButtonKanjyo"); kanjyo.GetComponent<BusyoStatusButton> ().pa_lv = lv; GameObject chigyo = GameObject.Find ("ButtonCyouhei"); 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; GameObject kunren = GameObject.Find ("ButtonKunren"); kunren.GetComponent<BusyoStatusButton> ().ch_type = ch_type; kunren.GetComponent<BusyoStatusButton> ().ch_heisyu = heisyu; kunren.GetComponent<BusyoStatusButton> ().ch_lv = ch_lv; kunren.GetComponent<BusyoStatusButton> ().ch_status = chAtkDfc; kunren.GetComponent<BusyoStatusButton> ().ch_hp = hei ; kunren.GetComponent<BusyoStatusButton> ().ch_num = ch_num; kunren.GetComponent<BusyoStatusButton> ().pa_hp = totalBusyoHp/100; //Parametor Setting GameObject.Find ("GameScene").GetComponent<NowOnBusyo>().OnBusyo = busyoId; }
public void OnClick () { //Initialization totalMoney = 0; totalHyourou = 0; totalYRL = 0; totalKBL = 0; totalYML = 0; totalTPL = 0; totalYRM = 0; totalKBM = 0; totalYMM = 0; totalTPM = 0; totalYRH = 0; totalKBH = 0; totalYMH = 0; totalTPH = 0; /*Popup*/ string backPath = "Prefabs/Busyo/back"; GameObject back = Instantiate (Resources.Load (backPath)) as GameObject; back.transform.SetParent(GameObject.Find ("Map").transform); back.transform.localScale = new Vector2 (1, 1); RectTransform backTransform = back.GetComponent<RectTransform> (); backTransform.anchoredPosition = new Vector3 (0, 0, 0); //Popup Screen string popupPath = "Prefabs/Busyo/board"; GameObject popup = Instantiate (Resources.Load (popupPath)) as GameObject; popup.transform.SetParent(GameObject.Find ("Map").transform); popup.transform.localScale = new Vector2 (1, 1); RectTransform popupTransform = popup.GetComponent<RectTransform> (); popupTransform.anchoredPosition = new Vector3 (0, 0, 0); popup.name = "board"; //Pop text string popTextPath = "Prefabs/Busyo/popText"; GameObject popText = Instantiate (Resources.Load (popTextPath)) as GameObject; popText.transform.SetParent(popup.transform); popText.transform.localScale = new Vector2 (0.35f, 0.35f); RectTransform popTextTransform = popText.GetComponent<RectTransform> (); popTextTransform.anchoredPosition = new Vector3 (0, 260, 0); popText.name = "popText"; popText.GetComponent<Text> ().text = "内政状況"; //Scroll View string scrollPath = "Prefabs/Map/seiryoku/KuniScrollView"; GameObject scroll = Instantiate (Resources.Load (scrollPath)) as GameObject; scroll.transform.SetParent(popup.transform); scroll.transform.localScale = new Vector2 (1, 1); scroll.name = "KuniScrollView"; RectTransform scrollTransform = scroll.GetComponent<RectTransform> (); scrollTransform.anchoredPosition = new Vector3 (0, -80, 0); //Header string headerPath = "Prefabs/Map/seiryoku/GetTargetBack"; GameObject header = Instantiate (Resources.Load (headerPath)) as GameObject; header.transform.SetParent(popup.transform); header.transform.localScale = new Vector2 (1, 1); header.name = "GetTargetBack"; RectTransform headerTransform = header.GetComponent<RectTransform> (); headerTransform.anchoredPosition = new Vector3 (0, 185, 0); //Button string btnPath = "Prefabs/Map/seiryoku/GetAllShigenBtn"; GameObject btn = Instantiate (Resources.Load (btnPath)) as GameObject; btn.transform.SetParent(popup.transform); btn.transform.localScale = new Vector2 (1, 1); btn.name = "GetAllShigenBtn"; RectTransform btnTransform = btn.GetComponent<RectTransform> (); btnTransform.anchoredPosition = new Vector3 (420, 185, 0); /*Slot Preparation*/ //Check Open Kuni string openKuniString = PlayerPrefs.GetString ("openKuni"); char[] delimiterChars = {','}; List<string> openKuniList = new List<string> (); if (openKuniString.Contains (",")) { openKuniList = new List<string> (openKuniString.Split (delimiterChars)); } else { openKuniList.Add(openKuniString); } for (int i=0; i<openKuniList.Count; i++) { int kuniId = int.Parse(openKuniList[i]); string temp = "kuni" + openKuniList[i]; string clearedKuni = PlayerPrefs.GetString (temp); //Shiro Qty if(clearedKuni != null && clearedKuni != ""){ List<string> shiroList = new List<string>(); shiroList = new List<string>(clearedKuni.Split (delimiterChars)); shiro = shiroList.Count; //Kuni Name Entity_kuni_mst kuniMst = Resources.Load ("Data/kuni_mst") as Entity_kuni_mst; kuniName = kuniMst.param[kuniId-1].kuniName; string naiseiTemp = "naisei" + openKuniList[i]; string naiseiString = PlayerPrefs.GetString (naiseiTemp); if (PlayerPrefs.HasKey (naiseiTemp)) { int syogyo = 0; int nogyo = 0; int gunjyuYRL = 0; int gunjyuYRM = 0; int gunjyuYRH = 0; int gunjyuKBL = 0; int gunjyuKBM = 0; int gunjyuKBH = 0; int gunjyuYML = 0; int gunjyuYMM = 0; int gunjyuYMH = 0; int gunjyuTPL = 0; int gunjyuTPM = 0; int gunjyuTPH = 0; List<string> naiseiList = new List<string>(); naiseiList = new List<string>(naiseiString.Split (delimiterChars)); char[] delimiterChars2 = {':'}; List<string> deletePanelList = new List<string>(); for(int j=1; j<naiseiList.Count;j++){ List<string> naiseiContentList = new List<string>(); naiseiContentList = new List<string>(naiseiList[j].Split (delimiterChars2)); if(naiseiContentList[0] != "0"){ //Exist Entity_naisei_mst naiseiMst = Resources.Load ("Data/naisei_mst") as Entity_naisei_mst; string type = naiseiMst.param [int.Parse(naiseiContentList[0])].code; //Effect by Level List<int> naiseiEffectList = new List<int>(); NaiseiController naisei = new NaiseiController(); naiseiEffectList = naisei.getNaiseiList(type, int.Parse(naiseiContentList[1])); //Status if(type == "shop" || type == "kouzan"){ syogyo = syogyo + naiseiEffectList[0]; totalMoney = totalMoney + naiseiEffectList[0]; }else if(type == "ta"){ nogyo = nogyo + naiseiEffectList[0]; totalHyourou = totalHyourou + naiseiEffectList[0]; }else if(type == "yr"){ if(int.Parse(naiseiContentList[1])<9){ //Low gunjyuYRL = gunjyuYRL + naiseiEffectList[0]; totalYRL = totalYRL + naiseiEffectList[0]; }else if(int.Parse(naiseiContentList[1]) < 15){ //Middle gunjyuYRM = gunjyuYRM + naiseiEffectList[0]; totalYRM = totalYRM + naiseiEffectList[0]; }else if(15 <= int.Parse(naiseiContentList[1])){ //High gunjyuYRH = gunjyuYRH + naiseiEffectList[0]; totalYRH = totalYRH + naiseiEffectList[0]; } }else if(type == "kb"){ if(int.Parse(naiseiContentList[1])<9){ //Low gunjyuKBL = gunjyuKBL + naiseiEffectList[0]; totalKBL = totalKBL + naiseiEffectList[0]; }else if(int.Parse(naiseiContentList[1]) < 15){ //Middle gunjyuKBM = gunjyuKBM + naiseiEffectList[0]; totalKBM = totalKBM + naiseiEffectList[0]; }else if(15 <= int.Parse(naiseiContentList[1])){ //High gunjyuKBH = gunjyuKBH + naiseiEffectList[0]; totalKBH = totalKBH + naiseiEffectList[0]; } }else if(type == "ym"){ if(int.Parse(naiseiContentList[1])<9){ //Low gunjyuYML = gunjyuYML + naiseiEffectList[0]; totalYML = totalYML + naiseiEffectList[0]; }else if(int.Parse(naiseiContentList[1]) < 15){ //Middle gunjyuYMM = gunjyuYMM + naiseiEffectList[0]; totalYMM = totalYMM + naiseiEffectList[0]; }else if(15 <= int.Parse(naiseiContentList[1])){ //High gunjyuYMH = gunjyuYMH + naiseiEffectList[0]; totalYMH = totalYMH + naiseiEffectList[0]; } }else if(type == "tp"){ if(int.Parse(naiseiContentList[1])<9){ //Low gunjyuTPL = gunjyuTPL + naiseiEffectList[0]; totalTPL = totalTPL + naiseiEffectList[0]; }else if(int.Parse(naiseiContentList[1]) < 15){ //Middle gunjyuTPM = gunjyuTPM + naiseiEffectList[0]; totalTPM = totalTPM + naiseiEffectList[0]; }else if(15 <= int.Parse(naiseiContentList[1])){ //High gunjyuTPH = gunjyuTPH + naiseiEffectList[0]; totalTPH = totalTPH + naiseiEffectList[0]; } } } } //Make Slot string slotPath = "Prefabs/Map/seiryoku/KuniSlot"; GameObject kuniSlot = Instantiate (Resources.Load (slotPath)) as GameObject; kuniSlot.transform.SetParent(GameObject.Find ("Content").transform); kuniSlot.transform.localScale = new Vector2 (1, 1); kuniSlot.name = "KuniSlot" + kuniId; //Jyosyu Addition string jyosyuTemp = "jyosyu" + kuniId; if (PlayerPrefs.HasKey (jyosyuTemp)) { int jyosyuId = PlayerPrefs.GetInt (jyosyuTemp); StatusGet sts = new StatusGet(); int lv = PlayerPrefs.GetInt (jyosyuId.ToString()); float naiseiSts = (float)sts.getDfc(jyosyuId,lv); float hpSts = (float)sts.getHp(jyosyuId,lv); float atkSts = (float)sts.getAtk(jyosyuId,lv); float tempSyogyo = (float)syogyo; tempSyogyo = tempSyogyo + (tempSyogyo * naiseiSts/200); float tempNogyo = (float)nogyo; tempNogyo = tempNogyo + (tempNogyo * naiseiSts/200); syogyo = (int)tempSyogyo; nogyo = (int)tempNogyo; } kuniSlot.transform.FindChild("KuniNameBack").transform.FindChild("KuniNameValue").GetComponent<Text>().text = kuniName; kuniSlot.transform.FindChild("Shiro").transform.FindChild("ShiroValue").GetComponent<Text>().text = shiro.ToString(); kuniSlot.transform.FindChild("Money").transform.FindChild("MoneyValue").GetComponent<Text>().text = syogyo.ToString(); kuniSlot.transform.FindChild("Hyourou").transform.FindChild("HyourouValue").GetComponent<Text>().text = nogyo.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("YR").transform.FindChild("CyouheiYRValueL").GetComponent<Text>().text = gunjyuYRL.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("YR").transform.FindChild("CyouheiYRValueM").GetComponent<Text>().text = gunjyuYRM.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("YR").transform.FindChild("CyouheiYRValueH").GetComponent<Text>().text = gunjyuYRH.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("KB").transform.FindChild("CyouheiKBValueL").GetComponent<Text>().text = gunjyuKBL.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("KB").transform.FindChild("CyouheiKBValueM").GetComponent<Text>().text = gunjyuKBM.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("KB").transform.FindChild("CyouheiKBValueH").GetComponent<Text>().text = gunjyuKBH.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("YM").transform.FindChild("CyouheiYMValueL").GetComponent<Text>().text = gunjyuYML.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("YM").transform.FindChild("CyouheiYMValueM").GetComponent<Text>().text = gunjyuYMM.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("YM").transform.FindChild("CyouheiYMValueH").GetComponent<Text>().text = gunjyuYMH.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("TP").transform.FindChild("CyouheiTPValueL").GetComponent<Text>().text = gunjyuTPL.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("TP").transform.FindChild("CyouheiTPValueM").GetComponent<Text>().text = gunjyuTPM.ToString(); kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("TP").transform.FindChild("CyouheiTPValueH").GetComponent<Text>().text = gunjyuTPH.ToString(); } } }//Kuni Loop Finish //Set Total Amount GameObject btnObj = GameObject.Find ("GetAllShigenBtn").gameObject; btnObj.GetComponent<GetAllShigen> ().totalMoney = totalMoney; btnObj.GetComponent<GetAllShigen> ().totalHyourou = totalHyourou; btnObj.GetComponent<GetAllShigen> ().totalYRL = totalYRL; btnObj.GetComponent<GetAllShigen> ().totalKBL = totalKBL; btnObj.GetComponent<GetAllShigen> ().totalYML = totalYML; btnObj.GetComponent<GetAllShigen> ().totalTPL = totalTPL; btnObj.GetComponent<GetAllShigen> ().totalYRM = totalYRM; btnObj.GetComponent<GetAllShigen> ().totalKBM = totalKBM; btnObj.GetComponent<GetAllShigen> ().totalYMM = totalYMM; btnObj.GetComponent<GetAllShigen> ().totalTPM = totalTPM; btnObj.GetComponent<GetAllShigen> ().totalYRH = totalYRH; btnObj.GetComponent<GetAllShigen> ().totalKBH = totalKBH; btnObj.GetComponent<GetAllShigen> ().totalYMH = totalYMH; btnObj.GetComponent<GetAllShigen> ().totalTPH = totalTPH; }
public void OnClick() { //SE sound = GameObject.Find("SEController").GetComponent <AudioSource> (); sound.PlayOneShot(sound.clip); if (!bakuhuFlg) { /*Common Process*/ if (Application.loadedLevelName != "tutorialMain") { string pathOfBack = "Prefabs/Common/TouchBack"; GameObject back = Instantiate(Resources.Load(pathOfBack)) as GameObject; back.transform.SetParent(GameObject.Find("Panel").transform); back.transform.localScale = new Vector2(1, 1); back.transform.localPosition = new Vector2(0, 0); } if (Application.loadedLevelName != "clearOrGameOver") { string pathOfBoard = "Prefabs/Map/smallBoard"; GameObject board = Instantiate(Resources.Load(pathOfBoard)) as GameObject; board.transform.SetParent(GameObject.Find("Panel").transform); board.transform.localScale = new Vector2(1, 1); if (Application.loadedLevelName == "tutorialMain") { board.transform.FindChild("close").gameObject.SetActive(false); } /*Value Setting*/ //Kuni Name GameObject.Find("kuniName").GetComponent <Text> ().text = kuniName; //Daimyo Name GameObject.Find("DaimyoNameValue").GetComponent <Text> ().text = daimyoName; //Kamon string kamonPath = "Prefabs/Kamon/" + daimyoId.ToString(); GameObject kamon = GameObject.Find("KamonBack"); kamon.GetComponent <Image> ().sprite = Resources.Load(kamonPath, typeof(Sprite)) as Sprite; //Daimyo Busyo View string busyoViewPath = "Prefabs/Map/daimyoView"; GameObject daimyoView = Instantiate(Resources.Load(busyoViewPath)) as GameObject; daimyoView.transform.SetParent(kamon.transform); daimyoView.transform.localScale = new Vector2(1, 1); RectTransform busyoTransform = daimyoView.GetComponent <RectTransform> (); busyoTransform.anchoredPosition = new Vector3(90, 125, 0); busyoTransform.sizeDelta = new Vector2(180, 230); string daimyoPath = "Prefabs/Player/Sprite/unit" + daimyoBusyoId.ToString(); daimyoView.GetComponent <Image> ().sprite = Resources.Load(daimyoPath, typeof(Sprite)) as Sprite; /* * string busyoPath = "Prefabs/Player/Unit/" + daimyoBusyoId; * GameObject busyo = Instantiate (Resources.Load (busyoPath)) as GameObject; * busyo.transform.SetParent (kamon.transform); * busyo.transform.localScale = new Vector2 (1, 1); * busyo.GetComponent<DragHandler> ().enabled = false; * * RectTransform busyoTransform = busyo.GetComponent<RectTransform> (); * busyoTransform.anchoredPosition = new Vector3 (90, 100, 0); * busyoTransform.sizeDelta = new Vector2 (180, 200); * * foreach (Transform n in busyo.transform) { * GameObject.Destroy (n.gameObject); * } */ //Doumei if (doumeiFlg) { string doumeiPath = "Prefabs/Common/Doumei"; GameObject doumei = Instantiate(Resources.Load(doumeiPath)) as GameObject; doumei.transform.SetParent(kamon.transform); doumei.transform.localScale = new Vector2(1, 1); RectTransform doumeiTransform = doumei.GetComponent <RectTransform> (); doumeiTransform.anchoredPosition = new Vector3(-50, 80, 0); doumei.name = "Doumei"; } //Naisei Shigen Icon List <string> naiseiIconList = new List <string> (); char[] delimiterChars = { ':' }; if (naiseiItem != "null" && naiseiItem != "") { if (naiseiItem.Contains(":")) { naiseiIconList = new List <string> (naiseiItem.Split(delimiterChars)); } else { naiseiIconList.Add(naiseiItem); } //Base string nasieiBasePath = "Prefabs/Map/Common/NaiseiList"; GameObject naiseiBase = Instantiate(Resources.Load(nasieiBasePath)) as GameObject; naiseiBase.transform.SetParent(board.transform); naiseiBase.transform.localScale = new Vector2(1, 1); RectTransform naiseiBaseTransform = naiseiBase.GetComponent <RectTransform> (); naiseiBaseTransform.anchoredPosition = new Vector3(405, -80, 0); //Icon string nasieiIconPath = "Prefabs/Map/Common/NaiseiItem"; for (int i = 0; i < naiseiIconList.Count; i++) { GameObject naiseiIcon = Instantiate(Resources.Load(nasieiIconPath)) as GameObject; naiseiIcon.transform.SetParent(naiseiBase.transform); naiseiIcon.transform.localScale = new Vector2(1, 1); string naiseiName = naiseiIconList [i]; if (Application.systemLanguage != SystemLanguage.Japanese) { if (naiseiName == "kb") { naiseiIcon.transform.FindChild("Text").GetComponent <Text> ().text = "H"; naiseiIcon.GetComponent <IconExp>().IconId = 5; } else if (naiseiName == "tp") { naiseiIcon.transform.FindChild("Text").GetComponent <Text> ().text = "G"; naiseiIcon.GetComponent <IconExp>().IconId = 6; } else if (naiseiName == "kzn") { naiseiIcon.transform.FindChild("Text").GetComponent <Text> ().text = "M"; naiseiIcon.GetComponent <IconExp>().IconId = 7; } else if (naiseiName == "snb") { naiseiIcon.transform.FindChild("Text").GetComponent <Text> ().text = "N"; naiseiIcon.GetComponent <IconExp>().IconId = 8; } else if (naiseiName == "nbn") { naiseiIcon.transform.FindChild("Text").GetComponent <Text> ().text = "W"; naiseiIcon.GetComponent <IconExp>().IconId = 9; } else if (naiseiName == "mkd") { naiseiIcon.transform.FindChild("Text").GetComponent <Text> ().text = "E"; naiseiIcon.GetComponent <IconExp>().IconId = 10; } else if (naiseiName == "syn") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "T"; naiseiIcon.GetComponent <IconExp>().IconId = 11; } } else { if (naiseiName == "kb") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "馬"; naiseiIcon.GetComponent <IconExp>().IconId = 5; } else if (naiseiName == "tp") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "砲"; naiseiIcon.GetComponent <IconExp>().IconId = 6; } else if (naiseiName == "kzn") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "鉱"; naiseiIcon.GetComponent <IconExp>().IconId = 7; } else if (naiseiName == "snb") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "忍"; naiseiIcon.GetComponent <IconExp>().IconId = 8; } else if (naiseiName == "nbn") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "南"; naiseiIcon.GetComponent <IconExp>().IconId = 9; } else if (naiseiName == "mkd") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "帝"; naiseiIcon.GetComponent <IconExp>().IconId = 10; } else if (naiseiName == "syn") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "商"; naiseiIcon.GetComponent <IconExp>().IconId = 11; } } } } //Heiryoku Calc GameObject yukouValue = GameObject.Find("YukouValue"); GameObject atkBtn = GameObject.Find("AttackButton"); GameObject gaikouBtn = GameObject.Find("GaikouButton"); GameObject bouryakuhouBtn = GameObject.Find("BouryakuButton"); Color NGClorBtn = new Color(133 / 255f, 133 / 255f, 80 / 255f, 255f / 255f); Color NGClorTxt = new Color(90 / 255f, 90 / 255f, 40 / 255f, 255f / 255f); if (clearFlg == false) { if (Application.systemLanguage != SystemLanguage.Japanese) { atkBtn.transform.FindChild("Text").GetComponent <Text>().text = "Attack"; } else { atkBtn.transform.FindChild("Text").GetComponent <Text>().text = "侵略"; } if (cyouhouSnbRankId != 0) { GameObject.Find("HeiryokuValue").GetComponent <Text> ().text = heiryoku.ToString(); //Shinobi Icon string shinobiItemPath = "Prefabs/Item/Shinobi/Shinobi"; GameObject shinobi = Instantiate(Resources.Load(shinobiItemPath)) as GameObject; shinobi.transform.SetParent(board.transform); shinobi.transform.localScale = new Vector2(0.25f, 0.31f); shinobi.name = "shinobi"; RectTransform snbTransform = shinobi.GetComponent <RectTransform> (); snbTransform.anchoredPosition = new Vector3(-251, 250, 0); shinobi.GetComponent <Button> ().enabled = false; if (cyouhouSnbRankId == 1) { Color lowColor = new Color(0f / 255f, 0f / 255f, 219f / 255f, 255f / 255f); shinobi.GetComponent <Image> ().color = lowColor; if (Application.systemLanguage != SystemLanguage.Japanese) { shinobi.transform.FindChild("ShinobiRank").GetComponent <Text>().text = "Low"; } else { shinobi.transform.FindChild("ShinobiRank").GetComponent <Text> ().text = "下"; } } else if (cyouhouSnbRankId == 2) { Color midColor = new Color(94f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); shinobi.GetComponent <Image> ().color = midColor; if (Application.systemLanguage != SystemLanguage.Japanese) { shinobi.transform.FindChild("ShinobiRank").GetComponent <Text> ().text = "Mid"; } else { shinobi.transform.FindChild("ShinobiRank").GetComponent <Text>().text = "中"; } } else if (cyouhouSnbRankId == 3) { Color highColor = new Color(84f / 255f, 103f / 255f, 0f / 255f, 255f / 255f); shinobi.GetComponent <Image> ().color = highColor; if (Application.systemLanguage != SystemLanguage.Japanese) { shinobi.transform.FindChild("ShinobiRank").GetComponent <Text> ().text = "High"; } else { shinobi.transform.FindChild("ShinobiRank").GetComponent <Text>().text = "上"; } } } else { GameObject.Find("HeiryokuValue").GetComponent <Text> ().text = "?"; } //Yukoudo yukouValue.GetComponent <Text> ().text = myYukouValue.ToString(); //Cyouhou atkBtn.GetComponent <AttackNaiseiView> ().cyouhouSnbRankId = cyouhouSnbRankId; } else { //Cleard GameObject.Find("HeiryokuValue").GetComponent <Text> ().text = heiryoku.ToString(); //Yukoudo yukouValue.GetComponent <Text> ().text = "-"; //Enable Gaiko & Cyouhou gaikouBtn.GetComponent <Image> ().color = NGClorBtn; gaikouBtn.GetComponent <Button> ().enabled = false; gaikouBtn.transform.FindChild("Text").GetComponent <Text> ().color = NGClorTxt; bouryakuhouBtn.GetComponent <Image> ().color = NGClorBtn; bouryakuhouBtn.GetComponent <Button> ().enabled = false; bouryakuhouBtn.transform.FindChild("Text").GetComponent <Text> ().color = NGClorTxt; if (Application.systemLanguage != SystemLanguage.Japanese) { atkBtn.transform.FindChild("Text").GetComponent <Text> ().text = "Develop"; } else { atkBtn.transform.FindChild("Text").GetComponent <Text>().text = "内政"; } if (Application.loadedLevelName == "tutorialMain") { TutorialController tutorialScript = new TutorialController(); Vector2 vect = new Vector2(0, 50); GameObject animObj = tutorialScript.SetPointer(atkBtn, vect); animObj.transform.localScale = new Vector2(150, 150); } } //Enable Attack if (openFlg == false && clearFlg == false) { atkBtn.GetComponent <Image> ().color = NGClorBtn; //test atkBtn.GetComponent <Button> ().enabled = false; atkBtn.transform.FindChild("Text").GetComponent <Text> ().color = NGClorTxt; } //Enable Gaikou if (soubujireiFlg) { gaikouBtn.GetComponent <Image> ().color = NGClorBtn; gaikouBtn.GetComponent <Button> ().enabled = false; gaikouBtn.transform.FindChild("Text").GetComponent <Text> ().color = NGClorTxt; } //Doumei Flg if (doumeiFlg) { atkBtn.GetComponent <AttackNaiseiView> ().doumeiFlg = doumeiFlg; gaikouBtn.GetComponent <GaikouView> ().doumeiFlg = doumeiFlg; atkBtn.GetComponent <Image> ().color = NGClorBtn; atkBtn.GetComponent <Button> ().enabled = false; atkBtn.transform.FindChild("Text").GetComponent <Text> ().color = NGClorTxt; } //Set Hidden Value if (Application.loadedLevelName != "tutorialMain") { GameObject close = GameObject.Find("close").gameObject; close.GetComponent <CloseBoard> ().title = kuniName; close.GetComponent <CloseBoard> ().daimyoId = daimyoId; close.GetComponent <CloseBoard> ().daimyoBusyoId = daimyoBusyoId; close.GetComponent <CloseBoard> ().daimyoBusyoName = daimyoName; close.GetComponent <CloseBoard> ().doumeiFlg = doumeiFlg; close.GetComponent <CloseBoard> ().kuniQty = kuniQty; close.GetComponent <CloseBoard> ().kuniId = kuniId; close.GetComponent <CloseBoard> ().daimyoBusyoAtk = daimyoBusyoAtk; close.GetComponent <CloseBoard> ().daimyoBusyoDfc = daimyoBusyoDfc; close.GetComponent <CloseBoard> ().yukoudo = myYukouValue; close.GetComponent <CloseBoard> ().naiseiItem = naiseiItem; bool cyouhouFlg = false; if (cyouhouSnbRankId != 0) { cyouhouFlg = true; } close.GetComponent <CloseBoard> ().cyouhouFlg = cyouhouFlg; close.GetComponent <CloseBoard> ().cyouhouSnbRankId = cyouhouSnbRankId; } //Set Button Value AttackNaiseiView attkNaiseView = GameObject.Find("AttackButton").GetComponent <AttackNaiseiView> (); attkNaiseView.kuniId = kuniId; attkNaiseView.kuniName = kuniName; attkNaiseView.myDaimyoId = GameObject.Find("GameController").GetComponent <MainStageController> ().myDaimyo; attkNaiseView.daimyoId = daimyoId; attkNaiseView.daimyoName = daimyoName; attkNaiseView.openFlg = openFlg; attkNaiseView.clearFlg = clearFlg; attkNaiseView.activeBusyoQty = busyoQty; attkNaiseView.activeBusyoLv = busyoLv; attkNaiseView.activeButaiQty = butaiQty; attkNaiseView.activeButaiLv = butaiLv; //Cyoutei Button if (kuniId == 16) { //Yamashiro string pathOfButton = "Prefabs/Cyoutei/CyouteiIcon"; GameObject btn = Instantiate(Resources.Load(pathOfButton)) as GameObject; btn.transform.SetParent(board.transform); btn.transform.localScale = new Vector2(1, 1); btn.transform.localPosition = new Vector2(225, -220); btn.name = "CyouteiIcon"; btn.GetComponent <CyouteiPop> ().yukoudo = myYukouValue; btn.GetComponent <CyouteiPop> ().myDaimyoFlg = clearFlg; btn.GetComponent <CyouteiPop> ().occupiedDaimyoId = daimyoId; btn.GetComponent <CyouteiPop> ().occupiedDaimyoName = daimyoName; } //Syounin Button if (kuniId == 38 || kuniId == 39 || kuniId == 58) { //Hakata or Sakai string pathOfButton = "Prefabs/Syounin/SyouninIcon"; GameObject btn = Instantiate(Resources.Load(pathOfButton)) as GameObject; btn.transform.SetParent(board.transform); btn.transform.localScale = new Vector2(1, 1); btn.transform.localPosition = new Vector2(225, -220); btn.name = "SyouninIcon"; btn.GetComponent <SyouninPop> ().yukoudo = myYukouValue; btn.GetComponent <SyouninPop> ().myDaimyoFlg = clearFlg; btn.GetComponent <SyouninPop> ().occupiedDaimyoName = daimyoName; if (kuniId == 38 || kuniId == 39) { if (Application.systemLanguage != SystemLanguage.Japanese) { btn.transform.FindChild("Text").GetComponent <Text>().text = "Sakai"; btn.transform.FindChild("Text").GetComponent <Text>().font = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font; btn.transform.FindChild("Text").GetComponent <Text>().fontSize = 200; } else { btn.transform.FindChild("Text").GetComponent <Text>().text = "堺"; } btn.GetComponent <SyouninPop> ().sakaiFlg = true; } else if (kuniId == 58) { if (Application.systemLanguage != SystemLanguage.Japanese) { btn.transform.FindChild("Text").GetComponent <Text>().text = "Hakata"; btn.transform.FindChild("Text").GetComponent <Text>().font = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font; btn.transform.FindChild("Text").GetComponent <Text>().fontSize = 200; } else { btn.transform.FindChild("Text").GetComponent <Text>().text = "博多"; } } } } else { //Select Initial Daimyo Screen string pathOfBoard = "Prefabs/clearOrGameOver/DaimyoSelectBoard"; GameObject board = Instantiate(Resources.Load(pathOfBoard)) as GameObject; board.transform.SetParent(GameObject.Find("Panel").transform); board.transform.localScale = new Vector2(1, 1); GameObject selectBtn = board.transform.FindChild("SelectButton").gameObject; //Kuni Name GameObject.Find("kuniName").GetComponent <Text> ().text = kuniName; //Daimyo Name GameObject.Find("DaimyoNameValue").GetComponent <Text> ().text = daimyoName; //Kamon string kamonPath = "Prefabs/Kamon/" + daimyoId.ToString(); GameObject kamon = GameObject.Find("KamonBack"); kamon.GetComponent <Image> ().sprite = Resources.Load(kamonPath, typeof(Sprite)) as Sprite; //Daimyo Busyo View string busyoPath = "Prefabs/Player/Unit/BusyoUnit"; GameObject busyo = Instantiate(Resources.Load(busyoPath)) as GameObject; busyo.name = daimyoBusyoId.ToString(); busyo.transform.SetParent(kamon.transform); busyo.transform.localScale = new Vector2(1, 1); busyo.GetComponent <DragHandler> ().enabled = false; RectTransform busyoTransform = busyo.GetComponent <RectTransform> (); busyoTransform.anchoredPosition = new Vector3(90, 100, 0); busyoTransform.sizeDelta = new Vector2(180, 200); foreach (Transform n in busyo.transform) { GameObject.Destroy(n.gameObject); } //Kuni Qty GameObject.Find("KuniQtyValue").GetComponent <Text> ().text = kuniQty.ToString(); //Once Cleared Flg if (gameClearFlg) { if (Application.systemLanguage != SystemLanguage.Japanese) { GameObject.Find("KouryakuFlg").transform.FindChild("Label").GetComponent <Text>().text = " Cleared"; } else { GameObject.Find("KouryakuFlg").transform.FindChild("Label").GetComponent <Text>().text = "攻略済"; } } else { if (Application.systemLanguage != SystemLanguage.Japanese) { GameObject.Find("KouryakuFlg").transform.FindChild("Label").GetComponent <Text>().text = " Never Cleared"; } else { GameObject.Find("KouryakuFlg").transform.FindChild("Label").GetComponent <Text>().text = "未攻略"; } } //Status //Daimyo Have Flg char[] delimiterChars = { ':' }; int lv = 0; StatusGet sts = new StatusGet(); //Default Status lv = 1; GameObject.Find("ButaiQtyValue").GetComponent <Text> ().text = "1"; GameObject.Find("ButaiLvValue").GetComponent <Text> ().text = "1"; //Hp int hp = sts.getHp(daimyoBusyoId, lv); hp = hp * 100; GameObject.Find("HPValue").GetComponent <Text> ().text = hp.ToString(); //Atk int atk = sts.getAtk(daimyoBusyoId, lv); atk = atk * 10; GameObject.Find("AtkValue").GetComponent <Text> ().text = atk.ToString(); //Dfc int dfc = sts.getDfc(daimyoBusyoId, lv); dfc = dfc * 10; GameObject.Find("DfcValue").GetComponent <Text> ().text = dfc.ToString(); //Spd int spd = sts.getSpd(daimyoBusyoId, lv); GameObject.Find("SpdValue").GetComponent <Text> ().text = spd.ToString(); //Heisyu string heisyu = sts.getHeisyu(daimyoBusyoId); string heisyuKanji = ""; if (Application.systemLanguage != SystemLanguage.Japanese) { if (heisyu == "YR") { heisyuKanji = "Spear"; } else if (heisyu == "KB") { heisyuKanji = "Cavalry"; } else if (heisyu == "YM") { heisyuKanji = "Bow"; } else if (heisyu == "TP") { heisyuKanji = "Gun"; } } else { if (heisyu == "YR") { heisyuKanji = "槍"; } else if (heisyu == "KB") { heisyuKanji = "騎馬"; } else if (heisyu == "YM") { heisyuKanji = "弓"; } else if (heisyu == "TP") { heisyuKanji = "鉄砲"; } } GameObject.Find("HeisyuValue").GetComponent <Text> ().text = heisyuKanji.ToString(); //Naisei Shigen Icon List <string> naiseiIconList = new List <string> (); if (naiseiItem != "null" && naiseiItem != "") { if (naiseiItem.Contains(":")) { naiseiIconList = new List <string> (naiseiItem.Split(delimiterChars)); } else { naiseiIconList.Add(naiseiItem); } //Base string nasieiBasePath = "Prefabs/Map/Common/NaiseiList"; GameObject naiseiBase = Instantiate(Resources.Load(nasieiBasePath)) as GameObject; naiseiBase.transform.SetParent(board.transform); naiseiBase.transform.localScale = new Vector2(1, 1); RectTransform naiseiBaseTransform = naiseiBase.GetComponent <RectTransform> (); naiseiBaseTransform.anchoredPosition = new Vector3(405, -80, 0); //Icon string nasieiIconPath = "Prefabs/Map/Common/NaiseiItem"; for (int i = 0; i < naiseiIconList.Count; i++) { GameObject naiseiIcon = Instantiate(Resources.Load(nasieiIconPath)) as GameObject; naiseiIcon.transform.SetParent(naiseiBase.transform); naiseiIcon.transform.localScale = new Vector2(1, 1); string naiseiName = naiseiIconList [i]; if (Application.systemLanguage != SystemLanguage.Japanese) { if (naiseiName == "kb") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "H"; naiseiIcon.GetComponent <IconExp>().IconId = 5; } else if (naiseiName == "tp") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "G"; naiseiIcon.GetComponent <IconExp>().IconId = 6; } else if (naiseiName == "kzn") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "M"; naiseiIcon.GetComponent <IconExp>().IconId = 7; } else if (naiseiName == "snb") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "N"; naiseiIcon.GetComponent <IconExp>().IconId = 8; } else if (naiseiName == "nbn") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "W"; naiseiIcon.GetComponent <IconExp>().IconId = 9; } else if (naiseiName == "mkd") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "E"; naiseiIcon.GetComponent <IconExp>().IconId = 10; } else if (naiseiName == "syn") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "T"; naiseiIcon.GetComponent <IconExp>().IconId = 11; } } else { if (naiseiName == "kb") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "馬"; naiseiIcon.GetComponent <IconExp>().IconId = 5; } else if (naiseiName == "tp") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "砲"; naiseiIcon.GetComponent <IconExp>().IconId = 6; } else if (naiseiName == "kzn") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "鉱"; naiseiIcon.GetComponent <IconExp>().IconId = 7; } else if (naiseiName == "snb") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "忍"; naiseiIcon.GetComponent <IconExp>().IconId = 8; } else if (naiseiName == "nbn") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "南"; naiseiIcon.GetComponent <IconExp>().IconId = 9; } else if (naiseiName == "mkd") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "帝"; naiseiIcon.GetComponent <IconExp>().IconId = 10; } else if (naiseiName == "syn") { naiseiIcon.transform.FindChild("Text").GetComponent <Text>().text = "商"; naiseiIcon.GetComponent <IconExp>().IconId = 11; } } } } selectBtn.GetComponent <SelectDaimyo> ().daimyoId = daimyoId; selectBtn.GetComponent <SelectDaimyo> ().daimyoName = daimyoName; selectBtn.GetComponent <SelectDaimyo> ().daimyoBusyoId = daimyoBusyoId; selectBtn.GetComponent <SelectDaimyo> ().busyoHaveFlg = busyoHaveFlg; selectBtn.GetComponent <SelectDaimyo> ().heisyu = heisyu; } } else { //Bakuhu Menu GameObject BakuhuBase = GameObject.Find("BakuhuBase").gameObject; if (BakuhuBase.transform.FindChild("ToubatsuText") != null) { Destroy(BakuhuBase.transform.FindChild("ToubatsuText").gameObject); } if (BakuhuBase.transform.FindChild("ToubatsuSelect") == null) { string toubatsuPath = "Prefabs/Bakuhu/ToubatsuSelect"; toubatsu = Instantiate(Resources.Load(toubatsuPath)) as GameObject; toubatsu.transform.SetParent(BakuhuBase.transform); toubatsu.transform.localScale = new Vector2(1, 1); toubatsu.name = "ToubatsuSelect"; } else { toubatsu = BakuhuBase.transform.FindChild("ToubatsuSelect").gameObject; } string kamonImagePath = "Prefabs/Kamon/" + daimyoId.ToString(); toubatsu.transform.FindChild("ToubatsuTarget").transform.FindChild("Kamon").GetComponent <Image> ().sprite = Resources.Load(kamonImagePath, typeof(Sprite)) as Sprite; string imagePath = "Prefabs/Player/Sprite/unit" + daimyoBusyoId.ToString(); toubatsu.transform.FindChild("ToubatsuTarget").transform.FindChild("Daimyo").GetComponent <Image> ().sprite = Resources.Load(imagePath, typeof(Sprite)) as Sprite; if (Application.systemLanguage != SystemLanguage.Japanese) { toubatsu.transform.FindChild("Exp").GetComponent <Text> ().text = "Would you declare " + daimyoName + " attack order to surrounding parties?"; } else { toubatsu.transform.FindChild("Exp").GetComponent <Text>().text = daimyoName + "の討伐令を周辺大名に出しますか?"; } //Blinker GameObject BakuhuKuniIconView = BakuhuBase.transform.FindChild("BakuhuKuniIconView").gameObject; foreach (Transform obj in BakuhuKuniIconView.transform) { SendParam script = obj.GetComponent <SendParam> (); if (script.daimyoId != daimyoId) { if (obj.GetComponent <ImageBlinker> ()) { Destroy(obj.GetComponent <ImageBlinker> ()); obj.GetComponent <Image>().color = new Color(255, 255, 255); } } else { if (!obj.GetComponent <ImageBlinker> ()) { obj.gameObject.AddComponent <ImageBlinker>(); } } } //Set Param to Button toubatsu.transform.FindChild("ToubatsuBtn").GetComponent <DoTobatsu>().targetDaimyoId = daimyoId; toubatsu.transform.FindChild("ToubatsuBtn").GetComponent <DoTobatsu>().targetDaimyoName = daimyoName; toubatsu.transform.FindChild("ToubatsuBtn").GetComponent <DoTobatsu> ().kuniQty = kuniQty; } }
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)){ sameTargetKuniList.Add(n); } } } /*Slot making*/ string temp = "gaikou" + targetDaimyo; int myYukoudo = PlayerPrefs.GetInt(temp); //Get Chiryaku Entity_daimyo_mst daimyoMst = Resources.Load ("Data/daimyo_mst") as Entity_daimyo_mst; int myDaimyoBusyoId = daimyoMst.param [myDaimyo - 1].busyoId; 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]); string daimyoName = daimyoMst.param [daimyoId - 1].daimyoName; 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 = (int)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; } }
public void GetPlayerSenryoku(string busyoId) { int i = 0; bool result = int.TryParse(busyoId, out i); if (result) { //Parent int myDaimyoBusyo = PlayerPrefs.GetInt("myDaimyoBusyo"); if (int.Parse(busyoId) == myDaimyoBusyo) { myDaimyoBusyoFlg = true; } BusyoInfoGet busyo = new BusyoInfoGet(); belongDaimyoId = busyo.getDaimyoId(int.Parse(busyoId)); if (belongDaimyoId == 0) { belongDaimyoId = busyo.getDaimyoHst(int.Parse(busyoId)); } shipId = busyo.getShipId(int.Parse(busyoId)); lv = PlayerPrefs.GetInt(busyoId, 1); 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; JyosyuHeiryoku jyosyuHei = new JyosyuHeiryoku(); int addJyosyuHei = jyosyuHei.GetJyosyuHeiryoku(busyoId.ToString()); KahouStatusGet kahouSts = new KahouStatusGet(); string[] KahouStatusArray = kahouSts.getKahouForStatus(busyoId, adjHp, adjAtk, adjDfc, spd); int totalBusyoHp = 0; int totalBusyoAtk = 0; int totalBusyoDfc = 0; 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(); //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; } } } totalBusyoAtk = adjAtk + int.Parse(KahouStatusArray[0]) + Mathf.FloorToInt(addAtkByKanni); totalBusyoHp = adjHp + int.Parse(KahouStatusArray[1]) + Mathf.FloorToInt(addHpByKanni) + addJyosyuHei; totalBusyoDfc = adjDfc + int.Parse(KahouStatusArray[2]) + Mathf.FloorToInt(addDfcByKanni); totalSpd = spd + int.Parse(KahouStatusArray[3]); if (Application.loadedLevelName == "preKaisen") { if (shipId == 1) { totalBusyoHp = totalBusyoHp * 2; } else if (shipId == 2) { totalBusyoHp = Mathf.FloorToInt((float)totalBusyoHp * 1.5f); } } //Child 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(); } char[] delimiterChars = { ':' }; if (chParam.Contains(":")) { string[] ch_list = chParam.Split(delimiterChars); chQty = int.Parse(ch_list [1]); chlv = int.Parse(ch_list [2]); int ch_status = int.Parse(ch_list [3]); int totalChldHp = 0; int totalChldAtk = 0; int totalChldDfc = 0; ch_status = ch_status * 10; int atkDfc = (int)sts.getChAtkDfc(ch_status, totalBusyoHp); totalChldHp = ch_status * chQty; totalChldAtk = atkDfc * chQty; totalChldDfc = atkDfc * chQty; //Set value totalHp = totalBusyoHp + totalChldHp; totalAtk = totalBusyoAtk + totalChldAtk; totalDfc = totalBusyoDfc + totalChldDfc; } } }
public void ScrollView(GameObject obj, GameObject btnObj){ string scrollPath = "Prefabs/Map/common/ScrollView"; GameObject scroll = Instantiate (Resources.Load (scrollPath)) as GameObject; scroll.transform.SetParent(obj.transform); scroll.transform.localScale = new Vector3 (1, 1, 1); RectTransform scroll_transform = scroll.GetComponent<RectTransform>(); scroll_transform.anchoredPosition = new Vector3(0,130,0); scroll.name = "scroll"; List<string> myBusyoList = new List<string>(); string myBusyoString = PlayerPrefs.GetString ("myBusyo"); char[] delimiterChars = {','}; myBusyoList = new List<string>(myBusyoString.Split (delimiterChars)); string slotPath = "Prefabs/Map/common/Slot"; string chiryakuPath = "Prefabs/Map/common/Chiryaku"; GameObject contents = scroll.transform.FindChild("Content").gameObject; for (int i=0; i<myBusyoList.Count; i++) { string myBusyoId = myBusyoList[i]; //Slot GameObject prefab = Instantiate (Resources.Load (slotPath)) as GameObject; prefab.transform.SetParent(contents.transform); prefab.transform.localScale = new Vector3 (1, 1, 1); prefab.GetComponent<GaikouBusyoSelect>().DoBtn = btnObj; prefab.GetComponent<GaikouBusyoSelect>().Content = contents; prefab.GetComponent<GaikouBusyoSelect>().kuniDiff = kuniDiff; prefab.GetComponent<GaikouBusyoSelect>().daimyoBusyoAtk = daimyoBusyoAtk; prefab.GetComponent<GaikouBusyoSelect>().daimyoBusyoDfc = daimyoBusyoDfc; //Busyo string busyoPath = "Prefabs/Player/Unit/" + myBusyoId; GameObject busyo = Instantiate (Resources.Load (busyoPath)) as GameObject; busyo.transform.SetParent(prefab.transform); busyo.transform.localScale = new Vector3 (4, 5, 4); busyo.name = myBusyoList [i].ToString (); RectTransform text_transform = busyo.transform.FindChild("Text").GetComponent<RectTransform>(); text_transform.anchoredPosition = new Vector3(-32,12,0); prefab.name = "Slot" + busyo.name; //Get Chiryaku StatusGet sts = new StatusGet(); int lv = PlayerPrefs.GetInt (myBusyoId); float chiryakuSts = (float)sts.getDfc(int.Parse(myBusyoId),lv); chiryakuSts = chiryakuSts *10; GameObject chiryaku = Instantiate (Resources.Load (chiryakuPath)) as GameObject; chiryaku.transform.SetParent(busyo.transform); chiryaku.transform.FindChild("value").GetComponent<Text>().text = chiryakuSts.ToString(); chiryaku.transform.localScale = new Vector3 (1, 1, 1); busyo.GetComponent<DragHandler> ().enabled = false; //Deffault Busyo Click if(i == 0){ prefab.GetComponent<GaikouBusyoSelect>().OnClick(); } } }