Ejemplo n.º 1
0
    public void init(int transfers, bool resetPos = true)
    {
        m_OtherMenu = m_propMenus [1];
        foreach (PropertyMenu pm in m_propMenus)
        {
            foreach (GameObject go in pm.propertyButtons)
            {
                if (CanSelectProperty(go.GetComponent <ButtonProperty>().SelectedProperty, m_OtherMenu))
                {
                    go.GetComponent <Image> ().color = m_normalColor;
                }
                else
                {
                    go.GetComponent <Image> ().color = m_deactiveColor;
                }
            }
            m_OtherMenu = m_propMenus [0];
        }
        if (resetPos)
        {
            m_listSelected = 0;
            m_propSelected = 0;
        }
        m_CurrentMenu = m_propMenus [m_listSelected];
        int otherMenu = (int)((m_listSelected + 1) % 2);

        m_OtherMenu    = m_propMenus [otherMenu];
        m_propSelected = Mathf.Min(m_CurrentMenu.NumProps() - 1, m_propSelected);
        if (m_propSelected < 0)
        {
            SwapLists();
            m_propSelected = 0;
            m_propSelected = Mathf.Min(m_CurrentMenu.NumProps() - 1, m_propSelected);
        }
        if (m_propSelected < 0)
        {
            m_infoText.text = "No Properties Available";
            exit_time       = 1.0f;
            ExitMenu();
            return;
        }
        m_timeSinceExit      = 0.0f;
        m_transfersRemaining = transfers;
        //m_remainingText.text = "Transfers Remaining: \n" + transfers.ToString ();
        m_selectedButton = m_CurrentMenu.propertyButtons [m_propSelected];
        HighlightKey(m_selectedButton);
        PauseGame.SlowToPause();
        PauseGame.CanPause   = false;
        starting             = true;
        m_active             = true;
        m_remainingText.text = "";
        m_reminderText.text  = "Use Movement Keys to Highlight \n" + "Press " + TextboxManager.GetKeyString("Cancel") + " to Exit Menu";
    }
Ejemplo n.º 2
0
    bool CanSelectProperty(Property p, PropertyMenu other)
    {
        if (m_CurrentMenu.holder.HasProperty("NanoLock"))
        {
            return(false);
        }
        if (m_OtherMenu.holder.HasProperty("NanoShield"))
        {
            return(false);
        }
        if (!p.Stealable)
        {
            return(false);
        }
        if (other.NumProps() >= other.MaxSlots)
        {
            return(false);
        }
        string pName = p.PropertyName;

        if (other.holder.HasProperty(pName) && !p.Stackable)
        {
            return(false);
        }
        return(true);
    }
Ejemplo n.º 3
0
    void SelectProperty(int xInput, int yInput)
    {
        if (m_selectedButton != null)
        {
            if (CanSelectProperty(m_selectedButton.GetComponent <ButtonProperty>().SelectedProperty, m_OtherMenu))
            {
                m_selectedButton.GetComponent <Image> ().color = m_normalColor;
            }
            else
            {
                m_selectedButton.GetComponent <Image> ().color = m_deactiveColor;
            }
        }
        if (m_currentGhost != null)
        {
            Destroy(m_currentGhost);
        }

        if (xInput == -1 && m_listSelected == 1)
        {
            if (m_propMenus[0].NumProps() > 0)
            {
                m_propSelected = Mathf.Min(m_propMenus[0].NumProps() - 1, m_propSelected);
                SwapLists();
            }
        }
        else if (xInput == 1 && m_listSelected == 0)
        {
            if (m_propMenus[1].NumProps() > 0)
            {
                m_propSelected = Mathf.Min(m_propMenus[1].NumProps() - 1, m_propSelected);
                SwapLists();
            }
        }

        if (yInput == -1 && m_propSelected > 0)
        {
            m_propSelected -= 1;
        }
        else if (yInput == 1 && m_propSelected < (m_CurrentMenu.NumProps() - 1))
        {
            m_propSelected += 1;
        }
        HighlightKey(m_CurrentMenu.propertyButtons[m_propSelected]);
    }
Ejemplo n.º 4
0
    void HighlightKey(GameObject button)
    {
        m_selectedButton = button;
        Property p = button.GetComponent <ButtonProperty> ().SelectedProperty;

        if (CanSelectProperty(p, m_OtherMenu))
        {
            m_selectedButton.GetComponent <Image> ().color = m_highLightedColor;
        }
        else
        {
            m_selectedButton.GetComponent <Image> ().color = m_highlightDeactiveColor;
        }
        if (!p.Stealable)
        {
            m_centerImage.sprite = XImage;
            m_infoText.text      = "CANNOT TRANSFER! This property cannot be transferred";
            return;
        }
        if (m_CurrentMenu.holder.HasProperty("NanoLock"))
        {
            m_infoText.text = "CANNOT TRANSFER! This item is NanoLocked";
            return;
        }
        else if (m_OtherMenu.holder.HasProperty("NanoShield"))
        {
            m_infoText.text = "CANNOT TRANSFER! Target is NanoShielded";
            return;
        }
        if (m_OtherMenu.NumProps() >= m_OtherMenu.MaxSlots)
        {
            m_centerImage.sprite = XImage;
            if (m_listSelected == 1)
            {
                m_infoText.text = "CANNOT TRANSFER! You have no free slots";
            }
            else
            {
                m_infoText.text = "CANNOT TRANSFER! Transfer Target has no free slots";
            }
            return;
        }

        string pName = p.PropertyName;

        //Debug.Log (pName + " : " + m_OtherMenu.holderName + " : " + m_OtherMenu.holder.HasProperty(pName));
        if (m_OtherMenu.holder.HasProperty(pName) && !p.Stackable)
        {
            m_centerImage.sprite = XImage;
            if (m_listSelected == 1)
            {
                m_infoText.text = "CANNOT TRANSFER! You already have this property";
            }
            else
            {
                m_infoText.text = "CANNOT TRANSFER! Transfer Target already has this property";
            }
            return;
        }

        if (m_listSelected == 0)
        {
            m_centerImage.sprite = ArrowRight;
            m_infoText.text      = "Press 'Enter' to implant " + pName;
            AddGhostProperty(m_propMenus[1].MenuPrefab, p);
        }
        else
        {
            m_centerImage.sprite = ArrowLeft;
            m_infoText.text      = "Press 'Enter' to steal " + pName;
            AddGhostProperty(m_propMenus[0].MenuPrefab, p);
        }
    }