예제 #1
0
    public void OnClick()
    {
        List <string> avlNaiseiList = new List <string> ();

        char[]           delimiterChars = { ':' };
        NaiseiController script         = GameObject.Find("NaiseiController").GetComponent <NaiseiController> ();
        string           shigen         = script.shigen;


        if (shigen != "null")
        {
            if (shigen.Contains(":"))
            {
                avlNaiseiList = new List <string> (shigen.Split(delimiterChars));
            }
            else
            {
                avlNaiseiList.Add(shigen);
            }
        }

        if (avlNaiseiList.Contains("tp") && avlNaiseiList.Contains("kb") && avlNaiseiList.Contains("snb"))
        {
            Message msg = new Message();
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                msg.makeMessage("You have already transferred technology of Gun, Hourse, Ninja.");
            }
            else
            {
                msg.makeMessage("この国に鉄砲、騎馬、忍技術は伝達済みです。");
            }
        }
        else
        {
            BusyoStatusButton pop = new BusyoStatusButton();
            pop.commonPopup(26);
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                GameObject.Find("popText").GetComponent <Text> ().text = "Tech Transfer";
            }
            else
            {
                GameObject.Find("popText").GetComponent <Text>().text = "技術伝達";
            }
        }
    }
예제 #2
0
	public void OnClick(){

		List<string> avlNaiseiList = new List<string> ();
		char[] delimiterChars = {':'};
		NaiseiController script = GameObject.Find ("NaiseiController").GetComponent<NaiseiController> ();
		string shigen = script.shigen;


		if(shigen != "null"){
			if(shigen.Contains(":")){
				avlNaiseiList = new List<string> (shigen.Split (delimiterChars));
			}else{
				avlNaiseiList.Add(shigen);
			}
		}

		if (avlNaiseiList.Contains ("tp") && avlNaiseiList.Contains ("kb") && avlNaiseiList.Contains ("snb")) {
			Message msg = new Message();
			msg.makeMessage("この国に鉄砲、騎馬、忍技術は伝達済みです。");
		
		} else {
		
			BusyoStatusButton pop = new BusyoStatusButton ();
			pop.commonPopup ();

			GameObject.Find ("popText").GetComponent<Text> ().text = "技術伝達";







		}




	}
예제 #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;
	}
예제 #4
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;
        }
    }
예제 #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);
                }
            }
        }
    }
예제 #6
0
	public void OnClick(){

		BusyoStatusButton pop = new BusyoStatusButton ();
		pop.commonPopup ();

		if (blank) {
		//New
			//Label
			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.anchoredPosition = new Vector3 (0, 0, 0);

			//Naisei Master
			Entity_naisei_mst naiseiMst = Resources.Load ("Data/naisei_mst") as Entity_naisei_mst;

			for (int i=1; i<naiseiMst.param.Count; i++) {
				if (naiseiMst.param [i].code != "NotYet") {
					//Slot
					string slotPath = "Prefabs/Naisei/NaiseiSlot";
					GameObject slot = Instantiate (Resources.Load (slotPath)) as GameObject;
					slot.transform.SetParent (scroll.transform.FindChild ("NaiseiContent").transform);
					slot.transform.localScale = new Vector2 (1, 1);

					//Bldg
					GameObject naiseiName = slot.transform.FindChild ("NaiseiName").gameObject;
					naiseiName.GetComponent<Text> ().text = naiseiMst.param [i].name;
					string bldgPath = "Prefabs/Naisei/Bldg/" + naiseiMst.param [i].code + "_s";
					GameObject bldg = Instantiate (Resources.Load (bldgPath)) as GameObject;
					bldg.transform.SetParent (naiseiName.transform);
					RectTransform bldgTransform = bldg.GetComponent<RectTransform> ();
					bldgTransform.anchoredPosition = new Vector3 (0, -315, 0);
					bldg.transform.localScale = new Vector2 (3, 3);
					bldg.GetComponent<Button>().enabled = false;

					//Some Value
					naiseiName.transform.FindChild ("NaiseiExp").GetComponent<Text> ().text = naiseiMst.param [i].exp;
					string target = naiseiMst.param [i].target;
					if (target == "money") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "金";
					} else if (target == "hyourou") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "兵糧";
					} else if (target == "YR") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "槍刀素材";
					}else if (target == "KB") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "騎馬素材";
					}else if (target == "TP") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "鉄砲素材";
					}else if (target == "YM") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "弓矢素材";
					}

					naiseiName.transform.FindChild ("NaiseiEffectValue").GetComponent<Text> ().text = "+" + naiseiMst.param [i].effect1;
					naiseiName.transform.FindChild ("RequiredMoney").GetComponent<Text> ().text = naiseiMst.param [i].money1.ToString();
					naiseiName.transform.FindChild ("RequiredHyourou").GetComponent<Text> ().text = naiseiMst.param [i].hyourou.ToString();
					GameObject createButton = naiseiName.transform.FindChild("CreateButton").gameObject;
					createButton.GetComponent<BuildNaisei> ().panelId = int.Parse(name);
					createButton.GetComponent<BuildNaisei> ().naiseiId = i;
					createButton.GetComponent<BuildNaisei> ().naiseiName = naiseiMst.param [i].name;
					createButton.GetComponent<BuildNaisei> ().requiredMoney = naiseiMst.param [i].money1;
					createButton.GetComponent<BuildNaisei> ().requiredHyourou = naiseiMst.param [i].hyourou;

				}
			}

		} else {
		//Update
			GameObject.Find ("popText").GetComponent<Text> ().text = "内政強化";

			string naiseiUpdatePath = "Prefabs/Naisei/NaiseiUpdate";
			GameObject NaiseiUpdate = Instantiate (Resources.Load (naiseiUpdatePath)) as GameObject;
			NaiseiUpdate.transform.parent = GameObject.Find ("board(Clone)").transform;
			NaiseiUpdate.transform.localScale = new Vector2 (1, 1);
			RectTransform naiseiUpdateTransform = NaiseiUpdate.GetComponent<RectTransform> ();
			naiseiUpdateTransform.anchoredPosition = new Vector3 (0, -40, 0);

			string bldgRank = "";
			int nextLv = int.Parse(lv) + 1;
			if(nextLv<8){
				bldgRank = "s";
			}else if(nextLv < 15){
				bldgRank = "m";
			}else if(15 <= nextLv){
				bldgRank = "l";
			}
			string bldg = type + "_" + bldgRank;
			string pathMod = "";
			if(type == "shiro"){
				pathMod = "Shiro/";
			}else{
				pathMod = "Bldg/";
			}

			string bldgPath = "Prefabs/Naisei/" + pathMod + bldg;
			GameObject bldgObj = Instantiate (Resources.Load (bldgPath)) as GameObject;
			bldgObj.transform.SetParent(NaiseiUpdate.transform);
			bldgObj.transform.localScale = new Vector3 (1.5f, 1.5f, 1);
			RectTransform bldgTransform = bldgObj.GetComponent<RectTransform> ();
			bldgTransform.anchoredPosition = new Vector3 (-250, 0, 0);
			bldgObj.GetComponent<Button>().enabled = false;

			//Detail Info
			GameObject baseObj = NaiseiUpdate.transform.FindChild("Base").gameObject;
			baseObj.transform.FindChild("FromLv").GetComponent<Text>().text = "Lv" + lv;
			baseObj.transform.FindChild("ToLv").GetComponent<Text>().text = nextLv.ToString();
			baseObj.transform.FindChild("NowNaiseiEffectValue").GetComponent<Text>().text = "+" + effect.ToString();
			baseObj.transform.FindChild("NextNaiseiEffectValue").GetComponent<Text>().text = "+" + effectNextLv.ToString();
			baseObj.transform.FindChild("RequiredMoney").GetComponent<Text>().text = moneyNextLv.ToString();
			baseObj.transform.FindChild("RequiredHyourou").GetComponent<Text>().text = requiredHyourou.ToString();


			if(type=="shiro"){
				baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "防備";
				baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "城";
				baseObj.transform.FindChild ("NaiseiEffectLabel2").GetComponent<Text> ().enabled = true;
				baseObj.transform.FindChild("NowNaiseiEffectValue2").GetComponent<Text>().enabled = true;
				baseObj.transform.FindChild("NextNaiseiEffectValue2").GetComponent<Text>().enabled = true;
				baseObj.transform.FindChild ("arrow2").GetComponent<Image> ().enabled = true;
				baseObj.transform.FindChild("NowNaiseiEffectValue2").GetComponent<Text>().text = "+" + effect.ToString();
				baseObj.transform.FindChild("NextNaiseiEffectValue2").GetComponent<Text>().text = "+" + effectNextLv.ToString();

			}else{

				baseObj.transform.FindChild ("NaiseiEffectLabel2").GetComponent<Text> ().enabled = false;
				baseObj.transform.FindChild ("NowNaiseiEffectValue2").GetComponent<Text> ().enabled = false;
				baseObj.transform.FindChild ("arrow2").GetComponent<Image> ().enabled = false;
				baseObj.transform.FindChild ("NextNaiseiEffectValue2").GetComponent<Text> ().enabled = false;

				if (type == "shop") {
					baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "金";
					baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "商人町";

				} else if (type == "ta") {
					baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "兵糧";
					baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "村落";

				} else if (type == "yr") {
					baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "槍刀素材";
					baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "刀鍛冶屋";
					
				} else if (type == "kb") {
					baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "騎馬素材";
					baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "厩舎";
					
				} else if (type == "tp") {
					baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "鉄砲素材";
					baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "鉄砲鍛冶屋";
					
				} else if (type == "ym") {
					baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "弓矢素材";
					baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "皮職人";
					
				}
			}

			//Button Setting
			GameObject updateBtn = baseObj.transform.FindChild ("NaiseiUpdateButton").gameObject;
			updateBtn.GetComponent<UpdateNaisei>().activeKuniId = GameObject.Find ("NaiseiController").GetComponent<NaiseiController>().activeKuniId;
			updateBtn.GetComponent<UpdateNaisei>().requiredMoney = moneyNextLv;
			updateBtn.GetComponent<UpdateNaisei>().requiredHyourou = requiredHyourou;
			updateBtn.GetComponent<UpdateNaisei>().areaId = name;
			updateBtn.GetComponent<UpdateNaisei>().naiseiId = naiseiId;
			updateBtn.GetComponent<UpdateNaisei>().targetLv = nextLv;
			updateBtn.GetComponent<UpdateNaisei>().naiseiName = naiseiName;
		}
	}
