Example #1
0
 /// <summary>
 /// 刷新主界面的数据
 /// </summary>
 /// <param name="arg1"></param>
 /// <param name="arg2"></param>
 private void RefreshUIShowData(int arg1, IntCD arg2)
 {
     incomeCoinMS      = PlayerDataModule.CurrScenePerMinCoin(true);
     earningsText.text = MinerBigInt.ToDisplay(incomeCoinMS) + GetL10NString("Ui_Text_67");
     arg2.Reset();
     arg2.Run();
 }
Example #2
0
        protected void Callback_SpawnCar(IntCD CD, IVoidParam spawnCarParam)
        {
            SpawnCarParam _spawnCarParam = spawnCarParam as SpawnCarParam;
            var           car            = EntityManager.GetInstance().GenEntityGameObject(1, EntityFuncType.CrossRoadCar) as EntityCrossRoadCar;

            //var car = EntityManager.GetInstance().GetRandomEntity(ResType.Car, EntityFuncType.CrossRoadCar) as EntityCrossRoadCar;

            car.Init(_spawnCarParam.startPos, _spawnCarParam.endPos, _spawnCarParam.speed);
            //重要:Entity取出后先设置位置,再把Collider设置成true,防止在未设置位置时触发碰撞
            car.position = _spawnCarParam.startPos;
            try
            {
                car.GetTrans().Find("Collider").gameObject.SetActive(true);
            }
            catch (System.Exception e)
            {
#if UNITY_EDITOR
                throw new System.Exception(string.Format("汽车 {0} 取Collider 失败", car.mainGameObject.name));
#endif
            }


            car.LookAt(_spawnCarParam.endPos);
            car.Active();

            CrossRoadModelManager.GetInstance().entityModel.AddToEntityMovables(car);
            if (CD != null)
            {
                CD.Reset();
                CD.Run();
            }
        }
        protected void OnLittleZooDataReply(Message msg)
        {
            var _msg   = msg as LittleZooDataReply;
            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            //LogWarp.LogErrorFormat("{0}, {1}", _msg != null, entity != null);
            if (_msg.entityID != entity.entityID)
            {
                return;
            }

            int cdVal      = _msg.littleZoo.visitCDValue;
            var playerData = GlobalDataManager.GetInstance().playerData;

            if (playerData.playerZoo.buffVisitCDVal != UFrame.Const.Invalid_Float)
            {
                int buffVisitCDVal = Math_F.FloatToInt1000(playerData.playerZoo.buffVisitCDVal);
                cdVal = Mathf.Min(cdVal, buffVisitCDVal);
            }

            if (visitCD == null)
            {
                visitCD = new IntCD(cdVal);
            }
            else
            {
                visitCD.ResetOrg(cdVal);
            }
            if (!GlobalDataManager.GetInstance().playerData.playerZoo.isGuide)
            {
                GetSceneUIGameObject();
            }

            visitCD.Run();
            isRevCDVal = true;

            //cd时间太短就执行idle
            if (cdVal < Math_F.FloatToInt1000(Config.globalConfig.getInstace().VisitorMinAnimLen))
            {
                entity.PlayActionAnim(Config.globalConfig.getInstace().VisitorIdle);
                return;
            }
            var cell = entity.PlayActionAnim();

            if (cell.effectresid > 0)
            {
                effID = cell.effectresid;
                var pool = PoolManager.GetInstance().GetGameObjectPool(effID);
                effGo    = pool.New();
                effTrans = effGo.transform;
                effTrans.SetParent(GlobalDataManager.GetInstance().zooGameSceneData.littleZooParentNode, false);
                effPos            = entity.position;
                effPos.y          = cell.effectY;
                effTrans.position = effPos;
                effTrans.rotation = entity.rotation;
            }
        }
        protected virtual void Follow(int deltaTimeMS)
        {
            //是否到后点
            //到达后点, 开始启动旋转,位移转按角速度求出的位置
            //未到达后点往后点继续前进
            if (turnCD.IsRunning() || !turnCD.IsFinish())
            {
                return;
            }

            //还没到最后一个转弯点
#if UNITY_EDITOR
            if (ctrList == null)
            {
                string e = string.Format("{0} 路径异常", this.ownerEntity.entityID);
                throw new System.Exception(e);
            }
#endif
            if (idxCtr < ctrList.Count)
            {
                var ctr = ctrList[idxCtr];
                if (!IsArrivedTarget(ctr.backPos))
                {
                    UnArrived(deltaTimeMS, ctr.backPos);
                    return;
                }

                //重新设置旋转CD
                turnCD.ResetOrg(turnCDVal);
                turnCD.Run();
                return;
            }

            //到这里已经转过最后一个弯了
            var lastPos = pathPosList[pathPosList.Count - 1];
            if (!IsArrivedTarget(lastPos))
            {
                UnArrived(deltaTimeMS, lastPos);
                return;
            }

            //走到这里已经到达路径最后一个点,走完全部path
            WhenArrivedEndPos();

            this.isArrivedEnd = true;
        }
