/// <inheritdoc/>
        override public GameObject GetGameObject(Activity activity)
        {
            var attachment = activity.Attachments.FirstOrDefault();
            var heroCard   = attachment.GetRichCard <HeroCard>();
            var vc         = m_Pool.Spawn();
            List <ActionSheetOption> actionSheetOptions = null;

            if (heroCard.Buttons != null)
            {
                actionSheetOptions = new List <ActionSheetOption>();
                foreach (var action in heroCard.Buttons)
                {
                    ICommand command = m_CommandLibrary.GetCommand(action.Type);
                    actionSheetOptions.Add(new ActionSheetOption(action.Image, action.Title, command));
                }
            }
            if (activity.SuggestedActions != null)
            {
                if (actionSheetOptions == null)
                {
                    actionSheetOptions = new List <ActionSheetOption>();
                }

                foreach (var action in activity.SuggestedActions?.Actions)
                {
                    ICommand command = m_CommandLibrary.GetCommand(action.Type);
                    actionSheetOptions.Add(new ActionSheetOption(action.Image, action.Title, command));
                }
            }

            vc.Initialize(heroCard.Text, heroCard.Images.FirstOrDefault()?.Url, actionSheetOptions);
            return(vc.gameObject);
        }
예제 #2
0
        /// <inheritdoc/>
        public override GameObject GetGameObject(Activity activity)
        {
            TextCardViewController vc = m_Pool.Spawn();

            vc.Initialize(activity.Text);

            return(vc.gameObject);
        }
        public override GameObject GetGameObject(Activity activity)
        {
            IList <CardAction>            actions = activity.SuggestedActions.Actions;
            ActionSheetCardViewController vc      = m_Pool.Spawn();
            List <ActionSheetOption>      options = new List <ActionSheetOption>();

            foreach (var action in actions)
            {
                ICommand command = m_CommandLibrary.GetCommand(action.Type);
                options.Add(new ActionSheetOption(action.Image, action.Title, command));
            }
            vc.Initialize(options, activity.Text);
            return(vc.gameObject);
        }
        public void Initialize(string message, string imageUrl, IEnumerable <AssemblyComponent> components)
        {
            this.message  = message;
            this.imageUrl = imageUrl;

            foreach (var component in components)
            {
                var vc = m_AssemblyPool.Spawn();
                vc.Initialize(component);
                vc.transform.SetParent(m_MaterialContainer, false);
            }

            if (m_MaterialContainer.childCount == 0)
            {
                m_MaterialContainer.gameObject.SetActive(false);
            }
        }
예제 #5
0
        /// <inheritdoc/>
        public override GameObject GetGameObject(Activity activity)
        {
            var attachment   = activity.Attachments.FirstOrDefault();
            var materialCard = attachment.GetRichCard <MaterialCard>();
            var vc           = m_Pool.Spawn();

            if (materialCard.Materials != null)
            {
                m_AssemblyComponents.Clear();
                foreach (var m in materialCard.Materials)
                {
                    m_AssemblyComponents.Add(new AssemblyComponent(m.Image, m.Title, m.Meta, m.Amount));
                }
            }

            vc.Initialize(materialCard.Text, materialCard.Image?.Url, m_AssemblyComponents);
            return(vc.gameObject);
        }