Пример #1
0
 public static NFCNet Instance()
 {
     if (_instance == null)
     {
         _instance = new NFCNet();
     }
     return(_instance);
 }
Пример #2
0
        public void ConnectServer(string ip, UInt16 port)
        {
            if (NFCNet.Instance().isConnected())
            {
                NFCNet.Instance().shutDown();
            }

            NFCNet.Instance().ready(ip, port);
            NFCNet.Instance().connect();
        }
Пример #3
0
        public void ConnectServer(string ip, UInt16 port)
        {
            if (NFCNet.Instance().isConnected())
            {
                NFCNet.Instance().shutDown();
            }

            if (ip == "127.0.0.1" && port != 14001)
            {
                ip = NFCNet.Instance().ip;
            }

            NFCNet.Instance().ready(ip, port);
            NFCNet.Instance().connect();
        }
Пример #4
0
        public void SendToServerByPB(NFMsg.EGameMsgID unMsgID, MemoryStream stream)
        {
            NFMsg.MsgBase xData = new NFMsg.MsgBase();
            xData.player_id = NFToPB(mOwnerID);
            xData.msg_data  = stream.ToArray();

            MemoryStream body = new MemoryStream();

            Serializer.Serialize <NFMsg.MsgBase>(body, xData);

            MemoryStream pack   = new MemoryStream();
            BinaryWriter writer = new BinaryWriter(pack);
            UInt32       msgLen = (UInt32)body.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE;

            writer.Write(NFCNet.ConvertUint16((UInt16)unMsgID));
            writer.Write(NFCNet.ConvertUint32((UInt32)msgLen));
            body.WriteTo(pack);
            NFCNet.Instance().sendMsg(pack);
        }
Пример #5
0
 public override void Execute()
 {
     NFCNet.Instance().Execute();
 }
Пример #6
0
 public void OnUpdate()
 {
     NFCNet.Instance().doUpdate();
 }
Пример #7
0
 public override bool Execute()
 {
     NFCNet.Instance().doUpdate();
     return(true);
 }