Exemplo n.º 1
0
    public static void LoadPositionsTeam(IniDataSection sectionFile, TeamID teamId)
    {
        var section = sectionFile.GetContentSection(teamId.ToString());

        string[] position;
        for (int i = 0; i < MAX_SPAWNS; ++i)
        {
            position = section[i].Split(',');
            spawns[(int)teamId, i].X     = Double(position[0]);
            spawns[(int)teamId, i].Y     = Double(position[1]);
            spawns[(int)teamId, i].Z     = Double(position[2]);
            spawns[(int)teamId, i].Angle = Float(position[3]);
        }
    }
Exemplo n.º 2
0
 /* Loads the specific data of a map. */
 public static void LoadMapData()
 {
     try
     {
         var path        = Scriptfiles.GetPath($"maps{Path.DirectorySeparatorChar}{GetCurrentMap()}.ini");
         var sectionFile = new IniDataSection(path);
         LoadPositionsTeam(sectionFile, TeamID.Alpha);
         LoadPositionsTeam(sectionFile, TeamID.Beta);
         Interior  = Int(sectionFile.GetContentSection("Interior")?[0]) ?? DEFAULT_INTERIOR;
         Weather   = Int(sectionFile.GetContentSection("Weather")?[0]) ?? DEFAULT_WEATHER;
         WorldTime = Int(sectionFile.GetContentSection("WorldTime")?[0]) ?? DEFAULT_WORLDTIME;
     }
     catch (FileNotFoundException e)
     {
         Console.WriteLine($"Error {e.StackTrace} Reason: {e.Message}");
     }
     catch (DirectoryNotFoundException e)
     {
         Console.WriteLine($"Error {e.StackTrace} Reason: {e.Message}");
     }
 }