public IntPtr getStartData(double _time, int _sumplayers) { starting.spawnid = spawnarea; starting.sumplayer = (uint)_sumplayers; Mrs.MRS_LOG_DEBUG("getStartData Spawn:{0} countPlayer:{1}", String.Join(", ", starting.spawnid), starting.sumplayer); IntPtr data = Marshal.AllocHGlobal(Marshal.SizeOf(starting)); Marshal.StructureToPtr(starting, data, false); return(data); }
// レコードのパース private static void ParseRecord(MrsConnection connection, IntPtr connection_data, UInt32 seqnum, UInt16 options, UInt16 payload_type, IntPtr _payload, UInt32 payload_len) { Mrs.MRS_LOG_DEBUG("ParseRecord seqnum=0x{0} options=0x{1:X2} payload={2:X}/{3}", seqnum, options, payload_type, payload_len); // MRS_PAYLOAD_TYPE_BEGIN - MRS_PAYLOAD_TYPE_ENDの範囲内で任意のIDを定義し、対応するアプリケーションコードを記述する switch (payload_type) { case 0x01: break; default: break; } }
// プレイヤー情報の格納 public IntPtr setProfile(IntPtr _data, int _num) { S_DataProfile getdata = (S_DataProfile)Marshal.PtrToStructure(_data, typeof(S_DataProfile)); profile[_num].name = getdata.name; profile[_num].player_id = _num; Mrs.MRS_LOG_DEBUG("setProfile ID:{0}", profile[_num].player_id); IntPtr p_data = Marshal.AllocHGlobal(Marshal.SizeOf(profile[_num])); Marshal.StructureToPtr(profile[_num], p_data, false); return(p_data); }