Exemple #1
0
	public void OnClick () {
		Message msg = new Message(); 

		if (itemOK == false || moneyOK == false) {
			//Error

			string Text = "物資が不足しておりますぞ。";
			msg.makeMessage(Text);

		} else {
			/*Do Cyouhei*/
			//Reduce Current Item
			string itemColumn = "cyouhei" + ch_type;
			string itemString = PlayerPrefs.GetString (itemColumn);
			char[] delimiterChars = {','};
			string[] itemList = itemString.Split (delimiterChars);

			string newItemListString = "0,0,0";
			if(itemType == "low"){
				int calc = int.Parse(itemList[0]) - requiredItem;
				newItemListString = calc.ToString() + "," + itemList[1] + "," + itemList[2];

			}else if(itemType == "middle"){
				int calc = int.Parse(itemList[1]) - requiredItem;
				newItemListString = itemList[0] + "," + calc.ToString() + "," + itemList[2];

			}else if(itemType == "hight"){
				int calc = int.Parse(itemList[2]) - requiredItem;
				newItemListString = itemList[0] + "," + itemList[1] + "," + calc.ToString();

			}
			PlayerPrefs.SetString (itemColumn,newItemListString);

			//Reduce Money
			int calcMoney = nowMoney - requiredMoney; 
			PlayerPrefs.SetInt ("money",calcMoney);

			//Add Child QTY
			string busyoId = GameObject.Find ("GameScene").GetComponent<NowOnBusyo>().OnBusyo;
			string temp = "hei" + busyoId;
			string childStsString = PlayerPrefs.GetString (temp);
			char[] delimiterChars2 = {':'};
			string[] childStsList = childStsString.Split (delimiterChars2);
		
			int bfrChildQty = int.Parse(childStsList[1]);
			int aftChildQty = bfrChildQty + 1;

			string newChildStsString = childStsString;
			newChildStsString = childStsList[0] + ":" + aftChildQty.ToString() + ":" + childStsList[2] + ":" + childStsList[3];
			PlayerPrefs.SetString (temp,newChildStsString);

			PlayerPrefs.Flush();


			//Message
			string busyoName = GameObject.Find ("GameScene").GetComponent<NowOnBusyo>().OnBusyoName;
			string OKtext=busyoName+"隊にて徴兵を実施しました。";
			msg.makeMessage(OKtext);

			//Reload
			//Close Board
			GameObject.Find ("close").GetComponent<CloseBoard>().onClick();
			RonkouScene ronkou = new RonkouScene();
			ronkou.createBusyoStatusView(busyoId);

		}
	}	
Exemple #2
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;
                            }
                        }
                    }
                }
                //OK
                PlayerPrefs.SetString("myBusyo",newMyBusyoString);
                PlayerPrefs.DeleteKey(busyoId.ToString());
                string hei = "hei" + busyoId;
                PlayerPrefs.DeleteKey(hei);
                string senpou = "senpou" + busyoId;
                PlayerPrefs.DeleteKey(senpou);
                string koudou = "kondou" + busyoId;
                PlayerPrefs.DeleteKey(koudou);
                PlayerPrefs.SetString ("availableBugu",availableBugu);
                PlayerPrefs.SetString ("availableKabuto",availableKabuto);
                PlayerPrefs.SetString ("availableGusoku",availableGusoku);
                PlayerPrefs.SetString ("availableMeiba",availableMeiba);
                PlayerPrefs.SetString ("availableCyadougu",availableCyadougu);
                PlayerPrefs.SetString ("availableHeihousyo",availableHeihousyo);
                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();
                //Delete
                foreach ( Transform n in GameObject.Find("BusyoView").transform ){
                    //Busyo Serihu
                    GameObject.Destroy(n.gameObject);
                }
                //Create
                ronkou.createBusyoView(newOnBusyo.ToString());

                //BusyoStatus
                ronkou.createBusyoStatusView(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)"));
        }
    }
