void ProcessReceivedHotScene(HotScenesController.HotSceneInfo hotSceneInfo, int priority) { Vector2Int baseCoords = hotSceneInfo.baseCoords; HotSceneCellView hotSceneView = null; if (cachedHotScenes.ContainsKey(baseCoords)) { hotSceneView = cachedHotScenes[baseCoords]; if (!hotSceneView) { return; } } else { hotSceneView = hotScenesViewPool.GetView(); hotSceneView.Initialize(); cachedHotScenes.Add(baseCoords, hotSceneView); } hotSceneView.transform.SetSiblingIndex(priority); if (!hotSceneView.gameObject.activeSelf) { hotSceneView.gameObject.SetActive(true); } if (!IsHotSceneCellActive(baseCoords)) { AddActiveHotSceneCell(baseCoords, hotSceneView); } hotSceneView.Setup(hotSceneInfo); friendsController.AddHandler(hotSceneView.friendsHandler); }
public void SetMinimapSceneInfo(HotScenesController.HotSceneInfo sceneInfo) { baseCoord = sceneInfo.baseCoords; name = sceneInfo.name; creator = sceneInfo.creator; description = sceneInfo.description; parcels = sceneInfo.parcels; }
private void OnMapInfoUpdated(HotScenesController.HotSceneInfo sceneInfo) { sceneName.text = sceneInfo.name; FetchThumbnail(sceneInfo.thumbnail, onFail: () => FetchThumbnail(MapUtils.GetMarketPlaceThumbnailUrl(sceneInfo.parcels, THMBL_MARKETPLACE_WIDTH, THMBL_MARKETPLACE_HEIGHT, THMBL_MARKETPLACE_SIZEFACTOR), onFail: () => SetThumbnail(errorThumbnail.texture))); }
public void Setup(HotScenesController.HotSceneInfo sceneInfo) { hotSceneInfo = sceneInfo; mapInfoHandler.SetMinimapSceneInfo(sceneInfo); OnCrowdInfoUpdated(sceneInfo); OnMapInfoUpdated(sceneInfo); }
void ProcessReceivedHotScene(HotScenesController.HotSceneInfo hotSceneInfo, int priority) { Vector2Int baseCoords = hotSceneInfo.baseCoords; HotSceneCellView hotSceneView = null; if (cachedHotScenes.ContainsKey(baseCoords)) { hotSceneView = cachedHotScenes[baseCoords]; if (!hotSceneView) { return; } } else { hotSceneView = hotScenesViewPool.GetView(); hotSceneView.Setup(); cachedHotScenes.Add(baseCoords, hotSceneView); } hotSceneView.transform.SetSiblingIndex(priority); if (!hotSceneView.gameObject.activeSelf) { hotSceneView.gameObject.SetActive(true); } if (!IsHotSceneCellActive(baseCoords)) { AddActiveHotSceneCell(baseCoords, hotSceneView); } hotSceneView.crowdHandler.SetCrowdInfo(hotSceneInfo); if (!hotSceneView.mapInfoHandler.HasMinimapSceneInfo()) { mapDataController.SetMinimapData(baseCoords, hotSceneView.mapInfoHandler, (resolvedView) => { friendsController.AddHandler(hotSceneView.friendsHandler); }, (rejectedView) => { hotScenesViewPool.PoolView(hotSceneView); cachedHotScenes[baseCoords] = null; }); } }
private void SimulateHotSceneUpdate() { var scenes = new HotScenesController.HotSceneInfo[] { new HotScenesController.HotSceneInfo() { baseCoords = BASECOORD_FIRST_CELL, realms = new HotScenesController.HotSceneInfo.Realm[] { new HotScenesController.HotSceneInfo.Realm() { layer = "amber", serverName = "fenrir", usersCount = 10, usersMax = 50 }, new HotScenesController.HotSceneInfo.Realm() { layer = "blue", serverName = "unicorn", usersCount = 2, usersMax = 50 } }, parcels = new Vector2Int[] { BASECOORD_FIRST_CELL, BASECOORD_FIRST_CELL + new Vector2Int(0, 1) }, usersTotalCount = 12 }, new HotScenesController.HotSceneInfo() { baseCoords = BASECOORD_SECOND_CELL, realms = new HotScenesController.HotSceneInfo.Realm[] { new HotScenesController.HotSceneInfo.Realm() { layer = "amber", serverName = "fenrir", usersCount = 1, usersMax = 50 } }, parcels = new Vector2Int[] { BASECOORD_SECOND_CELL }, usersTotalCount = 1 }, new HotScenesController.HotSceneInfo() { baseCoords = BASECOORD_TEMPTATION, realms = new HotScenesController.HotSceneInfo.Realm[] { new HotScenesController.HotSceneInfo.Realm() { layer = "red", serverName = "temptation", usersCount = 100, usersMax = 50 } }, parcels = new Vector2Int[] { BASECOORD_TEMPTATION, BASECOORD_TEMPTATION + new Vector2Int(0, 1), BASECOORD_TEMPTATION + new Vector2Int(0, 2) }, usersTotalCount = 100 } }; string scenesJson = "["; for (int i = 0; i < scenes.Length; i++) { scenesJson += JsonUtility.ToJson(scenes[i]); if (i != scenes.Length - 1) { scenesJson += ","; } } scenesJson += "]"; var json = "{\"chunkIndex\":0,\"chunksCount\":1,\"scenesInfo\":" + scenesJson + "}"; HotScenesController.i.UpdateHotScenesList(json); }
private void OnCrowdInfoUpdated(HotScenesController.HotSceneInfo info) { crowdCount.text = info.usersTotalCount.ToString(); crowdCountContainer.SetActive(info.usersTotalCount > 0); }
public void SetCrowdInfo(HotScenesController.HotSceneInfo info) { this.info = info; onInfoUpdate?.Invoke(info); }