Methods

์†Œ๊ฐœ

UI, ์œ ์ € ์ปจํŠธ๋กค, ์‚ฌ์šด๋“œ ๋“ฑ ZEP์—์„œ ์ผ์–ด๋‚  ์ˆ˜ ์žˆ๋Š” ์ „๋ฐ˜์ ์ธ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

ํ”Œ๋ ˆ์ด์–ด ๊ฐœ์ธ ํ™”๋ฉด์— UI๋ฅผ ํ‘œ์‹œ, ํ”Œ๋ ˆ์ด์–ด๋ฅผ ์ด๋™, ํ”Œ๋ ˆ์ด์–ด ๊ฐœ์ธ์—๊ฒŒ ์‚ฌ์šด๋“œ ์žฌ์ƒ ๋“ฑ ํŽธ๋ฆฌํ•œ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

UI

์ด๋ฆ„์„ค๋ช…

showCenterLabel

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์ง€์ •๋œ ์œ„์น˜์— text๋ฅผ 3์ดˆ๊ฐ„ ํ‘œ์‹œํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

showCustomLabel

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์ง€์ •๋œ ์œ„์น˜์— text๋ฅผ 3์ดˆ๊ฐ„ ํ‘œ์‹œํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค. text ๋ถ€๋ถ„์— span ํƒœ๊ทธ๋ฅผ ๋„ฃ์–ด ํ…์ŠคํŠธ๋ฅผ ๊พธ๋ฐ€ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

showWidget

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์ง€์ •๋œ ์œ„์น˜์— ์œ„์ ฏ์„ ๋ถˆ๋Ÿฌ์˜ค๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

showBuyAlert

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ๊ตฌ๋งค ์œ„์ ฏ์„ ํ‘œ์‹œํ•˜๊ณ , ๊ตฌ๋งค ํ›„ ๋™์ž‘ํ•˜๋Š” ์ฝœ๋ฐฑํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

hideBuyAlert

ํ”Œ๋ ˆ์ด์–ด์˜ ๊ตฌ๋งค ์œ„์ ฏ์„ ์ˆจ๊น๋‹ˆ๋‹ค.

sendMessage

์œ ์ € ๊ฐœ์ธ์—๊ฒŒ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๋ฅผ ๋ณด๋ƒ…๋‹ˆ๋‹ค.

showPrompt

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์ž…๋ ฅ์ฐฝ์„ ๋ณด์—ฌ์ฃผ๊ณ , ํ”Œ๋ ˆ์ด์–ด์˜ ์‘๋‹ต์— ๋”ฐ๋ผ ๋™์ž‘ํ•˜๋Š” callback ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

showConfirm

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ํ™•์ธ์ฐฝ์„ ๋ณด์—ฌ์ฃผ๊ณ , ํ”Œ๋ ˆ์ด์–ด๊ฐ€ OK๋ฅผ ๋ˆŒ๋ €์„ ๋•Œ ๋™์ž‘ํ•˜๋Š” ์ฝœ๋ฐฑํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

showAlert

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ๊ฒฝ๊ณ ์ฐฝ์„ ๋ณด์—ฌ์ฃผ๊ณ , ํ”Œ๋ ˆ์ด์–ด๊ฐ€ OK๋ฅผ ๋ˆŒ๋ €์„ ๋•Œ ๋™์ž‘ํ•˜๋Š” callback ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

showImageModal

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์ž…๋ ฅํ•œ ์ด๋ฏธ์ง€ ์ฃผ์†Œ์— ํ•ด๋‹นํ•˜๋Š” ์ด๋ฏธ์ง€๋ฅผ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.

showNoteModal

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ํ…์ŠคํŠธ ์ฐฝ์„ ๋ณด์—ฌ์ฃผ๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

showWidgetResponsive

์œ„์ ฏ์˜ ์ƒ/ํ•˜/์ขŒ/์šฐ ์—ฌ๋ฐฑ์„ ํ™”๋ฉด ํฌ๊ธฐ์— ๋Œ€ํ•œ %๋น„์œจ๋กœ ์ •์˜ํ•˜์—ฌ ์œ„์ ฏ์„ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.

openWebLink

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์›น URL์„ ์ƒˆ ์ฐฝ์ด๋‚˜ ํŒ์—… ์ฐฝ์œผ๋กœ ์—ด์–ด ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

showEmbed

URL์„ ์ž„๋ฒ ๋“œ ํ˜•ํƒœ๋กœ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.

ํฌ๊ธฐ์™€ ์œ„์น˜๋ฅผ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Data Load

์ด๋ฆ„์„ค๋ช…

isEmail

ํ”Œ๋ ˆ์ด์–ด์˜ ์ด๋ฉ”์ผ์„ ๋น„๊ตํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

getLocationName

ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์„œ์žˆ๋Š” ์ง€์ • ์˜์—ญ์˜ ์ด๋ฆ„์„ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.

User Control

์ด๋ฆ„์„ค๋ช…

spawnAt

ํ”Œ๋ ˆ์ด์–ด์˜ ์บ๋ฆญํ„ฐ๋ฅผ ์ง€์ •ํ•œ ์ขŒํ‘œ๋กœ ์ด๋™์‹œํ‚ค๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

spawnAtLocation

ํ”Œ๋ ˆ์ด์–ด์˜ ์บ๋ฆญํ„ฐ๋ฅผ ์ง€์ • ์˜์—ญ์œผ๋กœ ์ด๋™์‹œํ‚ค๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

spawnAtMap

ํ”Œ๋ ˆ์ด์–ด๋ฅผ ๋‹ค๋ฅธ ์ŠคํŽ˜์ด์Šค ๋˜๋Š” ๋งต์œผ๋กœ ์ด๋™์‹œํ‚ค๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

setCameraTarget

ํ”Œ๋ ˆ์ด์–ด์˜ ์‹œ์ ์„ ์ง€์ •๋œ ์ขŒํ‘œ๋กœ ์ค‘์‹ฌ ์ด๋™์‹œํ‚ต๋‹ˆ๋‹ค.

setCameraTargetWithKey

ํ”Œ๋ ˆ์ด์–ด์˜ ์‹œ์ ์„ ํŠน์ • ์˜ค๋ธŒ์ ํŠธ๋กœ ์ค‘์‹ฌ ์ด๋™์‹œํ‚ต๋‹ˆ๋‹ค.

setEffectSprite

ํ”Œ๋ ˆ์ด์–ด์˜ ๋ฐฐ๊ฒฝ ๋˜๋Š” ์ „๊ฒฝ ์ด๋ฏธ์ง€๋ฅผ ์„ค์ • ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

playEffectSprite

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์• ๋‹ˆ๋ฉ”์ด์…˜ ํšจ๊ณผ๋ฅผ ์ž…๋ ฅ ํšŸ์ˆ˜๋งŒํผ ๋ฐ˜๋ณต ์žฌ์ƒํ•˜๊ณ  ์‚ฌ๋ผ์ง€๋Š” ํšจ๊ณผ๋ฅผ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค.

disappearObject

ํ”Œ๋ ˆ์ด์–ด ๊ฐœ์ธ ํ™”๋ฉด ์ƒ์—์„œ key ๊ฐ’์„ ๊ฐ€์ง€๋Š” ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์‚ฌ๋ผ์ง€๊ฒŒํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

Sound

์ด๋ฆ„์„ค๋ช…

playSound

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์‚ฌ์šด๋“œ ํŒŒ์ผ์„ ์žฌ์ƒํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

playSoundLink

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์‚ฌ์šด๋“œ URL์„ ์žฌ์ƒํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

stopSound

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์žฌ์ƒ์ค‘์ธ ์‚ฌ์šด๋“œ๋ฅผ ์ค‘์ง€์‹œํ‚ค๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

๊ณตํ†ต

์ด๋ฆ„์„ค๋ช…

sendUpdated

Player ๊ด€๋ จ ํ•„๋“œ ๊ฐ’์ด ๋ณ€๊ฒฝ๋˜๋ฉด ๋ณ€๊ฒฝ ๊ฐ’์„ ์ ์šฉํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

save

Player storage ๊ฐ’์ด ๋ณ€๊ฒฝ๋˜๋ฉด ๋ณ€๊ฒฝ ๊ฐ’์„ ์ ์šฉํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

๐Ÿ“š API ์„ค๋ช… ๋ฐ ์˜ˆ์ œ

๐ŸŽจ UI Methods

UI ํ•จ์ˆ˜ ํ•œ ๋ˆˆ์— ๋ณด๊ธฐ

// ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์ง€์ •๋œ ์œ„์น˜์— ํ•ด๋‹น text๋ฅผ 3์ดˆ๊ฐ„ ํ‘œ์‹œ
player.showCenterLabel(text: string, color: uint = 0xFFFFFF, bgColor: uint = 0x000000, offset: int = 0, time: int = 3000)

// ๋ชจ๋“  ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์ง€์ •๋œ ์œ„์น˜์— ํ•ด๋‹น text๋ฅผ 3์ดˆ๊ฐ„ ํ‘œ์‹œ, ์ปค์Šคํ„ฐ๋งˆ์ด์ง• ๊ฐ€๋Šฅ
player.showCustomLabel(text: string, color: number = 0xFFFFFF, bgColor: number = 0x000000, offset: number = 0, width = 100, opacity = 0.6, time: int = 3000);

// ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์ง€์ •๋œ align์˜ ์œ„์น˜์— ํ•ด๋‹น htmlํŒŒ์ผ์„ ์œ„์ ฏ์œผ๋กœ ๋ถˆ๋Ÿฌ์˜ด
player.showWidget(fileName: string, align: string, width: number, height: number): ScriptWidget

// ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ๊ตฌ๋งค ์œ„์ ฏ์„ ํ‘œ์‹œํ•˜๊ณ , ๊ตฌ๋งค ํ›„ ๋™์ž‘ํ•˜๋Š” ์ฝœ๋ฐฑํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
player.showBuyAlert(itemName: string, price: number, callback: function);

// ํ”Œ๋ ˆ์ด์–ด์˜ ๊ตฌ๋งค ์œ„์ ฏ์„ ๋‹ซ์Šต๋‹ˆ๋‹ค.
player.hideBuyAlert();

// ํ”Œ๋ ˆ์ด์–ด ๊ฐœ์ธ์—๊ฒŒ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๋ฅผ ๋ณด๋ƒ…๋‹ˆ๋‹ค.
player.sendMessage(message: string, color: number = 0xFFFFFF)

// ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์ž…๋ ฅ์ฐฝ์„ ๋ณด์—ฌ์ฃผ๊ณ , ํ”Œ๋ ˆ์ด์–ด์˜ ์‘๋‹ต์— ๋”ฐ๋ผ ๋™์ž‘ํ•˜๋Š” callback ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
player.showPrompt(text: string, function(inputText))

// ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ํ™•์ธ์ฐฝ์„ ๋ณด์—ฌ์ฃผ๊ณ , ํ”Œ๋ ˆ์ด์–ด๊ฐ€ OK๋ฅผ ๋ˆŒ๋ €์„ ๋•Œ ๋™์ž‘ํ•˜๋Š” ์ฝœ๋ฐฑํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
player.showConfirm(text: string, function(result))

// ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ๊ฒฝ๊ณ ์ฐฝ์„ ๋ณด์—ฌ์ฃผ๊ณ , ํ”Œ๋ ˆ์ด์–ด๊ฐ€ OK๋ฅผ ๋ˆŒ๋ €์„ ๋•Œ ๋™์ž‘ํ•˜๋Š” callback ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
player.showAlert(text: string, function())

// ์œ„์ ฏ์˜ ์ƒ/ํ•˜/์ขŒ/์šฐ ์—ฌ๋ฐฑ์„ ํ™”๋ฉด ํฌ๊ธฐ์— ๋Œ€ํ•œ % ๋น„์œจ๋กœ ์ •์˜ํ•˜์—ฌ ์œ„์ ฏ์„ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.
player.showWidgetResponsive(fileName:string, marginTop:number, marginRight:number, marginBottom:number, marginLeft:number)

//ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์›น URL์„ ์ƒˆ ์ฐฝ์ด๋‚˜ ํŒ์—… ์ฐฝ์œผ๋กœ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.
player.openWebLink(url:string, popup:boolean);

// ์ง€์ •๋œ align์˜ ์œ„์น˜์— url ์ž„๋ฒ ๋“œ์ฐฝ์„ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.
player.showEmbed(url: string, align: string, width: number, height: number, hasBackdrop: boolean = true)

showCenterLabel

player.showCenterLabel(text: string, color: uint = 0xFFFFFF, bgColor: uint = 0x000000, offset: number = 0, time: number = 3000)

ํ•ด๋‹น ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์ง€์ •๋œ ์œ„์น˜์— text๋ฅผ 3์ดˆ๊ฐ„ ํ‘œ์‹œํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

text

String

๋ผ๋ฒจ์— ์ถœ๋ ฅํ•  ํ…์ŠคํŠธ

color

Uint

์ถœ๋ ฅํ•  ๊ธ€์”จ์˜ ์ƒ‰์„ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. (HexCode) ๊ฐ’์„ ์ž…๋ ฅํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ, ํฐ์ƒ‰(0xFFFFFF)์œผ๋กœ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค. โžก๏ธ๊ตฌ๊ธ€ ์ƒ‰์ƒ ์„ ํƒ ๋„๊ตฌ

bgColor

Uint

๋ฉ”์‹œ์ง€๊ฐ€ ์ถœ๋ ฅ๋˜๋Š” ๋ผ๋ฒจ์˜ ๋ฐฐ๊ฒฝ์ƒ‰์„ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. ๊ฐ’์„ ์ž…๋ ฅํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ, ๊ฒ€์€์ƒ‰(0x000000)์œผ๋กœ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค.

offset

number

offset ๊ฐ’์ด ํด์ˆ˜๋ก ํ‘œ์‹œ๋˜๋Š” ์œ„์น˜๊ฐ€ ํ™”๋ฉด ์•„๋ž˜์ชฝ ๋ฐฉํ–ฅ์œผ๋กœ ๊ฐ€๊นŒ์›Œ์ง‘๋‹ˆ๋‹ค. ๊ฐ’์„ ์ž…๋ ฅํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ, 0์œผ๋กœ ์ง€์ •๋ฉ๋‹ˆ๋‹ค.

time

number

๋ผ๋ฒจ ํ‘œ์‹œ ์‹œ๊ฐ„ (ms), ๊ธฐ๋ณธ ๊ฐ’ 3000 ( 3์ดˆ )

์˜ˆ์ œ

๋…ธ๋ž€์ƒ‰ ๋ผ๋ฒจ์„ 2์ดˆ๊ฐ„ ์ถœ๋ ฅํ•ด๋ณด๊ธฐ

App.onJoinPlayer.Add(function(player){
	player.showCenterLabel(`${player.name}๋‹˜ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค.`, 0x000000, 0xFFFF00, 500, 2000); // ๋…ธ๋ž€์ƒ‰ ๋ฐฐ๊ฒฝ, ๊ฒ€์ •์ƒ‰ ๊ธ€์”จ๋กœ ํ‘œ์‹œํ•˜๊ธฐ
});

showCustomLabel

player.showCustomLabel(text: string, color: number = 0xFFFFFF, bgColor: number = 0x000000, offset: number = 0, width = 100, opacity = 0.6, time: number = 3000, option: object = null);

๋ชจ๋“  ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์ง€์ •๋œ ์œ„์น˜์— text๋ฅผ 3์ดˆ๊ฐ„ ํ‘œ์‹œํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

text ๋ถ€๋ถ„์— span ํƒœ๊ทธ๋ฅผ ๋„ฃ์–ด ํ…์ŠคํŠธ๋ฅผ ๊พธ๋ฐ€ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

text

String

๋ผ๋ฒจ์— ์ถœ๋ ฅํ•  ํ…์ŠคํŠธ ( span ํƒœ๊ทธ ํ—ˆ์šฉ )

color

Uint

์ถœ๋ ฅํ•  ๊ธ€์”จ์˜ ์ƒ‰ (HexCode) ๊ฐ’์„ ์ž…๋ ฅํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ, ํฐ์ƒ‰(0xFFFFFF)์œผ๋กœ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค. โžก๏ธ๊ตฌ๊ธ€ ์ƒ‰์ƒ ์„ ํƒ ๋„๊ตฌ

bgColor

Uint

๋ฉ”์‹œ์ง€๊ฐ€ ์ถœ๋ ฅ๋˜๋Š” ๋ผ๋ฒจ์˜ ๋ฐฐ๊ฒฝ์ƒ‰ ๊ฐ’์„ ์ž…๋ ฅํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ, ๊ฒ€์€์ƒ‰(0x000000)์œผ๋กœ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค.

offset

number

offset ๊ฐ’์ด ํด์ˆ˜๋ก ํ‘œ์‹œ๋˜๋Š” ์œ„์น˜๊ฐ€ ํ™”๋ฉด ์•„๋ž˜์ชฝ ๋ฐฉํ–ฅ์œผ๋กœ ๊ฐ€๊นŒ์›Œ์ง‘๋‹ˆ๋‹ค. ๊ฐ’์„ ์ž…๋ ฅํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ, 0์œผ๋กœ ์ง€์ •๋ฉ๋‹ˆ๋‹ค.

width

number

๋ผ๋ฒจ์˜ ๋„ˆ๋น„๋ฅผ n%๋กœ ์„ค์ •ํ•˜๋Š” ๊ฐ’ ์ž…๋‹ˆ๋‹ค. (๊ธฐ๋ณธ ๊ฐ’ 100)

opacity

number

๋ผ๋ฒจ์˜ ๋ฐฐ๊ฒฝ ํˆฌ๋ช…๋„๋ฅผ ์„ค์ •ํ•˜๋Š” ๊ฐ’ ์ž…๋‹ˆ๋‹ค. (๊ธฐ๋ณธ ๊ฐ’ 0.6, ๋ฒ”์œ„ 0 ~ 1)

time

number

๋ผ๋ฒจ ํ‘œ์‹œ ์‹œ๊ฐ„ (ms), ๊ธฐ๋ณธ ๊ฐ’ 3000 ( 3์ดˆ )

์˜ต์…˜

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

key

String

๋ผ๋ฒจ์— ํ‚ค ๊ฐ’์„ ํ• ๋‹นํ•˜์—ฌ, ์„œ๋กœ ๋‹ค๋ฅธ ํ‚ค ๊ฐ’์„ ๊ฐ€์ง„ ๋ผ๋ฒจ์€ ๋™์‹œ์— ํ‘œ์‹œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

