Exemplo n.º 1
0
    public void OnClick()
    {
        if (name == "YesButton") {
            //Kainin
            //Delete Key
            int kuniId = GameObject.Find ("NaiseiController").GetComponent<NaiseiController> ().activeKuniId;
            string temp = "jyosyu" + kuniId;
            int busyoId = PlayerPrefs.GetInt (temp);
            PlayerPrefs.DeleteKey(temp);

            //JyosyuHei Kainin
            string temp2 = "jyosyuHei" + busyoId;
            PlayerPrefs.DeleteKey(temp2);

            PlayerPrefs.Flush ();

            //Close
            GameObject.Find ("TouchBack").GetComponent<CloseBoard>().onClick();

            //Initialization
            //Message
            Message msg = new Message();
            string text =  "城主を解任致しました。";
            msg.makeMessage(text);

            //Initialization
            NaiseiController naisei = new NaiseiController ();
            naisei.Start ();

        }else if(name == "NoButton"){
            //Close
            GameObject.Find ("TouchBack").GetComponent<CloseBoard>().onClick();
        }
    }
Exemplo n.º 2
0
    public void OnClick()
    {
        Debug.Log ("RequiredItem Check Not Yet");

        //Jyosyu Ninmei
        int kuniId = GameObject.Find ("NaiseiController").GetComponent<NaiseiController> ().activeKuniId;
        string temp = "jyosyu" + kuniId;
        PlayerPrefs.SetInt (temp, int.Parse(busyoId));

        //Jyosyu Heiryoku
        string temp2 = "jyosyuHei" + busyoId;
        int jyosyuHei = int.Parse(GameObject.Find ("AshigaruValue").GetComponent<Text> ().text);
        PlayerPrefs.SetInt (temp2, jyosyuHei);

        PlayerPrefs.Flush ();

        //Delete Box
        Destroy (GameObject.Find ("board(Clone)"));
        Destroy (GameObject.Find ("Back(Clone)"));

        //Message
        MessageBusyo msg = new MessageBusyo();
        string text =  "城主に任命致しました。";
        string type = "ninmei";
        msg.makeMessage(text,int.Parse(busyoId), type);

        //Initialization
        NaiseiController naisei = new NaiseiController ();
        naisei.Start ();
    }
Exemplo n.º 3
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();

        if (name == "YesButton")
        {
            audioSources [4].Play();

            //Kainin
            //Delete Key
            if (Application.loadedLevelName == "naisei")
            {
                kuniId = GameObject.Find("NaiseiController").GetComponent <NaiseiController> ().activeKuniId;
            }

            string temp    = "jyosyu" + kuniId;
            int    busyoId = PlayerPrefs.GetInt(temp);
            PlayerPrefs.DeleteKey(temp);

            //JyosyuHei Kainin
            string temp2 = "jyosyuHei" + busyoId;
            PlayerPrefs.DeleteKey(temp2);

            string temp3 = "jyosyuBusyo" + busyoId;
            PlayerPrefs.DeleteKey(temp3);

            PlayerPrefs.Flush();

            //Close
            GameObject.Find("TouchBack").GetComponent <CloseBoard>().onClick();

            //Initialization
            //Message
            Message msg = new Message();
            msg.makeMessage(msg.getMessage(87));

            //Initialization
            if (Application.loadedLevelName == "naisei")
            {
                NaiseiController naisei = new NaiseiController();
                naisei.Start();
            }
            else if (Application.loadedLevelName == "busyo")
            {
                SyoguScene syogu = new SyoguScene();
                syogu.createSyoguView(busyoId.ToString());
            }
        }
        else if (name == "NoButton")
        {
            //Close
            audioSources [1].Play();
            GameObject.Find("TouchBack").GetComponent <CloseBoard>().onClick();
        }
    }
