当前位置: 首页>>代码示例>>C#>>正文


C# ISelectable.Select方法代码示例

本文整理汇总了C#中ISelectable.Select方法的典型用法代码示例。如果您正苦于以下问题:C# ISelectable.Select方法的具体用法?C# ISelectable.Select怎么用?C# ISelectable.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISelectable的用法示例。


在下文中一共展示了ISelectable.Select方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ChangeSelection

 public void ChangeSelection(ISelectable newOne)
 {
     if (selected != null) selected.DeSelect();
     selected = newOne;
     selected.Select();
     //Debug.Log("Is Selected null? " + ((selected == null).ToString()));
     
     if (selected is ExtractiveHouse)
     {
         RedrawExtractivePanel();
         ((House)selected).someChanges += RedrawExtractivePanel;
     }
     if (selected is ProcessHouse)
     {
         RedrawProcessPanel();
         ((House)selected).someChanges += RedrawProcessPanel;
     }
     else if (selected is Store) {
         RedrawStorePanel();
         ((Store)selected).someChanges += RedrawStorePanel;
     }
     
     
 }
开发者ID:kosstbarz,项目名称:Scripts,代码行数:24,代码来源:SelectedPanel.cs

示例2: Select

    private void Select(ISelectable selectable)
    {
        if (lastSelected != null)
            lastSelected.Unselect();

        if (selectable != null)
        {
            if (lastSelected != selectable)
            {
                selectable.Select();
                lastSelected = selectable;
            }
            else
            {
                selectable.Unselect();
                lastSelected = null;
            }
        }
    }
开发者ID:kaza,项目名称:ContainerCity,代码行数:19,代码来源:Targeting.cs

示例3: selectItem

 private void selectItem(ISelectable item)
 {
     if (item == null) throw new ArgumentNullException("item");
     if (!item.IsSelected)
     {
         item.Select();
     }
 }
开发者ID:osama-abuomar,项目名称:TownDefenders-XNA4Game,代码行数:8,代码来源:UnitSelectionManager.cs

示例4: flipSelectionState

 private void flipSelectionState(ISelectable item)
 {
     if (item.IsSelected)
     {
         item.DeSelect();
     }
     else
     {
         item.Select();
     }
 }
开发者ID:osama-abuomar,项目名称:TownDefenders-XNA4Game,代码行数:11,代码来源:UnitSelectionManager.cs

示例5: SetSelected

        /// <summary>
        /// Implements the setter for SelectedItemVisual.
        /// </summary>
        /// <param name="selected"></param>
        void SetSelected(ISelectable selected)
        {
            // deselect existing item
            if (Selected != null &&
                selected == null)
                Selected.Deselect(UIBinding);

            // select new item
            if (selected != null &&
                selected != Selected)
                selected.Select(UIBinding);
        }
开发者ID:nxkit,项目名称:nxkit,代码行数:16,代码来源:Select1.cs

示例6: ExtractField

        private dynamic ExtractField(ISelectable item, Page page, DataToken field, int index)
        {
            ISelector selector = SelectorUtil.Parse(field.Selector);
            if (selector == null)
            {
                return null;
            }

            var f = field as Field;
            List<Formatter.Formatter> formatters = GenerateFormatter(f?.Formatters);

            bool isEntity = field is Entity;

            if (!isEntity)
            {
                string tmpValue;
                if (selector is EnviromentSelector)
                {
                    var enviromentSelector = selector as EnviromentSelector;
                    tmpValue = GetEnviromentValue(enviromentSelector.Field, page, index);
                    foreach (var formatter in formatters)
                    {
                        tmpValue = formatter.Formate(tmpValue);
                    }
                    return tmpValue;
                }
                else
                {
                    bool needPlainText = (((Field)field).Option == PropertyExtractBy.ValueOption.PlainText);
                    if (field.Multi)
                    {
                        var propertyValues = item.SelectList(selector).Nodes();

                        List<string> results = new List<string>();
                        foreach (var propertyValue in propertyValues)
                        {
                            string tmp = propertyValue.GetValue(needPlainText);
                            foreach (var formatter in formatters)
                            {
                                tmp = formatter.Formate(tmp);
                            }
                            results.Add(tmp);
                        }
                        return new JArray(results);
                    }
                    else
                    {
                        bool needCount = (((Field)field).Option == PropertyExtractBy.ValueOption.Count);
                        if (needCount)
                        {
                            var propertyValues = item.SelectList(selector).Nodes();
                            return propertyValues != null ? propertyValues.Count.ToString() : "-1";
                        }
                        else
                        {
                            tmpValue = item.Select(selector)?.GetValue(needPlainText);
                            tmpValue = formatters.Aggregate(tmpValue, (current, formatter) => formatter.Formate(current));
                            return tmpValue;
                        }
                    }
                }
            }
            else
            {
                if (field.Multi)
                {
                    var propertyValues = item.SelectList(selector).Nodes();
                    JArray objs = new JArray();
                    var selectables = item.SelectList(selector).Nodes();
                    foreach (var selectable in selectables)
                    {
                        JObject obj = new JObject();

                        foreach (var child in ((Entity)field).Fields)
                        {
                            obj.Add(child.Name, ExtractField(selectable, page, child, 0));
                        }
                        objs.Add(obj);
                    }
                    return objs;
                }
                else
                {
                    JObject obj = new JObject();
                    var selectable = item.Select(selector);
                    foreach (var child in ((Entity)field).Fields)
                    {
                        obj.Add(child.Name, ExtractField(selectable, page, field, 0));
                    }
                    return obj;
                }
            }
        }
开发者ID:yalunwang,项目名称:DotnetSpider,代码行数:93,代码来源:EntityExtractor.cs


注:本文中的ISelectable.Select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。