/// <summary> /// 动物栏的观光点数量消息修改 /// </summary> /// <param name="obj"></param> private void OnSetLittleZooVisitorLocationLevelOfPlayerData(Message obj) { var _msg = obj as SetDetailValueOfPlayerData; // 涉及金币减扣 LittleZooModuleDataMSS littleZooModuleData = GlobalDataManager.GetInstance().playerData.GetLittleZooModuleData(_msg.detailVal); buildupCell = GetBuildupCell(_msg.detailVal); if (littleZooModuleData.littleZooVisitorSeatLevel >= buildupCell.watchmaxlv) { return; } BigInteger bigDelta = (LittleZooModule.GetUpGradeVisitorLocationLevelConsumption(_msg.detailVal, littleZooModuleData.littleZooVisitorSeatLevel + _msg.deltaVal)); //bool retCode = VaryDataCoin(bigDelta); //if (!retCode) //{ // //string e = string.Format("升级动物栏扣钱失败"); // //throw new System.Exception(e); // return; //} if (!playerData.playerZoo.playerCoin.WarpAddCoin(playerData, -bigDelta)) { return; } int currVal = littleZooModuleData.littleZooVisitorSeatLevel + _msg.deltaVal; //LogWarp.Log("测试: 等级原来是"+zooLevel+" 现在是 "+currVal); int idx = GlobalDataManager.GetInstance().playerData.GetLittleZooIDIndexOfDataIdx(_msg.detailVal); //获取动物栏ID 下标 this.playerData.playerZoo.littleZooModuleDatasMSS[idx].littleZooVisitorSeatLevel = currVal; //BroadcastValueOfPlayerData.Send((int)GameMessageDefine.BroadcastCoinOfPlayerData, // 0, 0, BigInteger.Parse(GlobalDataManager.GetInstance().playerData.playerZoo.coin), bigDelta); BroadcastDetailValueOfPlayerData.Send((int)GameMessageDefine.BroadcastLittleZooVisitorLocationLevelOfPlayerData, _msg.detailVal, currVal, _msg.deltaVal); BuildingLevelup.Send((int)BuildingTypeFM.LittleZoo, _msg.detailVal, (int)LittleZooProperty.Capacity, currVal); }
/// <summary> /// 动物栏的门票升级消息修改 /// </summary> /// <param name="msg"></param> protected void OnSetLittleZooTicketsLevelPlayerData(Message msg) { var _msg = msg as SetDetailValueOfPlayerData; // 涉及金币减扣 LittleZooModuleDataMSS littleZooModuleData = GlobalDataManager.GetInstance().playerData.GetLittleZooModuleData(_msg.detailVal); buildupCell = GetBuildupCell(_msg.detailVal); if ((littleZooModuleData.littleZooTicketsLevel + _msg.deltaVal) > buildupCell.lvmax) { return; } BigInteger bigDelta = (LittleZooModule.GetUpGradeConsumption(_msg.detailVal, littleZooModuleData.littleZooTicketsLevel + _msg.deltaVal)); if (!playerData.playerZoo.playerCoin.WarpAddCoin(playerData, -bigDelta)) { return; } //修改动物栏等级 int currVal = littleZooModuleData.littleZooTicketsLevel + _msg.deltaVal; int idx = GlobalDataManager.GetInstance().playerData.GetLittleZooIDIndexOfDataIdx(_msg.detailVal); //获取动物栏ID 下标 this.playerData.playerZoo.littleZooModuleDatasMSS[idx].littleZooTicketsLevel = currVal; BroadcastDetailValueOfPlayerData.Send((int)GameMessageDefine.BroadcastLittleZooTicketsLevelPlayerData, _msg.detailVal, currVal, _msg.deltaVal); BuildingLevelup.Send((int)BuildingTypeFM.LittleZoo, _msg.detailVal, (int)LittleZooProperty.TicketPrice, currVal); //收集星星: var lvshage = Config.buildupConfig.getInstace().getCell(_msg.detailVal).lvshage; int idx01 = FindLevelRangIndex01(lvshage, currVal); //LogWarp.LogErrorFormat("测试: 等级={0} 下标={1} ",currVal,idx01); int stageLevel = Config.buildupConfig.getInstace().getCell(_msg.detailVal).lvshage[idx01]; if (this.playerData.playerZoo.littleZooModuleDatasMSS[idx].littleZooTicketsLevel == stageLevel) { int awardType = Config.buildupConfig.getInstace().getCell(_msg.detailVal).lvrewardtype[idx01]; int awardID = Config.buildupConfig.getInstace().getCell(_msg.detailVal).lvreward[idx01]; var cell = Config.itemConfig.getInstace().getCell(awardID); if (awardType == 1) { //发放奖励道具 MessageInt.Send((int)GameMessageDefine.GetItem, awardID); if (cell.itemtype == 2) { PageMgr.GetPage <UIMainPage>().OnMoneyEffect(); } //LogWarp.LogErrorFormat("动物栏 当前等级为{0},可以发放奖励道具{1}", stageLevel, awardID); } else if (awardType == 2) { var buildUpCell = Config.buildupConfig.getInstace().getCell(_msg.detailVal); int animalID = buildUpCell.lvreward[idx01]; //LogWarp.LogErrorFormat("测试:AAAAAAAAAAAAAAAAAAAAAAA 动物栏:{0} animalID ={1}" , _msg.detailVal, animalID); var animalUpCell = Config.animalupConfig.getInstace().getCell(animalID); //判断是否需要存储动物 bool isExistAnimalID = playerData.playerZoo.animalMSS15.FindAnimalID(animalID); if (!isExistAnimalID) { playerData.playerZoo.animalMSS15.AddAnimal(animalID, true); LittleZooModule.LoadAnimal(_msg.detailVal, animalID, animalUpCell.moveradius, buildUpCell.animalwanderoffset); GetShowUIReceivePage(animalID); MessageInt.Send((int)GameMessageDefine.GetAnimalAtlasDataMessage, animalID); MessageManager.GetInstance().Send((int)GameMessageDefine.AnimalBuffAlterSucceed); } } //发放星星 MessageInt.Send((int)GameMessageDefine.GetItem, 4); //LogWarp.LogErrorFormat("动物栏 当前等级为{0},可以发放星星", stageLevel); } }