Example #1
0
        public void OnStepFinish(GuideStep step)
        {
            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)
            {
                ClearSelf();

                GuideMgr.S.FinishGuide(this);

                Log.i("#Guide Finish:" + m_GuideId);
            }
            else
            {
                TrackNextStep();
            }
        }
Example #2
0
        protected override List <ITrigger> GetTriggerArray()
        {
            TDGuideStep data = TDGuideStepTable.GetData(m_GuideStepID);

            if (data == null)
            {
                return(null);
            }

            return(LoadTrigger(data.trigger, data.commonParam));
        }
Example #3
0
        private static void OnAddRow(TDGuideStep memberInstance)
        {
            int key = memberInstance.id;

            if (m_DataCache.ContainsKey(key))
            {
                Log.e(string.Format("Invaild,  TDGuideStepTable Id already exists {0}", key));
            }
            else
            {
                m_DataCache.Add(key, memberInstance);
                m_DataList.Add(memberInstance);
            }
        }
Example #4
0
        public static void Parse(byte[] fileData)
        {
            m_DataCache.Clear();
            m_DataList.Clear();
            DataStreamReader dataR = new DataStreamReader(fileData);
            int rowCount           = dataR.GetRowCount();

            int[] fieldIndex = dataR.GetFieldIndex(TDGuideStep.GetFieldHeadIndex());
    #if (UNITY_STANDALONE_WIN) || UNITY_EDITOR || UNITY_STANDALONE_OSX
            dataR.CheckFieldMatch(TDGuideStep.GetFieldHeadIndex(), "GuideStepTable");
    #endif
            for (int i = 0; i < rowCount; ++i)
            {
                TDGuideStep memberInstance = new TDGuideStep();
                memberInstance.ReadRow(dataR, fieldIndex);
                OnAddRow(memberInstance);
                memberInstance.Reset();
                CompleteRowAdd(memberInstance);
            }
            Log.i(string.Format("Parse Success TDGuideStep"));
        }
Example #5
0
        //command format:[c1:p1,p2,p3;c2:p1,p2,p3]
        private List <AbstractGuideCommand> LoadCommands()
        {
            TDGuideStep data = TDGuideStepTable.GetData(m_GuideStepID);

            if (data == null)
            {
                return(null);
            }

            string[] msg = data.command.Split(';');
            if (msg == null || msg.Length == 0)
            {
                return(null);
            }

            object[] commonParams = null;

            if (data.commonParam != null)
            {
                string[] comParamString = data.commonParam.Split(';');
                if (comParamString.Length > 0)
                {
                    commonParams = new object[comParamString.Length];
                    for (int i = 0; i < comParamString.Length; ++i)
                    {
                        if (comParamString[i].Contains(":"))
                        {
                            string[]      dynaParams   = comParamString [i].Split(':');
                            IRuntimeParam runtimeParam = RuntimeParamFactory.S.Create(dynaParams[0]);
                            if (runtimeParam == null)
                            {
                                Log.e("Create RuntimeParam Failed:" + dynaParams[0]);
                            }
                            else
                            {
                                if (dynaParams.Length > 1)
                                {
                                    object[] resultArray = GuideConfigParamProcess.ProcessParam(dynaParams[1], commonParams);
                                    runtimeParam.SetParam(resultArray);
                                }
                            }
                            commonParams[i] = runtimeParam;
                        }
                        else
                        {
                            commonParams[i] = comParamString[i];
                        }
                    }
                }
            }

            List <AbstractGuideCommand> result = null;

            for (int i = 0; i < msg.Length; ++i)
            {
                if (string.IsNullOrEmpty(msg[i]))
                {
                    continue;
                }
                string[] com = msg[i].Split(':');
                if (com == null || com.Length == 0)
                {
                    continue;
                }

                AbstractGuideCommand command = GuideCommandFactory.S.Create(com[0]);
                if (command == null)
                {
                    Log.e("Create Command Failed:" + com [0]);
                    continue;
                }

                if (com.Length > 1)
                {
                    object[] resultArray = GuideConfigParamProcess.ProcessParam(com[1], commonParams);
                    //处理参数
                    command.SetParam(resultArray);
                }

                if (result == null)
                {
                    result = new List <AbstractGuideCommand> ();
                }

                result.Add(command);
            }

            return(result);
        }
Example #6
0
 static void CompleteRowAdd(TDGuideStep tdData)
 {
 }