Example #1
0
    public int heiryokuCalc(int kuni)
    {
        GameObject targetKuni    = GameObject.Find("KuniIconView");
        int        enemyTotalHei = 0;

        if (targetKuni.transform.FindChild(kuni.ToString()))
        {
            SendParam sendParam     = targetKuni.transform.FindChild(kuni.ToString()).GetComponent <SendParam> ();
            int       daimyoBusyoId = sendParam.daimyoBusyoId;
            int       busyoLv       = sendParam.busyoLv;
            int       busyoQty      = sendParam.busyoQty;
            int       butaiLv       = sendParam.butaiLv;
            int       butaiQty      = sendParam.butaiQty;


            if (daimyoBusyoId != 0)
            {
                StatusGet sts      = new StatusGet();
                int       hp       = sts.getHp(daimyoBusyoId, busyoLv);
                int       hpResult = hp * 100 * busyoQty;
                string    type     = sts.getHeisyu(daimyoBusyoId);
                int       chHp     = sts.getChHp(type, butaiLv, hp);
                chHp          = chHp * butaiQty * busyoQty * 10;
                enemyTotalHei = hpResult + chHp;
            }
        }
        return(enemyTotalHei);
    }
Example #2
0
    public int getStsAndMakeInstance(int jinkei, int mapId, float rainMinusRatio, float snowMinusRatio)
    {
        //Get Status
        string map     = jinkei.ToString() + "map" + mapId;
        int    busyoId = PlayerPrefs.GetInt(map);

        string busyoString = busyoId.ToString();
        int    lv          = PlayerPrefs.GetInt(busyoString);

        StatusGet    sts         = new StatusGet();
        BusyoInfoGet busyoInfo   = new BusyoInfoGet();
        int          shipId      = busyoInfo.getShipId(busyoId);
        int          hp          = sts.getHp(busyoId, lv);
        int          atk         = sts.getAtk(busyoId, lv);
        int          dfc         = sts.getDfc(busyoId, lv);
        int          spd         = sts.getSpd(busyoId, lv);
        string       busyoName   = sts.getBusyoName(busyoId);
        ArrayList    senpouArray = sts.getSenpou(busyoId, false);

        //Make Average Senpou Lv
        totalSenpouLv = totalSenpouLv + (int)senpouArray[8];

        //Weather Minus
        if (rainMinusRatio != 0 || snowMinusRatio != 0)
        {
            float tmp = (float)spd * 0.5f;
            if (tmp < 1)
            {
                tmp = 1;
            }
            spd = Mathf.FloorToInt(tmp);
        }

        //Soudaisyo
        if (busyoId == soudaisyo)
        {
            soudaisyoHp  = hp;
            soudaisyoAtk = atk;
            soudaisyoDfc = dfc;
            soudaisyoSpd = spd / 10;
        }

        //Boubi
        int boubi = 0;

        if (activeStageId == 0)
        {
            //Passive
            boubi = PlayerPrefs.GetInt("activeBoubi", 0);
        }

        //View Object & pass status to it.
        PlayerInstance inst = new PlayerInstance();

        inst.makeKaisenInstance(busyoId, shipId, mapId, hp, atk, dfc, spd, senpouArray, busyoName, soudaisyo, boubi, false, 0, 0);

        return(busyoId);
    }
Example #3
0
    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);
    }
Example #4
0
    public int getHei(int busyoId, int activeBusyoLv, int activeButaiQty, int activeButaiLv)
    {
        int hei = 0;

        StatusGet    sts        = new StatusGet();
        BusyoInfoGet info       = new BusyoInfoGet();
        string       TaisyoType = info.getHeisyu(busyoId);
        int          hp         = sts.getHp(busyoId, activeBusyoLv);

        hp = hp * 100;

        EnemyInstance enemyIns = new EnemyInstance();
        int           chldHp   = activeButaiQty * enemyIns.getChildStatus(activeButaiLv, TaisyoType, 0);

        hei = hp + chldHp;

        return(hei);
    }
Example #5
0
	public void createSenpouStatusView(string busyoId){
		StatusGet sts = new StatusGet();
		ArrayList senpouArray = sts.getSenpou(int.Parse(busyoId));

		int senpouId = (int)senpouArray[0];
		string senpouTyp = senpouArray[1].ToString();
		string senpouName = senpouArray[2].ToString();
		string senpouExp = senpouArray[3].ToString();
		float senpouEach = (float)senpouArray[4];
		float senpouRatio = (float)senpouArray[5];
		float senpouTerm = (float)senpouArray[6];
		int senpouStatus = (int)senpouArray[7];
		int senpouLv = (int)senpouArray[8];


		//Kahou Adjustment
		KahouStatusGet kahouSts = new KahouStatusGet ();
		string[] KahouSenpouArray =kahouSts.getKahouForSenpou (busyoId,senpouStatus);
		string kahouTyp = KahouSenpouArray [0];
		string adjSenpouStatus = senpouStatus.ToString();

		if (kahouTyp != null) {
			if (kahouTyp == "Attack") {
				int kahouStatus = int.Parse (KahouSenpouArray [1]);
				adjSenpouStatus = adjSenpouStatus + "(+" + kahouStatus + ")";
			} else {
				Debug.Log ("Not Yet except for Attack");
			}
		}

		//Explanation Modification
		senpouExp = senpouExp.Replace("A", adjSenpouStatus);
		senpouExp = senpouExp.Replace("B", senpouEach.ToString());
		senpouExp = senpouExp.Replace("C", senpouRatio.ToString());
		senpouExp = senpouExp.Replace("D", senpouTerm.ToString());

		//Fill fields by got Senpou Value
		GameObject.Find ("SenpouValue").GetComponent<Text> ().text = senpouName;
		GameObject.Find ("SenpouLvValue").GetComponent<Text> ().text = senpouLv.ToString();
		GameObject.Find ("SenpouExpValue").GetComponent<Text> ().text = senpouExp;


	}
Example #6
0
	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;
		
	}
Example #7
0
    public void createSenpouStatusView(string busyoId)
    {
        StatusGet sts         = new StatusGet();
        ArrayList senpouArray = sts.getOriginalSenpou(int.Parse(busyoId), false);

        int    senpouId     = (int)senpouArray[0];
        string senpouTyp    = senpouArray[1].ToString();
        string senpouName   = senpouArray[2].ToString();
        string senpouExp    = senpouArray[3].ToString();
        float  senpouEach   = (float)senpouArray[4];
        float  senpouRatio  = (float)senpouArray[5];
        float  senpouTerm   = (float)senpouArray[6];
        int    senpouStatus = (int)senpouArray[7];
        int    senpouLv     = (int)senpouArray[8];

        //Kahou Adjustment
        KahouStatusGet kahouSts = new KahouStatusGet();

        string[] KahouSenpouArray = kahouSts.getKahouForSenpou(busyoId, senpouStatus);
        string   kahouTyp         = KahouSenpouArray [0];
        string   adjSenpouStatus  = senpouStatus.ToString();

        if (kahouTyp != null)
        {
            if (kahouTyp == "Attack")
            {
                int kahouStatus = int.Parse(KahouSenpouArray [1]);
                adjSenpouStatus = adjSenpouStatus + "<color=#35d74bFF>(+" + kahouStatus.ToString() + ")</color>";
            }
            else
            {
                Debug.Log("Not Yet except for Attack");
            }
        }

        //Explanation Modification
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            senpouExp = senpouExp.Replace("ABC", adjSenpouStatus);
            senpouExp = senpouExp.Replace("DEF", senpouEach.ToString());
            senpouExp = senpouExp.Replace("GHI", senpouRatio.ToString());
            senpouExp = senpouExp.Replace("JKL", senpouTerm.ToString());
        }
        else
        {
            senpouExp = senpouExp.Replace("A", adjSenpouStatus);
            senpouExp = senpouExp.Replace("B", senpouEach.ToString());
            senpouExp = senpouExp.Replace("C", senpouRatio.ToString());
            senpouExp = senpouExp.Replace("D", senpouTerm.ToString());
        }
        //Fill fields by got Senpou Value
        GameObject.Find("SenpouValue").GetComponent <Text> ().text    = senpouName;
        GameObject.Find("SenpouLvValue").GetComponent <Text> ().text  = senpouLv.ToString();
        GameObject.Find("SenpouExpValue").GetComponent <Text> ().text = senpouExp;


        GameObject btn = GameObject.Find("SenpouStatus").transform.FindChild("ButtonHeihousyo").gameObject;

        if (senpouLv < 20)
        {
            btn.GetComponent <Image> ().color = OKClorBtn;
            btn.transform.FindChild("Text").GetComponent <Text> ().color = OKClorTxt;
            btn.GetComponent <Button>().enabled = true;
        }
        else
        {
            btn.GetComponent <Image> ().color = NGClorBtn;
            btn.transform.FindChild("Text").GetComponent <Text> ().color = NGClorTxt;
            btn.GetComponent <Button>().enabled = false;
        }
    }
Example #8
0
	public void enemyEngunInstance(string enemyEngunList){
		
		List<string> daimyoEnguniList = new List<string> ();
		char[] delimiterChars = {':'};
		char[] delimiterChars2 = {'-'};
		if(enemyEngunList.Contains(":")){
			daimyoEnguniList = new List<string> (enemyEngunList.Split (delimiterChars));
		}else{
			daimyoEnguniList.Add(enemyEngunList);
		}
		
		for(int i=0; i<daimyoEnguniList.Count; i++){
			string daimyoEngunString = daimyoEnguniList[i];
			List<string> unitEnguniList = new List<string> ();
			unitEnguniList = new List<string> (daimyoEngunString.Split (delimiterChars2));
			int busyoId = int.Parse(unitEnguniList[0]);
			if(busyoId!=0){
				int busyoLv = int.Parse(unitEnguniList[1]);
				int butaiQty = int.Parse(unitEnguniList[2]);
				int butaiLv = int.Parse(unitEnguniList[3]);
				
				StatusGet sts = new StatusGet ();
				int hp = sts.getHp (busyoId, busyoLv);
				int atk = sts.getAtk (busyoId, busyoLv);
				int dfc = sts.getDfc (busyoId, busyoLv);
				int spd = sts.getSpd (busyoId, busyoLv);
				string busyoName = sts.getBusyoName (busyoId);
				ArrayList senpouArray = sts.getSenpou (busyoId);
				
				//View Object & pass status to it. 
				EnemyInstance inst = new EnemyInstance ();
				BusyoInfoGet info = new BusyoInfoGet ();
				string ch_type = info.getHeisyu (busyoId);
				int mapId = 22;

				inst.makeInstance(mapId, busyoId, butaiLv, ch_type, butaiQty, hp, atk, dfc, spd, busyoName, 0, false);
			}
		}
		Message msg = new Message ();
		string text = "敵軍の援軍が到着しましたぞ!";
		msg.makeKassenMessage (text);
		
		
	}
Example #9
0
    public void GetPlayerSenryoku(string busyoId)
    {
        //Parent
        int lv = PlayerPrefs.GetInt (busyoId);
        StatusGet sts = new StatusGet ();
        int hp = sts.getHp (int.Parse (busyoId), lv);
        int atk = sts.getAtk (int.Parse (busyoId), lv);
        int dfc = sts.getDfc (int.Parse (busyoId), lv);
        int spd = sts.getSpd (int.Parse (busyoId), lv);

        int adjHp = hp * 100;
        int adjAtk = atk * 10;
        int adjDfc = dfc * 10;

        KahouStatusGet kahouSts = new KahouStatusGet ();
        string[] KahouStatusArray =kahouSts.getKahouForStatus (busyoId,adjHp,adjAtk,adjDfc,spd);
        int totalBusyoHp =0;
        int totalBusyoAtk =0;
        int totalBusyoDfc =0;

        for(int i=0;i<KahouStatusArray.Length;i++){
            string status = KahouStatusArray[i];

            if(i==0){
                //Attack
                totalBusyoAtk = adjAtk + int.Parse(status);

            }else if(i==1){
                //HP
                totalBusyoHp = adjHp + int.Parse(status);

            }else if(i==2){
                //DFC
                totalBusyoDfc = adjDfc + int.Parse(status);

            }
        }

        //Child
        string heiId = "hei" + busyoId.ToString ();
        string chParam = PlayerPrefs.GetString (heiId, "0");

        char[] delimiterChars = {':'};
        string[] ch_list = chParam.Split (delimiterChars);

        int ch_num = int.Parse (ch_list [1]);
        int ch_status = int.Parse (ch_list [3]);
        int totalChldHp = 0;
        int totalChldAtk = 0;
        int totalChldDfc = 0;

        JyosyuHeiryoku jyosyuHei = new JyosyuHeiryoku ();
        int addHei = jyosyuHei.GetJyosyuHeiryoku (busyoId.ToString());

        totalChldHp = (ch_status * 10 + addHei) * ch_num;
        totalChldAtk = (ch_status + totalBusyoHp/200) * ch_num;
        totalChldDfc = (ch_status + totalBusyoHp/200) * ch_num;

        //Set value
        totalHp = totalBusyoHp + totalChldHp;
        totalAtk = totalBusyoAtk + totalChldAtk;
        totalDfc = totalBusyoDfc + totalChldDfc;
    }
Example #10
0
	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;

		//Senpou Script Parametor
		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];

		/*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);

		//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);
			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 = "Prefabs/BusyoDtl/BusyoDtlPlayer";
		GameObject dtl = Instantiate(Resources.Load (dtlPath)) as GameObject;
		dtl.transform.parent = prefab.transform;
		
		//Name
		GameObject nameLabel = dtl.transform.FindChild("NameLabel").gameObject;
		nameLabel.GetComponent<TextMesh> ().text = busyoName;
		
		//HP Bar
		GameObject minHpBar = dtl.transform.FindChild("MinHpBar").gameObject;
		minHpBar.GetComponent<BusyoHPBar>().initLife = adjHp + int.Parse(KahouStatusArray[1]) + Mathf.FloorToInt (addHpByKanni);


		//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 (-40, -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;

		}

		int adjHpWithKahou = adjHp + int.Parse(KahouStatusArray[1]) + Mathf.FloorToInt (addHpByKanni);
		prefab.GetComponent<PlayerHP> ().life = adjHpWithKahou;

		if (prefab.GetComponent<PlayerAttack> ()) {
			prefab.GetComponent<PlayerAttack> ().attack = adjAtk + int.Parse(KahouStatusArray[0]) + Mathf.FloorToInt (addAtkByKanni);
			prefab.GetComponent<Homing> ().speed = spd + int.Parse(KahouStatusArray[3]);
		} 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<HomingLong> ().speed = spd + int.Parse(KahouStatusArray[3]);
		}

		prefab.GetComponent<PlayerHP>().dfc = adjDfc + int.Parse(KahouStatusArray[2]) + Mathf.FloorToInt (addDfcByKanni) + boubi;



		//Soudaisyo
		if (busyoId == soudaisyo) {
			prefab.GetComponent<PlayerHP> ().taisyo = true;
		}


		/*Child Instantiate*/
		//set child object
		string heiId = "hei" + busyoId.ToString();
		string chParam = PlayerPrefs.GetString(heiId,"0");

		char[] delimiterChars = {':'};
		string[] ch_list = chParam.Split(delimiterChars);

		string ch_type = ch_list[0];
		int ch_num = int.Parse (ch_list[1]);
		int ch_lv = int.Parse (ch_list[2]);
		float ch_status = float.Parse (ch_list[3]);
		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 = ch_prefab.name + "_" + prefab.name;

			//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;
				}
			}


			//Jyosyu Handling
			JyosyuHeiryoku jyosyuHei = new JyosyuHeiryoku ();
			float addHei = (float)jyosyuHei.GetJyosyuHeiryoku (busyoId.ToString());
			float addTotalHei = ch_status + addHei;

			StatusGet sts = new StatusGet();
			int atkDfc = (int)sts.getChAtkDfc((int)ch_status, adjHpWithKahou);

			ch_prefab.GetComponent<PlayerHP>().life = addTotalHei;
			if(ch_prefab.GetComponent<PlayerAttack> ()){
				ch_prefab.GetComponent<PlayerAttack> ().attack = atkDfc;
			}else{
				if (ch_type == "TP") {
					ch_prefab.GetComponent<AttackLong> ().attack = atkDfc * 5;
				} else if (ch_type == "YM") {
					ch_prefab.GetComponent<AttackLong> ().attack = atkDfc * 3;
				}
			}
			ch_prefab.GetComponent<PlayerHP>().dfc = atkDfc;
		}

	}
Example #11
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();
        audioSources [0].Play();

        //Common
        string busyoName = GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyoName;
        string busyoId   = GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyo;

        BusyoStatusButton pop = new BusyoStatusButton();

        pop.commonPopup(22);
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            GameObject.Find("popText").GetComponent <Text> ().text = "Give Skillbook";
        }
        else
        {
            GameObject.Find("popText").GetComponent <Text>().text = "秘伝書授与";
        }
        //Busyo View
        string     path  = "Prefabs/Player/Unit/BusyoUnit";
        GameObject Busyo = Instantiate(Resources.Load(path)) as GameObject;

        Busyo.name = busyoId.ToString();
        Busyo.transform.SetParent(GameObject.Find("board(Clone)").transform);
        Busyo.transform.localScale = new Vector2(3, 3);
        Busyo.GetComponent <DragHandler>().enabled = false;
        RectTransform busyo_transform = Busyo.GetComponent <RectTransform>();

        busyo_transform.anchoredPosition = new Vector3(300, 350, 0);
        busyo_transform.sizeDelta        = new Vector2(100, 100);

        //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.anchoredPosition = 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.anchoredPosition     = new Vector3(20, -50, 0);
        rank_transform.sizeDelta            = new Vector2(200, 200);
        rank.GetComponent <Text>().fontSize = 200;

        //Hidensyo
        string     hidensyoPath = "Prefabs/Busyo/Hidensyo";
        GameObject hidensyo     = Instantiate(Resources.Load(hidensyoPath)) as GameObject;

        hidensyo.transform.SetParent(GameObject.Find("board(Clone)").transform);
        hidensyo.transform.localScale = new Vector2(1, 1);
        RectTransform hidensyo_transform = hidensyo.GetComponent <RectTransform>();

        hidensyo_transform.anchoredPosition = new Vector3(0, 0, 0);
        hidensyo.name = "Hidensyo";

        //Senpou Detail
        StatusGet sts         = new StatusGet();
        ArrayList senpouArray = sts.getSenpou(int.Parse(busyoId), false);

        int senpouId = (int)senpouArray[0];

        GameObject.Find("SenpouNameValue").GetComponent <Text>().text = senpouArray[2].ToString();
        int senpouLv = (int)senpouArray[8];

        GameObject.Find("LvFrom").GetComponent <Text>().text = senpouLv.ToString();
        int nextLv = senpouLv + 1;

        GameObject.Find("LvTo").GetComponent <Text>().text = nextLv.ToString();

        //Get Next Senpou
        List <string> senpouList = getSenpouNextLv(senpouId, nextLv);

        string senpouExp    = senpouArray[3].ToString();
        float  senpouEach   = (float)senpouArray[4];
        float  senpouRatio  = (float)senpouArray[5];
        float  senpouTerm   = (float)senpouArray[6];
        int    senpouStatus = (int)senpouArray[7];

        int    diff            = int.Parse(senpouList [0]) - senpouStatus;
        string adjSenpouStatus = senpouStatus.ToString() + "<color=#35d74bFF>" + "(+" + diff + ")" + "</color>";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            senpouExp = senpouExp.Replace("ABC", adjSenpouStatus);
            senpouExp = senpouExp.Replace("DEF", senpouEach.ToString());
            senpouExp = senpouExp.Replace("GHI", senpouRatio.ToString());
            senpouExp = senpouExp.Replace("JKL", senpouTerm.ToString());
        }
        else
        {
            senpouExp = senpouExp.Replace("A", adjSenpouStatus);
            senpouExp = senpouExp.Replace("B", senpouEach.ToString());
            senpouExp = senpouExp.Replace("C", senpouRatio.ToString());
            senpouExp = senpouExp.Replace("D", senpouTerm.ToString());
        }

        GameObject.Find("PopSenpouExpValue").GetComponent <Text> ().text = senpouExp;
        Text itemText = GameObject.Find("RequiredItemValue").GetComponent <Text> ();

        itemText.text = senpouList[2];

        Image      hImage        = GameObject.Find("HidensyoItem").GetComponent <Image> ();
        Text       hRank         = GameObject.Find("HidensyoRank").GetComponent <Text> ();
        string     senpouType    = senpouList [1];
        Color      shortageColor = new Color(203f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);
        GameObject DoHidensyoObj = GameObject.Find("GiveHidensyo");

        DoHidensyoObj.GetComponent <DoHidensyo> ().requiredItemQty = int.Parse(itemText.text);
        DoHidensyoObj.GetComponent <DoHidensyo> ().busyoId         = busyoId;
        DoHidensyoObj.GetComponent <DoHidensyo> ().nextSenpouLv    = nextLv;

        if (senpouType == "low")
        {
            Color lowColor = new Color(86f / 255f, 87f / 255f, 255f / 255f, 255f / 255f);
            hImage.color = lowColor;
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                hRank.text = "Low";
            }
            else
            {
                hRank.text = "下";
            }
            int hidensyoGeQty = PlayerPrefs.GetInt("hidensyoGe");
            DoHidensyoObj.GetComponent <DoHidensyo>().itemType = senpouType;
            if (hidensyoGeQty < int.Parse(itemText.text))
            {
                itemText.color = shortageColor;
                DoHidensyoObj.GetComponent <DoHidensyo>().requiredItem = false;
            }
        }
        else if (senpouType == "middle")
        {
            Color midColor = new Color(236f / 255f, 93f / 255f, 93f / 255f, 255f / 255f);
            hImage.color = midColor;
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                hRank.text = "Mid";
            }
            else
            {
                hRank.text = "中";
            }
            int hidensyoCyuQty = PlayerPrefs.GetInt("hidensyoCyu");
            DoHidensyoObj.GetComponent <DoHidensyo>().itemType = senpouType;
            if (hidensyoCyuQty < int.Parse(itemText.text))
            {
                itemText.color = shortageColor;
                DoHidensyoObj.GetComponent <DoHidensyo>().requiredItem = false;
            }
        }
        else if (senpouType == "high")
        {
            Color hightColor = new Color(207f / 255f, 232f / 255f, 95f / 255f, 255f / 255f);
            hImage.color = hightColor;
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                hRank.text = "High";
            }
            else
            {
                hRank.text = "上";
            }
            int hidensyoJyoQty = PlayerPrefs.GetInt("hidensyoJyo");
            DoHidensyoObj.GetComponent <DoHidensyo>().itemType = senpouType;
            if (hidensyoJyoQty < int.Parse(itemText.text))
            {
                itemText.color = shortageColor;
                DoHidensyoObj.GetComponent <DoHidensyo>().requiredItem = false;
            }
        }


        Text moneyAmt = GameObject.Find("RequiredMoneyValue").GetComponent <Text> ();

        moneyAmt.text = senpouList[3];
        DoHidensyoObj.GetComponent <DoHidensyo> ().requiredMoneyAmt = int.Parse(moneyAmt.text);

        int money = PlayerPrefs.GetInt("money");

        if (money < int.Parse(moneyAmt.text))
        {
            moneyAmt.color = shortageColor;
            DoHidensyoObj.GetComponent <DoHidensyo>().requiredMoney = false;
        }
    }
Example #12
0
    public void OnClick()
    {
        if (name == "YesButton") {
            /*Tsuihou*/
            //Limit Check
            int myBusyoQty = PlayerPrefs.GetInt("myBusyoQty");

            if (myBusyoQty == 1) {
                //Error
                Message msg = new Message();
                string Text = "御館様、武将を皆追放することは出来ませぬぞ。お家を滅ぼすおつもりか。";
                msg.makeMessage (Text);

            } else {

                //Delete Data

                //myBusyo
                List<string> myBusyo_list = new List<string> ();
                string myBusyoString = PlayerPrefs.GetString ("myBusyo");
                char[] delimiterChars = {','};
                myBusyo_list.AddRange (myBusyoString.Split (delimiterChars));
                myBusyo_list.Remove(busyoId.ToString());
                string newMyBusyoString = "";
                string newOnBusyo = myBusyo_list[0];
                for(int i=0; i<myBusyo_list.Count;i++){
                    newMyBusyoString = newMyBusyoString + myBusyo_list[i] + ",";
                }
                newMyBusyoString = newMyBusyoString.TrimEnd(',');

                //kahou
                List<string> kahou_list = new List<string> ();
                string kahou = "kahou" + busyoId;
                string kahouString = PlayerPrefs.GetString (kahou);
                kahou_list.AddRange(kahouString.Split (delimiterChars));

                string availableBugu = PlayerPrefs.GetString ("availableBugu");
                string availableKabuto = PlayerPrefs.GetString ("availableKabuto");
                string availableGusoku = PlayerPrefs.GetString ("availableGusoku");
                string availableMeiba =  PlayerPrefs.GetString ("availableMeiba");
                string availableCyadougu = PlayerPrefs.GetString ("availableCyadougu");
                string availableHeihousyo = PlayerPrefs.GetString ("availableHeihousyo");
                string availableChishikisyo = PlayerPrefs.GetString ("availableChishikisyo");

                for(int j=0; j<kahou_list.Count;j++){
                    string kahouId = kahou_list[j];

                    if(j==0){
                        //Bugu
                        if(kahouId !="0"){
                            if(availableBugu != "" && availableBugu != null){
                                availableBugu = availableBugu + "," + kahouId;
                            }else{
                                availableBugu = kahouId;
                            }
                        }

                    }else if(j==1){
                        //Kabuto
                        if(kahouId !="0"){
                            if(availableKabuto != "" && availableKabuto != null){
                                availableKabuto = availableKabuto + "," + kahouId;
                            }else{
                                availableKabuto = kahouId;
                            }
                        }

                    }else if(j==2){
                        //Gusoku
                        if(kahouId !="0"){
                            if(availableGusoku != "" && availableGusoku != null){
                                availableGusoku = availableGusoku + "," + kahouId;
                            }else{
                                availableGusoku = kahouId;
                            }
                        }

                    }else if(j==3){
                        //Meiba
                        if(kahouId !="0"){
                            if(availableMeiba != "" && availableMeiba != null){
                                availableMeiba = availableMeiba + "," + kahouId;
                            }else{
                                availableMeiba = kahouId;
                            }
                        }

                    }else if(j==4){
                        //Cyadougu1
                        if(kahouId !="0"){
                            if(availableCyadougu != "" && availableCyadougu != null){
                                availableCyadougu = availableCyadougu + "," + kahouId;
                            }else{
                                availableCyadougu = kahouId;
                            }
                        }

                    }else if(j==5){
                        //Cyadougu2
                        if(kahouId !="0"){
                            if(availableCyadougu != "" && availableCyadougu != null){
                                availableCyadougu = availableCyadougu + "," + kahouId;
                            }else{
                                availableCyadougu = kahouId;
                            }
                        }

                    }else if(j==6){
                        //Heihousyo
                        if(kahouId !="0"){
                            if(availableHeihousyo != "" && availableHeihousyo != null){
                                availableHeihousyo = availableHeihousyo + "," + kahouId;
                            }else{
                                availableHeihousyo = kahouId;
                            }
                        }

                    }else if(j==7){
                        //Chishikisyo
                        if(kahouId !="0"){
                            if(availableChishikisyo != "" && availableChishikisyo != null){
                                availableChishikisyo = availableChishikisyo + "," + kahouId;
                            }else{
                                availableChishikisyo = kahouId;
                            }
                        }
                    }
                }
                //OK
                PlayerPrefs.SetString("myBusyo",newMyBusyoString);
                PlayerPrefs.DeleteKey(busyoId.ToString());
                string hei = "hei" + busyoId;
                PlayerPrefs.DeleteKey(hei);
                string senpou = "senpou" + busyoId;
                PlayerPrefs.DeleteKey(senpou);
                string koudou = "kondou" + busyoId;
                PlayerPrefs.DeleteKey(koudou);
                PlayerPrefs.SetString ("availableBugu",availableBugu);
                PlayerPrefs.SetString ("availableKabuto",availableKabuto);
                PlayerPrefs.SetString ("availableGusoku",availableGusoku);
                PlayerPrefs.SetString ("availableMeiba",availableMeiba);
                PlayerPrefs.SetString ("availableCyadougu",availableCyadougu);
                PlayerPrefs.SetString ("availableHeihousyo",availableHeihousyo);
                PlayerPrefs.SetString ("availableChishikisyo",availableChishikisyo);
                PlayerPrefs.DeleteKey(kahou);
                string exp = "exp" + busyoId;
                PlayerPrefs.DeleteKey(exp);

                //jinkei 1map1 ~ 4map25
                int oyaId = 1;
                for(int k=oyaId; k<5; k++){
                    int koId = 1;

                    for(int l=koId; l<26; l++){
                        string mapKey = k.ToString() + "map" + l.ToString();
                        int mapBusyo = PlayerPrefs.GetInt (mapKey);

                        if(mapBusyo == busyoId){
                            //Delete
                            PlayerPrefs.DeleteKey(mapKey);
                        }
                    }
                }
                myBusyoQty = myBusyoQty - 1;
                PlayerPrefs.SetInt("myBusyoQty",myBusyoQty);
                PlayerPrefs.Flush();

                //Back & Update
                Destroy(GameObject.Find("TsuihouConfirm"));
                Destroy(GameObject.Find("Back(Clone)"));

                MessageBusyo msg = new MessageBusyo();
                string tsuihouText = busyoName + "を追放しました。";
                string type = "tsuihou";
                msg.makeMessage(tsuihouText,busyoId, type);

                //Now On Busyo Mod.
                GameObject.Find ("GameScene").GetComponent<NowOnBusyo>().OnBusyo = newOnBusyo;
                StatusGet sts = new StatusGet();
                GameObject.Find ("GameScene").GetComponent<NowOnBusyo>().OnBusyoName = sts.getBusyoName(int.Parse(newOnBusyo));

                /*Initialization*/
                //BusyoView
                RonkouScene ronkou = new RonkouScene();
                //Delete
                foreach ( Transform n in GameObject.Find("BusyoView").transform ){
                    //Busyo Serihu
                    GameObject.Destroy(n.gameObject);
                }
                //Create
                ronkou.createBusyoView(newOnBusyo.ToString());

                //BusyoStatus
                ronkou.createBusyoStatusView(newOnBusyo.ToString());

                //Scroll View
                //Delete
                foreach ( Transform n in GameObject.Find("Content").transform ){
                    GameObject.Destroy(n.gameObject);
                }

                //Create
                ArrayList myBusyoList = new ArrayList();
                GameObject mainController = GameObject.Find ("GameScene");
                string minBusyoId = "";
                minBusyoId = ronkou.createScrollView(myBusyoList,minBusyoId,mainController);
            }

        }else if(name == "NoButton"){
            //Back
            Destroy(GameObject.Find("TsuihouConfirm"));
            Destroy(GameObject.Find("Back(Clone)"));
        }
    }
