Exemplo n.º 1
0
	public void OnClick(){

		//Pop View
		BusyoStatusButton pop = new BusyoStatusButton ();
		pop.commonPopup ();
		GameObject.Find ("popText").GetComponent<Text> ().text ="武将登用";

		//Busyo View
		string path = "Prefabs/Player/Unit/" + busyoId;
		GameObject Busyo = Instantiate (Resources.Load (path)) as GameObject;			
		Busyo.transform.SetParent (GameObject.Find ("board(Clone)").transform);
		Busyo.transform.localScale = new Vector2 (5, 5);
		Busyo.GetComponent<DragHandler>().enabled = false;
		RectTransform busyo_transform = Busyo.GetComponent<RectTransform>();
		busyo_transform.anchoredPosition = new Vector3(350,300,0);
		busyo_transform.sizeDelta = new Vector2( 100, 100);

		//Text Modification
		Busyo.transform.FindChild ("Text").gameObject.GetComponent<Text>().enabled = false;

		//Rank Text Modification
		GameObject rank = Busyo.transform.FindChild ("Rank").gameObject;
		RectTransform rank_transform = rank.GetComponent<RectTransform>();
		rank_transform.anchoredPosition = new Vector3 (0,-50,0);
		rank_transform.sizeDelta = new Vector2( 200, 200);
		rank.GetComponent<Text>().fontSize = 200;

		/*Status*/
		string statusPath = "Prefabs/Touyou/busyoStatus";
		GameObject status = Instantiate (Resources.Load (statusPath)) as GameObject;			
		status.transform.SetParent (GameObject.Find ("board(Clone)").transform);
		status.transform.localScale = new Vector2 (1, 1);
		RectTransform status_transform = status.GetComponent<RectTransform>();
		status_transform.anchoredPosition = new Vector3(245,-40,0);


		Entity_busyo_mst busyoMst  = Resources.Load ("Data/busyo_mst") as Entity_busyo_mst;
		Entity_senpou_mst senpouMst  = Resources.Load ("Data/senpou_mst") as Entity_senpou_mst;
		string busyoName = busyoMst.param [busyoId-1].name;
		GameObject.Find ("busyoNameValue").GetComponent<Text>().text = busyoName;
		GameObject.Find ("TosotsuValue").GetComponent<Text>().text = busyoMst.param [busyoId-1].minHp.ToString() + "00";
		GameObject.Find ("BuyuuValue").GetComponent<Text> ().text = busyoMst.param [busyoId - 1].minAtk.ToString () + "0";
		GameObject.Find ("ChiryakuValue").GetComponent<Text>().text = busyoMst.param [busyoId-1].minDfc.ToString() + "0";
		GameObject.Find ("SpeedValue").GetComponent<Text>().text = busyoMst.param [busyoId-1].minSpd.ToString();

		string heisyuType = busyoMst.param [busyoId - 1].heisyu;
		string heisyu = "";
		if (heisyuType == "KB") {
			heisyu = "騎馬隊";
		} else if (heisyuType == "YR") {
			heisyu = "槍隊";
		} else if (heisyuType == "TP") {
			heisyu = "鉄砲隊";
		} else if (heisyuType == "YM") {
			heisyu = "弓隊";
		}

		GameObject.Find ("ChildNameValue").GetComponent<Text>().text = heisyu;

		int senpouId = busyoMst.param [busyoId-1].senpou_id;
		GameObject.Find ("SenpouValue").GetComponent<Text>().text = senpouMst.param[senpouId-1].name;
		int senpouStatus = senpouMst.param [senpouId - 1].lv1;
		int each = (int)senpouMst.param [senpouId - 1].each;
		int ratio = (int)senpouMst.param [senpouId - 1].ratio;
		int term = (int)senpouMst.param [senpouId - 1].term;
		string senpouExp = senpouMst.param [senpouId - 1].effection;
		senpouExp = senpouExp.Replace("A", senpouStatus.ToString());
		senpouExp = senpouExp.Replace("B", each.ToString());
		senpouExp = senpouExp.Replace("C", ratio.ToString());
		senpouExp = senpouExp.Replace("D", term.ToString());

		GameObject.Find ("SenpouExpValue").GetComponent<Text>().text = senpouExp;


		/*Saku*/
		Saku saku = new Saku ();
		List<string> sakuList = new List<string>();
		sakuList = saku.getSakuInfo (busyoId);
		
		//Icon
		string sakuPath = "Prefabs/Saku/saku" + sakuList[0];
		GameObject sakuIcon = Instantiate (Resources.Load (sakuPath)) as GameObject;
		GameObject StatusSaku = status.transform.FindChild("StatusSaku").gameObject;
		foreach ( Transform n in StatusSaku.transform ){
			if(n.tag == "Saku"){
				GameObject.Destroy(n.gameObject);
			}
		}
		sakuIcon.transform.SetParent (StatusSaku.transform);
		sakuIcon.transform.localScale = new Vector2 (0.7f, 0.7f);
		sakuIcon.GetComponent<Button>().enabled = false;
		RectTransform sakuIcon_transform = sakuIcon.GetComponent<RectTransform>();
		sakuIcon_transform.anchoredPosition = new Vector3(-235,0,0);
		
		StatusSaku.transform.FindChild("SakuExp").transform.FindChild("SakuExpValue").GetComponent<Text>().text = sakuList[2];

		/*daimyo busyo check*/
		Daimyo daimyo = new Daimyo ();
		daimyoFlg = daimyo.daimyoBusyoCheck (busyoId);

		//pass data to button
		GameObject touyouBtn = GameObject.Find ("TouyouButton").gameObject;
		touyouBtn.GetComponent<DoTouyou> ().busyoId = busyoId;
		touyouBtn.GetComponent<DoTouyou> ().busyoName = busyoName;
		touyouBtn.GetComponent<DoTouyou> ().heisyu = heisyuType;
		touyouBtn.GetComponent<DoTouyou> ().sequence = int.Parse(name);
		touyouBtn.GetComponent<DoTouyou> ().rank = busyoRank;
		touyouBtn.GetComponent<DoTouyou> ().daimyoFlg = daimyoFlg;
	}
