override public void ConstructFromXML(XML cxml)
{
base.ConstructFromXML(cxml);
XML xml = cxml.GetNode("Button");
string str;
str = xml.GetAttribute("mode");
if (str != null)
{
_mode = FieldTypes.ParseButtonMode(str);
}
else
{
_mode = ButtonMode.Common;
}
str = xml.GetAttribute("sound");
if (str != null)
{
sound = UIPackage.GetItemAssetByURL(str) as AudioClip;
}
str = xml.GetAttribute("volume");
if (str != null)
{
soundVolumeScale = float.Parse(str) / 100f;
}
str = xml.GetAttribute("downEffect");
if (str != null)
{
_downEffect = str == "dark" ? 1 : (str == "scale" ? 2 : 0);
_downEffectValue = xml.GetAttributeFloat("downEffectValue");
}
_buttonController = GetController("button");
_titleObject = GetChild("title");
_iconObject = GetChild("icon");
if (_mode == ButtonMode.Common)
{
SetState(UP);
}
displayObject.onRollOver.Add(__rollover);
displayObject.onRollOut.Add(__rollout);
displayObject.onTouchBegin.Add(__touchBegin);
displayObject.onTouchEnd.Add(__touchEnd);
displayObject.onRemovedFromStage.Add(__removedFromStage);
displayObject.onClick.Add(__click);
}