Example #13
0
	public void GetPlayerSenryoku(string busyoId){

		//Parent
		lv = PlayerPrefs.GetInt (busyoId);
		StatusGet sts = new StatusGet ();
		int hp = sts.getHp (int.Parse (busyoId), lv);
		int atk = sts.getAtk (int.Parse (busyoId), lv);
		int dfc = sts.getDfc (int.Parse (busyoId), lv);
		int spd = sts.getSpd (int.Parse (busyoId), lv);
		
		int adjHp = hp * 100;
		int adjAtk = atk * 10;
		int adjDfc = dfc * 10;
		
		KahouStatusGet kahouSts = new KahouStatusGet ();
		string[] KahouStatusArray =kahouSts.getKahouForStatus (busyoId,adjHp,adjAtk,adjDfc,spd);
		int totalBusyoHp =0;
		int totalBusyoAtk =0;
		int totalBusyoDfc =0;


		string kanniTmp = "kanni" + busyoId;
		float addAtkByKanni = 0;
		float addHpByKanni = 0;
		float addDfcByKanni = 0;

		if (PlayerPrefs.HasKey (kanniTmp)) {
			int kanniId = PlayerPrefs.GetInt (kanniTmp);
			Kanni kanni = new Kanni ();

			//Status
			string kanniTarget = kanni.getEffectTarget(kanniId);
			int effect = kanni.getEffect(kanniId);
			if(kanniTarget=="atk"){
				addAtkByKanni = ((float)adjAtk * (float)effect)/100;
			}else if(kanniTarget=="hp"){
				addHpByKanni = ((float)adjHp * (float)effect)/100;
			}else if(kanniTarget=="dfc"){
				addDfcByKanni = ((float)adjDfc * (float)effect)/100;
			}
		}

		totalBusyoAtk = adjAtk + int.Parse(KahouStatusArray[0]) + Mathf.FloorToInt (addAtkByKanni);
		totalBusyoHp = adjHp + int.Parse(KahouStatusArray[1]) + Mathf.FloorToInt (addHpByKanni);
		totalBusyoDfc = adjDfc + int.Parse(KahouStatusArray[2]) + Mathf.FloorToInt (addDfcByKanni);



		//Child
		string heiId = "hei" + busyoId.ToString ();
		string chParam = PlayerPrefs.GetString (heiId, "0");
		
		char[] delimiterChars = {':'};
		string[] ch_list = chParam.Split (delimiterChars);
		
		int ch_num = int.Parse (ch_list [1]);
		chlv = int.Parse (ch_list [2]);
		int ch_status = int.Parse (ch_list [3]);
		int totalChldHp = 0;
		int totalChldAtk = 0;
		int totalChldDfc = 0;

		ch_status = ch_status * 10;
		int atkDfc = (int)sts.getChAtkDfc(ch_status, totalBusyoHp);
		JyosyuHeiryoku jyosyuHei = new JyosyuHeiryoku ();
		int addHei = jyosyuHei.GetJyosyuHeiryoku (busyoId.ToString());

		totalChldHp = ch_status * ch_num;
		totalChldAtk = atkDfc * ch_num;
		totalChldDfc = atkDfc * ch_num;
		
		//Set value
		totalHp = totalBusyoHp + totalChldHp;
		totalAtk = totalBusyoAtk + totalChldAtk;
		totalDfc = totalBusyoDfc + totalChldDfc;

	}
Example #14
0
    public void createSenpouStatusView(string busyoId)
    {
        StatusGet sts = new StatusGet();
        ArrayList senpouArray = sts.getSenpou(int.Parse(busyoId));

        int senpouId = (int)senpouArray[0];
        string senpouTyp = senpouArray[1].ToString();
        string senpouName = senpouArray[2].ToString();
        string senpouExp = senpouArray[3].ToString();
        float senpouEach = (float)senpouArray[4];
        float senpouRatio = (float)senpouArray[5];
        float senpouTerm = (float)senpouArray[6];
        int senpouStatus = (int)senpouArray[7];
        int senpouLv = (int)senpouArray[8];

        //Kahou Adjustment
        KahouStatusGet kahouSts = new KahouStatusGet ();
        string[] KahouSenpouArray =kahouSts.getKahouForSenpou (busyoId,senpouStatus);
        string kahouTyp = KahouSenpouArray [0];
        string adjSenpouStatus = senpouStatus.ToString();

        if (kahouTyp != null) {
            if (kahouTyp == "Attack") {
                int kahouStatus = int.Parse (KahouSenpouArray [1]);
                adjSenpouStatus = adjSenpouStatus + "(+" + kahouStatus + ")";
            } else {
                Debug.Log ("Not Yet except for Attack");
            }
        }

        //Explanation Modification
        senpouExp = senpouExp.Replace("A", adjSenpouStatus);
        senpouExp = senpouExp.Replace("B", senpouEach.ToString());
        senpouExp = senpouExp.Replace("C", senpouRatio.ToString());
        senpouExp = senpouExp.Replace("D", senpouTerm.ToString());

        //Fill fields by got Senpou Value
        GameObject.Find ("SenpouValue").GetComponent<Text> ().text = senpouName;
        GameObject.Find ("SenpouLvValue").GetComponent<Text> ().text = senpouLv.ToString();
        GameObject.Find ("SenpouExpValue").GetComponent<Text> ().text = senpouExp;

        //Fill Etoku Koudou Tokusei
        //Active : new Color (255f/255f, 206f/255f, 0f/255f, 221f/255f);
        //Unactive 1414317D
        string temp = "koudou" + busyoId;
        string koudouParam = PlayerPrefs.GetString (temp);
        char[] delimiterChars = {','};
        string[] koudou_list = koudouParam.Split (delimiterChars);

        //Initialize color
        Color activeColor = new Color (255f / 255f, 206f / 255f, 0f / 255f, 221f / 255f);
        Color nonActiveColor = new Color (21f / 255f, 21f / 255f, 49f / 255f, 125f / 255f);
        Color activeTxtColor = new Color (229f / 255f, 228f / 255f, 188f / 255f, 221f / 255f);
        Color nonActiveTxtColor = new Color (112f / 255f, 112f / 255f, 112f / 255f, 255f / 255f);

        GameObject.Find ("KoudouHudou").GetComponent<Image> ().color = nonActiveColor;
        GameObject.Find ("KoudouTouhi").GetComponent<Image> ().color = nonActiveColor;
        GameObject.Find ("KoudouCyuusei").GetComponent<Image> ().color = nonActiveColor;
        GameObject.Find ("KoudouYT").GetComponent<Image> ().color = nonActiveColor;
        GameObject.Find ("KoudouSutegamari").GetComponent<Image> ().color = nonActiveColor;

        GameObject.Find ("HudouText").GetComponent<Text> ().color = nonActiveTxtColor;
        GameObject.Find ("TouhiText").GetComponent<Text> ().color = nonActiveTxtColor;
        GameObject.Find ("CyuuseiText").GetComponent<Text> ().color = nonActiveTxtColor;
        GameObject.Find ("YTText").GetComponent<Text> ().color = nonActiveTxtColor;
        GameObject.Find ("SutegamariText").GetComponent<Text> ().color = nonActiveTxtColor;

        //1:平攻め,2:不動,3:逃避,4忠誠:,5:弓鉄砲殲滅,6:ステガマリ
        for(int i =0; i<koudou_list.Length; i++){
            string koudouId = koudou_list[i].ToString();

            if(koudouId == "2"){
                GameObject.Find ("KoudouHudou").GetComponent<Image> ().color = activeColor;
                GameObject.Find ("HudouText").GetComponent<Text> ().color = activeTxtColor;

            }else if(koudouId == "3"){
                GameObject.Find ("KoudouTouhi").GetComponent<Image> ().color = activeColor;
                GameObject.Find ("TouhiText").GetComponent<Text> ().color = activeTxtColor;

            }else if(koudouId == "4"){
                GameObject.Find ("KoudouCyuusei").GetComponent<Image> ().color = activeColor;
                GameObject.Find ("CyuuseiText").GetComponent<Text> ().color = activeTxtColor;

            }else if(koudouId == "5"){
                GameObject.Find ("KoudouYT").GetComponent<Image> ().color = activeColor;
                GameObject.Find ("YTText").GetComponent<Text> ().color = activeTxtColor;

            }else if(koudouId == "6"){
                GameObject.Find ("KoudouSutegamari").GetComponent<Image> ().color = activeColor;
                GameObject.Find ("SutegamariText").GetComponent<Text> ().color = activeTxtColor;
            }
        }
    }
Example #15
0
    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;
            }
        }
    }
Example #16
0
    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);
            }
        }
    }
Example #17
0
    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);
    }
Example #18
0
    public void OnClick()
    {
        MainStageController MainStageController = GameObject.Find("GameController").GetComponent <MainStageController>();

        //SE
        AudioSource sound = GameObject.Find("SEController").GetComponent <AudioSource> ();

        sound.PlayOneShot(sound.clip);

        //Initialization
        totalMoney   = 0;
        kozanMoney   = 0;
        totalHyourou = 0;
        totalYRL     = 0;
        totalKBL     = 0;
        totalYML     = 0;
        totalTPL     = 0;
        totalYRM     = 0;
        totalKBM     = 0;
        totalYMM     = 0;
        totalTPM     = 0;
        totalYRH     = 0;
        totalKBH     = 0;
        totalYMH     = 0;
        totalTPH     = 0;
        totalSNBL    = 0;
        totalSNBM    = 0;
        totalSNBH    = 0;

        /*Popup*/
        string     backPath = "Prefabs/Busyo/back";
        GameObject back     = Instantiate(Resources.Load(backPath)) as GameObject;

        back.transform.SetParent(GameObject.Find("Map").transform);
        back.transform.localScale = new Vector2(1, 1);
        RectTransform backTransform = back.GetComponent <RectTransform> ();

        backTransform.anchoredPosition = new Vector3(0, 0, 0);

        //Popup Screen
        string     popupPath = "Prefabs/Busyo/board";
        GameObject popup     = Instantiate(Resources.Load(popupPath)) as GameObject;

        popup.transform.SetParent(GameObject.Find("Map").transform);
        popup.transform.localScale = new Vector2(1, 1);
        RectTransform popupTransform = popup.GetComponent <RectTransform> ();

        popupTransform.anchoredPosition = new Vector3(0, 0, 0);
        popup.name = "board";

        //qa
        string     qaPath = "Prefabs/Common/Question";
        GameObject qa     = Instantiate(Resources.Load(qaPath)) as GameObject;

        qa.transform.SetParent(popup.transform);
        qa.transform.localScale = new Vector2(1, 1);
        RectTransform qaTransform = qa.GetComponent <RectTransform> ();

        qaTransform.anchoredPosition = new Vector3(-540, 285, 0);
        qa.name = "qa";
        qa.GetComponent <QA> ().qaId = 2;


        //Pop text
        string     popTextPath = "Prefabs/Busyo/popText";
        GameObject popText     = Instantiate(Resources.Load(popTextPath)) as GameObject;

        popText.transform.SetParent(popup.transform);
        popText.transform.localScale = new Vector2(0.35f, 0.35f);
        RectTransform popTextTransform = popText.GetComponent <RectTransform> ();

        popTextTransform.anchoredPosition = new Vector3(0, 260, 0);
        popText.name = "popText";
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            popText.GetComponent <Text>().text = "Finance";
        }
        else
        {
            popText.GetComponent <Text> ().text = "内政状況";
        }

        //Cyosyu
        string     cyosyuPath = "Prefabs/Cyosyu/CyosyuObj";
        GameObject CyosyuObj  = Instantiate(Resources.Load(cyosyuPath)) as GameObject;

        CyosyuObj.transform.SetParent(popup.transform);
        CyosyuObj.transform.localScale = new Vector2(1, 1);



        string        seiryoku       = PlayerPrefs.GetString("seiryoku");
        List <string> seiryokuList   = new List <string> ();
        List <string> mySeiryokuList = new List <string> ();

        char[] delimiterChars = { ',' };

        seiryokuList = new List <string> (seiryoku.Split(delimiterChars));
        int myDaimyoId = PlayerPrefs.GetInt("myDaimyo");

        //Get my Kuni
        for (int i = 0; i < seiryokuList.Count; i++)
        {
            int seiryokuId = int.Parse(seiryokuList [i]);
            if (seiryokuId == myDaimyoId)
            {
                int kuniId = i + 1;
                mySeiryokuList.Add(kuniId.ToString());
            }
        }


        //Kuni Loop Start
        int naiseiBldg = 0;
        int syogyo     = 0;
        int nogyo      = 0;
        int gunjyu     = 0;
        int ashigaru   = 0;
        int boubi      = 0;
        int bukkyo     = 0;
        int kirisuto   = 0;
        int bunka      = 0;

        //seiryoku loop
        for (int i = 0; i < mySeiryokuList.Count; i++)
        {
            int kuniKozan  = 0;
            int kuniSyogyo = 0;

            int    kuniId      = int.Parse(mySeiryokuList[i]);
            string temp        = "kuni" + mySeiryokuList[i];
            string clearedKuni = PlayerPrefs.GetString(temp);
            //Shiro Qty
            if (clearedKuni != null && clearedKuni != "")
            {
                List <string> shiroList = new List <string>();
                shiroList = new List <string>(clearedKuni.Split(delimiterChars));
                shiro     = shiroList.Count;

                //Kuni Name
                Entity_kuni_mst kuniMst = Resources.Load("Data/kuni_mst") as Entity_kuni_mst;
                kuniName = kuniMst.param[kuniId - 1].kuniName;

                string naiseiTemp   = "naisei" + mySeiryokuList[i];
                string naiseiString = PlayerPrefs.GetString(naiseiTemp);
                if (PlayerPrefs.HasKey(naiseiTemp))
                {
                    List <string> naiseiList = new List <string>();
                    naiseiList = new List <string>(naiseiString.Split(delimiterChars));
                    char[]        delimiterChars2 = { ':' };
                    List <string> deletePanelList = new List <string>();


                    for (int j = 1; j < naiseiList.Count; j++)
                    {
                        List <string> naiseiContentList = new List <string>();
                        naiseiContentList = new List <string>(naiseiList[j].Split(delimiterChars2));


                        if (naiseiContentList[0] != "0")
                        {
                            //Exist
                            Entity_naisei_mst naiseiMst = Resources.Load("Data/naisei_mst") as Entity_naisei_mst;
                            string            type      = naiseiMst.param [int.Parse(naiseiContentList[0])].code;
                            naiseiBldg = naiseiBldg + 1;

                            //Effect by Level
                            List <int>       naiseiEffectList = new List <int>();
                            NaiseiController naisei           = new NaiseiController();
                            naiseiEffectList = naisei.getNaiseiList(type, int.Parse(naiseiContentList[1]));


                            //Status
                            if (type == "shop")
                            {
                                kuniSyogyo = kuniSyogyo + naiseiEffectList[0];
                            }
                            else if (type == "kzn")
                            {
                                kuniKozan = kuniKozan + naiseiEffectList[0];
                            }
                            else if (type == "ta")
                            {
                                nogyo        = nogyo + naiseiEffectList[0];
                                totalHyourou = totalHyourou + naiseiEffectList[0];
                            }
                            else if (type == "yr")
                            {
                                if (int.Parse(naiseiContentList[1]) < 11)
                                {
                                    //Low
                                    gunjyu   = gunjyu + naiseiEffectList[0];
                                    totalYRL = totalYRL + naiseiEffectList[0];
                                }
                                else if (int.Parse(naiseiContentList[1]) < 16)
                                {
                                    //Middle
                                    gunjyu   = gunjyu + naiseiEffectList[0];
                                    totalYRM = totalYRM + naiseiEffectList[0];
                                }
                                else if (15 <= int.Parse(naiseiContentList[1]))
                                {
                                    //High
                                    gunjyu   = gunjyu + naiseiEffectList[0];
                                    totalYRH = totalYRH + naiseiEffectList[0];
                                }
                            }
                            else if (type == "kb")
                            {
                                if (int.Parse(naiseiContentList[1]) < 11)
                                {
                                    //Low
                                    gunjyu   = gunjyu + naiseiEffectList[0];
                                    totalKBL = totalKBL + naiseiEffectList[0];
                                }
                                else if (int.Parse(naiseiContentList[1]) < 16)
                                {
                                    //Middle
                                    gunjyu   = gunjyu + naiseiEffectList[0];
                                    totalKBM = totalKBM + naiseiEffectList[0];
                                }
                                else if (15 <= int.Parse(naiseiContentList[1]))
                                {
                                    //High
                                    gunjyu   = gunjyu + naiseiEffectList[0];
                                    totalKBH = totalKBH + naiseiEffectList[0];
                                }
                            }
                            else if (type == "ym")
                            {
                                if (int.Parse(naiseiContentList[1]) < 11)
                                {
                                    //Low
                                    gunjyu   = gunjyu + naiseiEffectList[0];
                                    totalYML = totalYML + naiseiEffectList[0];
                                }
                                else if (int.Parse(naiseiContentList[1]) < 16)
                                {
                                    //Middle
                                    gunjyu   = gunjyu + naiseiEffectList[0];
                                    totalYMM = totalYMM + naiseiEffectList[0];
                                }
                                else if (15 <= int.Parse(naiseiContentList[1]))
                                {
                                    //High
                                    gunjyu   = gunjyu + naiseiEffectList[0];
                                    totalYMH = totalYMH + naiseiEffectList[0];
                                }
                            }
                            else if (type == "tp")
                            {
                                if (int.Parse(naiseiContentList[1]) < 11)
                                {
                                    //Low
                                    gunjyu   = gunjyu + naiseiEffectList[0];
                                    totalTPL = totalTPL + naiseiEffectList[0];
                                }
                                else if (int.Parse(naiseiContentList[1]) < 16)
                                {
                                    //Middle
                                    gunjyu   = gunjyu + naiseiEffectList[0];
                                    totalTPM = totalTPM + naiseiEffectList[0];
                                }
                                else if (15 <= int.Parse(naiseiContentList[1]))
                                {
                                    //High
                                    gunjyu   = gunjyu + naiseiEffectList[0];
                                    totalTPH = totalTPH + naiseiEffectList[0];
                                }
                            }
                            else if (type == "snb")
                            {
                                if (int.Parse(naiseiContentList[1]) < 11)
                                {
                                    //Low
                                    gunjyu    = gunjyu + naiseiEffectList[0];
                                    totalSNBL = totalSNBL + naiseiEffectList[0];
                                }
                                else if (int.Parse(naiseiContentList[1]) < 16)
                                {
                                    //Middle
                                    gunjyu    = gunjyu + naiseiEffectList[0];
                                    totalSNBM = totalSNBM + naiseiEffectList[0];
                                }
                                else if (15 <= int.Parse(naiseiContentList[1]))
                                {
                                    //High
                                    gunjyu    = gunjyu + naiseiEffectList[0];
                                    totalSNBH = totalSNBH + naiseiEffectList[0];
                                }
                            }
                            else if (type == "trd")
                            {
                                boubi = boubi + naiseiEffectList[0];
                            }
                            else if (type == "nbn")
                            {
                                kirisuto = kirisuto + naiseiEffectList[0];
                            }
                            else if (type == "kgy")
                            {
                                bunka = bunka + naiseiEffectList [0];
                            }
                            else if (type == "bky")
                            {
                                bukkyo = bukkyo + naiseiEffectList [0];
                            }
                            else if (type == "hsy")
                            {
                                ashigaru = ashigaru + naiseiEffectList [0];
                            }
                        }
                    }

                    //Shiro
                    int shiroLv            = int.Parse(naiseiList[0]);
                    NaiseiController naise = new NaiseiController();
                    List <int>       naiseiShiroEffectList = new List <int>();
                    naiseiShiroEffectList = naise.getNaiseiList("shiro", shiroLv);
                    ashigaru = ashigaru + naiseiShiroEffectList[0];
                    boubi    = boubi + naiseiShiroEffectList[0];


                    //Jyosyu Addition
                    string jyosyuTemp = "jyosyu" + kuniId;

                    if (PlayerPrefs.HasKey(jyosyuTemp))
                    {
                        int       jyosyuId  = PlayerPrefs.GetInt(jyosyuTemp);
                        StatusGet sts       = new StatusGet();
                        int       lv        = PlayerPrefs.GetInt(jyosyuId.ToString());
                        float     naiseiSts = (float)sts.getDfc(jyosyuId, lv);

                        float hpSts  = (float)sts.getHp(jyosyuId, lv);
                        float atkSts = (float)sts.getAtk(jyosyuId, lv);

                        float tempKuniSyogyo = (float)kuniSyogyo;
                        tempKuniSyogyo = tempKuniSyogyo + (tempKuniSyogyo * naiseiSts / 200);
                        kuniSyogyo     = (int)tempKuniSyogyo;

                        float tempKuniKozan = (float)kuniKozan;
                        tempKuniKozan = tempKuniKozan + (tempKuniKozan * naiseiSts / 200);
                        kuniKozan     = (int)tempKuniKozan;
                    }
                }
            }
            kozanMoney = kozanMoney + kuniKozan;
            totalMoney = totalMoney + kuniSyogyo;
            syogyo     = syogyo + (kuniKozan * 4 + kuniSyogyo);
        }//Kuni Loop Finish


        /*visualize*/
        //Upper Board
        GameObject spring = CyosyuObj.transform.FindChild("spring").gameObject;

        spring.transform.FindChild("TargetMoney").transform.FindChild("Value").GetComponent <Text>().text = (totalMoney + kozanMoney).ToString();

        GameObject summerWinter = CyosyuObj.transform.FindChild("summerWinter").gameObject;

        summerWinter.transform.FindChild("TargetMoney").transform.FindChild("Value").GetComponent <Text>().text = kozanMoney.ToString();
        GameObject TargetGunjyu = summerWinter.transform.FindChild("TargetGunjyu").gameObject;

        if (totalYRH != 0)
        {
            TargetGunjyu.transform.FindChild("YR").transform.FindChild("CyouheiYRValueH").GetComponent <Text>().text = totalYRH.ToString();
        }
        if (totalYRM != 0)
        {
            TargetGunjyu.transform.FindChild("YR").transform.FindChild("CyouheiYRValueM").GetComponent <Text>().text = totalYRM.ToString();
        }
        if (totalYRL != 0)
        {
            TargetGunjyu.transform.FindChild("YR").transform.FindChild("CyouheiYRValueL").GetComponent <Text>().text = totalYRL.ToString();
        }
        if (totalKBH != 0)
        {
            TargetGunjyu.transform.FindChild("KB").transform.FindChild("CyouheiKBValueH").GetComponent <Text>().text = totalKBH.ToString();
        }
        if (totalKBM != 0)
        {
            TargetGunjyu.transform.FindChild("KB").transform.FindChild("CyouheiKBValueM").GetComponent <Text>().text = totalKBM.ToString();
        }
        if (totalKBL != 0)
        {
            TargetGunjyu.transform.FindChild("KB").transform.FindChild("CyouheiKBValueL").GetComponent <Text>().text = totalKBL.ToString();
        }
        if (totalYMH != 0)
        {
            TargetGunjyu.transform.FindChild("YM").transform.FindChild("CyouheiYMValueH").GetComponent <Text>().text = totalYMH.ToString();
        }
        if (totalYMM != 0)
        {
            TargetGunjyu.transform.FindChild("YM").transform.FindChild("CyouheiYMValueM").GetComponent <Text>().text = totalYMM.ToString();
        }
        if (totalYML != 0)
        {
            TargetGunjyu.transform.FindChild("YM").transform.FindChild("CyouheiYMValueL").GetComponent <Text>().text = totalYML.ToString();
        }
        if (totalTPH != 0)
        {
            TargetGunjyu.transform.FindChild("TP").transform.FindChild("CyouheiTPValueH").GetComponent <Text>().text = totalTPH.ToString();
        }
        if (totalTPM != 0)
        {
            TargetGunjyu.transform.FindChild("TP").transform.FindChild("CyouheiTPValueM").GetComponent <Text>().text = totalTPM.ToString();
        }
        if (totalTPL != 0)
        {
            TargetGunjyu.transform.FindChild("TP").transform.FindChild("CyouheiTPValueL").GetComponent <Text>().text = totalTPL.ToString();
        }
        if (totalSNBH != 0)
        {
            TargetGunjyu.transform.FindChild("SNB").transform.FindChild("SNBValueH").GetComponent <Text>().text = totalSNBH.ToString();
        }
        if (totalSNBM != 0)
        {
            TargetGunjyu.transform.FindChild("SNB").transform.FindChild("SNBValueM").GetComponent <Text>().text = totalSNBM.ToString();
        }
        if (totalSNBL != 0)
        {
            TargetGunjyu.transform.FindChild("SNB").transform.FindChild("SNBValueL").GetComponent <Text>().text = totalSNBL.ToString();
        }

        GameObject autumn = CyosyuObj.transform.FindChild("autumn").gameObject;

        autumn.transform.FindChild("TargetMoney").transform.FindChild("Value").GetComponent <Text>().text   = kozanMoney.ToString();
        autumn.transform.FindChild("TargetHyourou").transform.FindChild("Value").GetComponent <Text>().text = totalHyourou.ToString();

        //Color
        int nowSeason = MainStageController.nowSeason;

        if (nowSeason == 1)
        {
            summerWinter.transform.FindChild("summer").gameObject.AddComponent <TextBlinker>();
        }
        else if (nowSeason == 2)
        {
            autumn.transform.FindChild("autumn").gameObject.AddComponent <TextBlinker>();
        }
        else if (nowSeason == 3)
        {
            summerWinter.transform.FindChild("winter").gameObject.AddComponent <TextBlinker>();
        }
        else if (nowSeason == 4)
        {
            spring.transform.FindChild("spring").gameObject.AddComponent <TextBlinker>();
        }


        //Lower Board
        GameObject status = CyosyuObj.transform.FindChild("statusBack").gameObject;

        //Kamon
        string     imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + myDaimyoId.ToString();
        GameObject kamon     = status.transform.FindChild("Kamon").gameObject;

        kamon.GetComponent <Image> ().sprite =
            Resources.Load(imagePath, typeof(Sprite)) as Sprite;
        if (Application.systemLanguage == SystemLanguage.Japanese)
        {
            kamon.transform.FindChild("Value").GetComponent <Text> ().text = GameObject.Find("DaimyoValue").GetComponent <Text> ().text + "  国状況";
        }
        else
        {
            kamon.transform.FindChild("Value").GetComponent <Text>().text = GameObject.Find("DaimyoValue").GetComponent <Text>().text + " Status";
        }
        //Kuni
        status.transform.FindChild("Shiro").transform.FindChild("No").GetComponent <Text>().text = mySeiryokuList.Count.ToString();

        //Naisei Bldg.
        status.transform.FindChild("Naisei").transform.FindChild("No").GetComponent <Text>().text = (naiseiBldg + mySeiryokuList.Count).ToString();

        //Tabibito
        int tabibitoQty = PlayerPrefs.GetInt("HstTabibito");

        status.transform.FindChild("Tabibito").transform.FindChild("No").GetComponent <Text>().text = tabibitoQty.ToString();

        //Nanbansen
        int nanbansenQty = PlayerPrefs.GetInt("HstNanbansen");

        status.transform.FindChild("Ship").transform.FindChild("No").GetComponent <Text>().text = nanbansenQty.ToString();

        //Syogyo
        status.transform.FindChild("StatusSyogyo").transform.FindChild("SyogyoValue").GetComponent <Text>().text = syogyo.ToString();

        //Nogyo
        status.transform.FindChild("StatusNougyo").transform.FindChild("NougyoValue").GetComponent <Text>().text = nogyo.ToString();

        //Gunjyu
        status.transform.FindChild("StatusGunjyu").transform.FindChild("GunjyuValue").GetComponent <Text>().text = (gunjyu * 2).ToString();

        //Ashigaru
        status.transform.FindChild("StatusAshigaru").transform.FindChild("AshigaruValue").GetComponent <Text>().text = ashigaru.ToString();

        //Boubi
        status.transform.FindChild("StatusBoubi").transform.FindChild("BoubiValue").GetComponent <Text>().text = boubi.ToString();

        //Bukkyo
        status.transform.FindChild("StatusBukkyo").transform.FindChild("BukkyoValue").GetComponent <Text>().text = bukkyo.ToString();

        //Kirisuto
        status.transform.FindChild("StatusKirisuto").transform.FindChild("KirisutoValue").GetComponent <Text>().text = kirisuto.ToString();

        //Bunka
        status.transform.FindChild("StatusBunka").transform.FindChild("BunkaValue").GetComponent <Text>().text = bunka.ToString();

        //tutorial
        if (Application.loadedLevelName == "tutorialMain")
        {
            Destroy(transform.FindChild("point_up").gameObject);
            TutorialController TutorialController = new TutorialController();
            Vector2            vect     = new Vector2(0, 50);
            GameObject         closeObj = popup.transform.FindChild("close").gameObject;
            GameObject         animObj  = TutorialController.SetPointer(closeObj, vect);
            animObj.transform.localScale = new Vector2(120, 120);

            GameObject SubButtonViewLeft = GameObject.Find("SubButtonViewLeft").gameObject;
            GameObject.Find("SeiryokuInfo").transform.SetParent(SubButtonViewLeft.transform);
        }
    }
