您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
50 行
1.3 KiB
50 行
1.3 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.AddressableAssets;
|
|
using UnityEngine.Rendering;
|
|
using UnityEngine.Serialization;
|
|
|
|
[CreateAssetMenu(fileName = "VolumeHolder", menuName = "Volume Holder", order = 0)]
|
|
public class VolumeHolder : ScriptableObject
|
|
{
|
|
[SerializeField]
|
|
public AssetReference[] _Volumes;
|
|
[FormerlySerializedAs("qualityIndicies")] [SerializeField]
|
|
public List<int> qualityIndices = new List<int>();
|
|
[FormerlySerializedAs("qualityVolumeIndicies")] [SerializeField]
|
|
public List<int> qualityVolumeIndices = new List<int>();
|
|
|
|
public bool ContainsKey(int key)
|
|
{
|
|
return qualityIndices.Contains(key);
|
|
}
|
|
|
|
public void Add(int key, int value)
|
|
{
|
|
qualityIndices.Add(key);
|
|
qualityVolumeIndices.Add(value);
|
|
}
|
|
|
|
public void SetKey(int key, int value)
|
|
{
|
|
if (qualityIndices.Contains(key))
|
|
{
|
|
qualityVolumeIndices[qualityIndices.IndexOf(key)] = value;
|
|
}
|
|
else
|
|
{
|
|
Add(key, value);
|
|
}
|
|
}
|
|
|
|
public int GetValue(int key)
|
|
{
|
|
if (qualityIndices.Contains(key))
|
|
{
|
|
return qualityVolumeIndices[qualityIndices.IndexOf(key)];
|
|
}
|
|
|
|
throw new Exception(message: $"{qualityIndices} does not contain key {key}");
|
|
}
|
|
}
|