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

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


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

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

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

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


	}
Beispiel #2
0
    public void createBusyoStatusView(string busyoId)
    {
        bool tutorialDoneFlg = PlayerPrefs.GetBool("tutorialDoneFlg");
        int  lv = 1;

        if (!tutorialDoneFlg || Application.loadedLevelName != "tutorialBusyo")
        {
            lv = PlayerPrefs.GetInt(busyoId);
        }

        StatusGet sts = new StatusGet();
        int       hp  = sts.getHp(int.Parse(busyoId), lv);
        int       atk = sts.getAtk(int.Parse(busyoId), lv);
        int       dfc = sts.getDfc(int.Parse(busyoId), lv);
        int       spd = sts.getSpd(int.Parse(busyoId), lv);

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

        //add lv
        string addLvTmp = "addlv" + busyoId.ToString();

        if (PlayerPrefs.HasKey(addLvTmp))
        {
            string addLvValue = "+" + PlayerPrefs.GetString(addLvTmp);
            GameObject.Find("addLvValue").GetComponent <Text>().text = addLvValue.ToString();
        }
        else
        {
            GameObject.Find("addLvValue").GetComponent <Text>().text = "";
        }
        int maxLv = 100 + PlayerPrefs.GetInt(addLvTmp);

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


        //Exp
        string expId     = "exp" + busyoId.ToString();
        string expString = "";
        int    nowExp    = 0;

        if (!tutorialDoneFlg || Application.loadedLevelName != "tutorialBusyo")
        {
            nowExp = PlayerPrefs.GetInt(expId);
        }
        Exp exp         = new Exp();
        int requiredExp = 0;

        if (lv != maxLv)
        {
            requiredExp = exp.getExpforNextLv(lv);
        }
        else
        {
            requiredExp = exp.getExpLvMax(maxLv);
        }

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


        //Kahou status
        int totalBusyoHp = 0;
        int finalAtk     = 0;
        int finalHp      = 0;
        int finalDfc     = 0;
        int finalSpd     = 0;

        if (tutorialDoneFlg && Application.loadedLevelName != "tutorialBusyo")
        {
            KahouStatusGet kahouSts         = new KahouStatusGet();
            string[]       KahouStatusArray = kahouSts.getKahouForStatus(busyoId, adjHp, adjAtk, adjDfc, spd);

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

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

                    //Status
                    string kanniTarget = kanni.getEffectTarget(kanniId);
                    int    effect      = kanni.getEffect(kanniId);
                    if (kanniTarget == "atk")
                    {
                        addAtkByKanni = ((float)adjAtk * (float)effect) / 100;
                    }
                    else if (kanniTarget == "hp")
                    {
                        addHpByKanni = ((float)adjHp * (float)effect) / 100;
                    }
                    else if (kanniTarget == "dfc")
                    {
                        addDfcByKanni = ((float)adjDfc * (float)effect) / 100;
                    }
                }
                else
                {
                    if (Application.systemLanguage != SystemLanguage.Japanese)
                    {
                        GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text>().text = "No Rank";
                    }
                    else
                    {
                        GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text>().text = "官位無し";
                    }
                }
            }
            else
            {
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text>().text = "No Rank";
                }
                else
                {
                    GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text>().text = "官位無し";
                }
            }

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

                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text>().text = kuniName + "\nLord";
                }
                else
                {
                    GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text>().text = kuniName + "\n城主";
                }
            }
            else
            {
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text>().text = "No Feud";
                }
                else
                {
                    GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text>().text = "城無し";
                }
            }

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

            GameObject.Find("KahouAtkValue").GetComponent <Text> ().text = "+" + finalAtk.ToString();
            GameObject.Find("KahouHpValue").GetComponent <Text>().text   = "+" + finalHp.ToString();
            totalBusyoHp = adjHp + finalHp;
            GameObject.Find("KahouDfcValue").GetComponent <Text>().text = "+" + finalDfc.ToString();
            GameObject.Find("KahouSpdValue").GetComponent <Text>().text = "+" + finalSpd.ToString();
        }
        else
        {
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text>().text = "No Rank";
            }
            else
            {
                GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text>().text = "官位無し";
            }

            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text>().text = "No Feud";
            }
            else
            {
                GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text>().text = "城無し";
            }
        }

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

        if (!tutorialDoneFlg || Application.loadedLevelName != "tutorialBusyo")
        {
            chParam = PlayerPrefs.GetString(heiId, "0");
        }
        else
        {
            //retry tutorial
            chParam = "TP: 1:1:1";
        }

        if (chParam == "0" || chParam == "")
        {
            StatusGet statusScript  = new StatusGet();
            string    chParamHeisyu = statusScript.getHeisyu(int.Parse(busyoId));
            chParam = chParamHeisyu + ":1:1:1";
            PlayerPrefs.SetString(heiId, chParam);
            PlayerPrefs.Flush();
        }


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

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

        string heisyu = "";

        Message msg = new Message();

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

        GameObject.Find("ChildNameValue").GetComponent <Text> ().text = heisyu;
        GameObject.Find("ChildQtyValue").GetComponent <Text> ().text  = ch_num.ToString();
        GameObject.Find("ChildLvValue").GetComponent <Text> ().text   = ch_lv.ToString();

        //Jyosyu Handling
        JyosyuHeiryoku jyosyuHei = new JyosyuHeiryoku();
        float          addHei    = (float)jyosyuHei.GetJyosyuHeiryoku(busyoId);
        float          hei       = ch_status * 10;

        GameObject.Find("ChildHeiryokuValue").GetComponent <Text> ().text = hei.ToString();
        float newHei = finalHp + addHei;

        GameObject.Find("KahouHpValue").GetComponent <Text>().text = "+" + newHei.ToString();


        int    chAtkDfc       = (int)sts.getChAtkDfc((int)hei, totalBusyoHp);
        string chAtkDfcString = chAtkDfc.ToString() + "/" + chAtkDfc.ToString();

        GameObject.Find("ChildStatusValue").GetComponent <Text> ().text = chAtkDfcString;

        //Child Image
        foreach (Transform n in GameObject.Find("Img").transform)
        {
            GameObject.Destroy(n.gameObject);
        }
        string     chPath = "Prefabs/Player/Unit/" + ch_type;
        GameObject chObj  = Instantiate(Resources.Load(chPath)) as GameObject;

        chObj.transform.SetParent(GameObject.Find("Img").transform);
        RectTransform chTransform = chObj.GetComponent <RectTransform> ();

        chTransform.anchoredPosition3D = new Vector3(-200, -50, 0);
        chTransform.sizeDelta          = new Vector2(40, 40);
        chObj.transform.localScale     = new Vector2(4, 4);



        GameObject chigyo = GameObject.Find("ButtonCyouhei");

        if (ch_num < 20)
        {
            chigyo.GetComponent <Image> ().color = OKClorBtn;
            chigyo.transform.FindChild("Text").GetComponent <Text> ().color = OKClorTxt;
            chigyo.GetComponent <Button>().enabled = true;

            chigyo.GetComponent <BusyoStatusButton> ().ch_type   = ch_type;
            chigyo.GetComponent <BusyoStatusButton> ().ch_heisyu = heisyu;
            chigyo.GetComponent <BusyoStatusButton> ().ch_num    = ch_num;
            chigyo.GetComponent <BusyoStatusButton> ().ch_status = chAtkDfc;
            chigyo.GetComponent <BusyoStatusButton> ().ch_hp     = hei;
            chigyo.GetComponent <BusyoStatusButton> ().pa_hp     = totalBusyoHp / 100;
        }
        else
        {
            //MAX
            chigyo.GetComponent <Image> ().color = NGClorBtn;
            chigyo.transform.FindChild("Text").GetComponent <Text> ().color = NGClorTxt;
            chigyo.GetComponent <Button>().enabled = false;
        }
        GameObject kunren = GameObject.Find("ButtonKunren");

        if (ch_lv < 100)
        {
            kunren.GetComponent <Image> ().color = OKClorBtn;
            kunren.transform.FindChild("Text").GetComponent <Text> ().color = OKClorTxt;
            kunren.GetComponent <Button>().enabled = true;

            kunren.GetComponent <BusyoStatusButton> ().ch_type   = ch_type;
            kunren.GetComponent <BusyoStatusButton> ().ch_heisyu = heisyu;
            kunren.GetComponent <BusyoStatusButton> ().ch_lv     = ch_lv;
            kunren.GetComponent <BusyoStatusButton> ().ch_status = chAtkDfc;
            kunren.GetComponent <BusyoStatusButton> ().ch_hp     = hei;
            kunren.GetComponent <BusyoStatusButton> ().ch_num    = ch_num;
            kunren.GetComponent <BusyoStatusButton> ().pa_hp     = totalBusyoHp / 100;
        }
        else
        {
            //MAX
            kunren.GetComponent <Image> ().color = NGClorBtn;
            kunren.transform.FindChild("Text").GetComponent <Text> ().color = NGClorTxt;
            kunren.GetComponent <Button>().enabled = false;
        }
        //Parametor Setting
        GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyo = busyoId;

        //Jinkei Flg
        GameObject BusyoView = GameObject.Find("BusyoView");

        if (!BusyoView.transform.FindChild("jinkei"))
        {
            if (jinkeiBusyoCheck(int.Parse(busyoId)))
            {
                string     iconPath = "Prefabs/Busyo/Jinkei";
                GameObject jinkei   = Instantiate(Resources.Load(iconPath)) as GameObject;
                jinkei.transform.SetParent(GameObject.Find("BusyoView").transform);
                jinkei.transform.localScale    = new Vector2(0.3f, 0.3f);
                jinkei.transform.localPosition = new Vector2(220, 200);
                jinkei.name = "jinkei";
            }
        }
    }
