ソースを参照

修改获取bytes方式

“hujiajun” 4 ヶ月 前
コミット
eba4723d66

+ 2 - 2
package/Runtime/MQTT/1.0.0/GHZMQTT/QTTManager.cs

@@ -43,13 +43,13 @@ public class QTTManager
 
     byte[] bytes;
     public Thread th;
-    public void Connect()
+    public void Connect(byte[] tbytes)
     {
         if (isConnecting || isConnect)
         {
             return;
         }
-        bytes = (Resources.Load("emqxsl-ca") as TextAsset).bytes;
+        bytes = tbytes;//
         isConnecting = true;
         ThreadStart ts = new ThreadStart(DoConnect);
         th = new Thread(ts);

+ 11 - 11
package/Runtime/MQTT/1.0.0/GHZMQTT/TestMqttDemo.cs

@@ -23,7 +23,7 @@ public class TestMqttDemo : MonoBehaviour
 
     private void OnConnecting()
     {
-        Debug.Log("MQtt  连接中");
+        Debug.Log("MQtt  锟斤拷锟斤拷锟斤拷");
     }
 
     private void onSucceed()
@@ -34,7 +34,7 @@ public class TestMqttDemo : MonoBehaviour
 
     private void onFaild()
     {
-        Debug.Log("MQtt  连接失败");
+        Debug.Log("MQtt  锟斤拷锟斤拷失锟斤拷");
     }
 
     // Update is called once per frame
@@ -61,12 +61,12 @@ public class TestMqttDemo : MonoBehaviour
     }
 
 
-    //连接
+    //锟斤拷锟斤拷
     public void Connect()
     {
         DisConnect();
         qt = new QTTManager(id, "u@unity1", null, "api-fat1.ghz-tech.com","1883");
-        qt.Connect();
+        qt.Connect((Resources.Load("emqxsl-ca") as TextAsset).bytes);
         qt.ConnectionFailed += onFaild;
         qt.ConnectionSucceeded += onSucceed;
         qt.OnConnecting += OnConnecting;
@@ -76,17 +76,17 @@ public class TestMqttDemo : MonoBehaviour
 
     private void OnClose(EventArgs obj)
     {
-        Debug.Log("断开连接");
+        Debug.Log("锟较匡拷锟斤拷锟斤拷");
     }
 
-    //断开连接
+    //锟较匡拷锟斤拷锟斤拷
     public void DisConnect()
     {
         if (qt != null && qt.IsConnect())
             qt.DisConnect();
 
     }
-    //订阅
+    //锟斤拷锟斤拷
     public void Subscribe()
     {
         ushort s = qt.Subscribe(
@@ -104,16 +104,16 @@ public class TestMqttDemo : MonoBehaviour
 
                         });
     }
-    //发送1
+    //锟斤拷锟斤拷1
     public void send()
     {
         qt.Publish("client/" + rid, Encoding.UTF8.GetBytes("111111111111111"), MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE, false);
-        Debug.Log("MQtt  发送" + rid);
+        Debug.Log("MQtt  锟斤拷锟斤拷" + rid);
     }
-    //发送2
+    //锟斤拷锟斤拷2
     public void send2()
     {
         qt.Publish("client/manage", Encoding.UTF8.GetBytes("111111111111111"), MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE, false);
-        Debug.Log("MQtt  发送manage");
+        Debug.Log("MQtt  锟斤拷锟斤拷manage");
     }
 }