Esempio n. 1
0
    public void OnGUI(FB.FFSM.BlockFunc func)
    {
        EditorGUILayout.HelpBox("这个功能是检测输入并跳出Block", MessageType.Info);
        func.haveexit = true;

        {
            var text = EditorGUILayout.TextField("输入指令", func.strParam0.ToUpper());
            if (text != func.strParam0)
            {
                func.strParam0 = text;
                EditorUtility.SetDirty(Window_StateTable.stateTable);
            }
        }
        func.vecParam0.x = EditorGUILayout.FloatField("指令时间:", func.vecParam0.x);

        bool isHitOn = (func.intParam1 == 1) ? true : false;

        isHitOn        = EditorGUILayout.Toggle("是否击中:", isHitOn);
        func.intParam1 = (isHitOn) ? 1 : 0;

        GUILayout.BeginHorizontal();
        {
            List <string> tempstr = new List <string>();
            for (int i = 0; i < Window_StateTable.selectBlock.exits.Count; i++)
            {
                tempstr.Add(i.ToString());
            }
            string butt_str = "选择";
            if (GUILayout.Button(butt_str, GUILayout.Width(80)))
            {
                //如果此block没有配置exit就会添加一个next的选项最终会指向下一个block
                Window_PickExit.ShowExitFunc((exit) =>
                {
                    exitfunc = exit;
                });
            }

            if (exitfunc != null)
            {
                if (exitfunc != null)
                {
                    func.strParam1 = exitfunc.statename;
                    func.intParam0 = exitfunc.blockindex;
                }
            }

            EditorUtility.SetDirty(Window_StateTable.stateTable);
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginVertical();
        GUILayout.Label("跳出到状态:   " + func.strParam1);
        GUILayout.Label("blockIndex:   " + func.intParam0.ToString());
        GUILayout.EndVertical();
    }
Esempio n. 2
0
    public void OnGUI(FB.FFSM.BlockFunc func)
    {
        EditorGUILayout.HelpBox("这个功能是检测输入并跳出Block", MessageType.Info);
        func.haveexit = true;

        func.haveexit = true;
        {
            FB.FFSM.BlockParser_WhenExit.WhenExit exit = (FB.FFSM.BlockParser_WhenExit.WhenExit)func.intParam1;
            var exit2 = (FB.FFSM.BlockParser_WhenExit.WhenExit)EditorGUILayout.EnumPopup("条件", exit);

            if (exit2 != exit)
            {
                func.intParam1 = (int)exit2;
                EditorUtility.SetDirty(Window_StateTable.stateTable);
            }
        }
        GUILayout.BeginHorizontal();
        {
            List <string> tempstr = new List <string>();
            for (int i = 0; i < Window_StateTable.selectBlock.exits.Count; i++)
            {
                tempstr.Add(i.ToString());
            }
            string butt_str = "选择";
            if (GUILayout.Button(butt_str, GUILayout.Width(80)))
            {
                //如果此block没有配置exit就会添加一个next的选项最终会指向下一个block
                Window_PickExit.ShowExitFunc((exit) =>
                {
                    exitfunc = exit;
                });
            }


            if (exitfunc != null)
            {
                func.strParam1 = exitfunc.statename;
                func.intParam0 = exitfunc.blockindex;
                exitfunc       = null;
            }


            EditorUtility.SetDirty(Window_StateTable.stateTable);
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginVertical();

        GUILayout.Label("跳出到状态:   " + func.strParam1);
        GUILayout.Label("blockIndex:   " + func.intParam0.ToString());
        GUILayout.EndVertical();
    }
Esempio n. 3
0
    public void OnGUI(FB.FFSM.BlockFunc func)
    {
        EditorGUILayout.HelpBox("这个功能是攻击判定", MessageType.Info);
        func.haveexit = string.IsNullOrEmpty(func.strParam1);
        GUILayout.BeginVertical();
        bool ishit = (func.intParam3 == 1) ? true : false;

        ishit          = EditorGUILayout.Toggle("是否击中", ishit);
        func.intParam3 = (ishit) ? 1 : 0;

        func.strParam0 = EditorGUILayout.TextField("属性:", func.strParam0);

        FB.FFSM.BlockParser_PropExit.PropOp exit = (FB.FFSM.BlockParser_PropExit.PropOp)func.intParam2;
        exit = (FB.FFSM.BlockParser_PropExit.PropOp)EditorGUILayout.EnumPopup(exit);
        if ((int)exit != func.intParam2)
        {
            func.intParam2 = (int)exit;
        }
        func.intParam1 = EditorGUILayout.IntField("数值:", func.intParam1);



        GUILayout.BeginHorizontal();
        {
            List <string> tempstr = new List <string>();
            for (int i = 0; i < Window_StateTable.selectBlock.exits.Count; i++)
            {
                tempstr.Add(i.ToString());
            }
            string butt_str = "选择";
            if (GUILayout.Button(butt_str, GUILayout.Width(80)))
            {
                //如果此block没有配置exit就会添加一个next的选项最终会指向下一个block
                Window_PickExit.ShowExitFunc((_exit) =>
                {
                    exitfunc = _exit;
                });
            }

            if (exitfunc != null)
            {
                func.strParam1 = exitfunc.statename;
                func.intParam0 = exitfunc.blockindex;
            }
        }

        //int id = EditorGUILayout.IntField(_selectBlock.exits[ie].blockindex, GUILayout.Width(120));
        GUILayout.EndHorizontal();
        GUILayout.Label("跳出到状态:   " + func.strParam1);
        GUILayout.Label("blockIndex:   " + func.intParam0.ToString());
        GUILayout.EndVertical();
    }
Esempio n. 4
0
 public void Init()
 {
     exitfunc = null;
 }
Esempio n. 5
0
    void OnGUI_PickExitFunc()
    {
        FB.FFSM.BlockExit exit = new FB.FFSM.BlockExit();
        //计算list
        int exitcount = Window_StateTable.selectBlock.exits.Count;

        if (Window_StateTable.selectBlock.exits.Count == 0)
        {
            for (int i = 0; i < Window_StateTable.selectItem.blocks.Count; i++)
            {
                if (Window_StateTable.selectBlock == Window_StateTable.selectItem.blocks[i])
                {
                    if (i + 1 <= Window_StateTable.selectItem.blocks.Count)
                    {
                        picklist = new List <string>()
                        {
                            "next"
                        };

                        exit.statename  = Window_StateTable.selectItem.name;
                        exit.blockindex = i + 1;
                    }
                }
                else if (Window_StateTable.selectBlock == Window_StateTable.selectItem.blocks[Window_StateTable.selectItem.blocks.Count - 1])
                {
                    if (EditorUtility.DisplayDialog("错误", "我是最后一个block,请为我配一个exit", "是的"))
                    {
                        return;
                    }
                }
            }
        }
        else
        {
            picklist = new List <string>();
            for (int i = 0; i < exitcount; i++)
            {
                if (Window_StateTable.selectBlock.exits[i].statename != null && Window_StateTable.selectBlock.exits[i].blockindex != null)
                {
                    picklist.Add(((Window_StateTable.selectBlock.exits[i].statename == "")?"请先选择exit的状态名":Window_StateTable.selectBlock.exits[i].statename) + " | " + Window_StateTable.selectBlock.exits[i].blockindex.ToString());
                }
            }
        }

        pos = UnityEngine.GUILayout.BeginScrollView(pos);


        if (picklist != null)
        {
            if (picklist[0] == "next")
            {
                if (GUILayout.Button("Next"))
                {
                    this.Close();
                    _funccb(exit);
                }
            }
            else
            {
                for (int i = 0; i < picklist.Count; i++)
                {
                    if (showtext != null)
                    {
                        if (color != null)
                        {
                            GUI.backgroundColor = color[i];
                        }
                        if (UnityEngine.GUILayout.Button(showtext[i]))
                        {
                            this.Close();
                            _funccb(Window_StateTable.selectBlock.exits[i]);
                        }
                    }
                    else
                    {
                        if (color != null)
                        {
                            GUI.backgroundColor = color[i];
                        }
                        if (UnityEngine.GUILayout.Button(picklist[i]))
                        {
                            this.Close();
                            _funccb(Window_StateTable.selectBlock.exits[i]);
                        }
                    }
                }
            }
        }


        if (UnityEngine.GUILayout.Button("==Close=="))
        {
            this.Close();
            _funccb(null);
        }
        GUILayout.EndScrollView();
    }