Exemple #1
0
        private void OnEventTrigger(BaseEventData p)
        {
            PointerEventData ped = p as PointerEventData;

            if (ped.pointerCurrentRaycast.isValid)
            {
                if (ped.GetPointerObjectName() == eventTrigger.name)
                {
                    if (isHideAllowed)
                    {
                        viewService.RemoveView(RavenhillViewType.hint_view);
                    }
                }
                else
                {
                    if (secondEventTrigger != null)
                    {
                        if (ped.GetPointerObjectName() == secondEventTrigger.name)
                        {
                            if (isHideAllowed)
                            {
                                viewService.RemoveView(RavenhillViewType.hint_view);
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
        public void Setup(CollectionData collectionData, ChargerData data)
        {
            this.data                = data;
            this.collectionData      = collectionData;
            iconImage.overrideSprite = resourceService.GetSprite(data);

            var info        = collectionData.GetChargeData(data.id);
            int playerCount = playerService.GetItemCount(data);

            countText.text = string.Format($"{playerCount}/{info.count}");

            if (playerCount >= info.count)
            {
                countText.color = allowColor;
                iconImage.color = nonEmptyIconColor;
            }
            else
            {
                countText.color = notAllowColor;
                iconImage.color = emptyIconColor;
            }

            trigger.SetEventTriggerClick((eventData) => {
                Debug.Log($"Click on charger: {data.id}");
                PointerEventData pointerData = eventData as PointerEventData;
                if (pointerData != null)
                {
                    if (pointerData.GetPointerObjectName() == trigger.name)
                    {
                        viewService.ShowView(RavenhillViewType.collection_buy_charger_view, collectionData);
                    }
                }
            }, engine.GetService <IAudioService>());
        }
Exemple #3
0
        public override void Setup(object inData = null)
        {
            base.Setup(inData);

            data = inData as Data;
            if (data == null)
            {
                throw new ArgumentException($"VideoView must have setup parameter {typeof(Data).FullName}");
            }

            eventTrigger.SetEventTriggerClick(p => {
                PointerEventData pointerData = p as PointerEventData;
                if (pointerData != null)
                {
                    if (pointerData.GetPointerObjectName() == eventTrigger.name)
                    {
                        if (data != null)
                        {
                            data.completeAction?.Invoke();
                            viewService.RemoveView(RavenhillViewType.video_view, 0.2f);
                        }
                    }
                }
            }, engine.GetService <IAudioService>());

            VideoData videoData = resourceService.GetVideoData(data.id);

            if (videoData != null)
            {
                VideoClip clip = Resources.Load <VideoClip>(videoData.resourceAsset);
                videoPlayer.clip = clip;
                videoPlayer.Play();
            }
        }
Exemple #4
0
        public override void Setup(BuffInfo buff)
        {
            base.Setup(buff);

            this.buff = buff;
            this.name = buff.Id;

            iconImage.overrideSprite = resourceService.GetSprite(buff.Data);
            updateTimer.Setup(1.0f, (delay) => {
                UpdateTimer();
            });
            trigger.SetEventTriggerClick(p => {
                PointerEventData ped = p as PointerEventData;
                if (ped.pointerCurrentRaycast.isValid)
                {
                    if (ped.GetPointerObjectName() == this.name)
                    {
                        iconImage.gameObject.GetOrAdd <RectTransformAnimScale>().StartAnim(new MCFloatAnimData {
                            start           = 1,
                            end             = 1.1f,
                            duration        = 0.15f,
                            overwriteEasing = new OverwriteEasing {
                                type = MCEaseType.EaseInOutCubic
                            },
                            endAction = () => {
                                iconImage.gameObject.GetOrAdd <RectTransformAnimScale>().StartAnim(new MCFloatAnimData {
                                    start           = 1.1f,
                                    end             = 1,
                                    duration        = 0.15f,
                                    overwriteEasing = new OverwriteEasing {
                                        type = MCEaseType.EaseInOutCubic
                                    },
                                    endAction = () => {
                                        viewService.ShowView(RavenhillViewType.hint_view, new HintView.ItemData {
                                            data           = buff.Data,
                                            offsetType     = HintView.OffsetType.Left,
                                            screenPosition = engine.Input.lastPointerPosition
                                        });
                                    }
                                });
                            }
                        });
                    }
                }
            }, engine.GetService <IAudioService>());
        }
        public void Setup()
        {
            var collection = resourceService.GetStoryCollection(collectionId);

            if (collection == null)
            {
                throw new NullReferenceException("storyCollection");
            }

            int playerCount = playerService.GetItemCount(collection);

            if (playerCount > 0)
            {
                presentImage.ActivateSelf();
                nonPresentImage.DeactivateSelf();
            }
            else
            {
                presentImage.DeactivateSelf();
                nonPresentImage.ActivateSelf();
            }

            presentTrigger.SetEventTriggerClick(p => {
                PointerEventData pointerData = p as PointerEventData;
                if (pointerData.GetPointerObjectName() == presentTrigger.name)
                {
                    engine.GetService <IVideoService>().PlayVideo(collection.videoId, () => Debug.Log("hey"));
                }
                presentImage.gameObject.GetOrAdd <RectTransformAnimScale>().StartAnim(new MCFloatAnimData {
                    duration        = 0.15f,
                    start           = 1,
                    end             = 1.1f,
                    overwriteEasing = new OverwriteEasing {
                        type = MCEaseType.EaseInOutCubic
                    },
                    endAction = () => {
                        presentImage.gameObject.GetOrAdd <RectTransformAnimScale>().StartAnim(new MCFloatAnimData {
                            duration        = 0.15f,
                            start           = 1.1f,
                            end             = 1,
                            overwriteEasing = new OverwriteEasing {
                                type = MCEaseType.EaseInOutCubic
                            }
                        });
                    }
                });
            }, engine.GetService <IAudioService>());

            nonPresentTrigger.SetEventTriggerClick(p => {
                PointerEventData pointerData = p as PointerEventData;

                if (pointerData.GetPointerObjectName() == nonPresentTrigger.name)
                {
                    viewService.ShowView(RavenhillViewType.story_collection_charge_view, collection);
                }

                nonPresentImage.gameObject.GetOrAdd <RectTransformAnimScale>().StartAnim(new MCFloatAnimData {
                    duration        = 0.15f,
                    start           = 1,
                    end             = 1.1f,
                    overwriteEasing = new OverwriteEasing {
                        type = MCEaseType.EaseInOutCubic
                    },
                    endAction = () => {
                        nonPresentImage.gameObject.GetOrAdd <RectTransformAnimScale>().StartAnim(new MCFloatAnimData {
                            duration        = 0.15f,
                            start           = 1.1f,
                            end             = 1,
                            overwriteEasing = new OverwriteEasing {
                                type = MCEaseType.EaseInOutCubic
                            }
                        });
                    }
                });
            }, engine.GetService <IAudioService>());
        }