void OnClick() { switch ((FruitPrucStatusType)MyFruitData.byFruitStatus) { case FruitPrucStatusType.NONE_FRUIT_STATUS_TYPE: int unlockLevel = myParent.TreasureTreesDataBase.TreasureTreesDataList.First(P => P.PositionID == MyPositionID).UnlockLevel; if (unlockLevel < 0) { string ShowMsg = unlockLevel > 0 ? string.Format(LanguageTextManager.GetString("IDS_H1_464"), unlockLevel) : LanguageTextManager.GetString("IDS_H1_465"); //MessageBox.Instance.Show(3, "", ShowMsg, LanguageTextManager.GetString("IDS_H2_55"), LanguageTextManager.GetString("IDS_H2_28"), SendUnlockMyFruitPositionToSever, null); bool CanBuy = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_BINDPAY >= MyTreeData.UnlockCost; //元宝是否足够 myParent.ShowCostMoneyMessageBox(CanBuy, EMessageCoinType.EGoldType, MyTreeData.UnlockCost, ShowMsg, LanguageTextManager.GetString("IDS_H2_11"), LanguageTextManager.GetString("IDS_H2_28"), SendUnlockMyFruitPositionToSever, null); } break; case FruitPrucStatusType.SEED_FRUIT_STATUS_TYPE: OnFruitClick(); break; case FruitPrucStatusType.FLOWER_FRUIT_STATUS_TYPE: OnFruitClick(); break; case FruitPrucStatusType.GROW_FRUIT_STATUS_TYPE: OnFruitClick(); break; case FruitPrucStatusType.RIPEN_FRUIT_STATUS_TYPE: myParent.PickUpFruit((byte)MyPositionID); break; } }
void OnUseManaBtnClick(object obj) { SoundManager.Instance.PlaySoundEffect("Sound_Button_Tree_Buy"); int buyNum = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_MAXMANNA_BUYNUM; bool CanBuyMana = buyNum < CommonDefineManager.Instance.CommonDefine.FruitMannan_CountMax; int leftTime = CommonDefineManager.Instance.CommonDefine.FruitMannan_CountMax - PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_MAXMANNA_BUYNUM; //TraceUtil.Log("是否可以继续购买仙露:" + PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_MAXMANNA_BUYNUM); if (CanBuyMana) //如果可以购买仙露 { bool CanBuy = PlayerManager.Instance.FindHeroDataModel().PlayerValues.PLAYER_FIELD_BINDPAY >= CommonDefineManager.Instance.CommonDefine.FruitMannan_Pay; //元宝是否足够 string formatStr = LanguageTextManager.GetString("IDS_I28_16").Replace("\\n", "\n"); string ShowMsg = string.Format(formatStr, CommonDefineManager.Instance.CommonDefine.FruitMannan_Count, leftTime); string sureBtnStr = LanguageTextManager.GetString("IDS_H2_55"); string cancelBtnStr = LanguageTextManager.GetString("IDS_H2_28"); int A = CommonDefineManager.Instance.CommonDefine.BuyFruitMannanConsumption1; int B = CommonDefineManager.Instance.CommonDefine.BuyFruitMannanConsumption2; int C = CommonDefineManager.Instance.CommonDefine.BuyFruitMannanConsumption3; int D = CommonDefineManager.Instance.CommonDefine.BuyFruitMannanConsumption4; int buyTimes = buyNum / CommonDefineManager.Instance.CommonDefine.FruitMannan_Count + 1; int buyPrice = Mathf.FloorToInt((A * buyTimes * buyTimes + B * buyTimes + C) / (float)D) * D; MyParent.ShowCostMoneyMessageBox(CanBuy, EMessageCoinType.EGoldType, buyPrice, ShowMsg, sureBtnStr, cancelBtnStr, SendBuyAmritaToSever, null); } else { MessageBox.Instance.ShowTips(3, LanguageTextManager.GetString("IDS_H1_470"), 1);//超出购买上限提示 SoundManager.Instance.PlaySoundEffect("Sound_Button_Tree_BuyFail"); } }