12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- 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<int, Type> m_ExtensionTypes = new HashMap<int, Type>();
- public static void Init()
- {
- if (m_FinishInit) { return; }
- foreach (Type stype in ReflectionUtil.GetNoneVirtualSubTypes(typeof(XmdsServerScene)))
- {
- var ext = PropertyUtil.GetAttribute<XmdsExtensionZoneAttribute>(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));
- }
- }
- }
|