Initial Commit
This commit is contained in:
parent
53eb92e9af
commit
270ab7d11f
15341 changed files with 700234 additions and 0 deletions
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace Unity.Cloud.Collaborate.Views.Adapters {
|
||||
internal interface IAdapter
|
||||
{
|
||||
int Height { get; }
|
||||
|
||||
Func<VisualElement> MakeItem { get; }
|
||||
|
||||
Action<VisualElement, int> BindItem { get; }
|
||||
|
||||
int GetEntryCount();
|
||||
|
||||
void RegisterObserver(IAdapterObserver observer);
|
||||
|
||||
void DeregisterObserver(IAdapterObserver observer);
|
||||
}
|
||||
}
|
11
Library/PackageCache/com.unity.collab-proxy@1.3.9/Editor/Views/Adapters/IAdapter.cs.meta
generated
Normal file
11
Library/PackageCache/com.unity.collab-proxy@1.3.9/Editor/Views/Adapters/IAdapter.cs.meta
generated
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 05643fe94e7516e4b86f73e706833e49
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,9 @@
|
|||
using System;
|
||||
|
||||
namespace Unity.Cloud.Collaborate.Views.Adapters
|
||||
{
|
||||
internal interface IAdapterObserver
|
||||
{
|
||||
void NotifyDataSetChanged();
|
||||
}
|
||||
}
|
11
Library/PackageCache/com.unity.collab-proxy@1.3.9/Editor/Views/Adapters/IAdapterObserver.cs.meta
generated
Normal file
11
Library/PackageCache/com.unity.collab-proxy@1.3.9/Editor/Views/Adapters/IAdapterObserver.cs.meta
generated
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6797ef5b31abfd44993cf9870584620e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Library/PackageCache/com.unity.collab-proxy@1.3.9/Editor/Views/Adapters/ListAdapters.meta
generated
Normal file
8
Library/PackageCache/com.unity.collab-proxy@1.3.9/Editor/Views/Adapters/ListAdapters.meta
generated
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 664e0259f5e6a0146b29dc2f29a742f6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,81 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace Unity.Cloud.Collaborate.Views.Adapters.ListAdapters
|
||||
{
|
||||
/// <summary>
|
||||
/// Adapter used to provide entries to the AdapterListView. Allows the data to be kept separately to the layout
|
||||
/// and visual elements.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of list element the adapter provides</typeparam>
|
||||
internal abstract class BaseListAdapter<T> : IAdapter where T : VisualElement
|
||||
{
|
||||
readonly List<IAdapterObserver> m_AdapterObservers = new List<IAdapterObserver>();
|
||||
|
||||
#region PrivateInterfaceFields
|
||||
|
||||
Func<VisualElement> IAdapter.MakeItem => MakeItem;
|
||||
|
||||
Action<VisualElement, int> IAdapter.BindItem => (v, i) => BindItem((T)v, i);
|
||||
|
||||
#endregion
|
||||
|
||||
#region UserOverrides
|
||||
|
||||
/// <summary>
|
||||
/// Provides the static height for each element.
|
||||
/// </summary>
|
||||
public abstract int Height { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates and returns the layout for the entry.
|
||||
/// </summary>
|
||||
/// <returns>Created entry layout.</returns>
|
||||
protected abstract T MakeItem();
|
||||
|
||||
/// <summary>
|
||||
/// Binds data to the entry at the given index.
|
||||
/// </summary>
|
||||
/// <param name="element">Entry to bind to.</param>
|
||||
/// <param name="index">Index in the data.</param>
|
||||
protected abstract void BindItem(T element, int index);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the count of the number of entries in the list.
|
||||
/// </summary>
|
||||
/// <returns>The entry count.</returns>
|
||||
public abstract int GetEntryCount();
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Register an observer for this adapter.
|
||||
/// </summary>
|
||||
/// <param name="observer">Observer to register.</param>
|
||||
public void RegisterObserver(IAdapterObserver observer)
|
||||
{
|
||||
m_AdapterObservers.Add(observer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deregister an observer for this adapter.
|
||||
/// </summary>
|
||||
/// <param name="observer">Observer to deregister.</param>
|
||||
public void DeregisterObserver(IAdapterObserver observer)
|
||||
{
|
||||
m_AdapterObservers.Remove(observer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Notify that the data set in this adapter has changed.
|
||||
/// </summary>
|
||||
public void NotifyDataSetChanged()
|
||||
{
|
||||
foreach (var observer in m_AdapterObservers)
|
||||
{
|
||||
observer.NotifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6d5f9c23c4be9e644ae25c47f8b2299d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,65 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using JetBrains.Annotations;
|
||||
using Unity.Cloud.Collaborate.Assets;
|
||||
using Unity.Cloud.Collaborate.Components.ChangeListEntries;
|
||||
using Unity.Cloud.Collaborate.Models.Structures;
|
||||
using Unity.Cloud.Collaborate.Presenters;
|
||||
using UnityEngine.Assertions;
|
||||
|
||||
namespace Unity.Cloud.Collaborate.Views.Adapters.ListAdapters
|
||||
{
|
||||
internal class ConflictedChangeListAdapter : BaseListAdapter<ConflictedChangeListElement>
|
||||
{
|
||||
IChangesPresenter m_Presenter;
|
||||
|
||||
[CanBeNull]
|
||||
IReadOnlyList<IChangeEntryData> m_List;
|
||||
public IReadOnlyList<IChangeEntryData> List
|
||||
{
|
||||
set
|
||||
{
|
||||
m_List = value;
|
||||
NotifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ConflictedChangeListAdapter([NotNull] IChangesPresenter presenter)
|
||||
{
|
||||
m_Presenter = presenter;
|
||||
}
|
||||
|
||||
public override int Height { get; } = UiConstants.ChangesListViewItemHeight;
|
||||
|
||||
protected override ConflictedChangeListElement MakeItem()
|
||||
{
|
||||
return new ConflictedChangeListElement();
|
||||
}
|
||||
|
||||
protected override void BindItem(ConflictedChangeListElement element, int index)
|
||||
{
|
||||
Assert.IsNotNull(m_List, "List should not be null at this point.");
|
||||
element.ClearData();
|
||||
var changesEntry = m_List[index];
|
||||
var path = changesEntry.All ? StringAssets.all : changesEntry.Entry.Path;
|
||||
element.UpdateFilePath(path);
|
||||
|
||||
// Update status icon
|
||||
element.statusIcon.ClearClassList();
|
||||
element.statusIcon.AddToClassList(BaseChangeListElement.IconUssClassName);
|
||||
element.statusIcon.AddToClassList(ToggleableChangeListElement.StatusIconUssClassName);
|
||||
element.statusIcon.AddToClassList(changesEntry.Entry.StatusToString());
|
||||
|
||||
// Wire up buttons
|
||||
element.showButton.Clicked += () => m_Presenter.RequestShowConflictedDifferences(changesEntry.Entry.Path);
|
||||
element.chooseMergeButton.Clicked += () => m_Presenter.RequestChooseMerge(changesEntry.Entry.Path);
|
||||
element.chooseMineButton.Clicked += () => m_Presenter.RequestChooseMine(changesEntry.Entry.Path);
|
||||
element.chooseRemoteButton.Clicked += () => m_Presenter.RequestChooseRemote(changesEntry.Entry.Path);
|
||||
}
|
||||
|
||||
public override int GetEntryCount()
|
||||
{
|
||||
return m_List?.Count ?? 0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 70522d02d20893a42b7cf30eb8221cce
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,58 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using JetBrains.Annotations;
|
||||
using Unity.Cloud.Collaborate.Assets;
|
||||
using Unity.Cloud.Collaborate.Presenters;
|
||||
using Unity.Cloud.Collaborate.Components.ChangeListEntries;
|
||||
using Unity.Cloud.Collaborate.Models.Structures;
|
||||
|
||||
namespace Unity.Cloud.Collaborate.Views.Adapters.ListAdapters
|
||||
{
|
||||
internal class HistoryEntryChangeListAdapter : BaseListAdapter<HistoryChangeListElement>
|
||||
{
|
||||
string m_RevisionId;
|
||||
IList<IChangeEntry> m_List;
|
||||
readonly IHistoryPresenter m_Presenter;
|
||||
|
||||
public HistoryEntryChangeListAdapter([NotNull] IHistoryPresenter presenter, [NotNull] string revisionId, [NotNull] IList<IChangeEntry> list)
|
||||
{
|
||||
m_Presenter = presenter;
|
||||
m_RevisionId = revisionId;
|
||||
m_List = list;
|
||||
}
|
||||
|
||||
public override int Height => UiConstants.HistoryListViewItemHeight;
|
||||
|
||||
protected override HistoryChangeListElement MakeItem()
|
||||
{
|
||||
return new HistoryChangeListElement();
|
||||
}
|
||||
|
||||
protected override void BindItem(HistoryChangeListElement element, int index)
|
||||
{
|
||||
element.ClearData();
|
||||
var entry = m_List[index];
|
||||
element.UpdateFilePath(entry.Path);
|
||||
|
||||
// TODO: make status icon an object to handle this logic
|
||||
element.statusIcon.ClearClassList();
|
||||
element.statusIcon.AddToClassList(BaseChangeListElement.IconUssClassName);
|
||||
element.statusIcon.AddToClassList(HistoryChangeListElement.StatusIconUssClassName);
|
||||
element.statusIcon.AddToClassList(entry.StatusToString());
|
||||
|
||||
if (m_Presenter.SupportsRevert)
|
||||
{
|
||||
element.revertButton.Clicked += () => m_Presenter.RequestRevert(m_RevisionId, new List<string> { entry.Path });
|
||||
}
|
||||
else
|
||||
{
|
||||
element.revertButton.AddToClassList(UiConstants.ussHidden);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetEntryCount()
|
||||
{
|
||||
return m_List.Count;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 93a892c54d73e8f4ca210cdc2bf67a74
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,132 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using JetBrains.Annotations;
|
||||
using Unity.Cloud.Collaborate.Assets;
|
||||
using Unity.Cloud.Collaborate.Components.ChangeListEntries;
|
||||
using Unity.Cloud.Collaborate.Models.Structures;
|
||||
using Unity.Cloud.Collaborate.Presenters;
|
||||
using UnityEngine.Assertions;
|
||||
|
||||
namespace Unity.Cloud.Collaborate.Views.Adapters.ListAdapters
|
||||
{
|
||||
internal class ToggleableChangeListAdapter : BaseListAdapter<ToggleableChangeListElement>
|
||||
{
|
||||
[CanBeNull]
|
||||
IReadOnlyList<IChangeEntryData> m_List;
|
||||
public IReadOnlyList<IChangeEntryData> List
|
||||
{
|
||||
set
|
||||
{
|
||||
m_List = value;
|
||||
NotifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
readonly IChangesPresenter m_Presenter;
|
||||
int m_LastBoundElementIndex;
|
||||
|
||||
public ToggleableChangeListAdapter(IChangesPresenter presenter)
|
||||
{
|
||||
m_Presenter = presenter;
|
||||
}
|
||||
|
||||
public override int Height { get; } = UiConstants.ChangesListViewItemHeight;
|
||||
|
||||
protected override ToggleableChangeListElement MakeItem()
|
||||
{
|
||||
return new ToggleableChangeListElement();
|
||||
}
|
||||
|
||||
protected override void BindItem(ToggleableChangeListElement element, int index)
|
||||
{
|
||||
Assert.IsNotNull(m_List, "List should not be null at this point.");
|
||||
m_LastBoundElementIndex = index;
|
||||
element.ClearData();
|
||||
var changesEntry = m_List[index];
|
||||
var path = changesEntry.All ? StringAssets.all : changesEntry.Entry.Path;
|
||||
element.UpdateFilePath(path);
|
||||
|
||||
// Setup callbacks
|
||||
element.SetToggleCallback(c => OnItemToggleChanged(index, c));
|
||||
element.diffButton.Clicked += () => OnDiffClicked(index);
|
||||
element.discardButton.RemoveFromClassList(UiConstants.ussHidden);
|
||||
element.discardButton.Clicked += () => OnDiscardClicked(index);
|
||||
|
||||
// Update the toggle and tooltips.
|
||||
if (changesEntry.ToggleReadOnly)
|
||||
{
|
||||
element.toggle.SetValueWithoutNotify(true);
|
||||
element.toggle.SetEnabled(false);
|
||||
element.toggle.parent.tooltip = StringAssets.includedToPublishByAnotherGitTool;
|
||||
}
|
||||
else
|
||||
{
|
||||
element.toggle.SetValueWithoutNotify(changesEntry.Toggled);
|
||||
element.toggle.SetEnabled(true);
|
||||
element.toggle.parent.tooltip = string.Empty;
|
||||
}
|
||||
|
||||
// Update the visibility of the icon and discard button.
|
||||
if (changesEntry.All)
|
||||
{
|
||||
element.buttons.AddToClassList(UiConstants.ussHidden);
|
||||
element.statusIcon.AddToClassList(UiConstants.ussHidden);
|
||||
}
|
||||
else
|
||||
{
|
||||
element.buttons.RemoveFromClassList(UiConstants.ussHidden);
|
||||
// TODO: make status icon an object to handle this logic
|
||||
element.statusIcon.ClearClassList();
|
||||
element.statusIcon.AddToClassList(BaseChangeListElement.IconUssClassName);
|
||||
element.statusIcon.AddToClassList(ToggleableChangeListElement.StatusIconUssClassName);
|
||||
element.statusIcon.AddToClassList(changesEntry.Entry.StatusToString());
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetEntryCount()
|
||||
{
|
||||
return m_List?.Count ?? 0;
|
||||
}
|
||||
|
||||
void OnItemToggleChanged(int index, bool toggled)
|
||||
{
|
||||
Assert.IsNotNull(m_List, "List should not be null at this point.");
|
||||
var changeEntry = m_List[index];
|
||||
var refresh = m_Presenter.UpdateEntryToggle(changeEntry.Entry.Path, toggled);
|
||||
if (refresh) NotifyDataSetChanged();
|
||||
}
|
||||
|
||||
void OnDiscardClicked(int index)
|
||||
{
|
||||
Assert.IsNotNull(m_List, "List should not be null at this point.");
|
||||
var changeEntry = m_List[index];
|
||||
m_Presenter.RequestDiscard(changeEntry.Entry);
|
||||
}
|
||||
|
||||
public int GetLastBoundElementIndex()
|
||||
{
|
||||
return m_LastBoundElementIndex;
|
||||
}
|
||||
|
||||
public int GetFirstToggledIndex()
|
||||
{
|
||||
Assert.IsNotNull(m_List, "List should not be null at this point.");
|
||||
for (var i=0; i < m_List.Count; i++)
|
||||
{
|
||||
if(m_List[i].Toggled)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void OnDiffClicked(int index)
|
||||
{
|
||||
Assert.IsNotNull(m_List, "List should not be null at this point.");
|
||||
var changeEntry = m_List[index];
|
||||
m_Presenter.RequestDiffChanges(changeEntry.Entry.Path);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 928f8025717499a41802f8fe66420488
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue