public void CreatePlatform() { if (GetComponent <Platform>() != null) { return; } IPlatformListener platformListener = PlatformListener.Instance; Platform.CreateOnGameObject(gameObject, platformListener); }
/// <summary> /// 创建发布者平台实例, 并调用发布者平台的初始化方法 /// </summary> /// <param name="gameObject"></param> public static void CreateOnGameObject(GameObject gameObject, IPlatformListener platformListener) { switch (LywConfig.GetPublisher()) { case ProductPublisher.Local: instance = gameObject.AddComponent <Platform>(); break; case ProductPublisher.LywGames: instance = gameObject.AddComponent <LywPlatform>(); break; default: LoggerManager.Instance.Error("Invalid publisher type when create platform.Invalid Platform type is " + LywConfig.GetPublisher()); break; } // 创建平台即初始化平台 if (instance != null) { instance.platformListener = platformListener; instance.Initialize(); } }