Exemplo n.º 2
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();
        audioSources [0].Play();

        //Panel
        GameObject.Find("Touyou").GetComponent <Canvas>().sortingLayerName = "unit";

        //Pop View
        BusyoStatusButton pop   = new BusyoStatusButton();
        GameObject        board = pop.commonPopup(27);

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            GameObject.Find("popText").GetComponent <Text> ().text = "Samurai Recruitment";
        }
        else
        {
            GameObject.Find("popText").GetComponent <Text>().text = "武将登用";
        }
        //Kamon
        string     kamonPath = "Prefabs/Touyou/kamon";
        GameObject kamon     = Instantiate(Resources.Load(kamonPath)) as GameObject;

        kamon.transform.SetParent(board.transform);
        kamon.transform.localScale    = new Vector2(1, 1);
        kamon.transform.localPosition = new Vector2(-310, 0);
        BusyoInfoGet busyoScript = new BusyoInfoGet();
        int          daimyoId    = busyoScript.getDaimyoId(busyoId);

        if (daimyoId == 0)
        {
            daimyoId = busyoScript.getDaimyoHst(busyoId);
        }
        string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString();

        kamon.GetComponent <Image> ().sprite =
            Resources.Load(imagePath, typeof(Sprite)) as Sprite;

        //Busyo View
        string     path  = "Prefabs/Player/Unit/BusyoUnit";
        GameObject Busyo = Instantiate(Resources.Load(path)) as GameObject;

        Busyo.name = busyoId.ToString();
        Busyo.transform.SetParent(board.transform);
        Busyo.transform.localScale = new Vector2(3.5f, 3.5f);
        Busyo.GetComponent <DragHandler>().enabled = false;
        RectTransform busyo_transform = Busyo.GetComponent <RectTransform>();

        busyo_transform.anchoredPosition = new Vector3(350, 300, 0);
        busyo_transform.sizeDelta        = new Vector2(100, 100);

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

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

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


        //Text Modification
        Busyo.transform.FindChild("Text").gameObject.GetComponent <Text>().enabled = false;

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

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

        /*Status*/
        string     statusPath = "Prefabs/Touyou/busyoStatus";
        GameObject status     = Instantiate(Resources.Load(statusPath)) as GameObject;

        status.transform.SetParent(board.transform);
        status.transform.localScale = new Vector2(1, 1);
        RectTransform status_transform = status.GetComponent <RectTransform>();

        status_transform.anchoredPosition = new Vector3(245, -40, 0);


        Entity_busyo_mst  busyoMst  = Resources.Load("Data/busyo_mst") as Entity_busyo_mst;
        Entity_senpou_mst senpouMst = Resources.Load("Data/senpou_mst") as Entity_senpou_mst;
        string            busyoName = busyoScript.getName(busyoId);

        GameObject.Find("busyoNameValue").GetComponent <Text>().text = busyoName;
        GameObject.Find("TosotsuValue").GetComponent <Text>().text   = busyoMst.param [busyoId - 1].minHp.ToString() + "00";
        GameObject.Find("BuyuuValue").GetComponent <Text> ().text    = busyoMst.param [busyoId - 1].minAtk.ToString() + "0";
        GameObject.Find("ChiryakuValue").GetComponent <Text>().text  = busyoMst.param [busyoId - 1].minDfc.ToString() + "0";
        GameObject.Find("SpeedValue").GetComponent <Text>().text     = busyoMst.param [busyoId - 1].minSpd.ToString();

        string  heisyuType = busyoMst.param [busyoId - 1].heisyu;
        string  heisyu     = "";
        Message msg        = new Message();

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

        GameObject.Find("ChildNameValue").GetComponent <Text>().text = heisyu;

        int senpouId = busyoMst.param [busyoId - 1].senpou_id;

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            GameObject.Find("SenpouValue").GetComponent <Text>().text = senpouMst.param[senpouId - 1].nameEng;
        }
        else
        {
            GameObject.Find("SenpouValue").GetComponent <Text>().text = senpouMst.param[senpouId - 1].name;
        }
        int    senpouStatus = senpouMst.param [senpouId - 1].lv1;
        int    each         = (int)senpouMst.param [senpouId - 1].each;
        int    ratio        = (int)senpouMst.param [senpouId - 1].ratio;
        int    term         = (int)senpouMst.param [senpouId - 1].term;
        string senpouExp    = "";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            senpouExp = senpouMst.param [senpouId - 1].effectionEng;
        }
        else
        {
            senpouExp = senpouMst.param[senpouId - 1].effection;
        }
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            senpouExp = senpouExp.Replace("ABC", senpouStatus.ToString());
            senpouExp = senpouExp.Replace("DEF", each.ToString());
            senpouExp = senpouExp.Replace("GHI", ratio.ToString());
            senpouExp = senpouExp.Replace("JKL", term.ToString());
        }
        else
        {
            senpouExp = senpouExp.Replace("A", senpouStatus.ToString());
            senpouExp = senpouExp.Replace("B", each.ToString());
            senpouExp = senpouExp.Replace("C", ratio.ToString());
            senpouExp = senpouExp.Replace("D", term.ToString());
        }
        GameObject.Find("SenpouExpValue").GetComponent <Text>().text = senpouExp;


        /*Saku*/
        Saku          saku     = new Saku();
        List <string> sakuList = new List <string>();

        sakuList = saku.getSakuInfo(busyoId);

        //Icon
        string     sakuPath   = "Prefabs/Saku/saku" + sakuList[0];
        GameObject sakuIcon   = Instantiate(Resources.Load(sakuPath)) as GameObject;
        GameObject StatusSaku = status.transform.FindChild("StatusSaku").gameObject;

        foreach (Transform n in StatusSaku.transform)
        {
            if (n.tag == "Saku")
            {
                GameObject.Destroy(n.gameObject);
            }
        }
        sakuIcon.transform.SetParent(StatusSaku.transform);
        sakuIcon.transform.localScale            = new Vector2(0.7f, 0.7f);
        sakuIcon.GetComponent <Button>().enabled = false;
        RectTransform sakuIcon_transform = sakuIcon.GetComponent <RectTransform>();

        sakuIcon_transform.anchoredPosition = new Vector3(-235, 0, 0);

        StatusSaku.transform.FindChild("SakuExp").transform.FindChild("SakuExpValue").GetComponent <Text>().text = sakuList[2];

        /*daimyo busyo check*/
        Daimyo daimyo = new Daimyo();

        daimyoFlg = daimyo.daimyoBusyoCheck(busyoId);

        //pass data to button
        GameObject touyouBtn = GameObject.Find("TouyouButton").gameObject;

        touyouBtn.GetComponent <DoTouyou> ().busyoId   = busyoId;
        touyouBtn.GetComponent <DoTouyou> ().busyoName = busyoName;
        touyouBtn.GetComponent <DoTouyou> ().heisyu    = heisyuType;
        touyouBtn.GetComponent <DoTouyou> ().sequence  = int.Parse(name);
        touyouBtn.GetComponent <DoTouyou> ().rank      = busyoRank;
        touyouBtn.GetComponent <DoTouyou> ().daimyoFlg = daimyoFlg;


        //Tutorial
        if (Application.loadedLevelName == "tutorialTouyou")
        {
            TutorialController tutorialScript = new TutorialController();
            Vector2            vect           = new Vector2(0, 50);
            GameObject         btn            = tutorialScript.SetPointer(touyouBtn, vect);
            btn.transform.localScale = new Vector2(150, 150);
        }

        //Hired Check
        if (Application.loadedLevelName != "tutorialTouyou")
        {
            string myBusyo        = PlayerPrefs.GetString("myBusyo");
            char[] delimiterChars = { ',' };

            if (myBusyo != null && myBusyo != "")
            {
                List <string> myBusyoList = new List <string>();
                if (myBusyo.Contains(","))
                {
                    myBusyoList = new List <string>(myBusyo.Split(delimiterChars));
                }
                else
                {
                    myBusyoList.Add(myBusyo);
                }

                if (myBusyoList.Contains(busyoId.ToString()))
                {
                    msg.makeMessage(msg.getMessage(137));
                }
            }
            //Zukan Check
            string zukanBusyoHst = PlayerPrefs.GetString("zukanBusyoHst");
            if (zukanBusyoHst != null && zukanBusyoHst != "")
            {
                List <string> myZukanList = new List <string>();
                if (zukanBusyoHst.Contains(","))
                {
                    myZukanList = new List <string>(zukanBusyoHst.Split(delimiterChars));
                }
                else
                {
                    myZukanList.Add(zukanBusyoHst);
                }

                if (myZukanList.Contains(busyoId.ToString()))
                {
                    string     zukanPath = "Prefabs/Touyou/Zukan";
                    GameObject zukan     = Instantiate(Resources.Load(zukanPath)) as GameObject;
                    zukan.transform.SetParent(board.transform);
                    zukan.transform.localScale    = new Vector2(1, 1);
                    zukan.transform.localPosition = new Vector2(-41, 167);
                }
            }
        }
    }
