Beispiel #1
0
    private void OnNotification(object sender, IApiNotification notification)
    {
        switch (notification.Code)
        {
        case 501:
            var matchReadyState = Utilities.ParseJson <SCReadyState>(notification.Content);
            if (matchReadyState.customMatchId == _context.currentMatchData.value.customMatchId)
            {
                _context.CreateEntity().ReplaceMatchReadyState(matchReadyState);
            }
            break;

        case 502:
            var allocationNinja = Utilities.ParseJson <SCAllocationNinja>(notification.Content);
            _context.ReplaceAllocationNinjaNotification(allocationNinja);
            break;

        case 503:
            var chooseNinja = Utilities.ParseJson <SCChooseNinja>(notification.Content);
            _context.CreateEntity().ReplacePlayerChooseNinjaInfo(chooseNinja.userId, chooseNinja.ninjaName, chooseNinja.confirm);
            break;

        case 504:
            var matchData = Utilities.ParseJson <SCMatchData>(notification.Content);
            _context.ReplaceCurrentMatchData(matchData);
            _context.isMatchStart = true;
            break;

        default:
            break;
        }
    }
        /// <summary>
        /// Shows a notification panel
        /// </summary>
        private void NotifyQuestComplete(IApiNotification e)
        {
            Reward reward = JsonUtility.FromJson <Reward>(e.Content);

            base.Show();
            _titleText.text       = e.Subject;
            _descriptionText.text = "Received reward: " + reward.reward;
        }
 /// <summary>
 /// Handles incomming notification messages.
 /// </summary>
 private void NotificationReceived(IApiNotification e)
 {
     if (e.Code == (int)NotificationCode.Quest_NewFriend)
     {
         Reward reward = JsonUtility.FromJson <Reward>(e.Content);
         base.Show();
         _titleText.text       = e.Subject;
         _descriptionText.text = "Received reward: " + reward.reward;
     }
 }
Beispiel #4
0
 public AuthController(IApiNotification notificador,
                       SignInManager <IdentityUser> signInManager,
                       UserManager <IdentityUser> userManager,
                       IOptions <ApiUserClaimsSettings> appSettings,
                       IApiUser user, ILogger <AuthController> logger) : base(notificador, user)
 {
     _signInManager = signInManager;
     _userManager   = userManager;
     _logger        = logger;
     _appSettings   = appSettings.Value;
 }
Beispiel #5
0
 /// <summary>
 /// Refreshes user list when a member joins or leaves the clan.
 /// Changes tabs to clan search when current clan is disbanded.
 /// </summary>
 private void NotificationReceived(IApiNotification notification)
 {
     if (notification.Code == (int)NotificationCode.Clan_RefreshMembers)
     {
         RefreshClanMenu();
     }
     if (notification.Code == (int)NotificationCode.Clan_Delete)
     {
         OnClanLeft();
     }
 }
Beispiel #6
0
        public RootController(IApiNotification notification,
                              IApiUser appUser)
        {
            _notification = notification;
            AppUser       = appUser;

            if (appUser.IsAuthenticated())
            {
                UserId = appUser.GetUserId();
                IsUserAuthenticated = true;
            }
        }
Beispiel #7
0
        /// <summary>
        /// Refreshes user list when a member joins or leaves the clan.
        /// Changes tabs to clan search when current clan is disbanded.
        /// </summary>
        private void NotificationReceived(IApiNotification notification)
        {
            if (notification.Code == (int)NotificationCode.Clan_RefreshMembers)
            {
                SearchClan();
            }
            if (notification.Code == (int)NotificationCode.Clan_Delete)
            {
                _state.DisplayedClan = null;
                _state.UserClan      = null;
                _state.UserClanRank  = null;

                RefreshUI(_state);
            }
        }
Beispiel #8
0
 private void _socket_OnNotification(object sender, IApiNotification e)
 {
     Debug.Log("Call to socket_OnNotification");
 }
 /// <summary>
 /// Invokes <see cref="OnNotification"/> event.
 /// </summary>
 private void DispatchNotification(IApiNotification notification)
 {
     OnNotification?.Invoke(notification);
 }
 /// <summary>
 /// Invokes <see cref="OnNotification"/> on the main thread.
 /// </summary>
 public void PushLocalNotification(IApiNotification notification)
 {
     UnityMainThreadDispatcher.Instance().Enqueue(() => DispatchNotification(notification));
 }
 /// <summary>
 /// Handles incomming notification messages.
 /// </summary>
 private void NotificationReceived(object sender, IApiNotification notification)
 {
     Debug.Log("Notification received: " + notification.Code);
     PushLocalNotification(notification);
 }