コード例 #1
0
    public void Btn_SendStep()
    {
        string      strTime = DateTime.Now.ToLongTimeString();
        int         intTime = (int)DateTime.Now.Second;
        XXFrameData fd      = new XXFrameData();

        fd.strData = strTime;
        fd.intData = intTime;

        SendFramePara para = new SendFramePara()
        {
            Data = fd.ToString(),
        };

        paintRoom.SendFrame(para, eve =>
        {
            if (eve.Code == 0)
            {
                AppendTxt("发送帧同步成功\r\n");
            }
            else
            {
                AppendTxt("发送帧同步失败\r\n");
            }
        });
    }
コード例 #2
0
 public override void LateUpdate()
 {
     base.LateUpdate();
     if (connect)
     {
         XXFrameData fd = new XXFrameData();
         fd.strData = GeneralData();
         fd.intData = (int)UserManager.instance.UType;
         SendFramePara para = new SendFramePara()
         {
             Data = fd.ToString(),
         };
         try
         {
             paintRoom.SendFrame(para, eve =>
             {
                 /* if (eve.Code == 0)
                  *   AppendTxt("发送帧同步成功\r\n");
                  * else
                  *   AppendTxt("发送帧同步失败\r\n");*/
             });
         }
         catch (Exception e) { }
     }
 }
コード例 #3
0
    public override void LateUpdate()
    {
        base.LateUpdate();

        //    if (!startTrans)
        //         return;
        //            print("每2帧执行一次");
        if (connect)// && /*Time.frameCount % 5 == 0 &&*/ paintCanvas2.PosUpdate)
        {
            foreach (string pName in paintCanvasDic.Keys)
            {
                JsonData jsonData = new JsonData();
                jsonData["mark"] = pName;
                JsonData ctrlData = new JsonData();
                JsonData nrl      = paintCanvasDic[pName].GetSendData();
                if (nrl != null)
                {
                    ctrlData["nrl"] = nrl;
                }
                JsonData ctrl = paintCanvasDic[pName].GetCtrlData();
                if (ctrl != null)
                {
                    ctrlData["ctrl"] = ctrl;
                }
                if (ctrlData.IsObject)
                {
                    jsonData["ctrl-data"] = ctrlData;
                }
                string sendData = jsonData.ToJson();
                //                Debug.Log(sendData);
                try
                {
                    if (sendData != null)
                    {
                        XXFrameData fd = new XXFrameData();
                        fd.strData = sendData;
                        fd.intData = (int)UserManager.instance.UType;
                        SendFramePara para = new SendFramePara()
                        {
                            Data = fd.ToString(),
                        };
                        paintRoom.SendFrame(para, eve =>
                        {
                            if (eve.Code == 0)
                            {
                                //                                Debug.Log("发送帧同步成功\r\n");
                                //  AppendTxt("发送帧同步成功\r\n");
                            }

                            else
                            {
                                //  if (ToastManager.instance)
                                //      ToastManager.instance.AddToast(ToastType.Error, "发送帧同步失败\r\n");
                                //   Debug.Log("发送帧同步失败\r\n");
                                //    AppendTxt("发送帧同步失败\r\n");
                            }
                        });
                    }
                }
                catch (Exception e) { }
            }
        }
    }