public static void StoreNoiseRender(ModuleBase noise, string name, IntVec2 renderSize)
 {
     NoiseDebugUI.RenderSize = renderSize;
     NoiseDebugUI.StoreNoiseRender(noise, name);
 }
Beispiel #2
0
        public static void NoiseDebugOnGUI()
        {
            if (!Prefs.DevMode || !DebugViewSettings.drawRecordedNoise)
            {
                return;
            }
            if (Widgets.ButtonText(new Rect(0f, 40f, 200f, 30f), "Clear noise renders", true, false, true))
            {
                NoiseDebugUI.Clear();
            }
            if (Widgets.ButtonText(new Rect(200f, 40f, 200f, 30f), "Hide noise renders", true, false, true))
            {
                DebugViewSettings.drawRecordedNoise = false;
            }
            if (WorldRendererUtility.WorldRenderedNow)
            {
                if (NoiseDebugUI.planetNoises.Any <NoiseDebugUI.NoisePlanet>() && Widgets.ButtonText(new Rect(400f, 40f, 200f, 30f), "Next planet noise", true, false, true))
                {
                    if (Event.current.button == 1)
                    {
                        if (NoiseDebugUI.currentPlanetNoise == null || NoiseDebugUI.planetNoises.IndexOf(NoiseDebugUI.currentPlanetNoise) == -1)
                        {
                            NoiseDebugUI.currentPlanetNoise = NoiseDebugUI.planetNoises[NoiseDebugUI.planetNoises.Count - 1];
                        }
                        else if (NoiseDebugUI.planetNoises.IndexOf(NoiseDebugUI.currentPlanetNoise) == 0)
                        {
                            NoiseDebugUI.currentPlanetNoise = null;
                        }
                        else
                        {
                            NoiseDebugUI.currentPlanetNoise = NoiseDebugUI.planetNoises[NoiseDebugUI.planetNoises.IndexOf(NoiseDebugUI.currentPlanetNoise) - 1];
                        }
                    }
                    else if (NoiseDebugUI.currentPlanetNoise == null || NoiseDebugUI.planetNoises.IndexOf(NoiseDebugUI.currentPlanetNoise) == -1)
                    {
                        NoiseDebugUI.currentPlanetNoise = NoiseDebugUI.planetNoises[0];
                    }
                    else if (NoiseDebugUI.planetNoises.IndexOf(NoiseDebugUI.currentPlanetNoise) == NoiseDebugUI.planetNoises.Count - 1)
                    {
                        NoiseDebugUI.currentPlanetNoise = null;
                    }
                    else
                    {
                        NoiseDebugUI.currentPlanetNoise = NoiseDebugUI.planetNoises[NoiseDebugUI.planetNoises.IndexOf(NoiseDebugUI.currentPlanetNoise) + 1];
                    }
                }
                if (NoiseDebugUI.currentPlanetNoise != null)
                {
                    Rect rect = new Rect(605f, 40f, 300f, 30f);
                    Text.Font = GameFont.Medium;
                    Widgets.Label(rect, NoiseDebugUI.currentPlanetNoise.name);
                    Text.Font = GameFont.Small;
                }
            }
            float num  = 0f;
            float num2 = 90f;

            Text.Font = GameFont.Tiny;
            foreach (NoiseDebugUI.Noise2D noise2D in NoiseDebugUI.noises2D)
            {
                Texture2D texture = noise2D.Texture;
                if (num + (float)texture.width + 5f > (float)UI.screenWidth)
                {
                    num   = 0f;
                    num2 += (float)(texture.height + 5 + 25);
                }
                Rect position = new Rect(num, num2, (float)texture.width, (float)texture.height);
                GUI.DrawTexture(position, texture);
                Rect rect2 = new Rect(num, num2 - 15f, (float)texture.width, (float)texture.height);
                GUI.color = Color.black;
                Widgets.Label(rect2, noise2D.name);
                GUI.color = Color.white;
                Widgets.Label(new Rect(rect2.x + 1f, rect2.y + 1f, rect2.width, rect2.height), noise2D.name);
                num += (float)(texture.width + 5);
            }
        }