示例#1
0
        protected override void ClearEditCtrls()
        {
            base.ClearEditCtrls();

            this._tfNum      = null;
            this._tgConditon = null;
        }
示例#2
0
        protected override void FillEditCtrls()
        {
            base.FillEditCtrls();

            Vector2 ptStart = this.getEditPtStart();

            Rect  rc = new Rect(ptStart.x, ptStart.y, 80, 20);
            Label l  = new Label("循环的次数:", this.eWin, rc, null);

            this._editCtrls.Add(l);

            string strNum = "";

            if (this._cfg != null && this._cfg.Keys.Contains("num"))
            {
                int num = (int)this._cfg["num"];
                strNum = num.ToString();
            }
            rc          = new Rect(ptStart.x + 80, ptStart.y, 100, 20);
            this._tfNum = new Textfield(strNum, this.eWin, rc, null);
            this._editCtrls.Add(this._tfNum);

            ptStart.y += 22;

            //condition
            bool b = false;

            if (this._cfg != null && this._cfg.Keys.Contains("condition"))
            {
                b = (bool)this._cfg["condition"];
            }
            rc = new Rect(ptStart.x, ptStart.y, 180, 20);
            this._tgConditon = new Toggle("直到子节点返回成功", b, this.eWin, rc, null);
            this._editCtrls.Add(this._tgConditon);
        }
示例#3
0
        protected virtual void FillEditCtrls()
        {
            this.BeforeFillEditCtrls();

            //for weight selector special proccess
            if (this.nodeParent != null && this.nodeParent.nodeCategory == "weightselector")
            {
                this.position.height += 22;
                this._CalcBaseRects();
            }

            Rect   rcBtn   = new Rect(this.position.x + 50, this.position.y + BTNode.DefaultHeight + 2, 80, BTNode.SaveBtnHeight);
            Button btnSave = new Button("Save", this.eWin, rcBtn, null);

            btnSave.OnClick = new Button.ButtonDelegate(OnBtnSave);
            this._editCtrls.Add(btnSave);

            float y         = this.position.y + BTNode.DefaultHeight + BTNode.SaveBtnHeight + 4;
            float x         = this.position.x + this._rcBar.width + 2;
            Rect  rcLabel   = new Rect(x, y, 40, 20);
            Label labelName = new Label("名称:", this.eWin, rcLabel, null);

            this._editCtrls.Add(labelName);

            string strDiyName = "";

            if (this._cfg != null && this._cfg.Keys.Contains("diyname"))
            {
                strDiyName = (string)this._cfg["diyname"];
            }
            float wtf         = this.position.width - 46 - this._rcBar.width;
            Rect  rcTextfield = new Rect(x + 40, y, wtf, 20);

            this._tfName = new Textfield(strDiyName, this.eWin, rcTextfield, null);
            this._editCtrls.Add(this._tfName);

            //for weight selector special proccess
            if (this.nodeParent != null && this.nodeParent.nodeCategory == "weightselector")
            {
                y += 22;
                Rect  rcWL   = new Rect(x, y, 40, 20);
                Label labelW = new Label("权重:", this.eWin, rcWL, null);
                this._editCtrls.Add(labelW);

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

                Rect rctfW = new Rect(x + 40, y, wtf, 20);
                this._tfWeight = new Textfield(strWeight, this.eWin, rctfW, null);
                this._editCtrls.Add(this._tfWeight);
            }
        }
示例#4
0
        protected override void OnProcBtnSave(JsonWriter w)
        {
            base.OnProcBtnSave(w);

            w.WritePropertyName("revert");
            bool   bRevert = this._ckRevert.IsCheck;
            string str     = bRevert ? "y" : "n";

            w.Write(str);

            w.WritePropertyName("method");
            MethodDefine md = this.ddlMethod.selectItem;

            w.Write(md.strName);

            for (int i = 0; i < this.lstTextfieldArgs.Count; i++)
            {
                Textfield tf = this.lstTextfieldArgs[i];
                if (tf.text != "")
                {
                    w.WritePropertyName("arg" + (i + 1).ToString());
                    string strType = (string)md.lstArgType[i];
                    if (strType == "float")
                    {
                        w.Write(double.Parse(tf.text));
                    }
                    else if (strType == "bool")
                    {
                        if (tf.text == "true")
                        {
                            w.Write(true);
                        }
                        else
                        {
                            w.Write(false);
                        }
                    }
                    else if (strType == "int")
                    {
                        w.Write(int.Parse(tf.text));
                    }
                    else if (strType == "string")
                    {
                        w.Write(tf.text);
                    }
                }
            }
        }
示例#5
0
        protected override void FillEditCtrls()
        {
            base.FillEditCtrls();

            Vector2 ptStart = this.getEditPtStart();

            Rect  rc = new Rect(ptStart.x, ptStart.y, 80, 20);
            Label l  = new Label("逻辑运算符:", this.eWin, rc, null);

            this._editCtrls.Add(l);

            string strLogic = "";

            if (this._cfg != null && this._cfg.Keys.Contains("logic"))
            {
                strLogic = (string)this._cfg["logic"];
            }
            rc            = new Rect(ptStart.x + 80, ptStart.y, 100, 20);
            this._tfLogic = new Textfield(strLogic, this.eWin, rc, null);
            this._editCtrls.Add(this._tfLogic);
        }
示例#6
0
        protected override void FillEditCtrls()
        {
            base.FillEditCtrls();

            Vector2 ptStart = this.getEditPtStart();

            Rect  rc = new Rect(ptStart.x, ptStart.y, 80, 20);
            Label l  = new Label("循环的次数:", this.eWin, rc, null);

            this._editCtrls.Add(l);

            string strNum = "";

            if (this._cfg != null && this._cfg.Keys.Contains("num"))
            {
                int num = (int)this._cfg["num"];
                strNum = num.ToString();
            }
            rc          = new Rect(ptStart.x + 80, ptStart.y, 100, 20);
            this._tfNum = new Textfield(strNum, this.eWin, rc, null);
            this._editCtrls.Add(this._tfNum);
        }
示例#7
0
        protected override void FillEditCtrls()
        {
            base.FillEditCtrls();

            Vector2 ptStart = this.getEditPtStart();

            Rect  rc = new Rect(ptStart.x, ptStart.y, 80, 20);
            Label l  = new Label("持续时间:", this.eWin, rc, null);

            this._editCtrls.Add(l);

            string strTime = "";

            if (this._cfg != null && this._cfg.Keys.Contains("tmspan"))
            {
                double span = (double)this._cfg["tmspan"];
                strTime = span.ToString();
            }
            rc           = new Rect(ptStart.x + 80, ptStart.y, 100, 20);
            this._tfTime = new Textfield(strTime, this.eWin, rc, null);
            this._editCtrls.Add(this._tfTime);
        }
示例#8
0
        protected override void ClearEditCtrls()
        {
            base.ClearEditCtrls();

            this._tfLogic = null;
        }
示例#9
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;
        }