protected virtual void onDragEnd()
        {
            switch (channelUpdated)
            {
            case CustomizationChannel.RED:
                fabricChannelData.ActualChannelRed = fabricChannelData.UpdatedChannel;
                CustomizationContext.EventBus.DispatchEvent(default(CustomizerUIEvents.ShowCustomizationControls));
                CustomizationContext.EventBus.DispatchEvent(default(CustomizerUIEvents.OnApplyFabric));
                EventManager.Instance.PostEvent("SFX/UI/ClothingDesigner/ItemDrop", EventAction.PlaySound);
                break;

            case CustomizationChannel.GREEN:
                fabricChannelData.ActualChannelGreen = fabricChannelData.UpdatedChannel;
                CustomizationContext.EventBus.DispatchEvent(default(CustomizerUIEvents.ShowCustomizationControls));
                CustomizationContext.EventBus.DispatchEvent(default(CustomizerUIEvents.OnApplyFabric));
                EventManager.Instance.PostEvent("SFX/UI/ClothingDesigner/ItemDrop", EventAction.PlaySound);
                break;

            case CustomizationChannel.BLUE:
                fabricChannelData.ActualChannelBlue = fabricChannelData.UpdatedChannel;
                CustomizationContext.EventBus.DispatchEvent(default(CustomizerUIEvents.ShowCustomizationControls));
                CustomizationContext.EventBus.DispatchEvent(default(CustomizerUIEvents.OnApplyFabric));
                EventManager.Instance.PostEvent("SFX/UI/ClothingDesigner/ItemDrop", EventAction.PlaySound);
                break;

            default:
                CustomizationContext.EventBus.DispatchEvent(default(CustomizerDragEvents.EndDragFabricButton));
                break;
            }
            lastChannel = CustomizationChannel.NONE;
            CustomizationContext.EventBus.DispatchEvent(default(CustomizerDragEvents.GestureComplete));
            CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.InputStateChange(isDown: false, isManipulator: false));
        }
Exemplo n.º 2
0
 public UpdateChannelDecal(CustomizationChannel channelToUpdate, Texture2D newDecal, Vector2 uvOffset, Renderer chosenRenderer = null)
 {
     NewDecal        = newDecal;
     ChannelToUpdate = channelToUpdate;
     UVOffset        = uvOffset;
     ChosenRenderer  = chosenRenderer;
 }
        private Vector2 DragChannel(CustomizationChannel channel, Vector2 inputCoord, Vector2 channelCoord)
        {
            Vector2 vector  = CustomizerConstants.TEXTURE_CENTER_UV - inputCoord;
            Vector2 vector2 = vector - lastUVPosition;

            if (lastChannel != channel)
            {
                vector2     = Vector2.zero;
                lastChannel = channel;
            }
            lastUVPosition = vector;
            Vector2 result = channelCoord + vector2;

            while (result.x > 1f)
            {
                result.x -= 2f;
            }
            while (result.x < -1f)
            {
                result.x += 2f;
            }
            while (result.y > 1f)
            {
                result.y -= 2f;
            }
            while (result.y < -1f)
            {
                result.y += 2f;
            }
            return(result);
        }
 public override void ExitState()
 {
     lastChannel = CustomizationChannel.NONE;
     if (dragContainer != null)
     {
         dragContainer.Hide();
     }
 }
 protected virtual void dragChannelNone()
 {
     CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.UpdateChannelFabric(CustomizationChannel.GREEN, fabricChannelData.OriginalChannelGreen, fabricChannelData.UVOffsetGreen));
     CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.UpdateChannelFabric(CustomizationChannel.BLUE, fabricChannelData.OriginalChannelBlue, fabricChannelData.UVOffsetBlue));
     CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.UpdateChannelFabric(CustomizationChannel.RED, fabricChannelData.OriginalChannelRed, fabricChannelData.UVOffsetRed));
     CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.InputOverChannel(CustomizationChannel.NONE));
     channelUpdated = CustomizationChannel.NONE;
     lastChannel    = CustomizationChannel.NONE;
 }
        protected virtual void dragChannelBlue(Vector2 textureCoord, SkinnedMeshRenderer smr)
        {
            Vector2 vector = DragChannel(CustomizationChannel.BLUE, textureCoord, fabricChannelData.UVOffsetBlue);

            fabricChannelData.UVOffsetBlue = vector;
            CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.UpdateChannelFabric(CustomizationChannel.RED, fabricChannelData.OriginalChannelRed, fabricChannelData.UVOffsetRed));
            CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.UpdateChannelFabric(CustomizationChannel.GREEN, fabricChannelData.OriginalChannelGreen, fabricChannelData.UVOffsetGreen));
            CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.UpdateChannelFabric(CustomizationChannel.BLUE, dragTexture, vector));
            CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.InputOverChannel(CustomizationChannel.BLUE));
            channelUpdated = CustomizationChannel.BLUE;
            fabricChannelData.UpdatedChannel = dragTexture;
        }
