Example #1
0
    public void createSakuStatusView(string busyoId)
    {
        /*Saku Fields*/
        Saku          saku     = new Saku();
        List <string> sakuList = new List <string>();
        string        tmp      = "gokui" + busyoId;

        if (PlayerPrefs.HasKey(tmp))
        {
            int gokuiId = PlayerPrefs.GetInt(tmp);
            sakuList = saku.getGokuiInfoForLabel(int.Parse(busyoId), gokuiId);
        }
        else
        {
            sakuList = saku.getSakuInfoForLabel(int.Parse(busyoId));
        }

        //Icon
        string     sakuPath   = "Prefabs/Saku/saku" + sakuList[0];
        GameObject sakuIcon   = Instantiate(Resources.Load(sakuPath)) as GameObject;
        GameObject StatusSaku = GameObject.Find("SenpouStatus").transform.FindChild("StatusSaku").gameObject;

        foreach (Transform n in StatusSaku.transform)
        {
            if (n.tag == "Saku")
            {
                GameObject.Destroy(n.gameObject);
            }
        }
        sakuIcon.transform.SetParent(StatusSaku.transform);
        sakuIcon.transform.localScale            = new Vector2(1, 1);
        sakuIcon.GetComponent <Button>().enabled = false;
        RectTransform sakuIcon_transform = sakuIcon.GetComponent <RectTransform>();

        sakuIcon_transform.anchoredPosition3D = new Vector3(-260, 0, 0);

        StatusSaku.transform.FindChild("SakuName").transform.FindChild("SakuNameValue").GetComponent <Text>().text = sakuList[1];
        StatusSaku.transform.FindChild("SakuExp").transform.FindChild("SakuExpValue").GetComponent <Text>().text   = sakuList[2];
        StatusSaku.transform.FindChild("SakuLv").transform.FindChild("SakuLvValue").GetComponent <Text>().text     = sakuList[3];
    }
