public void getEnemyStsAndMakeInstance(int linkNo, int mapId, float rainMinusRatio, float snowMinusRatio) { string map = "emap" + mapId; int busyoId = PlayerPrefs.GetInt(map); int activeBusyoLv = PlayerPrefs.GetInt("activeBusyoLv"); int activeButaiQty = PlayerPrefs.GetInt("activeButaiQty"); int activeButaiLv = PlayerPrefs.GetInt("activeButaiLv"); StatusGet sts = new StatusGet(); BusyoInfoGet info = new BusyoInfoGet(); int shipId = info.getShipId(busyoId); int hp = sts.getHp(busyoId, activeBusyoLv); int atk = sts.getAtk(busyoId, activeBusyoLv); int dfc = sts.getDfc(busyoId, activeBusyoLv); int spd = sts.getSpd(busyoId, activeBusyoLv); string busyoName = sts.getBusyoName(busyoId); string heisyu = sts.getHeisyu(busyoId); int playerBusyoQty = PlayerPrefs.GetInt("jinkeiBusyoQty"); aveSenpouLv = Mathf.CeilToInt(totalSenpouLv / playerBusyoQty); ArrayList senpouArray = sts.getEnemySenpou(busyoId, aveSenpouLv, ""); //Weather Minus if (rainMinusRatio != 0 || snowMinusRatio != 0) { float tmp = (float)spd * 0.5f; if (tmp < 1) { tmp = 1; } spd = Mathf.FloorToInt(tmp); } bool enemyTaisyoFlg = false; if (busyoId == enemySoudaisyo) { enemyTaisyoFlg = true; } //View Object & pass status to it. EnemyInstance inst = new EnemyInstance(); inst.makeKaisenInstance(mapId, busyoId, shipId, activeButaiLv, heisyu, activeButaiQty, hp, atk, dfc, spd, busyoName, linkNo, enemyTaisyoFlg, senpouArray); }
public void 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 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 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 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 makeKaisenInstance(int busyoId, int shipId, int mapId, int hp, int atk, int dfc, int spd, ArrayList senpouArray, string busyoName, int soudaisyo, int boubi, bool engunFlg, int engunButaiQty, int engunButaiSts) { /*Parent Instantiate*/ string path = "Prefabs/Kaisen/" + shipId; GameObject prefab = Instantiate(Resources.Load(path)) as GameObject; prefab.name = busyoId.ToString(); //Senpou Script Parametor StatusGet senpouScript = new StatusGet(); bool shipFlg = senpouScript.getSenpouShipFlg((int)senpouArray[0]); if (shipFlg) { prefab.GetComponent <SenpouController>().senpouId = (int)senpouArray[0]; prefab.GetComponent <SenpouController>().senpouTyp = senpouArray[1].ToString(); prefab.GetComponent <SenpouController>().senpouName = senpouArray[2].ToString(); prefab.GetComponent <SenpouController>().senpouEach = (float)senpouArray[4]; prefab.GetComponent <SenpouController>().senpouRatio = (float)senpouArray[5]; prefab.GetComponent <SenpouController>().senpouTerm = (float)senpouArray[6]; prefab.GetComponent <SenpouController>().senpouStatus = (int)senpouArray[7]; prefab.GetComponent <SenpouController>().senpouLv = (int)senpouArray[8]; //Serihu Entity_serihu_mst serihuMst = Resources.Load("Data/serihu_mst") as Entity_serihu_mst; string serihu = ""; if (Application.systemLanguage != SystemLanguage.Japanese) { serihu = serihuMst.param[busyoId - 1].senpouMsgEng; } else { serihu = serihuMst.param[busyoId - 1].senpouMsg; } prefab.GetComponent <SenpouController>().senpouSerihu = serihu; } else { Destroy(prefab.GetComponent <SenpouController>()); } /*Player Status Setting*/ //parametor setting int adjHp = hp * 100; int adjAtk = atk * 10; int adjDfc = dfc * 10; //Kahou Adjustment float addAtkByKanni = 0; float addHpByKanni = 0; float addDfcByKanni = 0; //Jyosyu Adjustment float addJyosyuHei = 0; string[] KahouStatusArray = null; if (!engunFlg) { KahouStatusGet kahouSts = new KahouStatusGet(); KahouStatusArray = kahouSts.getKahouForStatus(busyoId.ToString(), adjHp, adjAtk, adjDfc, spd); //Kanni Adjustment string kanniTmp = "kanni" + busyoId; 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; } } } JyosyuHeiryoku jyosyuHei = new JyosyuHeiryoku(); addJyosyuHei = (float)jyosyuHei.GetJyosyuHeiryoku(busyoId.ToString()); } //Busyo Detail Info [Name & HP Bar] string dtlPath = ""; if (Application.systemLanguage != SystemLanguage.Japanese) { dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayerEng"; } else { dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayer"; } GameObject dtl = Instantiate(Resources.Load(dtlPath)) as GameObject; dtl.transform.SetParent(prefab.transform); dtl.transform.localPosition = new Vector3(0, 1, -1); dtl.transform.localScale = new Vector3(1, 1, 0); dtl.name = "BusyoDtlPlayer"; //Name GameObject nameLabel = dtl.transform.FindChild("NameLabel").gameObject; nameLabel.GetComponent <TextMesh>().text = busyoName; if (Application.systemLanguage != SystemLanguage.Japanese) { nameLabel.GetComponent <TextMesh>().fontSize = 40; } //Location by map id if (mapId == 1) { prefab.transform.position = new Vector2(-65, 16); } else if (mapId == 2) { prefab.transform.position = new Vector2(-50, 16); } else if (mapId == 3) { prefab.transform.position = new Vector2(-35, 16); } else if (mapId == 4) { prefab.transform.position = new Vector2(-20, 16); } else if (mapId == 5) { prefab.transform.position = new Vector2(-5, 16); } else if (mapId == 6) { prefab.transform.position = new Vector2(-65, 8); } else if (mapId == 7) { prefab.transform.position = new Vector2(-50, 8); } else if (mapId == 8) { prefab.transform.position = new Vector2(-35, 8); } else if (mapId == 9) { prefab.transform.position = new Vector2(-20, 8); } else if (mapId == 10) { prefab.transform.position = new Vector2(-5, 8); } else if (mapId == 11) { prefab.transform.position = new Vector2(-65, 0); } else if (mapId == 12) { prefab.transform.position = new Vector2(-50, 0); } else if (mapId == 13) { prefab.transform.position = new Vector2(-35, 0); } else if (mapId == 14) { prefab.transform.position = new Vector2(-20, 0); } else if (mapId == 15) { prefab.transform.position = new Vector2(-5, 0); } else if (mapId == 16) { prefab.transform.position = new Vector2(-65, -8); } else if (mapId == 17) { prefab.transform.position = new Vector2(-50, -8); } else if (mapId == 18) { prefab.transform.position = new Vector2(-35, -8); } else if (mapId == 19) { prefab.transform.position = new Vector2(-20, -8); } else if (mapId == 20) { prefab.transform.position = new Vector2(-5, -8); } else if (mapId == 21) { prefab.transform.position = new Vector2(-65, -16); } else if (mapId == 22) { prefab.transform.position = new Vector2(-50, -16); } else if (mapId == 23) { prefab.transform.position = new Vector2(-45, -16); } else if (mapId == 24) { prefab.transform.position = new Vector2(-20, -16); } else if (mapId == 25) { prefab.transform.position = new Vector2(-5, -16); } //Add Senryoku if (!engunFlg) { string key = "addSenryokuSlot" + mapId; if (PlayerPrefs.HasKey(key)) { string atkDfc = PlayerPrefs.GetString(key); List <string> atkDfcList = new List <string>(); char[] delimiterChars2 = { ',' }; atkDfcList = new List <string>(atkDfc.Split(delimiterChars2)); adjAtk = adjAtk + int.Parse(atkDfcList[0]); adjDfc = adjDfc + int.Parse(atkDfcList[1]); } } //Adjust Status & Set int adjHpWithKahou = 0; float adjAtkWithKahou = 0; float adjDfcWithKahou = 0; float adjSpd = 0; if (!engunFlg) { adjHpWithKahou = adjHp + int.Parse(KahouStatusArray[1]) + Mathf.FloorToInt(addHpByKanni); adjAtkWithKahou = (float)adjAtk + int.Parse(KahouStatusArray[0]) + Mathf.FloorToInt(addAtkByKanni); adjDfcWithKahou = (float)adjDfc + int.Parse(KahouStatusArray[2]) + Mathf.FloorToInt(addDfcByKanni) + boubi; adjSpd = ((float)spd + float.Parse(KahouStatusArray[3])) / 10; } else { adjHpWithKahou = adjHp; adjAtkWithKahou = (float)adjAtk; adjDfcWithKahou = (float)adjDfc; adjSpd = (float)spd / 10; } if (shipId == 1) { adjHpWithKahou = adjHpWithKahou * 2; adjDfcWithKahou = adjDfcWithKahou * 2; adjSpd = Mathf.FloorToInt((float)adjSpd * 0.5f); } else if (shipId == 2) { adjHpWithKahou = Mathf.FloorToInt((float)adjHpWithKahou * 1.5f); adjDfcWithKahou = Mathf.FloorToInt((float)adjDfcWithKahou * 1.5f); adjSpd = Mathf.FloorToInt((float)adjSpd * 0.6f); } else if (shipId == 3) { adjSpd = Mathf.FloorToInt((float)adjSpd * 0.8f); } if (adjSpd <= 0) { adjSpd = 1; } GameObject minHpBar = dtl.transform.FindChild("MinHpBar").gameObject; minHpBar.GetComponent <BusyoHPBar>().initLife = adjHpWithKahou; prefab.GetComponent <PlayerHP>().life = adjHpWithKahou + addJyosyuHei; prefab.GetComponent <PlayerAttack>().attack = adjAtkWithKahou; prefab.GetComponent <UnitMover>().speed = adjSpd; prefab.GetComponent <UnitMover>().heisyu = "SHP"; prefab.GetComponent <PlayerHP>().dfc = adjDfcWithKahou; //Soudaisyo if (!engunFlg) { if (busyoId == soudaisyo) { prefab.GetComponent <PlayerHP>().taisyo = true; } } //SE AudioController audio = new AudioController(); audio.addComponentMoveAttack(prefab, "SHP"); /*Child Instantiate*/ //set child object int ch_num = 0; int ch_lv = 0; float ch_status = 0; if (!engunFlg) { string heiId = "hei" + busyoId.ToString(); string chParam = PlayerPrefs.GetString(heiId, "0"); if (chParam == "0") { StatusGet statusScript = new StatusGet(); string chParamHeisyu = statusScript.getHeisyu(busyoId); chParam = chParamHeisyu + ":1:1:1"; PlayerPrefs.SetString(heiId, chParam); PlayerPrefs.Flush(); } char[] delimiterChars = { ':' }; string[] ch_list = chParam.Split(delimiterChars); ch_num = int.Parse(ch_list[1]); ch_lv = int.Parse(ch_list[2]); ch_status = float.Parse(ch_list[3]); } else { ch_num = engunButaiQty; ch_status = engunButaiSts; } ch_status = ch_status * 10; string ch_path = "Prefabs/Kaisen/3"; for (int i = 1; i <= ch_num; i++) { //Make Relationship GameObject ch_prefab = Instantiate(Resources.Load(ch_path)) as GameObject; ch_prefab.transform.SetParent(prefab.transform); ch_prefab.name = "Child" + i.ToString(); ch_prefab.transform.localScale = new Vector2(0.7f, 0.7f); ch_prefab.GetComponent <SpriteRenderer>().sortingOrder = 3; ch_prefab.tag = "PlayerChild"; Destroy(ch_prefab.GetComponent <Rigidbody2D>()); Destroy(ch_prefab.GetComponent <UnitMover>()); Destroy(ch_prefab.GetComponent <Kunkou>()); Destroy(ch_prefab.GetComponent <PolygonCollider2D>()); Destroy(ch_prefab.GetComponent <PlayerHP>()); Destroy(ch_prefab.GetComponent <PlayerAttack>()); Destroy(ch_prefab.GetComponent <SenpouController>()); //Location if (i == 1) { ch_prefab.transform.localPosition = new Vector2(1.8f, 0); } else if (i == 2) { ch_prefab.transform.localPosition = new Vector2(1.8f, 0.5f); } else if (i == 3) { ch_prefab.transform.localPosition = new Vector2(1.8f, -0.5f); } else if (i == 4) { ch_prefab.transform.localPosition = new Vector2(1.8f, 1.0f); } else if (i == 5) { ch_prefab.transform.localPosition = new Vector2(1.8f, -1.0f); } else if (i == 6) { ch_prefab.transform.localPosition = new Vector2(0, 0.5f); } else if (i == 7) { ch_prefab.transform.localPosition = new Vector2(0, -0.5f); } else if (i == 8) { ch_prefab.transform.localPosition = new Vector2(0, 1.0f); } else if (i == 9) { ch_prefab.transform.localPosition = new Vector2(0, -1.0f); } else if (i == 10) { ch_prefab.transform.localPosition = new Vector2(-1.8f, 0); } else if (i == 11) { ch_prefab.transform.localPosition = new Vector2(-1.8f, 0.5f); } else if (i == 12) { ch_prefab.transform.localPosition = new Vector2(-1.8f, -0.5f); } else if (i == 13) { ch_prefab.transform.localPosition = new Vector2(-1.8f, 1.0f); } else if (i == 14) { ch_prefab.transform.localPosition = new Vector2(-1.8f, -1.0f); } else if (i == 15) { ch_prefab.transform.localPosition = new Vector2(1.8f, 1.5f); } else if (i == 16) { ch_prefab.transform.localPosition = new Vector2(1.8f, -1.5f); } else if (i == 17) { ch_prefab.transform.localPosition = new Vector2(0, 1.5f); } else if (i == 18) { ch_prefab.transform.localPosition = new Vector2(0, -1.5f); } else if (i == 19) { ch_prefab.transform.localPosition = new Vector2(-1.8f, 1.5f); } else if (i == 20) { ch_prefab.transform.localPosition = new Vector2(-1.8f, -1.5f); } StatusGet sts = new StatusGet(); int atkDfc = (int)sts.getChAtkDfc((int)ch_status, adjHpWithKahou); if (i == 1) { //Child Qty prefab.GetComponent <PlayerHP>().childQty = ch_num; //Child Unit HP prefab.GetComponent <PlayerHP>().childHP = (int)ch_status; //Attack prefab.GetComponent <PlayerAttack>().attack = prefab.GetComponent <PlayerAttack>().attack + (ch_num * atkDfc); //Dfc prefab.GetComponent <PlayerHP>().dfc = prefab.GetComponent <PlayerHP>().dfc + (ch_num * atkDfc); } } }
public void OnClick() { AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> (); audioSources [2].Play(); /*Busyo View*/ //Delete Previous foreach (Transform n in GameObject.Find("BusyoView").transform) { GameObject.Destroy(n.gameObject); } //Jinkei Flg if (jinkeiFlg) { string iconPath = "Prefabs/Busyo/Jinkei"; GameObject jinkei = Instantiate(Resources.Load(iconPath)) as GameObject; jinkei.transform.SetParent(GameObject.Find("BusyoView").transform); jinkei.transform.localScale = new Vector2(0.3f, 0.3f); jinkei.transform.localPosition = new Vector2(220, 200); jinkei.name = "jinkei"; } //Make New Busyo string busyoId; busyoId = this.name.Remove(0, 4); string path = "Prefabs/Player/Unit/BusyoUnit"; GameObject Busyo = Instantiate(Resources.Load(path)) as GameObject; Busyo.name = busyoId.ToString(); Busyo.transform.SetParent(GameObject.Find("BusyoView").transform); Busyo.transform.localScale = new Vector2(4, 4); Busyo.GetComponent <DragHandler> ().enabled = false; RectTransform rect_transform = Busyo.GetComponent <RectTransform>(); rect_transform.anchoredPosition3D = new Vector3(300, 200, 0); rect_transform.sizeDelta = new Vector2(100, 100); //Ship Rank string shipPath = "Prefabs/Busyo/ShipSts"; GameObject ShipObj = Instantiate(Resources.Load(shipPath)) as GameObject; ShipObj.transform.SetParent(Busyo.transform); preKaisen kaisenScript = new preKaisen(); int shipId = kaisenScript.getShipSprite(ShipObj, int.Parse(busyoId)); ShipObj.transform.localPosition = new Vector3(-40, -40, 0); ShipObj.transform.localScale = new Vector2(0.4f, 0.4f); if (Application.systemLanguage != SystemLanguage.Japanese) { if (shipId == 1) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "High"; } else if (shipId == 2) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Mid"; } else if (shipId == 3) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Low"; } } else { if (shipId == 1) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "上"; } else if (shipId == 2) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "中"; } else if (shipId == 3) { ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "下"; } } //Text Modification GameObject text = Busyo.transform.FindChild("Text").gameObject; text.GetComponent <Text> ().color = new Color(255, 255, 255, 255); RectTransform text_transform = text.GetComponent <RectTransform>(); text_transform.anchoredPosition3D = new Vector3(-70, 30, 0); text_transform.sizeDelta = new Vector2(630, 120); text.transform.localScale = new Vector2(0.2f, 0.2f); //Rank Text Modification GameObject rank = Busyo.transform.FindChild("Rank").gameObject; RectTransform rank_transform = rank.GetComponent <RectTransform>(); rank_transform.anchoredPosition3D = new Vector3(20, -50, 0); rank_transform.sizeDelta = new Vector2(200, 200); rank.GetComponent <Text>().fontSize = 200; /*Busyo Status*/ NowOnBusyo NowOnBusyoScript = GameObject.Find("GameScene").GetComponent <NowOnBusyo> (); BusyoInfoGet busyoInfoGetScript = new BusyoInfoGet(); if (GameObject.Find("GameScene").GetComponent <NowOnButton> ().onButton == "Ronkou") { int lv = PlayerPrefs.GetInt(busyoId); StatusGet sts = new StatusGet(); int hp = sts.getHp(int.Parse(busyoId), lv); int atk = sts.getAtk(int.Parse(busyoId), lv); int dfc = sts.getDfc(int.Parse(busyoId), lv); int spd = sts.getSpd(int.Parse(busyoId), lv); int adjHp = hp * 100; int adjAtk = atk * 10; int adjDfc = dfc * 10; //add lv string addLvTmp = "addlv" + busyoId.ToString(); if (PlayerPrefs.HasKey(addLvTmp)) { string addLvValue = "+" + PlayerPrefs.GetString(addLvTmp); GameObject.Find("addLvValue").GetComponent <Text>().text = addLvValue.ToString(); } else { GameObject.Find("addLvValue").GetComponent <Text>().text = ""; } int maxLv = 100 + PlayerPrefs.GetInt(addLvTmp); GameObject.Find("LvValue").GetComponent <Text> ().text = lv.ToString(); GameObject.Find("TosotsuValue").GetComponent <Text> ().text = adjHp.ToString(); GameObject.Find("BuyuuValue").GetComponent <Text> ().text = adjAtk.ToString(); GameObject.Find("ChiryakuValue").GetComponent <Text> ().text = adjDfc.ToString(); GameObject.Find("SpeedValue").GetComponent <Text> ().text = spd.ToString(); //Exp string expId = "exp" + busyoId.ToString(); string expString = ""; int nowExp = PlayerPrefs.GetInt(expId); Exp exp = new Exp(); int requiredExp = 0; if (lv != maxLv) { requiredExp = exp.getExpforNextLv(lv); } else { requiredExp = exp.getExpLvMax(maxLv); } expString = nowExp + "/" + requiredExp; GameObject.Find("ExpValue").GetComponent <Text> ().text = expString; //Kahou status KahouStatusGet kahouSts = new KahouStatusGet(); string[] KahouStatusArray = kahouSts.getKahouForStatus(busyoId, adjHp, adjAtk, adjDfc, spd); int totalBusyoHp = 0; //Kanni string kanniTmp = "kanni" + busyoId; float addAtkByKanni = 0; float addHpByKanni = 0; float addDfcByKanni = 0; if (PlayerPrefs.HasKey(kanniTmp)) { int kanniId = PlayerPrefs.GetInt(kanniTmp); if (kanniId != 0) { Kanni kanni = new Kanni(); string kanniIkai = kanni.getIkai(kanniId); string kanniName = kanni.getKanni(kanniId); GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text> ().text = kanniIkai + "\n" + kanniName; //Status string kanniTarget = kanni.getEffectTarget(kanniId); int effect = kanni.getEffect(kanniId); if (kanniTarget == "atk") { addAtkByKanni = ((float)adjAtk * (float)effect) / 100; } else if (kanniTarget == "hp") { addHpByKanni = ((float)adjHp * (float)effect) / 100; } else if (kanniTarget == "dfc") { addDfcByKanni = ((float)adjDfc * (float)effect) / 100; } } else { if (Application.systemLanguage != SystemLanguage.Japanese) { GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text>().text = "No Rank"; } else { GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text>().text = "官位無し"; } } } else { if (Application.systemLanguage != SystemLanguage.Japanese) { GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text> ().text = "No Rank"; } else { GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text>().text = "官位無し"; } } //Jyosyu string jyosyuTmp = "jyosyuBusyo" + busyoId; if (PlayerPrefs.HasKey(jyosyuTmp)) { int kuniId = PlayerPrefs.GetInt(jyosyuTmp); KuniInfo kuni = new KuniInfo(); string kuniName = kuni.getKuniName(kuniId); if (Application.systemLanguage != SystemLanguage.Japanese) { GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text> ().text = kuniName + "\nLord"; } else { GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text>().text = kuniName + "\n城主"; } } else { if (Application.systemLanguage != SystemLanguage.Japanese) { GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text>().text = "No Feud"; } else { GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text>().text = "城無し"; } } //Show Additional Status int finalAtk = int.Parse(KahouStatusArray [0]) + Mathf.FloorToInt(addAtkByKanni); int finalHp = int.Parse(KahouStatusArray [1]) + Mathf.FloorToInt(addHpByKanni); int finalDfc = int.Parse(KahouStatusArray [2]) + Mathf.FloorToInt(addDfcByKanni); int finalSpd = int.Parse(KahouStatusArray [3]); GameObject.Find("KahouAtkValue").GetComponent <Text> ().text = "+" + finalAtk.ToString(); GameObject.Find("KahouHpValue").GetComponent <Text>().text = "+" + finalHp.ToString(); totalBusyoHp = adjHp + finalHp; GameObject.Find("KahouDfcValue").GetComponent <Text>().text = "+" + finalDfc.ToString(); GameObject.Find("KahouSpdValue").GetComponent <Text>().text = "+" + finalSpd.ToString(); //Butai Status string heiId = "hei" + busyoId.ToString(); string chParam = PlayerPrefs.GetString(heiId, "0"); if (chParam == "0" || chParam == "") { StatusGet statusScript = new StatusGet(); string heisyu = statusScript.getHeisyu(int.Parse(busyoId)); chParam = heisyu + ":1:1:1"; PlayerPrefs.SetString(heiId, chParam); PlayerPrefs.Flush(); } if (chParam.Contains(":")) { char[] delimiterChars = { ':' }; string[] ch_list = chParam.Split(delimiterChars); string ch_type = ch_list [0]; int ch_num = int.Parse(ch_list [1]); int ch_lv = int.Parse(ch_list [2]); float ch_status = float.Parse(ch_list [3]); string heisyu = ""; Message msg = new Message(); if (ch_type == "KB") { heisyu = msg.getMessage(55); } else if (ch_type == "YR") { heisyu = msg.getMessage(56); } else if (ch_type == "TP") { heisyu = msg.getMessage(57); } else if (ch_type == "YM") { heisyu = msg.getMessage(58); } GameObject.Find("ChildNameValue").GetComponent <Text> ().text = heisyu; GameObject.Find("ChildQtyValue").GetComponent <Text> ().text = ch_num.ToString(); GameObject.Find("ChildLvValue").GetComponent <Text> ().text = ch_lv.ToString(); //Jyosyu Handling JyosyuHeiryoku jyosyuHei = new JyosyuHeiryoku(); float addHei = (float)jyosyuHei.GetJyosyuHeiryoku(busyoId); float hei = ch_status * 10; GameObject.Find("ChildHeiryokuValue").GetComponent <Text>().text = hei.ToString(); float newHei = finalHp + addHei; GameObject.Find("KahouHpValue").GetComponent <Text>().text = "+" + newHei.ToString(); int chAtkDfc = (int)sts.getChAtkDfc((int)hei, totalBusyoHp); string chAtkDfcString = chAtkDfc.ToString() + "/" + chAtkDfc.ToString(); GameObject.Find("ChildStatusValue").GetComponent <Text> ().text = chAtkDfcString; //Child Image foreach (Transform n in GameObject.Find("Img").transform) { GameObject.Destroy(n.gameObject); } string chPath = "Prefabs/Player/Unit/" + ch_type; GameObject chObj = Instantiate(Resources.Load(chPath)) as GameObject; chObj.transform.SetParent(GameObject.Find("Img").transform); RectTransform chTransform = chObj.GetComponent <RectTransform> (); chTransform.anchoredPosition3D = new Vector3(-200, -50, 0); chTransform.sizeDelta = new Vector2(40, 40); chObj.transform.localScale = new Vector2(4, 4); GameObject chigyo = GameObject.Find("ButtonCyouhei"); if (ch_num < 20) { chigyo.GetComponent <Image> ().color = OKClorBtn; chigyo.transform.FindChild("Text").GetComponent <Text> ().color = OKClorTxt; chigyo.GetComponent <Button>().enabled = true; chigyo.GetComponent <BusyoStatusButton> ().ch_type = ch_type; chigyo.GetComponent <BusyoStatusButton> ().ch_heisyu = heisyu; chigyo.GetComponent <BusyoStatusButton> ().ch_num = ch_num; chigyo.GetComponent <BusyoStatusButton> ().ch_status = chAtkDfc; chigyo.GetComponent <BusyoStatusButton> ().ch_hp = hei; chigyo.GetComponent <BusyoStatusButton> ().pa_hp = totalBusyoHp / 100; } else { //MAX chigyo.GetComponent <Image> ().color = NGClorBtn; chigyo.transform.FindChild("Text").GetComponent <Text> ().color = NGClorTxt; chigyo.GetComponent <Button>().enabled = false; } GameObject kunren = GameObject.Find("ButtonKunren"); if (ch_lv < 100) { kunren.GetComponent <Image> ().color = OKClorBtn; kunren.transform.FindChild("Text").GetComponent <Text> ().color = OKClorTxt; kunren.GetComponent <Button>().enabled = true; kunren.GetComponent <BusyoStatusButton> ().ch_type = ch_type; kunren.GetComponent <BusyoStatusButton> ().ch_heisyu = heisyu; kunren.GetComponent <BusyoStatusButton> ().ch_lv = ch_lv; kunren.GetComponent <BusyoStatusButton> ().ch_num = ch_num; kunren.GetComponent <BusyoStatusButton> ().ch_status = chAtkDfc; kunren.GetComponent <BusyoStatusButton> ().ch_hp = hei; kunren.GetComponent <BusyoStatusButton> ().pa_hp = totalBusyoHp / 100; } else { //MAX kunren.GetComponent <Image> ().color = NGClorBtn; kunren.transform.FindChild("Text").GetComponent <Text> ().color = NGClorTxt; kunren.GetComponent <Button>().enabled = false; } } //Parametor Setting NowOnBusyoScript.OnBusyo = busyoId; NowOnBusyoScript.OnBusyoName = busyoInfoGetScript.getName(int.Parse(busyoId)); } else if (GameObject.Find("GameScene").GetComponent <NowOnButton> ().onButton == "Senpou") { NowOnBusyoScript.OnBusyo = busyoId; NowOnBusyoScript.OnBusyoName = busyoInfoGetScript.getName(int.Parse(busyoId)); SenpouScene scene = new SenpouScene(); scene.createSenpouStatusView(busyoId); scene.createSakuStatusView(busyoId); } else if (GameObject.Find("GameScene").GetComponent <NowOnButton> ().onButton == "Kahou") { NowOnBusyoScript.OnBusyo = busyoId; NowOnBusyoScript.OnBusyoName = busyoInfoGetScript.getName(int.Parse(busyoId)); KahouScene kahou = new KahouScene(); kahou.createKahouStatusView(busyoId); } else if (GameObject.Find("GameScene").GetComponent <NowOnButton> ().onButton == "Syogu") { NowOnBusyoScript.OnBusyo = busyoId; NowOnBusyoScript.OnBusyoName = busyoInfoGetScript.getName(int.Parse(busyoId)); SyoguScene syogu = new SyoguScene(); syogu.createSyoguView(busyoId); } }
public void OnClick() { AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> (); if (moneyOK != true) { //Error audioSources [4].Play(); msg.makeMessage(msg.getMessage(6)); } else { //OK audioSources [3].Play(); Slider lvSlider = GameObject.Find("KunrenSlider").GetComponent <Slider>(); int targetLv = (int)lvSlider.value; string payMoney = GameObject.Find("RequiredMoneyValue").GetComponent <Text>().text; string busyoId = GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyo; //reduce money int nowMoney = PlayerPrefs.GetInt("money"); int calcMoney = nowMoney - int.Parse(payMoney); //increase target Lv string tmp = "hei" + busyoId; string chParam = PlayerPrefs.GetString(tmp, "0"); if (chParam == "0" || chParam == "") { StatusGet statusScript = new StatusGet(); string chParamHeisyu = statusScript.getHeisyu(int.Parse(busyoId)); chParam = chParamHeisyu + ":1:1:1"; PlayerPrefs.SetString(tmp, chParam); PlayerPrefs.Flush(); } char[] delimiterChars = { ':' }; string[] ch_list = chParam.Split(delimiterChars); //get pure status Entity_lvch_mst lvMst = Resources.Load("Data/lvch_mst") as Entity_lvch_mst; int startline = 0; string ch_type = ch_list [0]; if (ch_type == "KB") { startline = 0; } else if (ch_type == "YR") { startline = 1; } else if (ch_type == "TP") { startline = 2; } else if (ch_type == "YM") { startline = 3; } object stslst = lvMst.param[startline]; Type t = stslst.GetType(); String param = "lv" + targetLv.ToString(); FieldInfo f = t.GetField(param); int sts = (int)f.GetValue(stslst); string newParam = ch_list [0] + ":" + ch_list [1] + ":" + targetLv.ToString() + ":" + sts.ToString(); PlayerPrefs.SetInt("money", calcMoney); PlayerPrefs.SetString(tmp, newParam); PlayerPrefs.SetBool("questDailyFlg23", true); PlayerPrefs.Flush(); //Message string busyoName = GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyoName; string OKtext = ""; if (Application.systemLanguage != SystemLanguage.Japanese) { OKtext = busyoName + " trained their soldiers."; } else { OKtext = busyoName + "隊にて訓練を実施しました。"; } msg.makeMessage(OKtext); //Reload //Close Board GameObject.Find("close").GetComponent <CloseBoard>().onClick(); RonkouScene ronkou = new RonkouScene(); ronkou.createBusyoStatusView(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 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 (); } } }
void Start() { GameScene gameSceneScript = new GameScene(); //Sound BGMSESwitch bgm = new BGMSESwitch(); bgm.StopSEVolume(); bgm.StopKassenBGMVolume(); //Taiko StartCoroutine("taikoMusic"); //Kill Prevous BGM KillOtherBGM kill = new KillOtherBGM(); kill.Start(); //Giveup button bool isAttackedFlg = PlayerPrefs.GetBool("isAttackedFlg"); if (isAttackedFlg) { GameObject.Find("GiveupBtn").SetActive(false); } //Auto button bool Auto2Flg = PlayerPrefs.GetBool("Auto2Flg"); if (Auto2Flg) { GameObject.Find("AutoBtn").transform.FindChild("Num").GetComponent <Text>().text = "2"; GameObject.Find("AutoBtn").GetComponent <AutoAttack>().speed = 2; } //Dinamic Map activeKuniId = PlayerPrefs.GetInt("activeKuniId"); activeStageId = PlayerPrefs.GetInt("activeStageId"); GameObject wall = Instantiate(wallPrefab); wall.name = "wall"; kaisenWeatherHandling(map); //Get Minus Status float rainMinusRatio = PlayerPrefs.GetFloat("rainMinusStatus", 0); float snowMinusRatio = PlayerPrefs.GetFloat("snowMinusStatus", 0); /*Player Setting*/ int jinkei = PlayerPrefs.GetInt("jinkei", 0); List <int> myBusyoList = new List <int>(); if (jinkei == 1) { soudaisyo = PlayerPrefs.GetInt("soudaisyo1"); if (PlayerPrefs.HasKey("1map1")) { int mapId = 1; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("1map2")) { int mapId = 2; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("1map7")) { int mapId = 7; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("1map8")) { int mapId = 8; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("1map11")) { int mapId = 11; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("1map12")) { int mapId = 12; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("1map13")) { int mapId = 13; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("1map14")) { int mapId = 14; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("1map17")) { int mapId = 17; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("1map18")) { int mapId = 18; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("1map21")) { int mapId = 21; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("1map22")) { int mapId = 22; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } } else if (jinkei == 2) { soudaisyo = PlayerPrefs.GetInt("soudaisyo2"); if (PlayerPrefs.HasKey("2map3")) { int mapId = 3; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("2map4")) { int mapId = 4; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("2map5")) { int mapId = 5; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("2map7")) { int mapId = 7; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("2map8")) { int mapId = 8; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("2map11")) { int mapId = 11; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("2map12")) { int mapId = 12; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("2map17")) { int mapId = 17; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("2map18")) { int mapId = 18; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("2map23")) { int mapId = 23; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("2map24")) { int mapId = 24; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("2map25")) { int mapId = 25; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } } else if (jinkei == 3) { soudaisyo = PlayerPrefs.GetInt("soudaisyo3"); if (PlayerPrefs.HasKey("3map3")) { int mapId = 3; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("3map7")) { int mapId = 7; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("3map8")) { int mapId = 8; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("3map9")) { int mapId = 9; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("3map11")) { int mapId = 11; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("3map12")) { int mapId = 12; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("3map14")) { int mapId = 14; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("3map15")) { int mapId = 15; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("3map16")) { int mapId = 16; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("3map20")) { int mapId = 20; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("3map21")) { int mapId = 21; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("3map25")) { int mapId = 25; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } } else if (jinkei == 4) { soudaisyo = PlayerPrefs.GetInt("soudaisyo4"); if (PlayerPrefs.HasKey("4map1")) { int mapId = 1; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("4map2")) { int mapId = 2; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("4map7")) { int mapId = 7; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("4map8")) { int mapId = 8; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("4map12")) { int mapId = 12; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("4map13")) { int mapId = 13; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("4map14")) { int mapId = 14; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("4map18")) { int mapId = 18; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("4map19")) { int mapId = 19; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("4map20")) { int mapId = 20; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("4map24")) { int mapId = 24; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } if (PlayerPrefs.HasKey("4map25")) { int mapId = 25; myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio)); } } //Saku BusyoInfoGet info = new BusyoInfoGet(); StatusGet sts = new StatusGet(); GameObject content = GameObject.Find("Content").gameObject; string slotPath = "Prefabs/Saku/Slot"; Saku saku = new Saku(); foreach (Transform n in content.transform) { GameObject.Destroy(n.gameObject); } foreach (int busyoId in myBusyoList) { List <string> sakuList = new List <string>(); sakuList = saku.getSakuInfo(busyoId); if (saku.getSakuShipFlg(int.Parse(sakuList[0]))) { GameObject slot = Instantiate(Resources.Load(slotPath)) as GameObject; string sakuPath = "Prefabs/Saku/saku" + sakuList[0]; GameObject sakuIcon = Instantiate(Resources.Load(sakuPath)) as GameObject; sakuIcon.transform.SetParent(slot.transform); sakuIcon.transform.localScale = new Vector2(0.45f, 0.45f); sakuIcon.GetComponent <Button>().enabled = false; slot.transform.SetParent(content.transform); slot.transform.localScale = new Vector2(1, 1); slot.GetComponent <Saku>().sakuId = int.Parse(sakuList[0]); slot.GetComponent <Saku>().sakuEffect = int.Parse(sakuList[4]); if (sakuList[0] == "3") { //hukuhei //Heisyu slot.GetComponent <Saku>().sakuHeisyu = info.getHeisyu(busyoId); //Hei Status string heiId = "hei" + busyoId.ToString(); string chParam = PlayerPrefs.GetString(heiId, "0"); if (chParam == "0" || chParam == "") { StatusGet statusScript = new StatusGet(); string chParamHeisyu = statusScript.getHeisyu(busyoId); chParam = chParamHeisyu + ":1:1:1"; PlayerPrefs.SetString(heiId, chParam); PlayerPrefs.Flush(); } char[] delimiterChars = { ':' }; string[] ch_list = chParam.Split(delimiterChars); slot.GetComponent <Saku>().sakuHeiSts = float.Parse(ch_list[3]); slot.GetComponent <Saku>().sakuBusyoId = busyoId; //Busyo Speed int sakuBusyoLv = PlayerPrefs.GetInt(busyoId.ToString()); float adjSpd = (float)sts.getSpd(busyoId, sakuBusyoLv) / 10; slot.GetComponent <Saku>().sakuBusyoSpeed = adjSpd; } } } //Nanban string nanbanString = PlayerPrefs.GetString("nanbanItem"); List <string> nanbanList = new List <string>(); char[] delimiterChars3 = { ',' }; nanbanList = new List <string>(nanbanString.Split(delimiterChars3)); for (int i = 0; i < nanbanList.Count; i++) { int qty = int.Parse(nanbanList[i]); if (qty != 0) { if (i == 0 || i == 1) { GameObject slot = Instantiate(Resources.Load(slotPath)) as GameObject; string nanbanPath = ""; if (i == 0) { nanbanPath = "Prefabs/Saku/saku8"; } else if (i == 1) { nanbanPath = "Prefabs/Saku/saku9"; } GameObject sakuIcon = Instantiate(Resources.Load(nanbanPath)) as GameObject; sakuIcon.transform.SetParent(slot.transform); sakuIcon.transform.localScale = new Vector2(0.45f, 0.45f); sakuIcon.GetComponent <Button>().enabled = false; slot.transform.SetParent(content.transform); slot.transform.localScale = new Vector2(1, 1); if (i == 0) { slot.GetComponent <Saku>().sakuId = 8; } else if (i == 1) { slot.GetComponent <Saku>().sakuId = 9; } else if (i == 2) { slot.GetComponent <Saku>().sakuId = 10; } int temp = i + 1; ItemInfo item = new ItemInfo(); string itemCd = "nanban" + temp.ToString(); int effect = item.getItemEffect(itemCd); slot.GetComponent <Saku>().sakuEffect = effect; } } } /*エネミー配置*/ int linkNo = PlayerPrefs.GetInt("activeLink", 0); enemySoudaisyo = PlayerPrefs.GetInt("enemySoudaisyo"); if (PlayerPrefs.HasKey("emap1")) { int mapId = 1; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap2")) { int mapId = 2; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap3")) { int mapId = 3; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap4")) { int mapId = 4; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap5")) { int mapId = 5; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap6")) { int mapId = 6; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap7")) { int mapId = 7; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap8")) { int mapId = 8; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap9")) { int mapId = 9; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap10")) { int mapId = 10; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap11")) { int mapId = 11; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap12")) { int mapId = 12; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap13")) { int mapId = 13; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap14")) { int mapId = 14; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap15")) { int mapId = 15; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap16")) { int mapId = 16; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap17")) { int mapId = 17; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap18")) { int mapId = 18; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap19")) { int mapId = 19; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap20")) { int mapId = 20; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap21")) { int mapId = 21; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap22")) { int mapId = 22; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap23")) { int mapId = 23; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap24")) { int mapId = 24; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } if (PlayerPrefs.HasKey("emap25")) { int mapId = 25; getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio); } /*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() { Message msg = new Message(); AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> (); if (itemOK == false || moneyOK == false) { //Error audioSources [4].Play(); msg.makeMessage(msg.getMessage(52)); } else { audioSources [3].Play(); /*Do Cyouhei*/ //Reduce Current Item string itemColumn = "cyouhei" + ch_type; string itemString = PlayerPrefs.GetString(itemColumn); char[] delimiterChars = { ',' }; string[] itemList = itemString.Split(delimiterChars); string newItemListString = "0,0,0"; if (itemType == "low") { int calc = int.Parse(itemList[0]) - requiredItem; newItemListString = calc.ToString() + "," + itemList[1] + "," + itemList[2]; } else if (itemType == "middle") { int calc = int.Parse(itemList[1]) - requiredItem; newItemListString = itemList[0] + "," + calc.ToString() + "," + itemList[2]; } else if (itemType == "hight") { int calc = int.Parse(itemList[2]) - requiredItem; newItemListString = itemList[0] + "," + itemList[1] + "," + calc.ToString(); } PlayerPrefs.SetString(itemColumn, newItemListString); //Reduce Money int calcMoney = nowMoney - requiredMoney; PlayerPrefs.SetInt("money", calcMoney); //Add Child QTY string busyoId = GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyo; string temp = "hei" + busyoId; string childStsString = PlayerPrefs.GetString(temp, "0"); if (childStsString == "0" || childStsString == "") { StatusGet statusScript = new StatusGet(); string chParamHeisyu = statusScript.getHeisyu(int.Parse(busyoId)); childStsString = chParamHeisyu + ":1:1:1"; PlayerPrefs.SetString(temp, childStsString); PlayerPrefs.Flush(); } char[] delimiterChars2 = { ':' }; string[] childStsList = childStsString.Split(delimiterChars2); int bfrChildQty = int.Parse(childStsList[1]); int aftChildQty = bfrChildQty + 1; string newChildStsString = childStsString; newChildStsString = childStsList[0] + ":" + aftChildQty.ToString() + ":" + childStsList[2] + ":" + childStsList[3]; PlayerPrefs.SetString(temp, newChildStsString); PlayerPrefs.SetBool("questDailyFlg22", true); PlayerPrefs.Flush(); //Message string busyoName = GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyoName; string OKtext = ""; if (Application.systemLanguage != SystemLanguage.Japanese) { OKtext = busyoName + " recruited new soldiers."; } else { OKtext = busyoName + "隊にて徴兵を実施しました。"; } msg.makeMessage(OKtext); //Reload //Close Board if (Application.loadedLevelName != "tutorialBusyo") { GameObject.Find("close").GetComponent <CloseBoard>().onClick(); RonkouScene ronkou = new RonkouScene(); ronkou.createBusyoStatusView(busyoId); } else { Destroy(GameObject.Find("Back(Clone)").gameObject); Destroy(GameObject.Find("board(Clone)").gameObject); GameObject ChildQtyValue = GameObject.Find("ChildQtyValue").gameObject; ChildQtyValue.GetComponent <Text>().text = "2"; //Set Parametor PlayerPrefs.SetInt("tutorialId", 11); PlayerPrefs.Flush(); TutorialController tutorialScript = new TutorialController(); Vector2 vect = new Vector2(50, 200); GameObject anim = tutorialScript.SetFadeoutPointer(ChildQtyValue, vect); anim.transform.localScale = new Vector2(500, 500); Color enabledColor = new Color(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f); GameObject btn = GameObject.Find("ButtonKunren").gameObject; btn.GetComponent <Button>().enabled = true; btn.GetComponent <Image>().color = enabledColor; btn.transform.FindChild("Text").GetComponent <Text>().color = enabledColor; GameObject ButaiStatus = GameObject.Find("ButaiStatus").gameObject; GameObject BusyoStatus = GameObject.Find("BusyoStatus").gameObject; ButaiStatus.transform.SetParent(BusyoStatus.transform); GameObject Button = GameObject.Find("Panel").transform.FindChild("Button").gameObject; GameObject tBack = GameObject.Find("tBack").gameObject; Button.transform.SetParent(tBack.transform); Vector2 vect2 = new Vector2(0, 50); GameObject animPoint = tutorialScript.SetPointer(Button, vect2); animPoint.transform.localScale = new Vector2(200, 200); } } }
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 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 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(){ //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; }
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 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 GetPlayerSenryoku(string busyoId) { int i = 0; bool result = int.TryParse(busyoId, out i); if (result) { //Parent int myDaimyoBusyo = PlayerPrefs.GetInt("myDaimyoBusyo"); if (int.Parse(busyoId) == myDaimyoBusyo) { myDaimyoBusyoFlg = true; } BusyoInfoGet busyo = new BusyoInfoGet(); belongDaimyoId = busyo.getDaimyoId(int.Parse(busyoId)); if (belongDaimyoId == 0) { belongDaimyoId = busyo.getDaimyoHst(int.Parse(busyoId)); } shipId = busyo.getShipId(int.Parse(busyoId)); lv = PlayerPrefs.GetInt(busyoId, 1); StatusGet sts = new StatusGet(); int hp = sts.getHp(int.Parse(busyoId), lv); int atk = sts.getAtk(int.Parse(busyoId), lv); int dfc = sts.getDfc(int.Parse(busyoId), lv); int spd = sts.getSpd(int.Parse(busyoId), lv); int adjHp = hp * 100; int adjAtk = atk * 10; int adjDfc = dfc * 10; JyosyuHeiryoku jyosyuHei = new JyosyuHeiryoku(); int addJyosyuHei = jyosyuHei.GetJyosyuHeiryoku(busyoId.ToString()); KahouStatusGet kahouSts = new KahouStatusGet(); string[] KahouStatusArray = kahouSts.getKahouForStatus(busyoId, adjHp, adjAtk, adjDfc, spd); int totalBusyoHp = 0; int totalBusyoAtk = 0; int totalBusyoDfc = 0; string kanniTmp = "kanni" + busyoId; float addAtkByKanni = 0; float addHpByKanni = 0; float addDfcByKanni = 0; if (PlayerPrefs.HasKey(kanniTmp)) { int kanniId = PlayerPrefs.GetInt(kanniTmp); if (kanniId != 0) { Kanni kanni = new Kanni(); //Status string kanniTarget = kanni.getEffectTarget(kanniId); int effect = kanni.getEffect(kanniId); if (kanniTarget == "atk") { addAtkByKanni = ((float)adjAtk * (float)effect) / 100; } else if (kanniTarget == "hp") { addHpByKanni = ((float)adjHp * (float)effect) / 100; } else if (kanniTarget == "dfc") { addDfcByKanni = ((float)adjDfc * (float)effect) / 100; } } } totalBusyoAtk = adjAtk + int.Parse(KahouStatusArray[0]) + Mathf.FloorToInt(addAtkByKanni); totalBusyoHp = adjHp + int.Parse(KahouStatusArray[1]) + Mathf.FloorToInt(addHpByKanni) + addJyosyuHei; totalBusyoDfc = adjDfc + int.Parse(KahouStatusArray[2]) + Mathf.FloorToInt(addDfcByKanni); totalSpd = spd + int.Parse(KahouStatusArray[3]); if (Application.loadedLevelName == "preKaisen") { if (shipId == 1) { totalBusyoHp = totalBusyoHp * 2; } else if (shipId == 2) { totalBusyoHp = Mathf.FloorToInt((float)totalBusyoHp * 1.5f); } } //Child string heiId = "hei" + busyoId.ToString(); string chParam = PlayerPrefs.GetString(heiId, "0"); if (chParam == "0" || chParam == "") { StatusGet statusScript = new StatusGet(); string heisyu = statusScript.getHeisyu(int.Parse(busyoId)); chParam = heisyu + ":1:1:1"; PlayerPrefs.SetString(heiId, chParam); PlayerPrefs.Flush(); } char[] delimiterChars = { ':' }; if (chParam.Contains(":")) { string[] ch_list = chParam.Split(delimiterChars); chQty = int.Parse(ch_list [1]); chlv = int.Parse(ch_list [2]); int ch_status = int.Parse(ch_list [3]); int totalChldHp = 0; int totalChldAtk = 0; int totalChldDfc = 0; ch_status = ch_status * 10; int atkDfc = (int)sts.getChAtkDfc(ch_status, totalBusyoHp); totalChldHp = ch_status * chQty; totalChldAtk = atkDfc * chQty; totalChldDfc = atkDfc * chQty; //Set value totalHp = totalBusyoHp + totalChldHp; totalAtk = totalBusyoAtk + totalChldAtk; totalDfc = totalBusyoDfc + totalChldDfc; } } }
public void makeInstance(int busyoId, int mapId, int hp, int atk, int dfc, int spd, ArrayList senpouArray, string busyoName, int soudaisyo, int boubi) { /*Parent Instantiate*/ string path = "Prefabs/Player/" + busyoId; GameObject prefab = Instantiate(Resources.Load(path)) as GameObject; prefab.name = busyoId.ToString(); //Senpou Script Parametor StatusGet senpouScript = new StatusGet(); bool onlySeaFlg = senpouScript.getSenpouOnlySeaFlg((int)senpouArray[0]); if (!onlySeaFlg) { prefab.GetComponent <SenpouController>().senpouId = (int)senpouArray[0]; prefab.GetComponent <SenpouController>().senpouTyp = senpouArray[1].ToString(); prefab.GetComponent <SenpouController>().senpouName = senpouArray[2].ToString(); prefab.GetComponent <SenpouController>().senpouEach = (float)senpouArray[4]; prefab.GetComponent <SenpouController>().senpouRatio = (float)senpouArray[5]; prefab.GetComponent <SenpouController>().senpouTerm = (float)senpouArray[6]; prefab.GetComponent <SenpouController>().senpouStatus = (int)senpouArray[7]; prefab.GetComponent <SenpouController>().senpouLv = (int)senpouArray[8]; //Serihu Entity_serihu_mst serihuMst = Resources.Load("Data/serihu_mst") as Entity_serihu_mst; string serihu = ""; if (Application.systemLanguage != SystemLanguage.Japanese) { serihu = serihuMst.param[busyoId - 1].senpouMsgEng; } else { serihu = serihuMst.param[busyoId - 1].senpouMsg; } prefab.GetComponent <SenpouController>().senpouSerihu = serihu; } else { Destroy(prefab.GetComponent <SenpouController>()); } /*Player Status Setting*/ //parametor setting int adjHp = hp * 100; int adjAtk = atk * 10; int adjDfc = dfc * 10; //heisyu BusyoInfoGet info = new BusyoInfoGet(); string heisyu = info.getHeisyu(busyoId); JyosyuHeiryoku jyosyuHei = new JyosyuHeiryoku(); float addJyosyuHei = (float)jyosyuHei.GetJyosyuHeiryoku(busyoId.ToString()); //Kahou Adjustment KahouStatusGet kahouSts = new KahouStatusGet(); string[] KahouStatusArray = kahouSts.getKahouForStatus(busyoId.ToString(), adjHp, adjAtk, adjDfc, spd); //Kanni Adjustment 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; } } } //Busyo Detail Info [Name & HP Bar] string dtlPath = ""; if (Application.systemLanguage != SystemLanguage.Japanese) { dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayerEng"; } else { dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayer"; } GameObject dtl = Instantiate(Resources.Load(dtlPath)) as GameObject; dtl.transform.SetParent(prefab.transform); dtl.transform.localPosition = new Vector3(0, 1.3f, -1); dtl.transform.localScale = new Vector3(1.3f, 1.3f, 0); dtl.name = "BusyoDtlPlayer"; //Name GameObject nameLabel = dtl.transform.FindChild("NameLabel").gameObject; nameLabel.GetComponent <TextMesh> ().text = busyoName; //Location by map id if (mapId == 1) { prefab.transform.position = new Vector2(-65, 16); prefab.GetComponent <LineLocation>().nowLine = 1; } else if (mapId == 2) { prefab.transform.position = new Vector2(-50, 16); prefab.GetComponent <LineLocation>().nowLine = 1; } else if (mapId == 3) { prefab.transform.position = new Vector2(-35, 16); prefab.GetComponent <LineLocation>().nowLine = 1; } else if (mapId == 4) { prefab.transform.position = new Vector2(-20, 16); prefab.GetComponent <LineLocation>().nowLine = 1; } else if (mapId == 5) { prefab.transform.position = new Vector2(-5, 16); prefab.GetComponent <LineLocation>().nowLine = 1; } else if (mapId == 6) { prefab.transform.position = new Vector2(-65, 8); prefab.GetComponent <LineLocation>().nowLine = 2; } else if (mapId == 7) { prefab.transform.position = new Vector2(-50, 8); prefab.GetComponent <LineLocation>().nowLine = 2; } else if (mapId == 8) { prefab.transform.position = new Vector2(-35, 8); prefab.GetComponent <LineLocation>().nowLine = 2; } else if (mapId == 9) { prefab.transform.position = new Vector2(-20, 8); prefab.GetComponent <LineLocation>().nowLine = 2; } else if (mapId == 10) { prefab.transform.position = new Vector2(-5, 8); prefab.GetComponent <LineLocation>().nowLine = 2; } else if (mapId == 11) { prefab.transform.position = new Vector2(-65, 0); prefab.GetComponent <LineLocation>().nowLine = 3; } else if (mapId == 12) { prefab.transform.position = new Vector2(-50, 0); prefab.GetComponent <LineLocation>().nowLine = 3; } else if (mapId == 13) { prefab.transform.position = new Vector2(-35, 0); prefab.GetComponent <LineLocation>().nowLine = 3; } else if (mapId == 14) { prefab.transform.position = new Vector2(-20, 0); prefab.GetComponent <LineLocation>().nowLine = 3; } else if (mapId == 15) { prefab.transform.position = new Vector2(-5, 0); prefab.GetComponent <LineLocation>().nowLine = 3; } else if (mapId == 16) { prefab.transform.position = new Vector2(-65, -8); prefab.GetComponent <LineLocation>().nowLine = 4; } else if (mapId == 17) { prefab.transform.position = new Vector2(-50, -8); prefab.GetComponent <LineLocation>().nowLine = 4; } else if (mapId == 18) { prefab.transform.position = new Vector2(-35, -8); prefab.GetComponent <LineLocation>().nowLine = 4; } else if (mapId == 19) { prefab.transform.position = new Vector2(-20, -8); prefab.GetComponent <LineLocation>().nowLine = 4; } else if (mapId == 20) { prefab.transform.position = new Vector2(-5, -8); prefab.GetComponent <LineLocation>().nowLine = 4; } else if (mapId == 21) { prefab.transform.position = new Vector2(-65, -16); prefab.GetComponent <LineLocation>().nowLine = 5; } else if (mapId == 22) { prefab.transform.position = new Vector2(-50, -16); prefab.GetComponent <LineLocation>().nowLine = 5; } else if (mapId == 23) { prefab.transform.position = new Vector2(-45, -16); prefab.GetComponent <LineLocation>().nowLine = 5; } else if (mapId == 24) { prefab.transform.position = new Vector2(-20, -16); prefab.GetComponent <LineLocation>().nowLine = 5; } else if (mapId == 25) { prefab.transform.position = new Vector2(-5, -16); prefab.GetComponent <LineLocation>().nowLine = 5; } //Add Senryoku string key = "addSenryokuSlot" + mapId; if (PlayerPrefs.HasKey(key)) { string atkDfc = PlayerPrefs.GetString(key); List <string> atkDfcList = new List <string> (); char[] delimiterChars2 = { ',' }; atkDfcList = new List <string> (atkDfc.Split(delimiterChars2)); adjAtk = adjAtk + int.Parse(atkDfcList [0]); adjDfc = adjDfc + int.Parse(atkDfcList [1]); } //HP Status int adjHpWithKahou = adjHp + int.Parse(KahouStatusArray[1]) + Mathf.FloorToInt(addHpByKanni); GameObject minHpBar = dtl.transform.FindChild("MinHpBar").gameObject; minHpBar.GetComponent <BusyoHPBar>().initLife = adjHpWithKahou; prefab.GetComponent <PlayerHP> ().life = adjHpWithKahou + addJyosyuHei; //spd adjust float adjSpd = ((float)spd + float.Parse(KahouStatusArray[3])) / 10; prefab.GetComponent <UnitMover> ().heisyu = heisyu; if (prefab.GetComponent <PlayerAttack> ()) { prefab.GetComponent <PlayerAttack> ().attack = adjAtk + int.Parse(KahouStatusArray[0]) + Mathf.FloorToInt(addAtkByKanni); prefab.GetComponent <UnitMover>().speed = adjSpd; } else { if (heisyu == "TP") { prefab.GetComponent <AttackLong> ().attack = 5 * (adjAtk + int.Parse(KahouStatusArray [0]) + Mathf.FloorToInt(addAtkByKanni)); } else if (heisyu == "YM") { prefab.GetComponent <AttackLong> ().attack = 3 * (adjAtk + int.Parse(KahouStatusArray [0]) + Mathf.FloorToInt(addAtkByKanni)); } prefab.GetComponent <UnitMover> ().speed = adjSpd; } prefab.GetComponent <PlayerHP>().dfc = adjDfc + int.Parse(KahouStatusArray[2]) + Mathf.FloorToInt(addDfcByKanni) + boubi; //Soudaisyo if (busyoId == soudaisyo) { prefab.GetComponent <PlayerHP> ().taisyo = true; } //SE AudioController audio = new AudioController(); audio.addComponentMoveAttack(prefab, heisyu); /*Child Instantiate*/ //set child object string heiId = "hei" + busyoId.ToString(); string chParam = ""; bool tutorialDoneFlg = PlayerPrefs.GetBool("tutorialDoneFlg"); if (!tutorialDoneFlg || Application.loadedLevelName != "tutorialKassen") { chParam = PlayerPrefs.GetString(heiId, "0"); } else { //retry tutorial if (busyoId == 19) { chParam = "TP:2:1:1"; } else { StatusGet statusScript = new StatusGet(); string chParamHeisyu = statusScript.getHeisyu(busyoId); chParam = chParamHeisyu + ":1:1:1"; } } if (chParam == "0") { StatusGet statusScript = new StatusGet(); string chParamHeisyu = statusScript.getHeisyu(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]); ch_status = ch_status * 10; string ch_path = "Prefabs/Player/" + ch_type; float y1 = 3.0f; float y2 = 3.0f; float y3 = 3.0f; float y4 = 3.0f; for (int i = 1; i <= ch_num; i++) { //Make Relationship GameObject ch_prefab = Instantiate(Resources.Load(ch_path)) as GameObject; ch_prefab.transform.parent = prefab.transform; ch_prefab.name = "Child" + i.ToString(); //Sashimono Making string sashimono_path = "Prefabs/Sashimono/" + busyoId; GameObject sashimono = Instantiate(Resources.Load(sashimono_path)) as GameObject; sashimono.transform.parent = ch_prefab.transform; sashimono.transform.localScale = new Vector2(0.3f, 0.3f); if (ch_type == "YR") { sashimono.transform.localPosition = new Vector2(-1, 0.6f); //Location if (i < 6) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 3, prefab.transform.position.y + y1); y1 = y1 - 1.5f; } else if (5 < i && i < 11) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 6, prefab.transform.position.y + y2); y2 = y2 - 1.5f; } else if (10 < i && i < 16) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 9, prefab.transform.position.y + y3); y3 = y3 - 1.5f; } else if (15 < i && i < 21) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 12, prefab.transform.position.y + y4); y4 = y4 - 1.5f; } } else if (ch_type == "KB") { sashimono.transform.localPosition = new Vector2(-0.5f, 1); //Location if (i < 6) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1); y1 = y1 - 1.5f; } else if (5 < i && i < 11) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2); y2 = y2 - 1.5f; } else if (10 < i && i < 16) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3); y3 = y3 - 1.5f; } else if (15 < i && i < 21) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4); y4 = y4 - 1.5f; } } else if (ch_type == "TP") { sashimono.transform.localPosition = new Vector2(-0.8f, 0.5f); //Location if (i < 6) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1); y1 = y1 - 1.5f; } else if (5 < i && i < 11) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2); y2 = y2 - 1.5f; } else if (10 < i && i < 16) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3); y3 = y3 - 1.5f; } else if (15 < i && i < 21) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4); y4 = y4 - 1.5f; } } else if (ch_type == "YM") { sashimono.transform.localPosition = new Vector2(-0.8f, 0.5f); //Location if (i < 6) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1); y1 = y1 - 1.5f; } else if (5 < i && i < 11) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2); y2 = y2 - 1.5f; } else if (10 < i && i < 16) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3); y3 = y3 - 1.5f; } else if (15 < i && i < 21) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4); y4 = y4 - 1.5f; } } StatusGet sts = new StatusGet(); int atkDfc = (int)sts.getChAtkDfc((int)ch_status, adjHpWithKahou); if (i == 1) { //Child Qty prefab.GetComponent <PlayerHP>().childQty = ch_num; //Child Unit HP float addTotalHei = ch_status; prefab.GetComponent <PlayerHP>().childHP = (int)addTotalHei; //Attack if (ch_type == "YM") { prefab.GetComponent <AttackLong> ().childAttack = atkDfc * 3; prefab.GetComponent <Heisyu> ().atk = atkDfc * 3; } else if (ch_type == "TP") { prefab.GetComponent <AttackLong> ().childAttack = atkDfc * 5; prefab.GetComponent <Heisyu> ().atk = atkDfc * 5; } else { prefab.GetComponent <PlayerAttack> ().attack = prefab.GetComponent <PlayerAttack> ().attack + (ch_num * atkDfc); prefab.GetComponent <Heisyu> ().atk = atkDfc; } //Dfc prefab.GetComponent <PlayerHP> ().dfc = prefab.GetComponent <PlayerHP> ().dfc + (ch_num * atkDfc); prefab.GetComponent <Heisyu> ().dfc = atkDfc; } } }