API:LabelGetText
Aus WARWiki
Keine Beschreibung verfügbar.
Nutzung
API:LabelGetText()
Diese Funktion übernimmt keine Argumente.
Diese Funktion gibt keine Werte zurück.
Source Code
-- This function is used as the comparison function for
-- table.sort() on the player display order
local function ComparePlayers( index1, index2 )
if( index2 == nil ) then
return false
end
local player1 = SocialWindowTabParty.playerListData[index1]
local player2 = SocialWindowTabParty.playerListData[index2]
if (player1 == nil or player1.name == nil or player1.name == L"") then
return false
end
if (player2 == nil or player2.name == nil or player2.name == L"") then
return true
end
local type = SocialWindowTabParty.display.type
local order = SocialWindowTabParty.display.order
local compareResult
-- Check for sorting by all the the string fields first
-- Sorting by Name
if( type == SocialWindowTabParty.SORT_TYPE_NAME )then
if( order == SocialWindowTabParty.SORT_ORDER_UP ) then
return ( WStringsCompare(player1.name, player2.name) < 0 )
else
return ( WStringsCompare(player1.name, player2.name) > 0 )
end
end
--Sorting By Career (And if they match, then sort alphabetically)
if( type == SocialWindowTabParty.SORT_TYPE_CAREER ) then
compareResult = WStringsCompare(player1.career, player2.career)
if (compareResult == 0) then
compareResult = WStringsCompare(player1.name, player2.name)
end
if( order == SocialWindowTabParty.SORT_ORDER_UP ) then
return ( compareResult < 0 )
else
return ( compareResult > 0 )
end
end
-- Sorting By Location (And if they match, then sort alphabetically)
if( type == SocialWindowTabParty.SORT_TYPE_LOCATION ) then
compareResult = WStringsCompare(player1.location, player2.location)
if (compareResult == 0) then
compareResult = WStringsCompare(player1.name, player2.name)
end
if( order == SocialWindowTabParty.SORT_ORDER_UP ) then
return ( compareResult < 0)
else
return ( compareResult > 0)
end
end
-- Otherwise assume we're sorting by a number, not a string.
-- Sorting By A Numerical Value - When tied, sort by name
local key = SocialWindowTabParty.sortKeys[type]
if (player1[key] == player2[key]) then
compareResult = WStringsCompare(player1.name, player2.name) -- In the case of a tie, sort by player name
else
if (tonumber(player1[key]) < tonumber(player2[key])) then
compareResult = -1
else
compareResult = 1
end
end
if( order == SocialWindowTabParty.SORT_ORDER_UP ) then
return ( compareResult < 0)
else
return ( compareResult > 0)
end
end