public override string Render() { if (Visiable) { AddAttributes(); _tagBuilder.InnerHtml = RenderInner(); string result = string.Empty; if (SelfClosing) { result = _tagBuilder.ToString(TagRenderMode.SelfClosing); } else { result = _tagBuilder.ToString(); } result += RenderAfter(); if (ContainerTemplate.IsNullOrEmpty()) { return(result); } else { return(ContainerTemplate.FormatTo(Id, Label, result, Description)); } } return(string.Empty); }
/// <summary> /// Process the taghelper and generate the output. /// </summary> public void Process(TagHelperContext context, TagHelperOutput output) { output.TagName = "div"; output.Attributes.Add("class", ContainerClass); var captchaDivId = $"Captcha{context.UniqueId}{Name}"; output.Attributes.Add("id", captchaDivId); output.TagMode = TagMode.StartTagAndEndTag; var captchaImage = GetCaptchaImageTagBuilder(); //output.Content.AppendHtml(captchaImage); var refreshButton = GetRefreshButtonTagBuilder(); //output.Content.AppendHtml(refreshButton); var textInput = GetTextInputTagBuilder(); //output.Content.AppendHtml($"{string.Format(TextBoxTemplate, textInput.GetString())}"); output.Content.AppendHtml(ContainerTemplate.Replace("{Textbox}", textInput.GetString()).Replace("{Image}", captchaImage.GetString()).Replace("{RefreshBtn}", refreshButton.GetString())); var validationMessage = GetValidationMessageTagBuilder(); output.Content.AppendHtml(validationMessage); var hiddenInputToken = GetHiddenInputTokenTagBuilder(Name); output.Content.AppendHtml(hiddenInputToken); }
protected override void OnInit() { base.OnInit(); //记录下m_itemSpacing的大小 Vector2 m_itemSize = Vector2.zero; m_LayoutGroup = gameObject.GetComponent <LayoutGroup>(); if (m_LayoutGroup is GridLayoutGroup) { var gridGroup = m_LayoutGroup as GridLayoutGroup; m_itemSize = gridGroup.cellSize; m_itemSpacing = gridGroup.spacing; } else { LayoutElement layOut = ContainerTemplate.GetComponent <LayoutElement>(); if (m_LayoutGroup is HorizontalLayoutGroup) { float width = layOut.minWidth; if (width <= 0) { width = layOut.preferredWidth; } float height = layOut.preferredHeight; if (height <= 0) { height = layOut.minHeight; } m_itemSize = new Vector2(width, height); m_itemSpacing = new Vector2((m_LayoutGroup as HorizontalLayoutGroup).spacing, 0); } else { float width = layOut.preferredWidth; if (width <= 0) { width = layOut.minWidth; } float height = layOut.minHeight; if (height <= 0) { height = layOut.preferredHeight; } m_itemSize = new Vector2(width, height); m_itemSpacing = new Vector2(0, (m_LayoutGroup as VerticalLayoutGroup).spacing); } } m_oldPadding = m_LayoutGroup.padding; //if (this.m_scrollRect) SetGridSize = m_itemSize + m_itemSpacing; }
/// <summary> /// </summary> /// <param name="hitObject"></param> public DrawableRpContainerLineGroup(BaseRpObject hitObject) : base(hitObject) { HitObject = (RpContainerLineGroup)hitObject; Template = new ContainerTemplate(HitObject) { Position = new Vector2(0, 0), Alpha = 1 }; Children = new Drawable[] { Template }; //may not be so correct //Size = _rpDetectPress.DrawSize; Scale = new Vector2(HitObject.Scale); }
public override string Render() { if (Visiable) { if (!this.Value.IsNullOrEmpty()) { string[] timeRangeArr = this.Value.Split(','); DefaultStartValue = timeRangeArr[0]; if (timeRangeArr.Length > 1) { DefaultEndValue = timeRangeArr[1]; } } if (Name.IsNullOrEmpty()) { Name = Id; } if (!DefaultStartValue.IsNullOrEmpty()) { DefaultStartValue = Env.Parse(DefaultStartValue); } if (!DefaultEndValue.IsNullOrEmpty()) { DefaultEndValue = Env.Parse(DefaultEndValue); } DatePicker sdt = new DatePicker() { Value = DefaultStartValue, ShowPreNextButton = false, CssClass = this.CssClass, DateTimeFormat = this.DateTimeFormat, GreaterThanToday = this.GreaterThanToday, Maximum = this.Maximum, Minimum = this.Minimum, ShowWeek = this.ShowWeek, Id = NamingCenter.GetTimeRangeDatePickerStartId(this.Name), Name = NamingCenter.GetTimeRangeDatePickerStartId(this.Name), MaxDateControl = NamingCenter.GetTimeRangeDatePickerEndId(this.Name) }; DatePicker edt = new DatePicker() { Value = DefaultEndValue, ShowPreNextButton = false, CssClass = this.CssClass, DateTimeFormat = this.DateTimeFormat, GreaterThanToday = this.GreaterThanToday, Maximum = this.Maximum, Minimum = this.Minimum, ShowWeek = this.ShowWeek, Id = NamingCenter.GetTimeRangeDatePickerEndId(this.Name), Name = NamingCenter.GetTimeRangeDatePickerEndId(this.Name), MinDateControl = NamingCenter.GetTimeRangeDatePickerStartId(this.Name) }; string result = "<label>从 </label>{0}<label> 到 </label>{1}".FormatTo(sdt.Render(), edt.Render()); return(ContainerTemplate.FormatTo(Id, Label, result, Description)); } return(string.Empty); }
protected override void OnInit() { base.OnInit(); cachedTransform = gameObject.transform; if (ContainerTransform.childCount > 0) { Transform t = ContainerTransform.GetChild(0); if (t != null) { if (t.name == TEMPLATE) { this.ContainerTemplate = t; this.m_templateVisiable = ContainerTemplate.gameObject.activeSelf; this.IsTemplateWithCanvas = ContainerTemplate.GetComponentsInChildren <Canvas>(true).Length > 0; t.gameObject.SetActive(false); } } } UseChildPool = _usePool; }
public override string Render() { if (Visiable) { AddAttributes(); var texts = new List <string>(); if (TextID.IsNullOrEmpty()) { TextID = "{0}_Text".FormatTo(Id); } if (!Value.IsNullOrEmpty() && !SelectType.IsNullOrEmpty()) { var page = PageBuilder.BuildPage(SelectType); if (page != null && page.Controls.Count > 0) { IFieldConverter listDs = null; page.Controls.ForEach((o) => { if (o is IListDataSourceControl) { listDs = (o as IListDataSourceControl).DataSource as IFieldConverter; return; } else if (o is ICascadeDataSourceControl) { listDs = (o as ICascadeDataSourceControl).DataSource as IFieldConverter; return; } }); if (listDs != null) { if (IsMulitle) { foreach (var v in Value.Split(',')) { texts.Add(listDs.Converter(Id, v, null).ToString()); } } else { texts.Add(listDs.Converter(Id, Value, null).ToString()); } } } } string text = string.Empty; if (texts.Count > 0) { text = string.Join(",", texts.ToArray()); } var textBox = new TextBox() { Id = TextID, Name = TextID, Value = text }; if (!Attributes.IsNullOrEmpty()) { foreach (var attr in Attributes) { textBox.Attributes[attr.Key] = attr.Value; } } textBox.Attributes["data-selector"] = SelectType; textBox.Attributes["data-showtype"] = ShowType.ToString(); textBox.Attributes["data-multiple"] = IsMulitle.ToString().ToLower(); textBox.Attributes["data-target"] = Id; textBox.Attributes["data-dialogheight"] = DialogHeight.ToString(); textBox.Attributes["data-dialogwidth"] = DialogWidth.ToString(); var hidden = new HiddenField() { Id = Id, Name = Id, Value = Value, Validator = Validator }; string result = hidden.Render() + textBox.Render(); return(ContainerTemplate.FormatTo(Id, Label, result, Description)); } return(string.Empty); }