Beispiel #1
0
        public void GetActiveInterfaceObjects(List <FrontiersInterface.Widget> currentObjects, int flag)
        {
            if (flag < 0)
            {
                flag = GUIEditorID;
            }

            FrontiersInterface.Widget w = new FrontiersInterface.Widget(flag);
            w.SearchCamera = NGUICamera;
            for (int i = 0; i < Buttons.Count; i++)
            {
                if (!Buttons[i].Disabled && Buttons [i].gameObject.layer != Globals.LayerNumGUIRaycastIgnore)
                {
                    w.BoxCollider = Buttons[i].Collider;
                    currentObjects.Add(w);
                }
            }
            for (int i = 0; i < Pages.Count; i++)
            {
                if (Pages[i].Selected)
                {
                    Pages[i].GetActiveInterfaceObjects(currentObjects, flag);
                }
            }
            for (int i = 0; i < SubTabs.Count; i++)
            {
                if (SubTabs[i].Visible)
                {
                    SubTabs[i].GetActiveInterfaceObjects(currentObjects, flag);
                }
            }
        }
Beispiel #2
0
        protected bool FindSearchOriginAndCamera(bool autoSetFirstObject)
        {
            if (GUIManager.Get.HasActiveInterface && GUIManager.Get.TopInterface.SupportsControllerSearch)
            {
                SearchCamera = GUIManager.Get.ActiveCamera;
                if (CurrentActiveInterface == null || CurrentActiveInterface != GUIManager.Get.TopInterface)
                {
                    //if this interface isn't the same as the top interface
                    //start over from the top right
                    FrontiersInterface lastInterface = CurrentActiveInterface;
                    CurrentActiveInterface = GUIManager.Get.TopInterface;
                    if (lastInterface != CurrentActiveInterface && autoSetFirstObject)
                    {
                        //get the first interface element
                        FrontiersInterface.Widget w = CurrentActiveInterface.FirstInterfaceObject;
                        if (!w.IsEmpty && w.BoxCollider != CurrentSearch.Widget.BoxCollider)
                        {
                            SelectWidget(w);
                            return(false);
                        }
                    }
                    CurrentSearch.Widget       = CurrentActiveInterface.FirstInterfaceObject;
                    CurrentSearch.ScreenBounds = new Bounds(ScreenSearchOrigin, Vector3.one * 0.1f);
                }
            }
            else if (Cutscene.IsActive && Cutscene.CurrentCutscene.HasActiveInterfaces)
            {
                SearchCamera = Cutscene.CurrentCutscene.ActiveCamera;
            }
            else if (VRManager.VRMode && GUIManager.ShowCursor)
            {
                SearchCamera = VRManager.Get.NGUICamera;
            }
            else
            {
                SearchCamera = null;
                return(false);
            }

            ScreenSearchOrigin   = Frontiers.InterfaceActionManager.MousePosition;          //Input.mousePosition;
            ScreenSearchOrigin.z = 0f;
            WorldSearchOrigin    = SearchCamera.ScreenToWorldPoint(ScreenSearchOrigin);

            if (UICamera.hoveredObject != null && (CurrentSearch.Widget.IsEmpty || CurrentSearch.Widget.BoxCollider.gameObject != UICamera.hoveredObject.gameObject))
            {
                WidgetSearch s = new WidgetSearch();
                s.Widget.BoxCollider  = UICamera.hoveredObject.GetComponent <Collider> ();
                s.Widget.SearchCamera = GUIManager.Get.ActiveCamera;
                SetCurrentSearch(s);
            }

            if (CurrentSearch.Widget.IsEmpty)
            {
                CurrentSearch.ScreenBounds = new Bounds(ScreenSearchOrigin, Vector3.one * 0.1f);
            }

            RefreshScreenSettings();

            return(true);
        }