Example #19
0
    public void Start()
    {
        //Get Temp Kuni Id & Stage Id
        activeKuniId = PlayerPrefs.GetInt ("activeKuniId");
        string temp = "naisei" + activeKuniId.ToString ();

        /*Initial Setting*/
        //Kuni Name & jyosyu
        string title = "";
        string kuniName = PlayerPrefs.GetString ("activeKuniName");

        string jyosyuTemp = "jyosyu" + activeKuniId;

        //Clear Image
        foreach ( Transform n in GameObject.Find ("JyosyuImage").transform){
            GameObject.Destroy(n.gameObject);
        }

        if (PlayerPrefs.HasKey (jyosyuTemp)) {
            //Jyosyu Exist
            jyosyuId = PlayerPrefs.GetInt (jyosyuTemp);
            string busyoPath = "Prefabs/Player/Unit/" + jyosyuId;
            GameObject busyo = Instantiate (Resources.Load (busyoPath)) as GameObject;
            busyo.transform.SetParent (GameObject.Find ("JyosyuImage").transform);
            busyo.transform.localScale = new Vector2 (4, 4);
            busyo.GetComponent<DragHandler>().enabled = false;
            RectTransform busyo_transform = busyo.GetComponent<RectTransform>();
            busyo_transform.anchoredPosition = new Vector3(40,40,0);
            busyo_transform.sizeDelta = new Vector2( 23, 23);

            foreach(Transform n in busyo.transform){
                GameObject.Destroy(n.gameObject);
            }

            StatusGet sts = new StatusGet();
            string jyosyuName = sts.getBusyoName(jyosyuId);
            title = kuniName + "・" + jyosyuName;

            //Ninmei Button
            GameObject btn = GameObject.Find ("Ninmei").gameObject;
            btn.GetComponent<Ninmei>().kaininFlg = true;
            btn.transform.FindChild("NinmeiText").GetComponent<Text>().text = "城主解任";
            btn.GetComponent<Ninmei>().jyosyuId = jyosyuId;
            btn.GetComponent<Ninmei>().jyosyuName = jyosyuName;

        } else {
            //Jyosyu Not Exist
            title = kuniName + "・蔵入地";

            //Ninmei Button
            GameObject btn = GameObject.Find ("Ninmei").gameObject;
            btn.GetComponent<Ninmei>().kaininFlg = false;
            btn.transform.FindChild("NinmeiText").GetComponent<Text>().text = "城主任命";
        }

        GameObject.Find ("StageNameValue").GetComponent<Text> ().text = title;

        //Money
        int money = PlayerPrefs.GetInt("money");
        GameObject.Find ("MoneyValue").GetComponent<Text> ().text = money.ToString();

        //Hyourou
        int hyourou = PlayerPrefs.GetInt("hyourou");
        GameObject.Find ("HyourouCurrentValue").GetComponent<Text> ().text = hyourou.ToString();

        //HyourouMax
        int hyourouMax = PlayerPrefs.GetInt("hyourouMax");
        GameObject.Find ("HyourouMaxValue").GetComponent<Text> ().text = hyourouMax.ToString();

        /*Open Panel*/
        //Clear Previous Panel
        foreach ( Transform n in GameObject.Find ("NaiseiView").transform){
            GameObject.Destroy(n.gameObject);
        }
        //Clear Previous Mask Panel
        foreach ( Transform n in GameObject.Find ("MaskView").transform){
            GameObject.Destroy(n.gameObject);
        }

        //Open Panel & MaskPanel
         		panelByShiro(activeKuniId);
        panelByKuniLv();

        if (PlayerPrefs.HasKey (temp)) {
            /*initial setting*/
            string naiseiString = PlayerPrefs.GetString (temp);
            List<string> naiseiList = new List<string>();
            char[] delimiterChars = {','};
            naiseiList = new List<string>(naiseiString.Split (delimiterChars));

            /*Naisei Bldg Handling*/
            char[] delimiterChars2 = {':'};
            List<string> deletePanelList = new List<string>();
            for(int i=1; i<naiseiList.Count;i++){

                List<string> naiseiContentList = new List<string>();
                naiseiContentList = new List<string>(naiseiList[i].Split (delimiterChars2));

                if(naiseiContentList[0] != "0"){
                    //Exist
                    Entity_naisei_mst naiseiMst = Resources.Load ("Data/naisei_mst") as Entity_naisei_mst;
                    string bldgRank = "";
                    if(int.Parse(naiseiContentList[1])<8){
                        bldgRank = "s";
                    }else if(int.Parse(naiseiContentList[1]) < 15){
                        bldgRank = "m";
                    }else if(15 <= int.Parse(naiseiContentList[1])){
                        bldgRank = "l";
                    }

                    //Add Delete Target
                    deletePanelList.Add(i.ToString());

                    //Make New Panel
                    string type = naiseiMst.param [int.Parse(naiseiContentList[0])].code;
                    string bldg = type + "_" + bldgRank;
                    string bldgPath = "Prefabs/Naisei/Bldg/" + bldg;
                    GameObject bldgObj = Instantiate (Resources.Load (bldgPath)) as GameObject;
                    bldgObj.transform.parent = GameObject.Find ("NaiseiView").transform;
                    bldgObj.transform.localScale = new Vector3 (1, 1, 1);
                    setBldg(bldgObj, i);
                    bldgObj.name = i.ToString();
                    bldgObj.GetComponent<AreaButton>().blank = false;
                    bldgObj.GetComponent<AreaButton>().type = type;
                    bldgObj.GetComponent<AreaButton>().lv = naiseiContentList[1];
                    bldgObj.GetComponent<AreaButton>().naiseiId = int.Parse(naiseiContentList[0]);

                    //Effect by Level
                    List<int> naiseiEffectList = new List<int>();
                    naiseiEffectList = getNaiseiList(type, int.Parse(naiseiContentList[1]));
                    bldgObj.GetComponent<AreaButton>().effect = naiseiEffectList[0];
                    bldgObj.GetComponent<AreaButton>().effectNextLv = naiseiEffectList[1];
                    bldgObj.GetComponent<AreaButton>().moneyNextLv = naiseiEffectList[2];
                    bldgObj.GetComponent<AreaButton>().requiredHyourou =naiseiMst.param [int.Parse(naiseiContentList[0])].hyourou;
                    bldgObj.GetComponent<AreaButton>().naiseiName =naiseiMst.param [int.Parse(naiseiContentList[0])].name;

                    //Status
                    if(type == "shop" || type == "kouzan"){
                        syogyo = syogyo + naiseiEffectList[0];
                    }else if(type == "ta"){
                        nogyo = nogyo + naiseiEffectList[0];
                    }else if(type == "yr" ||type == "kb"||type == "tp" ||type == "ym"){
                        gunjyu = gunjyu + naiseiEffectList[0];
                    }else if(type == "ashigaru"){
                        ashigaru = ashigaru + naiseiEffectList[0];
                    }else if(type == "toride"){
                        boubi = boubi + naiseiEffectList[0];
                    }else{
                        Debug.Log ("Not Yet");
                    }
                }
            }

            //Clear Duplicated Panel
            foreach ( Transform n in GameObject.Find ("NaiseiView").transform){
                if(deletePanelList.Contains(n.name)){
                    if(n.tag == "Area"){
                        GameObject.Destroy(n.gameObject);
                    }
                }
            }

            /*shiro setting*/
            string rank = "";
            if(int.Parse(naiseiList[0])<8){
                rank = "s";
                setShiro(rank, naiseiList[0]);
            }else if(int.Parse(naiseiList[0]) < 15){
                rank = "m";
                setShiro(rank, naiseiList[0]);
            }else if(15 <= int.Parse(naiseiList[0])){
                rank = "l";
                setShiro(rank, naiseiList[0]);
            }

            string maskPath = "Prefabs/Naisei/MaskPanel";
            GameObject maskPanel = Instantiate (Resources.Load (maskPath)) as GameObject;
            maskPanel.transform.parent = GameObject.Find ("MaskView").transform;
            maskPanel.transform.localScale = new Vector3 (1, 1, 1);
            RectTransform maskPanel_transform = maskPanel.GetComponent<RectTransform>();
            maskPanel_transform.anchoredPosition = new Vector2(0,-20);
            maskPanel.name = "shiro_" + rank;

            //Status Handling

            //Status Jyosyu Modification
            if (PlayerPrefs.HasKey (jyosyuTemp)) {
                StatusGet sts = new StatusGet();
                int lv = PlayerPrefs.GetInt (jyosyuId.ToString());
                float naiseiSts = (float)sts.getDfc(jyosyuId,lv);

                float hpSts = (float)sts.getHp(jyosyuId,lv);
                float atkSts = (float)sts.getAtk(jyosyuId,lv);
                float boubiSts = (hpSts + atkSts)/2;

                float tempSyogyo = (float)syogyo;
                tempSyogyo = tempSyogyo + (tempSyogyo * naiseiSts/200);
                float tempNogyo = (float)nogyo;
                tempNogyo = tempNogyo + (tempNogyo * naiseiSts/200);
                float tempBoubi = (float)boubi;
                tempBoubi = tempBoubi + (tempBoubi * naiseiSts/200);

                syogyo = (int)tempSyogyo;
                nogyo = (int)tempNogyo;
                boubi = (int)tempBoubi;

            }

            GameObject.Find("SyogyoValue").GetComponent<Text>().text = syogyo.ToString();
            GameObject.Find("NougyoValue").GetComponent<Text>().text = nogyo.ToString();
            GameObject.Find("GunjyuValue").GetComponent<Text>().text = gunjyu.ToString();
            GameObject.Find("AshigaruValue").GetComponent<Text>().text = ashigaru.ToString();
            GameObject.Find("BoubiValue").GetComponent<Text>().text = boubi.ToString();
            GameObject.Find("BukkyoValue").GetComponent<Text>().text = bukkyo.ToString();
            GameObject.Find("KirisutoValue").GetComponent<Text>().text = kirisuto.ToString();
            GameObject.Find("BunkaValue").GetComponent<Text>().text = bunka.ToString();

        } else {
            //Error
            Debug.Log ("ERROR");
        }
    }
Example #20
0
    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));
    }
Example #21
0
    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);
        }
    }
Example #22
0
	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;
	}
Example #23
0
    /*make engun instance*/
    public void makeEngunInstance(int busyoId, int hp, int atk, int dfc, int spd, ArrayList senpouArray, string busyoName, int ch_num, int ch_lv)
    {
        /*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>());
        }

        //Engun Flg
        prefab.GetComponent <Kunkou> ().engunFlg = true;



        /*Player Status Setting*/
        //parametor setting
        int adjHp  = hp * 100;
        int adjAtk = atk * 10;
        int adjDfc = dfc * 10;

        //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;

        //HP Bar
        GameObject minHpBar = dtl.transform.FindChild("MinHpBar").gameObject;

        minHpBar.GetComponent <BusyoHPBar>().initLife = adjHp;

        //Location by map id
        prefab.transform.position = new Vector2(-20, -16);
        prefab.GetComponent <LineLocation>().nowLine = 5;

        //heisyu
        BusyoInfoGet info    = new BusyoInfoGet();
        string       ch_type = info.getHeisyu(busyoId);

        prefab.GetComponent <PlayerHP> ().life = adjHp;

        //adjust spd
        float adjSpd = (float)spd / 10;


        if (prefab.GetComponent <PlayerAttack> ())
        {
            prefab.GetComponent <PlayerAttack> ().attack = adjAtk;
            prefab.GetComponent <UnitMover> ().speed     = adjSpd;
        }
        else
        {
            if (ch_type == "TP")
            {
                prefab.GetComponent <AttackLong> ().attack = 5 * adjAtk;
            }
            else if (ch_type == "YM")
            {
                prefab.GetComponent <AttackLong> ().attack = 3 * adjAtk;
            }
            prefab.GetComponent <UnitMover> ().speed = adjSpd;
        }
        prefab.GetComponent <PlayerHP>().dfc     = adjDfc;
        prefab.GetComponent <UnitMover>().heisyu = ch_type;

        //SE
        AudioController audio = new AudioController();

        audio.addComponentMoveAttack(prefab, ch_type);



        /*Child Instantiate*/
        //set child object
        Entity_lvch_mst lvMst     = Resources.Load("Data/lvch_mst") as Entity_lvch_mst;
        int             startline = 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" + ch_lv.ToString();
        FieldInfo f      = t.GetField(param);
        int       sts    = (int)f.GetValue(stslst);

        float ch_status = (float)sts;

        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;
                }
            }

            //Status
            if (i == 1)
            {
                //Child Qty
                prefab.GetComponent <PlayerHP>().childQty = ch_num;

                //Child Unit HP
                prefab.GetComponent <PlayerHP>().childHP = (int)ch_status;

                StatusGet stsScript = new StatusGet();
                int       atkDfc    = (int)stsScript.getChAtkDfc((int)ch_status, adjHp);

                //Attack
                if (ch_type == "YM")
                {
                    prefab.GetComponent <AttackLong> ().childAttack = atkDfc * 3;
                }
                else if (ch_type == "TP")
                {
                    prefab.GetComponent <AttackLong> ().childAttack = atkDfc * 5;
                }
                else
                {
                    prefab.GetComponent <PlayerAttack> ().attack = prefab.GetComponent <PlayerAttack> ().attack + (ch_num * atkDfc);
                }

                //Dfc
                prefab.GetComponent <PlayerHP> ().dfc = prefab.GetComponent <PlayerHP> ().dfc + (ch_num * atkDfc);
            }
        }
    }
Example #24
0
    //doramatic charactor
    // Use this for initialization
    void Start()
    {
        //map生成
        Instantiate(mapPrefab);
        Instantiate(treePrefab);
        Instantiate(wallPrefab);

        /*プレイヤー配置*/

        //ユーザ陣形データのロード
        int jinkei =PlayerPrefs.GetInt("jinkei",0);

        //1.魚麟
        if (jinkei == 1) {
            if(PlayerPrefs.HasKey("1map1")){
                int mapId = 1;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }

            if(PlayerPrefs.HasKey("1map2")){
                int mapId = 2;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("1map7")){
                int mapId = 7;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("1map8")){
                 int mapId = 8;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);

            }
            if(PlayerPrefs.HasKey("1map11")){
                int mapId = 11;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("1map12")){
                int mapId = 12;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("1map13")){
                int mapId = 13;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("1map14")){
                int mapId = 14;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("1map17")){
                int mapId = 17;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("1map18")){
                int mapId = 18;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("1map21")){
                int mapId = 21;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("1map22")){
                int mapId = 22;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }

        //2.鶴翼
        }else if(jinkei == 2){
            if(PlayerPrefs.HasKey("2map3")){
                int mapId = 3;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map4")){
                int mapId = 4;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map5")){
                int mapId = 5;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map7")){
                int mapId = 7;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map8")){
                int mapId = 8;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map11")){
                int mapId = 11;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map12")){
                int mapId = 12;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map17")){
                int mapId = 17;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map18")){
                int mapId = 18;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map23")){
                int mapId = 23;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map24")){
                int mapId = 24;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map25")){
                int mapId = 25;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }

        }
        //3.偃月
        else if(jinkei == 3){
            if(PlayerPrefs.HasKey("3map3")){
                int mapId = 3;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map7")){
                int mapId = 7;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map8")){
                int mapId = 8;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map9")){
                int mapId = 9;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map11")){
                int mapId = 11;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map12")){
                int mapId = 12;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map14")){
                int mapId = 14;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map15")){
                int mapId = 15;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map16")){
                int mapId = 16;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map20")){
                int mapId = 20;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map21")){
                int mapId = 21;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map25")){
                int mapId = 25;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
        }

        //4.雁行
        else if(jinkei == 4){
            if(PlayerPrefs.HasKey("4map1")){
                int mapId = 1;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map2")){
                int mapId = 2;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map7")){
                int mapId = 7;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map8")){
                int mapId = 8;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map12")){
                int mapId = 12;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map13")){
                int mapId = 13;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map14")){
                int mapId = 14;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map18")){
                int mapId = 18;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map19")){
                int mapId = 19;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map20")){
                int mapId = 20;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map24")){
                int mapId = 24;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map25")){
                int mapId = 25;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
        }

        /*エネミー配置*/
        //stageId取得しマスタ判別
        int tempStageId = PlayerPrefs.GetInt("activeStageId",0);
        int kuniId = PlayerPrefs.GetInt("activeKuniId",0);
        Entity_stage_mst stageMst  = Resources.Load ("Data/stage_mst") as Entity_stage_mst;

        //y=10(X-1)+z-1
        int stageId = 10*(kuniId - 1) + tempStageId;
        int enemyJinkei = stageMst.param[stageId - 1].jinkei;
        int enemyLv = stageMst.param[stageId - 1].lv;

        int[] enemyArray = new int[25];
        enemyArray[0] = stageMst.param[stageId - 1].map1;
        enemyArray[1] = stageMst.param[stageId - 1].map2;
        enemyArray[2] = stageMst.param[stageId - 1].map3;
        enemyArray[3] = stageMst.param[stageId - 1].map4;
        enemyArray[4] = stageMst.param[stageId - 1].map5;
        enemyArray[5] = stageMst.param[stageId - 1].map6;
        enemyArray[6] = stageMst.param[stageId - 1].map7;
        enemyArray[7] = stageMst.param[stageId - 1].map8;
        enemyArray[8] = stageMst.param[stageId - 1].map9;
        enemyArray[9] = stageMst.param[stageId - 1].map10;
        enemyArray[10] = stageMst.param[stageId - 1].map11;
        enemyArray[11] = stageMst.param[stageId - 1].map12;
        enemyArray[12] = stageMst.param[stageId - 1].map13;
        enemyArray[13] = stageMst.param[stageId - 1].map14;
        enemyArray[14] = stageMst.param[stageId - 1].map15;
        enemyArray[15] = stageMst.param[stageId - 1].map16;
        enemyArray[16] = stageMst.param[stageId - 1].map17;
        enemyArray[17] = stageMst.param[stageId - 1].map18;
        enemyArray[18] = stageMst.param[stageId - 1].map19;
        enemyArray[19] = stageMst.param[stageId - 1].map20;
        enemyArray[20] = stageMst.param[stageId - 1].map21;
        enemyArray[21] = stageMst.param[stageId - 1].map22;
        enemyArray[22] = stageMst.param[stageId - 1].map23;
        enemyArray[23] = stageMst.param[stageId - 1].map24;
        enemyArray[24] = stageMst.param[stageId - 1].map25;
        int ch_num = stageMst.param[stageId - 1].chQty;
        int ch_lv = stageMst.param[stageId - 1].lv;

        for(int i=0; i < enemyArray.Length; i++ ){
            if(enemyArray[i] != 0){
                int enemyMapId = i+1;
                int EnemyMap = enemyArray[i];
                StatusGet sts = new StatusGet();
                int hp = sts.getHp(EnemyMap,enemyLv);
                int atk = sts.getAtk(EnemyMap,enemyLv);
                int dfc = sts.getDfc(EnemyMap,enemyLv);
                int spd = sts.getSpd(EnemyMap,enemyLv);

                BusyoInfoGet info = new BusyoInfoGet();
                String busyoName = info.getName(EnemyMap);
                String ch_type = info.getHeisyu(EnemyMap);

                EnemyInstance inst = new EnemyInstance();
                inst.makeInstance(enemyMapId, EnemyMap, ch_lv, ch_type, ch_num, hp, atk, dfc, spd, busyoName);
            }
        }

        //HP bar
        //Instantiate(hpBarPlayerPrefab);
        //Instantiate(hpBarEnemyPrefab);

        //合戦開始エフェクト
        string pathBack = "Prefabs/PreKassen/backGround";
        GameObject back = Instantiate(Resources.Load (pathBack)) as GameObject;
        back.transform.localScale = new Vector2 (30, 15);

        string pathLight = "Prefabs/PreKassen/lightning";
        GameObject light = Instantiate(Resources.Load (pathLight)) as GameObject;
        light.transform.localScale = new Vector2 (10, 10);
    }
Example #25
0
    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);
            }
        }
    }
