public override void LoadData() { base.LoadData(); Master = DetermineIfMaster(); if (!Master) { var set = new DefinitionSet(); EnergyWeapons.Definitions.Create(set); MyAPIGateway.Utilities.SendModMessage(MOD_MESSAGE_DEFINITION_CHANNEL, MyAPIGateway.Utilities.SerializeToXML(set)); return; } MyAPIGateway.Utilities.RegisterMessageHandler(MOD_MESSAGE_PING_MASTER_CHANNEL, MasterPingHandler); MyAPIGateway.Utilities.RegisterMessageHandler(MOD_MESSAGE_DEFINITION_CHANNEL, MasterDefinitionHandler); _loggerStatic = new CustomLogger(); Definitions = new DefinitionManager(); { var set = new DefinitionSet(); EnergyWeapons.Definitions.Create(set); Definitions.Add(set); } MyAPIGateway.Entities.OnEntityNameSet += CheckEntityComponents; MyVisualScriptLogicProvider.ItemSpawned += ItemSpawned; Logger.Info($"Initialized"); }
public void Create1() { var definitionManager = new DefinitionManager(); var traitManager = new TraitManager(definitionManager); var system = traitManager.Add("System", "Test"); var definition = definitionManager.Add("Class"); definition.AddRequirement(new Comparison(system.Definition, Operator.Equal, "Test")); var @class = traitManager.Add("Class", "Foo", definition); var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, Formatting = Formatting.None }; var traitsJson = JsonConvert.SerializeObject(traitManager, Formatting.Indented, settings); }