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