Exemplo n.º 4
0
	public void OnClick () {
		if (name == "YesButton") {
			//Kainin
			//Delete Key
			if (Application.loadedLevelName == "naisei") {
				kuniId = GameObject.Find ("NaiseiController").GetComponent<NaiseiController> ().activeKuniId;
			}

			string temp = "jyosyu" + kuniId;
			int busyoId = PlayerPrefs.GetInt (temp);
			PlayerPrefs.DeleteKey(temp);

			//JyosyuHei Kainin
			string temp2 = "jyosyuHei" + busyoId;
			PlayerPrefs.DeleteKey(temp2);

			string temp3 = "jyosyuBusyo" + busyoId;
			PlayerPrefs.DeleteKey(temp3);

			PlayerPrefs.Flush ();

			//Close
			GameObject.Find ("TouchBack").GetComponent<CloseBoard>().onClick();

			//Initialization
			//Message
			Message msg = new Message(); 
			string text =  "城主を解任致しました。";
			msg.makeMessage(text);
			
			//Initialization
			if (Application.loadedLevelName == "naisei") {
				NaiseiController naisei = new NaiseiController ();
				naisei.Start ();
			}else if(Application.loadedLevelName == "busyo"){
				SyoguScene syogu = new SyoguScene();
				syogu.createSyoguView(busyoId.ToString());
			}

		}else if(name == "NoButton"){
			//Close
			GameObject.Find ("TouchBack").GetComponent<CloseBoard>().onClick();
		}
	}	
Exemplo n.º 5
0
	// Use this for initialization
	public void OnClick () {

		//Money Check
		Message msg = new Message(); 
		int nowMoney = PlayerPrefs.GetInt ("money");
		int nowHyourou = PlayerPrefs.GetInt ("hyourou");

		if (nowMoney < requiredMoney) {
			//Error
			//Message
			string Text = "金が不足しております。";
			msg.makeMessage(Text);
			
		} else {
			if (nowHyourou < requiredHyourou) {
				//Error
				string Text = "兵糧が不足しております。";
				msg.makeMessage(Text);

			} else {

				activeKuniId = GameObject.Find ("NaiseiController").GetComponent<NaiseiController> ().activeKuniId;
				string temp = "naisei" + activeKuniId.ToString ();

				//Defalt=> 1,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0
				string naiseiString = PlayerPrefs.GetString (temp);
				List<string> naiseiList = new List<string> ();
				char[] delimiterChars = {','};
				naiseiList = new List<string> (naiseiString.Split (delimiterChars));

				string newNaiseiString = "";
				for (int i=0; i<naiseiList.Count; i++) {
					if (i == panelId) {
						string newParam = naiseiId.ToString () + ":1";
						newNaiseiString = newNaiseiString + "," + newParam;

					} else {
						if (newNaiseiString == "") {
							newNaiseiString = naiseiList [i];
						} else {
							newNaiseiString = newNaiseiString + "," + naiseiList [i];
						}
					}
				}


				/*Reduce Money & Hyourou*/
				//Money
				int resultMoney = nowMoney - requiredMoney;
				int resultHyourou = nowHyourou - requiredHyourou;
				PlayerPrefs.SetInt("money",resultMoney);
				PlayerPrefs.SetInt("hyourou",resultHyourou);


				PlayerPrefs.SetString (temp, newNaiseiString);
				PlayerPrefs.Flush();

				//Message
				string OKtext = naiseiName + "を建築しましたぞ。\n国が栄えますな。";
				msg.makeMessage (OKtext);

				//Close Tab
				GameObject.Find ("close").GetComponent<CloseBoard> ().onClick ();

				//Initialization
				NaiseiController naisei = new NaiseiController ();
				naisei.Start ();
			}
		}
	}
