当前位置: 首页>>代码示例>>C#>>正文


C# Exp.getExpforNextLv方法代码示例

本文整理汇总了C#中Exp.getExpforNextLv方法的典型用法代码示例。如果您正苦于以下问题:C# Exp.getExpforNextLv方法的具体用法?C# Exp.getExpforNextLv怎么用?C# Exp.getExpforNextLv使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Exp的用法示例。


在下文中一共展示了Exp.getExpforNextLv方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: createBusyoStatusView

    public void createBusyoStatusView(string busyoId)
    {
        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= exp.getExpforNextLv(lv);

        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;
        for(int i=0;i<KahouStatusArray.Length;i++){
            string status = KahouStatusArray[i];

            if(i==0){
                //Attack
                GameObject.Find ("KahouAtkValue").GetComponent<Text>().text = "+" + status;

            }else if(i==1){
                //HP
                GameObject.Find ("KahouHpValue").GetComponent<Text>().text = "+" + status;
                totalBusyoHp = adjHp + int.Parse(status);
            }else if(i==2){
                //DFC
                GameObject.Find ("KahouDfcValue").GetComponent<Text>().text = "+" + status;

            }else if(i==3){
                //SPD
                GameObject.Find ("KahouSpdValue").GetComponent<Text>().text = "+" + status;
            }
        }

        //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;

        float chAtkDfc = ch_status + totalBusyoHp / 200;
        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.anchoredPosition = new Vector3 (-200, -50, 0);
//.........这里部分代码省略.........
开发者ID:zeimoter,项目名称:zeimoter,代码行数:101,代码来源:RonkouScene.cs

示例2: OnClick

	public void OnClick(){

		busyoName = GameObject.Find ("GameScene").GetComponent<NowOnBusyo>().OnBusyoName;
		busyoId = GameObject.Find ("GameScene").GetComponent<NowOnBusyo>().OnBusyo;

		commonPopup ();

		if(buttonName == "kanjyo"){
			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 (3, 3);
			Busyo.GetComponent<DragHandler>().enabled = false;
			RectTransform busyo_transform = Busyo.GetComponent<RectTransform>();
			busyo_transform.anchoredPosition = new Vector3(300,350,0);
			busyo_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.anchoredPosition = 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.anchoredPosition = new Vector3 (20,-50,0);
			rank_transform.sizeDelta = new Vector2( 200, 200);
			rank.GetComponent<Text>().fontSize = 200;

			//Common for Kanjyo
			string kanjyoPath = "Prefabs/Busyo/Kanjyo";
			GameObject kanjyo = Instantiate (Resources.Load (kanjyoPath)) as GameObject;
			kanjyo.transform.SetParent (GameObject.Find ("board(Clone)").transform);
			kanjyo.transform.localScale = new Vector2 (1, 1);
			RectTransform kanjyo_transform = kanjyo.GetComponent<RectTransform>();
			kanjyo_transform.anchoredPosition = new Vector3(0,0,0);

			//Busyo Lv 
			GameObject.Find ("PopLvValue").GetComponent<Text>().text = pa_lv.ToString();
			
			//Exp Status Bar
			Exp exp = new Exp();


			GameObject expSlider = GameObject.Find ("ExpSlider");
			int nextExp =exp.getDifExpforNextLv(pa_lv);
			string tempExp = "exp" + busyoId;
			int nowExp = PlayerPrefs.GetInt(tempExp);
			int startExp = nowExp - exp.getExpforNextLv(pa_lv-1);


			expSlider.GetComponent<Slider>().value = startExp;
			expSlider.GetComponent<Slider>().maxValue = nextExp;

			GameObject.Find ("CurrentExpValue").GetComponent<Text>().text = startExp.ToString();
			GameObject.Find ("NextLvExpValue").GetComponent<Text>().text = nextExp.ToString();


			Item item =new Item();

			//Low kanjyo fields
			string kanjyoItemPath = "Prefabs/Item/Kanjyo/Kanjyo";
			GameObject lowKanjyoItem = Instantiate (Resources.Load (kanjyoItemPath)) as GameObject;
			lowKanjyoItem.transform.SetParent(GameObject.Find ("KakyuKanjyo").transform);
			lowKanjyoItem.transform.localScale = new Vector2 (0.8f, 0.8f);
			RectTransform lowKanjyoTransform = lowKanjyoItem.GetComponent<RectTransform> ();
			lowKanjyoTransform.anchoredPosition = new Vector3 (-210, 125, 0);
			lowKanjyoTransform.sizeDelta = new Vector2 (100, 100);
			RectTransform lowKanjyoRank = lowKanjyoItem.transform.FindChild("KanjyoRank").GetComponent<RectTransform>();
			lowKanjyoRank.anchoredPosition = new Vector3(-30,30,0);
			RectTransform lowKanjyoRect = lowKanjyoItem.transform.FindChild("Kanjyo").GetComponent<RectTransform>();
			lowKanjyoRect.sizeDelta = new Vector2 (100, 100);
			Color lowColor = new Color (86f / 255f, 87f / 255f, 255f / 255f, 255f / 255f);
			lowKanjyoItem.GetComponent<Image>().color = lowColor;
			lowKanjyoItem.transform.FindChild("KanjyoRank").GetComponent<Text>().text = "下";
			lowKanjyoItem.name = "Kanjyo1";

			//Item Effect
			int effectForLow =item.getEffect(lowKanjyoItem.name);
			GameObject.Find ("KakyuKanjyoExpValue").GetComponent<Text>().text = effectForLow.ToString();

			//Middle kanjyo fields
			GameObject midKanjyoItem = Instantiate (Resources.Load (kanjyoItemPath)) as GameObject;
			midKanjyoItem.transform.SetParent(GameObject.Find ("CyukyuKanjyo").transform);
			midKanjyoItem.transform.localScale = new Vector2 (0.8f, 0.8f);
			RectTransform midKanjyoTransform = midKanjyoItem.GetComponent<RectTransform> ();
			midKanjyoTransform.anchoredPosition = new Vector3 (-210, 125, 0);
			midKanjyoTransform.sizeDelta = new Vector2 (100, 100);
			RectTransform midKanjyoRank = midKanjyoItem.transform.FindChild("KanjyoRank").GetComponent<RectTransform>();
			midKanjyoRank.anchoredPosition = new Vector3(-30,30,0);
			RectTransform midKanjyoRect = midKanjyoItem.transform.FindChild("Kanjyo").GetComponent<RectTransform>();
			midKanjyoRect.sizeDelta = new Vector2 (100, 100);
			Color midColor = new Color (236f / 255f, 93f / 255f, 93f / 255f, 255f / 255f);
			midKanjyoItem.GetComponent<Image>().color = midColor;
//.........这里部分代码省略.........
开发者ID:zeimoter,项目名称:sengoku2d,代码行数:101,代码来源:BusyoStatusButton.cs

示例3: createBusyoStatusView

	public void createBusyoStatusView(string busyoId){
		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 ();
//.........这里部分代码省略.........
开发者ID:zeimoter,项目名称:sengoku2d,代码行数:101,代码来源:RonkouScene.cs

示例4: OnClick

    public void OnClick()
    {
        //Limit Check
        int stockLimit = PlayerPrefs.GetInt("stockLimit");
        int myBusyoQty = PlayerPrefs.GetInt("myBusyoQty");

        if (myBusyoQty + 1 > stockLimit) {
            //Error
            Message msg = new Message();
            string Text = "現在の国力では登用出来る武将数は" + stockLimit.ToString()+ "人までですぞ。";
            msg.makeMessage (Text);

        } else {
            //Existing Check
            int existCheck = PlayerPrefs.GetInt (busyoId.ToString ());

            //Not Exist
            if (existCheck != null && existCheck != 0) {
                //Lv up
                int currentLv = PlayerPrefs.GetInt (busyoId.ToString ());
                int newLv = currentLv + 1;
                PlayerPrefs.SetInt (busyoId.ToString (), newLv);

                string exp = "exp" + busyoId.ToString ();
                //int currentExp = PlayerPrefs.GetInt (exp);
                Exp expCalc = new Exp ();
                int totalExp = expCalc.getExpforNextLv (currentLv);
                PlayerPrefs.SetInt (exp, totalExp);

                //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);

                PlayerPrefs.Flush ();

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

                MessageBusyo msg = new MessageBusyo ();
                string lvUpText = busyoName + "をレベルアップしました。";
                string type = "touyou";
                msg.makeMessage (lvUpText, busyoId, type);

                //Exist
            } else {

                //Add New Data
                string myBusyoString = PlayerPrefs.GetString ("myBusyo");
                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:10";
                PlayerPrefs.SetString (hei, heiValue);

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

                string koudou = "koudou" + busyoId.ToString ();
                PlayerPrefs.SetString (koudou, "1");

                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);

                //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);
                myBusyoQty = myBusyoQty + 1;
                PlayerPrefs.SetInt("myBusyoQty",myBusyoQty);
                PlayerPrefs.Flush ();

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

                MessageBusyo msg = new MessageBusyo ();
//.........这里部分代码省略.........
开发者ID:zeimoter,项目名称:zeimoter,代码行数:101,代码来源:DoTouyou.cs

示例5: OnClick

	public void OnClick () {

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

		if (myBusyoQty + 1 > stockLimit) {
			//Error
			Message msg = new Message(); 
			string Text = "現在の国力では登用出来る武将数は" + stockLimit.ToString()+ "人までですぞ。";
			msg.makeMessage (Text);

		} else {
			//Existing Check
			int existCheck = PlayerPrefs.GetInt (busyoId.ToString ());
			if (existCheck != null && existCheck != 0) {
				//Lv up
				int currentLv = PlayerPrefs.GetInt (busyoId.ToString ());

				int newLv = 0;
				string lvUpText = "";

				//Already Lv 100
				if(currentLv == 100){
					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);
					lvUpText = "武将珠" + busyoDama + "個を贈呈します。";
					GameObject.Find ("BusyoDamaValue").GetComponent<Text>().text = myBusyoDama.ToString();

				}else{
					newLv = currentLv + 1;
					lvUpText = busyoName + "をレベルアップしました。";
				}
				PlayerPrefs.SetInt (busyoId.ToString (), newLv);

				if(currentLv != 100){
					string exp = "exp" + busyoId.ToString ();
					Exp expCalc = new Exp ();
					int totalExp = expCalc.getExpforNextLv (currentLv);
					PlayerPrefs.SetInt (exp, totalExp);
				}
				//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);

				PlayerPrefs.Flush ();

				//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 {

				//Add New Data
				string myBusyoString = PlayerPrefs.GetString ("myBusyo");
				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");
//.........这里部分代码省略.........
开发者ID:zeimoter,项目名称:sengoku2d,代码行数:101,代码来源:DoTouyou.cs

示例6: DoKanjyoOperation

	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 = 0;
			List<float> maxExpList = new List<float> ();
			if(targetLv != 100){
				targetMaxExp = exp.getExpforNextLv (targetLv);
				for (int k=nowLv; k<=targetLv; k++) {
					maxExpList.Add (exp.getDifExpforNextLv (k));
				}
			}else{
				maxExpList.Add((float)exp.getExpLv100());
			}

			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;

		}
	}
开发者ID:zeimoter,项目名称:sengoku2d,代码行数:100,代码来源:DoKanjyo.cs


注:本文中的Exp.getExpforNextLv方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。