| | 1 | | using DCL; |
| | 2 | | using DCL.Controllers; |
| | 3 | | using DCL.ECS7.InternalComponents; |
| | 4 | | using DCL.ECSRuntime; |
| | 5 | | using DCL.Models; |
| | 6 | | using System; |
| | 7 | | using System.Collections.Generic; |
| | 8 | | using UnityEngine.UIElements; |
| | 9 | |
|
| | 10 | | namespace ECSSystems.ScenesUiSystem |
| | 11 | | { |
| | 12 | | public class ECSScenesUiSystem : IDisposable |
| | 13 | | { |
| | 14 | | private readonly UIDocument uiDocument; |
| | 15 | | private readonly IInternalECSComponent<InternalUiContainer> internalUiContainerComponent; |
| | 16 | | private readonly IWorldState worldState; |
| | 17 | | private readonly BaseList<IParcelScene> loadedScenes; |
| | 18 | | private readonly BooleanVariable hideUiEventVariable; |
| | 19 | | private readonly BaseVariable<bool> isCurrentSceneUiEnabled; |
| | 20 | | private readonly BaseDictionary<int, bool> isSceneUIEnabled; |
| 13 | 21 | | private readonly List<IParcelScene> globalScenesAddedBuffer = new (); |
| | 22 | |
|
| | 23 | | private int lastSceneNumber; |
| | 24 | | private bool isPendingSceneUI; |
| | 25 | | private IParcelScene currentScene; |
| 13 | 26 | | private HashSet<IParcelScene> scenesUiToSort = new (); |
| | 27 | |
|
| 13 | 28 | | public ECSScenesUiSystem(UIDocument uiDocument, |
| | 29 | | IInternalECSComponent<InternalUiContainer> internalUiContainerComponent, |
| | 30 | | BaseList<IParcelScene> loadedScenes, |
| | 31 | | IWorldState worldState, |
| | 32 | | BooleanVariable hideUiEventVariable, |
| | 33 | | BaseVariable<bool> isCurrentSceneUiEnabled, |
| | 34 | | BaseDictionary<int, bool> isSceneUIEnabled) |
| | 35 | | { |
| 13 | 36 | | this.uiDocument = uiDocument; |
| 13 | 37 | | this.internalUiContainerComponent = internalUiContainerComponent; |
| 13 | 38 | | this.worldState = worldState; |
| 13 | 39 | | this.loadedScenes = loadedScenes; |
| 13 | 40 | | this.hideUiEventVariable = hideUiEventVariable; |
| 13 | 41 | | this.isCurrentSceneUiEnabled = isCurrentSceneUiEnabled; |
| 13 | 42 | | this.isSceneUIEnabled = isSceneUIEnabled; |
| | 43 | |
|
| 13 | 44 | | lastSceneNumber = -1; |
| 13 | 45 | | isPendingSceneUI = true; |
| 13 | 46 | | currentScene = null; |
| | 47 | |
|
| 13 | 48 | | loadedScenes.OnRemoved += LoadedScenesOnOnRemoved; |
| 13 | 49 | | hideUiEventVariable.OnChange += OnHideAllUiEvent; |
| 13 | 50 | | isCurrentSceneUiEnabled.OnChange += OnHideCurrentSceneUiEvent; |
| 13 | 51 | | isSceneUIEnabled.OnSet += OnSceneUiVisibilitySet; |
| 13 | 52 | | isSceneUIEnabled.OnAdded += OnSceneUiVisibilityAdded; |
| | 53 | |
|
| 13 | 54 | | OnHideAllUiEvent(hideUiEventVariable.Get(), false); |
| 13 | 55 | | } |
| | 56 | |
|
| | 57 | | public void Dispose() |
| | 58 | | { |
| 1 | 59 | | loadedScenes.OnRemoved -= LoadedScenesOnOnRemoved; |
| 1 | 60 | | hideUiEventVariable.OnChange -= OnHideAllUiEvent; |
| 1 | 61 | | isCurrentSceneUiEnabled.OnChange -= OnHideCurrentSceneUiEvent; |
| 1 | 62 | | isSceneUIEnabled.OnSet -= OnSceneUiVisibilitySet; |
| 1 | 63 | | isSceneUIEnabled.OnAdded -= OnSceneUiVisibilityAdded; |
| 1 | 64 | | } |
| | 65 | |
|
| | 66 | | public void Update() |
| | 67 | | { |
| 18 | 68 | | int currentSceneNumber = worldState.GetCurrentSceneNumber(); |
| 18 | 69 | | bool sceneChanged = lastSceneNumber != currentSceneNumber; |
| 18 | 70 | | lastSceneNumber = currentSceneNumber; |
| | 71 | |
|
| 18 | 72 | | globalScenesAddedBuffer.Clear(); |
| | 73 | |
|
| 18 | 74 | | ApplyParenting(ref scenesUiToSort, uiDocument, internalUiContainerComponent, currentSceneNumber, globalScene |
| | 75 | |
|
| | 76 | | // If parenting detects that the order for ui elements has changed, it should sort the ui tree |
| 18 | 77 | | if (scenesUiToSort.Count > 0) |
| 0 | 78 | | SortSceneUiTree(internalUiContainerComponent, scenesUiToSort); |
| | 79 | |
|
| 18 | 80 | | UpdatePortableExperiencesVisibilityByFeatureToggle(currentScene, globalScenesAddedBuffer); |
| | 81 | |
|
| | 82 | | // clear UI if scene changed |
| 18 | 83 | | if (sceneChanged && !isPendingSceneUI) |
| | 84 | | { |
| 4 | 85 | | ClearCurrentSceneUI(uiDocument, currentScene, internalUiContainerComponent); |
| 4 | 86 | | isPendingSceneUI = currentSceneNumber > 0; |
| | 87 | | } |
| | 88 | |
|
| 18 | 89 | | if (sceneChanged && currentScene != null && currentSceneNumber != currentScene.sceneData.sceneNumber) |
| | 90 | | { |
| 5 | 91 | | currentScene = null; |
| | 92 | | } |
| | 93 | |
|
| | 94 | | // UI not set for current scene yet |
| 18 | 95 | | if (isPendingSceneUI) |
| | 96 | | { |
| | 97 | | // we get current scene reference |
| 15 | 98 | | currentScene ??= GetCurrentScene(currentSceneNumber, loadedScenes); |
| | 99 | |
|
| | 100 | | // we apply current scene UI |
| 15 | 101 | | if (currentScene != null) |
| | 102 | | { |
| 12 | 103 | | if (ApplySceneUI(internalUiContainerComponent, uiDocument, currentScene, isCurrentSceneUiEnabled, is |
| 10 | 104 | | isPendingSceneUI = false; |
| | 105 | |
|
| 12 | 106 | | UpdatePortableExperiencesVisibilityByFeatureToggle(currentScene, loadedScenes); |
| | 107 | | } |
| | 108 | | } |
| 18 | 109 | | } |
| | 110 | |
|
| | 111 | | private void LoadedScenesOnOnRemoved(IParcelScene scene) |
| | 112 | | { |
| 0 | 113 | | if (scene.sceneData.sceneNumber == lastSceneNumber) |
| | 114 | | { |
| 0 | 115 | | lastSceneNumber = -1; |
| | 116 | | } |
| 0 | 117 | | } |
| | 118 | |
|
| | 119 | | private void OnHideAllUiEvent(bool current, bool previous) |
| | 120 | | { |
| 15 | 121 | | SetDocumentActive(uiDocument, !current); |
| 15 | 122 | | } |
| | 123 | |
|
| | 124 | | private void OnHideCurrentSceneUiEvent(bool enabled, bool previous) |
| | 125 | | { |
| 2 | 126 | | if (currentScene == null) |
| 0 | 127 | | return; |
| | 128 | |
|
| 2 | 129 | | ECSComponentData<InternalUiContainer>? currentSceneContainer = |
| | 130 | | internalUiContainerComponent.GetFor(currentScene, SpecialEntityId.SCENE_ROOT_ENTITY); |
| | 131 | |
|
| 2 | 132 | | if (currentSceneContainer == null) |
| 0 | 133 | | return; |
| | 134 | |
|
| 2 | 135 | | InternalUiContainer model = currentSceneContainer.Value.model; |
| 2 | 136 | | model.rootElement.style.display = new StyleEnum<DisplayStyle>(enabled ? DisplayStyle.Flex : DisplayStyle.Non |
| 2 | 137 | | } |
| | 138 | |
|
| | 139 | | internal static void ApplyParenting(ref HashSet<IParcelScene> scenesToSort, |
| | 140 | | UIDocument uiDocument, |
| | 141 | | IInternalECSComponent<InternalUiContainer> internalUiContainerComponent, |
| | 142 | | int currentSceneNumber, |
| | 143 | | List<IParcelScene> globalScenesAdded = null) |
| | 144 | | { |
| | 145 | | // Clear previous call so we do not accumulate |
| 24 | 146 | | scenesToSort.Clear(); |
| | 147 | |
|
| | 148 | | // check for orphan ui containers |
| 24 | 149 | | var allContainers = internalUiContainerComponent.GetForAll(); |
| | 150 | |
|
| 132 | 151 | | for (int i = 0; i < allContainers.Count; i++) |
| | 152 | | { |
| 42 | 153 | | var uiContainerData = allContainers[i].value; |
| | 154 | |
|
| | 155 | | // check if ui should be sort (only current and global scenes) |
| 42 | 156 | | if (uiContainerData.model.shouldSort |
| | 157 | | && (uiContainerData.scene.isPersistent || uiContainerData.scene.sceneData.sceneNumber == currentScen |
| | 158 | | { |
| 1 | 159 | | scenesToSort.Add(uiContainerData.scene); |
| | 160 | | } |
| | 161 | |
|
| | 162 | | // add global scenes ui but |
| | 163 | | // skip non-global scenes ui containers on root entity since no parenting is needed |
| 42 | 164 | | if (uiContainerData.entity.entityId == SpecialEntityId.SCENE_ROOT_ENTITY) |
| | 165 | | { |
| 31 | 166 | | var model = uiContainerData.model; |
| | 167 | |
|
| 31 | 168 | | if (uiContainerData.scene.isPersistent && model.parentElement == null) |
| | 169 | | { |
| 2 | 170 | | uiDocument.rootVisualElement.Add(model.rootElement); |
| 2 | 171 | | model.parentElement = uiDocument.rootVisualElement; |
| 2 | 172 | | internalUiContainerComponent.PutFor(uiContainerData.scene, uiContainerData.entity, model); |
| 2 | 173 | | globalScenesAdded?.Add(uiContainerData.scene); |
| | 174 | | } |
| | 175 | |
|
| 2 | 176 | | continue; |
| | 177 | | } |
| | 178 | |
|
| | 179 | | // skip containers with parent already set |
| 11 | 180 | | if (uiContainerData.model.parentElement != null) |
| | 181 | | continue; |
| | 182 | |
|
| 11 | 183 | | var parentDataModel = GetParentContainerModel( |
| | 184 | | internalUiContainerComponent, |
| | 185 | | uiContainerData.scene, |
| | 186 | | uiContainerData.model.parentId); |
| | 187 | |
|
| | 188 | | // apply parenting |
| 11 | 189 | | if (parentDataModel != null) |
| | 190 | | { |
| 10 | 191 | | var currentContainerModel = uiContainerData.model; |
| 10 | 192 | | parentDataModel.Value.rootElement.Add(uiContainerData.model.rootElement); |
| 10 | 193 | | currentContainerModel.parentElement = parentDataModel.Value.rootElement; |
| | 194 | |
|
| 10 | 195 | | internalUiContainerComponent.PutFor(uiContainerData.scene, uiContainerData.model.parentId, parentDat |
| 10 | 196 | | internalUiContainerComponent.PutFor(uiContainerData.scene, uiContainerData.entity, currentContainerM |
| | 197 | | } |
| | 198 | | } |
| 24 | 199 | | } |
| | 200 | |
|
| | 201 | | internal static void ClearCurrentSceneUI(UIDocument uiDocument, IParcelScene currentScene, |
| | 202 | | IInternalECSComponent<InternalUiContainer> internalUiContainerComponent) |
| | 203 | | { |
| 5 | 204 | | ECSComponentData<InternalUiContainer>? currentSceneContainer = |
| | 205 | | internalUiContainerComponent.GetFor(currentScene, SpecialEntityId.SCENE_ROOT_ENTITY); |
| | 206 | |
|
| 5 | 207 | | if (currentSceneContainer == null) |
| 0 | 208 | | return; |
| | 209 | |
|
| 5 | 210 | | InternalUiContainer model = currentSceneContainer.Value.model; |
| 5 | 211 | | model.parentElement = null; |
| | 212 | |
|
| 5 | 213 | | if (uiDocument.rootVisualElement.Contains(model.rootElement)) |
| | 214 | | { |
| 5 | 215 | | uiDocument.rootVisualElement.Remove(model.rootElement); |
| | 216 | | } |
| | 217 | |
|
| 5 | 218 | | internalUiContainerComponent.PutFor(currentScene, SpecialEntityId.SCENE_ROOT_ENTITY, model); |
| 5 | 219 | | } |
| | 220 | |
|
| | 221 | | internal static IParcelScene GetCurrentScene(int sceneNumber, IList<IParcelScene> loadedScenes) |
| | 222 | | { |
| 19 | 223 | | if (sceneNumber <= 0) |
| 2 | 224 | | return null; |
| | 225 | |
|
| 17 | 226 | | IParcelScene currentScene = null; |
| | 227 | |
|
| 44 | 228 | | for (int i = 0; i < loadedScenes.Count; i++) |
| | 229 | | { |
| 19 | 230 | | if (loadedScenes[i].sceneData.sceneNumber == sceneNumber) |
| | 231 | | { |
| 14 | 232 | | currentScene = loadedScenes[i]; |
| 14 | 233 | | break; |
| | 234 | | } |
| | 235 | | } |
| | 236 | |
|
| 17 | 237 | | return currentScene; |
| | 238 | | } |
| | 239 | |
|
| | 240 | | internal static bool ApplySceneUI(IInternalECSComponent<InternalUiContainer> internalUiContainerComponent, |
| | 241 | | UIDocument uiDocument, IParcelScene currentScene, |
| | 242 | | BaseVariable<bool> isCurrentSceneUIEnabled, |
| | 243 | | BaseDictionary<int, bool> isSceneUiEnabled) |
| | 244 | | { |
| 20 | 245 | | ECSComponentData<InternalUiContainer>? sceneRootUiContainer = |
| | 246 | | internalUiContainerComponent.GetFor(currentScene, SpecialEntityId.SCENE_ROOT_ENTITY); |
| | 247 | |
|
| 20 | 248 | | if (sceneRootUiContainer != null) |
| | 249 | | { |
| 17 | 250 | | bool isVisible = isCurrentSceneUIEnabled.Get(); |
| | 251 | |
|
| 17 | 252 | | if (isSceneUiEnabled.TryGetValue(currentScene.sceneData.sceneNumber, out bool enabled)) |
| 0 | 253 | | isVisible &= enabled; |
| | 254 | |
|
| 17 | 255 | | var model = sceneRootUiContainer.Value.model; |
| 17 | 256 | | uiDocument.rootVisualElement.Insert(0, model.rootElement); |
| 17 | 257 | | model.parentElement = uiDocument.rootVisualElement; |
| 17 | 258 | | model.rootElement.style.display = new StyleEnum<DisplayStyle>(isVisible ? DisplayStyle.Flex : DisplaySty |
| 17 | 259 | | internalUiContainerComponent.PutFor(currentScene, SpecialEntityId.SCENE_ROOT_ENTITY, model); |
| 17 | 260 | | return true; |
| | 261 | | } |
| | 262 | |
|
| 3 | 263 | | return false; |
| | 264 | | } |
| | 265 | |
|
| | 266 | | private static InternalUiContainer? GetParentContainerModel(IInternalECSComponent<InternalUiContainer> internalU |
| | 267 | | IParcelScene scene, long parentId) |
| | 268 | | { |
| 11 | 269 | | InternalUiContainer? parentDataModel = |
| | 270 | | internalUiContainerComponent.GetFor(scene, parentId)?.model; |
| | 271 | |
|
| | 272 | | // create root entity ui container if needed |
| 11 | 273 | | if (parentDataModel == null && parentId == SpecialEntityId.SCENE_ROOT_ENTITY) |
| | 274 | | { |
| 4 | 275 | | parentDataModel = new InternalUiContainer(parentId); |
| 4 | 276 | | var style = parentDataModel.Value.rootElement.style; |
| | 277 | |
|
| | 278 | | // Initialize with default values |
| 4 | 279 | | parentDataModel.Value.rootElement.pickingMode = PickingMode.Ignore; // to avoid blocking pointer |
| 4 | 280 | | style.width = new Length(100f, LengthUnit.Percent); |
| 4 | 281 | | style.height = new Length(100f, LengthUnit.Percent); |
| 4 | 282 | | style.flexDirection = new StyleEnum<FlexDirection>(FlexDirection.Row); |
| 4 | 283 | | style.flexBasis = new StyleLength(StyleKeyword.Auto); |
| 4 | 284 | | style.flexGrow = 0; |
| 4 | 285 | | style.flexShrink = 1; |
| 4 | 286 | | style.flexWrap = new StyleEnum<Wrap>(Wrap.NoWrap); |
| 4 | 287 | | style.justifyContent = new StyleEnum<Justify>(Justify.FlexStart); |
| 4 | 288 | | style.alignItems = new StyleEnum<Align>(Align.Stretch); |
| 4 | 289 | | style.alignSelf = new StyleEnum<Align>(Align.Auto); |
| 4 | 290 | | style.alignContent = new StyleEnum<Align>(Align.Stretch); |
| 4 | 291 | | style.position = new StyleEnum<Position>(Position.Absolute); |
| | 292 | | } |
| | 293 | |
|
| 11 | 294 | | return parentDataModel; |
| | 295 | | } |
| | 296 | |
|
| | 297 | | internal static void SortSceneUiTree(IInternalECSComponent<InternalUiContainer> internalUiContainerComponent, |
| | 298 | | ICollection<IParcelScene> scenesToSort) |
| | 299 | | { |
| 3 | 300 | | Dictionary<VisualElement, Dictionary<long, RightOfData>> sortSceneTree = new Dictionary<VisualElement, Dicti |
| | 301 | |
|
| | 302 | | // Setup UI sorting |
| 3 | 303 | | var allContainers = internalUiContainerComponent.GetForAll(); |
| | 304 | |
|
| 38 | 305 | | for (int i = 0; i < allContainers.Count; i++) |
| | 306 | | { |
| 16 | 307 | | var uiContainerData = allContainers[i].value; |
| | 308 | |
|
| 16 | 309 | | if (!scenesToSort.Contains(uiContainerData.scene)) |
| | 310 | | continue; |
| | 311 | |
|
| 16 | 312 | | InternalUiContainer model = uiContainerData.model; |
| | 313 | |
|
| | 314 | | // If not parented yet, we skip it |
| 16 | 315 | | if (model.parentElement == null) |
| | 316 | | continue; |
| | 317 | |
|
| | 318 | | // Ignore root scene UI container |
| 13 | 319 | | if (uiContainerData.entity.entityId == SpecialEntityId.SCENE_ROOT_ENTITY) |
| | 320 | | continue; |
| | 321 | |
|
| 13 | 322 | | if (!sortSceneTree.TryGetValue(model.parentElement, out var sceneTreeDictionary)) |
| | 323 | | { |
| 5 | 324 | | sceneTreeDictionary = new Dictionary<long, RightOfData>(); |
| 5 | 325 | | sortSceneTree[model.parentElement] = sceneTreeDictionary; |
| | 326 | | } |
| | 327 | |
|
| 13 | 328 | | sceneTreeDictionary[model.rightOf] = new RightOfData(model.rootElement, |
| | 329 | | uiContainerData.entity.entityId); |
| | 330 | |
|
| 13 | 331 | | model.shouldSort = false; |
| 13 | 332 | | internalUiContainerComponent.PutFor(uiContainerData.scene, uiContainerData.entity.entityId, model); |
| | 333 | | } |
| | 334 | |
|
| | 335 | | // Apply UI sorting |
| 16 | 336 | | foreach (var pairs in sortSceneTree) |
| | 337 | | { |
| 5 | 338 | | VisualElement parentElement = pairs.Key; |
| 5 | 339 | | Dictionary<long, RightOfData> sceneSort = pairs.Value; |
| | 340 | |
|
| 5 | 341 | | int index = 0; |
| 5 | 342 | | long nextElementId = 0; |
| | 343 | |
|
| 18 | 344 | | while (sceneSort.TryGetValue(nextElementId, out RightOfData rightOfData)) |
| | 345 | | { |
| 13 | 346 | | sceneSort.Remove(nextElementId); |
| 13 | 347 | | rightOfData.element.PlaceInFront(parentElement[index]); |
| 13 | 348 | | nextElementId = rightOfData.id; |
| 13 | 349 | | index++; |
| 13 | 350 | | } |
| | 351 | | } |
| 3 | 352 | | } |
| | 353 | |
|
| | 354 | | private static void SetDocumentActive(UIDocument uiDocument, bool active) |
| | 355 | | { |
| 15 | 356 | | uiDocument.rootVisualElement.style.display = active ? DisplayStyle.Flex : DisplayStyle.None; |
| 15 | 357 | | } |
| | 358 | |
|
| | 359 | | private void OnSceneUiVisibilityAdded(int sceneNumber, bool enabled) |
| | 360 | | { |
| 3 | 361 | | int currentSceneNumber = worldState.GetCurrentSceneNumber(); |
| 3 | 362 | | IParcelScene currentScene = worldState.GetScene(currentSceneNumber); |
| | 363 | |
|
| 3 | 364 | | if (enabled |
| | 365 | | && currentScene != null |
| | 366 | | && currentScene.sceneData.sceneNumber != sceneNumber |
| | 367 | | && currentScene.sceneData.scenePortableExperienceFeatureToggles == ScenePortableExperienceFeatureToggles |
| 1 | 368 | | return; |
| | 369 | |
|
| 2 | 370 | | SetSceneUiVisibility(sceneNumber, enabled); |
| 2 | 371 | | } |
| | 372 | |
|
| | 373 | | private void OnSceneUiVisibilitySet(IEnumerable<KeyValuePair<int, bool>> list) |
| | 374 | | { |
| 0 | 375 | | foreach ((int sceneNumber, bool enabled) in list) |
| 0 | 376 | | OnSceneUiVisibilityAdded(sceneNumber, enabled); |
| 0 | 377 | | } |
| | 378 | |
|
| | 379 | | private void SetSceneUiVisibility(int sceneNumber, bool enabled) |
| | 380 | | { |
| 2 | 381 | | IParcelScene scene = GetCurrentScene(sceneNumber, loadedScenes); |
| | 382 | |
|
| 2 | 383 | | if (scene == null) return; |
| | 384 | |
|
| 2 | 385 | | ECSComponentData<InternalUiContainer>? sceneUiContainer = |
| | 386 | | internalUiContainerComponent.GetFor(scene, SpecialEntityId.SCENE_ROOT_ENTITY); |
| | 387 | |
|
| 2 | 388 | | if (sceneUiContainer == null) return; |
| | 389 | |
|
| 2 | 390 | | sceneUiContainer.Value.model.rootElement.style.display = |
| | 391 | | new StyleEnum<DisplayStyle>(enabled ? DisplayStyle.Flex : DisplayStyle.None); |
| 2 | 392 | | } |
| | 393 | |
|
| | 394 | | private void UpdatePortableExperiencesVisibilityByFeatureToggle(IParcelScene currentScene, IReadOnlyList<IParcel |
| | 395 | | { |
| 42 | 396 | | if (currentScene == null) return; |
| | 397 | |
|
| 80 | 398 | | for (var i = 0; i < scenes.Count; i++) |
| | 399 | | { |
| 22 | 400 | | IParcelScene pxScene = scenes[i]; |
| 22 | 401 | | if (!pxScene.isPortableExperience) continue; |
| | 402 | |
|
| 0 | 403 | | ScenePortableExperienceFeatureToggles featureToggle = |
| | 404 | | currentScene.sceneData.scenePortableExperienceFeatureToggles; |
| | 405 | |
|
| 0 | 406 | | if (featureToggle == ScenePortableExperienceFeatureToggles.HideUi) |
| 0 | 407 | | SetSceneUiVisibility(pxScene.sceneData.sceneNumber, false); |
| | 408 | | } |
| 18 | 409 | | } |
| | 410 | |
|
| | 411 | | private readonly struct RightOfData |
| | 412 | | { |
| | 413 | | public readonly long id; |
| | 414 | | public readonly VisualElement element; |
| | 415 | |
|
| | 416 | | public RightOfData(VisualElement element, long id) |
| | 417 | | { |
| 13 | 418 | | this.id = id; |
| 13 | 419 | | this.element = element; |
| 13 | 420 | | } |
| | 421 | | } |
| | 422 | | } |
| | 423 | | } |