Beispiel #3
0
	public void OnClick(){

		GameObject board = GameObject.Find ("SyouninBoard").gameObject;
		Message msg = new Message (); 
		GameObject actionValue = GameObject.Find ("ActionValue").gameObject;
		int actionRemainQty = int.Parse(actionValue.GetComponent<Text> ().text);
		char[] delimiterChars = {','};

		if (actionRemainQty <= 0) {
			
			string Text = "行動回数が足りませぬ。\tこれ以上、取引は出来ませぬぞ。";
			msg.makeMessage (Text);
			
			string serihu = "お役に立てましたでしょうか。これからもご贔屓の程お願い致します。";
			serihuChanger (serihu);
			
		} else {

			CloseLayer CloseLayerScript = GameObject.Find ("CloseSyoukaijyo").GetComponent<CloseLayer>();

			if (name == "Kahou") {
				string path = "Prefabs/Syounin/MenuKahou";
				GameObject menu = Instantiate (Resources.Load (path)) as GameObject;
				menu.transform.SetParent (board.transform);
				menu.transform.localScale = new Vector2 (1, 1);
				menu.transform.localPosition = new Vector2 (0, -150);
				menu.transform.FindChild ("Close").GetComponent<CloseMenu> ().obj = menu;
				menu.name = "MenuKahou";

				//Product Show
				string kahouCdString = CloseLayerScript.kahouCdString;
				List<string> kahouCdList = new List<string> ();
				kahouCdList = new List<string> (kahouCdString.Split (delimiterChars));

				string kahouIdString = CloseLayerScript.kahouIdString;
				List<string> kahouIdList = new List<string> ();
				kahouIdList = new List<string> (kahouIdString.Split (delimiterChars));

				GameObject content = menu.transform.FindChild("ScrollView").transform.FindChild("Content").gameObject;
				GameObject money = menu.transform.FindChild("MoneyValue").gameObject;
				GameObject btn = menu.transform.FindChild("DoKahouButton").gameObject;

				KahouStatusGet kahouSts = new KahouStatusGet();

				for(int i=0; i<kahouCdList.Count; i++){
					string kahouCd = kahouCdList[i];
					int kahouId = int.Parse(kahouIdList[i]);
					string kahouCdId = kahouCd + kahouId;

					string kahouPath = "Prefabs/Item/Kahou/" + kahouCdId;
					int tmp = i + 1;
					string slotName = "item" + tmp.ToString(); 
					GameObject itemSlot = content.transform.FindChild(slotName).gameObject;
					itemSlot.GetComponent<SyouninProductSelect>().Content = content;

					//status
					List<string> kahouStsList = new List<string> ();
					kahouStsList = kahouSts.getKahouInfo(kahouCd, kahouId);
					itemSlot.GetComponent<SyouninProductSelect>().kahouName = kahouStsList[0];
					itemSlot.GetComponent<SyouninProductSelect>().kahouEffectLabel = kahouStsList[2];
					itemSlot.GetComponent<SyouninProductSelect>().kahouEffectValue = kahouStsList[3];
					float price = float.Parse(kahouStsList[5]);
					float discount = CloseLayerScript.discount;
					float finalPrice = price * discount;
					itemSlot.GetComponent<SyouninProductSelect>().price = Mathf.CeilToInt(finalPrice);
					itemSlot.GetComponent<SyouninProductSelect>().Money = money;
					itemSlot.GetComponent<SyouninProductSelect>().Btn = btn;
					itemSlot.GetComponent<SyouninProductSelect>().menuName = name;

					itemSlot.GetComponent<SyouninProductSelect>().kahouCd = kahouCd;
					itemSlot.GetComponent<SyouninProductSelect>().kahouId = kahouId;

					//kahou icon
					GameObject kahouObj = Instantiate (Resources.Load (kahouPath)) as GameObject;
					kahouObj.transform.SetParent (itemSlot.transform);
					kahouObj.transform.localScale = new Vector2 (1, 1);
					kahouObj.GetComponent<Button>().enabled = false;

					//Adjust
					RectTransform rect = kahouObj.transform.FindChild("Rank").GetComponent<RectTransform>();
					rect.anchoredPosition3D = new Vector3(20,-30,0);
					kahouObj.transform.FindChild("Rank").localScale = new Vector3(0.3f,0.3f,0);
				}

				//Initial
				content.transform.FindChild("item1").GetComponent<SyouninProductSelect>().OnClick();

				string serihu = "貴重な品を取り揃えて御座いますよ。お気に召す物はございますでしょうか。";
				serihuChanger (serihu);

			}else if(name == "Busshi"){

				string path = "Prefabs/Syounin/MenuBusshi";
				GameObject menu = Instantiate (Resources.Load (path)) as GameObject;
				menu.transform.SetParent (board.transform);
				menu.transform.localScale = new Vector2 (1, 1);
				menu.transform.localPosition = new Vector2 (0, -150);
				menu.transform.FindChild ("Close").GetComponent<CloseMenu> ().obj = menu;
				menu.name = "MenuBusshi";

				GameObject content = menu.transform.FindChild("ScrollView").transform.FindChild("Content").gameObject;

				//Prepared Value
				string busshiQtyString = CloseLayerScript.busshiQtyString;
				List<string> busshiQtyList = new List<string> ();
				busshiQtyList = new List<string> (busshiQtyString.Split (delimiterChars));
				
				string busshiRankString = CloseLayerScript.busshiRankString;
				List<string> busshiRankList = new List<string> ();
				busshiRankList = new List<string> (busshiRankString.Split (delimiterChars));

				Item item = new Item();
				float discount = CloseLayerScript.discount;

				//YR
				string YRpath = "Prefabs/Item/Cyouhei/CyouheiYR";
				GameObject YRObj = Instantiate (Resources.Load (YRpath)) as GameObject;
				GameObject item1 = content.transform.FindChild("item1").gameObject;
				YRObj.transform.SetParent (item1.transform);
				YRObj.transform.localScale = new Vector2 (1, 1);
				YRObj.GetComponent<Button>().enabled = false;
				YRObj.transform.FindChild("Qty").GetComponent<Text>().text = busshiQtyList[0];
				YRObj.name = "CyouheiYR";
				RectTransform trn1 = YRObj.transform.FindChild("Qty").GetComponent<RectTransform>();
				trn1.anchoredPosition3D = new Vector3(-30,-40,0);
				colorByRankChanger(YRObj, busshiRankList[0]);

				string itemCdYR = YRObj.name + busshiRankList[0];
				float unitPriceYR = (float)item.getUnitPrice(itemCdYR);
				float finalPriceYR = unitPriceYR * discount;
				item1.GetComponent<SyouninProductSelect>().price = Mathf.CeilToInt(finalPriceYR);
				item1.GetComponent<SyouninProductSelect>().busshiQty = int.Parse(busshiQtyList[0]);
				item1.GetComponent<SyouninProductSelect>().menuName = name;
				item1.GetComponent<SyouninProductSelect>().busshiCd = itemCdYR;

				//KB
				string KBpath = "Prefabs/Item/Cyouhei/CyouheiKB";
				GameObject KBObj = Instantiate (Resources.Load (KBpath)) as GameObject;
				GameObject item2 = content.transform.FindChild("item2").gameObject;
				KBObj.transform.SetParent (item2.transform);
				KBObj.transform.localScale = new Vector2 (1, 1);
				KBObj.GetComponent<Button>().enabled = false;
				KBObj.transform.FindChild("Qty").GetComponent<Text>().text = busshiQtyList[1];
				KBObj.name = "CyouheiKB";
				RectTransform trn2 = KBObj.transform.FindChild("Qty").GetComponent<RectTransform>();
				trn2.anchoredPosition3D = new Vector3(-30,-40,0);
				colorByRankChanger(KBObj, busshiRankList[1]);

				string itemCdKB = KBObj.name + busshiRankList[1];
				float unitPriceKB = (float)item.getUnitPrice(itemCdKB);
				float finalPriceKB = unitPriceKB * discount;
				item2.GetComponent<SyouninProductSelect>().price = Mathf.CeilToInt(finalPriceKB);
				item2.GetComponent<SyouninProductSelect>().busshiQty = int.Parse(busshiQtyList[1]);
				item2.GetComponent<SyouninProductSelect>().menuName = name;
				item2.GetComponent<SyouninProductSelect>().busshiCd = itemCdKB;


				//TP
				string TPpath = "Prefabs/Item/Cyouhei/CyouheiTP";
				GameObject TPObj = Instantiate (Resources.Load (TPpath)) as GameObject;
				GameObject item3 = content.transform.FindChild("item3").gameObject;
				TPObj.transform.SetParent (item3.transform);
				TPObj.transform.localScale = new Vector2 (1, 1);
				TPObj.GetComponent<Button>().enabled = false;
				TPObj.transform.FindChild("Qty").GetComponent<Text>().text = busshiQtyList[2];
				TPObj.name = "CyouheiTP";
				RectTransform trn3 = TPObj.transform.FindChild("Qty").GetComponent<RectTransform>();
				trn3.anchoredPosition3D = new Vector3(-30,-40,0);
				colorByRankChanger(TPObj, busshiRankList[2]);

				string itemCdTP = TPObj.name + busshiRankList[2];
				float unitPriceTP = (float)item.getUnitPrice(itemCdTP);
				float finalPriceTP = unitPriceTP * discount;
				item3.GetComponent<SyouninProductSelect>().price = Mathf.CeilToInt(finalPriceTP);
				item3.GetComponent<SyouninProductSelect>().busshiQty = int.Parse(busshiQtyList[2]);
				item3.GetComponent<SyouninProductSelect>().menuName = name;
				item3.GetComponent<SyouninProductSelect>().busshiCd = itemCdTP;


				//YM
				string YMath = "Prefabs/Item/Cyouhei/CyouheiYM";
				GameObject YMObj = Instantiate (Resources.Load (YMath)) as GameObject;
				GameObject item4 = content.transform.FindChild("item4").gameObject;
				YMObj.transform.SetParent (item4.transform);
				YMObj.transform.localScale = new Vector2 (1, 1);
				YMObj.GetComponent<Button>().enabled = false;
				YMObj.transform.FindChild("Qty").GetComponent<Text>().text = busshiQtyList[3];
				YMObj.name = "CyouheiYM";
				RectTransform trn4 = YMObj.transform.FindChild("Qty").GetComponent<RectTransform>();
				trn4.anchoredPosition3D = new Vector3(-30,-40,0);
				colorByRankChanger(YMObj, busshiRankList[3]);

				string itemCdYM = YMObj.name + busshiRankList[3];
				float unitPriceYM = (float)item.getUnitPrice(itemCdYM);
				float finalPriceYM = unitPriceYM * discount;
				item4.GetComponent<SyouninProductSelect>().price = Mathf.CeilToInt(finalPriceYM);
				item4.GetComponent<SyouninProductSelect>().busshiQty = int.Parse(busshiQtyList[3]);
				item4.GetComponent<SyouninProductSelect>().menuName = name;
				item4.GetComponent<SyouninProductSelect>().busshiCd = itemCdYM;


				//SNB
				string SNBpath = "Prefabs/Item/Shinobi/Shinobi";
				GameObject SNBObj = Instantiate (Resources.Load (SNBpath)) as GameObject;
				GameObject item5 = content.transform.FindChild("item5").gameObject;
				SNBObj.transform.SetParent (item5.transform);
				SNBObj.transform.localScale = new Vector2 (1, 1);
				SNBObj.GetComponent<Button>().enabled = false;
				SNBObj.transform.FindChild("Qty").GetComponent<Text>().text = busshiQtyList[4];
				SNBObj.name = "Shinobi";
				RectTransform trn5 = SNBObj.transform.FindChild("Qty").GetComponent<RectTransform>();
				trn5.anchoredPosition3D = new Vector3(-30,-40,0);
				RectTransform trnContent = SNBObj.transform.FindChild("Shinobi").GetComponent<RectTransform>();
				trnContent.sizeDelta = new Vector3(95,120,0);
				colorByRankChanger(SNBObj, busshiRankList[4]);

				string itemCdSNB = SNBObj.name + busshiRankList[4];
				float unitPriceSNB = (float)item.getUnitPrice(itemCdSNB);
				float finalPriceSNB = unitPriceSNB * discount;
				item5.GetComponent<SyouninProductSelect>().price = Mathf.CeilToInt(finalPriceSNB);
				item5.GetComponent<SyouninProductSelect>().busshiQty = int.Parse(busshiQtyList[4]);
				item5.GetComponent<SyouninProductSelect>().menuName = name;
				item5.GetComponent<SyouninProductSelect>().busshiCd = itemCdSNB;

				//Initial
				item1.GetComponent<SyouninProductSelect>().OnClick();

				string serihu = "物資が御入用でしょうか。鉄砲に騎馬、忍など取り揃えておりますよ。";
				serihuChanger (serihu);

			}else if(name == "Yasen"){

				string path = "Prefabs/Syounin/MenuYasen";
				GameObject menu = Instantiate (Resources.Load (path)) as GameObject;
				menu.transform.SetParent (board.transform);
				menu.transform.localScale = new Vector2 (1, 1);
				menu.transform.localPosition = new Vector2 (0, -150);
				menu.transform.FindChild ("Close").GetComponent<CloseMenu> ().obj = menu;
				menu.name = "MenuYasen";

				int yasenAmt = CloseLayerScript.yasenAmt;
				menu.transform.FindChild("MoneyValue").GetComponent<Text>().text = yasenAmt.ToString();
				GameObject btn = menu.transform.FindChild("DoYasenButton").gameObject;
				btn.GetComponent<DoSyouninMenu>().price = yasenAmt;

				string serihu = "なんと、矢銭をご所望ですか...。";
				serihuChanger (serihu);

			}else if(name == "Youjinbou"){

				string path = "Prefabs/Syounin/MenuRounin";
				GameObject menu = Instantiate (Resources.Load (path)) as GameObject;
				menu.transform.SetParent (board.transform);
				menu.transform.localScale = new Vector2 (1, 1);
				menu.transform.localPosition = new Vector2 (0, -150);
				menu.transform.FindChild ("Close").GetComponent<CloseMenu> ().obj = menu;
				menu.name = "MenuRounin";

				//Preparation
				float discount = CloseLayerScript.discount;
				int rdmKengouId = CloseLayerScript.rdmKengouId;
				GameObject btn = menu.transform.FindChild("DoRouninButton").gameObject;

				string kengouPath = "Prefabs/Item/kengou";
				GameObject kengou = Instantiate (Resources.Load (kengouPath)) as GameObject;
				kengou.transform.SetParent (menu.transform);
				kengou.transform.localScale = new Vector2 (1.0f, 1.25f);
				kengou.GetComponent<Button>().enabled = false;

				RectTransform kengouRect = kengou.GetComponent<RectTransform>();
				kengouRect.anchoredPosition3D = new Vector3(-200,-30,0);

				GameObject rank = kengou.transform.FindChild("Rank").gameObject;
				RectTransform kengouRankRect = rank.GetComponent<RectTransform>();
				kengouRankRect.anchoredPosition3D = new Vector3(-50,20,0);
				rank.transform.localScale = new Vector2(0.09f, 0.09f);

				Item item = new Item();
				string itemCd = "kengou" + rdmKengouId;
				string kengouName = item.getItemName(itemCd);
				string exp = item.getExplanation(itemCd);
				float unitPrice = (float)item.getUnitPrice(itemCd);
				rank.GetComponent<Text>().text = kengouName;

				float finalPrice = unitPrice * discount;
				btn.GetComponent<DoSyouninMenu>().price = Mathf.CeilToInt(finalPrice);
				btn.GetComponent<DoSyouninMenu>().kengouId = rdmKengouId;

				GameObject info = menu.transform.FindChild("Info").gameObject;
				info.transform.FindChild("Name").GetComponent<Text>().text = kengouName;
				info.transform.FindChild("EffectLabel").GetComponent<Text>().text = exp;
				menu.transform.FindChild("MoneyValue").GetComponent<Text>().text = Mathf.CeilToInt(finalPrice).ToString();

				string serihu = "弊家で囲うております者でございます。腕は確かでございますぞ。";
				serihuChanger (serihu);

			}else if(name == "Cyakai"){

				string path = "Prefabs/Syounin/MenuCyakai";
				GameObject menu = Instantiate (Resources.Load (path)) as GameObject;
				menu.transform.SetParent (board.transform);
				menu.transform.localScale = new Vector2 (1, 1);
				menu.transform.localPosition = new Vector2 (0, -150);
				menu.transform.FindChild ("Close").GetComponent<CloseMenu> ().obj = menu;
				menu.name = "MenuCyakai";

				string serihu = "それは華やかなものになるでしょうなあ。ご所有の大名物を見とうございます。";
				serihuChanger (serihu);


			}else if(name == "Gijyutsu"){

				string path = "Prefabs/Syounin/MenuTech";
				GameObject menu = Instantiate (Resources.Load (path)) as GameObject;
				menu.transform.SetParent (board.transform);
				menu.transform.localScale = new Vector2 (1, 1);
				menu.transform.localPosition = new Vector2 (0, -150);
				menu.transform.FindChild ("Close").GetComponent<CloseMenu> ().obj = menu;
				menu.name = "MenuTech";
				GameObject btn = menu.transform.FindChild("DoTechButton").gameObject;

				int techId = CloseLayerScript.techId;

				//Image
				string spritePath = "";
				if(techId == 1){
					spritePath = "Prefabs/Item/Tech/Sprite/tp";
				}else if(techId == 2){
					spritePath = "Prefabs/Item/Tech/Sprite/kb";
				}else if(techId == 3){
					spritePath = "Prefabs/Item/Tech/Sprite/snb";
				}
				GameObject techImage = menu.transform.FindChild("Tech").gameObject;
				techImage.GetComponent<Image> ().sprite = 
					Resources.Load (spritePath, typeof(Sprite)) as Sprite;

				//Detail Info
				Item item = new Item();
				string itemCd = "tech" + techId;
				string techName = item.getItemName(itemCd);
				string exp = item.getExplanation(itemCd);
				float unitPrice = (float)item.getUnitPrice(itemCd);
				float discount = CloseLayerScript.discount;

				float finalPrice = unitPrice * discount;
				btn.GetComponent<DoSyouninMenu>().price = Mathf.CeilToInt(finalPrice);
				btn.GetComponent<DoSyouninMenu>().techId = techId;
				
				GameObject info = menu.transform.FindChild("Info").gameObject;
				info.transform.FindChild("Name").GetComponent<Text>().text = techName;
				info.transform.FindChild("EffectLabel").GetComponent<Text>().text = exp;
				menu.transform.FindChild("MoneyValue").GetComponent<Text>().text = Mathf.CeilToInt(finalPrice).ToString();

				string serihu = "様々な技術が日ノ本に拡がるは良きことと存じまする。是非お買い求め下され。";
				serihuChanger (serihu);

			}


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

        if (Application.loadedLevelName == "souko")
        {
            //Souko Scene
            GameObject.Find("GetMoney").GetComponent <Image> ().enabled = true;
            GameObject sellBtn = GameObject.Find("SellButton");
            sellBtn.GetComponent <Image> ().enabled  = true;
            sellBtn.GetComponent <Button> ().enabled = true;
            sellBtn.transform.FindChild("Text").GetComponent <Text> ().enabled = true;

            GameObject.Find("ItemNameValue").GetComponent <Text> ().text    = kahouName;
            GameObject.Find("KahouEffectLabel").GetComponent <Text> ().text = kahouTarget;
            string effect = "+" + kahouEffect + kahouUnit;
            GameObject.Find("KahouEffectValue").GetComponent <Text> ().text = effect;
            string sell = "+" + kahouSell;
            GameObject.Find("GetMoneyValue").GetComponent <Text> ().text = sell;

            //Delete Previous Icon
            GameObject itemView = GameObject.Find("ItemView");
            foreach (Transform n in itemView.transform)
            {
                if (n.tag == "Kahou")
                {
                    GameObject.Destroy(n.gameObject);
                }
            }
            string     kahouIconPath = "Prefabs/Item/Kahou/" + name;
            GameObject kahouIcon     = Instantiate(Resources.Load(kahouIconPath)) as GameObject;
            kahouIcon.transform.SetParent(itemView.transform);
            kahouIcon.transform.localScale = new Vector2(1, 1);
            RectTransform kahouTransform = kahouIcon.GetComponent <RectTransform> ();
            kahouTransform.anchoredPosition3D = new Vector3(0, 120, 0);

            kahouIcon.GetComponent <Button> ().enabled = false;

            //Sell Button Set
            sellBtn.GetComponent <DoSell> ().kahouId   = kahouId;
            sellBtn.GetComponent <DoSell> ().kahouName = kahouName;
            sellBtn.GetComponent <DoSell> ().kahouType = kahouType;
            sellBtn.GetComponent <DoSell> ().kahouSell = kahouSell;
        }
        else if (Application.loadedLevelName == "busyo")
        {
            //Busyo Kahou Scene

            GameObject mainController = GameObject.Find("GameScene");

            mainController.GetComponent <NowOnButton> ().onKahouButton = this.transform.parent.gameObject.name;

            /*Board with Current Kahou Info*/
            //Back Cover
            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);

            //Popup Screen
            string     popupPath = "Prefabs/Busyo/equipedKahouBoard";
            GameObject popup     = Instantiate(Resources.Load(popupPath)) as GameObject;
            popup.transform.SetParent(GameObject.Find("Panel").transform);
            popup.transform.localScale = new Vector2(1, 1);
            RectTransform popupTransform = popup.GetComponent <RectTransform> ();
            popupTransform.anchoredPosition3D = new Vector3(0, 0, 0);

            //Get Kahou Data
            if (kahouType == "bugu")
            {
                Entity_kahou_bugu_mst Mst = Resources.Load("Data/kahou_bugu_mst") as Entity_kahou_bugu_mst;
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    kahouName   = Mst.param[kahouId - 1].kahouNameEng;
                    kahouTarget = Mst.param[kahouId - 1].kahouTargetEng;
                }
                else
                {
                    kahouName   = Mst.param[kahouId - 1].kahouName;
                    kahouTarget = Mst.param[kahouId - 1].kahouTarget;
                }
                kahouEffect = Mst.param [kahouId - 1].kahouEffect;
                kahouUnit   = Mst.param [kahouId - 1].unit;
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    kahouExp = Mst.param [kahouId - 1].kahouExpEng;
                }
                else
                {
                    kahouExp = Mst.param[kahouId - 1].kahouExp;
                }
            }
            else if (kahouType == "kabuto")
            {
                Entity_kahou_kabuto_mst Mst = Resources.Load("Data/kahou_kabuto_mst") as Entity_kahou_kabuto_mst;
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    kahouName   = Mst.param[kahouId - 1].kahouNameEng;
                    kahouTarget = Mst.param[kahouId - 1].kahouTargetEng;
                }
                else
                {
                    kahouName   = Mst.param[kahouId - 1].kahouName;
                    kahouTarget = Mst.param[kahouId - 1].kahouTarget;
                }
                kahouEffect = Mst.param [kahouId - 1].kahouEffect;
                kahouUnit   = Mst.param [kahouId - 1].unit;
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    kahouExp = Mst.param[kahouId - 1].kahouExpEng;
                }
                else
                {
                    kahouExp = Mst.param[kahouId - 1].kahouExp;
                }
            }
            else if (kahouType == "gusoku")
            {
                Entity_kahou_gusoku_mst Mst = Resources.Load("Data/kahou_gusoku_mst") as Entity_kahou_gusoku_mst;
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    kahouName   = Mst.param[kahouId - 1].kahouNameEng;
                    kahouTarget = Mst.param[kahouId - 1].kahouTargetEng;
                }
                else
                {
                    kahouName   = Mst.param[kahouId - 1].kahouName;
                    kahouTarget = Mst.param[kahouId - 1].kahouTarget;
                }
                kahouEffect = Mst.param [kahouId - 1].kahouEffect;
                kahouUnit   = Mst.param [kahouId - 1].unit;
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    kahouExp = Mst.param[kahouId - 1].kahouExpEng;
                }
                else
                {
                    kahouExp = Mst.param[kahouId - 1].kahouExp;
                }
            }
            else if (kahouType == "meiba")
            {
                Entity_kahou_meiba_mst Mst = Resources.Load("Data/kahou_meiba_mst") as Entity_kahou_meiba_mst;
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    kahouName   = Mst.param[kahouId - 1].kahouNameEng;
                    kahouTarget = Mst.param[kahouId - 1].kahouTargetEng;
                }
                else
                {
                    kahouName   = Mst.param[kahouId - 1].kahouName;
                    kahouTarget = Mst.param[kahouId - 1].kahouTarget;
                }
                kahouEffect = Mst.param [kahouId - 1].kahouEffect;
                kahouUnit   = Mst.param [kahouId - 1].unit;
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    kahouExp = Mst.param[kahouId - 1].kahouExpEng;
                }
                else
                {
                    kahouExp = Mst.param[kahouId - 1].kahouExp;
                }
            }
            else if (kahouType == "cyadougu")
            {
                Entity_kahou_cyadougu_mst Mst = Resources.Load("Data/kahou_cyadougu_mst") as Entity_kahou_cyadougu_mst;
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    kahouName   = Mst.param[kahouId - 1].kahouNameEng;
                    kahouTarget = Mst.param[kahouId - 1].kahouTargetEng;
                }
                else
                {
                    kahouName   = Mst.param[kahouId - 1].kahouName;
                    kahouTarget = Mst.param[kahouId - 1].kahouTarget;
                }
                kahouEffect = Mst.param [kahouId - 1].kahouEffect;
                kahouUnit   = Mst.param [kahouId - 1].unit;
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    kahouExp = Mst.param[kahouId - 1].kahouExpEng;
                }
                else
                {
                    kahouExp = Mst.param[kahouId - 1].kahouExp;
                }
            }
            else if (kahouType == "heihousyo")
            {
                Entity_kahou_heihousyo_mst Mst = Resources.Load("Data/kahou_heihousyo_mst") as Entity_kahou_heihousyo_mst;
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    kahouName   = Mst.param[kahouId - 1].kahouNameEng;
                    kahouTarget = Mst.param[kahouId - 1].kahouTargetEng;
                }
                else
                {
                    kahouName   = Mst.param[kahouId - 1].kahouName;
                    kahouTarget = Mst.param[kahouId - 1].kahouTarget;
                }
                kahouEffect = Mst.param [kahouId - 1].kahouEffect;
                kahouUnit   = Mst.param [kahouId - 1].unit;
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    kahouExp = Mst.param[kahouId - 1].kahouExpEng;
                }
                else
                {
                    kahouExp = Mst.param[kahouId - 1].kahouExp;
                }
            }
            else if (kahouType == "chishikisyo")
            {
                Entity_kahou_chishikisyo_mst Mst = Resources.Load("Data/kahou_chishikisyo_mst") as Entity_kahou_chishikisyo_mst;
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    kahouName   = Mst.param[kahouId - 1].kahouNameEng;
                    kahouTarget = Mst.param[kahouId - 1].kahouTargetEng;
                }
                else
                {
                    kahouName   = Mst.param[kahouId - 1].kahouName;
                    kahouTarget = Mst.param[kahouId - 1].kahouTarget;
                }
                kahouEffect = Mst.param [kahouId - 1].kahouEffect;
                kahouUnit   = Mst.param [kahouId - 1].unit;
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    kahouExp = Mst.param[kahouId - 1].kahouExpEng;
                }
                else
                {
                    kahouExp = Mst.param[kahouId - 1].kahouExp;
                }
            }

            //Refrect Kahou info.
            GameObject.Find("equipedKahouName").GetComponent <Text> ().text        = kahouName;
            GameObject.Find("equipedKahouEffectLabel").GetComponent <Text> ().text = kahouTarget;
            GameObject.Find("equipedKahouEffectValue").GetComponent <Text> ().text = "+" + kahouEffect + kahouUnit;
            GameObject.Find("equipedKahouExpValue").GetComponent <Text> ().text    = kahouExp;
            string     kahouTypId = kahouType + kahouId;
            string     kahouPath  = "Prefabs/Item/Kahou/" + kahouTypId;
            GameObject kahou      = Instantiate(Resources.Load(kahouPath)) as GameObject;
            kahou.transform.SetParent(GameObject.Find("equipedKahouBoard(Clone)").transform);

            kahou.transform.localScale = new Vector3(1.2f, 1.2f, 0);
            RectTransform kahouTransform = kahou.GetComponent <RectTransform> ();
            kahouTransform.anchoredPosition3D = new Vector3(-360, 0, 0);

            kahou.GetComponent <Button> ().enabled = false;

            //Send Param Delete Button
            GameObject.Find("DeleteButton").GetComponent <DeleteKahou> ().kahouType = kahouType;
            GameObject.Find("DeleteButton").GetComponent <DeleteKahou> ().kahouId   = kahouId;
        }
        else if (Application.loadedLevelName == "zukan")
        {
            string     pathOfBack = "Prefabs/Common/TouchBack";
            GameObject back       = Instantiate(Resources.Load(pathOfBack)) as GameObject;
            back.transform.parent        = GameObject.Find("Panel").transform;
            back.transform.localScale    = new Vector2(1, 1);
            back.transform.localPosition = new Vector2(0, 0);

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

            //Get Data
            string     kahouTypId    = kahouType + kahouId.ToString();
            string     kahouIconPath = "Prefabs/Item/Kahou/" + kahouTypId;
            GameObject kahouIcon     = Instantiate(Resources.Load(kahouIconPath)) as GameObject;
            kahouIcon.transform.SetParent(pop.transform);
            kahouIcon.transform.localScale = new Vector2(1.5f, 1.5f);
            RectTransform rectIcon = kahouIcon.GetComponent <RectTransform>();
            rectIcon.anchoredPosition3D = new Vector3(-130, 90, 0);
            kahouIcon.GetComponent <Button>().enabled = false;

            KahouStatusGet kahou         = new KahouStatusGet();
            List <string>  kahouInfoList = new List <string> ();
            kahouInfoList = kahou.getKahouInfo(kahouType, kahouId);

            GameObject.Find("kahouNameValue").GetComponent <Text>().text = kahouInfoList[0];
            string kahouTypeName = "";
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                if (kahouType == "bugu")
                {
                    kahouTypeName = "Arms";
                }
                else if (kahouType == "gusoku")
                {
                    kahouTypeName = "Armor";
                }
                else if (kahouType == "kabuto")
                {
                    kahouTypeName = "Helmet";
                }
                else if (kahouType == "meiba")
                {
                    kahouTypeName = "Horse";
                }
                else if (kahouType == "cyadougu")
                {
                    kahouTypeName = "Tea Things";
                }
                else if (kahouType == "chishikisyo")
                {
                    kahouTypeName = "Book";
                }
                else if (kahouType == "heihousyo")
                {
                    kahouTypeName = "Tactics";
                }
            }
            else
            {
                if (kahouType == "bugu")
                {
                    kahouTypeName = "武具";
                }
                else if (kahouType == "gusoku")
                {
                    kahouTypeName = "具足";
                }
                else if (kahouType == "kabuto")
                {
                    kahouTypeName = "兜";
                }
                else if (kahouType == "meiba")
                {
                    kahouTypeName = "名馬";
                }
                else if (kahouType == "cyadougu")
                {
                    kahouTypeName = "茶道具";
                }
                else if (kahouType == "chishikisyo")
                {
                    kahouTypeName = "知識書";
                }
                else if (kahouType == "heihousyo")
                {
                    kahouTypeName = "兵法書";
                }
            }
            GameObject.Find("kahouTypValue").GetComponent <Text>().text = kahouTypeName;
            GameObject.Find("EffectTitle").GetComponent <Text>().text   = kahouInfoList[2];
            string effect = "+" + kahouInfoList[3] + kahouInfoList[4];
            GameObject.Find("EffectValue").GetComponent <Text>().text = effect;
            GameObject.Find("ExpValue").GetComponent <Text>().text    = kahouInfoList[1];
        }
    }
Beispiel #5
0
    public void GetPlayerSenryoku(string busyoId)
    {
        int  i      = 0;
        bool result = int.TryParse(busyoId, out i);

        if (result)
        {
            //Parent
            int myDaimyoBusyo = PlayerPrefs.GetInt("myDaimyoBusyo");
            if (int.Parse(busyoId) == myDaimyoBusyo)
            {
                myDaimyoBusyoFlg = true;
            }

            BusyoInfoGet busyo = new BusyoInfoGet();
            belongDaimyoId = busyo.getDaimyoId(int.Parse(busyoId));
            if (belongDaimyoId == 0)
            {
                belongDaimyoId = busyo.getDaimyoHst(int.Parse(busyoId));
            }
            shipId = busyo.getShipId(int.Parse(busyoId));

            lv = PlayerPrefs.GetInt(busyoId, 1);
            StatusGet sts = new StatusGet();
            int       hp  = sts.getHp(int.Parse(busyoId), lv);
            int       atk = sts.getAtk(int.Parse(busyoId), lv);
            int       dfc = sts.getDfc(int.Parse(busyoId), lv);
            int       spd = sts.getSpd(int.Parse(busyoId), lv);

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

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

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

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

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

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

            totalBusyoAtk = adjAtk + int.Parse(KahouStatusArray[0]) + Mathf.FloorToInt(addAtkByKanni);
            totalBusyoHp  = adjHp + int.Parse(KahouStatusArray[1]) + Mathf.FloorToInt(addHpByKanni) + addJyosyuHei;
            totalBusyoDfc = adjDfc + int.Parse(KahouStatusArray[2]) + Mathf.FloorToInt(addDfcByKanni);
            totalSpd      = spd + int.Parse(KahouStatusArray[3]);
            if (Application.loadedLevelName == "preKaisen")
            {
                if (shipId == 1)
                {
                    totalBusyoHp = totalBusyoHp * 2;
                }
                else if (shipId == 2)
                {
                    totalBusyoHp = Mathf.FloorToInt((float)totalBusyoHp * 1.5f);
                }
            }

            //Child
            string heiId   = "hei" + busyoId.ToString();
            string chParam = PlayerPrefs.GetString(heiId, "0");
            if (chParam == "0" || chParam == "")
            {
                StatusGet statusScript = new StatusGet();
                string    heisyu       = statusScript.getHeisyu(int.Parse(busyoId));
                chParam = heisyu + ":1:1:1";
                PlayerPrefs.SetString(heiId, chParam);
                PlayerPrefs.Flush();
            }

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

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

                ch_status = ch_status * 10;
                int atkDfc = (int)sts.getChAtkDfc(ch_status, totalBusyoHp);

                totalChldHp  = ch_status * chQty;
                totalChldAtk = atkDfc * chQty;
                totalChldDfc = atkDfc * chQty;

                //Set value
                totalHp  = totalBusyoHp + totalChldHp;
                totalAtk = totalBusyoAtk + totalChldAtk;
                totalDfc = totalBusyoDfc + totalChldDfc;
            }
        }
    }
