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


Python Control.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from client.ui.base import Control [as 别名]
# 或者: from client.ui.base.Control import __init__ [as 别名]
 def __init__(self, **k):
     pyglet.graphics.Batch.__init__(self)
     Control.__init__(
         self, x=0, y=0,
         width=0, height=0, zindex=2,
         **k
     )
开发者ID:AojiaoZero,项目名称:thbattle,代码行数:9,代码来源:view.py

示例2: __init__

# 需要导入模块: from client.ui.base import Control [as 别名]
# 或者: from client.ui.base.Control import __init__ [as 别名]
    def __init__(self, texture, prompt, parent, *a, **k):
        self.texture = texture
        self.prompt = prompt

        width = texture.width
        height = texture.height

        x = (parent.width - width) // 2
        y = (parent.height - height) // 2

        self._x = x
        self._y = y

        Control.__init__(self, *a, x=x, y=y, width=width, height=height, parent=parent, zindex=999999, **k)

        ta = TextArea(
            parent=self,
            # font_size=12,
            x=2, y=2, width=width, height=100,
        )

        ta.append(prompt)
        h = ta.content_height
        ta.height = h
        self.ta_height = h
开发者ID:AojiaoZero,项目名称:thbattle,代码行数:27,代码来源:game_controls.py

示例3: __init__

# 需要导入模块: from client.ui.base import Control [as 别名]
# 或者: from client.ui.base.Control import __init__ [as 别名]
        def __init__(self, parent=None):
            Control.__init__(self, parent=parent, **r2d((0, 0, 820, 720)))
            self.btn_getready = Button(
                parent=self, caption=u'准备', **r2d((360, 80, 100, 35))
            )

            self.ready = False

            l = []

            class MyPP(PlayerPortrait):
                # this class is INTENTIONALLY put here
                # to make cached avatars get gc'd
                cached_avatar = {}

            for x, y, color in parent.ui_class.portrait_location:
                l.append(MyPP('NONAME', parent=self, x=x, y=y, color=color))
            self.portraits = l

            @self.btn_getready.event
            def on_click():
                if self.ready:
                    Executive.call('cancel_ready', ui_message, [])
                    self.ready = False
                    self.btn_getready.caption = u'准备'
                    self.btn_getready.update()
                else:
                    Executive.call('get_ready', ui_message, [])
                    #self.btn_getready.state = Button.DISABLED
                    self.ready = True
                    self.btn_getready.caption = u'取消准备'
                    self.btn_getready.update()
开发者ID:feng2606,项目名称:thbattle,代码行数:34,代码来源:screens.py

示例4: __init__

# 需要导入模块: from client.ui.base import Control [as 别名]
# 或者: from client.ui.base.Control import __init__ [as 别名]
    def __init__(self, x0, y0, x1, y1, *args, **kwargs):
        Control.__init__(self, *args, **kwargs)
        from math import sqrt, atan2, pi

        self.x, self.y = x0, y0
        dx, dy = x1 - x0, y1 - y0
        scale = sqrt(dx * dx + dy * dy) / L("c-ray").width
        self.angle = atan2(dy, dx) / pi * 180
        self.scale = SineInterp(0.0, scale, 0.4)
        self.alpha = ChainInterp(
            FixedInterp(1.0, 1), CosineInterp(1.0, 0.0, 0.5), on_done=lambda self, desc: self.delete()
        )
开发者ID:feisuzhu,项目名称:thbattle,代码行数:14,代码来源:game_controls.py

示例5: __init__

# 需要导入模块: from client.ui.base import Control [as 别名]
# 或者: from client.ui.base.Control import __init__ [as 别名]
    def __init__(self, game, *a, **k):
        self.game = game
        game.event_observer = UIEventHook

        Control.__init__(self, *a, **k)

        self.char_portraits = None

        self.deck_indicator = DeckIndicator(parent=self, x=30, y=680, width=50, height=25)

        self.handcard_area = HandCardArea(parent=self, x=238, y=9, zindex=3, width=93 * 5 + 42, height=145)

        self.deck_area = PortraitCardArea(
            parent=self, width=1, height=1, x=self.width // 2, y=self.height // 2, zindex=4
        )

        self.btn_afk = Button(parent=self, caption=u"让⑨帮你玩", zindex=1, color=Colors.blue, **r2d((730, 640, 75, 25)))

        self.gameintro_icon = GameIntroIcon(parent=self, game=game, **r2d((780, 610, 25, 25)))

        self.afk = False

        @self.btn_afk.event
        def on_click():
            v = not self.afk
            self.afk = v
            self.btn_afk.color = (Colors.blue, Colors.orange)[v]
            self.btn_afk.update()

        @self.handcard_area.event
        def on_selection_change():
            self.dispatch_event("on_selection_change")

        self.dropcard_area = DropCardArea(parent=self, x=0, y=324, zindex=3, width=820, height=125)

        class Animations(pyglet.graphics.Batch, Control):
            def __init__(self, **k):
                pyglet.graphics.Batch.__init__(self)
                Control.__init__(self, x=0, y=0, width=0, height=0, zindex=2, **k)

            def hit_test(self, x, y):
                return False

        self.animations = Animations(parent=self)
        self.selecting_player = 0
开发者ID:CoolCloud,项目名称:thbattle,代码行数:47,代码来源:view.py

示例6: __init__

# 需要导入模块: from client.ui.base import Control [as 别名]
# 或者: from client.ui.base.Control import __init__ [as 别名]
        def __init__(self, parent=None):
            Control.__init__(self, parent=parent, **r2d((0, 0, 820, 720)))
            self.btn_getready = Button(parent=self, caption=u"准备", **r2d((360, 80, 100, 35)))

            self.btn_invite = Button(parent=self, caption=u"邀请", **r2d((360, 40, 100, 35)))

            self.ready = False

            l = []

            class MyPP(PlayerPortrait):
                # this class is INTENTIONALLY put here
                # to make cached avatars get gc'd
                cached_avatar = {}

            for x, y, color in parent.ui_class.portrait_location:
                l.append(MyPP("NONAME", parent=self, x=x, y=y, color=color))
            self.portraits = l

            @self.btn_getready.event
            def on_click():
                if self.ready:
                    Executive.call("cancel_ready", ui_message, [])
                    self.ready = False
                    self.btn_getready.caption = u"准备"
                    self.btn_getready.update()
                else:
                    Executive.call("get_ready", ui_message, [])
                    # self.btn_getready.state = Button.DISABLED
                    self.ready = True
                    self.btn_getready.caption = u"取消准备"
                    self.btn_getready.update()

            @self.btn_invite.event  # noqa
            def on_click():
                GameScreen.InvitePanel(self.parent.game.gameid, parent=self)
开发者ID:hycxa,项目名称:thbattle,代码行数:38,代码来源:screens.py

示例7: __init__

# 需要导入模块: from client.ui.base import Control [as 别名]
# 或者: from client.ui.base.Control import __init__ [as 别名]
 def __init__(self, fold_size=5, *args, **kwargs):
     Control.__init__(self, *args, **kwargs)
     self.fold_size = fold_size
     self.view = kwargs['parent']
开发者ID:17night,项目名称:thbattle,代码行数:6,代码来源:game_controls.py

示例8: __init__

# 需要导入模块: from client.ui.base import Control [as 别名]
# 或者: from client.ui.base.Control import __init__ [as 别名]
    def __init__(self, game, *a, **k):
        self.selection_change = ObservableEvent()

        self.game = game

        Control.__init__(self, can_focus=True, *a, **k)

        self.keystrokes = '\x00'
        self.char_portraits = None

        self.deck_indicator = DeckIndicator(
            parent=self, x=30, y=660, width=50, height=25,
        )

        self.handcard_area = HandCardArea(
            parent=self, view=self, x=238, y=9, zindex=3,
            width=93*5+42, height=145,
        )

        self.deck_area = PortraitCardArea(
            parent=self, width=1, height=1,
            x=self.width//2, y=self.height//2, zindex=4,
        )

        self.btn_afk = OptionButton(
            parent=self, zindex=1, conf=(
                (u'让⑨帮你玩', Colors.blue, False),
                (u'⑨在帮你玩', Colors.orange, True),
            ), **r2d((30, 625, 75, 25))
        )

        self.gameintro_icon = GameIntroIcon(
            parent=self, game=game,
            **r2d((690, 630, 25, 25))
        )

        self.dropcard_area = DropCardArea(
            parent=self, x=0, y=324, zindex=3,
            width=820, height=125,
        )

        class Animations(pyglet.graphics.Batch, Control):
            def __init__(self, **k):
                pyglet.graphics.Batch.__init__(self)
                Control.__init__(
                    self, x=0, y=0,
                    width=0, height=0, zindex=2,
                    **k
                )
                self.animations = []

            def delete(self):
                Control.delete(self)
                for a in self.animations:
                    a.delete()

            def hit_test(self, x, y):
                return False

        self.animations = Animations(parent=self)
        self.selecting_player = 0
        self.action_params = {}
开发者ID:feisuzhu,项目名称:thbattle,代码行数:64,代码来源:view.py


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