Example #2
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();
        audioSources [0].Play();

        string     pathOfBack = "Prefabs/Common/TouchBack";
        GameObject back       = Instantiate(Resources.Load(pathOfBack)) as GameObject;

        back.transform.parent        = GameObject.Find("Panel").transform;
        back.transform.localScale    = new Vector2(1, 1);
        back.transform.localPosition = new Vector2(0, 0);

        string     pathOfPop = "Prefabs/Zukan/busyoPop";
        GameObject pop       = Instantiate(Resources.Load(pathOfPop)) as GameObject;

        pop.transform.parent        = GameObject.Find("Panel").transform;
        pop.transform.localScale    = new Vector2(1, 1);
        pop.transform.localPosition = new Vector2(0, 0);

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

        kamon.GetComponent <Image> ().sprite =
            Resources.Load(imagePath, typeof(Sprite)) as Sprite;

        //Busyo Icon
        string     busyoPath = "Prefabs/Player/Unit/BusyoUnit";
        GameObject busyo     = Instantiate(Resources.Load(busyoPath)) as GameObject;

        busyo.name = busyoId.ToString();
        busyo.transform.SetParent(pop.transform);
        busyo.transform.localScale = new Vector2(7, 7);
        busyo.GetComponent <DragHandler>().enabled = false;
        RectTransform busyoRect = busyo.GetComponent <RectTransform>();

        busyoRect.anchoredPosition3D = new Vector3(180, 400, 0);
        busyoRect.sizeDelta          = new Vector2(40, 40);
        busyo.transform.FindChild("Text").GetComponent <Text> ().enabled = false;

        //Ship Rank
        string     shipPath = "Prefabs/Busyo/ShipSts";
        GameObject ShipObj  = Instantiate(Resources.Load(shipPath)) as GameObject;

        ShipObj.transform.SetParent(busyo.transform);
        preKaisen kaisenScript = new preKaisen();
        int       shipId       = kaisenScript.getShipSprite(ShipObj, busyoId);

        ShipObj.transform.localPosition = new Vector3(-10, -15, 0);
        ShipObj.transform.localScale    = new Vector2(0.2f, 0.2f);
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            if (shipId == 1)
            {
                ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "High";
            }
            else if (shipId == 2)
            {
                ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Mid";
            }
            else if (shipId == 3)
            {
                ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Low";
            }
        }
        else
        {
            if (shipId == 1)
            {
                ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "上";
            }
            else if (shipId == 2)
            {
                ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "中";
            }
            else if (shipId == 3)
            {
                ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "下";
            }
        }
        //Name
        GameObject.Find("busyoNameValue").GetComponent <Text> ().text = busyoName;
        string  heisyuName = "";
        Message msg        = new Message();

        if (heisyu == "YR")
        {
            heisyuName = msg.getMessage(56);
        }
        else if (heisyu == "KB")
        {
            heisyuName = msg.getMessage(55);
        }
        else if (heisyu == "YM")
        {
            heisyuName = msg.getMessage(58);
        }
        else if (heisyu == "TP")
        {
            heisyuName = msg.getMessage(57);
        }

        GameObject.Find("ChildNameValue").GetComponent <Text> ().text = heisyuName;
        int newHp = hp * 100;

        GameObject.Find("TosotsuValue").GetComponent <Text> ().text = newHp.ToString();
        int newAtk = atk * 10;

        GameObject.Find("BuyuuValue").GetComponent <Text> ().text = newAtk.ToString();
        int newDfc = dfc * 10;

        GameObject.Find("ChiryakuValue").GetComponent <Text> ().text = newDfc.ToString();
        GameObject.Find("SpeedValue").GetComponent <Text> ().text    = spd.ToString();

        //Senpou
        Entity_senpou_mst senpouMst = Resources.Load("Data/senpou_mst") as Entity_senpou_mst;

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            GameObject.Find("SenpouValue").GetComponent <Text>().text = senpouMst.param[senpouId - 1].nameEng;
        }
        else
        {
            GameObject.Find("SenpouValue").GetComponent <Text>().text = senpouMst.param[senpouId - 1].name;
        }
        int    senpouStatus = senpouMst.param [senpouId - 1].lv20;
        int    each         = (int)senpouMst.param [senpouId - 1].each;
        int    ratio        = (int)senpouMst.param [senpouId - 1].ratio;
        int    term         = (int)senpouMst.param [senpouId - 1].term;
        string senpouExp    = "";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            senpouExp = senpouMst.param [senpouId - 1].effectionEng;
        }
        else
        {
            senpouExp = senpouMst.param[senpouId - 1].effection;
        }

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            senpouExp = senpouExp.Replace("ABC", senpouStatus.ToString());
            senpouExp = senpouExp.Replace("DEF", each.ToString());
            senpouExp = senpouExp.Replace("GHI", ratio.ToString());
            senpouExp = senpouExp.Replace("JKL", term.ToString());
        }
        else
        {
            senpouExp = senpouExp.Replace("A", senpouStatus.ToString());
            senpouExp = senpouExp.Replace("B", each.ToString());
            senpouExp = senpouExp.Replace("C", ratio.ToString());
            senpouExp = senpouExp.Replace("D", term.ToString());
        }



        GameObject.Find("SenpouExpValue").GetComponent <Text>().text = senpouExp;


        //Saku
        Saku          saku     = new Saku();
        List <string> sakuList = new List <string>();

        sakuList = saku.getSakuInfoLvMax(busyoId);

        string     sakuPath   = "Prefabs/Saku/saku" + sakuList[0];
        GameObject sakuIcon   = Instantiate(Resources.Load(sakuPath)) as GameObject;
        GameObject StatusSaku = GameObject.Find("StatusSaku").gameObject;

        foreach (Transform n in StatusSaku.transform)
        {
            if (n.tag == "Saku")
            {
                GameObject.Destroy(n.gameObject);
            }
        }
        sakuIcon.transform.SetParent(StatusSaku.transform);
        sakuIcon.transform.localScale            = new Vector2(0.85f, 0.85f);
        sakuIcon.GetComponent <Button>().enabled = false;
        RectTransform sakuIcon_transform = sakuIcon.GetComponent <RectTransform>();

        sakuIcon_transform.anchoredPosition = new Vector3(-360, 0, 0);

        StatusSaku.transform.FindChild("SakuExp").transform.FindChild("SakuExpValue").GetComponent <Text>().text = sakuList[2];
    }