예제 #7
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;

		}
	}
예제 #8
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;

		//pass data to button
		GameObject.Find ("TouyouButton").GetComponent<DoTouyou> ().busyoId = busyoId;
		GameObject.Find ("TouyouButton").GetComponent<DoTouyou> ().busyoName = busyoName;
		GameObject.Find ("TouyouButton").GetComponent<DoTouyou> ().heisyu = heisyuType;
		GameObject.Find ("TouyouButton").GetComponent<DoTouyou> ().sequence = int.Parse(name);
		GameObject.Find ("TouyouButton").GetComponent<DoTouyou> ().rank = Busyo.transform.FindChild("Rank").GetComponent<Text>().text;;
	}
예제 #9
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;
        }
    }
예제 #10
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;
        }
    }
예제 #11
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource>();

        if (blank)
        {
            audioSources[0].Play();
            BusyoStatusButton pop = new BusyoStatusButton();
            pop.commonPopup(20);

            //New
            //Label
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                GameObject.Find("popText").GetComponent <Text> ().text = "Development";
            }
            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.anchoredPosition = new Vector3(0, 0, 0);

            //Naisei Master
            Entity_naisei_mst naiseiMst = Resources.Load("Data/naisei_mst") as Entity_naisei_mst;

            //Re-make Common & Shigen
            List <string> avlNaiseiList  = new List <string> ();
            char[]        delimiterChars = { ':' };
            string        shigen         = GameObject.Find("NaiseiController").GetComponent <NaiseiController>().shigen;
            if (shigen != "null")
            {
                if (shigen.Contains(":"))
                {
                    avlNaiseiList = new List <string> (shigen.Split(delimiterChars));
                }
                else
                {
                    avlNaiseiList.Add(shigen);
                }
            }

            /***Tech Item Start***/
            List <string> avlTechList = new List <string> ();

            int tpQty  = PlayerPrefs.GetInt("transferTP");
            int kbQty  = PlayerPrefs.GetInt("transferKB");
            int snbQty = PlayerPrefs.GetInt("transferSNB");
            if (tpQty > 0 && !avlNaiseiList.Contains("tp"))
            {
                avlTechList.Add("tp");
            }
            if (kbQty > 0 && !avlNaiseiList.Contains("kb"))
            {
                avlTechList.Add("kb");
            }
            if (snbQty > 0 && !avlNaiseiList.Contains("snb"))
            {
                avlTechList.Add("snb");
            }
            /***Tech Item Finish***/



            NaiseiInfo naiseiInfo = new NaiseiInfo();
            for (int i = 1; i < naiseiMst.param.Count; i++)
            {
                string code = naiseiMst.param [i].code;

                //if (code != "NotYet"){ // for test
                if ((naiseiMst.param [i].common == 1 && code != "NotYet") ||
                    (avlNaiseiList.Contains(naiseiMst.param [i].code) && code != "NotYet"))
                {
                    //Slot
                    string     slotPath = "Prefabs/Naisei/NaiseiSlot";
                    GameObject slot     = Instantiate(Resources.Load(slotPath)) as GameObject;
                    slot.transform.SetParent(scroll.transform.FindChild("NaiseiContent").transform);
                    slot.transform.localScale = new Vector2(1, 1);

                    //Bldg
                    string naiseiNameText = naiseiInfo.getNaiseiName(i);
                    string naiseExpText   = naiseiInfo.getNaiseiExp(i);


                    GameObject naiseiName = slot.transform.FindChild("NaiseiName").gameObject;
                    naiseiName.GetComponent <Text> ().text = naiseiNameText;
                    string     bldgPath = "Prefabs/Naisei/Bldg/" + naiseiMst.param [i].code + "_s";
                    GameObject bldg     = Instantiate(Resources.Load(bldgPath)) as GameObject;
                    bldg.transform.SetParent(naiseiName.transform);
                    RectTransform bldgTransform = bldg.GetComponent <RectTransform> ();
                    bldgTransform.anchoredPosition       = new Vector3(0, -315, 0);
                    bldg.transform.localScale            = new Vector2(3, 3);
                    bldg.GetComponent <Button>().enabled = false;

                    //Some Value
                    naiseiName.transform.FindChild("NaiseiExp").GetComponent <Text> ().text = naiseExpText;
                    string target  = naiseiMst.param [i].target;
                    int    effect1 = naiseiMst.param [i].effect1;
                    if (Application.systemLanguage != SystemLanguage.Japanese)
                    {
                        if (target == "money")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Money";
                        }
                        else if (target == "hyourou")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Stamina";
                        }
                        else if (target == "YR")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Spear Item";
                        }
                        else if (target == "KB")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Cavalry Item";
                        }
                        else if (target == "TP")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Gun Item";
                        }
                        else if (target == "YM")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Bow Item";
                        }
                        else if (target == "nbn")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Christian";
                        }
                        else if (target == "bnk")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Culture";
                        }
                        else if (target == "snb")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Ninja";
                        }
                        else if (target == "bky")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Buddhism";
                        }
                        else if (target == "child")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Additional Soldier";
                        }
                        else if (target == "dfc")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Defence";
                        }
                    }
                    else
                    {
                        if (target == "money")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "金";
                        }
                        else if (target == "hyourou")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "兵糧";
                        }
                        else if (target == "YR")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "槍刀素材";
                        }
                        else if (target == "KB")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "騎馬素材";
                        }
                        else if (target == "TP")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "鉄砲素材";
                        }
                        else if (target == "YM")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "弓矢素材";
                        }
                        else if (target == "nbn")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "基督教";
                        }
                        else if (target == "bnk")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "文化";
                        }
                        else if (target == "snb")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "忍";
                        }
                        else if (target == "bky")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "仏教";
                        }
                        else if (target == "child")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "足軽兵数";
                        }
                        else if (target == "dfc")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "防備";
                        }
                    }
                    //Label & Effect Value Adjustment
                    if (code != "kzn")
                    {
                        if (code != "yr" && code != "kb" && code != "tp" && code != "ym" && code != "snb")
                        {
                            if (code != "nbn" && code != "kgy" && code != "bky" && code != "hsy" && code != "trd")
                            {
                                naiseiName.transform.FindChild("NaiseiEffectValue").GetComponent <Text> ().text = "+" + effect1;
                            }
                            else
                            {
                                naiseiName.transform.FindChild("NaiseiUnit").GetComponent <Text>().enabled      = false;
                                naiseiName.transform.FindChild("NaiseiEffectValue").GetComponent <Text> ().text = "+" + effect1;
                            }
                        }
                        else
                        {
                            effect1 = effect1 * 2;

                            //Rank


                            naiseiName.transform.FindChild("NaiseiEffectValue").GetComponent <Text> ().text = "+" + effect1;
                        }
                    }
                    else
                    {
                        effect1 = effect1 * 4;
                        naiseiName.transform.FindChild("NaiseiEffectValue").GetComponent <Text> ().text = "+" + effect1;
                    }

                    naiseiName.transform.FindChild("RequiredMoney").GetComponent <Text> ().text   = naiseiMst.param [i].money1.ToString();
                    naiseiName.transform.FindChild("RequiredHyourou").GetComponent <Text> ().text = naiseiMst.param [i].hyourou.ToString();
                    GameObject createButton = naiseiName.transform.FindChild("CreateButton").gameObject;
                    createButton.GetComponent <BuildNaisei> ().panelId         = int.Parse(name);
                    createButton.GetComponent <BuildNaisei> ().naiseiId        = i;
                    createButton.GetComponent <BuildNaisei>().naiseiName       = naiseiNameText;
                    createButton.GetComponent <BuildNaisei> ().requiredMoney   = naiseiMst.param [i].money1;
                    createButton.GetComponent <BuildNaisei> ().requiredHyourou = naiseiMst.param [i].hyourou;
                }
                else if (naiseiMst.param [i].common == 0 && code != "NotYet" && avlTechList.Contains(naiseiMst.param [i].code))
                {
                    //Technical Item
                    string naiseiNameText = naiseiInfo.getNaiseiName(i);
                    string naiseExpText   = naiseiInfo.getNaiseiExp(i);

                    //Slot
                    string     slotPath = "Prefabs/Naisei/NaiseiSlotWithItem";
                    GameObject slot     = Instantiate(Resources.Load(slotPath)) as GameObject;
                    slot.transform.SetParent(scroll.transform.FindChild("NaiseiContent").transform);
                    slot.transform.localScale = new Vector2(1, 1);

                    //Bldg
                    GameObject naiseiName = slot.transform.FindChild("NaiseiName").gameObject;
                    naiseiName.GetComponent <Text>().text = naiseiNameText;
                    string     bldgPath = "Prefabs/Naisei/Bldg/" + naiseiMst.param [i].code + "_s";
                    GameObject bldg     = Instantiate(Resources.Load(bldgPath)) as GameObject;
                    bldg.transform.SetParent(naiseiName.transform);
                    RectTransform bldgTransform = bldg.GetComponent <RectTransform> ();
                    bldgTransform.anchoredPosition       = new Vector3(0, -315, 0);
                    bldg.transform.localScale            = new Vector2(3, 3);
                    bldg.GetComponent <Button>().enabled = false;

                    //Some Value
                    naiseiName.transform.FindChild("NaiseiExp").GetComponent <Text>().text = naiseExpText;
                    string target  = naiseiMst.param [i].target;
                    int    effect1 = naiseiMst.param [i].effect1;

                    int techId = 0;
                    if (Application.systemLanguage != SystemLanguage.Japanese)
                    {
                        if (target == "KB")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Cavalry Item";
                            techId = 2;
                        }
                        else if (target == "TP")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Gun Item";
                            techId = 1;
                        }
                        else if (target == "snb")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Ninja";
                            techId = 3;
                        }
                    }
                    else
                    {
                        if (target == "KB")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "騎馬素材";
                            techId = 2;
                        }
                        else if (target == "TP")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "鉄砲素材";
                            techId = 1;
                        }
                        else if (target == "snb")
                        {
                            naiseiName.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "忍";
                            techId = 3;
                        }
                    }
                    //Label & Effect Value Adjustment
                    effect1 = effect1 * 2;
                    naiseiName.transform.FindChild("NaiseiEffectValue").GetComponent <Text> ().text = "+" + effect1;

                    naiseiName.transform.FindChild("RequiredHyourou").GetComponent <Text> ().text = naiseiMst.param [i].hyourou.ToString();
                    GameObject createButton = naiseiName.transform.FindChild("CreateButton").gameObject;
                    createButton.GetComponent <BuildNaiseiWithItem> ().techId          = techId;
                    createButton.GetComponent <BuildNaiseiWithItem> ().panelId         = int.Parse(name);
                    createButton.GetComponent <BuildNaiseiWithItem> ().naiseiId        = i;
                    createButton.GetComponent <BuildNaiseiWithItem>().naiseiName       = naiseiNameText;
                    createButton.GetComponent <BuildNaiseiWithItem> ().requiredHyourou = naiseiMst.param [i].hyourou;
                }
            }

            //tutorial
            if (Application.loadedLevelName == "tutorialNaisei")
            {
                GameObject.Find("board(Clone)").transform.FindChild("close").gameObject.SetActive(false);

                foreach (Transform child in scroll.transform.FindChild("NaiseiContent").transform)
                {
                    if (child.transform.FindChild("NaiseiName").transform.FindChild("CreateButton").GetComponent <BuildNaisei>())
                    {
                        if (child.transform.FindChild("NaiseiName").transform.FindChild("CreateButton").GetComponent <BuildNaisei>().naiseiId != 1)
                        {
                            child.gameObject.SetActive(false);
                        }
                    }
                    else if (child.transform.FindChild("NaiseiName").transform.FindChild("CreateButton").GetComponent <BuildNaiseiWithItem>())
                    {
                        child.gameObject.SetActive(false);
                    }
                }

                TutorialController tutorialScript = new TutorialController();
                Vector2            vect           = new Vector2(0, 30);
                GameObject         createButton   = GameObject.Find("CreateButton").gameObject;
                GameObject         pointUp        = tutorialScript.SetPointer(createButton, vect);
                pointUp.transform.localScale = new Vector2(100, 100);

                //set zero
                GameObject.Find("RequiredMoney").GetComponent <Text>().text   = "0";
                GameObject.Find("RequiredHyourou").GetComponent <Text>().text = "0";
                createButton.GetComponent <BuildNaisei>().requiredHyourou     = 0;
                createButton.GetComponent <BuildNaisei>().requiredMoney       = 0;
            }
        }
        else
        {
            if (int.Parse(lv) == 20)
            {
                Message msg = new Message();
                msg.makeMessage(msg.getMessage(116));
                audioSources[4].Play();
            }
            else
            {
                BusyoStatusButton pop   = new BusyoStatusButton();
                GameObject        board = pop.commonPopup(21);
                audioSources[0].Play();

                //Update
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    GameObject.Find("popText").GetComponent <Text> ().text = "Development";
                }
                else
                {
                    GameObject.Find("popText").GetComponent <Text>().text = "内政強化";
                }

                string     naiseiUpdatePath = "Prefabs/Naisei/NaiseiUpdate";
                GameObject NaiseiUpdate     = Instantiate(Resources.Load(naiseiUpdatePath)) as GameObject;
                NaiseiUpdate.transform.SetParent(board.transform);
                NaiseiUpdate.transform.localScale = new Vector2(1, 1);
                RectTransform naiseiUpdateTransform = NaiseiUpdate.GetComponent <RectTransform> ();
                naiseiUpdateTransform.anchoredPosition = new Vector3(0, -40, 0);

                string bldgRank = "";
                int    nextLv   = int.Parse(lv) + 1;
                if (nextLv < 8)
                {
                    bldgRank = "s";
                }
                else if (nextLv < 15)
                {
                    bldgRank = "m";
                }
                else if (15 <= nextLv)
                {
                    bldgRank = "l";
                }
                string bldg    = type + "_" + bldgRank;
                string pathMod = "";
                if (type == "shiro")
                {
                    pathMod = "Shiro/";
                }
                else
                {
                    pathMod = "Bldg/";
                }

                string     bldgPath = "Prefabs/Naisei/" + pathMod + bldg;
                GameObject bldgObj  = Instantiate(Resources.Load(bldgPath)) as GameObject;
                bldgObj.transform.SetParent(NaiseiUpdate.transform);
                bldgObj.transform.localScale = new Vector3(1.5f, 1.5f, 1);
                RectTransform bldgTransform = bldgObj.GetComponent <RectTransform> ();
                bldgTransform.anchoredPosition          = new Vector3(-250, 0, 0);
                bldgObj.GetComponent <Button>().enabled = false;

                //Special Shiro
                if (type == "shiro")
                {
                    string shiroTmp = "shiro" + GameObject.Find("NaiseiController").GetComponent <NaiseiController>().activeKuniId;
                    if (PlayerPrefs.HasKey(shiroTmp))
                    {
                        int shiroId = PlayerPrefs.GetInt(shiroTmp);
                        if (shiroId != 0)
                        {
                            string imagePath = "Prefabs/Naisei/Shiro/Sprite/" + shiroId;
                            bldgObj.GetComponent <Image>().sprite =
                                Resources.Load(imagePath, typeof(Sprite)) as Sprite;
                        }
                    }
                }

                //Detail Info
                GameObject baseObj = NaiseiUpdate.transform.FindChild("Base").gameObject;
                baseObj.transform.FindChild("FromLv").GetComponent <Text>().text = "Lv" + lv;
                baseObj.transform.FindChild("ToLv").GetComponent <Text>().text   = nextLv.ToString();

                //Rank
                string nowRank = "";
                string nxtRank = "";
                if (type == "yr" || type == "kb" || type == "tp" || type == "ym" || type == "kb" || type == "snb")
                {
                    if (Application.systemLanguage != SystemLanguage.Japanese)
                    {
                        if (int.Parse(lv) < 11)
                        {
                            nowRank = "Low";
                        }
                        else if (int.Parse(lv) < 16)
                        {
                            nowRank = "Mid";
                        }
                        else
                        {
                            nowRank = "High";
                        }
                    }
                    else
                    {
                        if (int.Parse(lv) < 11)
                        {
                            nowRank = "下";
                        }
                        else if (int.Parse(lv) < 16)
                        {
                            nowRank = "中";
                        }
                        else
                        {
                            nowRank = "上";
                        }
                    }
                    if (Application.systemLanguage != SystemLanguage.Japanese)
                    {
                        if ((int.Parse(lv) + 1) < 11)
                        {
                            nxtRank = "Low";
                        }
                        else if ((int.Parse(lv) + 1) < 16)
                        {
                            nxtRank = "Mid";
                        }
                        else
                        {
                            nxtRank = "High";
                        }
                    }
                    else
                    {
                        if ((int.Parse(lv) + 1) < 11)
                        {
                            nxtRank = "下";
                        }
                        else if ((int.Parse(lv) + 1) < 16)
                        {
                            nxtRank = "中";
                        }
                        else
                        {
                            nxtRank = "上";
                        }
                    }
                }

                baseObj.transform.FindChild("NowNaiseiEffectValue").GetComponent <Text>().text  = nowRank + " +" + effect.ToString();
                baseObj.transform.FindChild("NextNaiseiEffectValue").GetComponent <Text>().text = nxtRank + " +" + effectNextLv.ToString();
                baseObj.transform.FindChild("RequiredMoney").GetComponent <Text>().text         = moneyNextLv.ToString();
                baseObj.transform.FindChild("RequiredHyourou").GetComponent <Text>().text       = requiredHyourou.ToString();


                if (type == "shiro")
                {
                    if (Application.systemLanguage != SystemLanguage.Japanese)
                    {
                        baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Defence";
                    }
                    else
                    {
                        baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "防備";
                    }
                    baseObj.transform.FindChild("NaiseiUnit").GetComponent <Text> ().enabled = false;
                    if (Application.systemLanguage != SystemLanguage.Japanese)
                    {
                        baseObj.transform.FindChild("BldgName").GetComponent <Text> ().text = "Castle";
                    }
                    else
                    {
                        baseObj.transform.FindChild("BldgName").GetComponent <Text>().text = "城";
                    }
                    baseObj.transform.FindChild("NaiseiEffectLabel2").GetComponent <Text> ().enabled    = true;
                    baseObj.transform.FindChild("NowNaiseiEffectValue2").GetComponent <Text>().enabled  = true;
                    baseObj.transform.FindChild("NextNaiseiEffectValue2").GetComponent <Text>().enabled = true;
                    baseObj.transform.FindChild("arrow2").GetComponent <Image> ().enabled            = true;
                    baseObj.transform.FindChild("NowNaiseiEffectValue2").GetComponent <Text>().text  = "+" + effect.ToString();
                    baseObj.transform.FindChild("NextNaiseiEffectValue2").GetComponent <Text>().text = "+" + effectNextLv.ToString();

                    //Special Castle Check
                    string        nowQty         = PlayerPrefs.GetString("shiro");
                    List <string> nowQtyList     = new List <string>();
                    char[]        delimiterChars = { ',' };
                    if (nowQty != "" && nowQty != null)
                    {
                        //scroll view
                        string     scrollPath = "Prefabs/Naisei/Shiro/ShiroScrollView";
                        GameObject scroll     = Instantiate(Resources.Load(scrollPath)) as GameObject;
                        scroll.transform.SetParent(board.transform);

                        GameObject content = scroll.transform.FindChild("Content").gameObject;
                        scroll.transform.localScale    = new Vector2(0.8f, 0.8f);
                        scroll.transform.localPosition = new Vector2(-240, -240);

                        nowQtyList = new List <string>(nowQty.Split(delimiterChars));
                        string path  = "Prefabs/Item/Shiro/shiro";
                        Shiro  shiro = new Shiro();
                        for (int i = 0; i < nowQtyList.Count; i++)
                        {
                            string imagePath = "Prefabs/Naisei/Shiro/Sprite/";
                            int    qty       = int.Parse(nowQtyList[i]);
                            if (qty != 0)
                            {
                                int        shiroId = i + 1;
                                GameObject item    = Instantiate(Resources.Load(path)) as GameObject;
                                item.transform.SetParent(content.transform);
                                item.transform.localScale    = new Vector2(1, 1);
                                item.transform.localPosition = new Vector3(0, 0, 0);
                                item.transform.FindChild("Qty").GetComponent <Text>().text = qty.ToString();

                                string name = shiro.getName(shiroId);
                                item.transform.FindChild("name").GetComponent <Text>().text = name;
                                imagePath = imagePath + shiroId;
                                item.transform.FindChild("image").GetComponent <Image>().sprite =
                                    Resources.Load(imagePath, typeof(Sprite)) as Sprite;

                                //value
                                item.name = "shiro" + shiroId;
                                item.GetComponent <ItemInfo>().posessQty = qty;
                                item.GetComponent <ItemInfo>().itemId    = shiroId;
                                item.GetComponent <ItemInfo>().itemName  = name;
                            }
                        }
                        //scroll.GetComponent<ScrollRect>().enabled = false;
                    }
                }
                else
                {
                    //Destroy Button
                    string     dstryPath   = "Prefabs/Naisei/DestroyButton";
                    GameObject dstryBtnObj = Instantiate(Resources.Load(dstryPath)) as GameObject;
                    dstryBtnObj.transform.SetParent(GameObject.Find("board(Clone)").transform);
                    dstryBtnObj.transform.localPosition = new Vector2(-480, -220);
                    dstryBtnObj.transform.localScale    = new Vector2(1, 1);
                    dstryBtnObj.GetComponent <NaiseiDestroy> ().areaId       = int.Parse(name);
                    dstryBtnObj.GetComponent <NaiseiDestroy> ().activeKuniId = GameObject.Find("NaiseiController").GetComponent <NaiseiController> ().activeKuniId;

                    baseObj.transform.FindChild("NaiseiEffectLabel2").GetComponent <Text> ().enabled    = false;
                    baseObj.transform.FindChild("NowNaiseiEffectValue2").GetComponent <Text> ().enabled = false;
                    baseObj.transform.FindChild("arrow2").GetComponent <Image> ().enabled = false;
                    baseObj.transform.FindChild("NextNaiseiEffectValue2").GetComponent <Text> ().enabled = false;

                    if (Application.systemLanguage != SystemLanguage.Japanese)
                    {
                        if (type == "shop")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Money";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text> ().text          = "Store";
                        }
                        else if (type == "ta")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Stamina";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text> ().text          = "Farm";
                        }
                        else if (type == "yr")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Spear Item";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text> ().text          = "Sword Blacksmith";
                        }
                        else if (type == "kb")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Cavalry Item";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text> ().text          = "Stable";
                        }
                        else if (type == "tp")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Gun Item";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text> ().text          = "Gun Blacksmith";
                        }
                        else if (type == "ym")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Bow Item";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text> ().text          = "Archery House";
                        }
                        else if (type == "kzn")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Money";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text> ().text          = "Mine";
                        }
                        else if (type == "nbn")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Christian";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text> ().text          = "Church";
                            baseObj.transform.FindChild("NaiseiUnit").GetComponent <Text> ().enabled     = false;
                        }
                        else if (type == "kgy")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Culture";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text> ().text          = "Court Noble House";
                            baseObj.transform.FindChild("NaiseiUnit").GetComponent <Text> ().enabled     = false;
                        }
                        else if (type == "snb")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Ninja";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text> ().text          = "Ninja Town";
                        }
                        else if (type == "bky")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Buddhism";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text> ().text          = "Temple";
                            baseObj.transform.FindChild("NaiseiUnit").GetComponent <Text> ().enabled     = false;
                        }
                        else if (type == "hsy")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Additional Soldier";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text> ().text          = "Barrack";
                            baseObj.transform.FindChild("NaiseiUnit").GetComponent <Text> ().enabled     = false;
                        }
                        else if (type == "trd")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text> ().text = "Defence";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text> ().text          = "Fort";
                            baseObj.transform.FindChild("NaiseiUnit").GetComponent <Text> ().enabled     = false;
                        }
                    }
                    else
                    {
                        if (type == "shop")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "金";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text>().text          = "商人町";
                        }
                        else if (type == "ta")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "兵糧";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text>().text          = "村落";
                        }
                        else if (type == "yr")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "槍刀素材";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text>().text          = "刀鍛冶屋";
                        }
                        else if (type == "kb")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "騎馬素材";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text>().text          = "厩舎";
                        }
                        else if (type == "tp")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "鉄砲素材";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text>().text          = "鉄砲鍛冶屋";
                        }
                        else if (type == "ym")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "弓矢素材";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text>().text          = "皮職人";
                        }
                        else if (type == "kzn")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "金";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text>().text          = "鉱山";
                        }
                        else if (type == "nbn")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "基督教";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text>().text          = "南蛮寺";
                            baseObj.transform.FindChild("NaiseiUnit").GetComponent <Text>().enabled     = false;
                        }
                        else if (type == "kgy")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "文化";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text>().text          = "公家館";
                            baseObj.transform.FindChild("NaiseiUnit").GetComponent <Text>().enabled     = false;
                        }
                        else if (type == "snb")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "忍";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text>().text          = "忍の里";
                        }
                        else if (type == "bky")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "仏教";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text>().text          = "寺";
                            baseObj.transform.FindChild("NaiseiUnit").GetComponent <Text>().enabled     = false;
                        }
                        else if (type == "hsy")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "足軽兵数";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text>().text          = "兵舎";
                            baseObj.transform.FindChild("NaiseiUnit").GetComponent <Text>().enabled     = false;
                        }
                        else if (type == "trd")
                        {
                            baseObj.transform.FindChild("NaiseiEffectLabel").GetComponent <Text>().text = "防備";
                            baseObj.transform.FindChild("BldgName").GetComponent <Text>().text          = "砦";
                            baseObj.transform.FindChild("NaiseiUnit").GetComponent <Text>().enabled     = false;
                        }
                    }
                }

                //Button Setting
                GameObject updateBtn = baseObj.transform.FindChild("NaiseiUpdateButton").gameObject;
                updateBtn.GetComponent <UpdateNaisei>().activeKuniId    = GameObject.Find("NaiseiController").GetComponent <NaiseiController>().activeKuniId;
                updateBtn.GetComponent <UpdateNaisei>().requiredMoney   = moneyNextLv;
                updateBtn.GetComponent <UpdateNaisei>().requiredHyourou = requiredHyourou;
                updateBtn.GetComponent <UpdateNaisei>().areaId          = name;
                updateBtn.GetComponent <UpdateNaisei>().naiseiId        = naiseiId;
                updateBtn.GetComponent <UpdateNaisei>().targetLv        = nextLv;
                updateBtn.GetComponent <UpdateNaisei>().naiseiName      = naiseiName;
            }
        }
    }