borderRadius

String

๋ผ๋ฒจ์˜ ๋ชจ์„œ๋ฆฌ์— ๋‘ฅ๊ธ€๊ธฐ๋ฅผ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ex) borderRadius: "8px"

fontOpacity

boolean

false๋กœ ์„ค์ •์‹œ ํฐํŠธ์— ํˆฌ๋ช…๋„๊ฐ€ ์ ์šฉ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

padding

String

๋ผ๋ฒจ ๋‚ด๋ถ€์— padding ๊ฐ’์„ ์ง€์ • ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ex) padding: "8px"

์˜ˆ์ œ

์ปค์Šคํ…€ ๋ผ๋ฒจ ์˜ˆ์ œ ์ฝ”๋“œ ํŽ˜์ด์ง€๋ฅผ ์ฐธ๊ณ ํ•ด์ฃผ์„ธ์š”

showWidget

player.showWidget(fileName: string, align: string, width: number, height: number): ScriptWidget

ํ•ด๋‹น ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์ง€์ •๋œ align์˜ ์œ„์น˜์— ํ•ด๋‹น htmlํŒŒ์ผ์„ ์œ„์ ฏ์œผ๋กœ ๋ถˆ๋Ÿฌ์˜ค๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

fileName

String

๋ถˆ๋Ÿฌ์˜ฌ ํŒŒ์ผ์˜ ์ด๋ฆ„

align

String

์œ„์ ฏ์„ ํ‘œ์‹œํ•  ์œ„์น˜ โ€™popupโ€™, โ€˜sidebarโ€™, โ€˜topโ€™, โ€˜topleftโ€™, โ€˜toprightโ€™, โ€˜middleโ€™, โ€˜middleleftโ€™, โ€˜middlerightโ€™, โ€˜bottomโ€™, โ€˜bottomleftโ€™, โ€˜bottomrightโ€™

width height

number

์œ„์ ฏ์„ ํ‘œ์‹œํ•  ์˜์—ญ์˜ ๊ฐ€๋กœ, ์„ธ๋กœ ํฌ๊ธฐ(px)

์˜ˆ์ œ

์ดˆ์„ฑํ€ด์ฆˆ ์œ„์ ฏ ๋”ฐ๋ผํ•ด๋ณด๊ธฐ

let _widget = null;
// ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ž…์žฅํ•  ๋•Œ ์‹คํ–‰
App.onJoinPlayer.Add(function (player) {
	_widget = player.showWidget("widget.html", "top", 200, 300); // ํ™”๋ฉด ์ƒ๋‹จ, 200x300 ์˜์—ญ์— ์œ„์ ฏ์„ ๋ณด์—ฌ์คŒ
	_widget.sendMessage({
		timer: 15,
		answer: "ใ……ใ…ใ…‹",
	});
});

showBuyAlert

player.showBuyAlert(itemName: string, price: number, callback: function, payToSpaceOwner: Boolean, option: object)

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ๊ตฌ๋งค ์œ„์ ฏ์„ ํ‘œ์‹œํ•˜๊ณ , ๊ตฌ๋งค ํ›„ ๋™์ž‘ํ•˜๋Š” ์ฝœ๋ฐฑํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์†Œ๋ชจ๋œ ZEM์€ ์•ฑ ์ œ์ž‘์ž์—๊ฒŒ ๋Œ์•„๊ฐ€๋ฉฐ, ๋‚ด ํ›„์› ๋‚ด์—ญ ํŽ˜์ด์ง€์—์„œ ๋‚ด์—ญ์„ ํ™•์ธ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ZEM ์ •์‚ฐ ๊ด€๋ จ ๋‚ด์šฉ์€ ์ •์‚ฐ๊ฐ€์ด๋“œ ํŽ˜์ด์ง€์—์„œ ํ™•์ธํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

itemName

String

๊ตฌ๋งค์ฐฝ์— ํ‘œ์‹œํ•  ์•„์ดํ…œ์˜ ์ด๋ฆ„

price

number

์•„์ดํ…œ์˜ ๊ฐ€๊ฒฉ (ํ™”ํ๋‹จ์œ„: ZEM)

callback

function

๊ตฌ๋งค ์„ฑ๊ณต์‹œ ๋™์ž‘ํ•  ์ฝœ๋ฐฑํ•จ์ˆ˜

๊ตฌ๋งค ์„ฑ๊ณต ์—ฌ๋ถ€(success)์™€ ๊ตฌ๋งค์ •๋ณด(buyAlertResult) ๋ฐ์ดํ„ฐ๋ฅผ ์ „๋‹ฌ ๋ฐ›์œผ๋ฉฐ, buyAlertResult๋Š” ํ™˜๋ถˆ ๊ธฐ๋Šฅ์— ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.

payToSpaceOwner

Boolean

๊ธฐ๋ณธ ๊ฐ’์€ false๋กœ ์„ค์ •๋˜๋ฉฐ false์ธ ๊ฒฝ์šฐ ์•ฑ ์†Œ์œ ์ž์—๊ฒŒ ์ˆ˜์ต์ด ์ „๋‹ฌ๋˜๊ณ ,

true์ธ ๊ฒฝ์šฐ ๋งต ์†Œ์œ ์ž์—๊ฒŒ ์ˆ˜์ต์ด ์ „๋‹ฌ๋ฉ๋‹ˆ๋‹ค.

option

Object

๋‹ค์Œ ์˜ต์…˜๋“ค์„ ์„ค์ • ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. message : ๊ตฌ๋งค์ฐฝ์— ํ‘œ์‹œํ•  ํ…์ŠคํŠธ๋ฅผ ์„ค์ • ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

timer : ๊ตฌ๋งค์ฐฝ์„ ํ‘œ์‹œํ•  ์‹œ๊ฐ„(ms)์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์˜ˆ์ œ

๊ตฌ๋งค์ •๋ณด ์ €์žฅ ๋ฐ ํ™˜๋ถˆ ๊ธฐ๋Šฅ ์˜ˆ์ œ

const itemName = "ITEM";

// Q๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜ - ์•„์ดํ…œ์„ ๊ตฌ๋งคํ•˜๊ณ  player.storage์— ๊ตฌ๋งค์ •๋ณด ์ €์žฅํ•˜๊ธฐ
App.addOnKeyDown(81, function (player) {
	let pStorage = JSON.parse(player.storage);
	if (!player.tag) {
		player.tag = {};
	}
	if (pStorage == null) {
		pStorage = {};
	}
	//์ด๋ฏธ ์•„์ดํ…œ์„ ๊ตฌ๋งคํ–ˆ๋‹ค๋ฉด ๋ฉ”์‹œ์ง€ ์ถœ๋ ฅ
	if (pStorage[itemName]) {
		player.showCenterLabel(`${itemName}์„ ์ด๋ฏธ ๊ตฌ๋งคํ–ˆ์Šต๋‹ˆ๋‹ค.`);
	} else {
		player.showBuyAlert(itemName, 0, function (success, buyAlertResult) {
			if (success) {
				App.sayToAll(`[์ •๋ณด] ${player.name}๋‹˜์ด ${itemName}์„ ๊ตฌ๋งคํ–ˆ์Šต๋‹ˆ๋‹ค!`);
				pStorage[itemName] = true;
				player.tag.buyAlertResult = buyAlertResult
				player.storage = JSON.stringify(pStorage);
				player.save();
			}
		}, 
		false,// false ์ธ ๊ฒฝ์šฐ ์•ฑ ์†Œ์œ ์ž์—๊ฒŒ ์ˆ˜์ต์ „๋‹ฌ, true์ด๋ฉด ์ŠคํŽ˜์ด์Šค ์†Œ์œ ์ž์—๊ฒŒ ์ˆ˜์ต ์ „๋‹ฌ
		{
			message: `${itemName} custom message`,//message์— itemName์— ํ•ด๋‹นํ•˜๋Š” text๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ ๊ฐ•์กฐ๋˜์–ด ํ‘œ์‹œ๋จ
			timer: 10000 // 10์ดˆ - ๊ตฌ๋งค์ฐฝ ํ‘œ์‹œ์‹œ๊ฐ„(ms)
		}
		);
	}
});

// W๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜ - ํ™˜๋ถˆ ๊ธฐ๋Šฅ
App.addOnKeyDown(87, function (player) {
	let pStorage = JSON.parse(player.storage);
	if( pStorage && player.tag.buyAlertResult )
	{	
		if( player.tag.buyAlertResult.Refund() )
		{
			App.sayToAll("===== refund success!");
			pStorage[itemName] = false;
		}
		else {
			App.sayToAll("===== refund failed");
		}
		player.tag.buyAlertResult = null;
		player.storage = JSON.stringify(pStorage);
		player.save();
	}
})

hideBuyAlert

player.hideBuyAlert()

ํ”Œ๋ ˆ์ด์–ด์˜ ๊ตฌ๋งค ์œ„์ ฏ์„ ๋‹ซ์Šต๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์—†์Œ

sendMessage

player.sendMessage(text: string, color: uint = 0xFFFFFF)

