public override void Enter(int preStateName)
        {
            base.Enter(preStateName);

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

            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} StateVisitorGotoExitGateEntryQueue.Enter", entity.entityID);
            DebugFile.GetInstance().MarkGameObject(entity.mainGameObject, "visitor_{0}_{1}_{2}", entity.entityID, (VisitorState)this.preStateName, (VisitorState)this.stateName);

            MessageManager.GetInstance().Regist((int)UFrameBuildinMessage.Arrived,
                                                this.OnArrived);
            MessageManager.GetInstance().Regist((int)GameMessageDefine.BroadcastAfterExtendSceneAndModifiedPath,
                                                this.OnBroadcastAfterExtendSceneAndModifiedPath);
            MessageManager.GetInstance().Regist((int)GameMessageDefine.BroadcastForwardOneStepInExitGateQueue,
                                                this.OnBroadcastForwardOneStepInExitGateQueue);
            MessageManager.GetInstance().Regist((int)GameMessageDefine.SendExitGateCheckinCDFinishReply,
                                                this.OnSendExitGateCheckinCDFinishReply);

            finishQueueStep = 0;

            GoToOrgPosOfQueue(entity);
            if (checkInCD == null)
            {
                checkInCD = new IntCD(0);
            }
            checkInCD.Stop();
            LogWarp.LogFormat("{0} GoToOrgPosOfQueue step = {1}", entity.entityID, finishQueueStep);
            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} GoToOrgPosOfQueue step = {1}", entity.entityID, finishQueueStep);
        }
        public override void Enter(int preStateName)
        {
            base.Enter(preStateName);
            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} StateVisitorStayVisitSeat.Enter", entity.entityID);
            DebugFile.GetInstance().MarkGameObject(entity.mainGameObject, "visitor_{0}_{1}_{2}", entity.entityID, (VisitorState)this.preStateName, (VisitorState)this.stateName);

            isToVisitorStateChoseLittleZoo    = false;
            isToStateVisitorLeaveNonLittleZoo = false;
            shouldImmediateFinishVisitCD      = false;

            effID = Const.Invalid_Int;
            effGo = null;

            isRevCDVal = false;
            if (visitCD != null)
            {
                visitCD.Stop();
            }

            // LogWarp.LogFormat("-->Visitor enter tour state: littleZooId ={0}visitorId ={1}", entity.stayBuildingID, entity.entityID);
            // 观光游客面朝动物栏中心
            entity.LookAt(LittleZooPosManager.GetInstance().GetPos(entity.stayBuildingID));

            MessageManager.GetInstance().Regist((int)GameMessageDefine.LittleZooDataReply, OnLittleZooDataReply);
            MessageManager.GetInstance().Regist((int)GameMessageDefine.VisitorVisitCDFinshedReply, OnVisitorVisitCDFinshedReply);
            MessageManager.GetInstance().Regist((int)GameMessageDefine.ImmediateFinishVisitCD, OnImmediateFinishVisitCD);

            //模型到达动物栏等待位   调用新手引导的内容  显示步骤16
            if (GlobalDataManager.GetInstance().playerData.playerZoo.isGuide == true)
            {
                UIGuidePage uIGuidePage = PageMgr.GetPage <UIGuidePage>();
                if (uIGuidePage == null)
                {
                    string e = string.Format("新手引导界面  PageMgr.allPages里 UIGuidePage   为空");
                    throw new System.Exception(e);
                }
                //LogWarp.LogError("测试:     uIGuidePage.procedure=      " + uIGuidePage.procedure);
                if (uIGuidePage.newBieGuild_step == NewBieGuild.Step_16)
                {
                    uIGuidePage.TAEvent_finish();
                    uIGuidePage.newBieGuild_step = NewBieGuild.Step_17;
                    uIGuidePage.TAEvent_start();                     //本阶段显示文本
                    uIGuidePage.TAEvent_process();
                    uIGuidePage.OnClickDialogBoxButton();
                }
                else if (uIGuidePage.newBieGuild_step == NewBieGuild.Step_17)
                {
                    PageMgr.ShowPage <UIGuidePage>();  //开启新手引导UI
                }
            }
            //进入这个状态开始计算游览cd
            LittleZooData.Send(entity.entityID, entity.stayBuildingID);
        }
