コード例 #1
0
ファイル: NPSettings.cs プロジェクト: Gamepie/Split.Up
        private void UpdateDefineSymbols()
        {
            foreach (BuildTargetGroup _curBuildTargetGroup in buildTargetGroups)
            {
                string[]      _curDefineSymbols = UnityPlayerSettings.GetScriptingDefineSymbolsForGroup(_curBuildTargetGroup).Split(defineSeperators, StringSplitOptions.RemoveEmptyEntries);
                List <string> _newDefineSymbols = new List <string>(_curDefineSymbols);

                // Asset type
#pragma warning disable
                if (kIsFullVersion)
                {
                    if (_newDefineSymbols.Contains(kLiteVersionMacro))
                    {
                        _newDefineSymbols.Remove(kLiteVersionMacro);
                    }
                }
                else
                {
                    if (!_newDefineSymbols.Contains(kLiteVersionMacro))
                    {
                        _newDefineSymbols.Add(kLiteVersionMacro);
                    }
                }
#pragma warning restore

                ApplicationSettings.Features      _supportedFeatures      = m_applicationSettings.SupportedFeatures;
                ApplicationSettings.AddonServices _supportedAddonServices = m_applicationSettings.SupportedAddonServices;

                // Regarding supported features
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesAddressBook, kMacroAddressBook);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesBilling, kMacroBilling);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesCloudServices, kMacroCloudServices);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesGameServices, kMacroGameServices);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesMediaLibrary, kMacroMediaLibrary);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesNetworkConnectivity, kMacroNetworkConnectivity);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesNotificationService, kMacroNotificationService);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesSharing, kMacroSharin);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesTwitter, kMacroTwitter);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesWebView, kMacroWebView);

                // Regarding supported addon features
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedAddonServices.UsesSoomlaGrow, kMacroSoomlaGrowService);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedAddonServices.UsesOneSignal, kMacroOneSignalService);

                // Now save these changes
                UnityPlayerSettings.SetScriptingDefineSymbolsForGroup(_curBuildTargetGroup, string.Join(";", _newDefineSymbols.ToArray()));
            }
        }
コード例 #2
0
        private void UpdateDefineSymbols()
        {
            ApplicationSettings.Features      _supportedFeatures      = m_applicationSettings.SupportedFeatures;
            ApplicationSettings.AddonServices _supportedAddonServices = m_applicationSettings.SupportedAddonServices;

#if UNITY_ANDROID
            if (_supportedFeatures.UsesCloudServices && !_supportedFeatures.UsesGameServices)
            {
                string _error = "Cloud Services on Android needs Game Services feature to be enabled. Please enable Game Services now.";
                Debug.LogWarning("[Cross Platform Native Plugins] " + _error);
                EditorUtility.DisplayDialog("Cross Platform Native Plugins - Alert", _error, "Ok");
            }

#if USES_BILLING
            if (string.IsNullOrEmpty(NPSettings.Billing.Android.PublicKey))
            {
                string _error = "Please specify Public key in Billing Settings for using Billing feature. You can get this key from Google Play Developer Console -> Your App -> Development & Tools -> Services & API -> Licensing & in-app billing.";
                Debug.LogWarning("[Cross Platform Native Plugins] " + _error);
            }
#endif
#endif

            foreach (BuildTargetGroup _curBuildTargetGroup in buildTargetGroups)
            {
                string[]      _curDefineSymbols = UnityPlayerSettings.GetScriptingDefineSymbolsForGroup(_curBuildTargetGroup).Split(defineSeperators, StringSplitOptions.RemoveEmptyEntries);
                List <string> _newDefineSymbols = new List <string>(_curDefineSymbols);

                // Asset type
#pragma warning disable
                if (kIsFullVersion)
                {
                    if (_newDefineSymbols.Contains(kLiteVersionMacro))
                    {
                        _newDefineSymbols.Remove(kLiteVersionMacro);
                    }
                }
                else
                {
                    if (!_newDefineSymbols.Contains(kLiteVersionMacro))
                    {
                        _newDefineSymbols.Add(kLiteVersionMacro);
                    }
                }
#pragma warning restore

                // Regarding supported features
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesAddressBook, kMacroAddressBook);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesBilling, kMacroBilling);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesCloudServices, kMacroCloudServices);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesGameServices, kMacroGameServices);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesMediaLibrary, kMacroMediaLibrary);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesNetworkConnectivity, kMacroNetworkConnectivity);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesNotificationService, kMacroNotificationService);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesSharing, kMacroSharin);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesTwitter, kMacroTwitter);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesWebView, kMacroWebView);

                // Regarding supported addon features
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedAddonServices.UsesSoomlaGrow, kMacroSoomlaGrowService);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedAddonServices.UsesOneSignal, kMacroOneSignalService);

                // Now save these changes
                UnityPlayerSettings.SetScriptingDefineSymbolsForGroup(_curBuildTargetGroup, string.Join(";", _newDefineSymbols.ToArray()));
            }
        }