Exemple #3
0
    public void DoKanjyoOperation(string kanjyoTyp)
    {
        GameObject ExpSliderObj = GameObject.Find ("ExpSlider");
        string busyoId = GameObject.Find ("GameScene").GetComponent<NowOnBusyo>().OnBusyo;
        string busyoName = GameObject.Find ("GameScene").GetComponent<NowOnBusyo>().OnBusyoName;

        //Classification
        string QtyValue = "";
        string ExValue = "";
        if (kanjyoTyp == "DoKakyuKanjyo") {
            QtyValue = "KakyuKanjyoQtyValue";
            ExValue = "KakyuKanjyoExpValue";

        }else if(kanjyoTyp == "DoCyukyuKanjyo"){
            QtyValue = "CyukyuKanjyoQtyValue";
            ExValue = "CyukyuKanjyoExpValue";

        }else if(kanjyoTyp == "DoJyokyuKanjyo"){
            QtyValue = "JyokyuKanjyoQtyValue";
            ExValue = "JyokyuKanjyoExpValue";
        }

        //Check exist or not
        GameObject qty = GameObject.Find (QtyValue);
        int kanjyoQty = int.Parse(qty.GetComponent<Text>().text);

        if (kanjyoQty == 0) {
            /*Error*/
            string Text = "感状はありませぬぞ。";
            Message msg = new Message();
            msg.makeMessage (Text);

            GameObject.Find ("DoKakyuKanjyo").GetComponent<Button> ().enabled = true;
            GameObject.Find ("DoCyukyuKanjyo").GetComponent<Button> ().enabled = true;
            GameObject.Find ("DoJyokyuKanjyo").GetComponent<Button> ().enabled = true;
            GameObject.Find ("close").GetComponent<Button> ().enabled = true;

        } else {
            /*Correct Case*/
            //reduce qty
            qty.GetComponent<Text> ().text = (kanjyoQty - 1).ToString ();

            //increase exp
            int nowLv = PlayerPrefs.GetInt (busyoId);
            string tempExp = "exp" + busyoId;
            int nowExp = PlayerPrefs.GetInt (tempExp);
            int newExp = nowExp + int.Parse (GameObject.Find (ExValue).GetComponent<Text> ().text);

            Exp exp = new Exp ();
            int targetLv = exp.getLvbyTotalExp (nowLv, newExp);
            int targetMaxExp = exp.getExpforNextLv (targetLv);

            List<float> maxExpList = new List<float> ();
            for (int k=nowLv; k<=targetLv; k++) {
                maxExpList.Add (exp.getDifExpforNextLv (k));
            }

            ExpSliderObj.GetComponent<ExpSlider> ().maxExpArray = maxExpList;  //Max Experience by Level
            ExpSliderObj.GetComponent<ExpSlider> ().i = 0; //
            ExpSliderObj.GetComponent<ExpSlider> ().startLv = nowLv; //
            ExpSliderObj.GetComponent<ExpSlider> ().nowExp = float.Parse (GameObject.Find ("CurrentExpValue").GetComponent<Text> ().text); //
            ExpSliderObj.GetComponent<ExpSlider> ().kanjyoExp = float.Parse (GameObject.Find (ExValue).GetComponent<Text> ().text);
            ExpSliderObj.GetComponent<ExpSlider> ().newExp = newExp; //
            ExpSliderObj.GetComponent<ExpSlider> ().targetMaxExp = targetMaxExp; //

            ExpSliderObj.GetComponent<Slider> ().value = float.Parse (GameObject.Find ("CurrentExpValue").GetComponent<Text> ().text);
            ExpSliderObj.GetComponent<Slider> ().maxValue = maxExpList [0];

            //Set Qty of Kanjyo
            string kanjyoQtyString = "";
            if (kanjyoTyp == "DoKakyuKanjyo") {
                kanjyoQtyString = (kanjyoQty - 1).ToString () + "," + kanjyoList [1] + "," + kanjyoList [2];

            } else if (kanjyoTyp == "DoCyukyuKanjyo") {
                kanjyoQtyString = kanjyoList [0] + "," + (kanjyoQty - 1).ToString () + "," + kanjyoList [2];

            } else if (kanjyoTyp == "DoJyokyuKanjyo") {
                kanjyoQtyString = kanjyoList [0] + "," + kanjyoList [1] + "," + (kanjyoQty - 1).ToString ();
            }

            PlayerPrefs.SetString ("kanjyo", kanjyoQtyString);
            PlayerPrefs.SetInt (tempExp, newExp);
            PlayerPrefs.SetInt (busyoId, targetLv);
            PlayerPrefs.Flush();

            string kanjyoText = busyoName + "に感状を与えました。";
            Message msg = new Message();
            msg.makeMessage (kanjyoText);

            //Run
            ExpSliderObj.GetComponent<ExpSlider> ().enabled = true;

            RonkouScene ronkou = new RonkouScene();
            ronkou.createBusyoStatusView(busyoId);

        }
    }
Exemple #4
0
    public void OnClick()
    {
        if (moneyOK != true) {
            //Error
            string Text = "金が不足しております。";
            msg.makeMessage(Text);

        }else{
            //OK
            Slider lvSlider = GameObject.Find ("KunrenSlider").GetComponent<Slider>();
            int targetLv = (int)lvSlider.value;
            string payMoney = GameObject.Find ("RequiredMoneyValue").GetComponent<Text>().text;
            string busyoId = GameObject.Find ("GameScene").GetComponent<NowOnBusyo>().OnBusyo;

            //reduce money
            int nowMoney = PlayerPrefs.GetInt ("money");
            int calcMoney = nowMoney - int.Parse(payMoney);

            //increase target Lv
            string tmp = "hei" + busyoId;
            string chParam = PlayerPrefs.GetString (tmp);

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

            //get pure status
            Entity_lvch_mst lvMst  = Resources.Load ("Data/lvch_mst") as Entity_lvch_mst;
            int startline = 0;
            string ch_type = ch_list [0];

            if(ch_type=="KB"){
                startline = 0;
            }else if(ch_type=="YR"){
                startline = 1;
            }else if(ch_type=="TP"){
                startline = 2;
            }else if(ch_type=="YM"){
                startline = 3;
            }

            object stslst = lvMst.param[startline];
            Type t = stslst.GetType();
            String param = "lv" + targetLv.ToString();
            FieldInfo f = t.GetField(param);
            int sts = (int)f.GetValue(stslst);

            string newParam = ch_list [0] + ":" + ch_list [1] + ":" + targetLv.ToString() + ":" + sts.ToString();

            PlayerPrefs.SetInt ("money",calcMoney);
            PlayerPrefs.SetString (tmp,newParam);

            PlayerPrefs.Flush();

            //Message
            string busyoName = GameObject.Find ("GameScene").GetComponent<NowOnBusyo>().OnBusyoName;
            string OKtext=busyoName+"隊にて訓練を実施しました。";
            msg.makeMessage(OKtext);

            //Reload
            //Close Board
            GameObject.Find ("close").GetComponent<CloseBoard>().onClick();
            RonkouScene ronkou = new RonkouScene();
            ronkou.createBusyoStatusView(busyoId);

        }
    }
