Ejemplo n.º 1
0
        static StreamManager()
        {
            ReignServices.CheckStatus();
            ques = new List <StreamManagerQue>();

                        #if !DISABLE_REIGN
                        #if UNITY_EDITOR
            plugin = new StreamPlugin();
#elif UNITY_WINRT
            plugin = new StreamPlugin_WinRT();
#elif UNITY_ANDROID
            plugin = new StreamPlugin_Android();
#elif UNITY_IOS
            plugin = new StreamPlugin_iOS();
#elif UNITY_BLACKBERRY
            plugin = new StreamPlugin_BB10();
#elif UNITY_STANDALONE_WIN
            //plugin = new StreamPlugin();
#else
            plugin = new StreamsPlugin_Dumy();
#endif

            ReignServices.AddService(update, null, null);
                        #endif
        }
Ejemplo n.º 2
0
        static MessageBoxManager()
        {
            ReignServices.CheckStatus();

                        #if !DISABLE_REIGN
                        #if UNITY_EDITOR
            plugin = new MessageBoxPlugin();
                        #elif UNITY_WINRT
            plugin = new MessageBoxPlugin_WinRT();
                        #elif UNITY_ANDROID
            plugin = new MessageBoxPlugin_Android();
                        #elif UNITY_IOS
            plugin = new MessageBoxPlugin_iOS();
                        #elif UNITY_BLACKBERRY
            plugin = new MessageBoxPlugin_BB10();
                        #elif UNITY_STANDALONE_WIN
            plugin = new MessageBoxPlugin_Win32();
                        #elif UNITY_STANDALONE_OSX
            plugin = new MessageBoxPlugin_OSX();
                        #else
            plugin = new MessageBoxPlugin_Dumy();
                        #endif

            ReignServices.AddService(update, null, null);
                        #endif
        }
        private async void showAsync(string title, string message, MessageBoxTypes type, MessageBoxOptions options, MessageBoxCallback callback)
                #endif
        {
                        #if WINDOWS_PHONE
            WinRTPlugin.Dispatcher.BeginInvoke(delegate()
            {
                // XNA method
                Microsoft.Xna.Framework.GamerServices.Guide.BeginShowMessageBox(title, message,
                                                                                new System.Collections.Generic.List <string> {
                    options.OkButtonName, options.CancelButtonText
                }, 0, Microsoft.Xna.Framework.GamerServices.MessageBoxIcon.Error,
                                                                                asyncResult =>
                {
                    int?result = Microsoft.Xna.Framework.GamerServices.Guide.EndShowMessageBox(asyncResult);
                    ReignServices.InvokeOnUnityThread(delegate
                    {
                        if (callback != null)
                        {
                            callback(result == 0 ? MessageBoxResult.Ok : MessageBoxResult.Cancel);
                        }
                    });
                }, null);

                // Silverlight method. (Doesn't support custom named buttons)
                //var result = MessageBox.Show(message, title, type == MessageBoxTypes.Ok ? MessageBoxButton.OK : MessageBoxButton.OKCancel);
                //if (callback != null) callback(result == System.Windows.MessageBoxResult.OK ? MessageBoxResult.Ok : MessageBoxResult.Cancel);
            });
                        #else
            await WinRTPlugin.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async delegate()
            {
                var msg = new MessageDialog(message, title);
                if (type == MessageBoxTypes.Ok)
                {
                    await msg.ShowAsync();
                    ReignServices.InvokeOnUnityThread(delegate
                    {
                        if (callback != null)
                        {
                            callback(MessageBoxResult.Ok);
                        }
                    });
                }
                else if (type == MessageBoxTypes.OkCancel)
                {
                    bool result = false;
                    msg.Commands.Add(new UICommand(options.OkButtonName, new UICommandInvokedHandler((cmd) => result     = true)));
                    msg.Commands.Add(new UICommand(options.CancelButtonText, new UICommandInvokedHandler((cmd) => result = false)));
                    await msg.ShowAsync();
                    ReignServices.InvokeOnUnityThread(delegate
                    {
                        if (callback != null)
                        {
                            callback(result ? MessageBoxResult.Ok : MessageBoxResult.Cancel);
                        }
                    });
                }
            });
                        #endif
        }
 /// <summary>
 /// Use to init a score API.
 /// </summary>
 /// <param name="desc">Score Desc.</param>
 public static void Init(ScoreDesc desc, CreatedScoreAPICallbackMethod callback)
 {
     ScoreManager.createdCallback = callback;
     ReignServices.CheckStatus();
     plugin            = ScorePluginAPI.New(desc, async_CreatedCallback);
     ScoreManager.desc = desc;
     ReignServices.AddService(update, null, null);
 }
        static InAppPurchaseManager()
        {
            ReignServices.CheckStatus();

                        #if !DISABLE_REIGN
            ReignServices.AddService(update, null, null);
                        #endif
        }
        static InterstitialAdManager()
        {
            ReignServices.CheckStatus();
            plugins = new List <IInterstitialAdPlugin>();

                        #if !DISABLE_REIGN
            ReignServices.AddService(update, onGui, null);
                        #endif
        }
