Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

TribesGUI.TribesInventoryWeaponSlot


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
//
// Renders the weapon icon as a selected slot. Has a button on
// the component to assign a weapon to the slot.
//
class TribesInventoryWeaponSlot extends GUI.GUIMultiComponent;

var localized String SlotText;

var GUIButton		AssignButton;
var GUIImage		WeaponImage;
var GUILabel		SlotLabel;

var	class<Weapon>	weaponClass;
var	int				slotIndex;

function InitComponent(GUIComponent MyOwner)
{
	super.InitComponent(MyOwner);

	AssignButton = GUIButton(AddComponent("GUI.GUIButton", "", true));
	AssignButton.WinHeight = 0.45;
	AssignButton.WinWidth = (ActualHeight() / ActualWidth()) * AssignButton.WinHeight;
	AssignButton.WinLeft = 0.5 - (AssignButton.WinWidth * 0.5);
	AssignButton.WinTop = 0.025;
	AssignButton.Caption = SlotText @ (slotIndex + 1);
	AssignButton.StyleName = StyleName;
	AssignButton.bNeverFocus = true;
	AssignButton.InitComponent(self);

	WeaponImage = GUIImage(AddComponent("GUI.GUIImage", "", true));
	WeaponImage.WinLeft = 0.0;
	WeaponImage.WinTop = 0.5;
	WeaponImage.WinHeight = 0.5;
	WeaponImage.WinWidth = 1.0;
	WeaponImage.ImageStyle = ISTY_Justified;
	WeaponImage.ImageRenderStyle = MSTY_Alpha;
	WeaponImage.ImageAlign = IMGA_Center;

	SlotLabel = GUILabel(AddComponent("GUI.GUILabel", "", true));
	SlotLabel.WinLeft = 0.0;
	SlotLabel.WinTop = 1.0 - (12 / ActualHeight());
	SlotLabel.WinWidth = 1.0;
	SlotLabel.WinHeight = 12 / ActualHeight();
	SlotLabel.TextAlign = TXTA_Center;
	SlotLabel.Caption = SlotText @ (slotIndex + 1);
	SlotLabel.StyleName = StyleName;
	SlotLabel.InitComponent(Self);

	AssignButton.OnClick = InternalOnClick;
}

Delegate OnAssign(TribesInventoryWeaponSlot AssignedSlot);

function InternalOnClick(GUIComponent Sender)
{
	OnAssign(self);
}

function SetWeaponClass(class<Weapon> newClass)
{
	if(newClass != weaponClass)
	{
		weaponClass = newClass;
		if(weaponClass != None)
			WeaponImage.Image = weaponClass.default.inventoryIcon;
		else
			WeaponImage.Image = None;
	}
}

function SetEnabled(bool value)
{
	AssignButton.SetEnabled(value);
}

defaultproperties
{
	SlotText = "Slot"
	bNeverFocus = true
	PropagateState=false
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: st 16.4.2014 10:20:44.000 - Creation time: st 23.5.2018 00:10:48.437 - Created with UnCodeX