Ejemplo n.º 1
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();
        }
    }
Ejemplo n.º 2
0
	public void OnClick(){

		string tmp = "kanni" + busyoId;
		PlayerPrefs.SetInt (tmp, kanniId);


		//Reduce from My Kanni
		string myKanni = PlayerPrefs.GetString("myKanni");
		List<string> myKanniList = new List<string> ();
		if(myKanni.Contains(",")){
			char[] delimiterChars = {','};
			myKanniList = new List<string> (myKanni.Split (delimiterChars));
		}else{
			myKanniList.Add(myKanni);
		}
		myKanniList.Remove (kanniId.ToString());

		string newMyKanni = "";
		for (int i=0; i<myKanniList.Count; i++) {
			if(i==0){
				newMyKanni = myKanniList[i];
			}else{
				newMyKanni = newMyKanni + "," + myKanniList[i];
			}
		}
		PlayerPrefs.SetString ("myKanni", newMyKanni);

		//Add Busyo Kanni
		string newMyKanniWithBusyo = "";
		string myKanniWithBusyo = PlayerPrefs.GetString ("myKanniWithBusyo");
		if (myKanniWithBusyo != null && myKanniWithBusyo != "") {
			newMyKanniWithBusyo = myKanniWithBusyo + "," + kanniId;
		} else {
			newMyKanniWithBusyo = kanniId.ToString();		
		}
		PlayerPrefs.SetString ("myKanniWithBusyo", newMyKanniWithBusyo);


		PlayerPrefs.Flush ();

		SyoguScene syogu = new SyoguScene();
		syogu.createSyoguView(busyoId);
		
		//Close Board
		CloseBoard close = new CloseBoard ();
		close.onClick();

	}
Ejemplo n.º 3
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();
		}
	}	
Ejemplo n.º 4
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();
        audioSources [2].Play();

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

        //Make New Busyo
        string busyoId;

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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


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

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


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

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

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

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

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

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

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

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


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

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

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

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

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

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


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


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

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

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

            //Parametor Setting
            NowOnBusyoScript.OnBusyo     = busyoId;
            NowOnBusyoScript.OnBusyoName = busyoInfoGetScript.getName(int.Parse(busyoId));
        }
        else if (GameObject.Find("GameScene").GetComponent <NowOnButton> ().onButton == "Senpou")
        {
            NowOnBusyoScript.OnBusyo     = busyoId;
            NowOnBusyoScript.OnBusyoName = busyoInfoGetScript.getName(int.Parse(busyoId));
            SenpouScene scene = new SenpouScene();
            scene.createSenpouStatusView(busyoId);
            scene.createSakuStatusView(busyoId);
        }
        else if (GameObject.Find("GameScene").GetComponent <NowOnButton> ().onButton == "Kahou")
        {
            NowOnBusyoScript.OnBusyo     = busyoId;
            NowOnBusyoScript.OnBusyoName = busyoInfoGetScript.getName(int.Parse(busyoId));
            KahouScene kahou = new KahouScene();
            kahou.createKahouStatusView(busyoId);
        }
        else if (GameObject.Find("GameScene").GetComponent <NowOnButton> ().onButton == "Syogu")
        {
            NowOnBusyoScript.OnBusyo     = busyoId;
            NowOnBusyoScript.OnBusyoName = busyoInfoGetScript.getName(int.Parse(busyoId));
            SyoguScene syogu = new SyoguScene();
            syogu.createSyoguView(busyoId);
        }
    }
