public static Int4?Combine(Int4?left, Int4?right, bool important) { if (left == null) { return(right ?? null); } if (right == null) { return(left); } var result = new Int4 { left = left.left, right = left.right, top = left.top, bottom = left.bottom }; if (left.left == null) { result.left = right.left; } else if (important && right.left != null) { result.left = right.left; } if (left.right == null) { result.right = right.right; } else if (important && right.right != null) { result.right = right.right; } if (left.top == null) { result.top = right.top; } else if (important && right.top != null) { result.top = right.top; } if (left.bottom == null) { result.bottom = right.bottom; } else if (important && right.bottom != null) { result.bottom = right.bottom; } return(result); }
private static GUIStyleCombine ApplyStyles(GUIStyleCombine target, GUIStyleCombine other) { var result = new GUIStyleCombine(new GUIStyleDescription(target.Description), target.Important); if (target.Description.Alignment == null) { result.Description.Alignment = other.Description.Alignment; } else if (other.Important && other.Description.Alignment != null) { result.Description.Alignment = other.Description.Alignment; } result.Description.Border = Int4.Combine(target.Description.Border, other.Description.Border, other.Important); result.Description.Margin = Int4.Combine(target.Description.Margin, other.Description.Margin, other.Important); result.Description.Padding = Int4.Combine(target.Description.Padding, other.Description.Padding, other.Important); result.Description.Overflow = Int4.Combine(target.Description.Overflow, other.Description.Overflow, other.Important); if (target.Description.Clipping == null) { result.Description.Clipping = other.Description.Clipping; } else if (other.Important && other.Description.Clipping != null) { result.Description.Clipping = other.Description.Clipping; } if (target.Description.Font == null) { result.Description.Font = other.Description.Font; } else if (other.Important && other.Description.Font != null) { result.Description.Font = other.Description.Font; } if (target.Description.FixedWidth == null) { result.Description.FixedWidth = other.Description.FixedWidth; } else if (other.Important && other.Description.FixedWidth != null) { result.Description.FixedWidth = other.Description.FixedWidth; } if (target.Description.FixedHeight == null) { result.Description.FixedHeight = other.Description.FixedHeight; } else if (other.Important && other.Description.FixedHeight != null) { result.Description.FixedHeight = other.Description.FixedHeight; } if (target.Description.ContentOffset == null) { result.Description.ContentOffset = other.Description.ContentOffset; } else if (other.Important && other.Description.ContentOffset != null) { result.Description.ContentOffset = other.Description.ContentOffset; } if (target.Description.FontSize == null) { result.Description.FontSize = other.Description.FontSize; } else if (other.Important && other.Description.FontSize != null) { result.Description.FontSize = other.Description.FontSize; } if (target.Description.FontStyle == null) { result.Description.FontStyle = other.Description.FontStyle; } else if (other.Important && other.Description.FontStyle != null) { result.Description.FontStyle = other.Description.FontStyle; } if (target.Description.ImagePosition == null) { result.Description.ImagePosition = other.Description.ImagePosition; } else if (other.Important && other.Description.ImagePosition != null) { result.Description.ImagePosition = other.Description.ImagePosition; } if (target.Description.RichText == null) { result.Description.RichText = other.Description.RichText; } else if (other.Important && other.Description.RichText != null) { result.Description.RichText = other.Description.RichText; } if (target.Description.StretchWidth == null) { result.Description.StretchWidth = other.Description.StretchWidth; } else if (other.Important && other.Description.StretchWidth != null) { result.Description.StretchWidth = other.Description.StretchWidth; } if (target.Description.StretchHeight == null) { result.Description.StretchHeight = other.Description.StretchHeight; } else if (other.Important && other.Description.StretchHeight != null) { result.Description.StretchHeight = other.Description.StretchHeight; } if (target.Description.WordWrap == null) { result.Description.WordWrap = other.Description.WordWrap; } else if (other.Important && other.Description.WordWrap != null) { result.Description.WordWrap = other.Description.WordWrap; } if (target.Description.Normal == null) { result.Description.Normal = other.Description.Normal; } else if (other.Important && other.Description.Normal != null) { result.Description.Normal = other.Description.Normal; } if (target.Description.Active == null) { result.Description.Active = other.Description.Active; } else if (other.Important && other.Description.Active != null) { result.Description.Active = other.Description.Active; } if (target.Description.Focused == null) { result.Description.Focused = other.Description.Focused; } else if (other.Important && other.Description.Focused != null) { result.Description.Focused = other.Description.Focused; } if (target.Description.Hover == null) { result.Description.Hover = other.Description.Hover; } else if (other.Important && other.Description.Hover != null) { result.Description.Hover = other.Description.Hover; } if (target.Description.OnNormal == null) { result.Description.OnNormal = other.Description.OnNormal; } else if (other.Important && other.Description.OnNormal != null) { result.Description.OnNormal = other.Description.OnNormal; } if (target.Description.OnActive == null) { result.Description.OnActive = other.Description.OnActive; } else if (other.Important && other.Description.OnActive != null) { result.Description.OnActive = other.Description.OnActive; } if (target.Description.OnFocused == null) { result.Description.OnFocused = other.Description.OnFocused; } else if (other.Important && other.Description.OnFocused != null) { result.Description.OnFocused = other.Description.OnFocused; } if (target.Description.OnHover == null) { result.Description.OnHover = other.Description.OnHover; } else if (other.Important && other.Description.OnHover != null) { result.Description.OnHover = other.Description.OnHover; } if (target.Description.TextColor == null) { result.Description.TextColor = other.Description.TextColor; } else if (other.Important && other.Description.TextColor != null) { result.Description.TextColor = other.Description.TextColor; } return(result); }