Exemple #3
0
        public override void Enter(int preStateName)
        {
            base.Enter(preStateName);
            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} StateVisitorStayFirstPosInEntryQueue.Enter", entity.entityID);
            DebugFile.GetInstance().MarkGameObject(entity.mainGameObject, "visitor_{0}_{1}_{2}", entity.entityID, (VisitorState)this.preStateName, (VisitorState)this.stateName);

            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} Play {1}", entity.entityID, Config.globalConfig.getInstace().VisitorIdle);
            entity.PlayActionAnim(Config.globalConfig.getInstace().VisitorIdle);
            isToVisitorStateChoseLittleZoo          = false;
            shouldImmediateFinishEntryGateCheckInCD = false;

            accumulativeUpdateUITime = 0;

            if (checkInCD != null)
            {
                checkInCD.Stop();
            }

            isRecvCDVal     = false;
            isSendCDFinshed = false;
            MessageManager.GetInstance().Regist((int)GameMessageDefine.GetEntryGateDataReply, OnGetEntryGateDataReply);
            MessageManager.GetInstance().Regist((int)GameMessageDefine.EntryGateCheckInCDFinshedReply, OnEntryGateCheckInCDFinshedReply);
            MessageManager.GetInstance().Regist((int)UFrameBuildinMessage.Arrived, this.OnArrived);
            MessageManager.GetInstance().Regist((int)GameMessageDefine.ImmediateFinishEntryGateCheckInCD, OnImmediateFinishEntryGateCheckInCD);
            /*   模型到达售票口   调用新手引导的内容  显示步骤10   */
            if (GlobalDataManager.GetInstance().playerData.playerZoo.isGuide == true)
            {
                UIGuidePage uIGuidePage = PageMgr.GetPage <UIGuidePage>();
                if (uIGuidePage == null)
                {
                    string e = string.Format("新手引导界面  PageMgr.allPages里 UIGuidePage   为空");
                    throw new System.Exception(e);
                }
                if (uIGuidePage.newBieGuild_step == NewBieGuild.Step_10)
                {
                    PageMgr.ShowPage <UIGuidePage>();
                }
                else if (uIGuidePage.newBieGuild_step == NewBieGuild.Step_9)
                {
                    uIGuidePage.TAEvent_finish();
                    uIGuidePage.newBieGuild_step = NewBieGuild.Step_10;
                    uIGuidePage.TAEvent_start((int)uIGuidePage.newBieGuild_step);                     //本阶段显示文本
                    uIGuidePage.TAEvent_process((int)uIGuidePage.newBieGuild_step);
                    uIGuidePage.OnClickDialogBoxButton();
                }
            }

            //进入这个状态开始计算游览cd
            GetEntryGateDataApply.Send(entity.entityID, entity.zooEntryID);
        }
        public override void Release()
        {
            MessageManager.GetInstance().UnRegist((int)GameMessageDefine.SetParkingProfitLevelOfPlayerData, this.OnSetParkingProfitLevelOfPlayerData);
            MessageManager.GetInstance().UnRegist((int)GameMessageDefine.SetParkingSpaceLevelOfPlayerData, this.OnSetParkingSpaceLevelOfPlayerData);
            MessageManager.GetInstance().UnRegist((int)GameMessageDefine.SetParkingEnterCarSpawnLevelOfPlayerData, this.OnSetParkingEnterCarSpawnLevelOfPlayerData);


            //MessageManager.GetInstance().UnRegist((int)GameMessageDefine.SetCoinOfPlayerData, this.OnSetCoinOfPlayerData);
            MessageManager.GetInstance().UnRegist((int)GameMessageDefine.AddCoinOfPlayerDataMSSC, this.OnSetCoinOfPlayerDataMSSC);
            MessageManager.GetInstance().UnRegist((int)GameMessageDefine.SetDiamondOfPlayerData, this.OnSetDiamondOfPlayerData);
            MessageManager.GetInstance().UnRegist((int)GameMessageDefine.SetStarOfPlayerData, this.OnSetStarOfPlayerData);

            MessageManager.GetInstance().UnRegist((int)GameMessageDefine.SetLittleZooTicketsLevelPlayerData, this.OnSetLittleZooTicketsLevelPlayerData);
            MessageManager.GetInstance().UnRegist((int)GameMessageDefine.SetLittleZooVisitorLocationLevelOfPlayerData, this.OnSetLittleZooVisitorLocationLevelOfPlayerData);
            MessageManager.GetInstance().UnRegist((int)GameMessageDefine.SetLittleZooEnterVisitorSpawnLevelOfPlayerData, this.OnSetLittleZooEnterVisitorSpawnLevelOfPlayerData);

            MessageManager.GetInstance().UnRegist((int)GameMessageDefine.OpenNewLittleZoo, this.OnOpenNewLittleZoo);
            MessageManager.GetInstance().UnRegist((int)GameMessageDefine.VisitorVisitCDFinshedReply, OnVisitorVisitCDFinshedReply);
            MessageManager.GetInstance().UnRegist((int)GameMessageDefine.EntryGateCheckInCDFinshedReply, OnEntryGateCheckGoToZoo);
            MessageManager.GetInstance().UnRegist((int)GameMessageDefine.SetAnimalLevel, this.OnSetAnimalLevelData);
            MessageManager.GetInstance().UnRegist((int)GameMessageDefine.SetEntryGateLevelOfPlayerData, this.OnSetEntryGateLevelOfPlayerData);
            MessageManager.GetInstance().UnRegist((int)GameMessageDefine.SetEntryGatePureLevelOfPlayerData, this.OnSetEntryGatePureLevelOfPlayerData);
            MessageManager.GetInstance().UnRegist((int)GameMessageDefine.SetEntryGateNumOfPlayerData, this.OnSetEntryGateNumOfPlayerData);

            MessageManager.GetInstance().UnRegist((int)GameMessageDefine.IncreaseCrossRoadStageID, this.OnIncreaseCrossRoadStageID);

            trigerLoadLittleZooIDs.Clear();
            if (leaveSceneCD != null)
            {
                leaveSceneCD.Stop();
                leaveSceneCD = null;
            }
            Stop();
        }