Exemplo n.º 7
0
    public override void EnterState(CustomizerGestureModel currentGesture)
    {
        decalChannelData.OriginalRedUVOffset   = decalChannelData.ActualRedUVOffset;
        decalChannelData.OriginalGreenUVOffset = decalChannelData.ActualGreenUVOffset;
        decalChannelData.OriginalBlueUVOffset  = decalChannelData.ActualBlueUVOffset;
        decalChannelData.OriginalRedRenderer   = decalChannelData.ActualRedRenderer;
        decalChannelData.OriginalGreenRenderer = decalChannelData.ActualGreenRenderer;
        decalChannelData.OriginalBlueRenderer  = decalChannelData.ActualBlueRenderer;
        switch (currentGesture.Channel)
        {
        case CustomizationChannel.BLUE:
            decalChannelData.OriginalChannelRed   = decalChannelData.ActualChannelRed;
            decalChannelData.OriginalChannelGreen = decalChannelData.ActualChannelGreen;
            decalChannelData.OriginalChannelBlue  = null;
            decalChannelData.OriginalBlueRenderer = null;
            currentGesture.DragIconTexture        = decalChannelData.ActualChannelBlue;
            startingChannel = CustomizationChannel.BLUE;
            break;

        case CustomizationChannel.GREEN:
            decalChannelData.OriginalChannelRed    = decalChannelData.ActualChannelRed;
            decalChannelData.OriginalChannelBlue   = decalChannelData.ActualChannelBlue;
            decalChannelData.OriginalChannelGreen  = null;
            decalChannelData.OriginalGreenRenderer = null;
            currentGesture.DragIconTexture         = decalChannelData.ActualChannelGreen;
            startingChannel = CustomizationChannel.GREEN;
            break;

        case CustomizationChannel.RED:
            decalChannelData.OriginalChannelGreen = decalChannelData.ActualChannelGreen;
            decalChannelData.OriginalChannelBlue  = decalChannelData.ActualChannelBlue;
            decalChannelData.OriginalChannelRed   = null;
            decalChannelData.OriginalRedRenderer  = null;
            currentGesture.DragIconTexture        = decalChannelData.ActualChannelRed;
            startingChannel = CustomizationChannel.RED;
            break;
        }
        if (currentGesture.DragIconTexture != null)
        {
            dragTexture = currentGesture.DragIconTexture;
            setupDragIcon(currentGesture);
            CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.InputStateChange(isDown: true, isManipulator: false));
            CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.InputOverChannel(CustomizationChannel.NONE));
        }
        else
        {
            CustomizationContext.EventBus.DispatchEvent(default(CustomizerDragEvents.GestureComplete));
            CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.InputStateChange(isDown: false, isManipulator: false));
        }
    }
 public override void EnterState(CustomizerGestureModel currentGesture)
 {
     fabricChannelData.OriginalChannelRed   = fabricChannelData.ActualChannelRed;
     fabricChannelData.OriginalChannelGreen = fabricChannelData.ActualChannelGreen;
     fabricChannelData.OriginalChannelBlue  = fabricChannelData.ActualChannelBlue;
     channelUpdated = CustomizationChannel.NONE;
     dragTexture    = currentGesture.DragIconTexture;
     if (dragTexture != null)
     {
         CustomizationContext.EventBus.DispatchEvent(new CustomizerDragEvents.StartDragFabricButton(currentGesture));
         CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.InputStateChange(isDown: true, isManipulator: false));
         CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.InputOverChannel(CustomizationChannel.NONE));
         setupDragIcon(currentGesture);
         EventManager.Instance.PostEvent("SFX/UI/ClothingDesigner/ItemSelect", EventAction.PlaySound);
     }
     else
     {
         CustomizationContext.EventBus.DispatchEvent(default(CustomizerDragEvents.EndDragFabricButton));
         CustomizationContext.EventBus.DispatchEvent(default(CustomizerDragEvents.GestureComplete));
         CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.InputStateChange(isDown: false, isManipulator: false));
     }
 }
Exemplo n.º 9
0
 public UpdateChannelFabric(CustomizationChannel channelToUpdate, Texture2D newFabric, Vector2 uvOffset)
 {
     NewFabric       = newFabric;
     ChannelToUpdate = channelToUpdate;
     UVOffset        = uvOffset;
 }
Exemplo n.º 10
0
 public InputOverChannel(CustomizationChannel channel)
 {
     Channel = channel;
 }
Exemplo n.º 11
0
 public void SetPersistentChannelData(OriginalFabricData fabricChannelData)
 {
     this.fabricChannelData = fabricChannelData;
     channelUpdated         = CustomizationChannel.NONE;
 }