Exemplo n.º 6
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();

        if (name == "YesButton")
        {
            //Destroy
            audioSources [6].Play();

            string temp = "naisei" + activeKuniId.ToString();
            if (PlayerPrefs.HasKey(temp))
            {
                //Get Data
                string        naiseiString   = PlayerPrefs.GetString(temp);
                List <string> naiseiList     = new List <string>();
                char[]        delimiterChars = { ',' };
                naiseiList = new List <string>(naiseiString.Split(delimiterChars));

                string targetValue = "0:0";
                naiseiList[areaId] = targetValue;


                //Remake string
                string newNaiseiString = "";
                for (int i = 0; i < naiseiList.Count; i++)
                {
                    if (i + 1 != naiseiList.Count)
                    {
                        newNaiseiString = newNaiseiString + naiseiList[i] + ",";
                    }
                    else
                    {
                        newNaiseiString = newNaiseiString + naiseiList[i];
                    }
                }
                PlayerPrefs.SetString(temp, newNaiseiString);
                PlayerPrefs.Flush();

                Message msg = new Message();
                msg.makeMessage(msg.getMessage(118));

                //Close Tab
                GameObject.Find("close").GetComponent <CloseBoard> ().onClick();

                //Initialization
                NaiseiController naisei = new NaiseiController();
                naisei.Start();

                //Animation
                GameObject naiseiView   = GameObject.Find("NaiseiView").gameObject;
                Vector2    areaPosition = naiseiView.transform.FindChild(areaId.ToString()).transform.localPosition;
                string     animPath     = "Prefabs/Naisei/DestroyAnim";
                GameObject destroyObj   = Instantiate(Resources.Load(animPath)) as GameObject;
                destroyObj.transform.SetParent(naiseiView.transform);
                destroyObj.transform.localScale    = new Vector2(200, 100);
                destroyObj.transform.localPosition = new Vector2(areaPosition.x + 10, areaPosition.y + 65);
            }
        }
        else if (name == "NoButton")
        {
            //Close
            audioSources [1].Play();

            GameObject.Find("TouchBack").GetComponent <CloseBoard>().onClick();
        }
    }
Exemplo n.º 7
0
    // Use this for initialization
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();

        //Money Check
        Message msg        = new Message();
        int     nowMoney   = PlayerPrefs.GetInt("money");
        int     nowHyourou = PlayerPrefs.GetInt("hyourou");

        if (nowMoney < requiredMoney)
        {
            //Error
            //Message
            audioSources [4].Play();
            msg.makeMessage(msg.getMessage(6));
        }
        else
        {
            if (nowHyourou < requiredHyourou)
            {
                //Error
                audioSources [4].Play();
                //msg.makeMessage(msg.getMessage(7));
                msg.hyourouMovieMessage();
                GameObject.Find("close").GetComponent <CloseBoard>().onClick();
            }
            else
            {
                audioSources [3].Play();

                activeKuniId = GameObject.Find("NaiseiController").GetComponent <NaiseiController> ().activeKuniId;
                string temp = "naisei" + activeKuniId.ToString();

                //Defalt=> 1,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0
                string        naiseiString   = PlayerPrefs.GetString(temp);
                List <string> naiseiList     = new List <string> ();
                char[]        delimiterChars = { ',' };
                naiseiList = new List <string> (naiseiString.Split(delimiterChars));

                string newNaiseiString = "";
                for (int i = 0; i < naiseiList.Count; i++)
                {
                    if (i == panelId)
                    {
                        string newParam = naiseiId.ToString() + ":1";
                        newNaiseiString = newNaiseiString + "," + newParam;
                    }
                    else
                    {
                        if (newNaiseiString == "")
                        {
                            newNaiseiString = naiseiList [i];
                        }
                        else
                        {
                            newNaiseiString = newNaiseiString + "," + naiseiList [i];
                        }
                    }
                }

                bool tutorialDoneFlg = PlayerPrefs.GetBool("tutorialDoneFlg");
                if (!tutorialDoneFlg || Application.loadedLevelName != "tutorialNaisei")
                {
                    /*Reduce Money & Hyourou*/
                    //Money
                    int resultMoney   = nowMoney - requiredMoney;
                    int resultHyourou = nowHyourou - requiredHyourou;
                    PlayerPrefs.SetInt("money", resultMoney);
                    PlayerPrefs.SetInt("hyourou", resultHyourou);

                    //Track
                    int TrackBuildMoneyNo = PlayerPrefs.GetInt("TrackBuildMoneyNo", 0);
                    TrackBuildMoneyNo = TrackBuildMoneyNo + requiredMoney;
                    PlayerPrefs.SetInt("TrackBuildMoneyNo", TrackBuildMoneyNo);


                    PlayerPrefs.SetString(temp, newNaiseiString);
                    PlayerPrefs.SetBool("questDailyFlg16", true);
                    PlayerPrefs.Flush();
                }

                //Message
                string OKtext = "";
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    OKtext = "You built " + naiseiName + ".\n The country is thriving.";
                }
                else
                {
                    OKtext = naiseiName + "を建築しましたぞ。\n国が栄えますな。";
                }
                msg.makeMessage(OKtext);

                //Close Tab
                if (Application.loadedLevelName == "tutorialNaisei")
                {
                    Destroy(GameObject.Find("Back(Clone)").gameObject);
                    Destroy(GameObject.Find("board(Clone)").gameObject);
                    PlayerPrefs.SetInt("tutorialId", 3);
                    PlayerPrefs.Flush();
                }
                else
                {
                    GameObject.Find("close").GetComponent <CloseBoard> ().onClick();
                }

                //Initialization
                NaiseiController naisei = new NaiseiController();
                naisei.Start();

                if (Application.loadedLevelName == "tutorialNaisei")
                {
                    GameObject tBtnObj = GameObject.Find("tButton").gameObject;
                    Destroy(tBtnObj.transform.FindChild("12").gameObject);

                    GameObject NaiseiViewObj = GameObject.Find("NaiseiView").gameObject;
                    GameObject builtObj      = NaiseiViewObj.transform.FindChild("12").gameObject;
                    builtObj.transform.SetParent(tBtnObj.transform);
                    builtObj.GetComponent <Button>().enabled = false;
                }
            }
        }
    }
