Example #1
0
        private void AddTextBox(string UIName, Coordinates coordinates, params KeyValuePair <string, object>[] extraSettings)
        {
            string drawingLuaTemplate = File.ReadAllText($"{BRPaths.INCLUDE_LUA_MISSION}\\Drawing\\TextBox.lua");

            GeneratorTools.ReplaceKey(ref drawingLuaTemplate, "Text", extraSettings.First(x => x.Key == "Text").Value);
            DrawingColour colour     = (DrawingColour)(extraSettings.FirstOrDefault(x => x.Key == "Colour").Value ?? DrawingColour.Red);
            DrawingColour fillColour = (DrawingColour)(extraSettings.FirstOrDefault(x => x.Key == "FillColour").Value ?? DrawingColour.White);

            AddToList(UIName, drawingLuaTemplate, coordinates, colour, fillColour);
        }
Example #2
0
        private void AddFree(string UIName, Coordinates coordinates, params KeyValuePair <string, object>[] extraSettings)
        {
            string drawingLuaTemplate = File.ReadAllText($"{BRPaths.INCLUDE_LUA_MISSION}\\Drawing\\Free.lua");
            string freePosLuaTemplate = File.ReadAllText($"{BRPaths.INCLUDE_LUA_MISSION}\\Drawing\\FreePos.lua");

            var points = "";
            var index  = 1;

            foreach (Coordinates pos in (List <Coordinates>)extraSettings.First(x => x.Key == "Points").Value)
            {
                var templateLua = new String(freePosLuaTemplate);
                GeneratorTools.ReplaceKey(ref templateLua, "Index", index);
                GeneratorTools.ReplaceKey(ref templateLua, "X", pos.X);
                GeneratorTools.ReplaceKey(ref templateLua, "Y", pos.Y);
                points += $"{templateLua}\n";
                index++;
            }
            GeneratorTools.ReplaceKey(ref drawingLuaTemplate, "POINTS", points);
            DrawingColour colour     = (DrawingColour)(extraSettings.FirstOrDefault(x => x.Key == "Colour").Value ?? DrawingColour.Red);
            DrawingColour fillColour = (DrawingColour)(extraSettings.FirstOrDefault(x => x.Key == "FillColour").Value ?? DrawingColour.RedFill);

            AddToList(UIName, drawingLuaTemplate, coordinates, colour, fillColour);
        }
Example #3
0
 private void AddToList(string UIName, string template, Coordinates coordinates, DrawingColour colour, DrawingColour fillColour)
 {
     GeneratorTools.ReplaceKey(ref template, "UIName", UIName);
     GeneratorTools.ReplaceKey(ref template, "X", coordinates.X);
     GeneratorTools.ReplaceKey(ref template, "Y", coordinates.Y);
     GeneratorTools.ReplaceKey(ref template, "Colour", colour.ToValue());
     GeneratorTools.ReplaceKey(ref template, "FillColour", fillColour.ToValue());
     LuaDrawings.Add(template);
 }
Example #4
0
 public static string ToValue(this DrawingColour colour) => colour switch
 {