public void OnDrop(PointerEventData eventData)
    {
        if (eventData.pointerDrag == null)
        {
            return;
        }

        CrewUIIcon crewIcon = eventData.pointerDrag.GetComponent <CrewUIIcon>();

        if (crewIcon == null)
        {
            return;
        }

        CrewUISlot cur_slot        = slot;
        bool       cur_slot_vanish = cur_slot.vanish_empty;

        cur_slot.vanish_empty = false;

        CrewUISlot next_slot        = crewIcon.slot;
        bool       next_slot_vanish = next_slot.vanish_empty;

        next_slot.vanish_empty = false;

        LeaveSlot();
        crewIcon.InsertInto(cur_slot);
        InsertInto(next_slot);
        Snap();

        cur_slot.vanish_empty  = cur_slot_vanish;
        next_slot.vanish_empty = next_slot_vanish;
    }
    public CrewUIIcon GenIcon(CrewUISlot slot)
    {
        CrewUIIcon crewIcon = Instantiate(Game.inst.crewIconUI_prefab, slot.gameObject.transform).GetComponent <CrewUIIcon>();

        crewIcon.member = this;
        crewIcon.SetPortraitName(portaitName);
        return(crewIcon);
    }
 public void OnLeft(CrewUIIcon crewIcon)
 {
     // iconContainerTransform.gameObject.SetActive(false);
     filled = null;
     if (vanish_empty)
     {
         Destroy(gameObject);
     }
 }
    void OnDestroy()
    {
        if (filled != null)
        {
            filled.slot = null;
            Destroy(filled);
        }

        canvas                 = null;
        rectTransform          = null;
        iconContainerTransform = null;

        filled = null;
    }
    public void InsertNew(CrewUIIcon crewIcon)
    {
        GameObject crewSlotObj = Instantiate(Game.inst.crewSlotUI_prefab, gameObject.transform);

        CrewUISlot crewSlot = crewSlotObj.GetComponent <CrewUISlot>();

        if (slotsVanish)
        {
            crewSlot.vanish_empty = slotsVanish;
        }

        crewIcon.InsertInto(crewSlot);
        crewIcon.Snap();
    }
    public void OnDrop(PointerEventData eventData)
    {
        if (eventData.pointerDrag == null)
        {
            return;
        }

        CrewUIIcon crewIcon = eventData.pointerDrag.GetComponent <CrewUIIcon>();

        if (crewIcon == null)
        {
            return;
        }

        crewIcon.InsertInto(this);
    }
示例#7
0
    void Start()
    {
        List <string> portrait_names = new List <string>
        {
            "Admiral",
            "Trader",
            "Techpriest",
            "Servitor"
        };

        foreach (string po_name in portrait_names)
        {
            CrewUIIcon crewIcon = Instantiate(Game.inst.crewIconUI_prefab, canvas.transform).GetComponent <CrewUIIcon>();
            crewIcon.SetPortraitName(po_name);
            availableCrew.InsertNew(crewIcon);
        }
    }
    public void OnDrop(PointerEventData eventData)
    {
        if (eventData.pointerDrag == null)
        {
            return;
        }

        CrewUIIcon crewIcon = eventData.pointerDrag.GetComponent <CrewUIIcon>();

        if (crewIcon == null)
        {
            return;
        }

        if (expandable)
        {
            InsertNew(crewIcon);
        }
    }
 public void OnInserted(CrewUIIcon crewIcon)
 {
     filled = crewIcon;
     // iconContainerTransform.gameObject.SetActive(true);
 }