protected virtual NeutronPlayer[] OnCustomMatchmakingTo(NeutronPlayer player, MatchmakingTo matchmakingTo) { switch (matchmakingTo) { default: LogHelper.Error("Broadcast Packet not implemented! " + matchmakingTo); return(null); } }
private async void Internal_OnPlayerJoinedRoom(NeutronPlayer player, NeutronRoom room) { await NeutronSchedule.ScheduleTaskAsync(() => { MakeRoomContainer(room); }); OnPlayerJoinedRoom(player, room); }
/// <summary> ///* Envia o estado da autenticação ao seu usuário. /// </summary> /// <param name="user">* O usuário a ser autenticado.</param> /// <param name="authStatus">* O estado da autenticação</param> /// <returns></returns> protected bool OnAuth(NeutronPlayer user, bool authStatus) { user.Properties = string.IsNullOrEmpty(user.Properties) ? "{\"Neutron\":\"Neutron\"}" : user.Properties; using (NeutronStream stream = Neutron.PooledNetworkStreams.Pull()) { NeutronStream.IWriter writer = stream.Writer; writer.WritePacket((byte)Packet.AuthStatus); writer.Write(user.Properties); writer.Write(authStatus); user.Write(writer); } return(authStatus); }
private void MakeVirtualOwner(INeutronMatchmaking matchmaking, NeutronChannel channel, NeutronRoom room) { if (matchmaking.Owner != null) { LogHelper.Error("Matchmaking already has an owner!"); } else { //* Não pode aproveitar o Neutron.Server.Player? não, não podemos compartilhar a mesma instância pra vários matchmaking, um jogador só pode está em um Matchmaking ao mesmo tempo. NeutronPlayer player = PlayerHelper.MakeTheServerPlayer(); player.Channel = channel; player.Room = room; player.Matchmaking = MatchmakingHelper.Matchmaking(player); matchmaking.Owner = player; //! reforço: um jogador só pode está em um Matchmaking ao mesmo tempo. } }
protected virtual void OnCustomTarget(NeutronPlayer player, NeutronPacket packet, TargetTo targetTo, NeutronPlayer[] players) { throw new NotImplementedException("Ué cara???"); }
protected virtual void OnPlayerLeftRoom(NeutronPlayer player) { }
protected virtual async Task <bool> OnAuthentication(NeutronPlayer player, Authentication authentication) { return(await Task.Run(() => true)); }
#pragma warning disable UNT0006 protected virtual void OnPlayerConnected(NeutronPlayer player) #pragma warning restore UNT0006 { }
protected virtual void OnPlayerConnected(NeutronPlayer player, bool isMine, Neutron neutron) { }
protected virtual void OnRoomPropertiesChanged(NeutronPlayer player, string properties, bool isMine, Neutron neutron) { }
protected virtual void OnPlayerJoinedChannel(NeutronChannel channel, NeutronPlayer player, bool isMine, Neutron neutron) { }
protected virtual void OnPlayerCustomPacketReceived(NeutronStream.IReader reader, NeutronPlayer player, byte packetId, Neutron neutron) { }
#pragma warning disable UNT0006 protected virtual void OnPlayerDisconnected(NeutronPlayer player) #pragma warning restore UNT0006 { LogHelper.Info($"The Player [{player.StateObject.TcpRemoteEndPoint}] Has been disconnected from server."); }
protected virtual bool OnPlayerNicknameChanged(NeutronPlayer player, string nickname) { return(true); }
protected virtual bool OnPlayerPropertiesChanged(NeutronPlayer player, string properties) { return(true); }
protected virtual bool OnPlayerCreatedRoom(NeutronPlayer player, NeutronRoom room) { return(true); }
protected virtual void OnCheatDetected(NeutronPlayer player, string name) { LogHelper.Info($"Usando hack porraaaaaaaa -> {player.Nickname}"); }
protected virtual void OnPlayerNicknameChanged(NeutronPlayer player, string nickname, bool isMine, Neutron neutron) { }
protected virtual void OnPlayerJoinedRoom(NeutronPlayer player, NeutronRoom room) { }
protected virtual void OnPlayerDisconnected(string reason, NeutronPlayer player, bool isMine, Neutron neutron) { }
protected virtual void OnPlayerLeftChannel(NeutronPlayer player) { }
protected virtual void OnPlayerCreatedRoom(NeutronRoom room, NeutronPlayer player, bool isMine, Neutron neutron) { }
protected virtual void OnPlayerJoinedChannel(NeutronPlayer player) { }
protected virtual void OnMessageReceived(string message, NeutronPlayer player, bool isMine, Neutron neutron) { }
protected virtual void OnPlayerDestroyed(NeutronPlayer player) { }
/// <summary> ///* Ends a gRPC(Global Remote Procedure Call) service call.<br/> ///* (from server-side) use this overload to send from server to client. /// </summary> /// <param name="id">The id of the gRPC service.</param> /// <param name="parameters">The parameters that will be sent with the service.</param> /// <param name="protocol">The protocol used to send the service.</param> /// <param name="player">The player that will send the service.</param> public void End_gRPC(byte id, NeutronStream parameters, Protocol protocol, NeutronPlayer player) { Server.End_gRPC(id, parameters, protocol, player); }
protected virtual bool OnMessageReceived(NeutronPlayer player, string message) { return(true); }