Example #5
0
        protected void OnGetEntryGateDataReply(Message msg)
        {
            var _msg   = msg as GetEntryGateDataReply;
            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            //LogWarp.LogErrorFormat("{0}, {1}", _msg != null, entity != null);
            if (_msg.entityID != entity.entityID)
            {
                return;
            }

            int cdVal = _msg.entryGate.checkInCDVal;

#if UNITY_EDITOR
            if (cdVal <= 0)
            {
                string e = string.Format("cdVal = {0}", cdVal);
                throw new System.Exception(e);
            }
#endif
            var playerData = GlobalDataManager.GetInstance().playerData;
            if (playerData.playerZoo.buffEntryGateCDVal != UFrame.Const.Invalid_Float)
            {
                int buffCD = Math_F.FloatToInt1000(playerData.playerZoo.buffEntryGateCDVal);
                cdVal = Mathf.Min(cdVal, buffCD);
            }

            if (checkInCD == null)
            {
                checkInCD = new IntCD(cdVal);
            }
            else
            {
                checkInCD.ResetOrg(cdVal);
            }

            if (!GlobalDataManager.GetInstance().playerData.playerZoo.isGuide)
            {
                GetSceneUIGameObject();
            }

            checkInCD.Run();

            isRecvCDVal = true;
        }
Example #6
0
        void OnDrag_NormalPlus(DragGesture gesture)
        {
            if (gesture.State == GestureRecognitionState.InProgress && CouldDrag())
            {
                //LogWarp.LogErrorFormat("{0} OnDrag_NormalPlus", Time.realtimeSinceStartup);
                //MessageString.Send((int)UFrameBuildinMessage.CameraDebug, Time.realtimeSinceStartup + " OnDrag_NormalPlus");
                if (gesture.DeltaMove.SqrMagnitude() > 0)
                {
                    Vector2 screenSpaceMove = dragSensitivity * gesture.DeltaMove;
                    Vector3 worldSpaceMove  = screenSpaceMove.x * cacheTrans.right + screenSpaceMove.y * cacheTrans.up;

                    dragMoveTo.x -= worldSpaceMove.x;
                    dragMoveTo.z -= worldSpaceMove.z;

                    dragSmoothDir.x = -worldSpaceMove.x;
                    dragSmoothDir.y = -worldSpaceMove.z;

                    dragMoveTo2D.x = dragMoveTo.x;
                    dragMoveTo2D.y = dragMoveTo.z;
                    if (CouldMoveTo(dragMoveTo2D))
                    {
                        cacheTrans.position = dragMoveTo;
#if UNITY_EDITOR
                        moveToPoint.position = dragMoveTo;
                        //LogWarp.LogErrorFormat("{0} CouldMoveTo moveToPoint {1}", Time.realtimeSinceStartup, dragMoveTo);
#endif
                    }
                    else
                    {
                        WhenCannotMoveTo(dragMoveTo2D);
                    }

                    DragSmoothCD.Stop();
                }
            }
            else if (gesture.State == GestureRecognitionState.Started && CouldDrag())
            {
                DragSmoothCD.Stop();
            }
            else if (gesture.State == GestureRecognitionState.Ended && CouldDrag())
            {
                DragSmoothCD.ResetOrg(dragSmoothDurationMS);
                DragSmoothCD.Run();
            }
        }
        protected void RunCheckInCD()
        {
            int cdVal      = ExitGateModule.GetChinkinCDValMs();
            var playerData = GlobalDataManager.GetInstance().playerData;

            if (playerData.playerZoo.buffExitEntryCDVal != UFrame.Const.Invalid_Float)
            {
                int buffExitEntryCDValMS = Math_F.FloatToInt1000(playerData.playerZoo.buffExitEntryCDVal);
                cdVal = Mathf.Min(cdVal, buffExitEntryCDValMS);
            }
            checkInCD.ResetOrg(cdVal);
            checkInCD.Run();
#if UNITY_EDITOR
            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;
            LogWarp.LogFormat("{0} RunCheckInCD cdVal={1}", entity.entityID, cdVal);
            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} RunCheckInCD cdVal={1}", entity.entityID, cdVal);
#endif
        }
Example #8
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();
        }
 private void Test02(int arg1, IntCD arg2)
 {
     LogWarp.LogErrorFormat("BBBBBBBBBBBBBBBBB   {0}    {1}", arg1, arg2.org);
     arg2.Reset();
     arg2.Run();
 }
 protected void InitLeaveSceneCD()
 {
     levelSceneCDVal = Config.globalConfig.getInstace().LeaveSceneCoinCD * 1000;
     leaveSceneCD    = new IntCD(levelSceneCDVal);
     leaveSceneCD.Run();
 }
 protected void InitCD()
 {
     CDVal = Config.globalConfig.getInstace().LeaveSceneCoinCD * 1000;
     CD    = new IntCD(CDVal);
     CD.Run();
 }