Chat works
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
<div ng-controller="ChatController" id="ChatController">
|
<div ng-controller="ChatController" id="ChatController">
|
||||||
|
|
||||||
<div id="vertical-container" style="height: 600px" class="Output scrollable"><div ng-repeat="line in Output" ng-class="line.Class">{{line.Message}}</div></div>
|
<div id="vertical-container" style="height: 600px" class="Output scrollable"><div ng-repeat="line in Output" ng-class="line.Class"><span class="chatname"><a href="#/{{address}}/player/{{line.UserId}}/" style="color: {{line.Color}}">{{line.Username}}</a>:</span> {{line.Message}}</div></div>
|
||||||
|
|
||||||
<form ng-submit="SubmitCommand()" class="md-inline-form">
|
<form ng-submit="SubmitCommand()" class="md-inline-form">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
+7
-9
@@ -7,22 +7,20 @@ function ChatController( $scope, rconService, $timeout )
|
|||||||
|
|
||||||
$scope.SubmitCommand = function ()
|
$scope.SubmitCommand = function ()
|
||||||
{
|
{
|
||||||
$scope.Output.push( { Message: $scope.Command, Type: 'Command' } );
|
|
||||||
|
|
||||||
rconService.Command( "say " + $scope.Command, 1 );
|
rconService.Command( "say " + $scope.Command, 1 );
|
||||||
$scope.Command = "";
|
$scope.Command = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.$on( "OnMessage", function ( event, msg ) { $scope.OnMessage( msg ); } );
|
$scope.$on( "OnMessage", function ( event, msg )
|
||||||
|
|
||||||
$scope.OnMessage = function( msg )
|
|
||||||
{
|
{
|
||||||
if ( msg.Type != "Chat" ) return;
|
if ( msg.Type != "Chat" ) return;
|
||||||
|
|
||||||
msg.Class = msg.Type;
|
$scope.OnMessage( JSON.parse( msg.Message ) );
|
||||||
msg.Message = msg.Message.substr( 7 );
|
} );
|
||||||
$scope.Output.push( msg );
|
|
||||||
|
|
||||||
|
$scope.OnMessage = function( msg )
|
||||||
|
{
|
||||||
|
$scope.Output.push( msg );
|
||||||
$timeout( $scope.ScrollToBottom, 50 );
|
$timeout( $scope.ScrollToBottom, 50 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +38,7 @@ function ChatController( $scope, rconService, $timeout )
|
|||||||
{
|
{
|
||||||
console.log( "GetHistory" );
|
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 );
|
var messages = JSON.parse( msg.Message );
|
||||||
|
|
||||||
|
|||||||
+7
-2
@@ -17,8 +17,13 @@ function ConsoleController( $scope, rconService, $timeout )
|
|||||||
|
|
||||||
$scope.OnMessage = function( msg )
|
$scope.OnMessage = function( msg )
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( msg.Message.startsWith( "[rcon] " ) ) return;
|
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;
|
msg.Class = msg.Type;
|
||||||
$scope.Output.push( msg );
|
$scope.Output.push( msg );
|
||||||
@@ -40,7 +45,7 @@ function ConsoleController( $scope, rconService, $timeout )
|
|||||||
{
|
{
|
||||||
console.log( "GetHistory" );
|
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 );
|
var messages = JSON.parse( msg.Message );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user