new public IXMLElement AddElement(string name, XMLElementUI <TAppData, TModuleData, TElementData> previewElement)
        {
            var namespaces = previewElement.module.data.GetNamespaces();

            var componentType = ComponentGetter.GetFromAssemblies(name, namespaces);

            if (componentType != null)
            {
                GameObject go = new GameObject(name);
                go.AddComponent(componentType);
                return(previewElement.CreateElement(name, previewElement.data.CreateChild(go)));
            }

            return(new BombElement(name, previewElement.name));
        }
Пример #2
0
        new public IXMLElement AddElement(string name, XMLElementUI <TAppData, TModuleData, TElementData> previewElement)
        {
            UnityEngine.Object prefab = null;
            foreach (var folder in previewElement.module.data.GetResFolders())
            {
                prefab = Resources.Load(string.Join("/", new string[] { folder, name }));
                if (prefab != null)
                {
                    return(previewElement.CreateElement(name,
                                                        previewElement.data.CreateChild(GameObject.Instantiate((prefab as GameObject)))
                                                        ));
                }
            }

            return(new BombElement(name, previewElement.name));
        }
        new public IXMLElement AddElement(string name, XMLElementUI <TAppData, TModuleData, TElementData> previewElement)
        {
            switch (name)
            {
            case "controller":
                return(new ControllerState <TAppData, TModuleData, TElementData>(previewElement));

            case "component":
                return(new ComponentState <TAppData, TModuleData, TElementData>(previewElement));

            case "void":
                return(previewElement.CreateElement(name, previewElement.data.CreateChild(name)));

            default:
                return(new BombElement(name, previewElement.name));
            }
        }