public WidgetSequenceCommandEntry(GameConfigCommandDescriptor commandDescriptor) { this.Build(); _commandDescriptor = commandDescriptor; _inputCommand.Text = _commandDescriptor._command; _inputArguments.Text = _commandDescriptor._arguments; RefreshCommandPickerVisibility(); }
public void AddSequenceCommand(List <KeyValuePair <string, string> > commandList) { _commandList = new List <GameConfigCommandDescriptor>(); foreach (KeyValuePair <string, string> command in commandList) { GameConfigCommandDescriptor commandDescriptor = new GameConfigCommandDescriptor(); commandDescriptor._command = command.Key; commandDescriptor._arguments = command.Value; _commandList.Add(commandDescriptor); } }
public FileOperationResult Load() { try { XmlReader reader = XmlReader.Create(_descriptorFile); while (reader.Read()) { // Only detect start elements. if (reader.IsStartElement()) { // Get element name and switch on it. switch (reader.Name) { case "commands": { _gameConfigDB = new GameConfigDB(); string attribute = reader["name"]; Config.AssertResource(attribute); _gameConfigDB.SetName(attribute); attribute = reader["creationDate"]; Config.AssertResource(attribute); _gameConfigDB.SetCreationDate(Int32.Parse(attribute)); } break; case "section": { if (_currentGameConfigSectionDescriptor != null) { _gameConfigDB.AddSection(_currentGameConfigSectionDescriptor); _currentGameConfigSectionDescriptor = null; } _currentGameConfigSectionDescriptor = new GameConfigSectionDescriptor(); string attribute = reader["tittle"]; Config.AssertResource(attribute); _currentGameConfigSectionDescriptor._tittle = Utils.DecodeHTML(attribute); } break; case "command": { _currentGameConfigButtonDescriptor = new GameConfigButtonDescriptor(); string attribute = reader["type"]; Config.AssertResource(attribute); GameConfigButtonDescriptor.Etype type = Utils.static_cast <GameConfigButtonDescriptor.Etype>(Int32.Parse(attribute)); _currentGameConfigButtonDescriptor._type = type; attribute = reader["tittle"]; Config.AssertResource(attribute); _currentGameConfigButtonDescriptor._tittle = Utils.DecodeHTML(attribute); if (type == GameConfigButtonDescriptor.Etype.MultiCommand) { _currentGameConfigButtonDescriptor._commandList = new List <GameConfigCommandDescriptor>(); } else { attribute = reader["command"]; Config.AssertResource(attribute); _currentGameConfigButtonDescriptor._command = Utils.DecodeHTML(attribute); } if (type == GameConfigButtonDescriptor.Etype.FixedArgument || type == GameConfigButtonDescriptor.Etype.ExposedArgument) { attribute = reader["arguments"]; Config.AssertResource(attribute); _currentGameConfigButtonDescriptor._arguments = Utils.DecodeHTML(attribute); } _currentGameConfigSectionDescriptor._buttons.Add(_currentGameConfigButtonDescriptor); } break; case "command_sequence": { GameConfigCommandDescriptor commandDescriptor = new GameConfigCommandDescriptor(); string attribute = reader["command"]; Config.AssertResource(attribute); commandDescriptor._command = Utils.DecodeHTML(attribute); attribute = reader["arguments"]; Config.AssertResource(attribute); commandDescriptor._arguments = Utils.DecodeHTML(attribute); _currentGameConfigButtonDescriptor._commandList.Add(commandDescriptor); } break; } } } if (_currentGameConfigSectionDescriptor != null) { _gameConfigDB.AddSection(_currentGameConfigSectionDescriptor); _currentGameConfigSectionDescriptor = null; } reader.Close(); return(new FileOperationResult(true)); } catch (System.Exception ex) { return(new FileOperationResult(false, ex.Message)); } }
private void AddCommandEntry(GameConfigCommandDescriptor command) { WidgetSequenceCommandEntry commandSequenceWidget = new WidgetSequenceCommandEntry(command); DoAddCommandEntry(commandSequenceWidget); }