Ejemplo n.º 1
0
 void DropSelectedSlot(WindowUI window, bool controlKeyPressed)
 {
     if (m_selectedSlot != null)
     {
         int        index      = m_selectedSlot.GetSlotIndex();
         int        amount     = m_selectedSlot.GetSlotAmount(controlKeyPressed);
         int        windowId   = m_selectedSlot.GetWindow().GetWindowId();
         WindowType windowType = m_selectedSlot.GetWindow().GetWindowType();
         if (window == null)
         {
             if (windowType.Equals(WindowType.InventoryWindow))
             {
                 m_gameManager.SendDrop(index, amount);
             }
             else if (windowType.Equals(WindowType.CharacterWindow))
             {
                 m_gameManager.SendUse(index);
             }
             else if (IsCombineWindow(windowType))
             {
                 m_gameManager.SendDropFromWindow(windowId, index, amount);
             }
         }
         else
         {
             WindowType newWindowType = window.GetWindowType();
             if (newWindowType.Equals(WindowType.CharacterWindow))
             {
                 if (windowType.Equals(WindowType.InventoryWindow))
                 {
                     m_gameManager.SendUse(index);
                 }
                 else if (windowType.Equals(WindowType.CharacterWindow))
                 {
                     m_gameManager.SendUse(index);
                 }
             }
             else if (newWindowType.Equals(WindowType.DiscardButton))
             {
                 if (windowType.Equals(WindowType.InventoryWindow) || windowType.Equals(WindowType.CharacterWindow))
                 {
                     m_gameManager.SendDiscardItem(index);
                 }
                 else if (windowType.Equals(WindowType.SpellsWindow))
                 {
                     m_gameManager.SendDiscardSpell(index);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
    public void RemoveWindow(int windowId)
    {
        WindowUI window = GetWindowUI(windowId);

        if (window != null)
        {
            if (windowId < 100)
            {
                window.gameObject.SetActive(false);
            }
            else
            {
                WindowType windowType = window.GetWindowType();
                m_state.RemoveWindow(windowId, windowType, window);
                Destroy(window.gameObject);
            }
        }
    }
Ejemplo n.º 3
0
    Vector3 GetWindowPosition(WindowUI window)
    {
        Vector3       position    = Vector3.zero;
        WindowType    windowType  = window.GetWindowType();
        BoxCollider2D collider    = window.GetComponent <BoxCollider2D>();
        Vector3       sizeOffset  = new Vector3(-collider.size.x / 2, (collider.size.y / 2) + 2f, 0);
        int           windowCount = GetWindowTypeCount(windowType);

        sizeOffset += new Vector3(NEW_WINDOW_OFFSET * (windowCount % 12), -NEW_WINDOW_OFFSET * ((windowCount % 12) + Mathf.Floor(windowCount / 12)), 0);
        switch (windowType)
        {
        case WindowType.OptionsBar:
            position = new Vector3(7.21875f, -5.875f - 0.75f, 0);
            break;

        case WindowType.InventoryWindow:
            position = new Vector3(7.03125f, 5.5f, 0);
            break;

        case WindowType.SpellsWindow:
            position = new Vector3(-8.21875f, 5.5f, 0);
            break;

        case WindowType.CommandBar:
            position = new Vector3(-5.5f, 7.5f + 0.75f, 0);
            break;

        case WindowType.BuffBar:
            position = new Vector3(-12.21875f, 7.5f + 0.75f, 0);
            break;

        case WindowType.FpsBar:
            position = new Vector3(10.65625f, 7.5f + 0.75f, 0);
            break;

        case WindowType.HealthBar:
            position = new Vector3(9.15625f, -2.75f, 0);
            break;

        case WindowType.ManaBar:
            position = new Vector3(9.15625f, -3.4375f, 0);
            break;

        case WindowType.SpiritBar:
            position = new Vector3(9.15625f, -4.125f, 0);
            break;

        case WindowType.ExperienceBar:
            position = new Vector3(9.15625f, -4.8125f, 0);
            break;

        case WindowType.CharacterWindow:
            position = new Vector3(-5.53125f, 6, 0);
            break;

        case WindowType.ChatWindow:
            position = new Vector3(-12.21875f, -2.5f - 0.75f, 0);
            break;

        case WindowType.VendorWindow:
            position = sizeOffset;
            break;

        case WindowType.PartyWindow:
            position = new Vector3(0.09375f, -1.1875f - 0.75f, 0);
            break;

        case WindowType.Combine2:
            position = sizeOffset;
            break;

        case WindowType.Combine4:
            position = sizeOffset;
            break;

        case WindowType.Combine6:
            position = sizeOffset;
            break;

        case WindowType.Combine8:
            position = sizeOffset;
            break;

        case WindowType.Combine10:
            position = sizeOffset;
            break;

        case WindowType.QuestWindow:
            position = sizeOffset;
            break;

        case WindowType.LargeQuestWindow:
            position = sizeOffset;
            break;

        case WindowType.TextWindow:
            position = sizeOffset;
            break;

        case WindowType.DiscardButton:
            position = new Vector3(4.65625f, -5.71875f - 0.75f, 0);
            break;

        case WindowType.LetterWindow:
            position = sizeOffset;
            break;

        case WindowType.TradeWindow:
            position = sizeOffset;
            break;
        }
        return(position);
    }