コード例 #1
0
        public static void ModifyLittleZooMap(int littleZooID, Dictionary <int, LittleZoo> littleZooMap)
        {
            LittleZoo littleZoo            = null;
            var       buildinPos           = LittleZooBuildinPosManager.GetInstance().GetLittleZooBuildinPos(littleZooID);
            var       littleZooModuleDatas = GlobalDataManager.GetInstance().playerData.playerZoo.littleZooModuleDatasMSS;
            int       idx  = GlobalDataManager.GetInstance().playerData.GetLittleZooIDIndexOfDataIdx(littleZooID); //获取动物栏ID  下标
            var       cell = Config.buildupConfig.getInstace().getCell(littleZooID);
            //int visitNum = OpenVisitPosNUmber(littleZooModuleDatas[idx].littleZooVisitorSeatLevel);
            int visitNum      = OpenVisitPosNumber((int)littleZooModuleDatas[idx].littleZooID, (int)littleZooModuleDatas[idx].littleZooVisitorSeatLevel);
            int visitDuartion = (int)GetComeVisitorSpeedCD(littleZooID, littleZooModuleDatas[idx].littleZooEnterVisitorSpawnLevel);

            //LogWarp.LogErrorFormat("测试:   当前动物栏{0}的观光点数{1}",littleZooID,visitNum);

            if (!littleZooMap.TryGetValue(littleZooID, out littleZoo))
            {
                littleZoo = new LittleZoo(littleZooID, buildinPos, visitDuartion, visitNum, visitNum);
                littleZooMap.Add(littleZooID, littleZoo);

                return;
            }

            littleZoo.visitCDValue = visitDuartion;

            if (visitNum > littleZoo.maxLenthOfVisitQueue)
            {
                int extendLen = visitNum - littleZoo.maxLenthOfVisitQueue;
                for (int i = 0; i < extendLen; i++)
                {
                    littleZoo.visitQueue.Add(Const.Invalid_Int);
                    littleZoo.waitQueue.Add(Const.Invalid_Int);
                }
                littleZoo.maxLenthOfVisitQueue = visitNum;
                littleZoo.maxLenthOfWaitQueue  = visitNum;
            }
        }
コード例 #2
0
        /// <summary>
        /// 获取对应动物栏ID对应的的观光位下的UI显示对象
        /// </summary>
        /// <param name="littleZooID">动物栏ID</param>
        /// <param name="idx">观光位下标</param>
        /// <param name="ID">类型</param>
        /// <returns></returns>
        public GameObject GetLittleZooVisitSeatGameObject(int littleZooID, int idx, int ID)
        {
            GameObject visitSeatGB    = null;
            GameObject sceneFlutterGB = null;

            //判断是否有littleZooID的key值,没有则添加
            if (!zooSceneUIDic.ContainsKey(littleZooID))
            {
                Dictionary <int, SceneUIArray> dic = new Dictionary <int, SceneUIArray>();
                zooSceneUIDic.Add(littleZooID, dic);
            }
            Dictionary <int, SceneUIArray> dic2 = zooSceneUIDic[littleZooID];

            //判断是否有idx的key值,没有则添加
            if (!dic2.ContainsKey(idx))
            {
                //生成对应的字典和GameObject
                string  visitSeatPath        = Config.globalConfig.getInstace().VisitSeatCDGameObject;
                string  sceneFlutterTextPath = Config.globalConfig.getInstace().SceneFlutterTextGameObject;
                var     buildinPos           = LittleZooBuildinPosManager.GetInstance().GetLittleZooBuildinPos(littleZooID);
                Vector3 vector = buildinPos.visitPosList[idx];


                if (littleZooMountPoint == null)
                {
                    littleZooMountPoint = GameObject.Find(Config.globalConfig.getInstace().BuildVisitEffect);
                    //LogWarp.LogError("测试:只获取一次 littleZooMountPoint 对象");
                }
                visitSeatGB = SetLoadGameObject(vector, idx, visitSeatPath, littleZooMountPoint.transform);
                float scale = Config.globalConfig.getInstace().CdTimeZoom;
                visitSeatGB.transform.localScale = new Vector3(scale, scale, scale);

                sceneFlutterGB = SetLoadGameObject(vector, idx, sceneFlutterTextPath, littleZooMountPoint.transform);
                SceneUIArray littleUIArray = new SceneUIArray()
                {
                    VisitSeatGB    = visitSeatGB,
                    SceneFlutterGB = sceneFlutterGB
                };
                zooSceneUIDic[littleZooID][idx] = littleUIArray;
            }

            switch (ID)
            {
            case 0:
                return(zooSceneUIDic[littleZooID][idx].VisitSeatGB);

            case 1:
                return(zooSceneUIDic[littleZooID][idx].SceneFlutterGB);

            default:
                LogWarp.LogError("场景观光位UI:获取类型不对 = " + ID);
                return(null);
            }
        }
