๐Ÿ”นText Button List

Text Button List ํ˜• ์œ„์ ฏ์€ ํ…์ŠคํŠธ์™€ ๋ฒ„ํŠผ์„ ํ•จ๊ป˜ ํ‘œ์‹œํ•  ์ˆ˜ ์žˆ๋Š” UI์ž…๋‹ˆ๋‹ค.

ํ™œ์šฉ ์•ฑ ) ์นด๋ฉ”๋ผ ๊ด€์ „ ํ”„๋ฆฌ๋ฏธ์—„ ๊ธฐ๋Šฅ

Image

Example

function openWidget(p)
{
    //Check if player is mobile or not
    if(p.isMobile)
        //Set the widget's name, anchor position, width, and height.
        p.tag.widget = p.showWidget('widget.html','sidebar',300,550);
    else
        p.tag.widget = p.showWidget('widget.html','sidebar',280,520);

    //Send data to widget
    p.tag.widget.sendMessage({
        isMobile : p.isMobile,
    })
    
    //Register events for messages sent from widgets
    p.tag.widget.onMessage.Add(function(sender, msg) {
        switch (msg.type)
        {
            case 'close':
                if(p.tag.widget)
                {
                    p.tag.widget.destroy();
                    p.tag.widget = null;
                }
                
                break;
        }
    })
}

//Event when a player joins the app
App.onJoinPlayer.Add(function(p) {
    // Initialize tag properties of player
    p.tag = {};
});

// Action when the player clicks the sidebar app
App.onSidebarTouched.Add(function(p) {
    openWidget(p);
});

Last updated