Beispiel #6
0
    public void makeInstance(int mapId, int busyoId, int lv, string ch_type, int ch_num, int hp, int atk, int dfc, int spd, string busyoName, int linkNo, bool taisyo, ArrayList senpouArray, string kahouList)
    {
        /*Roujyo Start*/
        bool       shiroFlg    = false;
        bool       torideFlg   = false;
        GameObject buildingObj = null;
        bool       pvpFlg      = GameObject.Find("GameScene").GetComponent <GameScene>().pvpFlg;

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

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

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

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

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

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

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


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

        prefab.name = busyoId.ToString();

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

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



        //Senpou Script Parametor
        StatusGet senpouScript = new StatusGet();
        bool      onlySeaFlg   = senpouScript.getSenpouOnlySeaFlg((int)senpouArray[0]);

        if (!onlySeaFlg)
        {
            prefab.GetComponent <SenpouController>().senpouId     = (int)senpouArray[0];
            prefab.GetComponent <SenpouController>().senpouTyp    = senpouArray[1].ToString();
            prefab.GetComponent <SenpouController>().senpouName   = senpouArray[2].ToString();
            prefab.GetComponent <SenpouController>().senpouEach   = (float)senpouArray[4];
            prefab.GetComponent <SenpouController>().senpouRatio  = (float)senpouArray[5];
            prefab.GetComponent <SenpouController>().senpouTerm   = (float)senpouArray[6];
            prefab.GetComponent <SenpouController>().senpouStatus = (int)senpouArray[7];
            prefab.GetComponent <SenpouController>().senpouLv     = (int)senpouArray[8];
            //Serihu
            Entity_serihu_mst serihuMst = Resources.Load("Data/serihu_mst") as Entity_serihu_mst;
            string            serihu    = "";
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                serihu = serihuMst.param[busyoId - 1].senpouMsgEng;
            }
            else
            {
                serihu = serihuMst.param[busyoId - 1].senpouMsg;
            }
            prefab.GetComponent <SenpouController>().senpouSerihu = serihu;
        }
        else
        {
            Destroy(prefab.GetComponent <SenpouController>());
        }

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

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlEnemyEng";
        }
        else
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlEnemy";
        }
        GameObject dtl = Instantiate(Resources.Load(dtlPath)) as GameObject;

        dtl.transform.SetParent(prefab.transform);
        dtl.transform.localPosition = new Vector3(0, 1.3f, -1);
        dtl.transform.localScale    = new Vector3(-1.3f, 1.3f, 0);
        dtl.name = "BusyoDtlEnemy";

        //Name
        GameObject nameLabel = dtl.transform.FindChild("NameLabel").gameObject;

        nameLabel.GetComponent <TextMesh> ().text = busyoName;


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



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

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

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

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

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

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

        //adjust spd
        float adjSpd = spdWithKahou / 10;

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

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

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

        //SE
        AudioController audio = new AudioController();

        audio.addComponentMoveAttack(prefab, ch_type);


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

        for (int i = 1; i <= ch_num; i++)
        {
            //Make Relationship
            GameObject ch_prefab = Instantiate(Resources.Load(ch_path)) as GameObject;
            ch_prefab.transform.SetParent(prefab.transform);
            ch_prefab.name = "Child" + i.ToString();

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


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

            if (ch_type == "YR")
            {
                sashimono.transform.localPosition = new Vector2(-1, 0.6f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 3, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 6, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 9, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 12, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "KB")
            {
                sashimono.transform.localPosition = new Vector2(-0.5f, 1);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "TP")
            {
                sashimono.transform.localPosition = new Vector2(-0.8f, 0.5f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "YM")
            {
                sashimono.transform.localPosition = new Vector2(-0.8f, 0.5f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }

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

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

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

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

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

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

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

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

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

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

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

            //HP
            List <float> randomList = new List <float>()
            {
                1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f, 5.0f
            };
            int   rdm         = UnityEngine.Random.Range(0, randomList.Count);
            float randomValue = randomList [rdm];
            buildingObj.transform.FindChild("BusyoDtlEnemy").transform.FindChild("MinHpBar").GetComponent <BusyoHPBar>().initLife = (float)hp * randomValue;
            buildingObj.GetComponent <EnemyHP>().life = (float)hp * randomValue;
        }
    }
Beispiel #7
0
    public void randomSalesKahouView(GameObject slot)
    {
        int requriedMoney = 0;

        //kahou
        Kahou kahou = new Kahou();

        //Type
        List <string> kahouTypeList = new List <string> {
            "bugu", "kabuto", "gusoku", "meiba", "cyadougu", "heihousyo", "chishikisyo"
        };
        int    rdmTyp    = UnityEngine.Random.Range(0, kahouTypeList.Count);
        string kahouType = kahouTypeList [rdmTyp];

        //Rank
        float rankPercent = UnityEngine.Random.value;

        rankPercent = rankPercent * 100;
        string kahouRank = "";

        if (rankPercent <= 5)
        {
            //S
            kahouRank = "S";
        }
        else if (5 < rankPercent && rankPercent <= 20)
        {
            //A
            kahouRank = "A";
        }
        else if (20 < rankPercent && rankPercent <= 50)
        {
            //B
            kahouRank = "B";
        }
        else if (50 < rankPercent)
        {
            //C
            kahouRank = "C";
        }

        int            kahouId       = kahou.getRamdomKahouId(kahouType, kahouRank);
        KahouStatusGet kahouSts      = new KahouStatusGet();
        List <string>  kahouInfoList = new List <string> ();

        kahouInfoList = kahouSts.getKahouInfo(kahouType, kahouId);
        requriedMoney = int.Parse(kahouInfoList [5]);

        //discount
        List <float> discountList = new List <float> {
            1.5f, 1.4f, 1.3f, 1.2f, 1.1f, 1.0f, 0.9f, 0.8f, 0.7f, 0.6f, 0.5f
        };
        int   rdmDisc         = UnityEngine.Random.Range(0, discountList.Count);
        float discountPercent = discountList [rdmDisc];

        requriedMoney = Mathf.CeilToInt((float)requriedMoney * discountPercent);


        //kahou
        slot.GetComponent <ShisyaSelect>().itemCd    = kahouType;
        slot.GetComponent <ShisyaSelect> ().itemId   = kahouId.ToString();
        slot.GetComponent <ShisyaSelect> ().itemName = kahouInfoList [0];
        slot.GetComponent <ShisyaSelect> ().moneyNo  = requriedMoney;
    }
Beispiel #8
0
	public void makeNanbansen(){

		string shipPath = "Prefabs/Naisei/ship";
		GameObject ship = Instantiate(Resources.Load (shipPath)) as GameObject;
		GameObject tabibitoView = GameObject.Find ("TabibitoView").gameObject;
		ship.transform.SetParent(tabibitoView.transform);
		ship.transform.localScale = new Vector2 (1, 1);

		RectTransform ship_transform = ship.GetComponent<RectTransform>();
		ship_transform.anchoredPosition3D = new Vector3(570,180,0);

		Item item = new Item ();
		Nanbansen nanbansen = ship.GetComponent<Nanbansen> ();

		//Get TP Item
		string itemTPCd = "";
		int itemTPId = 0;
		int itemTPQty = 0;
		float itemTPPrice = 0;

		float tpPercent = UnityEngine.Random.value;
		tpPercent = tpPercent * 100;

		if (tpPercent <= 30) {
			//Jyo
			itemTPCd = "CyouheiTP3";
			itemTPId = 3;
		} else if(30 < tpPercent && tpPercent <= 60){
			//Cyu
			itemTPCd = "CyouheiTP2";
			itemTPId = 2;

		}else if(60 < tpPercent){
			//Ge
			itemTPCd = "CyouheiTP1";
			itemTPId = 1;

		}

		itemTPQty = UnityEngine.Random.Range(1,6); //1-5 Qty
		itemTPPrice = randomPriceChange(itemTPCd, itemTPQty);
		nanbansen.itemTPCd = itemTPCd;
		nanbansen.itemTPId = itemTPId;
		nanbansen.itemTPQty = itemTPQty;
		nanbansen.itemTPPrice = itemTPPrice;
		nanbansen.itemTPExp = item.getExplanation (itemTPCd);


		//Get Saku Item
		string itemSakuCd = "";
		int itemSakuQty = 1;
		float itemSakuPrice = 0;
		int itemSakuId = 0;

		float sakuPercent = UnityEngine.Random.value;
		sakuPercent = sakuPercent * 100;
		
		if (sakuPercent <= 30) {
			itemSakuCd = "nanban1";
			itemSakuId = 1;
		} else if(30 < sakuPercent && sakuPercent <= 60){
			itemSakuCd = "nanban2";
			itemSakuId = 2;
		}else if(60 < sakuPercent){
			itemSakuCd = "nanban3";
			itemSakuId = 3;
		}
		itemSakuPrice = randomPriceChange(itemSakuCd, itemSakuQty);
		nanbansen.itemSakuCd = itemSakuCd;
		nanbansen.itemSakuId = itemSakuId;
		nanbansen.itemSakuPrice = itemSakuPrice;
		nanbansen.itemSakuExp = item.getExplanation (itemSakuCd);


		//Get Kahou Item
		string itemKahouCd = "";
		int itemKahouQty = 1;
		float itemKahouPrice = 0;
		
		float kahouPercent = UnityEngine.Random.value;
		kahouPercent = kahouPercent * 100;
		string kahouRank = "";

		if (kahouPercent <= 10) {
			//S
			kahouRank = "S";
		} else if(10 < kahouPercent && kahouPercent <= 30){
			//A
			kahouRank = "A";
		}else if(30 < kahouPercent  && kahouPercent <= 60){
			//B
			kahouRank = "B";
		}else if(60 < kahouPercent){
			//C
			kahouRank = "C";
		}
		Kahou kahou = new Kahou ();
		List<string> kahouRandom = new List<string> (){"bugu","kabuto","gusoku","meiba","cyadougu","chishikisyo","heihousyo"};
		int rdm = UnityEngine.Random.Range(0,7);
		itemKahouCd = kahouRandom[rdm];
		int itemKahouId = kahou.getRamdomKahouId(itemKahouCd, kahouRank);

		List<string> kahouInfo = new List<string> (); 
		KahouStatusGet kahouSts = new KahouStatusGet (); 
		kahouInfo = kahouSts.getKahouInfo(itemKahouCd, itemKahouId);

		float priceChange = UnityEngine.Random.Range (1, 51);
		int updown = UnityEngine.Random.Range (0,2); //0:Up, 1:Down

		float kahouPrice = 0;
		float kahouUnitPrice = float.Parse (kahouInfo [5]);
		float diff = kahouUnitPrice * priceChange/100;
		if(updown==0){
			kahouPrice = kahouUnitPrice + diff;
		}else{
			kahouPrice = kahouUnitPrice - diff;
		}

		nanbansen.itemKahouCd = itemKahouCd;
		nanbansen.itemKahouId = itemKahouId;
		nanbansen.itemKahouPrice = kahouPrice;
		nanbansen.itemKahouExp = kahouInfo [1];

	}
Beispiel #9
0
	public void GetPlayerSenryoku(string busyoId){

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


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

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

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

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



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

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

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

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

        Color Select   = new Color(76f / 255f, 50f / 255f, 18f / 255f, 80f / 255f);
        Color unSelect = new Color(255f / 255f, 255f / 255f, 255f / 255f, 100f / 255f);

        foreach (Transform obj in Content.transform)
        {
            obj.GetComponent <Image>().color = unSelect;
        }
        GetComponent <Image> ().color = Select;


        baseObj = GameObject.Find("Base").gameObject;
        baseObj.transform.FindChild("Title").GetComponent <Text> ().text = title;
        baseObj.transform.FindChild("Mask").transform.FindChild("Image").GetComponent <Image> ().sprite = transform.FindChild("Image").GetComponent <Image> ().sprite;
        baseObj.transform.FindChild("Comment").transform.FindChild("Text").GetComponent <Text> ().text  = serihu;
        baseObj.transform.FindChild("Name").GetComponent <Text> ().text = shisyaName;

        reqruiedItemView(shisyaId);

        //Request to purchase item
        if (shisyaId == 5 || shisyaId == 19)
        {
            RequestBuyItem.gameObject.SetActive(true);
            Kahou  kahou     = new Kahou();
            string rank      = kahou.getKahouRank(itemCd, int.Parse(itemId));
            string kahouPath = "";
            if (rank == "C")
            {
                kahouPath = "Prefabs/Kahou/" + itemCd + "C";
            }
            else
            {
                kahouPath = "Prefabs/Kahou/" + itemCd + itemId;
            }
            RequestBuyItem.GetComponent <Image>().sprite =
                Resources.Load(kahouPath, typeof(Sprite)) as Sprite;
            //string kahouMsg = kahou.getRamdomKahou

            KahouStatusGet kahouSts      = new KahouStatusGet();
            List <string>  kahouInfoList = new List <string>();
            kahouInfoList = kahouSts.getKahouInfo(itemCd, int.Parse(itemId));
            string effect = kahouInfoList[0] + "\n" + kahouInfoList[2] + " +" + kahouInfoList[3] + kahouInfoList[4];
            RequestBuyItem.GetComponent <PopItem>().text = effect;
        }
        else
        {
            RequestBuyItem.gameObject.SetActive(false);
        }

        //Yes/No Button
        if (shisyaId != 6)
        {
            Color      OKbtnColor = new Color(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
            Color      OKtxtColor = new Color(190f / 255f, 190f / 255f, 0f / 255f, 255f / 255f);
            GameObject ysBtn      = GameObject.Find("YesButton").gameObject;
            ysBtn.GetComponent <Button> ().enabled = true;
            ysBtn.GetComponent <Image> ().color    = OKbtnColor;
            ysBtn.transform.FindChild("Text").GetComponent <Text> ().color = OKtxtColor;

            GameObject noBtn = GameObject.Find("NoButton").gameObject;
            noBtn.GetComponent <Button> ().enabled = true;
            noBtn.GetComponent <Image> ().color    = OKbtnColor;
            noBtn.transform.FindChild("Text").GetComponent <Text> ().color = OKtxtColor;

            ysBtn.GetComponent <DoShisya> ().slot = gameObject;
            noBtn.GetComponent <DoShisya> ().slot = gameObject;
        }
        else
        {
            //Doumei Haki
            //disable button
            Color      OKbtnColor = new Color(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
            Color      OKtxtColor = new Color(190f / 255f, 190f / 255f, 0f / 255f, 255f / 255f);
            Color      NGColor    = new Color(118f / 255f, 118f / 255f, 45f / 255f, 255f / 255f);
            GameObject ysBtn      = GameObject.Find("YesButton").gameObject;
            ysBtn.GetComponent <Button> ().enabled = true;
            ysBtn.GetComponent <Image> ().color    = OKbtnColor;
            ysBtn.transform.FindChild("Text").GetComponent <Text> ().color = OKtxtColor;

            GameObject noBtn = GameObject.Find("NoButton").gameObject;
            noBtn.GetComponent <Button>().enabled = false;
            noBtn.GetComponent <Image> ().color   = NGColor;
            noBtn.transform.FindChild("Text").GetComponent <Text> ().color = NGColor;

            ysBtn.GetComponent <DoShisya> ().slot = gameObject;
            noBtn.GetComponent <DoShisya> ().slot = gameObject;
        }
    }
Beispiel #11
0
    public void createSenpouStatusView(string busyoId)
    {
        StatusGet sts = new StatusGet();
        ArrayList senpouArray = sts.getSenpou(int.Parse(busyoId));

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            }else if(koudouId == "6"){
                GameObject.Find ("KoudouSutegamari").GetComponent<Image> ().color = activeColor;
                GameObject.Find ("SutegamariText").GetComponent<Text> ().color = activeTxtColor;
            }
        }
    }
Beispiel #12
0
    public void makeKaisenInstance(int busyoId, int shipId, int mapId, int hp, int atk, int dfc, int spd, ArrayList senpouArray, string busyoName, int soudaisyo, int boubi, bool engunFlg, int engunButaiQty, int engunButaiSts)
    {
        /*Parent Instantiate*/
        string     path   = "Prefabs/Kaisen/" + shipId;
        GameObject prefab = Instantiate(Resources.Load(path)) as GameObject;

        prefab.name = busyoId.ToString();

        //Senpou Script Parametor
        StatusGet senpouScript = new StatusGet();
        bool      shipFlg      = senpouScript.getSenpouShipFlg((int)senpouArray[0]);

        if (shipFlg)
        {
            prefab.GetComponent <SenpouController>().senpouId     = (int)senpouArray[0];
            prefab.GetComponent <SenpouController>().senpouTyp    = senpouArray[1].ToString();
            prefab.GetComponent <SenpouController>().senpouName   = senpouArray[2].ToString();
            prefab.GetComponent <SenpouController>().senpouEach   = (float)senpouArray[4];
            prefab.GetComponent <SenpouController>().senpouRatio  = (float)senpouArray[5];
            prefab.GetComponent <SenpouController>().senpouTerm   = (float)senpouArray[6];
            prefab.GetComponent <SenpouController>().senpouStatus = (int)senpouArray[7];
            prefab.GetComponent <SenpouController>().senpouLv     = (int)senpouArray[8];
            //Serihu
            Entity_serihu_mst serihuMst = Resources.Load("Data/serihu_mst") as Entity_serihu_mst;
            string            serihu    = "";
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                serihu = serihuMst.param[busyoId - 1].senpouMsgEng;
            }
            else
            {
                serihu = serihuMst.param[busyoId - 1].senpouMsg;
            }
            prefab.GetComponent <SenpouController>().senpouSerihu = serihu;
        }
        else
        {
            Destroy(prefab.GetComponent <SenpouController>());
        }



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

        //Kahou Adjustment
        float addAtkByKanni = 0;
        float addHpByKanni  = 0;
        float addDfcByKanni = 0;

        //Jyosyu Adjustment
        float addJyosyuHei = 0;

        string[] KahouStatusArray = null;
        if (!engunFlg)
        {
            KahouStatusGet kahouSts = new KahouStatusGet();
            KahouStatusArray = kahouSts.getKahouForStatus(busyoId.ToString(), adjHp, adjAtk, adjDfc, spd);
            //Kanni Adjustment
            string kanniTmp = "kanni" + busyoId;

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

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

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

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayerEng";
        }
        else
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayer";
        }
        GameObject dtl = Instantiate(Resources.Load(dtlPath)) as GameObject;

        dtl.transform.SetParent(prefab.transform);
        dtl.transform.localPosition = new Vector3(0, 1, -1);
        dtl.transform.localScale    = new Vector3(1, 1, 0);
        dtl.name = "BusyoDtlPlayer";
        //Name
        GameObject nameLabel = dtl.transform.FindChild("NameLabel").gameObject;

        nameLabel.GetComponent <TextMesh>().text = busyoName;
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            nameLabel.GetComponent <TextMesh>().fontSize = 40;
        }
        //Location by map id
        if (mapId == 1)
        {
            prefab.transform.position = new Vector2(-65, 16);
        }
        else if (mapId == 2)
        {
            prefab.transform.position = new Vector2(-50, 16);
        }
        else if (mapId == 3)
        {
            prefab.transform.position = new Vector2(-35, 16);
        }
        else if (mapId == 4)
        {
            prefab.transform.position = new Vector2(-20, 16);
        }
        else if (mapId == 5)
        {
            prefab.transform.position = new Vector2(-5, 16);
        }
        else if (mapId == 6)
        {
            prefab.transform.position = new Vector2(-65, 8);
        }
        else if (mapId == 7)
        {
            prefab.transform.position = new Vector2(-50, 8);
        }
        else if (mapId == 8)
        {
            prefab.transform.position = new Vector2(-35, 8);
        }
        else if (mapId == 9)
        {
            prefab.transform.position = new Vector2(-20, 8);
        }
        else if (mapId == 10)
        {
            prefab.transform.position = new Vector2(-5, 8);
        }
        else if (mapId == 11)
        {
            prefab.transform.position = new Vector2(-65, 0);
        }
        else if (mapId == 12)
        {
            prefab.transform.position = new Vector2(-50, 0);
        }
        else if (mapId == 13)
        {
            prefab.transform.position = new Vector2(-35, 0);
        }
        else if (mapId == 14)
        {
            prefab.transform.position = new Vector2(-20, 0);
        }
        else if (mapId == 15)
        {
            prefab.transform.position = new Vector2(-5, 0);
        }
        else if (mapId == 16)
        {
            prefab.transform.position = new Vector2(-65, -8);
        }
        else if (mapId == 17)
        {
            prefab.transform.position = new Vector2(-50, -8);
        }
        else if (mapId == 18)
        {
            prefab.transform.position = new Vector2(-35, -8);
        }
        else if (mapId == 19)
        {
            prefab.transform.position = new Vector2(-20, -8);
        }
        else if (mapId == 20)
        {
            prefab.transform.position = new Vector2(-5, -8);
        }
        else if (mapId == 21)
        {
            prefab.transform.position = new Vector2(-65, -16);
        }
        else if (mapId == 22)
        {
            prefab.transform.position = new Vector2(-50, -16);
        }
        else if (mapId == 23)
        {
            prefab.transform.position = new Vector2(-45, -16);
        }
        else if (mapId == 24)
        {
            prefab.transform.position = new Vector2(-20, -16);
        }
        else if (mapId == 25)
        {
            prefab.transform.position = new Vector2(-5, -16);
        }

        //Add Senryoku
        if (!engunFlg)
        {
            string key = "addSenryokuSlot" + mapId;
            if (PlayerPrefs.HasKey(key))
            {
                string        atkDfc          = PlayerPrefs.GetString(key);
                List <string> atkDfcList      = new List <string>();
                char[]        delimiterChars2 = { ',' };
                atkDfcList = new List <string>(atkDfc.Split(delimiterChars2));
                adjAtk     = adjAtk + int.Parse(atkDfcList[0]);
                adjDfc     = adjDfc + int.Parse(atkDfcList[1]);
            }
        }

        //Adjust Status & Set
        int   adjHpWithKahou  = 0;
        float adjAtkWithKahou = 0;
        float adjDfcWithKahou = 0;
        float adjSpd          = 0;

        if (!engunFlg)
        {
            adjHpWithKahou  = adjHp + int.Parse(KahouStatusArray[1]) + Mathf.FloorToInt(addHpByKanni);
            adjAtkWithKahou = (float)adjAtk + int.Parse(KahouStatusArray[0]) + Mathf.FloorToInt(addAtkByKanni);
            adjDfcWithKahou = (float)adjDfc + int.Parse(KahouStatusArray[2]) + Mathf.FloorToInt(addDfcByKanni) + boubi;
            adjSpd          = ((float)spd + float.Parse(KahouStatusArray[3])) / 10;
        }
        else
        {
            adjHpWithKahou  = adjHp;
            adjAtkWithKahou = (float)adjAtk;
            adjDfcWithKahou = (float)adjDfc;
            adjSpd          = (float)spd / 10;
        }

        if (shipId == 1)
        {
            adjHpWithKahou  = adjHpWithKahou * 2;
            adjDfcWithKahou = adjDfcWithKahou * 2;
            adjSpd          = Mathf.FloorToInt((float)adjSpd * 0.5f);
        }
        else if (shipId == 2)
        {
            adjHpWithKahou  = Mathf.FloorToInt((float)adjHpWithKahou * 1.5f);
            adjDfcWithKahou = Mathf.FloorToInt((float)adjDfcWithKahou * 1.5f);
            adjSpd          = Mathf.FloorToInt((float)adjSpd * 0.6f);
        }
        else if (shipId == 3)
        {
            adjSpd = Mathf.FloorToInt((float)adjSpd * 0.8f);
        }
        if (adjSpd <= 0)
        {
            adjSpd = 1;
        }
        GameObject minHpBar = dtl.transform.FindChild("MinHpBar").gameObject;

        minHpBar.GetComponent <BusyoHPBar>().initLife = adjHpWithKahou;
        prefab.GetComponent <PlayerHP>().life         = adjHpWithKahou + addJyosyuHei;
        prefab.GetComponent <PlayerAttack>().attack   = adjAtkWithKahou;
        prefab.GetComponent <UnitMover>().speed       = adjSpd;
        prefab.GetComponent <UnitMover>().heisyu      = "SHP";
        prefab.GetComponent <PlayerHP>().dfc          = adjDfcWithKahou;


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

        //SE
        AudioController audio = new AudioController();

        audio.addComponentMoveAttack(prefab, "SHP");


        /*Child Instantiate*/
        //set child object
        int   ch_num    = 0;
        int   ch_lv     = 0;
        float ch_status = 0;

        if (!engunFlg)
        {
            string heiId   = "hei" + busyoId.ToString();
            string chParam = PlayerPrefs.GetString(heiId, "0");
            if (chParam == "0")
            {
                StatusGet statusScript  = new StatusGet();
                string    chParamHeisyu = statusScript.getHeisyu(busyoId);
                chParam = chParamHeisyu + ":1:1:1";
                PlayerPrefs.SetString(heiId, chParam);
                PlayerPrefs.Flush();
            }

            char[]   delimiterChars = { ':' };
            string[] ch_list        = chParam.Split(delimiterChars);
            ch_num    = int.Parse(ch_list[1]);
            ch_lv     = int.Parse(ch_list[2]);
            ch_status = float.Parse(ch_list[3]);
        }
        else
        {
            ch_num    = engunButaiQty;
            ch_status = engunButaiSts;
        }
        ch_status = ch_status * 10;

        string ch_path = "Prefabs/Kaisen/3";

        for (int i = 1; i <= ch_num; i++)
        {
            //Make Relationship
            GameObject ch_prefab = Instantiate(Resources.Load(ch_path)) as GameObject;
            ch_prefab.transform.SetParent(prefab.transform);
            ch_prefab.name = "Child" + i.ToString();
            ch_prefab.transform.localScale = new Vector2(0.7f, 0.7f);
            ch_prefab.GetComponent <SpriteRenderer>().sortingOrder = 3;
            ch_prefab.tag = "PlayerChild";

            Destroy(ch_prefab.GetComponent <Rigidbody2D>());
            Destroy(ch_prefab.GetComponent <UnitMover>());
            Destroy(ch_prefab.GetComponent <Kunkou>());
            Destroy(ch_prefab.GetComponent <PolygonCollider2D>());
            Destroy(ch_prefab.GetComponent <PlayerHP>());
            Destroy(ch_prefab.GetComponent <PlayerAttack>());
            Destroy(ch_prefab.GetComponent <SenpouController>());

            //Location
            if (i == 1)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, 0);
            }
            else if (i == 2)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, 0.5f);
            }
            else if (i == 3)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, -0.5f);
            }
            else if (i == 4)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, 1.0f);
            }
            else if (i == 5)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, -1.0f);
            }
            else if (i == 6)
            {
                ch_prefab.transform.localPosition = new Vector2(0, 0.5f);
            }
            else if (i == 7)
            {
                ch_prefab.transform.localPosition = new Vector2(0, -0.5f);
            }
            else if (i == 8)
            {
                ch_prefab.transform.localPosition = new Vector2(0, 1.0f);
            }
            else if (i == 9)
            {
                ch_prefab.transform.localPosition = new Vector2(0, -1.0f);
            }
            else if (i == 10)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, 0);
            }
            else if (i == 11)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, 0.5f);
            }
            else if (i == 12)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, -0.5f);
            }
            else if (i == 13)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, 1.0f);
            }
            else if (i == 14)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, -1.0f);
            }
            else if (i == 15)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, 1.5f);
            }
            else if (i == 16)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, -1.5f);
            }
            else if (i == 17)
            {
                ch_prefab.transform.localPosition = new Vector2(0, 1.5f);
            }
            else if (i == 18)
            {
                ch_prefab.transform.localPosition = new Vector2(0, -1.5f);
            }
            else if (i == 19)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, 1.5f);
            }
            else if (i == 20)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, -1.5f);
            }


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

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

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

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

                //Dfc
                prefab.GetComponent <PlayerHP>().dfc = prefab.GetComponent <PlayerHP>().dfc + (ch_num * atkDfc);
            }
        }
    }
