private void OnMatchNotFound(MatchNotFoundMessage m)
 {
     foreach (var l in _onMatchNotFoundListeners)
     {
         l();
     }
 }
예제 #2
0
 /// <summary>
 /// Sends the event match not found.
 /// </summary>
 /// <param name="message">Message.</param>
 public void SendEvent_MatchNotFound(MatchNotFoundMessage message)
 {
     foreach (SparkBehaviour behaviour in ObservedBehaviours)
     {
         behaviour.Call("OnMatchNotFound", message);
     }
 }
예제 #3
0
 /// <summary>
 /// Raises the match not found event.
 /// </summary>
 /// <param name="message">Message.</param>
 private void OnMatchNotFound(MatchNotFoundMessage message)
 {
     foreach (SparkView view in sparkViews)
     {
         view.SendEvent_MatchNotFound(message);
     }
 }
예제 #4
0
 private void MatchNotFound(MatchNotFoundMessage obj)
 {
     if (!matchFailed)
     {
         matchFailed = true;
         print("match failed");
         FakeBotMatch();
     }
 }
 public virtual void OnMatchNotFoundInvoke(MatchNotFoundMessage x)
 {
     if (GameSparksManager.Instance().IsDebug)
     {
         var subs     = OnMatchNotFound?.GetInvocationList();
         var debugStr = "OnMatchNotFound InvokationList: ";
         subs?.ToList().ForEach(m => debugStr += "\n" + m.Method.Name);
         Debug.Log(debugStr);
     }
     OnMatchNotFound?.Invoke(x);
 }
예제 #6
0
 private static void OnMatchNotFound(MatchNotFoundMessage matchNotFoundMessage)
 {
     GameController.Instance.Lobby.OnSearchCancelled();
 }
    private void OnMatchNotFound(MatchNotFoundMessage message)
    {
        Debug.Log("On match not found.");

        status = "Match not found.";
    }
