예제 #1
0
    /// <summary> Adds an SSPoint object to the list of selected SS.
    /// Updates the UI text element showing the number of selected SS.
    /// Shows info when trying to select more SS than allowed.
    /// Called when clicking on a valid SS. </summary>
    /// <param name="sSPoint">The clicked SSPoint object that should be added to the list.</param>
    /// <returns>True only if the selected SSPoint has been added to the list.</returns>
    internal bool SelectSS(SSPoint sSPoint)
    {
        bool success = false;

        for (int i = 0; i < selectedSSPoints.Length; i++)
        {
            if (selectedSSPoints[i] == null)
            {   // found an empty spot; select this SS
                selectedSSPoints[i] = sSPoint;
                success             = true;
                break;
            }
        }

        UIManager uim = this.GetComponent <UIManager>(); // used for updating the UI

        if (!success)
        {   // inform the player that max allowed ss have been selected
            uim.FlashXAtTouch(0.8f);
            uim.FlashMaxSSSelected(1.5f);
        }

        // update the UI
        int selectedSSCount = GetSelectedSSCount();

        uim.UpdateSelectedSSCount(selectedSSCount);
        // if all SS have been selected, show the "done" button
        uim.SetEnabledButtonBottomCenterDonePicking(selectedSSCount >= numberOfLymphNodes);

        return(success);
    }
예제 #2
0
    internal void DeselectSS(SSPoint sSPoint)
    {
        for (int i = 0; i < selectedSSPoints.Length; i++)
        {
            if (selectedSSPoints[i] != null && selectedSSPoints[i].Equals(sSPoint))
            {   // found the provided SSPoint object; deselect this SS
                selectedSSPoints[i] = null;
                break;
            }
        }

        // update the UI
        UIManager uim             = this.GetComponent <UIManager>(); // used for updating the UI
        int       selectedSSCount = GetSelectedSSCount();

        uim.UpdateSelectedSSCount(selectedSSCount);
        // if the number of select SS is less than the required number, hide the "done" button
        // this is a little redundant, but is kept here as an additional safeguard
        uim.SetEnabledButtonBottomCenterDonePicking(selectedSSCount >= numberOfLymphNodes);
    }