import { Tween, tween } from "cc"; import { ContainerState } from "../../util/Enum"; import { ContainerView } from "./ContainerView"; export const ContainerNone = (who: ContainerView) => { const w = who; return { check: () => { if (w.container?.state == ContainerState.NONE) { return true; } return false; }, entry: () => { who.node.position = who.container.o_pos.clone() }, do: (dt: number) => { }, exit: () => { } } } export const ContainerSelect = (who: ContainerView) => { const w = who; return { check: () => { if (w.container?.state == ContainerState.SELECTED) { return true; } return false; }, entry: () => { let opos = who.container.o_pos.clone() Tween.stopAllByTag(ContainerState.SELECTED,who.node) tween(who.node).tag(ContainerState.SELECTED).to(.2,{position:opos.add3f(0,30,0)}).start() }, do: (dt: number) => { }, exit: () => { let opos = who.container.o_pos.clone() Tween.stopAllByTag(ContainerState.SELECTED,who.node) tween(who.node).tag(ContainerState.SELECTED).to(.2,{position:opos}).start() } } }