Esempio n. 1
0
def create(args):
    g = GumpMenu("", 250, 150)
    g.store["serial"] = args["serial"]  # to be included in the response
    g.store["menuid"] = args["menuid"]  # to be included in the response

    g.addBackground((0, 0, 250, 300), 3000)

    title = g.addLabel((5, 7, 240, 20), args["question"])
    title.halign = HAlign.CENTER

    scroll = theme.addScrollArea(g, (5, 30, 240, 265))

    # args["answers"] is a list of tuples
    # (answerid, text, artid, hue)
    y = 0
    for answer in args["answers"]:
        if answer[2] == 0:
            # question only
            btText = theme.addPythonButton(scroll, (5, y + 5, 210, 25),
                                           onButtonClick)
            btText.store["data"] = answer
            btText.text = answer[1]
        else:
            # display art texture
            btArt = scroll.addPythonButton((5, y + 5),
                                           Texture(TextureSource.STATICART,
                                                   answer[2]), onButtonClick)
            btArt.store["data"] = answer
            btArt.hue = answer[3]
            scroll.addLabel((50, y + 10), answer[1])
        y += 28

    scroll.updateScrollbars()
    return g
Esempio n. 2
0
def create(args):
    g = GumpMenu("shardlist", 400, 300)
    g.closable = False

    shardlist = args["shardlist"]
    if len(shardlist) > 0:
        g.onEnter = selectFirst
        g.store["firstName"] = shardlist[0]
    else:
        g.onEnter = createShard

    g.addImage((0, 0), Texture(TextureSource.THEME, "images/background_250x250.png"))

    scroll = theme.addScrollArea(g, (20, 20, 210, 137))

    y = 0
    for shard in shardlist:
        btnShard = theme.addPythonButton(scroll, (0, y, 190, 25), selectShard)
        btnShard.text = shard
        btnShard.store["shard"] = shard
        y += 28

    scroll.updateScrollbars()

    btnCreate = theme.addPythonButton(g, (20, 175, 210, 25), createShard)
    btnCreate.text = "Create shard"

    btnExit = theme.addPythonButton(g, (20, 203, 210, 25), shutdown)
    btnExit.text = "Exit"
def create(args):
    g = GumpMenu("", 250, 150)
    g.store["serial"] = args["serial"] # to be included in the response
    g.store["menuid"] = args["menuid"] # to be included in the response

    g.addBackground((0, 0, 250, 300), 3000)

    title = g.addLabel((5, 7, 240, 20), args["question"])
    title.halign = HAlign.CENTER

    scroll = theme.addScrollArea(g, (5, 30, 240, 265))

    # args["answers"] is a list of tuples
    # (answerid, text, artid, hue)
    y = 0
    for answer in args["answers"]:
        if answer[2] == 0:
            # question only
            btText = theme.addPythonButton(scroll, (5, y + 5, 210, 25), onButtonClick)
            btText.store["data"] = answer
            btText.text = answer[1]
        else:
            # display art texture
            btArt = scroll.addPythonButton((5, y + 5), Texture(TextureSource.STATICART, answer[2]), onButtonClick)
            btArt.store["data"] = answer
            btArt.hue = answer[3]
            scroll.addLabel((50, y + 10), answer[1])
        y += 28

    scroll.updateScrollbars()
    return g
Esempio n. 4
0
def create(args):
    g = GumpMenu("shardlist", 400, 300)
    g.closable = False

    shardlist = args["shardlist"]
    if len(shardlist) > 0:
        g.onEnter = selectFirst
        g.store["firstName"] = shardlist[0]
    else:
        g.onEnter = createShard

    g.addImage((0, 0),
               Texture(TextureSource.THEME, "images/background_250x250.png"))

    scroll = theme.addScrollArea(g, (20, 20, 210, 137))

    y = 0
    for shard in shardlist:
        btnShard = theme.addPythonButton(scroll, (0, y, 190, 25), selectShard)
        btnShard.text = shard
        btnShard.store["shard"] = shard
        y += 28

    scroll.updateScrollbars()

    btnCreate = theme.addPythonButton(g, (20, 175, 210, 25), createShard)
    btnCreate.text = "Create shard"

    btnExit = theme.addPythonButton(g, (20, 203, 210, 25), shutdown)
    btnExit.text = "Exit"
