public void Initialize(System.Data.SQLite.SQLiteDataReader data, List <string> elementsData, List <State> statesData, List <BattlerClass> classesData, List <Player> playersData, List <Skill> skillsData) { Initialize(data); Id = Int(data["Player_ID"]); ElementRates = ReadRatesList(data, "Player", elementsData, "ElementRates"); StateRates = ReadRatesList(data, "Player", statesData, "Vulnerability"); NaturalStats = ReadStats(data["NaturalStats"], false); Companionship = Int(data["Companionship"]); SavePartnerRate = Int(data["SavePartnerRate"]); CounterattackRate = Int(data["CounterattackRate"]); AssistDamageRate = Int(data["AssistDamageRate"]); List <int> classesList = ReadDBList(data, "Player", "BattlerClass"); for (int i = 0; i < classesList.Count; i++) { ClassSet.Add(ReadObj(classesData, classesList[i])); } PlayerCompanionships = ReadRatesList(data, "Player", playersData, "CompanionshipTo"); List <int> skillsList = ReadDBList(data, "Player", "Skill", "LevelRequired"); for (int i = 0; i < skillsList.Count;) { SkillSet.Add(ReadObj(skillsData, skillsList[i++])); SkillSetLevels.Add(skillsList[i++]); } }
protected override void BuildRenderTree(RenderTreeBuilder builder) { int seq = -1; var rootClasses = new ClassSet("Integrant.Element.Component", "Integrant.Element.Component.Modal"); if (Modal !.Shown) { rootClasses.Add("Integrant.Element.Component.Modal:Shown"); } // -> Container builder.OpenElement(++seq, "div"); builder.AddAttribute(++seq, "hidden", !Modal !.Shown); builder.AddAttribute(++seq, "class", rootClasses.ToString()); builder.AddAttribute(++seq, "onclick", EventCallback.Factory.Create <MouseEventArgs>(this, OnBackgroundClick)); builder.AddElementReferenceCapture(++seq, elemRef => _elemRef = elemRef); // - -> Constrainer builder.OpenElement(++seq, "div"); builder.AddAttribute(++seq, "class", "Integrant.Element.Component.Modal.Constrainer"); builder.AddAttribute(++seq, "style", $"max-width: {Modal.MaxWidth()};"); // - - -> Content container builder.OpenElement(++seq, "div"); builder.AddAttribute(++seq, "class", "Integrant.Element.Component.Modal.Content"); builder.AddAttribute(++seq, "onclick", EventCallback.Factory.Create <MouseEventArgs>(this, OnContentClick)); builder.AddEventStopPropagationAttribute(++seq, "onclick", true); // - - - -> Close button builder.OpenElement(++seq, "span"); builder.AddAttribute(++seq, "class", "Integrant.Element.Component.Modal.CloseButton"); builder.AddAttribute(++seq, "onclick", EventCallback.Factory.Create <MouseEventArgs>(this, OnCloseButtonClick)); builder.OpenComponent <MaterialIcon>(++seq); builder.AddAttribute(++seq, "ID", "close"); builder.CloseComponent(); builder.CloseElement(); // - - - -> Content builder.AddContent(++seq, ChildContent); // builder.CloseElement(); builder.CloseElement(); builder.CloseElement(); }
public Title ( BitGetters.BitContent content, BitGetters.BitURL?url = null, bool isStatic = true, BitGetters.BitIsVisible?isVisible = null, BitGetters.BitClasses?classes = null, BitGetters.BitSize?margin = null, BitGetters.BitSize?padding = null, BitGetters.BitColor?backgroundColor = null, BitGetters.BitColor?foregroundColor = null, BitGetters.BitPixels?pixelsHeight = null, BitGetters.BitPixels?pixelsWidth = null, BitGetters.BitREM?fontSize = null, BitGetters.BitWeight?fontWeight = null, BitGetters.BitDisplay?display = null, BitGetters.BitData?data = null, BitGetters.BitTooltip?tooltip = null ) { Spec = new BitSpec { Content = content, URL = url, IsStatic = isStatic, IsVisible = isVisible, Classes = classes, Margin = margin, Padding = padding, BackgroundColor = backgroundColor, ForegroundColor = foregroundColor, PixelsHeight = pixelsHeight, PixelsWidth = pixelsWidth, FontSize = fontSize, FontWeight = fontWeight, Display = display, Data = data, Tooltip = tooltip, }; ConstantClasses = new ClassSet( "Integrant.Element.Bit", "Integrant.Element.Bit." + nameof(Title) ); if (url != null) { ConstantClasses.Add("Integrant.Element.Bit." + nameof(Title) + ":Linked"); } Cache(); }
public static bool Disabled <TStructure, TMember> ( TStructure value, Member <TStructure, TMember> member, ClassSet classes ) { if (member.InputIsDisabled?.Invoke(value, member) == true) { classes.Add("Integrant.Rudiment.Input:Disabled"); return(true); } return(false); }
public static bool Required <TStructure, TMember> ( TStructure value, Member <TStructure, TMember> member, ClassSet classes ) { if (member.InputIsRequired?.Invoke(value, member) == true) { classes.Add("Integrant.Rudiment.Input:Required"); // This should always be true if (member.InputMeetsRequirement != null) { classes.Add(member.InputMeetsRequirement.Invoke(value, member) ? "Integrant.Rudiment.Input:MeetsRequirement" : "Integrant.Rudiment.Input:FailsRequirement"); } return(true); } return(false); }
protected internal string Class(bool initial, string[]?additional = null) { ClassSet c = ConstantClasses.Clone(); if (additional != null) { c.AddRange(additional); } if (Spec.IsDisabled?.Invoke() == true) { c.Add("Integrant.Element.Bit:Disabled"); } if (Spec.Classes != null) { c.AddRange(Spec.Classes.Invoke()); } return(c.ToString()); }
public RenderFragment Render ( StructureInstance <TStructure> structure, TStructure value, MemberInstance <TStructure, string> member ) => builder => { int seq = -1; builder.OpenElement(++seq, "div"); // ClassSet classes = new ClassSet ( "Integrant.Element.Override.Input", "Integrant.Rudiment.Input." + nameof(StringInput <TStructure>) ); if (TextArea) { classes.Add("Integrant.Rudiment.Input:TextArea"); } if (Monospace) { classes.Add("Integrant.Rudiment.Input:Monospace"); } bool required = InputBuilder.Required(value, member.Member, classes); bool disabled = InputBuilder.Disabled(value, member.Member, classes); builder.AddAttribute(++seq, "class", classes.ToString()); // if (!TextArea) { InputBuilder.OpenInnerInput ( builder, ref seq, value, member.Member, "input", "text", "value", member.Member.InputValue.Invoke(value, member.Member), required, disabled, args => OnChange(value, args) ); InputBuilder.CloseInnerInput(builder); } else { InputBuilder.OpenInnerInput ( builder, ref seq, value, member.Member, "textarea", null, "value", member.Member.InputValue.Invoke(value, member.Member), required, disabled, args => OnChange(value, args) ); if (TextAreaCols != null) { builder.AddAttribute(++seq, "cols", TextAreaCols.Invoke(value, member.Member, this)); } if (TextAreaRows != null) { builder.AddAttribute(++seq, "rows", TextAreaRows.Invoke(value, member.Member, this)); } InputBuilder.CloseInnerInput(builder); } builder.CloseElement(); };
protected override void BuildRenderTree(RenderTreeBuilder b) { int seq = -1; b.OpenElement(++seq, "div"); b.AddAttribute(++seq, "class", "Integrant.Element.Component Integrant.Element.Component.Combobox"); b.AddElementReferenceCapture(++seq, elemRef => Combobox._elementRef = elemRef); // Input b.OpenElement(++seq, "div"); var classes = new ClassSet( "Integrant.Element.Component.Combobox.Input", "Integrant.Element.Override.Input" ); if (Combobox._isDisabled?.Invoke() == true) { classes.Add("Integrant.Element.Override.Input:Disabled"); } if (Combobox._isRequired?.Invoke() == true && Combobox._selected == null) { classes.Add("Integrant.Element.Override.Input:FailsRequirement"); } b.AddAttribute(++seq, "class", classes.ToString()); b.OpenElement(++seq, "input"); b.AddAttribute(++seq, "type", "text"); b.AddAttribute(++seq, "value", Combobox.InputValue()); b.AddAttribute(++seq, "data-has-selection", Combobox._selected != null); b.AddAttribute(++seq, "disabled", Combobox._isDisabled?.Invoke() == true); b.AddAttribute(++seq, "required", Combobox._isRequired?.Invoke() == true); ++seq; if (Combobox._placeholder != null) { b.AddAttribute(seq, "placeholder", Combobox._placeholder.Invoke()); } b.AddAttribute(++seq, "onclick", EventCallback.Factory.Create <MouseEventArgs>(this, Combobox.OnInputClick)); b.AddAttribute(++seq, "onfocus", EventCallback.Factory.Create <FocusEventArgs>(this, Combobox.OnInputFocus)); b.AddAttribute(++seq, "onblur", EventCallback.Factory.Create <FocusEventArgs>(this, Combobox.OnInputBlur)); b.AddAttribute(++seq, "onkeydown", EventCallback.Factory.Create <KeyboardEventArgs>(this, Combobox.OnInputKeyDown)); b.AddAttribute(++seq, "oninput", EventCallback.Factory.Create <ChangeEventArgs>(this, Combobox.OnInputInput)); b.CloseElement(); b.CloseElement(); // Dropdown b.OpenElement(++seq, "div"); b.AddAttribute(++seq, "class", "Integrant.Element.Component.Combobox.Dropdown"); b.AddAttribute(++seq, "data-shown", Combobox._shown); b.OpenRegion(++seq); int seq2 = -1; for (var i = 0; i < Combobox.Options().Length; i++) { IOption <T> o = Combobox.Options()[i]; bool selected = Combobox._selected?.Value.Equals(o.Value) == true; bool focused = Combobox._focused?.Value.Equals(o.Value) == true; bool matches = Combobox.Matches(o); b.OpenElement(++seq2, "div"); b.AddAttribute(++seq, "class", "Integrant.Element.Component.Combobox.Option"); b.AddAttribute(++seq2, "hidden", !matches); b.AddAttribute(++seq2, "data-i", i); b.AddAttribute(++seq2, "data-focused", focused); b.AddAttribute(++seq2, "data-selected", selected); b.AddAttribute(++seq2, "data-disabled", o.Disabled); b.AddAttribute(++seq2, "onmousedown", EventCallback.Factory.Create <MouseEventArgs>(this, Combobox.OnOptionMouseDown)); b.AddEventPreventDefaultAttribute(++seq2, "onmousedown", true); b.AddAttribute(++seq2, "onclick", EventCallback.Factory.Create <MouseEventArgs>(this, args => Combobox.OnOptionClick(args, o))); b.AddContent(++seq2, o.OptionText); b.CloseElement(); } b.CloseRegion(); b.CloseElement(); // b.CloseElement(); }