Ejemplo n.º 7
0
 private void ad_AdClosed(object sender, InterstitialAdLoadedEventArgs e)
 {
     ReignServices.InvokeOnUnityThread(delegate
     {
         if (eventCallback != null)
         {
             eventCallback(InterstitialAdEvents.Canceled, null);
         }
     });
 }
Ejemplo n.º 8
0
 private void ad_NoAd(object sender, NoAdEventArgs e)
 {
     ReignServices.InvokeOnUnityThread(delegate
     {
         if (eventCallback != null)
         {
             eventCallback(InterstitialAdEvents.Error, "NoAd Error: " + e.Message);
         }
     });
 }
 void adControl_IsEngagedChanged(object sender, RoutedEventArgs e)
 {
     ReignServices.InvokeOnUnityThread(delegate
     {
         if (adControl.IsEngaged && eventCallback != null)
         {
             eventCallback(AdEvents.Clicked, null);
         }
     });
 }
Ejemplo n.º 10
0
 void adView_FailedToReceiveAd(object sender, AdErrorEventArgs e)
 {
     ReignServices.InvokeOnUnityThread(delegate
     {
         if (eventCallback != null)
         {
             eventCallback(AdEvents.Error, e.ErrorCode.ToString());
         }
     });
 }
 void ad_FailedToReceiveAd(object sender, AdErrorEventArgs e)
 {
     ReignServices.InvokeOnUnityThread(delegate
     {
         if (eventCallback != null)
         {
             eventCallback(InterstitialAdEvents.Error, "Error Code: " + e.ErrorCode);
         }
     });
 }
 void ad_ShowingOverlay(object sender, AdEventArgs e)
 {
     ReignServices.InvokeOnUnityThread(delegate
     {
         if (eventCallback != null)
         {
             eventCallback(InterstitialAdEvents.Shown, null);
         }
     });
 }
Ejemplo n.º 13
0
 void adControl_AdRefreshed(object sender, AdLoadedEventArgs e)
 {
     ReignServices.InvokeOnUnityThread(delegate
     {
         if (eventCallback != null)
         {
             eventCallback(AdEvents.Refreshed, null);
         }
     });
 }
 private void adReceived(object sender, AdEventArgs e)
 {
     ReignServices.InvokeOnUnityThread(delegate
     {
         if (eventCallback != null)
         {
             eventCallback(InterstitialAdEvents.Cached, null);
         }
     });
 }
Ejemplo n.º 15
0
 void adView_ReceivedAd(object sender, AdEventArgs e)
 {
     ReignServices.InvokeOnUnityThread(delegate
     {
         if (eventCallback != null)
         {
             eventCallback(AdEvents.Refreshed, null);
         }
     });
 }