Exemple #5
0
    public void OnClick()
    {
        Message msg = new Message();

        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();

        if (itemOK == false || moneyOK == false)
        {
            //Error
            audioSources [4].Play();
            msg.makeMessage(msg.getMessage(52));
        }
        else
        {
            audioSources [3].Play();

            /*Do Cyouhei*/
            //Reduce Current Item
            string   itemColumn     = "cyouhei" + ch_type;
            string   itemString     = PlayerPrefs.GetString(itemColumn);
            char[]   delimiterChars = { ',' };
            string[] itemList       = itemString.Split(delimiterChars);

            string newItemListString = "0,0,0";
            if (itemType == "low")
            {
                int calc = int.Parse(itemList[0]) - requiredItem;
                newItemListString = calc.ToString() + "," + itemList[1] + "," + itemList[2];
            }
            else if (itemType == "middle")
            {
                int calc = int.Parse(itemList[1]) - requiredItem;
                newItemListString = itemList[0] + "," + calc.ToString() + "," + itemList[2];
            }
            else if (itemType == "hight")
            {
                int calc = int.Parse(itemList[2]) - requiredItem;
                newItemListString = itemList[0] + "," + itemList[1] + "," + calc.ToString();
            }
            PlayerPrefs.SetString(itemColumn, newItemListString);

            //Reduce Money
            int calcMoney = nowMoney - requiredMoney;
            PlayerPrefs.SetInt("money", calcMoney);

            //Add Child QTY
            string busyoId        = GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyo;
            string temp           = "hei" + busyoId;
            string childStsString = PlayerPrefs.GetString(temp, "0");
            if (childStsString == "0" || childStsString == "")
            {
                StatusGet statusScript  = new StatusGet();
                string    chParamHeisyu = statusScript.getHeisyu(int.Parse(busyoId));
                childStsString = chParamHeisyu + ":1:1:1";
                PlayerPrefs.SetString(temp, childStsString);
                PlayerPrefs.Flush();
            }

            char[]   delimiterChars2 = { ':' };
            string[] childStsList    = childStsString.Split(delimiterChars2);

            int bfrChildQty = int.Parse(childStsList[1]);
            int aftChildQty = bfrChildQty + 1;

            string newChildStsString = childStsString;
            newChildStsString = childStsList[0] + ":" + aftChildQty.ToString() + ":" + childStsList[2] + ":" + childStsList[3];
            PlayerPrefs.SetString(temp, newChildStsString);

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


            //Message
            string busyoName = GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyoName;
            string OKtext    = "";
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                OKtext = busyoName + " recruited new soldiers.";
            }
            else
            {
                OKtext = busyoName + "隊にて徴兵を実施しました。";
            }
            msg.makeMessage(OKtext);

            //Reload
            //Close Board
            if (Application.loadedLevelName != "tutorialBusyo")
            {
                GameObject.Find("close").GetComponent <CloseBoard>().onClick();
                RonkouScene ronkou = new RonkouScene();
                ronkou.createBusyoStatusView(busyoId);
            }
            else
            {
                Destroy(GameObject.Find("Back(Clone)").gameObject);
                Destroy(GameObject.Find("board(Clone)").gameObject);
                GameObject ChildQtyValue = GameObject.Find("ChildQtyValue").gameObject;
                ChildQtyValue.GetComponent <Text>().text = "2";
                //Set Parametor
                PlayerPrefs.SetInt("tutorialId", 11);
                PlayerPrefs.Flush();
                TutorialController tutorialScript = new TutorialController();
                Vector2            vect           = new Vector2(50, 200);
                GameObject         anim           = tutorialScript.SetFadeoutPointer(ChildQtyValue, vect);
                anim.transform.localScale = new Vector2(500, 500);

                Color      enabledColor = new Color(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
                GameObject btn          = GameObject.Find("ButtonKunren").gameObject;
                btn.GetComponent <Button>().enabled = true;
                btn.GetComponent <Image>().color    = enabledColor;
                btn.transform.FindChild("Text").GetComponent <Text>().color = enabledColor;

                GameObject ButaiStatus = GameObject.Find("ButaiStatus").gameObject;
                GameObject BusyoStatus = GameObject.Find("BusyoStatus").gameObject;
                ButaiStatus.transform.SetParent(BusyoStatus.transform);

                GameObject Button = GameObject.Find("Panel").transform.FindChild("Button").gameObject;
                GameObject tBack  = GameObject.Find("tBack").gameObject;
                Button.transform.SetParent(tBack.transform);
                Vector2    vect2     = new Vector2(0, 50);
                GameObject animPoint = tutorialScript.SetPointer(Button, vect2);
                animPoint.transform.localScale = new Vector2(200, 200);
            }
        }
    }