Esempio n. 1
0
        private void DrawStatus()
        {
            if ((int)(0.1f / env.timeInterval) == 0 || counter % (int)(0.1f / env.timeInterval) == 0)
            {
                status = "";
            }

            if (status == "")
            {
                string str;

                str = "v" + env.debug.version + Environment.NewLine +
                      "Demonstrates simple AI. The beings need all of the different types of" + Environment.NewLine +
                      "essence to survive." + Environment.NewLine +
                      "- Full (non-rotational) world movement implemented." + Environment.NewLine +
                      "- Left-click to select, right-click to drag." + Environment.NewLine +
                      "- Hold ctrl while left-clicking to lock camera onto target." + Environment.NewLine +
                      "- To change the time scale, hold down 'T' and scroll" + Environment.NewLine +
                      "  with the mouse wheel." + Environment.NewLine +
                      "- You can 'jump to being' by clicking on its corresponding" + Environment.NewLine +
                      "  waypoint in the radar (to the right)." + Environment.NewLine +
                      "- Hold shift while scrolling with the mouse wheel to" + Environment.NewLine +
                      "  scroll this text." + Environment.NewLine +
                      Environment.NewLine;

                str += "Music: " + Environment.NewLine +
                       "\"I Dream\" by nomadicxxl. Licence: CC BY 3.0." + Environment.NewLine +
                       "Available at https://freesound.org/s/371802/" + Environment.NewLine +
                       Environment.NewLine;

                str += "Effects: " + Environment.NewLine +
                       "\"Ting\" by Popup Pixels. Licence: CC BY 3.0." + Environment.NewLine +
                       "Available at http://soundbible.com/1628-Ting.html" + Environment.NewLine +
                       Environment.NewLine;

                str += "Scale: x" + string.Format("{0:0.00}", scale) + Environment.NewLine +
                       "Time Scale: x" + string.Format("{0:0.0}", env.timeScale) + Environment.NewLine;
                str += "Mouse: " + TransformToWorld(env.oldMouseLoc) + Environment.NewLine +
                       "Restarts: " + env.ai.restarts + Environment.NewLine +
                       "Age: " + f.ToString(new TimeSpan(f.SecondsToTicks(env.ai.age))) + Environment.NewLine +
                       Environment.NewLine;

                if (selected_being != null)
                {
                    str += "Selected Being:" + selected_being.ToString().Replace(Environment.NewLine, Environment.NewLine + "    ") + Environment.NewLine;
                }

                str += "Being averages:" + env.ai.Stats_Beings().Replace(Environment.NewLine, Environment.NewLine + "    ") + Environment.NewLine;
                str += "Essence averages:" + env.ai.Stats_Essence().Replace(Environment.NewLine, Environment.NewLine + "    ") + Environment.NewLine;

                //miss lines
                string[] lines;
                string[] delimit = new string[1];
                delimit[0] = Environment.NewLine;
                lines      = str.Split(delimit, StringSplitOptions.RemoveEmptyEntries);

                status_miss_lines = f.NumberBound(status_miss_lines, 0, lines.Length - 1);

                int c = lines.Length;
                if (c != 0 & status_miss_lines != 0)
                {
                    for (int i = 0; i < status_miss_lines; i++)
                    {
                        str = str.Replace(lines[i] + Environment.NewLine, "");
                    }
                }

                //remove space
                while (str.Length != 0 && str.Substring(0, 2) == Environment.NewLine)
                {
                    str = str.Remove(0, 2);
                }

                if (status_miss_lines > 0)
                {
                    str = "...(" + status_miss_lines + " lines hidden. Hold down shift and scroll to change)..." + Environment.NewLine + str;
                }

                status = str;
            }


            DrawText(status, new Point());

            //FPS
            DrawText("FPS: " + string.Format("{0:0.0}", FPS), new Point(env.Width - 20, 0), Brushes.White, 1, 1);

            //paused + accuracy
            if (!env.alive)
            {
                DrawText("Paused", new Point(env.Width / 2, 0));
            }
            else if (env.timeScale > 1f)
            {
                DrawText("Accuracy: " + string.Format("{0:0}", 100f / Math.Pow(env.timeScale, 0.4)) + "%", new Point(env.Width / 2, 0));
            }
        }