Exemplo n.º 8
0
	public void OnClick () {

		Message msgLine = new Message ();
		int nowMoney = PlayerPrefs.GetInt ("money");
		if (nowMoney < 1000) {

			string text = "金が不足しておるようですぞ。";
			msgLine.makeMessage(text);

		} else {

			int nowHyourou = PlayerPrefs.GetInt("hyourou");
			if(nowHyourou<10){

				string text = "兵糧が不足しておるようですぞ。";
				msgLine.makeMessage(text);

			}else{
				//Reduce Money & Hyourou
				int newMoney = nowMoney - 1000;
				int newHyourou = nowHyourou - 10;
				PlayerPrefs.SetInt("money",newMoney);
				PlayerPrefs.SetInt("hyourou",newHyourou);

				//Jyosyu Ninmei
				if (Application.loadedLevelName == "naisei") {
					kuniId = GameObject.Find ("NaiseiController").GetComponent<NaiseiController> ().activeKuniId;
				}
				string temp = "jyosyu" + kuniId;
				PlayerPrefs.SetInt (temp, int.Parse (busyoId));

				//Jyosyu Heiryoku
				string temp2 = "jyosyuHei" + busyoId;
				if (Application.loadedLevelName == "naisei") {
					jyosyuHei = int.Parse (GameObject.Find ("AshigaruValue").GetComponent<Text> ().text);
				}
				PlayerPrefs.SetInt (temp2, jyosyuHei);


				//Jyosyu Busyo for KuniId
				string temp3 = "jyosyuBusyo" + busyoId;
				PlayerPrefs.SetInt (temp3, kuniId);

				PlayerPrefs.Flush ();

				//Delete Box
				Destroy (GameObject.Find ("board(Clone)"));
				Destroy (GameObject.Find ("Back(Clone)"));

				//Message
				MessageBusyo msg = new MessageBusyo ();
				string text = "城主に任命致しました。";
				string type = "ninmei";
				msg.makeMessage (text, int.Parse (busyoId), type);

				//Initialization
				if (Application.loadedLevelName == "naisei") {
					NaiseiController naisei = new NaiseiController ();
					naisei.Start ();
				}else if(Application.loadedLevelName == "busyo"){
					SyoguScene syogu = new SyoguScene();
					syogu.createSyoguView(busyoId.ToString());
				}
			}
		}
	}	
