当前位置: 首页>>代码示例>>Python>>正文


Python Panel.__init__方法代码示例

本文整理汇总了Python中client.ui.controls.Panel.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Panel.__init__方法的具体用法?Python Panel.__init__怎么用?Python Panel.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在client.ui.controls.Panel的用法示例。


在下文中一共展示了Panel.__init__方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from client.ui.controls import Panel [as 别名]
# 或者: from client.ui.controls.Panel import __init__ [as 别名]
    def __init__(self, trans, *a, **k):
        self.trans = trans
        cards = trans.cards
        self.inputlet = None

        w = 20 + (91 + 10) * 4 + 20
        h = 20 + 125 + 20 + 125 + 20 + 20

        self.lbl = Label(
            text=u"等待其他玩家操作", x=w//2, y=300, font_size=12,
            color=(255, 255, 160, 255), shadow=(2, 0, 0, 0, 230),
            anchor_x='center', anchor_y='bottom'
        )

        Panel.__init__(self, width=1, height=1, zindex=5, *a, **k)
        parent = self.parent
        self.x, self.y = (parent.width - w)//2, (parent.height - h)//2 + 20
        self.width, self.height = w, h
        self.update()

        self.mapping = mapping = {}
        for i, c in enumerate(cards):
            y, x = divmod(i, 4)
            x, y = 20 + (91 + 10) * x, 20 + (125 + 20) * (1 - y)
            cs = CardSprite(c, parent=self, x=x, y=y)
            cs.associated_card = c
            mapping[id(c)] = cs

            @cs.event
            def on_mouse_dblclick(x, y, button, modifier, cs=cs):
                if cs.gray: return
                ilet = self.inputlet
                if not ilet: return
                ilet.set_card(cs.associated_card)
                ilet.done()
开发者ID:feisuzhu,项目名称:thbattle,代码行数:37,代码来源:inputs.py

示例2: __init__

# 需要导入模块: from client.ui.controls import Panel [as 别名]
# 或者: from client.ui.controls.Panel import __init__ [as 别名]
            def __init__(self, game_id, *a, **k):
                Panel.__init__(
                    self, width=550, height=340,
                    zindex=10000,
                    *a, **k
                )
                self.game_id = game_id
                self.x = (self.overlay.width - 550) // 2
                self.y = (self.overlay.height - 340) // 2

                self.btncancel = btncancel = Button(
                    u'取消', parent=self, x=440, y=25, width=90, height=40
                )

                self.labels = pyglet.graphics.Batch()

                Label(
                    u'旁观游戏', font_size=12, x=275, y=306,
                    anchor_x='center', anchor_y='bottom',
                    color=Colors.green.heavy + (255, ),
                    shadow=(2, 207, 240, 156, 204),
                    batch=self.labels,
                )

                @btncancel.event
                def on_click():
                    self.delete()

                Executive.call('query_gameinfo', ui_message, game_id)
开发者ID:feng2606,项目名称:thbattle,代码行数:31,代码来源:screens.py

示例3: __init__

# 需要导入模块: from client.ui.controls import Panel [as 别名]
# 或者: from client.ui.controls.Panel import __init__ [as 别名]
    def __init__(self, g, *a, **k):
        Panel.__init__(self, width=550, height=340, zindex=10000, *a, **k)
        parent = self.parent
        self.x = (parent.width - 550) // 2
        self.y = (parent.height - 340) // 2
        self.textarea = ta = TextArea(
            parent=self, x=30, y=30, width=550-30, height=340-60,
            font_size=12,
        )
        ta.text = u''
        winners = g.winners
        for p in g.players:
            s = u'|G%s|r(|R%s|r, |c0000ffff%s|r, %s)\n' % (
                p.ui_meta.char_name, p.account.username.replace('|', '||'),
                g.ui_meta.identity_table[p.identity.type],
                u'|R胜利|r' if p in winners else u'失败'
            )
            ta.append(s)

        if g.me in winners:
            self.pic = gres.win
        else:
            self.pic = gres.lose

        close = Button(
            u'关闭', parent=self, x=440, y=25, width=90, height=40
        )

        @close.event
        def on_click():
            self.delete()