Beispiel #3
0
        public override void GetActiveInterfaceObjects(List <FrontiersInterface.Widget> currentObjects, int flag)
        {
            if (QuickCreateMode)
            {
                return;
            }

            if (flag < 0)
            {
                flag = GUIEditorID;
            }

            FrontiersInterface.Widget w = new FrontiersInterface.Widget(flag);

            if (WaitingForNextPage)
            {
                FrontiersInterface.GetActiveInterfaceObjectsInTransform(NextPageGroup.transform, NGUICamera, currentObjects, flag);
            }
            else if (CurrentChooser != null)
            {
                FrontiersInterface.GetActiveInterfaceObjectsInTransform(CurrentChooser.transform, NGUICamera, currentObjects, flag);
                if (LastChoiceMade == "Age")
                {
                    w.SearchCamera = NGUICamera;
                    w.BoxCollider  = AgeSlider.foreground.GetComponent <BoxCollider>();
                    currentObjects.Add(w);
                }
            }

            w.Flag         = QuickCharacterCreationID;
            w.SearchCamera = NGUICamera;
            w.BoxCollider  = QuickCreateButton.GetComponent <BoxCollider>();
            currentObjects.Add(w);
        }
        public override bool Maximize()
        {
            if (base.Maximize())
            {
                CloseButton.gameObject.SetActive(true);
                ContainerDisplayParentTransform.gameObject.SetActive(true);
                StackContainerInterfaceTransform.gameObject.SetActive(true);
                InventoryTabs.Show();

                CraftingInterface.ClearCrafting();
                //if we had a container open, clear it
                StackContainerInterface.ClearContainer();
                QuickslotsDisplay.EnableColliders(true);
                InventoryTabsAnchor.relativeOffset = Vector2.zero;
                GUIManager.Get.NGUIMessageDisplay.HideImmediately();
                for (int i = 0; i < StackContainerDisplays.Count; i++)
                {
                    StackContainerDisplays[i].Show();
                }
                FrontiersInterface.Widget w = FirstInterfaceObject;
                GUICursor.Get.SelectWidget(w);
                mFollowWidgetFlag = w.Flag;
                return(true);
            }
            return(false);
        }
Beispiel #5
0
 public void WaitForNextPage()
 {
     //TargetPosition = ChooserOpenPosition;
     NextPageButton.SendMessage("SetEnabled");
     WaitingForNextPage = true;
     //force the cursor to attach to the next page widget
     FrontiersInterface.Widget w = new FrontiersInterface.Widget(GUIEditorID);
     w.SearchCamera = NGUICamera;
     w.BoxCollider  = NextPageButton.GetComponent <BoxCollider>();
     GUICursor.Get.SelectWidget(w);
 }
Beispiel #6
0
 public WidgetSearch(FrontiersInterface.Widget w)
 {
     Widget         = w;
     ScreenBounds   = gEmptyBounds;
     WorldBounds    = gEmptyBounds;
     PrimaryOverlap = 0f;
     PrimaryAxis    = 0;
     SecondaryAxis  = 0;
     Distance       = 0;
     Dot            = 0;
     FinalScore     = Mathf.NegativeInfinity;
 }
Beispiel #7
0
        protected void SetCurrentSearch(WidgetSearch newSearch)
        {
            WidgetSelectedRecently = true;
            PreviousSearch         = CurrentSearch;
            CurrentSearch          = newSearch;
            LastSearchDirection    = CurrentWidgetBounds.center - ScreenSearchOrigin;

            //if the search has an attached scroll bar
            //that means we need to move the scroll bar until the cursor is within the browser bounds
            if (CurrentSearch.Widget.IsBrowserObject)
            {
                //if we're moving to another widget in the same browser object, just go to the next one
                if (PreviousSearch.Widget.IsBrowserObject &&
                    PreviousSearch.Widget.BrowserObject != CurrentSearch.Widget.BrowserObject &&
                    (PreviousSearch.Widget.BrowserObject.ParentBrowser == CurrentSearch.Widget.BrowserObject.ParentBrowser))
                {
                    LastBrowserBounds = CurrentSearch.Widget.BrowserObject.ParentBrowser.FocusOn(CurrentSearch.Widget.BrowserObject);
                }
                else
                {
                    //if our last widget was not a browser object, get the first available
                    //if the first available is on-screen, use that
                    FrontiersInterface.Widget w = CurrentSearch.Widget.BrowserObject.ParentBrowser.FirstInterfaceObject;
                    if (!w.IsEmpty && w.IsBrowserObject && CurrentSearch.Widget.BrowserObject.ParentBrowser.IsBrowserObjectVisible(w.BrowserObject, 1.0f, out LastBrowserBounds))
                    {
                        CurrentSearch.Widget = w;
                        LastBrowserBounds    = CurrentSearch.Widget.BrowserObject.ParentBrowser.FocusOn(CurrentSearch.Widget.BrowserObject);
                    }
                    //in either case, focus on the result
                    LastBrowserBounds = CurrentSearch.Widget.BrowserObject.ParentBrowser.FocusOn(CurrentSearch.Widget.BrowserObject);
                }
            }
            //recalculate the widget screen bounds just in case we moved it
            CurrentSearch.WorldBounds = CurrentSearch.Widget.BoxCollider.bounds;
            if (SearchCamera == null)
            {
                SearchCamera = newSearch.Widget.SearchCamera;
            }
            try {
                Vector3 widgetPos = SearchCamera.WorldToScreenPoint(CurrentSearch.WorldBounds.center);
                widgetPos.z = 0f;
                CurrentSearch.ScreenBounds = new Bounds(widgetPos, CurrentSearch.WorldBounds.size);
                CurrentSearch           = CopyMousePositionFromSearch(CurrentSearch, SearchCamera);
                UICamera.selectedObject = CurrentSearch.Widget.BoxCollider.gameObject;
            } catch (Exception e) {
                Debug.Log("Error setting current search: " + e.ToString());
            }
        }
 public void GetActiveInterfaceObjects(List <FrontiersInterface.Widget> currentObjects, int flag)
 {
     FrontiersInterface.Widget w = new FrontiersInterface.Widget(flag);
     for (int i = 0; i < Squares.Count; i++)
     {
         w.BoxCollider  = Squares[i].Collider;
         w.SearchCamera = NGUICamera;
         currentObjects.Add(w);
     }
     for (int i = 0; i < StatButtons.Count; i++)
     {
         w.BoxCollider  = StatButtons[i];
         w.SearchCamera = NGUICamera;
         currentObjects.Add(w);
     }
 }