예제 #12
0
	public void OnClick(){

		BusyoStatusButton bsb = new BusyoStatusButton ();

		if (name == "kanni") {
			if(kanniId ==0){
				string myKanni = PlayerPrefs.GetString("myKanni");

				if(myKanni != null && myKanni !=""){

					bsb.commonPopup ();
					GameObject.Find ("popText").GetComponent<Text> ().text ="官位一覧";
					
					string scrollPath = "Prefabs/Busyo/KanniScrollView";
					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 = "KanniScrollView";
					RectTransform scrollTransform = scroll.GetComponent<RectTransform> ();
					scrollTransform.anchoredPosition3D = new Vector3 (0, 0, 0);

					List<string> myKanniList = new List<string> ();

					if(myKanni.Contains(",")){
						char[] delimiterChars = {','};
						myKanniList = new List<string> (myKanni.Split (delimiterChars));
					}else{
						myKanniList.Add(myKanni);
					}

					myKanniList.Sort();

					string pathSlot = "Prefabs/Busyo/KanniSlot";
					Kanni kanni = new Kanni();
					GameObject content = scroll.transform.FindChild("KanniContent").gameObject;
					for(int i=0; i<myKanniList.Count; i++){
						GameObject slot = Instantiate (Resources.Load (pathSlot)) as GameObject;
						slot.transform.SetParent(content.transform);
						slot.transform.localScale = new Vector2 (1, 1);

						int kanniIdTmp = int.Parse(myKanniList[i]);
						string kanniName = kanni.getKanni(kanniIdTmp);
						string kanniIkai = kanni.getIkai(kanniIdTmp);
						string EffectLabel = kanni.getEffectLabel(kanniIdTmp);
						int effect = kanni.getEffect(kanniIdTmp);

						slot.transform.FindChild("Name").GetComponent<Text>().text = kanniIkai + "\t" + kanniName;
						slot.transform.FindChild("EffectLabel").GetComponent<Text>().text = EffectLabel;
						slot.transform.FindChild("EffectValue").GetComponent<Text>().text = "+" + effect.ToString() + "%";

						GameObject btn = slot.transform.FindChild("GiveButton").gameObject;
						btn.GetComponent<GiveKanni>().busyoId = busyoId;
						btn.GetComponent<GiveKanni>().kanniId = kanniIdTmp;

					}



				}else{
					Message msg = new Message();
					msg.makeMessage("官位を持っておりませんぞ。\n山城国にある朝廷を訪れてみましょう。");
				}
			}else{

				string backPath = "Prefabs/Busyo/back";
				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);

				string removePath = "Prefabs/Busyo/KanniRemoveConfirm";
				GameObject remove = Instantiate (Resources.Load (removePath)) as GameObject;
				remove.transform.SetParent(GameObject.Find ("Panel").transform);
				remove.transform.localScale = new Vector2 (1, 1);
				remove.transform.localPosition = new Vector3(0,0,0);
				remove.name = "KanniRemoveConfirm";
				BusyoInfoGet busyo = new BusyoInfoGet();
				string busyoName = busyo.getName(int.Parse(busyoId));
				remove.transform.FindChild("YesButton").GetComponent<DoRemoveKanni>().busyoId = busyoId;
				remove.transform.FindChild("RemoveText").GetComponent<Text>().text = busyoName + "殿の官位を\n罷免なさるのですか?";

			}



		}else if(name == "jyosyu"){
			if(jyosyuKuniId ==0){
				//Available 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);
				}

				List<string> okKuniList = new List<string> ();
				for (int i=0; i<openKuniList.Count; i++) {
					int kuniId = int.Parse(openKuniList[i]);
					string temp = "kuni" + kuniId.ToString();
					string clearedKuni = PlayerPrefs.GetString (temp);
					//Shiro Qty
					if(clearedKuni != null && clearedKuni != ""){
						//Jyosyu Exist Check
						string jyosyuTmp = "jyosyu" + kuniId.ToString();
						if(!PlayerPrefs.HasKey(jyosyuTmp)){
							okKuniList.Add(kuniId.ToString());
						}
					}
				}

				if(okKuniList.Count != 0){
					bsb.commonPopup ();
					GameObject.Find ("popText").GetComponent<Text> ().text ="国一覧";
					
					string scrollPath = "Prefabs/Busyo/KanniScrollView";
					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 = "KanniScrollView";
					RectTransform scrollTransform = scroll.GetComponent<RectTransform> ();
					scrollTransform.anchoredPosition3D = new Vector3 (0, 0, 0);

					string pathSlot = "Prefabs/Busyo/ShiroSlot";
					GameObject content = scroll.transform.FindChild("KanniContent").gameObject;
					KuniInfo kuni = new KuniInfo();
					for(int i=0; i<okKuniList.Count; i++){

						GameObject slot = Instantiate (Resources.Load (pathSlot)) as GameObject;
						slot.transform.SetParent(content.transform);
						slot.transform.localScale = new Vector2 (1, 1);
						
						int kuniId = int.Parse(okKuniList[i]);
						string kuniName = kuni.getKuniName(kuniId);

						slot.transform.FindChild("Name").GetComponent<Text>().text = kuniName;


						//Status
						int jyosyuHei = 0;
						string naiseiTemp = "naisei" + kuniId.ToString();
						string naiseiString = PlayerPrefs.GetString (naiseiTemp);

						List<string> naiseiList = new List<string>();
						naiseiList = new List<string>(naiseiString.Split (delimiterChars));
						char[] delimiterChars2 = {':'};
						Entity_naisei_mst naiseiMst = Resources.Load ("Data/naisei_mst") as Entity_naisei_mst;
						NaiseiController naisei = new NaiseiController();


						string shiroLv = naiseiList[0];
						List<int> shiroEffectList = new List<int>();
						shiroEffectList = naisei.getNaiseiList("shiro", int.Parse(shiroLv));
						jyosyuHei = shiroEffectList[0];

						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"){
								string type = naiseiMst.param [int.Parse(naiseiContentList[0])].code;
								if(type == "hsy"){
									List<int> naiseiEffectList = new List<int>();
									naiseiEffectList = naisei.getNaiseiList(type, int.Parse(naiseiContentList[1]));

									jyosyuHei = jyosyuHei + naiseiEffectList[0];
								}

							}
						}


						slot.transform.FindChild("EffectValue").GetComponent<Text>().text = "+" + jyosyuHei.ToString();
						
						GameObject btn = slot.transform.FindChild("GiveButton").gameObject;
						btn.GetComponent<DoNinmei>().busyoId = busyoId;
						btn.GetComponent<DoNinmei>().kuniId = kuniId;
						btn.GetComponent<DoNinmei>().jyosyuHei = jyosyuHei;
					}



				}else{
					Message msg = new Message();
					msg.makeMessage("任命可能な国はありませんぞ。\nまずは城を落としなされ。");
				}




			}else{
				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";
				msg.transform.FindChild("YesButton").GetComponent<DoKainin>().kuniId = jyosyuKuniId;


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

		}


	}
