Beispiel #1
0
        /// <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="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);
            }
        }
Beispiel #3
0
        /// <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>
        /// 收到设置售票口的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>
        /// 动物栏的观光点数量消息修改
        /// </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>
        /// <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);
            }
        }