Beispiel #9
0
 public void GetActiveInterfaceObjects(List <FrontiersInterface.Widget> currentObjects, int flag)
 {
     FrontiersInterface.Widget w = new FrontiersInterface.Widget(flag);
     for (int i = 0; i < InventorySquares.Count; i++)
     {
         if (InventorySquares[i].IsEnabled)
         {
             w.BoxCollider  = InventorySquares[i].Collider;
             w.SearchCamera = NGUICamera;
             currentObjects.Add(w);
         }
     }
     w.BoxCollider  = EnablerDisplay.Collider;
     w.SearchCamera = NGUICamera;
     currentObjects.Add(w);
 }
Beispiel #10
0
        public void SelectWidget(FrontiersInterface.Widget w)
        {
            FollowCurrentWidget = false;

            if (FindSearchOriginAndCamera(false))
            {
                WidgetSearch s = new WidgetSearch(w);
                if (!w.IsEmpty)
                {
                    s.WorldBounds         = w.BoxCollider.bounds;
                    s.ScreenBounds.min    = w.SearchCamera.WorldToScreenPoint(s.WorldBounds.min);
                    s.ScreenBounds.max    = w.SearchCamera.WorldToScreenPoint(s.WorldBounds.max);
                    s.ScreenBounds.center = w.SearchCamera.WorldToScreenPoint(s.WorldBounds.center);
                    SetCurrentSearch(s);
                }
            }
        }
        public void GetActiveInterfaceObjects(List <FrontiersInterface.Widget> currentObjects, int flag)
        {
            if (Visible)
            {
                ContainerDisplay.GetActiveInterfaceObjects(currentObjects, flag);
                FrontiersInterface.Widget w = new FrontiersInterface.Widget(flag);
                w.SearchCamera = NGUICamera;

                if (TakeAllButton != null && TakeContainerButton != null)
                {
                    w.BoxCollider = TakeContainerButton.GetComponent <BoxCollider>();
                    currentObjects.Add(w);

                    w.BoxCollider = TakeAllButton.GetComponent <BoxCollider>();
                    currentObjects.Add(w);
                }

                w.BoxCollider = ShowHideButton.GetComponent <BoxCollider>();
                currentObjects.Add(w);
            }
        }
Beispiel #12
0
        public void GetActiveInterfaceObjects(List <FrontiersInterface.Widget> currentObjects, int flag)
        {
            if (flag < 0)
            {
                flag = GUIEditorID;
            }

            FrontiersInterface.Widget w = new FrontiersInterface.Widget(flag);
            w.SearchCamera = GUILogInterface.Get.NGUICamera;
            w.BoxCollider  = ScrollBar.foreground.GetComponent <BoxCollider>();
            currentObjects.Add(w);
            if (DopplegangerButton.activeSelf)
            {
                w.BoxCollider = DopplegangerButton.GetComponent <BoxCollider>();
                currentObjects.Add(w);
            }
            w.BoxCollider = CloseButton.GetComponent <BoxCollider>();
            currentObjects.Add(w);
            //add this just so we have something to navigate to
            w.BoxCollider = Icon.GetComponent <BoxCollider>();
            currentObjects.Add(w);
        }
