Пример #1
0
	public void OnClick(){

		if (name != "PassButton") {
			//Syoukaijyo Confirm Pop

			//Back
			string pathOfBack = "Prefabs/Cyoutei/TouchBackLayer";
			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);

			//Cyoutei Pop
			string pathOfPop = "Prefabs/Cyoutei/SelectSyoukaijyoBoard";
			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);
			pop.name = "SelectSyoukaijyoBoard";
			back.GetComponent<CloseLayer> ().closeTargetObj = pop;
			back.GetComponent<CloseLayer> ().closeTargetBack = back;
			pop.transform.FindChild ("CloseBtn").GetComponent<CloseLayer> ().closeTargetObj = pop;
			pop.transform.FindChild ("CloseBtn").GetComponent<CloseLayer> ().closeTargetBack = back;

			//Check Syoukaijyo
			string nowQty = PlayerPrefs.GetString ("cyoutei");
			//string nowQty = "0,0,0";
			List<string> nowQtyList = new List<string> ();
			char[] delimiterChars = {','};
			nowQtyList = new List<string> (nowQty.Split (delimiterChars));

			GameObject scrollView = pop.transform.FindChild ("ScrollView").gameObject;
			GameObject content = scrollView.transform.FindChild ("Content").gameObject;
			bool notZeroflg = false;
			//Jyo
			if (nowQtyList [2] == "0") {
				content.transform.FindChild ("Jyo").gameObject.SetActive (false);
			} else {
				notZeroflg = true;
				content.transform.FindChild ("Jyo").transform.FindChild ("cyoutei").transform.FindChild ("Qty").GetComponent<Text> ().text = nowQtyList [2];
				content.transform.FindChild ("Jyo").GetComponent<SyoukaijyoSelect>().OnClick();
			}

			//Cyu
			if (nowQtyList [1] == "0") {
				content.transform.FindChild ("Cyu").gameObject.SetActive (false);
			} else {
				notZeroflg = true;
				content.transform.FindChild ("Cyu").transform.FindChild ("cyoutei").transform.FindChild ("Qty").GetComponent<Text> ().text = nowQtyList [1];
				content.transform.FindChild ("Cyu").GetComponent<SyoukaijyoSelect>().OnClick();
			}

			//Ge
			if (nowQtyList [0] == "0") {
				content.transform.FindChild ("Ge").gameObject.SetActive (false);
			} else {
				notZeroflg = true;
				content.transform.FindChild ("Ge").transform.FindChild ("cyoutei").transform.FindChild ("Qty").GetComponent<Text> ().text = nowQtyList [0];
				content.transform.FindChild ("Ge").GetComponent<SyoukaijyoSelect>().OnClick();
			}


			if (!notZeroflg) {
				scrollView.transform.FindChild ("NoSyoukaijyo").GetComponent<Text> ().enabled = true;
				pop.transform.FindChild ("Serihu").transform.FindChild ("Text").GetComponent<Text> ().text = "公家からの紹介状が無いと殿中には入れませんぞ。";
				pop.transform.FindChild ("PassButton").gameObject.SetActive (false);
			}

			pop.transform.FindChild("PassButton").GetComponent<CyouteiPop>().SelectSyoukaijyoBoard = pop;
			pop.transform.FindChild("PassButton").GetComponent<CyouteiPop>().myDaimyoFlg = myDaimyoFlg;
			pop.transform.FindChild("PassButton").GetComponent<CyouteiPop>().occupiedDaimyoName = occupiedDaimyoName;
			pop.transform.FindChild("PassButton").GetComponent<CyouteiPop>().yukoudo = yukoudo;

		} else {
			//Cyoutei Main Pop
			int hyourou = PlayerPrefs.GetInt("hyourou");
			int newHyourou = hyourou - 5;
			PlayerPrefs.SetInt("hyourou",newHyourou);
			GameObject.Find("HyourouCurrentValue").GetComponent<Text>().text = newHyourou.ToString();

			//Check Yukoudo
			int ratio = 100 - yukoudo;
			if(myDaimyoFlg){
				ratio = 0;
			}
			float percent = Random.value;
			percent = percent * 100;

			if(percent > ratio){

				SelectSyoukaijyoBoard.transform.FindChild("CloseBtn").GetComponent<CloseLayer>().OnClick();

				string pathOfBack = "Prefabs/Cyoutei/CyouteiBack";
				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/Cyoutei/CyouteiBoard";
				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);
				pop.name = "CyouteiBoard";

				CloseLayer CloseLayerScript =  pop.transform.FindChild("CloseSyoukaijyo").GetComponent<CloseLayer>();
				CloseLayerScript.closeTargetBack = back;
				CloseLayerScript.closeTargetObj = pop;
				CloseLayerScript.syoukaijyoRank = syoukaijyoRank;
				CloseLayerScript.occupiedFlg = myDaimyoFlg;

				//RandomValue
				int yukouAddValue = 0;
				int yukouReducePoint = Random.Range(2, 10);

				int stopBattleRatio = 0;
				int stopBattleReducePoint = Random.Range(2, 10);

				int kanniRatio = 0;
				int kanniReducePoint = Random.Range(20, 100);
				int syoukaijyoRankId = 0;

				//Change Menu by syoukaijyo rank
				GameObject action = pop.transform.FindChild("Action").gameObject;
				if(syoukaijyoRank == "Ge"){
					List<string> btnNameList = new List<string> (){"Bakuhu","Cyouteki"};
					enableButton(pop,btnNameList);
					yukouAddValue = Random.Range(1, 3);
					stopBattleRatio = Random.Range(10, 30);
					kanniRatio = Random.Range(20, 60);
					syoukaijyoRankId = 1;
					action.transform.FindChild("ActionValue").GetComponent<Text>().text = "1";
					action.transform.FindChild("ActionMaxValue").GetComponent<Text>().text = "1";

				}else if(syoukaijyoRank == "Cyu"){
					List<string> btnNameList = new List<string> (){"Bakuhu","Cyouteki"};
					enableButton(pop,btnNameList);
					yukouAddValue = Random.Range(3, 8);
					stopBattleRatio = Random.Range(30, 80);
					kanniRatio = Random.Range(40, 80);
					syoukaijyoRankId = 2;
					action.transform.FindChild("ActionValue").GetComponent<Text>().text = "2";
					action.transform.FindChild("ActionMaxValue").GetComponent<Text>().text = "2";


				}else if(syoukaijyoRank == "Jyo"){
					yukouAddValue = Random.Range(8, 15);
					stopBattleRatio = 100;
					kanniRatio = Random.Range(60, 100);
					syoukaijyoRankId = 3;
					action.transform.FindChild("ActionValue").GetComponent<Text>().text = "3";
					action.transform.FindChild("ActionMaxValue").GetComponent<Text>().text = "3";

				}

				//TargetKanni;
				Kanni kanni = new Kanni();
				int kuniQty = GameObject.Find("GameController").GetComponent<MainStageController>().myKuniQty;
				int kanniId = kanni.getRandomKanni(syoukaijyoRankId,kuniQty);


				CloseLayerScript.yukouAddValue = yukouAddValue;
				CloseLayerScript.yukouReducePoint = yukouReducePoint;
				CloseLayerScript.stopBattleRatio = stopBattleRatio;
				CloseLayerScript.stopBattleReducePoint = stopBattleReducePoint;
				CloseLayerScript.kanniId = kanniId;
				if(kanniId != 0){
					CloseLayerScript.kanniName = kanni.getKanniName(kanniId);
					CloseLayerScript.kanniRatio = kanniRatio;
					CloseLayerScript.kanniReducePoint = kanniReducePoint;
				}

				//Cyoutei Point
				int cyouteiPoint = PlayerPrefs.GetInt("cyouteiPoint");
				pop.transform.FindChild("CyouteiPoint").transform.FindChild("CyouteiValue").GetComponent<Text>().text = cyouteiPoint.ToString() + "%";


				bool doneFirstCyouteiFlg = PlayerPrefs.GetBool("doneFirstCyouteiFlg");
				Daimyo daimyo = new Daimyo();
				int myDaimyo = PlayerPrefs.GetInt("myDaimyo");

				if(!doneFirstCyouteiFlg){
					//1st time
					PlayerPrefs.SetBool("doneFirstCyouteiFlg",true);

					KuniInfo kuni = new KuniInfo();
					int kuniId = kuni.getOneKuniId(myDaimyo);
					int firstKanniId = kanni.getKuniKanni(kuniId);
					string firstKanniName = kanni.getKanniName(firstKanniId);

					string myKanni = PlayerPrefs.GetString ("myKanni");
					if(myKanni != null && myKanni !=""){
						myKanni = myKanni + "," + firstKanniId.ToString();
					}else{
						myKanni = firstKanniId.ToString();
					}
					PlayerPrefs.SetString ("myKanni",myKanni);
					PlayerPrefs.Flush();

					string serihu = "噂は宮中まで届いておるぞ。天下静謐のため力を貸してくれ。\t" + firstKanniName + "に任ずるぞ。";
					pop.transform.FindChild("Serihu").transform.FindChild("Text").GetComponent<Text>().text = serihu;

				}else{
					//2nd time

					//Serihu
					string daimyoName = daimyo.getName(myDaimyo);
					string serihu = "おお、" + daimyoName + "殿。\t此度は何用か。" ;
					pop.transform.FindChild("Serihu").transform.FindChild("Text").GetComponent<Text>().text = serihu;
				}


			}else{
				Message msg = new Message();
				msg.makeMessage("御屋形様、"+occupiedDaimyoName+"めに参内を邪魔されました。");
			
			}
		}
	}
