Example #1
0
        /// <summary>
        /// 加载动物栏
        /// </summary>
        protected void LoadLittleZoo()
        {
            var        loadGroup = GlobalDataManager.GetInstance().zooGameSceneData.loadGroup;
            GameObject camera    = GameObject.Find("Camera");

            GlobalDataManager.GetInstance().zooGameSceneData.camera = camera;
            var littleZooRoot = GameObject.Find("LittleZoo").transform;

            GlobalDataManager.GetInstance().zooGameSceneData.littleZooParentNode = littleZooRoot;
            int littleZooID = Const.Invalid_Int;
            int groupID     = Const.Invalid_Int;

            bool retCode = this.playerData.playerZoo.IsExistlittleZooModuleDatas(sceneID);

            if (!retCode)
            {
                this.playerData.playerZoo.SetDefaultlittleZooData(sceneID);
            }

            //var littleZooModuleDatas = this.GetlittleZooModuleDatas(sceneID);
            var littleZooModuleDatas = this.playerData.playerZoo.littleZooModuleDatasMSS;

            //for (int i = 0; i < this.playerData.playerZoo.littleZooModuleDatas.Count; i++)
            for (int i = 0; i < littleZooModuleDatas.Count; i++)
            {
                var littleZooModuleData = this.playerData.playerZoo.littleZooModuleDatasMSS[i];
                if (littleZooModuleData.sceneID != sceneID)
                {
                    continue;
                }
                littleZooID = littleZooModuleData.littleZooID;
                groupID     = GlobalDataManager.GetInstance().logicTableGroup.FindGroupID(littleZooID);
                if (!loadGroup.Contains(groupID))
                {
                    loadGroup.Add(groupID);
                    LogWarp.LogFormat("loadGroup {0}", groupID);
                }

                //加载动物栏
                int level       = littleZooModuleData.littleZooTicketsLevel;
                var cellBuild   = Config.buildupConfig.getInstace().getCell(littleZooID);
                int buildResIdx = LittleZooModule.FindLevelRangIndex(cellBuild.lvmodel, level);

                LittleZooModule.LoadLittleZoo(sceneID, littleZooID, buildResIdx, littleZooRoot, false);
            }
            loadGroup.Sort();


            Config.resourceCell cellRes;
            int   idx          = 0;
            float offset       = Config.globalConfig.getInstace().ZooPartResLen;
            float extendOffset = 0;

            Config.groupCell preCell  = null;
            Config.groupCell lastCell = null;
            for (int i = 0; i < loadGroup.Count; i++)
            {
                var cellGroup = Config.groupConfig.getInstace().getCell(loadGroup[i]);

                //加载Group
                if (cellGroup.zoopartresID > 0 && i >= (Config.globalConfig.getInstace().DefaultOpenGroup))
                {
                    cellRes = Config.resourceConfig.getInstace().getCell(cellGroup.zoopartresID);
                    var goPart = ResourceManager.GetInstance().LoadGameObject(cellRes.prefabpath);
                    if (preCell != null)
                    {
                        extendOffset += preCell.groundsize;
                    }
                    goPart.transform.position = new Vector3(goPart.transform.position.x - extendOffset, 0, 0);
                    goPart.name = string.Format("Group_{0}", cellGroup.zoopartresID);
                    ++idx;
                    preCell  = cellGroup;
                    lastCell = cellGroup;
                    GlobalDataManager.GetInstance().zooGameSceneData.AddExtendLoadGroup(loadGroup[i], goPart);
                }
            }
            if (lastCell != null)
            {
                extendOffset += lastCell.groundsize;
            }

            LittleZooModule.LoadExitGate(sceneID, idx, extendOffset);
        }