示例#1
0
        public void Awake()
        {
            readerSettings.IgnoreComments = true;

            foreach (BSMLTag tag in Utilities.GetListOfType <BSMLTag>())
            {
                RegisterTag(tag);
            }

            foreach (BSMLMacro macro in Utilities.GetListOfType <BSMLMacro>())
            {
                RegisterMacro(macro);
            }

            typeHandlers = Utilities.GetListOfType <TypeHandler>();
            foreach (TypeHandler typeHandler in typeHandlers.ToArray())
            {
                Type type = (typeHandler.GetType().GetCustomAttributes(typeof(ComponentHandler), true).FirstOrDefault() as ComponentHandler)?.type;
                if (type == null)
                {
                    Logger.log.Warn($"TypeHandler {typeHandler.GetType().FullName} does not have the [ComponentHandler] attribute and will be ignored.");
                    typeHandlers.Remove(typeHandler);
                }
            }
        }
示例#2
0
        public void Awake()
        {
            readerSettings.IgnoreComments = true;

            foreach (BSMLTag tag in Utilities.GetListOfType <BSMLTag>())
            {
                RegisterTag(tag);
            }

            foreach (BSMLMacro macro in Utilities.GetListOfType <BSMLMacro>())
            {
                RegisterMacro(macro);
            }

            typeHandlers = Utilities.GetListOfType <TypeHandler>();
        }
示例#3
0
        public void MenuSceneLoaded()
        {
            foreach (BSMLTag tag in tags.Values)
            {
                if (!tag.isInitialized)
                {
                    tag.Setup();
                    tag.isInitialized = true;
                }
            }

#if false//don't worry about this, it's for the docs
            string contents = "";
            foreach (BSMLTag tag in Utilities.GetListOfType <BSMLTag>())
            {
                tag.Setup();
                contents += $"- type: {tag.GetType().Name}\n";
                contents += $"  aliases:\n";
                foreach (string alias in tag.Aliases)
                {
                    contents += $"  - {alias}\n";
                }
                contents += $"  components:\n";
                GameObject currentNode = tag.CreateObject(transform);
                foreach (TypeHandler typeHandler in typeHandlers)
                {
                    Type type = (typeHandler.GetType().GetCustomAttributes(typeof(ComponentHandler), true).FirstOrDefault() as ComponentHandler).type;
                    if (GetExternalComponent(currentNode, type) != null)
                    {
                        contents += $"  - {type.Name}\n";
                    }
                }
            }
            File.WriteAllText(Path.Combine(Environment.CurrentDirectory, "Tags.yml"), contents);
#endif
        }