protected CustomSaberUiComposition( SiraLog logger, CustomScreen.Factory screenFactory, BaseGameUiHandler baseGameUiHandler, PhysicsRaycasterWithCache physicsRaycaster, BsmlDecorator bsmlDecorator, SaberSet saberSet) : base(logger, screenFactory, baseGameUiHandler, physicsRaycaster, bsmlDecorator) { _saberSet = saberSet; }
protected override void SetupTemplates() { base.SetupTemplates(); BsmlDecorator.AddTemplate("NavHeight", "70"); // if (BsmlDecorator.StyleSheetHandler.GetSelector("btn", out var selector)) // { // Debug.LogWarning($"Found {selector.Name}"); // foreach (var rule in selector.GetRules()) // { // Debug.LogWarning($"- {rule.Name} = {rule.Value}"); // } // } }
public void AddCell(PropertyDescriptor data) { if (data.PropObject == null) { return; } var go = _itemContainer.CreateGameObject("PropCell"); go.AddComponent <RectTransform>(); var layoutElement = go.AddComponent <LayoutElement>(); layoutElement.preferredHeight = 16; layoutElement.preferredWidth = 70; var contentSizeFitter = go.AddComponent <ContentSizeFitter>(); contentSizeFitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize; contentSizeFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize; //go.AddComponent<StackLayoutGroup>(); var cellType = data.Type switch { EPropertyType.Float => typeof(FloatPropCell), EPropertyType.Bool => typeof(BoolPropCell), EPropertyType.Color => typeof(ColorPropCell), EPropertyType.Texture => typeof(TexturePropCell), _ => throw new ArgumentOutOfRangeException(nameof(data), "cell type not handled") }; var comp = (BasePropCell)go.AddComponent(cellType); BsmlDecorator.ParseFromResource(comp.ContentLocation, go, comp); comp.SetData(data); _cells.Add(comp); } }
protected override void SetupTemplates() { base.SetupTemplates(); BsmlDecorator.AddTemplate("NavHeight", "70"); }