//2层 全局事件，管理行动规则

{

    "ID": 2010204,

    "Specials": 

    {

        //static

        "staticTopY_offset":4,

        "staticDownY_offset":1,

        "max_X":5,

        //从上向下走

        //TopY_Dir_2010204

        //从下向上走

        //DownY_Dir_2010204



        //上次位置

        "X":0,

        "Y":0,



        //移动距离

        "dist_X":0,

        "dist_Y":0,



        //Y移动时的临时变量，方便缩减文本

        "Y_ite":0,

        "X_ite":0,

        "loop":0,

        "cur":0,

        





        "numbers":0

    },

    "Events": {

        //起始坐标

        "OnCreate":{

            "Actions":

            [

                {

                    "$type":"Share.CConfigSetSpecial",

                    "SpecialName":"X",

                    "SpecialValue":"playerpos(X)"

                },

                {

                    "$type":"Share.CConfigSetSpecial",

                    "SpecialName":"Y",

                    "SpecialValue":"playerpos(Y)"

                },

                {

                    //Y向上距离

                    "$type": "Share.CConfigSetHollowVariable",

                    "Key": "TopY_Dir_2010204",

                    "Value": "specials(staticTopY_offset)"

                },

                {

                    //Y向下距离

                    "$type": "Share.CConfigSetHollowVariable",

                    "Key": "DownY_Dir_2010204",

                    "Value": "specials(staticDownY_offset)"

                }

            ]

        },

        "OnPlayerMove": {

            //每次行动都会摧毁旁边格子  左或下

            "Actions": [

                //重置ite

                {

                    "$type":"Share.CConfigSetSpecial",

                    "SpecialName":"Y_ite",

                    "SpecialValue":0

                },

                {

                    "$type":"Share.CConfigSetSpecial",

                    "SpecialName":"X_ite",

                    "SpecialValue":0

                },

                //预处理 - 是否跳过逻辑

                {

                    "$type": "Share.CConfigJump",

                    "Jump": "OnEnd",

                    "Predicates":

                    [

                        {

                            "$type": "Share.CConfigEventByHollowVariable",

                            "Key": "TriggerSkip_2010204",

                            "CompareType": "Equal",

                            "Count": 1

                        }

                    ]

                },

                //计算本次位移距离

                {

                    "$type":"Share.CConfigSetSpecial",

                    "SpecialName":"dist_X",

                    "SpecialValue":"playerpos(X)-specials(X)"

                },

                {

                    "$type":"Share.CConfigSetSpecial",

                    "SpecialName":"dist_Y",

                    "SpecialValue":"playerpos(Y)-specials(Y)",

                    "Predicates":[

                        {

                            "$type":"Share.CConfigEventBySpecials",

                            "ParamName":"Y",

                            "Param":"playerpos(Y)",

                            "CompareType":"LessEqual"

                        }

                    ]

                },

                {

                    "$type":"Share.CConfigSetSpecial",

                    "SpecialName":"dist_Y",

                    "SpecialValue":"specials(Y)-playerpos(Y)",

                    "Predicates":[

                        {

                            "$type":"Share.CConfigEventBySpecials",

                            "ParamName":"Y",

                            "Param":"playerpos(Y)",

                            "CompareType":"Greater"

                        }

                    ]

                },

                //逻辑执行

                {

                    //左侧

                    "$type": "Share.CConfigJump",

                    "ID":101,

                    "Jump": "Func_LeftRight",

                    "Predicates": [

                        {

                            "$type":"Share.CConfigEventBySpecials",

                            "ParamName":"dist_X",

                            "Param":0,

                            "CompareType":"Greater"

                        }

                    ]

                },

                {

                    //上下

                    "$type": "Share.CConfigJump",

                    "ID":102,

                    "Jump": "Func_UpDown",

                    "Predicates": [

                        {

                            "$type":"Share.CConfigEventBySpecials",

                            "ParamName":"dist_Y",

                            "Param":0,

                            "CompareType":"Greater"

                        }

                    ]

                },

                {

                    //左侧

                    "$type": "Share.CConfigJump",

                    "Jump": "OnEnd"

                }

            ]

        },

        "OnEnd":{

            "Actions":

            [

                {

                    "$type":"Share.CConfigSetSpecial",

                    "SpecialName":"X",

                    "SpecialValue":"playerpos(X)"

                },

                {

                    "$type":"Share.CConfigSetSpecial",

                    "SpecialName":"Y",

                    "SpecialValue":"playerpos(Y)"

                }

            ]

        },

        "Func_UpDown":{

            //上下移动带有左右移动

            "Actions":

            [

                {

                    //上-->下

                    "$type": "Share.CConfigJump",

                    "Jump": "SubFunc_UpToDown",

                    "Predicates": [

                        {

                            "$type":"Share.CConfigEventBySpecials",

                            "ParamName":"Y",

                            "Param":"playerpos(Y)",

                            "CompareType":"Less"

                        }

                    ]

                },

                {

                    //下-->上

                    "$type": "Share.CConfigJump",

                    "Jump": "SubFunc_DownToUp",

                    "Predicates": [

                        {

                            "$type":"Share.CConfigEventBySpecials",

                            "ParamName":"Y",

                            "Param":"playerpos(Y)",

                            "CompareType":"GreaterEqual"

                        }

                    ]

                },

                {

                    "$type":"Share.CConfigSetSpecial",

                    "ID":103,

                    "SpecialName":"dist_Y",

                    "SpecialValue":"specials(dist_Y)-1"

                },

                {

                    "$type":"Share.CConfigSetSpecial",

                    "SpecialName":"Y_ite",

                    "SpecialValue":"specials(Y_ite)+1"

                },

                {

                    "$type":"Share.CConfigGoto",

                    "GotoID":102

                }

            ]

        },

        "Func_LeftRight":{

            "Actions": [

                //左侧所有

                {

                    "$type": "Share.CConfigSetMapState",

                    "NodeType":"All",

                    "X":"playerpos(X)-1-specials(X_ite)",

                    "Y":0,

                    "Position":"Absolute",

                    "Radius":0,

                    "Count":1,

                    "FromVisibleState":["Visible"],

                    "ToVisibleState":["VisibleByTriggerEvent"]

                },

                {

                    "$type": "Share.CConfigSetMapState",

                    "NodeType":"All",

                    "X":"playerpos(X)-1-specials(X_ite)",

                    "Y":1,

                    "Position":"Absolute",

                    "Radius":0,

                    "Count":1,

                    "FromVisibleState":["Visible"],

                    "ToVisibleState":["VisibleByTriggerEvent"]

                },

                {

                    "$type": "Share.CConfigSetMapState",

                    "NodeType":"All",

                    "X":"playerpos(X)-1-specials(X_ite)",

                    "Y":2,

                    "Position":"Absolute",

                    "Radius":0,

                    "Count":1,

                    "FromVisibleState":["Visible"],

                    "ToVisibleState":["VisibleByTriggerEvent"]

                },

                {

                    "$type": "Share.CConfigSetMapState",

                    "NodeType":"All",

                    "X":"playerpos(X)-1-specials(X_ite)",

                    "Y":3,

                    "Position":"Absolute",

                    "Radius":0,

                    "Count":1,

                    "FromVisibleState":["Visible"],

                    "ToVisibleState":["VisibleByTriggerEvent"]

                },

                {

                    "$type": "Share.CConfigSetMapState",

                    "NodeType":"All",

                    "X":"playerpos(X)-1-specials(X_ite)",

                    "Y":4,

                    "Position":"Absolute",

                    "Radius":0,

                    "Count":1,

                    "FromVisibleState":["Visible"],

                    "ToVisibleState":["VisibleByTriggerEvent"]

                },

                {

                    "$type":"Share.CConfigSetSpecial",

                    "SpecialName":"dist_X",

                    "SpecialValue":"specials(dist_X)-1"

                },

                {

                    "$type":"Share.CConfigSetSpecial",

                    "SpecialName":"X_ite",

                    "SpecialValue":"specials(X_ite)+1"

                },

                {

                    "$type":"Share.CConfigGoto",

                    "GotoID":101

                }

            ]

        },

        "SubFunc_UpToDown":{

            "Actions":[

                //初始化循环

                {

                    "$type":"Share.CConfigSetSpecial",

                    "SpecialName":"loop",

                    "SpecialValue":"specials(max_X)-playerpos(X)"

                },

                {

                    "$type":"Share.CConfigSetSpecial",

                    "SpecialName":"cur",

                    "SpecialValue":0

                },

                

                //==============================================

                //-----------------do---------------

                {

                    "$type": "Share.CConfigSetMapState",

                    "ID":201,

                    "NodeType":"All",

                    "X":"specials(cur)",

                    "Y":"-scenevar(TopY_Dir_2010204)-specials(Y_ite)",

                    "Position":"Relative",

                    "Radius":0,

                    "Count":1,

                    "FromVisibleState":["Visible"],

                    "ToVisibleState":["VisibleByTriggerEvent"]

                },

                {

                    "$type":"Share.CConfigSetSpecial",

                    "SpecialName":"cur",

                    "SpecialValue":"specials(cur)+1"

                },

                //-----------------while()---------------

                {

                    "$type":"Share.CConfigGoto",

                    "GotoID":201,

                    "Predicates":[

                        {

                            "$type":"Share.CConfigEventBySpecials",

                            "ParamName":"cur",

                            "Param":"specials(loop)",

                            "CompareType":"LessEqual"

                        }

                    ]

                },

                //==============================================



                //距离

                {

                    "$type": "Share.CConfigSetHollowVariable",

                    "Key": "DownY_Dir_2010204",

                    "Value": "scenevar(DownY_Dir_2010204)-1"

                },

                //return

                {

                    "$type":"Share.CConfigGoto",

                    "GotoID":103

                }

            ]

        },

        "SubFunc_DownToUp":{

            "Actions":[

                //初始化循环

                {

                    "$type":"Share.CConfigSetSpecial",

                    "SpecialName":"loop",

                    "SpecialValue":"specials(max_X)-playerpos(X)"

                },

                {

                    "$type":"Share.CConfigSetSpecial",

                    "SpecialName":"cur",

                    "SpecialValue":0

                },

                

                //==============================================

                //-----------------do---------------

                {

                    "$type": "Share.CConfigSetMapState",

                    "ID":202,

                    "NodeType":"All",

                    "X":"specials(cur)",

                    "Y":"scenevar(DownY_Dir_2010204)+specials(Y_ite)",

                    "Position":"Relative",

                    "Radius":0,

                    "Count":1,

                    "FromVisibleState":["Visible"],

                    "ToVisibleState":["VisibleByTriggerEvent"]

                },

                {

                    "$type":"Share.CConfigSetSpecial",

                    "SpecialName":"cur",

                    "SpecialValue":"specials(cur)+1"

                },

                //-----------------while()---------------

                {

                    "$type":"Share.CConfigGoto",

                    "GotoID":202,

                    "Predicates":[

                        {

                            "$type":"Share.CConfigEventBySpecials",

                            "ParamName":"cur",

                            "Param":"specials(loop)",

                            "CompareType":"LessEqual"

                        }

                    ]

                },

                //==============================================



                //距离

                {

                    "$type": "Share.CConfigSetHollowVariable",

                    "Key": "TopY_Dir_2010204",

                    "Value": "scenevar(TopY_Dir_2010204)-1"

                },

                //return

                {

                    "$type":"Share.CConfigGoto",

                    "GotoID":103

                }

            ]

        }

    }

}

