protected void OnBroadcastOpenNewLittleZoo(Message msg) { var _msg = msg as BroadcastOpenNewLittleZoo; //增加数据 ModifyLittleZooMap(_msg.littleZooID, littleZooMap); //自身外观变化从0级别变1级 LoadLittleZoo(sceneID, _msg.littleZooID, 1, null); var cellBuildUp = Config.buildupConfig.getInstace().getCell(_msg.littleZooID); Config.animalupCell cellAnimalUp; int animalID = cellBuildUp.animalid[0]; cellAnimalUp = Config.animalupConfig.getInstace().getCell(animalID); bool isFindAnimalProp = playerData.playerZoo.animalMSS15.FindAnimalProp(cellAnimalUp.bigtype, cellAnimalUp.smalltype, out AnimalProp animalProp); if (!isFindAnimalProp) { playerData.playerZoo.animalMSS15.AddAnimal(animalID, true); LittleZooModule.LoadAnimal(_msg.littleZooID, animalID, cellAnimalUp.moveradius, cellBuildUp.animalwanderoffset, sceneID); MessageInt.Send((int)GameMessageDefine.GetAnimalAtlasDataMessage, animalID); MessageManager.GetInstance().Send((int)GameMessageDefine.AnimalBuffAlterSucceed); } else { for (int j = 0; j < cellBuildUp.animalid.Length; j++) { animalID = cellBuildUp.animalid[j]; bool isShow = LittleZooModule.GetExamineAnimalShowToLittleZooScene(animalID); if (isShow == true) { cellAnimalUp = Config.animalupConfig.getInstace().getCell(animalID); LittleZooModule.LoadAnimal(_msg.littleZooID, animalID, cellAnimalUp.moveradius, cellBuildUp.animalwanderoffset, sceneID); } } } //是否需要加载额外地块 if (!_msg.isTriggerExtend) { return; } //加载新地块 float extendLen = 0; if (_msg.triggerLoadGroupID != Const.Invalid_Int) { extendLen = LoadExtendGroup(_msg.triggerLoadGroupID); UIInteractive.GetInstance().Init(); } int triggerLittleZooID; for (int i = 0; i < _msg.triggerLoadLittleZooIDs.Count; i++) { triggerLittleZooID = _msg.triggerLoadLittleZooIDs[i]; //加载动物栏 LoadLittleZoo(sceneID, triggerLittleZooID, 0, GlobalDataManager.GetInstance().zooGameSceneData.littleZooParentNode); } //出口后移 MoveExitGate(extendLen); MessageManager.GetInstance().Send((int)GameMessageDefine.BroadcastAfterExtendSceneAndModifiedPath); BuildingUnlock.Send((int)BuildingTypeFM.LittleZoo, _msg.littleZooID); }
/// <summary> /// 加载动物栏的小动物 /// MIN(1+INT(lv/100),10) 然后取buildup表中的animalid数组中的元素 /// </summary> protected void LoadAnimalInLittleZoo() { int firstLittleZooID = GlobalDataManager.GetInstance().logicTableGroup.GetFirstLittleZooID(sceneID);//默认,代码准确赋值 if (firstLittleZooID == Const.Invalid_Int) { firstLittleZooID = 1001; } Config.buildupCell cellBuildUp; Config.animalupCell cellAnimalUp; int animalID; //var coin = playerData.playerZoo.playerCoin.GetCoinByScene(playerData.playerZoo.currSceneID); LittleZooModule.playerAnimalGoToResourceID.Clear(); var animalMSS15 = playerData.playerZoo.animalMSS15; for (int i = 0; i < this.playerData.playerZoo.littleZooModuleDatasMSS.Count; i++) { //若是非本场景跳出 if (playerData.playerZoo.littleZooModuleDatasMSS[i].sceneID != sceneID) { continue; } //若是本场景第一个动物栏, int littleZooID = playerData.playerZoo.littleZooModuleDatasMSS[i].littleZooID; if (littleZooID == 1001) { //AppsFlyer打点:首次加载游戏 } //看第一个动物数据是否有类型的数据,若有继续,若无添加 if (littleZooID == firstLittleZooID) { cellBuildUp = Config.buildupConfig.getInstace().getCell(littleZooID); animalID = cellBuildUp.animalid[0]; bool isShow = LittleZooModule.GetExamineAnimalShowToLittleZooScene(animalID); if (isShow == false) { animalMSS15.AddAnimal(animalID, true); } } //动物栏的门票等级是否大于0 if (playerData.playerZoo.littleZooModuleDatasMSS[i].littleZooTicketsLevel > 0) { //利用animalID去查询是否有小类型等级 cellBuildUp = Config.buildupConfig.getInstace().getCell(littleZooID); for (int j = 0; j < cellBuildUp.animalid.Length; j++) { animalID = cellBuildUp.animalid[j]; bool isShow = LittleZooModule.GetExamineAnimalShowToLittleZooScene(animalID); if (isShow == true) { cellAnimalUp = Config.animalupConfig.getInstace().getCell(animalID); LittleZooModule.LoadAnimal(littleZooID, animalID, cellAnimalUp.moveradius, cellBuildUp.animalwanderoffset, sceneID); } } } } (PageMgr.allPages["UILoading"] as UILoading).SliderValueLoading(1f); waitCD.Run(); }
/// <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); } }