Share.cs 742 字节
Newer Older
1 2 3 4 5
namespace Base
{
	/// <summary>
	/// 游戏和扩展编辑器都需要用到的数据放在这个Scene上面
	/// </summary>
T
tanghai 已提交
6
	public sealed class Share : Entity
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
	{
		private static Scene share;

		public static Scene Scene
		{
			get
			{
				if (share == null)
				{
					share = new Scene("Share", SceneType.Share);
					share.AddComponent<EventComponent>();
					share.AddComponent<LogComponent>();
					GlobalConfigComponent globalConfigComponent = share.AddComponent<GlobalConfigComponent>();
					share.AddComponent<NetworkComponent, NetworkProtocol>(globalConfigComponent.GlobalProto.Protocol);
				}
				return share;
			}
		}

		public static void Close()
		{
			Scene scene = share;
			share = null;
			scene?.Dispose();
		}
	}
}