Beispiel #13
0
        public static void GetActiveInterfaceObjectsInTransform(Transform startTransform, Camera searchCamera, List <Widget> currentObjects, int flag)
        {
            gGetColliders.Clear();
            startTransform.GetComponentsInChildren <Collider>(gGetColliders);
            FrontiersInterface.Widget w  = new FrontiersInterface.Widget(flag);
            IGUIBrowserObject         bo = null;

            w.SearchCamera = searchCamera;
            for (int j = 0; j < gGetColliders.Count; j++)
            {
                w.BoxCollider = gGetColliders[j];
                if (w.BoxCollider.gameObject.layer == Globals.LayerNumGUIRaycastIgnore || !w.BoxCollider.gameObject.activeSelf)
                {
                    continue;
                }
                w.BrowserObject = null;
                if (w.BoxCollider.CompareTag(Globals.TagBrowserObject))
                {
                    w.BrowserObject = (IGUIBrowserObject)w.BoxCollider.GetComponent(typeof(IGUIBrowserObject));
                    if (w.BrowserObject == null)
                    {
                        w.BrowserObject = (IGUIBrowserObject)w.BoxCollider.transform.parent.GetComponent(typeof(IGUIBrowserObject));
                    }
                }
                else if (w.BoxCollider.CompareTag(Globals.TagIgnoreTab))
                {
                    continue;
                }
                else if (w.BoxCollider.CompareTag(Globals.TagActiveObject))
                {
                    //never use scrollbars
                    if (w.BoxCollider.gameObject.HasComponent <UIScrollBar>() || w.BoxCollider.transform.parent.gameObject.HasComponent <UIScrollBar>())
                    {
                        continue;
                    }
                }
                currentObjects.Add(w);
            }
        }
Beispiel #14
0
 public void GetActiveInterfaceObjects(List <FrontiersInterface.Widget> currentObjects, Camera NGUICamera, int flag)
 {
     FrontiersInterface.Widget w = new FrontiersInterface.Widget(flag);
     w.SearchCamera = NGUICamera;
     w.BoxCollider  = Collider;
     currentObjects.Add(w);
     for (int i = 0; i < Flows.Count; i++)
     {
         if (Flows [i] != null)
         {
             w.BoxCollider = Flows [i].GetComponent <BoxCollider> ();
             currentObjects.Add(w);
         }
     }
     for (int i = 0; i < SymptomDisplays.Count; i++)
     {
         if (SymptomDisplays [i] != null)
         {
             w.BoxCollider = SymptomDisplays [i].GetComponent <BoxCollider> ();
             currentObjects.Add(w);
         }
     }
 }
