public int heiryokuCalc(int kuni) { GameObject targetKuni = GameObject.Find("KuniIconView"); int enemyTotalHei = 0; if (targetKuni.transform.FindChild(kuni.ToString())) { SendParam sendParam = targetKuni.transform.FindChild(kuni.ToString()).GetComponent <SendParam> (); int daimyoBusyoId = sendParam.daimyoBusyoId; int busyoLv = sendParam.busyoLv; int busyoQty = sendParam.busyoQty; int butaiLv = sendParam.butaiLv; int butaiQty = sendParam.butaiQty; if (daimyoBusyoId != 0) { StatusGet sts = new StatusGet(); int hp = sts.getHp(daimyoBusyoId, busyoLv); int hpResult = hp * 100 * busyoQty; string type = sts.getHeisyu(daimyoBusyoId); int chHp = sts.getChHp(type, butaiLv, hp); chHp = chHp * butaiQty * busyoQty * 10; enemyTotalHei = hpResult + chHp; } } return(enemyTotalHei); }
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 int getHei(int busyoId, int activeBusyoLv, int activeButaiQty, int activeButaiLv) { int hei = 0; StatusGet sts = new StatusGet(); BusyoInfoGet info = new BusyoInfoGet(); string TaisyoType = info.getHeisyu(busyoId); int hp = sts.getHp(busyoId, activeBusyoLv); hp = hp * 100; EnemyInstance enemyIns = new EnemyInstance(); int chldHp = activeButaiQty * enemyIns.getChildStatus(activeButaiLv, TaisyoType, 0); hei = hp + chldHp; return(hei); }
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 int heiryokuCalc(int kuni){ GameObject targetKuni = GameObject.Find ("KuniIconView"); SendParam sendParam = targetKuni.transform.FindChild (kuni.ToString ()).GetComponent<SendParam> (); int daimyoBusyoId = sendParam.daimyoBusyoId; int busyoLv = sendParam.busyoLv; int busyoQty = sendParam.busyoQty; int butaiLv = sendParam.butaiLv; int butaiQty = sendParam.butaiQty; int enemyTotalHei = 0; if (daimyoBusyoId != 0) { StatusGet sts = new StatusGet (); int hp = sts.getHp (daimyoBusyoId, busyoLv); int hpResult = hp * 100 * busyoQty; string type = sts.getHeisyu (daimyoBusyoId); int chHp = sts.getChHp (type, butaiLv, hp); chHp = chHp * butaiQty * busyoQty * 10; enemyTotalHei = hpResult + chHp; } return enemyTotalHei; }
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 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(){ //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 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 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; } }
// Use this for initialization public void Start () { Resources.UnloadUnusedAssets (); //Data Initialization //DataMaker data = new DataMaker (); //data.Start (); /*Initial Data*/ bool initDataFlg = PlayerPrefs.GetBool ("initDataFlg"); if (initDataFlg == false) { //my daimyo InitDataMaker initData = new InitDataMaker (); initData.makeInitData (); } /*--------------------*/ /*Game Over*/ /*--------------------*/ bool gameOverFlg = PlayerPrefs.GetBool("gameOverFlg"); if (gameOverFlg) { Application.LoadLevel ("clearOrGameOver"); } else { /*--------------------*/ /*Game Clear*/ /*--------------------*/ bool gameClearFlg = PlayerPrefs.GetBool ("gameClearFlg"); if (gameClearFlg) { Application.LoadLevel ("clearOrGameOver"); } else { Entity_kuni_mst kuniMst = Resources.Load ("Data/kuni_mst") as Entity_kuni_mst; Entity_kuni_mapping_mst kuniMappingMst = Resources.Load ("Data/kuni_mapping_mst") as Entity_kuni_mapping_mst; Entity_daimyo_mst daimyoMst = Resources.Load ("Data/daimyo_mst") as Entity_daimyo_mst; //Base Info. int kuniLv = PlayerPrefs.GetInt ("kuniLv"); int money = PlayerPrefs.GetInt ("money"); int busyoDama = PlayerPrefs.GetInt ("busyoDama"); GameObject.Find ("KuniLvValue").GetComponent<Text> ().text = kuniLv.ToString (); GameObject.Find ("MoneyValue").GetComponent<Text> ().text = money.ToString (); GameObject.Find ("BusyoDamaValue").GetComponent<Text> ().text = busyoDama.ToString (); myDaimyo = PlayerPrefs.GetInt ("myDaimyo"); string myDaimyoName = daimyoMst.param [myDaimyo - 1].daimyoName; GameObject.Find ("DaimyoValue").GetComponent<Text> ().text = myDaimyoName; //Kuni List string openKuni = PlayerPrefs.GetString ("openKuni"); List<string> openKuniList = new List<string> (); char[] delimiterChars = {','}; if (openKuni != null && openKuni != "") { if (openKuni.Contains (",")) { openKuniList = new List<string> (openKuni.Split (delimiterChars)); } else { openKuniList.Add (openKuni); } } GameObject kuniIconView = GameObject.Find ("KuniIconView"); string clearedKuni = PlayerPrefs.GetString ("clearedKuni"); List<string> clearedKuniList = new List<string> (); if (clearedKuni != null && clearedKuni != "") { if (clearedKuni.Contains (",")) { clearedKuniList = new List<string> (clearedKuni.Split (delimiterChars)); } else { clearedKuniList.Add (clearedKuni); } } /*View Every Kuni by Master*/ GameObject KuniMap = GameObject.Find ("KuniMap"); //Seiryoku Default Setting string seiryoku = PlayerPrefs.GetString ("seiryoku"); List<string> seiryokuList = new List<string> (); seiryokuList = new List<string> (seiryoku.Split (delimiterChars)); //Count my Kuni QTY for (int m=0; m<seiryokuList.Count; m++) { int seiryokuId = int.Parse (seiryokuList [m]); if (seiryokuId == myDaimyo) { myKuniQty = myKuniQty + 1; } } //My Doumei Color doumeiColor = new Color (100f / 255f, 130f / 255f, 255f / 255f, 255f / 255f); //Blue string myDoumei = PlayerPrefs.GetString ("doumei"); List<string> myDoumeiList = new List<string> (); if (myDoumei != null && myDoumei != "") { if (myDoumei.Contains (",")) { myDoumeiList = new List<string> (myDoumei.Split (delimiterChars)); } else { myDoumeiList.Add (myDoumei); } } string kuniPath = "Prefabs/Map/Kuni/"; for (int i=0; i<kuniMst.param.Count; i++) { int kuniId = kuniMst.param [i].kunId; string newKuniPath = kuniPath + kuniId.ToString (); int locationX = kuniMst.param [i].locationX; int locationY = kuniMst.param [i].locationY; GameObject kuni = Instantiate (Resources.Load (newKuniPath)) as GameObject; kuni.transform.SetParent (kuniIconView.transform); kuni.name = kuniId.ToString (); kuni.GetComponent<SendParam> ().kuniId = kuniId; kuni.GetComponent<SendParam> ().kuniName = kuniMst.param [i].kuniName; kuni.transform.localScale = new Vector2 (1, 1); kuni.GetComponent<SendParam> ().naiseiItem = kuniMst.param [i].naisei; //Seiryoku Handling int daimyoId = int.Parse (seiryokuList [kuniId - 1]); string daimyoName = daimyoMst.param [daimyoId - 1].daimyoName; kuni.GetComponent<SendParam> ().daimyoId = daimyoId; kuni.GetComponent<SendParam> ().daimyoName = daimyoName; int daimyoBusyoIdTemp = daimyoMst.param [daimyoId - 1].busyoId; kuni.GetComponent<SendParam> ().daimyoBusyoId = daimyoBusyoIdTemp; BusyoInfoGet busyo = new BusyoInfoGet (); if (daimyoBusyoIdTemp != 0) { kuni.GetComponent<SendParam> ().daimyoBusyoAtk = busyo.getMaxAtk (daimyoBusyoIdTemp); kuni.GetComponent<SendParam> ().daimyoBusyoDfc = busyo.getMaxDfc (daimyoBusyoIdTemp); } //Senryoku //Count QTY of Enemy Kuni int enemyKuniQty = 1; //for (int l=0; l<seiryokuList.Count; l++) { // int seiryokuId = int.Parse (seiryokuList [l]); // // if (seiryokuId == daimyoId) { // enemyKuniQty = enemyKuniQty + 1; // } //} List<string> checkedKuniList = new List<string> (); enemyKuniQty = countLinkedKuniQty(1, kuniId, daimyoId, seiryokuList, checkedKuniList); EnemySenryokuCalc calc = new EnemySenryokuCalc (); int busyoQty = 0; int busyoLv = 0; int butaiQty = 0; int butaiLv = 0; busyoQty = calc.EnemyBusyoQtyCalc (myKuniQty, enemyKuniQty); if (busyoQty > 12) { busyoQty = 12; } int senryokuRatio = daimyoMst.param [daimyoId - 1].senryoku; busyoLv = calc.EnemyBusyoLvCalc (senryokuRatio); butaiQty = calc.EnemyButaiQtyCalc (enemyKuniQty); butaiLv = calc.EnemyButaiLvCalc (senryokuRatio); kuni.GetComponent<SendParam> ().busyoQty = busyoQty; kuni.GetComponent<SendParam> ().busyoLv = busyoLv; kuni.GetComponent<SendParam> ().butaiQty = butaiQty; kuni.GetComponent<SendParam> ().butaiLv = butaiLv; kuni.GetComponent<SendParam> ().kuniQty = enemyKuniQty; //Color Handling float colorR = (float)daimyoMst.param [daimyoId - 1].colorR; float colorG = (float)daimyoMst.param [daimyoId - 1].colorG; float colorB = (float)daimyoMst.param [daimyoId - 1].colorB; Color kuniColor = new Color (colorR / 255f, colorG / 255f, colorB / 255f, 255f / 255f); KuniMap.transform.FindChild (kuni.name).GetComponent<Image> ().color = kuniColor; //Daimyo Kamon Image string imagePath = "Prefabs/Kamon/" + daimyoId.ToString (); kuni.GetComponent<Image> ().sprite = Resources.Load (imagePath, typeof(Sprite)) as Sprite; RectTransform kuniTransform = kuni.GetComponent<RectTransform> (); kuniTransform.anchoredPosition = new Vector3 (locationX, locationY, 0); //My Doumei Check if (myDoumei != null && myDoumei != "") { if (myDoumeiList.Contains (daimyoId.ToString ())) { kuni.GetComponent<SendParam> ().doumeiFlg = true; kuni.GetComponent<Image> ().color = doumeiColor; } } //My daimyo Check if (daimyoId == myDaimyo) { string myDaimyoPath = "Prefabs/Kamon/MyDaimyoKamon/" + myDaimyo.ToString (); kuni.GetComponent<Image> ().sprite = Resources.Load (myDaimyoPath, typeof(Sprite)) as Sprite; kuni.GetComponent<SendParam> ().clearFlg = true; int myHeiryoku = PlayerPrefs.GetInt ("jinkeiHeiryoku"); kuni.GetComponent<SendParam> ().heiryoku = myHeiryoku; } else { //Not my daimyo //Yukoudo string gaikouTemp = "gaikou" + daimyoId; int myYukouValue = PlayerPrefs.GetInt (gaikouTemp); kuni.GetComponent<SendParam> ().myYukouValue = myYukouValue; if (daimyoBusyoIdTemp != 0) { StatusGet sts = new StatusGet (); int hp = sts.getHp (daimyoBusyoIdTemp, busyoLv); int hpResult = hp * 100 * busyoQty; string type = sts.getHeisyu (daimyoBusyoIdTemp); int chHp = sts.getChHp (type, butaiLv, hp); chHp = chHp * butaiQty * busyoQty * 10; int totalHei = hpResult + chHp; kuni.GetComponent<SendParam> ().heiryoku = totalHei; } //Action Policy Setting(agrresive false or true) if(enemyKuniQty>=3){ kuni.GetComponent<SendParam> ().aggressiveFlg = getAggressiveFlg (0); // big country }else { kuni.GetComponent<SendParam> ().aggressiveFlg = getAggressiveFlg (1); // small country } //Cyouhou Flg string cyouhouTmp = "cyouhou" + kuniId; if (PlayerPrefs.HasKey (cyouhouTmp)) { int cyouhouSnbRankId = PlayerPrefs.GetInt (cyouhouTmp); kuni.GetComponent<SendParam> ().cyouhouSnbRankId = cyouhouSnbRankId; } } } //Color Change for kuni icon "Open but never cleared" Color openKuniColor = new Color (255f / 255f, 255f / 255f, 0f / 255f, 255f / 255f); //Yellow for (int i=0; i<openKuniList.Count; i++) { string openKuniId = openKuniList [i]; //Flg Change GameObject targetOpenKuni = GameObject.Find ("KuniIconView").transform.FindChild (openKuniId).gameObject; targetOpenKuni.GetComponent<SendParam> ().openFlg = true; bool doumeiFlg = targetOpenKuni.GetComponent<SendParam> ().doumeiFlg; //Color Change if (!clearedKuniList.Contains (openKuniId)) { if (!doumeiFlg) { targetOpenKuni.GetComponent<Image> ().color = openKuniColor; } } } //Clear Kuni Check bool kuniClearedFlg = PlayerPrefs.GetBool ("kuniClearedFlg"); if (kuniClearedFlg == true) { Message msg = new Message (); string Text = "国盗り、祝着至極に御座りますな。\n民から武将珠100個届いておりますぞ。"; msg.makeMessage (Text); //Add Busyo Dama busyoDama = busyoDama + 100; GameObject.Find ("BusyoDamaValue").GetComponent<Text> ().text = busyoDama.ToString (); PlayerPrefs.SetInt ("busyoDama", busyoDama); PlayerPrefs.SetBool ("kuniClearedFlg", false); PlayerPrefs.Flush (); } //From Naisei Check bool fromNaiseiFlg = PlayerPrefs.GetBool ("fromNaiseiFlg"); if (fromNaiseiFlg == true) { int activeKuniId = PlayerPrefs.GetInt ("activeKuniId"); GameObject.Find ("KuniIconView").transform.FindChild (activeKuniId.ToString ()).GetComponent<SendParam> ().OnClick (); GameObject.Find ("AttackButton").GetComponent<AttackNaiseiView> ().OnClick (); PlayerPrefs.SetBool ("fromNaiseiFlg", false); PlayerPrefs.Flush (); } /*Timer Handling*/ //Last Log-In Time string timestring = PlayerPrefs.GetString ("lasttime"); if (timestring == null || timestring == "") timestring = System.DateTime.Now.ToString (); System.DateTime datetime = System.DateTime.Parse (timestring); System.TimeSpan span = System.DateTime.Now - datetime; //経過時間を秒,時間で取得 double spantime = span.TotalSeconds; //spantimeでスタミナの回復分を求める double staminaDouble = spantime / 300; int addHyourou = (int)staminaDouble; int amariSec = (int)spantime - (addHyourou * 300); amariSec = 300 - amariSec; //HyourouMax hyourouMax = PlayerPrefs.GetInt ("hyourouMax"); GameObject.Find ("HyourouMaxValue").GetComponent<Text> ().text = hyourouMax.ToString (); //Now Hyourou int nowHyourou = PlayerPrefs.GetInt ("hyourou"); currentHyourou = GameObject.Find ("HyourouCurrentValue").gameObject; currentHyourou.GetComponent<Text> ().text = nowHyourou.ToString (); //Hyourou Full Check if (hyourouMax <= nowHyourou) { hyourouFull = true; GameObject.Find ("HyourouCurrentValue").GetComponent<Text> ().text = hyourouMax.ToString (); PlayerPrefs.SetInt ("hyourou", hyourouMax); PlayerPrefs.Flush (); } else { if (addHyourou > 0) { int newHyourou = nowHyourou + addHyourou; if (hyourouMax <= newHyourou) { hyourouFull = true; PlayerPrefs.SetInt ("hyourou", hyourouMax); PlayerPrefs.Flush (); GameObject.Find ("HyourouCurrentValue").GetComponent<Text> ().text = hyourouMax.ToString (); } else { hyourouFull = false; PlayerPrefs.SetInt ("hyourou", newHyourou); PlayerPrefs.Flush (); GameObject.Find ("HyourouCurrentValue").GetComponent<Text> ().text = newHyourou.ToString (); //Timer GameObject.Find ("TimerValue").GetComponent<Text> ().text = amariSec.ToString (); timer = (float)amariSec; } //終了時の処理 // 現在の時刻を取得 System.DateTime now = System.DateTime.Now; // 文字列に変換して保存 PlayerPrefs.SetString ("lasttime", now.ToString ()); PlayerPrefs.Flush (); } else { hyourouFull = false; PlayerPrefs.SetInt ("hyourou", nowHyourou); PlayerPrefs.Flush (); GameObject.Find ("HyourouCurrentValue").GetComponent<Text> ().text = nowHyourou.ToString (); //Timer GameObject.Find ("TimerValue").GetComponent<Text> ().text = amariSec.ToString (); timer = (float)amariSec; } } /*Year & Season -Auto Count- Start*/ string lastSeasonChangeTime = PlayerPrefs.GetString ("lastSeasonChangeTime"); if (lastSeasonChangeTime == null || lastSeasonChangeTime == "") { lastSeasonChangeTime = System.DateTime.Now.ToString (); PlayerPrefs.SetString ("lastSeasonChangeTime", lastSeasonChangeTime); PlayerPrefs.Flush (); } System.DateTime SChangeTime = System.DateTime.Parse (lastSeasonChangeTime); System.TimeSpan scSpan = System.DateTime.Now - SChangeTime; double scSpanHour = scSpan.TotalHours; double scSpanSec = scSpan.TotalSeconds; string yearSeason = PlayerPrefs.GetString ("yearSeason"); string[] yearSeasonList = yearSeason.Split (delimiterChars); int nowYear = int.Parse (yearSeasonList [0]); int nowSeason = int.Parse (yearSeasonList [1]); if (scSpanHour >= 12) { int seasonPastCount = (int)scSpanHour / 12; int amari = (int)scSpanSec - (seasonPastCount * 43200); for (int i=1; i<=seasonPastCount; i++) { if (nowSeason == 4) { nowYear = nowYear + 1; nowSeason = 1; } else { nowSeason = nowSeason + 1; } } yearTimer = cyosyuMstTime - amari; string newYearSeason = nowYear.ToString () + "," + nowSeason.ToString (); PlayerPrefs.SetString ("yearSeason", newYearSeason); lastSeasonChangeTime = System.DateTime.Now.ToString (); PlayerPrefs.SetString ("lastSeasonChangeTime", lastSeasonChangeTime); PlayerPrefs.SetBool ("doneCyosyuFlg", false); PlayerPrefs.SetString ("yearSeason", newYearSeason); PlayerPrefs.Flush (); } else { yearTimer = cyosyuMstTime - scSpanSec; } GameObject.Find ("YearValue").GetComponent<Text> ().text = nowYear.ToString (); SetSeason (nowSeason); doneCyosyuFlg = PlayerPrefs.GetBool ("doneCyosyuFlg"); if (!doneCyosyuFlg) { GameObject.Find ("SeiryokuInfo").transform.FindChild ("Ex").GetComponent<Image> ().enabled = true; } else { GameObject.Find ("SeiryokuInfo").transform.FindChild ("Ex").GetComponent<Image> ().enabled = false; } /*Year & Season End*/ /*--------------------*/ /*Gunzei*/ /*--------------------*/ string keyHistory = PlayerPrefs.GetString ("keyHistory"); List<string> keyHistoryList = new List<string> (); if (keyHistory != null && keyHistory != "") { if (keyHistory.Contains (",")) { keyHistoryList = new List<string> (keyHistory.Split (delimiterChars)); } else { keyHistoryList.Add (keyHistory); } } for (int n=0; n<keyHistoryList.Count; n++) { string keyTemp = keyHistoryList [n]; string keyValue = PlayerPrefs.GetString (keyTemp); if (keyValue != null) { List<string> keyValueList = new List<string> (); keyValueList = new List<string> (keyValue.Split (delimiterChars)); string gunzeiTime = keyValueList [0]; System.DateTime gunzeiDatetime = System.DateTime.Parse (gunzeiTime); System.TimeSpan gunzeiSpan = System.DateTime.Now - gunzeiDatetime; double gunzeiSpantime = gunzeiSpan.TotalSeconds; double remainTime = 0; List<string> srcDstKuniList = new List<string> (); char[] keyDelimiterChars = {'-'}; srcDstKuniList = new List<string> (keyTemp.Split (keyDelimiterChars)); int srcDaimyoId = int.Parse (keyValueList [1]); int dstDaimyoId = int.Parse (keyValueList [2]); int srcKuni = int.Parse (srcDstKuniList [0]); int dstKuni = int.Parse (srcDstKuniList [1]); bool dstEngunFlg = bool.Parse (keyValueList [9]); string dstEngunDaimyoId = keyValueList [10]; string dstEngunHei = keyValueList [11]; string dstEngunSts = keyValueList [12]; if (gunzeiSpantime >= 300) { //Has past //Simulation Gunzei gunzei = new Gunzei (); if (dstDaimyoId != myDaimyo) { int enemyHei = gunzei.heiryokuCalc (int.Parse (srcDstKuniList [1])); int engunTotalHei = 0; if (dstEngunFlg) { char[] delimiterChars2 = {':'}; List<string> engunHeiList = new List<string> (); engunHeiList = new List<string> (dstEngunHei.Split (delimiterChars2)); for (int k=0; k<engunHeiList.Count; k++) { engunTotalHei = engunTotalHei + int.Parse (engunHeiList [k]); } } enemyHei = enemyHei + engunTotalHei; int ratio = 0; int myHei = int.Parse (keyValueList [5]); if ((myHei + enemyHei) > 0) { ratio = 100 * myHei / (myHei + enemyHei); if (ratio < 1) { ratio = 1; } } MainEventHandler kassenEvent = new MainEventHandler (); bool winFlg = kassenEvent.CheckByProbability (ratio); if (winFlg) { bool noGunzeiFlg = true; gunzei.win (keyTemp, int.Parse (keyValueList [1]), int.Parse (keyValueList [2]), noGunzeiFlg); } else { deleteKeyHistory (keyTemp); } } else { MyDaimyoWasAttacked atked = new MyDaimyoWasAttacked (); atked.wasAttacked (keyTemp, srcKuni, dstKuni, srcDaimyoId, dstDaimyoId, dstEngunFlg, dstEngunDaimyoId, dstEngunSts); } } else { //View Previous string path = "Prefabs/Map/Gunzei"; GameObject Gunzei = Instantiate (Resources.Load (path)) as GameObject; Gunzei.transform.SetParent (GameObject.Find ("Panel").transform); Gunzei.GetComponent<Gunzei> ().key = keyTemp; Gunzei.GetComponent<Gunzei> ().srcKuni = int.Parse (srcDstKuniList [0]); Gunzei.GetComponent<Gunzei> ().dstKuni = int.Parse (srcDstKuniList [1]); Gunzei.GetComponent<Gunzei> ().spantime = gunzeiSpantime; Gunzei.GetComponent<Gunzei> ().srcDaimyoId = srcDaimyoId; Gunzei.GetComponent<Gunzei> ().dstDaimyoId = dstDaimyoId; Gunzei.GetComponent<Gunzei> ().srcDaimyoName = keyValueList [3]; Gunzei.GetComponent<Gunzei> ().dstDaimyoName = keyValueList [4]; Gunzei.GetComponent<Gunzei> ().myHei = int.Parse (keyValueList [5]); Gunzei.GetComponent<Gunzei> ().dstEngunFlg = bool.Parse (keyValueList [9]); Gunzei.GetComponent<Gunzei> ().dstEngunDaimyoId = keyValueList [10]; Gunzei.GetComponent<Gunzei> ().dstEngunHei = keyValueList [11]; Gunzei.GetComponent<Gunzei> ().dstEngunSts = keyValueList [12]; Gunzei.name = keyTemp; RectTransform GunzeiTransform = Gunzei.GetComponent<RectTransform> (); GunzeiTransform.anchoredPosition = new Vector3 (int.Parse (keyValueList [6]), int.Parse (keyValueList [7]), 0); if (keyValueList [8] == "right") { Gunzei.transform.localScale = new Vector2 (1, 1); } else { Gunzei.transform.localScale = new Vector2 (-1, 1); Gunzei.GetComponent<Gunzei> ().leftFlg = true; } } } else { PlayerPrefs.DeleteKey (keyTemp); PlayerPrefs.Flush (); } } //Metsubou Flg Check if (PlayerPrefs.HasKey ("metsubou")) { string metsubou = PlayerPrefs.GetString ("metsubou"); List<string> metsubouList = new List<string> (); if (metsubou.Contains (",")) { metsubouList = new List<string> (metsubou.Split (delimiterChars)); } else { metsubouList.Add (metsubou); } //Metsubou Message 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); //make board string pathOfBoard = "Prefabs/Event/EventBoard"; GameObject board = Instantiate (Resources.Load (pathOfBoard)) as GameObject; board.transform.SetParent (GameObject.Find ("Panel").transform); board.transform.localScale = new Vector2 (1, 1); string pathOfScroll = "Prefabs/Event/Metsubou"; GameObject scroll = Instantiate (Resources.Load (pathOfScroll)) as GameObject; scroll.transform.SetParent (board.transform); scroll.transform.localScale = new Vector2 (1, 1); string pathOfSlot = "Prefabs/Event/MetsubouSlot"; GameObject contents = scroll.transform.FindChild ("MetsubouScrollView/MetsubouContent").gameObject; char[] delimiterChars2 = {':'}; foreach (string text in metsubouList) { GameObject slot = Instantiate (Resources.Load (pathOfSlot)) as GameObject; slot.transform.SetParent (contents.transform); List<string> metsubouTextList = new List<string> (); metsubouTextList = new List<string> (text.Split (delimiterChars2)); string srcDaimyoName = daimyoMst.param [int.Parse (metsubouTextList [0]) - 1].daimyoName; string dstDaimyoName = daimyoMst.param [int.Parse (metsubouTextList [1]) - 1].daimyoName; string metsubouText = dstDaimyoName + "は" + srcDaimyoName + "に滅ぼされました"; slot.transform.FindChild ("MetsubouText").GetComponent<Text> ().text = metsubouText; slot.transform.localScale = new Vector2 (1, 1); //Metsubou Daimyo Handling string srcMetsubouTemp = "metsubou" + metsubouTextList [0]; string srcMetsubou = PlayerPrefs.GetString (srcMetsubouTemp); string dstMetsubouTemp = "metsubou" + metsubouTextList [1]; string dstMetsubou = PlayerPrefs.GetString (dstMetsubouTemp); string newSrcMetsubou = ""; if (srcMetsubou != null && srcMetsubou != "") { newSrcMetsubou = srcMetsubou + "," + metsubouTextList [1]; } else { newSrcMetsubou = metsubouTextList [1]; } if (dstMetsubou != null && dstMetsubou != "") { newSrcMetsubou = newSrcMetsubou + "," + dstMetsubou; } PlayerPrefs.SetString (srcMetsubouTemp, newSrcMetsubou); } PlayerPrefs.DeleteKey ("metsubou"); PlayerPrefs.Flush (); } /*--------------------*/ /*Enemy Action*/ /*--------------------*/ MainEventHandler gameEvent = new MainEventHandler (); gameEvent.mainHandler (); } } }
//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 int getEngunHei(string engunSts){ int totalHei = 0; char[] delimiterChars = {'-'}; List<string> engunStsList = new List<string>(); engunStsList = new List<string> (engunSts.Split (delimiterChars)); int busyoId = int.Parse(engunStsList [0]); int busyoLv = int.Parse(engunStsList [1]); int butaiQty = int.Parse(engunStsList [2]); int butaiLv = int.Parse(engunStsList [3]); if (busyoId != 0) { StatusGet sts = new StatusGet (); int hp = sts.getHp (busyoId, busyoLv); int hpResult = hp * 100; string type = sts.getHeisyu (busyoId); int chHp = sts.getChHp (type, butaiLv, hp); chHp = chHp * butaiQty * 10; totalHei = hpResult + chHp; } return totalHei; }
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 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 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; } }
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(){ //SE audio.PlayOneShot(touch); /*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); 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"; } //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) { StatusGet sts = new StatusGet (); int hp = sts.getHp (daimyoBusyoId,busyoLv); int hpResult = hp * 100 * busyoQty; string type = sts.getHeisyu (daimyoBusyoId); int chHp = sts.getChHp(type, butaiLv, hp); chHp = chHp * butaiQty * busyoQty * 10; int totalHei = hpResult + chHp; GameObject.Find ("HeiryokuValue").GetComponent<Text> ().text = totalHei.ToString (); //Yukoudo string gaikouTemp = "gaikou" + daimyoId; int myYukouValue = PlayerPrefs.GetInt(gaikouTemp); yukouValue.GetComponent<Text>().text = myYukouValue.ToString(); } else { //Cleard int myHeiryoku = PlayerPrefs.GetInt("jinkeiHeiryoku"); GameObject.Find ("HeiryokuValue").GetComponent<Text> ().text = myHeiryoku.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> ().doumeiFlg = doumeiFlg; close.GetComponent<CloseBoard> ().kuniQty = kuniQty; close.GetComponent<CloseBoard> ().kuniId = kuniId; //Set Button Value AttackNaiseiView attkNaiseView = GameObject.Find ("AttackButton").GetComponent<AttackNaiseiView>(); attkNaiseView.kuniId = kuniId; attkNaiseView.kuniName = kuniName; attkNaiseView.daimyoId = daimyoId; attkNaiseView.daimyoName = daimyoName; attkNaiseView.openFlg = openFlg; attkNaiseView.clearFlg = clearFlg; attkNaiseView.activeBusyoQty = busyoQty; attkNaiseView.activeBusyoLv = busyoLv; attkNaiseView.activeButaiQty = butaiQty; attkNaiseView.activeButaiLv = butaiLv; }
//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() { 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 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 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 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 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 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 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 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 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 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 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 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 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; } } }
//PowerType2 //Busyo + Busyo public int powerType2(List<int> mapList, int taisyoMapId, int linkNo, int activeDaimyoId){ int totalHei = 0; 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; /*Busyo Master Setting Start*/ //Active Busyo List List<string> metsubouDaimyoList = new List<string> (); string metsubouTemp = "metsubou" + activeDaimyoId; string metsubouDaimyoString = PlayerPrefs.GetString (metsubouTemp); char[] delimiterChars2 = {','}; if (metsubouDaimyoString != null && metsubouDaimyoString != "") { if (metsubouDaimyoString.Contains (",")) { metsubouDaimyoList = new List<string> (metsubouDaimyoString.Split (delimiterChars2)); } else { metsubouDaimyoList = new List<string> (metsubouDaimyoString.Split (delimiterChars2)); } } metsubouDaimyoList.Add (activeDaimyoId.ToString ()); Entity_busyo_mst busyoMst = Resources.Load ("Data/busyo_mst") as Entity_busyo_mst; List<int> busyoList = new List<int> (); for (int i=0; i<busyoMst.param.Count; i++) { int busyoId = busyoMst.param [i].id; int daimyoId = busyoMst.param [i].daimyoId; if (metsubouDaimyoList.Contains (daimyoId.ToString ())) { if (busyoId != daimyoBusyoId) { busyoList.Add (busyoId); } } } /*Busyo Master Setting End*/ /*Random Shuffle*/ for (int i = 0; i < busyoList.Count; i++) { int temp = busyoList [i]; int randomIndex = UnityEngine.Random.Range (0, busyoList.Count); busyoList [i] = busyoList [randomIndex]; busyoList [randomIndex] = temp; } 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; } /*Taisyo Setting Start*/ GameObject EnemyJinkeiView = GameObject.Find ("EnemyJinkeiView").gameObject; int taisyoBusyoId = busyoList[0]; StatusGet sts = new StatusGet(); BusyoInfoGet info = new BusyoInfoGet(); int hp = sts.getHp(taisyoBusyoId,activeBusyoLv); hp = hp * 100; //Link Status Adjustment if (linkNo != 0) { float linkAdjst = (float)linkNo/10; float adjstHp = hp * linkAdjst; hp = hp + (int)adjstHp; } string TaisyoBusyoName = info.getName(taisyoBusyoId); string TaisyoType = info.getHeisyu(taisyoBusyoId); int chldHp = activeButaiQty * enemyIns.getChildStatus (activeButaiLv, TaisyoType, linkNo); totalHei = hp + chldHp; string path = "Prefabs/Player/Unit/" + taisyoBusyoId; GameObject tsyBusyo = Instantiate(Resources.Load (path)) as GameObject; string slotName = "Slot" + taisyoMapId; tsyBusyo.transform.SetParent(EnemyJinkeiView.transform.FindChild(slotName).transform); tsyBusyo.name = taisyoBusyoId.ToString(); tsyBusyo.transform.localScale = new Vector2(-3,3); tsyBusyo.transform.localPosition = new Vector3(0, 0, 0); tempEnemySoudaisyo = int.Parse (tsyBusyo.name); //Button string soudaisyoPath = "Prefabs/Jinkei/soudaisyo"; GameObject soudaisyo = Instantiate (Resources.Load (soudaisyoPath)) as GameObject; soudaisyo.transform.SetParent (tsyBusyo.transform); soudaisyo.transform.localScale = new Vector2 (27, 12); soudaisyo.name = "enemySoudaisyo"; soudaisyo.transform.localPosition = new Vector3(0, 11, 0); tsyBusyo.GetComponent<DragHandler> ().enabled = false; //Text GameObject txtObj = tsyBusyo.transform.FindChild ("Text").gameObject; Vector2 txtScale = txtObj.transform.localScale; txtScale.x *= -1; txtObj.transform.localScale = txtScale; Vector2 txtPos = txtObj.transform.localPosition; txtPos.x *= -1; txtObj.transform.localPosition = txtPos; GameObject rblObj = tsyBusyo.transform.FindChild ("Rank").gameObject; Vector2 rblScale = rblObj.transform.localScale; rblScale.x *= -1; rblObj.transform.localScale = rblScale; Vector2 rblPos = rblObj.transform.localPosition; rblPos.x *= -1; rblObj.transform.localPosition = rblPos; GameObject tsyTxtObj = tsyBusyo.transform.FindChild ("enemySoudaisyo").transform.FindChild("Text").gameObject; Vector2 tsyScale = tsyTxtObj.transform.localScale; tsyScale.x *= -1; tsyTxtObj.transform.localScale = tsyScale; Vector2 tsyPos = tsyTxtObj.transform.localPosition; tsyPos.x *= -1; tsyTxtObj.transform.localPosition = tsyPos; /*Taisyo Setting End*/ //Make Instance busyoList.Remove (taisyoBusyoId); int busyoListCount = busyoList.Count; for (int j=0; j<activeBusyoQty-1; j++) { if (busyoListCount > 0) { int randomBusyoId = busyoList [j]; busyoListCount = busyoListCount - 1; int mapId = mapList [j]; //Status if (randomBusyoId != 0) { int busyoHp = sts.getHp (randomBusyoId, activeBusyoLv); busyoHp = busyoHp * 100; //Link Status Adjustment if (linkNo != 0) { float linkAdjst = (float)linkNo/10; float adjstHp = busyoHp * linkAdjst; busyoHp = busyoHp + (int)adjstHp; } string busyoName = info.getName (randomBusyoId); string busyoType = info.getHeisyu (randomBusyoId); int chldHp2 = activeButaiQty * enemyIns.getChildStatus (activeButaiLv, busyoType, linkNo); totalHei = totalHei + busyoHp + chldHp2; string busyoPath = "Prefabs/Player/Unit/" + randomBusyoId; GameObject chdBusyo = Instantiate(Resources.Load (busyoPath)) as GameObject; string chdSlotName = "Slot" + mapId; chdBusyo.transform.SetParent(EnemyJinkeiView.transform.FindChild(chdSlotName).transform); chdBusyo.name = randomBusyoId.ToString(); chdBusyo.transform.localScale = new Vector2(-3,3); chdBusyo.transform.localPosition = new Vector3(0, 0, 0); //Button chdBusyo.GetComponent<DragHandler> ().enabled = false; //Text GameObject chTxtObj = chdBusyo.transform.FindChild ("Text").gameObject; Vector2 chTxtScale = chTxtObj.transform.localScale; chTxtScale.x *= -1; chTxtObj.transform.localScale = chTxtScale; Vector2 chTxtPos = chTxtObj.transform.localPosition; chTxtPos.x *= -1; chTxtObj.transform.localPosition = chTxtPos; GameObject chRblObj = chdBusyo.transform.FindChild ("Rank").gameObject; Vector2 chRblScale = chRblObj.transform.localScale; chRblScale.x *= -1; chRblObj.transform.localScale = chRblScale; Vector2 chRblPos = chRblObj.transform.localPosition; chRblPos.x *= -1; chRblObj.transform.localPosition = chRblPos; } }else{ //samurai daisyo make busyoListCount = busyoListCount - 1; int mapId = mapList [j]; int busyoHp = sts.getHp (35, activeBusyoLv); busyoHp = busyoHp * 100; //Link Status Adjustment if (linkNo != 0) { float linkAdjst = (float)linkNo/10; float adjstHp = busyoHp * linkAdjst; busyoHp = busyoHp + (int)adjstHp; } string busyoName = info.getName (35); string[] texts = new string[] { "YR", "KB"}; string busyoType = texts[UnityEngine.Random.Range(0, texts.Length - 1)]; int chldHp2 = activeButaiQty * enemyIns.getChildStatus (activeButaiLv, busyoType, linkNo); totalHei = totalHei + busyoHp + chldHp2; string busyoPath = "Prefabs/Player/Unit/35"; GameObject chdBusyo = Instantiate(Resources.Load (busyoPath)) as GameObject; string chdSlotName = "Slot" + mapId; chdBusyo.transform.SetParent(EnemyJinkeiView.transform.FindChild(chdSlotName).transform); chdBusyo.name = "35"; chdBusyo.transform.localScale = new Vector2(-3,3); chdBusyo.transform.localPosition = new Vector3(0, 0, 0); //Button chdBusyo.GetComponent<DragHandler> ().enabled = false; //Rabel & Text GameObject chTxtObj = chdBusyo.transform.FindChild ("Text").gameObject; Vector2 chTxtScale = chTxtObj.transform.localScale; chTxtScale.x *= -1; chTxtObj.transform.localScale = chTxtScale; Vector2 chTxtPos = chTxtObj.transform.localPosition; chTxtPos.x *= -1; chTxtObj.transform.localPosition = chTxtPos; } } return totalHei; }