Exemplo n.º 1
0
 public IEnumerable <GameObject> PostInitialize(UiSo ui, UiTheme theme)
 {
     gameController.OnGameEnd += HandleGameEnd;
     resetButton.OnClick      += HandleReset;
     gameObject.SetActive(false);
     return(UnityUtil.Once(gameObject));
 }
Exemplo n.º 2
0
 public IEnumerable <GameObject> PostInitialize(UiSo ui, UiTheme theme)
 {
     gameController.OnPuckCountChange += HandlePuckCountChange;
     gameController.OnScoreChange     += HandleScoreChange;
     HandlePuckCountChange(gameController.State.PuckHandCount);
     HandleScoreChange(gameController.State.Score);
     return(UnityUtil.Once(gameObject));
 }
Exemplo n.º 3
0
 public IEnumerable <GameObject> Initialize(UiSo ui, UiTheme theme)
 {
     uiTheme = theme;
     uiSo    = ui;
     shape   = UnityUtil.GetRequiredComp <UiThemeShapeBeh>(this);
     SetDisabled(isClickDisabled);
     return(UnityUtil.Once(gameObject));
 }
Exemplo n.º 4
0
        public IEnumerable <GameObject> Initialize(UiSo ui, UiTheme theme)
        {
            uiSo = ui;
            var obj = gameObject;

            rectTransform = obj.GetComponent <RectTransform>();
            EvalEndPos();
            return(UnityUtil.Once(obj));
        }
Exemplo n.º 5
0
 public IEnumerable <GameObject> Initialize(UiSo aUi, UiTheme theme)
 {
     ui           = aUi;
     drawerRect   = GetComponent <RectTransform>();
     toggleHeight = toggleLayout.preferredHeight;
     targetHeight = drawerRect.rect.height - toggleHeight;
     UpdateHeight(1.0f);
     return(UnityUtil.Once(gameObject));
 }
Exemplo n.º 6
0
        public IEnumerable <GameObject> PostInitialize(UiSo ui, UiTheme theme)
        {
            var rectTransform = GetComponent <RectTransform>();

            rectTransform.anchoredPosition = position;
            openMotion.EvalEndPos();
            gameObject.SetActive(isVisible);

            closeButton.OnClick = HandleCloseClick;

            return(UnityUtil.Once(gameObject));
        }
Exemplo n.º 7
0
 public IEnumerable <GameObject> Initialize(UiSo ui, UiTheme aTheme)
 {
     theme          = aTheme;
     text           = UnityUtil.GetRequiredComp <Text>(this);
     text.hideFlags = ui.isVerboseDebug ? HideFlags.None : HideFlags.HideInInspector;
     SetColor(colorType);
     SetFontType(fontType);
     SetAlignment(alignment);
     SetValue(value);
     text.horizontalOverflow = HorizontalWrapMode.Overflow;
     text.verticalOverflow   = VerticalWrapMode.Overflow;
     return(UnityUtil.Once(gameObject));
 }
Exemplo n.º 8
0
        public IEnumerable <GameObject> Initialize(UiSo ui, UiTheme theme)
        {
            shape           = UnityUtil.GetRequiredComp <UiThemeShapeBeh>(this);
            shape.hideFlags = ui.isVerboseDebug ? HideFlags.None :  HideFlags.HideInInspector;
            UiThemeUtil.AddChild(ref textBeh, "Text", transform, ui);
            shape.Initialize(ui, theme);
            textBeh.Initialize(ui, theme);
            textBeh.SetFontType(UIThemeFontType.Button);
            textBeh.SetAlignment(TextAnchor.MiddleCenter);
            textBeh.SetValue(text);
            shape.SetShapeType(shapeType);
            shapeRipple = UnityUtil.GetRequiredComp <UiThemeShapeRipple>(this);
            shapeRipple.Initialize(ui, theme);
            shapeRipple.SetDisabled(isClickDisabled);
            shapeRipple.hideFlags = ui.isVerboseDebug ? HideFlags.None :  HideFlags.HideInInspector;
            shape.hideFlags       = ui.isVerboseDebug ? HideFlags.None :  HideFlags.HideInInspector;

            SetClickDisabled(isClickDisabled);
            return(UnityUtil.Once(gameObject));
        }
