예제 #1
0
    public void Fill()
    {
        var e1 = new AutoLoad.LoadClass("Enemies");
        var e2 = new AutoLoad.LoadClass("Obs");
        var e3 = new AutoLoad.LoadClass("Trees");

        AutoLoad.LoadNameInFile(paths, e1, e2, e3);
    }
예제 #2
0
 public void Remove()
 {
     ManageLabel.RemoveLabels();
     ManageEntry.RemoveEntry();
     ManageGroup.RemoveGroup(GroupName);
     autoLoad = AutoLoad.None;
     AssetDatabase.SaveAssets();
 }
예제 #3
0
 public AData(AddressableAssetEntry addressableAssetEntry, Setter setter)
 {
     Setter         = setter;
     ID             = addressableAssetEntry.guid;
     entry          = addressableAssetEntry;
     assetReference = new AssetReference(ID);
     assetPath      = addressableAssetEntry.AssetPath;
     obj            = addressableAssetEntry.MainAsset;
     loadOnScene    = SceneManager.GetSceneByBuildIndex(loadOnSceneIndex);
     autoLoad       = Setter.autoLoad;
     unload         = Unload.None;
     name           = addressableAssetEntry.MainAsset.name;
     group          = setter.Group;
     ManageAutoLoad(autoLoad);
 }
예제 #4
0
        private void ManageAutoLoad(AutoLoad load)
        {
            if (Setter == null)
            {
                Setter = GetSetter(group.Name);
            }
            if (Setter == null)
            {
                RemoveOnSetterNull(); return;
            }
            if (!CheckEntry())
            {
                return;
            }

            switch (load)
            {
            case AutoLoad.OnStart:
                AddOnStartLabel(entry);
                RemoveOnAwakeLabel(entry);
                AddAdataTo(this, GlobalOnStartList);
                RemoveAdataFrom(this, GlobalOnAwakeList);
                SetterLists(Setter.onStartList, Setter.onAwakeList, Setter.noAutoLoadList);
                break;

            case AutoLoad.OnAwake:
                AddOnAwakeLabel(entry);
                RemoveOnStartLabel(entry);
                RemoveAdataFrom(this, GlobalOnStartList);
                AddAdataTo(this, GlobalOnAwakeList);
                SetterLists(Setter.onAwakeList, Setter.onStartList, Setter.noAutoLoadList);
                break;

            case AutoLoad.None:
                RemoveOnAwakeLabel(entry);
                RemoveOnStartLabel(entry);
                RemoveAdataFrom(this, GlobalOnStartList);
                RemoveAdataFrom(this, GlobalOnAwakeList);
                SetterLists(Setter.noAutoLoadList, Setter.onAwakeList, Setter.onStartList);

                break;

            default: throw new ArgumentOutOfRangeException();
            }

            RefreshLabels();
            entry = DefaultAssetSettings.CreateOrMoveEntry(ID, group);
        }
        private static string[] Headers(IReadOnlyCollection <AData> list, AutoLoad autoLoadLabel)
        {
            string[]   headers;
            string     buttonName;
            GlobalList asset;

            switch (autoLoadLabel)
            {
            case AutoLoad.OnStart:
                headers    = new[] { $"{OnStart} : Total = {list.Count}", $"AutoLoadStr", $"load With Scene", $"UnloadStr" };
                buttonName = "Global OnStart";
                asset      = GetAsset <GlobalList>(Constants.GlobalOnStartList);
                break;

            case AutoLoad.OnAwake:
                headers    = new[] { $"{ OnAwake} : Total = {list.Count}", $"AutoLoadStr", $"load With Scene", $"UnloadStr" };
                buttonName = "Global OnAwake";
                asset      = GetAsset <GlobalList>(Constants.GlobalOnAwakeList);
                break;

            case AutoLoad.None:
                headers    = new[] { $"No AutoLoadStr : Total = {list.Count}", $"AutoLoadStr" };
                buttonName = string.Empty;
                asset      = null;
                break;

            default: throw new ArgumentOutOfRangeException(nameof(autoLoadLabel), autoLoadLabel, null);
            }



            BeginVertical();

            PingButton(buttonName, asset);

            BeginHorizontal("Box");
            Labels(headers, headers.Length);
            EndHorizontal();

            EndVertical();

            return(headers);
        }