Exemplo n.º 9
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();

        //Money Check
        Message msg        = new Message();
        int     nowMoney   = PlayerPrefs.GetInt("money");
        int     nowHyourou = PlayerPrefs.GetInt("hyourou");

        if (nowMoney < requiredMoney)
        {
            //Error
            //Message
            audioSources [4].Play();
            msg.makeMessage(msg.getMessage(6));
        }
        else
        {
            if (nowHyourou < requiredHyourou)
            {
                //Error
                audioSources [4].Play();
                //msg.makeMessage(msg.getMessage(7));
                msg.hyourouMovieMessage();
                GameObject.Find("close").GetComponent <CloseBoard>().onClick();
            }
            else
            {
                audioSources [3].Play();

                //Update
                //Track
                int TrackBuildMoneyNo = PlayerPrefs.GetInt("TrackBuildMoneyNo", 0);
                TrackBuildMoneyNo = TrackBuildMoneyNo + requiredMoney;
                PlayerPrefs.SetInt("TrackBuildMoneyNo", TrackBuildMoneyNo);


                string temp = "naisei" + activeKuniId.ToString();
                if (PlayerPrefs.HasKey(temp))
                {
                    //Money Reduce
                    nowMoney = nowMoney - requiredMoney;
                    PlayerPrefs.SetInt("money", nowMoney);

                    //Hyourou Reduce
                    nowHyourou = nowHyourou - requiredHyourou;
                    PlayerPrefs.SetInt("hyourou", nowHyourou);

                    /*Update Lv*/
                    //Get Data
                    string        naiseiString   = PlayerPrefs.GetString(temp);
                    List <string> naiseiList     = new List <string>();
                    char[]        delimiterChars = { ',' };
                    naiseiList = new List <string>(naiseiString.Split(delimiterChars));

                    //replace vtarget column's value by area id
                    if (areaId.Contains("shiro"))
                    {
                        //shiro
                        naiseiList[0] = targetLv.ToString();
                    }
                    else
                    {
                        //the other
                        string targetValue = naiseiId.ToString() + ":" + targetLv.ToString();
                        naiseiList[int.Parse(areaId)] = targetValue;
                    }

                    //Remake string
                    string newNaiseiString = "";
                    for (int i = 0; i < naiseiList.Count; i++)
                    {
                        if (i + 1 != naiseiList.Count)
                        {
                            newNaiseiString = newNaiseiString + naiseiList[i] + ",";
                        }
                        else
                        {
                            newNaiseiString = newNaiseiString + naiseiList[i];
                        }
                    }
                    PlayerPrefs.SetString(temp, newNaiseiString);
                    PlayerPrefs.SetBool("questDailyFlg16", true);
                    PlayerPrefs.Flush();
                }
                else
                {
                    Debug.Log("no possible error");
                }

                //Message
                string OKtext = "";
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    OKtext = "You upgraded " + naiseiName + ".\n The country is thriving.";
                }
                else
                {
                    OKtext = naiseiName + "を開発しましたぞ。\nますます国が栄えますな。";
                }
                GameObject msgObj = msg.makeMessage(OKtext);

                //Close Tab
                GameObject.Find("close").GetComponent <CloseBoard> ().onClick();

                //Initialization
                NaiseiController naisei = new NaiseiController();
                naisei.Start();
                NaiseiController naiseiObjScript = GameObject.Find("NaiseiController").GetComponent <NaiseiController>();
                naiseiObjScript.total  = int.Parse(GameObject.Find("Tabibito").transform.FindChild("TabibitoMaxValue").GetComponent <Text>().text);
                naiseiObjScript.remain = int.Parse(GameObject.Find("Tabibito").transform.FindChild("TabibitoCountDownValue").GetComponent <Text>().text);
            }
        }
    }
