import{createUnityColor}from"../../../unity/tool";import{REQUEST_TYPE}from"../../../unity/model-api";import{merge}from"lodash";const defaultWarningSetting={size:5,offsetY:5,intensity:1,frequency:2,animSpeed:.5,color:createUnityColor("#ff0000ff")},defaultFireSetting={intension:1,color:createUnityColor("#ff0000ff")};export let PointEffectType=function(a){return a.Fire="Fire",a.Warning="Warning",a}({});export const createPoint=async(a,b)=>{var c,d;let e;if(a.effectType===PointEffectType.Fire)e=merge(defaultFireSetting,a.setting?a.setting:{});else if(a.effectType===PointEffectType.Warning)e=merge(defaultWarningSetting,a.setting?a.setting:{});else throw new Error("\u672A\u77E5 `\u70B9\u7279\u6548` \u7C7B\u578B\uFF1A"+a.effectType);const{ID:f}=await b.unity.invoke(REQUEST_TYPE.CreatPointEffect,{EffectType:a.effectType,SpaceID:a.spaceID,Position:{X:a.position.x,Y:a.position.y,Z:a.position.z},Setting:{Size:e.size,OffsetY:e.offsetY,Intensity:e.intensity,Frequency:e.frequency,AnimSpeed:e.animSpeed,Intension:e.intension,Color:null!==(c=a.setting)&&void 0!==c&&c.color?createUnityColor(null===(d=a.setting)||void 0===d?void 0:d.color):e.color}});return{id:f,remove:()=>{b.unity.invoke(REQUEST_TYPE.RemovePointEffect,{Ids:[f]})}}};