コード例 #1
0
 private void SetBgColor()
 {
     if (CmpLocalizationMapper.popupBgColors != null && CmpLocalizationMapper.popupBgColors.ContainsKey(viewId))
     {
         bg.color = GraphicExtension.HexToColor(CmpLocalizationMapper.popupBgColors[viewId]);
     }
 }
コード例 #2
0
    public override void SetLocalization(CmpUiElementModel elementModel)
    {
        var longButton = elementModel as CmpLongButtonModel;

        if (onText != null)
        {
            onText.text = longButton.OnText;
        }
        if (offText != null)
        {
            offText.text = longButton.OffText;
        }
        if (customText != null)
        {
            customText.text = longButton.CustomText;
        }

        if (longButton.Font != null && longButton.Font.color != null)
        {
            onText.color     = GraphicExtension.HexToColor(longButton.Font.color);
            offText.color    = GraphicExtension.HexToColor(longButton.Font.color);
            customText.color = GraphicExtension.HexToColor(longButton.Font.color);
            mainText.color   = GraphicExtension.HexToColor(longButton.Font.color);
        }

        ColorBlock clrs = button.colors;

        clrs.highlightedColor = GraphicExtension.HexToColor(longButton.OnFocusColorCode);
        clrs.normalColor      = GraphicExtension.HexToColor(longButton.OnUnfocusColorCode);
        button.colors         = clrs;

        model = longButton;
    }
コード例 #3
0
 public override void SetLocalization(CmpUiElementModel elementModel)
 {
     if (elementModel != null)
     {
         var text = elementModel as CmpTextModel;
         if (text.Font != null && text.Font.color != null)
         {
             localizedText.color = GraphicExtension.HexToColor(text.Font.color);
         }
         localizedText.text = text.Text;
         model = text;
     }
     else
     {
         localizedText.text = "";
     }
 }
コード例 #4
0
    public override void SetLocalization(CmpUiElementModel elementModel)
    {
        var btn = elementModel as CmpBackButtonModel;

        localizedText.color = GraphicExtension.HexToColor(btn.Font.color);
        localizedText.text  = btn.Text;

        ColorBlock clrs = button.colors;

        clrs.normalColor = GraphicExtension.HexToColor(btn.BackgroundColor);
        button.colors    = clrs;

        if (btn.StartFocus.HasValue && btn.StartFocus.Value)
        {
            //TODO
        }
        model = btn;
    }
コード例 #5
0
    public override void SetLocalization(CmpUiElementModel elementModel)
    {
        var slider = elementModel as CmpSliderModel;

        leftLocalizedText.text  = slider.LeftText;
        rightLocalizedText.text = slider.RightText;

        leftColorController.activeTextColor  = GraphicExtension.HexToColor(slider.ActiveFont.color);
        rightColorController.activeTextColor = GraphicExtension.HexToColor(slider.ActiveFont.color);

        leftColorController.defaultTextColor  = GraphicExtension.HexToColor(slider.DefaultFont.color);
        rightColorController.defaultTextColor = GraphicExtension.HexToColor(slider.DefaultFont.color);

        bg.color       = GraphicExtension.HexToColor(slider.BackgroundColor);
        activeBg.color = GraphicExtension.HexToColor(slider.ActiveBackgroundColor);

        model = slider;
    }
コード例 #6
0
    public override void SetLocalization(CmpUiElementModel elementModel)
    {
        if (elementModel.id.Equals("DoNotSellButton"))
        {
            var nativeButton = elementModel as CmpLongButtonModel;
            localizedText.text = nativeButton.name;
            ColorBlock clrs = button.colors;
            clrs.highlightedColor = GraphicExtension.HexToColor(nativeButton.OnFocusColorCode);
            clrs.normalColor      = GraphicExtension.HexToColor(nativeButton.OnUnfocusColorCode);
            button.colors         = clrs;
            // btnAnim.activeTextColor = GraphicExtension.HexToColor(nativeButton.OnUnfocusColorCode);
            // btnAnim.defaultTextColor = GraphicExtension.HexToColor(nativeButton.OnFocusColorCode);
            btnAnim.SetIdleState();
            model = nativeButton;
        }
        else
        {
            var nativeButton = elementModel as CmpNativeButtonModel;
            localizedText.text = nativeButton.Text;

            ColorBlock clrs = button.colors;
            clrs.highlightedColor    = GraphicExtension.HexToColor(nativeButton.OnFocusBackgroundColor);
            clrs.normalColor         = GraphicExtension.HexToColor(nativeButton.OnUnfocusBackgroundColor);
            button.colors            = clrs;
            btnAnim.activeTextColor  = GraphicExtension.HexToColor(nativeButton.OnFocusTextColor);
            btnAnim.defaultTextColor = GraphicExtension.HexToColor(nativeButton.OnUnfocusTextColor);
            if (nativeButton.StartFocus.HasValue && nativeButton.StartFocus.Value)
            {
                btnAnim.SetActiveState();
                //TODO
            }
            else
            {
                btnAnim.SetIdleState();
            }
            model = nativeButton;
        }
    }
コード例 #7
0
        private static void UnityExtensions()
        {
            BehaviourExtension.Example();
            CameraExtension.Example();
            ColorExtension.Example();
            QFramework.GameObjectExtension.Example();
            GraphicExtension.Example();
            ImageExtension.Example();
            ObjectExtension.Example();
            UnityActionExtension.Example();

            #region RectTransform

            #endregion

            #region Selectable

            #endregion

            #region Toggle

            #endregion
        }