예제 #6
0
 public void SetAutoCode(AutoLoad autoLoad)
 {
 }
        internal void Create(IReadOnlyList <AData> list, SerializedProperty serializedProperty, AutoLoad autoLoadLabel, UnityEditor.Editor mainEditor)
        {
            if (list.Count <= 0)
            {
                return;
            }
            mainEditor.serializedObject.Update();
            BeginVertical("Box");

            var column = Headers(list, autoLoadLabel).Length;

            BeginHorizontal("Box");
            ApplyToAllButton = UButton("Apply To All", column);
            switch (autoLoadLabel)
            {
            case AutoLoad.None:

                AutoLoadPopUpNone  = Popup(AutoLoadPopUpNone, AutoLoadOptions, GUILayout.MaxWidth(currentViewWidth / column));
                AutoLoadIndexValue = (AutoLoad)Enum.Parse(typeof(AutoLoad), AutoLoadOptions[AutoLoadPopUpNone]);
                LoadWithSceneIndex = 0;
                UnloadIndexValue   = Unload.None;
                break;

            case AutoLoad.OnStart:
                AutoLoadPopUpOnStart = Popup(AutoLoadPopUpOnStart, AutoLoadOptions, GUILayout.MaxWidth(currentViewWidth / column));
                AutoLoadIndexValue   = (AutoLoad)Enum.Parse(typeof(AutoLoad), AutoLoadOptions[AutoLoadPopUpOnStart]);

                OnStartLoadWithSceneIndex = Popup(OnStartLoadWithSceneIndex, SceneNamesArray, GUILayout.MaxWidth(currentViewWidth / column));
                LoadWithSceneIndex        = OnStartLoadWithSceneIndex;

                UnloadOnStartIndex = Popup(UnloadOnStartIndex, UnloadOptions, GUILayout.MaxWidth(currentViewWidth / column));
                UnloadIndexValue   = (Unload)Enum.Parse(typeof(Unload), UnloadOptions[UnloadOnStartIndex]);

                break;

            case AutoLoad.OnAwake:

                AutoLoadPopUpOnAwake = Popup(AutoLoadPopUpOnAwake, AutoLoadOptions, GUILayout.MaxWidth(currentViewWidth / column));
                AutoLoadIndexValue   = (AutoLoad)Enum.Parse(typeof(AutoLoad), AutoLoadOptions[AutoLoadPopUpOnAwake]);

                OnAwakeLoadWithSceneIndex = Popup(OnAwakeLoadWithSceneIndex, SceneNamesArray, GUILayout.MaxWidth(currentViewWidth / column));
                LoadWithSceneIndex        = OnAwakeLoadWithSceneIndex;

                UnloadOnAwakeIndex = Popup(UnloadOnAwakeIndex, UnloadOptions, GUILayout.MaxWidth(currentViewWidth / column));
                UnloadIndexValue   = (Unload)Enum.Parse(typeof(Unload), UnloadOptions[UnloadOnAwakeIndex]);

                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(autoLoadLabel), autoLoadLabel, null);
            }
            EndHorizontal();

            if (list.Count > 0)
            {
                for (var i = 0; i < list.Count; i++)
                {
                    BeginHorizontal();
                    var item     = serializedProperty.GetArrayElementAtIndex(i);
                    var obj      = item.FindPropertyRelative(Obj);
                    var unload   = item.FindPropertyRelative(UnloadStr);
                    var autoLoad = item.FindPropertyRelative(AutoLoadStr);

                    PropertyField(obj, GUIContent.none, GUILayout.MaxWidth(currentViewWidth / column));
                    PropertyField(autoLoad, GUIContent.none, GUILayout.MaxWidth(currentViewWidth / column));

                    if (autoLoadLabel != AutoLoad.None)
                    {
                        list[i].loadOnSceneIndex = Popup(list[i].loadOnSceneIndex, SceneNamesArray, GUILayout.MaxWidth(currentViewWidth / column));
                        PropertyField(unload, GUIContent.none, GUILayout.MaxWidth(currentViewWidth / column));
                    }

                    if (ApplyToAllButton)
                    {
                        list[i].loadOnSceneIndex = LoadWithSceneIndex;
                        list[i].unload           = UnloadIndexValue;
                        list[i].autoLoad         = AutoLoadIndexValue;
                    }

                    serializedProperty.serializedObject.ApplyModifiedProperties();
                    serializedProperty.serializedObject.Update();

                    EndHorizontal();
                }
            }
            mainEditor.serializedObject.ApplyModifiedProperties();
            mainEditor.serializedObject.Update();
            EndVertical();
        }
예제 #8
0
 public void Update(AutoLoad load) => ManageAutoLoad(load);