/// <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);
        }
        /// <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);
            }
        }
Ejemplo n.º 3
0
        private void ReceiveRewardForTask(int taskId)
        {
            missionModel.SetTaskCleared(taskId);
            ItemType itemType;

            System.Numerics.BigInteger itemQuantity;
            missionModel.GetTaskReward(taskId, out itemType, out itemQuantity);
            SetTaskStateVars();
            MessageInt.Send((int)GameMessageDefine.GetItem, int.Parse(missionModel.GetTaskCell(taskId).reward));
        }
Ejemplo n.º 4
0
        public override void Enter(int preStateName)
        {
            base.Enter(preStateName);

            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} StateVisitorLeaveZooEntryQueueFull.Enter", entity.entityID);
            DebugFile.GetInstance().MarkGameObject(entity.mainGameObject, "visitor_{0}_{1}_{2}", entity.entityID, (VisitorState)this.preStateName, (VisitorState)this.stateName);
            entity.moveSpeed = Config.globalConfig.getInstace().ZooVisitorBackSpeed;
            MessageManager.GetInstance().Regist((int)UFrameBuildinMessage.Arrived, this.OnArrived);
            MessageManager.GetInstance().Regist((int)GameMessageDefine.VisitorWhereLeaveFromReply, this.OnVisitorWhereLeaveFromReply);

            //走回去的路,广告游客(ship)没有停车场逻辑,地下游客走地下, 地上游客走申请
            EntityFuncType entityFuncType = (EntityFuncType)(entity.entityFuncType);

            switch (entityFuncType)
            {
            case EntityFuncType.Visitor_From_Ship:
                EntityVisitor.GodownPath(entity, PathManager.GetInstance().GetPath(
                                             Config.globalConfig.getInstace().AdvertVisitorOut));
                break;

            case EntityFuncType.Visitor_From_Car:
                //这里没有走申请,得发个消息,让底下停车场数量-1
                MessageInt.Send((int)GameMessageDefine.DirectMinusOneUnderParkingNum, entity.entityID);
                EntityVisitor.GodownReversePath(entity, Config.globalConfig.getInstace().EntryQueueObservePath);
                break;

            case EntityFuncType.Visitor_From_GroundParking:
                VisitorWhereLeaveFromApply.Send(entity.entityID);
                break;

            default:
                string e = string.Format("没有这种游客类型{0}", entityFuncType);
                throw new System.Exception(e);
            }

            //生成愤怒表情
            var pool = PoolManager.GetInstance().GetGameObjectPool(9301);

            expGo             = pool.New();
            expTrans          = expGo.transform;
            expTrans.position = entity.position;
            ExpressionScaleAnim(expTrans, Config.globalConfig.getInstace().ExpressionScaleOrg,
                                Config.globalConfig.getInstace().ExpressionScaleMax,
                                Config.globalConfig.getInstace().ExpressionScaleDuration,
                                Config.globalConfig.getInstace().ExpressionDuration);
        }
Ejemplo n.º 5
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>
        /// 修改玩家动物为可升级状态
        /// </summary>
        /// <param name="id"></param>
        public void SetPlayerAnimalDataAlreadyOpen(int id, int entityID = 0)
        {
            var LittleAnimal = getPlayerAnimalCell(id);

            if (LittleAnimal.animalLevel > 0)
            {
                return;
            }
            else
            {   //新开启的动物显示在动物栏
                LittleAnimal.animalLevel    = 1;
                LittleAnimal.animalState    = AnimalState.AlreadyOpen;
                LittleAnimal.animalEntityID = entityID;
                playerAnimalsNumber        += 1;
                playerAllAnimalsLevel      += 1;
            }
            MessageInt.Send((int)GameMessageDefine.SetAnimalAtlasDataMessage, id);
        }
 /// <summary>
 /// 测试Item的消息机制
 /// </summary>
 private void OnTestAddItem()
 {
     MessageInt.Send((int)GameMessageDefine.GetItem, 4);
 }
        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);
            }
        }