public void SendMethod() { /* * var pk = CGLoginAccount.CreateBuilder(); * pk.Username = "******"; * pk.Password = "******"; */ /* * var ainfo = AvatarInfo.CreateBuilder(); * ainfo.X = 1; * ainfo.Z = 1; */ var cg = CGPlayerCmd.CreateBuilder(); cg.Cmd = "Login"; var data = KBEngine.Bundle.GetPacket(cg); rc.Send(data); }
void SendUserData() { Debug.Log("SendUserData"); if (state != WorldState.Connected) { return; } if (rc == null) { return; } var me = ObjectManager.objectManager.GetMyPlayer(); var pos = me.transform.position; var cg = CGPlayerCmd.CreateBuilder(); cg.Cmd = "InitData"; var ainfo = AvatarInfo.CreateBuilder(); ainfo.X = (int)(pos.x * 100); ainfo.Z = (int)(pos.z * 100); ainfo.Y = (int)(pos.y * 100); var pinfo = ServerData.Instance.playerInfo; foreach (var d in pinfo.DressInfoList) { ainfo.DressInfoList.Add(d); } ainfo.Level = ObjectManager.objectManager.GetMyProp(CharAttribute.CharAttributeEnum.LEVEL); ainfo.HP = ObjectManager.objectManager.GetMyProp(CharAttribute.CharAttributeEnum.HP); cg.AvatarInfo = ainfo.Build(); var data = KBEngine.Bundle.GetPacket(cg); rc.Send(data); }