protected void OnOpenNewLittleZoo(Message msg) { //判定是不是最后,是否需要加载新地块,以及新加载地块上的动物栏 var _msg = msg as OpenNewLittleZoo; int littleZooID = _msg.littleZooID; string e; int idx = GlobalDataManager.GetInstance().playerData.GetLittleZooIDIndexOfDataIdx(littleZooID); if (idx < 0) { //e = string.Format("开启的动物栏 {0} 在用户数据中没有", littleZooID); //throw new System.Exception(e); return; } #if UNITY_EDITOR if (playerData.playerZoo.littleZooModuleDatasMSS[idx].littleZooTicketsLevel != 0) { //e = string.Format("开启的动物栏 {0} 在用户数据中等级!=0", littleZooID); //throw new System.Exception(e); return; } #endif playerData.playerZoo.littleZooModuleDatasMSS[idx].sceneID = playerData.playerZoo.currSceneID; playerData.playerZoo.littleZooModuleDatasMSS[idx].littleZooTicketsLevel = 1; playerData.playerZoo.littleZooModuleDatasMSS[idx].littleZooEnterVisitorSpawnLevel = 1; playerData.playerZoo.littleZooModuleDatasMSS[idx].littleZooVisitorSeatLevel = 1; int nextGroupID = Const.Invalid_Int; bool trigerExtend = false; trigerLoadLittleZooIDs.Clear(); if (GlobalDataManager.GetInstance().logicTableGroup.IsTrigerLoadNextGroupID( playerData.playerZoo.currSceneID, littleZooID, ref nextGroupID)) { //触发额外的地块,用户数据中加数据 if (!GlobalDataManager.GetInstance().zooGameSceneData.IsExtendGroupContains(nextGroupID)) { trigerExtend = true; var cell = Config.groupConfig.getInstace().getCell(nextGroupID); trigerLoadLittleZooIDs.AddRange(cell.startid); for (int i = 0; i < trigerLoadLittleZooIDs.Count; i++) { //playerData.playerZoo.littleZooLevels.Add(0); LittleZooModuleDataMSS littleZooModuleData = new LittleZooModuleDataMSS { sceneID = playerData.playerZoo.currSceneID, littleZooID = trigerLoadLittleZooIDs[i], littleZooTicketsLevel = 0, littleZooVisitorSeatLevel = 0, littleZooEnterVisitorSpawnLevel = 0, }; playerData.playerZoo.littleZooModuleDatasMSS.Add(littleZooModuleData); } } } //LogWarp.LogError("测试:开启了littleZooID" + littleZooID); BroadcastOpenNewLittleZoo.Send(littleZooID, trigerExtend, nextGroupID, trigerLoadLittleZooIDs); }
/// <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> /// 动物栏展示每分钟观光游客数量 Y=观光速率*观光点数 /// </summary> /// <returns></returns> public static float GetLittleZooVisitorNumberMS(int littleZooID, LittleZooModuleDataMSS littleZooModuleData) { var visitorNumber = GetVisitDurationMS(littleZooID, littleZooModuleData.littleZooEnterVisitorSpawnLevel) * OpenVisitPosNumber(littleZooID, littleZooModuleData.littleZooVisitorSeatLevel); return(visitorNumber); }
/// <summary> /// 根据用户数据获取任务进度 /// </summary> /// <param name="taskId"></param> /// <returns></returns> public int ResolveTaskProgress(int taskId) { Config.missionCell missionCell = GetTaskCell(taskId); if (missionCell == null) { return(0); } TaskType taskType = missionCell.ParseTaskType(); if (taskType == TaskType.AdWatch || taskType == TaskType.LittleZooVisit) { return(0); } if (taskType == TaskType.LittleZooLevelup) { int litzooId = missionCell.GetLittleZooId(); LittleZooModuleDataMSS litzooData = null; try { litzooData = playerData.GetLittleZooModuleData(litzooId); } catch (Exception e) { string.Format("动物栏[{0}]还未开启", litzooId); } if (litzooData != null) { LittleZooProperty zooProp = missionCell.ParseLittleZooProperty(); if (zooProp == LittleZooProperty.TicketPrice) { return(litzooData.littleZooTicketsLevel); } else if (zooProp == LittleZooProperty.Capacity) { return(litzooData.littleZooVisitorSeatLevel); } else if (zooProp == LittleZooProperty.VisitSpeed) { return(litzooData.littleZooEnterVisitorSpawnLevel); } } return(0); } else if (taskType == TaskType.ParkingLevelup) { ParkingProperty parkProp = missionCell.ParseParkingProperty(); if (parkProp == ParkingProperty.Revenue) { return(playerData.GetParkingCenterDataIDIndexOfDataIdx().parkingProfitLevel); } else if (parkProp == ParkingProperty.Capacity) { return(playerData.GetParkingCenterDataIDIndexOfDataIdx().parkingSpaceLevel); } else if (parkProp == ParkingProperty.VisitorFlowSpeed) { return(playerData.GetParkingCenterDataIDIndexOfDataIdx().parkingEnterCarSpawnLevel); } } else if (taskType == TaskType.EntryGateLevelup) { EntryGateProperty entryProp = missionCell.ParseEntryGateProperty(); if (entryProp == EntryGateProperty.TicketPrice) { return(playerData.GetEntryDateDataIDIndexOfDataIdx().entryTicketsLevel); } else if (entryProp == EntryGateProperty.Entrance) { GateData entryData = null; int entryId = missionCell.GetEntryGateId(); try { entryData = playerData.GetEntryGateIDIndexOfDataIdx(entryId); } catch (Exception e) { string.Format("售票口[{0}]还未开启", entryId); } return(entryData != null ? entryData.level : 0); } } return(0); }
/// <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); } }