Example #26
0
    public void makeInstance(int mapId, int busyoId, int lv, string ch_type, int ch_num, int hp, int atk, int dfc, int spd, string busyoName, int linkNo, bool taisyo, ArrayList senpouArray, string kahouList)
    {
        /*Roujyo Start*/
        bool       shiroFlg    = false;
        bool       torideFlg   = false;
        GameObject buildingObj = null;
        bool       pvpFlg      = GameObject.Find("GameScene").GetComponent <GameScene>().pvpFlg;

        if (!pvpFlg)
        {
            string eSRMap = "eSRMap" + mapId.ToString();
            shiroFlg = PlayerPrefs.GetBool(eSRMap);
            PlayerPrefs.DeleteKey(eSRMap);

            if (!shiroFlg)
            {
                string eTRMap = "eTRMap" + mapId.ToString();
                torideFlg = PlayerPrefs.GetBool(eTRMap);
                PlayerPrefs.DeleteKey(eTRMap);
            }

            if (shiroFlg)
            {
                string objPath = "Prefabs/Kassen/eShiro";
                buildingObj = Instantiate(Resources.Load(objPath)) as GameObject;
                buildingObj.transform.localScale = new Vector2(2, 1.5f);
                setEnemyObjectOnMap(mapId, buildingObj);
                buildingObj.name = "shiro";

                string stageName = PlayerPrefs.GetString("activeStageName");
                buildingObj.transform.FindChild("BusyoDtlEnemy").transform.FindChild("NameLabel").GetComponent <TextMesh> ().text = stageName;

                //HP
                int    powerType = PlayerPrefs.GetInt("activePowerType");
                string Type      = "";
                if (powerType == 1)
                {
                    Type = "s";
                }
                else if (powerType == 2)
                {
                    Type = "m";
                }
                else if (powerType == 3)
                {
                    Type = "l";
                }
                string imagePath = "Prefabs/Naisei/Shiro/Sprite/shiro_" + Type;
                buildingObj.GetComponent <SpriteRenderer> ().sprite =
                    Resources.Load(imagePath, typeof(Sprite)) as Sprite;
            }
            else
            {
                if (torideFlg)
                {
                    string objPath = "Prefabs/Kassen/eToride";
                    buildingObj = Instantiate(Resources.Load(objPath)) as GameObject;
                    buildingObj.transform.localScale = new Vector2(3, 3);
                    setEnemyObjectOnMap(mapId, buildingObj);
                    buildingObj.name = "toride";

                    //HP
                    int    powerType = PlayerPrefs.GetInt("activePowerType");
                    string Type      = "";
                    if (powerType == 1)
                    {
                        Type = "s";
                    }
                    else if (powerType == 2)
                    {
                        Type = "m";
                    }
                    else if (powerType == 3)
                    {
                        Type = "l";
                    }

                    string imagePath = "Prefabs/Kassen/kassenTrd_" + Type;
                    buildingObj.GetComponent <SpriteRenderer> ().sprite =
                        Resources.Load(imagePath, typeof(Sprite)) as Sprite;
                }
            }
        }
        /*Roujyo End*/


        string     path   = "Prefabs/Player/" + busyoId;
        GameObject prefab = Instantiate(Resources.Load(path)) as GameObject;

        prefab.name = busyoId.ToString();

        /**Player to Enemy**/
        Vector3 scale = prefab.transform.localScale;
        float   x     = prefab.transform.localScale.x;

        scale.x = scale.x * -1;
        prefab.transform.localScale = scale;
        Destroy(prefab.GetComponent <PlayerHP>());
        prefab.AddComponent <EnemyHP>();
        Destroy(prefab.GetComponent <Kunkou>());
        Destroy(prefab.GetComponent <UnitMover>());
        if (prefab.GetComponent <PlayerAttack>())
        {
            Destroy(prefab.GetComponent <PlayerAttack>());
            prefab.AddComponent <EnemyAttack>();
            prefab.AddComponent <Homing>();
        }
        else
        {
            prefab.AddComponent <HomingLong>();
            if (ch_type == "YM")
            {
                prefab.GetComponent <AttackLong>().bullet = Resources.Load("Prefabs/Enemy/EnemyArrow") as GameObject;
            }
            else
            {
                prefab.GetComponent <AttackLong>().bullet = Resources.Load("Prefabs/Enemy/EnemyBullet") as GameObject;
            }
        }
        prefab.tag   = "Enemy";
        prefab.layer = LayerMask.NameToLayer("Enemy");
        /**Player to Enemy End**/



        //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>());
        }

        //Busyo Detail Info [Name & HP Bar]
        string dtlPath = "";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlEnemyEng";
        }
        else
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlEnemy";
        }
        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 = "BusyoDtlEnemy";

        //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(5, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 2)
        {
            prefab.transform.position = new Vector2(20, 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(50, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 5)
        {
            prefab.transform.position = new Vector2(65, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 6)
        {
            prefab.transform.position = new Vector2(5, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 7)
        {
            prefab.transform.position = new Vector2(20, 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(50, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 10)
        {
            prefab.transform.position = new Vector2(65, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 11)
        {
            prefab.transform.position = new Vector2(5, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 12)
        {
            prefab.transform.position = new Vector2(20, 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(50, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 15)
        {
            prefab.transform.position = new Vector2(65, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 16)
        {
            prefab.transform.position = new Vector2(5, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 17)
        {
            prefab.transform.position = new Vector2(20, -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(50, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 20)
        {
            prefab.transform.position = new Vector2(65, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 21)
        {
            prefab.transform.position = new Vector2(5, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }
        else if (mapId == 22)
        {
            prefab.transform.position = new Vector2(20, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }
        else if (mapId == 23)
        {
            prefab.transform.position = new Vector2(35, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }
        else if (mapId == 24)
        {
            prefab.transform.position = new Vector2(50, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }
        else if (mapId == 25)
        {
            prefab.transform.position = new Vector2(65, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }



        //Link Adjustment
        float linkAdjst = (float)linkNo / 10;

        hp  = hp * 100;
        atk = atk * 10;
        dfc = dfc * 10;
        if (linkNo != 0)
        {
            float adjstHp = hp * linkAdjst;
            hp = hp + (int)adjstHp;
            float adjstDfc = dfc * linkAdjst;
            dfc = dfc + (int)adjstDfc;
        }

        /*Kahou Adjustment*/
        string[] KahouStatusArray;
        float    spdWithKahou = (float)spd;

        if (pvpFlg)
        {
            KahouStatusGet KahouStatusGet = new KahouStatusGet();
            KahouStatusArray = KahouStatusGet.getPvPKahouForStatus(kahouList, hp, atk, dfc, spd);
            hp           = hp + int.Parse(KahouStatusArray[1]);
            atk          = atk + int.Parse(KahouStatusArray[0]);
            dfc          = dfc + int.Parse(KahouStatusArray[2]);
            spdWithKahou = ((float)spd + float.Parse(KahouStatusArray[3]));
        }

        //HP Bar
        GameObject minHpBar = dtl.transform.FindChild("MinHpBar").gameObject;

        minHpBar.GetComponent <BusyoHPBar>().initLife = hp;
        prefab.GetComponent <EnemyHP>().life          = hp;

        //adjust spd
        float adjSpd = spdWithKahou / 10;

        if (prefab.GetComponent <EnemyAttack> ())
        {
            if (linkNo != 0)
            {
                float adjstAtk = atk * linkAdjst;
                atk = atk + (int)adjstAtk;
            }
            prefab.GetComponent <EnemyAttack> ().attack = atk;
            if (adjSpd <= 0)
            {
                adjSpd = 1;
            }
            prefab.GetComponent <Homing> ().speed  = adjSpd;
            prefab.GetComponent <Homing>().leftFlg = true;
        }
        else
        {
            if (ch_type == "YM")
            {
                atk = atk * 3;
            }
            else if (ch_type == "TP")
            {
                atk = atk * 5;
            }
            if (linkNo != 0)
            {
                float adjstAtk = atk * linkAdjst;
                atk = atk + (int)adjstAtk;
            }

            prefab.GetComponent <AttackLong> ().attack = atk;
            if (adjSpd <= 0)
            {
                adjSpd = 1;
            }
            prefab.GetComponent <HomingLong> ().speed  = adjSpd;
            prefab.GetComponent <HomingLong>().leftFlg = true;
        }
        prefab.GetComponent <EnemyHP> ().dfc = dfc;

        if (taisyo)
        {
            prefab.GetComponent <EnemyHP> ().taisyo = true;
        }

        //SE
        AudioController audio = new AudioController();

        audio.addComponentMoveAttack(prefab, ch_type);


        //Child Instantiate
        //set child object
        string    ch_path = "Prefabs/Enemy/" + ch_type;
        float     y1      = 3.0f;
        float     y2      = 3.0f;
        float     y3      = 3.0f;
        float     y4      = 3.0f;
        StatusGet sts     = new StatusGet();

        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();

            //Sashimono Making
            string sashimono_path = "Prefabs/Sashimono/" + busyoId;
            //string sashimono_path = "Prefabs/Sashimono/1";
            GameObject sashimono = Instantiate(Resources.Load(sashimono_path)) as GameObject;
            sashimono.transform.SetParent(ch_prefab.transform);


            //reverse Horizonal
            sashimono.transform.localScale       = new Vector2(0.3f, 0.3f);
            sashimono.transform.localEulerAngles = new Vector3(sashimono.transform.localEulerAngles.x, sashimono.transform.localEulerAngles.y, 10);

            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;
                }
            }

            int ch_status = getChildStatus(lv, ch_type, linkNo);

            //Round up because of Link adjustment might be under 0
            int atkDfc = Mathf.CeilToInt(sts.getChAtkDfc(ch_status, hp));

            if (i == 1)
            {
                //Child Qty
                prefab.GetComponent <EnemyHP>().childQty = ch_num;

                //Child Unit HP
                prefab.GetComponent <EnemyHP>().childHP = ch_status;

                //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 <EnemyAttack> ().attack = prefab.GetComponent <EnemyAttack> ().attack + (ch_num * atkDfc);
                    prefab.GetComponent <Heisyu> ().atk         = atkDfc;
                }

                //Dfc
                prefab.GetComponent <EnemyHP> ().dfc = prefab.GetComponent <EnemyHP> ().dfc + (ch_num * atkDfc);
                prefab.GetComponent <Heisyu> ().dfc  = atkDfc;
            }
        }

        //Busyo Config in Shiro or Toride
        if (shiroFlg || torideFlg)
        {
            //Choose AI Type
            int baseAtk = sts.getBaseAtk(busyoId);
            int baseDfc = sts.getBaseDfc(busyoId);
            int AIType  = getAIType(baseAtk, baseDfc, taisyo);

            buildingObj.GetComponent <ShiroSearch> ().busyoObjList.Add(prefab);
            if (ch_type == "YM" || ch_type == "TP")
            {
                prefab.GetComponent <HomingLong> ().backShiroObj = buildingObj;
                prefab.GetComponent <HomingLong> ().enabled      = false;
            }
            else
            {
                prefab.GetComponent <Homing> ().backShiroObj = buildingObj;
                prefab.GetComponent <Homing> ().enabled      = false;

                //YR & KB
                if (shiroFlg && AIType == 3)
                {
                    AIType = 1;
                }
            }

            //Size
            buildingObj.GetComponent <ShiroSearch> ().busyoObjSize.Add(prefab.transform.localScale);
            prefab.transform.localScale = new Vector2(0, 0);

            //AI
            buildingObj.GetComponent <ShiroSearch> ().AITypeList.Add(AIType);

            //HP
            List <float> randomList = new List <float>()
            {
                1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f, 5.0f
            };
            int   rdm         = UnityEngine.Random.Range(0, randomList.Count);
            float randomValue = randomList [rdm];
            buildingObj.transform.FindChild("BusyoDtlEnemy").transform.FindChild("MinHpBar").GetComponent <BusyoHPBar>().initLife = (float)hp * randomValue;
            buildingObj.GetComponent <EnemyHP>().life = (float)hp * randomValue;
        }
    }
Example #27
0
	// 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 ();
			}
		}
	}	
Example #28
0
    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);
        }
    }
Example #29
0
    public void OnClick()
    {
        //Common
        Message msg = new Message();

        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();

        //Check Shinobi
        if (cyouhouSnbRankId != 0)
        {
            char[]        delimiterChars = { ',' };
            List <string> myBusyoList    = new List <string> ();
            string        myBusyoString  = PlayerPrefs.GetString("myBusyo");

            if (myBusyoString.Contains(","))
            {
                myBusyoList = new List <string> (myBusyoString.Split(delimiterChars));
            }
            else
            {
                myBusyoList.Add(myBusyoString);
            }

            //reduce used busyo
            List <string> usedBusyoList = new List <string>();
            string        usedBusyo     = PlayerPrefs.GetString("usedBusyo");
            if (usedBusyo != null && usedBusyo != "")
            {
                usedBusyoList = new List <string> (usedBusyo.Split(delimiterChars));
                myBusyoList.RemoveAll(usedBusyo.Contains);
            }

            //Check Busyo
            if (myBusyoList.Count != 0)
            {
                audioSources [0].Play();

                scrollObj.SetActive(true);
                scrollObj.transform.FindChild("Back").GetComponent <DoKousaku> ().scrollObj = scrollObj;
                GameObject doBtnObj = scrollObj.transform.FindChild("Do").gameObject;
                doBtnObj.GetComponent <DoKousaku> ().scrollObj = scrollObj;

                //Make Scroll
                GameObject content = scrollObj.transform.FindChild("ScrollView").transform.FindChild("Content").gameObject;

                foreach (Transform obj in content.transform)
                {
                    Destroy(obj.gameObject);
                }


                string slotPath = "Prefabs/Map/kousaku/Slot";
                string dfcPath  = "Prefabs/Map/kousaku/TextObj";
                for (int i = 0; i < myBusyoList.Count; i++)
                {
                    string busyoId = myBusyoList [i];

                    //Slot
                    GameObject slot = Instantiate(Resources.Load(slotPath)) as GameObject;
                    slot.transform.SetParent(content.transform);
                    slot.transform.localScale = new Vector3(1, 1, 1);

                    //Busyo
                    string     busyoPath = "Prefabs/Player/Unit/BusyoUnit";
                    GameObject busyo     = Instantiate(Resources.Load(busyoPath)) as GameObject;
                    busyo.name = busyoId;
                    busyo.transform.SetParent(slot.transform);
                    busyo.transform.localScale = new Vector3(4, 5, 0);
                    busyo.name = busyoId;
                    slot.name  = "Slot" + busyo.name;

                    busyo.GetComponent <DragHandler> ().enabled = false;

                    //Chiryaku
                    GameObject txtObj = Instantiate(Resources.Load(dfcPath)) as GameObject;
                    txtObj.transform.SetParent(busyo.transform);
                    txtObj.transform.localScale    = new Vector3(1, 1, 0);
                    txtObj.transform.localPosition = new Vector3(5, -12, 0);

                    StatusGet sts         = new StatusGet();
                    int       lv          = PlayerPrefs.GetInt(busyoId);
                    float     chiryakuSts = (float)sts.getDfc(int.Parse(busyoId), lv);
                    chiryakuSts = chiryakuSts * 10;

                    txtObj.transform.FindChild("Value").GetComponent <Text> ().text = chiryakuSts.ToString();

                    //Set Param
                    KousakuBusyoSelect script = slot.GetComponent <KousakuBusyoSelect>();
                    script.busyoId  = int.Parse(busyoId);
                    script.dfc      = chiryakuSts;
                    script.doBtnObj = doBtnObj;
                    script.content  = content;

                    //Initial Setting
                    if (i == 0)
                    {
                        slot.GetComponent <KousakuBusyoSelect> ().OnClick();
                    }
                }

                scrollObj.transform.FindChild("Do").GetComponent <DoKousaku> ().cyouhouSnbRankId = cyouhouSnbRankId;
                if (name == "CyouryakuButton")
                {
                    scrollObj.transform.FindChild("Question").GetComponent <QA>().qaId = 31;
                    if (Application.systemLanguage == SystemLanguage.Japanese)
                    {
                        scrollObj.transform.FindChild("Text").GetComponent <Text> ().text = "調略";
                        scrollObj.transform.FindChild("Do").transform.FindChild("Text").GetComponent <Text> ().text = "調略";
                    }
                    else
                    {
                        scrollObj.transform.FindChild("Text").GetComponent <Text>().text = "Win Over";
                        scrollObj.transform.FindChild("Do").transform.FindChild("Text").GetComponent <Text>().text = "Win Over";
                    }
                    doBtnObj.GetComponent <DoKousaku>().linkCutFlg = false;
                }
                else
                {
                    scrollObj.transform.FindChild("Question").GetComponent <QA>().qaId = 30;

                    if (Application.systemLanguage == SystemLanguage.Japanese)
                    {
                        scrollObj.transform.FindChild("Text").GetComponent <Text> ().text = "連絡線遮断";
                        scrollObj.transform.FindChild("Do").transform.FindChild("Text").GetComponent <Text>().text = "遮断";
                    }
                    else
                    {
                        scrollObj.transform.FindChild("Text").GetComponent <Text>().text = "Link Cut";
                        scrollObj.transform.FindChild("Do").transform.FindChild("Text").GetComponent <Text>().text = "Cut";
                    }
                    doBtnObj.GetComponent <DoKousaku> ().linkCutFlg = true;
                }
            }
            else
            {
                audioSources [4].Play();
                msg.makeUpperMessageOnBoard(msg.getMessage(8));
            }
        }
        else
        {
            audioSources [4].Play();
            msg.makeUpperMessageOnBoard(msg.getMessage(51));
        }
    }
Example #30
0
	public void ScrollView(GameObject obj, GameObject btnObj){

		string scrollPath = "Prefabs/Map/common/ScrollView";
		GameObject scroll = Instantiate (Resources.Load (scrollPath)) as GameObject;
		scroll.transform.SetParent(obj.transform);
		scroll.transform.localScale = new Vector3 (1, 1, 1);
		RectTransform scroll_transform = scroll.GetComponent<RectTransform>();
		scroll_transform.anchoredPosition = new Vector3(0,130,0);
		scroll.name = "scroll";

		List<string> myBusyoList = new List<string>();
		string myBusyoString = PlayerPrefs.GetString ("myBusyo");
		char[] delimiterChars = {','};
		myBusyoList = new List<string>(myBusyoString.Split (delimiterChars));

		string slotPath = "Prefabs/Map/common/Slot";
		string chiryakuPath = "Prefabs/Map/common/Chiryaku";
		GameObject contents = scroll.transform.FindChild("Content").gameObject;

		for (int i=0; i<myBusyoList.Count; i++) {

			string myBusyoId = myBusyoList[i];

			//Slot
			GameObject prefab = Instantiate (Resources.Load (slotPath)) as GameObject;
			prefab.transform.SetParent(contents.transform);
			prefab.transform.localScale = new Vector3 (1, 1, 1);
			prefab.GetComponent<GaikouBusyoSelect>().DoBtn = btnObj;
			prefab.GetComponent<GaikouBusyoSelect>().Content = contents;
			prefab.GetComponent<GaikouBusyoSelect>().kuniDiff = kuniDiff;
			prefab.GetComponent<GaikouBusyoSelect>().daimyoBusyoAtk = daimyoBusyoAtk;
			prefab.GetComponent<GaikouBusyoSelect>().daimyoBusyoDfc = daimyoBusyoDfc;


			//Busyo
			string busyoPath = "Prefabs/Player/Unit/" + myBusyoId;
			GameObject busyo = Instantiate (Resources.Load (busyoPath)) as GameObject;
			busyo.transform.SetParent(prefab.transform);
			busyo.transform.localScale = new Vector3 (4, 5, 4);
			busyo.name = myBusyoList [i].ToString ();

			RectTransform text_transform = busyo.transform.FindChild("Text").GetComponent<RectTransform>();
			text_transform.anchoredPosition = new Vector3(-32,12,0);
			prefab.name = "Slot" + busyo.name;

			//Get Chiryaku
			StatusGet sts = new StatusGet();
			int lv = PlayerPrefs.GetInt (myBusyoId);
			float chiryakuSts = (float)sts.getDfc(int.Parse(myBusyoId),lv);
			chiryakuSts = chiryakuSts *10;

			GameObject chiryaku = Instantiate (Resources.Load (chiryakuPath)) as GameObject;
			chiryaku.transform.SetParent(busyo.transform);
			chiryaku.transform.FindChild("value").GetComponent<Text>().text = chiryakuSts.ToString();
			chiryaku.transform.localScale = new Vector3 (1, 1, 1);

			busyo.GetComponent<DragHandler> ().enabled = false;

			//Deffault Busyo Click
			if(i == 0){
				prefab.GetComponent<GaikouBusyoSelect>().OnClick();
			}

		}

	}
Example #31
0
    public void ScrollView(GameObject obj, GameObject btnObj)
    {
        string     scrollPath = "Prefabs/Map/common/ScrollView";
        GameObject scroll     = Instantiate(Resources.Load(scrollPath)) as GameObject;

        scroll.transform.SetParent(obj.transform);
        scroll.transform.localScale = new Vector3(1, 1, 1);
        RectTransform scroll_transform = scroll.GetComponent <RectTransform>();

        scroll_transform.anchoredPosition = new Vector3(0, 130, 0);
        scroll.name = "scroll";

        List <string> myBusyoList   = new List <string>();
        string        myBusyoString = PlayerPrefs.GetString("myBusyo");

        char[] delimiterChars = { ',' };
        myBusyoList = new List <string>(myBusyoString.Split(delimiterChars));

        //reduce used busyo
        List <string> usedBusyoList = new List <string>();
        string        usedBusyo     = PlayerPrefs.GetString("usedBusyo");

        if (usedBusyo != null && usedBusyo != "")
        {
            usedBusyoList = new List <string> (usedBusyo.Split(delimiterChars));
            myBusyoList.RemoveAll(usedBusyo.Contains);
        }

        string     slotPath     = "Prefabs/Map/common/Slot";
        string     chiryakuPath = "Prefabs/Map/common/Chiryaku";
        GameObject contents     = scroll.transform.FindChild("Content").gameObject;

        for (int i = 0; i < myBusyoList.Count; i++)
        {
            string myBusyoId = myBusyoList[i];

            //Slot
            GameObject prefab = Instantiate(Resources.Load(slotPath)) as GameObject;
            prefab.transform.SetParent(contents.transform);
            prefab.transform.localScale = new Vector3(1, 1, 1);
            prefab.GetComponent <GaikouBusyoSelect>().DoBtn          = btnObj;
            prefab.GetComponent <GaikouBusyoSelect>().Content        = contents;
            prefab.GetComponent <GaikouBusyoSelect>().kuniDiff       = kuniDiff;
            prefab.GetComponent <GaikouBusyoSelect>().daimyoBusyoAtk = daimyoBusyoAtk;
            prefab.GetComponent <GaikouBusyoSelect>().daimyoBusyoDfc = daimyoBusyoDfc;
            prefab.GetComponent <GaikouBusyoSelect>().busyoId        = int.Parse(myBusyoId);

            //Busyo
            string     busyoPath = "Prefabs/Player/Unit/BusyoUnit";
            GameObject busyo     = Instantiate(Resources.Load(busyoPath)) as GameObject;
            busyo.name = myBusyoId;
            busyo.transform.SetParent(prefab.transform);
            busyo.transform.localScale = new Vector3(4, 5, 4);
            busyo.name = myBusyoList [i].ToString();

            RectTransform text_transform = busyo.transform.FindChild("Text").GetComponent <RectTransform>();
            text_transform.anchoredPosition = new Vector3(-32, 12, 0);
            prefab.name = "Slot" + busyo.name;

            //Get Chiryaku
            StatusGet sts     = new StatusGet();
            int       lv      = 0;
            bool      hardFlg = PlayerPrefs.GetBool("hardFlg");
            if (hardFlg)
            {
                lv = 1;
            }
            else
            {
                lv = PlayerPrefs.GetInt(myBusyoId);
            }
            float chiryakuSts = (float)sts.getDfc(int.Parse(myBusyoId), lv);
            chiryakuSts = chiryakuSts * 10;

            GameObject chiryaku = Instantiate(Resources.Load(chiryakuPath)) as GameObject;
            chiryaku.transform.SetParent(busyo.transform);
            chiryaku.transform.FindChild("value").GetComponent <Text>().text = chiryakuSts.ToString();
            chiryaku.transform.localScale    = new Vector3(1, 1, 1);
            chiryaku.transform.localPosition = new Vector3(0, 0, 0);

            busyo.GetComponent <DragHandler> ().enabled = false;

            //Deffault Busyo Click
            if (i == 0)
            {
                prefab.GetComponent <GaikouBusyoSelect>().OnClick();
            }
        }
    }
Example #32
0
	public void playerEngunInstance(string playerEngunList){

		List<string> daimyoEnguniList = new List<string> ();
		char[] delimiterChars = {':'};
		char[] delimiterChars2 = {'-'};
		if(playerEngunList.Contains(":")){
			daimyoEnguniList = new List<string> (playerEngunList.Split (delimiterChars));
		}else{
			daimyoEnguniList.Add(playerEngunList);
		}

		for(int i=0; i<daimyoEnguniList.Count; i++){
			string daimyoEngunString = daimyoEnguniList[i];
			List<string> unitEnguniList = new List<string> ();
			unitEnguniList = new List<string> (daimyoEngunString.Split (delimiterChars2));
			int busyoId = int.Parse(unitEnguniList[0]);
			if(busyoId!=0){
				int busyoLv = int.Parse(unitEnguniList[1]);
				int butaiQty = int.Parse(unitEnguniList[2]);
				int butaiLv = int.Parse(unitEnguniList[3]);

				StatusGet sts = new StatusGet ();
				int hp = sts.getHp (busyoId, busyoLv);
				int atk = sts.getAtk (busyoId, busyoLv);
				int dfc = sts.getDfc (busyoId, busyoLv);
				int spd = sts.getSpd (busyoId, busyoLv);
				string busyoName = sts.getBusyoName (busyoId);
				ArrayList senpouArray = sts.getSenpou (busyoId);
				
				//View Object & pass status to it. 
				PlayerInstance inst = new PlayerInstance ();
				inst.makeEngunInstance(busyoId, hp, atk, dfc, spd, senpouArray, busyoName, butaiQty, butaiLv);

			}
		}
		Message msg = new Message ();
		string text = "自軍の援軍が到着しましたぞ!";
		msg.makeKassenMessage (text);


	}
Example #33
0
    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;
        }
    }
Example #34
0
	public void OnClick(){

		//Ninmei
		if (kaininFlg == false) {

			//Make Jyosyu List
			string openKuniString = PlayerPrefs.GetString ("openKuni");
			List<string> openKuniList = new List<string> ();
			char[] delimiterChars = {','};
			openKuniList = new List<string> (openKuniString.Split (delimiterChars));

			List<string> jyosyuList = new List<string> ();
			for (int i=0; i<openKuniList.Count; i++) {
				string temp = "jyosyu" + openKuniList [i];
				if (PlayerPrefs.HasKey (temp)) {
					int jyosyuId = PlayerPrefs.GetInt (temp);
					jyosyuList.Add (jyosyuId.ToString ());
				}
			}

			//Available Jyosyu List
			string myBusyoString = PlayerPrefs.GetString ("myBusyo");
			List<string> myBusyoList = new List<string> ();
			myBusyoList = new List<string> (myBusyoString.Split (delimiterChars));

			//Reduce MyBusyo - CurrentJyosyu
			myBusyoList.RemoveAll (jyosyuList.Contains);

			//Reduce MyDaimyo
			//int myDaimyo = PlayerPrefs.GetInt("myDaimyo");
			//Daimyo daimyo = new Daimyo();
			//int myDaimyoBusyo = daimyo.getDaimyoBusyoId(myDaimyo);
			//myBusyoList.Remove(myDaimyoBusyo.ToString());


			if(myBusyoList.Count > 0){
				BusyoStatusButton pop = new BusyoStatusButton ();
				pop.commonPopup ();
				GameObject.Find ("popText").GetComponent<Text> ().text = "城主任命";
				
				//Set Scroll View
				string scrollPath = "Prefabs/Naisei/ScrollView";
				GameObject scroll = Instantiate (Resources.Load (scrollPath)) as GameObject;
				scroll.transform.SetParent (GameObject.Find ("board(Clone)").transform);
				scroll.transform.localScale = new Vector2 (1, 1);
				scroll.name = "ScrollView";
				RectTransform scrollTransform = scroll.GetComponent<RectTransform> ();
				scrollTransform.anchoredPosition3D = new Vector3 (0, 0, 0);

				//Show Available List
				foreach (string avl in myBusyoList) {
					string slotPath = "Prefabs/Naisei/BusyoSlot";
					GameObject slot = Instantiate (Resources.Load (slotPath)) as GameObject;
					slot.transform.SetParent (scroll.transform.FindChild ("NaiseiContent").transform);
					slot.transform.localScale = new Vector2 (1, 1);

					string busyoPath = "Prefabs/Player/Unit/" + avl;
					GameObject busyo = Instantiate (Resources.Load (busyoPath)) as GameObject;
					busyo.transform.SetParent (slot.transform.FindChild ("Busyo").transform);
					busyo.transform.localScale = new Vector2 (3.5f, 3.5f);
					RectTransform busyo_transform = busyo.GetComponent<RectTransform> ();
					busyo_transform.anchoredPosition3D = new Vector3 (0, -300, 0);
					busyo_transform.sizeDelta = new Vector2 (200, 200);
					busyo.GetComponent<DragHandler> ().enabled = false;

					GameObject text = busyo.transform.FindChild ("Text").gameObject;
					text.transform.localScale = new Vector2 (0.6f, 0.6f);
					RectTransform text_transform = text.GetComponent<RectTransform> ();
					text_transform.anchoredPosition3D = new Vector3 (-200, 65, 0);

					GameObject rank = busyo.transform.FindChild ("Rank").gameObject;
					rank.transform.localScale = new Vector2 (1, 1);
					RectTransform rank_transform = rank.GetComponent<RectTransform> ();
					rank_transform.anchoredPosition3D = new Vector3 (30, -100, 0);

					//Status
					StatusGet sts = new StatusGet ();
					int lv = PlayerPrefs.GetInt (avl);
					float naiseiStsTemp = (float)sts.getDfc (int.Parse (avl), lv);
					float naiseiSts = naiseiStsTemp / 2;

					float hpSts = (float)sts.getHp (int.Parse (avl), lv);
					float atkSts = (float)sts.getAtk (int.Parse (avl), lv);
					float boubiStatusTemp = (hpSts + atkSts) / 2;
					float boubiStatus = boubiStatusTemp / 2;

					slot.transform.FindChild ("Busyo").transform.FindChild ("NaiseiEffectValue").GetComponent<Text> ().text = "+" + naiseiSts.ToString ("f1") + "%";
					slot.transform.FindChild ("Busyo").transform.FindChild ("BoubiEffectValue").GetComponent<Text> ().text = "+" + boubiStatus.ToString ("f1") + "%";

					//Lv
					string lvPath = "Prefabs/Naisei/Lv";
					GameObject lvObj = Instantiate (Resources.Load (lvPath)) as GameObject;
					lvObj.transform.SetParent (busyo.transform);
					lvObj.GetComponent<Text> ().text = "Lv" + lv;
					lvObj.transform.localScale = new Vector2 (0.1f, 0.1f);
					RectTransform lv_transform = lvObj.GetComponent<RectTransform> ();
					lv_transform.anchoredPosition3D = new Vector3 (130, -70, 0);

					//Button
					slot.transform.FindChild ("Busyo").transform.FindChild ("NinmeiButton").GetComponent<DoNinmei> ().busyoId = avl;
					

				}
			}else{
				Message msg = new Message();
				string text = "城主に任命可能な武将がおりませぬぞ。\t配下武将を登用して下され。";
				msg.makeMessage(text);
			}
		} else {
			//Kainin
			//Common Process
			//Back Cover
			string backPath = "Prefabs/Common/TouchBack";
			GameObject back = Instantiate (Resources.Load (backPath)) as GameObject;
			back.transform.SetParent(GameObject.Find ("Panel").transform);
			back.transform.localScale = new Vector2 (1, 1);
			RectTransform backTransform = back.GetComponent<RectTransform> ();
			backTransform.anchoredPosition3D = new Vector3 (0, 0, 0);
			back.name = "TouchBack";

			//Message Box
			string msgPath = "Prefabs/Naisei/KaininConfirm";
			GameObject msg = Instantiate (Resources.Load (msgPath)) as GameObject;
			msg.transform.SetParent(back.transform);
			msg.transform.localScale = new Vector2 (1, 1);
			RectTransform msgTransform = msg.GetComponent<RectTransform> ();
			msgTransform.anchoredPosition3D = new Vector3 (0, 0, 0);
			msgTransform.name = "kaininConfirm";

			//Message Text Mod
			GameObject msgObj = msg.transform.FindChild ("KaininText").gameObject;
			int myDaimyoBusyo = PlayerPrefs.GetInt ("myDaimyoBusyo");
			string msgText = msgObj.GetComponent<Text> ().text;
			if (myDaimyoBusyo == jyosyuId) {
				msgText = msgText.Replace("A", "自らを");
			} else {
				msgText = msgText.Replace("A", jyosyuName);
			}
			msgObj.GetComponent<Text> ().text = msgText;

		}
	}
Example #35
0
    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;
    }
Example #36
0
	public void Start () {

		//Get Temp Kuni Id & Stage Id
		activeKuniId = PlayerPrefs.GetInt ("activeKuniId");
		string temp = "naisei" + activeKuniId.ToString ();

		/*Initial Setting*/
		//Kuni Name & jyosyu
		string title = "";
		string kuniName = PlayerPrefs.GetString ("activeKuniName");

		string jyosyuTemp = "jyosyu" + activeKuniId;

		//Clear Image
		foreach ( Transform n in GameObject.Find ("JyosyuImage").transform){
			GameObject.Destroy(n.gameObject);
		}

		if (PlayerPrefs.HasKey (jyosyuTemp)) {
			//Jyosyu Exist
			jyosyuId = PlayerPrefs.GetInt (jyosyuTemp);
			string busyoPath = "Prefabs/Player/Unit/" + jyosyuId;
			GameObject busyo = Instantiate (Resources.Load (busyoPath)) as GameObject;
			busyo.transform.SetParent (GameObject.Find ("JyosyuImage").transform);
			busyo.transform.localScale = new Vector2 (4, 4);
			busyo.GetComponent<DragHandler>().enabled = false;
			RectTransform busyo_transform = busyo.GetComponent<RectTransform>();
			busyo_transform.anchoredPosition3D = new Vector3(40,40,0);
			busyo_transform.sizeDelta = new Vector2( 23, 23);

			foreach(Transform n in busyo.transform){
				GameObject.Destroy(n.gameObject);
			}

			StatusGet sts = new StatusGet();
			string jyosyuName = sts.getBusyoName(jyosyuId);
			title = kuniName + "・" + jyosyuName;

			//Ninmei Button
			GameObject btn = GameObject.Find ("Ninmei").gameObject;
			btn.GetComponent<Ninmei>().kaininFlg = true;
			btn.transform.FindChild("NinmeiText").GetComponent<Text>().text = "城主解任";
			btn.GetComponent<Ninmei>().jyosyuId = jyosyuId;
			btn.GetComponent<Ninmei>().jyosyuName = jyosyuName;

		} else {
			//Jyosyu Not Exist
			title = kuniName + "・蔵入地"; 

			//Ninmei Button
			GameObject btn = GameObject.Find ("Ninmei").gameObject;
			btn.GetComponent<Ninmei>().kaininFlg = false;
			btn.transform.FindChild("NinmeiText").GetComponent<Text>().text = "城主任命";
		}

		GameObject.Find ("StageNameValue").GetComponent<Text> ().text = title;


		//Money
		int money = PlayerPrefs.GetInt("money");
		GameObject.Find ("MoneyValue").GetComponent<Text> ().text = money.ToString();

		//Hyourou
		int hyourou = PlayerPrefs.GetInt("hyourou");
		GameObject.Find ("HyourouCurrentValue").GetComponent<Text> ().text = hyourou.ToString();

		//HyourouMax
		int hyourouMax = PlayerPrefs.GetInt("hyourouMax");
		GameObject.Find ("HyourouMaxValue").GetComponent<Text> ().text = hyourouMax.ToString();

		//Naisei Icon List
		KuniInfo kuni = new KuniInfo ();
		shigen = kuni.getKuniNaisei (activeKuniId);



		//Sea or Tree
		isSeaFlg = kuni.getKuniIsSeaFlg (activeKuniId);
		GameObject otherObj = GameObject.Find ("Other").gameObject;
		if (isSeaFlg) {
			if(otherObj.transform.FindChild("treeUpper") != null){
				otherObj.transform.FindChild("treeUpper").gameObject.SetActive(false);
			}
		} else {
			if(otherObj.transform.FindChild("sea") != null){
				otherObj.transform.FindChild("sea").gameObject.SetActive(false);
			}
		}



		/*Open Panel*/
		//Clear Previous Panel
		foreach ( Transform n in GameObject.Find ("NaiseiView").transform){
			GameObject.Destroy(n.gameObject);
		}
		//Clear Previous Mask Panel
		foreach ( Transform n in GameObject.Find ("MaskView").transform){
			GameObject.Destroy(n.gameObject);
		}

		//Open Panel & MaskPanel
 		panelByShiro(activeKuniId);
		panelByKuniLv();

		if (PlayerPrefs.HasKey (temp)) {
			/*initial setting*/
			string naiseiString = PlayerPrefs.GetString (temp);
			List<string> naiseiList = new List<string>();
			char[] delimiterChars = {','};
			naiseiList = new List<string>(naiseiString.Split (delimiterChars));

			/*Naisei Bldg Handling*/
			char[] delimiterChars2 = {':'};
			List<string> deletePanelList = new List<string>();
			Entity_naisei_mst naiseiMst = Resources.Load ("Data/naisei_mst") as Entity_naisei_mst;

			for(int i=1; i<naiseiList.Count;i++){

				List<string> naiseiContentList = new List<string>();
				naiseiContentList = new List<string>(naiseiList[i].Split (delimiterChars2));


				if(naiseiContentList[0] != "0"){
					//Exist
					string bldgRank = "";
					if(int.Parse(naiseiContentList[1])<8){
						bldgRank = "s";
					}else if(int.Parse(naiseiContentList[1]) < 15){
						bldgRank = "m";
					}else if(15 <= int.Parse(naiseiContentList[1])){
						bldgRank = "l";
					}

					//Add Delete Target
					deletePanelList.Add(i.ToString());

					//Make New Panel
					string type = naiseiMst.param [int.Parse(naiseiContentList[0])].code;
					string bldg = type + "_" + bldgRank;
					string bldgPath = "Prefabs/Naisei/Bldg/" + bldg;
					GameObject bldgObj = Instantiate (Resources.Load (bldgPath)) as GameObject;
					bldgObj.transform.parent = GameObject.Find ("NaiseiView").transform;
					bldgObj.transform.localScale = new Vector3 (1, 1, 1);
					setBldg(bldgObj, i);
					bldgObj.name = i.ToString();
					bldgObj.GetComponent<AreaButton>().blank = false;
					bldgObj.GetComponent<AreaButton>().type = type;
					bldgObj.GetComponent<AreaButton>().lv = naiseiContentList[1];
					bldgObj.GetComponent<AreaButton>().naiseiId = int.Parse(naiseiContentList[0]);

					//Effect by Level
					List<int> naiseiEffectList = new List<int>();
					naiseiEffectList = getNaiseiList(type, int.Parse(naiseiContentList[1]));
					if(type != "kzn"){
						if(type != "yr" &&type != "kb"&&type != "tp" &&type != "ym" &&type !="snb"){
							bldgObj.GetComponent<AreaButton>().effect = naiseiEffectList[0];
							bldgObj.GetComponent<AreaButton>().effectNextLv = naiseiEffectList[1];
						}else{
							bldgObj.GetComponent<AreaButton>().effect = naiseiEffectList[0] * 2;
							bldgObj.GetComponent<AreaButton>().effectNextLv = naiseiEffectList[1] * 2;
						}
					}else{
						bldgObj.GetComponent<AreaButton>().effect = naiseiEffectList[0] * 4;
						bldgObj.GetComponent<AreaButton>().effectNextLv = naiseiEffectList[1] * 4;
					}

					bldgObj.GetComponent<AreaButton>().moneyNextLv = naiseiEffectList[2];
					bldgObj.GetComponent<AreaButton>().requiredHyourou =naiseiMst.param [int.Parse(naiseiContentList[0])].hyourou;
					bldgObj.GetComponent<AreaButton>().naiseiName =naiseiMst.param [int.Parse(naiseiContentList[0])].name;

					//Status
					if(type == "shop"){
						syogyo = syogyo + naiseiEffectList[0];
					}else if(type == "ta"){
						nogyo = nogyo + naiseiEffectList[0];
					}else if(type == "yr" ||type == "kb"||type == "tp" ||type == "ym"||type == "snb"){
						int tempCalc = naiseiEffectList[0] * 2;
						gunjyu = gunjyu + tempCalc;
					}else if(type == "ashigaru"){
						ashigaru = ashigaru + naiseiEffectList[0];
					}else if(type == "trd"){
						boubi = boubi + naiseiEffectList[0];
					}else if(type == "kzn"){
						int tempCalc = naiseiEffectList[0] * 4;
						syogyo = syogyo + tempCalc;
					}else if(type == "nbn"){
						int tempCalc = naiseiEffectList[0];
						kirisuto = kirisuto + tempCalc;
					}else if(type == "kgy"){
						int tempCalc = naiseiEffectList[0];
						bunka = bunka + tempCalc;					
					}else if(type == "bky"){
						int tempCalc = naiseiEffectList[0];
						bukkyo = bukkyo + tempCalc;					
					}else if(type == "hsy"){
						int tempCalc = naiseiEffectList[0];
						ashigaru = ashigaru + tempCalc;					
					}else{
						Debug.Log ("Not Yet");

					}
				}
			}

			//Clear Duplicated Panel
			foreach ( Transform n in GameObject.Find ("NaiseiView").transform){
				if(deletePanelList.Contains(n.name)){
					if(n.tag == "Area"){
						GameObject.Destroy(n.gameObject);
					}
				}
			}

			/*shiro setting*/
			string rank = "";
			if(int.Parse(naiseiList[0])<8){
				rank = "s";
				setShiro(rank, naiseiList[0]);
			}else if(int.Parse(naiseiList[0]) < 15){
				rank = "m";
				setShiro(rank, naiseiList[0]);
			}else if(15 <= int.Parse(naiseiList[0])){
				rank = "l";
				setShiro(rank, naiseiList[0]);
			}
			
			string maskPath = "Prefabs/Naisei/MaskPanel";
			GameObject maskPanel = Instantiate (Resources.Load (maskPath)) as GameObject;
			maskPanel.transform.parent = GameObject.Find ("MaskView").transform;
			maskPanel.transform.localScale = new Vector3 (1, 1, 1);
			RectTransform maskPanel_transform = maskPanel.GetComponent<RectTransform>();
			maskPanel_transform.anchoredPosition3D = new Vector3(0,-20,0);
			maskPanel.name = "shiro_" + rank;


			//Status Handling

			//Status Jyosyu Modification
			if (PlayerPrefs.HasKey (jyosyuTemp)) {
				StatusGet sts = new StatusGet();
				int lv = PlayerPrefs.GetInt (jyosyuId.ToString());
				float naiseiSts = (float)sts.getDfc(jyosyuId,lv);

				float hpSts = (float)sts.getHp(jyosyuId,lv);
				float atkSts = (float)sts.getAtk(jyosyuId,lv);
				float boubiSts = (hpSts + atkSts)/2;

				float tempSyogyo = (float)syogyo;
				tempSyogyo = tempSyogyo + (tempSyogyo * naiseiSts/200);
				float tempNogyo = (float)nogyo;
				tempNogyo = tempNogyo + (tempNogyo * naiseiSts/200);
				float tempBoubi = (float)boubi;
				tempBoubi = tempBoubi + (tempBoubi * naiseiSts/200);

				syogyo = (int)tempSyogyo;
				nogyo = (int)tempNogyo;
				boubi = (int)tempBoubi;

			}

			GameObject.Find("SyogyoValue").GetComponent<Text>().text = syogyo.ToString();
			GameObject.Find("NougyoValue").GetComponent<Text>().text = nogyo.ToString();
			GameObject.Find("GunjyuValue").GetComponent<Text>().text = gunjyu.ToString();
			GameObject.Find("AshigaruValue").GetComponent<Text>().text = ashigaru.ToString();
			GameObject.Find("BoubiValue").GetComponent<Text>().text = boubi.ToString();
			GameObject.Find("BukkyoValue").GetComponent<Text>().text = bukkyo.ToString();
			GameObject.Find("KirisutoValue").GetComponent<Text>().text = kirisuto.ToString();
			GameObject.Find("BunkaValue").GetComponent<Text>().text = bunka.ToString();
			GameObject.Find("BukkyoValue").GetComponent<Text>().text = bukkyo.ToString();


			//jyosyu status update
			if (PlayerPrefs.HasKey (jyosyuTemp)) {
				int jyosyuId = PlayerPrefs.GetInt (jyosyuTemp);
				string heiTmp = "jyosyuHei" + jyosyuId;

				PlayerPrefs.SetInt (heiTmp,ashigaru);
			}
			string boubiTmp = "boubi" + activeKuniId;
			PlayerPrefs.SetInt (boubiTmp,boubi);




		} else {
			//Error
			Debug.Log ("ERROR");
		}

		/***************************/
		/*Tabibito Controller Start*/
		/***************************/

		tabibitoObj = GameObject.Find ("Tabibito").gameObject;
		
		loginTemp = "naiseiLoginDate" + activeKuniId.ToString ();
		string loginTimeString = PlayerPrefs.GetString (loginTemp);
		if (loginTimeString == null || loginTimeString == "") {
			loginTimeString = System.DateTime.Today.ToString ();
			PlayerPrefs.SetString (loginTemp,loginTimeString);
			PlayerPrefs.Flush();
		}
		
		System.DateTime loginTime = System.DateTime.Parse (loginTimeString);
		System.TimeSpan span = System.DateTime.Today - loginTime;
		double spanDay = span.TotalDays;
		
		string counterTemp = "naiseiTabibitoCounter" + activeKuniId.ToString ();
		if (spanDay >= 1) {
			//Reset
			PlayerPrefs.SetInt (counterTemp,0);
			PlayerPrefs.Flush();
			counter = 0;
			
		}else{
			//Get Counted No
			counter = PlayerPrefs.GetInt (counterTemp,0);
		}
		
		//Set Tabibito Max
		total = (boubi + bukkyo + kirisuto + bunka)/10;
		remain = total - counter;
		tabibitoObj.transform.FindChild ("TabibitoMaxValue").GetComponent<Text> ().text = total.ToString ();
		tabibitoObj.transform.FindChild ("TabibitoCountDownValue").GetComponent<Text> ().text = remain.ToString ();



		/***************************/
		/*Tabibito Controller End  */
		/***************************/



	}
Example #37
0
	public void OnClick(){

		//Common
		Message msg = new Message();

		//Check Shinobi
		if (cyouhouSnbRankId != 0) {

			List<string> myBusyoList = new List<string> ();
			string myBusyoString = PlayerPrefs.GetString ("myBusyo");
			if (myBusyoString.Contains (",")) {
				char[] delimiterChars = { ',' };
				myBusyoList = new List<string> (myBusyoString.Split (delimiterChars));
			} else {
				myBusyoList.Add (myBusyoString);
			}

			//Check Busyo
			if(myBusyoList.Count != 0){
				
				scrollObj.SetActive (true);
				scrollObj.transform.FindChild ("Back").GetComponent<DoKousaku> ().scrollObj = scrollObj;
				GameObject doBtnObj = scrollObj.transform.FindChild ("Do").gameObject;
				doBtnObj.GetComponent<DoKousaku> ().scrollObj = scrollObj;

				//Make Scroll
				GameObject content = scrollObj.transform.FindChild("ScrollView").transform.FindChild("Content").gameObject;

				foreach (Transform obj in content.transform) {
					Destroy (obj.gameObject);
				}


				string slotPath = "Prefabs/Map/kousaku/Slot";
				string dfcPath = "Prefabs/Map/kousaku/TextObj";
				for(int i=0; i<myBusyoList.Count; i++){

					string busyoId = myBusyoList [i];

					//Slot
					GameObject slot = Instantiate (Resources.Load (slotPath)) as GameObject;
					slot.transform.SetParent(content.transform);
					slot.transform.localScale = new Vector3 (1, 1, 1);

					//Busyo
					string busyoPath = "Prefabs/Player/Unit/" + busyoId;
					GameObject busyo = Instantiate (Resources.Load (busyoPath)) as GameObject;
					busyo.transform.SetParent(slot.transform);
					busyo.transform.localScale = new Vector3 (4, 5, 0);
					busyo.name = busyoId;
					slot.name = "Slot" + busyo.name;

					busyo.GetComponent<DragHandler> ().enabled = false;			

					//Chiryaku
					GameObject txtObj = Instantiate (Resources.Load (dfcPath)) as GameObject;
					txtObj.transform.SetParent(busyo.transform);
					txtObj.transform.localScale = new Vector3 (1, 1, 0);
					txtObj.transform.localPosition = new Vector3 (5, -12, 0);

					StatusGet sts = new StatusGet();
					int lv = PlayerPrefs.GetInt (busyoId);
					float chiryakuSts = (float)sts.getDfc(int.Parse(busyoId),lv);
					chiryakuSts = chiryakuSts *10;

					txtObj.transform.FindChild ("Value").GetComponent<Text> ().text = chiryakuSts.ToString ();

					//Set Param
					KousakuBusyoSelect script = slot.GetComponent<KousakuBusyoSelect>();
					script.busyoId = int.Parse(busyoId);
					script.dfc = chiryakuSts;
					script.doBtnObj = doBtnObj;
					script.content = content;

					//Initial Setting
					if (i == 0) {
						slot.GetComponent<KousakuBusyoSelect> ().OnClick ();
					}


				}

				scrollObj.transform.FindChild ("Do").GetComponent<DoKousaku> ().cyouhouSnbRankId = cyouhouSnbRankId;
				if (name == "CyouryakuButton") {
					scrollObj.transform.FindChild ("Text").GetComponent<Text> ().text = "調略";
					scrollObj.transform.FindChild ("Do").transform.FindChild ("Text").GetComponent<Text> ().text = "調略";
					doBtnObj.GetComponent<DoKousaku> ().linkCutFlg = false;
				} else {
					scrollObj.transform.FindChild ("Text").GetComponent<Text> ().text = "連絡線遮断";
					scrollObj.transform.FindChild ("Do").transform.FindChild ("Text").GetComponent<Text> ().text = "遮断";
					doBtnObj.GetComponent<DoKousaku> ().linkCutFlg = true;
				}

			}else{
				msg.makeUpperMessageOnBoard ("今季に行動可能な武将はおりませぬ。\n季節が変わった後に命を下しましょう。");
			}

		} else {
			msg.makeUpperMessageOnBoard ("諜報にて潜伏中の忍が必要ですぞ。");
		}
	}
Example #38
0
	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;

		}
	}
Example #39
0
 protected virtual void OnStatusGet(StatusEventsArgs e)
 {
     StatusGet?.Invoke(this, e);
 }
Example #40
0
    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));
    }
Example #41
0
	public void createBusyoStatusView(string busyoId){
		int lv = PlayerPrefs.GetInt (busyoId);
		StatusGet sts = new StatusGet ();
		int hp = sts.getHp (int.Parse (busyoId), lv);
		int atk = sts.getAtk (int.Parse (busyoId), lv);
		int dfc = sts.getDfc (int.Parse (busyoId), lv);
		int spd = sts.getSpd (int.Parse (busyoId), lv);
		
		int adjHp = hp * 100;
		int adjAtk = atk * 10;
		int adjDfc = dfc * 10;
		
		GameObject.Find ("LvValue").GetComponent<Text> ().text = lv.ToString ();
		GameObject.Find ("TosotsuValue").GetComponent<Text> ().text = adjHp.ToString ();
		GameObject.Find ("BuyuuValue").GetComponent<Text> ().text = adjAtk.ToString ();
		GameObject.Find ("ChiryakuValue").GetComponent<Text> ().text = adjDfc.ToString ();
		GameObject.Find ("SpeedValue").GetComponent<Text> ().text = spd.ToString ();

		//Exp
		string expId = "exp" + busyoId.ToString ();
		string expString = "";
		int nowExp = PlayerPrefs.GetInt(expId);
		Exp exp = new Exp ();
		int requiredExp = 0;
		if (lv != 100) {
			requiredExp = exp.getExpforNextLv (lv);
		} else {
			requiredExp = exp.getExpLv100();
		}

		expString = nowExp + "/" + requiredExp;
		GameObject.Find ("ExpValue").GetComponent<Text> ().text = expString;


		//Kahou status
		KahouStatusGet kahouSts = new KahouStatusGet ();
		string[] KahouStatusArray =kahouSts.getKahouForStatus (busyoId,adjHp,adjAtk,adjDfc,spd);
		int totalBusyoHp =0;


		//Kanni
		string kanniTmp = "kanni" + busyoId;
		float addAtkByKanni = 0;
		float addHpByKanni = 0;
		float addDfcByKanni = 0;

		if (PlayerPrefs.HasKey (kanniTmp)) {
			int kanniId = PlayerPrefs.GetInt (kanniTmp);
			Kanni kanni = new Kanni ();
			string kanniIkai = kanni.getIkai (kanniId);
			string kanniName = kanni.getKanni (kanniId);
			GameObject.Find ("StatusKanni").transform.FindChild ("Value").GetComponent<Text> ().text = kanniIkai + "\n" + kanniName;

			//Status
			string kanniTarget = kanni.getEffectTarget(kanniId);
			int effect = kanni.getEffect(kanniId);
			if(kanniTarget=="atk"){
				addAtkByKanni = ((float)adjAtk * (float)effect)/100;
			}else if(kanniTarget=="hp"){
				addHpByKanni = ((float)adjHp * (float)effect)/100;
			}else if(kanniTarget=="dfc"){
				addDfcByKanni = ((float)adjDfc * (float)effect)/100;
			}

		
		} else {
			GameObject.Find ("StatusKanni").transform.FindChild ("Value").GetComponent<Text> ().text = "官位無し";
		}

		//Jyosyu
		string jyosyuTmp = "jyosyuBusyo" + busyoId;
		if (PlayerPrefs.HasKey (jyosyuTmp)) {
			int kuniId = PlayerPrefs.GetInt(jyosyuTmp);
			KuniInfo kuni = new KuniInfo();
			string kuniName = kuni.getKuniName(kuniId);

			GameObject.Find ("StatusJyosyu").transform.FindChild ("Value").GetComponent<Text> ().text = kuniName + "\n城主";

		} else {
			GameObject.Find ("StatusJyosyu").transform.FindChild ("Value").GetComponent<Text> ().text = "城無し";
		}




		//Show Additional Status
		int finalAtk = int.Parse (KahouStatusArray [0]) + Mathf.FloorToInt (addAtkByKanni);
		int finalHp = int.Parse (KahouStatusArray [1]) + Mathf.FloorToInt (addHpByKanni);
		int finalDfc= int.Parse (KahouStatusArray [2]) + Mathf.FloorToInt (addDfcByKanni);
		int finalSpd = int.Parse (KahouStatusArray [3]);

		GameObject.Find ("KahouAtkValue").GetComponent<Text> ().text = "+" + finalAtk.ToString ();
		GameObject.Find ("KahouHpValue").GetComponent<Text>().text = "+" + finalHp.ToString();
		totalBusyoHp = adjHp + finalHp;
		GameObject.Find ("KahouDfcValue").GetComponent<Text>().text = "+" + finalDfc.ToString();
		GameObject.Find ("KahouSpdValue").GetComponent<Text>().text = "+" + finalSpd.ToString();


		//Butai Status
		string heiId = "hei" + busyoId.ToString ();
		string chParam = PlayerPrefs.GetString (heiId, "0");
		
		char[] delimiterChars = {':'};
		string[] ch_list = chParam.Split (delimiterChars);
		
		string ch_type = ch_list [0];
		int ch_num = int.Parse (ch_list [1]);
		int ch_lv = int.Parse (ch_list [2]);
		float ch_status = float.Parse (ch_list [3]);
		
		string heisyu = "";
		if (ch_type == "KB") {
			heisyu = "騎馬隊";
		} else if (ch_type == "YR") {
			heisyu = "槍隊";
		} else if (ch_type == "TP") {
			heisyu = "鉄砲隊";
		} else if (ch_type == "YM") {
			heisyu = "弓隊";
		}
		GameObject.Find ("ChildNameValue").GetComponent<Text> ().text = heisyu;
		GameObject.Find ("ChildQtyValue").GetComponent<Text> ().text = ch_num.ToString ();
		GameObject.Find ("ChildLvValue").GetComponent<Text> ().text = ch_lv.ToString ();

		//Jyosyu Handling
		JyosyuHeiryoku jyosyuHei = new JyosyuHeiryoku ();
		float addHei = (float)jyosyuHei.GetJyosyuHeiryoku (busyoId);
		float hei = ch_status * 10;
		string heiText = hei.ToString() + "<size=150><Color=#35D74BFF>+" + addHei + "</Color></size>";
		GameObject.Find ("ChildHeiryokuValue").GetComponent<Text> ().text = heiText;


		int chAtkDfc = (int)sts.getChAtkDfc ((int)hei, totalBusyoHp);
		string chAtkDfcString = chAtkDfc.ToString () + "/" + chAtkDfc.ToString (); 
		GameObject.Find ("ChildStatusValue").GetComponent<Text> ().text = chAtkDfcString;
		
		//Child Image
		foreach (Transform n in GameObject.Find ("Img").transform) {
			GameObject.Destroy (n.gameObject);
		}
		string chPath = "Prefabs/Player/Unit/" + ch_type;
		GameObject chObj = Instantiate (Resources.Load (chPath)) as GameObject;
		chObj.transform.SetParent(GameObject.Find ("Img").transform);
		RectTransform chTransform = chObj.GetComponent<RectTransform> ();
		chTransform.anchoredPosition3D = new Vector3 (-200, -50, 0);
		chTransform.sizeDelta = new Vector2 (40, 40);
		chObj.transform.localScale = new Vector2 (4, 4);



		GameObject chigyo = GameObject.Find ("ButtonCyouhei");
		chigyo.GetComponent<BusyoStatusButton> ().ch_type = ch_type;
		chigyo.GetComponent<BusyoStatusButton> ().ch_heisyu = heisyu;
		chigyo.GetComponent<BusyoStatusButton> ().ch_num = ch_num;
		chigyo.GetComponent<BusyoStatusButton> ().ch_status = chAtkDfc;
		chigyo.GetComponent<BusyoStatusButton> ().ch_hp = hei;
		chigyo.GetComponent<BusyoStatusButton> ().pa_hp = totalBusyoHp/100;

		GameObject kunren = GameObject.Find ("ButtonKunren");
		kunren.GetComponent<BusyoStatusButton> ().ch_type = ch_type;
		kunren.GetComponent<BusyoStatusButton> ().ch_heisyu = heisyu;
		kunren.GetComponent<BusyoStatusButton> ().ch_lv = ch_lv;
		kunren.GetComponent<BusyoStatusButton> ().ch_status = chAtkDfc;
		kunren.GetComponent<BusyoStatusButton> ().ch_hp = hei ;
		kunren.GetComponent<BusyoStatusButton> ().ch_num = ch_num;
		kunren.GetComponent<BusyoStatusButton> ().pa_hp = totalBusyoHp/100;

		//Parametor Setting
		GameObject.Find ("GameScene").GetComponent<NowOnBusyo>().OnBusyo = busyoId;

	}
Example #42
0
	public void makeInstance(int mapId, int busyoId, int lv, string ch_type, int ch_num, int hp, int atk, int dfc,int spd, string busyoName, int linkNo, bool taisyo){
		string path = "Prefabs/Enemy/" + busyoId;
		GameObject prefab = Instantiate(Resources.Load (path)) as GameObject;


		//Busyo Detail Info [Name & HP Bar]
		string dtlPath = "Prefabs/BusyoDtl/BusyoDtlEnemy";
		GameObject dtl = Instantiate(Resources.Load (dtlPath)) as GameObject;
		dtl.transform.parent = prefab.transform;
		
		//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 (5, 16);
			prefab.GetComponent<LineLocation>().nowLine = 1;
		} else if (mapId == 2) {
			prefab.transform.position = new Vector2 (20, 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 (50, 16);
			prefab.GetComponent<LineLocation>().nowLine = 1;
		} else if (mapId == 5) {
			prefab.transform.position = new Vector2 (65, 16);
			prefab.GetComponent<LineLocation>().nowLine = 1;
		} else if (mapId == 6) {
			prefab.transform.position = new Vector2 (5, 8);
			prefab.GetComponent<LineLocation>().nowLine = 2;
		} else if (mapId == 7) {
			prefab.transform.position = new Vector2 (20, 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 (50, 8);
			prefab.GetComponent<LineLocation>().nowLine = 2;
		} else if (mapId == 10) {
			prefab.transform.position = new Vector2 (65, 8);
			prefab.GetComponent<LineLocation>().nowLine = 2;
		} else if (mapId == 11) {
			prefab.transform.position = new Vector2 (5, 0);
			prefab.GetComponent<LineLocation>().nowLine = 3;
		} else if (mapId == 12) {
			prefab.transform.position = new Vector2 (20, 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 (50, 0);
			prefab.GetComponent<LineLocation>().nowLine = 3;
		} else if (mapId == 15) {
			prefab.transform.position = new Vector2 (65, 0);
			prefab.GetComponent<LineLocation>().nowLine = 3;
		} else if (mapId == 16) {
			prefab.transform.position = new Vector2 (5, -8);
			prefab.GetComponent<LineLocation>().nowLine = 4;
		} else if (mapId == 17) {
			prefab.transform.position = new Vector2 (20, -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 (50, -8);
			prefab.GetComponent<LineLocation>().nowLine = 4;
		} else if (mapId == 20) {
			prefab.transform.position = new Vector2 (65, -8);
			prefab.GetComponent<LineLocation>().nowLine = 4;
		} else if (mapId == 21) {
			prefab.transform.position = new Vector2 (5, -16);
			prefab.GetComponent<LineLocation>().nowLine = 5;
		} else if (mapId == 22) {
			prefab.transform.position = new Vector2 (20, -16);
			prefab.GetComponent<LineLocation>().nowLine = 5;
		} else if (mapId == 23) {
			prefab.transform.position = new Vector2 (35, -16);
			prefab.GetComponent<LineLocation>().nowLine = 5;
		} else if (mapId == 24) {
			prefab.transform.position = new Vector2 (50, -16);
			prefab.GetComponent<LineLocation>().nowLine = 5;
		} else if (mapId == 25) {
			prefab.transform.position = new Vector2 (65, -16);
			prefab.GetComponent<LineLocation>().nowLine = 5;
		}


		//Link Adjustment
		float linkAdjst = (float)linkNo/10;
		hp = hp * 100;
		dfc = dfc * 10;

		if (linkNo != 0) {
			float adjstHp = hp * linkAdjst;
			hp = hp + (int)adjstHp;

			float adjstDfc = dfc * linkAdjst;
			dfc = dfc + (int)adjstDfc;
		}


		//HP Bar
		GameObject minHpBar = dtl.transform.FindChild("MinHpBar").gameObject;
		minHpBar.GetComponent<BusyoHPBar>().initLife = hp;

		//parametor setting
		prefab.GetComponent<EnemyHP>().life = hp;
		if (prefab.GetComponent<EnemyAttack> ()) {
			atk = atk * 10;
			if (linkNo != 0) {
				float adjstAtk = atk * linkAdjst;
				atk = atk + (int)adjstAtk;

			}
			prefab.GetComponent<EnemyAttack> ().attack = atk;
			prefab.GetComponent<Homing> ().speed = spd;
			prefab.GetComponent<Homing>().leftFlg = true;

		} else {
			if(ch_type == "YM"){
				atk = atk * 30;
			}else if(ch_type == "TP"){
				atk = atk * 50;
			}
			if (linkNo != 0) {
				float adjstAtk = atk * linkAdjst;
				atk = atk + (int)adjstAtk;
			}

			prefab.GetComponent<AttackLong> ().attack = atk;
			prefab.GetComponent<HomingLong> ().speed = spd;
			prefab.GetComponent<HomingLong>().leftFlg = true;
		}
		prefab.GetComponent<EnemyHP> ().dfc = dfc;

		if (taisyo) {
			prefab.GetComponent<EnemyHP> ().taisyo = true;

		}



		/*Child Instantiate*/
		//set child object
		string ch_path = "Prefabs/Enemy/" + 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 = ch_prefab.name + "_" + prefab.name;

			//Sashimono Making
			string sashimono_path = "Prefabs/Sashimono/" + busyoId;
			GameObject sashimono = Instantiate(Resources.Load (sashimono_path)) as GameObject;
			sashimono.transform.parent = ch_prefab.transform;


			//reverse Horizonal
			sashimono.transform.localScale = new Vector2(0.3f,0.3f);
			sashimono.transform.localEulerAngles = new Vector3(sashimono.transform.localEulerAngles.x, sashimono.transform.localEulerAngles.y, 10);

			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 ch_status = getChildStatus(lv, ch_type, linkNo);

			//Round up because of Link adjustment might be under 0
			int atkDfc = Mathf.CeilToInt(sts.getChAtkDfc(ch_status, hp));

			ch_prefab.GetComponent<EnemyHP>().life = ch_status;
			if(ch_prefab.GetComponent<EnemyAttack> ()){
				ch_prefab.GetComponent<EnemyAttack> ().attack =atkDfc;
				ch_prefab.GetComponent<HomingPrnt>().leftFlg = true;
			}else{
				if (ch_type == "TP") {
					ch_prefab.GetComponent<AttackLong> ().attack = atkDfc * 5;
				} else if (ch_type == "YM") {
					ch_prefab.GetComponent<AttackLong> ().attack = atkDfc * 3;
				}
				ch_prefab.GetComponent<HomingLongPrnt>().leftFlg = true;
			}
			ch_prefab.GetComponent<EnemyHP>().dfc = atkDfc;
		}

	}
Example #43
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();

        if (name == "YesButton")
        {
            /*Tsuihou*/
            //Limit Check
            int myBusyoQty = PlayerPrefs.GetInt("myBusyoQty");

            if (myBusyoQty == 1)
            {
                //Error
                audioSources [4].Play();
                Message msg = new Message();
                msg.makeMessage(msg.getMessage(91));
            }
            else
            {
                audioSources [4].Play();
                //Delete Data
                //myBusyo
                List <string> myBusyo_list   = new List <string> ();
                string        myBusyoString  = PlayerPrefs.GetString("myBusyo");
                char[]        delimiterChars = { ',' };
                myBusyo_list.AddRange(myBusyoString.Split(delimiterChars));
                myBusyo_list.Remove(busyoId.ToString());
                string newMyBusyoString = "";
                string newOnBusyo       = myBusyo_list[0];
                for (int i = 0; i < myBusyo_list.Count; i++)
                {
                    newMyBusyoString = newMyBusyoString + myBusyo_list[i] + ",";
                }
                newMyBusyoString = newMyBusyoString.TrimEnd(',');


                //kahou
                List <string> kahou_list  = new List <string> ();
                string        kahou       = "kahou" + busyoId;
                string        kahouString = PlayerPrefs.GetString(kahou);
                kahou_list.AddRange(kahouString.Split(delimiterChars));

                string availableBugu        = PlayerPrefs.GetString("availableBugu");
                string availableKabuto      = PlayerPrefs.GetString("availableKabuto");
                string availableGusoku      = PlayerPrefs.GetString("availableGusoku");
                string availableMeiba       = PlayerPrefs.GetString("availableMeiba");
                string availableCyadougu    = PlayerPrefs.GetString("availableCyadougu");
                string availableHeihousyo   = PlayerPrefs.GetString("availableHeihousyo");
                string availableChishikisyo = PlayerPrefs.GetString("availableChishikisyo");

                for (int j = 0; j < kahou_list.Count; j++)
                {
                    string kahouId = kahou_list[j];

                    if (j == 0)
                    {
                        //Bugu
                        if (kahouId != "0")
                        {
                            if (availableBugu != "" && availableBugu != null)
                            {
                                availableBugu = availableBugu + "," + kahouId;
                            }
                            else
                            {
                                availableBugu = kahouId;
                            }
                        }
                    }
                    else if (j == 1)
                    {
                        //Kabuto
                        if (kahouId != "0")
                        {
                            if (availableKabuto != "" && availableKabuto != null)
                            {
                                availableKabuto = availableKabuto + "," + kahouId;
                            }
                            else
                            {
                                availableKabuto = kahouId;
                            }
                        }
                    }
                    else if (j == 2)
                    {
                        //Gusoku
                        if (kahouId != "0")
                        {
                            if (availableGusoku != "" && availableGusoku != null)
                            {
                                availableGusoku = availableGusoku + "," + kahouId;
                            }
                            else
                            {
                                availableGusoku = kahouId;
                            }
                        }
                    }
                    else if (j == 3)
                    {
                        //Meiba
                        if (kahouId != "0")
                        {
                            if (availableMeiba != "" && availableMeiba != null)
                            {
                                availableMeiba = availableMeiba + "," + kahouId;
                            }
                            else
                            {
                                availableMeiba = kahouId;
                            }
                        }
                    }
                    else if (j == 4)
                    {
                        //Cyadougu1
                        if (kahouId != "0")
                        {
                            if (availableCyadougu != "" && availableCyadougu != null)
                            {
                                availableCyadougu = availableCyadougu + "," + kahouId;
                            }
                            else
                            {
                                availableCyadougu = kahouId;
                            }
                        }
                    }
                    else if (j == 5)
                    {
                        //Cyadougu2
                        if (kahouId != "0")
                        {
                            if (availableCyadougu != "" && availableCyadougu != null)
                            {
                                availableCyadougu = availableCyadougu + "," + kahouId;
                            }
                            else
                            {
                                availableCyadougu = kahouId;
                            }
                        }
                    }
                    else if (j == 6)
                    {
                        //Heihousyo
                        if (kahouId != "0")
                        {
                            if (availableHeihousyo != "" && availableHeihousyo != null)
                            {
                                availableHeihousyo = availableHeihousyo + "," + kahouId;
                            }
                            else
                            {
                                availableHeihousyo = kahouId;
                            }
                        }
                    }
                    else if (j == 7)
                    {
                        //Chishikisyo
                        if (kahouId != "0")
                        {
                            if (availableChishikisyo != "" && availableChishikisyo != null)
                            {
                                availableChishikisyo = availableChishikisyo + "," + kahouId;
                            }
                            else
                            {
                                availableChishikisyo = kahouId;
                            }
                        }
                    }
                }

                //Kanni
                string kanniTmp = "kanni" + busyoId;
                if (PlayerPrefs.HasKey(kanniTmp))
                {
                    DoRemoveKanni removeKanni = new DoRemoveKanni();
                    removeKanni.removeKanni(busyoId.ToString());
                }

                //Jyosyu
                for (int i = 1; i < 66; i++)
                {
                    string jyosyuTemp = "jyosyu" + i.ToString();
                    int    jyosyu     = PlayerPrefs.GetInt(jyosyuTemp);
                    if (jyosyu == busyoId)
                    {
                        PlayerPrefs.DeleteKey(jyosyuTemp);
                        break;
                    }
                }


                //OK
                PlayerPrefs.SetString("myBusyo", newMyBusyoString);
                PlayerPrefs.DeleteKey(busyoId.ToString());
                string hei = "hei" + busyoId;
                PlayerPrefs.DeleteKey(hei);
                string senpou = "senpou" + busyoId;
                PlayerPrefs.DeleteKey(senpou);
                string saku = "saku" + busyoId;
                PlayerPrefs.DeleteKey(saku);
                string jyosyuHei = "jyosyuHei" + busyoId;
                PlayerPrefs.DeleteKey(jyosyuHei);
                string jyosyuBusyo = "jyosyuBusyo" + busyoId;
                PlayerPrefs.DeleteKey(jyosyuBusyo);
                if (availableBugu != null)
                {
                    PlayerPrefs.SetString("availableBugu", availableBugu);
                }
                if (availableKabuto != null)
                {
                    PlayerPrefs.SetString("availableKabuto", availableKabuto);
                }
                if (availableGusoku != null)
                {
                    PlayerPrefs.SetString("availableGusoku", availableGusoku);
                }
                if (availableMeiba != null)
                {
                    PlayerPrefs.SetString("availableMeiba", availableMeiba);
                }
                if (availableCyadougu != null)
                {
                    PlayerPrefs.SetString("availableCyadougu", availableCyadougu);
                }
                if (availableHeihousyo != null)
                {
                    PlayerPrefs.SetString("availableHeihousyo", availableHeihousyo);
                }
                if (availableChishikisyo != null)
                {
                    PlayerPrefs.SetString("availableChishikisyo", availableChishikisyo);
                }
                PlayerPrefs.DeleteKey(kahou);
                string exp = "exp" + busyoId;
                PlayerPrefs.DeleteKey(exp);
                string gokui = "gokui" + busyoId;
                PlayerPrefs.DeleteKey(gokui);

                //jinkei 1map1 ~ 4map25
                int oyaId = 1;
                for (int k = oyaId; k < 5; k++)
                {
                    int koId = 1;

                    for (int l = koId; l < 26; l++)
                    {
                        string mapKey   = k.ToString() + "map" + l.ToString();
                        int    mapBusyo = PlayerPrefs.GetInt(mapKey);

                        if (mapBusyo == busyoId)
                        {
                            //Delete
                            PlayerPrefs.DeleteKey(mapKey);
                        }
                    }
                }
                myBusyoQty = myBusyoQty - 1;
                PlayerPrefs.SetInt("myBusyoQty", myBusyoQty);
                PlayerPrefs.Flush();

                //Back & Update
                Destroy(GameObject.Find("TsuihouConfirm"));
                Destroy(GameObject.Find("Back(Clone)"));

                MessageBusyo msg         = new MessageBusyo();
                string       tsuihouText = "";
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    tsuihouText = "Banished " + busyoName + ".";
                }
                else
                {
                    tsuihouText = busyoName + "を追放しました。";
                }
                string type = "tsuihou";
                msg.makeMessage(tsuihouText, busyoId, type);

                //Now On Busyo Mod.
                GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyo = newOnBusyo;
                StatusGet sts = new StatusGet();
                GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyoName = sts.getBusyoName(int.Parse(newOnBusyo));

                /*Initialization*/
                //BusyoView
                RonkouScene ronkou = new RonkouScene();
                SyoguScene  syogu  = new SyoguScene();
                //Delete
                foreach (Transform n in GameObject.Find("BusyoView").transform)
                {
                    //Busyo Serihu
                    GameObject.Destroy(n.gameObject);
                }
                //Create
                ronkou.createBusyoView(newOnBusyo.ToString());

                //BusyoStatus
                syogu.createSyoguView(newOnBusyo.ToString());

                //Scroll View
                //Delete
                foreach (Transform n in GameObject.Find("Content").transform)
                {
                    GameObject.Destroy(n.gameObject);
                }

                //Create
                List <string> myBusyoList    = new List <string>();
                GameObject    mainController = GameObject.Find("GameScene");
                string        minBusyoId     = "";
                minBusyoId = ronkou.createScrollView(myBusyoList, minBusyoId, mainController, false);
            }
        }
        else if (name == "NoButton")
        {
            //Back
            audioSources [1].Play();
            Destroy(GameObject.Find("TsuihouConfirm"));
            Destroy(GameObject.Find("Back(Clone)"));
        }
    }
Example #44
0
	// Use this for initialization
	void Start () {


		//Dinamic Map
		activeKuniId  = PlayerPrefs.GetInt("activeKuniId");
		activeStageId = PlayerPrefs.GetInt("activeStageId");
		Stage stage = new Stage ();

		if (activeStageId != 0) {
			//Active

			int stageMapId = stage.getStageMap (activeKuniId, activeStageId); 

			string mapPath = "";
			string mapFrontPath = "";
			Instantiate (wallPrefab);

			if (stageMapId != 1) {
				if (stageMapId == 2) {
					//mountain
					mapPath = "Prefabs/PreKassen/map2";
					GameObject map = Instantiate (Resources.Load (mapPath)) as GameObject;

					mapFrontPath = "Prefabs/PreKassen/mapFront2";
					GameObject mapFront = Instantiate (Resources.Load (mapFrontPath)) as GameObject;

					weatherHandling(stageMapId, map, mapFront);

				} else if (stageMapId == 3) {
					//sea
					mapPath = "Prefabs/PreKassen/map3";
					GameObject map = Instantiate (Resources.Load (mapPath)) as GameObject;

					mapFrontPath = "Prefabs/PreKassen/mapFront3";
					GameObject mapFront = Instantiate (Resources.Load (mapFrontPath)) as GameObject;

					weatherHandling(stageMapId, map, mapFront);
				}
			} else {
				
				Instantiate (treePrefab);

				mapPath = "Prefabs/PreKassen/map1";
				GameObject map = Instantiate (Resources.Load (mapPath)) as GameObject;

				weatherHandling(stageMapId, map, null);
			}

		} else {
			//Passive
			int stageMapId = stage.getStageMap (activeKuniId, 10); 

			string mapPath = "";
			string mapFrontPath = "";
			Instantiate (wallPrefab);

			if (stageMapId != 1) {
				if (stageMapId == 2) {
					//mountain
					mapPath = "Prefabs/PreKassen/map2";
					GameObject map = Instantiate (Resources.Load (mapPath)) as GameObject;

					mapFrontPath = "Prefabs/PreKassen/mapFront2";
					GameObject mapFront = Instantiate (Resources.Load (mapFrontPath)) as GameObject;

					weatherHandling(stageMapId, map, mapFront);

				} else if (stageMapId == 3) {
					//sea
					mapPath = "Prefabs/PreKassen/map3";
					GameObject map = Instantiate (Resources.Load (mapPath)) as GameObject;

					mapFrontPath = "Prefabs/PreKassen/mapFront3";
					GameObject mapFront = Instantiate (Resources.Load (mapFrontPath)) as GameObject;

					weatherHandling(stageMapId, map, mapFront);
				}
			} else {
				Instantiate (mapPrefab);
				Instantiate (treePrefab);

				weatherHandling(stageMapId, mapPrefab, null);
			}
		}

		/*Get Minus Status*/
		float mntMinusRatio = PlayerPrefs.GetFloat("mntMinusStatus",0);
		float seaMinusRatio = PlayerPrefs.GetFloat("seaMinusStatus",0);
		float rainMinusRatio = PlayerPrefs.GetFloat("rainMinusStatus",0);
		float snowMinusRatio = PlayerPrefs.GetFloat("snowMinusStatus",0);
	
		/*プレイヤー配置*/
		//ユーザ陣形データのロード
		int jinkei =PlayerPrefs.GetInt("jinkei",0);
		List<int> myBusyoList = new List<int> (); 

		//1.魚麟
		if (jinkei == 1) {
			soudaisyo = PlayerPrefs.GetInt("soudaisyo1");
			if(PlayerPrefs.HasKey("1map1")){
				int mapId = 1;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map2")){
				int mapId = 2;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map7")){
				int mapId = 7;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map8")){
				int mapId = 8;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map11")){
				int mapId = 11;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map12")){
				int mapId = 12;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map13")){
				int mapId = 13;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map14")){
				int mapId = 14;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map17")){
				int mapId = 17;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map18")){
				int mapId = 18;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map21")){
				int mapId = 21;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map22")){
				int mapId = 22;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}



		//2.鶴翼
		}else if(jinkei == 2){
			soudaisyo = PlayerPrefs.GetInt("soudaisyo2");

			if(PlayerPrefs.HasKey("2map3")){
				int mapId = 3;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map4")){
				int mapId = 4;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map5")){
				int mapId = 5;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map7")){
				int mapId = 7;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map8")){
				int mapId = 8;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map11")){
				int mapId = 11;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map12")){
				int mapId = 12;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map17")){
				int mapId = 17;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map18")){
				int mapId = 18;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map23")){
				int mapId = 23;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map24")){
				int mapId = 24;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map25")){
				int mapId = 25;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}

		}
		//3.偃月
		else if(jinkei == 3){
			soudaisyo = PlayerPrefs.GetInt("soudaisyo3");

			if(PlayerPrefs.HasKey("3map3")){
				int mapId = 3;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map7")){
				int mapId = 7;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map8")){
				int mapId = 8;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map9")){
				int mapId = 9;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map11")){
				int mapId = 11;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map12")){
				int mapId = 12;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map14")){
				int mapId = 14;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map15")){
				int mapId = 15;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map16")){
				int mapId = 16;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map20")){
				int mapId = 20;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map21")){
				int mapId = 21;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map25")){
				int mapId = 25;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
		}

		//4.雁行
		else if(jinkei == 4){
			soudaisyo = PlayerPrefs.GetInt("soudaisyo4");

			if(PlayerPrefs.HasKey("4map1")){
				int mapId = 1;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map2")){
				int mapId = 2;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map7")){
				int mapId = 7;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map8")){
				int mapId = 8;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map12")){
				int mapId = 12;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map13")){
				int mapId = 13;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map14")){
				int mapId = 14;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map18")){
				int mapId = 18;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map19")){
				int mapId = 19;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map20")){
				int mapId = 20;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map24")){
				int mapId = 24;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map25")){
				int mapId = 25;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, 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){
			GameObject slot = Instantiate (Resources.Load (slotPath)) as GameObject;

			List<string> sakuList = new List<string>();
			sakuList = saku.getSakuInfo (busyoId);
			string sakuPath = "Prefabs/Saku/saku" + sakuList[0];
			GameObject sakuIcon = Instantiate (Resources.Load (sakuPath)) as GameObject;
			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");
				
				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());
				slot.GetComponent<Saku>().sakuBusyoSpeed = sts.getSpd(busyoId,sakuBusyoLv);
			}



		}

		//Kengou
		string kengouString = PlayerPrefs.GetString("kengouItem");
		List<string> kengouList = new List<string> ();
		char[] delimiterChars3 = {','};
		kengouList = new List<string> (kengouString.Split (delimiterChars3));

		for (int i=0; i<kengouList.Count; i++) {
			int qty = int.Parse(kengouList[i]);
			if(qty != 0){
				GameObject slot = Instantiate (Resources.Load (slotPath)) as GameObject;
				string kengouPath = "Prefabs/Saku/saku7";
				GameObject sakuIcon = Instantiate (Resources.Load (kengouPath)) 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);

				ItemInfo item = new ItemInfo();
				int temp = i + 1;
				string itemCd = "kengou" + temp.ToString();
				string kengouName = item.getItemName(itemCd);
				sakuIcon.transform.FindChild("sakuIconText").GetComponent<Text>().text = kengouName;
				sakuIcon.transform.FindChild("sakuIconText").transform.localScale = new Vector2 (0.11f,0.15f);

				slot.GetComponent<Saku>().sakuId = 7;

				int effect = item.getItemEffect(itemCd);
				slot.GetComponent<Saku>().sakuEffect = effect;
				slot.GetComponent<Saku>().kengouCd = itemCd;
				slot.GetComponent<Saku>().kengouQty = qty;
				slot.GetComponent<Saku>().kengouName = kengouName;
			}
		}


		//Nanban
		string nanbanString = PlayerPrefs.GetString("nanbanItem");
		List<string> nanbanList = new List<string> ();
		nanbanList = new List<string> (nanbanString.Split (delimiterChars3));

		for (int i=0; i<nanbanList.Count; i++) {
			int qty = int.Parse(nanbanList[i]);
			if(qty != 0){
				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";
				}else if(i==2){
					nanbanPath = "Prefabs/Saku/saku10";
				}

				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;


				if(i == 2){
					//teppou youhei
					slot.GetComponent<Saku>().sakuHeisyu = "TP";
					//Hei Status
					string heiId = "hei" + soudaisyo.ToString();
					string chParam = PlayerPrefs.GetString(heiId,"0");
					
					char[] delimiterChars = {':'};
					string[] ch_list = chParam.Split(delimiterChars);
					slot.GetComponent<Saku>().sakuHeiSts =  float.Parse (ch_list[3]);
					slot.GetComponent<Saku>().sakuBusyoId =  soudaisyo;
					
					//Busyo Speed
					int sakuBusyoLv = PlayerPrefs.GetInt(soudaisyo.ToString());
					slot.GetComponent<Saku>().sakuBusyoSpeed = sts.getSpd(soudaisyo,sakuBusyoLv);
				}

			}
		}



		/*エネミー配置*/
		int linkNo = PlayerPrefs.GetInt("activeLink",0);
		enemySoudaisyo = PlayerPrefs.GetInt("enemySoudaisyo");


		if(PlayerPrefs.HasKey("emap1")){
			int mapId = 1;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap2")){
			int mapId = 2;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap3")){
			int mapId = 3;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap4")){
			int mapId = 4;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap5")){
			int mapId = 5;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap6")){
			int mapId = 6;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap7")){
			int mapId = 7;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap8")){
			int mapId = 8;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap9")){
			int mapId = 9;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap10")){
			int mapId = 10;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap11")){
			int mapId = 11;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap12")){
			int mapId = 12;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap13")){
			int mapId = 13;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap14")){
			int mapId = 14;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap15")){
			int mapId = 15;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap16")){
			int mapId = 16;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap17")){
			int mapId = 17;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap18")){
			int mapId = 18;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap19")){
			int mapId = 19;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap20")){
			int mapId = 20;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap21")){
			int mapId = 21;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap22")){
			int mapId = 22;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap23")){
			int mapId = 23;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap24")){
			int mapId = 24;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap25")){
			int mapId = 25;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, 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);



	}
