Ejemplo n.º 1
0
    protected virtual void Awake()
    {
        if (instance != null)
        {
            Destroy(gameObject);
            return;
        }

        if (this.GetType() == typeof(InAppPurchasesSystem))
        {
#if UNITY_IPHONE
            InAppPurchasesSystemIOS newSystem = gameObject.AddComponent <InAppPurchasesSystemIOS>();
            newSystem.showDialogs  = showDialogs;
            newSystem.logAnalytics = logAnalytics;
#elif UNITY_ANDROID
            InAppPurchasesSystemAndroid newSystem = gameObject.AddComponent <InAppPurchasesSystemAndroid>();
            newSystem.showDialogs  = showDialogs;
            newSystem.logAnalytics = logAnalytics;
#endif

#if (UNITY_IPHONE || UNITY_ANDROID)
            Destroy(this);
            return;
#endif
        }

        instance = this;
        DontDestroyOnLoad(gameObject);

        if (distributionBuild)
        {
            prefix = disneyId;
        }
        else
        {
            prefix = mobilityId;
        }

        Debug.LogWarning("In app purchases prefix: " + prefix);

        RequestProductList();
    }
	protected virtual void Awake() 
	{
		if (instance != null)
		{
			Destroy(gameObject);
			return;
		}
		
		if (this.GetType() == typeof(InAppPurchasesSystem))
		{
#if UNITY_IPHONE
			InAppPurchasesSystemIOS newSystem = gameObject.AddComponent<InAppPurchasesSystemIOS>();
			newSystem.showDialogs = showDialogs;
			newSystem.logAnalytics = logAnalytics;
#elif UNITY_ANDROID
			InAppPurchasesSystemAndroid newSystem = gameObject.AddComponent<InAppPurchasesSystemAndroid>();
			newSystem.showDialogs = showDialogs;
			newSystem.logAnalytics = logAnalytics;
#endif
			
#if (UNITY_IPHONE || UNITY_ANDROID)
			Destroy(this);
			return;
#endif
		}
		
		instance = this;
		DontDestroyOnLoad(gameObject);
		
		if (distributionBuild) 
		{
			prefix = disneyId;
		}
		else {
			prefix = mobilityId;
		}
		
		Debug.LogWarning("In app purchases prefix: " + prefix);
		
		RequestProductList();
	}