コード例 #1
0
        public void SaveStep(GuideStep step)
        {
            int oldKeyStep = PrefsRecord.S.GetInt(GetLastKeyStepKey(step.guide.guideID));

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

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

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

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

                        if (allStep[i].id <= data.id)
                        {
                            PrefsRecord.S.SetInt(GetLastKeyStepKey(step.guide.guideID), allStep[i].id);
                            PrefsRecord.S.Save();
                            break;
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: Guide.cs プロジェクト: SPLiHua/Skylark
        private void RegisterStep()
        {
            m_GuideStepList = new List <GuideStep>();

            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);
                step.guide = this;
                step.RegisterTrack();
                m_GuideStepList.Add(step);
            }
        }
コード例 #3
0
ファイル: Guide.cs プロジェクト: SPLiHua/Skylark
        public void OnStepFinish(GuideStep step, bool forceFinishAllSteps = false)
        {
            if (step.stepID > m_LastFinishStepID)
            {
                m_LastFinishStepID = step.stepID;
                GuideMgr.S.SaveStep(step);
            }

            Log.I("m_LastFinishStepID///////" + m_LastFinishStepID);
            m_GuideStepList[m_CurrentGuideIndex].FinishTrack();
            TDGuideStep lastStep = TDGuideStepTable.GetGuideLastStep(m_GuideID);

            if (lastStep == null || lastStep.id == m_LastFinishStepID || forceFinishAllSteps)
            {
                GuideMgr.S.FinishGuide();
                Log.I("#Guide Finish:" + m_GuideID);
            }
            else
            {
                m_CurrentGuideIndex++;
                m_GuideStepList[m_CurrentGuideIndex].StartTrack();
            }
        }