Beispiel #1
0
        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();
            }
        }
Beispiel #2
0
        private void AddStep(GuideStep step)
        {
            if (m_GuideSteps == null)
            {
                m_GuideSteps = new List <GuideStep>();
            }

            step.guide = this;

            m_GuideSteps.Add(step);
        }
Beispiel #3
0
        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;
                        }
                    }
                }
            }
        }
Beispiel #4
0
        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);
        }