Exemplo n.º 1
0
 public static void RenderPlanetNoise()
 {
     if (Prefs.DevMode && DebugViewSettings.drawRecordedNoise)
     {
         if (NoiseDebugUI.currentPlanetNoise != null)
         {
             if (NoiseDebugUI.planetNoiseMesh == null)
             {
                 List <int> triangles;
                 SphereGenerator.Generate(6, 100.3f, Vector3.forward, 360f, out NoiseDebugUI.planetNoiseMeshVerts, out triangles);
                 NoiseDebugUI.planetNoiseMesh      = new Mesh();
                 NoiseDebugUI.planetNoiseMesh.name = "NoiseDebugUI";
                 NoiseDebugUI.planetNoiseMesh.SetVertices(NoiseDebugUI.planetNoiseMeshVerts);
                 NoiseDebugUI.planetNoiseMesh.SetTriangles(triangles, 0);
                 NoiseDebugUI.lastDrawnPlanetNoise = null;
             }
             if (NoiseDebugUI.lastDrawnPlanetNoise != NoiseDebugUI.currentPlanetNoise)
             {
                 NoiseDebugUI.UpdatePlanetNoiseVertexColors();
                 NoiseDebugUI.lastDrawnPlanetNoise = NoiseDebugUI.currentPlanetNoise;
             }
             Graphics.DrawMesh(NoiseDebugUI.planetNoiseMesh, Vector3.zero, Quaternion.identity, WorldMaterials.VertexColor, WorldCameraManager.WorldLayer);
         }
     }
 }
Exemplo n.º 2
0
 public static void StorePlanetNoise(ModuleBase noise, string name)
 {
     if (Prefs.DevMode && DebugViewSettings.drawRecordedNoise)
     {
         NoiseDebugUI.NoisePlanet item = new NoiseDebugUI.NoisePlanet(noise, name);
         NoiseDebugUI.planetNoises.Add(item);
     }
 }
Exemplo n.º 3
0
 public static void ClearPlanetNoises()
 {
     NoiseDebugUI.planetNoises.Clear();
     NoiseDebugUI.currentPlanetNoise   = null;
     NoiseDebugUI.lastDrawnPlanetNoise = null;
     if (NoiseDebugUI.planetNoiseMesh != null)
     {
         Mesh localPlanetNoiseMesh = NoiseDebugUI.planetNoiseMesh;
         LongEventHandler.ExecuteWhenFinished(delegate
         {
             UnityEngine.Object.Destroy(localPlanetNoiseMesh);
         });
         NoiseDebugUI.planetNoiseMesh = null;
     }
 }
Exemplo n.º 4
0
 public static void NoiseDebugOnGUI()
 {
     if (Prefs.DevMode && DebugViewSettings.drawRecordedNoise)
     {
         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>())
             {
                 if (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);
         }
     }
 }