コード例 #1
0
        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;
        }
コード例 #2
0
        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*/;
        }
コード例 #3
0
        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();
        }
コード例 #4
0
ファイル: World.cs プロジェクト: aihhr1832/RimWorld-Decompile
        public void WorldUpdate()
        {
            bool worldRenderedNow = WorldRendererUtility.WorldRenderedNow;

            this.renderer.CheckActivateWorldCamera();
            if (worldRenderedNow)
            {
                Profiler.BeginSample("ExpandableWorldObjectsUpdate()");
                ExpandableWorldObjectsUtility.ExpandableWorldObjectsUpdate();
                Profiler.EndSample();
                Profiler.BeginSample("World.renderer.DrawWorldLayers()");
                this.renderer.DrawWorldLayers();
                Profiler.EndSample();
                Profiler.BeginSample("World.dynamicDrawManager.DrawDynamicWorldObjects()");
                this.dynamicDrawManager.DrawDynamicWorldObjects();
                Profiler.EndSample();
                Profiler.BeginSample("World.features.UpdateFeatures()");
                this.features.UpdateFeatures();
                Profiler.EndSample();
                Profiler.BeginSample("NoiseDebugUI.RenderPlanetNoise()");
                NoiseDebugUI.RenderPlanetNoise();
                Profiler.EndSample();
            }
            Profiler.BeginSample("WorldComponentUpdate()");
            WorldComponentUtility.WorldComponentUpdate(this);
            Profiler.EndSample();
        }
コード例 #5
0
 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;
     }
 }
コード例 #6
0
        public void WorldUpdate()
        {
            bool worldRenderedNow = WorldRendererUtility.WorldRenderedNow;

            renderer.CheckActivateWorldCamera();
            if (worldRenderedNow)
            {
                ExpandableWorldObjectsUtility.ExpandableWorldObjectsUpdate();
                renderer.DrawWorldLayers();
                dynamicDrawManager.DrawDynamicWorldObjects();
                features.UpdateFeatures();
                NoiseDebugUI.RenderPlanetNoise();
            }
            WorldComponentUtility.WorldComponentUpdate(this);
        }
コード例 #7
0
ファイル: GenWorldUI.cs プロジェクト: wensincai/RW-Decompile
        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);
        }