์œ ์ € ๊ฐœ์ธ์—๊ฒŒ ์ฑ„ํŒ… ๋ฉ”์‹œ์ง€๋ฅผ ๋ณด๋‚ด๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

text

String

๋ผ๋ฒจ์— ์ถœ๋ ฅํ•  ํ…์ŠคํŠธ

color

Uint

์ถœ๋ ฅํ•  ๊ธ€์”จ์˜ ์ƒ‰์„ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. (HexCode) ๊ฐ’์„ ์ž…๋ ฅํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ, ํฐ์ƒ‰(0xFFFFFF)์œผ๋กœ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค. โžก๏ธ๊ตฌ๊ธ€ ์ƒ‰์ƒ ์„ ํƒ ๋„๊ตฌ

์˜ˆ์ œ

ํ”Œ๋ ˆ์ด์–ด ๊ฐœ์ธ์—๊ฒŒ๋งŒ ๋ณด์ด๋Š” ํ™˜์˜๋ฉ”์‹œ์ง€ ์ถœ๋ ฅํ•˜๊ธฐ.


App.onJoinPlayer.Add(function(player){
    player.sendMessage(`${player.name}๋‹˜ ์–ด์„œ์˜ค์„ธ์š”!\nhttps://docs-kr.zep.us/ ๋งํฌ ํด๋ฆญ์‹œ ๊ฐ€์ด๋“œ๋กœ ์—ฐ๊ฒฐ๋ฉ๋‹ˆ๋‹ค.`,0xffffff);
});

showPrompt

player.showPrompt(title: string, function(inputText), option = {})

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์ž…๋ ฅ์ฐฝ์„ ๋ณด์—ฌ์ฃผ๊ณ , ํ”Œ๋ ˆ์ด์–ด์˜ ์‘๋‹ต์— ๋”ฐ๋ผ ๋™์ž‘ํ•˜๋Š” callback ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

title

String

์ž…๋ ฅ์ฐฝ์˜ ํƒ€์ดํ‹€

inputText

String

ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ž…๋ ฅํ•œ ํ…์ŠคํŠธ

์˜ต์…˜

๊ฐ’์„ ์ž…๋ ฅํ•˜์ง€ ์•Š์•„๋„ default ๊ฐ’์ด ์ ์šฉ๋ฉ๋‹ˆ๋‹ค.

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

content

String

์ž…๋ ฅ์ฐฝ ์œ„์— ์ถœ๋ ฅํ•  ํ…์ŠคํŠธ (Default: null)

confirmVariant

'primary' | 'alert'

confirm ๋ฒ„ํŠผ์˜ ์ƒ‰์ƒ (Default: "primary") - 'primary': ํ‘ธ๋ฅธ์ƒ‰, - 'alert': ๋ถ‰์€์ƒ‰

cancelText

String

cancel ๋ฒ„ํŠผ์˜ ํ…์ŠคํŠธ (Default: "์ทจ์†Œ")

confirmText

String

confirm ๋ฒ„ํŠผ์˜ ํ…์ŠคํŠธ (Default: "ํ™•์ธ")

placeholder

String

input placeholder ํ…์ŠคํŠธ (Default: null)

textType

'text' | 'password'

์ž…๋ ฅ ํƒ€์ž… (Default: "text")

- 'text': ์ž…๋ ฅ ๊ฐ’์„ ํ…์ŠคํŠธ๋กœ ํ‘œ์‹œ - 'password': ์ž…๋ ฅ ๊ฐ’์„ *๋กœ ํ‘œ์‹œ

์˜ˆ์ œ

"1234"๋ฅผ ์ž…๋ ฅํ•˜๋Š” ๊ฒฝ์šฐ "Correct" ๋ฉ”์‹œ์ง€ ์ถœ๋ ฅํ•ด๋ณด๊ธฐ

// Qํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(KeyCodeType.q, function (player) {
    player.showPrompt("Password", function (inputText) {
            if (inputText == "1234") {
                player.showCenterLabel("Correct");
            } else {
                player.showCenterLabel("Incorrect");
            }
        },
        {
            content: 'Description', // ์„ค๋ช…
            confirmVariant: 'primary', // ํ™•์ธ ๋ฒ„ํŠผ ์ƒ‰์ƒ 'primary' | 'alert'
            cancelText: 'custom cancel', // ์ทจ์†Œ ๋ฒ„ํŠผ ํ…์ŠคํŠธ
            confirmText: 'custom confirm',// ํ™•์ธ ๋ฒ„ํŠผ ํ…์ŠคํŠธ
            placeholder: 'Custom Placeholder',// ์ž…๋ ฅ์นธ์˜ placeholder
            textType: 'password' // ์ž…๋ ฅ ํ…์ŠคํŠธ์˜ ํ‘œ์‹œ ํ˜•์‹ 'text' | 'password'
        }
    );
});

showConfirm

player.showConfirm(text: string, function(result), option = {})

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ํ™•์ธ์ฐฝ์„ ๋ณด์—ฌ์ฃผ๊ณ , ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ํ™•์ธ ๋ฒ„ํŠผ์„ ๋ˆŒ๋ €์„ ๋•Œ ๋™์ž‘ํ•˜๋Š” callback ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. cancel์„ ๋ˆ„๋ฅผ ๊ฒฝ์šฐ์—๋Š” callback ํ•จ์ˆ˜๊ฐ€ ๋™์ž‘ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

text

String

ํ™•์ธ์ฐฝ์— ์ถœ๋ ฅํ•  ํ…์ŠคํŠธ

result

Boolean

ํ”Œ๋ ˆ์ด์–ด๊ฐ€ OK๋ฅผ ๋ˆ„๋ฅด๋Š” ๊ฒฝ์šฐ true

์˜ต์…˜

๊ฐ’์„ ์ž…๋ ฅํ•˜์ง€ ์•Š์•„๋„ default ๊ฐ’์ด ์ ์šฉ๋ฉ๋‹ˆ๋‹ค.

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

content

String

content ์˜์—ญ์— ์ถœ๋ ฅํ•  ํ…์ŠคํŠธ (Default: null)

confirmVariant

'primary' | 'alert'

confirm ๋ฒ„ํŠผ์˜ ์ƒ‰์ƒ (Default: 'primary') - primary: ํ‘ธ๋ฅธ์ƒ‰, - alert: ๋ถ‰์€์ƒ‰

cancelText

String

cancel ๋ฒ„ํŠผ์˜ ํ…์ŠคํŠธ (Default: "์ทจ์†Œ")

confirmText

String

confirm ๋ฒ„ํŠผ์˜ ํ…์ŠคํŠธ (Default: "ํ™•์ธ")

์˜ˆ์ œ

ํ™•์ธ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅธ ๊ฒฝ์šฐ ์ฑ„ํŒ…์ฐฝ์— ํ…์ŠคํŠธ ์ถœ๋ ฅํ•˜๊ธฐ

// Q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(KeyCodeType.q, function (player) {
    player.showConfirm("Confirm", function (result) {
            if (result) {
                App.sayToAll("ok");
            }
        },
        {
            content: 'Description', // ์„ค๋ช…
            confirmVariant: 'alert', // ํ™•์ธ ๋ฒ„ํŠผ ์ƒ‰์ƒ 'primary' | 'alert';
            cancelText: 'custom cancel', // ์ทจ์†Œ ๋ฒ„ํŠผ ํ…์ŠคํŠธ
            confirmText: 'custom confirm',// ํ™•์ธ ๋ฒ„ํŠผ ํ…์ŠคํŠธ
        }
    );
});

showAlert

player.showAlert(text: string, function(), option = {})

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ๊ฒฝ๊ณ ์ฐฝ์„ ๋ณด์—ฌ์ฃผ๊ณ , ํ”Œ๋ ˆ์ด์–ด๊ฐ€ OK๋ฅผ ๋ˆŒ๋ €์„ ๋•Œ ๋™์ž‘ํ•˜๋Š” callback ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

text

String

๊ฒฝ๊ณ ์ฐฝ์— ์ถœ๋ ฅํ•  ํ…์ŠคํŠธ

์˜ต์…˜

๊ฐ’์„ ์ž…๋ ฅํ•˜์ง€ ์•Š์•„๋„ default ๊ฐ’์ด ์ ์šฉ๋ฉ๋‹ˆ๋‹ค.

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

content

String

content ์˜์—ญ์— ์ถœ๋ ฅํ•  ํ…์ŠคํŠธ (Default: null)

confirmText

String

confirm ๋ฒ„ํŠผ์˜ ํ…์ŠคํŠธ (Default: "ํ™•์ธ")

์˜ˆ์ œ

๋ฒ„ํŠผ์„ ๋ˆ„๋ฅธ ๊ฒฝ์šฐ ์ฑ„ํŒ…์ฐฝ์— ํ…์ŠคํŠธ ์ถœ๋ ฅํ•˜๊ธฐ

// Q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(81, function (player) {
    player.showAlert("Alert", function () {
            App.sayToAll("ok");
        },
        {
            content: 'Description', // ์„ค๋ช…
            confirmText: 'custom confirm',// ํ™•์ธ ๋ฒ„ํŠผ ํ…์ŠคํŠธ
        }
    );
});

showWidgetResponsive

player.showWidgetResponsive(fileName:string, marginTop:number, marginRight:number, marginBottom:number, marginLeft:number)

