Exemple #1
0
        public static string Write(this UIModel model)
        {
            var fi = new FileInfo(model.output);

            fi.Directory.Create();
            using (var fs = fi.Create()) {
                Write(model, fs, UIGlobalSettings.GetOrCreateSettings().schema);
            }



            AssetDatabase.SaveAssets();
            AssetDatabase.ImportAsset(model.output);
            AssetDatabase.Refresh();
            //return AssetDatabase.GUIDFromAssetPath(model.output).ToString();
            var settings = AddressableAssetSettingsDefaultObject.GetSettings(false);
            var guid     = AssetDatabase.GUIDFromAssetPath(model.output).ToString();

            if (settings != null && !string.IsNullOrEmpty(model.address))
            {
                var entry = settings.FindAssetEntry(guid);
                if (entry == null)
                {
                    entry = settings.CreateOrMoveEntry(guid, settings.FindGroup(UI_ADDRESSABLES_GROUP) ?? AddressableAssetSettingsDefaultObject.Settings.CreateGroup(UI_ADDRESSABLES_GROUP, false, false, false, null));
                }
                entry.SetAddress(model.address);
            }
            return(guid);
        }
 void OnDestroy()
 {
     if (_instance == this)
     {
         _instance = null;
     }
 }
Exemple #3
0
        private static void InitializeModel(UIModel model, XmlReader reader, string guid, string path)
        {
            var            settings         = UIGlobalSettings.GetOrCreateSettings();
            var            referencedAssets = new List <string>();
            var            nodes            = new List <UIGraphNodeOld>();
            var            context          = new Context();
            Header         header           = default;
            TypeDecomposer decomposer       = new TypeDecomposer();

            if (reader.Read() && IsRoot(reader))
            {
                header = new Header(settings, reader, model);
                var childReader = reader.ReadSubtree();
                var root        = Node.Create(default, -1);
 protected override void OnCreate()
 {
     base.OnCreate();
     schema         = UIGlobalSettings.GetOrCreateSettings().schema;
     compiledSchema = this.schema.Compile(Allocator.Persistent);
 }
 void Awake()
 {
     _instance = this;
 }