Răsfoiți Sursa

small update

Arnis Lielturks 7 ani în urmă
părinte
comite
325f2b6a2b

+ 3 - 0
Source/Samples/54_P2PMultiplayer/P2PMultiplayer.cpp

@@ -49,6 +49,7 @@
 #include <Urho3D/UI/Text.h>
 #include <Urho3D/UI/Text.h>
 #include <Urho3D/UI/Text3D.h>
 #include <Urho3D/UI/Text3D.h>
 #include <Urho3D/UI/UI.h>
 #include <Urho3D/UI/UI.h>
+#include <Urho3D/UI/MessageBox.h>
 #include <Urho3D/UI/UIEvents.h>
 #include <Urho3D/UI/UIEvents.h>
 #include <Urho3D/Core/CoreEvents.h>
 #include <Urho3D/Core/CoreEvents.h>
 
 
@@ -332,10 +333,12 @@ void P2PMultiplayer::HandleUpdate(StringHash eventType, VariantMap& eventData)
 
 
                     if (val.IsNull()) {
                     if (val.IsNull()) {
                         URHO3D_LOGWARNING("No active sessions, starting new one");
                         URHO3D_LOGWARNING("No active sessions, starting new one");
+                        new MessageBox(context_, "Creating new P2P session", "No active sessions");
                         StartSession();
                         StartSession();
                     }
                     }
                     else {
                     else {
                         URHO3D_LOGWARNING("Found incomplete session, joining it");
                         URHO3D_LOGWARNING("Found incomplete session, joining it");
+                        new MessageBox(context_, "Joining other p2p session: " + val.GetString(), "Incomplete session found");
                         JoinSession(val.GetString());
                         JoinSession(val.GetString());
                     }
                     }
                 } else if (url.Contains(API_NEW_SESSION)) {
                 } else if (url.Contains(API_NEW_SESSION)) {

+ 6 - 11
Source/Urho3D/Network/Network.cpp

@@ -1084,32 +1084,27 @@ void Network::HandleIncomingPacket(SLNet::Packet* packet, bool isServer)
     }
     }
     else if (packetID == ID_READY_EVENT_SET)
     else if (packetID == ID_READY_EVENT_SET)
     {
     {
-        URHO3D_LOGWARNINGF("Got ID_READY_EVENT_SET from %s", packet->guid.ToString());
         ReadyStatusChanged();
         ReadyStatusChanged();
         packetHandled = true;
         packetHandled = true;
     }
     }
     else if (packetID == ID_READY_EVENT_UNSET)
     else if (packetID == ID_READY_EVENT_UNSET)
     {
     {
         ReadyStatusChanged();
         ReadyStatusChanged();
-        URHO3D_LOGWARNINGF("Got ID_READY_EVENT_UNSET from %s", packet->guid.ToString());
         packetHandled = true;
         packetHandled = true;
     }
     }
     else if (packetID == ID_READY_EVENT_ALL_SET)
     else if (packetID == ID_READY_EVENT_ALL_SET)
     {
     {
         ReadyStatusChanged();
         ReadyStatusChanged();
-        URHO3D_LOGWARNINGF("ID_READY_EVENT_ALL_SET from %s", packet->guid.ToString());
         packetHandled = true;
         packetHandled = true;
     }
     }
     else if (packetID == ID_READY_EVENT_QUERY)
     else if (packetID == ID_READY_EVENT_QUERY)
     {
     {
         ReadyStatusChanged();
         ReadyStatusChanged();
-        URHO3D_LOGINFOF("Got ID_READY_EVENT_QUERY from %s", packet->guid.ToString());
         packetHandled = true;
         packetHandled = true;
     }
     }
     else if (packetID == ID_READY_EVENT_FORCE_ALL_SET)
     else if (packetID == ID_READY_EVENT_FORCE_ALL_SET)
     {
     {
         ReadyStatusChanged();
         ReadyStatusChanged();
-        URHO3D_LOGINFOF("Got ID_READY_EVENT_FORCE_ALL_SET from %s", packet->guid.ToString());
         packetHandled = true;
         packetHandled = true;
     }
     }
     else if (packetID == ID_UNCONNECTED_PONG) // Host discovery response
     else if (packetID == ID_UNCONNECTED_PONG) // Host discovery response
@@ -1222,12 +1217,12 @@ void Network::HandleIncomingPacket(SLNet::Packet* packet, bool isServer)
     }
     }
     else if (packetID == ID_FCM2_VERIFIED_JOIN_ACCEPTED)
     else if (packetID == ID_FCM2_VERIFIED_JOIN_ACCEPTED)
     {
     {
-        DataStructures::List<SLNet::RakNetGUID> systemsAccepted;
-        bool thisSystemAccepted;
+//        DataStructures::List<SLNet::RakNetGUID> systemsAccepted;
+//        bool thisSystemAccepted;
 //        fullyConnectedMesh2_->GetVerifiedJoinAcceptedAdditionalData(packet, &thisSystemAccepted, systemsAccepted, nullptr);
 //        fullyConnectedMesh2_->GetVerifiedJoinAcceptedAdditionalData(packet, &thisSystemAccepted, systemsAccepted, nullptr);
-        if (thisSystemAccepted) {
-            URHO3D_LOGINFO("Game join request accepted");
-        }
+//        if (thisSystemAccepted) {
+//            URHO3D_LOGINFO("Game join request accepted");
+//        }
         URHO3D_LOGINFO("ID_FCM2_VERIFIED_JOIN_ACCEPTED");
         URHO3D_LOGINFO("ID_FCM2_VERIFIED_JOIN_ACCEPTED");
         packetHandled = true;
         packetHandled = true;
     }
     }
@@ -1612,7 +1607,7 @@ bool Network::IsHostSystem()
     return fullyConnectedMesh2_->IsHostSystem();
     return fullyConnectedMesh2_->IsHostSystem();
 }
 }
 
 
-String Network::GetHostAddress()
+const String Network::GetHostAddress()
 {
 {
     if (networkMode_ == SERVER_CLIENT) {
     if (networkMode_ == SERVER_CLIENT) {
         return rakPeer_->GetMyGUID().ToString();
         return rakPeer_->GetMyGUID().ToString();

+ 1 - 1
Source/Urho3D/Network/Network.h

@@ -86,7 +86,7 @@ public:
     /// Are we the host system in P2P session
     /// Are we the host system in P2P session
     bool IsHostSystem();
     bool IsHostSystem();
     /// Get host GUID
     /// Get host GUID
-    String GetHostAddress();
+    const String GetHostAddress();
     /// Let other peers know about our readiness
     /// Let other peers know about our readiness
     void SetReady(bool value);
     void SetReady(bool value);
     /// Get current ready status
     /// Get current ready status