예제 #8
0
    private void OnMessageReceived(object sender, MessageEventArgs e)
    {
        string message = e.Data;

        UnityThreadHelper.Dispatcher.Dispatch(() => {
            if (message.Equals(""))
            {
                Debug.Log("--empty web socket message. maybe ping response");
                return;
            }
            else if (e.RawData.Length == 1)
            {
                stompWebsocketHandler.heartBeaten();
            }
            else if (e.RawData.Length == 2)
            {
                Debug.Log("--received server dc message");
                return;
            }

            String[] splitText = message.Replace("\n\n", "\r").Split("\r".ToCharArray());
            String[] headers   = splitText[0].Split("\n".ToCharArray());

            if (headers[0].Equals("CONNECTED"))
            {
                for (int i = 0; i < headers.Length; i++)
                {
                    if (headers[i].StartsWith("heart-beat"))
                    {
                        String heartBeat = headers[i].Split(":".ToCharArray())[1];
                        stompWebsocketHandler.heartBeatPeriod = Int32.Parse(heartBeat.Split(",".ToCharArray())[1]);
                        if (stompWebsocketHandler.heartBeatPeriod != 0)
                        {
                            stompWebsocketHandler.CheckAlive();
                        }
                        Debug.Log("connectivity heart: " + stompWebsocketHandler.heartBeatPeriod);
                    }
                    else if (headers[i].StartsWith("user-id"))
                    {
                        String userId = headers[i].Split(":".ToCharArray())[1];
                        OnConnected(userId);
                    }
                }
                return;
            }
            else if (headers.Length == 3 && headers[0].Equals("ERROR"))
            {
                Debug.Log("--ERROR: " + headers[1] + " " + headers[2]);
                return;
            }
            else if (splitText.Length == 1)
            {
                // Debug.Log("--unknown at main: " + message);
                return;
            }
            String body    = splitText[1];
            String command = headers[0];
            if (command.Equals("MESSAGE"))
            {
                foreach (String header in headers)
                {
                    String[] splitedHeader = header.Split(":".ToCharArray());
                    if (splitedHeader[0].Equals("delivery-id"))
                    {
                        stompWebsocketHandler.stomp.webSocket.Send("ACK\n" +
                                                                   "X-Backtory-Connectivity-Id:" + connectivityId + "\n" +
                                                                   "delivery-id:" + splitedHeader[1] + "\n" +
                                                                   "\n\0");
                    }
                }

                body = body.Substring(0, body.Length - 1);
                BacktoryRealtimeMessage backtoryRealtimeMessage = (BacktoryRealtimeMessage)
                                                                  fastJSON.JSON.ToObject(body, typeof(BacktoryRealtimeMessage));
                String _class = backtoryRealtimeMessage._type;
                if (_class == null)
                {
                    Debug.Log(message);
                    OnMessage(message);
                }
                else if (_class.Equals(BacktoryConnectivityMessage.CHAT_GROUP_CREATED_MESSAGE))
                {
                    Debug.Log(BacktoryConnectivityMessage.CHAT_GROUP_CREATED_MESSAGE);
                    ChatGroupCreatedMessage chatMessage = (ChatGroupCreatedMessage)
                                                          fastJSON.JSON.ToObject(body, typeof(ChatGroupCreatedMessage));
                    OnChatGroupCreatedMessage(chatMessage);
                }
                else if (_class.Equals(BacktoryConnectivityMessage.CHAT_GROUP_MEMBERS_LIST_MESSAGE))
                {
                    Debug.Log(BacktoryConnectivityMessage.CHAT_GROUP_MEMBERS_LIST_MESSAGE);
                    ChatGroupMembersListMessage listMessage = (ChatGroupMembersListMessage)
                                                              fastJSON.JSON.ToObject(body, typeof(ChatGroupMembersListMessage));
                    OnChatGroupMembersListMessage(listMessage);
                }
                else if (_class.Equals(BacktoryConnectivityMessage.CHAT_GROUPS_LIST_MESSAGE))
                {
                    Debug.Log(BacktoryConnectivityMessage.CHAT_GROUPS_LIST_MESSAGE);
                    ChatGroupsListMessage chatMessage = (ChatGroupsListMessage)
                                                        fastJSON.JSON.ToObject(body, typeof(ChatGroupsListMessage));
                    OnChatGroupsListMessage(chatMessage);
                }
                else if (_class.Equals(BacktoryConnectivityMessage.CHAT_GROUP_OWNER_ADDED_MESSAGE))
                {
                    Debug.Log(BacktoryConnectivityMessage.CHAT_GROUP_OWNER_ADDED_MESSAGE);
                    ChatGroupOwnerAddedMessage addedMessage = (ChatGroupOwnerAddedMessage)
                                                              fastJSON.JSON.ToObject(body, typeof(ChatGroupOwnerAddedMessage));
                    OnChatGroupOwnerAddedMessage(addedMessage);
                }
                else if (_class.Equals(BacktoryConnectivityMessage.CHAT_GROUP_LEFT_MESSAGE))
                {
                    Debug.Log(BacktoryConnectivityMessage.CHAT_GROUP_LEFT_MESSAGE);
                    ChatGroupLeftMessage leftMessage = (ChatGroupLeftMessage)
                                                       fastJSON.JSON.ToObject(body, typeof(ChatGroupLeftMessage));
                    OnChatGroupLeftMessage(leftMessage);
                }
                else if (_class.Equals(BacktoryConnectivityMessage.CHAT_GROUP_INVITED_MESSAGE))
                {
                    Debug.Log(BacktoryConnectivityMessage.CHAT_GROUP_INVITED_MESSAGE);
                    ChatGroupInvitedMessage invitedMessage = (ChatGroupInvitedMessage)
                                                             fastJSON.JSON.ToObject(body, typeof(ChatGroupInvitedMessage));
                    OnChatGroupInvitedMessage(invitedMessage);
                }
                else if (_class.Equals(BacktoryConnectivityMessage.CHAT_GROUP_USER_REMOVED_MESSAGE))
                {
                    Debug.Log(BacktoryConnectivityMessage.CHAT_GROUP_USER_REMOVED_MESSAGE);
                    UserRemovedMessage removedMessage = (UserRemovedMessage)
                                                        fastJSON.JSON.ToObject(body, typeof(UserRemovedMessage));
                    OnChatGroupUserRemovedMessage(removedMessage);
                    sendDelivery(removedMessage.deliveryId);
                }
                else if (_class.Equals(BacktoryConnectivityMessage.CHAT_GROUP_USER_ADDED_MESSAGE))
                {
                    Debug.Log(BacktoryConnectivityMessage.CHAT_GROUP_USER_ADDED_MESSAGE);
                    UserAddedMessage addedMessage = (UserAddedMessage)
                                                    fastJSON.JSON.ToObject(body, typeof(UserAddedMessage));
                    OnChatGroupUserAddedMessage(addedMessage);
                    sendDelivery(addedMessage.deliveryId);
                }
                else if (_class.Equals(BacktoryConnectivityMessage.CHAT_GROUP_USER_JOINED_MESSAGE))
                {
                    Debug.Log(BacktoryConnectivityMessage.CHAT_GROUP_USER_JOINED_MESSAGE);
                    UserJoinedMessage joinedMessage = (UserJoinedMessage)
                                                      fastJSON.JSON.ToObject(body, typeof(UserJoinedMessage));
                    OnChatGroupUserJoinedMessage(joinedMessage);
                    sendDelivery(joinedMessage.deliveryId);
                }
                else if (_class.Equals(BacktoryConnectivityMessage.CHAT_GROUP_USER_LEFT_MESSAGE))
                {
                    Debug.Log(BacktoryConnectivityMessage.CHAT_GROUP_USER_LEFT_MESSAGE);
                    UserLeftMessage leftMessage = (UserLeftMessage)
                                                  fastJSON.JSON.ToObject(body, typeof(UserLeftMessage));
                    OnChatGroupUserLeftMessage(leftMessage);
                    sendDelivery(leftMessage.deliveryId);
                }
                else if (_class.Equals(BacktoryConnectivityMessage.CHAT_GROUP_INVITATION_MESSAGE))
                {
                    Debug.Log(BacktoryConnectivityMessage.CHAT_GROUP_INVITATION_MESSAGE);
                    ChatInvitationMessage invitationMessage = (ChatInvitationMessage)
                                                              fastJSON.JSON.ToObject(body, typeof(ChatInvitationMessage));
                    OnChatInvitationMessage(invitationMessage);
                    sendDelivery(invitationMessage.deliveryId);
                }
                else if (_class.Equals(BacktoryConnectivityMessage.SIMPLE_CHAT_MESSAGE))
                {
                    Debug.Log(BacktoryConnectivityMessage.SIMPLE_CHAT_MESSAGE);
                    SimpleChatMessage simpleMessage = (SimpleChatMessage)
                                                      fastJSON.JSON.ToObject(body, typeof(SimpleChatMessage));
                    onSimpleMessage(simpleMessage);
                    sendDelivery(simpleMessage.deliveryId);
                }
                else if (_class.Equals(BacktoryConnectivityMessage.USER_CHAT_HISTORY_MESSAGE))
                {
                    Debug.Log(BacktoryConnectivityMessage.USER_CHAT_HISTORY_MESSAGE);
                    UserChatHistoryMessage historyMessage = (UserChatHistoryMessage)
                                                            fastJSON.JSON.ToObject(body, typeof(UserChatHistoryMessage));
                    List <ChatMessage> messageList = parseMessageList(historyMessage.messageList, false);
                    OnUserChatHistoryMessage(messageList);
                }
                else if (_class.Equals(BacktoryConnectivityMessage.GROUP_CHAT_HISTORY_MESSAGE))
                {
                    Debug.Log(BacktoryConnectivityMessage.GROUP_CHAT_HISTORY_MESSAGE);
                    GroupChatHistoryMessage historyMessage = (GroupChatHistoryMessage)
                                                             fastJSON.JSON.ToObject(body, typeof(GroupChatHistoryMessage));
                    List <ChatMessage> messageList = parseMessageList(historyMessage.messageList, false);
                    OnGroupChatHistoryMessage(messageList, historyMessage.groupId);
                }
                else if (_class.Equals(BacktoryConnectivityMessage.OFFLINE_CHAT_MESSAGE_LIST))
                {
                    Debug.Log(BacktoryConnectivityMessage.OFFLINE_CHAT_MESSAGE_LIST);
                    OfflineChatMessageList offlineMessageList = (OfflineChatMessageList)
                                                                fastJSON.JSON.ToObject(body, typeof(OfflineChatMessageList));
                    // if (offlineMessageList.messageList.Count == 0) {
                    //     OnEmptyOffline();
                    //     return;
                    // }
                    List <ChatMessage> messageList = parseMessageList(offlineMessageList.messageList, true);
                    OnOfflineChatMessage(messageList);
                }

                else if (_class.Equals(BacktoryConnectivityMessage.EXCEPTION))
                {
                    Debug.Log(BacktoryConnectivityMessage.EXCEPTION);
                    OnException(body);
                }
                else if (_class.Equals(BacktoryConnectivityMessage.MATCHMAKING_CANCELLATION_RESPONSE))
                {
                    Debug.Log(BacktoryConnectivityMessage.MATCHMAKING_CANCELLATION_RESPONSE);
                    MatchmakingCancellationResponseMessage onMatchCancellationResponse = (MatchmakingCancellationResponseMessage)
                                                                                         fastJSON.JSON.ToObject(body, typeof(MatchmakingCancellationResponseMessage));
                    requestList.Remove(onMatchCancellationResponse.requestId);
                    OnMatchCancellationResponse(onMatchCancellationResponse.requestId);
                }
                else if (_class.Equals(BacktoryConnectivityMessage.MATCHMAKING_RESPONSE))
                {
                    Debug.Log(BacktoryConnectivityMessage.MATCHMAKING_RESPONSE);
                    MatchmakingResponseMessage matchMakingResponse = (MatchmakingResponseMessage)
                                                                     fastJSON.JSON.ToObject(body, typeof(MatchmakingResponseMessage));
                    requestList.Add(matchMakingResponse.requestId);
                    if (OnMatchResponse != null)
                    {
                        OnMatchResponse(matchMakingResponse.requestId);
                    }
                    else
                    {
                        Debug.Log("ghalat ast");
                    }
                }
                else if (_class.Equals(BacktoryConnectivityMessage.MATCH_FOUND_MESSAGE))
                {
                    Debug.Log(BacktoryConnectivityMessage.MATCH_FOUND_MESSAGE);
                    MatchFoundMessage matchFoundMessage = (MatchFoundMessage)
                                                          fastJSON.JSON.ToObject(body, typeof(MatchFoundMessage));
                    if (requestList.Contains(matchFoundMessage.requestId))
                    {
                        OnMatchFound(matchFoundMessage);
                    }
                    else
                    {
                        Debug.Log("--Matchmaking for another device of user");
                    }
                }
                else if (_class.Equals(BacktoryConnectivityMessage.MATCH_NOT_FOUND_MESSAGE))
                {
                    Debug.Log(BacktoryConnectivityMessage.MATCH_NOT_FOUND_MESSAGE);
                    MatchNotFoundMessage matchNotFoundMessage = (MatchNotFoundMessage)
                                                                fastJSON.JSON.ToObject(body, typeof(MatchNotFoundMessage));
                    if (requestList.Contains(matchNotFoundMessage.requestId))
                    {
                        OnMatchNotFound(matchNotFoundMessage);
                    }
                    else
                    {
                        Debug.Log("--Matchmaking not found for another device of user");
                    }
                }
                else if (_class.Equals(BacktoryConnectivityMessage.MATCH_UPDATE_MESSAGE))
                {
                    Debug.Log(BacktoryConnectivityMessage.MATCH_UPDATE_MESSAGE);
                    MatchUpdateMessage matchUpdateMessage = (MatchUpdateMessage)
                                                            fastJSON.JSON.ToObject(body, typeof(MatchUpdateMessage));
                    OnMatchUpdate(matchUpdateMessage);
                }
                else
                {
                    OnMessage(body);
                }
            }
            else
            {
                Debug.Log("--received message: " + body);
            }
        });
    }
