void RunDemo() { if (m_currTestIndex < 0) { return; } if (m_currentDemo != null) { m_currentDemo.Exit(); } m_currentDemo = m_alDemos[m_currTestIndex] as MtActionDemo; if (m_currentDemo != null) { m_currentDemo.Enter(); } m_txtTitle.text = string.Format("{0}. {1}", m_currTestIndex + 1, m_currentDemo.Title()); m_txtSubTitle.text = m_currentDemo.SubTitle(); }
void InitDemos() { m_alDemos = new ArrayList(); Assembly assembly = Assembly.GetAssembly(typeof(MtActionDemo)); Type baseClass = typeof(MtActionDemo); Type[] arrType = assembly.GetTypes(); foreach (var type in arrType) { if (type.IsSubclassOf(baseClass)) { MtActionDemo actionDemo = (MtActionDemo)Activator.CreateInstance(type); actionDemo.OnSubTitleChange = OnSubTitleChange; actionDemo.CubeTransform = m_tfCube; m_alDemos.Add(actionDemo); } } RunDemo(); }