Ejemplo n.º 16
0
 void adControl_Clicked(object sender, AdClickEventArgs e)
 {
     ReignServices.InvokeOnUnityThread(delegate
     {
         if (eventCallback != null)
         {
             eventCallback(AdEvents.Clicked, null);
         }
     });
 }
 void ad_LeavingApplication(object sender, AdEventArgs e)
 {
     ReignServices.InvokeOnUnityThread(delegate
     {
         if (eventCallback != null)
         {
             eventCallback(InterstitialAdEvents.Clicked, null);
         }
     });
 }
Ejemplo n.º 18
0
 void adControl_ErrorOccurred(object sender, AdLoadingErrorEventArgs e)
 {
     ReignServices.InvokeOnUnityThread(delegate
     {
         Debug.LogError(e.Error.Message);
         if (eventCallback != null)
         {
             eventCallback(AdEvents.Error, e.Error.Message);
         }
     });
 }
Ejemplo n.º 19
0
 private void async_CreatedCallback(bool succeeded)
 {
                 #if ASYNC
     ReignServices.InvokeOnUnityThread(delegate
     {
         ReignServices.Singleton.StartCoroutine(createdCallbackDelay(succeeded));
     });
                 #else
     ReignServices.Singleton.StartCoroutine(createdCallbackDelay(succeeded));
                 #endif
 }
Ejemplo n.º 20
0
 private void adControl_NoAd(object sender, NoAdEventArgs e)
 {
     ReignServices.InvokeOnUnityThread(delegate
     {
         Debug.LogError(e.Message);
         if (eventCallback != null)
         {
             eventCallback(AdEvents.Error, e.Message);
         }
     });
 }
Ejemplo n.º 21
0
 private void adControl_AdCovered(object sender, AdCoveredEventArgs e)
 {
     ReignServices.InvokeOnUnityThread(delegate
     {
         string error = "Overlapping XAML object: " + e.CulpritElement.Name;
         Debug.LogError(error);
         if (eventCallback != null)
         {
             eventCallback(AdEvents.Error, error);
         }
     });
 }
Ejemplo n.º 22
0
    void Awake()
    {
        if (Singleton != null)
        {
            canDestroy = false;
            Destroy(gameObject);
            return;
        }

        canDestroy = true;
        Singleton  = this;
        DontDestroyOnLoad(gameObject);
    }
