Beispiel #1
0
    protected override void Init()
    {
        base.Init();

        // Not interested in non singleton instance
        if (instance != this)
        {
            return;
        }

        // Create compoennts
#if USES_ADDRESS_BOOK
        if (addressBook == null)
        {
            addressBook = AddComponentBasedOnPlatformOnlyIfRequired <AddressBook>();
        }
#endif

#if USES_BILLING
        if (billing == null)
        {
            billing = AddComponentBasedOnPlatformOnlyIfRequired <Billing>();
        }
#endif

#if USES_CLOUD_SERVICES
        if (cloudServices == null)
        {
            cloudServices = AddComponentBasedOnPlatformOnlyIfRequired <CloudServices>();
        }
#endif

#if USES_GAME_SERVICES
        if (gameServices == null)
        {
            gameServices = AddComponentBasedOnPlatformOnlyIfRequired <GameServices>();
        }
#endif

#if USES_MEDIA_LIBRARY
        if (mediaLibrary == null)
        {
            mediaLibrary = AddComponentBasedOnPlatformOnlyIfRequired <MediaLibrary>();
        }
#endif

#if USES_NETWORK_CONNECTIVITY
        if (networkConnectivity == null)
        {
            networkConnectivity = AddComponentBasedOnPlatformOnlyIfRequired <NetworkConnectivity>();
        }
#endif

#if USES_NOTIFICATION_SERVICE
        if (notificationService == null)
        {
            notificationService = CachedGameObject.AddComponentIfNotFound <NotificationService>();
        }
#endif

#if USES_SHARING
        if (sharing == null)
        {
            sharing = AddComponentBasedOnPlatformOnlyIfRequired <Sharing>();
        }
#endif

#if USES_TWITTER
        if (twitter == null)
        {
            twitter = AddComponentBasedOnPlatformOnlyIfRequired <Twitter>();
        }
#endif

        if (userInterface == null)
        {
            userInterface = AddComponentBasedOnPlatformOnlyIfRequired <UI>();
        }

        if (utility == null)
        {
            utility = CachedGameObject.AddComponentIfNotFound <Utility>();
        }

#if USES_WEBVIEW
        if (webview == null)
        {
            webview = CachedGameObject.AddComponentIfNotFound <WebViewNative>();
        }
#endif

#if USES_SOOMLA_GROW
        if (soomlaGrowService == null)
        {
            soomlaGrowService = AddComponentBasedOnPlatformOnlyIfRequired <SoomlaGrowService>();
        }
#endif
    }