the icons delete as players leave, as they're supposed to. But getting them to move into place after someone leaves isn't working. Also there's no code for moving the icons if the player list sorting is changed, as I have no idea how to pull that part off as I can't even move them when someone leaves the game
Client.cs
package NotAnActualPackage
{
function gameConnection::onConnectionAccepted(%t)
{
schedule(0,0,swol_saveServerName());
return parent::onConnectionAccepted(%t);
}
function swol_saveServerName()
{
$Swol::ServerName = $ServerInfo::Name;
$Swol::ServerHostName = swol_getHostName();
}
function swol_getHostName()
{
%s = $Swol::ServerName;
if(%s $= "")
%s = $ServerInfo::Name;
%a = strPos(%s,"'s");
%b = strPos(%s,"s'");
if(%a >= %b)
%c = %a;
else
%c = %b;
if(%c == -1)
return "";
%n = getSubStr(%s,0,%c);
return %n;
}
function NewPlayerListGui::update(%this,%cl,%name,%blid,%a,%b,%c)
{
$qq=NPL_List.RowCount();
parent::update(%this,%cl,%name,%blid,%a,%b,%c);
// echo(%name);
// echo(%a SPC "-" SPC %b SPC "-" SPC %c);
}
function NPL_List::addRow(%this,%i,%t)
{
if(getField(%t,0) $= "S" && getField(%t,1) $= $Swol::ServerHostName)
{
%t = "H" @ getSubStr(%t,1,strLen(%t)-1);
%j = "<bitmap:add-ons/Script_Statuses/Icon_HostShield.png>";
}
else if(getField(%t,0) $= "S" && getField(%t,1) !$= $Swol::ServerHostName)
{
// %t = " " @ getSubStr(%t,1,strLen(%t)-1);
%j = "<bitmap:add-ons/Script_Statuses/Icon_SuperAdminShield.png>";
}
else if(getField(%t,0) $= "A")
{
// %t = " " @ getSubStr(%t,1,strLen(%t)-1);
%j = "<bitmap:add-ons/Script_Statuses/Icon_AdminShield.png>";
}
else
{
// %t = " " @ getSubStr(%t,1,strLen(%t)-1);
%j = "<bitmap:add-ons/Script_Statuses/Icon_PlayerShield.png>";
}
if($testfornow)
{
if(isObject($q[$qq]))
{
$q[$qq].delete();
}
//%i=NPL_List.getRowID();
//$testfornow=false;
$q[%i]=new GuiMLTextCtrl()
{
profile = "GuiMLTextCtrl";
horizSizing = "right";
vertSizing = "bottom";
position = "20" SPC 20*$qq;
extent = "16 16";
minExtent = "8 2";
enabled = "1";
visible = "1";
clipToParent = "1";
lineSpacing = "2";
allowColorChars = "0";
maxChars = "-1";
text = %j;
maxBitmapHeight = "-1";
selectable = "0";
autoResize = "0";
};
// %a=NPL_List.getRowID($q,NPL_List);
// $q_[$qq]=$qq;
// warn(%i);
NPL_Scroll.add($q[%i]);
$qq++;
}
parent::addRow(%this,%i,%t);
}
function NPL_list::removeRow(%this,%a)
{
parent::removeRow(%this,%a);
// warn(%a);
$q[%a].delete();
}
function NPL_list::removeRowByID(%this,%a)
{
parent::removeRowByID(%this,%a);
// warn(%a);
//NPL_List::ResetIcons();
$q[%a].delete();
}
function NPL_List::ResetIcons(%this)
{
if($qq<=0)
return;
for(%i=0;%i<$qq;%i++)
{
$q[%i].delete();
}
NewPlayerListGui::update();
}
};
activatePackage(NotAnActualPackage);
$testfornow=true;
$qq=-1;
function NPL_AddButtons()
{
%a = new GuiBitmapButtonCtrl(Legend_Icons) {
profile = "BlockButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "380 33";
extent = "100 19";
minExtent = "8 2";
enabled = "1";
visible = "1";
clipToParent = "1";
command = "";
text = "Legend Icons";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "base/client/ui/button1";
lockAspectRatio = "0";
alignLeft = "0";
alignTop = "0";
overflowImage = "0";
mKeepCached = "0";
mColor = "255 255 255 255";
};
%b = new GuiBitmapCtrl() {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "52 33";
extent = "100 19";
minExtent = "8 2";
enabled = "1";
visible = "1";
clipToParent = "1";
command = "";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "base/data/shapes/white";
lockAspectRatio = "0";
alignLeft = "0";
alignTop = "0";
overflowImage = "0";
mKeepCached = "0";
mColor = "200 200 200 255";
};
%c = new GuiBitmapButtonCtrl(Status) {
profile = "BlockButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "56 33";
extent = "50 19";
minExtent = "8 2";
enabled = "1";
visible = "1";
clipToParent = "1";
command = "";
text = "Status";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "base/client/ui/button1";
lockAspectRatio = "0";
alignLeft = "0";
alignTop = "0";
overflowImage = "0";
mKeepCached = "0";
mColor = "255 255 255 255";
};
%d = new GuiBitmapButtonCtrl() {
profile = "BlockButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "110 33";
extent = "68 19";
minExtent = "8 2";
enabled = "1";
visible = "1";
clipToParent = "1";
command = "NewPlayerListGui.sortList(1);";
text = "Name";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "base/client/ui/button1";
lockAspectRatio = "0";
alignLeft = "0";
alignTop = "0";
overflowImage = "0";
mKeepCached = "0";
mColor = "255 255 255 255";
};
NPL_Window.add(%a);
NPL_Window.add(%b);
NPL_Window.add(%c);
NPL_Window.add(%d);
}
NPL_AddButtons();