public void AddObserver(GamebaseCallback.DataDelegate <GamebaseResponse.SDK.ObserverMessage> observer)
 {
     if (false == observerSet.Add(observer))
     {
         GamebaseLog.Warn(GamebaseStrings.ADD_OBSERVER_FAILED, this, "AddObserver");
         return;
     }
 }
Example #2
0
 public void RemoveObserver(GamebaseCallback.DataDelegate <GamebaseResponse.SDK.ObserverMessage> observer)
 {
     if (false == observerSet.Remove(observer))
     {
         GamebaseLog.Warn(GamebaseStrings.REMOVE_OBSERVER_FAILED, this);
         return;
     }
 }
Example #3
0
 public void RemoveServerPushEvent(GamebaseCallback.DataDelegate <GamebaseResponse.SDK.ServerPushMessage> serverPushEvent)
 {
     if (false == serverPushEventSet.Remove(serverPushEvent))
     {
         GamebaseLog.Warn(GamebaseStrings.REMOVE_SERVER_PUSH_FAILED, this);
         return;
     }
 }
Example #4
0
 public void AddServerPushEvent(GamebaseCallback.DataDelegate <GamebaseResponse.SDK.ServerPushMessage> serverPushEvent)
 {
     if (false == serverPushEventSet.Add(serverPushEvent))
     {
         GamebaseLog.Warn(GamebaseStrings.ADD_SERVER_PUSH_FAILED, this, "AddServerPushEvent");
         return;
     }
 }
Example #5
0
        public static void AddDelegate(string scheme, GamebaseCallback.DataDelegate <NativeMessage> eventDelegate, GamebaseCallback.DataDelegate <NativeMessage> pluginEventDelegate = null)
        {
            DelegateData delegateData = new DelegateData();

            delegateData.eventDelegate       = eventDelegate;
            delegateData.pluginEventDelegate = pluginEventDelegate;

            delegateDictionary.Add(scheme, delegateData);
        }
Example #6
0
        public static void FireNotSupportedAPI <T>(object classObj, GamebaseCallback.DataDelegate <T> callback, [System.Runtime.CompilerServices.CallerMemberName] string methodName = "")
        {
            if (callback == null)
            {
                return;
            }

            GamebaseLog.Warn(string.Format("{0}", CreateNotSupportedMessage()), classObj, methodName);
            callback(default(T));
        }
Example #7
0
 public bool RemoveOnChangedStatusListener(GamebaseCallback.DataDelegate <GamebaseNetworkType> stateDelegate)
 {
     networkStateDelegate -= stateDelegate;
     if (networkStateDelegate == null)
     {
         network.RemoveOnChangedStatusListener();
         GamebaseCallbackHandler.UnregisterCallback(networkStateHandle);
         networkStateHandle = 0;
     }
     return(true);
 }
 public bool RemoveUpdateStatusListener(GamebaseCallback.DataDelegate <GamebaseResponse.Launching.LaunchingStatus> statusDelegate)
 {
     launchingStatusDelegate -= statusDelegate;
     if (launchingStatusDelegate == null)
     {
         launching.RemoveUpdateStatusListener(launchingStatusHandle);
         GamebaseCallbackHandler.UnregisterCallback(launchingStatusHandle);
         launchingStatusHandle = 0;
     }
     return(true);
 }
Example #9
0
        public override void ShowAlert(Dictionary <string, string> parameters, GamebaseUtilAlertType alertType, int handle)
        {
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
            string title       = GetDictionaryValue(parameters, GamebaseSystemPopup.KEY_TITLE);
            string message     = GetDictionaryValue(parameters, GamebaseSystemPopup.KEY_MESSAGE);
            string buttonLeft  = GetDictionaryValue(parameters, GamebaseSystemPopup.KEY_BUTTON_LEFT);
            string buttonRight = GetDictionaryValue(parameters, GamebaseSystemPopup.KEY_BUTTON_RIGHT);

            int select = BUTTON_OK;

            if (GamebaseUtilAlertType.ALERT_OK == alertType)
            {
                StandaloneGamebaseMessageBox.OK = buttonRight;

                select = StandaloneGamebaseMessageBox.ShowMessageBox(
                    title,
                    message,
                    StandaloneGamebaseMessageBox.MB_OK);
            }
            else
            {
                StandaloneGamebaseMessageBox.OK     = buttonLeft;
                StandaloneGamebaseMessageBox.Cancel = buttonRight;

                select = StandaloneGamebaseMessageBox.ShowMessageBox(
                    title,
                    message,
                    StandaloneGamebaseMessageBox.MB_OKCANCEL);
            }

            GamebaseUtilAlertButtonID buttonID;
            if (BUTTON_OK == select)
            {
                buttonID = GamebaseUtilAlertButtonID.BUTTON_ONE;
            }
            else
            {
                buttonID = GamebaseUtilAlertButtonID.BUTTON_TWO;
            }

            if (-1 != handle)
            {
                GamebaseCallback.DataDelegate <GamebaseUtilAlertButtonID> callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.DataDelegate <GamebaseUtilAlertButtonID> >(handle);
                if (null != callback)
                {
                    callback(buttonID);
                }
            }
#else
            base.ShowAlert(parameters, alertType, handle);
#endif
        }
