override public void Setup_BeforeAdd(XML xml) { base.Setup_BeforeAdd(xml); string str; str = xml.GetAttribute("url"); if (str != null) { _url = str; } str = xml.GetAttribute("align"); if (str != null) { _align = FieldTypes.ParseAlign(str); } str = xml.GetAttribute("vAlign"); if (str != null) { _verticalAlign = FieldTypes.ParseVerticalAlign(str); } str = xml.GetAttribute("fill"); if (str != null) { _fill = FieldTypes.ParseFillType(str); } _autoSize = xml.GetAttributeBool("autoSize", false); str = xml.GetAttribute("errorSign"); if (str != null) { showErrorSign = str == "true"; } _playing = xml.GetAttributeBool("playing", true); str = xml.GetAttribute("color"); if (str != null) { this.color = ToolSet.ConvertFromHtmlColor(str); } str = xml.GetAttribute("fillMethod"); if (str != null) { _content.fillMethod = FieldTypes.ParseFillMethod(str); } if (_content.fillMethod != FillMethod.None) { _content.fillOrigin = xml.GetAttributeInt("fillOrigin"); _content.fillClockwise = xml.GetAttributeBool("fillClockwise", true); _content.fillAmount = (float)xml.GetAttributeInt("fillAmount", 100) / 100; } if (_url != null) { LoadContent(); } }
void DecodeValue(TransitionActionType type, string str, TransitionValue value) { string[] arr; switch (type) { case TransitionActionType.XY: case TransitionActionType.Size: case TransitionActionType.Pivot: case TransitionActionType.Skew: arr = str.Split(','); if (arr[0] == "-") { value.b1 = false; } else { value.f1 = float.Parse(arr[0]); value.b1 = true; } if (arr[1] == "-") { value.b2 = false; } else { value.f2 = float.Parse(arr[1]); value.b2 = true; } break; case TransitionActionType.Alpha: value.f1 = float.Parse(str); break; case TransitionActionType.Rotation: value.f1 = int.Parse(str); break; case TransitionActionType.Scale: arr = str.Split(','); value.f1 = float.Parse(arr[0]); value.f2 = float.Parse(arr[1]); break; case TransitionActionType.Color: value.c = ToolSet.ConvertFromHtmlColor(str); break; case TransitionActionType.Animation: arr = str.Split(','); if (arr[0] == "-") { value.b1 = false; } else { value.i = int.Parse(arr[0]); value.b1 = true; } value.b = arr[1] == "p"; break; case TransitionActionType.Visible: value.b = str == "true"; break; case TransitionActionType.Sound: arr = str.Split(','); value.s = arr[0]; if (arr.Length > 1) { int intv = int.Parse(arr[1]); if (intv == 100 || intv == 0) { value.f1 = 1; } else { value.f1 = (float)intv / 100f; } } else { value.f1 = 1; } break; case TransitionActionType.Transition: arr = str.Split(','); value.s = arr[0]; if (arr.Length > 1) { value.i = int.Parse(arr[1]); } else { value.i = 1; } break; case TransitionActionType.Shake: arr = str.Split(','); value.f1 = float.Parse(arr[0]); value.f2 = float.Parse(arr[1]); break; case TransitionActionType.ColorFilter: arr = str.Split(','); value.f1 = float.Parse(arr[0]); value.f2 = float.Parse(arr[1]); value.f3 = float.Parse(arr[2]); value.f4 = float.Parse(arr[3]); break; } }
override public void Setup_BeforeAdd(XML xml) { base.Setup_BeforeAdd(xml); string str; this.displayAsPassword = xml.GetAttributeBool("password", false); str = xml.GetAttribute("font"); if (str != null) { _textFormat.font = str; } str = xml.GetAttribute("fontSize"); if (str != null) { _textFormat.size = int.Parse(str); } str = xml.GetAttribute("color"); if (str != null) { _textFormat.color = ToolSet.ConvertFromHtmlColor(str); } str = xml.GetAttribute("align"); if (str != null) { _align = FieldTypes.ParseAlign(str); } str = xml.GetAttribute("vAlign"); if (str != null) { _verticalAlign = FieldTypes.ParseVerticalAlign(str); } str = xml.GetAttribute("leading"); if (str != null) { _textFormat.lineSpacing = int.Parse(str); } str = xml.GetAttribute("letterSpacing"); if (str != null) { _textFormat.letterSpacing = int.Parse(str); } _ubbEnabled = xml.GetAttributeBool("ubb", false); str = xml.GetAttribute("autoSize"); if (str != null) { this.autoSize = FieldTypes.ParseAutoSizeType(str); } _textFormat.underline = xml.GetAttributeBool("underline", false); _textFormat.italic = xml.GetAttributeBool("italic", false); _textFormat.bold = xml.GetAttributeBool("bold", false); _singleLine = xml.GetAttributeBool("singleLine", false); str = xml.GetAttribute("strokeColor"); if (str != null) { _strokeColor = ToolSet.ConvertFromHtmlColor(str); _stroke = xml.GetAttributeInt("strokeSize", 1); } }
public override void Setup_BeforeAdd(XML xml) { base.Setup_BeforeAdd(xml); TextFormat tf = _textField.textFormat; string str; str = xml.GetAttribute("font"); if (str != null) tf.font = str; str = xml.GetAttribute("fontSize"); if (str != null) tf.size = int.Parse(str); str = xml.GetAttribute("color"); if (str != null) tf.color = ToolSet.ConvertFromHtmlColor(str); str = xml.GetAttribute("align"); if (str != null) this.align = FieldTypes.ParseAlign(str); str = xml.GetAttribute("vAlign"); if (str != null) this.verticalAlign = FieldTypes.ParseVerticalAlign(str); str = xml.GetAttribute("leading"); if (str != null) tf.lineSpacing = int.Parse(str); str = xml.GetAttribute("letterSpacing"); if (str != null) tf.letterSpacing = int.Parse(str); _ubbEnabled = xml.GetAttributeBool("ubb", false); str = xml.GetAttribute("autoSize"); if (str != null) this.autoSize = FieldTypes.ParseAutoSizeType(str); tf.underline = xml.GetAttributeBool("underline", false); tf.italic = xml.GetAttributeBool("italic", false); tf.bold = xml.GetAttributeBool("bold", false); this.singleLine = xml.GetAttributeBool("singleLine", false); str = xml.GetAttribute("strokeColor"); if (str != null) { this.strokeColor = ToolSet.ConvertFromHtmlColor(str); this.stroke = xml.GetAttributeInt("strokeSize", 1); } str = xml.GetAttribute("shadowColor"); if (str != null) { this.strokeColor = ToolSet.ConvertFromHtmlColor(str); this.shadowOffset = xml.GetAttributeVector("shadowOffset"); } _textField.textFormat = tf; }
override public void Setup_AfterAdd(XML cxml) { base.Setup_AfterAdd(cxml); XML xml = cxml.GetNode("Button"); if (xml == null) { return; } string str; str = xml.GetAttribute("title"); if (str != null) { this.title = str; } str = xml.GetAttribute("icon"); if (str != null) { this.icon = str; } str = xml.GetAttribute("selectedTitle"); if (str != null) { this.selectedTitle = str; } str = xml.GetAttribute("selectedIcon"); if (str != null) { this.selectedIcon = str; } str = xml.GetAttribute("titleColor"); if (str != null) { this.titleColor = ToolSet.ConvertFromHtmlColor(str); } str = xml.GetAttribute("titleFontSize"); if (str != null) { this.titleFontSize = int.Parse(str); } str = xml.GetAttribute("controller"); if (str != null) { _relatedController = parent.GetController(str); } pageOption.id = xml.GetAttribute("page"); this.selected = xml.GetAttributeBool("checked", false); 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; } }
override public void Setup_AfterAdd(XML cxml) { base.Setup_AfterAdd(cxml); XML xml = cxml.GetNode("ComboBox"); if (xml == null) { return; } string str; str = xml.GetAttribute("titleColor"); if (str != null) { this.titleColor = ToolSet.ConvertFromHtmlColor(str); } visibleItemCount = xml.GetAttributeInt("visibleItemCount", visibleItemCount); _popupDirection = xml.GetAttribute("direction", _popupDirection); XMLList col = xml.Elements("item"); _items = new string[col.Count]; _values = new string[col.Count]; int i = 0; foreach (XML ix in col) { _items[i] = ix.GetAttribute("title"); _values[i] = ix.GetAttribute("value"); str = ix.GetAttribute("icon"); if (str != null) { if (_icons == null) { _icons = new string[col.Count]; } _icons[i] = str; } i++; } str = xml.GetAttribute("title"); if (str != null && str.Length > 0) { this.text = str; _selectedIndex = Array.IndexOf(_items, str); } else if (_items.Length > 0) { _selectedIndex = 0; this.text = _items[0]; } else { _selectedIndex = -1; } str = xml.GetAttribute("icon"); if (str != null && str.Length > 0) { this.icon = str; } str = xml.GetAttribute("selectionController"); if (str != null) { _selectionController = parent.GetController(str); } }
override public void Setup_BeforeAdd(XML xml) { string str; string type = xml.GetAttribute("type"); if (type != null && type != "empty") { _shape = new Shape(); _shape.gOwner = this; displayObject = _shape; } base.Setup_BeforeAdd(xml); if (_shape != null) { int lineSize; str = xml.GetAttribute("lineSize"); if (str != null) { lineSize = int.Parse(str); } else { lineSize = 1; } Color lineColor; str = xml.GetAttribute("lineColor"); if (str != null) { lineColor = ToolSet.ConvertFromHtmlColor(str); } else { lineColor = Color.black; } Color fillColor; str = xml.GetAttribute("fillColor"); if (str != null) { fillColor = ToolSet.ConvertFromHtmlColor(str); } else { fillColor = Color.white; } float[] cornerRadius = null; string[] arr; arr = xml.GetAttributeArray("corner"); if (arr != null && arr.Length > 0) { cornerRadius = new float[4]; for (int i = 0; i < 4; i++) { if (i < arr.Length) { cornerRadius[i] = float.Parse(arr[i]); } else { cornerRadius[i] = cornerRadius[i - 1]; } } } if (type == "rect") { if (cornerRadius != null) { DrawRoundRect(this.width, this.height, fillColor, cornerRadius); } else { DrawRect(this.width, this.height, lineSize, lineColor, fillColor); } } else { DrawEllipse(this.width, this.height, fillColor); } } }