Example #45
0
	//doramatic charactor

	// Use this for initialization
	void Start () {
		//map生成
		Instantiate(mapPrefab);
		Instantiate(treePrefab);
		Instantiate(wallPrefab);


		/*プレイヤー配置*/
	
		//ユーザ陣形データのロード
		int jinkei =PlayerPrefs.GetInt("jinkei",0);

		//1.魚麟
		if (jinkei == 1) {
			if(PlayerPrefs.HasKey("1map1")){
				int mapId = 1;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map2")){
				int mapId = 2;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map7")){
				int mapId = 7;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map8")){
				int mapId = 8;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map11")){
				int mapId = 11;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map12")){
				int mapId = 12;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map13")){
				int mapId = 13;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map14")){
				int mapId = 14;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map17")){
				int mapId = 17;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map18")){
				int mapId = 18;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map21")){
				int mapId = 21;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map22")){
				int mapId = 22;
				getStsAndMakeInstance(jinkei,mapId);
			}
		


		//2.鶴翼
		}else if(jinkei == 2){
			if(PlayerPrefs.HasKey("2map3")){
				int mapId = 3;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map4")){
				int mapId = 4;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map5")){
				int mapId = 5;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map7")){
				int mapId = 7;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map8")){
				int mapId = 8;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map11")){
				int mapId = 11;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map12")){
				int mapId = 12;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map17")){
				int mapId = 17;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map18")){
				int mapId = 18;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map23")){
				int mapId = 23;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map24")){
				int mapId = 24;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map25")){
				int mapId = 25;
				getStsAndMakeInstance(jinkei,mapId);
			}

		}
		//3.偃月
		else if(jinkei == 3){
			if(PlayerPrefs.HasKey("3map3")){
				int mapId = 3;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map7")){
				int mapId = 7;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map8")){
				int mapId = 8;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map9")){
				int mapId = 9;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map11")){
				int mapId = 11;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map12")){
				int mapId = 12;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map14")){
				int mapId = 14;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map15")){
				int mapId = 15;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map16")){
				int mapId = 16;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map20")){
				int mapId = 20;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map21")){
				int mapId = 21;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map25")){
				int mapId = 25;
				getStsAndMakeInstance(jinkei,mapId);
			}
		}

		//4.雁行
		else if(jinkei == 4){
			if(PlayerPrefs.HasKey("4map1")){
				int mapId = 1;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map2")){
				int mapId = 2;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map7")){
				int mapId = 7;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map8")){
				int mapId = 8;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map12")){
				int mapId = 12;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map13")){
				int mapId = 13;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map14")){
				int mapId = 14;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map18")){
				int mapId = 18;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map19")){
				int mapId = 19;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map20")){
				int mapId = 20;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map24")){
				int mapId = 24;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map25")){
				int mapId = 25;
				getStsAndMakeInstance(jinkei,mapId);
			}
		}


		/*エネミー配置*/
		//stageId取得しマスタ判別
		int tempStageId = PlayerPrefs.GetInt("activeStageId",0);
		int kuniId = PlayerPrefs.GetInt("activeKuniId",0);

		Entity_stage_mst stageMst  = Resources.Load ("Data/stage_mst") as Entity_stage_mst;

		//y=10(X-1)+z-1
		int stageId = 10*(kuniId - 1) + tempStageId;

		//Jinkei Random
		List<int> jinkeiList = new List<int> (){1,2,3,4};
		int enemyJinkei = UnityEngine.Random.Range(1,jinkeiList.Count + 1);

		/*Dynamic Enemy Setting Start*/
		int activeDaimyoId = PlayerPrefs.GetInt("activeDaimyoId");
		int activeBusyoQty = PlayerPrefs.GetInt ("activeBusyoQty");
		int activeBusyoLv = PlayerPrefs.GetInt ("activeBusyoLv");
		int activeButaiQty = PlayerPrefs.GetInt ("activeButaiQty");
		int activeButaiLv = PlayerPrefs.GetInt ("activeButaiLv");
		Entity_daimyo_mst daimyoMst = Resources.Load ("Data/daimyo_mst") as Entity_daimyo_mst;
		int daimyoBusyoId = daimyoMst.param[activeDaimyoId-1].busyoId;

		//Dimyo Setting
		int taisyoMapId = 0;
		List<int> mapList = new List<int>();

		if (enemyJinkei == 1) {
			taisyoMapId = 15;
			mapList = new List<int>(){4,5,8,9,12,13,14,18,19,24,25};

		}else if (enemyJinkei == 2) {
			taisyoMapId = 15;
			mapList = new List<int>(){1,2,3,8,9,14,18,19,21,22,23};

		}else if (enemyJinkei == 3) {
			taisyoMapId = 14;
			mapList = new List<int>(){1,5,6,10,11,12,15,17,18,19,23};
				
		}else if (enemyJinkei == 4) {
			taisyoMapId = 14;
			mapList = new List<int>(){4,5,8,9,12,13,16,17,18,21,22};

		}
		
		StatusGet sts = new StatusGet();
		int hp = sts.getHp(daimyoBusyoId,activeBusyoLv);
		int atk = sts.getAtk(daimyoBusyoId,activeBusyoLv);
		int dfc = sts.getDfc(daimyoBusyoId,activeBusyoLv);
		int spd = sts.getSpd(daimyoBusyoId,activeBusyoLv);
		
		BusyoInfoGet info = new BusyoInfoGet();
		String daimyoBusyoName = info.getName(daimyoBusyoId);
		String daimyoType = info.getHeisyu(daimyoBusyoId);
		
		EnemyInstance inst = new EnemyInstance();
		inst.makeInstance(taisyoMapId, daimyoBusyoId, activeButaiLv, daimyoType, activeButaiQty, hp, atk, dfc, spd, daimyoBusyoName);

		//Busyo Setting
		//Make busyo list
		Entity_busyo_mst busyoMst  = Resources.Load ("Data/busyo_mst") as Entity_busyo_mst;
		List<int> busyoList = new List<int> ();

		for(int i=0; i<busyoMst.param.Count; i++){
			int busyoId = busyoMst.param[i].id;
			int daimyoId = busyoMst.param[i].daimyoId;

			if(daimyoId == activeDaimyoId){

				if(busyoId != daimyoBusyoId){
					busyoList.Add (busyoId);
				}
			}
		}

		//Random Shuffle
		for (int i = 0; i < busyoList.Count; i++) {
			int temp = busyoList[i];
			int randomIndex = UnityEngine.Random.Range(0, busyoList.Count);
			busyoList[i] = busyoList[randomIndex];
			busyoList[randomIndex] = temp;
		}

		for (int i = 0; i < mapList.Count; i++) {
			int temp = mapList[i];
			int randomIndex = UnityEngine.Random.Range(0, mapList.Count);
			mapList[i] = mapList[randomIndex];
			mapList[randomIndex] = temp;
		}

		for(int j=0; j<activeBusyoQty-1; j++){
			int randomBusyoId = busyoList[j];
			int mapId = mapList[j];


			//Status
			if(randomBusyoId !=0){
				int busyoHp = sts.getHp(randomBusyoId,activeBusyoLv);
				int busyoAtk = sts.getAtk(randomBusyoId,activeBusyoLv);
				int busyoDfc = sts.getDfc(randomBusyoId,activeBusyoLv);
				int busyoSpd = sts.getSpd(randomBusyoId,activeBusyoLv);

				String busyoName = info.getName(randomBusyoId);
				String busyoType = info.getHeisyu(randomBusyoId);

				inst.makeInstance(mapId, randomBusyoId, activeButaiLv, busyoType, activeButaiQty, busyoHp, busyoAtk, busyoDfc, busyoSpd, busyoName);
			}
		}

		/*Dynamic Enemy Setting Finish*/

		//合戦開始エフェクト
		string pathBack = "Prefabs/PreKassen/backGround";
		GameObject back = Instantiate(Resources.Load (pathBack)) as GameObject;
		back.transform.localScale = new Vector2 (30, 15);

		string pathLight = "Prefabs/PreKassen/lightning";
		GameObject light = Instantiate(Resources.Load (pathLight)) as GameObject;
		light.transform.localScale = new Vector2 (10, 10);



	}
