예제 #1
0
        //load sector
        private void loadToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            string file = Path.Combine(this.saves_path, SectorTree.SelectedNode.Text, "SANDBOX_0_0_0_.sbs");

            if (File.Exists(file))
            {
                Sandbox.Common.ObjectBuilders.MyObjectBuilder_Base sec = Sandbox.Common.ObjectBuilders.MyObjectBuilder_Base.CreateNewObject(Sandbox.Common.ObjectBuilders.MyObjectBuilderTypeEnum.Sector);
                MyObjectBuilder_Sector mySector = (Sandbox.Common.ObjectBuilders.MyObjectBuilder_Sector)sec;
                Console.WriteLine(mySector.Position.ToString());
                try
                {
                    using (FileStream sr = File.Open(file, FileMode.Open))
                    {
                        if (Sandbox.Common.ObjectBuilders.MyObjectBuilder_Base.DeserializeXML(sr, out mySector))
                        {
                            this.create_tree(SectorTree.SelectedNode, mySector);
                        }
                    }
                }
                catch (System.NullReferenceException)
                {
                    MessageBox.Show("Unable to load that savegame, please report this!");
                }
            }
        }
예제 #2
0
 public static MyDefinitionId GetId(this MyObjectBuilder_Base self)
 {
     return(new MyDefinitionId(self.TypeId, self.SubtypeId));
 }
예제 #3
0
		private static void SaveSandbox( MyObjectBuilder_Base objectBuilder, string savePath, out ulong fileSize )
		{
			string path = Path.Combine(savePath, "Sandbox.sbc");
			MyObjectBuilderSerializer.SerializeXML(path, false, objectBuilder, out fileSize);
		}
 public static MyGuiControlBase CreateGuiControl(MyObjectBuilder_Base builder)
 {
     return m_objectFactory.CreateInstance(builder.TypeId);
 }
 void SwitchToWeaponSuccess(MyDefinitionId? weapon, MyObjectBuilder_Base weaponObjectBuilder, long weaponEntityId)
 {
     SwitchToWeaponInternal(weapon, false);
 }