Beispiel #15
0
        public void Update()
        {
            if (!Cutscene.IsActive)
            {
                return;
            }

            if (MakingChoice || WaitingForNextPage)
            {
                Cutscene.CurrentCutscene.ShowCursor = true;
            }
            else if (GUICursor.Get.LastSelectedWidgetFlag == GUIEditorID)
            {
                Cutscene.CurrentCutscene.ShowCursor = false;
            }

            if (QuickCreateMode)
            {
                ChooserPanel.transform.localPosition     = Vector3.Lerp(ChooserPanel.transform.localPosition, ChooserClosedPosition, (float)(SpeedMultiplier * Frontiers.WorldClock.RTDeltaTime));
                QuickCreatePanel.transform.localPosition = Vector3.Lerp(QuickCreatePanel.transform.localPosition, QuickCreateClosedPosition, (float)(SpeedMultiplier * Frontiers.WorldClock.RTDeltaTime));
            }
            else if (WritingLetter)
            {
                ChooserPanel.transform.localPosition     = Vector3.Lerp(ChooserPanel.transform.localPosition, ChooserOpenPosition, (float)(SpeedMultiplier * Frontiers.WorldClock.RTDeltaTime));
                QuickCreatePanel.transform.localPosition = Vector3.Lerp(QuickCreatePanel.transform.localPosition, QuickCreateOpenPosition, (float)(SpeedMultiplier * Frontiers.WorldClock.RTDeltaTime));

                if (WaitingForNextPage)
                {
                    NextPageGroup.transform.localPosition = Vector3.Lerp(NextPageGroup.transform.localPosition, ChooserOpenPosition, (float)(SpeedMultiplier * Frontiers.WorldClock.RTDeltaTime));
                    IconGroup.transform.localPosition     = Vector3.Lerp(IconGroup.transform.localPosition, ChooserClosedPosition, (float)(SpeedMultiplier * Frontiers.WorldClock.RTDeltaTime));
                    if (CurrentChooser != null)
                    {
                        CurrentChooser.transform.localPosition = Vector3.Lerp(CurrentChooser.transform.localPosition, ChooserClosedPosition, (float)(SpeedMultiplier * Frontiers.WorldClock.RTDeltaTime));
                    }
                }
                else
                {
                    NextPageGroup.transform.localPosition = Vector3.Lerp(NextPageGroup.transform.localPosition, ChooserClosedPosition, (float)(SpeedMultiplier * Frontiers.WorldClock.RTDeltaTime));
                    IconGroup.transform.localPosition     = Vector3.Lerp(IconGroup.transform.localPosition, TargetPosition, (float)(SpeedMultiplier * Frontiers.WorldClock.RTDeltaTime));
                    if (CurrentChooser != null)
                    {
                        CurrentChooser.transform.localPosition = Vector3.Lerp(CurrentChooser.transform.localPosition, TargetPosition, (float)(SpeedMultiplier * Frontiers.WorldClock.RTDeltaTime));
                        if (!SetLastCursorPosition)
                        {
                            //tell the cursor to pick something
                            FrontiersInterface.Widget w = new FrontiersInterface.Widget(GUIEditorID);
                            w.SearchCamera = NGUICamera;
                            //look for the first box collider in the current chooser
                            foreach (Transform child in CurrentChooser.transform)
                            {
                                w.BoxCollider = child.GetComponent <BoxCollider>();
                                if (w.BoxCollider != null)
                                {
                                    break;
                                }
                            }
                            GUICursor.Get.SelectWidget(w);
                            SetLastCursorPosition = true;
                        }
                    }
                }
                                                                #if UNITY_EDITOR
                if (VRManager.VRMode | VRManager.VRTestingMode)
                {
                                                                                #else
                if (VRManager.VRMode)
                {
                                                                                #endif
                    //tell the cursor to follow us if we're selected
                    GUICursor.Get.TryToFollowCurrentWidget(GUIEditorID);
                }
            }
            else
            {
                ChooserPanel.transform.localPosition     = Vector3.Lerp(ChooserPanel.transform.localPosition, ChooserClosedPosition, (float)(SpeedMultiplier * Frontiers.WorldClock.RTDeltaTime));
                QuickCreatePanel.transform.localPosition = Vector3.Lerp(QuickCreatePanel.transform.localPosition, QuickCreateClosedPosition, (float)(SpeedMultiplier * Frontiers.WorldClock.RTDeltaTime));
            }

                                                #if UNITY_EDITOR
            if (VRManager.VRMode | VRManager.VRTestingMode)
            {
                                                #else
            if (VRManager.VRMode)
            {
                                                #endif
                ShadowObject.SetActive(false);
            }
            else
            {
                ShadowObject.SetActive(true);
                ShadowObject.transform.localPosition = Vector3.Lerp(ShadowObject.transform.localPosition, ShadowTargetPosition, (float)(SpeedMultiplier * Frontiers.WorldClock.RTDeltaTime));
            }
        }
Beispiel #16
0
        public void OpenChooser(string request)
        {
            if (MakingChoice)
            {
                return;
            }

            SetLastCursorPosition = false;

            EyeColorChooser.transform.localPosition   = ChooserClosedPosition;
            GenderChooser.transform.localPosition     = ChooserClosedPosition;
            EthnicityChooser.transform.localPosition  = ChooserClosedPosition;
            HairColorChooser.transform.localPosition  = ChooserClosedPosition;
            HairLengthChooser.transform.localPosition = ChooserClosedPosition;
            AgeChooser.transform.localPosition        = ChooserClosedPosition;
            NameChooser.transform.localPosition       = ChooserClosedPosition;

            MakingChoice        = true;
            LastChoiceConfirmed = false;
            LastRequestMade     = request;

            NameChooserInput.selected = false;
            UIInput.current           = null;

            switch (LastRequestMade)
            {
            case "EyeColor":
                CurrentChooser = EyeColorChooser;
                break;

            case "Gender":
                CurrentChooser = GenderChooser;
                break;

            case "Ethnicity":
                CurrentChooser = EthnicityChooser;
                break;

            case "HairColor":
                CurrentChooser = HairColorChooser;
                break;

            case "Age":
                CurrentChooser = AgeChooser;
                break;

            case "HairLength":
                CurrentChooser = HairLengthChooser;
                break;

            case "Name":
            default:
                CurrentChooser            = NameChooser;
                NameChooserInput.selected = true;
                UIInput.current           = NameChooserInput;
                FrontiersInterface.Widget w = new FrontiersInterface.Widget();
                w.SearchCamera = NGUICamera;
                w.BoxCollider  = NameChooserInput.GetComponent <BoxCollider>();
                GUICursor.Get.SelectWidget(w);
                break;
            }

            CurrentChooser.transform.localPosition = ChooserClosedPosition;
            TargetPosition = ChooserOpenPosition;
        }
Beispiel #17
0
        protected void DumbSearch(SearchDirection direction)
        {
            if (mDoingSearch)
            {
                return;
            }

            mDoingSearch = true;

            CurrentObjects.Clear();
            //if the cutscene is active, see if there are any cutscene interfaces
            if (Cutscene.IsActive)
            {
                Cutscene.GetActiveInterfaceObjects(CurrentObjects, -1);
            }
            if (VRManager.VRMode && GUIManager.ShowCursor)
            {
                VRManager.Get.GetActiveInterfaceObjects(CurrentObjects, -1);
            }

            CurrentSearches.Clear();
            LastDirection = direction;
            FrontiersInterface.Widget nextObject = new FrontiersInterface.Widget(-1);
            WidgetSearch search;
            Bounds       checkWidgetBounds  = new Bounds();
            Vector3      widgetScreenPos    = Vector3.zero;
            Vector3      widgetWorldPos     = Vector3.zero;
            Vector3      widgetDir          = Vector3.zero;
            Vector3      primaryMax         = SearchCamera.WorldToScreenPoint(CurrentSearch.WorldBounds.max);
            Vector3      primaryMin         = SearchCamera.WorldToScreenPoint(CurrentSearch.WorldBounds.min);
            Vector3      searchMin          = Vector3.zero;
            Vector3      searchMax          = Vector3.zero;
            float        primaryAxis        = 0;
            float        secondaryAxis      = 0;
            float        currentSize        = 0f;
            float        searchSize         = 0f;
            float        smallestProportion = 0f;

            switch (direction)
            {
            default:
            case SearchDirection.Up:
            case SearchDirection.Down:
                primaryAxis   = CurrentSearch.ScreenBounds.center.y;
                secondaryAxis = CurrentSearch.ScreenBounds.center.x;
                currentSize   = primaryMax.x - primaryMin.x;
                break;

            case SearchDirection.Left:
            case SearchDirection.Right:
                primaryAxis   = CurrentSearch.ScreenBounds.center.x;
                secondaryAxis = CurrentSearch.ScreenBounds.center.y;
                currentSize   = primaryMax.y - primaryMin.y;
                break;
            }
            if (CurrentActiveInterface != null)
            {
                CurrentActiveInterface.GetActiveInterfaceObjects(CurrentObjects, -1);
                if (CurrentActiveInterface.Type == InterfaceType.Primary)
                {
                    //hacky thing - get the player status
                    GUIPlayerStatusInterface.Get.GetActiveInterfaceObjects(CurrentObjects, -1);
                }
            }

            for (int i = CurrentObjects.LastIndex(); i >= 0; i--)
            {
                nextObject = CurrentObjects [i];
                if (nextObject.BoxCollider == CurrentSearch.Widget.BoxCollider || nextObject.BoxCollider == null || !nextObject.BoxCollider.enabled)
                {
                    //remove 'dead' objects so we don't have to worry about last-minute search being valid
                    CurrentObjects.RemoveAt(i);
                }
            }

            for (int i = 0; i < CurrentObjects.Count; i++)
            {
                nextObject      = CurrentObjects [i];
                widgetWorldPos  = nextObject.BoxCollider.bounds.center;
                widgetScreenPos = SearchCamera.WorldToScreenPoint(widgetWorldPos);
                if (IsOffScreen(widgetScreenPos))
                {
                    continue;
                }
                //get our search info from the object
                search                     = new WidgetSearch(nextObject);
                search.WorldBounds         = search.Widget.BoxCollider.bounds;
                widgetScreenPos.z          = 0f;
                widgetDir                  = (widgetScreenPos - ScreenSearchOrigin).normalized;
                searchMin                  = SearchCamera.WorldToScreenPoint(search.WorldBounds.min);
                searchMax                  = SearchCamera.WorldToScreenPoint(search.WorldBounds.max);
                search.ScreenBounds.min    = searchMin;
                search.ScreenBounds.max    = searchMax;
                search.ScreenBounds.center = widgetScreenPos;

                switch (direction)
                {
                default:
                case SearchDirection.Up:
                    search.PrimaryAxis = Mathf.Clamp(widgetScreenPos.y - primaryAxis, 0, WidgetSearch.gMaxPrimaryAxis);
                    if (search.PrimaryAxis <= 0)
                    {
                        break;
                    }
                    search.Dot           = Vector3.Dot(Vector3.up, widgetDir) * WidgetSearch.gMaxDot;
                    searchSize           = searchMax.x - searchMin.x;
                    search.SecondaryAxis = widgetScreenPos.x;
                    if (search.SecondaryAxis < secondaryAxis)
                    {
                        search.SecondaryAxis = Mathf.Clamp(secondaryAxis - search.SecondaryAxis, 0, WidgetSearch.gMaxSecondaryAxis);
                    }
                    else
                    {
                        search.SecondaryAxis = Mathf.Clamp(search.SecondaryAxis - secondaryAxis, 0, WidgetSearch.gMaxSecondaryAxis);
                    }
                    if (primaryMax.x < searchMin.x || searchMax.x < primaryMin.x)
                    {
                        search.PrimaryOverlap = 0;
                    }
                    else
                    {
                        if (searchSize < currentSize)
                        {
                            smallestProportion = searchSize / currentSize;
                        }
                        else
                        {
                            smallestProportion = currentSize / searchSize;
                        }
                        search.PrimaryOverlap = (Mathf.Clamp(primaryMax.x - searchMin.x, 0, searchSize) / searchSize) * smallestProportion;
                    }
                    search.Distance   = Mathf.Clamp(Vector3.Distance(widgetScreenPos, ScreenSearchOrigin), 0, WidgetSearch.gMaxDist);
                    search.FinalScore = WidgetSearch.CalculateScore(search);
                    CurrentSearches.Add(search);
                    break;

                case SearchDirection.Down:
                    search.PrimaryAxis = Mathf.Clamp(primaryAxis - widgetScreenPos.y, 0, WidgetSearch.gMaxPrimaryAxis);
                    if (search.PrimaryAxis <= 0)
                    {
                        break;
                    }
                    search.Dot           = Vector3.Dot(Vector3.down, widgetDir) * WidgetSearch.gMaxDot;
                    searchSize           = searchMax.x - searchMin.x;
                    search.SecondaryAxis = widgetScreenPos.x;
                    if (search.SecondaryAxis < secondaryAxis)
                    {
                        search.SecondaryAxis = Mathf.Clamp(secondaryAxis - search.SecondaryAxis, 0, WidgetSearch.gMaxSecondaryAxis);
                    }
                    else
                    {
                        search.SecondaryAxis = Mathf.Clamp(search.SecondaryAxis - secondaryAxis, 0, WidgetSearch.gMaxSecondaryAxis);
                    }
                    if (primaryMax.x < searchMin.x || searchMax.x < primaryMin.x)
                    {
                        search.PrimaryOverlap = 0;
                    }
                    else
                    {
                        if (searchSize < currentSize)
                        {
                            smallestProportion = searchSize / currentSize;
                        }
                        else
                        {
                            smallestProportion = currentSize / searchSize;
                        }
                        search.PrimaryOverlap = (Mathf.Clamp(primaryMax.x - searchMin.x, 0, searchSize) / searchSize) * smallestProportion;
                    }
                    search.Distance   = Mathf.Clamp(Vector3.Distance(widgetScreenPos, ScreenSearchOrigin), 0, WidgetSearch.gMaxDist);
                    search.FinalScore = WidgetSearch.CalculateScore(search);
                    CurrentSearches.Add(search);
                    break;

                case SearchDirection.Left:
                    search.PrimaryAxis = Mathf.Clamp(primaryAxis - widgetScreenPos.x, 0, WidgetSearch.gMaxPrimaryAxis);
                    if (search.PrimaryAxis <= 0)
                    {
                        break;
                    }
                    search.Dot           = Vector3.Dot(Vector3.left, widgetDir) * WidgetSearch.gMaxDot;
                    searchSize           = searchMax.y - searchMin.y;
                    search.SecondaryAxis = widgetScreenPos.y;
                    if (search.SecondaryAxis < secondaryAxis)
                    {
                        search.SecondaryAxis = Mathf.Clamp(secondaryAxis - search.SecondaryAxis, 0, WidgetSearch.gMaxSecondaryAxis);
                    }
                    else
                    {
                        search.SecondaryAxis = Mathf.Clamp(search.SecondaryAxis - secondaryAxis, 0, WidgetSearch.gMaxSecondaryAxis);
                    }
                    if (primaryMax.y < searchMin.y || searchMax.y < primaryMin.y)
                    {
                        search.PrimaryOverlap = 0;
                    }
                    else
                    {
                        if (searchSize < currentSize)
                        {
                            smallestProportion = searchSize / currentSize;
                        }
                        else
                        {
                            smallestProportion = currentSize / searchSize;
                        }
                        search.PrimaryOverlap = (Mathf.Clamp(primaryMax.y - searchMin.y, 0, searchSize) / searchSize) * smallestProportion;
                    }
                    search.Distance   = Mathf.Clamp(Vector3.Distance(widgetScreenPos, ScreenSearchOrigin), 0, WidgetSearch.gMaxDist);
                    search.FinalScore = WidgetSearch.CalculateScore(search);
                    CurrentSearches.Add(search);
                    break;

                case SearchDirection.Right:
                    search.PrimaryAxis = Mathf.Clamp(widgetScreenPos.x - primaryAxis, 0, WidgetSearch.gMaxPrimaryAxis);
                    if (search.PrimaryAxis <= 0)
                    {
                        break;
                    }
                    search.Dot           = Vector3.Dot(Vector3.right, widgetDir) * WidgetSearch.gMaxDot;
                    searchSize           = searchMax.y - searchMin.y;
                    search.SecondaryAxis = widgetScreenPos.y;
                    if (search.SecondaryAxis < secondaryAxis)
                    {
                        search.SecondaryAxis = Mathf.Clamp(secondaryAxis - search.SecondaryAxis, 0, WidgetSearch.gMaxSecondaryAxis);
                    }
                    else
                    {
                        search.SecondaryAxis = Mathf.Clamp(search.SecondaryAxis - secondaryAxis, 0, WidgetSearch.gMaxSecondaryAxis);
                    }
                    if (primaryMax.y < searchMin.y || searchMax.y < primaryMin.y)
                    {
                        search.PrimaryOverlap = 0;
                    }
                    else
                    {
                        //overlap is a normalized percentage of overlap multiplied by the proportion of one button size to the other
                        if (searchSize < currentSize)
                        {
                            smallestProportion = searchSize / currentSize;
                        }
                        else
                        {
                            smallestProportion = currentSize / searchSize;
                        }
                        search.PrimaryOverlap = (Mathf.Clamp(primaryMax.y - searchMin.y, 0, searchSize) / searchSize) * smallestProportion;
                    }
                    search.Distance   = Mathf.Clamp(Vector3.Distance(widgetScreenPos, ScreenSearchOrigin), 0, WidgetSearch.gMaxDist);
                    search.FinalScore = WidgetSearch.CalculateScore(search);
                    CurrentSearches.Add(search);
                    break;
                }
            }
            //this will sort them so we can pick the best one
            //best one is at 0, worse one is last
            //we keep the rest for debugging purposes
            CurrentSearches.Sort();
            if (CurrentSearches.Count == 0 && CurrentObjects.Count > 0)
            {
                //just pick the first one
                search              = new WidgetSearch(CurrentObjects [0]);
                search.Widget       = CurrentObjects [0];
                search.WorldBounds  = search.Widget.BoxCollider.bounds;
                search.ScreenBounds = new Bounds(search.Widget.SearchCamera.WorldToScreenPoint(search.WorldBounds.center), Vector3.one);
                CurrentSearches.Add(search);
            }
            mDoingSearch = false;
        }