์œ„์ ฏ์˜ ์ƒ/ํ•˜/์ขŒ/์šฐ ์—ฌ๋ฐฑ์„ ํ™”๋ฉด ํฌ๊ธฐ์— ๋Œ€ํ•œ %๋น„์œจ๋กœ ์ •์˜ํ•˜์—ฌ ์œ„์ ฏ์„ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.

ํ™”๋ฉด์˜ ํฌ๊ธฐ๊ฐ€ ์—ฌ๋ฐฑ์„ ํฌํ•จํ•œ ์œ„์ ฏ ์˜์—ญ๋ณด๋‹ค ์ž‘์•„์งˆ ๊ฒฝ์šฐ, ์œ„์ ฏ์˜ ํฌ๊ธฐ๊ฐ€ ๋น„๋ก€ํ•˜์—ฌ ์ž‘์•„์ง‘๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

fileName

String

๋ถˆ๋Ÿฌ์˜ฌ ํŒŒ์ผ์˜ ์ด๋ฆ„

margin top/left/right/bottom

String

์ƒ/ํ•˜/์ขŒ/์šฐ ์—ฌ๋ฐฑ์˜ % ๊ฐ’

์˜ˆ์ œ

ํ™”๋ฉด ํฌ๊ธฐ๋ฅผ ์ค„์ด๋Š” ๊ฒฝ์šฐ ์œ„์ ฏ์˜ ํฌ๊ธฐ ๋ณ€ํ™”

App.onJoinPlayer.Add(function (player) {
	player.tag = {};
});

// Q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(81, function (player) {
	player.tag.widget = player.showWidgetResponsive("result.html", 15, 15, 15, 15);
	player.tag.widget.onMessage.Add(function (player, data) {
		if (data.type == "close") {
			player.tag.widget.destroy();
			player.tag.widget = null;
		}
	});
});

player.openWebLink(url:string, popup:boolean=false)

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์›น URL์„ ์ƒˆ ์ฐฝ์ด๋‚˜ ํŒ์—… ์ฐฝ์œผ๋กœ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

url

String

์—ฐ๊ฒฐํ•  ์›น url ์ฃผ์†Œ

popup

boolean

true ์ธ ๊ฒฝ์šฐ, url ์ฐฝ์„ ํŒ์—… ํ˜•ํƒœ๋กœ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์ œ

openWebLink ํŒ์—…์œผ๋กœ ์—ฌ๋Š” ๊ฒฝ์šฐ

// Q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(81, function (player) {
	player.openWebLink("https://docs-kr.zep.us", true);
});

showEmbed

player.showEmbed(url: string, align: string, width: number, height: number, hasBackdrop: boolean = true)

ํ•ด๋‹น ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์ง€์ •๋œ align์˜ ์œ„์น˜์— url ์ž„๋ฒ ๋“œ ํ™”๋ฉด์„ ํ‘œ์‹œํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

url

String

์›น url ์ฃผ์†Œ

align

String

์ž„๋ฒ ๋“œ๋ฅผ ํ‘œ์‹œํ•  ์œ„์น˜ โ€˜sidebarโ€™, โ€˜topโ€™, โ€˜topleftโ€™, โ€˜toprightโ€™, โ€˜middleโ€™, โ€˜middleleftโ€™, โ€˜middlerightโ€™, โ€˜bottomโ€™, โ€˜bottomleftโ€™, โ€˜bottomrightโ€™

width height

number

์ž„๋ฒ ๋“œ ์˜์—ญ์˜ ๊ฐ€๋กœ, ์„ธ๋กœ ํฌ๊ธฐ(px)

hasBackdrop

boolean

true์ผ ๊ฒฝ์šฐ ์ž„๋ฒ ๋“œ์˜ ๋ฐ”๊นฅ ๋ฐฐ๊ฒฝ์— ๊ทธ๋ฆผ์ž๋ฅผ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์ œ

url ์ž„๋ฒ ๋“œ์ฐฝ ํ‘œ์‹œํ•˜๊ธฐ

// Q๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(81, function (player) {
	player.showEmbed("https://youtu.be/ztuTrpXJyks", "middle", 900, 600, true);
});

showImageModal

player.showImage(url: string)

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์ž…๋ ฅํ•œ ์ด๋ฏธ์ง€ ์ฃผ์†Œ์— ํ•ด๋‹นํ•˜๋Š” ์ด๋ฏธ์ง€๋ฅผ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

url

String

ํ‘œ์‹œํ• ์ด๋ฏธ์ง€ url

์˜ˆ์ œ

์ด๋ฏธ์ง€ ๋ชจ๋‹ฌ์ฐฝ ํ‘œ์‹œํ•˜๊ธฐ

// Q๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(KeyCodeType.Q, function (player) {
    player.showImageModal("https://cdn-static.zep.us/static/images/thumbnail.png");
});

showNoteModal

player.showNoteModal(text: string)

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ํ…์ŠคํŠธ ์ฐฝ์„ ๋ณด์—ฌ์ฃผ๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

text

String

ํ‘œ์‹œํ•  ํ…์ŠคํŠธ

์˜ˆ์ œ

ํ…์ŠคํŠธ ์ฐฝ ํ‘œ์‹œํ•˜๊ธฐ

// Q๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(KeyCodeType.Q, function (player) {
    player.showNoteModal("Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptatibus autem nisi soluta commodi a eius distinctio facilis est ea ullam. Dolorum a quis, impedit nisi voluptates magni architecto odit amet.");
});

๐Ÿ’ป Data Load Methods

Data Load Methods ํ•จ์ˆ˜ ํ•œ ๋ˆˆ์— ๋ณด๊ธฐ

// ์ง€์ •ํ•œ ์ด๋ฉ”์ผ๊ณผ ํ”Œ๋ ˆ์ด์–ด์˜ ์ด๋ฉ”์ผ์„ ๋น„๊ต
player.isEmail(email: string): boolean

// ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์„œ์žˆ๋Š” ๊ตฌ์—ญ์ด๋ฆ„์„ ํ˜ธ์ถœ
player.getLocationName(): string

isEmail

player.isEmail(email: string): boolean

ํ•ด๋‹น ํ”Œ๋ ˆ์ด์–ด์˜ ์ด๋ฉ”์ผ์ด ํŒŒ๋ผ๋ฏธํ„ฐ ๊ฐ’๊ณผ ๊ฐ™๋‹ค๋ฉด true, ์•„๋‹ˆ๋ฉด false๋ฅผ ๋ฆฌํ„ดํ•ฉ๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

email

String

๋น„๊ตํ•  ์ด๋ฉ”์ผ ํ…์ŠคํŠธ

์˜ˆ์ œ

ํ”Œ๋ ˆ์ด์–ด์˜ ์ด๋ฉ”์ผ์ด ์ง€์ •ํ•œ ํ…์ŠคํŠธ์™€ ๊ฐ™์€์ง€ ๋น„๊ตํ•ด๋ณด๊ธฐ

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
// App.addOnKeyDown
	let check = player.isEmail("supercat@supercat.co.kr");
	App.sayToAll(`์ด๋ฉ”์ผ ์ผ์น˜ ์—ฌ๋ถ€: ${check}`)
})

getLocationName

player.getLocationName : string

ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์„œ์žˆ๋Š” ์ง€์ • ์˜์—ญ์˜ ์ด๋ฆ„์„ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.

์ง€์ • ์˜์—ญ์€ โ€˜๋งต์—๋””ํ„ฐ > ํƒ€์ผํšจ๊ณผโ€™ ์—์„œ ์„ค์ • ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

  • ์—†์Œ

์˜ˆ์ œ

์บ๋ฆญํ„ฐ๊ฐ€ ์„œ์žˆ๋Š” ํƒ€์ผ์˜ ์˜์—ญ์ด๋ฆ„ ์ถœ๋ ฅํ•ด๋ณด๊ธฐ

โ†’ ์ง€์ • ์˜์—ญ ์„ค์ •์ด ์•ˆ๋˜์žˆ๋‹ค๋ฉด ๊ณต๋ฐฑ์œผ๋กœ ์ถœ๋ ฅ๋ฉ๋‹ˆ๋‹ค

// q ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
// App.addOnKeyDown
App.addOnKeyDown(81,function(player){
	App.sayToAll(`ํ˜„์žฌ ์„œ์žˆ๋Š” ๊ตฌ์—ญ: ${player.getLocationName()}`)
})

๐Ÿ™โ€โ™‚๏ธ User Control

User Control ํ•จ์ˆ˜ ํ•œ ๋ˆˆ์— ๋ณด๊ธฐ

// ํ”Œ๋ ˆ์ด์–ด๋ฅผ ํ•ด๋‹น ์ขŒํ‘œ๋กœ ์†Œํ™˜
player.spawnAt(tileX: int ,tileY: int, dir: int = 0)

// ํ”Œ๋ ˆ์ด์–ด๋ฅผ ํ•ด๋‹น ๊ตฌ์—ญ์œผ๋กœ ์†Œํ™˜
player.spawnAtLocation(name: string ,dir:int = 0)

// ํ”Œ๋ ˆ์ด์–ด๋ฅผ ํ•ด๋‹น ์ŠคํŽ˜์ด์Šค ํ•ด๋‹น ๋งต์œผ๋กœ ์ด๋™์‹œํ‚ค๊ธฐ
player.spawnAtMap(spaceHashID string, mapHashID:string = null)

