Beispiel #1
0
        /// <summary>
        /// Loads the config from a file or generates a new one
        /// </summary>
        /// <returns></returns>
        public static Config getConfig()
        {
            if (m_instance != null)
                return m_instance;

            m_instance = new Config();
            if (File.Exists(m_defaultName))
            {
                FileStream fs = File.Open(m_defaultName, FileMode.Open);
                if (fs != null)
                {
                    BinaryReader br = new BinaryReader(fs);
                    m_instance.deserialize(br);
                    fs.Close();
                }
                return m_instance;
            }
            else
            {
                m_instance = defaultConfig();
                return m_instance;
            }
        }
Beispiel #2
0
        public static Config defaultConfig()
        {
            Config conf = new Config();

            #region 3DEditor
            OptionGroup _3dOptions = new OptionGroup("3D Editor Options");

            _3dOptions.Options.Add(new ListOption("Model Component", "The Id of the Component that should be used for mesh data."));
            _3dOptions.Options.Add(new StringSemanticOption("Model Parameter", "The name of the parameter that should be used for mesh data. Separate multiple entries with ','", "model,mesh",ParameterSemantic.MESH));
            _3dOptions.Options.Add(new StringSemanticOption("Material Parameter", "The name of the parameter that should be used for material data. Separate multiple entries with ','", "material", ParameterSemantic.MATERIAL));
            _3dOptions.Options.Add(new ListOption("Position Component", "The Id of the Component that should be used for position data."));
            _3dOptions.Options.Add(new StringSemanticOption("Position Parameter", "The name of the parameter that should be used for position data. Separate multiple entries with ','", "position", ParameterSemantic.POSITION3D));
            _3dOptions.Options.Add(new ListOption("Orientation Component", "The Id of the Component that should be used for orientation data."));
            _3dOptions.Options.Add(new StringSemanticOption("Orientation Parameter", "The name of the parameter that should be used for orientation data. Separate multiple entries with ','", "orientation", ParameterSemantic.ORIENTATION3D));
            _3dOptions.Options.Add(new ListOption("Scale Component", "The Id of the Component that should be used for scaling data."));
            _3dOptions.Options.Add(new StringSemanticOption("Scale Parameter", "The name of the parameter that should be used for scaling data. Separate multiple entries with ','", "scale", ParameterSemantic.DIMENSION3D));
            _3dOptions.Options.Add(new ListOption("Camera Component", "The Id of the Component that should be used for Camera data."));

            conf.Options.Add(_3dOptions);
            #endregion

            #region StateMachine
            OptionGroup _StateMachines = new OptionGroup("StateMachines");
            _StateMachines.Options.Add(new ListOption("StateMachine Component", "The Id of the Componenet that can be used as a state machine."));
            _StateMachines.Options.Add(new StringSemanticOption("InitState Parameter", "The name of the parameter that specifies the initial state of the state machine. Separate multiple entries with ','", "initState", ParameterSemantic.INITSTATE));
            _StateMachines.Options.Add(new StringSemanticOption("Transitions Parameter", "The name of the parameter that holds all the transition data. Separate multiple entries with ','", "transitions", ParameterSemantic.TRANSITIONS));
            _StateMachines.Options.Add(new StringSemanticOption("Transition Parameter", "The name of the parameter that should be used for a ingle transition.", "transition", ParameterSemantic.TRANSITION));
            _StateMachines.Options.Add(new StringSemanticOption("Message Parameter", "The name of the parameter that holds the message id for a transition.", "msg", ParameterSemantic.MSG));
            _StateMachines.Options.Add(new StringSemanticOption("From Parameter", "The name of the parameter that specifies the 'From' state.", "transition", ParameterSemantic.FROM));
            _StateMachines.Options.Add(new StringSemanticOption("To Parameter", "The name of the parameter that specifies the 'To' state.", "transition", ParameterSemantic.TO));
            _StateMachines.Options.Add(new ListOption("State Component", "The Id of the Componenet that can be used as a state. Separate multiple entries with ','"));

            conf.Options.Add(_StateMachines);
            #endregion

            #region Paths
            OptionGroup _PathOptions = new OptionGroup("Paths");
            _PathOptions.Options.Add(new FolderOption("Export Path", "Default path for exporting.", Environment.CurrentDirectory + "\\Templates\\"));
            _PathOptions.Options.Add(new FolderOption("Save Path", "Default path for saving.", Environment.CurrentDirectory + "\\Scripts\\"));

            conf.Options.Add(_PathOptions);
            #endregion

            FileStream fs = File.Open(m_defaultName, FileMode.Create);
            BinaryWriter bw = new BinaryWriter(fs);
            conf.serialize(bw);
            bw.Flush();
            fs.Close();
            return conf;
        }