Ejemplo n.º 5
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();
        audioSources [3].Play();

        string tmp = "kanni" + busyoId;

        PlayerPrefs.SetInt(tmp, kanniId);


        //Reduce from My Kanni
        string        myKanni     = PlayerPrefs.GetString("myKanni");
        List <string> myKanniList = new List <string> ();

        if (myKanni.Contains(","))
        {
            char[] delimiterChars = { ',' };
            myKanniList = new List <string> (myKanni.Split(delimiterChars));
        }
        else
        {
            myKanniList.Add(myKanni);
        }
        myKanniList.Remove(kanniId.ToString());

        string newMyKanni = "";

        for (int i = 0; i < myKanniList.Count; i++)
        {
            if (i == 0)
            {
                newMyKanni = myKanniList[i];
            }
            else
            {
                newMyKanni = newMyKanni + "," + myKanniList[i];
            }
        }
        PlayerPrefs.SetString("myKanni", newMyKanni);

        //Add Busyo Kanni
        string newMyKanniWithBusyo = "";
        string myKanniWithBusyo    = PlayerPrefs.GetString("myKanniWithBusyo");

        if (myKanniWithBusyo != null && myKanniWithBusyo != "")
        {
            newMyKanniWithBusyo = myKanniWithBusyo + "," + kanniId;
        }
        else
        {
            newMyKanniWithBusyo = kanniId.ToString();
        }
        PlayerPrefs.SetString("myKanniWithBusyo", newMyKanniWithBusyo);

        PlayerPrefs.SetBool("questSpecialFlg8", true);
        PlayerPrefs.Flush();

        SyoguScene syogu = new SyoguScene();

        syogu.createSyoguView(busyoId);

        //Close Board
        CloseBoard close = new CloseBoard();

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

        if (name == "YesButton")
        {
            /*Tsuihou*/
            //Limit Check
            int myBusyoQty = PlayerPrefs.GetInt("myBusyoQty");

            if (myBusyoQty == 1)
            {
                //Error
                audioSources [4].Play();
                Message msg = new Message();
                msg.makeMessage(msg.getMessage(91));
            }
            else
            {
                audioSources [4].Play();
                //Delete Data
                //myBusyo
                List <string> myBusyo_list   = new List <string> ();
                string        myBusyoString  = PlayerPrefs.GetString("myBusyo");
                char[]        delimiterChars = { ',' };
                myBusyo_list.AddRange(myBusyoString.Split(delimiterChars));
                myBusyo_list.Remove(busyoId.ToString());
                string newMyBusyoString = "";
                string newOnBusyo       = myBusyo_list[0];
                for (int i = 0; i < myBusyo_list.Count; i++)
                {
                    newMyBusyoString = newMyBusyoString + myBusyo_list[i] + ",";
                }
                newMyBusyoString = newMyBusyoString.TrimEnd(',');


                //kahou
                List <string> kahou_list  = new List <string> ();
                string        kahou       = "kahou" + busyoId;
                string        kahouString = PlayerPrefs.GetString(kahou);
                kahou_list.AddRange(kahouString.Split(delimiterChars));

                string availableBugu        = PlayerPrefs.GetString("availableBugu");
                string availableKabuto      = PlayerPrefs.GetString("availableKabuto");
                string availableGusoku      = PlayerPrefs.GetString("availableGusoku");
                string availableMeiba       = PlayerPrefs.GetString("availableMeiba");
                string availableCyadougu    = PlayerPrefs.GetString("availableCyadougu");
                string availableHeihousyo   = PlayerPrefs.GetString("availableHeihousyo");
                string availableChishikisyo = PlayerPrefs.GetString("availableChishikisyo");

                for (int j = 0; j < kahou_list.Count; j++)
                {
                    string kahouId = kahou_list[j];

                    if (j == 0)
                    {
                        //Bugu
                        if (kahouId != "0")
                        {
                            if (availableBugu != "" && availableBugu != null)
                            {
                                availableBugu = availableBugu + "," + kahouId;
                            }
                            else
                            {
                                availableBugu = kahouId;
                            }
                        }
                    }
                    else if (j == 1)
                    {
                        //Kabuto
                        if (kahouId != "0")
                        {
                            if (availableKabuto != "" && availableKabuto != null)
                            {
                                availableKabuto = availableKabuto + "," + kahouId;
                            }
                            else
                            {
                                availableKabuto = kahouId;
                            }
                        }
                    }
                    else if (j == 2)
                    {
                        //Gusoku
                        if (kahouId != "0")
                        {
                            if (availableGusoku != "" && availableGusoku != null)
                            {
                                availableGusoku = availableGusoku + "," + kahouId;
                            }
                            else
                            {
                                availableGusoku = kahouId;
                            }
                        }
                    }
                    else if (j == 3)
                    {
                        //Meiba
                        if (kahouId != "0")
                        {
                            if (availableMeiba != "" && availableMeiba != null)
                            {
                                availableMeiba = availableMeiba + "," + kahouId;
                            }
                            else
                            {
                                availableMeiba = kahouId;
                            }
                        }
                    }
                    else if (j == 4)
                    {
                        //Cyadougu1
                        if (kahouId != "0")
                        {
                            if (availableCyadougu != "" && availableCyadougu != null)
                            {
                                availableCyadougu = availableCyadougu + "," + kahouId;
                            }
                            else
                            {
                                availableCyadougu = kahouId;
                            }
                        }
                    }
                    else if (j == 5)
                    {
                        //Cyadougu2
                        if (kahouId != "0")
                        {
                            if (availableCyadougu != "" && availableCyadougu != null)
                            {
                                availableCyadougu = availableCyadougu + "," + kahouId;
                            }
                            else
                            {
                                availableCyadougu = kahouId;
                            }
                        }
                    }
                    else if (j == 6)
                    {
                        //Heihousyo
                        if (kahouId != "0")
                        {
                            if (availableHeihousyo != "" && availableHeihousyo != null)
                            {
                                availableHeihousyo = availableHeihousyo + "," + kahouId;
                            }
                            else
                            {
                                availableHeihousyo = kahouId;
                            }
                        }
                    }
                    else if (j == 7)
                    {
                        //Chishikisyo
                        if (kahouId != "0")
                        {
                            if (availableChishikisyo != "" && availableChishikisyo != null)
                            {
                                availableChishikisyo = availableChishikisyo + "," + kahouId;
                            }
                            else
                            {
                                availableChishikisyo = kahouId;
                            }
                        }
                    }
                }

                //Kanni
                string kanniTmp = "kanni" + busyoId;
                if (PlayerPrefs.HasKey(kanniTmp))
                {
                    DoRemoveKanni removeKanni = new DoRemoveKanni();
                    removeKanni.removeKanni(busyoId.ToString());
                }

                //Jyosyu
                for (int i = 1; i < 66; i++)
                {
                    string jyosyuTemp = "jyosyu" + i.ToString();
                    int    jyosyu     = PlayerPrefs.GetInt(jyosyuTemp);
                    if (jyosyu == busyoId)
                    {
                        PlayerPrefs.DeleteKey(jyosyuTemp);
                        break;
                    }
                }


                //OK
                PlayerPrefs.SetString("myBusyo", newMyBusyoString);
                PlayerPrefs.DeleteKey(busyoId.ToString());
                string hei = "hei" + busyoId;
                PlayerPrefs.DeleteKey(hei);
                string senpou = "senpou" + busyoId;
                PlayerPrefs.DeleteKey(senpou);
                string saku = "saku" + busyoId;
                PlayerPrefs.DeleteKey(saku);
                string jyosyuHei = "jyosyuHei" + busyoId;
                PlayerPrefs.DeleteKey(jyosyuHei);
                string jyosyuBusyo = "jyosyuBusyo" + busyoId;
                PlayerPrefs.DeleteKey(jyosyuBusyo);
                if (availableBugu != null)
                {
                    PlayerPrefs.SetString("availableBugu", availableBugu);
                }
                if (availableKabuto != null)
                {
                    PlayerPrefs.SetString("availableKabuto", availableKabuto);
                }
                if (availableGusoku != null)
                {
                    PlayerPrefs.SetString("availableGusoku", availableGusoku);
                }
                if (availableMeiba != null)
                {
                    PlayerPrefs.SetString("availableMeiba", availableMeiba);
                }
                if (availableCyadougu != null)
                {
                    PlayerPrefs.SetString("availableCyadougu", availableCyadougu);
                }
                if (availableHeihousyo != null)
                {
                    PlayerPrefs.SetString("availableHeihousyo", availableHeihousyo);
                }
                if (availableChishikisyo != null)
                {
                    PlayerPrefs.SetString("availableChishikisyo", availableChishikisyo);
                }
                PlayerPrefs.DeleteKey(kahou);
                string exp = "exp" + busyoId;
                PlayerPrefs.DeleteKey(exp);
                string gokui = "gokui" + busyoId;
                PlayerPrefs.DeleteKey(gokui);

                //jinkei 1map1 ~ 4map25
                int oyaId = 1;
                for (int k = oyaId; k < 5; k++)
                {
                    int koId = 1;

                    for (int l = koId; l < 26; l++)
                    {
                        string mapKey   = k.ToString() + "map" + l.ToString();
                        int    mapBusyo = PlayerPrefs.GetInt(mapKey);

                        if (mapBusyo == busyoId)
                        {
                            //Delete
                            PlayerPrefs.DeleteKey(mapKey);
                        }
                    }
                }
                myBusyoQty = myBusyoQty - 1;
                PlayerPrefs.SetInt("myBusyoQty", myBusyoQty);
                PlayerPrefs.Flush();

                //Back & Update
                Destroy(GameObject.Find("TsuihouConfirm"));
                Destroy(GameObject.Find("Back(Clone)"));

                MessageBusyo msg         = new MessageBusyo();
                string       tsuihouText = "";
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    tsuihouText = "Banished " + busyoName + ".";
                }
                else
                {
                    tsuihouText = busyoName + "を追放しました。";
                }
                string type = "tsuihou";
                msg.makeMessage(tsuihouText, busyoId, type);

                //Now On Busyo Mod.
                GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyo = newOnBusyo;
                StatusGet sts = new StatusGet();
                GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyoName = sts.getBusyoName(int.Parse(newOnBusyo));

                /*Initialization*/
                //BusyoView
                RonkouScene ronkou = new RonkouScene();
                SyoguScene  syogu  = new SyoguScene();
                //Delete
                foreach (Transform n in GameObject.Find("BusyoView").transform)
                {
                    //Busyo Serihu
                    GameObject.Destroy(n.gameObject);
                }
                //Create
                ronkou.createBusyoView(newOnBusyo.ToString());

                //BusyoStatus
                syogu.createSyoguView(newOnBusyo.ToString());

                //Scroll View
                //Delete
                foreach (Transform n in GameObject.Find("Content").transform)
                {
                    GameObject.Destroy(n.gameObject);
                }

                //Create
                List <string> myBusyoList    = new List <string>();
                GameObject    mainController = GameObject.Find("GameScene");
                string        minBusyoId     = "";
                minBusyoId = ronkou.createScrollView(myBusyoList, minBusyoId, mainController, false);
            }
        }
        else if (name == "NoButton")
        {
            //Back
            audioSources [1].Play();
            Destroy(GameObject.Find("TsuihouConfirm"));
            Destroy(GameObject.Find("Back(Clone)"));
        }
    }
