import{createUnityColor}from"../../../unity/tool";import{REQUEST_TYPE}from"../../../unity/model-api";import{merge}from"lodash";const defaultWallSetting={size:.2,wireThickness:.25,intensity:1,height:10,breakpointWidth:.5,breakpointLength:2};export const createSegmentDefenceWall=async(a,b)=>{let c=merge(defaultWallSetting,a.setting?a.setting:{});if(0===a.walls.length)throw new Error("options.walls \u4E3A\u7A7A");a.walls.forEach(a=>{a.color=createUnityColor(a.color||"#66ccff")});const{SegmentWallIDs:d}=await b.unity.invoke(REQUEST_TYPE.CreatSegmentDefenceWallEffect,{SpaceID:a.spaceID,SegmentDefenceWalls:a.walls,GlobleSetting:c});return{ids:d,remove:()=>{b.unity.invoke(REQUEST_TYPE.RemoveSegmentDefeceWallEffect,{Ids:d})},updateColor:a=>{a.forEach(a=>{a.color=createUnityColor(a.color||"#66ccff")}),b.unity.invoke(REQUEST_TYPE.UpdateSegmentDefeceWallEffect,{SegemntInfos:a})}}};