Example #10
0
 public bool AddOnChangedStatusListener(GamebaseCallback.DataDelegate <GamebaseNetworkType> stateDelegate)
 {
     if (networkStateDelegate == null)
     {
         networkStateHandle = GamebaseCallbackHandler.RegisterCallback(new GamebaseCallback.DataDelegate <GamebaseNetworkType>(OnChangedStatus));
         if (!network.AddOnChangedStatusListener(networkStateHandle))
         {
             GamebaseCallbackHandler.UnregisterCallback(networkStateHandle);
             return(false);
         }
     }
     networkStateDelegate += stateDelegate;
     return(true);
 }
        public bool AddUpdateStatusListener(GamebaseCallback.DataDelegate <GamebaseResponse.Launching.LaunchingStatus> statusDelegate)
        {
            if (launchingStatusDelegate == null)
            {
                launchingStatusHandle = GamebaseCallbackHandler.RegisterCallback(new GamebaseCallback.DataDelegate <GamebaseResponse.Launching.LaunchingStatus>(OnLaunchingStatus));

                if (!launching.AddUpdateStatusListener(launchingStatusHandle))
                {
                    GamebaseCallbackHandler.UnregisterCallback(launchingStatusHandle);
                    return(false);
                }
            }
            launchingStatusDelegate += statusDelegate;
            return(true);
        }
Example #12
0
        public override void ShowAlert(Dictionary <string, string> parameters, GamebaseUtilAlertType alertType, int handle)
        {
            string title   = GetDictionaryValue(parameters, GamebaseSystemPopup.KEY_TITLE);
            string message = GetDictionaryValue(parameters, GamebaseSystemPopup.KEY_MESSAGE);
            string extra   = GetDictionaryValue(parameters, GamebaseSystemPopup.KEY_EXTRA);

            int select = BUTTON_OK;

            if (GamebaseUtilAlertType.ALERT_OK == alertType)
            {
                StringBuilder sb = new StringBuilder(message);

                Alert(title, sb.ToString());
            }
            else
            {
                StringBuilder sb = new StringBuilder(message);
                if (false == string.IsNullOrEmpty(extra))
                {
                    sb.Append("\n\n").Append(extra);
                }

                select = Confirm(title, sb.ToString());
            }

            GamebaseUtilAlertButtonID buttonID;

            if (BUTTON_OK == select)
            {
                buttonID = GamebaseUtilAlertButtonID.BUTTON_ONE;
            }
            else
            {
                buttonID = GamebaseUtilAlertButtonID.BUTTON_TWO;
            }

            if (-1 != handle)
            {
                GamebaseCallback.DataDelegate <GamebaseUtilAlertButtonID> callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.DataDelegate <GamebaseUtilAlertButtonID> >(handle);
                if (null != callback)
                {
                    callback(buttonID);
                }
            }
        }
 public void SetRecvEvent(GamebaseCallback.DataDelegate <string> callback)
 {
     recvCallback = callback;
 }
Example #14
0
        public void IsConnected(GamebaseCallback.DataDelegate <bool> callback)
        {
            int handle = GamebaseCallbackHandler.RegisterCallback(callback);

            network.IsConnected(handle);
        }
 public void RemoveServerPushEvent(GamebaseCallback.DataDelegate <GamebaseResponse.SDK.ServerPushMessage> serverPushEvent)
 {
     GamebaseServerPushEventManager.Instance.RemoveServerPushEvent(serverPushEvent);
     sdk.RemoveServerPushEvent();
 }
 public void AddServerPushEvent(GamebaseCallback.DataDelegate <GamebaseResponse.SDK.ServerPushMessage> serverPushEvent)
 {
     GamebaseServerPushEventManager.Instance.AddServerPushEvent(serverPushEvent);
     sdk.AddServerPushEvent(GamebaseServerPushEventManager.Instance.Handle);
 }
 public void RemoveObserver(GamebaseCallback.DataDelegate <GamebaseResponse.SDK.ObserverMessage> observer)
 {
     GamebaseObserverManager.Instance.RemoveObserver(observer);
     sdk.RemoveObserver();
 }
 public void AddObserver(GamebaseCallback.DataDelegate <GamebaseResponse.SDK.ObserverMessage> observer)
 {
     GamebaseObserverManager.Instance.AddObserver(observer);
     sdk.AddObserver(GamebaseObserverManager.Instance.Handle);
 }
        public void ShowAlert(Dictionary <string, string> parameters, GamebaseUtilAlertType alertType, GamebaseCallback.DataDelegate <GamebaseUtilAlertButtonID> buttonCallback)
        {
            int handle = GamebaseCallbackHandler.RegisterCallback(buttonCallback);

            util.ShowAlert(parameters, alertType, handle);
        }
Example #20
0
        public static void FireNotSupportedAPI <T>(object classObj, string methodName, GamebaseCallback.DataDelegate <T> callback)
        {
            if (callback == null)
            {
                return;
            }

            GamebaseLog.Warn(string.Format("{0}", CreateNotSupportedMessage()), classObj, methodName);
            callback(default(T));
        }
        private void ShowSystemPopup(GamebaseUtilAlertType alertType, string title, string message, string buttonLeft = "", string buttonRight = "", string extra = "", GamebaseCallback.DataDelegate <GamebaseUtilAlertButtonID> callback = null)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add(KEY_TITLE, title);
            parameters.Add(KEY_MESSAGE, message);
            parameters.Add(KEY_BUTTON_LEFT, buttonLeft);
            parameters.Add(KEY_BUTTON_RIGHT, buttonRight);
            parameters.Add(KEY_EXTRA, extra);

            GamebaseUtilImplementation.Instance.ShowAlert(parameters, alertType, callback);
        }