Esempio n. 1
0
        //call on loading to set up the project
        //return a string message if there is a problem or null if everything is okay
        public string Setup()
        {
            //Game.ini
            Ini = new GameIni();
            if (File.Exists(System.IO.Path.Combine(Directory, "Game.ini")))
            {
                Ini.Deserialize(File.ReadAllText(System.IO.Path.Combine(Directory, "Game.ini")));
            }
            else
            {
                return("There was an error reading Game.ini");
            }

            //Load RTP(s)
            FindRTPs();

            //Ruby
            Ruby = new Ruby();

            //Scripts.rxdata
            Scripts = new ScriptHive();
            Ruby.PopulateScriptHive(Scripts);

            //MapInfos.rxdata
            Maps = new MapInfos();
            Ruby.PopulateMapInfos(Maps);
            Maps.FinishedLoading();

            return(null);
        }
Esempio n. 2
0
 public void PopulateMapInfos(MapInfos infos)
 {
     try
     {
         //read a List from MapInfos.rxdata
         List <dynamic> mapInfoList = ToList(rbhelper.load_map_infos());
         foreach (dynamic d in mapInfoList)
         {
             List <dynamic> entry = ToList(d);
             infos.AddMap((int)entry[0], entry[1].ToString(), (int)entry[2], (int)entry[3], (bool)entry[4], (int)entry[5], (int)entry[6], entry[7]);
         }
     }
     catch (Exception e)
     {
         System.Windows.Forms.MessageBox.Show(e.Message);
     }
 }
Esempio n. 3
0
        public void WriteMapInfos(MapInfos infos)
        {
            List <IronRuby.Builtins.RubyArray> maps = new List <IronRuby.Builtins.RubyArray>();

            foreach (MapInfo info in infos.Maps)
            {
                IronRuby.Builtins.RubyArray ra = new IronRuby.Builtins.RubyArray();
                ra.Add(info.Id);
                ra.Add(info.Name);
                ra.Add(info.ParentId);
                ra.Add(info.Order);
                ra.Add(info.Expanded);
                ra.Add(info.ScrollX);
                ra.Add(info.ScrollY);
                ra.Add(info.Map.rbMap); //ta-da, found a way
                maps.Add(ra);
            }
            rbhelper.save_map_infos(maps);
        }
Esempio n. 4
0
 public void PopulateMapInfos(MapInfos infos)
 {
     try
     {
         //read a List from MapInfos.rxdata
         List <dynamic> mapInfoList = ToList(rbhelper.load_map_infos());
         foreach (dynamic d in mapInfoList)
         {
             List <dynamic> entry = ToList(d);
             infos.AddMap((int)entry[0], entry[1].ToString(), (int)entry[2], (int)entry[3], (bool)entry[4], (int)entry[5], (int)entry[6], entry[7]);
         }
         //todo: temporary, last editor map id
         int lastMap = rbhelper.get_last_map_id();
         Editor.SelectMap(lastMap);
     }
     catch (Exception e)
     {
         System.Windows.Forms.MessageBox.Show(e.Message);
     }
 }
Esempio n. 5
0
        //call on loading to set up the project
        //return a string message if there is a problem or null if everything is okay
        public string Setup()
        {
            //Game.ini
            Ini = new GameIni();
            if (File.Exists(System.IO.Path.Combine(Directory, "Game.ini")))
            {
                Ini.Deserialize(File.ReadAllText(System.IO.Path.Combine(Directory, "Game.ini")));
            }
            else
            {
                return("There was an error reading Game.ini");
            }

            //Load RTP(s)
            FindRTPs();

            //Ruby
            Ruby = new Ruby();

            //Scripts.rxdata
            Scripts = new ScriptHive();
            Ruby.PopulateScriptHive(Scripts);

            //Database
            Database = new Database();
            Ruby.PopulateDatabase(Database);

            //MapInfos.rxdata
            Maps = new MapInfos();
            Ruby.PopulateMapInfos(Maps);
            Maps.FinishedLoading();

            //setup starting position
            MapHandler.startMapId = Database.System.start_map_id;
            MapHandler.startMapX  = Database.System.start_x;
            MapHandler.startMapY  = Database.System.start_y;

            return(null);
        }