Exemplo n.º 3
0
    public void receiveBusyo(int busyoId)
    {
        //Common
        BusyoInfoGet BusyoInfoGet = new BusyoInfoGet();
        string       busyoName    = BusyoInfoGet.getName(busyoId);
        string       heisyu       = BusyoInfoGet.getHeisyu(busyoId);
        string       rank         = BusyoInfoGet.getRank(busyoId);
        int          myBusyoQty   = PlayerPrefs.GetInt("myBusyoQty");

        //Tracking
        int TrackNewBusyoHireNo = PlayerPrefs.GetInt("TrackNewBusyoHireNo", 0);

        TrackNewBusyoHireNo = TrackNewBusyoHireNo + 1;
        PlayerPrefs.SetInt("TrackNewBusyoHireNo", TrackNewBusyoHireNo);

        //Add zukan & gacya History Start
        string zukanBusyoHst = PlayerPrefs.GetString("zukanBusyoHst");

        if (zukanBusyoHst != null && zukanBusyoHst != "")
        {
            zukanBusyoHst = zukanBusyoHst + "," + busyoId.ToString();
        }
        else
        {
            zukanBusyoHst = busyoId.ToString();
        }
        PlayerPrefs.SetString("zukanBusyoHst", zukanBusyoHst);

        //Daimyo Busyo History
        Daimyo daimyo = new Daimyo();

        if (daimyo.daimyoBusyoCheck(busyoId))
        {
            string gacyaDaimyoHst = PlayerPrefs.GetString("gacyaDaimyoHst");
            if (gacyaDaimyoHst != null && gacyaDaimyoHst != "")
            {
                gacyaDaimyoHst = gacyaDaimyoHst + "," + busyoId.ToString();
            }
            else
            {
                gacyaDaimyoHst = busyoId.ToString();
            }
            PlayerPrefs.SetString("gacyaDaimyoHst", gacyaDaimyoHst);
        }

        //My Busyo Exist Check
        string myBusyoString = PlayerPrefs.GetString("myBusyo");

        char[]        delimiterChars = { ',' };
        List <string> myBusyoList    = new List <string>();

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

        if (myBusyoList.Contains(busyoId.ToString()))
        {
            //add lv
            string addLvTmp   = "addlv" + busyoId.ToString();
            int    addLvValue = 0;
            if (PlayerPrefs.HasKey(addLvTmp))
            {
                addLvValue = PlayerPrefs.GetInt(addLvTmp);
                addLvValue = addLvValue + 1;
                if (addLvValue >= 100)
                {
                    addLvValue = 100;
                }
            }
            else
            {
                addLvValue = 1;
            }

            if (addLvValue < 100)
            {
                PlayerPrefs.SetInt(addLvTmp, addLvValue);
                PlayerPrefs.Flush();

                MessageBusyo msg     = new MessageBusyo();
                string       type    = "touyou";
                string       msgText = "";
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    msgText = "Max Lv of " + busyoName + " increased.";
                }
                else
                {
                    msgText = busyoName + "の最大レベルが1上がりました。";
                }
                msg.makeMessage(msgText, busyoId, type);
            }
            else
            {
                //Lv up
                int currentLv = PlayerPrefs.GetInt(busyoId.ToString());
                int maxLv     = 100 + addLvValue;

                int    newLv    = 0;
                string lvUpText = "";

                //Already Lv Max
                if (currentLv == maxLv)
                {
                    newLv = currentLv;
                    int busyoDama = 0;
                    if (rank == "S")
                    {
                        busyoDama = 200;
                    }
                    else if (rank == "A")
                    {
                        busyoDama = 50;
                    }
                    else if (rank == "B")
                    {
                        busyoDama = 20;
                    }
                    else if (rank == "C")
                    {
                        busyoDama = 10;
                    }
                    int myBusyoDama = PlayerPrefs.GetInt("busyoDama");
                    myBusyoDama = myBusyoDama + busyoDama;
                    PlayerPrefs.SetInt("busyoDama", myBusyoDama);
                    if (Application.systemLanguage != SystemLanguage.Japanese)
                    {
                        lvUpText = "You got " + busyoDama + " stone.";
                    }
                    else
                    {
                        lvUpText = "武将珠" + busyoDama + "個を贈呈します。";
                    }
                }
                PlayerPrefs.SetInt(busyoId.ToString(), newLv);

                if (currentLv != maxLv)
                {
                    string exp      = "exp" + busyoId.ToString();
                    Exp    expCalc  = new Exp();
                    int    totalExp = expCalc.getExpforNextLv(currentLv);
                    PlayerPrefs.SetInt(exp, totalExp);
                }

                MessageBusyo msg  = new MessageBusyo();
                string       type = "touyou";
                msg.makeMessage(lvUpText, busyoId, type);
            }
        }
        else
        {
            int existCheck = PlayerPrefs.GetInt(busyoId.ToString());
            if (existCheck != 0 && existCheck != null)
            {
                //my Busyo not contain but player used him before daimyo was changed
                if (myBusyoString == null || myBusyoString == "")
                {
                    myBusyoString = busyoId.ToString();
                }
                else
                {
                    myBusyoString = myBusyoString + "," + busyoId.ToString();
                }
                PlayerPrefs.SetString("myBusyo", myBusyoString);

                //Add Qty
                myBusyoQty = myBusyoQty + 1;
                PlayerPrefs.SetInt("myBusyoQty", myBusyoQty);

                MessageBusyo msg         = new MessageBusyo();
                string       touyouuText = "";
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    touyouuText = "We hired " + busyoName + ".";
                }
                else
                {
                    touyouuText = busyoName + "を登用しました。";
                }
                string type = "touyou";
                msg.makeMessage(touyouuText, busyoId, type);
            }
            else
            {
                //Add Completely New Data
                if (myBusyoString == null || myBusyoString == "")
                {
                    myBusyoString = busyoId.ToString();
                }
                else
                {
                    myBusyoString = myBusyoString + "," + busyoId.ToString();
                }
                PlayerPrefs.SetString("myBusyo", myBusyoString);
                PlayerPrefs.SetInt(busyoId.ToString(), 1);

                string hei      = "hei" + busyoId.ToString();
                string heiValue = heisyu + ":1:1:1";
                PlayerPrefs.SetString(hei, heiValue);

                string senpou = "senpou" + busyoId.ToString();
                PlayerPrefs.SetInt(senpou, 1); //Lv

                string saku = "saku" + busyoId.ToString();
                PlayerPrefs.SetInt(saku, 1); //Lv

                string kahou = "kahou" + busyoId.ToString();
                PlayerPrefs.SetString(kahou, "0,0,0,0,0,0,0,0");

                string exp = "exp" + busyoId.ToString();
                PlayerPrefs.SetInt(exp, 0);

                //Add Qty
                myBusyoQty = myBusyoQty + 1;
                PlayerPrefs.SetInt("myBusyoQty", myBusyoQty);

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

                MessageBusyo msg         = new MessageBusyo();
                string       touyouuText = "";
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    touyouuText = "We hired " + busyoName + ".";
                }
                else
                {
                    touyouuText = busyoName + "を登用しました。";
                }
                string type = "touyou";
                msg.makeMessage(touyouuText, busyoId, type);
            }
        }
    }
