Example #1
0
    private void TestReadTextFile()
    {
        // Ready from Godot asset file

        /*
         * string path = "res://txt/game_stats.xml";
         * File f = new File();
         * Error err = f.Open(path, File.ModeFlags.Read);
         * if (err != Error.Ok)
         * {
         *      Console.WriteLine($"Error loading text file '{path}'");
         *      f.Close();
         *      return;
         * }
         * string txt = f.GetAsText();
         * Console.WriteLine($"Reading {txt.Length} chars from '{path}'");
         * ZqfXml.TestReadXml(txt);
         * f.Close();
         */

        // Read from mono embedded resource
        string str = ZqfXml.ReadAssemblyEmbeddedText("GodotSharpFps.txt.game_stats.xml");

        ZqfXml.TestReadXml(str);
    }
Example #2
0
    public override void _Ready()
    {
        Console.WriteLine("MAIN INIT");
        _instance = this;
        console   = new CmdConsole();
        console.AddObserver("test", "", "Test console", ExecCmdTest);
        console.AddObserver("map", "", "Load a scene from the maps folder, eg 'map test_box'", ExecCmdScene);

        // init services
        factory = new GameFactory(this);
        cam     = GetNode <GameCamera>("game_camera");
        ui      = GetNode <UI>("/root/ui");
        Input.SetMouseMode(Input.MouseMode.Captured);

        // test stuff
        ZqfXml.ListAllAssemblyResources(Assembly.GetExecutingAssembly());
        TestReadTextFile();
    }