Beispiel #13
0
    public void makeInstance(int busyoId, int mapId, int hp, int atk, int dfc, int spd, ArrayList senpouArray, string busyoName, int soudaisyo, int boubi)
    {
        /*Parent Instantiate*/
        string     path   = "Prefabs/Player/" + busyoId;
        GameObject prefab = Instantiate(Resources.Load(path)) as GameObject;

        prefab.name = busyoId.ToString();

        //Senpou Script Parametor
        StatusGet senpouScript = new StatusGet();
        bool      onlySeaFlg   = senpouScript.getSenpouOnlySeaFlg((int)senpouArray[0]);

        if (!onlySeaFlg)
        {
            prefab.GetComponent <SenpouController>().senpouId     = (int)senpouArray[0];
            prefab.GetComponent <SenpouController>().senpouTyp    = senpouArray[1].ToString();
            prefab.GetComponent <SenpouController>().senpouName   = senpouArray[2].ToString();
            prefab.GetComponent <SenpouController>().senpouEach   = (float)senpouArray[4];
            prefab.GetComponent <SenpouController>().senpouRatio  = (float)senpouArray[5];
            prefab.GetComponent <SenpouController>().senpouTerm   = (float)senpouArray[6];
            prefab.GetComponent <SenpouController>().senpouStatus = (int)senpouArray[7];
            prefab.GetComponent <SenpouController>().senpouLv     = (int)senpouArray[8];

            //Serihu
            Entity_serihu_mst serihuMst = Resources.Load("Data/serihu_mst") as Entity_serihu_mst;
            string            serihu    = "";
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                serihu = serihuMst.param[busyoId - 1].senpouMsgEng;
            }
            else
            {
                serihu = serihuMst.param[busyoId - 1].senpouMsg;
            }
            prefab.GetComponent <SenpouController>().senpouSerihu = serihu;
        }
        else
        {
            Destroy(prefab.GetComponent <SenpouController>());
        }



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

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

        JyosyuHeiryoku jyosyuHei    = new JyosyuHeiryoku();
        float          addJyosyuHei = (float)jyosyuHei.GetJyosyuHeiryoku(busyoId.ToString());

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

        string[] KahouStatusArray = kahouSts.getKahouForStatus(busyoId.ToString(), adjHp, adjAtk, adjDfc, spd);

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

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

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


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

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayerEng";
        }
        else
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayer";
        }
        GameObject dtl = Instantiate(Resources.Load(dtlPath)) as GameObject;

        dtl.transform.SetParent(prefab.transform);
        dtl.transform.localPosition = new Vector3(0, 1.3f, -1);
        dtl.transform.localScale    = new Vector3(1.3f, 1.3f, 0);
        dtl.name = "BusyoDtlPlayer";

        //Name
        GameObject nameLabel = dtl.transform.FindChild("NameLabel").gameObject;

        nameLabel.GetComponent <TextMesh> ().text = busyoName;


        //Location by map id
        if (mapId == 1)
        {
            prefab.transform.position = new Vector2(-65, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 2)
        {
            prefab.transform.position = new Vector2(-50, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 3)
        {
            prefab.transform.position = new Vector2(-35, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 4)
        {
            prefab.transform.position = new Vector2(-20, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 5)
        {
            prefab.transform.position = new Vector2(-5, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 6)
        {
            prefab.transform.position = new Vector2(-65, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 7)
        {
            prefab.transform.position = new Vector2(-50, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 8)
        {
            prefab.transform.position = new Vector2(-35, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 9)
        {
            prefab.transform.position = new Vector2(-20, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 10)
        {
            prefab.transform.position = new Vector2(-5, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 11)
        {
            prefab.transform.position = new Vector2(-65, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 12)
        {
            prefab.transform.position = new Vector2(-50, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 13)
        {
            prefab.transform.position = new Vector2(-35, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 14)
        {
            prefab.transform.position = new Vector2(-20, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 15)
        {
            prefab.transform.position = new Vector2(-5, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 16)
        {
            prefab.transform.position = new Vector2(-65, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 17)
        {
            prefab.transform.position = new Vector2(-50, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 18)
        {
            prefab.transform.position = new Vector2(-35, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 19)
        {
            prefab.transform.position = new Vector2(-20, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 20)
        {
            prefab.transform.position = new Vector2(-5, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 21)
        {
            prefab.transform.position = new Vector2(-65, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }
        else if (mapId == 22)
        {
            prefab.transform.position = new Vector2(-50, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }
        else if (mapId == 23)
        {
            prefab.transform.position = new Vector2(-45, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }
        else if (mapId == 24)
        {
            prefab.transform.position = new Vector2(-20, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }
        else if (mapId == 25)
        {
            prefab.transform.position = new Vector2(-5, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }

        //Add Senryoku
        string key = "addSenryokuSlot" + mapId;

        if (PlayerPrefs.HasKey(key))
        {
            string        atkDfc          = PlayerPrefs.GetString(key);
            List <string> atkDfcList      = new List <string> ();
            char[]        delimiterChars2 = { ',' };
            atkDfcList = new List <string> (atkDfc.Split(delimiterChars2));
            adjAtk     = adjAtk + int.Parse(atkDfcList [0]);
            adjDfc     = adjDfc + int.Parse(atkDfcList [1]);
        }


        //HP Status
        int        adjHpWithKahou = adjHp + int.Parse(KahouStatusArray[1]) + Mathf.FloorToInt(addHpByKanni);
        GameObject minHpBar       = dtl.transform.FindChild("MinHpBar").gameObject;

        minHpBar.GetComponent <BusyoHPBar>().initLife = adjHpWithKahou;
        prefab.GetComponent <PlayerHP> ().life        = adjHpWithKahou + addJyosyuHei;


        //spd adjust
        float adjSpd = ((float)spd + float.Parse(KahouStatusArray[3])) / 10;

        prefab.GetComponent <UnitMover> ().heisyu = heisyu;
        if (prefab.GetComponent <PlayerAttack> ())
        {
            prefab.GetComponent <PlayerAttack> ().attack = adjAtk + int.Parse(KahouStatusArray[0]) + Mathf.FloorToInt(addAtkByKanni);
            prefab.GetComponent <UnitMover>().speed      = adjSpd;
        }
        else
        {
            if (heisyu == "TP")
            {
                prefab.GetComponent <AttackLong> ().attack = 5 * (adjAtk + int.Parse(KahouStatusArray [0]) + Mathf.FloorToInt(addAtkByKanni));
            }
            else if (heisyu == "YM")
            {
                prefab.GetComponent <AttackLong> ().attack = 3 * (adjAtk + int.Parse(KahouStatusArray [0]) + Mathf.FloorToInt(addAtkByKanni));
            }
            prefab.GetComponent <UnitMover> ().speed = adjSpd;
        }

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



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

        //SE
        AudioController audio = new AudioController();

        audio.addComponentMoveAttack(prefab, heisyu);


        /*Child Instantiate*/
        //set child object
        string heiId           = "hei" + busyoId.ToString();
        string chParam         = "";
        bool   tutorialDoneFlg = PlayerPrefs.GetBool("tutorialDoneFlg");

        if (!tutorialDoneFlg || Application.loadedLevelName != "tutorialKassen")
        {
            chParam = PlayerPrefs.GetString(heiId, "0");
        }
        else
        {
            //retry tutorial
            if (busyoId == 19)
            {
                chParam = "TP:2:1:1";
            }
            else
            {
                StatusGet statusScript  = new StatusGet();
                string    chParamHeisyu = statusScript.getHeisyu(busyoId);
                chParam = chParamHeisyu + ":1:1:1";
            }
        }

        if (chParam == "0")
        {
            StatusGet statusScript  = new StatusGet();
            string    chParamHeisyu = statusScript.getHeisyu(busyoId);
            chParam = chParamHeisyu + ":1:1:1";
            PlayerPrefs.SetString(heiId, chParam);
            PlayerPrefs.Flush();
        }


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

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

        ch_status = ch_status * 10;

        string ch_path = "Prefabs/Player/" + ch_type;

        float y1 = 3.0f;
        float y2 = 3.0f;
        float y3 = 3.0f;
        float y4 = 3.0f;

        for (int i = 1; i <= ch_num; i++)
        {
            //Make Relationship
            GameObject ch_prefab = Instantiate(Resources.Load(ch_path)) as GameObject;
            ch_prefab.transform.parent = prefab.transform;
            ch_prefab.name             = "Child" + i.ToString();

            //Sashimono Making
            string     sashimono_path = "Prefabs/Sashimono/" + busyoId;
            GameObject sashimono      = Instantiate(Resources.Load(sashimono_path)) as GameObject;
            sashimono.transform.parent     = ch_prefab.transform;
            sashimono.transform.localScale = new Vector2(0.3f, 0.3f);


            if (ch_type == "YR")
            {
                sashimono.transform.localPosition = new Vector2(-1, 0.6f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 3, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 6, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 9, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 12, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "KB")
            {
                sashimono.transform.localPosition = new Vector2(-0.5f, 1);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "TP")
            {
                sashimono.transform.localPosition = new Vector2(-0.8f, 0.5f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "YM")
            {
                sashimono.transform.localPosition = new Vector2(-0.8f, 0.5f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }



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

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

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

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

                //Dfc
                prefab.GetComponent <PlayerHP> ().dfc = prefab.GetComponent <PlayerHP> ().dfc + (ch_num * atkDfc);
                prefab.GetComponent <Heisyu> ().dfc   = atkDfc;
            }
        }
    }
Beispiel #14
0
    public void OnClick()
    {
        if (Application.loadedLevelName != "tutorialHyojyo")
        {
            //Get Senryoku
            Senryoku Senryoku = null;
            foreach (Transform child in transform)
            {
                Senryoku = child.GetComponent <Senryoku>();
                busyoId  = int.Parse(child.name);
            }
            BusyoInfoGet BusyoInfoGet = new BusyoInfoGet();
            busyoName = BusyoInfoGet.getName(busyoId);
            hp        = Senryoku.totalHp;
            atk       = Senryoku.totalAtk;
            dfc       = Senryoku.totalDfc;
            spd       = Senryoku.totalSpd;
            daimyoId  = Senryoku.belongDaimyoId;
            lv        = Senryoku.lv;
            chQty     = Senryoku.chQty;
            heisyu    = BusyoInfoGet.getHeisyu(busyoId);
            sakuId    = BusyoInfoGet.getSakuId(busyoId);


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

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

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

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

            //Busyo Icon
            string     busyoPath = "Prefabs/Player/Unit/BusyoUnit";
            GameObject busyo     = Instantiate(Resources.Load(busyoPath)) as GameObject;
            busyo.name = busyoId.ToString();
            busyo.transform.SetParent(pop.transform);
            busyo.transform.localScale = new Vector2(7, 7);
            busyo.GetComponent <DragHandler>().enabled = false;
            RectTransform busyoRect = busyo.GetComponent <RectTransform>();
            busyoRect.anchoredPosition3D = new Vector3(180, 400, 0);
            busyoRect.sizeDelta          = new Vector2(40, 40);
            busyo.transform.FindChild("Text").GetComponent <Text>().enabled = false;

            //Ship Rank
            string     shipPath = "Prefabs/Busyo/ShipSts";
            GameObject ShipObj  = Instantiate(Resources.Load(shipPath)) as GameObject;
            ShipObj.transform.SetParent(busyo.transform);
            preKaisen kaisenScript = new preKaisen();
            int       shipId       = kaisenScript.getShipSprite(ShipObj, busyoId);
            ShipObj.transform.localPosition = new Vector3(-10, -15, 0);
            ShipObj.transform.localScale    = new Vector2(0.2f, 0.2f);
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                if (shipId == 1)
                {
                    ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "High";
                }
                else if (shipId == 2)
                {
                    ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Mid";
                }
                else if (shipId == 3)
                {
                    ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Low";
                }
            }
            else
            {
                if (shipId == 1)
                {
                    ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "上";
                }
                else if (shipId == 2)
                {
                    ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "中";
                }
                else if (shipId == 3)
                {
                    ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "下";
                }
            }

            //Name
            pop.transform.FindChild("busyoNameValue").GetComponent <Text>().text = busyoName;
            pop.transform.FindChild("lvValue").GetComponent <Text>().text        = lv.ToString();
            string  heisyuName = "";
            Message msg        = new Message();
            if (heisyu == "YR")
            {
                heisyuName = msg.getMessage(56);
            }
            else if (heisyu == "KB")
            {
                heisyuName = msg.getMessage(55);
            }
            else if (heisyu == "YM")
            {
                heisyuName = msg.getMessage(58);
            }
            else if (heisyu == "TP")
            {
                heisyuName = msg.getMessage(57);
            }
            pop.transform.FindChild("childNameValue").GetComponent <Text>().text = heisyuName;
            pop.transform.FindChild("childNum").GetComponent <Text>().text       = chQty.ToString();
            pop.transform.FindChild("hpValue").GetComponent <Text>().text        = hp.ToString();
            pop.transform.FindChild("atkValue").GetComponent <Text>().text       = atk.ToString();
            pop.transform.FindChild("dfcValue").GetComponent <Text>().text       = dfc.ToString();
            pop.transform.FindChild("spdValue").GetComponent <Text>().text       = spd.ToString();

            //Senpou
            StatusGet sts          = new StatusGet();
            ArrayList senpouArray  = sts.getOriginalSenpou(busyoId, false);
            int       senpouId     = (int)senpouArray[0];
            string    senpouTyp    = senpouArray[1].ToString();
            string    senpouName   = senpouArray[2].ToString();
            string    senpouExp    = senpouArray[3].ToString();
            float     senpouEach   = (float)senpouArray[4];
            float     senpouRatio  = (float)senpouArray[5];
            float     senpouTerm   = (float)senpouArray[6];
            int       senpouStatus = (int)senpouArray[7];
            int       senpouLv     = (int)senpouArray[8];

            //Kahou Adjustment
            KahouStatusGet kahouSts         = new KahouStatusGet();
            string[]       KahouSenpouArray = kahouSts.getKahouForSenpou(busyoId.ToString(), senpouStatus);
            string         kahouTyp         = KahouSenpouArray[0];
            string         adjSenpouStatus  = senpouStatus.ToString();
            if (kahouTyp != null)
            {
                if (kahouTyp == "Attack")
                {
                    int kahouStatus = int.Parse(KahouSenpouArray[1]);
                    adjSenpouStatus = adjSenpouStatus + "<color=#35d74bFF>(+" + kahouStatus.ToString() + ")</color>";
                }
                else
                {
                    Debug.Log("Not Yet except for Attack");
                }
            }
            //Explanation Modification
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                senpouExp = senpouExp.Replace("ABC", adjSenpouStatus);
                senpouExp = senpouExp.Replace("DEF", senpouEach.ToString());
                senpouExp = senpouExp.Replace("GHI", senpouRatio.ToString());
                senpouExp = senpouExp.Replace("JKL", senpouTerm.ToString());
            }
            else
            {
                senpouExp = senpouExp.Replace("A", adjSenpouStatus);
                senpouExp = senpouExp.Replace("B", senpouEach.ToString());
                senpouExp = senpouExp.Replace("C", senpouRatio.ToString());
                senpouExp = senpouExp.Replace("D", senpouTerm.ToString());
            }

            //Fill fields by got Senpou Value
            pop.transform.FindChild("senpouNameValue").GetComponent <Text>().text = senpouName;
            pop.transform.FindChild("senpouExpValue").GetComponent <Text>().text  = senpouExp;
            pop.transform.FindChild("senpouLvValue").GetComponent <Text>().text   = senpouLv.ToString();


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

            string     sakuPath = "Prefabs/Saku/saku" + sakuList[0];
            GameObject sakuIcon = Instantiate(Resources.Load(sakuPath)) as GameObject;
            foreach (Transform n in pop.transform)
            {
                if (n.tag == "Saku")
                {
                    GameObject.Destroy(n.gameObject);
                }
            }
            sakuIcon.transform.SetParent(pop.transform);
            sakuIcon.transform.localScale            = new Vector2(0.5f, 0.5f);
            sakuIcon.GetComponent <Button>().enabled = false;
            RectTransform sakuIcon_transform = sakuIcon.GetComponent <RectTransform>();
            sakuIcon_transform.anchoredPosition = new Vector3(-220, -185, 0);
            sakuIcon_transform.transform.SetSiblingIndex(30);
            pop.transform.FindChild("sakuExpValue").GetComponent <Text>().text = sakuList[2];
            pop.transform.FindChild("sakuLvValue").GetComponent <Text>().text  = sakuList[3];

            //adjust
            if (Application.loadedLevelName == "preKaisen")
            {
                foreach (Transform chld in pop.transform)
                {
                    if (chld.GetComponent <ReplaceSpriteNameRank>())
                    {
                        string busyoImagePath = "Prefabs/Player/Sprite/unit" + busyoId;
                        chld.GetComponent <Image>().sprite =
                            Resources.Load(busyoImagePath, typeof(Sprite)) as Sprite;
                    }
                }
            }
        }
    }
Beispiel #15
0
    public void GetPlayerSenryoku(string busyoId)
    {
        //Parent
        int lv = PlayerPrefs.GetInt (busyoId);
        StatusGet sts = new StatusGet ();
        int hp = sts.getHp (int.Parse (busyoId), lv);
        int atk = sts.getAtk (int.Parse (busyoId), lv);
        int dfc = sts.getDfc (int.Parse (busyoId), lv);
        int spd = sts.getSpd (int.Parse (busyoId), lv);

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

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

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

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

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

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

            }
        }

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

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

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

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

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

        //Set value
        totalHp = totalBusyoHp + totalChldHp;
        totalAtk = totalBusyoAtk + totalChldAtk;
        totalDfc = totalBusyoDfc + totalChldDfc;
    }
Beispiel #16
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();
        audioSources [0].Play();

        /*Scene Change*/
        GameObject.Find("GameScene").GetComponent <SoukoScene> ().currentTab = "KahouScene";

        /*button color change*/
        Color pushedTabColor  = new Color(118f / 255f, 103f / 255f, 16f / 255f, 255f / 255f);
        Color pushedTextColor = new Color(219f / 255f, 219f / 255f, 212f / 255f, 255f / 255f);
        Color normalTabColor  = new Color(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
        Color normalTextColor = new Color(255f / 255f, 255f / 255f, 0f / 255f, 255f / 255f);

        //Clear Color
        GameObject kahou = GameObject.Find("Kahou");
        GameObject dougu = GameObject.Find("Dougu");

        kahou.GetComponent <Image> ().color = pushedTabColor;
        dougu.GetComponent <Image> ().color = normalTabColor;

        kahou.transform.FindChild("Text").GetComponent <Text> ().color = pushedTextColor;
        dougu.transform.FindChild("Text").GetComponent <Text> ().color = normalTextColor;

        /*Initialize Kahou View*/
        GameObject itemView = GameObject.Find("ItemView");

        itemView.transform.FindChild("GetMoney").GetComponent <Image>().enabled = false;
        GameObject sellBtn = GameObject.Find("SellButton");

        sellBtn.GetComponent <Image>().enabled  = false;
        sellBtn.GetComponent <Button>().enabled = false;
        sellBtn.transform.FindChild("Text").GetComponent <Text>().enabled            = false;
        itemView.transform.FindChild("KahouEffectValue").GetComponent <Text> ().text = "";
        itemView.transform.FindChild("KahouEffectLabel").GetComponent <Text> ().text = "";
        GameObject.Find("GetMoneyValue").GetComponent <Text> ().text = "";
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            itemView.transform.FindChild("ItemNameValue").GetComponent <Text> ().text = "Select Item";
        }
        else
        {
            itemView.transform.FindChild("ItemNameValue").GetComponent <Text>().text = "家宝選択";
        }

        GameObject.Find("Background").GetComponent <Image>().enabled = false;
        GameObject.Find("Fill").GetComponent <Image>().enabled       = false;
        GameObject.Find("Handle").GetComponent <Image>().enabled     = false;
        GameObject.Find("SellQty").GetComponent <Image>().enabled    = false;
        GameObject.Find("SellQtyValue").GetComponent <Text>().text   = "";
        GameObject.Find("DouguExpValue").GetComponent <Text>().text  = "";


        foreach (Transform n in itemView.transform)
        {
            if (n.tag == "Kahou")
            {
                GameObject.Destroy(n.gameObject);
            }
        }
        string     defaultIconPath = "Prefabs/Item/Kahou/NoKabuto";
        GameObject defIcon         = Instantiate(Resources.Load(defaultIconPath)) as GameObject;

        defIcon.transform.SetParent(itemView.transform);
        defIcon.transform.localScale = new Vector2(1, 1);
        RectTransform defTransform = defIcon.GetComponent <RectTransform> ();

        defTransform.anchoredPosition3D          = new Vector3(0, 120, 0);
        defIcon.GetComponent <Button> ().enabled = false;

        /*avairable Kaho*/
        //Clear Previous Data
        GameObject content = GameObject.Find("Content");

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

        //Common Prametor
        char[]         delimiterChars = { ',' };
        KahouStatusGet kahouStatus    = new KahouStatusGet();

        //availableBugu
        string availableBuguString = PlayerPrefs.GetString("availableBugu");

        if (availableBuguString != null && availableBuguString != "")
        {
            string[] availableBugu_list = availableBuguString.Split(delimiterChars);

            for (int i = 0; i < availableBugu_list.Length; i++)
            {
                string     kahouId       = availableBugu_list[i];
                string     kahouTyp      = "bugu";
                string     kahouTypId    = kahouTyp + kahouId;
                string     kahouIconPath = "Prefabs/Item/Kahou/" + kahouTypId;
                GameObject kahouIcon     = Instantiate(Resources.Load(kahouIconPath)) as GameObject;
                kahouIcon.transform.SetParent(content.transform);
                kahouIcon.transform.localScale    = new Vector2(1, 1);
                kahouIcon.transform.localPosition = new Vector3(0, 0, 0);

                //Kahou Status
                List <string> kahouInfoList = new List <string> ();
                kahouInfoList = kahouStatus.getKahouInfo(kahouTyp, int.Parse(kahouId));
                kahouIcon.GetComponent <KahouInfo>().kahouId     = int.Parse(kahouId);
                kahouIcon.GetComponent <KahouInfo>().kahouType   = kahouTyp;
                kahouIcon.GetComponent <KahouInfo>().kahouName   = kahouInfoList[0];
                kahouIcon.GetComponent <KahouInfo>().kahouTarget = kahouInfoList[2];
                kahouIcon.GetComponent <KahouInfo>().kahouEffect = int.Parse(kahouInfoList[3]);
                kahouIcon.GetComponent <KahouInfo>().kahouUnit   = kahouInfoList[4];
                kahouIcon.GetComponent <KahouInfo>().kahouSell   = int.Parse(kahouInfoList[6]);
                kahouIcon.name = kahouTypId;
            }
        }

        //availableKabuto
        string availableKabutoString = PlayerPrefs.GetString("availableKabuto");

        if (availableKabutoString != null && availableKabutoString != "")
        {
            string[] availableKabuto_list = availableKabutoString.Split(delimiterChars);

            for (int i = 0; i < availableKabuto_list.Length; i++)
            {
                string     kahouId       = availableKabuto_list[i];
                string     kahouTyp      = "kabuto";
                string     kahouTypId    = kahouTyp + kahouId;
                string     kahouIconPath = "Prefabs/Item/Kahou/" + kahouTypId;
                GameObject kahouIcon     = Instantiate(Resources.Load(kahouIconPath)) as GameObject;
                kahouIcon.transform.SetParent(content.transform);
                kahouIcon.transform.localScale    = new Vector2(1, 1);
                kahouIcon.transform.localPosition = new Vector3(0, 0, 0);

                //Kahou Status
                List <string> kahouInfoList = new List <string> ();
                kahouInfoList = kahouStatus.getKahouInfo(kahouTyp, int.Parse(kahouId));
                kahouIcon.GetComponent <KahouInfo>().kahouId     = int.Parse(kahouId);
                kahouIcon.GetComponent <KahouInfo>().kahouType   = kahouTyp;
                kahouIcon.GetComponent <KahouInfo>().kahouName   = kahouInfoList[0];
                kahouIcon.GetComponent <KahouInfo>().kahouTarget = kahouInfoList[2];
                kahouIcon.GetComponent <KahouInfo>().kahouEffect = int.Parse(kahouInfoList[3]);
                kahouIcon.GetComponent <KahouInfo>().kahouUnit   = kahouInfoList[4];
                kahouIcon.GetComponent <KahouInfo>().kahouSell   = int.Parse(kahouInfoList[6]);
                kahouIcon.name = kahouTypId;
            }
        }

        //availableGusoku
        string availableGusokuString = PlayerPrefs.GetString("availableGusoku");

        if (availableGusokuString != null && availableGusokuString != "")
        {
            string[] availableGusoku_list = availableGusokuString.Split(delimiterChars);

            for (int i = 0; i < availableGusoku_list.Length; i++)
            {
                string     kahouId       = availableGusoku_list[i];
                string     kahouTyp      = "gusoku";
                string     kahouTypId    = kahouTyp + kahouId;
                string     kahouIconPath = "Prefabs/Item/Kahou/" + kahouTypId;
                GameObject kahouIcon     = Instantiate(Resources.Load(kahouIconPath)) as GameObject;
                kahouIcon.transform.SetParent(content.transform);
                kahouIcon.transform.localScale    = new Vector2(1, 1);
                kahouIcon.transform.localPosition = new Vector3(0, 0, 0);

                //Kahou Status
                List <string> kahouInfoList = new List <string> ();
                kahouInfoList = kahouStatus.getKahouInfo(kahouTyp, int.Parse(kahouId));
                kahouIcon.GetComponent <KahouInfo>().kahouId     = int.Parse(kahouId);
                kahouIcon.GetComponent <KahouInfo>().kahouType   = kahouTyp;
                kahouIcon.GetComponent <KahouInfo>().kahouName   = kahouInfoList[0];
                kahouIcon.GetComponent <KahouInfo>().kahouTarget = kahouInfoList[2];
                kahouIcon.GetComponent <KahouInfo>().kahouEffect = int.Parse(kahouInfoList[3]);
                kahouIcon.GetComponent <KahouInfo>().kahouUnit   = kahouInfoList[4];
                kahouIcon.GetComponent <KahouInfo>().kahouSell   = int.Parse(kahouInfoList[6]);
                kahouIcon.name = kahouTypId;
            }
        }

        //availableMeiba
        string availableMeibaString = PlayerPrefs.GetString("availableMeiba");

        if (availableMeibaString != null && availableMeibaString != "")
        {
            string[] availableMeiba_list = availableMeibaString.Split(delimiterChars);

            for (int i = 0; i < availableMeiba_list.Length; i++)
            {
                string     kahouId       = availableMeiba_list[i];
                string     kahouTyp      = "meiba";
                string     kahouTypId    = kahouTyp + kahouId;
                string     kahouIconPath = "Prefabs/Item/Kahou/" + kahouTypId;
                GameObject kahouIcon     = Instantiate(Resources.Load(kahouIconPath)) as GameObject;
                kahouIcon.transform.SetParent(content.transform);
                kahouIcon.transform.localScale    = new Vector2(1, 1);
                kahouIcon.transform.localPosition = new Vector3(0, 0, 0);

                //Kahou Status
                List <string> kahouInfoList = new List <string> ();
                kahouInfoList = kahouStatus.getKahouInfo(kahouTyp, int.Parse(kahouId));
                kahouIcon.GetComponent <KahouInfo>().kahouId     = int.Parse(kahouId);
                kahouIcon.GetComponent <KahouInfo>().kahouType   = kahouTyp;
                kahouIcon.GetComponent <KahouInfo>().kahouName   = kahouInfoList[0];
                kahouIcon.GetComponent <KahouInfo>().kahouTarget = kahouInfoList[2];
                kahouIcon.GetComponent <KahouInfo>().kahouEffect = int.Parse(kahouInfoList[3]);
                kahouIcon.GetComponent <KahouInfo>().kahouUnit   = kahouInfoList[4];
                kahouIcon.GetComponent <KahouInfo>().kahouSell   = int.Parse(kahouInfoList[6]);
                kahouIcon.name = kahouTypId;
            }
        }

        //availableCyadougu
        string availableCyadouguString = PlayerPrefs.GetString("availableCyadougu");

        if (availableCyadouguString != null && availableCyadouguString != "")
        {
            string[] availableCyadougu_list = availableCyadouguString.Split(delimiterChars);

            for (int i = 0; i < availableCyadougu_list.Length; i++)
            {
                string     kahouId       = availableCyadougu_list[i];
                string     kahouTyp      = "cyadougu";
                string     kahouTypId    = kahouTyp + kahouId;
                string     kahouIconPath = "Prefabs/Item/Kahou/" + kahouTypId;
                GameObject kahouIcon     = Instantiate(Resources.Load(kahouIconPath)) as GameObject;
                kahouIcon.transform.SetParent(content.transform);
                kahouIcon.transform.localScale    = new Vector2(1, 1);
                kahouIcon.transform.localPosition = new Vector3(0, 0, 0);

                //Kahou Status
                List <string> kahouInfoList = new List <string> ();
                kahouInfoList = kahouStatus.getKahouInfo(kahouTyp, int.Parse(kahouId));
                kahouIcon.GetComponent <KahouInfo>().kahouId     = int.Parse(kahouId);
                kahouIcon.GetComponent <KahouInfo>().kahouType   = kahouTyp;
                kahouIcon.GetComponent <KahouInfo>().kahouName   = kahouInfoList[0];
                kahouIcon.GetComponent <KahouInfo>().kahouTarget = kahouInfoList[2];
                kahouIcon.GetComponent <KahouInfo>().kahouEffect = int.Parse(kahouInfoList[3]);
                kahouIcon.GetComponent <KahouInfo>().kahouUnit   = kahouInfoList[4];
                kahouIcon.GetComponent <KahouInfo>().kahouSell   = int.Parse(kahouInfoList[6]);
                kahouIcon.name = kahouTypId;
            }
        }

        //availableHeihousyo
        string availableHeihousyoString = PlayerPrefs.GetString("availableHeihousyo");

        if (availableHeihousyoString != null && availableHeihousyoString != "")
        {
            string[] availableHeihousyo_list = availableHeihousyoString.Split(delimiterChars);

            for (int i = 0; i < availableHeihousyo_list.Length; i++)
            {
                string     kahouId       = availableHeihousyo_list[i];
                string     kahouTyp      = "heihousyo";
                string     kahouTypId    = kahouTyp + kahouId;
                string     kahouIconPath = "Prefabs/Item/Kahou/" + kahouTypId;
                GameObject kahouIcon     = Instantiate(Resources.Load(kahouIconPath)) as GameObject;
                kahouIcon.transform.SetParent(content.transform);
                kahouIcon.transform.localScale    = new Vector2(1, 1);
                kahouIcon.transform.localPosition = new Vector3(0, 0, 0);

                //Kahou Status
                List <string> kahouInfoList = new List <string> ();
                kahouInfoList = kahouStatus.getKahouInfo(kahouTyp, int.Parse(kahouId));
                kahouIcon.GetComponent <KahouInfo>().kahouId     = int.Parse(kahouId);
                kahouIcon.GetComponent <KahouInfo>().kahouType   = kahouTyp;
                kahouIcon.GetComponent <KahouInfo>().kahouName   = kahouInfoList[0];
                kahouIcon.GetComponent <KahouInfo>().kahouTarget = kahouInfoList[2];
                kahouIcon.GetComponent <KahouInfo>().kahouEffect = int.Parse(kahouInfoList[3]);
                kahouIcon.GetComponent <KahouInfo>().kahouUnit   = kahouInfoList[4];
                kahouIcon.GetComponent <KahouInfo>().kahouSell   = int.Parse(kahouInfoList[6]);
                kahouIcon.name = kahouTypId;
            }
        }

        //availableChishikisyo
        string availableChishikisyoString = PlayerPrefs.GetString("availableChishikisyo");

        if (availableChishikisyoString != null && availableChishikisyoString != "")
        {
            string[] availableChishikisyo_list = availableChishikisyoString.Split(delimiterChars);

            for (int i = 0; i < availableChishikisyo_list.Length; i++)
            {
                string     kahouId       = availableChishikisyo_list[i];
                string     kahouTyp      = "chishikisyo";
                string     kahouTypId    = kahouTyp + kahouId;
                string     kahouIconPath = "Prefabs/Item/Kahou/" + kahouTypId;
                GameObject kahouIcon     = Instantiate(Resources.Load(kahouIconPath)) as GameObject;
                kahouIcon.transform.SetParent(content.transform);
                kahouIcon.transform.localScale    = new Vector2(1, 1);
                kahouIcon.transform.localPosition = new Vector3(0, 0, 0);

                //Kahou Status
                List <string> kahouInfoList = new List <string> ();
                kahouInfoList = kahouStatus.getKahouInfo(kahouTyp, int.Parse(kahouId));
                kahouIcon.GetComponent <KahouInfo>().kahouId     = int.Parse(kahouId);
                kahouIcon.GetComponent <KahouInfo>().kahouType   = kahouTyp;
                kahouIcon.GetComponent <KahouInfo>().kahouName   = kahouInfoList[0];
                kahouIcon.GetComponent <KahouInfo>().kahouTarget = kahouInfoList[2];
                kahouIcon.GetComponent <KahouInfo>().kahouEffect = int.Parse(kahouInfoList[3]);
                kahouIcon.GetComponent <KahouInfo>().kahouUnit   = kahouInfoList[4];
                kahouIcon.GetComponent <KahouInfo>().kahouSell   = int.Parse(kahouInfoList[6]);
                kahouIcon.name = kahouTypId;
            }
        }
    }
Beispiel #17
0
    public void createSenpouStatusView(string busyoId)
    {
        StatusGet sts         = new StatusGet();
        ArrayList senpouArray = sts.getOriginalSenpou(int.Parse(busyoId), false);

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

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

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

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

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


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

        if (senpouLv < 20)
        {
            btn.GetComponent <Image> ().color = OKClorBtn;
            btn.transform.FindChild("Text").GetComponent <Text> ().color = OKClorTxt;
            btn.GetComponent <Button>().enabled = true;
        }
        else
        {
            btn.GetComponent <Image> ().color = NGClorBtn;
            btn.transform.FindChild("Text").GetComponent <Text> ().color = NGClorTxt;
            btn.GetComponent <Button>().enabled = false;
        }
    }
Beispiel #18
0
	public void OnClick(){

		if (Application.loadedLevelName == "souko") {
			//Souko Scene
			GameObject.Find ("GetMoney").GetComponent<Image> ().enabled = true;
			GameObject sellBtn = GameObject.Find ("SellButton");
			sellBtn.GetComponent<Image> ().enabled = true;
			sellBtn.GetComponent<Button> ().enabled = true;
			sellBtn.transform.FindChild ("Text").GetComponent<Text> ().enabled = true;

			GameObject.Find ("ItemNameValue").GetComponent<Text> ().text = kahouName;
			GameObject.Find ("KahouEffectLabel").GetComponent<Text> ().text = kahouTarget;
			string effect = "+" + kahouEffect + kahouUnit;
			GameObject.Find ("KahouEffectValue").GetComponent<Text> ().text = effect;
			string sell = "+" + kahouSell;
			GameObject.Find ("GetMoneyValue").GetComponent<Text> ().text = sell;

			//Delete Previous Icon
			GameObject itemView = GameObject.Find ("ItemView");
			foreach (Transform n in itemView.transform) {
				if (n.tag == "Kahou") {
					GameObject.Destroy (n.gameObject);
				}
			}
			string kahouIconPath = "Prefabs/Item/Kahou/" + name;
			GameObject kahouIcon = Instantiate (Resources.Load (kahouIconPath)) as GameObject;
			kahouIcon.transform.SetParent (itemView.transform);
			kahouIcon.transform.localScale = new Vector2 (1, 1);
			RectTransform kahouTransform = kahouIcon.GetComponent<RectTransform> ();
			kahouTransform.anchoredPosition3D = new Vector3 (0, 120, 0);

			kahouIcon.GetComponent<Button> ().enabled = false;

			//Sell Button Set
			sellBtn.GetComponent<DoSell> ().kahouId = kahouId;
			sellBtn.GetComponent<DoSell> ().kahouName = kahouName;
			sellBtn.GetComponent<DoSell> ().kahouType = kahouType;
			sellBtn.GetComponent<DoSell> ().kahouSell = kahouSell;


		} else if (Application.loadedLevelName == "busyo") {
			//Busyo Kahou Scene

			GameObject mainController = GameObject.Find ("GameScene");

			mainController.GetComponent<NowOnButton> ().onKahouButton = this.transform.parent.gameObject.name;

			/*Board with Current Kahou Info*/
			//Back Cover
			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);

			//Popup Screen
			string popupPath = "Prefabs/Busyo/equipedKahouBoard";
			GameObject popup = Instantiate (Resources.Load (popupPath)) as GameObject;
			popup.transform.SetParent (GameObject.Find ("Panel").transform);
			popup.transform.localScale = new Vector2 (1, 1);
			RectTransform popupTransform = popup.GetComponent<RectTransform> ();
			popupTransform.anchoredPosition3D = new Vector3 (0, 0, 0);

			//Get Kahou Data
			if (kahouType == "bugu") {
				Entity_kahou_bugu_mst Mst = Resources.Load ("Data/kahou_bugu_mst") as Entity_kahou_bugu_mst;
				kahouName = Mst.param [kahouId - 1].kahouName;
				kahouTarget = Mst.param [kahouId - 1].kahouTarget;
				kahouEffect = Mst.param [kahouId - 1].kahouEffect;	
				kahouUnit = Mst.param [kahouId - 1].unit;
				kahouExp = Mst.param [kahouId - 1].kahouExp;

			} else if (kahouType == "kabuto") {
				Entity_kahou_kabuto_mst Mst = Resources.Load ("Data/kahou_kabuto_mst") as Entity_kahou_kabuto_mst;
				kahouName = Mst.param [kahouId - 1].kahouName;
				kahouTarget = Mst.param [kahouId - 1].kahouTarget;
				kahouEffect = Mst.param [kahouId - 1].kahouEffect;	
				kahouUnit = Mst.param [kahouId - 1].unit;
				kahouExp = Mst.param [kahouId - 1].kahouExp;

			} else if (kahouType == "gusoku") {
				Entity_kahou_gusoku_mst Mst = Resources.Load ("Data/kahou_gusoku_mst") as Entity_kahou_gusoku_mst;
				kahouName = Mst.param [kahouId - 1].kahouName;
				kahouTarget = Mst.param [kahouId - 1].kahouTarget;
				kahouEffect = Mst.param [kahouId - 1].kahouEffect;	
				kahouUnit = Mst.param [kahouId - 1].unit;
				kahouExp = Mst.param [kahouId - 1].kahouExp;

			} else if (kahouType == "meiba") {
				Entity_kahou_meiba_mst Mst = Resources.Load ("Data/kahou_meiba_mst") as Entity_kahou_meiba_mst;
				kahouName = Mst.param [kahouId - 1].kahouName;
				kahouTarget = Mst.param [kahouId - 1].kahouTarget;
				kahouEffect = Mst.param [kahouId - 1].kahouEffect;	
				kahouUnit = Mst.param [kahouId - 1].unit;
				kahouExp = Mst.param [kahouId - 1].kahouExp;

			} else if (kahouType == "cyadougu") {
				Entity_kahou_cyadougu_mst Mst = Resources.Load ("Data/kahou_cyadougu_mst") as Entity_kahou_cyadougu_mst;
				kahouName = Mst.param [kahouId - 1].kahouName;
				kahouTarget = Mst.param [kahouId - 1].kahouTarget;
				kahouEffect = Mst.param [kahouId - 1].kahouEffect;	
				kahouUnit = Mst.param [kahouId - 1].unit;
				kahouExp = Mst.param [kahouId - 1].kahouExp;

			} else if (kahouType == "heihousyo") {
				Entity_kahou_heihousyo_mst Mst = Resources.Load ("Data/kahou_heihousyo_mst") as Entity_kahou_heihousyo_mst;
				kahouName = Mst.param [kahouId - 1].kahouName;
				kahouTarget = Mst.param [kahouId - 1].kahouTarget;
				kahouEffect = Mst.param [kahouId - 1].kahouEffect;	
				kahouUnit = Mst.param [kahouId - 1].unit;
				kahouExp = Mst.param [kahouId - 1].kahouExp;

			} else if (kahouType == "chishikisyo") {
				Entity_kahou_chishikisyo_mst Mst = Resources.Load ("Data/kahou_chishikisyo_mst") as Entity_kahou_chishikisyo_mst;
				kahouName = Mst.param [kahouId - 1].kahouName;
				kahouTarget = Mst.param [kahouId - 1].kahouTarget;
				kahouEffect = Mst.param [kahouId - 1].kahouEffect;	
				kahouUnit = Mst.param [kahouId - 1].unit;
				kahouExp = Mst.param [kahouId - 1].kahouExp;

			}		

			//Refrect Kahou info.
			GameObject.Find ("equipedKahouName").GetComponent<Text> ().text = kahouName;
			GameObject.Find ("equipedKahouEffectLabel").GetComponent<Text> ().text = kahouTarget;
			GameObject.Find ("equipedKahouEffectValue").GetComponent<Text> ().text = "+" + kahouEffect + kahouUnit;
			GameObject.Find ("equipedKahouExpValue").GetComponent<Text> ().text = kahouExp;
			string kahouTypId = kahouType + kahouId;
			string kahouPath = "Prefabs/Item/Kahou/" + kahouTypId;
			GameObject kahou = Instantiate (Resources.Load (kahouPath)) as GameObject;
			kahou.transform.SetParent (GameObject.Find ("equipedKahouBoard(Clone)").transform);

			kahou.transform.localScale = new Vector3 (1.5f, 1.5f, 0);
			RectTransform kahouTransform = kahou.GetComponent<RectTransform> ();
			kahouTransform.anchoredPosition3D = new Vector3 (-360, 0, 0);

			kahou.GetComponent<Button> ().enabled = false;

			//Send Param Delete Button
			GameObject.Find ("DeleteButton").GetComponent<DeleteKahou> ().kahouType = kahouType;
			GameObject.Find ("DeleteButton").GetComponent<DeleteKahou> ().kahouId = kahouId;


		} else if (Application.loadedLevelName == "zukan") {

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

			//Get Data
			string kahouTypId = kahouType + kahouId.ToString();
			string kahouIconPath = "Prefabs/Item/Kahou/" + kahouTypId;
			GameObject kahouIcon = Instantiate (Resources.Load (kahouIconPath)) as GameObject;
			kahouIcon.transform.SetParent(pop.transform);
			kahouIcon.transform.localScale = new Vector2 (1.5f, 1.5f);
			RectTransform rectIcon = kahouIcon.GetComponent<RectTransform>();
			rectIcon.anchoredPosition3D = new Vector3(-130,90,0);
			kahouIcon.GetComponent<Button>().enabled = false;

			KahouStatusGet kahou = new KahouStatusGet();
			List<string> kahouInfoList = new List<string> ();
			kahouInfoList = kahou.getKahouInfo(kahouType,kahouId);

			GameObject.Find("kahouNameValue").GetComponent<Text>().text = kahouInfoList[0];
			string kahouTypeName = "";
			if(kahouType=="bugu"){
				kahouTypeName = "武具";
			}else if(kahouType=="gusoku"){
				kahouTypeName = "具足";
			}else if(kahouType=="kabuto"){
				kahouTypeName = "兜";
			}else if(kahouType=="meiba"){
				kahouTypeName = "名馬";
			}else if(kahouType=="cyadougu"){
				kahouTypeName = "茶道具";
			}else if(kahouType=="chishikisyo"){
				kahouTypeName = "知識書";
			}else if(kahouType=="heihousyo"){
				kahouTypeName = "兵法書";		
			}
			GameObject.Find("kahouTypValue").GetComponent<Text>().text = kahouTypeName;
			GameObject.Find("EffectTitle").GetComponent<Text>().text = kahouInfoList[2];
			string effect = "+" + kahouInfoList[3] + kahouInfoList[4];
			GameObject.Find("EffectValue").GetComponent<Text>().text = effect;
			GameObject.Find("ExpValue").GetComponent<Text>().text = kahouInfoList[1];
			
		}
	}
Beispiel #19
0
    public void OnClick()
    {
        /*Scene Change*/
        GameObject.Find ("GameScene").GetComponent<SoukoScene> ().currentTab = "KahouScene";

        /*button color change*/
        Color pushedTabColor = new Color (118f / 255f, 103f / 255f, 16f / 255f, 255f / 255f);
        Color pushedTextColor = new Color (219f / 255f, 219f / 255f, 212f / 255f, 255f / 255f);
        Color normalTabColor = new Color (255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
        Color normalTextColor = new Color (255f / 255f, 255f / 255f, 0f / 255f, 255f / 255f);

        //Clear Color
        GameObject kahou = GameObject.Find ("Kahou");
        GameObject dougu = GameObject.Find ("Dougu");

        kahou.GetComponent<Image> ().color = pushedTabColor;
        dougu.GetComponent<Image> ().color = normalTabColor;

        kahou.transform.FindChild ("Text").GetComponent<Text> ().color = pushedTextColor;
        dougu.transform.FindChild ("Text").GetComponent<Text> ().color = normalTextColor;

        /*Initialize Kahou View*/
        GameObject itemView = GameObject.Find ("ItemView");
        itemView.transform.FindChild ("GetMoney").GetComponent<Image>().enabled = false;
        GameObject sellBtn = GameObject.Find ("SellButton");
        sellBtn.GetComponent<Image>().enabled = false;
        sellBtn.GetComponent<Button>().enabled = false;
        sellBtn.transform.FindChild("Text").GetComponent<Text>().enabled = false;
        itemView.transform.FindChild ("KahouEffectValue").GetComponent<Text> ().text = "";
        itemView.transform.FindChild ("KahouEffectLabel").GetComponent<Text> ().text = "";
        GameObject.Find ("GetMoneyValue").GetComponent<Text> ().text = "";
        itemView.transform.FindChild ("ItemNameValue").GetComponent<Text> ().text = "家宝選択";

        GameObject.Find ("Background").GetComponent<Image>().enabled = false;
        GameObject.Find ("Fill").GetComponent<Image>().enabled = false;
        GameObject.Find ("Handle").GetComponent<Image>().enabled = false;
        GameObject.Find ("SellQty").GetComponent<Image>().enabled = false;
        GameObject.Find ("SellQtyValue").GetComponent<Text>().text = "";
        GameObject.Find ("DouguExpValue").GetComponent<Text>().text = "";

        foreach ( Transform n in itemView.transform ){
            if(n.tag == "Kahou"){
                GameObject.Destroy(n.gameObject);
            }
        }
        string defaultIconPath = "Prefabs/Item/Kahou/NoKabuto";
        GameObject defIcon = Instantiate (Resources.Load (defaultIconPath)) as GameObject;
        defIcon.transform.SetParent(itemView.transform);
        defIcon.transform.localScale = new Vector2 (1, 1);
        RectTransform defTransform = defIcon.GetComponent<RectTransform> ();
        defTransform.anchoredPosition = new Vector3 (0, 120, 0);
        defIcon.GetComponent<Button> ().enabled = false;

        /*avairable Kaho*/
        //Clear Previous Data
        GameObject content = GameObject.Find ("Content");
        foreach ( Transform n in content.transform ){
            GameObject.Destroy(n.gameObject);
        }

        //Common Prametor
        char[] delimiterChars = {','};
        KahouStatusGet kahouStatus = new KahouStatusGet ();

        //availableBugu
        string availableBuguString = PlayerPrefs.GetString("availableBugu");
        if(availableBuguString != null && availableBuguString !=""){
            string[] availableBugu_list = availableBuguString.Split (delimiterChars);

            for(int i=0; i<availableBugu_list.Length; i++){
                string kahouId = availableBugu_list[i];
                string kahouTyp = "bugu";
                string kahouTypId = kahouTyp + kahouId;
                string kahouIconPath = "Prefabs/Item/Kahou/" + kahouTypId;
                GameObject kahouIcon = Instantiate (Resources.Load (kahouIconPath)) as GameObject;
                kahouIcon.transform.SetParent(content.transform);
                kahouIcon.transform.localScale = new Vector2 (1, 1);

                //Kahou Status
                List<string> kahouInfoList = new List<string> ();
                kahouInfoList = kahouStatus.getKahouInfo(kahouTyp,int.Parse(kahouId));
                kahouIcon.GetComponent<KahouInfo>().kahouId = int.Parse(kahouId);
                kahouIcon.GetComponent<KahouInfo>().kahouType = kahouTyp;
                kahouIcon.GetComponent<KahouInfo>().kahouName = kahouInfoList[0];
                kahouIcon.GetComponent<KahouInfo>().kahouTarget = kahouInfoList[2];
                kahouIcon.GetComponent<KahouInfo>().kahouEffect = int.Parse(kahouInfoList[3]);
                kahouIcon.GetComponent<KahouInfo>().kahouUnit = kahouInfoList[4];
                kahouIcon.GetComponent<KahouInfo>().kahouSell = int.Parse(kahouInfoList[6]);
                kahouIcon.name = kahouTypId;
            }
        }

        //availableKabuto
        string availableKabutoString = PlayerPrefs.GetString("availableKabuto");
        if(availableKabutoString != null && availableKabutoString !=""){
            string[] availableKabuto_list = availableKabutoString.Split (delimiterChars);

            for(int i=0; i<availableKabuto_list.Length; i++){
                string kahouId = availableKabuto_list[i];
                string kahouTyp = "kabuto";
                string kahouTypId = kahouTyp + kahouId;
                string kahouIconPath = "Prefabs/Item/Kahou/" + kahouTypId;
                GameObject kahouIcon = Instantiate (Resources.Load (kahouIconPath)) as GameObject;
                kahouIcon.transform.SetParent(content.transform);
                kahouIcon.transform.localScale = new Vector2 (1, 1);

                //Kahou Status
                List<string> kahouInfoList = new List<string> ();
                kahouInfoList = kahouStatus.getKahouInfo(kahouTyp,int.Parse(kahouId));
                kahouIcon.GetComponent<KahouInfo>().kahouId = int.Parse(kahouId);
                kahouIcon.GetComponent<KahouInfo>().kahouType = kahouTyp;
                kahouIcon.GetComponent<KahouInfo>().kahouName = kahouInfoList[0];
                kahouIcon.GetComponent<KahouInfo>().kahouTarget = kahouInfoList[2];
                kahouIcon.GetComponent<KahouInfo>().kahouEffect = int.Parse(kahouInfoList[3]);
                kahouIcon.GetComponent<KahouInfo>().kahouUnit = kahouInfoList[4];
                kahouIcon.GetComponent<KahouInfo>().kahouSell = int.Parse(kahouInfoList[6]);
                kahouIcon.name = kahouTypId;
            }
        }

        //availableGusoku
        string availableGusokuString = PlayerPrefs.GetString("availableGusoku");
        if(availableGusokuString != null && availableGusokuString !=""){
            string[] availableGusoku_list = availableGusokuString.Split (delimiterChars);

            for(int i=0; i<availableGusoku_list.Length; i++){
                string kahouId = availableGusoku_list[i];
                string kahouTyp = "gusoku";
                string kahouTypId = kahouTyp + kahouId;
                string kahouIconPath = "Prefabs/Item/Kahou/" + kahouTypId;
                GameObject kahouIcon = Instantiate (Resources.Load (kahouIconPath)) as GameObject;
                kahouIcon.transform.SetParent(content.transform);
                kahouIcon.transform.localScale = new Vector2 (1, 1);

                //Kahou Status
                List<string> kahouInfoList = new List<string> ();
                kahouInfoList = kahouStatus.getKahouInfo(kahouTyp,int.Parse(kahouId));
                kahouIcon.GetComponent<KahouInfo>().kahouId = int.Parse(kahouId);
                kahouIcon.GetComponent<KahouInfo>().kahouType = kahouTyp;
                kahouIcon.GetComponent<KahouInfo>().kahouName = kahouInfoList[0];
                kahouIcon.GetComponent<KahouInfo>().kahouTarget = kahouInfoList[2];
                kahouIcon.GetComponent<KahouInfo>().kahouEffect = int.Parse(kahouInfoList[3]);
                kahouIcon.GetComponent<KahouInfo>().kahouUnit = kahouInfoList[4];
                kahouIcon.GetComponent<KahouInfo>().kahouSell = int.Parse(kahouInfoList[6]);
                kahouIcon.name = kahouTypId;

            }
        }

        //availableMeiba
        string availableMeibaString = PlayerPrefs.GetString("availableMeiba");
        if(availableMeibaString != null && availableMeibaString !=""){
            string[] availableMeiba_list = availableMeibaString.Split (delimiterChars);

            for(int i=0; i<availableMeiba_list.Length; i++){
                string kahouId = availableMeiba_list[i];
                string kahouTyp = "meiba";
                string kahouTypId = kahouTyp + kahouId;
                string kahouIconPath = "Prefabs/Item/Kahou/" + kahouTypId;
                GameObject kahouIcon = Instantiate (Resources.Load (kahouIconPath)) as GameObject;
                kahouIcon.transform.SetParent(content.transform);
                kahouIcon.transform.localScale = new Vector2 (1, 1);

                //Kahou Status
                List<string> kahouInfoList = new List<string> ();
                kahouInfoList = kahouStatus.getKahouInfo(kahouTyp,int.Parse(kahouId));
                kahouIcon.GetComponent<KahouInfo>().kahouId = int.Parse(kahouId);
                kahouIcon.GetComponent<KahouInfo>().kahouType = kahouTyp;
                kahouIcon.GetComponent<KahouInfo>().kahouName = kahouInfoList[0];
                kahouIcon.GetComponent<KahouInfo>().kahouTarget = kahouInfoList[2];
                kahouIcon.GetComponent<KahouInfo>().kahouEffect = int.Parse(kahouInfoList[3]);
                kahouIcon.GetComponent<KahouInfo>().kahouUnit = kahouInfoList[4];
                kahouIcon.GetComponent<KahouInfo>().kahouSell = int.Parse(kahouInfoList[6]);
                kahouIcon.name = kahouTypId;

            }
        }

        //availableCyadougu
        string availableCyadouguString = PlayerPrefs.GetString("availableCyadougu");
        if(availableCyadouguString != null && availableCyadouguString !=""){
            string[] availableCyadougu_list = availableCyadouguString.Split (delimiterChars);

            for(int i=0; i<availableCyadougu_list.Length; i++){
                string kahouId = availableCyadougu_list[i];
                string kahouTyp = "cyadougu";
                string kahouTypId = kahouTyp + kahouId;
                string kahouIconPath = "Prefabs/Item/Kahou/" + kahouTypId;
                GameObject kahouIcon = Instantiate (Resources.Load (kahouIconPath)) as GameObject;
                kahouIcon.transform.SetParent(content.transform);
                kahouIcon.transform.localScale = new Vector2 (1, 1);

                //Kahou Status
                List<string> kahouInfoList = new List<string> ();
                kahouInfoList = kahouStatus.getKahouInfo(kahouTyp,int.Parse(kahouId));
                kahouIcon.GetComponent<KahouInfo>().kahouId = int.Parse(kahouId);
                kahouIcon.GetComponent<KahouInfo>().kahouType = kahouTyp;
                kahouIcon.GetComponent<KahouInfo>().kahouName = kahouInfoList[0];
                kahouIcon.GetComponent<KahouInfo>().kahouTarget = kahouInfoList[2];
                kahouIcon.GetComponent<KahouInfo>().kahouEffect = int.Parse(kahouInfoList[3]);
                kahouIcon.GetComponent<KahouInfo>().kahouUnit = kahouInfoList[4];
                kahouIcon.GetComponent<KahouInfo>().kahouSell = int.Parse(kahouInfoList[6]);
                kahouIcon.name = kahouTypId;

            }
        }

        //availableHeihousyo
        string availableHeihousyoString = PlayerPrefs.GetString("availableHeihousyo");
        if(availableHeihousyoString != null && availableHeihousyoString !=""){
            string[] availableHeihousyo_list = availableHeihousyoString.Split (delimiterChars);

            for(int i=0; i<availableHeihousyo_list.Length; i++){
                string kahouId = availableHeihousyo_list[i];
                string kahouTyp = "heihousyo";
                string kahouTypId = kahouTyp + kahouId;
                string kahouIconPath = "Prefabs/Item/Kahou/" + kahouTypId;
                GameObject kahouIcon = Instantiate (Resources.Load (kahouIconPath)) as GameObject;
                kahouIcon.transform.SetParent(content.transform);
                kahouIcon.transform.localScale = new Vector2 (1, 1);

                //Kahou Status
                List<string> kahouInfoList = new List<string> ();
                kahouInfoList = kahouStatus.getKahouInfo(kahouTyp,int.Parse(kahouId));
                kahouIcon.GetComponent<KahouInfo>().kahouId = int.Parse(kahouId);
                kahouIcon.GetComponent<KahouInfo>().kahouType = kahouTyp;
                kahouIcon.GetComponent<KahouInfo>().kahouName = kahouInfoList[0];
                kahouIcon.GetComponent<KahouInfo>().kahouTarget = kahouInfoList[2];
                kahouIcon.GetComponent<KahouInfo>().kahouEffect = int.Parse(kahouInfoList[3]);
                kahouIcon.GetComponent<KahouInfo>().kahouUnit = kahouInfoList[4];
                kahouIcon.GetComponent<KahouInfo>().kahouSell = int.Parse(kahouInfoList[6]);
                kahouIcon.name = kahouTypId;

            }
        }

        //availableChishikisyo
        string availableChishikisyoString = PlayerPrefs.GetString("availableChishikisyo");
        if(availableChishikisyoString != null && availableChishikisyoString !=""){
            string[] availableChishikisyo_list = availableChishikisyoString.Split (delimiterChars);

            for(int i=0; i<availableChishikisyo_list.Length; i++){
                string kahouId = availableChishikisyo_list[i];
                string kahouTyp = "chishikisyo";
                string kahouTypId = kahouTyp + kahouId;
                string kahouIconPath = "Prefabs/Item/Kahou/" + kahouTypId;
                GameObject kahouIcon = Instantiate (Resources.Load (kahouIconPath)) as GameObject;
                kahouIcon.transform.SetParent(content.transform);
                kahouIcon.transform.localScale = new Vector2 (1, 1);

                //Kahou Status
                List<string> kahouInfoList = new List<string> ();
                kahouInfoList = kahouStatus.getKahouInfo(kahouTyp,int.Parse(kahouId));
                kahouIcon.GetComponent<KahouInfo>().kahouId = int.Parse(kahouId);
                kahouIcon.GetComponent<KahouInfo>().kahouType = kahouTyp;
                kahouIcon.GetComponent<KahouInfo>().kahouName = kahouInfoList[0];
                kahouIcon.GetComponent<KahouInfo>().kahouTarget = kahouInfoList[2];
                kahouIcon.GetComponent<KahouInfo>().kahouEffect = int.Parse(kahouInfoList[3]);
                kahouIcon.GetComponent<KahouInfo>().kahouUnit = kahouInfoList[4];
                kahouIcon.GetComponent<KahouInfo>().kahouSell = int.Parse(kahouInfoList[6]);
                kahouIcon.name = kahouTypId;

            }
        }
    }
Beispiel #20
0
    public void makeSimplePlayer(int busyoId, bool soudaisyoFlg, GameObject battleArea, int xAdjust, GameObject YesBtn)
    {
        string     path   = "Prefabs/Player/" + busyoId;
        GameObject prefab = Instantiate(Resources.Load(path)) as GameObject;

        prefab.name = busyoId.ToString();
        prefab.transform.SetParent(battleArea.transform);
        prefab.transform.localScale = new Vector2(0.4f, 0.6f);
        prefab.GetComponent <SpriteRenderer>().sortingLayerName = "UI";
        prefab.GetComponent <SpriteRenderer>().sortingOrder     = 350;
        if (soudaisyoFlg)
        {
            prefab.transform.localPosition = new Vector2(1.0f, 1.8f);
        }
        else
        {
            float xAdjust2 = (float)xAdjust / 20;
            prefab.transform.localPosition = new Vector2(3 - xAdjust2, 1.8f);
        }
        prefab.GetComponent <Rigidbody2D>().gravityScale = 1;

        //Set Scirpt
        Destroy(prefab.GetComponent <PlayerHP>());
        Destroy(prefab.GetComponent <SenpouController>());
        Destroy(prefab.GetComponent <UnitMover>());
        Destroy(prefab.GetComponent <Kunkou>());
        Destroy(prefab.GetComponent <LineLocation>());
        if (prefab.GetComponent <AttackLong>())
        {
            Destroy(prefab.GetComponent <AttackLong>());
        }
        else
        {
            Destroy(prefab.GetComponent <PlayerAttack>());
        }
        Destroy(prefab.GetComponent <PlayerHP>());
        prefab.AddComponent <SimpleAttack>();
        prefab.AddComponent <SimpleHP>();
        prefab.AddComponent <Homing>();

        prefab.GetComponent <Homing>().enabled = false;

        YesBtn.GetComponent <StartSimpleKassen>().busyoObjList.Add(prefab);

        //Parametor
        string    busyoString = busyoId.ToString();
        int       lv          = PlayerPrefs.GetInt(busyoString);
        StatusGet sts         = new StatusGet();
        int       hp          = 100 * sts.getHp(busyoId, lv);
        int       atk         = 10 * sts.getAtk(busyoId, lv);
        int       dfc         = 10 * sts.getDfc(busyoId, lv);
        float     spd         = sts.getSpd(busyoId, lv);

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

        KahouStatusGet kahouSts = new KahouStatusGet();

        string[] KahouStatusArray = kahouSts.getKahouForStatus(busyoId.ToString(), hp, atk, dfc, (int)spd);
        string   kanniTmp         = "kanni" + busyoId;
        float    addAtkByKanni    = 0;
        float    addHpByKanni     = 0;
        float    addDfcByKanni    = 0;

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

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

        atk = atk + int.Parse(KahouStatusArray[0]) + Mathf.FloorToInt(addAtkByKanni);
        hp  = hp + int.Parse(KahouStatusArray[1]) + Mathf.FloorToInt(addHpByKanni) + addJyosyuHei;
        dfc = dfc + int.Parse(KahouStatusArray[2]) + Mathf.FloorToInt(addDfcByKanni);


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

        if (chParam == "0" || chParam == "")
        {
            StatusGet statusScript = new StatusGet();
            string    heisyu       = statusScript.getHeisyu(busyoId);
            chParam = heisyu + ":1:1:1";
            PlayerPrefs.SetString(heiId, chParam);
            PlayerPrefs.Flush();
        }

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

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

            ch_status = ch_status * 10;
            int atkDfc = (int)sts.getChAtkDfc(ch_status, hp);

            totalChldHp  = ch_status * chQty;
            totalChldAtk = atkDfc * chQty;
            totalChldDfc = atkDfc * chQty;

            //Set value
            hp  = hp + totalChldHp;
            atk = atk + totalChldAtk;
            dfc = dfc + totalChldDfc;
        }


        prefab.GetComponent <Homing>().speed         = spd / 20;
        prefab.GetComponent <SimpleAttack>().atk     = atk;
        prefab.GetComponent <SimpleHP>().dfc         = dfc;
        prefab.GetComponent <SimpleAttack>().baseAtk = atk;
        prefab.GetComponent <SimpleHP>().baseDfc     = dfc;
        prefab.GetComponent <SimpleHP>().life        = hp;

        //check
        int myDaimyoBusyo = PlayerPrefs.GetInt("myDaimyoBusyo");

        if (busyoId == myDaimyoBusyo)
        {
            myDaimyoBusyoFlg = true;
        }
    }
Beispiel #21
0
    public void createBusyoStatusView(string busyoId)
    {
        int lv = PlayerPrefs.GetInt (busyoId);
        StatusGet sts = new StatusGet ();
        int hp = sts.getHp (int.Parse (busyoId), lv);
        int atk = sts.getAtk (int.Parse (busyoId), lv);
        int dfc = sts.getDfc (int.Parse (busyoId), lv);
        int spd = sts.getSpd (int.Parse (busyoId), lv);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        //Parametor Setting
        GameObject.Find ("GameScene").GetComponent<NowOnBusyo>().OnBusyo = busyoId;
    }
Beispiel #22
0
	public void createBusyoStatusView(string busyoId){
		int lv = PlayerPrefs.GetInt (busyoId);
		StatusGet sts = new StatusGet ();
		int hp = sts.getHp (int.Parse (busyoId), lv);
		int atk = sts.getAtk (int.Parse (busyoId), lv);
		int dfc = sts.getDfc (int.Parse (busyoId), lv);
		int spd = sts.getSpd (int.Parse (busyoId), lv);
		
		int adjHp = hp * 100;
		int adjAtk = atk * 10;
		int adjDfc = dfc * 10;
		
		GameObject.Find ("LvValue").GetComponent<Text> ().text = lv.ToString ();
		GameObject.Find ("TosotsuValue").GetComponent<Text> ().text = adjHp.ToString ();
		GameObject.Find ("BuyuuValue").GetComponent<Text> ().text = adjAtk.ToString ();
		GameObject.Find ("ChiryakuValue").GetComponent<Text> ().text = adjDfc.ToString ();
		GameObject.Find ("SpeedValue").GetComponent<Text> ().text = spd.ToString ();

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

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


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


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

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

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

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

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

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

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




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

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


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

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


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



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

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

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

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

        /*Busyo View*/
        //Delete Previous
        foreach (Transform n in GameObject.Find("BusyoView").transform)
        {
            GameObject.Destroy(n.gameObject);
        }
        //Jinkei Flg
        if (jinkeiFlg)
        {
            string     iconPath = "Prefabs/Busyo/Jinkei";
            GameObject jinkei   = Instantiate(Resources.Load(iconPath)) as GameObject;
            jinkei.transform.SetParent(GameObject.Find("BusyoView").transform);
            jinkei.transform.localScale    = new Vector2(0.3f, 0.3f);
            jinkei.transform.localPosition = new Vector2(220, 200);
            jinkei.name = "jinkei";
        }

        //Make New Busyo
        string busyoId;

        busyoId = this.name.Remove(0, 4);
        string     path  = "Prefabs/Player/Unit/BusyoUnit";
        GameObject Busyo = Instantiate(Resources.Load(path)) as GameObject;

        Busyo.name = busyoId.ToString();
        Busyo.transform.SetParent(GameObject.Find("BusyoView").transform);
        Busyo.transform.localScale = new Vector2(4, 4);
        Busyo.GetComponent <DragHandler> ().enabled = false;

        RectTransform rect_transform = Busyo.GetComponent <RectTransform>();

        rect_transform.anchoredPosition3D = new Vector3(300, 200, 0);
        rect_transform.sizeDelta          = new Vector2(100, 100);

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

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

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

        text.GetComponent <Text> ().color = new Color(255, 255, 255, 255);
        RectTransform text_transform = text.GetComponent <RectTransform>();

        text_transform.anchoredPosition3D = new Vector3(-70, 30, 0);
        text_transform.sizeDelta          = new Vector2(630, 120);
        text.transform.localScale         = new Vector2(0.2f, 0.2f);

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

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


        /*Busyo Status*/
        NowOnBusyo   NowOnBusyoScript   = GameObject.Find("GameScene").GetComponent <NowOnBusyo> ();
        BusyoInfoGet busyoInfoGetScript = new BusyoInfoGet();

        if (GameObject.Find("GameScene").GetComponent <NowOnButton> ().onButton == "Ronkou")
        {
            int       lv  = PlayerPrefs.GetInt(busyoId);
            StatusGet sts = new StatusGet();
            int       hp  = sts.getHp(int.Parse(busyoId), lv);
            int       atk = sts.getAtk(int.Parse(busyoId), lv);
            int       dfc = sts.getDfc(int.Parse(busyoId), lv);
            int       spd = sts.getSpd(int.Parse(busyoId), lv);

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

            //add lv
            string addLvTmp = "addlv" + busyoId.ToString();
            if (PlayerPrefs.HasKey(addLvTmp))
            {
                string addLvValue = "+" + PlayerPrefs.GetString(addLvTmp);
                GameObject.Find("addLvValue").GetComponent <Text>().text = addLvValue.ToString();
            }
            else
            {
                GameObject.Find("addLvValue").GetComponent <Text>().text = "";
            }
            int maxLv = 100 + PlayerPrefs.GetInt(addLvTmp);

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

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


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

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


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

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

                    //Status
                    string kanniTarget = kanni.getEffectTarget(kanniId);
                    int    effect      = kanni.getEffect(kanniId);
                    if (kanniTarget == "atk")
                    {
                        addAtkByKanni = ((float)adjAtk * (float)effect) / 100;
                    }
                    else if (kanniTarget == "hp")
                    {
                        addHpByKanni = ((float)adjHp * (float)effect) / 100;
                    }
                    else if (kanniTarget == "dfc")
                    {
                        addDfcByKanni = ((float)adjDfc * (float)effect) / 100;
                    }
                }
                else
                {
                    if (Application.systemLanguage != SystemLanguage.Japanese)
                    {
                        GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text>().text = "No Rank";
                    }
                    else
                    {
                        GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text>().text = "官位無し";
                    }
                }
            }
            else
            {
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text> ().text = "No Rank";
                }
                else
                {
                    GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text>().text = "官位無し";
                }
            }

            //Jyosyu
            string jyosyuTmp = "jyosyuBusyo" + busyoId;
            if (PlayerPrefs.HasKey(jyosyuTmp))
            {
                int      kuniId   = PlayerPrefs.GetInt(jyosyuTmp);
                KuniInfo kuni     = new KuniInfo();
                string   kuniName = kuni.getKuniName(kuniId);
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text> ().text = kuniName + "\nLord";
                }
                else
                {
                    GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text>().text = kuniName + "\n城主";
                }
            }
            else
            {
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text>().text = "No Feud";
                }
                else
                {
                    GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text>().text = "城無し";
                }
            }

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

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

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

            if (chParam == "0" || chParam == "")
            {
                StatusGet statusScript = new StatusGet();
                string    heisyu       = statusScript.getHeisyu(int.Parse(busyoId));
                chParam = heisyu + ":1:1:1";
                PlayerPrefs.SetString(heiId, chParam);
                PlayerPrefs.Flush();
            }


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

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

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

                GameObject.Find("ChildNameValue").GetComponent <Text> ().text = heisyu;
                GameObject.Find("ChildQtyValue").GetComponent <Text> ().text  = ch_num.ToString();
                GameObject.Find("ChildLvValue").GetComponent <Text> ().text   = ch_lv.ToString();

                //Jyosyu Handling
                JyosyuHeiryoku jyosyuHei = new JyosyuHeiryoku();
                float          addHei    = (float)jyosyuHei.GetJyosyuHeiryoku(busyoId);
                float          hei       = ch_status * 10;
                GameObject.Find("ChildHeiryokuValue").GetComponent <Text>().text = hei.ToString();
                float newHei = finalHp + addHei;
                GameObject.Find("KahouHpValue").GetComponent <Text>().text = "+" + newHei.ToString();

                int    chAtkDfc       = (int)sts.getChAtkDfc((int)hei, totalBusyoHp);
                string chAtkDfcString = chAtkDfc.ToString() + "/" + chAtkDfc.ToString();
                GameObject.Find("ChildStatusValue").GetComponent <Text> ().text = chAtkDfcString;


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


                GameObject chigyo = GameObject.Find("ButtonCyouhei");
                if (ch_num < 20)
                {
                    chigyo.GetComponent <Image> ().color = OKClorBtn;
                    chigyo.transform.FindChild("Text").GetComponent <Text> ().color = OKClorTxt;
                    chigyo.GetComponent <Button>().enabled = true;

                    chigyo.GetComponent <BusyoStatusButton> ().ch_type   = ch_type;
                    chigyo.GetComponent <BusyoStatusButton> ().ch_heisyu = heisyu;
                    chigyo.GetComponent <BusyoStatusButton> ().ch_num    = ch_num;
                    chigyo.GetComponent <BusyoStatusButton> ().ch_status = chAtkDfc;
                    chigyo.GetComponent <BusyoStatusButton> ().ch_hp     = hei;
                    chigyo.GetComponent <BusyoStatusButton> ().pa_hp     = totalBusyoHp / 100;
                }
                else
                {
                    //MAX
                    chigyo.GetComponent <Image> ().color = NGClorBtn;
                    chigyo.transform.FindChild("Text").GetComponent <Text> ().color = NGClorTxt;
                    chigyo.GetComponent <Button>().enabled = false;
                }
                GameObject kunren = GameObject.Find("ButtonKunren");
                if (ch_lv < 100)
                {
                    kunren.GetComponent <Image> ().color = OKClorBtn;
                    kunren.transform.FindChild("Text").GetComponent <Text> ().color = OKClorTxt;
                    kunren.GetComponent <Button>().enabled = true;

                    kunren.GetComponent <BusyoStatusButton> ().ch_type   = ch_type;
                    kunren.GetComponent <BusyoStatusButton> ().ch_heisyu = heisyu;
                    kunren.GetComponent <BusyoStatusButton> ().ch_lv     = ch_lv;
                    kunren.GetComponent <BusyoStatusButton> ().ch_num    = ch_num;
                    kunren.GetComponent <BusyoStatusButton> ().ch_status = chAtkDfc;
                    kunren.GetComponent <BusyoStatusButton> ().ch_hp     = hei;
                    kunren.GetComponent <BusyoStatusButton> ().pa_hp     = totalBusyoHp / 100;
                }
                else
                {
                    //MAX
                    kunren.GetComponent <Image> ().color = NGClorBtn;
                    kunren.transform.FindChild("Text").GetComponent <Text> ().color = NGClorTxt;
                    kunren.GetComponent <Button>().enabled = false;
                }
            }

            //Parametor Setting
            NowOnBusyoScript.OnBusyo     = busyoId;
            NowOnBusyoScript.OnBusyoName = busyoInfoGetScript.getName(int.Parse(busyoId));
        }
        else if (GameObject.Find("GameScene").GetComponent <NowOnButton> ().onButton == "Senpou")
        {
            NowOnBusyoScript.OnBusyo     = busyoId;
            NowOnBusyoScript.OnBusyoName = busyoInfoGetScript.getName(int.Parse(busyoId));
            SenpouScene scene = new SenpouScene();
            scene.createSenpouStatusView(busyoId);
            scene.createSakuStatusView(busyoId);
        }
        else if (GameObject.Find("GameScene").GetComponent <NowOnButton> ().onButton == "Kahou")
        {
            NowOnBusyoScript.OnBusyo     = busyoId;
            NowOnBusyoScript.OnBusyoName = busyoInfoGetScript.getName(int.Parse(busyoId));
            KahouScene kahou = new KahouScene();
            kahou.createKahouStatusView(busyoId);
        }
        else if (GameObject.Find("GameScene").GetComponent <NowOnButton> ().onButton == "Syogu")
        {
            NowOnBusyoScript.OnBusyo     = busyoId;
            NowOnBusyoScript.OnBusyoName = busyoInfoGetScript.getName(int.Parse(busyoId));
            SyoguScene syogu = new SyoguScene();
            syogu.createSyoguView(busyoId);
        }
    }
Beispiel #24
0
    public void makeInstance(int busyoId, int mapId, int hp, int atk, int dfc,int spd, ArrayList senpouArray, string busyoName)
    {
        /*Parent Instantiate*/
        string path = "Prefabs/Player/" + busyoId;
        GameObject prefab = Instantiate(Resources.Load (path)) as GameObject;

        //Senpou Script Parametor
        prefab.GetComponent<SenpouController>().senpouId = (int)senpouArray[0];
        prefab.GetComponent<SenpouController>().senpouTyp = senpouArray[1].ToString();
        prefab.GetComponent<SenpouController>().senpouName = senpouArray[2].ToString();
        prefab.GetComponent<SenpouController>().senpouEach = (float)senpouArray[4];
        prefab.GetComponent<SenpouController>().senpouRatio = (float)senpouArray[5];
        prefab.GetComponent<SenpouController>().senpouTerm = (float)senpouArray[6];
        prefab.GetComponent<SenpouController>().senpouStatus = (int)senpouArray[7];
        prefab.GetComponent<SenpouController>().senpouLv = (int)senpouArray[8];

        /*Player Status Setting*/
        //parametor setting
        int adjHp = hp*100;
        int adjAtk = atk * 10;
        int adjDfc = dfc * 10;
        //Kahou Adjustment
        KahouStatusGet kahouSts = new KahouStatusGet();
        string[] KahouStatusArray =kahouSts.getKahouForStatus (busyoId.ToString(),adjHp,adjAtk,adjDfc,spd);

        //Busyo Detail Info [Name & HP Bar]
        string dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayer";
        GameObject dtl = Instantiate(Resources.Load (dtlPath)) as GameObject;
        dtl.transform.parent = prefab.transform;

        //Name
        GameObject nameLabel = dtl.transform.FindChild("NameLabel").gameObject;
        nameLabel.GetComponent<TextMesh> ().text = busyoName;

        //HP Bar
        GameObject minHpBar = dtl.transform.FindChild("MinHpBar").gameObject;
        minHpBar.GetComponent<BusyoHPBar>().initLife = adjHp + int.Parse(KahouStatusArray[1]);
        //minHpBar.GetComponent<BusyoHPBar>().initLife = hp*100;

        //Location by map id
        if (mapId == 1) {
            prefab.transform.position = new Vector2 (-65, 16);
            prefab.GetComponent<LineLocation>().nowLine = 1;
        } else if (mapId == 2) {
            prefab.transform.position = new Vector2 (-50, 16);
            prefab.GetComponent<LineLocation>().nowLine = 1;
        } else if (mapId == 3) {
            prefab.transform.position = new Vector2 (-35, 16);
            prefab.GetComponent<LineLocation>().nowLine = 1;

        } else if (mapId == 4) {
            prefab.transform.position = new Vector2 (-20, 16);
            prefab.GetComponent<LineLocation>().nowLine = 1;

        } else if (mapId == 5) {
            prefab.transform.position = new Vector2 (-5, 16);
            prefab.GetComponent<LineLocation>().nowLine = 1;

        } else if (mapId == 6) {
            prefab.transform.position = new Vector2 (-65, 8);
            prefab.GetComponent<LineLocation>().nowLine = 2;

        } else if (mapId == 7) {
            prefab.transform.position = new Vector2 (-50, 8);
            prefab.GetComponent<LineLocation>().nowLine = 2;

        } else if (mapId == 8) {
            prefab.transform.position = new Vector2 (-35, 8);
            prefab.GetComponent<LineLocation>().nowLine = 2;

        } else if (mapId == 9) {
            prefab.transform.position = new Vector2 (-20, 8);
            prefab.GetComponent<LineLocation>().nowLine = 2;

        } else if (mapId == 10) {
            prefab.transform.position = new Vector2 (-5, 8);
            prefab.GetComponent<LineLocation>().nowLine = 2;

        } else if (mapId == 11) {
            prefab.transform.position = new Vector2 (-65, 0);
            prefab.GetComponent<LineLocation>().nowLine = 3;

        } else if (mapId == 12) {
            prefab.transform.position = new Vector2 (-50, 0);
            prefab.GetComponent<LineLocation>().nowLine = 3;

        } else if (mapId == 13) {
            prefab.transform.position = new Vector2 (-35, 0);
            prefab.GetComponent<LineLocation>().nowLine = 3;

        } else if (mapId == 14) {
            prefab.transform.position = new Vector2 (-20, 0);
            prefab.GetComponent<LineLocation>().nowLine = 3;

        } else if (mapId == 15) {
            prefab.transform.position = new Vector2 (-5, 0);
            prefab.GetComponent<LineLocation>().nowLine = 3;

        } else if (mapId == 16) {
            prefab.transform.position = new Vector2 (-65, -8);
            prefab.GetComponent<LineLocation>().nowLine = 4;

        } else if (mapId == 17) {
            prefab.transform.position = new Vector2 (-40, -8);
            prefab.GetComponent<LineLocation>().nowLine = 4;

        } else if (mapId == 18) {
            prefab.transform.position = new Vector2 (-35, -8);
            prefab.GetComponent<LineLocation>().nowLine = 4;

        } else if (mapId == 19) {
            prefab.transform.position = new Vector2 (-20, -8);
            prefab.GetComponent<LineLocation>().nowLine = 4;

        } else if (mapId == 20) {
            prefab.transform.position = new Vector2 (-5, -8);
            prefab.GetComponent<LineLocation>().nowLine = 4;

        } else if (mapId == 21) {
            prefab.transform.position = new Vector2 (-65, -16);
            prefab.GetComponent<LineLocation>().nowLine = 5;

        } else if (mapId == 22) {
            prefab.transform.position = new Vector2 (-50, -16);
            prefab.GetComponent<LineLocation>().nowLine = 5;

        } else if (mapId == 23) {
            prefab.transform.position = new Vector2 (-45, -16);
            prefab.GetComponent<LineLocation>().nowLine = 5;

        } else if (mapId == 24) {
            prefab.transform.position = new Vector2 (-20, -16);
            prefab.GetComponent<LineLocation>().nowLine = 5;

        } else if (mapId == 25) {
            prefab.transform.position = new Vector2 (-5, -16);
            prefab.GetComponent<LineLocation>().nowLine = 5;

        }

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

        if (prefab.GetComponent<PlayerAttack> ()) {
            prefab.GetComponent<PlayerAttack> ().attack = adjAtk + int.Parse(KahouStatusArray[0]);
            prefab.GetComponent<Homing> ().speed = spd + int.Parse(KahouStatusArray[3]);
        } else {
            prefab.GetComponent<AttackLong> ().attack =  adjAtk + int.Parse(KahouStatusArray[0]);
            prefab.GetComponent<HomingLong> ().speed = spd + int.Parse(KahouStatusArray[3]);
        }
        prefab.GetComponent<PlayerHP>().dfc = adjDfc + int.Parse(KahouStatusArray[2]);

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

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

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

        string ch_path = "Prefabs/Player/" + ch_type;

        float y1 = 3.0f;
        float y2 = 3.0f;
        float y3 = 3.0f;
        float y4 = 3.0f;

        for(int i = 1; i <= ch_num; i++){
            //Make Relationship
            GameObject ch_prefab = Instantiate(Resources.Load (ch_path)) as GameObject;
            ch_prefab.transform.parent = prefab.transform;
            ch_prefab.name = ch_prefab.name + "_" + prefab.name;

            //Sashimono Making
            string sashimono_path = "Prefabs/Sashimono/" + busyoId;
            GameObject sashimono = Instantiate(Resources.Load (sashimono_path)) as GameObject;
            sashimono.transform.parent = ch_prefab.transform;
            sashimono.transform.localScale = new Vector2(0.3f,0.3f);

            if(ch_type == "YR"){
                sashimono.transform.localPosition = new Vector2(-1,0.6f);
                //Location
                if(i<6){
                    ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 3,prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;

                }else if(5<i && i<11){
                    ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 6,prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;

                }else if(10<i && i<16){
                    ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 9,prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;

                }else if(15<i && i<21){
                    ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 12,prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }else if(ch_type == "KB"){
                sashimono.transform.localPosition = new Vector2(-0.5f,1);
                //Location
                if(i<6){

                    ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 4,prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;

                }else if(5<i && i<11){
                    ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 7,prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;

                }else if(10<i && i<16){
                    ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 10,prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;

                }else if(15<i && i<21){
                    ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 13,prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }else if(ch_type == "TP"){
                sashimono.transform.localPosition = new Vector2(-0.8f,0.5f);
                //Location
                if(i<6){

                    ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 4,prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;

                }else if(5<i && i<11){
                    ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 7,prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;

                }else if(10<i && i<16){
                    ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 10,prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;

                }else if(15<i && i<21){
                    ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 13,prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }else if(ch_type == "YM"){
                sashimono.transform.localPosition = new Vector2(-0.8f,0.5f);
                //Location
                if(i<6){

                    ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 4,prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;

                }else if(5<i && i<11){
                    ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 7,prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;

                }else if(10<i && i<16){
                    ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 10,prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;

                }else if(15<i && i<21){
                    ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 13,prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }

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

            ch_prefab.GetComponent<PlayerHP>().life = addTotalHei;
            if(ch_prefab.GetComponent<PlayerAttack> ()){
                ch_prefab.GetComponent<PlayerAttack> ().attack = ch_status + adjHpWithKahou/200;
            }else{
                ch_prefab.GetComponent<AttackLong> ().attack = ch_status + adjHpWithKahou/200;
            }
            ch_prefab.GetComponent<PlayerHP>().dfc = ch_status + adjHpWithKahou/200;
        }
    }
Beispiel #25
0
    public void OnClick()
    {
        //SE
        audio.PlayOneShot(touch);

        /*Common Process*/
        string pathOfBoard = "Prefabs/Map/Popup";
        GameObject board = Instantiate(Resources.Load (pathOfBoard)) as GameObject;
        board.transform.parent = GameObject.Find ("Map").transform;
        board.transform.localScale = new Vector2 (1,0.8f);
        board.transform.localPosition = new Vector2 (0,0);

        /*Indivisual Process by Kuni*/
        string pathOfKuniMap = "Prefabs/Map/stage/kuniMap" + kuniId;
        GameObject kuniMap = Instantiate(Resources.Load (pathOfKuniMap)) as GameObject;
        GameObject.Find ("kuniName").GetComponent<Text>().text = kuniName;

        //kuni
        kuniMap.transform.parent = GameObject.Find ("board").transform;
        kuniMap.transform.localScale = new Vector2 (9, 6);
        kuniMap.transform.localPosition = new Vector3 (-145,4,0);
        kuniMap.name = "kuniMap" + kuniId;

        //Clear Stage Setting
        string clearedStage = "kuni" + kuniId;
        string clearedStageString = PlayerPrefs.GetString (clearedStage);
        List<string> clearedStageList = new List<string>();
        if (clearedStageString != null && clearedStageString != "") {
            char[] delimiterChars = {','};
            clearedStageList = new List<string>(clearedStageString.Split (delimiterChars));

        }

        //Default Value
        Entity_stage_mst stageMst = Resources.Load ("Data/stage_mst") as Entity_stage_mst;
        int startline = 10 * kuniId - 10;
        string stagePath = "Prefabs/Map/stage/stage";
        string clearedPath = "Prefabs/Map/cleared";

        int stageId = 1;
        bool clearedFlg = false;
        for(int i=startline; i<startline+10; i++){
            GameObject stage = Instantiate (Resources.Load (stagePath)) as GameObject;
            stage.transform.SetParent(kuniMap.transform);
            stage.transform.localScale = new Vector2 (1, 1);
            stage.name = "stage" + stageId.ToString();

            //Cleared Check
            if(clearedStageList.Contains(stageId.ToString()) == true){
                GameObject cleared = Instantiate (Resources.Load (clearedPath)) as GameObject;
                cleared.transform.SetParent(stage.transform);
                cleared.transform.localScale = new Vector2(0.1f,0.15f);
                cleared.transform.localPosition = new Vector2(0,0);
                clearedFlg = true;
            }

            //Get Stage Info
            string stageName = stageMst.param[i].stageName;
            int Exp = stageMst.param[i].exp;
            int Money = stageMst.param[i].money;
            string itemGrp = stageMst.param[i].itemGrp;
            string itemTyp = stageMst.param[i].itemTyp;
            int itemId = stageMst.param[i].itemId;
            int itemQty = stageMst.param[i].itemQty;
            int locationX = stageMst.param[i].LocationX;
            int locationY = stageMst.param[i].LocationY;

            RectTransform stageTransform = stage.GetComponent<RectTransform> ();
            stageTransform.anchoredPosition = new Vector3 (locationX, locationY, 0);

            stage.GetComponent<ShowStageDtl>().kuniId = kuniId;
            stage.GetComponent<ShowStageDtl>().stageId = stageId;
            stage.GetComponent<ShowStageDtl>().stageName = stageName;
            stage.GetComponent<ShowStageDtl>().exp = Exp;
            stage.GetComponent<ShowStageDtl>().money = Money;
            stage.GetComponent<ShowStageDtl>().itemGrp = itemGrp;
            stage.GetComponent<ShowStageDtl>().itemTyp = itemTyp;
            stage.GetComponent<ShowStageDtl>().itemId = itemId.ToString();
            stage.GetComponent<ShowStageDtl>().itemQty = itemQty;

            if(itemGrp=="kahou"){
                KahouStatusGet kahouSts = new KahouStatusGet();
                List<string> kahouInfoList =kahouSts.getKahouInfo(itemTyp, itemId);
                stage.GetComponent<ShowStageDtl>().ratio = float.Parse(kahouInfoList[7]);

            }else if(itemGrp=="item"){
                ItemInfo itemSts = new ItemInfo();
                string temp = itemTyp + itemId.ToString();
                List<string> itemInfoList = itemSts.getItemInfo(temp);
                stage.GetComponent<ShowStageDtl>().ratio = float.Parse(itemInfoList[6]);
            }

            stageId = stageId + 1;
        }

        /*Naisei Button*/
        string naiseiPath = "Prefabs/Map/NaiseiButton";
        GameObject naiseiBtn = Instantiate(Resources.Load (naiseiPath)) as GameObject;
        naiseiBtn.transform.parent = GameObject.Find ("Popup(Clone)").transform;
        naiseiBtn.GetComponent<StartNaisei> ().activeKuniId = kuniId;
        naiseiBtn.GetComponent<StartNaisei> ().activeKuniName = kuniName;
        naiseiBtn.GetComponent<StartNaisei> ().clearedFlg = clearedFlg;
        naiseiBtn.transform.localScale = new Vector2 (0.4f, 0.4f);
        naiseiBtn.transform.localPosition = new Vector2 (-490,-300);

        //Initial Setting
        GameObject firstStage = GameObject.Find ("stage1");
        firstStage.GetComponent<ShowStageDtl> ().OnClick ();
    }
Beispiel #26
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();

        GameObject board           = GameObject.Find("SyouninBoard").gameObject;
        Message    msg             = new Message();
        GameObject actionValue     = GameObject.Find("ActionValue").gameObject;
        int        actionRemainQty = int.Parse(actionValue.GetComponent <Text> ().text);

        char[] delimiterChars = { ',' };

        if (actionRemainQty <= 0)
        {
            audioSources [4].Play();
            msg.makeMessage(msg.getMessage(42));

            serihuChanger(msg.getMessage(43));
        }
        else
        {
            CloseLayer CloseLayerScript = GameObject.Find("CloseSyoukaijyo").GetComponent <CloseLayer>();

            if (name == "Kahou")
            {
                audioSources [0].Play();

                string     path = "Prefabs/Syounin/MenuKahou";
                GameObject menu = Instantiate(Resources.Load(path)) as GameObject;
                menu.transform.SetParent(board.transform);
                menu.transform.localScale    = new Vector2(1, 1);
                menu.transform.localPosition = new Vector2(0, -150);
                menu.transform.FindChild("Close").GetComponent <CloseMenu> ().obj = menu;
                menu.name = "MenuKahou";

                //Product Show
                string        kahouCdString = CloseLayerScript.kahouCdString;
                List <string> kahouCdList   = new List <string> ();
                kahouCdList = new List <string> (kahouCdString.Split(delimiterChars));

                string        kahouIdString = CloseLayerScript.kahouIdString;
                List <string> kahouIdList   = new List <string> ();
                kahouIdList = new List <string> (kahouIdString.Split(delimiterChars));

                GameObject content = menu.transform.FindChild("ScrollView").transform.FindChild("Content").gameObject;
                GameObject money   = menu.transform.FindChild("MoneyValue").gameObject;
                GameObject btn     = menu.transform.FindChild("DoKahouButton").gameObject;

                KahouStatusGet kahouSts = new KahouStatusGet();

                for (int i = 0; i < kahouCdList.Count; i++)
                {
                    string kahouCd   = kahouCdList[i];
                    int    kahouId   = int.Parse(kahouIdList[i]);
                    string kahouCdId = kahouCd + kahouId;

                    string     kahouPath = "Prefabs/Item/Kahou/" + kahouCdId;
                    int        tmp       = i + 1;
                    string     slotName  = "item" + tmp.ToString();
                    GameObject itemSlot  = content.transform.FindChild(slotName).gameObject;
                    itemSlot.GetComponent <SyouninProductSelect>().Content = content;

                    //status
                    List <string> kahouStsList = new List <string> ();
                    kahouStsList = kahouSts.getKahouInfo(kahouCd, kahouId);
                    itemSlot.GetComponent <SyouninProductSelect>().kahouName        = kahouStsList[0];
                    itemSlot.GetComponent <SyouninProductSelect>().kahouEffectLabel = kahouStsList[2];
                    itemSlot.GetComponent <SyouninProductSelect>().kahouEffectValue = kahouStsList[3];
                    float price      = float.Parse(kahouStsList[5]);
                    float discount   = CloseLayerScript.discount;
                    float finalPrice = price * discount;
                    itemSlot.GetComponent <SyouninProductSelect>().price    = Mathf.CeilToInt(finalPrice);
                    itemSlot.GetComponent <SyouninProductSelect>().Money    = money;
                    itemSlot.GetComponent <SyouninProductSelect>().Btn      = btn;
                    itemSlot.GetComponent <SyouninProductSelect>().menuName = name;

                    itemSlot.GetComponent <SyouninProductSelect>().kahouCd = kahouCd;
                    itemSlot.GetComponent <SyouninProductSelect>().kahouId = kahouId;

                    //kahou icon
                    GameObject kahouObj = Instantiate(Resources.Load(kahouPath)) as GameObject;
                    kahouObj.transform.SetParent(itemSlot.transform);
                    kahouObj.transform.localScale            = new Vector2(1, 1);
                    kahouObj.GetComponent <Button>().enabled = false;

                    //Adjust
                    RectTransform rect = kahouObj.transform.FindChild("Rank").GetComponent <RectTransform>();
                    rect.anchoredPosition3D = new Vector3(20, -30, 0);
                    kahouObj.transform.FindChild("Rank").localScale = new Vector3(0.3f, 0.3f, 0);
                }

                //Initial
                content.transform.FindChild("item1").GetComponent <SyouninProductSelect>().OnClick();
                serihuChanger(msg.getMessage(44));
            }
            else if (name == "Busshi")
            {
                audioSources [0].Play();

                string     path = "Prefabs/Syounin/MenuBusshi";
                GameObject menu = Instantiate(Resources.Load(path)) as GameObject;
                menu.transform.SetParent(board.transform);
                menu.transform.localScale    = new Vector2(1, 1);
                menu.transform.localPosition = new Vector2(0, -150);
                menu.transform.FindChild("Close").GetComponent <CloseMenu> ().obj = menu;
                menu.name = "MenuBusshi";

                GameObject content = menu.transform.FindChild("ScrollView").transform.FindChild("Content").gameObject;

                //Prepared Value
                string        busshiQtyString = CloseLayerScript.busshiQtyString;
                List <string> busshiQtyList   = new List <string> ();
                busshiQtyList = new List <string> (busshiQtyString.Split(delimiterChars));

                string        busshiRankString = CloseLayerScript.busshiRankString;
                List <string> busshiRankList   = new List <string> ();
                busshiRankList = new List <string> (busshiRankString.Split(delimiterChars));

                Item  item     = new Item();
                float discount = CloseLayerScript.discount;

                //YR
                string     YRpath = "Prefabs/Item/Cyouhei/CyouheiYR";
                GameObject YRObj  = Instantiate(Resources.Load(YRpath)) as GameObject;
                GameObject item1  = content.transform.FindChild("item1").gameObject;
                YRObj.transform.SetParent(item1.transform);
                YRObj.transform.localScale            = new Vector2(1, 1);
                YRObj.GetComponent <Button>().enabled = false;
                YRObj.transform.FindChild("Qty").GetComponent <Text>().text = busshiQtyList[0];
                YRObj.name = "CyouheiYR";
                RectTransform trn1 = YRObj.transform.FindChild("Qty").GetComponent <RectTransform>();
                trn1.anchoredPosition3D = new Vector3(-30, -40, 0);
                colorByRankChanger(YRObj, busshiRankList[0]);

                string itemCdYR     = YRObj.name + busshiRankList[0];
                float  unitPriceYR  = (float)item.getUnitPrice(itemCdYR);
                float  finalPriceYR = unitPriceYR * discount;
                item1.GetComponent <SyouninProductSelect>().price     = Mathf.CeilToInt(finalPriceYR);
                item1.GetComponent <SyouninProductSelect>().busshiQty = int.Parse(busshiQtyList[0]);
                item1.GetComponent <SyouninProductSelect>().menuName  = name;
                item1.GetComponent <SyouninProductSelect>().busshiCd  = itemCdYR;

                //KB
                string     KBpath = "Prefabs/Item/Cyouhei/CyouheiKB";
                GameObject KBObj  = Instantiate(Resources.Load(KBpath)) as GameObject;
                GameObject item2  = content.transform.FindChild("item2").gameObject;
                KBObj.transform.SetParent(item2.transform);
                KBObj.transform.localScale            = new Vector2(1, 1);
                KBObj.GetComponent <Button>().enabled = false;
                KBObj.transform.FindChild("Qty").GetComponent <Text>().text = busshiQtyList[1];
                KBObj.name = "CyouheiKB";
                RectTransform trn2 = KBObj.transform.FindChild("Qty").GetComponent <RectTransform>();
                trn2.anchoredPosition3D = new Vector3(-30, -40, 0);
                colorByRankChanger(KBObj, busshiRankList[1]);

                string itemCdKB     = KBObj.name + busshiRankList[1];
                float  unitPriceKB  = (float)item.getUnitPrice(itemCdKB);
                float  finalPriceKB = unitPriceKB * discount;
                item2.GetComponent <SyouninProductSelect>().price     = Mathf.CeilToInt(finalPriceKB);
                item2.GetComponent <SyouninProductSelect>().busshiQty = int.Parse(busshiQtyList[1]);
                item2.GetComponent <SyouninProductSelect>().menuName  = name;
                item2.GetComponent <SyouninProductSelect>().busshiCd  = itemCdKB;


                //TP
                string     TPpath = "Prefabs/Item/Cyouhei/CyouheiTP";
                GameObject TPObj  = Instantiate(Resources.Load(TPpath)) as GameObject;
                GameObject item3  = content.transform.FindChild("item3").gameObject;
                TPObj.transform.SetParent(item3.transform);
                TPObj.transform.localScale            = new Vector2(1, 1);
                TPObj.GetComponent <Button>().enabled = false;
                TPObj.transform.FindChild("Qty").GetComponent <Text>().text = busshiQtyList[2];
                TPObj.name = "CyouheiTP";
                RectTransform trn3 = TPObj.transform.FindChild("Qty").GetComponent <RectTransform>();
                trn3.anchoredPosition3D = new Vector3(-30, -40, 0);
                colorByRankChanger(TPObj, busshiRankList[2]);

                string itemCdTP     = TPObj.name + busshiRankList[2];
                float  unitPriceTP  = (float)item.getUnitPrice(itemCdTP);
                float  finalPriceTP = unitPriceTP * discount;
                item3.GetComponent <SyouninProductSelect>().price     = Mathf.CeilToInt(finalPriceTP);
                item3.GetComponent <SyouninProductSelect>().busshiQty = int.Parse(busshiQtyList[2]);
                item3.GetComponent <SyouninProductSelect>().menuName  = name;
                item3.GetComponent <SyouninProductSelect>().busshiCd  = itemCdTP;


                //YM
                string     YMath = "Prefabs/Item/Cyouhei/CyouheiYM";
                GameObject YMObj = Instantiate(Resources.Load(YMath)) as GameObject;
                GameObject item4 = content.transform.FindChild("item4").gameObject;
                YMObj.transform.SetParent(item4.transform);
                YMObj.transform.localScale            = new Vector2(1, 1);
                YMObj.GetComponent <Button>().enabled = false;
                YMObj.transform.FindChild("Qty").GetComponent <Text>().text = busshiQtyList[3];
                YMObj.name = "CyouheiYM";
                RectTransform trn4 = YMObj.transform.FindChild("Qty").GetComponent <RectTransform>();
                trn4.anchoredPosition3D = new Vector3(-30, -40, 0);
                colorByRankChanger(YMObj, busshiRankList[3]);

                string itemCdYM     = YMObj.name + busshiRankList[3];
                float  unitPriceYM  = (float)item.getUnitPrice(itemCdYM);
                float  finalPriceYM = unitPriceYM * discount;
                item4.GetComponent <SyouninProductSelect>().price     = Mathf.CeilToInt(finalPriceYM);
                item4.GetComponent <SyouninProductSelect>().busshiQty = int.Parse(busshiQtyList[3]);
                item4.GetComponent <SyouninProductSelect>().menuName  = name;
                item4.GetComponent <SyouninProductSelect>().busshiCd  = itemCdYM;


                //SNB
                string     SNBpath = "Prefabs/Item/Shinobi/Shinobi";
                GameObject SNBObj  = Instantiate(Resources.Load(SNBpath)) as GameObject;
                GameObject item5   = content.transform.FindChild("item5").gameObject;
                SNBObj.transform.SetParent(item5.transform);
                SNBObj.transform.localScale            = new Vector2(1, 1);
                SNBObj.GetComponent <Button>().enabled = false;
                SNBObj.transform.FindChild("Qty").GetComponent <Text>().text = busshiQtyList[4];
                SNBObj.name = "Shinobi";
                RectTransform trn5 = SNBObj.transform.FindChild("Qty").GetComponent <RectTransform>();
                trn5.anchoredPosition3D = new Vector3(-30, -40, 0);
                RectTransform trnContent = SNBObj.transform.FindChild("Shinobi").GetComponent <RectTransform>();
                trnContent.sizeDelta = new Vector3(95, 120, 0);
                colorByRankChanger(SNBObj, busshiRankList[4]);

                string itemCdSNB     = SNBObj.name + busshiRankList[4];
                float  unitPriceSNB  = (float)item.getUnitPrice(itemCdSNB);
                float  finalPriceSNB = unitPriceSNB * discount;
                item5.GetComponent <SyouninProductSelect>().price     = Mathf.CeilToInt(finalPriceSNB);
                item5.GetComponent <SyouninProductSelect>().busshiQty = int.Parse(busshiQtyList[4]);
                item5.GetComponent <SyouninProductSelect>().menuName  = name;
                item5.GetComponent <SyouninProductSelect>().busshiCd  = itemCdSNB;

                //Initial
                item1.GetComponent <SyouninProductSelect>().OnClick();

                serihuChanger(msg.getMessage(45));
            }
            else if (name == "Yasen")
            {
                audioSources [0].Play();

                string     path = "Prefabs/Syounin/MenuYasen";
                GameObject menu = Instantiate(Resources.Load(path)) as GameObject;
                menu.transform.SetParent(board.transform);
                menu.transform.localScale    = new Vector2(1, 1);
                menu.transform.localPosition = new Vector2(0, -150);
                menu.transform.FindChild("Close").GetComponent <CloseMenu> ().obj = menu;
                menu.name = "MenuYasen";

                int yasenAmt = CloseLayerScript.yasenAmt;
                menu.transform.FindChild("MoneyValue").GetComponent <Text>().text = yasenAmt.ToString();
                GameObject btn = menu.transform.FindChild("DoYasenButton").gameObject;
                btn.GetComponent <DoSyouninMenu>().price = yasenAmt;

                serihuChanger(msg.getMessage(46));
            }
            else if (name == "Youjinbou")
            {
                audioSources [0].Play();

                string     path = "Prefabs/Syounin/MenuRounin";
                GameObject menu = Instantiate(Resources.Load(path)) as GameObject;
                menu.transform.SetParent(board.transform);
                menu.transform.localScale    = new Vector2(1, 1);
                menu.transform.localPosition = new Vector2(0, -150);
                menu.transform.FindChild("Close").GetComponent <CloseMenu> ().obj = menu;
                menu.name = "MenuRounin";

                //Preparation
                float      discount    = CloseLayerScript.discount;
                int        rdmKengouId = CloseLayerScript.rdmKengouId;
                GameObject btn         = menu.transform.FindChild("DoRouninButton").gameObject;

                string     kengouPath = "Prefabs/Item/kengou";
                GameObject kengou     = Instantiate(Resources.Load(kengouPath)) as GameObject;
                kengou.transform.SetParent(menu.transform);
                kengou.transform.localScale            = new Vector2(1.0f, 1.25f);
                kengou.GetComponent <Button>().enabled = false;

                RectTransform kengouRect = kengou.GetComponent <RectTransform>();
                kengouRect.anchoredPosition3D = new Vector3(-200, -30, 0);

                GameObject    rank           = kengou.transform.FindChild("Rank").gameObject;
                RectTransform kengouRankRect = rank.GetComponent <RectTransform>();
                kengouRankRect.anchoredPosition3D = new Vector3(-50, 20, 0);
                rank.transform.localScale         = new Vector2(0.09f, 0.09f);

                Item   item       = new Item();
                string itemCd     = "kengou" + rdmKengouId;
                string kengouName = item.getItemName(itemCd);
                string exp        = item.getExplanation(itemCd);
                float  unitPrice  = (float)item.getUnitPrice(itemCd);
                rank.GetComponent <Text>().text = kengouName;

                float finalPrice = unitPrice * discount;
                btn.GetComponent <DoSyouninMenu>().price    = Mathf.CeilToInt(finalPrice);
                btn.GetComponent <DoSyouninMenu>().kengouId = rdmKengouId;

                GameObject info = menu.transform.FindChild("Info").gameObject;
                info.transform.FindChild("Name").GetComponent <Text>().text        = kengouName;
                info.transform.FindChild("EffectLabel").GetComponent <Text>().text = exp;
                menu.transform.FindChild("MoneyValue").GetComponent <Text>().text  = Mathf.CeilToInt(finalPrice).ToString();
                serihuChanger(msg.getMessage(47));
            }
            else if (name == "Cyakai")
            {
                //check cyadougu
                List <string> kahouList       = new List <string>();
                int           daimyoBusyoId   = PlayerPrefs.GetInt("myDaimyoBusyo");
                int           myDaimyoId      = PlayerPrefs.GetInt("myDaimyo");
                BusyoInfoGet  busyoInfo       = new BusyoInfoGet();
                string        daimyoBusyoName = busyoInfo.getName(daimyoBusyoId);

                string tmp         = "kahou" + daimyoBusyoId;
                string kahouString = PlayerPrefs.GetString(tmp);
                kahouList = new List <string>(kahouString.Split(delimiterChars));
                if (kahouList [4] == "0" && kahouList [5] == "0")
                {
                    audioSources [4].Play();
                    string text = "";
                    if (Application.systemLanguage != SystemLanguage.Japanese)
                    {
                        text = "Lord " + daimyoBusyoName + " don't have any teaware.";
                    }
                    else
                    {
                        text = daimyoBusyoName + "様は\n茶器をお持ちでないようですな。";
                    }
                    msg.makeMessageOnBoard(text);
                    serihuChanger(text);
                }
                else
                {
                    audioSources [0].Play();
                    string     path = "Prefabs/Syounin/MenuCyakai";
                    GameObject menu = Instantiate(Resources.Load(path)) as GameObject;
                    menu.transform.SetParent(board.transform);
                    menu.transform.localScale    = new Vector2(1, 1);
                    menu.transform.localPosition = new Vector2(0, -150);
                    menu.transform.FindChild("Close").GetComponent <CloseMenu> ().obj = menu;
                    menu.name = "MenuCyakai";
                    GameObject btn = menu.transform.FindChild("DoCyakaiButton").gameObject;

                    //Cyadougu History
                    string        cyakaiDouguHst     = PlayerPrefs.GetString("cyakaiDouguHst");
                    List <string> cyakaiDouguHstlist = new List <string> ();
                    if (cyakaiDouguHst != "" && cyakaiDouguHst != null)
                    {
                        if (cyakaiDouguHst.Contains(","))
                        {
                            cyakaiDouguHstlist = new List <string> (cyakaiDouguHst.Split(delimiterChars));
                        }
                        else
                        {
                            cyakaiDouguHstlist.Add(cyakaiDouguHst);
                        }
                    }


                    //Change Kahou Icon
                    bool doneCyadouguFlg1 = false;
                    bool doneCyadouguFlg2 = false;

                    int   targetKuniQty = 0;
                    Kahou kahou         = new Kahou();
                    if (kahouList [4] != "0")
                    {
                        string kahouId1 = kahouList [4];

                        string     cyadouguId   = "cyadougu" + kahouId1;
                        string     cyadouguPath = "Prefabs/Item/Kahou/" + cyadouguId;
                        GameObject cya          = Instantiate(Resources.Load(cyadouguPath)) as GameObject;
                        cya.transform.SetParent(menu.transform);
                        cya.transform.localScale = new Vector3(0.3f, 0.38f, 0);
                        RectTransform transform = cya.GetComponent <RectTransform> ();
                        transform.anchoredPosition3D         = new Vector3(-180, -60, 0);
                        cya.GetComponent <Button> ().enabled = false;

                        if (cyakaiDouguHstlist.Contains(kahouId1))
                        {
                            doneCyadouguFlg1 = true;
                        }
                        else
                        {
                            cyakaiDouguHstlist.Add(kahouId1);
                        }

                        string kahouRank = kahou.getKahouRank("cyadougu", int.Parse(kahouId1));
                        if (doneCyadouguFlg1)
                        {
                            targetKuniQty = targetKuniQty + 1;
                        }
                        else
                        {
                            if (kahouRank == "S")
                            {
                                targetKuniQty = targetKuniQty + 5;
                            }
                            else if (kahouRank == "A")
                            {
                                targetKuniQty = targetKuniQty + 3;
                            }
                            else if (kahouRank == "B")
                            {
                                targetKuniQty = targetKuniQty + 2;
                            }
                            else if (kahouRank == "C")
                            {
                                targetKuniQty = targetKuniQty + 1;
                            }
                        }
                    }
                    else
                    {
                        //Not Exist
                        string     cyadouguPath = "Prefabs/Item/Kahou/NoCyadougu";
                        GameObject cya          = Instantiate(Resources.Load(cyadouguPath)) as GameObject;
                        cya.transform.SetParent(menu.transform);
                        cya.transform.localScale = new Vector3(0.3f, 0.38f, 0);
                        RectTransform transform = cya.GetComponent <RectTransform> ();
                        transform.anchoredPosition3D         = new Vector3(-180, -60, 0);
                        cya.GetComponent <Button> ().enabled = false;
                    }

                    if (kahouList [5] != "0")
                    {
                        string kahouId2 = kahouList [5];

                        string     cyadouguId   = "cyadougu" + kahouId2;
                        string     cyadouguPath = "Prefabs/Item/Kahou/" + cyadouguId;
                        GameObject cya          = Instantiate(Resources.Load(cyadouguPath)) as GameObject;
                        cya.transform.SetParent(menu.transform);
                        cya.transform.localScale = new Vector3(0.3f, 0.38f, 0);
                        RectTransform transform = cya.GetComponent <RectTransform> ();
                        transform.anchoredPosition3D         = new Vector3(-130, -60, 0);
                        cya.GetComponent <Button> ().enabled = false;

                        if (cyakaiDouguHstlist.Contains(kahouId2))
                        {
                            doneCyadouguFlg2 = true;
                        }
                        else
                        {
                            cyakaiDouguHstlist.Add(kahouId2);
                        }

                        string kahouRank = kahou.getKahouRank("cyadougu", int.Parse(kahouId2));
                        if (doneCyadouguFlg2)
                        {
                            targetKuniQty = targetKuniQty + 1;
                        }
                        else
                        {
                            if (kahouRank == "S")
                            {
                                targetKuniQty = targetKuniQty + 5;
                            }
                            else if (kahouRank == "A")
                            {
                                targetKuniQty = targetKuniQty + 3;
                            }
                            else if (kahouRank == "B")
                            {
                                targetKuniQty = targetKuniQty + 2;
                            }
                            else if (kahouRank == "C")
                            {
                                targetKuniQty = targetKuniQty + 1;
                            }
                        }
                    }
                    else
                    {
                        //Not Exist
                        string     cyadouguPath = "Prefabs/Item/Kahou/NoCyadougu";
                        GameObject cya          = Instantiate(Resources.Load(cyadouguPath)) as GameObject;
                        cya.transform.SetParent(menu.transform);
                        cya.transform.localScale = new Vector3(0.3f, 0.38f, 0);
                        RectTransform transform = cya.GetComponent <RectTransform> ();
                        transform.anchoredPosition3D         = new Vector3(-130, -60, 0);
                        cya.GetComponent <Button> ().enabled = false;
                    }

                    //Change Kuni Qty
                    if (targetKuniQty < 1)
                    {
                        targetKuniQty = 1;
                    }

                    menu.transform.FindChild("Tabibito").transform.FindChild("Text").GetComponent <Text>().text = " X " + targetKuniQty.ToString();


                    //Set Button Value
                    btn.GetComponent <DoSyouninMenu>().price              = 10000;
                    btn.GetComponent <DoSyouninMenu>().targetKuniQty      = targetKuniQty;
                    btn.GetComponent <DoSyouninMenu>().cyakaiDouguHstlist = cyakaiDouguHstlist;
                    string serihu = "";
                    if (!doneCyadouguFlg1 && !doneCyadouguFlg2)
                    {
                        btn.GetComponent <DoSyouninMenu> ().doneCyadouguFlg = false;
                        serihu = msg.getMessage(48);
                    }
                    else
                    {
                        btn.GetComponent <DoSyouninMenu> ().doneCyadouguFlg = true;
                        serihu = msg.getMessage(49);
                    }
                    serihuChanger(serihu);
                }
            }
            else if (name == "Gijyutsu")
            {
                audioSources [0].Play();

                string     path = "Prefabs/Syounin/MenuTech";
                GameObject menu = Instantiate(Resources.Load(path)) as GameObject;
                menu.transform.SetParent(board.transform);
                menu.transform.localScale    = new Vector2(1, 1);
                menu.transform.localPosition = new Vector2(0, -150);
                menu.transform.FindChild("Close").GetComponent <CloseMenu> ().obj = menu;
                menu.name = "MenuTech";
                GameObject btn = menu.transform.FindChild("DoTechButton").gameObject;

                int techId = CloseLayerScript.techId;

                //Image
                string spritePath = "";
                if (techId == 1)
                {
                    spritePath = "Prefabs/Item/Tech/Sprite/tp";
                }
                else if (techId == 2)
                {
                    spritePath = "Prefabs/Item/Tech/Sprite/kb";
                }
                else if (techId == 3)
                {
                    spritePath = "Prefabs/Item/Tech/Sprite/snb";
                }
                GameObject techImage = menu.transform.FindChild("Tech").gameObject;
                techImage.GetComponent <Image> ().sprite =
                    Resources.Load(spritePath, typeof(Sprite)) as Sprite;

                //Detail Info
                Item   item      = new Item();
                string itemCd    = "tech" + techId;
                string techName  = item.getItemName(itemCd);
                string exp       = item.getExplanation(itemCd);
                float  unitPrice = (float)item.getUnitPrice(itemCd);
                float  discount  = CloseLayerScript.discount;

                float finalPrice = unitPrice * discount;
                btn.GetComponent <DoSyouninMenu>().price  = Mathf.CeilToInt(finalPrice);
                btn.GetComponent <DoSyouninMenu>().techId = techId;

                GameObject info = menu.transform.FindChild("Info").gameObject;
                info.transform.FindChild("Name").GetComponent <Text>().text        = techName;
                info.transform.FindChild("EffectLabel").GetComponent <Text>().text = exp;
                menu.transform.FindChild("MoneyValue").GetComponent <Text>().text  = Mathf.CeilToInt(finalPrice).ToString();
                serihuChanger(msg.getMessage(50));
            }
        }
    }