Chat works
This commit is contained in:
+7
-9
@@ -7,22 +7,20 @@ function ChatController( $scope, rconService, $timeout )
|
||||
|
||||
$scope.SubmitCommand = function ()
|
||||
{
|
||||
$scope.Output.push( { Message: $scope.Command, Type: 'Command' } );
|
||||
|
||||
rconService.Command( "say " + $scope.Command, 1 );
|
||||
$scope.Command = "";
|
||||
}
|
||||
|
||||
$scope.$on( "OnMessage", function ( event, msg ) { $scope.OnMessage( msg ); } );
|
||||
|
||||
$scope.OnMessage = function( msg )
|
||||
$scope.$on( "OnMessage", function ( event, msg )
|
||||
{
|
||||
if ( msg.Type != "Chat" ) return;
|
||||
|
||||
msg.Class = msg.Type;
|
||||
msg.Message = msg.Message.substr( 7 );
|
||||
$scope.Output.push( msg );
|
||||
$scope.OnMessage( JSON.parse( msg.Message ) );
|
||||
} );
|
||||
|
||||
$scope.OnMessage = function( msg )
|
||||
{
|
||||
$scope.Output.push( msg );
|
||||
$timeout( $scope.ScrollToBottom, 50 );
|
||||
}
|
||||
|
||||
@@ -40,7 +38,7 @@ function ChatController( $scope, rconService, $timeout )
|
||||
{
|
||||
console.log( "GetHistory" );
|
||||
|
||||
rconService.Request( "console.tail 4096", $scope, function ( msg )
|
||||
rconService.Request( "chat.tail 512", $scope, function ( msg )
|
||||
{
|
||||
var messages = JSON.parse( msg.Message );
|
||||
|
||||
|
||||
+7
-2
@@ -17,8 +17,13 @@ function ConsoleController( $scope, rconService, $timeout )
|
||||
|
||||
$scope.OnMessage = function( msg )
|
||||
{
|
||||
|
||||
if ( msg.Message.startsWith( "[rcon] " ) ) return;
|
||||
if ( msg.Type != "Message" && msg.Type != "Error" && msg.Type != "Warning" ) return;
|
||||
if ( msg.Type != "Generic" && msg.Type != "Log" && msg.Type != "Error" && msg.Type != "Warning" )
|
||||
{
|
||||
console.log( msg );
|
||||
return;
|
||||
}
|
||||
|
||||
msg.Class = msg.Type;
|
||||
$scope.Output.push( msg );
|
||||
@@ -40,7 +45,7 @@ function ConsoleController( $scope, rconService, $timeout )
|
||||
{
|
||||
console.log( "GetHistory" );
|
||||
|
||||
rconService.Request( "chat.tail 128", $scope, function ( msg )
|
||||
rconService.Request( "console.tail 128", $scope, function ( msg )
|
||||
{
|
||||
var messages = JSON.parse( msg.Message );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user