public static DBComponent GetZoneDB(this DBManagerComponent self, int zone) { DBComponent dbComponent = self.DBComponents[zone]; if (dbComponent != null) { return(dbComponent); } StartZoneConfig startZoneConfig = StartZoneConfigCategory.Instance.Get(zone); if (startZoneConfig.DBConnection == "") { throw new Exception($"zone: {zone} not found mongo connect string"); } dbComponent = self.AddChild <DBComponent, string, string, int>(startZoneConfig.DBConnection, startZoneConfig.DBName, zone); self.DBComponents[zone] = dbComponent; return(dbComponent); }
public override async ETTask Run(EventType.AppStart args) { Game.Scene.AddComponent <ConfigComponent>(); Options options = Game.Scene.GetComponent <Options>(); StartProcessConfig processConfig = StartProcessConfigCategory.Instance.Get(options.Process); Game.Scene.AddComponent <TimerComponent>(); Game.Scene.AddComponent <OpcodeTypeComponent>(); Game.Scene.AddComponent <MessageDispatcherComponent>(); Game.Scene.AddComponent <CoroutineLockComponent>(); // 发送普通actor消息 Game.Scene.AddComponent <ActorMessageSenderComponent>(); // 发送location actor消息 Game.Scene.AddComponent <ActorLocationSenderComponent>(); // 访问location server的组件 Game.Scene.AddComponent <LocationProxyComponent>(); Game.Scene.AddComponent <ActorMessageDispatcherComponent>(); // 数值订阅组件 Game.Scene.AddComponent <NumericWatcherComponent>(); // 控制台组件 Game.Scene.AddComponent <ConsoleComponent>(); Game.Scene.AddComponent <NetInnerComponent, string>(processConfig.InnerAddress); var processScenes = StartSceneConfigCategory.Instance.GetByProcess(IdGenerater.Process); foreach (StartSceneConfig startConfig in processScenes) { await SceneFactory.Create(Game.Scene, startConfig.SceneId, startConfig.Zone, startConfig.Name, startConfig.Type, startConfig); } StartZoneConfig zoneConfig = StartZoneConfigCategory.Instance.Get(Game.Scene.DomainZone()); Game.Scene.AddComponent <DBComponent, string, string>(zoneConfig.DBConnection, zoneConfig.DBName); }