Exemple #1
0
    // Default resources to be loaded here
    static void UpdateResources()
    {
        // Initialize all sub variable classes
        miscValues = new PanelMisc();
        miscValues.Init();

        placementValues = new PanelPlacement();
        placementValues.Init();
    }
 //Initialization
 void Start()
 {
     initialPosition     = transform.position;
     panelPlacementLeft  = leftPanelTransform.gameObject.GetComponent <PanelPlacement>();
     panelPlacementRight = rightPanelTransform.gameObject.GetComponent <PanelPlacement>();
     left            = false;
     mid             = true;
     right           = false;
     leftAttributes  = 0;
     rightAttributes = 0;
     allAttributes   = 0;
 }
Exemple #3
0
        internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (CheckDisabledModel(context))
            {
                return;
            }
            var input = new TagBuilder("a2-selector", null, IsInGrid);

            onRender?.Invoke(input);
            if (!String.IsNullOrEmpty(Delegate))
            {
                input.MergeAttribute(":fetch", $"$delegate('{Delegate}')");
            }
            if (!String.IsNullOrEmpty(SetDelegate))
            {
                input.MergeAttribute(":hitfunc", $"$delegate('{SetDelegate}')");
            }
            input.MergeAttribute("display", DisplayProperty);
            if (PanelPlacement != SelectorPanelPlacement.Default)
            {
                input.MergeAttribute("placement", PanelPlacement.ToString().ToKebabCase());
            }
            if (ListSize != null)
            {
                if (!ListSize.Width.IsEmpty)
                {
                    input.MergeAttribute("list-width", ListSize.Width.ToString());
                }
                if (!ListSize.Height.IsEmpty)
                {
                    input.MergeAttribute("list-height", ListSize.Height.ToString());
                }
            }
            if (ShowCaret)
            {
                input.MergeAttribute(":caret", "true");
            }
            MergeAttributes(input, context);
            MergeDisabled(input, context);
            MergeAlign(input, context, Align);
            MergeBindingAttributeString(input, context, "placeholder", nameof(Placeholder), Placeholder);
            MergeValue(input, context);
            MergeCustomValueItemProp(input, context, nameof(TextValue), "text");
            MergeCreateNew(input, context);

            input.RenderStart(context);
            RenderAddOns(context);
            //RenderNewPane(context);
            RenderPaneTemplate(context);
            input.RenderEnd(context);
        }
Exemple #4
0
        public override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null)
        {
            if (CheckDisabledModel(context))
            {
                return;
            }
            var input = new TagBuilder("a2-selector", null, IsInGrid);

            onRender?.Invoke(input);
            if (!String.IsNullOrEmpty(Delegate))
            {
                input.MergeAttribute(":fetch", $"$delegate('{Delegate}')");
            }
            if (!String.IsNullOrEmpty(Fetch))
            {
                input.MergeAttribute("fetch-command", Fetch);
            }
            if (!String.IsNullOrEmpty(SetDelegate))
            {
                input.MergeAttribute(":hitfunc", $"$delegate('{SetDelegate}')");
            }
            input.MergeAttribute("display", DisplayProperty);
            if (PanelPlacement != DropDownPlacement.BottomLeft)
            {
                input.MergeAttribute("placement", PanelPlacement.ToString().ToKebabCase());
            }
            if (Style != SelectorStyle.Default)
            {
                input.MergeAttribute("mode", Style.ToString().ToKebabCase());
            }
            SetSize(input, nameof(Selector));
            if (ListSize != null)
            {
                if (!ListSize.Width.IsEmpty)
                {
                    input.MergeAttribute("list-width", ListSize.Width.ToString());
                }
                if (!ListSize.Height.IsEmpty)
                {
                    input.MergeAttribute("list-height", ListSize.Height.ToString());
                }
            }
            if (ShowCaret.HasValue && ShowCaret.Value)
            {
                input.MergeAttribute(":caret", "true");
            }
            if (ShowClear)
            {
                input.MergeAttribute(":has-clear", "true");
            }

            var isBind = GetBinding(nameof(ItemsSource));

            if (isBind != null)
            {
                input.MergeAttribute(":items-source", isBind.GetPath(context));
            }

            MergeAttributes(input, context);
            MergeDisabled(input, context);
            MergeAlign(input, context, Align);
            MergeBindingAttributeString(input, context, "placeholder", nameof(Placeholder), Placeholder);
            MergeValue(input, context);
            MergeCustomValueItemProp(input, context, nameof(TextValue), "text");
            MergeCreateNew(input, context);

            input.RenderStart(context);
            RenderAddOns(context);
            //RenderNewPane(context);
            RenderPaneTemplate(context);
            input.RenderEnd(context);
        }