using CommonAI.Data; using CommonAI.Zone; using CommonAI.Zone.ZoneEditor; using CommonAI.ZoneServer.JSGModule; using CommonLang; using CommonLang.Property; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace XmdsCommonServer.Plugin.Scene { public class XmdsSceneFactory { private static bool m_FinishInit = false; private static HashMap m_ExtensionTypes = new HashMap(); public static void Init() { if (m_FinishInit) { return; } foreach (Type stype in ReflectionUtil.GetNoneVirtualSubTypes(typeof(XmdsServerScene))) { var ext = PropertyUtil.GetAttribute(stype); if (ext != null) { m_ExtensionTypes.Put(ext.TemplateID, stype); } } m_FinishInit = true; } public static XmdsServerScene CreateScene(TemplateManager templates, InstanceZoneListener listener, SceneData data, GSCreateAreaData gsData, string bindGameSrvId) { Type stype; if (m_ExtensionTypes.TryGetValue(data.TemplateID, out stype)) { return ReflectionUtil.CreateInstance(stype, templates, listener, data, gsData, bindGameSrvId) as XmdsServerScene; } return new XmdsServerScene(templates, listener, data, gsData, bindGameSrvId, JSGModule.GetSpaceDiveSize(data.sceneType)); } } }