Example #46
0
	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);
	}
Example #47
0
	public void getStsAndMakeInstance(int jinkei, int mapId){

		String map = jinkei.ToString() + "map" + mapId;
		//Get Status
		int busyoId = PlayerPrefs.GetInt(map);
		
		string busyoString = busyoId.ToString();
		int lv =PlayerPrefs.GetInt(busyoString);

		StatusGet sts = new StatusGet ();
		int hp = sts.getHp (busyoId, lv);
		int atk = sts.getAtk (busyoId, lv);
		int dfc = sts.getDfc (busyoId, lv);
		int spd = sts.getSpd (busyoId, lv);
		string busyoName = sts.getBusyoName (busyoId);
		ArrayList senpouArray = sts.getSenpou (busyoId);
		
		//View Object & pass status to it. 
		PlayerInstance inst = new PlayerInstance ();
		inst.makeInstance (busyoId, mapId, hp, atk, dfc, spd, senpouArray, busyoName);

	}
Example #48
0
	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;
	}
Example #49
0
    public void OnClick()
    {
        //Common
        string busyoName = GameObject.Find ("GameScene").GetComponent<NowOnBusyo>().OnBusyoName;
        string busyoId = GameObject.Find ("GameScene").GetComponent<NowOnBusyo>().OnBusyo;

        BusyoStatusButton pop = new BusyoStatusButton ();
        pop.commonPopup();
        GameObject.Find ("popText").GetComponent<Text> ().text ="秘伝書授与";

        //Busyo View
        string path = "Prefabs/Player/Unit/" + busyoId;
        GameObject Busyo = Instantiate (Resources.Load (path)) as GameObject;
        Busyo.transform.SetParent (GameObject.Find ("board(Clone)").transform);
        Busyo.transform.localScale = new Vector2 (3, 3);
        Busyo.GetComponent<DragHandler>().enabled = false;
        RectTransform busyo_transform = Busyo.GetComponent<RectTransform>();
        busyo_transform.anchoredPosition = new Vector3(300,350,0);
        busyo_transform.sizeDelta = new Vector2( 100, 100);

        //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.anchoredPosition = 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.anchoredPosition = new Vector3 (20,-50,0);
        rank_transform.sizeDelta = new Vector2( 200, 200);
        rank.GetComponent<Text>().fontSize = 200;

        //Hidensyo
        string hidensyoPath = "Prefabs/Busyo/Hidensyo";
        GameObject hidensyo = Instantiate (Resources.Load (hidensyoPath)) as GameObject;
        hidensyo.transform.SetParent (GameObject.Find ("board(Clone)").transform);
        hidensyo.transform.localScale = new Vector2 (1, 1);
        RectTransform hidensyo_transform = hidensyo.GetComponent<RectTransform>();
        hidensyo_transform.anchoredPosition = new Vector3(0,0,0);
        hidensyo.name = "Hidensyo";

        //Senpou Detail
        StatusGet sts = new StatusGet();
        ArrayList senpouArray = sts.getSenpou(int.Parse(busyoId));

        int senpouId = (int)senpouArray[0];
        GameObject.Find ("SenpouNameValue").GetComponent<Text>().text =senpouArray[2].ToString();
        int senpouLv = (int)senpouArray[8];
        GameObject.Find ("LvFrom").GetComponent<Text>().text =senpouLv.ToString();
        int nextLv = senpouLv + 1;
        GameObject.Find ("LvTo").GetComponent<Text>().text = nextLv.ToString();

        //Get Next Senpou
        List<string> senpouList = getSenpouNextLv (senpouId,nextLv);

        string senpouExp = senpouArray[3].ToString();
        float senpouEach = (float)senpouArray[4];
        float senpouRatio = (float)senpouArray[5];
        float senpouTerm = (float)senpouArray[6];
        int senpouStatus = (int)senpouArray[7];

        int diff = int.Parse (senpouList [0]) - senpouStatus;
        string adjSenpouStatus = senpouStatus.ToString() + "<color=green>" + "(+" + diff + ")" + "</color>";

        senpouExp = senpouExp.Replace("A", adjSenpouStatus);
        senpouExp = senpouExp.Replace("B", senpouEach.ToString());
        senpouExp = senpouExp.Replace("C", senpouRatio.ToString());
        senpouExp = senpouExp.Replace("D", senpouTerm.ToString());

        GameObject.Find ("PopSenpouExpValue").GetComponent<Text> ().text = senpouExp;
        Text itemText = GameObject.Find ("RequiredItemValue").GetComponent<Text> ();
        itemText.text = senpouList[2];

        Image hImage = GameObject.Find ("HidensyoItem").GetComponent<Image> ();
        Text hRank = GameObject.Find ("HidensyoRank").GetComponent<Text> ();
        string senpouType = senpouList [1];
        Color shortageColor = new Color (203f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);
        GameObject DoHidensyoObj = GameObject.Find ("GiveHidensyo");
        DoHidensyoObj.GetComponent<DoHidensyo> ().requiredItemQty = int.Parse (itemText.text);
        DoHidensyoObj.GetComponent<DoHidensyo> ().busyoId = busyoId;
        DoHidensyoObj.GetComponent<DoHidensyo> ().nextSenpouLv = nextLv;

        if(senpouType=="low"){
            Color lowColor = new Color (86f / 255f, 87f / 255f, 255f / 255f, 255f / 255f);
            hImage.color = lowColor;
            hRank.text = "下";
            int hidensyoGeQty = PlayerPrefs.GetInt ("hidensyoGe");
            DoHidensyoObj.GetComponent<DoHidensyo>().itemType = senpouType;
            if(hidensyoGeQty < int.Parse(itemText.text)){
                itemText.color = shortageColor;
                DoHidensyoObj.GetComponent<DoHidensyo>().requiredItem = false;
            }

        }else if(senpouType=="middle"){
            Color midColor = new Color (236f / 255f, 93f / 255f, 93f / 255f, 255f / 255f);
            hImage.color = midColor;
            hRank.text = "中";
            int hidensyoCyuQty = PlayerPrefs.GetInt ("hidensyoCyu");
            DoHidensyoObj.GetComponent<DoHidensyo>().itemType = senpouType;
            if(hidensyoCyuQty < int.Parse(itemText.text)){
                itemText.color = shortageColor;
                DoHidensyoObj.GetComponent<DoHidensyo>().requiredItem = false;
            }
        }else if(senpouType=="high"){
            Color hightColor = new Color (207f / 255f, 232f / 255f, 95f / 255f, 255f / 255f);
            hImage.color = hightColor;
            hRank.text = "上";
            int hidensyoJyoQty = PlayerPrefs.GetInt ("hidensyoJyo");
            DoHidensyoObj.GetComponent<DoHidensyo>().itemType = senpouType;
            if(hidensyoJyoQty < int.Parse(itemText.text)){
                itemText.color = shortageColor;
                DoHidensyoObj.GetComponent<DoHidensyo>().requiredItem = false;
            }
        }

        Text moneyAmt = GameObject.Find ("RequiredMoneyValue").GetComponent<Text> ();
        moneyAmt.text = senpouList[3];
        DoHidensyoObj.GetComponent<DoHidensyo> ().requiredMoneyAmt = int.Parse(moneyAmt.text);

        int money = PlayerPrefs.GetInt ("money");
        if(money < int.Parse (moneyAmt.text)){
            moneyAmt.color = shortageColor;
            DoHidensyoObj.GetComponent<DoHidensyo>().requiredMoney = false;
        }
    }
