예제 #1
0
        public void InitUI(NodeAddedEvent e, SingleNode <MatchLobbyGUIComponent> ui, LobbyNode lobby, [JoinByMap] MapNode map)
        {
            GameModesDescriptionData data = ConfiguratorService.GetConfig("localization/battle_mode").ConvertTo <GameModesDescriptionData>();

            ui.component.SetTeamBattleMode(lobby.battleMode.BattleMode != BattleMode.DM, lobby.userLimit.TeamLimit, lobby.userLimit.UserLimit);
            ui.component.ModeName          = data.battleModeLocalization[lobby.battleMode.BattleMode];
            ui.component.MapName           = map.descriptionItem.Name;
            ui.component.ShowSearchingText = !lobby.Entity.HasComponent <CustomBattleLobbyComponent>();
            if (map.Entity.HasComponent <MapPreviewDataComponent>())
            {
                ui.component.SetMapPreview((Texture2D)map.Entity.GetComponent <MapPreviewDataComponent>().Data);
            }
            else
            {
                AssetRequestEvent eventInstance = new AssetRequestEvent();
                eventInstance.Init <MapPreviewDataComponent>(map.mapPreview.AssetGuid);
                base.ScheduleEvent(eventInstance, map);
            }
            if (ui.Entity.HasComponent <BattleLobbyGroupComponent>())
            {
                ui.Entity.GetComponent <BattleLobbyGroupComponent>().Detach(ui.Entity);
            }
            lobby.battleLobbyGroup.Attach(ui.Entity);
            ui.component.paramGravity.text = ConfiguratorService.GetConfig("localization/gravity_type").ConvertTo <GravityTypeNames>().Names[lobby.gravity.GravityType];
        }
예제 #2
0
 public void RequestMapLoadPreview(NodeAddedEvent e, MapNode mapNode)
 {
     if (this.GetMap(mapNode.Entity).LoadPreview == null)
     {
         AssetRequestEvent eventInstance = new AssetRequestEvent();
         eventInstance.Init <MapLoadPreviewDataComponent>(mapNode.mapLoadPreview.AssetGuid);
         base.ScheduleEvent(eventInstance, mapNode);
     }
 }
예제 #3
0
        public void MapPreloadOnLobbyCreated(NodeAddedEvent e, MatchMakingLobbyNode lobby, [JoinByMap] MapNode map)
        {
            lobby.Entity.RemoveComponentIfPresent <MapPreloadOnLobbyComponent>();
            AssetRequestEvent eventInstance = new AssetRequestEvent {
                AssetGuid = map.assetReference.Reference.AssetGuid
            };

            base.ScheduleEvent(eventInstance, map);
            MapPreloadOnLobbyComponent component = new MapPreloadOnLobbyComponent {
                LoaderEntity = eventInstance.LoaderEntity
            };

            lobby.Entity.AddComponent(component);
        }
예제 #4
0
        public void RequestImage(NodeAddedEvent e, VisibleBattleNode battle, [JoinByMap] SingleNode <MapPreviewComponent> map, [JoinAll] ScreenNode screen)
        {
            base.Log.InfoFormat("RequestImage {0}", battle);
            RectTransform   item      = screen.lazyList.GetItem(battle.searchData.IndexInSearchResult);
            EntityBehaviour behaviour = Object.Instantiate <EntityBehaviour>(screen.battleSelectScreen.ItemContentPrefab);

            screen.lazyList.SetItemContent(battle.searchData.IndexInSearchResult, behaviour.GetComponent <RectTransform>());
            behaviour.BuildEntity(battle.Entity);
            screen.lazyList.UpdateSelection(battle.searchData.IndexInSearchResult);
            AssetRequestEvent eventInstance = new AssetRequestEvent();

            eventInstance.Init <MapPreviewDataComponent>(map.component.AssetGuid);
            base.ScheduleEvent(eventInstance, battle);
        }
예제 #5
0
        public void ProcessRequest(AssetRequestEvent e, Node any)
        {
            Entity entity = base.CreateEntity("AssetLoadByEventRequest");

            entity.AddComponent(new AssetReferenceComponent(new AssetReference(e.AssetGuid)));
            LoadByEventRequestComponent component = new LoadByEventRequestComponent {
                ResourceDataComponentType = e.ResourceDataComponentType,
                Owner = any.Entity
            };

            entity.AddComponent(component);
            AssetRequestComponent component2 = new AssetRequestComponent {
                Priority        = e.Priority,
                AssetStoreLevel = e.StoreLevel
            };

            entity.AddComponent(component2);
            e.LoaderEntity = entity;
        }