Example #3
0
	public void OnClick(){

		//Pop View
		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 (5, 5);
		Busyo.GetComponent<DragHandler>().enabled = false;
		RectTransform busyo_transform = Busyo.GetComponent<RectTransform>();
		busyo_transform.anchoredPosition = new Vector3(350,300,0);
		busyo_transform.sizeDelta = new Vector2( 100, 100);

		//Text Modification
		Busyo.transform.FindChild ("Text").gameObject.GetComponent<Text>().enabled = false;

		//Rank Text Modification
		GameObject rank = Busyo.transform.FindChild ("Rank").gameObject;
		RectTransform rank_transform = rank.GetComponent<RectTransform>();
		rank_transform.anchoredPosition = new Vector3 (0,-50,0);
		rank_transform.sizeDelta = new Vector2( 200, 200);
		rank.GetComponent<Text>().fontSize = 200;

		/*Status*/
		string statusPath = "Prefabs/Touyou/busyoStatus";
		GameObject status = Instantiate (Resources.Load (statusPath)) as GameObject;			
		status.transform.SetParent (GameObject.Find ("board(Clone)").transform);
		status.transform.localScale = new Vector2 (1, 1);
		RectTransform status_transform = status.GetComponent<RectTransform>();
		status_transform.anchoredPosition = new Vector3(245,-40,0);


		Entity_busyo_mst busyoMst  = Resources.Load ("Data/busyo_mst") as Entity_busyo_mst;
		Entity_senpou_mst senpouMst  = Resources.Load ("Data/senpou_mst") as Entity_senpou_mst;
		string busyoName = busyoMst.param [busyoId-1].name;
		GameObject.Find ("busyoNameValue").GetComponent<Text>().text = busyoName;
		GameObject.Find ("TosotsuValue").GetComponent<Text>().text = busyoMst.param [busyoId-1].minHp.ToString() + "00";
		GameObject.Find ("BuyuuValue").GetComponent<Text> ().text = busyoMst.param [busyoId - 1].minAtk.ToString () + "0";
		GameObject.Find ("ChiryakuValue").GetComponent<Text>().text = busyoMst.param [busyoId-1].minDfc.ToString() + "0";
		GameObject.Find ("SpeedValue").GetComponent<Text>().text = busyoMst.param [busyoId-1].minSpd.ToString();

		string heisyuType = busyoMst.param [busyoId - 1].heisyu;
		string heisyu = "";
		if (heisyuType == "KB") {
			heisyu = "騎馬隊";
		} else if (heisyuType == "YR") {
			heisyu = "槍隊";
		} else if (heisyuType == "TP") {
			heisyu = "鉄砲隊";
		} else if (heisyuType == "YM") {
			heisyu = "弓隊";
		}

		GameObject.Find ("ChildNameValue").GetComponent<Text>().text = heisyu;

		int senpouId = busyoMst.param [busyoId-1].senpou_id;
		GameObject.Find ("SenpouValue").GetComponent<Text>().text = senpouMst.param[senpouId-1].name;
		int senpouStatus = senpouMst.param [senpouId - 1].lv1;
		int each = (int)senpouMst.param [senpouId - 1].each;
		int ratio = (int)senpouMst.param [senpouId - 1].ratio;
		int term = (int)senpouMst.param [senpouId - 1].term;
		string senpouExp = senpouMst.param [senpouId - 1].effection;
		senpouExp = senpouExp.Replace("A", senpouStatus.ToString());
		senpouExp = senpouExp.Replace("B", each.ToString());
		senpouExp = senpouExp.Replace("C", ratio.ToString());
		senpouExp = senpouExp.Replace("D", term.ToString());

		GameObject.Find ("SenpouExpValue").GetComponent<Text>().text = senpouExp;


		/*Saku*/
		Saku saku = new Saku ();
		List<string> sakuList = new List<string>();
		sakuList = saku.getSakuInfo (busyoId);
		
		//Icon
		string sakuPath = "Prefabs/Saku/saku" + sakuList[0];
		GameObject sakuIcon = Instantiate (Resources.Load (sakuPath)) as GameObject;
		GameObject StatusSaku = status.transform.FindChild("StatusSaku").gameObject;
		foreach ( Transform n in StatusSaku.transform ){
			if(n.tag == "Saku"){
				GameObject.Destroy(n.gameObject);
			}
		}
		sakuIcon.transform.SetParent (StatusSaku.transform);
		sakuIcon.transform.localScale = new Vector2 (0.7f, 0.7f);
		sakuIcon.GetComponent<Button>().enabled = false;
		RectTransform sakuIcon_transform = sakuIcon.GetComponent<RectTransform>();
		sakuIcon_transform.anchoredPosition = new Vector3(-235,0,0);
		
		StatusSaku.transform.FindChild("SakuExp").transform.FindChild("SakuExpValue").GetComponent<Text>().text = sakuList[2];

		/*daimyo busyo check*/
		Daimyo daimyo = new Daimyo ();
		daimyoFlg = daimyo.daimyoBusyoCheck (busyoId);

		//pass data to button
		GameObject touyouBtn = GameObject.Find ("TouyouButton").gameObject;
		touyouBtn.GetComponent<DoTouyou> ().busyoId = busyoId;
		touyouBtn.GetComponent<DoTouyou> ().busyoName = busyoName;
		touyouBtn.GetComponent<DoTouyou> ().heisyu = heisyuType;
		touyouBtn.GetComponent<DoTouyou> ().sequence = int.Parse(name);
		touyouBtn.GetComponent<DoTouyou> ().rank = busyoRank;
		touyouBtn.GetComponent<DoTouyou> ().daimyoFlg = daimyoFlg;
	}
