private bool onSelectItem(InventoryModelEvents.SelectEquipment evt)
 {
     if (evt.Id == EquipmentId)
     {
         activateSelected(isActivated: true);
         breadcrumbController.RemovePersistentBreadcrumb(BreadcrumbType, EquipmentId.ToString());
     }
     return(false);
 }
예제 #2
0
        protected override void ProcessOneTouch(ITouch touch)
        {
            switch (touch.phase)
            {
            case TouchPhase.Began:
                currentGesture = processGesture(touch, currentGesture);
                break;

            case TouchPhase.Ended:
                if (Time.time - currentGesture.TouchStartTime < TapTimeThreshold && Vector2.Distance(touch.position, currentGesture.TouchDownStartPos) < tapDistanceThreshold)
                {
                    switch (currentGesture.TouchDownStartArea)
                    {
                    case AreaTouchedEnum.GREEN_CHANNEL:
                        if (CurrentState == CustomizerState.FABRIC)
                        {
                            CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.UpdateChannelFabric(CustomizationChannel.GREEN, originalFabricChannelData.ActualChannelGreen, originalFabricChannelData.UVOffsetGreen));
                        }
                        else
                        {
                            CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.UpdateChannelDecal(CustomizationChannel.GREEN, originalDecalChannelData.ActualChannelGreen, originalDecalChannelData.ActualGreenUVOffset, originalDecalChannelData.ActualGreenRenderer));
                        }
                        CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.InputOverChannel(CustomizationChannel.GREEN));
                        break;

                    case AreaTouchedEnum.BLUE_CHANNEL:
                        if (CurrentState == CustomizerState.FABRIC)
                        {
                            CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.UpdateChannelFabric(CustomizationChannel.BLUE, originalFabricChannelData.ActualChannelBlue, originalFabricChannelData.UVOffsetBlue));
                        }
                        else
                        {
                            CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.UpdateChannelDecal(CustomizationChannel.BLUE, originalDecalChannelData.ActualChannelBlue, originalDecalChannelData.ActualBlueUVOffset, originalDecalChannelData.ActualBlueRenderer));
                        }
                        CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.InputOverChannel(CustomizationChannel.BLUE));
                        break;

                    case AreaTouchedEnum.RED_CHANNEL:
                        if (CurrentState == CustomizerState.FABRIC)
                        {
                            CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.UpdateChannelFabric(CustomizationChannel.RED, originalFabricChannelData.ActualChannelRed, originalFabricChannelData.UVOffsetRed));
                        }
                        else
                        {
                            CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.UpdateChannelDecal(CustomizationChannel.RED, originalDecalChannelData.ActualChannelRed, originalDecalChannelData.ActualRedUVOffset, originalDecalChannelData.ActualRedRenderer));
                        }
                        CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.InputOverChannel(CustomizationChannel.RED));
                        break;

                    case AreaTouchedEnum.TEMPLATE_BUTTON:
                        if (currentGesture.IsEnabled)
                        {
                            if (currentGesture.IsEquippable)
                            {
                                Sprite templateSprite = Sprite.Create(currentGesture.DragIconTexture, new Rect(0f, 0f, currentGesture.DragIconTexture.width, currentGesture.DragIconTexture.height), Vector2.zero);
                                breadcrumbController.RemovePersistentBreadcrumb(templateBreadcrumbType, currentGesture.ItemDefinitionId.ToString());
                                CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.SelectTemplate(currentGesture.TemplateData, templateSprite));
                            }
                            else
                            {
                                ClothingDesignerContext.EventBus.DispatchEvent(new ClothingDesignerUIEvents.ShowMemberFlow("blueprints"));
                            }
                        }
                        break;
                    }
                }
                currentGesture = new CustomizerGestureModel();
                break;

            case TouchPhase.Canceled:
                currentGesture = new CustomizerGestureModel();
                break;

            case TouchPhase.Moved:
                switch (currentGesture.TouchDownStartArea)
                {
                case AreaTouchedEnum.RED_CHANNEL:
                case AreaTouchedEnum.GREEN_CHANNEL:
                case AreaTouchedEnum.BLUE_CHANNEL:
                    CustomizationContext.EventBus.DispatchEvent(new CustomizerDragEvents.DragOffChannel(currentGesture));
                    break;

                case AreaTouchedEnum.FABRIC_BUTTON:
                    if (checkButtonDrag(touch.deltaPosition))
                    {
                        breadcrumbController.RemovePersistentBreadcrumb(fabricBreadcrumbType, currentGesture.ItemDefinitionId.ToString());
                        CustomizationContext.EventBus.DispatchEvent(new CustomizerDragEvents.DragFabricButton(currentGesture));
                    }
                    break;

                case AreaTouchedEnum.DECAL_BUTTON:
                    if (checkButtonDrag(touch.deltaPosition))
                    {
                        breadcrumbController.RemovePersistentBreadcrumb(decalBreadcrumbType, currentGesture.ItemDefinitionId.ToString());
                        CustomizationContext.EventBus.DispatchEvent(new CustomizerDragEvents.DragDecalButton(currentGesture));
                    }
                    break;

                case AreaTouchedEnum.TEMPLATE_BUTTON:
                    if (checkButtonDrag(touch.deltaPosition) && currentGesture.IsEquippable)
                    {
                        breadcrumbController.RemovePersistentBreadcrumb(templateBreadcrumbType, currentGesture.ItemDefinitionId.ToString());
                        CustomizationContext.EventBus.DispatchEvent(new CustomizerDragEvents.DragTemplate(currentGesture));
                    }
                    break;

                case AreaTouchedEnum.PENGUIN_ROTATION_AREA:
                    CustomizationContext.EventBus.DispatchEvent(new CustomizerDragEvents.RotatePenguin(currentGesture));
                    break;

                case AreaTouchedEnum.CLICK_BLOCKING_UI:
                    break;
                }
                break;

            case TouchPhase.Stationary:
                break;
            }
        }