コード例 #3
0
        protected void GotoVisitSeat(EntityVisitor entity, int littleZooID, int indexInVisitQueue)
        {
            LogWarp.Log("GotoVisitSeat");
            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} Play {1}", entity.entityID, Config.globalConfig.getInstace().VisitorWalk);
            entity.PlayActionAnim(Config.globalConfig.getInstace().VisitorWalk);
            var littleZooBuildinPos = LittleZooBuildinPosManager.GetInstance().GetLittleZooBuildinPos(littleZooID);
            var endPos = littleZooBuildinPos.visitPosList[indexInVisitQueue];

            entity.pathList.Clear();
            entity.pathList.Add(entity.position);
            entity.pathList.Add(endPos);
            entity.followPath.Init(entity, entity.pathList, entity.position, 0, entity.moveSpeed, false);
            entity.followPath.Run();
        }
コード例 #4
0
        /// <summary>
        /// 加载动物
        /// </summary>
        /// <param name="littleZooID">加载动物栏ID</param>
        /// <param name="animalID">动物ID</param>
        /// <param name="animalWanderradius"></param>
        /// <param name="animalWanderoffset"></param>
        public static void LoadAnimal(int littleZooID, int animalID, float animalWanderradius, float[] animalWanderoffset, int senceID = -1)
        {
            var cellAnimalUp = Config.animalupConfig.getInstace().getCell(animalID);

            var entity = EntityManager.GetInstance().GenEntityGameObject(cellAnimalUp.resourceload, EntityFuncType.Animal_Wander) as EntityAnimalWander;

            entity.animalID = animalID;
            playerAnimalGoToResourceID.Add(animalID, entity.entityID);

            Vector3 offset = Vector3.zero;

            offset.x = animalWanderoffset[0];
            offset.y = animalWanderoffset[1];
            offset.z = animalWanderoffset[2];

            var littleZooBuildinPos = LittleZooBuildinPosManager.GetInstance().GetLittleZooBuildinPos(littleZooID);
            int idx       = FindArrayRangIndex(littleZooID, animalID);
            var animalPos = littleZooBuildinPos.animalPosList[idx];

            entity.position = animalPos;

            // PathWander
            if (entity.pathWander == null)
            {
                entity.pathWander = new UFrame.BehaviourFloat.PathWander();
            }
            entity.pathWander.Init(entity,
                                   PathManager.GetInstance().GetPath(cellAnimalUp.walkingpath),
                                   cellAnimalUp.animalwanderspeed);

            if (entity.anim == null)
            {
                entity.anim = new SimpleAnimation();
            }
            entity.anim.Init(entity.mainGameObject);

            entity.Active();
            EntityManager.GetInstance().AddToEntityMovables(entity);
        }
        /// <summary>
        /// 动物栏飘钱特效
        /// </summary>
        protected void PlayLittleZooSimpleParticle()
        {
#if NO_EFFECT
            return;
#endif
            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            var littleZooBuildinPos = LittleZooBuildinPosManager.GetInstance().GetLittleZooBuildinPos(entity.stayBuildingID);
            Dictionary <int, SimpleParticle> sps = null;
            var  visitSeatSpDict = GlobalDataManager.GetInstance().zooGameSceneData.visitSeatSpDict;
            bool retCode         = visitSeatSpDict.TryGetValue(entity.stayBuildingID, out sps);
            if (!retCode)
            {
                sps = new Dictionary <int, SimpleParticle>();
                visitSeatSpDict.Add(entity.stayBuildingID, sps);
            }

            SimpleParticle sp = null;
            retCode = sps.TryGetValue(entity.indexInVisitQueue, out sp);
            if (!retCode)
            {
                sp = new SimpleParticle();
                sps.Add(entity.indexInVisitQueue, sp);
            }

            if (!sp.isInit)
            {
                Vector3 visitPos = littleZooBuildinPos.visitPosList[entity.indexInVisitQueue];
                visitPos.y = Config.globalConfig.getInstace().LittleZooCoinEffectOffsetY;
                //GameObject effectGo = ResourceManager.GetInstance().LoadGameObject(Config.globalConfig.getInstace().CoinEffectRes);
                var        sceneCell = Config.sceneConfig.getInstace().getCell(playerData.playerZoo.currSceneID);
                var        moneyCell = Config.moneyConfig.getInstace().getCell(sceneCell.moneyid);
                GameObject effectGo  = ResourceManager.GetInstance().LoadGameObject(moneyCell.moneyeffect);
                effectGo.transform.position = visitPos;
                sp.Init(effectGo);
            }
            sp.Play();
        }
        protected void OnVisitorGetVisitSeatReply(Message msg)
        {
            var _msg   = msg as VisitorGetVisitSeatReply;
            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            if (_msg.entityID != entity.entityID)
            {
                return;
            }

            if (!_msg.result)
            {
                isToStateChoseLittleZoo = true;
                return;
            }
            entity.indexInVisitQueue = _msg.idxOfQueue;
            entity.pathList.Clear();
            entity.pathList.Add(entity.position);
            var     buildinPos = LittleZooBuildinPosManager.GetInstance().GetLittleZooBuildinPos(entity.stayBuildingID);
            Vector3 visitPos   = buildinPos.visitPosList[_msg.idxOfQueue];

            entity.pathList.Add(visitPos);
            EntityVisitor.GodownPath(entity, entity.pathList, false);
        }