/// <summary>
        /// Turn dragging on
        /// </summary>
        void enableDrag()
        {
            // record original values
            originalParent             = transform.parent;
            originalLocation           = transform.position;
            originalScale              = parentController.currentSize;
            originalContainerInventory = containingInventory;
            ItemBeingDragged           = this;
            isBeingDragged             = true;
            originalOpacity            = parentController.currentOpacity;
            wasShapedOriginally        = containingInventory == Player.InventoryTypes.GridPack
        ? true
        : false;

            /// update for dragging
            parentController.setOpacity(1);
            // if the pack menu is open it can manage all of the dragging
            if (Universe.LocalPlayerManager.PackGridController.packMenuIsOpen && containingInventory != Player.InventoryTypes.GridPack)
            {
                parentController.resize();
                // save and replace the anchor values
                originalMaxAnchor = parentController.rectTransform.anchorMax;
                originalMinAnchor = parentController.rectTransform.anchorMin;
                Vector2 gridSize = Universe.LocalPlayerManager.PackGridController.getGridSquareSize();
                parentController.rectTransform.anchorMin = Vector2.zero;
                parentController.rectTransform.anchorMax = gridSize + gridSize;

                // re-parent to the open grid
                containingInventory = Player.InventoryTypes.GridPack;
                parentController.rectTransform.SetParent(Universe.LocalPlayerManager.PackGridController.gridTransform);
            }
        }
 /// <summary>
 /// Display the notification in the given slot
 /// </summary>
 /// <param name="notification">The notification</param>
 /// <param name="position">Which position to show it in, top is 0</param>
 public void displayNotification(Notification notification, int position)
 {
     icon = notification.icon as ItemIconController;
     // set timer
     notificationCanvas = notificationCanvas ?? GetComponent <CanvasGroup>();
     displayTimer       = notification.displayTime;
     // set the icon and text
     messageText.text = notification.message;
     icon.parentTo(iconParent);
     icon.resize(65);
     icon.setBGColor(new Color(0, 131, 200));
     // set active and begin animating.
     beginFadeIn();
     beginSliding(BottomPositionIndex, position);
     gameObject.SetActive(true);
 }
Пример #3
0
 /// <summary>
 /// mark this item selected
 /// </summary>
 public void markSelected()
 {
     isSelected = true;
     icon.resize(LargeSize);
     icon.setBGColor(SelectedColor);
 }