public ClientData(IPEndPoint ep, byte[] byt) { //构造函数 IP = ep.Address; Port = ep.Port; ID = BitConverter.ToInt32(byt, 5); Type = (CLIENT_TYPE)(BitConverter.ToInt32(byt, 9)); Data = new byte[byt.Length - 14]; Buffer.BlockCopy(byt, 13, Data, 0, byt.Length - 14); }
public void CreateGameStart() { //开始游戏 Type = CLIENT_TYPE.SEND; Data = new byte[4]; int index = 0; GlobalC.AddSendData_Int((int)(CLIENT_DATA_TYPE.GAME_START), Data, ref index); }
public void CreateChangePlayerType(int type) { //修改角色 Type = CLIENT_TYPE.SEND; Data = new byte[8]; int index = 0; GlobalC.AddSendData_Int((int)(CLIENT_DATA_TYPE.CHANGE_PLAYER_TYPE), Data, ref index); GlobalC.AddSendData_Int(type, Data, ref index); }
public void CreateChangeDelay(int delay) { //修改延迟 Type = CLIENT_TYPE.SEND; Data = new byte[8]; int index = 0; GlobalC.AddSendData_Int((int)(CLIENT_DATA_TYPE.CHANGE_DELAY), Data, ref index); GlobalC.AddSendData_Int(delay, Data, ref index); }
public void CreateTeamChange(int TeamIndex) { //选择地图信息 Type = CLIENT_TYPE.SEND; Data = new byte[8]; int index = 0; GlobalC.AddSendData_Int((int)(CLIENT_DATA_TYPE.TEAM_CHANGE), Data, ref index); GlobalC.AddSendData_Int(TeamIndex, Data, ref index); }
public void CreateDelPlayer(int sit) { //玩家退出 Type = CLIENT_TYPE.SEND; Data = new byte[8]; int index = 0; GlobalC.AddSendData_Int((int)(CLIENT_DATA_TYPE.DEL_PLAYER), Data, ref index); GlobalC.AddSendData_Int(sit, Data, ref index); }
public void CreateMapChange(int mapIndex) { //选择地图信息 Type = CLIENT_TYPE.SEND; Data = new byte[8]; int index = 0; GlobalC.AddSendData_Int((int)(CLIENT_DATA_TYPE.MAP_CHANGE), Data, ref index); GlobalC.AddSendData_Int(mapIndex, Data, ref index); }
public void CreateChangeRoomPrep(bool IsWS, bool Isfree) { //改变房间属性 Type = CLIENT_TYPE.SEND; Data = new byte[6]; int index = 0; GlobalC.AddSendData_Int((int)(CLIENT_DATA_TYPE.CHANGE_ROOM_PREP), Data, ref index); GlobalC.AddSendData_Bool(IsWS, Data, ref index); GlobalC.AddSendData_Bool(Isfree, Data, ref index); }
public void CreateInput(byte[] byt, int sit) { //键盘输入(服务端) Type = CLIENT_TYPE.SEND; Data = new byte[21]; int index = 0; GlobalC.AddSendData_Int((int)(CLIENT_DATA_TYPE.INPUT), Data, ref index); GlobalC.AddSendData_Int(sit, Data, ref index); System.Buffer.BlockCopy(byt, 4, Data, 8, 13); }
public void CreateSignIn(string qq, string exid) { //转变为登录信息 int len = (qq.Length + exid.Length) * 2 + 8 + 4; Type = CLIENT_TYPE.SEND_ONCE; Data = new byte[len]; int index = 0; GlobalC.AddSendData_Int((int)(CLIENT_DATA_TYPE.SIGN_IN), Data, ref index); GlobalC.AddSendData_Str(qq, Data, ref index); GlobalC.AddSendData_Str(exid, Data, ref index); }
public void CreateImpulse() { //转变为脉冲信号 Type = CLIENT_TYPE.IMPULSE; //数据类型+当前时间 Data = new byte[8]; Buffer.BlockCopy(BitConverter.GetBytes((int)(CLIENT_DATA_TYPE.IMPULSE)), 0, Data, 0, 4); var time = DateTime.Now; int dataTime = (time.Minute * 60000) + (time.Second * 1000) + (time.Millisecond); Buffer.BlockCopy(BitConverter.GetBytes(dataTime), 0, Data, 4, 4); }
public void CreateInput(int time, bool[] dat) { //键盘输入(客户端) Type = CLIENT_TYPE.SEND; Data = new byte[17]; int index = 0; GlobalC.AddSendData_Int((int)(CLIENT_DATA_TYPE.INPUT), Data, ref index); GlobalC.AddSendData_Int(time, Data, ref index); for (int i = 0; i < 9; i++) { GlobalC.AddSendData_Bool(dat[i], Data, ref index); } }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { CLIENT_TYPE clientType = ( CLIENT_TYPE )value; switch (clientType) { case CLIENT_TYPE.Individual: return("个体用户"); case CLIENT_TYPE.Institutional: return("机构用户"); default: return(""); } }
public ClientInfo(Object client, CLIENT_TYPE type) { this.client = client; this.type = type; this.passPhrase = "undefined"; }
public void CreateImpulseRecv() { //转变为脉冲信号回复 Type = CLIENT_TYPE.IMPULSE_RECV; }