Exemplo n.º 4
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();


        //Limit Check
        int stockLimit = PlayerPrefs.GetInt("stockLimit");
        int myBusyoQty = PlayerPrefs.GetInt("myBusyoQty");

        char[] delimiterChars = { ',' };

        if (myBusyoQty + 1 > stockLimit && Application.loadedLevelName != "tutorialTouyou")
        {
            //Error
            audioSources [4].Play();
            Message msg  = new Message();
            string  Text = "";
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                Text = "You can hire samurai by " + stockLimit.ToString() + " members.";
            }
            else
            {
                Text = "現在の国力では登用出来る武将数は" + stockLimit.ToString() + "人までですぞ。";
            }
            msg.makeMessage(Text);
        }
        else
        {
            audioSources [3].Play();
            audioSources [7].Play();
            GameObject.Find("Touyou").GetComponent <Canvas>().sortingLayerName = "Default";

            //Track
            bool tutorialDoneFlg = PlayerPrefs.GetBool("tutorialDoneFlg");
            if (!tutorialDoneFlg || Application.loadedLevelName != "tutorialTouyou")
            {
                int TrackNewBusyoHireNo = PlayerPrefs.GetInt("TrackNewBusyoHireNo", 0);
                TrackNewBusyoHireNo = TrackNewBusyoHireNo + 1;
                PlayerPrefs.SetInt("TrackNewBusyoHireNo", TrackNewBusyoHireNo);


                /*Add zukan & gacya History Start*/
                string zukanBusyoHst = PlayerPrefs.GetString("zukanBusyoHst");
                if (zukanBusyoHst != null && zukanBusyoHst != "")
                {
                    zukanBusyoHst = zukanBusyoHst + "," + busyoId.ToString();
                }
                else
                {
                    zukanBusyoHst = busyoId.ToString();
                }
                PlayerPrefs.SetString("zukanBusyoHst", zukanBusyoHst);

                //Daimyo Busyo History
                Daimyo daimyo = new Daimyo();
                if (daimyo.daimyoBusyoCheck(busyoId))
                {
                    string gacyaDaimyoHst = PlayerPrefs.GetString("gacyaDaimyoHst");
                    if (gacyaDaimyoHst != null && gacyaDaimyoHst != "")
                    {
                        gacyaDaimyoHst = gacyaDaimyoHst + "," + busyoId.ToString();
                    }
                    else
                    {
                        gacyaDaimyoHst = busyoId.ToString();
                    }
                    PlayerPrefs.SetString("gacyaDaimyoHst", gacyaDaimyoHst);
                }

                //sequence
                string sequenceString = "";
                if (sequence == 1)
                {
                    sequenceString = "1,0,0";
                }
                else if (sequence == 2)
                {
                    sequenceString = "0,1,0";
                }
                else if (sequence == 3)
                {
                    sequenceString = "0,0,1";
                }
                PlayerPrefs.SetString("touyouHst", sequenceString);

                if (rank == "S")
                {
                    PlayerPrefs.SetBool("questSpecialFlg0", true);
                }
                else if (rank == "A")
                {
                    PlayerPrefs.SetBool("questSpecialFlg1", true);
                }
                PlayerPrefs.Flush();
                /*Add zukan & gacya History End*/



                //My Busyo Exist Check
                string        myBusyoString = PlayerPrefs.GetString("myBusyo");
                List <string> myBusyoList   = new List <string>();
                if (myBusyoString.Contains(","))
                {
                    myBusyoList = new List <string>(myBusyoString.Split(delimiterChars));
                }
                else
                {
                    myBusyoList.Add(myBusyoString);
                }

                if (myBusyoList.Contains(busyoId.ToString()))
                {
                    //add lv
                    string addLvTmp   = "addlv" + busyoId.ToString();
                    int    addLvValue = 0;
                    if (PlayerPrefs.HasKey(addLvTmp))
                    {
                        addLvValue = PlayerPrefs.GetInt(addLvTmp);
                        addLvValue = addLvValue + 1;
                        if (addLvValue >= 100)
                        {
                            addLvValue = 100;
                        }
                    }
                    else
                    {
                        addLvValue = 1;
                    }

                    if (addLvValue < 100)
                    {
                        PlayerPrefs.SetInt(addLvTmp, addLvValue);
                        PlayerPrefs.Flush();

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

                        MessageBusyo msg     = new MessageBusyo();
                        string       type    = "touyou";
                        string       msgText = "";
                        if (Application.systemLanguage != SystemLanguage.Japanese)
                        {
                            msgText = "Max Lv of " + busyoName + " increased.";
                        }
                        else
                        {
                            msgText = busyoName + "の最大レベルが1上がりました。";
                        }
                        msg.makeMessage(msgText, busyoId, type);
                    }
                    else
                    {
                        //Lv up
                        int currentLv = PlayerPrefs.GetInt(busyoId.ToString());
                        int maxLv     = 100 + addLvValue;

                        int    newLv    = 0;
                        string lvUpText = "";

                        //Already Lv Max
                        if (currentLv == maxLv)
                        {
                            newLv = currentLv;
                            int busyoDama = 0;
                            if (rank == "S")
                            {
                                busyoDama = 200;
                            }
                            else if (rank == "A")
                            {
                                busyoDama = 50;
                            }
                            else if (rank == "B")
                            {
                                busyoDama = 20;
                            }
                            else if (rank == "C")
                            {
                                busyoDama = 10;
                            }

                            int myBusyoDama = PlayerPrefs.GetInt("busyoDama");
                            myBusyoDama = myBusyoDama + busyoDama;
                            PlayerPrefs.SetInt("busyoDama", myBusyoDama);
                            if (Application.systemLanguage != SystemLanguage.Japanese)
                            {
                                lvUpText = "You got " + busyoDama + " stone.";
                            }
                            else
                            {
                                lvUpText = "武将珠" + busyoDama + "個を贈呈します。";
                            }
                            GameObject.Find("BusyoDamaValue").GetComponent <Text> ().text = myBusyoDama.ToString();
                        }
                        else
                        {
                            newLv = currentLv + 1;
                            if (Application.systemLanguage != SystemLanguage.Japanese)
                            {
                                lvUpText = busyoName + " Lv was increased.";
                            }
                            else
                            {
                                lvUpText = busyoName + "をレベルアップしました。";
                            }
                        }
                        PlayerPrefs.SetInt(busyoId.ToString(), newLv);

                        if (currentLv != maxLv)
                        {
                            string exp      = "exp" + busyoId.ToString();
                            Exp    expCalc  = new Exp();
                            int    totalExp = expCalc.getExpforNextLv(currentLv);
                            PlayerPrefs.SetInt(exp, totalExp);
                        }

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

                        MessageBusyo msg = new MessageBusyo();

                        string type = "touyou";
                        msg.makeMessage(lvUpText, busyoId, type);
                    }
                }
                else
                {
                    int existCheck = PlayerPrefs.GetInt(busyoId.ToString());
                    if (existCheck != 0 && existCheck != null)
                    {
                        //my Busyo not contain but player used him before daimyo was changed
                        if (myBusyoString == null || myBusyoString == "")
                        {
                            myBusyoString = busyoId.ToString();
                        }
                        else
                        {
                            myBusyoString = myBusyoString + "," + busyoId.ToString();
                        }
                        PlayerPrefs.SetString("myBusyo", myBusyoString);

                        //Add Qty
                        myBusyoQty = myBusyoQty + 1;
                        PlayerPrefs.SetInt("myBusyoQty", myBusyoQty);

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

                        MessageBusyo msg         = new MessageBusyo();
                        string       touyouuText = "";
                        if (Application.systemLanguage != SystemLanguage.Japanese)
                        {
                            touyouuText = "We hired " + busyoName + ".";
                        }
                        else
                        {
                            touyouuText = busyoName + "を登用しました。";
                        }
                        string type = "touyou";
                        msg.makeMessage(touyouuText, busyoId, type);
                    }
                    else
                    {
                        //Add Completely New Data
                        if (myBusyoString == null || myBusyoString == "")
                        {
                            myBusyoString = busyoId.ToString();
                        }
                        else
                        {
                            myBusyoString = myBusyoString + "," + busyoId.ToString();
                        }
                        PlayerPrefs.SetString("myBusyo", myBusyoString);
                        PlayerPrefs.SetInt(busyoId.ToString(), 1);

                        string hei      = "hei" + busyoId.ToString();
                        string heiValue = heisyu + ":1:1:1";
                        PlayerPrefs.SetString(hei, heiValue);

                        string senpou = "senpou" + busyoId.ToString();
                        PlayerPrefs.SetInt(senpou, 1);                  //Lv

                        string saku = "saku" + busyoId.ToString();
                        PlayerPrefs.SetInt(saku, 1);                  //Lv

                        string kahou = "kahou" + busyoId.ToString();
                        PlayerPrefs.SetString(kahou, "0,0,0,0,0,0,0,0");

                        string exp = "exp" + busyoId.ToString();
                        PlayerPrefs.SetInt(exp, 0);

                        //Add Qty
                        myBusyoQty = myBusyoQty + 1;
                        PlayerPrefs.SetInt("myBusyoQty", myBusyoQty);

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

                        MessageBusyo msg         = new MessageBusyo();
                        string       touyouuText = "";
                        if (Application.systemLanguage != SystemLanguage.Japanese)
                        {
                            touyouuText = "We hired " + busyoName + ".";
                        }
                        else
                        {
                            touyouuText = busyoName + "を登用しました。";
                        }
                        string type = "touyou";
                        msg.makeMessage(touyouuText, busyoId, type);
                    }
                }
            }
            else
            {
                //retry tutorial

                PlayerPrefs.SetInt("tutorialBusyo", busyoId);
                PlayerPrefs.Flush();

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

                MessageBusyo msg         = new MessageBusyo();
                string       touyouuText = "";
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    touyouuText = "We hired " + busyoName + ".";
                }
                else
                {
                    touyouuText = busyoName + "を登用しました。";
                }
                string type = "touyou";
                msg.makeMessage(touyouuText, busyoId, type);
            }
        }
        PlayerPrefs.Flush();

        //Close Process
        string gacyaHst = "";

        if (Application.loadedLevelName == "tutorialTouyou")
        {
            gacyaHst = "4,16,201";

            //Set Parametor
            PlayerPrefs.SetInt("tutorialId", 9);
            PlayerPrefs.Flush();

            TextController txtScript = GameObject.Find("TextBoard").transform.FindChild("Text").GetComponent <TextController>();
            txtScript.SetText(8);
            txtScript.SetNextLine();
            txtScript.tutorialId = 8;
            txtScript.actOnFlg   = false;

            //Center View
            GameObject centerView = GameObject.Find("CenterView").gameObject;
            centerView.transform.SetParent(GameObject.Find("tFinished").transform);
        }
        else
        {
            gacyaHst = PlayerPrefs.GetString("gacyaHst");
        }
        string[] tokens   = gacyaHst.Split(delimiterChars);
        int[]    hitBusyo = Array.ConvertAll <string, int>(tokens, int.Parse);

        Gacya viewBusyo = new Gacya();

        viewBusyo.viewBusyo(hitBusyo, false);
    }