Exemplo n.º 10
0
	public void OnClick () {

		//Money Check
		Message msg = new Message(); 
		int nowMoney = PlayerPrefs.GetInt ("money");
		int nowHyourou = PlayerPrefs.GetInt ("hyourou");

		if (nowMoney < requiredMoney) {
			//Error
			//Message
			string Text = "金が不足しております。";
			msg.makeMessage (Text);
			
		} else {
			if (nowHyourou < requiredHyourou) {
				//Error
				string Text = "兵糧が不足しております。";
				msg.makeMessage(Text);
				
			} else {

				//Update
				string temp = "naisei" + activeKuniId.ToString ();
				if (PlayerPrefs.HasKey (temp)) {
					//Money Reduce
					nowMoney = nowMoney - requiredMoney;
					PlayerPrefs.SetInt ("money", nowMoney);

					//Hyourou Reduce
					nowHyourou = nowHyourou - requiredHyourou;
					PlayerPrefs.SetInt ("hyourou", nowHyourou);

					/*Update Lv*/
					//Get Data
					string naiseiString = PlayerPrefs.GetString (temp);
					List<string> naiseiList = new List<string>();
					char[] delimiterChars = {','};
					naiseiList = new List<string>(naiseiString.Split (delimiterChars));

					//replace vtarget column's value by area id
					if(areaId.Contains("shiro")){
						//shiro
						naiseiList[0] = targetLv.ToString();

					}else{
						//the other
						string targetValue = naiseiId.ToString() + ":" + targetLv.ToString();
						naiseiList[int.Parse(areaId)] = targetValue;
					
					}

					//Remake string
					string newNaiseiString = "";
					for(int i=0; i<naiseiList.Count; i++){
						if(i+1 != naiseiList.Count){
							newNaiseiString = newNaiseiString + naiseiList[i] + ",";
						}else{
							newNaiseiString = newNaiseiString + naiseiList[i];
						}
					}
					PlayerPrefs.SetString (temp,newNaiseiString);
					PlayerPrefs.Flush();


				}else{
					Debug.Log ("no possible error");
				}

				//Message
				string OKtext = naiseiName + "を開発しましたぞ。\nますます国が栄えますな。";
				msg.makeMessage (OKtext);
				
				//Close Tab
				GameObject.Find ("close").GetComponent<CloseBoard> ().onClick ();
				
				//Initialization
				NaiseiController naisei = new NaiseiController ();
				naisei.Start ();

			
			}
		}
	}	
Exemplo n.º 11
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();

        Message msgLine  = new Message();
        int     nowMoney = PlayerPrefs.GetInt("money");

        if (nowMoney < 1000)
        {
            audioSources [4].Play();
            msgLine.makeMessage(msgLine.getMessage(6));
        }
        else
        {
            int nowHyourou = PlayerPrefs.GetInt("hyourou");
            if (nowHyourou < 10)
            {
                audioSources [4].Play();
                //msgLine.makeMessage(msgLine.getMessage(7));
                msgLine.hyourouMovieMessage();
                GameObject.Find("close").GetComponent <CloseBoard>().onClick();
            }
            else
            {
                audioSources [3].Play();
                //Reduce Money & Hyourou
                int newMoney   = nowMoney - 1000;
                int newHyourou = nowHyourou - 10;
                PlayerPrefs.SetInt("money", newMoney);
                PlayerPrefs.SetInt("hyourou", newHyourou);

                //Jyosyu Ninmei
                if (Application.loadedLevelName == "naisei")
                {
                    kuniId = GameObject.Find("NaiseiController").GetComponent <NaiseiController> ().activeKuniId;
                }
                string temp = "jyosyu" + kuniId;
                PlayerPrefs.SetInt(temp, int.Parse(busyoId));

                //Jyosyu Heiryoku
                string temp2 = "jyosyuHei" + busyoId;
                if (Application.loadedLevelName == "naisei")
                {
                    jyosyuHei = int.Parse(GameObject.Find("AshigaruValue").GetComponent <Text> ().text);
                }
                PlayerPrefs.SetInt(temp2, jyosyuHei);

                //Track
                int TrackJyosyuNinmeiNo = PlayerPrefs.GetInt("TrackJyosyuNinmeiNo", 0);
                TrackJyosyuNinmeiNo = TrackJyosyuNinmeiNo + 1;
                PlayerPrefs.SetInt("TrackJyosyuNinmeiNo", TrackJyosyuNinmeiNo);


                //Jyosyu Busyo for KuniId
                string temp3 = "jyosyuBusyo" + busyoId;
                PlayerPrefs.SetInt(temp3, kuniId);
                PlayerPrefs.SetBool("questSpecialFlg9", true);
                PlayerPrefs.Flush();


                //Delete Box
                Destroy(GameObject.Find("board(Clone)"));
                Destroy(GameObject.Find("Back(Clone)"));

                //Message
                MessageBusyo msg  = new MessageBusyo();
                string       text = msgLine.getMessage(88);
                string       type = "ninmei";
                msg.makeMessage(text, int.Parse(busyoId), type);

                //Initialization
                if (Application.loadedLevelName == "naisei")
                {
                    NaiseiController naisei = new NaiseiController();
                    naisei.Start();
                }
                else if (Application.loadedLevelName == "busyo")
                {
                    SyoguScene syogu = new SyoguScene();
                    syogu.createSyoguView(busyoId.ToString());
                }
            }
        }
    }