Ejemplo n.º 23
0
        internal static async void loadFileDialog_Callback(Windows.ApplicationModel.Activation.IFileOpenPickerContinuationEventArgs data)
        {
            if (data == null)
            {
                ReignServices.InvokeOnUnityThread(delegate
                {
                    LoadFileDialog_streamLoadedCallback(null, false);
                });
                return;
            }

            var files = data.Files;

            if (files != null && files.Count >= 1)
            {
                var    file   = files[0];
                Stream stream = null;
                if (LoadFileDialog_maxWidth == 0 || LoadFileDialog_maxHeight == 0)
                {
                    stream = await file.OpenStreamForReadAsync();

                    ReignServices.InvokeOnUnityThread(delegate
                    {
                        LoadFileDialog_streamLoadedCallback(stream, true);
                    });
                }
                else
                {
                    using (var tempStream = await file.OpenStreamForReadAsync())
                    {
                        stream = await resizeImageStream(tempStream.AsRandomAccessStream(), LoadFileDialog_maxWidth, LoadFileDialog_maxHeight);
                    }

                    ReignServices.InvokeOnUnityThread(delegate
                    {
                        LoadFileDialog_streamLoadedCallback(stream, true);
                    });
                }
            }
            else
            {
                ReignServices.InvokeOnUnityThread(delegate
                {
                    LoadFileDialog_streamLoadedCallback(null, false);
                });
            }

            LoadFileDialog_picker = null;
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Use to save a ScreenShot of you game to the pictures folder.
        /// </summary>
        /// <param name="streamSavedCallback"></param>
        public static void SaveScreenShotToPictures(StreamSavedCallbackMethod streamSavedCallback)
        {
            if (savingStream)
            {
                Debug.LogError("You must wait for the last saved file to finish!");
                if (streamSavedCallback != null)
                {
                    streamSavedCallback(false);
                }
                return;
            }

            StreamManager.streamSavedCallback = streamSavedCallback;
            ReignServices.CaptureScreenShot(captureScreenShotCallback);
        }
Ejemplo n.º 25
0
    void OnDestroy()
    {
        if (!canDestroy)
        {
            return;
        }

        PlayerPrefs.Save();
        if (destroyService != null)
        {
            destroyService();
        }

        Singleton      = null;
        updateService  = null;
        onguiService   = null;
        destroyService = null;
    }
Ejemplo n.º 26
0
 private static void async_streamSavedCallback(bool succeeded)
 {
                 #if ASYNC
     ReignServices.InvokeOnUnityThread(delegate
     {
         savingStream = false;
         if (streamSavedCallback != null)
         {
             streamSavedCallback(succeeded);
         }
     });
                 #else
     savingStream = false;
     if (streamSavedCallback != null)
     {
         streamSavedCallback(succeeded);
     }
                 #endif
 }
Ejemplo n.º 27
0
 private static void async_streamDeleteCallback(bool succeeded)
 {
                 #if ASYNC
     ReignServices.InvokeOnUnityThread(delegate
     {
         deletingFile = false;
         if (streamDeleteCallback != null)
         {
             streamDeleteCallback(succeeded);
         }
     });
                 #else
     deletingFile = false;
     if (streamDeleteCallback != null)
     {
         streamDeleteCallback(succeeded);
     }
                 #endif
 }
Ejemplo n.º 28
0
 private static void async_streamExistsCallback(bool exists)
 {
                 #if ASYNC
     ReignServices.InvokeOnUnityThread(delegate
     {
         checkingIfFileExists = false;
         if (streamExistsCallback != null)
         {
             streamExistsCallback(exists);
         }
     });
                 #else
     checkingIfFileExists = false;
     if (streamExistsCallback != null)
     {
         streamExistsCallback(exists);
     }
                 #endif
 }
Ejemplo n.º 29
0
 private static void async_streamLoadedCallback(Stream stream, bool succeeded)
 {
                 #if ASYNC
     ReignServices.InvokeOnUnityThread(delegate
     {
         loadingStream = false;
         if (streamLoadedCallback != null)
         {
             streamLoadedCallback(stream, succeeded);
         }
     });
                 #else
     loadingStream = false;
     if (streamLoadedCallback != null)
     {
         streamLoadedCallback(stream, succeeded);
     }
                 #endif
 }
Ejemplo n.º 30
0
        private async void init(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
        {
            bool pass = true;

            try
            {
                eventCallback = desc.EventCallback;
                unitID        = desc.WP8_AdDuplex_UnitID;
                testing       = desc.Testing;
            }
            catch (Exception e)
            {
                Debug.LogError(e.Message);
                pass = false;
            }

            if (!initialized && pass)
            {
                initialized = true;
                await WinRTPlugin.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, delegate()
                {
                    AdDuplexClient.Initialize(desc.WP8_AdDuplex_ApplicationKey);
                    ReignServices.InvokeOnUnityThread(delegate
                    {
                        if (createdCallback != null)
                        {
                            createdCallback(pass);
                        }
                    });
                });
            }
            else
            {
                ReignServices.InvokeOnUnityThread(delegate
                {
                    if (createdCallback != null)
                    {
                        createdCallback(pass);
                    }
                });
            }
        }
Ejemplo n.º 31
0
	void OnDestroy()
	{
		if (!canDestroy) return;

		PlayerPrefs.Save ();
		if (destroyService != null) destroyService();
		
		Singleton = null;
		updateService = null;
		onguiService = null;
		destroyService = null;
	}
Ejemplo n.º 32
0
	void Awake()
	{
		if (Singleton != null)
		{
			canDestroy = false;
			Destroy(gameObject);
			return;
		}

		canDestroy = true;
		Singleton = this;
		DontDestroyOnLoad(gameObject);
	}