/// <summary> /// 其他场景的动物栏收益和 /// </summary> /// <param name="isNeedMulBuff"></param> /// <returns></returns> public static System.Numerics.BigInteger GetOtherSceneAllZooPrice(int sceneID, bool isNeedMulBuff = false) { int parkNumber = ParkingCenter.GetOtherSceneParkingEnterCarSpawn(sceneID); float entryGateNumber = EntryGateModule.GetAllEntryChargeValMs(sceneID); //LogWarp.LogErrorFormat("其他场景 停车场来人速度{0} 售票口收费速度{1}", parkNumber, entryGateNumber); System.Numerics.BigInteger littleZooNumber = 0; PlayerData playerData = GlobalDataManager.GetInstance().playerData; var littleZooModuleDataList_MS = GlobalDataManager.GetInstance().playerData.playerZoo.littleZooModuleDatasMSS; //int sceneID = GlobalDataManager.GetInstance().playerData.playerZoo.currSceneID; for (int i = 0; i < littleZooModuleDataList_MS.Count; i++) { if (littleZooModuleDataList_MS[i].littleZooTicketsLevel == 0 || littleZooModuleDataList_MS[i].sceneID != sceneID) { continue; } //每分钟动物栏基础收益=动物栏产出*min(停车场来人速度,售票口收费速度(全),60/(观光速度*观光点数)) //动物栏产出 var number1 = LittleZooModule.GetLittleZooPrice(littleZooModuleDataList_MS[i].littleZooID, littleZooModuleDataList_MS[i].littleZooTicketsLevel, isNeedMulBuff); //观光速度*观光点数 var number4 = LittleZooModule.GetLittleZooVisitorNumberMS(littleZooModuleDataList_MS[i].littleZooID, littleZooModuleDataList_MS[i]); var number5 = (int)(Mathf.Min(parkNumber, entryGateNumber, number4)) * number1; //LogWarp.LogErrorFormat("测试:非 parkNumber={0} entryGateNumber={1} number4={2} number1={3} ",parkNumber, entryGateNumber, number4,number1); littleZooNumber += number5; } return(littleZooNumber); }
/// <summary> /// 玩家所有产出需要相加的倍数值 y=1+动物加成+停车场利润加成+道具BUFF /// </summary> /// <returns></returns> public static float PlayerRatioCoinInComeAdd(int sceneID = -1) { int level = GlobalDataManager.GetInstance().playerData.GetParkingCenterDataIDIndexOfDataIdx(sceneID).parkingProfitLevel; float number = LittleZooModule.GetAllAnimalsBuff() + ParkingCenter.GetParkingProfit(level) / 100f + GlobalDataManager.GetInstance().playerData.playerZoo.buffRatioCoinInComeAdd; return(number); }
/// <summary> /// 开启动物 /// </summary> private void OnSetAnimalLevelData(Message obj) { var msg = obj as SetBuyAnimalObjectData; /* 扣钱 扣钱成功后修改商品数量 发送扣钱的通知和商品修改的通知 */ var animalMSS15 = GlobalDataManager.GetInstance().playerData.playerZoo.animalMSS15; Config.animalupCell animalupCell = Config.animalupConfig.getInstace().getCell(msg.goodsID); if (animalMSS15.GetAnimalProp(msg.goodsID).lv >= Config.globalConfig.getInstace().AnimalLvUpLimit) { return; } var expendDelta = LittleZooModule.GetAnimalUpLevelPriceFormula(msg.goodsID); if (!WarpAddCoin(-expendDelta)) { return; } //增加动物数据 Config.buildupCell cellBuildUp = Config.buildupConfig.getInstace().getCell(msg.littleZooID); animalMSS15.AnimalLvUp(msg.goodsID, 1); LittleZooModule.playerAnimalGoToResourceID.TryGetValue(msg.goodsID, out int playerAnimalGoToResourceID); MessageInt.Send((int)GameMessageDefine.AnimalPlayLevelUpEffect, playerAnimalGoToResourceID); GetAddNewAnimalData.Send((int)GameMessageDefine.GetAnimalLevel, msg.goodsID, msg.littleZooID); MessageManager.GetInstance().Send((int)GameMessageDefine.AnimalBuffAlterSucceed); }
public Vector3 GetPos(int littleZooID) { int maplittleZooID = LittleZooModule.MapToFirstSceneLittleZooID(littleZooID); Vector3 pos = Vector3.zero; posMap.TryGetValue(maplittleZooID, out pos); return(pos); }
public LittleZooBuildinPos GetLittleZooBuildinPos(int littleZooID) { int maplittleZooID = LittleZooModule.MapToFirstSceneLittleZooID(littleZooID); LittleZooBuildinPos littleZooBuildinPos = null; littleZooBuildinPosMap.TryGetValue(maplittleZooID, out littleZooBuildinPos); return(littleZooBuildinPos); }
/// <summary> /// 获取观光位CD对象 /// </summary> private void GetSceneUIGameObject() { var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; int littleZooID = entity.stayBuildingID; //动物栏的ID int index = entity.indexInVisitQueue; //观光位置 Vector3 pathPos = entity.followPath.pathPosList[entity.followPath.nextPosIdx]; visitCDGameObject = LittleZooModule.GetVisitCDGameObject(littleZooID, pathPos, index); image_VisitCD = visitCDGameObject.transform.Find("Text_UI").Find("Image_Skill").GetComponent <Image>(); }
/// <summary> /// 获取观光位飘字对象 /// </summary> private void GetFlutterTextGameObject() { var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; int littleZooID = entity.stayBuildingID; //动物栏的ID int index = entity.indexInVisitQueue; //观光位置 Vector3 pathPos = entity.followPath.pathPosList[entity.followPath.nextPosIdx]; //观光位飘字 LittleZooModule.GetFlutterTextGameObject(littleZooID, pathPos, index); //动物栏飘钱 PlayLittleZooSimpleParticle(); }
/// <summary> /// Buff加成 /// </summary> /// <returns></returns> public static float PlayerRatioCoinInComeAll(int sceneID, bool isNeedMulBuff) { /* Y=(1+动物加成)*(1+停车场利润加成)*(1+广告BUFF+月卡BUFF+道具BUFF) */ var animalBuff = 1 + LittleZooModule.GetAllAnimalsBuff(); int level = GlobalDataManager.GetInstance().playerData.GetParkingCenterDataIDIndexOfDataIdx(sceneID).parkingProfitLevel; var parkingProfit = 1 + ParkingCenter.GetParkingProfit(level) / 100f; var timeBuff = PlayerRatioCoinInComeMul(); if (!isNeedMulBuff) { // 不需要时间段buff加成 Y=(1+动物加成)*(1+停车场利润加成) return(animalBuff * parkingProfit); } else { // Y=(1+动物加成)*(1+停车场利润加成)*(1+广告BUFF+月卡BUFF+道具BUFF) return(animalBuff * parkingProfit * timeBuff); } }
public static string GetPath(int startID, int endID) { string path = null; int mapstartID = LittleZooModule.MapToFirstSceneLittleZooID(startID); int mapEndID = LittleZooModule.MapToFirstSceneLittleZooID(endID); foreach (var kv in Config.pathConfig.getInstace().AllData) { var cell = kv.Value; if (cell.startid == mapstartID && cell.endid == mapEndID) { path = cell.path; break; } } return(path); }
//protected void AddCoin(BigInteger addNum) //{ // BigInteger currCoin = BigInteger.Parse(this.playerData.playerZoo.coin); // currCoin += addNum; // this.playerData.playerZoo.coin = currCoin.ToString(); // BroadcastValueOfPlayerData.Send((int)GameMessageDefine.BroadcastCoinOfPlayerData, // 0, 0, currCoin, addNum); //} /// <summary> /// 动物栏CD收益 /// </summary> /// <param name="msg"></param> protected void OnVisitorVisitCDFinshedReply(Message msg) { #if NO_BIGINT PlaySceneMoneyMusic(); #else //只有最新解锁的场景动物栏和大门产钱 if (playerData.playerZoo.currSceneID != playerData.playerZoo.lastUnLockSceneID) { return; } var _msg = msg as VisitorVisitCDFinshedReply; int littleZooEnterVisitorSpawnLevel = GlobalDataManager.GetInstance().playerData.GetLittleZooModuleData(_msg.littleZooID).littleZooTicketsLevel; BigInteger price = LittleZooModule.GetLittleZooPrice(_msg.littleZooID, littleZooEnterVisitorSpawnLevel); PlaySceneMoneyMusic(); playerData.playerZoo.playerCoin.WarpAddCoin(playerData, price, false); #endif }
/// <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> protected void LoadPartSceneForEditor() { LogWarp.LogFormat("LoadPartSceneForEditor"); int sceneID = LoadingMgr.Inst.editor_SceneID; //加载地块 var littleZooRoot = GameObject.Find("LittleZoo").transform; Config.resourceCell cellRes; int idx = 0; float offset = Config.globalConfig.getInstace().ZooPartResLen; float extendOffset = 0; Config.groupCell preCell = null; Config.groupCell lastCell = null; foreach (var kv in Config.groupConfig.getInstace().AllData) { if (kv.Value.scene != sceneID) { continue; } var cellGroup = kv.Value; //加载动物栏 for (int i = 0; i < cellGroup.startid.Length; i++) { //编辑器加载的都是0级的动物栏prefab LittleZooModule.LoadLittleZoo(sceneID, cellGroup.startid[i], 0, littleZooRoot); } //加载地块 if (cellGroup.zoopartresID > 0) { cellRes = Config.resourceConfig.getInstace().getCell(cellGroup.zoopartresID); var goPart = ResourceManager.GetInstance().LoadGameObject(cellRes.prefabpath); //goPart.transform.position = new Vector3(goPart.transform.position.x - idx * offset, 0, 0); if (preCell != null) { extendOffset += preCell.groundsize; } //goPart.transform.position = new Vector3(goPart.transform.position.x - extendOffset, 0, 0); goPart.transform.position += GlobalDataManager.GetInstance().SceneForward *extendOffset; goPart.name = string.Format("Group_{0}", cellGroup.zoopartresID); ++idx; preCell = cellGroup; lastCell = cellGroup; if (LoadingMgr.Inst.ExtendLoadGroupNum != Const.Invalid_Int && LoadingMgr.Inst.ExtendLoadGroupNum == idx) { break; } } } if (lastCell != null) { extendOffset += lastCell.groundsize; } LittleZooModule.LoadExitGate(sceneID, idx, extendOffset); }
/// <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> protected void LoadLittleZoo() { var loadGroup = GlobalDataManager.GetInstance().zooGameSceneData.loadGroup; GameObject camera = GameObject.Find("Camera"); GlobalDataManager.GetInstance().zooGameSceneData.camera = camera; var littleZooRoot = GameObject.Find("LittleZoo").transform; GlobalDataManager.GetInstance().zooGameSceneData.littleZooParentNode = littleZooRoot; int littleZooID = Const.Invalid_Int; int groupID = Const.Invalid_Int; bool retCode = this.playerData.playerZoo.IsExistlittleZooModuleDatas(sceneID); if (!retCode) { this.playerData.playerZoo.SetDefaultlittleZooData(sceneID); } //var littleZooModuleDatas = this.GetlittleZooModuleDatas(sceneID); var littleZooModuleDatas = this.playerData.playerZoo.littleZooModuleDatasMSS; //for (int i = 0; i < this.playerData.playerZoo.littleZooModuleDatas.Count; i++) for (int i = 0; i < littleZooModuleDatas.Count; i++) { var littleZooModuleData = this.playerData.playerZoo.littleZooModuleDatasMSS[i]; if (littleZooModuleData.sceneID != sceneID) { continue; } littleZooID = littleZooModuleData.littleZooID; groupID = GlobalDataManager.GetInstance().logicTableGroup.FindGroupID(littleZooID); if (!loadGroup.Contains(groupID)) { loadGroup.Add(groupID); LogWarp.LogFormat("loadGroup {0}", groupID); } //加载动物栏 int level = littleZooModuleData.littleZooTicketsLevel; var cellBuild = Config.buildupConfig.getInstace().getCell(littleZooID); int buildResIdx = LittleZooModule.FindLevelRangIndex(cellBuild.lvmodel, level); LittleZooModule.LoadLittleZoo(sceneID, littleZooID, buildResIdx, littleZooRoot, false); } loadGroup.Sort(); Config.resourceCell cellRes; int idx = 0; float offset = Config.globalConfig.getInstace().ZooPartResLen; float extendOffset = 0; Config.groupCell preCell = null; Config.groupCell lastCell = null; for (int i = 0; i < loadGroup.Count; i++) { var cellGroup = Config.groupConfig.getInstace().getCell(loadGroup[i]); //加载Group if (cellGroup.zoopartresID > 0 && i >= (Config.globalConfig.getInstace().DefaultOpenGroup)) { cellRes = Config.resourceConfig.getInstace().getCell(cellGroup.zoopartresID); var goPart = ResourceManager.GetInstance().LoadGameObject(cellRes.prefabpath); if (preCell != null) { extendOffset += preCell.groundsize; } goPart.transform.position = new Vector3(goPart.transform.position.x - extendOffset, 0, 0); goPart.name = string.Format("Group_{0}", cellGroup.zoopartresID); ++idx; preCell = cellGroup; lastCell = cellGroup; GlobalDataManager.GetInstance().zooGameSceneData.AddExtendLoadGroup(loadGroup[i], goPart); } } if (lastCell != null) { extendOffset += lastCell.groundsize; } LittleZooModule.LoadExitGate(sceneID, idx, extendOffset); }
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> /// 动物栏的门票升级消息修改 /// </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); } }