Example #1
0
        private void InitializeMessageCat()
        {
            var go = gameObject;

            go.AddComponent <ObservablePointerEnterTrigger>()
            .OnPointerEnterAsObservable()
            .Subscribe(x =>
            {
                if (!_isLock)
                {
                    return;
                }

                if (_cat)
                {
                    _cat.Hide();
                }

                _cat = Widget.Find <MessageCatManager>().Show(true, _messageForCat);
            })
            .AddTo(go);

            go.AddComponent <ObservablePointerExitTrigger>()
            .OnPointerExitAsObservable()
            .Subscribe(x =>
            {
                if (!_isLock || _cat is null)
                {
                    return;
                }

                _cat.Hide();
                _cat = null;
            })
            .AddTo(go);
        }
Example #2
0
        private void Awake()
        {
            _eventTrigger = GetComponent <EventTrigger>();
            if (!_eventTrigger)
            {
                throw new NotFoundComponentException <EventTrigger>();
            }

            EventTrigger.Entry entry = new EventTrigger.Entry();
            entry.eventID = EventTriggerType.PointerClick;
            entry.callback.AddListener(OnClick);
            _eventTrigger.triggers.Add(entry);

            RectTransform = GetComponent <RectTransform>();

            switch (ItemSubType)
            {
            case ItemSubType.FullCostume:
                _requireLevel = GameConfig.RequireCharacterLevel.CharacterFullCostumeSlot;
                break;

            case ItemSubType.HairCostume:
                _requireLevel = GameConfig.RequireCharacterLevel.CharacterHairCostumeSlot;
                break;

            case ItemSubType.EarCostume:
                _requireLevel = GameConfig.RequireCharacterLevel.CharacterEarCostumeSlot;
                break;

            case ItemSubType.EyeCostume:
                _requireLevel = GameConfig.RequireCharacterLevel.CharacterEyeCostumeSlot;
                break;

            case ItemSubType.TailCostume:
                _requireLevel = GameConfig.RequireCharacterLevel.CharacterTailCostumeSlot;
                break;

            case ItemSubType.Title:
                _requireLevel = GameConfig.RequireCharacterLevel.CharacterTitleSlot;
                break;

            case ItemSubType.Weapon:
                _requireLevel = GameConfig.RequireCharacterLevel.CharacterEquipmentSlotWeapon;
                break;

            case ItemSubType.Armor:
                _requireLevel = GameConfig.RequireCharacterLevel.CharacterEquipmentSlotArmor;
                break;

            case ItemSubType.Belt:
                _requireLevel = GameConfig.RequireCharacterLevel.CharacterEquipmentSlotBelt;
                break;

            case ItemSubType.Necklace:
                _requireLevel = GameConfig.RequireCharacterLevel.CharacterEquipmentSlotNecklace;
                break;

            case ItemSubType.Ring:
                _requireLevel = ItemSubTypeIndex == 1
                        ? GameConfig.RequireCharacterLevel.CharacterEquipmentSlotRing1
                        : GameConfig.RequireCharacterLevel.CharacterEquipmentSlotRing2;
                break;

            case ItemSubType.Food:
                switch (ItemSubTypeIndex)
                {
                case 1:
                    _requireLevel = GameConfig.RequireCharacterLevel
                                    .CharacterConsumableSlot1;
                    break;

                case 2:
                    _requireLevel = GameConfig.RequireCharacterLevel
                                    .CharacterConsumableSlot2;
                    break;

                case 3:
                    _requireLevel = GameConfig.RequireCharacterLevel
                                    .CharacterConsumableSlot3;
                    break;

                case 4:
                    _requireLevel = GameConfig.RequireCharacterLevel
                                    .CharacterConsumableSlot4;
                    break;

                case 5:
                    _requireLevel = GameConfig.RequireCharacterLevel
                                    .CharacterConsumableSlot5;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            _messageForCat =
                $"{L10nManager.Localize($"ITEM_SUB_TYPE_{ItemSubType.ToString()}")}\n<sprite name=\"UI_icon_lock_01\"> LV.{_requireLevel}";

            gameObject.AddComponent <ObservablePointerEnterTrigger>()
            .OnPointerEnterAsObservable()
            .Subscribe(x =>
            {
                if (!ShowUnlockTooltip || !IsLock)
                {
                    return;
                }

                if (_cat)
                {
                    _cat.Hide();
                }

                _cat = Widget.Find <MessageCatManager>().Show(true, _messageForCat);
            })
            .AddTo(gameObject);

            gameObject.AddComponent <ObservablePointerExitTrigger>()
            .OnPointerExitAsObservable()
            .Subscribe(x =>
            {
                if (!IsLock || !_cat)
                {
                    return;
                }

                _cat.Hide();
                _cat = null;
            })
            .AddTo(gameObject);
        }
Example #3
0
        private void Awake()
        {
            if (!GetComponentInParent <Menu>())
            {
                throw new NotFoundComponentException <Menu>();
            }

            _originLocalScale = bgTransform.localScale;

            switch (type)
            {
            case MenuType.Combination:
                _requireStage = GameConfig.RequireClearedStageLevel.UIMainMenuCombination;
                break;

            case MenuType.Ranking:
                _requireStage = GameConfig.RequireClearedStageLevel.UIMainMenuRankingBoard;
                break;

            case MenuType.Shop:
                _requireStage = GameConfig.RequireClearedStageLevel.UIMainMenuShop;
                break;

            case MenuType.Quest:
                _requireStage = GameConfig.RequireClearedStageLevel.UIMainMenuStage;
                break;

            case MenuType.Mimisbrunnr:
                _requireStage = GameConfig.RequireClearedStageLevel.UIBottomMenuMimisbrunnr;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            var unlockConditionString = string.Format(
                L10nManager.Localize("UI_STAGE_LOCK_FORMAT"),
                _requireStage);

            _messageForCat =
                $"{L10nManager.Localize(localizationKey)}\n<sprite name=\"UI_icon_lock_01\"> {unlockConditionString}";

            gameObject.AddComponent <ObservablePointerEnterTrigger>()
            .OnPointerEnterAsObservable()
            .Subscribe(x =>
            {
                if (!IsUnlocked)
                {
                    if (_cat)
                    {
                        _cat.Hide();
                    }

                    _cat = Widget.Find <MessageCatManager>().Show(true, _messageForCat);

                    return;
                }

                bgTransform.DOScale(_originLocalScale * BgScale, TweenDuration);
            })
            .AddTo(gameObject);

            gameObject.AddComponent <ObservablePointerExitTrigger>()
            .OnPointerExitAsObservable()
            .Subscribe(x =>
            {
                if (!IsUnlocked)
                {
                    if (!_cat)
                    {
                        return;
                    }

                    _cat.Hide();
                    _cat = null;

                    return;
                }

                bgTransform.DOScale(_originLocalScale, TweenDuration);
                ResetLocalizationKey();
            })
            .AddTo(gameObject);
        }