|
|
|
|
|
|
ToolbarMenu m_AddRandomizerMenu; |
|
|
|
public HashSet<Type> randomizerTypeSet = new HashSet<Type>(); |
|
|
|
|
|
|
|
int m_PreviousListSize; |
|
|
|
|
|
|
|
ScenarioBase scenario => (ScenarioBase)m_Property.serializedObject.targetObject; |
|
|
|
|
|
|
|
VisualElement inspectorContainer |
|
|
|
|
|
|
collapseAllButton.clicked += () => CollapseRandomizers(true); |
|
|
|
|
|
|
|
RefreshList(); |
|
|
|
Undo.undoRedoPerformed += () => |
|
|
|
{ |
|
|
|
m_Property.serializedObject.Update(); |
|
|
|
RefreshList(); |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
void RefreshList() |
|
|
|
|
|
|
randomizerTypeSet.Clear(); |
|
|
|
foreach (var randomizer in scenario.randomizers) |
|
|
|
randomizerTypeSet.Add(randomizer.GetType()); |
|
|
|
m_PreviousListSize = m_Property.arraySize; |
|
|
|
Undo.RegisterCompleteObjectUndo(m_Property.serializedObject.targetObject, "Add Randomizer"); |
|
|
|
var newRandomizer = scenario.CreateRandomizer(randomizerType); |
|
|
|
newRandomizer.RandomizeParameterSeeds(); |
|
|
|
m_Property.serializedObject.Update(); |
|
|
|
|
|
|
public void RemoveRandomizer(RandomizerElement element) |
|
|
|
{ |
|
|
|
Undo.RegisterCompleteObjectUndo(m_Property.serializedObject.targetObject, "Remove Randomizer"); |
|
|
|
scenario.RemoveRandomizer(element.randomizerType); |
|
|
|
m_Property.serializedObject.Update(); |
|
|
|
RefreshList(); |
|
|
|
|
|
|
{ |
|
|
|
if (currentIndex == nextIndex) |
|
|
|
return; |
|
|
|
Undo.RegisterCompleteObjectUndo(m_Property.serializedObject.targetObject, "Reorder Randomizer"); |
|
|
|
scenario.ReorderRandomizer(currentIndex, nextIndex); |
|
|
|
m_Property.serializedObject.Update(); |
|
|
|
RefreshList(); |
|
|
|