コード例 #1
0
        public IEnumerator sendCoroutine(NetworkInterface networkInterface, uint fId, PacketHolder par)
        {
            fini(true);
            Debug.Log("message Number " + streamList.Count);
            bool resp = false;

            if (networkInterface.valid())
            {
                for (int i = 0; i < streamList.Count; i++)
                {
                    stream = streamList[i];
                    networkInterface.send(stream.getbuffer(), delegate(Packet p) {
                        par.packet = p;
                        resp       = true;
                    }, fId);
                    Log.Sys("SendNetworkSuc");
                }
            }
            else
            {
                Dbg.ERROR_MSG("Bundle::send: networkInterface invalid!");
            }

            streamList.Clear();
            stream = new MemoryStream();

            while (!resp)
            {
                yield return(null);
            }
        }
コード例 #2
0
        public static IEnumerator sendSimple(UnityEngine.MonoBehaviour mo, IBuilderLite build, PacketHolder par)
        {
            var bundle = new Bundle();
            var data   = build.WeakBuild();

            Log.Net("send Simple " + bundle + " " + data);

            /*
             * After Build  builder Clear
             */

            bundle.newMessage(data.GetType());
            var fid = bundle.writePB(data);

            //Log.Net ("Perhaps network not ok");
            yield return(mo.StartCoroutine(bundle.sendCoroutine(KBEngine.KBEngineApp.app.networkInterface(), fid, par)));
        }