spawnAt

player.spawnAt(tileX: int ,tileY: int, dir: int = 0)

ํ”Œ๋ ˆ์ด์–ด์˜ ์บ๋ฆญํ„ฐ๋ฅผ tileX, tileY ์ขŒํ‘œ๋กœ ์ง€์ •ํ•œ ๋ฐฉํ–ฅ์„ ๋ฐ”๋ผ๋ณด๊ฒŒ ์ด๋™์‹œํ‚ต๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

tileX tileY

number

ํ”Œ๋ ˆ์ด์–ด๋ฅผ ์ด๋™์‹œํ‚ฌ x, y ์ขŒํ‘œ ๊ฐ’

dir

number

- ์บ๋ฆญํ„ฐ๊ฐ€ ๋ฐ”๋ผ๋ณผ ๋ฐฉํ–ฅ โ€ข ์™ผ์ชฝ : 1 โ€ข ์œ„์ชฝ : 2 โ€ข ์˜ค๋ฅธ์ชฝ : 3 โ€ข ์•„๋ž˜์ชฝ : 4 โ€ข ์™ผ์ชฝ์œ„ : 5 โ€ข ์™ผ์ชฝ์•„๋ž˜ : 6 โ€ข ์˜ค๋ฅธ์ชฝ์œ„: 7 โ€ข ์˜ค๋ฅธ์ชฝ์•„๋ž˜: 8

์˜ˆ์ œ

์ž…์žฅํ•˜๋Š” ํ”Œ๋ ˆ์ด์–ด๋ฅผ ์ง€์ •ํ•œ ์ขŒํ‘œ๋กœ ์ด๋™์‹œํ‚ค๊ธฐ

// ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ž…์žฅํ•  ๋•Œ ์‹คํ–‰
App.onJoinPlayer.Add(function (player) {
	player.spawnAt(5, 5, 1); // ํ”Œ๋ ˆ์ด์–ด๋ฅผ 5,5 ์œ„์น˜๋กœ ์™ผ์ชฝ ๋ฐฉํ–ฅ์„ ๋ฐ”๋ผ๋ณด๊ฒŒ ์ด๋™์‹œํ‚ค๊ธฐ
});

spawnAtLocation

player.spawnAtLocation(name: string, dir:int = 0)

ํ”Œ๋ ˆ์ด์–ด์˜ ์บ๋ฆญํ„ฐ๋ฅผ name์— ํ•ด๋‹นํ•˜๋Š” ์ง€์ • ์˜์—ญ์œผ๋กœ ์ง€์ •ํ•œ ๋ฐฉํ–ฅ์„ ๋ฐ”๋ผ๋ณด๊ฒŒ ์ด๋™์‹œํ‚ต๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

name

String

ํ”Œ๋ ˆ์ด์–ด๋ฅผ ์ด๋™์‹œํ‚ฌ ์ง€์ • ์˜์—ญ์˜ ์ด๋ฆ„

dir

number

- ์บ๋ฆญํ„ฐ๊ฐ€ ๋ฐ”๋ผ๋ณผ ๋ฐฉํ–ฅ โ€ข ์™ผ์ชฝ : 1 โ€ข ์œ„์ชฝ : 2 โ€ข ์˜ค๋ฅธ์ชฝ : 3 โ€ข ์•„๋ž˜์ชฝ : 4 โ€ข ์™ผ์ชฝ์œ„ : 5 โ€ข ์™ผ์ชฝ์•„๋ž˜ : 6 โ€ข ์˜ค๋ฅธ์ชฝ์œ„: 7 โ€ข ์˜ค๋ฅธ์ชฝ์•„๋ž˜: 8

์˜ˆ์ œ

์ž…์žฅํ•˜๋Š” ํ”Œ๋ ˆ์ด์–ด๋ฅผ ์ง€์ • ์˜์—ญ์œผ๋กœ ์ด๋™์‹œํ‚ค๊ธฐ

โš ๏ธ ๊ฐ™์€ ์ด๋ฆ„์˜ ์ง€์ • ์˜์—ญ์ด ์—ฌ๋Ÿฌ ๊ณณ ์žˆ๋‹ค๋ฉด ํ•ด๋‹น ์˜์—ญ๋“ค ์ค‘ ํ•œ ๊ณณ์œผ๋กœ ๋žœ๋ค ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

// ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ž…์žฅํ•  ๋•Œ ์‹คํ–‰
App.onJoinPlayer.Add(function (player) {
// ํ”Œ๋ ˆ์ด์–ด๋ฅผ "test"๋ผ๋Š” ์ด๋ฆ„์˜ ์ง€์ •์˜์—ญ์œผ๋กœ ์™ผ์ชฝ ๋ฐฉํ–ฅ์„ ๋ฐ”๋ผ๋ณด๊ฒŒ ์†Œํ™˜ํ•˜๊ธฐ
	player.spawnAtLocation("test", 1); 
});

spawnAtMap

player.spawnAtMap(spaceHashID string, mapHashID:string)

ํ”Œ๋ ˆ์ด์–ด๋ฅผ ํ•ด๋‹น ์ŠคํŽ˜์ด์Šค ํ•ด๋‹น ๋งต์œผ๋กœ ์ด๋™์‹œํ‚ต๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

spaceHashID

String

์ด๋™ํ•  ์ŠคํŽ˜์ด์Šค์˜ spaceHashID

mapHashID

String

์ด๋™ํ•  ๋งต์˜ mapHashID

์˜ˆ์ œ

์ž…์žฅํ•˜๋Š” ํ”Œ๋ ˆ์ด์–ด๋ฅผ ZEP ํŠœํ† ๋ฆฌ์–ผ ๋งต์œผ๋กœ ์ด๋™์‹œํ‚ค๊ธฐ ( ์ŠคํŽ˜์ด์Šค์™€ ๋งต ์ดํ•ดํ•˜๊ธฐ )

// ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ž…์žฅํ•  ๋•Œ ์‹คํ–‰
App.onJoinPlayer.Add(function (player) {
	// ํ”Œ๋ ˆ์ด์–ด๋ฅผ ZEP ํŠœํ† ๋ฆฌ์–ผ ๋งต์œผ๋กœ ์ด๋™์‹œํ‚ค๊ธฐ
	player.spawnAtMap("65jeBA", "2YvXMJ");
});

setCameraTarget

[1] player.setCameraTarget( tileX: Number, tileY: Number, time: Number )

[2] player.setCameraTarget( key: String, time: Number )

[1] ํ”Œ๋ ˆ์ด์–ด์˜ ์‹œ์ ์„ ์ง€์ •๋œ ์ขŒํ‘œ๋กœ ์ค‘์‹ฌ ์ด๋™์‹œํ‚ต๋‹ˆ๋‹ค.

[2] ํ”Œ๋ ˆ์ด์–ด์˜ ์‹œ์ ์„ ํŠน์ • ์˜ค๋ธŒ์ ํŠธ๋กœ ์ค‘์‹ฌ ์ด๋™์‹œํ‚ต๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

tileX

Number

x์ขŒํ‘œ

tileY

Number

y์ขŒํ‘œ

key

String

์˜ค๋ธŒ์ ํŠธ์˜ ํ‚ค ๊ฐ’

time

Number

์‹œ์ ์ด ๋ชฉํ‘œ ์ง€์ ๊นŒ์ง€ ์ด๋™ํ•˜๋Š”๋ฐ ๊ฑธ๋ฆฌ๋Š” ์‹œ๊ฐ„(์ดˆ)

์˜ˆ์ œ

[1] ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ๋ณด๊ณ  ์žˆ๋Š” ํ™”๋ฉด์˜ ์ค‘์‹ฌ์„ ์ž…๋ ฅํ•œ ์ขŒํ‘œ๋กœ ์ด๋™ ๋ฐ ์ดˆ๊ธฐํ™” ์‹œํ‚ค๊ธฐ

// Q๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(KeyCodeType.Q, function (player) {
    player.setCameraTarget(0, 0, 2); // ํ”Œ๋ ˆ์ด์–ด์˜ ์‹œ์ ์„ [0,0] ์ขŒํ‘œ๋กœ 2์ดˆ๋™์•ˆ ์ด๋™์‹œํ‚ต๋‹ˆ๋‹ค.
    player.sendUpdated(); 
});

// W๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(KeyCodeType.W, function (player) {
    player.setCameraTarget("");
    player.sendUpdated();
});

[2] ํ”Œ๋ ˆ์ด์–ด์˜ ์‹œ์ ์„ ์˜ค๋ธŒ์ ํŠธ๋กœ ์ด๋™ ๋ฐ ์ดˆ๊ธฐํ™” ์‹œํ‚ค๊ธฐ


let sprite = App.loadSpritesheet('blueman.png', 48, 64, {
    left: [5, 6, 7, 8, 9], // ์ขŒ๋ฐฉํ–ฅ ์ด๋™ ์ด๋ฏธ์ง€
    up: [15, 16, 17, 18, 19],
    down: [0, 1, 2, 3, 4],
    right: [10, 11, 12, 13, 14],
    dance: [20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],
    down_jump: [38],
    left_jump: [39],
    right_jump: [40],
    up_jump: [41],
},5);