Exemplo n.º 9
0
        public IEnumerable <GameObject> Initialize(UiSo ui, UiTheme theme)
        {
            UiThemeUtil.AddChild(ref textBeh, "Label", transform, ui);
            if (UiThemeUtil.AddChild(ref boxShapeBeh, "Box", transform, ui))
            {
                boxShapeBeh.gameObject.AddComponent <UiThemeShapeRipple>();
            }
            UiThemeUtil.AddChild(ref checkShapeBeh, "Check", boxShapeBeh.transform, ui);
            ripple = boxShapeBeh.gameObject.GetComponent <UiThemeShapeRipple>();
            textBeh.Initialize(ui, theme);
            boxShapeBeh.Initialize(ui, theme);
            checkShapeBeh.Initialize(ui, theme);
            ripple.Initialize(ui, theme);

            textBeh.SetAlignment(TextAnchor.MiddleRight);
            textBeh.SetColor(labelColor);
            textBeh.SetValue(label);
            textBeh.SetFontType(UIThemeFontType.Body);
            PositionBox(ui, boxShapeBeh.GetComponent <RectTransform>());
            boxShapeBeh.SetHasShadow(true);
            boxShapeBeh.SetColorType(boxColor);
            boxShapeBeh.SetShapeType(UiThemeShapeType.RoundedSquare);
            boxShapeBeh.SetIsOutline(false);
            checkShapeBeh.SetHasShadow(false);
            var checkRect = checkShapeBeh.GetComponent <RectTransform>();

            checkRect.offsetMax = Vector2.one * -2.0f;
            checkRect.offsetMin = Vector2.one * 2.0f;
            checkShapeBeh.SetShapeType(UiThemeShapeType.Check);
            checkShapeBeh.SetIsOutline(false);
            var textRect = textBeh.GetComponent <RectTransform>();

            textRect.offsetMax = Vector2.right * (-ui.checkboxSize - 5);
            boxShapeBeh.SetColorType(boxColor);
            boxShapeBeh.SetShapeType(UiThemeShapeType.RoundedSquare);

            SetChecked(isChecked);
            SetClickDisabled(isClickDisabled);

            return(UnityUtil.Once(gameObject));
        }
Exemplo n.º 10
0
        public IEnumerable <GameObject> Initialize(UiSo aUi, UiTheme aTheme)
        {
            ui    = aUi;
            theme = aTheme;
            var initObjs = new List <GameObject> {
                gameObject
            };

            SetHasShadow(hasShadow);
            if (UiThemeUtil.AddChild(ref shapeImage, "Shape", transform, ui))
            {
                shapeImage.gameObject.AddComponent <Mask>();
            }
            SetShapeType(shapeType);
            SetColorType(colorType);
            initObjs.Add(shapeImage.gameObject);
            var mask = shapeImage.gameObject.GetComponent <Mask>();

            mask.showMaskGraphic     = true;
            shapeImage.raycastTarget = true;
            return(initObjs);
        }
Exemplo n.º 11
0
        public IEnumerable <GameObject> Initialize(UiSo aUi, UiTheme theme)
        {
            ui                    = aUi;
            windowShape           = UnityUtil.GetRequiredComp <UiThemeShapeBeh>(this);
            windowShape.hideFlags = ui.GetHideFlags();
            openMotion            = UnityUtil.GetRequiredComp <UiMotionBeh>(this);
            openMotion.hideFlags  = ui.GetHideFlags();
            openMotion.offset     = Vector2.right * (size.x + position.x);
            var rectTransform = GetComponent <RectTransform>();

            rectTransform.anchorMin = Vector2.one;
            rectTransform.anchorMax = Vector2.one;
            rectTransform.pivot     = Vector2.one;
            rectTransform.sizeDelta = size;


            if (UiThemeUtil.AddChild(ref layoutGroup, "Layout", transform, ui))
            {
                layoutGroup.padding = new RectOffset(12, 12, 12, 12);
                layoutGroup.spacing = 6;
            }
            layoutGroup.childForceExpandHeight = false;
            layoutGroup.childForceExpandWidth  = true;
            layoutGroup.childControlHeight     = true;
            layoutGroup.childControlWidth      = true;
            layoutGroup.gameObject.hideFlags   = HideFlags.None;

            UiThemeUtil.AddChild(ref closeButtonRowLayout, "Modal Row", layoutGroup.transform, ui);
            closeButtonRowLayout.preferredWidth       = 25;
            closeButtonRowLayout.preferredHeight      = 25;
            closeButtonRowLayout.minHeight            = 25;
            closeButtonRowLayout.minWidth             = 25;
            closeButtonRowLayout.flexibleWidth        = 1.0f;
            closeButtonRowLayout.flexibleHeight       = 0;
            closeButtonRowLayout.gameObject.hideFlags = HideFlags.None;

            UiThemeUtil.AddChild(ref contentRowLayout, "Content Row", layoutGroup.transform, ui);
            contentRowLayout.flexibleWidth        = 1.0f;
            contentRowLayout.flexibleHeight       = 1.0f;
            contentRowLayout.gameObject.hideFlags = HideFlags.None;

            closeButtonRowLayout.transform.SetSiblingIndex(0);
            contentRowLayout.transform.SetSiblingIndex(1);

            UiThemeUtil.AddChild(ref closeButton, "Close Button", closeButtonRowLayout.transform, ui);
            closeButton.shapeType = UiThemeShapeType.Circle;
            closeButton.colorType = UIThemeColorType.Secondary;
            closeButton.text      = "x";
            closeButton.Initialize(ui, theme);
            closeButton.gameObject.hideFlags = ui.GetHideFlags();
            var closeTransform = closeButton.GetComponent <RectTransform>();

            closeTransform.anchorMax = Vector2.one;
            closeTransform.anchorMin = Vector2.right;
            closeTransform.pivot     = Vector2.right + Vector2.up * .5f;
            closeTransform.sizeDelta = Vector2.right * 25;



            return(UnityUtil.Once(gameObject));
        }