예제 #13
0
	public void OnClick(){

		BusyoStatusButton pop = new BusyoStatusButton ();
		pop.commonPopup ();

		if (blank) {
		//New
			//Label
			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.anchoredPosition = new Vector3 (0, 0, 0);

			//Naisei Master
			Entity_naisei_mst naiseiMst = Resources.Load ("Data/naisei_mst") as Entity_naisei_mst;

			//Re-make Common & Shigen
			List<string> avlNaiseiList = new List<string> ();
			char[] delimiterChars = {':'};
			string shigen = GameObject.Find("NaiseiController").GetComponent<NaiseiController>().shigen;
			if(shigen != "null"){
				if(shigen.Contains(":")){
					avlNaiseiList = new List<string> (shigen.Split (delimiterChars));
				}else{
					avlNaiseiList.Add(shigen);
				}
			}

			/***Tech Item Start***/
			List<string> avlTechList = new List<string> ();

			int tpQty = PlayerPrefs.GetInt("transferTP");
			int kbQty = PlayerPrefs.GetInt("transferKB");
			int snbQty = PlayerPrefs.GetInt("transferSNB");
			if(tpQty>0 && !avlNaiseiList.Contains("tp")){
				avlTechList.Add("tp");
			}
			if(kbQty>0 && !avlNaiseiList.Contains("kb")){
				avlTechList.Add("kb");
			}
			if(snbQty>0 && !avlNaiseiList.Contains("snb")){
				avlTechList.Add("snb");
			}
			/***Tech Item Finish***/




			for (int i=1; i<naiseiMst.param.Count; i++) {
				string code = naiseiMst.param [i].code;

				//if (code != "NotYet"){ // for test
				if ((naiseiMst.param [i].common == 1 && code != "NotYet") ||
				(avlNaiseiList.Contains(naiseiMst.param [i].code) && code != "NotYet")) {
					//Slot
					string slotPath = "Prefabs/Naisei/NaiseiSlot";
					GameObject slot = Instantiate (Resources.Load (slotPath)) as GameObject;
					slot.transform.SetParent (scroll.transform.FindChild ("NaiseiContent").transform);
					slot.transform.localScale = new Vector2 (1, 1);

					//Bldg
					GameObject naiseiName = slot.transform.FindChild ("NaiseiName").gameObject;
					naiseiName.GetComponent<Text> ().text = naiseiMst.param [i].name;
					string bldgPath = "Prefabs/Naisei/Bldg/" + naiseiMst.param [i].code + "_s";
					GameObject bldg = Instantiate (Resources.Load (bldgPath)) as GameObject;
					bldg.transform.SetParent (naiseiName.transform);
					RectTransform bldgTransform = bldg.GetComponent<RectTransform> ();
					bldgTransform.anchoredPosition = new Vector3 (0, -315, 0);
					bldg.transform.localScale = new Vector2 (3, 3);
					bldg.GetComponent<Button>().enabled = false;

					//Some Value
					naiseiName.transform.FindChild ("NaiseiExp").GetComponent<Text> ().text = naiseiMst.param [i].exp;
					string target = naiseiMst.param [i].target;
					int effect1 = naiseiMst.param [i].effect1;
					if (target == "money") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "金";
					} else if (target == "hyourou") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "兵糧";
					} else if (target == "YR") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "槍刀素材";
					}else if (target == "KB") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "騎馬素材";
					}else if (target == "TP") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "鉄砲素材";
					}else if (target == "YM") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "弓矢素材";
					}else if (target == "nbn") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "基督教";
					}else if (target == "bnk") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "文化";
					}else if (target == "snb") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "忍";
					}else if (target == "bky") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "寺";
					}else if (target == "child") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "足軽兵数";
					}else if (target == "dfc") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "防備";
					}

					//Label & Effect Value Adjustment 
					if(code != "kzn"){
						if(code != "yr" &&code != "kb"&&code != "tp" &&code != "ym" && code != "snb"){
							if(code != "nbn" && code != "kgy" && code != "bky" && code !="hsy" && code !="trd"){
								naiseiName.transform.FindChild ("NaiseiEffectValue").GetComponent<Text> ().text = "+" + effect1;
							}else{
								naiseiName.transform.FindChild ("NaiseiUnit").GetComponent<Text>().enabled = false;
								naiseiName.transform.FindChild ("NaiseiEffectValue").GetComponent<Text> ().text = "+" + effect1;
							}
						}else{
							effect1 = effect1 * 2;
							naiseiName.transform.FindChild ("NaiseiEffectValue").GetComponent<Text> ().text = "+" + effect1;
						}
					}else{
						effect1 = effect1 * 4;
						naiseiName.transform.FindChild ("NaiseiEffectValue").GetComponent<Text> ().text = "+" + effect1;
					}

					naiseiName.transform.FindChild ("RequiredMoney").GetComponent<Text> ().text = naiseiMst.param [i].money1.ToString();
					naiseiName.transform.FindChild ("RequiredHyourou").GetComponent<Text> ().text = naiseiMst.param [i].hyourou.ToString();
					GameObject createButton = naiseiName.transform.FindChild("CreateButton").gameObject;
					createButton.GetComponent<BuildNaisei> ().panelId = int.Parse(name);
					createButton.GetComponent<BuildNaisei> ().naiseiId = i;
					createButton.GetComponent<BuildNaisei> ().naiseiName = naiseiMst.param [i].name;
					createButton.GetComponent<BuildNaisei> ().requiredMoney = naiseiMst.param [i].money1;
					createButton.GetComponent<BuildNaisei> ().requiredHyourou = naiseiMst.param [i].hyourou;

				}else if (naiseiMst.param [i].common == 0 && code != "NotYet" && avlTechList.Contains(naiseiMst.param [i].code)){
					//Technical Item

					//Slot
					string slotPath = "Prefabs/Naisei/NaiseiSlotWithItem";
					GameObject slot = Instantiate (Resources.Load (slotPath)) as GameObject;
					slot.transform.SetParent (scroll.transform.FindChild ("NaiseiContent").transform);
					slot.transform.localScale = new Vector2 (1, 1);
					
					//Bldg
					GameObject naiseiName = slot.transform.FindChild ("NaiseiName").gameObject;
					naiseiName.GetComponent<Text> ().text = naiseiMst.param [i].name;
					string bldgPath = "Prefabs/Naisei/Bldg/" + naiseiMst.param [i].code + "_s";
					GameObject bldg = Instantiate (Resources.Load (bldgPath)) as GameObject;
					bldg.transform.SetParent (naiseiName.transform);
					RectTransform bldgTransform = bldg.GetComponent<RectTransform> ();
					bldgTransform.anchoredPosition = new Vector3 (0, -315, 0);
					bldg.transform.localScale = new Vector2 (3, 3);
					bldg.GetComponent<Button>().enabled = false;
					
					//Some Value
					naiseiName.transform.FindChild ("NaiseiExp").GetComponent<Text> ().text = naiseiMst.param [i].exp;
					string target = naiseiMst.param [i].target;
					int effect1 = naiseiMst.param [i].effect1;

					int techId = 0;
					if (target == "KB") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "騎馬素材";
						techId = 2;
					}else if (target == "TP") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "鉄砲素材";
						techId = 1;
					}else if (target == "snb") {
						naiseiName.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "忍";
						techId = 3;
					}
					
					//Label & Effect Value Adjustment 
					effect1 = effect1 * 2;
					naiseiName.transform.FindChild ("NaiseiEffectValue").GetComponent<Text> ().text = "+" + effect1;

					naiseiName.transform.FindChild ("RequiredHyourou").GetComponent<Text> ().text = naiseiMst.param [i].hyourou.ToString();
					GameObject createButton = naiseiName.transform.FindChild("CreateButton").gameObject;
					createButton.GetComponent<BuildNaiseiWithItem> ().techId = techId;
					createButton.GetComponent<BuildNaiseiWithItem> ().panelId = int.Parse(name);
					createButton.GetComponent<BuildNaiseiWithItem> ().naiseiId = i;
					createButton.GetComponent<BuildNaiseiWithItem> ().naiseiName = naiseiMst.param [i].name;
					createButton.GetComponent<BuildNaiseiWithItem> ().requiredHyourou = naiseiMst.param [i].hyourou;

				}
			}

		} else {
		//Update
			GameObject.Find ("popText").GetComponent<Text> ().text = "内政強化";

			string naiseiUpdatePath = "Prefabs/Naisei/NaiseiUpdate";
			GameObject NaiseiUpdate = Instantiate (Resources.Load (naiseiUpdatePath)) as GameObject;
			NaiseiUpdate.transform.parent = GameObject.Find ("board(Clone)").transform;
			NaiseiUpdate.transform.localScale = new Vector2 (1, 1);
			RectTransform naiseiUpdateTransform = NaiseiUpdate.GetComponent<RectTransform> ();
			naiseiUpdateTransform.anchoredPosition = new Vector3 (0, -40, 0);

			string bldgRank = "";
			int nextLv = int.Parse(lv) + 1;
			if(nextLv<8){
				bldgRank = "s";
			}else if(nextLv < 15){
				bldgRank = "m";
			}else if(15 <= nextLv){
				bldgRank = "l";
			}
			string bldg = type + "_" + bldgRank;
			string pathMod = "";
			if(type == "shiro"){
				pathMod = "Shiro/";
			}else{
				pathMod = "Bldg/";
			}

			string bldgPath = "Prefabs/Naisei/" + pathMod + bldg;
			GameObject bldgObj = Instantiate (Resources.Load (bldgPath)) as GameObject;
			bldgObj.transform.SetParent(NaiseiUpdate.transform);
			bldgObj.transform.localScale = new Vector3 (1.5f, 1.5f, 1);
			RectTransform bldgTransform = bldgObj.GetComponent<RectTransform> ();
			bldgTransform.anchoredPosition = new Vector3 (-250, 0, 0);
			bldgObj.GetComponent<Button>().enabled = false;

			//Detail Info
			GameObject baseObj = NaiseiUpdate.transform.FindChild("Base").gameObject;
			baseObj.transform.FindChild("FromLv").GetComponent<Text>().text = "Lv" + lv;
			baseObj.transform.FindChild("ToLv").GetComponent<Text>().text = nextLv.ToString();
			baseObj.transform.FindChild("NowNaiseiEffectValue").GetComponent<Text>().text = "+" + effect.ToString();
			baseObj.transform.FindChild("NextNaiseiEffectValue").GetComponent<Text>().text = "+" + effectNextLv.ToString();
			baseObj.transform.FindChild("RequiredMoney").GetComponent<Text>().text = moneyNextLv.ToString();
			baseObj.transform.FindChild("RequiredHyourou").GetComponent<Text>().text = requiredHyourou.ToString();


			if(type=="shiro"){
				baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "防備";
				baseObj.transform.FindChild ("NaiseiUnit").GetComponent<Text> ().enabled = false;
				baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "城";
				baseObj.transform.FindChild ("NaiseiEffectLabel2").GetComponent<Text> ().enabled = true;
				baseObj.transform.FindChild("NowNaiseiEffectValue2").GetComponent<Text>().enabled = true;
				baseObj.transform.FindChild("NextNaiseiEffectValue2").GetComponent<Text>().enabled = true;
				baseObj.transform.FindChild ("arrow2").GetComponent<Image> ().enabled = true;
				baseObj.transform.FindChild("NowNaiseiEffectValue2").GetComponent<Text>().text = "+" + effect.ToString();
				baseObj.transform.FindChild("NextNaiseiEffectValue2").GetComponent<Text>().text = "+" + effectNextLv.ToString();

			}else{

				baseObj.transform.FindChild ("NaiseiEffectLabel2").GetComponent<Text> ().enabled = false;
				baseObj.transform.FindChild ("NowNaiseiEffectValue2").GetComponent<Text> ().enabled = false;
				baseObj.transform.FindChild ("arrow2").GetComponent<Image> ().enabled = false;
				baseObj.transform.FindChild ("NextNaiseiEffectValue2").GetComponent<Text> ().enabled = false;

				if (type == "shop") {
					baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "金";
					baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "商人町";

				} else if (type == "ta") {
					baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "兵糧";
					baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "村落";

				} else if (type == "yr") {
					baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "槍刀素材";
					baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "刀鍛冶屋";
					
				} else if (type == "kb") {
					baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "騎馬素材";
					baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "厩舎";
					
				} else if (type == "tp") {
					baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "鉄砲素材";
					baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "鉄砲鍛冶屋";
					
				} else if (type == "ym") {
					baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "弓矢素材";
					baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "皮職人";
					
				}else if(type == "kzn"){
					baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "金";
					baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "鉱山";
				
				}else if(type == "nbn"){
					baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "基督教";
					baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "南蛮寺";
					baseObj.transform.FindChild ("NaiseiUnit").GetComponent<Text> ().enabled = false;
				
				}else if(type == "kgy"){
					baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "文化";
					baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "公家館";
					baseObj.transform.FindChild ("NaiseiUnit").GetComponent<Text> ().enabled = false;
				
				}else if(type == "snb"){
					baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "忍";
					baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "忍の里";
				
				}else if(type == "bky"){
					baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "仏教";
					baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "寺";
					baseObj.transform.FindChild ("NaiseiUnit").GetComponent<Text> ().enabled = false;
				
				}else if (type == "hsy") {
					baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "足軽兵数";
					baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "兵舎";
					baseObj.transform.FindChild ("NaiseiUnit").GetComponent<Text> ().enabled = false;
				
				}else if (type == "trd") {
					baseObj.transform.FindChild ("NaiseiEffectLabel").GetComponent<Text> ().text = "防備";
					baseObj.transform.FindChild ("BldgName").GetComponent<Text> ().text = "砦";
					baseObj.transform.FindChild ("NaiseiUnit").GetComponent<Text> ().enabled = false;
				}
			}

			//Button Setting
			GameObject updateBtn = baseObj.transform.FindChild ("NaiseiUpdateButton").gameObject;
			updateBtn.GetComponent<UpdateNaisei>().activeKuniId = GameObject.Find ("NaiseiController").GetComponent<NaiseiController>().activeKuniId;
			updateBtn.GetComponent<UpdateNaisei>().requiredMoney = moneyNextLv;
			updateBtn.GetComponent<UpdateNaisei>().requiredHyourou = requiredHyourou;
			updateBtn.GetComponent<UpdateNaisei>().areaId = name;
			updateBtn.GetComponent<UpdateNaisei>().naiseiId = naiseiId;
			updateBtn.GetComponent<UpdateNaisei>().targetLv = nextLv;
			updateBtn.GetComponent<UpdateNaisei>().naiseiName = naiseiName;
		}
	}