App.onJoinPlayer.Add(function (player) {
    App.runLater(function () {
        Map.putObjectWithKey(player.tileX, player.tileY, sprite, {
            overlap: true,
            movespeed: 50,
            key: "TestBlueMan",
            useDirAnim: true
        });
        Map.moveObjectWithKey("TestBlueMan", Map.width - 1, player.tileY, false);
    }, 2);
});

// Q๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(KeyCodeType.Q, function (player) {
    player.setCameraTarget("TestBlueMan",1);
    player.sendUpdated();
});

// W๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(KeyCodeType.W, function (player) {
    player.setCameraTarget("");
    player.sendUpdated();
});

setEffectSprite

player.setEffectSprite(resource: ScriptDynamicResource, offsetX: Number, offsetY: Number, type: Number)

ํ”Œ๋ ˆ์ด์–ด์˜ ๋ฐฐ๊ฒฝ ๋˜๋Š” ์ „๊ฒฝ ์ด๋ฏธ์ง€๋ฅผ ์„ค์ • ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

resource

ScriptDynamicResource

์Šคํฌ๋ฆฝํŠธ์— ๋กœ๋“œํ•œ ์ด๋ฏธ์ง€ ๊ฐ์ฒด

offsetX

Number

px ๋‹จ์œ„๋กœ x ์ถ• ๋ฐฉํ–ฅ์˜ ์˜คํ”„์…‹์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋Š” ์†์„ฑ

offsetY

Number

px ๋‹จ์œ„๋กœ y ์ถ• ๋ฐฉํ–ฅ์˜ ์˜คํ”„์…‹์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋Š” ์†์„ฑ

type

0 | 1

์„ค์ •ํƒ€์ž… - 0: ๋ฐฐ๊ฒฝ ์„ค์ • - 1 : ์ „๊ฒฝ ์„ค์ •

์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์ดํŽ™ํŠธ ์• ๋‹ˆ๋ฉ”์ด์…˜ ํ‚ค ๊ฐ’

์บ๋ฆญํ„ฐ์˜ ์›€์ง์ž„์— ๋งž์ถฐ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์žฌ์ƒํ•  ์ˆ˜ ์žˆ๋„๋ก ์„ค์ •์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. (์ฐธ๊ณ  ๋ฌธ์„œ)

์บ๋ฆญํ„ฐ์˜ ์›€์ง์ž„์— ๋Œ€์‘ํ•˜๋Š” ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ์ •์˜๋˜์–ด ์žˆ์ง€ ์•Š์€ ๊ฒฝ์šฐ ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ์žฌ์ƒ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

down_idle // ์ •๋ฉด์—์„œ ๋Œ€๊ธฐ ์ƒํƒœ
down // ์ •๋ฉด์—์„œ ์ด๋™ ์ค‘
left_idle // ์™ผ์ชฝ ๋ฐฉํ–ฅ์—์„œ ๋Œ€๊ธฐ ์ƒํƒœ
left // ์™ผ์ชฝ ๋ฐฉํ–ฅ์œผ๋กœ ์ด๋™ ์ค‘
right_idle // ์˜ค๋ฅธ์ชฝ ๋ฐฉํ–ฅ์—์„œ ๋Œ€๊ธฐ ์ƒํƒœ
right // ์˜ค๋ฅธ์ชฝ ๋ฐฉํ–ฅ์œผ๋กœ ์ด๋™ ์ค‘
up_idle // ์œ„์ชฝ ๋ฐฉํ–ฅ์—์„œ ๋Œ€๊ธฐ ์ƒํƒœ
up // ์œ„์ชฝ  ๋ฐฉํ–ฅ์œผ๋กœ ์ด๋™ ์ค‘
dance // ์ถค์ถ”๋Š” ๋ชจ์…˜
down_jump, // ์ •๋ฉด์—์„œ ์ ํ”„ํ•˜๋Š” ๋ชจ์…˜
left_jump, // ์™ผ์ชฝ ๋ฐฉํ–ฅ์œผ๋กœ ์ ํ”„ํ•˜๋Š” ๋ชจ์…˜
right_jump, // ์˜ค๋ฅธ์ชฝ ๋ฐฉํ–ฅ์œผ๋กœ ์ ํ”„ํ•˜๋Š” ๋ชจ์…˜
up_jump, // ์œ„์ชฝ ๋ฐฉํ–ฅ์œผ๋กœ ์ ํ”„ํ•˜๋Š” ๋ชจ์…˜
down_sit, // ์ •๋ฉด ๋ฐฉํ–ฅ์œผ๋กœ ์•‰์•„์žˆ๋Š” ๋ชจ์…˜
left_sit, // ์™ผ์ชฝ ๋ฐฉํ–ฅ์—์„œ ์•‰์•„์žˆ๋Š” ๋ชจ์…˜
right_sit, // ์˜ค๋ฅธ์ชฝ ๋ฐฉํ–ฅ์—์„œ ์•‰์•„์žˆ๋Š” ๋ชจ์…˜
up_sit // ํ›„๋ฉด์—์„œ ์•‰์•„์žˆ๋Š” ๋ชจ์…˜
down_attack // ์ •๋ฉด ๋ฐฉํ–ฅ ๊ณต๊ฒฉ ๋ชจ์…˜
left_attack // ์™ผ์ชฝ ๋ฐฉํ–ฅ ๊ณต๊ฒฉ ๋ชจ์…˜
right_attack // ์˜ค๋ฅธ์ชฝ ๋ฐฉํ–ฅ ๊ณต๊ฒฉ ๋ชจ์…˜
up_attack // ์œ„์ชฝ ๋ฐฉํ–ฅ ๊ณต๊ฒฉ ๋ชจ์…˜

์˜ˆ์ œ

ํ”Œ๋ ˆ์ด์–ด ๋ฐฐ๊ฒฝ์ด๋ฏธ์ง€ ์„ค์ •ํ•ด๋ณด๊ธฐ

let effect = App.loadSpritesheet(
	"effect_sprite.png",
	32,
	32,
	{
		down_idle: [0, 1, 2, 3],
		down_attack: [0, 1, 2, 3],
		down: [0, 1, 2, 3],

		left_idle: [4, 5, 6, 7],
		left_attack: [4, 5, 6, 7],
		left: [4, 5, 6, 7],

		right_idle: [8, 9, 10, 11],
		right_attack: [8, 9, 10, 11],
		right: [8, 9, 10, 11],

		up_idle: [0, 1, 2, 3],
		up_attack: [0, 1, 2, 3],
		up: [0, 1, 2, 3],

		dance: [0, 1, 2, 3],

		down_jump: [0],
		left_jump: [4],
		right_jump: [8],
		up_jump: [0],

		down_sit: [0, 1, 2, 3],
		left_sit: [4, 5, 6, 7],
		right_sit: [8, 9, 10, 11],
		up_sit: [0, 1, 2, 3],
	},
	5
);

// Q๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(KeyCodeType.Q, function (player) {
	player.setEffectSprite(effect, -32, -30, 0); // ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€ ์„ค์ •
	player.sendUpdated();
});

// W๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(KeyCodeType.W, function (player) {
	player.setEffectSprite(null); // ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€ ์‚ญ์ œ
	player.sendUpdated();
});

playEffectSprite

player.playEffectSprite(resource: ScriptDynamicResource, repeatNum, offsetX: Number, offsetY: Number)

ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์• ๋‹ˆ๋ฉ”์ด์…˜ ํšจ๊ณผ๋ฅผ repeatNum ํšŸ์ˆ˜๋งŒํผ ๋ฐ˜๋ณต ์žฌ์ƒํ•˜๊ณ  ์‚ฌ๋ผ์ง€๋Š” ํšจ๊ณผ๋ฅผ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

resource

ScriptDynamicResource

์Šคํฌ๋ฆฝํŠธ์— ๋กœ๋“œํ•œ ์ด๋ฏธ์ง€ ๊ฐ์ฒด

repeatNum

Number

์• ๋‹ˆ๋ฉ”์ด์…˜ ์žฌ์ƒ์„ ๋ฐ˜๋ณตํ•  ํšŸ์ˆ˜

offsetX

Number

px ๋‹จ์œ„๋กœ x ์ถ• ๋ฐฉํ–ฅ์˜ ์˜คํ”„์…‹์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋Š” ์†์„ฑ

offsetY

Number

px ๋‹จ์œ„๋กœ y ์ถ• ๋ฐฉํ–ฅ์˜ ์˜คํ”„์…‹์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋Š” ์†์„ฑ

์˜ˆ์ œ

1ํšŒ ์žฌ์ƒ ํ›„ ์‚ฌ๋ผ์ง€๋Š” ์ดํŽ™ํŠธ ํšจ๊ณผ

// ๋‹จ์ผ ์• ๋‹ˆ๋ฉ”์ด์…˜์œผ๋กœ ์ •์˜ํ•ด ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
let effect = App.loadSpritesheet("effect_sprite.png", 32, 32, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 5);

// Q๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(KeyCodeType.Q, function (player) {
	player.playEffectSprite(effect, 1, -32, -30);
});

disappearObject

player.disappearObject(key: String)

ํ”Œ๋ ˆ์ด์–ด ๊ฐœ์ธ ํ™”๋ฉด ์ƒ์—์„œ key ๊ฐ’์„ ๊ฐ€์ง€๋Š” ์˜ค๋ธŒ์ ํŠธ๋ฅผ ์‚ฌ๋ผ์ง€๊ฒŒํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