开发者ID:AojiaoZero,项目名称:thbattle,代码行数:33,代码来源:view.py

示例4: __init__

# 需要导入模块: from client.ui.controls import Panel [as 别名]
# 或者: from client.ui.controls.Panel import __init__ [as 别名]
    def __init__(self, trans, *a, **k):
        self.trans = trans
        self.pbar = None

        g = Game.getgame()
        choices = trans.mapping[g.me]

        w, h = 500 + 1*160, 390 + 1*113
        Panel.__init__(self, width=w, height=h, zindex=5, *a, **k)
        p = self.parent
        pw, ph = p.width, p.height
        self.x, self.y = (pw-w)/2, (ph-h)/2
        self.inputlet = None
        choices = self.choices = [c for c in choices if c.char_cls and not getattr(c, 'chosen', False)]
        self.selectors = selectors = []
        for i, c in enumerate(choices):
            y, x = divmod(i, 4)
            x, y = 15 + 160*x, 45 + 113*(3-y)
            gs = GirlSelector(c, selectors, parent=self, x=x, y=y)

            @gs.event
            def on_dblclick(gs=gs):
                c = gs.choice
                ilet = self.inputlet
                if not c.chosen and ilet:
                    ilet.set_choice(c)
                    ilet.done()
                    self.end_selection()

            selectors.append(gs)
开发者ID:AojiaoZero,项目名称:thbattle,代码行数:32,代码来源:inputs.py

示例5: __init__

# 需要导入模块: from client.ui.controls import Panel [as 别名]
# 或者: from client.ui.controls.Panel import __init__ [as 别名]
            def __init__(self, text, *a, **k):
                Panel.__init__(self, *a, **k)
                self.zindex = 100
                w, h = self.width, self.height
                ta = TextArea(parent=self, font_size=12, x=2, y=60, width=w - 4, height=h - 4 - 60)
                ta.append(text)
                btn = Button(u"关闭", parent=self, x=(w - 120) // 2, y=20, width=120, height=40)

                @btn.event
                def on_click():
                    self.delete()
开发者ID:hycxa,项目名称:thbattle,代码行数:13,代码来源:screens.py

示例6: __init__

# 需要导入模块: from client.ui.controls import Panel [as 别名]
# 或者: from client.ui.controls.Panel import __init__ [as 别名]
    def __init__(self, character, *a, **k):
        self.character = character
        ShownCardPanel.current = self

        categories = character.showncardlists

        h = 30 + len(categories)*145 + 10
        w = 100 + 6*93.0+30
        self.lbls = lbls = pyglet.graphics.Batch()

        Panel.__init__(self, width=1, height=1, zindex=5, *a, **k)

        y = 30

        i = 0
        for cat in reversed(categories):

            Label(
                text=CardList.ui_meta.lookup[cat.type], x=30, y=y+62+145*i, font_size=12,
                color=(255, 255, 160, 255), shadow=(2, 0, 0, 0, 130),
                anchor_x='left', anchor_y='center', batch=lbls,
            )
            ca = DropCardArea(
                parent=self,
                x=100, y=y+145*i,
                fold_size=6,
                width=6*93, height=125,
            )
            for c in cat:
                cs = CardSprite(c, parent=ca)
                cs.associated_card = c
            ca.update()
            i += 1

        p = self.parent
        self.x, self.y = (p.width - w)//2, (p.height - h)//2
        self.width, self.height = w, h
        self.update()

        btn = ImageButton(
            common_res.buttons.close_blue,
            parent=self,
            x=w-20, y=h-20,
        )

        @btn.event
        def on_click():
            self.delete()
开发者ID:AojiaoZero,项目名称:thbattle,代码行数:50,代码来源:game_controls.py

示例7: __init__

# 需要导入模块: from client.ui.controls import Panel [as 别名]
# 或者: from client.ui.controls.Panel import __init__ [as 别名]
 def __init__(self, selection_mode=0, *a, **k):
     self.selection_mode = selection_mode
     self.lbls = pyglet.graphics.Batch()
     self.selection = []
     Panel.__init__(self, width=1, height=1, *a, **k)
开发者ID:17night,项目名称:thbattle,代码行数:7,代码来源:game_controls.py


注:本文中的client.ui.controls.Panel.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。