This commit is contained in:
2026-11-24 15:51:02 +01:00
parent cca4d73e41
commit f4aa17114a
22092 changed files with 5042406 additions and 0 deletions
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6ed4af135d46444bb82543c0676535c8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,45 @@
#if AIA_PRESENT
using System;
using System.Threading.Tasks;
using Unity.AI.Assistant.FunctionCalling;
namespace Unity.PlasticSCM.Editor.Assistant.UI.Interactions
{
class ConfirmationInteraction : IInteractionSource<bool>, IApprovalInteraction
{
public string Action { get; }
public string Detail { get; }
public string AllowLabel { get; }
public string DenyLabel { get; }
public bool ShowScope => false;
public event Action<bool> OnCompleted;
public TaskCompletionSource<bool> TaskCompletionSource { get; } = new();
public ConfirmationInteraction(
string action,
string detail,
string allowLabel = null,
string denyLabel = null)
{
Action = action;
Detail = detail;
AllowLabel = allowLabel;
DenyLabel = denyLabel;
}
public void Respond(PermissionUserAnswer answer)
{
var approved = answer == PermissionUserAnswer.AllowOnce
|| answer == PermissionUserAnswer.AllowAlways;
TaskCompletionSource.TrySetResult(approved);
OnCompleted?.Invoke(approved);
}
public void CancelInteraction()
{
TaskCompletionSource.TrySetCanceled();
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1510662542b194ca0854fd173c356289
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,65 @@
#if AIA_PRESENT
using System.Collections.Generic;
using Unity.AI.Assistant.FunctionCalling;
using UnityEngine;
using UnityEngine.UIElements;
namespace Unity.PlasticSCM.Editor.Assistant.UI.Interactions
{
class DropDownInteraction : BaseInteraction<string>
{
// DropdownField's menu splits item names on '/' into submenu paths with no
// escape character. Substitute '/' with U+29F8 BIG SOLIDUS only at the menu
// construction layer (formatListItemCallback); choices and combo.value stay
// untouched, and the field text restores the real '/' via the selected callback.
const char k_MenuSlash = '\u29F8';
public DropDownInteraction(
string title,
string description,
string fieldLabel,
string confirmLabel,
List<string> choices)
{
style.paddingTop = 8;
style.paddingBottom = 8;
var titleLabel = new Label(title);
titleLabel.style.fontSize = 14;
titleLabel.style.unityFontStyleAndWeight = FontStyle.Bold;
titleLabel.style.marginBottom = 4;
Add(titleLabel);
if (!string.IsNullOrEmpty(description))
{
var descLabel = new Label(description);
descLabel.style.marginBottom = 8;
descLabel.style.whiteSpace = WhiteSpace.Normal;
Add(descLabel);
}
var combo = new DropdownField(
fieldLabel,
choices,
0,
formatSelectedValueCallback: val => val,
formatListItemCallback: val => val?.Replace('/', k_MenuSlash));
Add(combo);
var buttonRow = new VisualElement();
buttonRow.style.flexDirection = FlexDirection.Row;
buttonRow.style.marginTop = 8;
var confirmButton = new Button(() => CompleteInteraction(combo.value));
confirmButton.text = confirmLabel;
buttonRow.Add(confirmButton);
var cancelButton = new Button(CancelInteraction);
cancelButton.text = "Cancel";
buttonRow.Add(cancelButton);
Add(buttonRow);
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 61e7e7b5c173f464ca9dd243b9c64e58
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
#if AIA_PRESENT
namespace Unity.PlasticSCM.Editor.Assistant.UI.Interactions
{
class OptionChoice
{
public string Label { get; set; }
public string Description { get; set; }
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0ae12db6b63f345dbbbbb806477556f4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,104 @@
#if AIA_PRESENT
using System.Collections.Generic;
using Unity.AI.Assistant.FunctionCalling;
using UnityEngine;
using UnityEngine.UIElements;
namespace Unity.PlasticSCM.Editor.Assistant.UI.Interactions
{
class RadioGroupInteraction : BaseInteraction<string>
{
string m_SelectedValue;
public RadioGroupInteraction(
string title,
string description,
List<OptionChoice> options,
string confirmLabel = "Select")
{
style.paddingTop = 8;
style.paddingBottom = 8;
var titleLabel = new Label(title);
titleLabel.style.fontSize = 14;
titleLabel.style.unityFontStyleAndWeight = FontStyle.Bold;
titleLabel.style.marginBottom = 4;
Add(titleLabel);
if (!string.IsNullOrEmpty(description))
{
var descLabel = new Label(description);
descLabel.style.marginBottom = 8;
descLabel.style.whiteSpace = WhiteSpace.Normal;
Add(descLabel);
}
m_SelectedValue = options.Count > 0 ? options[0].Label : string.Empty;
var radioGroup = new GroupBox();
radioGroup.style.marginBottom = 8;
for (var i = 0; i < options.Count; i++)
{
var option = options[i];
var optionContainer = new VisualElement();
optionContainer.style.marginBottom = i < options.Count - 1 ? 8 : 0;
var radio = new RadioButton();
radio.value = i == 0;
radio.style.flexDirection = FlexDirection.RowReverse;
var capturedLabel = option.Label;
radio.RegisterValueChangedCallback(evt =>
{
if (evt.newValue)
m_SelectedValue = capturedLabel;
});
var labelContainer = new VisualElement();
labelContainer.style.marginLeft = 4;
labelContainer.style.flexGrow = 1;
var optionLabel = new Label(option.Label);
optionLabel.style.unityFontStyleAndWeight = FontStyle.Bold;
labelContainer.Add(optionLabel);
if (!string.IsNullOrEmpty(option.Description))
{
var optionDesc = new Label(option.Description);
optionDesc.style.whiteSpace = WhiteSpace.Normal;
optionDesc.style.opacity = 0.7f;
optionDesc.style.fontSize = 12;
optionDesc.style.marginTop = 2;
labelContainer.Add(optionDesc);
}
optionContainer.style.flexDirection = FlexDirection.Row;
optionContainer.style.alignItems = Align.FlexStart;
optionContainer.Add(radio);
optionContainer.Add(labelContainer);
var capturedRadio = radio;
labelContainer.RegisterCallback<ClickEvent>(evt => capturedRadio.value = true);
radioGroup.Add(optionContainer);
}
Add(radioGroup);
var buttonRow = new VisualElement();
buttonRow.style.flexDirection = FlexDirection.Row;
buttonRow.style.marginTop = 4;
var confirmButton = new Button(() => CompleteInteraction(m_SelectedValue));
confirmButton.text = confirmLabel;
buttonRow.Add(confirmButton);
var cancelButton = new Button(CancelInteraction);
cancelButton.text = "Cancel";
buttonRow.Add(cancelButton);
Add(buttonRow);
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1ae07da59c7dc45f1ba4ed327c03630b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: