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


C# Exp.getDifExpforNextLv方法代码示例

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


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

示例1: 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

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