Browse Source

получение имени команды

Rimmon 4 years ago
parent
commit
f6dd72f04a

+ 4 - 3
Assets/Scenes/Player.unity

@@ -38,7 +38,7 @@ RenderSettings:
   m_ReflectionIntensity: 1
   m_CustomReflection: {fileID: 0}
   m_Sun: {fileID: 0}
-  m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
+  m_IndirectSpecularColor: {r: 0.44657844, g: 0.49641222, b: 0.57481694, a: 1}
   m_UseRadianceAmbientProbe: 0
 --- !u!157 &3
 LightmapSettings:
@@ -57938,8 +57938,8 @@ MonoBehaviour:
     m_Alignment: 1
     m_AlignByGeometry: 0
     m_RichText: 1
-    m_HorizontalOverflow: 0
-    m_VerticalOverflow: 0
+    m_HorizontalOverflow: 1
+    m_VerticalOverflow: 1
     m_LineSpacing: 1
   m_Text: 
 --- !u!222 &7150456488137075256
@@ -58161,6 +58161,7 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   SessionCallerId: 0
+  callerName_: {fileID: 0}
   remoteCamImage: {fileID: 0}
 --- !u!114 &7150456488228975576
 MonoBehaviour:

+ 14 - 3
Assets/Scripts/Net/Client.cs

@@ -35,7 +35,7 @@ public class Client : MonoBehaviour
     double last_ping_time = 0;
     static string[] Servers = { "dev.prmsys.net", "localhost", "corp.prmsys.net" };
     static bool ShowPacketsSent = true;
-    static bool printPacketsShort = true;
+    static bool printPacketsShort = false;
     static bool ShowPackets = true; //ставится только в редакторе
     double initial_timer;
     int internal_timer = 0;
@@ -92,7 +92,7 @@ public class Client : MonoBehaviour
         Register(55, ImageReceive);
         Register(57, Location.TextureGetURL);
         Register(58, User.LogInOut, 6);
-        Register(59, RemoteAssistCallCallback, 10);
+        Register(59, RemoteAssistCallCallback);
 
         //set data path
         //if (Application.platform == RuntimePlatform.WindowsWebPlayer ||
@@ -184,7 +184,16 @@ public class Client : MonoBehaviour
                 break;
             case RemoteAssistCMD.SMOPP_TASK_INFO:
                 uint taskId = BitConverter.ToUInt32(bytedata, 10);
-                Debug.Log(taskId);
+                
+                int nameLen = BitConverter.ToInt32(bytedata, 14);
+                string name = Encoding.UTF8.GetString(bytedata, 18, nameLen);
+                Debug.Log("taskId " + taskId + " Команда "+name +" Команда " + name + " name "+name);
+
+                var user = User.Find(remoteScript_.SessionCallerId);
+                if (user != null)
+                    remoteScript_.callerName_.text = $"Звонок от [{ user.id }] { user.name} Проблема с командой: [{taskId}] {name}";
+                else
+                    remoteScript_.callerName_.text = $"Звонок от сотрудника  [ID: { remoteScript_.SessionCallerId }] Проблема с командой: [{taskId}]  {name}";
                 break;
         }
         
@@ -334,6 +343,8 @@ public class Client : MonoBehaviour
         if (!PacketLength.ContainsKey(num))
         {
             var rest = data.Length - offset;
+            //Debug.Log("GetLength rest " + rest+" offset "+ offset);
+            //printBytes(data);
             //packet not full
             if (rest < 5)
                 return 1;

+ 1 - 1
Assets/Scripts/RemoteAssist/RemoteClickAction.cs

@@ -38,7 +38,7 @@ public class RemoteClickAction : MonoBehaviour, IVideoCallSession
     private GameObject callCanvas_;
     private Button answerButton_;
     private Button declineButton_;
-    private Text callerName_;
+    public Text callerName_;
 
     private GameObject onConnectCanvas_;
     private Button drawButton_;