Example #1
0
        public static List <WorldObject> WorldObjectsUnderMouse(Vector2 mousePos)
        {
            List <WorldObject> list = new List <WorldObject>();

            ExpandableWorldObjectsUtility.GetExpandedWorldObjectUnderMouse(mousePos, list);
            float caravanDirectClickRadius = GenWorldUI.CaravanDirectClickRadius;

            GenWorldUI.clickedCaravans.Clear();
            List <Caravan> caravans = Find.WorldObjects.Caravans;

            for (int i = 0; i < caravans.Count; i++)
            {
                Caravan caravan = caravans[i];
                if (caravan.DistanceToMouse(mousePos) < caravanDirectClickRadius)
                {
                    GenWorldUI.clickedCaravans.Add(caravan);
                }
            }
            GenWorldUI.clickedCaravans.SortBy((Caravan x) => x.DistanceToMouse(mousePos));
            for (int j = 0; j < GenWorldUI.clickedCaravans.Count; j++)
            {
                if (!list.Contains(GenWorldUI.clickedCaravans[j]))
                {
                    list.Add(GenWorldUI.clickedCaravans[j]);
                }
            }
            float dynamicallyDrawnObjectDirectClickRadius = GenWorldUI.DynamicallyDrawnObjectDirectClickRadius;

            GenWorldUI.clickedDynamicallyDrawnObjects.Clear();
            List <WorldObject> allWorldObjects = Find.WorldObjects.AllWorldObjects;

            for (int k = 0; k < allWorldObjects.Count; k++)
            {
                WorldObject worldObject = allWorldObjects[k];
                if (worldObject.def.useDynamicDrawer && worldObject.DistanceToMouse(mousePos) < dynamicallyDrawnObjectDirectClickRadius)
                {
                    GenWorldUI.clickedDynamicallyDrawnObjects.Add(worldObject);
                }
            }
            GenWorldUI.clickedDynamicallyDrawnObjects.SortBy((WorldObject x) => x.DistanceToMouse(mousePos));
            for (int l = 0; l < GenWorldUI.clickedDynamicallyDrawnObjects.Count; l++)
            {
                if (!list.Contains(GenWorldUI.clickedDynamicallyDrawnObjects[l]))
                {
                    list.Add(GenWorldUI.clickedDynamicallyDrawnObjects[l]);
                }
            }
            int num = GenWorld.TileAt(mousePos, false);
            List <WorldObject> allWorldObjects2 = Find.WorldObjects.AllWorldObjects;

            for (int m = 0; m < allWorldObjects2.Count; m++)
            {
                if (allWorldObjects2[m].Tile == num && !list.Contains(allWorldObjects2[m]))
                {
                    list.Add(allWorldObjects2[m]);
                }
            }
            float caravanWideClickRadius = GenWorldUI.CaravanWideClickRadius;

            GenWorldUI.clickedCaravans.Clear();
            List <Caravan> caravans2 = Find.WorldObjects.Caravans;

            for (int n = 0; n < caravans2.Count; n++)
            {
                Caravan caravan2 = caravans2[n];
                if (caravan2.DistanceToMouse(mousePos) < caravanWideClickRadius)
                {
                    GenWorldUI.clickedCaravans.Add(caravan2);
                }
            }
            GenWorldUI.clickedCaravans.SortBy((Caravan x) => x.DistanceToMouse(mousePos));
            for (int num2 = 0; num2 < GenWorldUI.clickedCaravans.Count; num2++)
            {
                if (!list.Contains(GenWorldUI.clickedCaravans[num2]))
                {
                    list.Add(GenWorldUI.clickedCaravans[num2]);
                }
            }
            GenWorldUI.clickedCaravans.Clear();
            return(list);
        }
 internal float <> m__2(Caravan x)
 {
     return(x.DistanceToMouse(this.mousePos));
 }