本文整理汇总了C#中ISelectable类的典型用法代码示例。如果您正苦于以下问题:C# ISelectable类的具体用法?C# ISelectable怎么用?C# ISelectable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISelectable类属于命名空间,在下文中一共展示了ISelectable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddToSelection
internal void AddToSelection(ISelectable item)
{
var x = item as DesignerItem;
if (x != null)
{
CurrentSelection.Add(item);
x.IsSelected = true;
//_diagramControl.SelectedItems.Add(x);
//_diagramControl.SelectedItems.Clear();
//foreach (var designerItem in CurrentSelection.Cast<DesignerItem>())
//{
// _diagramControl.SelectedItems.Add(designerItem);
//}
//if (item is IGroupable)
//{
// List<IGroupable> groupItems = GetGroupMembers(item as IGroupable);
//foreach (ISelectable groupItem in groupItems)
//{
// groupItem.IsSelected = true;
// CurrentSelection.Add(groupItem);
//}
//}
//else
//{
// item.IsSelected = true;
// CurrentSelection.Add(item);
//}
}
}
示例2: AddItem
public void AddItem(ISelectable selectable, int rowIndex, int columnIndex)
{
if (Destroyed)
throw new InvalidOperationException("Cannot add a control to a destroyed group");
if (selectable == null)
throw new ArgumentNullException("selectable");
if (rowIndex < 0)
throw new ArgumentException("Cannot add an item to a row index less than 0");
if (columnIndex < 0)
throw new ArgumentException("Cannot add an item to a column index less than 0");
// Make sure this item doesn't already exist or an item doesn't exist in this row/column
if (_items.Contains(selectable))
throw new InvalidOperationException("Selectable item already exists in the GridSelectableGroup");
// Make sure the row/column index is available
if (_items[rowIndex, columnIndex] != null)
throw new InvalidOperationException(
string.Format("An item already exists at row {0} column {1} in the GridSelectableGroup", rowIndex, columnIndex));
// If we got here, the specified spot in the grid is free
_items.Add(selectable, null, rowIndex, columnIndex);
}
示例3: IsSelectedItemMenuOperator
protected override bool IsSelectedItemMenuOperator(ISelectable selected) {
if (_universeCenterMenuOperator.IsSelected) {
D.AssertEqual(_universeCenterMenuOperator, selected as UniverseCenterItem);
return true;
}
return false;
}
示例4: IsSelectedItemMenuOperator
protected sealed override bool IsSelectedItemMenuOperator(ISelectable selected) {
if (_planetoidMenuOperator.IsSelected) {
D.AssertEqual(_planetoidMenuOperator, selected as APlanetoidItem);
return true;
}
return false;
}
示例5: IsSelectedItemMenuOperator
protected override bool IsSelectedItemMenuOperator(ISelectable selected) {
if (_fleetMenuOperator.IsSelected) {
D.AssertEqual(_fleetMenuOperator, selected as FleetCmdItem);
return true;
}
return false;
}
示例6: AddToSelection
/// <summary>
/// 添加设计组件
/// </summary>
/// <param name="item"></param>
public void AddToSelection(ISelectable item)
{
if (item is IGroupable)
{
IEnumerable<IGroupable> list = designerCanvas.Children.OfType<IGroupable>();
List<IGroupable> groupItems = new List<IGroupable>();
foreach (IGroupable groupitem in list)
{
if (groupitem.CurrentSerialNumber == (item as IGroupable).CurrentSerialNumber)
{
groupItems.Add(groupitem);
break;
}
}
foreach (ISelectable groupItem in groupItems)
{
groupItem.IsSelected = true;
CurrentSelection.Add(groupItem);
}
}
else
{
item.IsSelected = true;
CurrentSelection.Add(item);
}
}
示例7: select
public void select(ISelectable select)
{
currentSelection.Selected = false;
currentSelection = select;
currentSelection.Selected = true;
panel1.Invalidate();
}
示例8: ToggleSelection
public void ToggleSelection(ISelectable item)
{
if (ActiveItems.Contains(item))
RemoveActive(item);
else
AddActive(item);
}
示例9: SetHoverItem
public void SetHoverItem(ISelectable item)
{
var prevHoverItem = HoverItem;
HoverItem = item;
if (HoverItem != null) HoverItem.AddHighlightColor(HoverColor);
if (prevHoverItem != null && item != prevHoverItem) prevHoverItem.RemoveHighlightColor(HoverColor);
}
示例10: IsSelectedItemMenuOperator
protected override bool IsSelectedItemMenuOperator(ISelectable selected) {
if (_baseMenuOperator.IsSelected) {
D.AssertEqual(_baseMenuOperator, selected as AUnitBaseCmdItem);
return true;
}
return false;
}
示例11: CheckInteraction
public override bool CheckInteraction(ISelectable[] selectedObjects, IInteractable obj)
{
if (selectedObjects[0].GetType() == typeof(Unit) && obj.GetType() == typeof(Map)) {
return true;
}
return false;
}
示例12: selectSingle
/// <summary>
/// Selects an object an unselects all other
/// </summary>
private void selectSingle(ISelectable selected)
{
foreach (var item in selectables) {
if (item == selected) {
if (!item.IsSelected) item.OnSelect();
} else item.OnDeselect();
}
}
示例13: AddItem
public void AddItem(ISelectable item) {
if (!items.Contains(item)) {
items.Add(item);
item.SetSelected(false);
item.SetSelectable(true);
item.OnSelected += SetSelected;
}
}
示例14: TryIsSelectedItemAccessAttempted
//protected override CtxObject ValidateAndAcquireCtxObject() {
// // the system's CtxObject, not the system's base's CtxObject - provides proper menu positioning
// return UnityUtility.ValidateMonoBehaviourPresence<CtxObject>(_system.gameObject);
//}
//public override void OnRightPressRelease() { // must override to test for the system being selected
// if (_system.IsSelected) {
// D.Assert(_system.Owner.IsPlayer);
// _accessSource = AccessSource.Local;
// _playerRemoteAccessItem = null;
// Show(true);
// return;
// }
// var selected = SelectionManager.Instance.CurrentSelection;
// var selectedFleet = selected as FleetCommandItem;
// if (selectedFleet != null && selectedFleet.Owner.IsPlayer) {
// // a remote player owned fleet is selected
// _accessSource = AccessSource.RemoteFleet;
// _playerRemoteAccessItem = selectedFleet;
// Show(true);
// return;
// }
// var selectedShip = selected as ShipItem;
// if (selectedShip != null && selectedShip.Owner.IsPlayer) {
// // a remote player owned ship is selected
// _accessSource = AccessSource.RemoteShip;
// _playerRemoteAccessItem = selectedShip;
// Show(true);
// return;
// }
// _accessSource = AccessSource.None;
// _playerRemoteAccessItem = null;
//}
protected override bool TryIsSelectedItemAccessAttempted(ISelectable selected) {
if (_system.IsSelected) {
D.Assert(_system == selected as SystemItem);
D.Assert(_system.Owner.IsPlayer);
return true;
}
return false;
}
示例15: SetSelected
public void SetSelected(ISelectable item) {
if ( !items.Contains(item)) return;
selectedItem = item;
foreach(ISelectable i in items) {
if (i != item) {
i.SetSelected(false);
}
}
Debug.Log(string.Format("ISelectable `{0}' was selected.",item.ToString()));
}