Пример #1
0
        public void AddItem(Entity entity)
        {
            EntityBehaviour behaviour = Instantiate <EntityBehaviour>(this.itemContentPrefab);
            ListItem        item      = Instantiate <ListItem>(this.itemPrefab);

            item.SetContent((UnityEngine.RectTransform)behaviour.transform);
            item.transform.SetParent(this.content, false);
            item.Data = entity;
            this.items.Add(item);
            behaviour.BuildEntity(entity);
            if (this.Sorter == null)
            {
                item.transform.SetAsLastSibling();
            }
            else
            {
                this.Sorter.Sort(this.items);
                int num = 0;
                foreach (ListItem item2 in this.items)
                {
                    item2.transform.SetSiblingIndex(num++);
                }
            }
            this.Layout();
        }
        private void SpawnEffect(RectTransform container, Entity entity)
        {
            EntityBehaviour behaviour = Instantiate <EntityBehaviour>(this.effectPrefab);

            behaviour.BuildEntity(entity);
            behaviour.transform.SetParent(container, false);
            behaviour.transform.SetAsFirstSibling();
            base.SendMessage("RefreshCurve", SendMessageOptions.DontRequireReceiver);
        }
Пример #3
0
        public void AddIndicator(ScoreTableRowIndicator indicatorPrefab)
        {
            ScoreTableRowIndicator indicator = Instantiate <ScoreTableRowIndicator>(indicatorPrefab);

            this.indicators.Add(indicatorPrefab, indicator);
            indicator.transform.SetParent(this.indicatorsContainer, false);
            EntityBehaviour component = indicator.GetComponent <EntityBehaviour>();

            if (component != null)
            {
                component.BuildEntity(base.GetComponent <EntityBehaviour>().Entity);
            }
            this.Sort();
        }
Пример #4
0
        public void InitMap(NodeAddedEvent e, SingleNode <MapSceneLoadedMarkerComponent> mapSceneLoadedMarker, [JoinAll, Context] LoadedMapNode map)
        {
            GameObject gameObject = mapSceneLoadedMarker.component.transform.parent.gameObject;

            if (!gameObject)
            {
                throw new CannotFindMapRootException(map.resourceData.Name);
            }
            EntityBehaviour behaviour = gameObject.AddComponent <EntityBehaviour>();

            behaviour.handleAutomaticaly = false;
            behaviour.BuildEntity(map.Entity);
            map.Entity.AddComponent(new MapInstanceComponent(gameObject));
        }
Пример #5
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);
        }
Пример #6
0
        public EntityBehaviour CreateChat(Entity entity, ChatType chatType, SingleNode <ChatDialogComponent> dialog, bool select = true)
        {
            EntityBehaviour behaviour = dialog.component.CreateChatChannel(chatType);

            behaviour.BuildEntity(entity);
            if (!behaviour.Entity.HasComponent <ChatChannelComponent>())
            {
                behaviour.Entity.AddComponent(new ChatChannelComponent(chatType));
            }
            if (select)
            {
                base.ScheduleEvent(new SelectChannelEvent(), entity);
            }
            return(behaviour);
        }
Пример #7
0
        public void AddUser(NodeAddedEvent e, [Combine] InitedScoreTable scoreTable, [Context, JoinByBattle, Combine] RoundUserNode roundUser)
        {
            ScoreTableRowComponent component = scoreTable.scoreTable.AddRow();
            Entity entity = component.GetComponent <EntityBehaviour>().Entity;

            entity.AddComponent(new ScoreTableGroupComponent(scoreTable.scoreTableGroup.Key));
            entity.AddComponent(new UserGroupComponent(roundUser.userGroup.Key));
            foreach (ScoreTableRowIndicator indicator in component.indicators.Values)
            {
                EntityBehaviour behaviour = indicator.GetComponent <EntityBehaviour>();
                if (behaviour != null)
                {
                    behaviour.BuildEntity(entity);
                }
            }
        }
        private void AddRow(InitedScoreTable scoreTable, RoundUserNode roundUser)
        {
            ScoreTableRowComponent component = scoreTable.scoreTable.AddRow();
            Entity entity = component.GetComponent <EntityBehaviour>().Entity;

            entity.AddComponent(new ScoreTableGroupComponent(scoreTable.scoreTableGroup.Key));
            entity.AddComponent(new UserGroupComponent(roundUser.userGroup.Key));
            foreach (ScoreTableRowIndicator indicator in component.indicators.Values)
            {
                EntityBehaviour behaviour = indicator.GetComponent <EntityBehaviour>();
                if (behaviour != null)
                {
                    behaviour.BuildEntity(entity);
                }
            }
        }
Пример #9
0
        public void CreateChatUI(NodeAddedEvent e, LobbyChatNode chat)
        {
            MatchLobbyGUIComponent component = MainScreenComponent.Instance.GetComponent <HomeScreenComponent>().BattleLobbyScreen.GetComponent <MatchLobbyGUIComponent>();
            EntityBehaviour        behaviour = component.chat.GetComponent <EntityBehaviour>();

            if (behaviour.Entity != null)
            {
                behaviour.DestroyEntity();
            }
            EntityBehaviour behaviour2 = component.chat.GetComponent <ChatUIComponent>().MessagesContainer.GetComponent <EntityBehaviour>();

            if (behaviour2.Entity != null)
            {
                behaviour2.DestroyEntity();
            }
            behaviour.BuildEntity(base.CreateEntity("LobbyChat"));
            behaviour2.BuildEntity(base.CreateEntity("LobbyChatContent"));
            chat.Entity.AddComponent <ActiveBattleChannelComponent>();
        }
Пример #10
0
        public void CreateBattleCamera(NodeAddedEvent evt, SingleNode <MapInstanceComponent> node)
        {
            Transform  transform  = new GameObject("BattleCameraRoot").transform;
            GameObject obj3       = GameObject.Find(ClientGraphicsConstants.MAIN_CAMERA_NAME);
            Transform  transform2 = obj3.transform;

            transform.SetPositionSafe(transform2.position);
            transform.SetRotationSafe(transform2.rotation);
            transform.SetParent(node.component.SceneRoot.transform, true);
            transform2.SetParent(transform, true);
            Entity          entity    = base.CreateEntity(typeof(CameraTemplate), "camera");
            EntityBehaviour component = obj3.GetComponent <EntityBehaviour>();

            if (component.Entity != null)
            {
                component.DestroyEntity();
            }
            component.BuildEntity(entity);
            entity.AddComponent(new CameraRootTransformComponent(transform));
            entity.AddComponent <BattleCameraComponent>();
            Camera unityCamera = obj3.GetComponent <Camera>();

            entity.AddComponent(new CameraComponent(unityCamera));
            CameraTransformDataComponent component2 = new CameraTransformDataComponent();
            TransformData data = new TransformData {
                Position = transform2.position,
                Rotation = transform2.rotation
            };

            component2.Data = data;
            entity.AddComponent(component2);
            entity.AddComponent <CameraFOVUpdateComponent>();
            entity.AddComponent <BezierPositionComponent>();
            entity.AddComponent <ApplyCameraTransformComponent>();
            entity.AddComponent <TransitionCameraComponent>();
            entity.AddComponent(new CameraShakerComponent(obj3.AddComponent <CameraShaker>()));
            BurningTargetBloomComponent component4 = new BurningTargetBloomComponent {
                burningTargetBloom = unityCamera.GetComponent <BurningTargetBloom>()
            };

            entity.AddComponent(component4);
            this.SetupCameraESM(entity);
        }