예제 #1
0
        /// <summary>
        /// Loads all expansion modules specified in the settings file
        /// </summary>
        /// <returns></returns>
        public bool LoadExpansions()
        {
            m_expansions.Clear();

            // handle main module
            if (m_main_module_type != null)
            {
                ExpansionBase main_module = (ExpansionBase)Activator.CreateInstance(m_main_module_type);
                main_module.Initialize(this, -1);

                m_expansions.Add(new LoadedExpansionInfo(main_module));
            }

            // load modules
            List <ExpansionSettingsBase> module_list = m_settings_file.GetExpansionList();

            for (int i = 0; i < module_list.Count; i++)
            {
                if (module_list[i].Active)
                {
                    ExpansionBase expansion;

                    LoadExpansionMainClass(module_list[i].ModuleName, out expansion);
                    expansion.Initialize(this, module_list[i].ExpansionIndex);

                    if (module_list[i] is CardSettingsBase)
                    {
                        CardSettingsBase card_info = module_list[i] as CardSettingsBase;

                        m_expansions.Add(new LoadedExpansionInfo(expansion, module_list[i].ExpansionIndex, card_info.SlotIndex));
                    }
                    else
                    {
                        m_expansions.Add(new LoadedExpansionInfo(expansion, module_list[i].ExpansionIndex));
                    }
                }
            }

            return(true);
        }