public static void ExpandableWorldObjectsOnGUI() { if (TransitionPct != 0f) { tmpWorldObjects.Clear(); tmpWorldObjects.AddRange(Find.WorldObjects.AllWorldObjects); SortByExpandingIconPriority(tmpWorldObjects); WorldTargeter worldTargeter = Find.WorldTargeter; List <WorldObject> worldObjectsUnderMouse = null; if (worldTargeter.IsTargeting) { worldObjectsUnderMouse = GenWorldUI.WorldObjectsUnderMouse(UI.MousePositionOnUI); } for (int i = 0; i < tmpWorldObjects.Count; i++) { WorldObject worldObject = tmpWorldObjects[i]; if (worldObject.def.expandingIcon && !worldObject.HiddenBehindTerrainNow()) { Color expandingIconColor = worldObject.ExpandingIconColor; expandingIconColor.a = TransitionPct; if (worldTargeter.IsTargetedNow(worldObject, worldObjectsUnderMouse)) { float num = GenMath.LerpDouble(-1f, 1f, 0.7f, 1f, Mathf.Sin(Time.time * 8f)); expandingIconColor.r *= num; expandingIconColor.g *= num; expandingIconColor.b *= num; } GUI.color = expandingIconColor; GUI.DrawTexture(ExpandedIconScreenRect(worldObject), worldObject.ExpandingIcon); } } tmpWorldObjects.Clear(); GUI.color = Color.white; } }
public static void ExpandableWorldObjectsOnGUI() { if (TransitionPct == 0f) { return; } tmpWorldObjects.Clear(); tmpWorldObjects.AddRange(Find.WorldObjects.AllWorldObjects); SortByExpandingIconPriority(tmpWorldObjects); WorldTargeter worldTargeter = Find.WorldTargeter; List <WorldObject> worldObjectsUnderMouse = null; if (worldTargeter.IsTargeting) { worldObjectsUnderMouse = GenWorldUI.WorldObjectsUnderMouse(UI.MousePositionOnUI); } for (int i = 0; i < tmpWorldObjects.Count; i++) { try { WorldObject worldObject = tmpWorldObjects[i]; if (worldObject.def.expandingIcon && !worldObject.HiddenBehindTerrainNow()) { Color expandingIconColor = worldObject.ExpandingIconColor; expandingIconColor.a = TransitionPct; if (worldTargeter.IsTargetedNow(worldObject, worldObjectsUnderMouse)) { float num = GenMath.LerpDouble(-1f, 1f, 0.7f, 1f, Mathf.Sin(Time.time * 8f)); expandingIconColor.r *= num; expandingIconColor.g *= num; expandingIconColor.b *= num; } GUI.color = expandingIconColor; Rect rect = ExpandedIconScreenRect(worldObject); if (worldObject.ExpandingIconFlipHorizontal) { rect.x = rect.xMax; rect.width *= -1f; } Widgets.DrawTextureRotated(rect, worldObject.ExpandingIcon, worldObject.ExpandingIconRotation); } } catch (Exception ex) { Log.Error("Error while drawing " + tmpWorldObjects[i].ToStringSafe() + ": " + ex); } } tmpWorldObjects.Clear(); GUI.color = Color.white; }