rconService.getUsers() will get and parse the userdata
PlayerInfo displays Info and provide a link to steam profile Dropdown in the Playerlist offers more options the selected Player
This commit is contained in:
@@ -4,4 +4,36 @@ app.controller( 'PlayerInfoController', PlayerInfoController );
|
||||
function PlayerInfoController( $scope, rconService, $routeParams )
|
||||
{
|
||||
$scope.userid = $routeParams.userid;
|
||||
|
||||
$scope.info = null;
|
||||
|
||||
$scope.refresh = function ()
|
||||
{
|
||||
rconService.getUsers($scope, function(users) {
|
||||
|
||||
for(var i in users) {
|
||||
if(users[i].SteamID === $scope.userid){
|
||||
|
||||
// set player data
|
||||
$scope.info = users[i];
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// info not found
|
||||
$scope.info = null;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.getUsername = function ()
|
||||
{
|
||||
if($scope.info && $scope.info.DisplayName) {
|
||||
return $scope.info.DisplayName;
|
||||
}
|
||||
|
||||
return $scope.userid;
|
||||
}
|
||||
|
||||
rconService.InstallService( $scope, $scope.refresh )
|
||||
}
|
||||
+3
-3
@@ -3,14 +3,14 @@ app.controller( 'PlayerListController', PlayerListController );
|
||||
|
||||
function PlayerListController( $scope, rconService, $interval )
|
||||
{
|
||||
$scope.Output = new Array();
|
||||
$scope.Output = [];
|
||||
$scope.OrderBy = '-ConnectedSeconds';
|
||||
|
||||
$scope.Refresh = function ()
|
||||
{
|
||||
rconService.Request( "playerlist", $scope, function ( msg )
|
||||
rconService.getUsers($scope, function ( users )
|
||||
{
|
||||
$scope.Players = JSON.parse( msg.Message );
|
||||
$scope.Players = users;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+14
-3
@@ -1,9 +1,9 @@
|
||||
|
||||
function RconService()
|
||||
{
|
||||
var s = {};
|
||||
|
||||
s.Callbacks = {};
|
||||
var s = {
|
||||
Callbacks: {}
|
||||
};
|
||||
|
||||
s.Connect = function ( addr, pass )
|
||||
{
|
||||
@@ -102,5 +102,16 @@ function RconService()
|
||||
}
|
||||
}
|
||||
|
||||
s.getUsers = function(scope, success) {
|
||||
this.Request( "playerlist", scope, function ( response )
|
||||
{
|
||||
var players = JSON.parse( response.Message );
|
||||
|
||||
if(typeof success === 'function') {
|
||||
success.call(scope, players);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
Reference in New Issue
Block a user