/// <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> /// 收到设置售票口的门票等级升级的消息 /// </summary> /// <param name="msg"></param> protected void OnSetEntryGateLevelOfPlayerData(Message msg) { var _msg = msg as SetDetailValueOfPlayerData; int entryTicketsLevel = GlobalDataManager.GetInstance().playerData.GetEntryDateDataIDIndexOfDataIdx().entryTicketsLevel; if ((entryTicketsLevel + _msg.detailVal) > ticketCell.lvmax) { return; } // 涉及金币减扣 BigInteger bigDelta = EntryGateModule.GetUpGradeConsumption(entryTicketsLevel, _msg.detailVal); //bool retCode = VaryDataCoin(bigDelta); //if (!retCode) //{ // //string e = string.Format("售票口门票升级扣钱失败"); // //throw new System.Exception(e); // return; //} //BroadcastValueOfPlayerData.Send((int)GameMessageDefine.BroadcastCoinOfPlayerData, // 0, 0, BigInteger.Parse(GlobalDataManager.GetInstance().playerData.playerZoo.coin), bigDelta); if (!playerData.playerZoo.playerCoin.WarpAddCoin(playerData, -bigDelta)) { return; } this.playerData.GetEntryDateDataIDIndexOfDataIdx().entryTicketsLevel += _msg.detailVal; BroadcastValueOfPlayerData.Send((int)GameMessageDefine.BroadcastEntryGateLevelOfPlayerData, this.playerData.GetEntryDateDataIDIndexOfDataIdx().entryTicketsLevel, _msg.deltaVal, 0, 0); BuildingLevelup.Send((int)BuildingTypeFM.EntryGate, -1, (int)EntryGateProperty.TicketPrice, this.playerData.GetEntryDateDataIDIndexOfDataIdx().entryTicketsLevel); //收集星星: var sortEntryGateIDs = GlobalDataManager.GetInstance().logicTableEntryGate.GetSortGateIDs(currSceneID); var lvshage = Config.ticketConfig.getInstace().getCell(sortEntryGateIDs[0]).lvshage; int idx = FindLevelRangIndex01(lvshage, this.playerData.GetEntryDateDataIDIndexOfDataIdx().entryTicketsLevel); int stageLevel = Config.ticketConfig.getInstace().getCell(sortEntryGateIDs[0]).lvshage[idx]; if (this.playerData.GetEntryDateDataIDIndexOfDataIdx().entryTicketsLevel == stageLevel) { int awardType = Config.ticketConfig.getInstace().getCell(sortEntryGateIDs[0]).lvrewardtype[idx]; int awardID = Config.ticketConfig.getInstace().getCell(sortEntryGateIDs[0]).lvreward[idx]; 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); } //发放星星 MessageInt.Send((int)GameMessageDefine.GetItem, 4); //LogWarp.LogErrorFormat("售票口 当前等级为{0},可以发放星星", stageLevel); } }
/// <summary> /// 获取售票口CD对象 /// </summary> private void GetSceneUIGameObject() { var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; int index = EntryGateModule.GetPresentSceneTicketCell(entity.zooEntryID);//观光位置 visitCDGameObject = EntryGateModule.GetVisitCDGameObject(index); image_VisitCD = visitCDGameObject.transform.Find("Text_UI").Find("Image_Skill").GetComponent <Image>(); image_VisitCD.fillAmount = 0f; }
/// <summary> /// 获取售票口飘字对象 /// </summary> private void GetFlutterTextGameObject() { var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity; int index = EntryGateModule.GetPresentSceneTicketCell(entity.zooEntryID);//观光位置 image_VisitCD.fillAmount = 0f; //节点下的飘钱对象 EntryGateModule.GetFlutterTextGameObject(index); //金钱粒子特效 PlayEntrySimpleParticle(index); }
/// <summary> /// 当前每分钟产出 /// 所有动物栏收益+售票口票价*min(停车场来人速度,售票口收费速度(全)) /// </summary> /// <returns></returns> public static System.Numerics.BigInteger CurrScenePerMinCoin(bool isNeedMulBuff = false) { //所有动物栏收益 var allZooPrice = GetAllZooPrice(isNeedMulBuff); //每分钟售票口基础收益=售票口票价*min(停车场来人速度,售票口收费速度(全)) //售票口票价: int sceneID = GlobalDataManager.GetInstance().playerData.playerZoo.currSceneID; var entryPrice = EntryGateModule.GetEntryPrice(GlobalDataManager.GetInstance().playerData.GetEntryDateDataIDIndexOfDataIdx().entryTicketsLevel, sceneID, isNeedMulBuff); //min(停车场来人速度,售票口收费速度(全)) var number = Mathf.Min(ParkingCenter.GetParkingEnterCarSpawn(), EntryGateModule.GetAllEntryChargeValMs()); //所有动物栏收益+售票口票价*min(停车场来人速度,售票口收费速度(全)) System.Numerics.BigInteger coin = allZooPrice + (entryPrice * (int)(number * 100)) / 100; //Logger.LogWarp.LogErrorFormat("测试:当前场景 每分钟 收益 allZooPrice={0}, entryPrice={1}, number={2}", allZooPrice ,entryPrice ,number ); return(coin); }
/// <summary> /// 售票口CD /// </summary> /// <param name="msg"></param> protected void OnEntryGateCheckGoToZoo(Message msg) { #if NO_BIGINT PlaySceneMoneyMusic(); #else //只有最新解锁的场景动物栏和大门产钱 if (playerData.playerZoo.currSceneID != playerData.playerZoo.lastUnLockSceneID) { return; } var sceneID = playerData.playerZoo.currSceneID; var price = EntryGateModule.GetEntryPrice(GlobalDataManager.GetInstance().playerData.GetEntryDateDataIDIndexOfDataIdx().entryTicketsLevel, sceneID, true); PlaySceneMoneyMusic(); playerData.playerZoo.playerCoin.WarpAddCoin(playerData, price, false); #endif }
/// <summary> /// 收到设置售票口的ID对应等级升级的消息 /// </summary> /// <param name="msg"></param> protected void OnSetEntryGatePureLevelOfPlayerData(Message msg) { var _msg = msg as SetDetailValueOfPlayerData; //var sortGateIDs = GlobalDataManager.GetInstance().playerData.playerZoo.GetSortTicketConfigGateIDs(); //int sceneID = GlobalDataManager.GetInstance().playerData.playerZoo.currSceneID; int entryID = sortGateIDs[_msg.detailVal]; var entryGate = GlobalDataManager.GetInstance().playerData.GetEntryGateIDIndexOfDataIdx(entryID); if (entryGate.level >= ticketCell.speedmaxlv) { return; } //升级扣钱 BigInteger bigDelta = EntryGateModule.GetUpGradeCheckinSpeedConsumption(entryID, entryGate.level); //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 deltaLevel = _msg.deltaVal; entryGate.level += deltaLevel; ////广播金钱变化 //BroadcastValueOfPlayerData.Send((int)GameMessageDefine.BroadcastCoinOfPlayerData, //0, 0, BigInteger.Parse(GlobalDataManager.GetInstance().playerData.playerZoo.coin), bigDelta); //LogWarp.LogError("测试: 升级单售票口 "+ entryID); //广播某入口升级 SetDetailValueOfPlayerData.Send((int)GameMessageDefine.BroadcastEntryGatePureLevelOfPlayerData, entryID, deltaLevel, 0); BuildingLevelup.Send((int)BuildingTypeFM.EntryGate, entryID, (int)EntryGateProperty.Entrance, entryGate.level); }
/// <summary> /// 其他场景产出每分钟产 /// 所有动物栏收益+售票口票价*min(停车场来人速度,售票口收费速度(全)) /// </summary> /// <returns></returns> public static System.Numerics.BigInteger LeaveScenePerMinCoin(int sceneID, bool isNeedMulBuff = false) { System.Numerics.BigInteger coin = 0; var playerData = GlobalDataManager.GetInstance().playerData; var scenePlayerData = playerData.playerZoo.scenePlayerDataMSS; if (scenePlayerData == null) { return(coin); } var sceneStates = scenePlayerData.sceneStates; if (sceneStates == null) { return(coin); } for (int i = 0; i < sceneStates.Count; i++) { var sceneState = sceneStates[i]; if ((sceneState.enterCount > 0 || sceneState.sceneId == GameConst.First_SceneID) && sceneState.sceneId != playerData.playerZoo.currSceneID && sceneState.sceneId == sceneID) { //所有动物栏收益 var allZooPrice = GetOtherSceneAllZooPrice(sceneID, isNeedMulBuff); //每分钟售票口基础收益=售票口票价*min(停车场来人速度,售票口收费速度(全)) //售票口票价: var entryPrice = EntryGateModule.GetEntryPrice(GlobalDataManager.GetInstance().playerData.GetEntryDateDataIDIndexOfDataIdx(sceneID).entryTicketsLevel, sceneID, isNeedMulBuff); //min(停车场来人速度,售票口收费速度(全)) var number = Mathf.Min(ParkingCenter.GetOtherSceneParkingEnterCarSpawn(sceneID), EntryGateModule.GetAllEntryChargeValMs(sceneID)); //所有动物栏收益+售票口票价*min(停车场来人速度,售票口收费速度(全)) coin = allZooPrice + (entryPrice * (int)(number * 100)) / 100; //Logger.LogWarp.LogErrorFormat("测试:其他场景{0} 每分钟 收益 allZooPrice={1}, entryPrice={2}, number={3}", sceneID, allZooPrice, entryPrice, number); } } return(coin); }