Example #4
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 #5
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();
        audioSources [0].Play();

        //Panel
        GameObject.Find("Touyou").GetComponent <Canvas>().sortingLayerName = "unit";

        //Pop View
        BusyoStatusButton pop   = new BusyoStatusButton();
        GameObject        board = pop.commonPopup(27);

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            GameObject.Find("popText").GetComponent <Text> ().text = "Samurai Recruitment";
        }
        else
        {
            GameObject.Find("popText").GetComponent <Text>().text = "武将登用";
        }
        //Kamon
        string     kamonPath = "Prefabs/Touyou/kamon";
        GameObject kamon     = Instantiate(Resources.Load(kamonPath)) as GameObject;

        kamon.transform.SetParent(board.transform);
        kamon.transform.localScale    = new Vector2(1, 1);
        kamon.transform.localPosition = new Vector2(-310, 0);
        BusyoInfoGet busyoScript = new BusyoInfoGet();
        int          daimyoId    = busyoScript.getDaimyoId(busyoId);

        if (daimyoId == 0)
        {
            daimyoId = busyoScript.getDaimyoHst(busyoId);
        }
        string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString();

        kamon.GetComponent <Image> ().sprite =
            Resources.Load(imagePath, typeof(Sprite)) as Sprite;

        //Busyo View
        string     path  = "Prefabs/Player/Unit/BusyoUnit";
        GameObject Busyo = Instantiate(Resources.Load(path)) as GameObject;

        Busyo.name = busyoId.ToString();
        Busyo.transform.SetParent(board.transform);
        Busyo.transform.localScale = new Vector2(3.5f, 3.5f);
        Busyo.GetComponent <DragHandler>().enabled = false;
        RectTransform busyo_transform = Busyo.GetComponent <RectTransform>();

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

        //Ship Rank
        string     shipPath = "Prefabs/Busyo/ShipSts";
        GameObject ShipObj  = Instantiate(Resources.Load(shipPath)) as GameObject;

        ShipObj.transform.SetParent(Busyo.transform);
        preKaisen kaisenScript = new preKaisen();
        int       shipId       = kaisenScript.getShipSprite(ShipObj, busyoId);

        ShipObj.transform.localPosition = new Vector3(-40, -40, 0);
        ShipObj.transform.localScale    = new Vector2(0.5f, 0.5f);
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            if (shipId == 1)
            {
                ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "High";
            }
            else if (shipId == 2)
            {
                ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Mid";
            }
            else if (shipId == 3)
            {
                ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Low";
            }
        }
        else
        {
            if (shipId == 1)
            {
                ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "上";
            }
            else if (shipId == 2)
            {
                ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "中";
            }
            else if (shipId == 3)
            {
                ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "下";
            }
        }


        //Text Modification
        Busyo.transform.FindChild("Text").gameObject.GetComponent <Text>().enabled = false;

        //Rank Text Modification
        GameObject    rank           = Busyo.transform.FindChild("Rank").gameObject;
        RectTransform rank_transform = rank.GetComponent <RectTransform>();

        rank_transform.anchoredPosition     = new Vector3(0, -50, 0);
        rank_transform.sizeDelta            = new Vector2(200, 200);
        rank.GetComponent <Text>().fontSize = 200;

        /*Status*/
        string     statusPath = "Prefabs/Touyou/busyoStatus";
        GameObject status     = Instantiate(Resources.Load(statusPath)) as GameObject;

        status.transform.SetParent(board.transform);
        status.transform.localScale = new Vector2(1, 1);
        RectTransform status_transform = status.GetComponent <RectTransform>();

        status_transform.anchoredPosition = new Vector3(245, -40, 0);


        Entity_busyo_mst  busyoMst  = Resources.Load("Data/busyo_mst") as Entity_busyo_mst;
        Entity_senpou_mst senpouMst = Resources.Load("Data/senpou_mst") as Entity_senpou_mst;
        string            busyoName = busyoScript.getName(busyoId);

        GameObject.Find("busyoNameValue").GetComponent <Text>().text = busyoName;
        GameObject.Find("TosotsuValue").GetComponent <Text>().text   = busyoMst.param [busyoId - 1].minHp.ToString() + "00";
        GameObject.Find("BuyuuValue").GetComponent <Text> ().text    = busyoMst.param [busyoId - 1].minAtk.ToString() + "0";
        GameObject.Find("ChiryakuValue").GetComponent <Text>().text  = busyoMst.param [busyoId - 1].minDfc.ToString() + "0";
        GameObject.Find("SpeedValue").GetComponent <Text>().text     = busyoMst.param [busyoId - 1].minSpd.ToString();

        string  heisyuType = busyoMst.param [busyoId - 1].heisyu;
        string  heisyu     = "";
        Message msg        = new Message();

        if (heisyuType == "KB")
        {
            heisyu = msg.getMessage(55);
        }
        else if (heisyuType == "YR")
        {
            heisyu = msg.getMessage(56);
        }
        else if (heisyuType == "TP")
        {
            heisyu = msg.getMessage(57);
        }
        else if (heisyuType == "YM")
        {
            heisyu = msg.getMessage(58);
        }

        GameObject.Find("ChildNameValue").GetComponent <Text>().text = heisyu;

        int senpouId = busyoMst.param [busyoId - 1].senpou_id;

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            GameObject.Find("SenpouValue").GetComponent <Text>().text = senpouMst.param[senpouId - 1].nameEng;
        }
        else
        {
            GameObject.Find("SenpouValue").GetComponent <Text>().text = senpouMst.param[senpouId - 1].name;
        }
        int    senpouStatus = senpouMst.param [senpouId - 1].lv1;
        int    each         = (int)senpouMst.param [senpouId - 1].each;
        int    ratio        = (int)senpouMst.param [senpouId - 1].ratio;
        int    term         = (int)senpouMst.param [senpouId - 1].term;
        string senpouExp    = "";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            senpouExp = senpouMst.param [senpouId - 1].effectionEng;
        }
        else
        {
            senpouExp = senpouMst.param[senpouId - 1].effection;
        }
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            senpouExp = senpouExp.Replace("ABC", senpouStatus.ToString());
            senpouExp = senpouExp.Replace("DEF", each.ToString());
            senpouExp = senpouExp.Replace("GHI", ratio.ToString());
            senpouExp = senpouExp.Replace("JKL", term.ToString());
        }
        else
        {
            senpouExp = senpouExp.Replace("A", senpouStatus.ToString());
            senpouExp = senpouExp.Replace("B", each.ToString());
            senpouExp = senpouExp.Replace("C", ratio.ToString());
            senpouExp = senpouExp.Replace("D", term.ToString());
        }
        GameObject.Find("SenpouExpValue").GetComponent <Text>().text = senpouExp;


        /*Saku*/
        Saku          saku     = new Saku();
        List <string> sakuList = new List <string>();

        sakuList = saku.getSakuInfo(busyoId);

        //Icon
        string     sakuPath   = "Prefabs/Saku/saku" + sakuList[0];
        GameObject sakuIcon   = Instantiate(Resources.Load(sakuPath)) as GameObject;
        GameObject StatusSaku = status.transform.FindChild("StatusSaku").gameObject;

        foreach (Transform n in StatusSaku.transform)
        {
            if (n.tag == "Saku")
            {
                GameObject.Destroy(n.gameObject);
            }
        }
        sakuIcon.transform.SetParent(StatusSaku.transform);
        sakuIcon.transform.localScale            = new Vector2(0.7f, 0.7f);
        sakuIcon.GetComponent <Button>().enabled = false;
        RectTransform sakuIcon_transform = sakuIcon.GetComponent <RectTransform>();

        sakuIcon_transform.anchoredPosition = new Vector3(-235, 0, 0);

        StatusSaku.transform.FindChild("SakuExp").transform.FindChild("SakuExpValue").GetComponent <Text>().text = sakuList[2];

        /*daimyo busyo check*/
        Daimyo daimyo = new Daimyo();

        daimyoFlg = daimyo.daimyoBusyoCheck(busyoId);

        //pass data to button
        GameObject touyouBtn = GameObject.Find("TouyouButton").gameObject;

        touyouBtn.GetComponent <DoTouyou> ().busyoId   = busyoId;
        touyouBtn.GetComponent <DoTouyou> ().busyoName = busyoName;
        touyouBtn.GetComponent <DoTouyou> ().heisyu    = heisyuType;
        touyouBtn.GetComponent <DoTouyou> ().sequence  = int.Parse(name);
        touyouBtn.GetComponent <DoTouyou> ().rank      = busyoRank;
        touyouBtn.GetComponent <DoTouyou> ().daimyoFlg = daimyoFlg;


        //Tutorial
        if (Application.loadedLevelName == "tutorialTouyou")
        {
            TutorialController tutorialScript = new TutorialController();
            Vector2            vect           = new Vector2(0, 50);
            GameObject         btn            = tutorialScript.SetPointer(touyouBtn, vect);
            btn.transform.localScale = new Vector2(150, 150);
        }

        //Hired Check
        if (Application.loadedLevelName != "tutorialTouyou")
        {
            string myBusyo        = PlayerPrefs.GetString("myBusyo");
            char[] delimiterChars = { ',' };

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

                if (myBusyoList.Contains(busyoId.ToString()))
                {
                    msg.makeMessage(msg.getMessage(137));
                }
            }
            //Zukan Check
            string zukanBusyoHst = PlayerPrefs.GetString("zukanBusyoHst");
            if (zukanBusyoHst != null && zukanBusyoHst != "")
            {
                List <string> myZukanList = new List <string>();
                if (zukanBusyoHst.Contains(","))
                {
                    myZukanList = new List <string>(zukanBusyoHst.Split(delimiterChars));
                }
                else
                {
                    myZukanList.Add(zukanBusyoHst);
                }

                if (myZukanList.Contains(busyoId.ToString()))
                {
                    string     zukanPath = "Prefabs/Touyou/Zukan";
                    GameObject zukan     = Instantiate(Resources.Load(zukanPath)) as GameObject;
                    zukan.transform.SetParent(board.transform);
                    zukan.transform.localScale    = new Vector2(1, 1);
                    zukan.transform.localPosition = new Vector2(-41, 167);
                }
            }
        }
    }