コード例 #3
0
        private void UpdateDefineSymbols()
        {
            Features      _supportedFeatures      = m_applicationSettings.SupportedFeatures;
            AddonServices _supportedAddonServices = m_applicationSettings.SupportedAddonServices;

                #if UNITY_ANDROID
            if (_supportedFeatures.UsesCloudServices && !_supportedFeatures.UsesGameServices)
            {
                string _error = "Cloud Services on Android needs Game Services feature to be enabled. Please enable Game Services now.";
                Debug.LogWarning("[Cross Platform Native Plugins] " + _error);
                EditorUtility.DisplayDialog("Cross Platform Native Plugins - Alert", _error, "Ok");
            }

                #if USES_BILLING
            if (string.IsNullOrEmpty(NPSettings.Billing.Android.PublicKey))
            {
                string _error = "Please specify Public key in Billing Settings for using Billing feature. You can get this key from Google Play Developer Console -> Your App -> Development & Tools -> Services & API -> Licensing & in-app billing.";
                Debug.LogWarning("[Cross Platform Native Plugins] " + _error);
            }
                #endif
                #endif

            if (_supportedAddonServices.UsesOneSignal)
            {
                if (!Directory.Exists("Assets/Standard Assets/OneSignal/src"))
                {
                    string _error = "Download OneSignal SDK from Github and move Assets/OneSignal/src folder to Assets/Standard Assets/OneSignal folder";
                    Debug.LogWarning("[Cross Platform Native Plugins] " + _error);
                    EditorUtility.DisplayDialog("OneSignal Addon Compatibility", _error, "Ok");
                }
            }

            BuildTargetGroup[] _buildTargets = GetBuildTargets();
            foreach (BuildTargetGroup _target in _buildTargets)
            {
                string[]      _curDefineSymbols = UnityPlayerSettings.GetScriptingDefineSymbolsForGroup(_target).Split(defineSeperators, StringSplitOptions.RemoveEmptyEntries);
                List <string> _newDefineSymbols = new List <string>(_curDefineSymbols);

                // Asset type
                #pragma warning disable
                if (kIsFullVersion)
                {
                    if (_newDefineSymbols.Contains(kLiteVersionMacro))
                    {
                        _newDefineSymbols.Remove(kLiteVersionMacro);
                    }
                }
                else
                {
                    if (!_newDefineSymbols.Contains(kLiteVersionMacro))
                    {
                        _newDefineSymbols.Add(kLiteVersionMacro);
                    }
                }
                #pragma warning restore

                // Regarding supported features
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesAddressBook, kAddressBookMacro);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesBilling, kBillingMacro);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesCloudServices, kCloudServicesMacro);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesGameServices, kGameServicesMacro);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesMediaLibrary, kMediaLibraryMacro);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesNetworkConnectivity, kNetworkConnectivityMacro);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesNotificationService, kNotificationServiceMacro);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesSharing, kSharingMacro);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesTwitter, kTwitterMacro);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedFeatures.UsesWebView, kWebViewMacro);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, m_utilitySettings.RateMyApp.IsEnabled, kRateMyAppMacro);

                // Regarding supported addon features
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedAddonServices.UsesSoomlaGrow, kMacroSoomlaGrowService);
                AddOrRemoveFeatureDefineSymbol(_newDefineSymbols, _supportedAddonServices.UsesOneSignal, kMacroOneSignalService);

                // Now save these changes
                UnityPlayerSettings.SetScriptingDefineSymbolsForGroup(_target, string.Join(";", _newDefineSymbols.ToArray()));
            }
        }