/// <summary> /// 停车场的停车位数量升级 /// </summary> /// <param name="obj"></param> private void OnSetParkingSpaceLevelOfPlayerData(Message obj) { var _msg = obj as SetValueOfPlayerData; parkingCenterData = playerData.GetParkingCenterDataIDIndexOfDataIdx(); int parkingSpaceLevel = parkingCenterData.parkingSpaceLevel; if (parkingSpaceLevel >= parkingCell.touristmaxlv) { return; } BigInteger bigDelta = (ParkingCenter.GetUpGradeNumberConsumption(parkingSpaceLevel)); //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.GetParkingCenterDataIDIndexOfDataIdx(currSceneID).parkingSpaceLevel += 1; BroadcastValueOfPlayerData.Send((int)GameMessageDefine.BroadcastParkingSpaceLevelOfPlayerData, this.playerData.GetParkingCenterDataIDIndexOfDataIdx(currSceneID).parkingSpaceLevel, _msg.deltaVal, 0, 0); BuildingLevelup.Send((int)BuildingTypeFM.Parking, 999, (int)ParkingProperty.Capacity, this.playerData.GetParkingCenterDataIDIndexOfDataIdx(currSceneID).parkingSpaceLevel); }
/// <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); }
public void Init(int level) { int numSpace = ParkingCenter.GetGroundParkingNumber(level); int numGroup = numSpace / globalConfig.getInstace().NumGroundParkingGroupSpace; for (int i = 0; i < numGroup; i++) { var group = new GroupParkingSpace(i, globalConfig.getInstace().NumGroundParkingGroupSpace); groupParkingSpaceDic.Add(i, group); } }
/// <summary> /// 停车场的等级升级(利润) /// </summary> /// <param name="msg"></param> protected void OnSetParkingProfitLevelOfPlayerData(Message msg) { var _msg = msg as SetDetailValueOfPlayerData; parkingCenterData = playerData.GetParkingCenterDataIDIndexOfDataIdx(currSceneID); int parkingProfitLevel = parkingCenterData.parkingProfitLevel; if ((parkingProfitLevel + _msg.detailVal) > parkingCell.lvmax) { return; } BigInteger bigDelta = ParkingCenter.GetUpGradeParkingProfitConsumption(parkingProfitLevel, _msg.detailVal); if (!playerData.playerZoo.playerCoin.WarpAddCoin(playerData, -bigDelta)) { return; } int needLevel = parkingProfitLevel + _msg.detailVal; this.playerData.GetParkingCenterDataIDIndexOfDataIdx(currSceneID).parkingProfitLevel = needLevel; BroadcastValueOfPlayerData.Send((int)GameMessageDefine.BroadcastParkingProfitLevelOfPlayerData, this.playerData.GetParkingCenterDataIDIndexOfDataIdx(currSceneID).parkingProfitLevel, _msg.detailVal, 0, 0); BuildingLevelup.Send((int)BuildingTypeFM.Parking, 999, (int)ParkingProperty.Revenue, this.playerData.GetParkingCenterDataIDIndexOfDataIdx(currSceneID).parkingProfitLevel); //收集星星: var lvshage = parkingCell.lvshage; int idx = FindLevelRangIndex01(lvshage, this.playerData.GetParkingCenterDataIDIndexOfDataIdx(currSceneID).parkingProfitLevel); int stageLevel = parkingCell.lvshage[idx]; if (this.playerData.GetParkingCenterDataIDIndexOfDataIdx(currSceneID).parkingProfitLevel == stageLevel) { int awardType = parkingCell.lvrewardtype[idx]; int awardID = parkingCell.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(); } } //发放星星 MessageInt.Send((int)GameMessageDefine.GetItem, 4); } }
/// <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> /// 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); } }
/// <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); }
//protected List<LittleZooModuleData> GetlittleZooModuleDatas(int sceneID) //{ // var result = new List<LittleZooModuleData>(); // var littleZooModuleDatas = this.playerData.playerZoo.littleZooModuleDatas; // for (int i = 0; i < littleZooModuleDatas.Count; i++) // { // var littleZooModuleData = littleZooModuleDatas[i]; // if (littleZooModuleData.sceneID == sceneID) // { // result.Add(littleZooModuleData); // } // } // return result; //} /// <summary> /// 加载停车场地块 /// </summary> protected void LoadParking() { GlobalDataManager.GetInstance().zooGameSceneData.ParckingSencePos = GameObject.Find("ParckingSencePos"); var allData = Config.parkingConfig.getInstace().AllData; Config.parkingCell parkingCell = GlobalDataManager.GetInstance().logicTableParkingData.GetParkingCell(sceneID); //var cellBuildUp = Config.parkingConfig.getInstace().getCell(sceneID); bool retCode = this.playerData.playerZoo.IsExistPackingModuleDatas(sceneID); if (!retCode) { this.playerData.playerZoo.SetDefaultParkingCenterData(sceneID); } var parkingSpaceLevel = this.playerData.GetParkingCenterDataIDIndexOfDataIdx(sceneID).parkingSpaceLevel; int currResIdx = ParkingCenter.FindLevelRangIndex(parkingCell.openlv, parkingSpaceLevel); var cellRes = Config.resourceConfig.getInstace().getCell(parkingCell.openggroup[currResIdx]); var parkingModel = ResourceManager.GetInstance().LoadGameObject(cellRes.prefabpath); parkingModel.transform.position = new UnityEngine.Vector3(0, 0, 0); parkingModel.SetActive(true); parkingModel.transform.SetParent(GlobalDataManager.GetInstance().zooGameSceneData.ParckingSencePos.transform, false); }