key

String

์‚ฌ๋ผ์ง€๊ฒŒํ•  ์˜ค๋ธŒ์ ํŠธ์˜ key ๊ฐ’

์˜ˆ์ œ

์˜ค๋ธŒ์ ํŠธ์™€ ์ƒํ˜ธ์ž‘์šฉ ์‹œ ๊ฐœ์ธ์—๊ฒŒ ์‚ฌ๋ผ์ง€๊ฒŒ ํ•˜๊ธฐ

let blueman = App.loadSpritesheet("blueman.png");

App.onJoinPlayer.Add(function (player) {
	Map.putObjectWithKey(player.tileX + 1, player.tileY, blueman, {
		type: 21,
		impassable: true,
		key: "objectKey",
	});
});

App.onTriggerObject.Add(function (player, layerID, x, y, key) {
	if(key){
	    player.disappearObject(key);
	}
});

๐Ÿ”‰ Sound Methods

Sound Methods ํ•จ์ˆ˜ ํ•œ ๋ˆˆ์— ๋ณด๊ธฐ

// ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์‚ฌ์šด๋“œ๋ฅผ ์žฌ์ƒ
player.playSound(fileName: string, loop: boolean = false)

// ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ๋งํฌ์— ํ•ด๋‹นํ•˜๋Š” ์‚ฌ์šด๋“œ๋ฅผ ์žฌ์ƒ
player.playSoundLink(link: string, loop: boolean = false)

playSound

player.playSound(fileName: string, loop: boolean = false, overlap: boolean = false, key: string = "ambient", volume: number = 1)

ํ•ด๋‹น ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์‚ฌ์šด๋“œ๋ฅผ ์žฌ์ƒํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

fileName

String

๋ถˆ๋Ÿฌ์˜ฌ ํŒŒ์ผ์˜ ์ด๋ฆ„

loop

boolean

true: ๋ฐ˜๋ณต ์žฌ์ƒ false: 1ํšŒ ์žฌ์ƒ

overlap

boolean

์‚ฌ์šด๋“œ ์˜ค๋ฒ„๋žฉ(๊ฒน์นจ) ์žฌ์ƒ ๊ฐ€๋Šฅ ์—ฌ๋ถ€

key

string

์žฌ์ƒํ•˜๋Š” ์‚ฌ์šด๋“œ๋ฅผ ์‹๋ณ„ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋˜๋Š” ๋ฌธ์ž์—ด์ž…๋‹ˆ๋‹ค. ๊ธฐ๋ณธ ๊ฐ’์€ "ambient"๋กœ ์„ค์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

volume

number

์‚ฌ์šด๋“œ์˜ ๋ณผ๋ฅจ์„ ์กฐ์ ˆํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋˜๋Š” ์ˆซ์ž์ž…๋‹ˆ๋‹ค. ๊ฐ’์˜ ๋ฒ”์œ„๋Š” 0์—์„œ 1๊นŒ์ง€์ด๋ฉฐ, 0์€ ์†Œ๋ฆฌ๊ฐ€ ์—†์Œ์„ ๋‚˜ํƒ€๋‚ด๊ณ , 1์€ ์ตœ๋Œ€ ๋ณผ๋ฅจ์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค.

์˜ˆ์ œ

์ž…์žฅ์Œ ์„ค์ •ํ•ด๋ณด๊ธฐ(ํŒŒ์ผ)

// ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ž…์žฅํ•  ๋•Œ ์‹คํ–‰
App.onJoinPlayer.Add(function (player) {
	player.playSound("join.mp3",false, true, "join", 0.5);
});

player.playSoundLink(link: string, loop: boolean = false, overlap: boolean = false, key: string = "ambient", volume: number = 1)

๋ชจ๋“  ํ”Œ๋ ˆ์ด์–ด์—๊ฒŒ ์‚ฌ์šด๋“œ๋ฅผ ์žฌ์ƒํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

๐Ÿ’ก ์˜ฌ๋ฐ”๋ฅธ ๋งํฌ๋ฅผ ์ž…๋ ฅํ–ˆ๋Š”๋ฐ ์žฌ์ƒ์ด ๋˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ

CORS ์ •์ฑ…์„ ์œ„๋ฐ˜ํ•œ ๊ฒฝ์šฐ์ผ ๊ฐ€๋Šฅ์„ฑ์ด ๋†’์Šต๋‹ˆ๋‹ค. CORS ์ •์ฑ…์„ ๋งž์ถœ ์ˆ˜ ์—†๋Š” ๊ฒฝ์šฐ์—๋Š” playSoundLink ๋Œ€์‹  ์Œ์•… ํŒŒ์ผ์„ ์—…๋กœ๋“œ ํ•˜์—ฌ playSound ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์„ ๊ถŒ์žฅ ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

link

String

์‚ฌ์šด๋“œ url

loop

boolean

true: ๋ฐ˜๋ณต ์žฌ์ƒ false: 1ํšŒ ์žฌ์ƒ

overlap

boolean

์‚ฌ์šด๋“œ ์˜ค๋ฒ„๋žฉ(๊ฒน์นจ) ์žฌ์ƒ ๊ฐ€๋Šฅ ์—ฌ๋ถ€

key

string

์žฌ์ƒํ•˜๋Š” ์‚ฌ์šด๋“œ๋ฅผ ์‹๋ณ„ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋˜๋Š” ๋ฌธ์ž์—ด์ž…๋‹ˆ๋‹ค. ๊ธฐ๋ณธ ๊ฐ’์€ "ambient"๋กœ ์„ค์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

volume

number

์‚ฌ์šด๋“œ์˜ ๋ณผ๋ฅจ์„ ์กฐ์ ˆํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋˜๋Š” ์ˆซ์ž์ž…๋‹ˆ๋‹ค. ๊ฐ’์˜ ๋ฒ”์œ„๋Š” 0์—์„œ 1๊นŒ์ง€์ด๋ฉฐ, 0์€ ์†Œ๋ฆฌ๊ฐ€ ์—†์Œ์„ ๋‚˜ํƒ€๋‚ด๊ณ , 1์€ ์ตœ๋Œ€ ๋ณผ๋ฅจ์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค.

์˜ˆ์ œ

์ž…์žฅ์Œ ์„ค์ •ํ•ด๋ณด๊ธฐ(์‚ฌ์šด๋“œ url)

// ํ”Œ๋ ˆ์ด์–ด๊ฐ€ ์ž…์žฅํ•  ๋•Œ ์‹คํ–‰
App.onJoinPlayer.Add(function (player) {
	player.playSoundLink("https://cdn-static-stage.zep.us/static/assets/sounds/new_donation_1.wav", false, true, "join", 0.5);
});

stopSound

player.stopSound(key: string)

key์— ํ•ด๋‹นํ•˜๋Š” ์‚ฌ์šด๋“œ์˜ ์žฌ์ƒ์„ ์ค‘์ง€ํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

์ด๋ฆ„ํƒ€์ž…์„ค๋ช…

key

string

์ค‘์ง€ํ•˜๋ ค๋Š” ์‚ฌ์šด๋“œ์˜ ํ‚ค ๊ฐ’

์˜ˆ์ œ

์žฌ์ƒ ์ค‘์ธ ์‚ฌ์šด๋“œ ์ค‘์ง€ ์‹œํ‚ค๊ธฐ ์•„๋ž˜ ์˜ˆ์ œ ์ฝ”๋“œ ์‹คํ–‰ ํ›„ Q, W ํ‚ค๋ฅผ ์—ฐ์†์œผ๋กœ ์ž…๋ ฅํ•ด๋ณด์„ธ์š”.

//Q๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(KeyCodeType.q,(player)=>{
	player.playSoundLink("https://cdn-static-stage.zep.us/static/assets/sounds/new_donation_1.wav", false, true, "donation", 0.5);
});

//W๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์ž‘ํ•˜๋Š” ํ•จ์ˆ˜
App.addOnKeyDown(KeyCodeType.w, (player)=>{
    player.stopSound("donation")
});

๐Ÿ’  ๊ณตํ†ต Methods

๊ณตํ†ต Methods ํ•จ์ˆ˜ ํ•œ ๋ˆˆ์— ๋ณด๊ธฐ

// ํ”Œ๋ ˆ์ด์–ด ํ•„๋“œ๊ฐ’์„ ์ˆ˜์ •ํ•œ ํ›„ ์—…๋ฐ์ดํŠธ
player.sendUpdated()

// ํ”Œ๋ ˆ์ด์–ด ์Šคํ† ๋ฆฌ์ง€๊ฐ’์„ ์ €์žฅ
player.save()

sendUpdated

player.sendUpdated()

App, Player ๊ด€๋ จ ํ•„๋“œ ๊ฐ’์ด ๋ณ€๊ฒฝ๋˜๋ฉด ๋ณ€๊ฒฝ ๊ฐ’์„ ์ ์šฉํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

  • ์—†์Œ

save

player.save()

App, Player storage ๊ฐ’์ด ๋ณ€๊ฒฝ๋˜๋ฉด ๋ณ€๊ฒฝ ๊ฐ’์„ ์ ์šฉํ•˜๋Š” ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

ํŒŒ๋ผ๋ฏธํ„ฐ

  • ์—†์Œ


Last updated