コード例 #1
0
        protected override void FillEditCtrls()
        {
            base.FillEditCtrls();

            Vector2 ptStart = this.getEditPtStart();
            Rect    rcLM    = new Rect(ptStart.x, ptStart.y, 40, 20);
            Label   lmethod = new Label("子树:", this.eWin, rcLM, null);

            this._editCtrls.Add(lmethod);

            Rect rcDDL = new Rect(ptStart.x + 42, ptStart.y, this.position.width - 46 - this._rcBar.width, 22);

            ptStart.y += 22;

            int nIndex = 0;

            if (this._curSubTree == null)
            {
                if (this._cfg != null && this._cfg.Keys.Contains("subtree"))
                {
                    this._curSubTree = (string)this._cfg ["subtree"];
                }
            }

            if (this._curSubTree != null)
            {
                nIndex = SubTreeDefine.LstSubTrees.FindIndex(delegate(SubTreeDefine s) {
                    return(s.strName == this._curSubTree);
                });
            }

            this.ddlSubTree = new DropdownList <SubTreeDefine>(this.eWin, rcDDL, null, SubTreeDefine.LstSubTrees, nIndex);
            this.ddlSubTree.OnSelectChange = new DropdownList <SubTreeDefine> .DropDownListDelegate(OnSelectSubTreeChange);

            this._editCtrls.Add(ddlSubTree);
        }
コード例 #2
0
        private void _FillMethod()
        {
            Vector2 ptStart = this.getEditPtStart();
            Rect    rcLM    = new Rect(ptStart.x, ptStart.y, 40, 20);
            Label   lmethod = new Label("方法:", this.eWin, rcLM, null);

            this._editCtrls.Add(lmethod);

            Rect rcDDL = new Rect(ptStart.x + 42, ptStart.y, this.position.width - 46 - this._rcBar.width, 22);

            ptStart.y += 22;

            int          nIndex = 0;
            MethodDefine mf     = MethodDefine.LstMethods[0];

            if (this._curMethod == null)
            {
                if (this._cfg != null && this._cfg.Keys.Contains("method"))
                {
                    this._curMethod = (string)this._cfg ["method"];
                }
            }

            if (this._curMethod != null)
            {
                nIndex = MethodDefine.LstMethods.FindIndex(delegate(MethodDefine s) {
                    return(s.strName == this._curMethod);
                });
                mf = MethodDefine.LstMethods.Find(delegate(MethodDefine s) {
                    return(s.strName == this._curMethod);
                });
            }

            ddlMethod = new DropdownList <MethodDefine>(this.eWin, rcDDL, null, MethodDefine.LstMethods, nIndex);
            ddlMethod.OnSelectChange = new DropdownList <MethodDefine> .DropDownListDelegate(OnSelMethodChange);

            this._editCtrls.Add(ddlMethod);

            for (int i = 0; i < mf.lstArgType.Count; i++)
            {
                string strArg = "";
                string ka     = "arg" + (i + 1).ToString();
                if (this._cfg != null && this._cfg.Keys.Contains(ka))
                {
                    string t = mf.lstArgType[i];
                    LogUtil.Debug(t);
                    if (t == "string")
                    {
                        strArg = (string)this._cfg[ka];
                    }
                    else if (t == "float")
                    {
                        try{
                            strArg = ((double)this._cfg[ka]).ToString();
                        }catch (Exception e) {
                            int tmp = (int)this._cfg[ka];
                            strArg = ((double)tmp).ToString();
                        }
                    }
                    else if (t == "int")
                    {
                        strArg = ((int)this._cfg[ka]).ToString();
                    }
                    else if (t == "bool")
                    {
                        strArg = (bool)this._cfg[ka] ? "true" : "false";
                    }
                    else
                    {
                        LogUtil.Debug("Error arguement type" + t.ToString());
                    }
                }

                Rect  rcLA  = new Rect(ptStart.x, ptStart.y + i * 22, 40, 20);
                Label label = new Label("参数" + (i + 1).ToString() + ":", this.eWin, rcLA, null);
                this._editCtrls.Add(label);

                Rect      rcTF = new Rect(ptStart.x + 42, ptStart.y + i * 21, this.position.width - 46 - this._rcBar.width, 20);
                Textfield tf   = new Textfield(strArg, this.eWin, rcTF, null);
                this.lstTextfieldArgs.Add(tf);
                this._editCtrls.Add(tf);
            }
            ptStart.y += mf.lstArgType.Count * 21;
        }