Example #50
0
    public void createBusyoStatusView(string busyoId)
    {
        int lv = PlayerPrefs.GetInt (busyoId);
        StatusGet sts = new StatusGet ();
        int hp = sts.getHp (int.Parse (busyoId), lv);
        int atk = sts.getAtk (int.Parse (busyoId), lv);
        int dfc = sts.getDfc (int.Parse (busyoId), lv);
        int spd = sts.getSpd (int.Parse (busyoId), lv);

        int adjHp = hp * 100;
        int adjAtk = atk * 10;
        int adjDfc = dfc * 10;

        GameObject.Find ("LvValue").GetComponent<Text> ().text = lv.ToString ();
        GameObject.Find ("TosotsuValue").GetComponent<Text> ().text = adjHp.ToString ();
        GameObject.Find ("BuyuuValue").GetComponent<Text> ().text = adjAtk.ToString ();
        GameObject.Find ("ChiryakuValue").GetComponent<Text> ().text = adjDfc.ToString ();
        GameObject.Find ("SpeedValue").GetComponent<Text> ().text = spd.ToString ();

        //Exp
        string expId = "exp" + busyoId.ToString ();
        string expString = "";
        int nowExp = PlayerPrefs.GetInt(expId);
        Exp exp = new Exp ();
        int requiredExp= exp.getExpforNextLv(lv);

        expString = nowExp + "/" + requiredExp;
        GameObject.Find ("ExpValue").GetComponent<Text> ().text = expString;

        //Kahou status
        KahouStatusGet kahouSts = new KahouStatusGet ();
        string[] KahouStatusArray =kahouSts.getKahouForStatus (busyoId,adjHp,adjAtk,adjDfc,spd);
        int totalBusyoHp =0;
        for(int i=0;i<KahouStatusArray.Length;i++){
            string status = KahouStatusArray[i];

            if(i==0){
                //Attack
                GameObject.Find ("KahouAtkValue").GetComponent<Text>().text = "+" + status;

            }else if(i==1){
                //HP
                GameObject.Find ("KahouHpValue").GetComponent<Text>().text = "+" + status;
                totalBusyoHp = adjHp + int.Parse(status);
            }else if(i==2){
                //DFC
                GameObject.Find ("KahouDfcValue").GetComponent<Text>().text = "+" + status;

            }else if(i==3){
                //SPD
                GameObject.Find ("KahouSpdValue").GetComponent<Text>().text = "+" + status;
            }
        }

        //Butai Status
        string heiId = "hei" + busyoId.ToString ();
        string chParam = PlayerPrefs.GetString (heiId, "0");

        char[] delimiterChars = {':'};
        string[] ch_list = chParam.Split (delimiterChars);

        string ch_type = ch_list [0];
        int ch_num = int.Parse (ch_list [1]);
        int ch_lv = int.Parse (ch_list [2]);
        float ch_status = float.Parse (ch_list [3]);

        string heisyu = "";
        if (ch_type == "KB") {
            heisyu = "騎馬隊";
        } else if (ch_type == "YR") {
            heisyu = "槍隊";
        } else if (ch_type == "TP") {
            heisyu = "鉄砲隊";
        } else if (ch_type == "YM") {
            heisyu = "弓隊";
        }
        GameObject.Find ("ChildNameValue").GetComponent<Text> ().text = heisyu;
        GameObject.Find ("ChildQtyValue").GetComponent<Text> ().text = ch_num.ToString ();
        GameObject.Find ("ChildLvValue").GetComponent<Text> ().text = ch_lv.ToString ();

        //Jyosyu Handling
        JyosyuHeiryoku jyosyuHei = new JyosyuHeiryoku ();
        float addHei = (float)jyosyuHei.GetJyosyuHeiryoku (busyoId);
        float hei = ch_status * 10;
        string heiText = hei.ToString() + "<size=150><Color=#35D74BFF>+" + addHei + "</Color></size>";
        GameObject.Find ("ChildHeiryokuValue").GetComponent<Text> ().text = heiText;

        float chAtkDfc = ch_status + totalBusyoHp / 200;
        string chAtkDfcString = chAtkDfc.ToString () + "/" + chAtkDfc.ToString ();
        GameObject.Find ("ChildStatusValue").GetComponent<Text> ().text = chAtkDfcString;

        //Child Image
        foreach (Transform n in GameObject.Find ("Img").transform) {
            GameObject.Destroy (n.gameObject);
        }
        string chPath = "Prefabs/Player/Unit/" + ch_type;
        GameObject chObj = Instantiate (Resources.Load (chPath)) as GameObject;
        chObj.transform.SetParent(GameObject.Find ("Img").transform);
        RectTransform chTransform = chObj.GetComponent<RectTransform> ();
        chTransform.anchoredPosition = new Vector3 (-200, -50, 0);
        chTransform.sizeDelta = new Vector2 (40, 40);
        chObj.transform.localScale = new Vector2 (4, 4);

        //Child Status Transfer to Button//Keep busyo name
        GameObject kanjyo = GameObject.Find ("ButtonKanjyo");
        kanjyo.GetComponent<BusyoStatusButton> ().pa_lv = lv;

        GameObject chigyo = GameObject.Find ("ButtonCyouhei");
        chigyo.GetComponent<BusyoStatusButton> ().ch_type = ch_type;
        chigyo.GetComponent<BusyoStatusButton> ().ch_heisyu = heisyu;
        chigyo.GetComponent<BusyoStatusButton> ().ch_num = ch_num;
        chigyo.GetComponent<BusyoStatusButton> ().ch_status = chAtkDfc;
        chigyo.GetComponent<BusyoStatusButton> ().ch_hp = hei;
        chigyo.GetComponent<BusyoStatusButton> ().pa_hp = totalBusyoHp/100;

        GameObject kunren = GameObject.Find ("ButtonKunren");
        kunren.GetComponent<BusyoStatusButton> ().ch_type = ch_type;
        kunren.GetComponent<BusyoStatusButton> ().ch_heisyu = heisyu;
        kunren.GetComponent<BusyoStatusButton> ().ch_lv = ch_lv;
        kunren.GetComponent<BusyoStatusButton> ().ch_status = chAtkDfc;
        kunren.GetComponent<BusyoStatusButton> ().ch_hp = hei ;
        kunren.GetComponent<BusyoStatusButton> ().ch_num = ch_num;
        kunren.GetComponent<BusyoStatusButton> ().pa_hp = totalBusyoHp/100;

        //Parametor Setting
        GameObject.Find ("GameScene").GetComponent<NowOnBusyo>().OnBusyo = busyoId;
    }
Example #51
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();

        //Ninmei
        if (kaininFlg == false)
        {
            //Make Jyosyu List
            string        openKuniString = PlayerPrefs.GetString("openKuni");
            List <string> openKuniList   = new List <string> ();
            char[]        delimiterChars = { ',' };
            openKuniList = new List <string> (openKuniString.Split(delimiterChars));

            List <string> jyosyuList = new List <string> ();
            for (int i = 0; i < openKuniList.Count; i++)
            {
                string temp = "jyosyu" + openKuniList [i];
                if (PlayerPrefs.HasKey(temp))
                {
                    int jyosyuId = PlayerPrefs.GetInt(temp);
                    jyosyuList.Add(jyosyuId.ToString());
                }
            }

            //Available Jyosyu List
            string        myBusyoString = PlayerPrefs.GetString("myBusyo");
            List <string> myBusyoList   = new List <string> ();
            myBusyoList = new List <string> (myBusyoString.Split(delimiterChars));

            //Reduce MyBusyo - CurrentJyosyu
            myBusyoList.RemoveAll(jyosyuList.Contains);

            //Reduce MyDaimyo
            //int myDaimyo = PlayerPrefs.GetInt("myDaimyo");
            //Daimyo daimyo = new Daimyo();
            //int myDaimyoBusyo = daimyo.getDaimyoBusyoId(myDaimyo);
            //myBusyoList.Remove(myDaimyoBusyo.ToString());


            if (myBusyoList.Count > 0)
            {
                audioSources [0].Play();
                BusyoStatusButton pop = new BusyoStatusButton();
                pop.commonPopup(19);
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    GameObject.Find("popText").GetComponent <Text> ().text = "Feudatory";
                }
                else
                {
                    GameObject.Find("popText").GetComponent <Text>().text = "城主任命";
                }
                //Set Scroll View
                string     scrollPath = "Prefabs/Naisei/ScrollView";
                GameObject scroll     = Instantiate(Resources.Load(scrollPath)) as GameObject;
                scroll.transform.SetParent(GameObject.Find("board(Clone)").transform);
                scroll.transform.localScale = new Vector2(1, 1);
                scroll.name = "ScrollView";
                RectTransform scrollTransform = scroll.GetComponent <RectTransform> ();
                scrollTransform.anchoredPosition3D = new Vector3(0, 0, 0);

                //Show Available List
                foreach (string avl in myBusyoList)
                {
                    string     slotPath = "Prefabs/Naisei/BusyoSlot";
                    GameObject slot     = Instantiate(Resources.Load(slotPath)) as GameObject;
                    slot.transform.SetParent(scroll.transform.FindChild("NaiseiContent").transform);
                    slot.transform.localScale = new Vector2(1, 1);

                    string     busyoPath = "Prefabs/Player/Unit/BusyoUnit";
                    GameObject busyo     = Instantiate(Resources.Load(busyoPath)) as GameObject;
                    busyo.name = avl;
                    busyo.transform.SetParent(slot.transform.FindChild("Busyo").transform);
                    busyo.transform.localScale = new Vector2(3.5f, 3.5f);
                    RectTransform busyo_transform = busyo.GetComponent <RectTransform> ();
                    busyo_transform.anchoredPosition3D          = new Vector3(0, -300, 0);
                    busyo_transform.sizeDelta                   = new Vector2(200, 200);
                    busyo.GetComponent <DragHandler> ().enabled = false;

                    GameObject text = busyo.transform.FindChild("Text").gameObject;
                    text.transform.localScale = new Vector2(0.6f, 0.6f);
                    RectTransform text_transform = text.GetComponent <RectTransform> ();
                    text_transform.anchoredPosition3D = new Vector3(-200, 65, 0);

                    GameObject rank = busyo.transform.FindChild("Rank").gameObject;
                    rank.transform.localScale = new Vector2(1, 1);
                    RectTransform rank_transform = rank.GetComponent <RectTransform> ();
                    rank_transform.anchoredPosition3D = new Vector3(30, -100, 0);

                    //Status
                    StatusGet sts           = new StatusGet();
                    int       lv            = PlayerPrefs.GetInt(avl);
                    float     naiseiStsTemp = (float)sts.getDfc(int.Parse(avl), lv);
                    float     naiseiSts     = naiseiStsTemp / 2;

                    float hpSts           = (float)sts.getHp(int.Parse(avl), lv);
                    float atkSts          = (float)sts.getAtk(int.Parse(avl), lv);
                    float boubiStatusTemp = (hpSts + atkSts) / 2;
                    float boubiStatus     = boubiStatusTemp / 2;

                    slot.transform.FindChild("Busyo").transform.FindChild("NaiseiEffectValue").GetComponent <Text> ().text = "+" + naiseiSts.ToString("f1") + "%";
                    slot.transform.FindChild("Busyo").transform.FindChild("BoubiEffectValue").GetComponent <Text> ().text  = "+" + boubiStatus.ToString("f1") + "%";

                    //Lv
                    string     lvPath = "Prefabs/Naisei/Lv";
                    GameObject lvObj  = Instantiate(Resources.Load(lvPath)) as GameObject;
                    lvObj.transform.SetParent(busyo.transform);
                    lvObj.GetComponent <Text> ().text = "Lv" + lv;
                    lvObj.transform.localScale        = new Vector2(0.1f, 0.1f);
                    RectTransform lv_transform = lvObj.GetComponent <RectTransform> ();
                    lv_transform.anchoredPosition3D = new Vector3(130, -70, 0);

                    //Button
                    slot.transform.FindChild("Busyo").transform.FindChild("NinmeiButton").GetComponent <DoNinmei> ().busyoId = avl;
                }
            }
            else
            {
                audioSources [4].Play();
                Message msg = new Message();
                msg.makeMessage(msg.getMessage(119));
            }
        }
        else
        {
            audioSources [0].Play();
            //Kainin
            //Common Process
            //Back Cover
            string     backPath = "Prefabs/Common/TouchBack";
            GameObject back     = Instantiate(Resources.Load(backPath)) as GameObject;
            back.transform.SetParent(GameObject.Find("Panel").transform);
            back.transform.localScale = new Vector2(1, 1);
            RectTransform backTransform = back.GetComponent <RectTransform> ();
            backTransform.anchoredPosition3D = new Vector3(0, 0, 0);
            back.name = "TouchBack";

            //Message Box
            string     msgPath = "Prefabs/Naisei/KaininConfirm";
            GameObject msg     = Instantiate(Resources.Load(msgPath)) as GameObject;
            msg.transform.SetParent(back.transform);
            msg.transform.localScale = new Vector2(1, 1);
            RectTransform msgTransform = msg.GetComponent <RectTransform> ();
            msgTransform.anchoredPosition3D = new Vector3(0, 0, 0);
            msgTransform.name = "kaininConfirm";

            //Message Text Mod
            GameObject msgObj        = msg.transform.FindChild("KaininText").gameObject;
            int        myDaimyoBusyo = PlayerPrefs.GetInt("myDaimyoBusyo");
            string     msgText       = "";
            if (myDaimyoBusyo == jyosyuId)
            {
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    msgText = "My lord, do you want to resign the lord of this country?";
                }
                else
                {
                    msgText = "御館様、自らを城主から解任なさいますか?";
                }
            }
            else
            {
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    msgText = "My lord, do you want to remove " + jyosyuName + " from the lord of this country?";
                }
                else
                {
                    msgText = "御館様、" + jyosyuName + "殿を城主から解任なさいますか?";
                }
            }



            msgObj.GetComponent <Text> ().text = msgText;
        }
    }
Example #52
0
    public void makeKaisenInstance(int mapId, int busyoId, int shipId, int lv, string ch_type, int ch_num, int hp, int atk, int dfc, int spd, string busyoName, int linkNo, bool taisyo, ArrayList senpouArray)
    {
        string     path   = "Prefabs/Kaisen/" + shipId;
        GameObject prefab = Instantiate(Resources.Load(path)) as GameObject;

        prefab.name  = busyoId.ToString();
        prefab.tag   = "Enemy";
        prefab.layer = LayerMask.NameToLayer("Enemy");
        Destroy(prefab.GetComponent <PlayerHP>());
        Destroy(prefab.GetComponent <PlayerAttack>());
        prefab.AddComponent <EnemyHP> ();
        prefab.AddComponent <EnemyAttack>();

        //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>());
        }

        //Script Adjust
        Destroy(prefab.GetComponent <UnitMover>());
        prefab.AddComponent <Homing>();



        //Busyo Detail Info [Name & HP Bar]
        string dtlPath = "";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlEnemyEng";
        }
        else
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlEnemy";
        }
        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 = "BusyoDtlEnemy";

        //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(5, 16);
        }
        else if (mapId == 2)
        {
            prefab.transform.position = new Vector2(20, 16);
        }
        else if (mapId == 3)
        {
            prefab.transform.position = new Vector2(35, 16);
        }
        else if (mapId == 4)
        {
            prefab.transform.position = new Vector2(50, 16);
        }
        else if (mapId == 5)
        {
            prefab.transform.position = new Vector2(65, 16);
        }
        else if (mapId == 6)
        {
            prefab.transform.position = new Vector2(5, 8);
        }
        else if (mapId == 7)
        {
            prefab.transform.position = new Vector2(20, 8);
        }
        else if (mapId == 8)
        {
            prefab.transform.position = new Vector2(35, 8);
        }
        else if (mapId == 9)
        {
            prefab.transform.position = new Vector2(50, 8);
        }
        else if (mapId == 10)
        {
            prefab.transform.position = new Vector2(65, 8);
        }
        else if (mapId == 11)
        {
            prefab.transform.position = new Vector2(5, 0);
        }
        else if (mapId == 12)
        {
            prefab.transform.position = new Vector2(20, 0);
        }
        else if (mapId == 13)
        {
            prefab.transform.position = new Vector2(35, 0);
        }
        else if (mapId == 14)
        {
            prefab.transform.position = new Vector2(50, 0);
        }
        else if (mapId == 15)
        {
            prefab.transform.position = new Vector2(65, 0);
        }
        else if (mapId == 16)
        {
            prefab.transform.position = new Vector2(5, -8);
        }
        else if (mapId == 17)
        {
            prefab.transform.position = new Vector2(20, -8);
        }
        else if (mapId == 18)
        {
            prefab.transform.position = new Vector2(35, -8);
        }
        else if (mapId == 19)
        {
            prefab.transform.position = new Vector2(50, -8);
        }
        else if (mapId == 20)
        {
            prefab.transform.position = new Vector2(65, -8);
        }
        else if (mapId == 21)
        {
            prefab.transform.position = new Vector2(5, -16);
        }
        else if (mapId == 22)
        {
            prefab.transform.position = new Vector2(20, -16);
        }
        else if (mapId == 23)
        {
            prefab.transform.position = new Vector2(35, -16);
        }
        else if (mapId == 24)
        {
            prefab.transform.position = new Vector2(50, -16);
        }
        else if (mapId == 25)
        {
            prefab.transform.position = new Vector2(65, -16);
        }

        //Link Adjustment
        float linkAdjst = (float)linkNo / 10;

        hp  = hp * 100;
        dfc = dfc * 10;

        if (linkNo != 0)
        {
            float adjstHp = hp * linkAdjst;
            hp = hp + (int)adjstHp;
            float adjstDfc = dfc * linkAdjst;
            dfc = dfc + (int)adjstDfc;
        }

        //Adjust
        float adjSpd = (float)spd / 10;

        if (adjSpd <= 0)
        {
            adjSpd = 1;
        }

        if (shipId == 1)
        {
            hp     = hp * 2;
            dfc    = dfc * 2;
            adjSpd = Mathf.FloorToInt((float)adjSpd * 0.5f);
        }
        else if (shipId == 2)
        {
            hp     = Mathf.FloorToInt((float)hp * 1.5f);
            dfc    = Mathf.FloorToInt((float)dfc * 1.5f);
            adjSpd = Mathf.FloorToInt((float)adjSpd * 0.6f);
        }
        else if (shipId == 3)
        {
            adjSpd = Mathf.FloorToInt((float)adjSpd * 0.8f);
        }
        atk = atk * 10;
        if (linkNo != 0)
        {
            float adjstAtk = atk * linkAdjst;
            atk = atk + (int)adjstAtk;
        }
        if (adjSpd <= 0)
        {
            adjSpd = 1;
        }
        GameObject minHpBar = dtl.transform.FindChild("MinHpBar").gameObject;

        minHpBar.GetComponent <BusyoHPBar>().initLife = hp;
        prefab.GetComponent <EnemyHP>().life          = hp;
        prefab.GetComponent <EnemyAttack>().attack    = atk;
        prefab.GetComponent <Homing>().speed          = adjSpd;
        prefab.GetComponent <EnemyHP>().dfc           = dfc;

        if (taisyo)
        {
            prefab.GetComponent <EnemyHP>().taisyo = true;
        }

        //SE
        AudioController audio = new AudioController();

        audio.addComponentMoveAttack(prefab, "SHP");

        //Child Instantiate
        //set child object
        string    ch_path = "Prefabs/Kaisen/3";
        StatusGet sts     = new StatusGet();

        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 = "EnemyChild";

            Destroy(ch_prefab.GetComponent <Rigidbody2D>());
            Destroy(ch_prefab.GetComponent <UnitMover>());
            Destroy(ch_prefab.GetComponent <Kunkou>());
            Destroy(ch_prefab.GetComponent <PolygonCollider2D>());
            Destroy(ch_prefab.GetComponent <PlayerAttack>());
            Destroy(ch_prefab.GetComponent <PlayerHP>());
            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);
            }


            int ch_status = getChildStatus(lv, ch_type, linkNo);

            //Round up because of Link adjustment might be under 0
            int atkDfc = Mathf.CeilToInt(sts.getChAtkDfc(ch_status, hp));

            if (i == 1)
            {
                //Child Qty
                prefab.GetComponent <EnemyHP>().childQty = ch_num;

                //Child Unit HP
                prefab.GetComponent <EnemyHP>().childHP = ch_status;

                //Attack
                prefab.GetComponent <EnemyAttack>().attack = prefab.GetComponent <EnemyAttack>().attack + (ch_num * atkDfc);

                //Dfc
                prefab.GetComponent <EnemyHP>().dfc = prefab.GetComponent <EnemyHP>().dfc + (ch_num * atkDfc);
            }
        }
    }
Example #53
0
    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";
            }
        }
    }
Example #54
0
	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;

	}
