FairyGUI.GButton.ConstructFromXML C# (CSharp) Method

ConstructFromXML() public method

public ConstructFromXML ( XML cxml ) : void
cxml FairyGUI.Utils.XML
return void
        public override 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 (_titleObject != null)
                _title = _titleObject.text;
            if (_iconObject != null)
                _icon = _iconObject.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);
        }

Usage Example

コード例 #1
0
	static public int ConstructFromXML(IntPtr l) {
		try {
			FairyGUI.GButton self=(FairyGUI.GButton)checkSelf(l);
			FairyGUI.Utils.XML a1;
			checkType(l,2,out a1);
			self.ConstructFromXML(a1);
			pushValue(l,true);
			return 1;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
All Usage Examples Of FairyGUI.GButton::ConstructFromXML