private void OnAddDropdown(Rect buttonRect, ReorderableList list)
        {
            var menu        = new GenericMenu();
            var factionList = AssetInfoLists.GetList(typeof(Faction));

            if (factionList == null)
            {
                return;
            }
            for (int i = 0; i < factionList.Count; i++)
            {
                if (factionList[i] == null)
                {
                    continue;
                }
                var faction = EditorUtility.InstanceIDToObject(factionList[i].instanceID) as Faction;
                if (faction == null)
                {
                    continue;
                }
                var isInList = (target as Faction).relationships.Find(x => x != null && x.faction == faction) != null;
                if (isInList)
                {
                    continue;
                }
                menu.AddItem(new GUIContent(factionList[i].pathAndName), false, OnClickAdd, faction);
            }
            menu.ShowAsContext();
        }
        private void OnDriveValueListAddDropdown(Rect buttonRect, ReorderableList list)
        {
            var menu   = new GenericMenu();
            var assets = AssetInfoLists.GetList(typeof(Drive));

            if (assets == null)
            {
                return;
            }
            for (int i = 0; i < assets.Count; i++)
            {
                if (assets[i] == null)
                {
                    continue;
                }
                var asset = EditorUtility.InstanceIDToObject(assets[i].instanceID) as Drive;
                if (asset == null)
                {
                    continue;
                }
                var isInList = (target as EntityType).driveValues.Find(x => x != null && x.drive == asset) != null;
                if (isInList)
                {
                    continue;
                }
                menu.AddItem(new GUIContent(assets[i].pathAndName), false, OnClickAddDriveValueList, asset);
            }
            menu.ShowAsContext();
        }
        private void OnUrgencyFunctionListAddDropdown(Rect buttonRect, ReorderableList list)
        {
            var menu   = new GenericMenu();
            var assets = AssetInfoLists.GetList(typeof(UrgencyFunction));

            if (assets == null)
            {
                return;
            }
            for (int i = 0; i < assets.Count; i++)
            {
                if (assets[i] == null)
                {
                    continue;
                }
                var asset = EditorUtility.InstanceIDToObject(assets[i].instanceID) as UrgencyFunction;
                if (asset == null)
                {
                    continue;
                }
                var isInList = (target as EntityType).urgencyFunctions.Contains(asset);
                if (isInList)
                {
                    continue;
                }
                menu.AddItem(new GUIContent(assets[i].pathAndName), false, OnClickAddUrgencyFunctionList, asset);
            }
            menu.ShowAsContext();
        }
        private void OnParentListAddDropdown(Rect buttonRect, ReorderableList list)
        {
            var menu           = new GenericMenu();
            var entityTypeList = AssetInfoLists.GetList(typeof(EntityType));

            if (entityTypeList == null)
            {
                return;
            }
            for (int i = 0; i < entityTypeList.Count; i++)
            {
                if (entityTypeList[i] == null)
                {
                    continue;
                }
                var entityType = EditorUtility.InstanceIDToObject(entityTypeList[i].instanceID) as EntityType;
                if (entityType == null)
                {
                    continue;
                }
                var myEntityType = target as EntityType;
                var isInList     = myEntityType != null && myEntityType.parents != null && myEntityType.parents.Contains(entityType);
                if (isInList)
                {
                    continue;
                }
                menu.AddItem(new GUIContent(entityTypeList[i].pathAndName), false, OnClickAddParentList, entityType);
            }
            menu.ShowAsContext();
        }
Esempio n. 5
0
        public virtual void Draw(float width)
        {
            var assetInfoList = AssetInfoLists.GetList(AssetType);

            if (assetInfoList == null)
            {
                return;
            }
            DrawTopInfo(assetInfoList);
            DrawAssetList(assetInfoList, width);
        }
        private void OnClickNewUrgencyFunction(object data)
        {
            var type = data as System.Type;

            if (type == null)
            {
                return;
            }
            var assetInfoList = AssetInfoLists.GetList(AssetType);

            if (assetInfoList == null)
            {
                return;
            }
            var wrapperType = QuestEditorUtility.GetWrapperType(type);

            if (wrapperType != null)
            {
                type = wrapperType;
            }
            var newAsset = AssetUtility.CreateAsset(type, AssetType.Name, true);

            assetInfoList.Add(new AssetInfo(newAsset));
        }