Esempio n. 5
0
def create(args):
    g = GumpMenu("serverlist", 400, 300)
    g.closable = False

    print args

    serverList = args["serverlist"]
    # serverlist is a list of tuples (index, name)
    if len(serverList) > 0:
        g.onEnter = selectFirst
        g.store["firstServer"] = serverList[0][0]

    g.addImage((0, 0),
               Texture(TextureSource.THEME, "images/background_250x250.png"))

    scroll = theme.addScrollArea(g, (20, 20, 210, 137))

    y = 0
    for (idx, name) in serverList:
        btnServer = theme.addPythonButton(scroll, (0, y, 190, 25),
                                          selectServer)
        btnServer.text = name
        btnServer.store["server"] = idx
        y += 28

    scroll.updateScrollbars()

    btnDisconnect = theme.addPythonButton(g, (20, 175, 210, 25), disconnect)
    btnDisconnect.text = "Disconnect"

    btnExit = theme.addPythonButton(g, (20, 203, 210, 25), shutdown)
    btnExit.text = "Exit"
Esempio n. 6
0
def create(args):
    g = GumpMenu("skills", args.get("x", 100), args.get("y", 100))
    g.mobile = args["mobile"]
    g.onPropertyUpdate = updateSkillValues

    g.addBackground((0, 0, 400, 400), 3000)
    scroll = theme.addScrollArea(g, (5, 5, 390, 390))

    # list of tuples:
    # [0]: id
    # [1]: usable
    # [2]: name
    skills = getSkillList()

    yOffset = 0
    for cur in skills:
        if (cur[1]):
            b = scroll.addPythonButton((1, 3 + yOffset),
                                       Texture(TextureSource.GUMPART, 2103),
                                       useSkill)
            b.state("mouseDown").texture = Texture(TextureSource.GUMPART, 2104)
            b.store["skillid"] = cur[0]

        scroll.addLabel((15, 1 + yOffset, 180, 20), cur[2])

        lValue = scroll.addLabel((200, 1 + yOffset, 80, 20), "")
        lValue.name = "lValue.%s" % cur[2]

        lBase = scroll.addLabel((290, 1 + yOffset, 80, 20), "")
        lBase.name = "lBase.%s" % cur[2]

        yOffset += 22

    scroll.updateScrollbars()

    # init labels
    updateSkillValues(g)

    return g
Esempio n. 7
0
def create(args):
    g = GumpMenu("characterlist", 400, 300)
    g.closable = False

    charList = args["characterlist"]
    # characterlist is a list of tuples (index, name, password)
    if len(charList) > 0:
        g.onEnter = selectFirst
        g.store["index"] = charList[0][0]
        g.store["name"] = charList[0][1]
        g.store["password"] = charList[0][2]

    g.addImage((0, 0), Texture(TextureSource.THEME, "images/background_250x250.png"))

    scroll = theme.addScrollArea(g, (20, 20, 210, 137))

    y = 0
    for (idx, name, password) in charList:
        btnChar = theme.addPythonButton(scroll, (0, y, 160, 25), selectCharacter)
        btnChar.text = name
        btnChar.store["index"] = idx
        btnChar.store["name"] = name
        btnChar.store["password"] = password

        btnDel = theme.addPythonButton(scroll, (165, y, 25, 25), deleteCharacter)
        btnDel.store["index"] = idx
        btnDel.store["password"] = password
        btnDel.text = "X"

        y += 28

    scroll.updateScrollbars()

    btnDummy = theme.addPythonButton(g, (20, 175, 210, 25), createDummyCharacter)
    btnDummy.text = "Create Dummy Character"

    btnDisconnect = theme.addPythonButton(g, (20, 203, 210, 25), disconnect)
    btnDisconnect.text = "Disconnect"
Esempio n. 8
0
def create(args):
    g = GumpMenu("skills", args.get("x", 100), args.get("y", 100))
    g.mobile = args["mobile"]
    g.onPropertyUpdate = updateSkillValues

    g.addBackground((0, 0, 400, 400), 3000)
    scroll = theme.addScrollArea(g, (5, 5, 390, 390))

    # list of tuples:
    # [0]: id
    # [1]: usable
    # [2]: name
    skills = getSkillList()

    yOffset = 0
    for cur in skills:
        if (cur[1]):
            b = scroll.addPythonButton((1, 3 + yOffset), Texture(TextureSource.GUMPART, 2103), useSkill)
            b.state("mouseDown").texture = Texture(TextureSource.GUMPART, 2104)
            b.store["skillid"] = cur[0]

        scroll.addLabel((15, 1 + yOffset, 180, 20), cur[2])

        lValue = scroll.addLabel((200, 1 + yOffset, 80, 20), "")
        lValue.name = "lValue.%s" % cur[2]

        lBase = scroll.addLabel((290, 1 + yOffset, 80, 20), "")
        lBase.name = "lBase.%s" % cur[2]

        yOffset += 22

    scroll.updateScrollbars()

    # init labels
    updateSkillValues(g)

    return g