Ejemplo n.º 7
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());
				}
			}
		}
	}	
Ejemplo n.º 8
0
	public void OnClick () {
		/*Busyo View*/
		//Delete revious
		foreach ( Transform n in GameObject.Find ("BusyoView").transform ){
			GameObject.Destroy(n.gameObject);
		}

		//Make New Busyo
		string busyoId;
		busyoId = this.name.Remove (0, 4);
		string path = "Prefabs/Player/Unit/" + busyoId;
		GameObject Busyo = Instantiate (Resources.Load (path)) as GameObject;
		Busyo.transform.SetParent(GameObject.Find ("BusyoView").transform);
		Busyo.transform.localScale = new Vector2 (4, 4);
		Busyo.GetComponent<DragHandler> ().enabled = false;	

		RectTransform rect_transform = Busyo.GetComponent<RectTransform>();
		rect_transform.anchoredPosition3D = new Vector3(300,200,0);
		rect_transform.sizeDelta = new Vector2( 100, 100);

		//Text Modification
		GameObject text = Busyo.transform.FindChild ("Text").gameObject;
		text.GetComponent<Text> ().color = new Color(255,255,255,255);
		RectTransform text_transform = text.GetComponent<RectTransform>();
		text_transform.anchoredPosition3D = new Vector3 (-70,30,0);
		text_transform.sizeDelta = new Vector2( 630, 120);
		text.transform.localScale = new Vector2 (0.2f,0.2f);

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

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

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

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

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


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

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


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

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

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

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

			//Show Additional Status
			int finalAtk = int.Parse (KahouStatusArray [0]) + Mathf.FloorToInt (addAtkByKanni);
			int finalHp = int.Parse (KahouStatusArray [1]) + Mathf.FloorToInt (addHpByKanni);
			int finalDfc= int.Parse (KahouStatusArray [2]) + Mathf.FloorToInt (addDfcByKanni);
			int finalSpd = int.Parse (KahouStatusArray [3]);
			
			GameObject.Find ("KahouAtkValue").GetComponent<Text> ().text = "+" + finalAtk.ToString ();
			GameObject.Find ("KahouHpValue").GetComponent<Text>().text = "+" + finalHp.ToString();
			totalBusyoHp = adjHp + finalHp;
			GameObject.Find ("KahouDfcValue").GetComponent<Text>().text = "+" + finalDfc.ToString();
			GameObject.Find ("KahouSpdValue").GetComponent<Text>().text = "+" + finalSpd.ToString();

			//Butai Status
			string heiId = "hei" + busyoId.ToString ();
			string chParam = PlayerPrefs.GetString (heiId, "0");
			
			char[] delimiterChars = {':'};
			string[] ch_list = chParam.Split (delimiterChars);
			
			string ch_type = ch_list [0];
			int ch_num = int.Parse (ch_list [1]);
			int ch_lv = int.Parse (ch_list [2]);
			float ch_status = float.Parse (ch_list [3]);

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

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

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

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


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

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

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

		} else if (GameObject.Find ("GameScene").GetComponent<NowOnButton> ().onButton == "Senpou") {
			GameObject.Find ("GameScene").GetComponent<NowOnBusyo> ().OnBusyo = busyoId;
			GameObject.Find ("GameScene").GetComponent<NowOnBusyo> ().OnBusyoName = text.GetComponent<Text> ().text;
			SenpouScene scene = new SenpouScene ();
			scene.createSenpouStatusView (busyoId);
			scene.createSakuStatusView(busyoId);
			
		} else if (GameObject.Find ("GameScene").GetComponent<NowOnButton> ().onButton == "Kahou") {
			GameObject.Find ("GameScene").GetComponent<NowOnBusyo> ().OnBusyo = busyoId;
			GameObject.Find ("GameScene").GetComponent<NowOnBusyo> ().OnBusyoName = text.GetComponent<Text> ().text;
			KahouScene kahou = new KahouScene();
			kahou.createKahouStatusView(busyoId);
		} else if (GameObject.Find ("GameScene").GetComponent<NowOnButton> ().onButton == "Syogu") {
			GameObject.Find ("GameScene").GetComponent<NowOnBusyo> ().OnBusyo = busyoId;
			GameObject.Find ("GameScene").GetComponent<NowOnBusyo> ().OnBusyoName = text.GetComponent<Text> ().text;
			SyoguScene syogu = new SyoguScene();
			syogu.createSyoguView(busyoId);
		}
	}	