예제 #9
0
 private void OnMatchNotFound(MatchNotFoundMessage message)
 {
     Debug.Log("OnMatchNotFound");
     MatchNotFoundEvent.Invoke();
 }
예제 #10
0
 private void OnMatchNotFound(MatchNotFoundMessage obj)
 {
     UnblockInput();
     Debug.Log(obj.JSONString);
 }
예제 #11
0
 private void OnMatchNotFound(MatchNotFoundMessage message)
 {
     Debug.Log("No Match Found!");
     UnblockInput();
 }
예제 #12
0
 private void OnMatchFoundFailed(MatchNotFoundMessage message)
 {
     ToggleFindMatch(true);
     m_playerList.text = "Error finding a match";
 }
예제 #13
0
 void OnMatchNotFound(MatchNotFoundMessage message)
 {
     m_txtSearch.text = m_notFoundText;
     Debug.Log("Match not found");
 }
예제 #14
0
 private void MatchNotFound(MatchNotFoundMessage obj)
 {
     print(obj.Errors.BaseData);
 }
예제 #15
0
 private void MatchNotFound(MatchNotFoundMessage message)
 {
 }
예제 #16
0
 public void onMatchNotFound(MatchNotFoundMessage matchNotFoundMessage)
 {
     addToConsole("---Matchmaking with id " +
                  matchNotFoundMessage.requestId + " not found" + " " + matchNotFoundMessage.metaData);
 }
예제 #17
0
 private void OnMatchNotFoundMessage(MatchNotFoundMessage msg)
 {
     FindPlayers();
 }
예제 #18
0
 void OnMatchNotFound(MatchNotFoundMessage message)
 {
     UnblockInput();
     textMatchFindMessage.text = message.JSONString;
 }
예제 #19
0
 void MatchNotFound(MatchNotFoundMessage message)
 {
     OnMatchResult(false);
 }
 public void OnMatchNotFound(MatchNotFoundMessage message)
 {
     writeLine("---match not found with json " + Backtory.ToJson(message, true));
 }