| | | 1 | | // Copyright (c) 2020-2024 dotBunny Inc. |
| | | 2 | | // dotBunny licenses this file to you under the BSL-1.0 license. |
| | | 3 | | // See the LICENSE file in the project root for more information. |
| | | 4 | | |
| | | 5 | | #if !UNITY_DOTSRUNTIME |
| | | 6 | | |
| | | 7 | | namespace GDX.Developer.Reports.Resource |
| | | 8 | | { |
| | | 9 | | /// <summary> |
| | | 10 | | /// Context for generating a <see cref="ResourceReport" /> based report. |
| | | 11 | | /// </summary> |
| | | 12 | | /// <exception cref="UnsupportedRuntimeException">Not supported on DOTS Runtime.</exception> |
| | | 13 | | public sealed class ResourceReportContext |
| | | 14 | | { |
| | | 15 | | public readonly int CharacterWidth; |
| | | 16 | | public readonly int KeyValuePairInfoWidth; |
| | | 17 | | public readonly int KeyValuePairWidth; |
| | | 18 | | public readonly int ObjectInfoWidth; |
| | | 19 | | public readonly int ObjectNameWidth; |
| | | 20 | | public readonly int ObjectSizeWidth; |
| | | 21 | | |
| | | 22 | | public readonly int ObjectTypeWidth; |
| | | 23 | | |
| | 7 | 24 | | public ResourceReportContext(int characterWidth = 120) |
| | 7 | 25 | | { |
| | 7 | 26 | | CharacterWidth = characterWidth; |
| | 7 | 27 | | KeyValuePairWidth = characterWidth / 3; |
| | 7 | 28 | | KeyValuePairInfoWidth = (CharacterWidth - KeyValuePairWidth) / 2; |
| | | 29 | | |
| | 7 | 30 | | float percent = characterWidth / 100f; |
| | | 31 | | |
| | 7 | 32 | | ObjectTypeWidth = (int)percent * 15; |
| | 7 | 33 | | ObjectNameWidth = (int)(percent * 33.333f); |
| | 7 | 34 | | ObjectSizeWidth = (int)percent * 11; |
| | | 35 | | |
| | 7 | 36 | | ObjectInfoWidth = characterWidth - (ObjectTypeWidth + ObjectNameWidth + ObjectSizeWidth + 3); |
| | 7 | 37 | | } |
| | | 38 | | } |
| | | 39 | | } |
| | | 40 | | #endif // !UNITY_DOTSRUNTIME |