Exemple #5
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();
            }
        }
        public virtual void TickTurn(int deltaTimeMS)
        {
            if (!turnCD.IsRunning() || turnCD.IsFinish())
            {
                return;
            }

            turnCD.Tick(deltaTimeMS);
            var ctr = this.ctrList[idxCtr];

            int left = turnCD.org - Mathf.Max(0, turnCD.cd);

            int logicDelta = deltaTimeMS;

            if (turnCD.cd < 0)
            {
                logicDelta += turnCD.cd;
            }
            //旋转
            this.ownerEntity.Rotate(new Vector3(0, ctr.turnSign * this.turnSpeed * logicDelta, 0), Space.Self);
            //位移
            var ctrForward = ctr.backPos - ctr.turnOrg;
            var turnDir    = Quaternion.Euler(0, ctr.turnSign * this.turnSpeed * left, 0) * ctrForward;

            this.ownerEntity.position = ctr.turnOrg + turnDir;

            if (turnCD.IsFinish())
            {
                turnCD.Stop();

                //去除tick旋转和位移的误差:位移到前点,看向下一个后点
                ownerEntity.position = ctr.forwardPos;
                idxCtr++;
                if (idxCtr < ctrList.Count)
                {
                    this.ownerEntity.LookAt(this.ctrList[idxCtr].backPos);
                    if (!isForward)
                    {
                        ownerEntity.Rotate(new Vector3(0, 180f, 0), Space.Self);
                    }
                }
            }
        }
Exemple #7
0
        public override void Enter(int preStateName)
        {
            base.Enter(preStateName);

            isSendFinished = false;
            isClosed       = false;

            //playerData = GlobalDataManager.GetInstance().playerData;

            sceneID = (fsmCtr as FSMGameLoad).sceneID;

            waitCD = new IntCD(100);
            waitCD.Stop();

            LoadAnimalInLittleZoo();
            ////SendLoadFinised();
            //if (playerData.playerLittleGame.stageID > 0)
            //{
            //    SendLoadFinised();
            //    return;
            //}
            EnterCrossRoad();
        }
Exemple #8
0
 void Start()
 {
     DragSmoothCD = new IntCD(dragSmoothDurationMS);
     DragSmoothCD.Stop();
     Init();
 }
 public override void Release()
 {
     CD.Stop();
 }