Esempio n. 1
0
        public RTPrefabLib CreateLib(string libName)
        {
            if (string.IsNullOrEmpty(libName))
            {
                return(null);
            }

            string      finalName = UniqueNameGen.Generate(libName, GetAllLibNames());
            RTPrefabLib lib       = new RTPrefabLib();

            lib.Name = finalName;
            _libs.Add(lib);

            if (HasRuntimeUI && Application.isPlaying)
            {
                _runtimeUI.ActiveLibDropDown.SyncWithLibDb();
            }
            if (_activeLibIndex == -1)
            {
                SetActiveLib(0);
            }

            lib.PrefabCreated += OnPrefabCreatedInLib;
            lib.PrefabRemoved += OnPrefabRemovedFromLib;
            lib.Cleared       += OnPrefabLibCleared;

            return(lib);
        }
Esempio n. 2
0
        public bool SetLibName(RTPrefabLib lib, string newLibName)
        {
            if (lib.Name == newLibName || !Contains(lib))
            {
                return(false);
            }
            if (string.IsNullOrEmpty(newLibName))
            {
                return(false);
            }

            string finalName = UniqueNameGen.Generate(newLibName, GetAllLibNames());

            lib.Name = finalName;

            if (HasRuntimeUI && Application.isPlaying)
            {
                _runtimeUI.ActiveLibDropDown.SyncWithLibDb();
            }

            return(true);
        }