Ejemplo n.º 9
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());
                }
            }
        }
    }
Ejemplo n.º 10
0
	public void OnClick () {

		if (name == "YesButton") {
			/*Tsuihou*/
			//Limit Check
			int myBusyoQty = PlayerPrefs.GetInt("myBusyoQty");

			if (myBusyoQty == 1) {
				//Error
				Message msg = new Message(); 
				string Text = "御館様、武将を皆追放することは出来ませぬぞ。お家を滅ぼすおつもりか。";
				msg.makeMessage (Text);
				
			} else {

				//Delete Data
				//myBusyo
				List<string> myBusyo_list = new List<string> ();
				string myBusyoString = PlayerPrefs.GetString ("myBusyo");
				char[] delimiterChars = {','};
				myBusyo_list.AddRange (myBusyoString.Split (delimiterChars));
				myBusyo_list.Remove(busyoId.ToString());
				string newMyBusyoString = "";
				string newOnBusyo = myBusyo_list[0];
				for(int i=0; i<myBusyo_list.Count;i++){
					newMyBusyoString = newMyBusyoString + myBusyo_list[i] + ",";
				}
				newMyBusyoString = newMyBusyoString.TrimEnd(',');


				//kahou
				List<string> kahou_list = new List<string> ();
				string kahou = "kahou" + busyoId;
				string kahouString = PlayerPrefs.GetString (kahou);
				kahou_list.AddRange(kahouString.Split (delimiterChars));

				string availableBugu = PlayerPrefs.GetString ("availableBugu");
				string availableKabuto = PlayerPrefs.GetString ("availableKabuto");
				string availableGusoku = PlayerPrefs.GetString ("availableGusoku");
				string availableMeiba =  PlayerPrefs.GetString ("availableMeiba");
				string availableCyadougu = PlayerPrefs.GetString ("availableCyadougu");
				string availableHeihousyo = PlayerPrefs.GetString ("availableHeihousyo");
				string availableChishikisyo = PlayerPrefs.GetString ("availableChishikisyo");

				for(int j=0; j<kahou_list.Count;j++){
					string kahouId = kahou_list[j];

					if(j==0){
						//Bugu
						if(kahouId !="0"){
							if(availableBugu != "" && availableBugu != null){
								availableBugu = availableBugu + "," + kahouId;
							}else{
								availableBugu = kahouId;
							}
						}

					}else if(j==1){
						//Kabuto
						if(kahouId !="0"){
							if(availableKabuto != "" && availableKabuto != null){
								availableKabuto = availableKabuto + "," + kahouId;
							}else{
								availableKabuto = kahouId;
							}
						}

					}else if(j==2){
						//Gusoku
						if(kahouId !="0"){
							if(availableGusoku != "" && availableGusoku != null){
								availableGusoku = availableGusoku + "," + kahouId;
							}else{
								availableGusoku = kahouId;
							}
						}
					
					}else if(j==3){
						//Meiba
						if(kahouId !="0"){
							if(availableMeiba != "" && availableMeiba != null){
								availableMeiba = availableMeiba + "," + kahouId;
							}else{
								availableMeiba = kahouId;
							}
						}

					}else if(j==4){
						//Cyadougu1
						if(kahouId !="0"){
							if(availableCyadougu != "" && availableCyadougu != null){
								availableCyadougu = availableCyadougu + "," + kahouId;
							}else{
								availableCyadougu = kahouId;
							}
						}

					}else if(j==5){
						//Cyadougu2
						if(kahouId !="0"){
							if(availableCyadougu != "" && availableCyadougu != null){
								availableCyadougu = availableCyadougu + "," + kahouId;
							}else{
								availableCyadougu = kahouId;
							}
						}

					}else if(j==6){
						//Heihousyo
						if(kahouId !="0"){
							if(availableHeihousyo != "" && availableHeihousyo != null){
								availableHeihousyo = availableHeihousyo + "," + kahouId;
							}else{
								availableHeihousyo = kahouId;
							}
						}

					}else if(j==7){
						//Chishikisyo
						if(kahouId !="0"){
							if(availableChishikisyo != "" && availableChishikisyo != null){
								availableChishikisyo = availableChishikisyo + "," + kahouId;
							}else{
								availableChishikisyo = kahouId;
							}
						}
					}
				}

				//Kanni
				string kanniTmp = "kanni" + busyoId;
				if(PlayerPrefs.HasKey(kanniTmp)){
					DoRemoveKanni removeKanni = new DoRemoveKanni();
					removeKanni.removeKanni(busyoId.ToString());
				}


				//OK
				PlayerPrefs.SetString("myBusyo",newMyBusyoString);
				PlayerPrefs.DeleteKey(busyoId.ToString());
				string hei = "hei" + busyoId;
				PlayerPrefs.DeleteKey(hei);
				string senpou = "senpou" + busyoId;
				PlayerPrefs.DeleteKey(senpou);
				string saku = "saku" + busyoId;
				PlayerPrefs.DeleteKey(saku);
				if(availableBugu != null) PlayerPrefs.SetString ("availableBugu",availableBugu);
				if(availableKabuto != null) PlayerPrefs.SetString ("availableKabuto",availableKabuto);
				if(availableGusoku != null) PlayerPrefs.SetString ("availableGusoku",availableGusoku);
				if(availableMeiba != null) PlayerPrefs.SetString ("availableMeiba",availableMeiba);
				if(availableCyadougu != null) PlayerPrefs.SetString ("availableCyadougu",availableCyadougu);
				if(availableHeihousyo != null) PlayerPrefs.SetString ("availableHeihousyo",availableHeihousyo);
				if(availableChishikisyo != null) PlayerPrefs.SetString ("availableChishikisyo",availableChishikisyo);
				PlayerPrefs.DeleteKey(kahou);
				string exp = "exp" + busyoId;
				PlayerPrefs.DeleteKey(exp);

				//jinkei 1map1 ~ 4map25
				int oyaId = 1;
				for(int k=oyaId; k<5; k++){
					int koId = 1;

					for(int l=koId; l<26; l++){
						string mapKey = k.ToString() + "map" + l.ToString();
						int mapBusyo = PlayerPrefs.GetInt (mapKey);

						if(mapBusyo == busyoId){
							//Delete
							PlayerPrefs.DeleteKey(mapKey);
						}
					}
				}
				myBusyoQty = myBusyoQty - 1;
				PlayerPrefs.SetInt("myBusyoQty",myBusyoQty);
				PlayerPrefs.Flush();

				//Back & Update
				Destroy(GameObject.Find("TsuihouConfirm"));
				Destroy(GameObject.Find("Back(Clone)"));

				MessageBusyo msg = new MessageBusyo();
				string tsuihouText = busyoName + "を追放しました。";
				string type = "tsuihou"; 
				msg.makeMessage(tsuihouText,busyoId, type);

				//Now On Busyo Mod.
				GameObject.Find ("GameScene").GetComponent<NowOnBusyo>().OnBusyo = newOnBusyo;
				StatusGet sts = new StatusGet();
				GameObject.Find ("GameScene").GetComponent<NowOnBusyo>().OnBusyoName = sts.getBusyoName(int.Parse(newOnBusyo)); 

				/*Initialization*/
				//BusyoView
				RonkouScene ronkou = new RonkouScene();
				SyoguScene syogu = new SyoguScene();
				//Delete
				foreach ( Transform n in GameObject.Find("BusyoView").transform ){
					//Busyo Serihu
					GameObject.Destroy(n.gameObject);
				}
				//Create
				ronkou.createBusyoView(newOnBusyo.ToString());

				//BusyoStatus
				syogu.createSyoguView(newOnBusyo.ToString());

				//Scroll View
				//Delete
				foreach ( Transform n in GameObject.Find("Content").transform ){
					GameObject.Destroy(n.gameObject);
				}

				//Create
				ArrayList myBusyoList = new ArrayList();
				GameObject mainController = GameObject.Find ("GameScene");
				string minBusyoId = "";
				minBusyoId = ronkou.createScrollView(myBusyoList,minBusyoId,mainController);
			}

		}else if(name == "NoButton"){
			//Back
			Destroy(GameObject.Find("TsuihouConfirm"));
			Destroy(GameObject.Find("Back(Clone)"));
		}
	}