//public int Diamonds = 0; void Awake() { Instance = this; //初始化模型层的数据 PlayerKernalDataProxy playerKernalData = new PlayerKernalDataProxy(PlayerCurrentHP, PlayerCurrentMP, PlayerCurrentAttack, PlayerCurrentDefence, PlayerCurrentDexterity, PlayerCurrentCritChance, PlayerMaxHP, PlayerMaxMP, PlayerMaxAttack, PlayerMaxDexterity, PlayerMaxDefence, PlayerMaxCritChance, AttackByProp, DefenceByProp, DexterityByProp, CritChanceByProp); PlayerExternalDataProxy playerExternalData = new PlayerExternalDataProxy(Exp, Level, Gold); PlayerPackageDataProxy playerPackageDataProxy = new PlayerPackageDataProxy(LittleBlueBottleNum, BigBlueBottleNum, LittleRedBottleNum, BigRedBottleNum); }
/// <summary> /// 显示大蓝瓶的数量 /// </summary> /// <param name="kv"></param> private void DisplayBigBlueNum(KeyValueUpdate kv) { if (kv.Key.Equals("BigBlueBottleNum")) { textBigBlueItemCount.text = kv.Value.ToString(); if (PlayerPackageDataProxy.GetInstance().GetCurrentBigBlueNum() == 0) { goBigBlueItemCount.gameObject.SetActive(false); } } }
/// <summary> /// 显示小蓝瓶的数量 /// </summary> /// <param name="kv"></param> private void DisplayLittleBlueNum(KeyValueUpdate kv) { if (kv.Key.Equals("LittleBlueBottleNum")) { //Debug.Log("改变文本"); textLittleBlueItemCount.text = kv.Value.ToString(); if (PlayerPackageDataProxy.GetInstance().GetCurrentLittleBlueNum() == 0) { goLittleBlueItemCount.gameObject.SetActive(false); } } }
/// <summary> /// 使用大红瓶 /// </summary> /// <param name="go"></param> private void OnBigRedBottleClick(GameObject go) { if (go != null) { if (PlayerPackageDataProxy.GetInstance().GetCurrentBigRedNum() >= 1) { PlayerKernalDataProxy.GetInstance().IncreaseHealthValues(item.Value); PlayerPackageDataProxy.GetInstance().DecreaseBigRedNum(1); } else { //全部消耗完毕后将物体移出小方格并且隐藏 this.transform.SetParent(recoverItem); this.gameObject.SetActive(false); } } }
/// <summary> /// 使用小蓝瓶 /// </summary> /// <param name="go"></param> private void OnLittleBlueBottleClick(GameObject go) { if (go != null) { if (PlayerPackageDataProxy.GetInstance().GetCurrentLittleBlueNum() >= 1) { //Debug.Log("消耗小蓝瓶"); PlayerPackageDataProxy.GetInstance().DecreaseLittleBlueNum(1); PlayerKernalDataProxy.GetInstance().IncreaseMagicValues(item.Value); } else { //全部消耗完毕后将物体移出小方格并且隐藏 this.transform.SetParent(recoverItem); this.gameObject.SetActive(false); } } }