本文整理匯總了C#中System.Windows.Forms.DataObject.SetGameObjectRefs方法的典型用法代碼示例。如果您正苦於以下問題:C# DataObject.SetGameObjectRefs方法的具體用法?C# DataObject.SetGameObjectRefs怎麽用?C# DataObject.SetGameObjectRefs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Forms.DataObject
的用法示例。
在下文中一共展示了DataObject.SetGameObjectRefs方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SerializeToData
protected override void SerializeToData(DataObject data)
{
data.SetGameObjectRefs(new[] { this.gameObj });
}
示例2: AppendNodesToData
protected void AppendNodesToData(DataObject data, IEnumerable<TreeNodeAdv> nodes, bool guardRequiredComponents)
{
if (!guardRequiredComponents)
{
data.SetData(nodes.ToArray());
data.SetComponentRefs(
from c in nodes
where c.Tag is ComponentNode
select (c.Tag as ComponentNode).Component);
data.SetGameObjectRefs(
from c in nodes
where c.Tag is GameObjectNode
select (c.Tag as GameObjectNode).Obj);
}
else
{
// Query selected objects and components
var nodeQuery =
from viewNode in this.objectView.SelectedNodes
select this.objectModel.FindNode(this.objectView.GetPath(viewNode)) as NodeBase;
var cmpQuery =
from cmpNode in nodeQuery
where cmpNode is ComponentNode
select (cmpNode as ComponentNode).Component;
var objQuery =
from objNode in nodeQuery
where objNode is GameObjectNode
select (objNode as GameObjectNode).Obj;
var cmpList = new List<Component>(cmpQuery);
var objList = new List<GameObject>(objQuery);
// Check which Components may be removed and which not
Component conflictComp = this.CheckComponentsRemovable(cmpList, objList);
if (conflictComp != null)
{
this.FlashNode(this.FindNode(conflictComp));
System.Media.SystemSounds.Beep.Play();
}
var viewNodeQuery =
cmpList.Select(c => this.objectView.FindNodeByTag(this.FindNode(c))).
Concat( objList.Select(o => this.objectView.FindNodeByTag(this.FindNode(o))));
this.AppendNodesToData(data, viewNodeQuery.ToArray(), false);
}
}