Example #6
0
	public void OnClick () {

		string pathOfBack = "Prefabs/Common/TouchBack";
		GameObject back = Instantiate (Resources.Load (pathOfBack)) as GameObject;
		back.transform.parent = GameObject.Find ("Panel").transform;
		back.transform.localScale = new Vector2 (1, 1);
		back.transform.localPosition = new Vector2 (0, 0);

		string pathOfPop = "Prefabs/Zukan/busyoPop";
		GameObject pop = Instantiate (Resources.Load (pathOfPop)) as GameObject;
		pop.transform.parent = GameObject.Find ("Panel").transform;
		pop.transform.localScale = new Vector2 (1, 1);
		pop.transform.localPosition = new Vector2 (0, 0);

		//Kamon
		GameObject kamon = pop.transform.FindChild ("kamon").gameObject;
		string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString ();
		kamon.GetComponent<Image> ().sprite = 
			Resources.Load (imagePath, typeof(Sprite)) as Sprite;

		//Busyo Icon
		string busyoPath = "Prefabs/Player/Unit/" + busyoId.ToString();
		GameObject busyo = Instantiate (Resources.Load (busyoPath)) as GameObject;		
		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;


		//Name
		GameObject.Find ("busyoNameValue").GetComponent<Text> ().text = busyoName;
		string heisyuName = "";
		if (heisyu == "YR") {
			heisyuName = "槍隊";
		} else if (heisyu == "KB") {
			heisyuName = "騎馬隊";
		} else if (heisyu == "YM") {
			heisyuName = "弓隊";
		} else if (heisyu == "TP") {
			heisyuName = "鉄砲隊";
		}
		GameObject.Find ("ChildNameValue").GetComponent<Text> ().text = heisyuName;
		int newHp = hp * 100;
		GameObject.Find ("TosotsuValue").GetComponent<Text> ().text = newHp.ToString();
		int newAtk = atk * 10;
		GameObject.Find ("BuyuuValue").GetComponent<Text> ().text = newAtk.ToString();
		int newDfc = dfc * 10;
		GameObject.Find ("ChiryakuValue").GetComponent<Text> ().text = newDfc.ToString();
		GameObject.Find ("SpeedValue").GetComponent<Text> ().text = spd.ToString();
			
		//Senpou
		Entity_senpou_mst senpouMst  = Resources.Load ("Data/senpou_mst") as Entity_senpou_mst;
		GameObject.Find ("SenpouValue").GetComponent<Text>().text = senpouMst.param[senpouId-1].name;
		int senpouStatus = senpouMst.param [senpouId - 1].lv1;
		int each = (int)senpouMst.param [senpouId - 1].each;
		int ratio = (int)senpouMst.param [senpouId - 1].ratio;
		int term = (int)senpouMst.param [senpouId - 1].term;
		string senpouExp = senpouMst.param [senpouId - 1].effection;
		senpouExp = senpouExp.Replace("A", senpouStatus.ToString());
		senpouExp = senpouExp.Replace("B", each.ToString());
		senpouExp = senpouExp.Replace("C", ratio.ToString());
		senpouExp = senpouExp.Replace("D", term.ToString());
		
		GameObject.Find ("SenpouExpValue").GetComponent<Text>().text = senpouExp;


		//Saku
		Saku saku = new Saku ();
		List<string> sakuList = new List<string>();
		sakuList = saku.getSakuInfo (busyoId);
		
		string sakuPath = "Prefabs/Saku/saku" + sakuList[0];
		GameObject sakuIcon = Instantiate (Resources.Load (sakuPath)) as GameObject;
		GameObject StatusSaku = GameObject.Find("StatusSaku").gameObject;
		foreach ( Transform n in StatusSaku.transform ){
			if(n.tag == "Saku"){
				GameObject.Destroy(n.gameObject);
			}
		}
		sakuIcon.transform.SetParent (StatusSaku.transform);
		sakuIcon.transform.localScale = new Vector2 (0.85f, 0.85f);
		sakuIcon.GetComponent<Button>().enabled = false;
		RectTransform sakuIcon_transform = sakuIcon.GetComponent<RectTransform>();
		sakuIcon_transform.anchoredPosition = new Vector3(-360,0,0);
		
		StatusSaku.transform.FindChild("SakuExp").transform.FindChild("SakuExpValue").GetComponent<Text>().text = sakuList[2];


				
				



	}	
Example #7
0
	public void createSakuStatusView(string busyoId){
		
		/*Saku Fields*/
		Saku saku = new Saku ();
		List<string> sakuList = new List<string>();
		sakuList = saku.getSakuInfo (int.Parse(busyoId));
		
		//Icon
		string sakuPath = "Prefabs/Saku/saku" + sakuList[0];
		GameObject sakuIcon = Instantiate (Resources.Load (sakuPath)) as GameObject;
		GameObject StatusSaku = GameObject.Find("SenpouStatus").transform.FindChild("StatusSaku").gameObject;
		foreach ( Transform n in StatusSaku.transform ){
			if(n.tag == "Saku"){
				GameObject.Destroy(n.gameObject);
			}
		}
		sakuIcon.transform.SetParent (StatusSaku.transform);
		sakuIcon.transform.localScale = new Vector2 (1, 1);
		sakuIcon.GetComponent<Button>().enabled = false;
		RectTransform sakuIcon_transform = sakuIcon.GetComponent<RectTransform>();
		sakuIcon_transform.anchoredPosition3D = new Vector3(-260,0,0);
		
		StatusSaku.transform.FindChild("SakuName").transform.FindChild("SakuNameValue").GetComponent<Text>().text = sakuList[1];
		StatusSaku.transform.FindChild("SakuExp").transform.FindChild("SakuExpValue").GetComponent<Text>().text = sakuList[2];
		StatusSaku.transform.FindChild("SakuLv").transform.FindChild("SakuLvValue").GetComponent<Text>().text = sakuList[3];
		
		
	}
Example #8
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 #9
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;
                    }
                }
            }
        }
    }