public static IEnumerable <WorldObject> MultiSelectableWorldObjectsInScreenRectDistinct(Rect rect) { List <WorldObject> allObjects = Find.WorldObjects.AllWorldObjects; int i = 0; while (true) { if (i < allObjects.Count) { if (!allObjects[i].NeverMultiSelect && !allObjects[i].HiddenBehindTerrainNow()) { if (ExpandableWorldObjectsUtility.IsExpanded(allObjects[i])) { if (rect.Overlaps(ExpandableWorldObjectsUtility.ExpandedIconScreenRect(allObjects[i]))) { yield return(allObjects[i]); /*Error: Unable to find new state assignment for yield return*/; } } else if (rect.Contains(allObjects[i].ScreenPos())) { break; } } i++; continue; } yield break; } yield return(allObjects[i]); /*Error: Unable to find new state assignment for yield return*/; }
public static void GetExpandedWorldObjectUnderMouse(Vector2 mousePos, List <WorldObject> outList) { outList.Clear(); Vector2 point = mousePos; point.y = (float)UI.screenHeight - point.y; List <WorldObject> allWorldObjects = Find.WorldObjects.AllWorldObjects; for (int i = 0; i < allWorldObjects.Count; i++) { WorldObject worldObject = allWorldObjects[i]; if (ExpandableWorldObjectsUtility.IsExpanded(worldObject)) { if (ExpandableWorldObjectsUtility.ExpandedIconScreenRect(worldObject).Contains(point)) { if (!worldObject.HiddenBehindTerrainNow()) { outList.Add(worldObject); } } } } ExpandableWorldObjectsUtility.SortByExpandingIconPriority(outList); outList.Reverse(); }
public static IEnumerable <WorldObject> MultiSelectableWorldObjectsInScreenRectDistinct(Rect rect) { List <WorldObject> allObjects = Find.WorldObjects.AllWorldObjects; for (int i = 0; i < allObjects.Count; i++) { if (!allObjects[i].NeverMultiSelect) { if (!allObjects[i].HiddenBehindTerrainNow()) { if (ExpandableWorldObjectsUtility.IsExpanded(allObjects[i])) { if (rect.Overlaps(ExpandableWorldObjectsUtility.ExpandedIconScreenRect(allObjects[i]))) { yield return(allObjects[i]); } } else if (rect.Contains(allObjects[i].ScreenPos())) { yield return(allObjects[i]); } } } } yield break; }
public static void ExpandableWorldObjectsOnGUI() { if (ExpandableWorldObjectsUtility.TransitionPct != 0.0) { ExpandableWorldObjectsUtility.tmpWorldObjects.Clear(); ExpandableWorldObjectsUtility.tmpWorldObjects.AddRange(Find.WorldObjects.AllWorldObjects); ExpandableWorldObjectsUtility.SortByExpandingIconPriority(ExpandableWorldObjectsUtility.tmpWorldObjects); WorldTargeter worldTargeter = Find.WorldTargeter; List <WorldObject> worldObjectsUnderMouse = null; if (worldTargeter.IsTargeting) { worldObjectsUnderMouse = GenWorldUI.WorldObjectsUnderMouse(UI.MousePositionOnUI); } for (int i = 0; i < ExpandableWorldObjectsUtility.tmpWorldObjects.Count; i++) { WorldObject worldObject = ExpandableWorldObjectsUtility.tmpWorldObjects[i]; if (worldObject.def.expandingIcon && !worldObject.HiddenBehindTerrainNow()) { Color expandingIconColor = worldObject.ExpandingIconColor; expandingIconColor.a = ExpandableWorldObjectsUtility.TransitionPct; if (worldTargeter.IsTargetedNow(worldObject, worldObjectsUnderMouse)) { float num = GenMath.LerpDouble(-1f, 1f, 0.7f, 1f, Mathf.Sin((float)(Time.time * 8.0))); expandingIconColor.r *= num; expandingIconColor.g *= num; expandingIconColor.b *= num; } GUI.color = expandingIconColor; GUI.DrawTexture(ExpandableWorldObjectsUtility.ExpandedIconScreenRect(worldObject), worldObject.ExpandingIcon); } } ExpandableWorldObjectsUtility.tmpWorldObjects.Clear(); GUI.color = Color.white; } }