public static void StartGame(ProtocolBase protocol) { int start = 0; ProtocolBytes proto = (ProtocolBytes)protocol; proto.GetNameX(start, ref start); Client.Instance.pl_info.id_game = proto.GetByte(start, ref start); //Loading GameCtrl.Instance.StartLoadingGameScene(); }
public static void Chatting(ProtocolBase protocol) { int start = 0; ProtocolBytes proto = (ProtocolBytes)protocol; proto.GetNameX(start, ref start); string str; Debug.Log(str = proto.GetString(start, ref start)); ClientLauncher.Instance.message = str; }
public static void SyncMouseButton0Up(ProtocolBase protocol) { int start = 0; ProtocolBytes proto = (ProtocolBytes)protocol; proto.GetNameX(start, ref start); long instant = proto.GetInt(start, ref start); int id = proto.GetByte(start, ref start); Unit unit = Gamef.GetUnit(id); unit.SyncPlayerInput.SyncMouseButton0Up(instant); }
public static void SyncMP(ProtocolBase protocol) { int start = 0; ProtocolBytes proto = (ProtocolBytes)protocol; proto.GetNameX(start, ref start); long instant = proto.GetInt(start, ref start); int id = proto.GetByte(start, ref start); Unit unit = Gamef.GetUnit(id); float val = proto.GetFloat(start, ref start); unit.SyncUnitState.SyncMP(instant, val); }
public static void SyncStop(ProtocolBase protocol) { int start = 0; ProtocolBytes proto = (ProtocolBytes)protocol; proto.GetNameX(start, ref start); long instant = proto.GetInt(start, ref start); int id = proto.GetByte(start, ref start); int skillIndex = proto.GetByte(start, ref start); Unit unit = Gamef.GetUnit(id); unit.SyncPlayerCastingState.SyncStop(instant, skillIndex); }
public static void DestroyObj(ProtocolBase protocol) { int start = 0; ProtocolBytes proto = (ProtocolBytes)protocol; proto.GetNameX(start, ref start); long instant = proto.GetInt(start, ref start); int id = proto.GetByte(start, ref start); Unit unit = Gamef.GetUnit(id); //Destroy the object. unit.Death(); }
public static void SyncTransform(ProtocolBase protocol) { int start = 0; ProtocolBytes proto = (ProtocolBytes)protocol; proto.GetNameX(start, ref start); long instant = proto.GetInt(start, ref start); int id = proto.GetByte(start, ref start); Unit unit = Gamef.GetUnit(id); Vector3 position = ParseVector3(proto, ref start); Quaternion rot = ParseQuaternion(proto, ref start); float speed = proto.GetFloat(start, ref start); unit.SyncMovement.SyncTransform(instant, position, rot, speed); }
public static void SyncMobileControlAxes(ProtocolBase protocol) { int start = 0; ProtocolBytes proto = (ProtocolBytes)protocol; proto.GetNameX(start, ref start); long instant = proto.GetInt(start, ref start); //parse instant int id = proto.GetByte(start, ref start); //parse id int[] hv = ParseHaV(proto.GetByte(start, ref start)); //parse h and v Vector3 fwd = ParseVector3(proto, ref start); // parse camera forward Unit unit = Gamef.GetUnit(id); unit.SyncPlayerInput.SyncMobileControlAxes(instant, hv[0], hv[1], fwd); }
public static void SyncAimTarget(ProtocolBase protocol) { int start = 0; ProtocolBytes proto = (ProtocolBytes)protocol; proto.GetNameX(start, ref start); long instant = proto.GetInt(start, ref start); int sourceId = proto.GetByte(start, ref start); int targetId = proto.GetByte(start, ref start); if (targetId == 255) { targetId = -1; } Unit unit = Gamef.GetUnit(sourceId); Debug.Log(string.Format("Send sync target ID {0} -> ID {1}", sourceId, targetId)); unit.SyncPlayerCastingState.SyncTarget(instant, Gamef.GetUnit(targetId)); }
//public void Logout(ProtocolBase protocol){} public static void Register(ProtocolBase protocol) { int start = 0; ProtocolBytes proto = (ProtocolBytes)protocol; proto.GetNameX(start, ref start); int ispass = proto.GetByte(start, ref start); if (ispass == 1) { //int id = proto.GetByte(start, ref start); Debug.Log("Reg success"); //Login } else { Debug.Log("Reg failed"); //Login failed } }
public static void Login(ProtocolBase protocol) { int start = 0; ProtocolBytes proto = (ProtocolBytes)protocol; proto.GetNameX(start, ref start); int ispass = proto.GetByte(start, ref start); if (ispass == 1) { Debug.Log("Login success"); Client.Instance.pl_info.isLogin = true; //Login //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DataSync.Match(); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } else { Debug.Log("Login failed"); //Login failed } }
public static bool CRC16(ProtocolBytes protocol) { return(CRC16(protocol.bytes)); }