< Summary

Class:BuilderMainPanelController
Assembly:BuilderProjectsPanel
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/ProjectsPanelHUD/Scripts/BuilderMainPanelController.cs
Covered lines:180
Uncovered lines:127
Coverable lines:307
Total lines:617
Line coverage:58.6% (180 of 307)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
BuilderMainPanelController()0%110100%
SetView(...)0%110100%
ConnectGuestWallet()0%2100%
OnBack()0%6200%
Dispose()0%11110100%
Initialize(...)0%2100%
Initialize(...)0%22097.3%
SectionContentNotEmpty()0%2100%
SectionContentEmpty()0%2100%
DuplicateProject(...)0%6200%
DuplicateProject()0%56700%
PublishProject()0%6200%
PublishProject()0%12300%
DeleteProject(...)0%2100%
GetManifestToEdit(...)0%6200%
CreateNewProject(...)0%2100%
OpenEditorFromNewProject(...)0%2100%
OpenEditorFromManifest(...)0%2100%
SetVisibility(...)0%110100%
OnVisibilityChanged(...)0%4.054085.71%
OnClose()0%3.023087.5%
PanelOpenEvent(...)0%110100%
GetAmountOfLandsOwnedAndOperator(...)0%3.013088.89%
SetView()0%110100%
PublishFinish(...)0%6200%
FetchPanelInfo()0%110100%
FetchPanelInfo(...)0%4.34073.33%
FetchProjectData()0%110100%
ProjectsFetched(...)0%110100%
ProjectsFetchedError(...)0%110100%
UpdateProjectsDeploymentStatus()0%3.143075%
LandsFetchedError(...)0%110100%
LandsFetched(...)0%9.178073.68%
GoToCoords(...)0%220100%
OpenUrl(...)0%2100%
OnGoToEditScene(...)0%2100%
StartFetchInterval()0%2.062075%
StopFetchInterval()0%110100%
RefreshDataInterval()0%5.673033.33%
WaitASecondAndRefreshProjects()0%12300%
OnSceneUnpublished(...)0%6200%
ConfigureBuilderInFullscreenMenuChanged(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/ProjectsPanelHUD/Scripts/BuilderMainPanelController.cs

#LineLine coverage
 1using DCL;
 2using DCL.Builder;
 3using DCL.Builder.Manifest;
 4using DCL.Helpers;
 5using DCL.Interface;
 6using System;
 7using System.Collections;
 8using System.Linq;
 9using Cysharp.Threading.Tasks;
 10using DCL.Configuration;
 11using UnityEngine;
 12using Variables.RealmsInfo;
 13using Environment = DCL.Environment;
 14using Object = UnityEngine.Object;
 15
 16public class BuilderMainPanelController : IHUD, IBuilderMainPanelController
 17{
 18    private const string DELETE_PROJECT_CONFIRM_TEXT = "Are you sure that you want to delete {0} project?";
 19    private const string CREATING_PROJECT_ERROR = "Error creating a new project: ";
 20    private const string OBTAIN_PROJECT_ERROR = "Error obtaining the project: ";
 21
 22    private const string DUPLICATE_PROJECT_ERROR = "Error duplicating the project: ";
 23    private const string PUBLISH_PROJECT_ERROR = "Error publishing the project: ";
 24
 25    private const string DELETE_PROJECT_ERROR = "Error deleting the project: ";
 26    private const string DELETE_PROJECT_SUCCESS = "<b>{0}</b> has been deleted";
 27
 28    private const string TESTING_ETH_ADDRESS = "0xDc13378daFca7Fe2306368A16BCFac38c80BfCAD";
 29    private const string TESTING_TLD = "org";
 30    private const string VIEW_PREFAB_PATH = "BuilderProjectsPanelDev";
 31
 32    private const float CACHE_TIME_LAND = 5 * 60;
 33    private const float CACHE_TIME_SCENES = 1 * 60;
 34    private const float REFRESH_INTERVAL = 2 * 60;
 35
 36    internal IBuilderMainPanelView view;
 37
 38    private ISectionsController sectionsController;
 39    private IProjectsController projectsController;
 40    private IScenesViewController scenesViewController;
 41    private ILandsController landsesController;
 42    private UnpublishPopupController unpublishPopupController;
 43
 44    private INewProjectFlowController newProjectFlowController;
 45
 46    private SectionsHandler sectionsHandler;
 47    private SceneContextMenuHandler sceneContextMenuHandler;
 48    private LeftMenuHandler leftMenuHandler;
 49    private LeftMenuSettingsViewHandler leftMenuSettingsViewHandler;
 50
 51    private ITheGraph theGraph;
 52    private ICatalyst catalyst;
 53
 54    private bool isInitialized = false;
 55    internal bool isFetchingLands = false;
 56    internal bool isFetchingProjects = false;
 57    private bool sendPlayerOpenPanelEvent = false;
 58    private Coroutine fetchDataInterval;
 59    private Promise<LandWithAccess[]> fetchLandPromise = null;
 60    private Promise<ProjectData[]> fetchProjectsPromise = null;
 61
 62    public event Action OnJumpInOrEdit;
 63
 64    internal IContext context;
 65
 4866    BaseVariable<Transform> configureBuilderInFullscreenMenu => DataStore.i.exploreV2.configureBuilderInFullscreenMenu;
 67
 1668    public BuilderMainPanelController()
 69    {
 1670        SetView(Object.Instantiate(Resources.Load<BuilderMainPanelView>(VIEW_PREFAB_PATH)));
 71
 1672        configureBuilderInFullscreenMenu.OnChange += ConfigureBuilderInFullscreenMenuChanged;
 1673        ConfigureBuilderInFullscreenMenuChanged(configureBuilderInFullscreenMenu.Get(), null);
 1674    }
 75
 76    internal void SetView(IBuilderMainPanelView view)
 77    {
 1678        this.view = view;
 1679        view.OnClosePressed += OnClose;
 1680        view.OnBackPressed += OnBack;
 1681        view.OnGuestConnectWallet += ConnectGuestWallet;
 1682    }
 83
 084    private void ConnectGuestWallet() { WebInterface.OpenURL(BIWSettings.GUEST_WALLET_INFO); }
 85
 86    private void OnBack()
 87    {
 088        if (newProjectFlowController.IsActive())
 089            newProjectFlowController.Hide();
 090    }
 91
 92    public void Dispose()
 93    {
 1694        StopFetchInterval();
 95
 1696        context.publisher.OnPublishFinish -= PublishFinish;
 97
 1698        sectionsController.OnRequestOpenUrl -= OpenUrl;
 1699        sectionsController.OnRequestGoToCoords -= GoToCoords;
 16100        sectionsController.OnRequestEditSceneAtCoords -= OnGoToEditScene;
 16101        sectionsController.OnCreateProjectRequest -= newProjectFlowController.NewProject;
 16102        sectionsController.OnSectionContentEmpty -= SectionContentEmpty;
 16103        sectionsController.OnSectionContentNotEmpty -= SectionContentNotEmpty;
 104
 16105        scenesViewController.OnJumpInPressed -= GoToCoords;
 16106        scenesViewController.OnRequestOpenUrl -= OpenUrl;
 16107        scenesViewController.OnEditorPressed -= OnGoToEditScene;
 16108        projectsController.OnEditorPressed -= GetManifestToEdit;
 16109        projectsController.OnDeleteProject -= DeleteProject;
 16110        projectsController.OnDuplicateProject -= DuplicateProject;
 16111        projectsController.OnPublishProject -= PublishProject;
 112
 16113        newProjectFlowController.OnNewProjectCrated -= CreateNewProject;
 114
 16115        view.OnCreateProjectPressed -= newProjectFlowController.NewProject;
 116
 16117        DataStore.i.HUDs.builderProjectsPanelVisible.OnChange -= OnVisibilityChanged;
 16118        DataStore.i.builderInWorld.unpublishSceneResult.OnChange -= OnSceneUnpublished;
 16119        view.OnClosePressed -= OnClose;
 16120        view.OnBackPressed -= OnBack;
 16121        view.OnGuestConnectWallet -= ConnectGuestWallet;
 122
 16123        unpublishPopupController?.Dispose();
 124
 16125        fetchLandPromise?.Dispose();
 16126        fetchProjectsPromise?.Dispose();
 127
 16128        leftMenuSettingsViewHandler?.Dispose();
 16129        sectionsHandler?.Dispose();
 16130        sceneContextMenuHandler?.Dispose();
 16131        leftMenuHandler?.Dispose();
 132
 16133        sectionsController?.Dispose();
 16134        scenesViewController?.Dispose();
 135
 16136        newProjectFlowController?.Dispose();
 137
 16138        configureBuilderInFullscreenMenu.OnChange -= ConfigureBuilderInFullscreenMenuChanged;
 139
 16140        view.Dispose();
 16141    }
 142
 143    public void Initialize(IContext context)
 144    {
 0145        Initialize(context,new SectionsController(view.GetSectionContainer()),
 146            new ScenesViewController(view.GetSceneCardViewPrefab(), view.GetTransform()),
 147            new LandsController(),
 148            new ProjectsController(view.GetProjectCardView(), view.GetProjectCardViewContextMenu(), view.GetTransform())
 149            new NewProjectFlowController(),
 150            Environment.i.platform.serviceProviders.theGraph,
 151            Environment.i.platform.serviceProviders.catalyst);
 0152    }
 153
 154    internal void Initialize(IContext context,ISectionsController sectionsController,
 155        IScenesViewController scenesViewController, ILandsController landsesController, IProjectsController projectsCont
 156    {
 16157        if (isInitialized)
 0158            return;
 159
 16160        isInitialized = true;
 161
 16162        this.context = context;
 16163        this.context.publisher.OnPublishFinish += PublishFinish;
 164
 16165        this.sectionsController = sectionsController;
 16166        this.scenesViewController = scenesViewController;
 16167        this.landsesController = landsesController;
 16168        this.projectsController = projectsController;
 169
 16170        this.newProjectFlowController = newProjectFlowController;
 171
 16172        this.theGraph = theGraph;
 16173        this.catalyst = catalyst;
 174
 16175        this.unpublishPopupController = new UnpublishPopupController(context,view.GetUnpublishPopup());
 176
 177        // set listeners for sections, setup searchbar for section, handle request for opening a new section
 16178        sectionsHandler = new SectionsHandler(sectionsController, scenesViewController, landsesController, projectsContr
 179        // handle if main panel or settings panel should be shown in current section
 16180        leftMenuHandler = new LeftMenuHandler(view, sectionsController);
 181        // handle project scene info on the left menu panel
 16182        leftMenuSettingsViewHandler = new LeftMenuSettingsViewHandler(view.GetSettingsViewReferences(), scenesViewContro
 183        // handle scene's context menu options
 16184        sceneContextMenuHandler = new SceneContextMenuHandler(view.GetSceneCardViewContextMenu(), sectionsController, sc
 185
 16186        this.projectsController.SetSceneContextMenuHandler(sceneContextMenuHandler);
 187
 16188        SetView();
 189
 16190        sectionsController.OnRequestOpenUrl += OpenUrl;
 16191        sectionsController.OnRequestGoToCoords += GoToCoords;
 16192        sectionsController.OnRequestEditSceneAtCoords += OnGoToEditScene;
 16193        sectionsController.OnCreateProjectRequest += newProjectFlowController.NewProject;
 16194        sectionsController.OnSectionContentEmpty += SectionContentEmpty;
 16195        sectionsController.OnSectionContentNotEmpty += SectionContentNotEmpty;
 196
 16197        scenesViewController.OnJumpInPressed += GoToCoords;
 16198        scenesViewController.OnRequestOpenUrl += OpenUrl;
 16199        scenesViewController.OnEditorPressed += OnGoToEditScene;
 16200        newProjectFlowController.OnNewProjectCrated += CreateNewProject;
 201
 16202        view.OnCreateProjectPressed += this.newProjectFlowController.NewProject;
 16203        this.projectsController.OnEditorPressed += GetManifestToEdit;
 16204        this.projectsController.OnDeleteProject += DeleteProject;
 16205        this.projectsController.OnDuplicateProject += DuplicateProject;
 16206        this.projectsController.OnPublishProject += PublishProject;
 207
 16208        DataStore.i.HUDs.builderProjectsPanelVisible.OnChange += OnVisibilityChanged;
 16209        DataStore.i.builderInWorld.unpublishSceneResult.OnChange += OnSceneUnpublished;
 16210    }
 211
 0212    private void SectionContentNotEmpty() { view.SetSearchViewVisible(true); }
 213
 0214    private void SectionContentEmpty() { view.SetSearchViewVisible(false); }
 215
 216    private void DuplicateProject(ProjectData data)
 217    {
 0218        Promise<Manifest> manifestPromise = context.builderAPIController.GetManifestById(data.id);
 0219        manifestPromise.Then( (manifest) =>
 220        {
 0221            DuplicateProject(data, manifest);
 0222        });
 223
 0224        manifestPromise.Catch( errorString =>
 225        {
 0226            BIWUtils.ShowGenericNotification(DUPLICATE_PROJECT_ERROR + errorString);
 0227        });
 228
 0229    }
 230
 231    private async void DuplicateProject(ProjectData data, Manifest manifest)
 232    {
 0233        string url = BIWUrlUtils.GetBuilderProjecThumbnailUrl(data.id, data.thumbnail);
 0234        Promise<Texture2D> screenshotPromise = new Promise<Texture2D>();
 0235        BIWUtils.MakeGetTextureCall(url, screenshotPromise);
 236
 0237        string scene_id = Guid.NewGuid().ToString();
 0238        manifest.project.title += " Copy";
 0239        manifest.project.id = Guid.NewGuid().ToString();
 0240        manifest.project.scene_id = scene_id;
 0241        manifest.scene.id = scene_id;
 0242        manifest.project.created_at = DateTime.UtcNow;
 0243        manifest.project.updated_at = DateTime.UtcNow;
 244
 0245        screenshotPromise.Then(texture =>
 246        {
 0247            context.builderAPIController.SetThumbnail(manifest.project.id, texture);
 0248        });
 249
 0250        Promise<bool> createPromise = context.builderAPIController.SetManifest(manifest);
 0251        createPromise.Then(isOk =>
 252        {
 0253            if (!isOk)
 0254                BIWUtils.ShowGenericNotification(DUPLICATE_PROJECT_ERROR);
 0255        });
 0256        createPromise.Catch(error =>
 257        {
 0258            BIWUtils.ShowGenericNotification(DUPLICATE_PROJECT_ERROR + error);
 0259        });
 260
 0261        await createPromise;
 0262        await screenshotPromise;
 263
 264        // We need to wait a bit before refreshing the projects so the server is able to process the data
 0265        CoroutineStarter.Start(WaitASecondAndRefreshProjects());
 266
 0267        BIWAnalytics.ProjectDuplicated(data.id, new Vector2Int(data.rows,data.cols));
 0268    }
 269
 270    private async void PublishProject(ProjectData data)
 271    {
 0272        Promise<Manifest> manifestPromise = context.builderAPIController.GetManifestById(data.id);
 0273        manifestPromise.Then( (manifest) =>
 274        {
 0275            manifest.project = data;
 0276            PublishProject(manifest);
 0277        });
 278
 0279        manifestPromise.Catch( errorString =>
 280        {
 0281            BIWUtils.ShowGenericNotification(PUBLISH_PROJECT_ERROR + errorString);
 0282        });
 0283    }
 284
 285    private async void PublishProject(Manifest manifest)
 286    {
 0287        string url = BIWUrlUtils.GetBuilderProjecThumbnailUrl(manifest.project.id, manifest.project.thumbnail);
 0288        Promise<Texture2D> screenshotPromise = new Promise<Texture2D>();
 0289        BIWUtils.MakeGetTextureCall(url, screenshotPromise);
 290
 0291        IBuilderScene builderScene = new BuilderScene(manifest, IBuilderScene.SceneType.PROJECT);
 0292        builderScene.SetScene(ManifestTranslator.ManifestToParcelSceneWithOnlyData(manifest));
 0293        screenshotPromise.Then((texture2D => builderScene.sceneScreenshotTexture = texture2D));
 0294        await screenshotPromise;
 0295        context.publisher.StartPublish(builderScene);
 0296    }
 297
 298    private void DeleteProject(ProjectData data)
 299    {
 0300        string deleteText = DELETE_PROJECT_CONFIRM_TEXT.Replace("{0}", data.title);
 301
 0302        context.commonHUD.GetPopUp()
 303               .ShowPopUpWithoutTitle(deleteText, "YES", "NO", () =>
 304               {
 0305                   Promise<bool> manifestPromise = context.builderAPIController.DeleteProject(data.id);
 0306                   manifestPromise.Then( (isOk) =>
 307                   {
 0308                       if (isOk)
 309                       {
 0310                           string text = DELETE_PROJECT_SUCCESS.Replace("{0}", data.title);
 0311                           view.ShowToast(text);
 0312                           FetchProjectData();
 313                       }
 0314                   });
 315
 0316                   manifestPromise.Catch( errorString =>
 317                   {
 0318                       BIWUtils.ShowGenericNotification(DELETE_PROJECT_ERROR + errorString);
 0319                   });
 320
 0321                   BIWAnalytics.ProjectDeleted(data.id, new Vector2Int(data.rows,data.cols));
 0322               }, null);
 0323    }
 324
 325    private void GetManifestToEdit(ProjectData data)
 326    {
 0327        Promise<Manifest> manifestPromise = context.builderAPIController.GetManifestById(data.id);
 0328        manifestPromise.Then( OpenEditorFromManifest);
 329
 0330        manifestPromise.Catch( errorString =>
 331        {
 0332            BIWUtils.ShowGenericNotification(OBTAIN_PROJECT_ERROR + errorString);
 0333        });
 0334    }
 335
 336    private void CreateNewProject(ProjectData project)
 337    {
 0338        context.sceneManager.ShowBuilderLoading();
 0339        Promise<ProjectData> projectPromise = context.builderAPIController.CreateNewProject(project);
 340
 0341        projectPromise.Then( OpenEditorFromNewProject);
 342
 0343        projectPromise.Catch( errorString =>
 344        {
 0345            context.sceneManager.HideBuilderLoading();
 0346            BIWUtils.ShowGenericNotification(CREATING_PROJECT_ERROR + errorString);
 0347        });
 348
 0349        BIWAnalytics.CreatedNewProject(project.title, project.description, new Vector2Int(project.rows,project.cols));
 0350    }
 351
 352    private void OpenEditorFromNewProject(ProjectData projectData)
 353    {
 0354        var manifest = BIWUtils.CreateManifestFromProject(projectData);
 0355        DataStore.i.builderInWorld.lastProjectIdCreated.Set(manifest.project.id);
 0356        OpenEditorFromManifest(manifest);
 0357    }
 358
 0359    private void OpenEditorFromManifest(Manifest manifest) { context.sceneManager.StartFlowFromProject(manifest); }
 360
 361    public void SetVisibility(bool visible)
 362    {
 363        // Note: we set it here since the profile is not ready at the initialization part
 6364        view.SetGuestMode(UserProfile.GetOwnUserProfile().isGuest);
 6365        DataStore.i.HUDs.builderProjectsPanelVisible.Set(visible);
 6366    }
 367
 368    private void OnVisibilityChanged(bool isVisible, bool prev)
 369    {
 7370        if (isVisible == prev)
 0371            return;
 372
 7373        view.SetVisible(isVisible);
 374
 375        // Note: we set it here since the profile is not ready at the initialization part
 7376        view.SetGuestMode(UserProfile.GetOwnUserProfile().isGuest);
 377
 7378        if (isVisible)
 379        {
 4380            if (DataStore.i.builderInWorld.landsWithAccess.Get() != null)
 4381                PanelOpenEvent(DataStore.i.builderInWorld.landsWithAccess.Get());
 382            else
 0383                sendPlayerOpenPanelEvent = true;
 384
 4385            sectionsController.OpenSection(SectionId.PROJECTS);
 386
 4387            FetchPanelInfo();
 4388            StartFetchInterval();
 4389        }
 390        else
 391        {
 3392            StopFetchInterval();
 393        }
 3394    }
 395
 396    private void OnClose()
 397    {
 1398        if (!view.IsVisible())
 0399            return;
 400
 1401        SetVisibility(false);
 402
 1403        LandWithAccess[] lands = landsesController.GetLands();
 1404        if (lands != null)
 405        {
 1406            Vector2Int totalLands = GetAmountOfLandsOwnedAndOperator(lands);
 1407            BIWAnalytics.PlayerClosesPanel(totalLands.x, totalLands.y);
 408        }
 1409    }
 410
 411    private void PanelOpenEvent(LandWithAccess[] lands)
 412    {
 4413        Vector2Int totalLands = GetAmountOfLandsOwnedAndOperator(lands);
 4414        BIWAnalytics.PlayerOpenPanel(totalLands.x, totalLands.y);
 4415    }
 416
 417    /// <summary>
 418    /// This counts the amount of lands that the user own and the amount of lands that the user operate
 419    /// </summary>
 420    /// <param name="lands"></param>
 421    /// <returns>Vector2: X = amount of owned lands, Y = amount of operator lands</returns>
 422    private Vector2Int GetAmountOfLandsOwnedAndOperator(LandWithAccess[] lands)
 423    {
 5424        int ownedLandsCount = 0;
 5425        int operatorLandsCount = 0;
 18426        foreach (var land in lands)
 427        {
 4428            if (land.role == LandRole.OWNER)
 4429                ownedLandsCount++;
 430            else
 0431                operatorLandsCount++;
 432        }
 433
 5434        return new Vector2Int(ownedLandsCount, operatorLandsCount);
 435    }
 436
 437    private void SetView()
 438    {
 16439        scenesViewController.AddListener((ISceneListener) view);
 16440        projectsController.AddListener((IProjectsListener) view);
 16441    }
 442
 443    private void PublishFinish(bool isOk)
 444    {
 0445        if(isOk)
 0446            FetchPanelInfo(0,0);
 0447    }
 448
 4449    private void FetchPanelInfo() => FetchPanelInfo(CACHE_TIME_LAND, CACHE_TIME_SCENES);
 450
 451    private void FetchPanelInfo(float landCacheTime, float scenesCacheTime)
 452    {
 4453        if (isFetchingLands || isFetchingProjects)
 0454            return;
 455
 4456        isFetchingLands = true;
 4457        isFetchingProjects = true;
 458
 4459        var address = UserProfile.GetOwnUserProfile().ethAddress;
 4460        var network = KernelConfig.i.Get().network;
 461
 462#if UNITY_EDITOR
 463        // NOTE: to be able to test in editor without getting a profile we hardcode an address here
 4464        if (string.IsNullOrEmpty(address))
 465        {
 0466            address = TESTING_ETH_ADDRESS;
 0467            network = TESTING_TLD;
 0468            DataStore.i.realm.playerRealm.Set(new CurrentRealmModel()
 469            {
 470                domain = $"https://peer.decentraland.{TESTING_TLD}",
 471                contentServerUrl = $"https://peer.decentraland.{TESTING_TLD}/content",
 472            });
 473        }
 474#endif
 475
 4476        sectionsController.SetFetchingDataStart();
 477
 4478        fetchLandPromise = DeployedScenesFetcher.FetchLandsFromOwner(catalyst, theGraph, address, network, landCacheTime
 4479        fetchLandPromise
 480            .Then(LandsFetched)
 481            .Catch(LandsFetchedError);
 482
 4483        FetchProjectData();
 4484    }
 485
 486    internal void FetchProjectData()
 487    {
 4488        sectionsController.SetFetchingDataStart<SectionProjectController>();
 4489        fetchProjectsPromise = BuilderPanelDataFetcher.FetchProjectData(context.builderAPIController);
 4490        fetchProjectsPromise
 491            .Then(ProjectsFetched)
 492            .Catch(ProjectsFetchedError);
 4493    }
 494
 495    internal void ProjectsFetched(ProjectData[] data)
 496    {
 1497        DataStore.i.builderInWorld.projectData.Set(data);
 1498        isFetchingProjects = false;
 1499        sectionsController.SetFetchingDataEnd<SectionProjectController>();
 1500        projectsController.SetProjects(data);
 1501        UpdateProjectsDeploymentStatus();
 1502    }
 503
 504    internal void ProjectsFetchedError(string error)
 505    {
 1506        isFetchingProjects = false;
 1507        sectionsController.SetFetchingDataEnd<SectionProjectController>();
 1508        projectsController.SetProjects(new ProjectData[] { });
 1509        BIWUtils.ShowGenericNotification(error);
 1510    }
 511
 512    private void UpdateProjectsDeploymentStatus()
 513    {
 2514        if (isFetchingLands || isFetchingProjects)
 0515            return;
 516
 2517        projectsController.UpdateDeploymentStatus();
 2518    }
 519
 520    internal void LandsFetchedError(string error)
 521    {
 1522        isFetchingLands = false;
 1523        sectionsController.SetFetchingDataEnd<SectionLandController>();
 1524        sectionsController.SetFetchingDataEnd<SectionScenesController>();
 1525        landsesController.SetLands(new LandWithAccess[] { });
 1526        scenesViewController.SetScenes(new ISceneData[] { });
 1527        Debug.LogError(error);
 1528    }
 529
 530    internal void LandsFetched(LandWithAccess[] lands)
 531    {
 1532        DataStore.i.builderInWorld.landsWithAccess.Set(lands.ToArray(), true);
 1533        sectionsController.SetFetchingDataEnd<SectionLandController>();
 1534        sectionsController.SetFetchingDataEnd<SectionScenesController>();
 1535        isFetchingLands = false;
 1536        UpdateProjectsDeploymentStatus();
 537
 538        try
 539        {
 1540            ISceneData[] places = { };
 541
 1542            if(lands.Length > 0)
 2543                places = lands.Where(land => land.scenes != null && land.scenes.Count > 0)
 2544                                       .Select(land => land.scenes.Where(scene => !scene.isEmpty).Select(scene => (IScen
 0545                                       .Aggregate((i, j) => i.Concat(j))
 546                                       .ToArray();
 547
 0548            if (sendPlayerOpenPanelEvent)
 0549                PanelOpenEvent(lands);
 550
 0551            landsesController.SetLands(lands);
 0552            scenesViewController.SetScenes(places);
 0553        }
 1554        catch (Exception e)
 555        {
 1556            Debug.Log("Error setting the lands and scenes "+ e);
 1557            landsesController.SetLands(lands);
 1558            scenesViewController.SetScenes(new ISceneData[] { });
 1559        }
 1560    }
 561
 562    internal void GoToCoords(Vector2Int coords)
 563    {
 1564        WebInterface.GoTo(coords.x, coords.y);
 1565        SetVisibility(false);
 1566        OnJumpInOrEdit?.Invoke();
 1567    }
 568
 0569    private void OpenUrl(string url) { WebInterface.OpenURL(url); }
 570
 571    internal void OnGoToEditScene(Vector2Int coords)
 572    {
 0573        SetVisibility(false);
 0574        context.sceneManager.StartFlowFromLandCoords(coords);
 0575    }
 576
 577    private void StartFetchInterval()
 578    {
 4579        if (fetchDataInterval != null)
 580        {
 0581            StopFetchInterval();
 582        }
 583
 4584        fetchDataInterval = CoroutineStarter.Start(RefreshDataInterval());
 4585    }
 586
 587    private void StopFetchInterval()
 588    {
 19589        CoroutineStarter.Stop(fetchDataInterval);
 19590        fetchDataInterval = null;
 19591    }
 592
 593    IEnumerator RefreshDataInterval()
 594    {
 0595        while (true)
 596        {
 4597            yield return WaitForSecondsCache.Get(REFRESH_INTERVAL);
 0598            FetchPanelInfo();
 599        }
 600    }
 601
 602    IEnumerator WaitASecondAndRefreshProjects()
 603    {
 0604        yield return new WaitForSeconds(1f);
 0605        FetchProjectData();
 0606    }
 607
 608    private void OnSceneUnpublished(PublishSceneResultPayload current, PublishSceneResultPayload previous)
 609    {
 0610        if (current.ok)
 611        {
 0612            FetchPanelInfo(CACHE_TIME_LAND, 0);
 613        }
 0614    }
 615
 32616    private void ConfigureBuilderInFullscreenMenuChanged(Transform currentParentTransform, Transform previousParentTrans
 617}

Methods/Properties

configureBuilderInFullscreenMenu()
BuilderMainPanelController()
SetView(DCL.Builder.IBuilderMainPanelView)
ConnectGuestWallet()
OnBack()
Dispose()
Initialize(DCL.Builder.IContext)
Initialize(DCL.Builder.IContext, DCL.Builder.ISectionsController, IScenesViewController, ILandsController, IProjectsController, INewProjectFlowController, ITheGraph, ICatalyst)
SectionContentNotEmpty()
SectionContentEmpty()
DuplicateProject(DCL.Builder.ProjectData)
DuplicateProject()
PublishProject()
PublishProject()
DeleteProject(DCL.Builder.ProjectData)
GetManifestToEdit(DCL.Builder.ProjectData)
CreateNewProject(DCL.Builder.ProjectData)
OpenEditorFromNewProject(DCL.Builder.ProjectData)
OpenEditorFromManifest(DCL.Builder.Manifest.Manifest)
SetVisibility(System.Boolean)
OnVisibilityChanged(System.Boolean, System.Boolean)
OnClose()
PanelOpenEvent(LandWithAccess[])
GetAmountOfLandsOwnedAndOperator(LandWithAccess[])
SetView()
PublishFinish(System.Boolean)
FetchPanelInfo()
FetchPanelInfo(System.Single, System.Single)
FetchProjectData()
ProjectsFetched(DCL.Builder.ProjectData[])
ProjectsFetchedError(System.String)
UpdateProjectsDeploymentStatus()
LandsFetchedError(System.String)
LandsFetched(LandWithAccess[])
GoToCoords(UnityEngine.Vector2Int)
OpenUrl(System.String)
OnGoToEditScene(UnityEngine.Vector2Int)
StartFetchInterval()
StopFetchInterval()
RefreshDataInterval()
WaitASecondAndRefreshProjects()
OnSceneUnpublished(PublishSceneResultPayload, PublishSceneResultPayload)
ConfigureBuilderInFullscreenMenuChanged(UnityEngine.Transform, UnityEngine.Transform)