本文整理汇总了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
)
示例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
示例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()
示例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()
)
示例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
示例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)
示例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']
示例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 = {}