Exemplo n.º 12
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource>();

        //Item Check
        Message msg       = new Message();
        string  tempParam = "";
        int     qty       = 0;

        if (techId == 1)
        {
            tempParam = "transferTP";
        }
        else if (techId == 2)
        {
            tempParam = "transferKB";
        }
        else if (techId == 3)
        {
            tempParam = "transferSNB";
        }

        qty = PlayerPrefs.GetInt(tempParam);
        int nowHyourou = PlayerPrefs.GetInt("hyourou");

        if (qty < 1)
        {
            //Error
            //Message
            msg.makeMessage(msg.getMessage(129));
            audioSources[4].Play();
        }
        else
        {
            if (nowHyourou < requiredHyourou)
            {
                //Error
                msg.makeMessage(msg.getMessage(7));
                audioSources[4].Play();
            }
            else
            {
                audioSources[3].Play();

                activeKuniId = GameObject.Find("NaiseiController").GetComponent <NaiseiController> ().activeKuniId;
                string temp = "naisei" + activeKuniId.ToString();

                //Defalt=> 1,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0
                string        naiseiString   = PlayerPrefs.GetString(temp);
                List <string> naiseiList     = new List <string> ();
                char[]        delimiterChars = { ',' };
                naiseiList = new List <string> (naiseiString.Split(delimiterChars));

                string newNaiseiString = "";
                for (int i = 0; i < naiseiList.Count; i++)
                {
                    if (i == panelId)
                    {
                        string newParam = naiseiId.ToString() + ":1";
                        newNaiseiString = newNaiseiString + "," + newParam;
                    }
                    else
                    {
                        if (newNaiseiString == "")
                        {
                            newNaiseiString = naiseiList [i];
                        }
                        else
                        {
                            newNaiseiString = newNaiseiString + "," + naiseiList [i];
                        }
                    }
                }


                /*Reduce Item & Hyourou*/
                //Item
                int resultItem    = qty - 1;
                int resultHyourou = nowHyourou - requiredHyourou;
                PlayerPrefs.SetInt(tempParam, resultItem);
                PlayerPrefs.SetInt("hyourou", resultHyourou);


                PlayerPrefs.SetString(temp, newNaiseiString);
                PlayerPrefs.Flush();

                //Message
                string OKtext = "";
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    OKtext = "You built " + naiseiName + ".\n The country is thriving.";
                }
                else
                {
                    OKtext = naiseiName + "を建築しましたぞ。\n国が栄えますな。";
                }

                msg.makeMessage(OKtext);

                //Close Tab
                GameObject.Find("close").GetComponent <CloseBoard> ().onClick();

                //Initialization
                NaiseiController naisei = new NaiseiController();
                naisei.Start();
            }
        }
    }