private void onBtnEnterClick() { //Debug.Log("选中了角色:" + _selectRoleIndex); //发送一个选中角色消息 SelectRoleCmd cmd = new SelectRoleCmd() { index = _selectRoleIndex }; Net.instance.SendCmd(cmd); }
internal static void OnSelectRole(Cmd cmd) { if (!Net.CheckCmd(cmd, typeof(SelectRoleCmd))) { return; } SelectRoleCmd selectRoleCmd = cmd as SelectRoleCmd; var curPlayer = Server.instance.curPlayer; var curRole = Server.instance.curPlayer.allRole[selectRoleCmd.index]; curPlayer.curRole = curRole; var roleTableData = RoleTable.instance[curRole.modelId]; curRole.name = roleTableData.name; curRole.hp = roleTableData.hp; curRole.attack = roleTableData.attack; curRole.defence = roleTableData.defence; //告诉客户端,场景编号 //分配ThisId var thisId = RoleServer.getNewThisId(); curPlayer.curRole.thisID = thisId; //告诉客户端主角的Thisid MainRoleThisIdCmd thisIdCmd = new MainRoleThisIdCmd() { thisId = thisId }; Server.instance.SendCmd(thisIdCmd); //进入场景(原来的函数是没有MapId,或许这部分的代码应该另写) EnterMap(curRole, 1); }