예제 #1
0
 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}");
     //     }
     // }
 }
예제 #3
0
        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);
        }
    }
예제 #4
0
 protected override void SetupTemplates()
 {
     base.SetupTemplates();
     BsmlDecorator.AddTemplate("NavHeight", "70");
 }