Exemple #1
0
    // Use this for initialization
    void Start()
    {
        sco = GameObject.FindGameObjectWithTag("Player").GetComponent <score>();
        GameObject menu = GameObject.FindGameObjectWithTag("endmenu");

        menucon = menu.transform.GetChild(1).GetComponent <menucontrol>();
    }
        //动态绑定菜单栏目列表
        private void CreateMenuCategoryList()
        {
            string      hdnSeletedClientID = "";
            string      hdnRightClientID   = "";
            menucontrol menuCtrl           = (menucontrol)LoadControl("..\\usercontrol\\menucontrol.ascx");

            menuCtrl.TopMenuId = DataConvert.GetInt32(ddlTopMenus.SelectedValue);
            PlaceHolder1.Controls.Add(menuCtrl);
            HtmlInputHidden hdnValue     = (HtmlInputHidden)menuCtrl.FindControl("hdnSelected");
            HtmlSelect      hdnRightList = (HtmlSelect)menuCtrl.FindControl("lstRight");

            hdnSeletedClientID = hdnSeletedClientID + hdnValue.ClientID + ",";
            hdnRightClientID   = hdnRightClientID + hdnRightList.ClientID + ",";

            btnSave.Attributes.Add("onclick", "return Save('" + ddlTopMenus.ClientID + "','" + hdnSeletedClientID + "','" + hdnAllSelected.ClientID + "');");
            btnReset.Attributes.Add("onclick", "listClear('" + hdnRightClientID + "','" + hdnSeletedClientID + "','" + hdnAllSelected.ClientID + "');return false;");
        }