public static ELCraftBrowser Spawn(ELCraftType type, string profile, SelectFileCallback onFileSelected, CancelledCallback onCancel, bool showMergeOption)
        {
            if (prefab == null)
            {
                CreatePrefab();
            }

            var cb = Instantiate(prefab).GetComponent <ELCraftBrowser> ();

            cb.enabled = true;
            cb.transform.SetParent(DialogCanvasUtil.DialogCanvasRect, false);

            cb.facility          = craftFacility[(int)type];
            cb.showMergeOption   = showMergeOption;
            cb.OnBrowseCancelled = onCancel;
            cb.onFileSelected    = onFileSelected;
            if (onConfigNodeSelected != null)
            {
                var callback = Delegate.CreateDelegate(onConfigNodeSelected.FieldType, cb, typeof(ELCraftBrowser).GetMethod("selCB", bindingFlags));
                onConfigNodeSelected.SetValue(cb, callback);
            }
            else
            {
                cb.OnFileSelected = onFileSelected;
            }
            cb.title   = "Select a craft to load";
            cb.profile = profile;

            return(cb);
        }
Ejemplo n.º 2
0
        public static ELCraftBrowser Spawn(ELCraftType type, string profile, SelectFileCallback onFileSelected, CancelledCallback onCancel, bool showMergeOption)
        {
            if (prefab == null)
            {
                CreatePrefab();
            }

            var cb = Instantiate(prefab).GetComponent <ELCraftBrowser> ();

            cb.transform.SetParent(DialogCanvasUtil.DialogCanvasRect, false);

            cb.facility          = craftFacility[(int)type];
            cb.showMergeOption   = showMergeOption;
            cb.OnBrowseCancelled = onCancel;
            cb.OnFileSelected    = onFileSelected;
            cb.title             = "Select a craft to load";
            cb.profile           = profile;

            return(cb);
        }