Esempio n. 1
0
 private CustomizerGestureModel processGesture(ITouch touch, CustomizerGestureModel gestureModel)
 {
     gestureModel.TouchDownStartPos = touch.position;
     if (isOverUI(touch))
     {
         if (EventSystem.current.currentSelectedGameObject != null)
         {
             EquipmentIcon component = EventSystem.current.currentSelectedGameObject.GetComponent <EquipmentIcon>();
             if (component != null)
             {
                 gestureModel.TouchDownStartArea = AreaTouchedEnum.INVENTORY_BUTTON;
                 gestureModel.DragIconTexture    = component.GetIcon() as Texture2D;
                 gestureModel.ItemId             = component.EquipmentId;
                 gestureModel.IsEquippable       = component.IsEquippable;
             }
         }
     }
     else if (isTouchBlockedByUIControls(touch))
     {
         gestureModel.TouchDownStartArea = AreaTouchedEnum.CLICK_BLOCKING_UI;
     }
     else
     {
         gestureModel.TouchDownStartArea = AreaTouchedEnum.PENGUIN_PREVIEW_ROTATION_AREA;
     }
     return(gestureModel);
 }
Esempio n. 2
0
        private void setItemView(EquipmentIcon iconItem, InventoryIconModel <DCustomEquipment> dataModel)
        {
            bool isPlayerMember = Service.Get <CPDataEntityCollection>().IsLocalPlayerMember() || !model.InventoryData.IsEquipmentMemberOnly(dataModel.Data);

            iconItem.SetupView(dataModel, isPlayerMember);
            itemImageBuilder.RequestImage(dataModel.Data, iconItem.SetIcon);
        }
Esempio n. 3
0
        private void showRemoveItemPrompt(PromptLoaderCMD promptLoader, EquipmentIcon iconItem)
        {
            Texture2D texture2D = (Texture2D)iconItem.GetIcon();
            Sprite    sprite    = Sprite.Create(texture2D, new Rect(0f, 0f, texture2D.width, texture2D.height), new Vector2(0.5f, 0.5f));

            promptLoader.PromptData.SetImage(DPrompt.PROMPT_IMAGE_DEFAULT, sprite);
            Service.Get <PromptManager>().ShowPrompt(promptLoader.PromptData, delegate(DPrompt.ButtonFlags pressed)
            {
                deleteConfirmationButton(pressed, iconItem.EquipmentId);
            }, promptLoader.Prefab);
        }
Esempio n. 4
0
        private void removeItem(EditableItem editableItem)
        {
            EquipmentIcon iconItem = editableItem.GetComponentInChildren <EquipmentIcon>();

            indexToRemove = editableItem.GetCurrentIndex();
            PromptDefinition promptDefinition = Service.Get <PromptManager>().GetPromptDefinition("DeleteEquipmentPrompt");
            PromptLoaderCMD  promptLoaderCMD  = new PromptLoaderCMD(this, promptDefinition, delegate(PromptLoaderCMD loader)
            {
                showRemoveItemPrompt(loader, iconItem);
            });

            promptLoaderCMD.Execute();
        }
Esempio n. 5
0
        private bool onItemReady(EditableItemEvents.ItemReady evt)
        {
            int           index = evt.Index;
            EditableItem  item  = evt.Item;
            EquipmentIcon componentInChildren = item.GetComponentInChildren <EquipmentIcon>();

            switch (index)
            {
            case 0:
                item.ShowActionButton = false;
                componentInChildren.SetupCreateButton();
                break;

            case 1:
                item.ShowActionButton = false;
                componentInChildren.SetupCatalogButton();
                break;

            default:
            {
                componentInChildren.SetupEquipmentButton();
                long key = model.DisplayedInventory[index - 2];
                InventoryIconModel <DCustomEquipment> inventoryIconModel = model.InventoryData.Inventory[key];
                item.ShowActionButton = true;
                item.Action           = EditableItem.ActionType.Delete;
                if (templateDefinitions.TryGetValue(inventoryIconModel.Data.DefinitionId, out var value) && !value.IsEditable)
                {
                    if (inventoryIconModel.IsHidden)
                    {
                        item.Action = EditableItem.ActionType.Hide;
                    }
                    else
                    {
                        item.Action = EditableItem.ActionType.Show;
                    }
                }
                AccessibilitySettings component = componentInChildren.GetComponent <AccessibilitySettings>();
                if (component != null)
                {
                    component.CustomToken = value.Name;
                }
                setItemView(componentInChildren, inventoryIconModel);
                break;
            }
            }
            return(false);
        }
Esempio n. 6
0
        private bool onEditableItemActionButtonClicked(EditableItemEvents.ActionButtonClicked evt)
        {
            EditableItem item = evt.Item;

            if (evt.Action == EditableItem.ActionType.Delete)
            {
                removeItem(item);
            }
            else if (evt.Action == EditableItem.ActionType.Hide)
            {
                EquipmentIcon componentInChildren = item.GetComponentInChildren <EquipmentIcon>();
                model.HideItem(componentInChildren.EquipmentId);
            }
            else if (evt.Action == EditableItem.ActionType.Show)
            {
                EquipmentIcon componentInChildren = item.GetComponentInChildren <EquipmentIcon>();
                model.ShowItem(componentInChildren.EquipmentId);
            }
            return(false);
        }