| | 1 | | using DCL; |
| | 2 | | using DCL.Configuration; |
| | 3 | | using DCL.Controllers; |
| | 4 | | using DCL.Tutorial; |
| | 5 | | using Newtonsoft.Json; |
| | 6 | | using System; |
| | 7 | | using System.Collections; |
| | 8 | | using System.Collections.Generic; |
| | 9 | | using System.Linq; |
| | 10 | | using UnityEngine; |
| | 11 | | using Environment = DCL.Environment; |
| | 12 | |
|
| | 13 | | public class BuilderInWorld : PluginFeature |
| | 14 | | { |
| | 15 | | internal static bool BYPASS_LAND_OWNERSHIP_CHECK = false; |
| | 16 | | private const float DISTANCE_TO_DISABLE_BUILDER_IN_WORLD = 45f; |
| | 17 | | private const float MAX_DISTANCE_STOP_TRYING_TO_ENTER = 16; |
| | 18 | |
|
| | 19 | | private GameObject cursorGO; |
| | 20 | | private InputController inputController; |
| | 21 | | private GameObject[] groundVisualsGO; |
| | 22 | |
|
| 0 | 23 | | internal IBIWOutlinerController outlinerController => context.outlinerController; |
| 0 | 24 | | internal IBIWInputHandler inputHandler => context.inputHandler; |
| 0 | 25 | | internal IBIWPublishController publishController => context.publishController; |
| 0 | 26 | | internal IBIWCreatorController creatorController => context.creatorController; |
| 0 | 27 | | internal IBIWModeController modeController => context.modeController; |
| 0 | 28 | | internal IBIWFloorHandler floorHandler => context.floorHandler; |
| 0 | 29 | | internal IBIWEntityHandler entityHandler => context.entityHandler; |
| 0 | 30 | | internal IBIWActionController actionController => context.actionController; |
| 0 | 31 | | internal IBIWSaveController saveController => context.saveController; |
| 0 | 32 | | internal IBIWInputWrapper inputWrapper => context.inputWrapper; |
| 0 | 33 | | internal IBIWRaycastController raycastController => context.raycastController; |
| 0 | 34 | | internal IBIWGizmosController gizmosController => context.gizmosController; |
| | 35 | |
|
| | 36 | | private BuilderInWorldBridge builderInWorldBridge; |
| | 37 | | private BuilderInWorldAudioHandler biwAudioHandler; |
| | 38 | | internal BIWContext context; |
| | 39 | |
|
| 25 | 40 | | private readonly List<IBIWController> controllers = new List<IBIWController>(); |
| | 41 | |
|
| | 42 | | internal ParcelScene sceneToEdit; |
| | 43 | | private BiwSceneMetricsAnalyticsHelper sceneMetricsAnalyticsHelper; |
| | 44 | |
|
| | 45 | | private Material skyBoxMaterial; |
| | 46 | |
|
| 0 | 47 | | public bool isBuilderInWorldActivated { get; internal set; } = false; |
| | 48 | |
|
| | 49 | | private InputAction_Trigger editModeChangeInputAction; |
| | 50 | |
|
| | 51 | | internal int checkerInsideSceneOptimizationCounter = 0; |
| | 52 | | internal string sceneToEditId; |
| | 53 | | internal bool catalogAdded = false; |
| | 54 | | private bool sceneReady = false; |
| | 55 | | private bool isInit = false; |
| | 56 | | private Material previousSkyBoxMaterial; |
| | 57 | | private Vector3 parcelUnityMiddlePoint; |
| | 58 | | private bool previousAllUIHidden; |
| | 59 | | private WebRequestAsyncOperation catalogAsyncOp; |
| | 60 | | private bool isCatalogLoading = false; |
| | 61 | | private bool areCatalogHeadersAsked = false; |
| | 62 | | internal bool areCatalogHeadersReady = false; |
| | 63 | | private float beginStartFlowTimeStamp = 0; |
| | 64 | | private float startEditorTimeStamp = 0; |
| | 65 | | internal bool isCatalogRequested = false; |
| | 66 | | internal bool isEnteringEditMode = false; |
| | 67 | | private bool activeFeature = false; |
| | 68 | | private int catalogsReceivedAmount = 0; |
| | 69 | |
|
| | 70 | | internal IBuilderInWorldLoadingController initialLoadingController; |
| | 71 | |
|
| | 72 | | private UserProfile userProfile; |
| | 73 | | internal Coroutine updateLandsWithAcessCoroutine; |
| | 74 | | private Dictionary<string, string> catalogCallHeaders; |
| | 75 | |
|
| | 76 | | internal bool isWaitingForPermission = false; |
| | 77 | | private bool alreadyAskedForLandPermissions = false; |
| | 78 | | private Vector3 askPermissionLastPosition; |
| | 79 | |
|
| 25 | 80 | | public BuilderInWorld() |
| | 81 | | { |
| 25 | 82 | | context = new BIWContext(); |
| 25 | 83 | | context.Initialize( |
| | 84 | | new BIWOutlinerController(), |
| | 85 | | new BIWInputHandler(), |
| | 86 | | new BIWInputWrapper(), |
| | 87 | | new BIWPublishController(), |
| | 88 | | new BIWCreatorController(), |
| | 89 | | new BIWModeController(), |
| | 90 | | new BIWFloorHandler(), |
| | 91 | | new BIWEntityHandler(), |
| | 92 | | new BIWActionController(), |
| | 93 | | new BIWSaveController(), |
| | 94 | | new BIWRaycastController(), |
| | 95 | | new BIWGizmosController(), |
| | 96 | | InitialSceneReferences.i.data |
| | 97 | | ); |
| 25 | 98 | | } |
| | 99 | |
|
| 0 | 100 | | public BuilderInWorld (BIWContext context) { this.context = context; } |
| | 101 | |
|
| | 102 | | public override void Initialize() |
| | 103 | | { |
| 25 | 104 | | base.Initialize(); |
| | 105 | |
|
| 25 | 106 | | if (isInit) |
| 0 | 107 | | return; |
| | 108 | |
|
| 25 | 109 | | activeFeature = true; |
| 25 | 110 | | isInit = true; |
| | 111 | |
|
| | 112 | | //We init the lands so we don't have a null reference |
| 25 | 113 | | DataStore.i.builderInWorld.landsWithAccess.Set(new LandWithAccess[0]); |
| | 114 | |
|
| 25 | 115 | | BIWCatalogManager.Init(); |
| | 116 | |
|
| 25 | 117 | | InitReferences(InitialSceneReferences.i.data); |
| | 118 | |
|
| 25 | 119 | | if (builderInWorldBridge != null) |
| | 120 | | { |
| 25 | 121 | | builderInWorldBridge.OnCatalogHeadersReceived += CatalogHeadersReceived; |
| 25 | 122 | | builderInWorldBridge.OnBuilderProjectInfo += BuilderProjectPanelInfo; |
| | 123 | | } |
| | 124 | |
|
| 25 | 125 | | InitHUD(); |
| | 126 | |
|
| 25 | 127 | | BIWTeleportAndEdit.OnTeleportEnd += OnPlayerTeleportedToEditScene; |
| | 128 | |
|
| 25 | 129 | | ConfigureLoadingController(); |
| 25 | 130 | | InitControllers(); |
| | 131 | |
|
| 25 | 132 | | CommonScriptableObjects.builderInWorldNotNecessaryUIVisibilityStatus.Set(true); |
| | 133 | |
|
| 25 | 134 | | userProfile = UserProfile.GetOwnUserProfile(); |
| | 135 | |
|
| 25 | 136 | | if (string.IsNullOrEmpty(userProfile.userId)) |
| 1 | 137 | | userProfile.OnUpdate += OnUserProfileUpdate; |
| | 138 | | else |
| 24 | 139 | | AskHeadersToKernel(); |
| | 140 | |
|
| | 141 | |
|
| 25 | 142 | | isCatalogLoading = true; |
| 25 | 143 | | BIWNFTController.i.Initialize(); |
| 25 | 144 | | BIWNFTController.i.OnNFTUsageChange += OnNFTUsageChange; |
| | 145 | |
|
| 25 | 146 | | editModeChangeInputAction = context.inputsReferencesAsset.editModeChangeInputAction; |
| 25 | 147 | | editModeChangeInputAction.OnTriggered += ChangeEditModeStatusByShortcut; |
| | 148 | |
|
| 25 | 149 | | biwAudioHandler = UnityEngine.Object.Instantiate(context.projectReferencesAsset.audioPrefab, Vector3.zero, Quate |
| 25 | 150 | | biwAudioHandler.Initialize(context); |
| 25 | 151 | | biwAudioHandler.gameObject.SetActive(false); |
| 25 | 152 | | } |
| | 153 | |
|
| | 154 | | private void AskHeadersToKernel() |
| | 155 | | { |
| 27 | 156 | | string ethAddress = string.IsNullOrEmpty(userProfile.ethAddress) ? "default" : userProfile.ethAddress; |
| 27 | 157 | | areCatalogHeadersAsked = true; |
| 27 | 158 | | builderInWorldBridge.AskKernelForCatalogHeadersWithParams("get", "/assetPacks?owner=" + ethAddress); |
| 27 | 159 | | } |
| | 160 | |
|
| | 161 | | public void InitReferences(InitialSceneReferences.Data sceneReferences) |
| | 162 | | { |
| 25 | 163 | | builderInWorldBridge = sceneReferences.builderInWorldBridge; |
| 25 | 164 | | cursorGO = sceneReferences.cursorCanvas; |
| 25 | 165 | | inputController = sceneReferences.inputController; |
| | 166 | |
|
| 25 | 167 | | List<GameObject> grounds = new List<GameObject>(); |
| | 168 | |
|
| 50 | 169 | | for (int i = 0; i < sceneReferences.groundVisual.transform.transform.childCount; i++) |
| | 170 | | { |
| 0 | 171 | | grounds.Add(sceneReferences.groundVisual.transform.transform.GetChild(i).gameObject); |
| | 172 | | } |
| | 173 | |
|
| 25 | 174 | | groundVisualsGO = grounds.ToArray(); |
| 25 | 175 | | skyBoxMaterial = context.projectReferencesAsset.skyBoxMaterial; |
| 25 | 176 | | } |
| | 177 | |
|
| | 178 | | private void InitBuilderProjectPanel() |
| | 179 | | { |
| 0 | 180 | | if (HUDController.i.builderProjectsPanelController != null) |
| 0 | 181 | | HUDController.i.builderProjectsPanelController.OnJumpInOrEdit += GetCatalog; |
| 0 | 182 | | } |
| | 183 | |
|
| | 184 | | private void InitHUD() |
| | 185 | | { |
| 25 | 186 | | HUDConfiguration hudConfig = new HUDConfiguration(); |
| 25 | 187 | | hudConfig.active = true; |
| 25 | 188 | | hudConfig.visible = false; |
| 25 | 189 | | HUDController.i.CreateHudElement(hudConfig, HUDElementID.BUILDER_IN_WORLD_MAIN); |
| 25 | 190 | | HUDController.i.OnBuilderProjectPanelCreation += InitBuilderProjectPanel; |
| | 191 | |
|
| 25 | 192 | | HUDController.i.builderInWorldMainHud.Initialize(); |
| | 193 | |
|
| 25 | 194 | | HUDController.i.builderInWorldMainHud.OnTutorialAction += StartTutorial; |
| 25 | 195 | | HUDController.i.builderInWorldMainHud.OnStartExitAction += StartExitMode; |
| 25 | 196 | | HUDController.i.builderInWorldMainHud.OnLogoutAction += ExitEditMode; |
| | 197 | |
|
| 25 | 198 | | if (HUDController.i.builderProjectsPanelController != null) |
| 0 | 199 | | HUDController.i.builderProjectsPanelController.OnJumpInOrEdit += GetCatalog; |
| 25 | 200 | | } |
| | 201 | |
|
| | 202 | | public override void Dispose() |
| | 203 | | { |
| 25 | 204 | | base.Dispose(); |
| | 205 | |
|
| 25 | 206 | | sceneMetricsAnalyticsHelper?.Dispose(); |
| | 207 | |
|
| 25 | 208 | | if (userProfile != null) |
| 25 | 209 | | userProfile.OnUpdate -= OnUserProfileUpdate; |
| | 210 | |
|
| 25 | 211 | | CoroutineStarter.Stop(updateLandsWithAcessCoroutine); |
| | 212 | |
|
| 25 | 213 | | if (sceneToEdit != null) |
| 13 | 214 | | sceneToEdit.OnLoadingStateUpdated -= UpdateSceneLoadingProgress; |
| | 215 | |
|
| 25 | 216 | | Environment.i.world.sceneController.OnNewSceneAdded -= NewSceneAdded; |
| 25 | 217 | | Environment.i.world.sceneController.OnReadyScene -= NewSceneReady; |
| | 218 | |
|
| 25 | 219 | | if (HUDController.i.builderInWorldMainHud != null) |
| | 220 | | { |
| 25 | 221 | | HUDController.i.builderInWorldMainHud.OnTutorialAction -= StartTutorial; |
| 25 | 222 | | HUDController.i.builderInWorldMainHud.OnStartExitAction -= StartExitMode; |
| 25 | 223 | | HUDController.i.builderInWorldMainHud.OnLogoutAction -= ExitEditMode; |
| | 224 | | } |
| | 225 | |
|
| 25 | 226 | | BIWTeleportAndEdit.OnTeleportEnd -= OnPlayerTeleportedToEditScene; |
| 25 | 227 | | DCLCharacterController.OnPositionSet -= ExitAfterCharacterTeleport; |
| | 228 | |
|
| 25 | 229 | | if (initialLoadingController != null) |
| 25 | 230 | | initialLoadingController.Dispose(); |
| | 231 | |
|
| 25 | 232 | | BIWNFTController.i.OnNFTUsageChange -= OnNFTUsageChange; |
| | 233 | |
|
| 25 | 234 | | BIWNFTController.i.Dispose(); |
| 25 | 235 | | builderInWorldBridge.OnCatalogHeadersReceived -= CatalogHeadersReceived; |
| 25 | 236 | | builderInWorldBridge.OnBuilderProjectInfo -= BuilderProjectPanelInfo; |
| | 237 | |
|
| 25 | 238 | | floorHandler.OnAllParcelsFloorLoaded -= OnAllParcelsFloorLoaded; |
| | 239 | |
|
| 25 | 240 | | CleanItems(); |
| | 241 | |
|
| 25 | 242 | | HUDController.i.OnBuilderProjectPanelCreation -= InitBuilderProjectPanel; |
| 25 | 243 | | editModeChangeInputAction.OnTriggered -= ChangeEditModeStatusByShortcut; |
| | 244 | |
|
| 25 | 245 | | if (biwAudioHandler.gameObject != null) |
| | 246 | | { |
| 25 | 247 | | biwAudioHandler.Dispose(); |
| 25 | 248 | | UnityEngine.Object.Destroy(biwAudioHandler.gameObject); |
| | 249 | | } |
| | 250 | |
|
| 25 | 251 | | context.Dispose(); |
| 25 | 252 | | } |
| | 253 | |
|
| | 254 | | public override void OnGUI() |
| | 255 | | { |
| 1 | 256 | | base.OnGUI(); |
| 1 | 257 | | if (!isBuilderInWorldActivated) |
| 0 | 258 | | return; |
| | 259 | |
|
| 28 | 260 | | foreach (var controller in controllers) |
| | 261 | | { |
| 13 | 262 | | controller.OnGUI(); |
| | 263 | | } |
| 1 | 264 | | } |
| | 265 | |
|
| | 266 | | public override void Update() |
| | 267 | | { |
| 3 | 268 | | base.Update(); |
| | 269 | |
|
| 3 | 270 | | if (isCatalogLoading && catalogAsyncOp?.webRequest != null) |
| 0 | 271 | | UpdateCatalogLoadingProgress(catalogAsyncOp.webRequest.downloadProgress * 100); |
| | 272 | |
|
| 3 | 273 | | if (!isBuilderInWorldActivated) |
| 1 | 274 | | return; |
| | 275 | |
|
| 54 | 276 | | foreach (var controller in controllers) |
| | 277 | | { |
| 25 | 278 | | controller.Update(); |
| | 279 | | } |
| | 280 | |
|
| 2 | 281 | | if (checkerInsideSceneOptimizationCounter >= 60) |
| | 282 | | { |
| 1 | 283 | | if (Vector3.Distance(DCLCharacterController.i.characterPosition.unityPosition, parcelUnityMiddlePoint) >= DI |
| 1 | 284 | | ExitEditMode(); |
| 1 | 285 | | checkerInsideSceneOptimizationCounter = 0; |
| 1 | 286 | | } |
| | 287 | | else |
| | 288 | | { |
| 1 | 289 | | checkerInsideSceneOptimizationCounter++; |
| | 290 | | } |
| 1 | 291 | | } |
| | 292 | |
|
| | 293 | | public override void LateUpdate() |
| | 294 | | { |
| 1 | 295 | | if (!isBuilderInWorldActivated) |
| 0 | 296 | | return; |
| | 297 | |
|
| 28 | 298 | | foreach (var controller in controllers) |
| | 299 | | { |
| 13 | 300 | | controller.LateUpdate(); |
| | 301 | | } |
| 1 | 302 | | } |
| | 303 | |
|
| | 304 | | private void OnNFTUsageChange() |
| | 305 | | { |
| 0 | 306 | | HUDController.i.builderInWorldMainHud.RefreshCatalogAssetPack(); |
| 0 | 307 | | HUDController.i.builderInWorldMainHud.RefreshCatalogContent(); |
| 0 | 308 | | } |
| | 309 | |
|
| | 310 | | internal void ActivateLandAccessBackgroundChecker() |
| | 311 | | { |
| 3 | 312 | | userProfile = UserProfile.GetOwnUserProfile(); |
| 3 | 313 | | if (!string.IsNullOrEmpty(userProfile.userId)) |
| | 314 | | { |
| 3 | 315 | | if (updateLandsWithAcessCoroutine != null) |
| 0 | 316 | | CoroutineStarter.Stop(updateLandsWithAcessCoroutine); |
| 3 | 317 | | updateLandsWithAcessCoroutine = CoroutineStarter.Start(CheckLandsAccess()); |
| | 318 | | } |
| 3 | 319 | | } |
| | 320 | |
|
| 0 | 321 | | private void BuilderProjectPanelInfo(string title, string description) { HUDController.i.builderInWorldMainHud.SetBu |
| | 322 | |
|
| | 323 | | internal void CatalogReceived(string catalogJson) |
| | 324 | | { |
| 2 | 325 | | catalogsReceivedAmount++; |
| | 326 | |
|
| 2 | 327 | | AssetCatalogBridge.i.AddFullSceneObjectCatalog(catalogJson); |
| 2 | 328 | | if (catalogsReceivedAmount >= 2) |
| | 329 | | { |
| 1 | 330 | | isCatalogLoading = false; |
| 1 | 331 | | CatalogLoaded(); |
| | 332 | | } |
| 2 | 333 | | } |
| | 334 | |
|
| | 335 | | public void CatalogLoaded() |
| | 336 | | { |
| 8 | 337 | | catalogAdded = true; |
| 8 | 338 | | if (HUDController.i.builderInWorldMainHud != null) |
| 8 | 339 | | HUDController.i.builderInWorldMainHud.RefreshCatalogContent(); |
| 8 | 340 | | StartEditMode(); |
| 8 | 341 | | } |
| | 342 | |
|
| | 343 | | internal void CatalogHeadersReceived(string rawHeaders) |
| | 344 | | { |
| 1 | 345 | | catalogCallHeaders = JsonConvert.DeserializeObject<Dictionary<string, string>>(rawHeaders); |
| 1 | 346 | | areCatalogHeadersReady = true; |
| 1 | 347 | | if (isCatalogRequested) |
| 0 | 348 | | GetCatalog(); |
| 1 | 349 | | } |
| | 350 | |
|
| | 351 | | internal void GetCatalog() |
| | 352 | | { |
| 2 | 353 | | if (catalogAdded) |
| 0 | 354 | | return; |
| | 355 | |
|
| 2 | 356 | | if (areCatalogHeadersReady) |
| | 357 | | { |
| 0 | 358 | | string ethAddress = ""; |
| 0 | 359 | | var userProfile = UserProfile.GetOwnUserProfile(); |
| 0 | 360 | | if (userProfile != null) |
| 0 | 361 | | ethAddress = userProfile.ethAddress; |
| 0 | 362 | | catalogAsyncOp = BIWUtils.MakeGetCall(BIWUrlUtils.GetUrlCatalog(ethAddress), CatalogReceived, catalogCallHea |
| 0 | 363 | | catalogAsyncOp = BIWUtils.MakeGetCall(BIWUrlUtils.GetUrlCatalog(""), CatalogReceived, catalogCallHeaders); |
| 0 | 364 | | } |
| | 365 | | else |
| | 366 | | { |
| 2 | 367 | | AskHeadersToKernel(); |
| | 368 | | } |
| | 369 | |
|
| 2 | 370 | | isCatalogRequested = true; |
| 2 | 371 | | } |
| | 372 | |
|
| | 373 | | private void ConfigureLoadingController() |
| | 374 | | { |
| 25 | 375 | | initialLoadingController = new BuilderInWorldLoadingController(); |
| 25 | 376 | | initialLoadingController.Initialize(); |
| 25 | 377 | | } |
| | 378 | |
|
| | 379 | | private void InitControllers() |
| | 380 | | { |
| 25 | 381 | | InitController(entityHandler); |
| 25 | 382 | | InitController(modeController); |
| 25 | 383 | | InitController(publishController); |
| 25 | 384 | | InitController(creatorController); |
| 25 | 385 | | InitController(outlinerController); |
| 25 | 386 | | InitController(floorHandler); |
| 25 | 387 | | InitController(inputHandler); |
| 25 | 388 | | InitController(saveController); |
| 25 | 389 | | InitController(actionController); |
| 25 | 390 | | InitController(inputWrapper); |
| 25 | 391 | | InitController(raycastController); |
| 25 | 392 | | InitController(gizmosController); |
| 25 | 393 | | } |
| | 394 | |
|
| | 395 | | public void InitController(IBIWController controller) |
| | 396 | | { |
| 307 | 397 | | controller.Initialize(context); |
| 307 | 398 | | controllers.Add(controller); |
| 307 | 399 | | } |
| | 400 | |
|
| 0 | 401 | | private void StartTutorial() { TutorialController.i.SetBuilderInWorldTutorialEnabled(); } |
| | 402 | |
|
| | 403 | | public void CleanItems() |
| | 404 | | { |
| 25 | 405 | | if (HUDController.i.builderInWorldMainHud != null) |
| 25 | 406 | | HUDController.i.builderInWorldMainHud.Dispose(); |
| | 407 | |
|
| 25 | 408 | | Camera camera = Camera.main; |
| | 409 | |
|
| 25 | 410 | | if (camera != null) |
| | 411 | | { |
| 25 | 412 | | BIWOutline outliner = camera.GetComponent<BIWOutline>(); |
| 25 | 413 | | UnityEngine.Object.Destroy(outliner); |
| | 414 | | } |
| | 415 | |
|
| 25 | 416 | | floorHandler?.CleanUp(); |
| 25 | 417 | | creatorController?.CleanUp(); |
| 25 | 418 | | } |
| | 419 | |
|
| | 420 | | public void ChangeEditModeStatusByShortcut(DCLAction_Trigger action) |
| | 421 | | { |
| 1 | 422 | | if (!activeFeature) |
| 0 | 423 | | return; |
| | 424 | |
|
| 1 | 425 | | if (isEnteringEditMode) |
| 0 | 426 | | return; |
| | 427 | |
|
| 1 | 428 | | if (isBuilderInWorldActivated) |
| | 429 | | { |
| 0 | 430 | | HUDController.i.builderInWorldMainHud.ExitStart(); |
| 0 | 431 | | return; |
| | 432 | | } |
| | 433 | |
|
| 1 | 434 | | if (DataStore.i.builderInWorld.landsWithAccess.Get().Length == 0 && !alreadyAskedForLandPermissions) |
| | 435 | | { |
| 1 | 436 | | ActivateLandAccessBackgroundChecker(); |
| 1 | 437 | | ShowGenericNotification(BIWSettings.LAND_EDITION_WAITING_FOR_PERMISSIONS_MESSAGE, DCL.NotificationModel.Type |
| 1 | 438 | | isWaitingForPermission = true; |
| 1 | 439 | | askPermissionLastPosition = DCLCharacterController.i.characterPosition.unityPosition; |
| 1 | 440 | | } |
| | 441 | | else |
| | 442 | | { |
| 0 | 443 | | CheckSceneToEditByShorcut(); |
| | 444 | | } |
| 0 | 445 | | } |
| | 446 | |
|
| | 447 | | internal void CheckSceneToEditByShorcut() |
| | 448 | | { |
| 2 | 449 | | FindSceneToEdit(); |
| | 450 | |
|
| 2 | 451 | | if (!UserHasPermissionOnParcelScene(sceneToEdit)) |
| | 452 | | { |
| 1 | 453 | | ShowGenericNotification(BIWSettings.LAND_EDITION_NOT_ALLOWED_BY_PERMISSIONS_MESSAGE); |
| 1 | 454 | | return; |
| | 455 | | } |
| | 456 | |
|
| 1 | 457 | | if (IsParcelSceneDeployedFromSDK(sceneToEdit)) |
| | 458 | | { |
| 0 | 459 | | ShowGenericNotification(BIWSettings.LAND_EDITION_NOT_ALLOWED_BY_SDK_LIMITATION_MESSAGE); |
| 0 | 460 | | return; |
| | 461 | | } |
| | 462 | |
|
| 1 | 463 | | GetCatalog(); |
| 1 | 464 | | TryStartEnterEditMode(true, null, "Shortcut"); |
| 1 | 465 | | } |
| | 466 | |
|
| | 467 | | internal void NewSceneAdded(IParcelScene newScene) |
| | 468 | | { |
| 1 | 469 | | if (newScene.sceneData.id != sceneToEditId) |
| 0 | 470 | | return; |
| | 471 | |
|
| 1 | 472 | | Environment.i.world.sceneController.OnNewSceneAdded -= NewSceneAdded; |
| | 473 | |
|
| 1 | 474 | | sceneToEdit = (ParcelScene)Environment.i.world.state.GetScene(sceneToEditId); |
| 1 | 475 | | sceneMetricsAnalyticsHelper = new BiwSceneMetricsAnalyticsHelper(sceneToEdit); |
| 1 | 476 | | sceneToEdit.OnLoadingStateUpdated += UpdateSceneLoadingProgress; |
| 1 | 477 | | } |
| | 478 | |
|
| | 479 | | private void NewSceneReady(string id) |
| | 480 | | { |
| 7 | 481 | | if (sceneToEditId != id) |
| 0 | 482 | | return; |
| | 483 | |
|
| 7 | 484 | | sceneToEdit.OnLoadingStateUpdated -= UpdateSceneLoadingProgress; |
| 7 | 485 | | Environment.i.world.sceneController.OnReadyScene -= NewSceneReady; |
| 7 | 486 | | sceneToEditId = null; |
| 7 | 487 | | sceneReady = true; |
| 7 | 488 | | CheckEnterEditMode(); |
| 7 | 489 | | } |
| | 490 | |
|
| | 491 | | internal bool UserHasPermissionOnParcelScene(ParcelScene sceneToCheck) |
| | 492 | | { |
| 11 | 493 | | if (BYPASS_LAND_OWNERSHIP_CHECK) |
| 10 | 494 | | return true; |
| | 495 | |
|
| 1 | 496 | | List<Vector2Int> allParcelsWithAccess = DataStore.i.builderInWorld.landsWithAccess.Get().SelectMany(land => land |
| 2 | 497 | | foreach (Vector2Int parcel in allParcelsWithAccess) |
| | 498 | | { |
| 0 | 499 | | if (sceneToCheck.sceneData.parcels.Any(currentParcel => currentParcel.x == parcel.x && currentParcel.y == pa |
| 0 | 500 | | return true; |
| | 501 | | } |
| | 502 | |
|
| 1 | 503 | | return false; |
| 0 | 504 | | } |
| | 505 | |
|
| | 506 | | internal bool IsParcelSceneDeployedFromSDK(ParcelScene sceneToCheck) |
| | 507 | | { |
| 13 | 508 | | List<DeployedScene> allDeployedScenesWithAccess = DataStore.i.builderInWorld.landsWithAccess.Get().SelectMany(la |
| 21 | 509 | | foreach (DeployedScene scene in allDeployedScenesWithAccess) |
| | 510 | | { |
| 1 | 511 | | if (scene.source != DeployedScene.Source.SDK) |
| | 512 | | continue; |
| | 513 | |
|
| 1 | 514 | | List<Vector2Int> parcelsDeployedFromSDK = scene.parcels.ToList(); |
| 3 | 515 | | foreach (Vector2Int parcel in parcelsDeployedFromSDK) |
| | 516 | | { |
| 2 | 517 | | if (sceneToCheck.sceneData.parcels.Any(currentParcel => currentParcel.x == parcel.x && currentParcel.y = |
| 1 | 518 | | return true; |
| | 519 | | } |
| | 520 | | } |
| | 521 | |
|
| 9 | 522 | | return false; |
| 1 | 523 | | } |
| | 524 | |
|
| | 525 | | private void CheckEnterEditMode() |
| | 526 | | { |
| 7 | 527 | | if (catalogAdded && sceneReady) |
| 7 | 528 | | EnterEditMode(); |
| 7 | 529 | | } |
| | 530 | |
|
| 0 | 531 | | public void TryStartEnterEditMode() { TryStartEnterEditMode(true, null); } |
| | 532 | |
|
| 0 | 533 | | public void TryStartEnterEditMode(IParcelScene targetScene) { TryStartEnterEditMode(true, targetScene); } |
| | 534 | |
|
| | 535 | | public void TryStartEnterEditMode(bool activateCamera, IParcelScene targetScene = null , string source = "BuilderPan |
| | 536 | | { |
| 8 | 537 | | if (sceneToEditId != null) |
| 0 | 538 | | return; |
| | 539 | |
|
| 8 | 540 | | FindSceneToEdit(targetScene); |
| | 541 | |
|
| 8 | 542 | | if (!UserHasPermissionOnParcelScene(sceneToEdit)) |
| | 543 | | { |
| 0 | 544 | | ShowGenericNotification(BIWSettings.LAND_EDITION_NOT_ALLOWED_BY_PERMISSIONS_MESSAGE); |
| 0 | 545 | | return; |
| | 546 | | } |
| 8 | 547 | | else if (IsParcelSceneDeployedFromSDK(sceneToEdit)) |
| | 548 | | { |
| 0 | 549 | | ShowGenericNotification(BIWSettings.LAND_EDITION_NOT_ALLOWED_BY_SDK_LIMITATION_MESSAGE); |
| 0 | 550 | | return; |
| | 551 | | } |
| | 552 | |
|
| | 553 | | //If the scene is still not loaded, we return as we still can't enter in builder in world |
| 8 | 554 | | if (sceneToEditId != null) |
| 0 | 555 | | return; |
| | 556 | |
|
| 8 | 557 | | isEnteringEditMode = true; |
| 8 | 558 | | previousAllUIHidden = CommonScriptableObjects.allUIHidden.Get(); |
| 8 | 559 | | NotificationsController.i.allowNotifications = false; |
| 8 | 560 | | CommonScriptableObjects.allUIHidden.Set(true); |
| 8 | 561 | | NotificationsController.i.allowNotifications = true; |
| 8 | 562 | | inputController.inputTypeMode = InputTypeMode.BUILD_MODE_LOADING; |
| 8 | 563 | | initialLoadingController.Show(); |
| 8 | 564 | | initialLoadingController.SetPercentage(0f); |
| 8 | 565 | | DataStore.i.appMode.Set(AppMode.BUILDER_IN_WORLD_EDITION); |
| 8 | 566 | | DataStore.i.virtualAudioMixer.sceneSFXVolume.Set(0f); |
| 8 | 567 | | BIWAnalytics.StartEditorFlow(source); |
| 8 | 568 | | beginStartFlowTimeStamp = Time.realtimeSinceStartup; |
| | 569 | |
|
| 8 | 570 | | biwAudioHandler.gameObject.SetActive(true); |
| | 571 | | //Note (Adrian) this should handle different when we have the full flow of the feature |
| 8 | 572 | | if (activateCamera) |
| 1 | 573 | | modeController.ActivateCamera(sceneToEdit); |
| | 574 | |
|
| 8 | 575 | | if (catalogAdded) |
| 7 | 576 | | StartEditMode(); |
| 8 | 577 | | } |
| | 578 | |
|
| | 579 | | private void StartEditMode() |
| | 580 | | { |
| 15 | 581 | | if (sceneToEdit == null) |
| 8 | 582 | | return; |
| | 583 | |
|
| 7 | 584 | | isEnteringEditMode = true; |
| | 585 | |
|
| 7 | 586 | | Environment.i.platform.cullingController.Stop(); |
| | 587 | |
|
| 7 | 588 | | sceneToEditId = sceneToEdit.sceneData.id; |
| | 589 | |
|
| | 590 | | // In this point we're sure that the catalog loading (the first half of our progress bar) has already finished |
| 7 | 591 | | initialLoadingController.SetPercentage(50f); |
| 7 | 592 | | Environment.i.world.sceneController.OnNewSceneAdded += NewSceneAdded; |
| 7 | 593 | | Environment.i.world.sceneController.OnReadyScene += NewSceneReady; |
| 7 | 594 | | Environment.i.world.blockersController.SetEnabled(false); |
| | 595 | |
|
| 7 | 596 | | builderInWorldBridge.StartKernelEditMode(sceneToEdit); |
| 7 | 597 | | } |
| | 598 | |
|
| | 599 | | private void EnterEditMode() |
| | 600 | | { |
| 7 | 601 | | if (!initialLoadingController.isActive) |
| 0 | 602 | | return; |
| | 603 | |
|
| 7 | 604 | | isEnteringEditMode = false; |
| 7 | 605 | | BIWNFTController.i.ClearNFTs(); |
| | 606 | |
|
| 7 | 607 | | ParcelSettings.VISUAL_LOADING_ENABLED = false; |
| | 608 | |
|
| 7 | 609 | | sceneToEdit.SetEditMode(true); |
| 7 | 610 | | cursorGO.SetActive(false); |
| 7 | 611 | | parcelUnityMiddlePoint = BIWUtils.CalculateUnityMiddlePoint(sceneToEdit); |
| | 612 | |
|
| 7 | 613 | | if (HUDController.i.builderInWorldMainHud != null) |
| | 614 | | { |
| 7 | 615 | | HUDController.i.builderInWorldMainHud.SetParcelScene(sceneToEdit); |
| 7 | 616 | | HUDController.i.builderInWorldMainHud.RefreshCatalogContent(); |
| 7 | 617 | | HUDController.i.builderInWorldMainHud.RefreshCatalogAssetPack(); |
| 7 | 618 | | HUDController.i.builderInWorldMainHud.SetVisibilityOfCatalog(true); |
| 7 | 619 | | HUDController.i.builderInWorldMainHud.SetVisibilityOfInspector(true); |
| | 620 | | } |
| | 621 | |
|
| 7 | 622 | | CommonScriptableObjects.builderInWorldNotNecessaryUIVisibilityStatus.Set(false); |
| 7 | 623 | | DataStore.i.builderInWorld.showTaskBar.Set(true); |
| | 624 | |
|
| 7 | 625 | | DCLCharacterController.OnPositionSet += ExitAfterCharacterTeleport; |
| | 626 | |
|
| 7 | 627 | | EnterBiwControllers(); |
| 7 | 628 | | Environment.i.world.sceneController.ActivateBuilderInWorldEditScene(); |
| | 629 | |
|
| 7 | 630 | | initialLoadingController.SetPercentage(100f); |
| | 631 | |
|
| 7 | 632 | | if (IsNewScene()) |
| | 633 | | { |
| 0 | 634 | | floorHandler.OnAllParcelsFloorLoaded -= OnAllParcelsFloorLoaded; |
| 0 | 635 | | floorHandler.OnAllParcelsFloorLoaded += OnAllParcelsFloorLoaded; |
| 0 | 636 | | SetupNewScene(); |
| 0 | 637 | | } |
| | 638 | | else |
| | 639 | | { |
| 7 | 640 | | initialLoadingController.Hide(onHideAction: () => |
| | 641 | | { |
| 0 | 642 | | inputController.inputTypeMode = InputTypeMode.BUILD_MODE; |
| 0 | 643 | | HUDController.i.builderInWorldMainHud?.SetVisibility(true); |
| 0 | 644 | | CommonScriptableObjects.allUIHidden.Set(previousAllUIHidden); |
| 0 | 645 | | OpenNewProjectDetailsIfNeeded(); |
| 0 | 646 | | }); |
| | 647 | | } |
| | 648 | |
|
| 7 | 649 | | isBuilderInWorldActivated = true; |
| | 650 | |
|
| 7 | 651 | | previousSkyBoxMaterial = RenderSettings.skybox; |
| 7 | 652 | | RenderSettings.skybox = skyBoxMaterial; |
| | 653 | |
|
| 14 | 654 | | foreach (var groundVisual in groundVisualsGO) |
| | 655 | | { |
| 0 | 656 | | groundVisual.SetActive(false); |
| | 657 | | } |
| | 658 | |
|
| 7 | 659 | | startEditorTimeStamp = Time.realtimeSinceStartup; |
| | 660 | |
|
| 7 | 661 | | BIWAnalytics.AddSceneInfo(sceneToEdit.sceneData.basePosition, BIWUtils.GetLandOwnershipType(DataStore.i.builderI |
| 7 | 662 | | BIWAnalytics.EnterEditor( Time.realtimeSinceStartup - beginStartFlowTimeStamp); |
| 7 | 663 | | } |
| | 664 | |
|
| | 665 | | internal void OnAllParcelsFloorLoaded() |
| | 666 | | { |
| 1 | 667 | | if (!initialLoadingController.isActive) |
| 0 | 668 | | return; |
| | 669 | |
|
| 1 | 670 | | floorHandler.OnAllParcelsFloorLoaded -= OnAllParcelsFloorLoaded; |
| 1 | 671 | | initialLoadingController.Hide(onHideAction: () => |
| | 672 | | { |
| 0 | 673 | | inputController.inputTypeMode = InputTypeMode.BUILD_MODE; |
| 0 | 674 | | HUDController.i.builderInWorldMainHud.SetVisibility(true); |
| 0 | 675 | | CommonScriptableObjects.allUIHidden.Set(previousAllUIHidden); |
| 0 | 676 | | OpenNewProjectDetailsIfNeeded(); |
| 0 | 677 | | }); |
| 1 | 678 | | } |
| | 679 | |
|
| | 680 | | private void OpenNewProjectDetailsIfNeeded() |
| | 681 | | { |
| 0 | 682 | | if (builderInWorldBridge.builderProject.isNewEmptyProject) |
| 0 | 683 | | modeController.OpenNewProjectDetails(); |
| 0 | 684 | | } |
| | 685 | |
|
| | 686 | | public void StartExitMode() |
| | 687 | | { |
| 1 | 688 | | if (saveController.GetSaveTimes() > 0) |
| | 689 | | { |
| 1 | 690 | | modeController.TakeSceneScreenshotForExit(); |
| | 691 | |
|
| 1 | 692 | | if ( HUDController.i.builderInWorldMainHud != null) |
| 1 | 693 | | HUDController.i.builderInWorldMainHud.ConfigureConfirmationModal( |
| | 694 | | BIWSettings.EXIT_MODAL_TITLE, |
| | 695 | | BIWSettings.EXIT_WITHOUT_PUBLISH_MODAL_SUBTITLE, |
| | 696 | | BIWSettings.EXIT_WITHOUT_PUBLISH_MODAL_CANCEL_BUTTON, |
| | 697 | | BIWSettings.EXIT_WITHOUT_PUBLISH_MODAL_CONFIRM_BUTTON); |
| 1 | 698 | | } |
| | 699 | | else |
| | 700 | | { |
| 0 | 701 | | HUDController.i.builderInWorldMainHud.ConfigureConfirmationModal( |
| | 702 | | BIWSettings.EXIT_MODAL_TITLE, |
| | 703 | | BIWSettings.EXIT_MODAL_SUBTITLE, |
| | 704 | | BIWSettings.EXIT_MODAL_CANCEL_BUTTON, |
| | 705 | | BIWSettings.EXIT_MODAL_CONFIRM_BUTTON); |
| | 706 | | } |
| 0 | 707 | | } |
| | 708 | |
|
| | 709 | | public void ExitEditMode() |
| | 710 | | { |
| 4 | 711 | | Environment.i.platform.cullingController.Start(); |
| | 712 | |
|
| 4 | 713 | | floorHandler.OnAllParcelsFloorLoaded -= OnAllParcelsFloorLoaded; |
| 4 | 714 | | initialLoadingController.Hide(true); |
| 4 | 715 | | inputController.inputTypeMode = InputTypeMode.GENERAL; |
| | 716 | |
|
| 4 | 717 | | CommonScriptableObjects.builderInWorldNotNecessaryUIVisibilityStatus.Set(true); |
| 4 | 718 | | DataStore.i.builderInWorld.showTaskBar.Set(true); |
| | 719 | |
|
| 4 | 720 | | ParcelSettings.VISUAL_LOADING_ENABLED = true; |
| | 721 | |
|
| 4 | 722 | | outlinerController.CancelAllOutlines(); |
| | 723 | |
|
| 4 | 724 | | cursorGO.SetActive(true); |
| | 725 | |
|
| 4 | 726 | | if (sceneToEdit != null) |
| 4 | 727 | | sceneToEdit.SetEditMode(false); |
| | 728 | |
|
| 4 | 729 | | DCLCharacterController.OnPositionSet -= ExitAfterCharacterTeleport; |
| | 730 | |
|
| 4 | 731 | | InmediateExit(); |
| | 732 | |
|
| 4 | 733 | | if (HUDController.i.builderInWorldMainHud != null) |
| | 734 | | { |
| 4 | 735 | | HUDController.i.builderInWorldMainHud.ClearEntityList(); |
| 4 | 736 | | HUDController.i.builderInWorldMainHud.SetVisibility(false); |
| | 737 | | } |
| | 738 | |
|
| 4 | 739 | | Environment.i.world.sceneController.DeactivateBuilderInWorldEditScene(); |
| 4 | 740 | | Environment.i.world.blockersController.SetEnabled(true); |
| | 741 | |
|
| 4 | 742 | | ExitBiwControllers(); |
| | 743 | |
|
| 8 | 744 | | foreach (var groundVisual in groundVisualsGO) |
| | 745 | | { |
| 0 | 746 | | groundVisual.SetActive(true); |
| | 747 | | } |
| | 748 | |
|
| 4 | 749 | | isBuilderInWorldActivated = false; |
| 4 | 750 | | RenderSettings.skybox = previousSkyBoxMaterial; |
| | 751 | |
|
| 4 | 752 | | if (biwAudioHandler.gameObject != null) |
| 4 | 753 | | biwAudioHandler.gameObject.SetActive(false); |
| 4 | 754 | | DataStore.i.appMode.Set(AppMode.DEFAULT); |
| 4 | 755 | | DataStore.i.virtualAudioMixer.sceneSFXVolume.Set(1f); |
| 4 | 756 | | BIWAnalytics.ExitEditor(Time.realtimeSinceStartup - startEditorTimeStamp); |
| 4 | 757 | | } |
| | 758 | |
|
| | 759 | | public void InmediateExit() |
| | 760 | | { |
| 4 | 761 | | CommonScriptableObjects.allUIHidden.Set(previousAllUIHidden); |
| 4 | 762 | | builderInWorldBridge.ExitKernelEditMode(sceneToEdit); |
| 4 | 763 | | } |
| | 764 | |
|
| | 765 | | public void EnterBiwControllers() |
| | 766 | | { |
| 218 | 767 | | foreach (var controller in controllers) |
| | 768 | | { |
| 101 | 769 | | controller.EnterEditMode(sceneToEdit); |
| | 770 | | } |
| | 771 | |
|
| | 772 | | //Note: This audio should inside the controllers, it is here because it is still a monobehaviour |
| 8 | 773 | | biwAudioHandler.EnterEditMode(sceneToEdit); |
| 8 | 774 | | } |
| | 775 | |
|
| | 776 | | public void ExitBiwControllers() |
| | 777 | | { |
| 106 | 778 | | foreach (var controller in controllers) |
| | 779 | | { |
| 49 | 780 | | controller.ExitEditMode(); |
| | 781 | | } |
| | 782 | |
|
| 4 | 783 | | if (biwAudioHandler.gameObject != null) |
| 4 | 784 | | biwAudioHandler.ExitEditMode(); |
| 4 | 785 | | } |
| | 786 | |
|
| 7 | 787 | | public bool IsNewScene() { return sceneToEdit.entities.Count <= 0; } |
| | 788 | |
|
| 2 | 789 | | public void SetupNewScene() { floorHandler.CreateDefaultFloor(); } |
| | 790 | |
|
| 2 | 791 | | internal void ExitAfterCharacterTeleport(DCLCharacterPosition position) { ExitEditMode(); } |
| | 792 | |
|
| | 793 | | public void FindSceneToEdit(IParcelScene targetScene) |
| | 794 | | { |
| 8 | 795 | | if (targetScene != null) |
| | 796 | | { |
| 7 | 797 | | var parcelSceneTarget = (ParcelScene)targetScene; |
| 7 | 798 | | if (sceneToEdit != null && sceneToEdit != parcelSceneTarget) |
| 0 | 799 | | actionController.Clear(); |
| | 800 | |
|
| 7 | 801 | | sceneToEdit = parcelSceneTarget; |
| 7 | 802 | | } |
| | 803 | | else |
| | 804 | | { |
| 1 | 805 | | FindSceneToEdit(); |
| | 806 | | } |
| 1 | 807 | | } |
| | 808 | |
|
| | 809 | | public IParcelScene FindSceneToEdit() |
| | 810 | | { |
| 15 | 811 | | foreach (IParcelScene scene in Environment.i.world.state.scenesSortedByDistance) |
| | 812 | | { |
| 4 | 813 | | if (WorldStateUtils.IsCharacterInsideScene(scene)) |
| | 814 | | { |
| 1 | 815 | | ParcelScene parcelScene = (ParcelScene)scene; |
| | 816 | |
|
| 1 | 817 | | if (sceneToEdit != null && sceneToEdit != parcelScene) |
| 0 | 818 | | actionController.Clear(); |
| | 819 | |
|
| 1 | 820 | | sceneToEdit = parcelScene; |
| 1 | 821 | | return sceneToEdit; |
| | 822 | | } |
| | 823 | | } |
| | 824 | |
|
| 3 | 825 | | return null; |
| 1 | 826 | | } |
| | 827 | |
|
| | 828 | | private void OnPlayerTeleportedToEditScene(Vector2Int coords) |
| | 829 | | { |
| 0 | 830 | | if (activeFeature) |
| | 831 | | { |
| 0 | 832 | | var targetScene = Environment.i.world.state.scenesSortedByDistance |
| 0 | 833 | | .FirstOrDefault(scene => scene.sceneData.parcels.Contains(coords)); |
| 0 | 834 | | TryStartEnterEditMode(targetScene); |
| | 835 | | } |
| 0 | 836 | | } |
| | 837 | |
|
| 0 | 838 | | private void UpdateCatalogLoadingProgress(float catalogLoadingProgress) { initialLoadingController.SetPercentage(cat |
| | 839 | |
|
| 0 | 840 | | private void UpdateSceneLoadingProgress(float sceneLoadingProgress) { initialLoadingController.SetPercentage(50f + ( |
| | 841 | |
|
| | 842 | | internal void OnUserProfileUpdate(UserProfile user) |
| | 843 | | { |
| 2 | 844 | | userProfile.OnUpdate -= OnUserProfileUpdate; |
| | 845 | |
|
| 2 | 846 | | if (!areCatalogHeadersAsked) |
| 1 | 847 | | AskHeadersToKernel(); |
| 2 | 848 | | } |
| | 849 | |
|
| | 850 | | private IEnumerator CheckLandsAccess() |
| | 851 | | { |
| 0 | 852 | | while (true) |
| | 853 | | { |
| 3 | 854 | | UpdateLandsWithAccess(); |
| 3 | 855 | | yield return WaitForSecondsCache.Get(BIWSettings.REFRESH_LANDS_WITH_ACCESS_INTERVAL); |
| | 856 | | } |
| | 857 | | } |
| | 858 | |
|
| | 859 | | private void UpdateLandsWithAccess() |
| | 860 | | { |
| 3 | 861 | | if (isBuilderInWorldActivated) |
| 0 | 862 | | return; |
| | 863 | |
|
| 3 | 864 | | DeployedScenesFetcher.FetchLandsFromOwner( |
| | 865 | | Environment.i.platform.serviceProviders.catalyst, |
| | 866 | | Environment.i.platform.serviceProviders.theGraph, |
| | 867 | | userProfile.ethAddress, |
| | 868 | | KernelConfig.i.Get().network, |
| | 869 | | BIWSettings.CACHE_TIME_LAND, |
| | 870 | | BIWSettings.CACHE_TIME_SCENES) |
| | 871 | | .Then(lands => |
| | 872 | | { |
| 3 | 873 | | DataStore.i.builderInWorld.landsWithAccess.Set(lands.ToArray(), true); |
| 3 | 874 | | if (isWaitingForPermission && Vector3.Distance(askPermissionLastPosition, DCLCharacterController.i.chara |
| | 875 | | { |
| 1 | 876 | | CheckSceneToEditByShorcut(); |
| | 877 | | } |
| | 878 | |
|
| 3 | 879 | | isWaitingForPermission = false; |
| 3 | 880 | | alreadyAskedForLandPermissions = true; |
| 3 | 881 | | }); |
| 3 | 882 | | } |
| | 883 | |
|
| | 884 | | private static void ShowGenericNotification(string message, DCL.NotificationModel.Type type = DCL.NotificationModel. |
| | 885 | | { |
| 2 | 886 | | DCL.NotificationModel.Model notificationModel = new DCL.NotificationModel.Model(); |
| 2 | 887 | | notificationModel.message = message; |
| 2 | 888 | | notificationModel.type = type; |
| 2 | 889 | | notificationModel.timer = timer; |
| 2 | 890 | | if (HUDController.i.notificationHud != null) |
| 0 | 891 | | HUDController.i.notificationHud.ShowNotification(notificationModel); |
| 2 | 892 | | } |
| | 893 | | } |