本文整理汇总了C#中AssetList.Add方法的典型用法代码示例。如果您正苦于以下问题:C# AssetList.Add方法的具体用法?C# AssetList.Add怎么用?C# AssetList.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AssetList
的用法示例。
在下文中一共展示了AssetList.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateFilesInVCIfNeeded
private static void UpdateFilesInVCIfNeeded()
{
if (Provider.enabled)
{
string[] strArray = Directory.GetFiles("Temp/ScriptUpdater/", "*.*", SearchOption.AllDirectories);
AssetList assets = new AssetList();
foreach (string str in strArray)
{
assets.Add(Provider.GetAssetByPath(str.Replace("Temp/ScriptUpdater/", string.Empty)));
}
Task task = Provider.Checkout(assets, CheckoutMode.Exact);
task.Wait();
if (<>f__am$cache0 == null)
{
示例2: UpdateFilesInVCIfNeeded
private static void UpdateFilesInVCIfNeeded()
{
if (!Provider.enabled)
{
return;
}
string[] files = Directory.GetFiles("Temp/ScriptUpdater/", "*.*", SearchOption.AllDirectories);
AssetList assetList = new AssetList();
string[] array = files;
for (int i = 0; i < array.Length; i++)
{
string text = array[i];
assetList.Add(Provider.GetAssetByPath(text.Replace("Temp/ScriptUpdater/", string.Empty)));
}
Task task = Provider.Checkout(assetList, CheckoutMode.Both);
task.Wait();
IEnumerable<Asset> source =
from a in task.assetList
where (a.state & Asset.States.ReadOnly) == Asset.States.ReadOnly
select a;
if (!task.success || source.Any<Asset>())
{
string arg_103_0 = "[API Updater] Files cannot be updated (failed to checkout): {0}";
object[] expr_BA = new object[1];
expr_BA[0] = (
from a in source
select string.Concat(new object[]
{
a.fullName,
" (",
a.state,
")"
})).Aggregate((string acc, string curr) => acc + Environment.NewLine + "\t" + curr);
Debug.LogErrorFormat(arg_103_0, expr_BA);
ScriptUpdatingManager.ReportExpectedUpdateFailure();
return;
}
FileUtil.CopyDirectoryRecursive("Temp/ScriptUpdater/", ".", true);
FileUtil.DeleteFileOrDirectory("Temp/ScriptUpdater/");
}
示例3: UpdateFilesInVCIfNeeded
private static void UpdateFilesInVCIfNeeded()
{
if (!Provider.enabled)
return;
string[] files = Directory.GetFiles("Temp/ScriptUpdater/", "*.*", SearchOption.AllDirectories);
AssetList assets = new AssetList();
foreach (string str in files)
assets.Add(Provider.GetAssetByPath(str.Replace("Temp/ScriptUpdater/", string.Empty)));
Task task = Provider.Checkout(assets, CheckoutMode.Exact);
task.Wait();
IEnumerable<Asset> source = task.assetList.Where<Asset>((Func<Asset, bool>) (a => (a.state & Asset.States.ReadOnly) == Asset.States.ReadOnly));
if (!task.success || source.Any<Asset>())
{
Debug.LogErrorFormat("[API Updater] Files cannot be updated (failed to check out): {0}", (object) source.Select<Asset, string>((Func<Asset, string>) (a => a.fullName + " (" + (object) a.state + ")")).Aggregate<string>((Func<string, string, string>) ((acc, curr) => acc + Environment.NewLine + "\t" + curr)));
ScriptUpdatingManager.ReportExpectedUpdateFailure();
}
else
{
FileUtil.CopyDirectoryRecursive("Temp/ScriptUpdater/", ".", true);
FileUtil.DeleteFileOrDirectory("Temp/ScriptUpdater/");
}
}
示例4: OnGUI
private void OnGUI()
{
if (BuildPlayerWindow.styles == null)
{
BuildPlayerWindow.styles = new BuildPlayerWindow.Styles();
BuildPlayerWindow.styles.toggleSize = BuildPlayerWindow.styles.toggle.CalcSize(new GUIContent("X"));
this.lv.rowHeight = (int) BuildPlayerWindow.styles.levelString.CalcHeight(new GUIContent("X"), 100f);
}
BuildPlayerWindow.InitBuildPlatforms();
if (!UnityConnect.instance.canBuildWithUPID)
this.ShowAlert();
GUILayout.Space(5f);
GUILayout.BeginHorizontal();
GUILayout.Space(10f);
GUILayout.BeginVertical();
string message = string.Empty;
bool disabled = !AssetDatabase.IsOpenForEdit("ProjectSettings/EditorBuildSettings.asset", out message);
EditorGUI.BeginDisabledGroup(disabled);
this.ActiveScenesGUI();
GUILayout.BeginHorizontal();
if (disabled)
{
GUI.enabled = true;
if (Provider.enabled && GUILayout.Button("Check out"))
{
Asset assetByPath = Provider.GetAssetByPath("ProjectSettings/EditorBuildSettings.asset");
AssetList assets = new AssetList();
assets.Add(assetByPath);
Provider.Checkout(assets, CheckoutMode.Asset);
}
GUILayout.Label(message);
GUI.enabled = false;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Add Open Scenes"))
this.AddOpenScenes();
GUILayout.EndHorizontal();
EditorGUI.EndDisabledGroup();
GUILayout.Space(10f);
GUILayout.BeginHorizontal(GUILayout.Height(301f));
this.ActiveBuildTargetsGUI();
GUILayout.Space(10f);
GUILayout.BeginVertical();
this.ShowBuildTargetSettings();
GUILayout.EndVertical();
GUILayout.EndHorizontal();
GUILayout.Space(10f);
GUILayout.EndVertical();
GUILayout.Space(10f);
GUILayout.EndHorizontal();
}
示例5: OnUnaddedFilesGUI
private void OnUnaddedFilesGUI()
{
AssetList assetList = new AssetList();
string text = string.Empty;
foreach (Asset current in this.assetList)
{
if (!current.IsState(Asset.States.OutOfSync) && !current.IsState(Asset.States.Synced) && !current.IsState(Asset.States.AddedLocal))
{
text = text + current.prettyPath + "\n";
assetList.Add(current);
}
}
GUILayout.Label("Files to add", EditorStyles.boldLabel, new GUILayoutOption[0]);
GUILayout.Label("Some additional files need to be added:", new GUILayoutOption[0]);
GUI.enabled = false;
GUILayout.TextArea(text, new GUILayoutOption[0]);
GUI.enabled = true;
GUILayout.BeginHorizontal(new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
if (GUILayout.Button("Add files", new GUILayoutOption[0]))
{
this.taskAdd = Provider.Add(assetList, false);
this.taskAdd.SetCompletionAction(CompletionAction.OnAddedChangeWindow);
}
if (GUILayout.Button("Abort", new GUILayoutOption[0]))
{
this.taskSubmit = null;
this.submitResultCode = 256;
this.submitErrorMessage = null;
base.Close();
}
GUILayout.EndHorizontal();
}
示例6: OnGUI
//.........这里部分代码省略.........
this.m_ShowIncoming = GUILayout.Toggle(this.m_ShowIncoming, GUIContent.Temp("Incoming" + (num != 0 ? " (" + num.ToString() + ")" : string.Empty)), EditorStyles.toolbarButton, new GUILayoutOption[0]);
if (EditorGUI.EndChangeCheck())
flag1 = true;
GUILayout.FlexibleSpace();
EditorGUI.BeginDisabledGroup(Provider.activeTask != null);
foreach (CustomCommand customCommand in Provider.customCommands)
{
if (customCommand.context == CommandContext.Global && GUILayout.Button(customCommand.label, EditorStyles.toolbarButton, new GUILayoutOption[0]))
customCommand.StartTask();
}
EditorGUI.EndDisabledGroup();
if (Mathf.FloorToInt(this.position.width - this.s_ToolbarButtonsWidth - this.s_SettingsButtonWidth - this.s_DeleteChangesetsButtonWidth) > 0 && this.HasEmptyPendingChangesets() && GUILayout.Button("Delete Empty Changesets", EditorStyles.toolbarButton, new GUILayoutOption[0]))
this.DeleteEmptyPendingChangesets();
if (Mathf.FloorToInt(this.position.width - this.s_ToolbarButtonsWidth - this.s_SettingsButtonWidth) > 0 && GUILayout.Button("Settings", EditorStyles.toolbarButton, new GUILayoutOption[0]))
{
EditorApplication.ExecuteMenuItem("Edit/Project Settings/Editor");
EditorWindow.FocusWindowIfItsOpen<InspectorWindow>();
GUIUtility.ExitGUI();
}
Color color1 = GUI.color;
GUI.color = new Color(1f, 1f, 1f, 0.5f);
bool flag2 = GUILayout.Button((Texture) this.refreshIcon, EditorStyles.toolbarButton, new GUILayoutOption[0]);
bool flag3 = flag1 || flag2;
GUI.color = color1;
if (current.isKey && GUIUtility.keyboardControl == 0 && (current.type == EventType.KeyDown && current.keyCode == KeyCode.F5))
{
flag3 = true;
current.Use();
}
if (flag3)
{
if (flag2)
Provider.InvalidateCache();
this.UpdateWindow();
}
GUILayout.EndArea();
Rect rect = new Rect(0.0f, fixedHeight, this.position.width, (float) ((double) this.position.height - (double) fixedHeight - 17.0));
bool flag4 = false;
GUILayout.EndHorizontal();
bool flag5;
if (!Provider.isActive)
{
Color color2 = GUI.color;
GUI.color = new Color(0.8f, 0.5f, 0.5f);
rect.height = fixedHeight;
GUILayout.BeginArea(rect);
GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
string text = "DISABLED";
if (Provider.enabled)
{
if (Provider.onlineState == OnlineState.Updating)
{
GUI.color = new Color(0.8f, 0.8f, 0.5f);
text = "CONNECTING...";
}
else
text = "OFFLINE";
}
GUILayout.Label(text, EditorStyles.miniLabel, new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.EndArea();
rect.y += rect.height;
if (!string.IsNullOrEmpty(Provider.offlineReason))
GUI.Label(rect, Provider.offlineReason);
GUI.color = color2;
flag5 = false;
}
else
{
flag5 = !this.m_ShowIncoming ? flag4 | this.pendingList.OnGUI(rect, this.hasFocus) : flag4 | this.incomingList.OnGUI(rect, this.hasFocus);
rect.y += rect.height;
rect.height = 17f;
GUI.Label(rect, GUIContent.none, WindowPending.s_Styles.bottomBarBg);
GUIContent content = new GUIContent("Apply All Incoming Changes");
Vector2 vector2 = EditorStyles.miniButton.CalcSize(content);
WindowPending.ProgressGUI(new Rect(rect.x, rect.y - 2f, (float) ((double) rect.width - (double) vector2.x - 5.0), rect.height), Provider.activeTask, false);
if (this.m_ShowIncoming)
{
Rect position = rect;
position.width = vector2.x;
position.height = vector2.y;
position.y = rect.y + 2f;
position.x = (float) ((double) this.position.width - (double) vector2.x - 5.0);
EditorGUI.BeginDisabledGroup(this.incomingList.Size == 0);
if (GUI.Button(position, content, EditorStyles.miniButton))
{
Asset asset = new Asset(string.Empty);
AssetList assets = new AssetList();
assets.Add(asset);
Provider.GetLatest(assets).SetCompletionAction(CompletionAction.OnGotLatestPendingWindow);
}
EditorGUI.EndDisabledGroup();
}
}
if (!flag5)
return;
this.Repaint();
}
示例7: ParseAttributeQueryResult
private QueryResult ParseAttributeQueryResult(XmlElement element, Query query) {
var list = new AssetList();
var asset = new Asset(query.Oid);
list.Add(asset);
var attribdef = metaModel.GetAttributeDefinition(query.AssetType.Token + "." + element.GetAttribute("name"));
ParseAttributeNode(asset, attribdef, element);
return new QueryResult(list, 1, query);
}
示例8: ParseAssetQueryResult
private QueryResult ParseAssetQueryResult(XmlElement element, Query query) {
var list = new AssetList();
list.Add(ParseAssetNode(element));
return new QueryResult(list, 1, query);
}
示例9: GetAssetListFromSelection
public static AssetList GetAssetListFromSelection()
{
AssetList assetList = new AssetList();
Asset[] array = Provider.Internal_GetAssetArrayFromSelection();
Asset[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
Asset item = array2[i];
assetList.Add(item);
}
return assetList;
}
示例10: Checkout
/// <summary>
/// <para>Checkout an asset or list of asset from the version control system.</para>
/// </summary>
/// <param name="assets">List of assets to checkout.</param>
/// <param name="mode">Tell the Provider to checkout the asset, the .meta file or both.</param>
/// <param name="asset">Asset to checkout.</param>
public static Task Checkout(Object[] assets, CheckoutMode mode)
{
AssetList list = new AssetList();
foreach (Object obj2 in assets)
{
Asset assetByPath = GetAssetByPath(AssetDatabase.GetAssetPath(obj2));
list.Add(assetByPath);
}
return Internal_Checkout(list.ToArray(), mode);
}
示例11: GetAssetListFromSelection
/// <summary>
/// <para>Return version control information about the currently selected assets.</para>
/// </summary>
public static AssetList GetAssetListFromSelection()
{
AssetList assetList = new AssetList();
foreach (Asset asset in Provider.Internal_GetAssetArrayFromSelection())
assetList.Add(asset);
return assetList;
}
示例12: Checkout
/// <summary>
/// <para>Checkout an asset or list of asset from the version control system.</para>
/// </summary>
/// <param name="assets">List of assets to checkout.</param>
/// <param name="mode">Tell the Provider to checkout the asset, the .meta file or both.</param>
/// <param name="asset">Asset to checkout.</param>
public static Task Checkout(Object[] assets, CheckoutMode mode)
{
AssetList assetList = new AssetList();
foreach (Object asset in assets)
{
Asset assetByPath = Provider.GetAssetByPath(AssetDatabase.GetAssetPath(asset));
assetList.Add(assetByPath);
}
return Provider.Internal_Checkout(assetList.ToArray(), mode);
}
示例13: OnUnaddedFilesGUI
private void OnUnaddedFilesGUI()
{
AssetList assets = new AssetList();
string text = string.Empty;
using (List<Asset>.Enumerator enumerator = this.assetList.GetEnumerator())
{
while (enumerator.MoveNext())
{
Asset current = enumerator.Current;
if (!current.IsState(Asset.States.OutOfSync) && !current.IsState(Asset.States.Synced) && !current.IsState(Asset.States.AddedLocal))
{
text = text + current.prettyPath + "\n";
assets.Add(current);
}
}
}
GUILayout.Label("Files to add", EditorStyles.boldLabel, new GUILayoutOption[0]);
GUILayout.Label("Some additional files need to be added:");
GUI.enabled = false;
GUILayout.TextArea(text);
GUI.enabled = true;
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if (GUILayout.Button("Add files"))
{
this.taskAdd = Provider.Add(assets, false);
this.taskAdd.SetCompletionAction(CompletionAction.OnAddedChangeWindow);
}
if (GUILayout.Button("Abort"))
this.ResetAndClose();
GUILayout.EndHorizontal();
}
示例14: saveAssets
public void saveAssets(string projectPath, string name, bool locked)
{
if (Assets.items != null)
{
AssetList package = new AssetList();
for (int i = 0; i < Assets.items.Count; i++)
{
Asset asset = Assets.items[i];
if (asset.package == name)
{
package.Add(asset);
}
}
if (package.Count > 0)
Serialization.serialize(Path.Combine(projectPath, name.Replace(" ", "_") + ".pak"), package);
}
}
示例15: SuiteRunSave
private void SuiteRunSave(object pubobj) {
var run = (SuiteRun)pubobj;
Logger.Log(LogMessage.SeverityType.Debug, run.ToString());
if(string.IsNullOrEmpty(run.SuiteRef)) {
Logger.Log(LogMessage.SeverityType.Debug, "Suite Reference is null or empty. Skipping...");
return;
}
var q = new Query(TestSuiteType);
var term = new FilterTerm(TestSuiteType.GetAttributeDefinition("Reference"));
term.Equal(run.SuiteRef);
q.Filter = term;
var r = Services.Retrieve(q);
if(r.Assets.Count == 0) {
Logger.Log(LogMessage.SeverityType.Debug, "No TestSuite found by reference: " + run.SuiteRef);
return;
}
var save = new AssetList();
foreach(var testsuite in r.Assets) {
var testrun = Services.New(TestRunType, testsuite.Oid);
testrun.SetAttributeValue(TestRunType.GetAttributeDefinition("Name"), run.Name);
testrun.SetAttributeValue(TestRunType.GetAttributeDefinition("Description"), run.Description);
testrun.SetAttributeValue(TestRunType.GetAttributeDefinition("Date"), run.Stamp);
testrun.SetAttributeValue(TestRunType.GetAttributeDefinition("Passed"), run.Passed);
testrun.SetAttributeValue(TestRunType.GetAttributeDefinition("Failed"), run.Failed);
testrun.SetAttributeValue(TestRunType.GetAttributeDefinition("NotRun"), run.NotRun);
testrun.SetAttributeValue(TestRunType.GetAttributeDefinition("Elapsed"), run.Elapsed);
LogSuiteRun(testrun);
save.Add(testrun);
}
Services.Save(save);
}