Пример #2
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();
        Message       msg          = new Message();

        if (name != "PassButton")
        {
            //Syoukaijyo Confirm Pop
            audioSources [0].Play();

            //Back
            string     pathOfBack = "Prefabs/Cyoutei/TouchBackLayer";
            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);

            //Cyoutei Pop
            string     pathOfPop = "Prefabs/Cyoutei/SelectSyoukaijyoBoard";
            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);
            pop.name = "SelectSyoukaijyoBoard";
            back.GetComponent <CloseLayer> ().closeTargetObj  = pop;
            back.GetComponent <CloseLayer> ().closeTargetBack = back;
            pop.transform.FindChild("CloseBtn").GetComponent <CloseLayer> ().closeTargetObj  = pop;
            pop.transform.FindChild("CloseBtn").GetComponent <CloseLayer> ().closeTargetBack = back;

            //Check Syoukaijyo
            string nowQty = PlayerPrefs.GetString("cyoutei");
            //string nowQty = "0,0,0";
            List <string> nowQtyList     = new List <string> ();
            char[]        delimiterChars = { ',' };
            nowQtyList = new List <string> (nowQty.Split(delimiterChars));

            GameObject scrollView = pop.transform.FindChild("ScrollView").gameObject;
            GameObject content    = scrollView.transform.FindChild("Content").gameObject;
            bool       notZeroflg = false;
            //Jyo
            if (nowQtyList [2] == "0")
            {
                content.transform.FindChild("Jyo").gameObject.SetActive(false);
            }
            else
            {
                notZeroflg = true;
                content.transform.FindChild("Jyo").transform.FindChild("cyoutei").transform.FindChild("Qty").GetComponent <Text> ().text = nowQtyList [2];
                content.transform.FindChild("Jyo").GetComponent <SyoukaijyoSelect>().OnClick();
            }

            //Cyu
            if (nowQtyList [1] == "0")
            {
                content.transform.FindChild("Cyu").gameObject.SetActive(false);
            }
            else
            {
                notZeroflg = true;
                content.transform.FindChild("Cyu").transform.FindChild("cyoutei").transform.FindChild("Qty").GetComponent <Text> ().text = nowQtyList [1];
                content.transform.FindChild("Cyu").GetComponent <SyoukaijyoSelect>().OnClick();
            }

            //Ge
            if (nowQtyList [0] == "0")
            {
                content.transform.FindChild("Ge").gameObject.SetActive(false);
            }
            else
            {
                notZeroflg = true;
                content.transform.FindChild("Ge").transform.FindChild("cyoutei").transform.FindChild("Qty").GetComponent <Text> ().text = nowQtyList [0];
                content.transform.FindChild("Ge").GetComponent <SyoukaijyoSelect>().OnClick();
            }


            if (!notZeroflg)
            {
                scrollView.transform.FindChild("NoSyoukaijyo").GetComponent <Text> ().enabled             = true;
                pop.transform.FindChild("Serihu").transform.FindChild("Text").GetComponent <Text> ().text = msg.getMessage(16);
                pop.transform.FindChild("PassButton").gameObject.SetActive(false);
            }

            pop.transform.FindChild("PassButton").GetComponent <CyouteiPop>().SelectSyoukaijyoBoard = pop;
            pop.transform.FindChild("PassButton").GetComponent <CyouteiPop>().myDaimyoFlg           = myDaimyoFlg;
            pop.transform.FindChild("PassButton").GetComponent <CyouteiPop>().occupiedDaimyoId      = occupiedDaimyoId;
            pop.transform.FindChild("PassButton").GetComponent <CyouteiPop>().occupiedDaimyoName    = occupiedDaimyoName;
            pop.transform.FindChild("PassButton").GetComponent <CyouteiPop>().yukoudo = yukoudo;
        }
        else
        {
            //Cyoutei Main Pop

            int hyourou = PlayerPrefs.GetInt("hyourou");
            if (hyourou >= 5)
            {
                int newHyourou = hyourou - 5;
                PlayerPrefs.SetInt("hyourou", newHyourou);
                GameObject.Find("HyourouCurrentValue").GetComponent <Text>().text = newHyourou.ToString();

                //Check Yukoudo
                int ratio = 100 - yukoudo;
                if (myDaimyoFlg)
                {
                    ratio = 0;
                }
                float percent = Random.value;
                percent = percent * 100;

                if (percent > ratio)
                {
                    //Stop Timer
                    stopGunzei();
                    GameObject.Find("GameController").GetComponent <MainStageController>().eventStopFlg = true;

                    audioSources [3].Play();
                    SelectSyoukaijyoBoard.transform.FindChild("CloseBtn").GetComponent <CloseLayer>().OnClick();

                    string     pathOfBack = "Prefabs/Cyoutei/CyouteiBack";
                    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/Cyoutei/CyouteiBoard";
                    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);
                    pop.name = "CyouteiBoard";

                    CloseLayer CloseLayerScript = pop.transform.FindChild("CloseSyoukaijyo").GetComponent <CloseLayer>();
                    CloseLayerScript.closeTargetBack   = back;
                    CloseLayerScript.closeTargetObj    = pop;
                    CloseLayerScript.syoukaijyoRank    = syoukaijyoRank;
                    CloseLayerScript.occupiedFlg       = myDaimyoFlg;
                    CloseLayerScript.syouninCyouteiFlg = true;

                    //RandomValue
                    int yukouAddValue    = 0;
                    int yukouReducePoint = Random.Range(2, 10);

                    int stopBattleRatio       = 0;
                    int stopBattleReducePoint = Random.Range(2, 10);

                    int kanniRatio       = 0;
                    int kanniReducePoint = Random.Range(20, 100);
                    int syoukaijyoRankId = 0;

                    int cyoutekiReducePoint = Random.Range(80, 100);

                    //Change Menu by syoukaijyo rank
                    GameObject action = pop.transform.FindChild("Action").gameObject;
                    if (syoukaijyoRank == "Ge")
                    {
                        List <string> btnNameList = new List <string> ()
                        {
                            "Bakuhu", "Cyouteki"
                        };
                        enableButton(pop, btnNameList);
                        yukouAddValue    = Random.Range(1, 3);
                        stopBattleRatio  = Random.Range(10, 30);
                        kanniRatio       = Random.Range(20, 60);
                        syoukaijyoRankId = 1;
                        action.transform.FindChild("ActionValue").GetComponent <Text>().text    = "1";
                        action.transform.FindChild("ActionMaxValue").GetComponent <Text>().text = "1";
                    }
                    else if (syoukaijyoRank == "Cyu")
                    {
                        List <string> btnNameList = new List <string> ()
                        {
                            "Bakuhu", "Cyouteki"
                        };
                        enableButton(pop, btnNameList);
                        yukouAddValue    = Random.Range(3, 8);
                        stopBattleRatio  = Random.Range(30, 80);
                        kanniRatio       = Random.Range(40, 80);
                        syoukaijyoRankId = 2;
                        action.transform.FindChild("ActionValue").GetComponent <Text>().text    = "2";
                        action.transform.FindChild("ActionMaxValue").GetComponent <Text>().text = "2";
                    }
                    else if (syoukaijyoRank == "Jyo")
                    {
                        yukouAddValue    = Random.Range(8, 15);
                        stopBattleRatio  = 100;
                        kanniRatio       = Random.Range(60, 100);
                        syoukaijyoRankId = 3;
                        action.transform.FindChild("ActionValue").GetComponent <Text>().text    = "3";
                        action.transform.FindChild("ActionMaxValue").GetComponent <Text>().text = "3";
                    }

                    //TargetKanni
                    Kanni kanni   = new Kanni();
                    int   kuniQty = GameObject.Find("GameController").GetComponent <MainStageController>().myKuniQty;
                    int   kanniId = kanni.getRandomKanni(syoukaijyoRankId, kuniQty);

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

                    string        openKuni     = PlayerPrefs.GetString("openKuni");
                    List <string> openKuniList = new List <string> ();
                    openKuniList = new List <string> (openKuni.Split(delimiterChars));

                    int myDaimyo         = PlayerPrefs.GetInt("myDaimyo");
                    int cyoutekiDaimyoId = CloseLayerScript.cyoutekiDaimyo;
                    //openKuniList.RemoveAll (x => x == occupiedDaimyoId.ToString());

                    //my kuni
                    List <string> myKuniList             = new List <string>();
                    List <string> occupiedDaimyoKuniList = new List <string>();
                    for (int i = 0; i < seiryokuList.Count; i++)
                    {
                        int tmpDaimyoId = int.Parse(seiryokuList [i]);
                        if (tmpDaimyoId == myDaimyo)
                        {
                            int kuniId = i + 1;
                            myKuniList.Add(kuniId.ToString());
                        }
                        else if (tmpDaimyoId == occupiedDaimyoId)
                        {
                            int kuniId = i + 1;
                            occupiedDaimyoKuniList.Add(kuniId.ToString());
                        }
                    }
                    openKuniList.RemoveAll(myKuniList.Contains);
                    openKuniList.RemoveAll(occupiedDaimyoKuniList.Contains);


                    int rdmId          = UnityEngine.Random.Range(0, openKuniList.Count);
                    int targetKuniId   = int.Parse(openKuniList[rdmId]);
                    int cyoutekiDaimyo = int.Parse(seiryokuList[targetKuniId - 1]);


                    //reduce cyoutei syoukaijyo
                    DoSell script = new DoSell();
                    script.deleteKouekiOrCyoutei(syoukaijyoRankId, "cyoutei", 1);


                    //Set Parametor
                    CloseLayerScript.yukouAddValue         = yukouAddValue;
                    CloseLayerScript.yukouReducePoint      = yukouReducePoint;
                    CloseLayerScript.stopBattleRatio       = stopBattleRatio;
                    CloseLayerScript.stopBattleReducePoint = stopBattleReducePoint;
                    CloseLayerScript.kanniId = kanniId;
                    if (kanniId != 0)
                    {
                        CloseLayerScript.kanniName        = kanni.getKanniName(kanniId);
                        CloseLayerScript.kanniRatio       = kanniRatio;
                        CloseLayerScript.kanniReducePoint = kanniReducePoint;
                    }
                    CloseLayerScript.cyoutekiDaimyo      = cyoutekiDaimyo;
                    CloseLayerScript.cyoutekiReducePoint = cyoutekiReducePoint;


                    //Cyoutei Point
                    int cyouteiPoint = PlayerPrefs.GetInt("cyouteiPoint");
                    pop.transform.FindChild("CyouteiPoint").transform.FindChild("CyouteiValue").GetComponent <Text>().text = cyouteiPoint.ToString() + "%";


                    bool   doneFirstCyouteiFlg = PlayerPrefs.GetBool("doneFirstCyouteiFlg");
                    Daimyo daimyo = new Daimyo();

                    if (!doneFirstCyouteiFlg)
                    {
                        //1st time
                        PlayerPrefs.SetBool("questSpecialFlg5", true);

                        PlayerPrefs.SetBool("doneFirstCyouteiFlg", true);

                        KuniInfo kuni           = new KuniInfo();
                        int      kuniId         = kuni.getOneKuniId(myDaimyo);
                        int      firstKanniId   = kanni.getKuniKanni(kuniId);
                        string   firstKanniName = kanni.getKanniName(firstKanniId);

                        string myKanni = PlayerPrefs.GetString("myKanni");
                        if (myKanni != null && myKanni != "")
                        {
                            myKanni = myKanni + "," + firstKanniId.ToString();
                        }
                        else
                        {
                            myKanni = firstKanniId.ToString();
                        }
                        PlayerPrefs.SetString("myKanni", myKanni);
                        PlayerPrefs.Flush();

                        MainStageController mainStage = new MainStageController();
                        mainStage.questExtension();
                        string serihu = "";
                        if (Application.systemLanguage != SystemLanguage.Japanese)
                        {
                            serihu = "Your good rumor has arrived to the Imperial court. Please lend me your power for the world.\n I assigned you as " + firstKanniName + ".";
                        }
                        else
                        {
                            serihu = "天下静謐のため力を貸してくれ。\n" + firstKanniName + "に任ずるぞ。";
                        }
                        pop.transform.FindChild("Serihu").transform.FindChild("Text").GetComponent <Text>().text = serihu;
                    }
                    else
                    {
                        //2nd time

                        //Serihu
                        string daimyoName = daimyo.getName(myDaimyo);
                        string serihu     = "";
                        if (Application.systemLanguage != SystemLanguage.Japanese)
                        {
                            serihu = "Lord " + daimyoName + ".\n What do you want?";
                        }
                        else
                        {
                            serihu = "おお、" + daimyoName + "殿。\n此度は何用か。";
                        }
                        pop.transform.FindChild("Serihu").transform.FindChild("Text").GetComponent <Text>().text = serihu;
                    }
                }
                else
                {
                    audioSources [4].Play();
                    if (Application.systemLanguage != SystemLanguage.Japanese)
                    {
                        msg.makeMessage("My lord " + occupiedDaimyoName + " disturbed us to visit coart.");
                    }
                    else
                    {
                        msg.makeMessage("御屋形様、" + occupiedDaimyoName + "めに参内を邪魔されました。");
                    }
                }
            }
            else
            {
                audioSources [4].Play();

                //string NGtext = msg.getMessage(7);
                //msg.makeMessage (NGtext);
                msg.hyourouMovieMessage();
            }
        }
    }
Пример #3
0
    public void ViewKuniInfo()
    {
        string     kuniPath = "Prefabs/Common/Kakejiku";
        GameObject kakejiku = Instantiate(Resources.Load(kuniPath)) as GameObject;

        kakejiku.transform.SetParent(GameObject.Find("Panel").transform);
        kakejiku.transform.localScale = new Vector2(1, 1);
        kakejiku.name = "Kakejiku";
        GameObject kuni = kakejiku.transform.FindChild("Kakejiku").transform.FindChild("KuniInfo").gameObject;

        //Kanni
        int    syogunDaimyoId = PlayerPrefs.GetInt("syogunDaimyoId");
        int    myDaimyoId     = PlayerPrefs.GetInt("myDaimyo");
        string kanniName      = "";

        if (syogunDaimyoId == myDaimyoId)
        {
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                kanniName = "Shogun";
            }
            else
            {
                kanniName = "征夷大将軍";
            }
        }
        else
        {
            int    myDaimyoBusyo = PlayerPrefs.GetInt("myDaimyoBusyo");
            string kanniTmp      = "kanni" + myDaimyoBusyo.ToString();
            if (PlayerPrefs.HasKey(kanniTmp))
            {
                int   kanniId = PlayerPrefs.GetInt(kanniTmp);
                Kanni kanni   = new Kanni();
                kanniName = kanni.getKanniName(kanniId);
            }
            else
            {
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    kanniName = "No Royal Court Rank";
                }
                else
                {
                    kanniName = "官位なし";
                }
            }
        }
        kuni.transform.FindChild("KaniValue").GetComponent <Text> ().text = kanniName;

        //Daimyo Name
        Daimyo daimyoScript = new Daimyo();
        int    myDaimyo     = PlayerPrefs.GetInt("myDaimyo");
        string myDaimyoName = daimyoScript.getName(myDaimyo);

        kuni.transform.FindChild("DaimyoName").GetComponent <Text>().text = myDaimyoName;

        //Daimyo busyo image
        int    daimyoBusyoId = daimyoScript.getDaimyoBusyoId(myDaimyo);
        string daimyoPath    = "Prefabs/Player/Sprite/unit" + daimyoBusyoId.ToString();

        kuni.transform.FindChild("Mask").transform.FindChild("BusyoImage").GetComponent <Image>().sprite =
            Resources.Load(daimyoPath, typeof(Sprite)) as Sprite;



        //Current Kokuryoku
        int kuniExp = PlayerPrefs.GetInt("kuniExp");
        //kuni.transform.FindChild ("PopStatusLv").transform.FindChild("PopLvValue").GetComponent<Text> ().text = kuniExp.ToString ();

        //Now Lv
        int nowLv = PlayerPrefs.GetInt("kuniLv");

        kuni.transform.FindChild("PopStatusLv").transform.FindChild("PopLvValue").GetComponent <Text>().text = nowLv.ToString();

        //Exp for Next Lv
        Exp exp      = new Exp();
        int totalExp = exp.getKuniExpforNextLv(nowLv);
        int diff     = totalExp - kuniExp;

        kuni.transform.FindChild("PopStatusLv").transform.FindChild("ExpValue").GetComponent <Text> ().text = diff.ToString();

        //Slider
        Slider sliderScript = kuni.transform.FindChild("PopStatusLv").transform.FindChild("ExpSlider").GetComponent <Slider>();

        sliderScript.maxValue = totalExp;
        int totalExpOfNowLv = 0;

        if (nowLv != 1)
        {
            totalExpOfNowLv = exp.getKuniExpforNextLv(nowLv - 1);
        }
        sliderScript.minValue = totalExpOfNowLv;
        sliderScript.value    = kuniExp;


        //Now Kuni Qty
        string clearedKuni = PlayerPrefs.GetString("clearedKuni");

        if (clearedKuni != null && clearedKuni != "")
        {
            if (clearedKuni.Contains(","))
            {
                char[]   delimiterChars  = { ',' };
                string[] clearedKuniList = clearedKuni.Split(delimiterChars);
                kuni.transform.FindChild("ShiroQtyValue").GetComponent <Text> ().text = clearedKuniList.Length.ToString();
            }
            else
            {
                kuni.transform.FindChild("ShiroQtyValue").GetComponent <Text> ().text = "1";
            }
        }
        else
        {
            kuni.transform.FindChild("ShiroQtyValue").GetComponent <Text> ().text = "0";
        }

        //Syutujin Limit
        int jinkeiLimit = PlayerPrefs.GetInt("jinkeiLimit");

        int  addNo         = 0;
        bool addJinkei1Flg = PlayerPrefs.GetBool("addJinkei1");

        if (addJinkei1Flg)
        {
            addNo = addNo + 1;
        }
        bool addJinkei2Flg = PlayerPrefs.GetBool("addJinkei2");

        if (addJinkei2Flg)
        {
            addNo = addNo + 1;
        }
        bool addJinkei3Flg = PlayerPrefs.GetBool("addJinkei3");

        if (addJinkei3Flg)
        {
            addNo = addNo + 1;
        }
        bool addJinkei4Flg = PlayerPrefs.GetBool("addJinkei4");

        if (addJinkei4Flg)
        {
            addNo = addNo + 1;
        }
        kuni.transform.FindChild("SyutsujinQtyValue").GetComponent <Text> ().text = jinkeiLimit.ToString() + "<Color=#35D74BFF>+" + addNo + "</Color>";

        //Stock Limit
        int    stockLimit = PlayerPrefs.GetInt("stockLimit");
        int    myBusyoQty = PlayerPrefs.GetInt("myBusyoQty");
        string value      = myBusyoQty.ToString() + "/" + stockLimit.ToString();

        kuni.transform.FindChild("TouyouQtyValue").GetComponent <Text> ().text = value;


        //SyutsujinQtyUpLvValue
        kuni.transform.FindChild("SyutsujinQtyUpLvValue").GetComponent <Text>().text = nextAvailableSamuraiUpLv(nowLv).ToString();

        //SyutsujinQtyValue
        int TrackTotalKassenNo = PlayerPrefs.GetInt("TrackTotalKassenNo");
        int TrackWinNo         = PlayerPrefs.GetInt("TrackWinNo");

        kuni.transform.FindChild("BattleNoValue").GetComponent <Text>().text = TrackTotalKassenNo.ToString();

        //WinRatioValue
        int winRatio = Mathf.CeilToInt((float)TrackWinNo / (float)TrackTotalKassenNo * 100);

        if (TrackWinNo == 0)
        {
            winRatio = 0;
        }
        kuni.transform.FindChild("WinRatioValue").GetComponent <Text>().text = winRatio.ToString();

        //DevNo
        int HstNanbansen = PlayerPrefs.GetInt("HstNanbansen");

        kuni.transform.FindChild("ShipNo").GetComponent <Text>().text = HstNanbansen.ToString();
        //VisitorNo
        int TrackTabibitoNo = PlayerPrefs.GetInt("TrackTabibitoNo");

        kuni.transform.FindChild("VisitorNo").GetComponent <Text>().text = TrackTabibitoNo.ToString();
        //BouryakuNo
        int TrackBouryakuNo = PlayerPrefs.GetInt("TrackBouryakuNo");

        kuni.transform.FindChild("BouryakuNo").GetComponent <Text>().text = TrackBouryakuNo.ToString();
        //GaikoNo
        int TrackGaikouNo = PlayerPrefs.GetInt("TrackGaikouNo");

        kuni.transform.FindChild("GaikoNo").GetComponent <Text>().text = TrackGaikouNo.ToString();
    }