Exemplo n.º 5
0
    public void OnClick()
    {
        /*Receive Item*/
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();
        audioSources [3].Play();

        //Item1
        string        gameClearDaimyo     = PlayerPrefs.GetString("gameClearDaimyo");
        bool          hardFlg             = PlayerPrefs.GetBool("hardFlg");
        List <string> gameClearDaimyoList = new List <string> ();

        char[] delimiterChars = { ',' };
        if (gameClearDaimyo != null && gameClearDaimyo != "")
        {
            if (gameClearDaimyo.Contains(","))
            {
                gameClearDaimyoList = new List <string> (gameClearDaimyo.Split(delimiterChars));
            }
            else
            {
                gameClearDaimyoList.Add(gameClearDaimyo);
            }
        }
        int myDaimyo = PlayerPrefs.GetInt("myDaimyo");

        if (!gameClearDaimyoList.Contains(myDaimyo.ToString()))
        {
            if (gameClearDaimyo != null && gameClearDaimyo != "")
            {
                gameClearDaimyo = gameClearDaimyo + "," + myDaimyo.ToString();
            }
            else
            {
                gameClearDaimyo = myDaimyo.ToString();
            }
            PlayerPrefs.SetString("gameClearDaimyo", gameClearDaimyo);
        }

        //Hard mode
        if (hardFlg)
        {
            string        gameClearDaimyoHard     = PlayerPrefs.GetString("gameClearDaimyoHard");
            List <string> gameClearDaimyoHardList = new List <string>();
            if (gameClearDaimyoHard != null && gameClearDaimyoHard != "")
            {
                if (gameClearDaimyoHard.Contains(","))
                {
                    gameClearDaimyoHardList = new List <string>(gameClearDaimyoHard.Split(delimiterChars));
                }
                else
                {
                    gameClearDaimyoHardList.Add(gameClearDaimyoHard);
                }
            }
            if (!gameClearDaimyoHardList.Contains(myDaimyo.ToString()))
            {
                if (gameClearDaimyoHard != null && gameClearDaimyoHard != "")
                {
                    gameClearDaimyoHard = gameClearDaimyoHard + "," + myDaimyo.ToString();
                }
                else
                {
                    gameClearDaimyoHard = myDaimyo.ToString();
                }
                PlayerPrefs.SetString("gameClearDaimyoHard", gameClearDaimyoHard);
            }
        }


        PlayerPrefs.SetBool("gameClearItemGetFlg", true);


        //Item2
        PlayerPrefs.DeleteKey("gameClearKahouCd");
        PlayerPrefs.DeleteKey("gameClearKahouId");
        Kahou kahou = new Kahou();

        if (kahouCd == "bugu")
        {
            kahou.registerBugu(int.Parse(kahouId));
        }
        else if (kahouCd == "gusoku")
        {
            kahou.registerGusoku(int.Parse(kahouId));
        }
        else if (kahouCd == "kabuto")
        {
            kahou.registerKabuto(int.Parse(kahouId));
        }
        else if (kahouCd == "meiba")
        {
            kahou.registerMeiba(int.Parse(kahouId));
        }
        else if (kahouCd == "cyadougu")
        {
            kahou.registerCyadougu(int.Parse(kahouId));
        }
        else if (kahouCd == "chishikisyo")
        {
            kahou.registerChishikisyo(int.Parse(kahouId));
        }
        else if (kahouCd == "heihousyo")
        {
            kahou.registerHeihousyo(int.Parse(kahouId));
        }

        //Item3
        int busyoDama    = PlayerPrefs.GetInt("busyoDama");
        int newBusyoDama = busyoDama + 1000;

        PlayerPrefs.SetInt("busyoDama", newBusyoDama);



        //Get Daimyo Busyo
        Daimyo daimyoScript  = new Daimyo();
        int    daimyoId      = PlayerPrefs.GetInt("myDaimyo");
        int    daimyoBusyoId = daimyoScript.getDaimyoBusyoId(daimyoId);

        string        zukanBusyoHst     = PlayerPrefs.GetString("zukanBusyoHst");
        List <string> zukanBusyoHstList = new List <string>();

        if (zukanBusyoHst != null && zukanBusyoHst != "")
        {
            if (zukanBusyoHst.Contains(","))
            {
                zukanBusyoHstList = new List <string>(zukanBusyoHst.Split(delimiterChars));
            }
            else
            {
                zukanBusyoHstList.Add(zukanBusyoHst);
            }
        }
        if (!zukanBusyoHstList.Contains(daimyoBusyoId.ToString()))
        {
            if (zukanBusyoHst != null && zukanBusyoHst != "")
            {
                zukanBusyoHst = zukanBusyoHst + "," + daimyoBusyoId.ToString();
            }
            else
            {
                zukanBusyoHst = daimyoBusyoId.ToString();
            }
            PlayerPrefs.SetString("zukanBusyoHst", zukanBusyoHst);
        }

        if (daimyoScript.daimyoBusyoCheck(daimyoBusyoId))
        {
            string        gacyaDaimyoHst     = PlayerPrefs.GetString("gacyaDaimyoHst");
            List <string> gacyaDaimyoHstList = new List <string>();
            if (gacyaDaimyoHst != null && gacyaDaimyoHst != "")
            {
                if (gacyaDaimyoHst.Contains(","))
                {
                    gacyaDaimyoHstList = new List <string>(gacyaDaimyoHst.Split(delimiterChars));
                }
                else
                {
                    gacyaDaimyoHstList.Add(gacyaDaimyoHst);
                }
            }
            if (!gacyaDaimyoHstList.Contains(daimyoBusyoId.ToString()))
            {
                if (gacyaDaimyoHst != null && gacyaDaimyoHst != "")
                {
                    gacyaDaimyoHst = gacyaDaimyoHst + "," + daimyoBusyoId.ToString();
                }
                else
                {
                    gacyaDaimyoHst = daimyoBusyoId.ToString();
                }
                PlayerPrefs.SetString("gacyaDaimyoHst", gacyaDaimyoHst);
            }
        }

        PlayerPrefs.Flush();



        //Hide Back
        Destroy(backObj.gameObject);
        Destroy(popObj.gameObject);
        Destroy(particleObj.gameObject);
        GameObject kunimap      = GameObject.Find("KuniMap").gameObject;
        GameObject kuniIconView = GameObject.Find("KuniIconView").gameObject;

        Destroy(kunimap.gameObject);
        Destroy(kuniIconView.gameObject);

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

        if (name == "YesButton")
        {
            audioSources[0].Play();
            RecoveryDataStore RecoveryDataStore = GameObject.Find("RecoveryDataStore").GetComponent <RecoveryDataStore>();

            //Common
            PlayerPrefs.SetBool("tutorialDoneFlg", true);
            PlayerPrefs.SetInt("kuniLv", RecoveryDataStore.kuniLv);
            Exp expScript   = new Exp();
            int jinkeiLimit = expScript.getJinkeiLimit(RecoveryDataStore.kuniLv);
            int stockLimit  = expScript.getStockLimit(RecoveryDataStore.kuniLv);
            PlayerPrefs.SetInt("jinkeiLimit", jinkeiLimit);
            PlayerPrefs.SetInt("stockLimit", stockLimit);
            PlayerPrefs.SetString("userId", RecoveryDataStore.inputUserId);
            if (RecoveryDataStore.addJinkei1)
            {
                PlayerPrefs.SetBool("addJinkei1", true);
            }
            else
            {
                PlayerPrefs.SetBool("addJinkei1", false);
            }
            if (RecoveryDataStore.addJinkei2)
            {
                PlayerPrefs.SetBool("addJinkei2", true);
            }
            else
            {
                PlayerPrefs.SetBool("addJinkei2", false);
            }
            if (RecoveryDataStore.addJinkei3)
            {
                PlayerPrefs.SetBool("addJinkei3", true);
            }
            else
            {
                PlayerPrefs.SetBool("addJinkei3", false);
            }
            if (RecoveryDataStore.addJinkei4)
            {
                PlayerPrefs.SetBool("addJinkei4", true);
            }
            else
            {
                PlayerPrefs.SetBool("addJinkei4", false);
            }

            if (RecoveryDataStore.dataStore_userId == 0)
            {
                /***dataStore***/
                PlayerPrefs.SetInt("kuniExp", RecoveryDataStore.kuniExp);
                PlayerPrefs.SetString("yearSeason", RecoveryDataStore.yearSeason);
                PlayerPrefs.SetInt("movieCount", RecoveryDataStore.movieCount);
                string seiryoku = RecoveryDataStore.seiryoku;
                if (seiryoku == "")
                {
                    seiryoku = "1,2,3,4,5,6,7,8,3,4,9,10,12,11,13,14,15,16,3,17,18,17,19,8,19,19,20,21,22,23,24,25,26,27,28,29,30,31,31,32,33,34,35,35,36,37,38,38,38,38,31,31,31,39,40,41,41,41,41,42,43,44,45,45,46";
                }
                PlayerPrefs.SetString("seiryoku", seiryoku);
                KuniInfo kuniScript = new KuniInfo();
                kuniScript.updateOpenKuni(RecoveryDataStore.myDaimyo, seiryoku);
                kuniScript.updateClearedKuni(RecoveryDataStore.myDaimyo, seiryoku);
                PlayerPrefs.SetInt("money", RecoveryDataStore.money);
                PlayerPrefs.SetInt("busyoDama", RecoveryDataStore.busyoDama);
                PlayerPrefs.SetInt("syogunDaimyoId", RecoveryDataStore.syogunDaimyoId);
                PlayerPrefs.SetString("doumei", RecoveryDataStore.doumei);

                for (int i = 0; i < RecoveryDataStore.questSpecialFlgId.Count; i++)
                {
                    int    questId = RecoveryDataStore.questSpecialFlgId[i];
                    string tmp     = "questSpecialFlg" + questId.ToString();
                    string tmp2    = "questSpecialReceivedFlg" + questId.ToString();
                    PlayerPrefs.SetBool(tmp, true);

                    bool questReceivedFlg = RecoveryDataStore.questSpecialReceivedFlgId[i];
                    if (questReceivedFlg)
                    {
                        PlayerPrefs.SetBool(tmp2, true);
                    }
                    else
                    {
                        PlayerPrefs.SetBool(tmp2, false);
                    }
                }

                Entity_quest_count_mst questCountMst = Resources.Load("Data/quest_count_mst") as Entity_quest_count_mst;
                for (int i = 0; i < questCountMst.param.Count; i++)
                {
                    bool dailyFlg = questCountMst.param[i].daily;
                    if (!dailyFlg)
                    {
                        countSpecialList.Add(i);
                    }
                }
                if (RecoveryDataStore.questSpecialCountReceivedFlg.Count != 0)
                {
                    for (int i = 0; i < countSpecialList.Count; i++)
                    {
                        int    id  = countSpecialList[i];
                        string tmp = "questSpecialCountReceivedFlg" + id.ToString();
                        bool   questReceivedFlg = RecoveryDataStore.questSpecialCountReceivedFlg[i];
                        if (questReceivedFlg)
                        {
                            PlayerPrefs.SetBool(tmp, true);
                        }
                        else
                        {
                            PlayerPrefs.SetBool(tmp, false);
                        }
                    }
                }


                int    count   = 0;
                string myBusyo = "";
                for (int i = 0; i < RecoveryDataStore.busyoList.Count; i++)
                {
                    int busyoId = RecoveryDataStore.busyoList[i];

                    if (busyoId != 0)
                    {
                        //add busyo
                        if (myBusyo == null || myBusyo == "")
                        {
                            myBusyo = busyoId.ToString();
                        }
                        else
                        {
                            myBusyo = myBusyo + "," + busyoId.ToString();
                        }
                        //add parametor
                        int    lv       = RecoveryDataStore.lvList[count];
                        string hei      = RecoveryDataStore.heiList[count];
                        int    senpouLv = RecoveryDataStore.senpouLvList[count];
                        int    sakuLv   = RecoveryDataStore.sakuLvList[count];
                        string kahou    = RecoveryDataStore.kahouList[count];

                        //lv
                        PlayerPrefs.SetInt(busyoId.ToString(), lv);
                        if (lv <= 0)
                        {
                            lv = 1;
                        }

                        //hei
                        string heiTmp = "hei" + busyoId.ToString();
                        PlayerPrefs.SetString(heiTmp, hei);

                        //senpou
                        string senpou = "senpou" + busyoId.ToString();
                        PlayerPrefs.SetInt(senpou, senpouLv); //Lv

                        //saku
                        string saku = "saku" + busyoId.ToString();
                        PlayerPrefs.SetInt(saku, sakuLv); //Lv

                        //kahou
                        string kahouTmp = "kahou" + busyoId.ToString();
                        PlayerPrefs.SetString(kahouTmp, kahou);

                        //exp
                        string exp           = "exp" + busyoId.ToString();
                        int    totalBusyoExp = expScript.getExpforNextLv(lv - 1);
                        PlayerPrefs.SetInt(exp, totalBusyoExp);

                        //addLv
                        string addlvTmp = "addlv" + busyoId.ToString();
                        int    addlv    = RecoveryDataStore.addLvList[count];
                        if (addlv != 0)
                        {
                            PlayerPrefs.SetInt(addlvTmp, addlv);
                        }

                        //gokui
                        string gokuiTmp = "gokui" + busyoId.ToString();
                        int    gokui    = RecoveryDataStore.gokuiList[count];
                        if (gokui != 0)
                        {
                            PlayerPrefs.SetInt(gokuiTmp, gokui);
                        }

                        //gokui
                        string kanniTmp = "kanni" + busyoId.ToString();
                        int    kanni    = RecoveryDataStore.kanniList[count];
                        if (kanni != 0)
                        {
                            PlayerPrefs.SetInt(kanniTmp, kanni);
                        }

                        count = count + 1;
                    }
                }

                PlayerPrefs.SetInt("myDaimyo", RecoveryDataStore.myDaimyo);
                Daimyo daimyoScript = new Daimyo();
                PlayerPrefs.SetInt("myDaimyoBusyo", daimyoScript.getDaimyoBusyoId(RecoveryDataStore.myDaimyo));
                PlayerPrefs.SetString("myBusyo", myBusyo);
                PlayerPrefs.SetString("myKanni", RecoveryDataStore.myKanni);
                PlayerPrefs.SetString("availableBugu", RecoveryDataStore.availableBugu);
                PlayerPrefs.SetString("availableKabuto", RecoveryDataStore.availableKabuto);
                PlayerPrefs.SetString("availableGusoku", RecoveryDataStore.availableGusoku);
                PlayerPrefs.SetString("availableMeiba", RecoveryDataStore.availableMeiba);
                PlayerPrefs.SetString("availableCyadougu", RecoveryDataStore.availableCyadougu);
                PlayerPrefs.SetString("availableHeihousyo", RecoveryDataStore.availableHeihousyo);
                PlayerPrefs.SetString("availableChishikisyo", RecoveryDataStore.availableChishikisyo);
                PlayerPrefs.SetString("kanjyo", RecoveryDataStore.kanjyo);
                PlayerPrefs.SetString("cyouheiYR", RecoveryDataStore.cyouheiYR);
                PlayerPrefs.SetString("cyouheiKB", RecoveryDataStore.cyouheiKB);
                PlayerPrefs.SetString("cyouheiTP", RecoveryDataStore.cyouheiTP);
                PlayerPrefs.SetString("cyouheiYM", RecoveryDataStore.cyouheiYM);
                PlayerPrefs.SetInt("hidensyoGe", RecoveryDataStore.hidensyoGe);
                PlayerPrefs.SetInt("hidensyoCyu", RecoveryDataStore.hidensyoCyu);
                PlayerPrefs.SetInt("hidensyoJyo", RecoveryDataStore.hidensyoJyo);
                PlayerPrefs.SetInt("shinobiGe", RecoveryDataStore.shinobiGe);
                PlayerPrefs.SetInt("shinobiCyu", RecoveryDataStore.shinobiCyu);
                PlayerPrefs.SetInt("shinobiJyo", RecoveryDataStore.shinobiJyo);
                PlayerPrefs.SetString("kengouItem", RecoveryDataStore.kengouItem);
                PlayerPrefs.SetString("gokuiItem", RecoveryDataStore.gokuiItem);
                PlayerPrefs.SetString("nanbanItem", RecoveryDataStore.nanbanItem);
                PlayerPrefs.SetInt("transferTP", RecoveryDataStore.transferTP);
                PlayerPrefs.SetInt("transferKB", RecoveryDataStore.transferKB);
                PlayerPrefs.SetInt("meisei", RecoveryDataStore.meisei);
                PlayerPrefs.SetString("shiro", RecoveryDataStore.shiro);
                PlayerPrefs.SetString("koueki", RecoveryDataStore.koueki);
                PlayerPrefs.SetString("cyoutei", RecoveryDataStore.cyoutei);
                PlayerPrefs.SetString("zukanBusyoHst", RecoveryDataStore.zukanBusyoHst);
                PlayerPrefs.SetString("zukanBuguHst", RecoveryDataStore.zukanBuguHst);
                PlayerPrefs.SetString("zukanGusokuHst", RecoveryDataStore.zukanGusokuHst);
                PlayerPrefs.SetString("zukanKabutoHst", RecoveryDataStore.zukanKabutoHst);
                PlayerPrefs.SetString("zukanMeibaHst", RecoveryDataStore.zukanMeibaHst);
                PlayerPrefs.SetString("zukanCyadouguHst", RecoveryDataStore.zukanCyadouguHst);
                PlayerPrefs.SetString("zukanChishikisyoHst", RecoveryDataStore.zukanChishikisyoHst);
                PlayerPrefs.SetString("zukanHeihousyoHst", RecoveryDataStore.zukanHeihousyoHst);
                PlayerPrefs.SetString("gameClearDaimyo", RecoveryDataStore.gameClearDaimyo);
                PlayerPrefs.SetString("gameClearDaimyoHard", RecoveryDataStore.gameClearDaimyoHard);

                //jinkei
                PlayerPrefs.SetInt("jinkei", RecoveryDataStore.jinkeiId);
                PlayerPrefs.SetInt("soudaisyo" + RecoveryDataStore.jinkeiId, RecoveryDataStore.soudaisyo);
                for (int i = 0; i < 25; i++)
                {
                    int busyoId = RecoveryDataStore.busyoMapList[i];
                    int id      = i + 1;
                    if (busyoId == 0)
                    {
                        string tmp = RecoveryDataStore.jinkeiId.ToString() + "map" + id.ToString();
                        PlayerPrefs.DeleteKey(tmp);
                    }
                    else
                    {
                        string tmp = RecoveryDataStore.jinkeiId.ToString() + "map" + id.ToString();
                        PlayerPrefs.SetInt(tmp, busyoId);
                    }
                }

                //naisei
                for (int i = 0; i < RecoveryDataStore.naiseiKuniList.Count; i++)
                {
                    int    kuniId    = RecoveryDataStore.naiseiKuniList[i];
                    string naiseiTmp = "naisei" + kuniId.ToString();
                    PlayerPrefs.SetString(naiseiTmp, RecoveryDataStore.naiseiList[i]);

                    if (RecoveryDataStore.naiseiShiroList[i] != 0)
                    {
                        string shiroTmp = "shiro" + kuniId.ToString();
                        PlayerPrefs.SetInt(shiroTmp, RecoveryDataStore.naiseiShiroList[i]);
                    }
                }

                //Add Qty & PvP Name
                PlayerPrefs.SetInt("myBusyoQty", RecoveryDataStore.busyoList.Count);
                string userName = RecoveryDataStore.userName;
                if (userName == "")
                {
                    userName = "******";
                }
                PlayerPrefs.SetString("PvPName", userName);
            }
            else
            {
                /***userId + pvpJinkei***/
                int totalExp = expScript.getTotalExp(RecoveryDataStore.kuniLv);
                PlayerPrefs.SetInt("kuniExp", totalExp);
                PlayerPrefs.SetInt("myDaimyo", RecoveryDataStore.myDaimyo);
                Daimyo daimyoScript = new Daimyo();
                PlayerPrefs.SetInt("myDaimyoBusyo", daimyoScript.getDaimyoBusyoId(RecoveryDataStore.myDaimyo));

                //pvp jinkei
                string        myBusyoString  = PlayerPrefs.GetString("myBusyo");
                List <string> myBusyoList    = new List <string>();
                char[]        delimiterChars = { ',' };
                if (myBusyoString != null && myBusyoString != "")
                {
                    if (myBusyoString.Contains(","))
                    {
                        myBusyoList = new List <string>(myBusyoString.Split(delimiterChars));
                    }
                    else
                    {
                        myBusyoList.Add(myBusyoString);
                    }
                }

                //zukan
                string        zukanBusyoHst     = PlayerPrefs.GetString("zukanBusyoHst");
                List <string> zukanBusyoHstList = new List <string>();
                if (zukanBusyoHst != null && zukanBusyoHst != "")
                {
                    if (zukanBusyoHst.Contains(","))
                    {
                        zukanBusyoHstList = new List <string>(zukanBusyoHst.Split(delimiterChars));
                    }
                    else
                    {
                        zukanBusyoHstList.Add(zukanBusyoHst);
                    }
                }

                //Daimyo Busyo History
                Daimyo        daimyo             = new Daimyo();
                string        gacyaDaimyoHst     = PlayerPrefs.GetString("gacyaDaimyoHst");
                List <string> gacyaDaimyoHstList = new List <string>();
                if (gacyaDaimyoHst != null && gacyaDaimyoHst != "")
                {
                    if (gacyaDaimyoHst.Contains(","))
                    {
                        gacyaDaimyoHstList = new List <string>(gacyaDaimyoHst.Split(delimiterChars));
                    }
                    else
                    {
                        gacyaDaimyoHstList.Add(gacyaDaimyoHst);
                    }
                }

                int count = 0;
                for (int i = 0; i < RecoveryDataStore.busyoList.Count; i++)
                {
                    int busyoId = RecoveryDataStore.busyoList[i];

                    if (busyoId != 0)
                    {
                        //add busyo
                        if (!myBusyoList.Contains(busyoId.ToString()))
                        {
                            if (myBusyoString == null || myBusyoString == "")
                            {
                                myBusyoString = busyoId.ToString();
                            }
                            else
                            {
                                myBusyoString = myBusyoString + "," + busyoId.ToString();
                            }
                            PlayerPrefs.SetString("myBusyo", myBusyoString);
                        }

                        //add zukan
                        if (!zukanBusyoHstList.Contains(busyoId.ToString()))
                        {
                            if (zukanBusyoHst == null || zukanBusyoHst == "")
                            {
                                zukanBusyoHst = busyoId.ToString();
                            }
                            else
                            {
                                zukanBusyoHst = zukanBusyoHst + "," + busyoId.ToString();
                            }
                            PlayerPrefs.SetString("zukanBusyoHst", zukanBusyoHst);
                        }

                        //add daimyo busyo
                        if (daimyo.daimyoBusyoCheck(busyoId))
                        {
                            if (!gacyaDaimyoHstList.Contains(busyoId.ToString()))
                            {
                                if (gacyaDaimyoHst == null || gacyaDaimyoHst == "")
                                {
                                    gacyaDaimyoHst = busyoId.ToString();
                                }
                                else
                                {
                                    gacyaDaimyoHst = gacyaDaimyoHst + "," + busyoId.ToString();
                                }
                                PlayerPrefs.SetString("gacyaDaimyoHst", gacyaDaimyoHst);
                            }
                        }

                        //add parametor
                        int    lv       = RecoveryDataStore.lvList[count];
                        string hei      = RecoveryDataStore.heiList[count];
                        int    senpouLv = RecoveryDataStore.senpouLvList[count];
                        int    sakuLv   = RecoveryDataStore.sakuLvList[count];
                        string kahou    = RecoveryDataStore.kahouList[count];

                        //lv
                        PlayerPrefs.SetInt(busyoId.ToString(), lv);

                        //hei
                        string heiTmp = "hei" + busyoId.ToString();
                        PlayerPrefs.SetString(heiTmp, hei);

                        //senpou
                        string senpou = "senpou" + busyoId.ToString();
                        PlayerPrefs.SetInt(senpou, senpouLv); //Lv

                        //saku
                        string saku = "saku" + busyoId.ToString();
                        PlayerPrefs.SetInt(saku, sakuLv); //Lv

                        //kahou
                        string kahouTmp = "kahou" + busyoId.ToString();
                        PlayerPrefs.SetString(kahouTmp, kahou);

                        //exp
                        string exp           = "exp" + busyoId.ToString();
                        int    totalBusyoExp = expScript.getExpforNextLv(lv - 1);
                        PlayerPrefs.SetInt(exp, totalBusyoExp);

                        count = count + 1;
                    }
                }
                PlayerPrefs.Flush();

                //Add Qty & PvP Name
                string        myBusyoStringCount = PlayerPrefs.GetString("myBusyo");
                List <string> myBusyoListCount   = new List <string>();
                if (myBusyoStringCount.Contains(","))
                {
                    myBusyoListCount = new List <string>(myBusyoStringCount.Split(delimiterChars));
                }
                else
                {
                    myBusyoListCount.Add(myBusyoStringCount);
                }
                PlayerPrefs.SetInt("myBusyoQty", myBusyoListCount.Count);
                string userName = RecoveryDataStore.userName;
                if (userName == "")
                {
                    userName = "******";
                }
                PlayerPrefs.SetString("PvPName", userName);
            }

            PlayerPrefs.Flush();

            //add data recovery history
            RecoveryDataStore.UpdateDataRecovery(RecoveryDataStore.inputUserId);


            //Final Process
            audioSources[3].Play();
            Destroy(back.gameObject);
            Destroy(msg.gameObject);
            GameObject.Find("Start").GetComponent <Button>().enabled = false;
            Message msgScript = new Message();
            msgScript.makeMessage(msgScript.getMessage(151));
        }
        else
        {
            RecoveryDataStore RecoveryDataStore = GameObject.Find("RecoveryDataStore").GetComponent <RecoveryDataStore>();
            RecoveryDataStore.ResetValue();

            audioSources[1].Play();
            Destroy(back.gameObject);
            Destroy(msg.gameObject);
        }
    }