Example #55
0
	public void OnClick () {
		//Initialization
		totalMoney = 0;
		totalHyourou = 0;
		totalYRL = 0;
		totalKBL = 0;
		totalYML = 0;
		totalTPL = 0;
		totalYRM = 0;
		totalKBM = 0;
		totalYMM = 0;
		totalTPM = 0;
		totalYRH = 0;
		totalKBH = 0;
		totalYMH = 0;
		totalTPH = 0;

		/*Popup*/
		string backPath = "Prefabs/Busyo/back";
		GameObject back = Instantiate (Resources.Load (backPath)) as GameObject;
		back.transform.SetParent(GameObject.Find ("Map").transform);
		back.transform.localScale = new Vector2 (1, 1);
		RectTransform backTransform = back.GetComponent<RectTransform> ();
		backTransform.anchoredPosition = new Vector3 (0, 0, 0);
		
		//Popup Screen
		string popupPath = "Prefabs/Busyo/board";
		GameObject popup = Instantiate (Resources.Load (popupPath)) as GameObject;
		popup.transform.SetParent(GameObject.Find ("Map").transform);
		popup.transform.localScale = new Vector2 (1, 1);
		RectTransform popupTransform = popup.GetComponent<RectTransform> ();
		popupTransform.anchoredPosition = new Vector3 (0, 0, 0);
		popup.name = "board";

		//Pop text
		string popTextPath = "Prefabs/Busyo/popText";
		GameObject popText = Instantiate (Resources.Load (popTextPath)) as GameObject;
		popText.transform.SetParent(popup.transform);
		popText.transform.localScale = new Vector2 (0.35f, 0.35f);
		RectTransform popTextTransform = popText.GetComponent<RectTransform> ();
		popTextTransform.anchoredPosition = new Vector3 (0, 260, 0);
		popText.name = "popText";
		popText.GetComponent<Text> ().text = "内政状況";

		//Scroll View
		string scrollPath = "Prefabs/Map/seiryoku/KuniScrollView";
		GameObject scroll = Instantiate (Resources.Load (scrollPath)) as GameObject;
		scroll.transform.SetParent(popup.transform);
		scroll.transform.localScale = new Vector2 (1, 1);
		scroll.name = "KuniScrollView";
		RectTransform scrollTransform = scroll.GetComponent<RectTransform> ();
		scrollTransform.anchoredPosition = new Vector3 (0, -80, 0);

		//Header
		string headerPath = "Prefabs/Map/seiryoku/GetTargetBack";
		GameObject header = Instantiate (Resources.Load (headerPath)) as GameObject;
		header.transform.SetParent(popup.transform);
		header.transform.localScale = new Vector2 (1, 1);
		header.name = "GetTargetBack";
		RectTransform headerTransform = header.GetComponent<RectTransform> ();
		headerTransform.anchoredPosition = new Vector3 (0, 185, 0);

		//Button
		string btnPath = "Prefabs/Map/seiryoku/GetAllShigenBtn";
		GameObject btn = Instantiate (Resources.Load (btnPath)) as GameObject;
		btn.transform.SetParent(popup.transform);
		btn.transform.localScale = new Vector2 (1, 1);
		btn.name = "GetAllShigenBtn";
		RectTransform btnTransform = btn.GetComponent<RectTransform> ();
		btnTransform.anchoredPosition = new Vector3 (420, 185, 0);



		/*Slot Preparation*/
		//Check Open Kuni
		string openKuniString = PlayerPrefs.GetString ("openKuni");
		char[] delimiterChars = {','};
		List<string> openKuniList = new List<string> ();
		if (openKuniString.Contains (",")) {
			openKuniList = new List<string> (openKuniString.Split (delimiterChars));
		} else {
			openKuniList.Add(openKuniString);
		}

		for (int i=0; i<openKuniList.Count; i++) {
			int kuniId = int.Parse(openKuniList[i]);
			string temp = "kuni" + openKuniList[i];
			string clearedKuni = PlayerPrefs.GetString (temp);
			//Shiro Qty
			if(clearedKuni != null && clearedKuni != ""){
				List<string> shiroList = new List<string>();
				shiroList = new List<string>(clearedKuni.Split (delimiterChars));
				shiro = shiroList.Count;

				//Kuni Name
				Entity_kuni_mst kuniMst = Resources.Load ("Data/kuni_mst") as Entity_kuni_mst;
				kuniName = kuniMst.param[kuniId-1].kuniName;

				string naiseiTemp = "naisei" + openKuniList[i];
				string naiseiString = PlayerPrefs.GetString (naiseiTemp);

				if (PlayerPrefs.HasKey (naiseiTemp)) {
					int syogyo = 0;
					int nogyo = 0;

					int gunjyuYRL = 0;
					int gunjyuYRM = 0;
					int gunjyuYRH = 0;
					int gunjyuKBL = 0;
					int gunjyuKBM = 0;
					int gunjyuKBH = 0;
					int gunjyuYML = 0;
					int gunjyuYMM = 0;
					int gunjyuYMH = 0;
					int gunjyuTPL = 0;
					int gunjyuTPM = 0;
					int gunjyuTPH = 0;

					List<string> naiseiList = new List<string>();
					naiseiList = new List<string>(naiseiString.Split (delimiterChars));
					char[] delimiterChars2 = {':'};
					List<string> deletePanelList = new List<string>();


					for(int j=1; j<naiseiList.Count;j++){
						List<string> naiseiContentList = new List<string>();
						naiseiContentList = new List<string>(naiseiList[j].Split (delimiterChars2));
						
						
						if(naiseiContentList[0] != "0"){
							//Exist
							Entity_naisei_mst naiseiMst = Resources.Load ("Data/naisei_mst") as Entity_naisei_mst;
							string type = naiseiMst.param [int.Parse(naiseiContentList[0])].code;

							//Effect by Level
							List<int> naiseiEffectList = new List<int>();
							NaiseiController naisei = new NaiseiController();
							naiseiEffectList = naisei.getNaiseiList(type, int.Parse(naiseiContentList[1]));


							//Status
							if(type == "shop" || type == "kouzan"){
								syogyo = syogyo + naiseiEffectList[0];
								totalMoney = totalMoney + naiseiEffectList[0];
							}else if(type == "ta"){
								nogyo = nogyo + naiseiEffectList[0];
								totalHyourou = totalHyourou + naiseiEffectList[0];
							}else if(type == "yr"){
								if(int.Parse(naiseiContentList[1])<9){
									//Low
									gunjyuYRL = gunjyuYRL + naiseiEffectList[0];
									totalYRL = totalYRL + naiseiEffectList[0];

								}else if(int.Parse(naiseiContentList[1]) < 15){
									//Middle
									gunjyuYRM = gunjyuYRM + naiseiEffectList[0];
									totalYRM = totalYRM + naiseiEffectList[0];

								}else if(15 <= int.Parse(naiseiContentList[1])){
									//High
									gunjyuYRH = gunjyuYRH + naiseiEffectList[0];
									totalYRH = totalYRH + naiseiEffectList[0];

								}


							}else if(type == "kb"){
								if(int.Parse(naiseiContentList[1])<9){
									//Low
									gunjyuKBL = gunjyuKBL + naiseiEffectList[0];
									totalKBL = totalKBL + naiseiEffectList[0];
									
								}else if(int.Parse(naiseiContentList[1]) < 15){
									//Middle
									gunjyuKBM = gunjyuKBM + naiseiEffectList[0];
									totalKBM = totalKBM + naiseiEffectList[0];
									
								}else if(15 <= int.Parse(naiseiContentList[1])){
									//High
									gunjyuKBH = gunjyuKBH + naiseiEffectList[0];
									totalKBH = totalKBH + naiseiEffectList[0];
									
								}

							}else if(type == "ym"){
								if(int.Parse(naiseiContentList[1])<9){
									//Low
									gunjyuYML = gunjyuYML + naiseiEffectList[0];
									totalYML = totalYML + naiseiEffectList[0];
									
								}else if(int.Parse(naiseiContentList[1]) < 15){
									//Middle
									gunjyuYMM = gunjyuYMM + naiseiEffectList[0];
									totalYMM = totalYMM + naiseiEffectList[0];
									
								}else if(15 <= int.Parse(naiseiContentList[1])){
									//High
									gunjyuYMH = gunjyuYMH + naiseiEffectList[0];
									totalYMH = totalYMH + naiseiEffectList[0];
									
								}
							}else if(type == "tp"){
								if(int.Parse(naiseiContentList[1])<9){
									//Low
									gunjyuTPL = gunjyuTPL + naiseiEffectList[0];
									totalTPL = totalTPL + naiseiEffectList[0];
									
								}else if(int.Parse(naiseiContentList[1]) < 15){
									//Middle
									gunjyuTPM = gunjyuTPM + naiseiEffectList[0];
									totalTPM = totalTPM + naiseiEffectList[0];
									
								}else if(15 <= int.Parse(naiseiContentList[1])){
									//High
									gunjyuTPH = gunjyuTPH + naiseiEffectList[0];
									totalTPH = totalTPH + naiseiEffectList[0];
									
								}
							}
						}
					}
					//Make Slot
					string slotPath = "Prefabs/Map/seiryoku/KuniSlot";
					GameObject kuniSlot = Instantiate (Resources.Load (slotPath)) as GameObject;
					kuniSlot.transform.SetParent(GameObject.Find ("Content").transform);
					kuniSlot.transform.localScale = new Vector2 (1, 1);
					kuniSlot.name = "KuniSlot" + kuniId;

					//Jyosyu Addition
					string jyosyuTemp = "jyosyu" + kuniId;

					if (PlayerPrefs.HasKey (jyosyuTemp)) {
						int jyosyuId = PlayerPrefs.GetInt (jyosyuTemp);

						StatusGet sts = new StatusGet();
						int lv = PlayerPrefs.GetInt (jyosyuId.ToString());
						float naiseiSts = (float)sts.getDfc(jyosyuId,lv);
						
						float hpSts = (float)sts.getHp(jyosyuId,lv);
						float atkSts = (float)sts.getAtk(jyosyuId,lv);

						float tempSyogyo = (float)syogyo;
						tempSyogyo = tempSyogyo + (tempSyogyo * naiseiSts/200);
						float tempNogyo = (float)nogyo;
						tempNogyo = tempNogyo + (tempNogyo * naiseiSts/200);

						syogyo = (int)tempSyogyo;
						nogyo = (int)tempNogyo;

					}


					kuniSlot.transform.FindChild("KuniNameBack").transform.FindChild("KuniNameValue").GetComponent<Text>().text = kuniName;
					kuniSlot.transform.FindChild("Shiro").transform.FindChild("ShiroValue").GetComponent<Text>().text = shiro.ToString();
					kuniSlot.transform.FindChild("Money").transform.FindChild("MoneyValue").GetComponent<Text>().text = syogyo.ToString();
					kuniSlot.transform.FindChild("Hyourou").transform.FindChild("HyourouValue").GetComponent<Text>().text = nogyo.ToString();
					kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("YR").transform.FindChild("CyouheiYRValueL").GetComponent<Text>().text = gunjyuYRL.ToString();
					kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("YR").transform.FindChild("CyouheiYRValueM").GetComponent<Text>().text = gunjyuYRM.ToString();
					kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("YR").transform.FindChild("CyouheiYRValueH").GetComponent<Text>().text = gunjyuYRH.ToString();
					kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("KB").transform.FindChild("CyouheiKBValueL").GetComponent<Text>().text = gunjyuKBL.ToString();
					kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("KB").transform.FindChild("CyouheiKBValueM").GetComponent<Text>().text = gunjyuKBM.ToString();
					kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("KB").transform.FindChild("CyouheiKBValueH").GetComponent<Text>().text = gunjyuKBH.ToString();
					kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("YM").transform.FindChild("CyouheiYMValueL").GetComponent<Text>().text = gunjyuYML.ToString();
					kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("YM").transform.FindChild("CyouheiYMValueM").GetComponent<Text>().text = gunjyuYMM.ToString();
					kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("YM").transform.FindChild("CyouheiYMValueH").GetComponent<Text>().text = gunjyuYMH.ToString();
					kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("TP").transform.FindChild("CyouheiTPValueL").GetComponent<Text>().text = gunjyuTPL.ToString();
					kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("TP").transform.FindChild("CyouheiTPValueM").GetComponent<Text>().text = gunjyuTPM.ToString();
					kuniSlot.transform.FindChild("Gunjyu").transform.FindChild("TP").transform.FindChild("CyouheiTPValueH").GetComponent<Text>().text = gunjyuTPH.ToString();

				}
			}
		}//Kuni Loop Finish

		//Set Total Amount
		GameObject btnObj = GameObject.Find ("GetAllShigenBtn").gameObject;
		btnObj.GetComponent<GetAllShigen> ().totalMoney = totalMoney;
		btnObj.GetComponent<GetAllShigen> ().totalHyourou = totalHyourou;
		btnObj.GetComponent<GetAllShigen> ().totalYRL = totalYRL;
		btnObj.GetComponent<GetAllShigen> ().totalKBL = totalKBL;
		btnObj.GetComponent<GetAllShigen> ().totalYML = totalYML;
		btnObj.GetComponent<GetAllShigen> ().totalTPL = totalTPL;
		btnObj.GetComponent<GetAllShigen> ().totalYRM = totalYRM;
		btnObj.GetComponent<GetAllShigen> ().totalKBM = totalKBM;
		btnObj.GetComponent<GetAllShigen> ().totalYMM = totalYMM;
		btnObj.GetComponent<GetAllShigen> ().totalTPM = totalTPM;
		btnObj.GetComponent<GetAllShigen> ().totalYRH = totalYRH;
		btnObj.GetComponent<GetAllShigen> ().totalKBH = totalKBH;
		btnObj.GetComponent<GetAllShigen> ().totalYMH = totalYMH;
		btnObj.GetComponent<GetAllShigen> ().totalTPH = totalTPH;


	}
Example #56
0
    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;
        }
    }
Example #57
0
	public void kuniScrollView(GameObject baseObj,  string targetDaimyo, GameObject btn){
		
		GameObject content = baseObj.transform.FindChild("scroll").transform.FindChild("Content").gameObject;

		string seiryoku = PlayerPrefs.GetString ("seiryoku");
		char[] delimiterChars = {','};
		List<string> seiryokuList = new List<string>();
		seiryokuList = new List<string> (seiryoku.Split (delimiterChars));

		//my kuni
		int myDaimyo = PlayerPrefs.GetInt ("myDaimyo");
		string myKuni = PlayerPrefs.GetString ("clearedKuni"); 
		List<int> myKuniList = new List<int>();
		if (myKuni.Contains (",")) {
			List<string> tempMyKuniList = new List<string> (myKuni.Split (delimiterChars));
			myKuniList = tempMyKuniList.ConvertAll(x => int.Parse(x));
		} else {
			myKuniList.Add(int.Parse(myKuni));
		}

		//doumei daimyo's opne kuni
		KuniInfo kuni = new KuniInfo ();
		List<int> doumeiOpenKuniList = new List<int>();
		List<int> doumeiKuniList = new List<int>();
		for(int i=0; i<seiryokuList.Count; i++){
			string tempDaimyo = seiryokuList[i];
			if(tempDaimyo == targetDaimyo){
				int doumeiKuniId = i + 1;
				doumeiKuniList.Add(doumeiKuniId);
				doumeiOpenKuniList.AddRange(kuni.getMappingKuni(doumeiKuniId));
			}
		}

		//"doumei daimyo's opne kuni" minus "my kuni"  
		List<int> doumeiOpenKuniMinusMyKuniList = new List<int>();
		foreach(int n in doumeiOpenKuniList){

			if(!myKuniList.Contains(n)){
				doumeiOpenKuniMinusMyKuniList.Add(n);
			}
		}

		//"doumei daimyo's doumei check
		string tempDoumei = "doumei" + targetDaimyo;
		string doumei = PlayerPrefs.GetString (tempDoumei);
		List<string> doumeiList = new List<string>();
		if (doumei.Contains (",")) {
			doumeiList = new List<string> (doumei.Split (delimiterChars));
		} else {
			doumeiList.Add(doumei);
		}

		if (doumei != null && doumei != "") {
			for(int t=0; t<doumeiOpenKuniMinusMyKuniList.Count; t++){
			//foreach (int n in doumeiOpenKuniMinusMyKuniList) {
				string checkDaimyoId = seiryokuList [doumeiOpenKuniMinusMyKuniList[t] - 1];
				if (doumeiList.Contains (checkDaimyoId)) {
					doumeiOpenKuniMinusMyKuniList.Remove (doumeiOpenKuniMinusMyKuniList[t]);
				}
			}
		}



		//Compare "doumei open" with "my open"
		string myOpenKuni = PlayerPrefs.GetString ("openKuni"); 
		List<int> myOpenKuniList = new List<int>();
		if (myOpenKuni.Contains (",")) {
			List<string> tempMyOpenKuniList = new List<string> (myOpenKuni.Split (delimiterChars));
			myOpenKuniList = tempMyOpenKuniList.ConvertAll(x => int.Parse(x));
		} else {
			myOpenKuniList.Add(int.Parse(myOpenKuni));
		}

		List<int> sameTargetKuniList = new List<int>();
		foreach(int n in myOpenKuniList){
			if(doumeiOpenKuniMinusMyKuniList.Contains(n)){
				if(!doumeiKuniList.Contains(n)){
					sameTargetKuniList.Add(n);
				}
			}
		}


		/*Slot making*/
		string temp = "gaikou" + targetDaimyo;
		int myYukoudo = PlayerPrefs.GetInt(temp);

		//Get Chiryaku
		Entity_daimyo_mst daimyoMst = Resources.Load ("Data/daimyo_mst") as Entity_daimyo_mst;
		int myDaimyoBusyoId = daimyoMst.param [myDaimyo - 1].busyoId;
		StatusGet sts = new StatusGet();
		int lv = PlayerPrefs.GetInt (myDaimyoBusyoId.ToString());
		float chiryaku = (float)sts.getDfc(myDaimyoBusyoId,lv);
		chiryaku = chiryaku *10;


		string slotPath = "Prefabs/Map/common/kuniSlot";
		for (int i=0; i<sameTargetKuniList.Count; i++) {
			GameObject prefab = Instantiate (Resources.Load (slotPath)) as GameObject;
			prefab.transform.SetParent(content.transform);
			prefab.transform.localScale = new Vector3 (1, 1, 1);

			int kuniId = sameTargetKuniList[i];
			int daimyoId = int.Parse (seiryokuList [kuniId - 1]);
			string daimyoName = daimyoMst.param [daimyoId - 1].daimyoName;

			string theirYukouTemp = "";
			if(int.Parse(targetDaimyo) < daimyoId){
				theirYukouTemp = targetDaimyo + "gaikou" + daimyoId.ToString();
			}else{
				theirYukouTemp = daimyoId.ToString() + "gaikou" + targetDaimyo;
			}

			int theirYukoudo = PlayerPrefs.GetInt(theirYukouTemp);

			string kuniName = kuni.getKuniName(kuniId);
			prefab.transform.FindChild("KuniValue").GetComponent<Text>().text = kuniName;
			prefab.transform.FindChild("DaimyoValue").GetComponent<Text>().text = daimyoName;
			prefab.GetComponent<GaikouKuniSelect>().Content = content;
			prefab.GetComponent<GaikouKuniSelect>().Btn = btn;

			prefab.GetComponent<GaikouKuniSelect>().myYukoudo = myYukoudo;
			prefab.GetComponent<GaikouKuniSelect>().chiryaku = (int)chiryaku;
			prefab.GetComponent<GaikouKuniSelect>().kuniDiff = kuniDiff;
			prefab.GetComponent<GaikouKuniSelect>().theirYukoudo = theirYukoudo;
			prefab.GetComponent<GaikouKuniSelect>().kuniName = kuniName;
			prefab.GetComponent<GaikouKuniSelect>().targetKuniId = kuniId;

			if(i == 0){
				prefab.GetComponent<GaikouKuniSelect>().OnClick();
			}
		}

		if (sameTargetKuniList.Count == 0) {
			string msgPath = "Prefabs/Map/gaikou/NoKyoutouMsg";
			GameObject msg = Instantiate (Resources.Load (msgPath)) as GameObject;
			msg.transform.SetParent(GameObject.Find("scroll").transform);
			msg.transform.localScale = new Vector3 (0.17f, 0.2f, 1);
			RectTransform msgTransform = msg.GetComponent<RectTransform> ();
			msgTransform.anchoredPosition = new Vector3 (-260, -115, 0);

			GameObject a = baseObj.transform.FindChild ("RequiredMoney").gameObject;
			GameObject b = baseObj.transform.FindChild ("KyoutouRatio").gameObject;
			Destroy(a);
			Destroy(b);

			btn.GetComponent<Button>().enabled = false;
			
		}

		
	}
Example #58
0
    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;
            }
        }
    }
Example #59
0
    public void OnClick()
    {
        if (Application.loadedLevelName != "tutorialHyojyo")
        {
            //Get Senryoku
            Senryoku Senryoku = null;
            foreach (Transform child in transform)
            {
                Senryoku = child.GetComponent <Senryoku>();
                busyoId  = int.Parse(child.name);
            }
            BusyoInfoGet BusyoInfoGet = new BusyoInfoGet();
            busyoName = BusyoInfoGet.getName(busyoId);
            hp        = Senryoku.totalHp;
            atk       = Senryoku.totalAtk;
            dfc       = Senryoku.totalDfc;
            spd       = Senryoku.totalSpd;
            daimyoId  = Senryoku.belongDaimyoId;
            lv        = Senryoku.lv;
            chQty     = Senryoku.chQty;
            heisyu    = BusyoInfoGet.getHeisyu(busyoId);
            sakuId    = BusyoInfoGet.getSakuId(busyoId);


            AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource>();
            audioSources[0].Play();

            string     pathOfBack = "Prefabs/Common/TouchBack";
            GameObject back       = Instantiate(Resources.Load(pathOfBack)) as GameObject;
            back.transform.parent        = GameObject.Find("Panel").transform;
            back.transform.localScale    = new Vector2(1, 1);
            back.transform.localPosition = new Vector2(0, 0);

            string     pathOfPop = "Prefabs/Jinkei/busyoDetail";
            GameObject pop       = Instantiate(Resources.Load(pathOfPop)) as GameObject;
            pop.transform.parent        = GameObject.Find("Panel").transform;
            pop.transform.localScale    = new Vector2(1, 1);
            pop.transform.localPosition = new Vector2(0, 0);

            //Kamon
            GameObject kamon     = pop.transform.FindChild("kamon").gameObject;
            string     imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString();
            kamon.GetComponent <Image>().sprite =
                Resources.Load(imagePath, typeof(Sprite)) as Sprite;

            //Busyo Icon
            string     busyoPath = "Prefabs/Player/Unit/BusyoUnit";
            GameObject busyo     = Instantiate(Resources.Load(busyoPath)) as GameObject;
            busyo.name = busyoId.ToString();
            busyo.transform.SetParent(pop.transform);
            busyo.transform.localScale = new Vector2(7, 7);
            busyo.GetComponent <DragHandler>().enabled = false;
            RectTransform busyoRect = busyo.GetComponent <RectTransform>();
            busyoRect.anchoredPosition3D = new Vector3(180, 400, 0);
            busyoRect.sizeDelta          = new Vector2(40, 40);
            busyo.transform.FindChild("Text").GetComponent <Text>().enabled = false;

            //Ship Rank
            string     shipPath = "Prefabs/Busyo/ShipSts";
            GameObject ShipObj  = Instantiate(Resources.Load(shipPath)) as GameObject;
            ShipObj.transform.SetParent(busyo.transform);
            preKaisen kaisenScript = new preKaisen();
            int       shipId       = kaisenScript.getShipSprite(ShipObj, busyoId);
            ShipObj.transform.localPosition = new Vector3(-10, -15, 0);
            ShipObj.transform.localScale    = new Vector2(0.2f, 0.2f);
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                if (shipId == 1)
                {
                    ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "High";
                }
                else if (shipId == 2)
                {
                    ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Mid";
                }
                else if (shipId == 3)
                {
                    ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Low";
                }
            }
            else
            {
                if (shipId == 1)
                {
                    ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "上";
                }
                else if (shipId == 2)
                {
                    ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "中";
                }
                else if (shipId == 3)
                {
                    ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "下";
                }
            }

            //Name
            pop.transform.FindChild("busyoNameValue").GetComponent <Text>().text = busyoName;
            pop.transform.FindChild("lvValue").GetComponent <Text>().text        = lv.ToString();
            string  heisyuName = "";
            Message msg        = new Message();
            if (heisyu == "YR")
            {
                heisyuName = msg.getMessage(56);
            }
            else if (heisyu == "KB")
            {
                heisyuName = msg.getMessage(55);
            }
            else if (heisyu == "YM")
            {
                heisyuName = msg.getMessage(58);
            }
            else if (heisyu == "TP")
            {
                heisyuName = msg.getMessage(57);
            }
            pop.transform.FindChild("childNameValue").GetComponent <Text>().text = heisyuName;
            pop.transform.FindChild("childNum").GetComponent <Text>().text       = chQty.ToString();
            pop.transform.FindChild("hpValue").GetComponent <Text>().text        = hp.ToString();
            pop.transform.FindChild("atkValue").GetComponent <Text>().text       = atk.ToString();
            pop.transform.FindChild("dfcValue").GetComponent <Text>().text       = dfc.ToString();
            pop.transform.FindChild("spdValue").GetComponent <Text>().text       = spd.ToString();

            //Senpou
            StatusGet sts          = new StatusGet();
            ArrayList senpouArray  = sts.getOriginalSenpou(busyoId, false);
            int       senpouId     = (int)senpouArray[0];
            string    senpouTyp    = senpouArray[1].ToString();
            string    senpouName   = senpouArray[2].ToString();
            string    senpouExp    = senpouArray[3].ToString();
            float     senpouEach   = (float)senpouArray[4];
            float     senpouRatio  = (float)senpouArray[5];
            float     senpouTerm   = (float)senpouArray[6];
            int       senpouStatus = (int)senpouArray[7];
            int       senpouLv     = (int)senpouArray[8];

            //Kahou Adjustment
            KahouStatusGet kahouSts         = new KahouStatusGet();
            string[]       KahouSenpouArray = kahouSts.getKahouForSenpou(busyoId.ToString(), senpouStatus);
            string         kahouTyp         = KahouSenpouArray[0];
            string         adjSenpouStatus  = senpouStatus.ToString();
            if (kahouTyp != null)
            {
                if (kahouTyp == "Attack")
                {
                    int kahouStatus = int.Parse(KahouSenpouArray[1]);
                    adjSenpouStatus = adjSenpouStatus + "<color=#35d74bFF>(+" + kahouStatus.ToString() + ")</color>";
                }
                else
                {
                    Debug.Log("Not Yet except for Attack");
                }
            }
            //Explanation Modification
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                senpouExp = senpouExp.Replace("ABC", adjSenpouStatus);
                senpouExp = senpouExp.Replace("DEF", senpouEach.ToString());
                senpouExp = senpouExp.Replace("GHI", senpouRatio.ToString());
                senpouExp = senpouExp.Replace("JKL", senpouTerm.ToString());
            }
            else
            {
                senpouExp = senpouExp.Replace("A", adjSenpouStatus);
                senpouExp = senpouExp.Replace("B", senpouEach.ToString());
                senpouExp = senpouExp.Replace("C", senpouRatio.ToString());
                senpouExp = senpouExp.Replace("D", senpouTerm.ToString());
            }

            //Fill fields by got Senpou Value
            pop.transform.FindChild("senpouNameValue").GetComponent <Text>().text = senpouName;
            pop.transform.FindChild("senpouExpValue").GetComponent <Text>().text  = senpouExp;
            pop.transform.FindChild("senpouLvValue").GetComponent <Text>().text   = senpouLv.ToString();


            //Saku
            Saku          saku     = new Saku();
            List <string> sakuList = new List <string>();
            sakuList = saku.getSakuInfo(busyoId);

            string     sakuPath = "Prefabs/Saku/saku" + sakuList[0];
            GameObject sakuIcon = Instantiate(Resources.Load(sakuPath)) as GameObject;
            foreach (Transform n in pop.transform)
            {
                if (n.tag == "Saku")
                {
                    GameObject.Destroy(n.gameObject);
                }
            }
            sakuIcon.transform.SetParent(pop.transform);
            sakuIcon.transform.localScale            = new Vector2(0.5f, 0.5f);
            sakuIcon.GetComponent <Button>().enabled = false;
            RectTransform sakuIcon_transform = sakuIcon.GetComponent <RectTransform>();
            sakuIcon_transform.anchoredPosition = new Vector3(-220, -185, 0);
            sakuIcon_transform.transform.SetSiblingIndex(30);
            pop.transform.FindChild("sakuExpValue").GetComponent <Text>().text = sakuList[2];
            pop.transform.FindChild("sakuLvValue").GetComponent <Text>().text  = sakuList[3];

            //adjust
            if (Application.loadedLevelName == "preKaisen")
            {
                foreach (Transform chld in pop.transform)
                {
                    if (chld.GetComponent <ReplaceSpriteNameRank>())
                    {
                        string busyoImagePath = "Prefabs/Player/Sprite/unit" + busyoId;
                        chld.GetComponent <Image>().sprite =
                            Resources.Load(busyoImagePath, typeof(Sprite)) as Sprite;
                    }
                }
            }
        }
    }