예제 #1
0
파일: Guide.cs 프로젝트: moto2002/Hunter
        public void OnStepFinish(GuideStep step, bool forceFinishAllSteps = false)
        {
            if (step.stepID > m_LastFinishStepID)
            {
                m_LastFinishStepID = step.stepID;
                GuideMgr.S.FinishStep(step);
            }

            //GuideMgr.S.FinishStep(step);

            TDGuideStep lastStep = TDGuideStepTable.GetGuideLastStep(m_GuideId);

            if (lastStep == null || lastStep.id == m_LastFinishStepID || forceFinishAllSteps)
            {
                ClearSelf();

                GuideMgr.S.FinishGuide(this);

                Log.i("#Guide Finish:" + m_GuideId);
            }
            else
            {
                TrackNextStep();
            }
        }
예제 #2
0
파일: Guide.cs 프로젝트: moto2002/Hunter
        private void AddStep(GuideStep step)
        {
            if (m_GuideSteps == null)
            {
                m_GuideSteps = new List <GuideStep>();
            }

            step.guide = this;

            m_GuideSteps.Add(step);
        }
예제 #3
0
파일: GuideMgr.cs 프로젝트: moto2002/Hunter
        public void FinishStep(GuideStep step)
        {
            int oldKeyStep = DataRecord.S.GetInt(GetLastKeyStepKey(step.guide.guideID));

            if (oldKeyStep >= step.stepID)
            {
                return;
            }

            //TODO:需要找到最近的关键帧并保存
            var data = TDGuideStepTable.GetData(step.stepID);

            if (data != null)
            {
                if (data.keyFrame)
                {
                    DataRecord.S.SetInt(GetLastKeyStepKey(step.guide.guideID), step.stepID);
                    DataRecord.S.Save();
                }
                else
                {
                    //纪录最近的keyframe
                    var allStep = TDGuideStepTable.GetDataAsGuideID(step.guide.guideID);
                    for (int i = allStep.Count - 1; i >= 0; --i)
                    {
                        if (!allStep[i].keyFrame)
                        {
                            continue;
                        }

                        if (allStep[i].id <= oldKeyStep)
                        {
                            break;
                        }

                        if (allStep[i].id <= data.id)
                        {
                            DataRecord.S.SetInt(GetLastKeyStepKey(step.guide.guideID), allStep[i].id);
                            DataRecord.S.Save();
                            break;
                        }
                    }
                }
            }
        }
예제 #4
0
파일: Guide.cs 프로젝트: moto2002/Hunter
        public bool ActiveSelf()
        {
            if (m_IsActive)
            {
                return(true);
            }

            m_IsActive = true;

            if (m_GuideSteps == null)
            {
                m_LastFinishStepID = GuideMgr.S.GetGuideLastStep(m_GuideId);

                var dataList = TDGuideStepTable.GetDataAsGuideID(m_GuideId);
                for (int i = 0; i < dataList.Count; ++i)
                {
                    if (dataList[i].id <= m_LastFinishStepID)
                    {
                        continue;
                    }
                    GuideStep step = new GuideStep(dataList [i].id);
                    AddStep(step);
                }
            }

            if (m_GuideSteps == null)
            {
                return(false);
            }

            Log.i("#Guide Start:" + m_GuideId);

            TrackNextStep();

            return(true);
        }