游戏要做横竖屏旋转,然后有一个组件转换之前是左-左关联容器组件的,转成竖屏后要改成底-底,代码设置后没生效,多转换几次之后就彻底的乱了,请问该如何操作呢?
lua的部分代码如下:
local RelationTypes = {
["left-left"] = RelationType.Left_Left,
["left-center"] = RelationType.Left_Center,
["left-right"] = RelationType.Left_Right,
["center-center"] = RelationType.Center_Center,
["right-left"] = RelationType.Right_Left,
["right-center"] = RelationType.Right_Center,
["right-right"] = RelationType.Right_Right,
["top-top"] = RelationType.Top_Top,
["top-middle"] = RelationType.Top_Middle,
["top-bottom"] = RelationType.Top_Bottom,
["middle-middle"] = RelationType.Middle_Middle,
["bottom-top"] = RelationType.Bottom_Top,
["bottom-middle"] = RelationType.Bottom_Middle,
["bottom-bottom"] = RelationType.Bottom_Bottom,
["width-width"] = RelationType.Width,
["height-height"] = RelationType.Height,
["leftext-left"] = RelationType.LeftExt_Left,
["leftext-right"] = RelationType.LeftExt_Right,
["rightext-left"] = RelationType.RightExt_Left,
["rightext-right"] = RelationType.RightExt_Right,
["topext-top"] = RelationType.TopExt_Top,
["topext-bottom"] = RelationType.TopExt_Bottom,
["bottomext-top"] = RelationType.BottomExt_Top,
["bottomext-bottom"] = RelationType.BottomExt_Bottom,
["size"] = RelationType.Size
}
child.relations:ClearAll()
child:AddRelation(target, RelationTypes[relationType]);
local RelationTypes = {
["left-left"] = RelationType.Left_Left,
["left-center"] = RelationType.Left_Center,
["left-right"] = RelationType.Left_Right,
["center-center"] = RelationType.Center_Center,
["right-left"] = RelationType.Right_Left,
["right-center"] = RelationType.Right_Center,
["right-right"] = RelationType.Right_Right,
["top-top"] = RelationType.Top_Top,
["top-middle"] = RelationType.Top_Middle,
["top-bottom"] = RelationType.Top_Bottom,
["middle-middle"] = RelationType.Middle_Middle,
["bottom-top"] = RelationType.Bottom_Top,
["bottom-middle"] = RelationType.Bottom_Middle,
["bottom-bottom"] = RelationType.Bottom_Bottom,
["width-width"] = RelationType.Width,
["height-height"] = RelationType.Height,
["leftext-left"] = RelationType.LeftExt_Left,
["leftext-right"] = RelationType.LeftExt_Right,
["rightext-left"] = RelationType.RightExt_Left,
["rightext-right"] = RelationType.RightExt_Right,
["topext-top"] = RelationType.TopExt_Top,
["topext-bottom"] = RelationType.TopExt_Bottom,
["bottomext-top"] = RelationType.BottomExt_Top,
["bottomext-bottom"] = RelationType.BottomExt_Bottom,
["size"] = RelationType.Size
}
child.relations:ClearAll()
child:AddRelation(target, RelationTypes[relationType]);
没有找到相关结果
已邀请:
1 个回复
谷主
赞同来自: