| | 1 | | using Decentraland.Common; |
| | 2 | | using UnityEngine; |
| | 3 | |
|
| | 4 | | namespace DCL.ECSComponents |
| | 5 | | { |
| | 6 | | public static class PBTextShape_Defaults |
| | 7 | | { |
| | 8 | | public static float GetFontSize(this PBTextShape self) |
| | 9 | | { |
| 21 | 10 | | return self.HasFontSize ? self.FontSize : 10.0f; |
| | 11 | | } |
| | 12 | |
|
| | 13 | | public static TextAlignMode GetTextAlign(this PBTextShape self) |
| | 14 | | { |
| 21 | 15 | | return self.HasTextAlign ? self.TextAlign : TextAlignMode.TamMiddleCenter; |
| | 16 | | } |
| | 17 | |
|
| | 18 | | public static float GetWidth(this PBTextShape self) |
| | 19 | | { |
| 4 | 20 | | return self.HasWidth ? self.Width : 1.0f; |
| | 21 | | } |
| | 22 | |
|
| | 23 | | public static float GetHeight(this PBTextShape self) |
| | 24 | | { |
| 4 | 25 | | return self.HasHeight ? self.Height : 1.0f; |
| | 26 | | } |
| | 27 | |
|
| | 28 | | public static Color3 GetShadowColor(this PBTextShape self) |
| | 29 | | { |
| 20 | 30 | | return self.ShadowColor ?? new Color3() { R = 1.0f, G = 1.0f, B = 1.0f }; |
| | 31 | | } |
| | 32 | |
|
| | 33 | | public static Color3 GetOutlineColor(this PBTextShape self) |
| | 34 | | { |
| 20 | 35 | | return self.OutlineColor ?? new Color3() { R = 1.0f, G = 1.0f, B = 1.0f }; |
| | 36 | | } |
| | 37 | |
|
| | 38 | | public static Color4 GetTextColor(this PBTextShape self) |
| | 39 | | { |
| 21 | 40 | | return self.TextColor ?? new Color4() { R = 1.0f, G = 1.0f, B = 1.0f, A = 1.0f}; |
| | 41 | | } |
| | 42 | |
|
| | 43 | | public static bool GetTextWrapping(this PBTextShape self) |
| | 44 | | { |
| 42 | 45 | | return self.HasTextWrapping && self.TextWrapping; |
| | 46 | | } |
| | 47 | |
|
| | 48 | | public static int GetLineCount(this PBTextShape self) |
| | 49 | | { |
| 22 | 50 | | return self.HasLineCount ? self.LineCount : 0; |
| | 51 | | } |
| | 52 | |
|
| | 53 | | public static bool GetFontAutoSize(this PBTextShape self) |
| | 54 | | { |
| 25 | 55 | | return self.HasFontAutoSize && self.FontAutoSize; |
| | 56 | | } |
| | 57 | |
|
| | 58 | | public static Vector4 GetPadding(this PBTextShape self) |
| | 59 | | { |
| 21 | 60 | | return new Vector4( |
| | 61 | | x: self.HasPaddingLeft ? self.PaddingLeft : 0, |
| | 62 | | y: self.HasPaddingTop ? self.PaddingTop : 0, |
| | 63 | | z: self.HasPaddingRight ? self.PaddingRight : 0, |
| | 64 | | w: self.HasPaddingBottom ? self.PaddingBottom : 0 |
| | 65 | | ); |
| | 66 | | } |
| | 67 | |
|
| | 68 | | public static float GetLineSpacing(this PBTextShape self) |
| | 69 | | { |
| 21 | 70 | | return self.HasLineSpacing ? self.LineSpacing : 0; |
| | 71 | | } |
| | 72 | |
|
| | 73 | | public static Font GetFont(this PBTextShape self) |
| | 74 | | { |
| 21 | 75 | | return self.HasFont ? self.Font : Font.FSansSerif; |
| | 76 | | } |
| | 77 | |
|
| | 78 | | public static float GetShadowOffsetX(this PBTextShape self) |
| | 79 | | { |
| 20 | 80 | | return self.HasShadowOffsetX ? self.ShadowOffsetX : 0; |
| | 81 | | } |
| | 82 | |
|
| | 83 | | public static float GetShadowOffsetY(this PBTextShape self) |
| | 84 | | { |
| 20 | 85 | | return self.HasShadowOffsetY ? self.ShadowOffsetY : 0; |
| | 86 | | } |
| | 87 | |
|
| | 88 | | public static float GetShadowBlur(this PBTextShape self) |
| | 89 | | { |
| 20 | 90 | | return self.HasShadowBlur ? self.ShadowBlur : 0; |
| | 91 | | } |
| | 92 | |
|
| | 93 | | public static float GetOutlineWidth(this PBTextShape self) |
| | 94 | | { |
| 20 | 95 | | return self.HasOutlineWidth ? self.OutlineWidth : 0; |
| | 96 | | } |
| | 97 | | } |
| | 98 | | } |