예제 #1
0
        /// <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();
        }
        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);
        }