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


C# TreeNode.SetOwner方法代码示例

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


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

示例1: ImmigratingAgentArriving

    //New immigrants arriving, add layer and upgrade excisting house
    public void ImmigratingAgentArriving(Agent immigrant)
    {
        //find house to upgrade
        //increase layer
        //add layer in right color to it

        //Gå igenom alla bostadshus clanen har och om man hittar ett med children mindre än 3 så lägg till ett floor på det huset
        //Debug.Log ("??????????????????????????Immigrant arriving adding floor");

        if(!blackBoard.GetColorsInClan(clan).Contains(immigrant.getAgentType()))
        {
            blackBoard.AddColorToClan(clan, immigrant.getAgentType());
        }

        foreach(Transform building in GameObject.Find(clan).transform.FindChild("Buildings"))
        {
            string buildingName = building.name.Substring(building.name.Length - 5, 5);
            if(buildingName.Substring(buildingName.Length-5, buildingName.Length) == "House")
            {
                int numberFloors = ((Building)building.GetComponent("Building")).GetFloors();

                if(numberFloors < 3) //max floors = 3
                {
                    goalIndex++;
                    planner.SetGoalWorldState(new WorldState(char.ToLower(immigrant.getAgentType()[0]) + immigrant.getAgentType().Substring(1) + "FloorIsBuilt", new WorldStateValue(true)));
                    plan = planner.RunAStar((WorldState)blackBoard.GetFact(clan, "currentWorldState")[0].GetFactValue());
                    //Debug.Log ("***********Plan Size " + plan.Count);

                    List<TreeNode> planList = new List<TreeNode>();
                    Vector3 positionOfHouseToUpgrade = building.position;

                    //Debug.Log("6666666666666666666666 floor ska byggas på " + positionOfHouseToUpgrade + " " + building.name);

                    TreeNode tempNode = new TreeNode(positionOfHouseToUpgrade, plan[1].GetName(), null, goalIndex);
                    tempNode.SetOwner(immigrant);

                    planList.Add(tempNode);

                    tempNode = new TreeNode(positionOfHouseToUpgrade, plan[0].GetName(), planList[0], goalIndex);
                    tempNode.SetOwner(immigrant);

                    planList.Add(tempNode);

                    blackBoard.AddToTaskTree(clan, planList);

                    numberFloors++;
                    ((Building)building.GetComponent("Building")).SetFloors(numberFloors);

                    break;
                }
            }
        }
    }
开发者ID:RikardGehlin,项目名称:Exjobb,代码行数:54,代码来源:BuildingCommanderBlueClan.cs

示例2: OnInit

        /// <summary>
        /// ��ʼ������ؼ��첽�ش��������Page ITreeViewAsyncCallback �ӿڵ�GetChildNode���������Խڵ�����
        /// </summary>
        /// <param name="e"></param>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit (e);

            if( Page.Request.QueryString["TreeView_ClientID"] != null )
            {
                this._IsCallback = true ;
            }

            if( Page.Request.QueryString["TreeView_ClientID"] == this.ClientID )
            {
                this._IsCallTarget = true ;

                this.ImageFolderUrl = base.ResolveUrl( this.ImageFolderUrl );

                this.EnableAsyncLoad = true ;

                if( Page.Request.QueryString["TreeView_ShowLines"] == "true" )
                    this._ShowLines = true ;
                else
                    this._ShowLines = false ;

                if( Page.Request.QueryString["TreeView_MultiSelect"] == "true" )
                    this._MultiSelect= true ;
                else
                    this._MultiSelect = false ;

                if( Page.Request.QueryString["TreeView_AutoSelectChildNodes"] == "true" )
                    this._AutoSelectChildNodes = true ;
                else
                    this._AutoSelectChildNodes = false ;

                ITreeViewAsyncCallback c ;

                if( this is ITreeViewAsyncCallback )
                    c = this as ITreeViewAsyncCallback ;
                else if( Page  is ITreeViewAsyncCallback   )
                    c = Page as ITreeViewAsyncCallback ;
                else
                    throw new Exception( "Page û��ʵ�� ITreeViewAsyncCallback �ӿڣ������첽��������" );

                //TreeNodeCollection nodes = c.GetChildNode( new TreeNode( Page.Request.QueryString["TreeViewLoadValue"] , "" ) ) ;

                TreeNode parentNode = null ;

                if( Page.Request.QueryString["TreeView_LoadRoot"] != "true" )
                {
                    parentNode = new TreeNode( Page.Request.QueryString["TreeView_NodeValue"] , Page.Request.QueryString["TreeView_NodeText"] );

                    parentNode.SetOwner( this ) ;

                    if( Page.Request.QueryString["TreeView_NodeChecked"] == "true" )
                        parentNode.Checked = true ;

                    //parentNode.Id = Page.Request.QueryString["TreeView_NodeID"] ;
                }

                Page.Response.Clear() ;

                //Page.Response.Write( Page.Request.QueryString.ToString() );

                if( _AsyncCallbackType == AsyncCallbackType.GetChildNodes )
                {
                    this._ChildNodes = c.TreeViewGetChildNodes( parentNode ) ;

                    OnTreeNodeCreated( _ChildNodes ) ;

                    HtmlTextWriter writer = new HtmlTextWriter( Page.Response.Output ) ;

                    RenderNodes( writer ) ;
                }
                else
                {
                    Page.Response.Write( c.TreeViewGetChildHtml( parentNode ) ) ;
                }

                //Page.Response.Flush();

                Page.Response.End();
            }
        }
开发者ID:porter1130,项目名称:C-A,代码行数:85,代码来源:TreeView.cs

示例3: RaiseTreeNodeCreatedEvent

        /// <summary>
        /// ����TreeNodeCreated�¼�,�ڹ������¼�
        /// </summary>
        /// <param name="node"></param>
        private void RaiseTreeNodeCreatedEvent( TreeNode node )
        {
            node.SetOwner( this );
            TreeNodeCreated( this , new TreeNodeCreatedEventArgs( node ) ) ;

            foreach( TreeNode n in node.ChildNodes )
            {
                n.SetOwner( this );
                RaiseTreeNodeCreatedEvent( n ) ;
            }
        }
开发者ID:porter1130,项目名称:C-A,代码行数:15,代码来源:TreeView.cs


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