public static void MakeBetter(MenuCommand command) { Text txt = command.context as Text; int size = txt.fontSize; bool bestFit = txt.resizeTextForBestFit; int min = txt.resizeTextMinSize; int max = txt.resizeTextMaxSize; var newTxt = Betterizer.MakeBetter <Text, BetterText>(txt); var betterTxt = newTxt as BetterText; if (betterTxt != null) { if (bestFit) { betterTxt.FontSizer.MinSize = min; betterTxt.FontSizer.MaxSize = max; } betterTxt.FontSizer.SetSize(size); } Betterizer.Validate(newTxt); }
public static void MakeBetter(MenuCommand command) { Image img = command.context as Image; var newImg = Betterizer.MakeBetter <Image, BetterImage>(img); if (newImg != null) { newImg.SetAllDirty(); BetterImage better = newImg as BetterImage; if (better != null) { // set border scale both to height as default to make default scale uniform. better.SpriteBorderScale.ModX.SizeModifiers[0].Mode = ImpactMode.PixelHeight; better.SpriteBorderScale.ModY.SizeModifiers[0].Mode = ImpactMode.PixelHeight; #if !UNITY_4 && !UNITY_5_0 && !UNITY_5_1 && !UNITY_5_2 && !UNITY_5_3 && !UNITY_5_4 && !UNITY_5_5 // from UNITY 5.6 on // ensure shader channels in canvas Canvas canvas = better.transform.GetComponentInParent <Canvas>(); canvas.additionalShaderChannels = canvas.additionalShaderChannels | AdditionalCanvasShaderChannels.TexCoord1 | AdditionalCanvasShaderChannels.Tangent; #endif } } }
public static void MakeBetter(MenuCommand command) { LayoutElement layout = command.context as LayoutElement; var newLayout = Betterizer.MakeBetter <LayoutElement, BetterLayoutElement>(layout) as BetterLayoutElement; if (newLayout != null) { } }
public static void MakeBetter(MenuCommand command) { ContentSizeFitter fitter = command.context as ContentSizeFitter; var h = fitter.horizontalFit; var v = fitter.verticalFit; var newFitter = Betterizer.MakeBetter <ContentSizeFitter, BetterContentSizeFitter>(fitter) as BetterContentSizeFitter; if (newFitter != null) { newFitter.CurrentSettings.HorizontalFit = h; newFitter.CurrentSettings.VerticalFit = v; } }
public static void MakeBetter(MenuCommand command) { AspectRatioFitter fitter = command.context as AspectRatioFitter; var mode = fitter.aspectMode; float ratio = fitter.aspectRatio; var newFitter = Betterizer.MakeBetter <AspectRatioFitter, BetterAspectRatioFitter>(fitter) as BetterAspectRatioFitter; if (newFitter != null) { newFitter.CurrentSettings.AspectMode = mode; newFitter.CurrentSettings.AspectRatio = ratio; } }
public static void MakeBetter(MenuCommand command) { RawImage img = command.context as RawImage; RawImage newImg = Betterizer.MakeBetter <RawImage, BetterRawImage>(img); #if !UNITY_4 && !UNITY_5_0 && !UNITY_5_1 && !UNITY_5_2 && !UNITY_5_3 && !UNITY_5_4 && !UNITY_5_5 // from UNITY 5.6 on BetterRawImage better = newImg as BetterRawImage; if (better != null) { // ensure shader channels in canvas Canvas canvas = better.transform.GetComponentInParent <Canvas>(); canvas.additionalShaderChannels = canvas.additionalShaderChannels | AdditionalCanvasShaderChannels.TexCoord1 | AdditionalCanvasShaderChannels.Tangent; } #endif }
protected static TBetter MakeBetterLogic(MenuCommand command) { TSource lg = command.context as TSource; var pad = new Margin(lg.padding); var space = lg.spacing; var newLg = Betterizer.MakeBetter <TSource, TBetter>(lg, "m_Padding"); var betterLg = newLg as TBetter; if (betterLg != null) { betterLg.PaddingSizer.SetSize(pad); betterLg.SpacingSizer.SetSize(space); } else if (newLg != null) { pad.CopyValuesTo(newLg.padding); } Betterizer.Validate(newLg); return(newLg as TBetter); }
public static void MakeBetter(MenuCommand command) { GridLayoutGroup grid = command.context as GridLayoutGroup; var pad = new Margin(grid.padding); var space = grid.spacing; var size = grid.cellSize; var newGrid = Betterizer.MakeBetter <GridLayoutGroup, BetterGridLayoutGroup>(grid, "m_Padding"); var betterGrid = newGrid as BetterGridLayoutGroup; if (betterGrid != null) { betterGrid.PaddingSizer.SetSize(pad); betterGrid.SpacingSizer.SetSize(space); betterGrid.CellSizer.SetSize(size); } else { pad.CopyValuesTo(newGrid.padding); } Betterizer.Validate(newGrid); }
public static void MakeBetter(MenuCommand command) { Selectable sel = command.context as Selectable; Betterizer.MakeBetter <Selectable, BetterSelectable>(sel); }
public static void MakeBetter(MenuCommand command) { Scrollbar obj = command.context as Scrollbar; Betterizer.MakeBetter <Scrollbar, BetterScrollbar>(obj); }
public static void MakeBetter(MenuCommand command) { ScrollRect obj = command.context as ScrollRect; Betterizer.MakeBetter <ScrollRect, BetterScrollRect>(obj); }
public static void MakeBetter(MenuCommand command) { Toggle tgl = command.context as Toggle; Betterizer.MakeBetter <Toggle, BetterToggle>(tgl); }
public static void MakeBetter(MenuCommand command) { Dropdown sel = command.context as Dropdown; Betterizer.MakeBetter <Dropdown, BetterDropdown>(sel); }
public static void MakeBetter(MenuCommand command) { InputField obj = command.context as InputField; Betterizer.MakeBetter <InputField, BetterInputField>(obj); }
public static void MakeBetter(MenuCommand command) { Button btn = command.context as Button; Betterizer.MakeBetter <Button, BetterButton>(btn); }
public static void MakeBetter(MenuCommand command) { Slider obj = command.context as Slider; Betterizer.MakeBetter <Slider, BetterSlider>(obj); }