def process_user_input(self, ilet): g = Game.getgame() me = g.me choices = ilet.mapping[me] for i, c in enumerate(choices): c._choice_index = i w, h = CharacterSorterControl.expected_size(1, ilet.num) w = 20 + w + 20 h = 60 + h + 50 def lbl(text, x, y): Label( text=text, font_size=12, x=x, y=y, color=(255, 255, 160, 255), shadow=(2, 0, 0, 0, 190), anchor_x='center', anchor_y='center', batch=self.lbls, ) lbl(u'请拖动调整角色的出场顺序', w // 2, h - 25) parent = self.parent self.x, self.y = (parent.width - w) // 2, (parent.height - h) // 2 self.width, self.height = w, h self.update() self.sorter = sorter = CharacterSorterControl(ilet.num, ilet.limit, parent=self, x=20, y=60) selectors = [] for i, c in enumerate(choices): selectors.append(GirlSelector(c, selectors, parent=sorter)) sorter.init() btn = Button(parent=self, caption=u'调整完成', x=w - 120, y=15, width=100, height=30) @btn.event def on_click(*a, **k): gslist, = self.sorter.get_result() index = [c.choice._choice_index for c in gslist] ilet.set_result(index) ilet.done() end_transaction(self.trans) b = BigProgressBar(parent=self, x=100, y=15, width=250) b.value = LinearInterp(1.0, 0.0, ilet.timeout, on_done=on_click)
def process_user_input(self, ilet): cards = ilet.cards w, h = RanProphetControl.expected_size() w = 100 + w + 20 h = 60 + h + 50 def lbl(text, x, y): Label( text=text, x=x, y=y, font_size=12, anchor_x='center', anchor_y='center', color=(255, 255, 160, 255), shadow=(2, 0, 0, 0, 230), batch=self.lbls, ) lbl(u'牌堆底', 50, 122) lbl(u'牌堆顶', 50, 277) lbl(u'请拖动调整牌的位置', w // 2, h - 25) parent = self.parent self.x, self.y = (parent.width - w) // 2, (parent.height - h) // 2 self.width, self.height = w, h self.update() self.rpc = rpc = RanProphetControl(parent=self, x=100, y=60) for i, c in enumerate(cards): cs = CardSprite(c, parent=rpc) cs.associated_card = c rpc.init() btn = Button(parent=self, caption=u'调整完成', x=w - 120, y=15, width=100, height=30) @btn.event def on_click(*a): up, down = self.rpc.get_result() up = [c.associated_card for c in up] down = [c.associated_card for c in down] ilet.set_result(up, down) ilet.done() end_transaction(self.trans) b = BigProgressBar(parent=self, x=100, y=15, width=250) b.value = LinearInterp(1.0, 0.0, ilet.timeout, on_done=on_click)
def process_user_input(self, ilet): cards = ilet.cards w, h = KokoroHopeMaskControl.expected_size() w = 100 + w + 20 h = 60 + h + 50 def lbl(text, x, y): Label( text=text, x=x, y=y, font_size=12, anchor_x='center', anchor_y='center', color=(255, 255, 160, 255), shadow=(2, 0, 0, 0, 230), batch=self.lbls, ) lbl(u'请拖动调整牌的位置,获得的牌必须是同花色的', w//2, h-25) lbl(u'牌堆顶', 50, 277) lbl(u'展示并获得', 50, 122) parent = self.parent self.x, self.y = (parent.width - w)//2, (parent.height - h)//2 self.width, self.height = w, h self.update() self.ctrl = ctrl = KokoroHopeMaskControl(parent=self, x=100, y=60) for i, c in enumerate(cards): cs = CardSprite(c, parent=ctrl) cs.associated_card = c ctrl.init() btn = Button(parent=self, caption=u'完成', x=w-120, y=15, width=100, height=30) @btn.event def on_click(*a): putback, acquire = self.ctrl.get_result() putback = [c.associated_card for c in putback] acquire = [c.associated_card for c in acquire] ilet.set_result(putback, acquire) ilet.done() end_transaction(self.trans) @ctrl.event def on_update(): putback, acquire = self.ctrl.get_result() putback = [c.associated_card for c in putback] acquire = [c.associated_card for c in acquire] if ilet.is_valid(putback, acquire): btn.state = Button.NORMAL else: btn.state = Button.DISABLED b = BigProgressBar(parent=self, x=100, y=15, width=250) b.value = LinearInterp(1.0, 0.0, ilet.timeout, on_done=on_click)
def process_user_input(self, ilet): cards = ilet.cards w, h = KokoroHopeMaskControl.expected_size() w = 100 + w + 20 h = 60 + h + 50 def lbl(text, x, y): Label( text=text, x=x, y=y, font_size=12, anchor_x='center', anchor_y='center', color=(255, 255, 160, 255), shadow=(2, 0, 0, 0, 230), batch=self.lbls, ) lbl(u'请拖动调整牌的位置', w // 2, h - 25) lbl(u'牌堆顶', 50, 277) lbl(u'展示并获得', 50, 122) parent = self.parent self.x, self.y = (parent.width - w)//2, (parent.height - h)//2 self.width, self.height = w, h self.update() self.ctrl = ctrl = KokoroHopeMaskControl(parent=self, x=100, y=60) for i, c in enumerate(cards): cs = CardSprite(c, parent=ctrl) cs.associated_card = c ctrl.init() btn = Button(parent=self, caption=u'完成', x=w-120, y=15, width=100, height=30) @btn.event def on_click(*a): ilet.done() end_transaction(self.trans) @ctrl.event def on_update(): putback, acquire = self.ctrl.get_result() putback = [c.associated_card for c in putback] acquire = [c.associated_card for c in acquire] if ilet.is_valid(putback, acquire): ilet.set_result(putback, acquire) btn.state = Button.NORMAL else: btn.state = Button.DISABLED b = BigProgressBar(parent=self, x=100, y=15, width=250) b.value = LinearInterp(1.0, 0.0, ilet.timeout, on_done=on_click)
def process_user_input(self, ilet): g = Game.getgame() me = g.me choices = ilet.mapping[me] for i, c in enumerate(choices): c._choice_index = i w, h = CharacterSorterControl.expected_size(1, ilet.num) w = 20 + w + 20 h = 60 + h + 50 def lbl(text, x, y): Label( text=text, font_size=12, x=x, y=y, color=(255, 255, 160, 255), shadow=(2, 0, 0, 0, 190), anchor_x='center', anchor_y='center', batch=self.lbls, ) lbl(u'请拖动调整角色的出场顺序', w//2, h-25) parent = self.parent self.x, self.y = (parent.width - w)//2, (parent.height - h)//2 self.width, self.height = w, h self.update() self.sorter = sorter = CharacterSorterControl( ilet.num, ilet.limit, parent=self, x=20, y=60 ) selectors = [] for i, c in enumerate(choices): selectors.append( GirlSelector(c, selectors, parent=sorter) ) sorter.init() btn = Button(parent=self, caption=u'调整完成', x=w-120, y=15, width=100, height=30) @btn.event def on_click(*a, **k): gslist, = self.sorter.get_result() index = [c.choice._choice_index for c in gslist] ilet.set_result(index) ilet.done() end_transaction(self.trans) b = BigProgressBar(parent=self, x=100, y=15, width=250) b.value = LinearInterp(1.0, 0.0, ilet.timeout, on_done=on_click)
def process_user_input(self, ilet): cards = ilet.cards w, h = RanProphetControl.expected_size() w = 100 + w + 20 h = 60 + h + 50 def lbl(text, x, y): Label( text=text, x=x, y=y, font_size=12, anchor_x='center', anchor_y='center', color=(255, 255, 160, 255), shadow=(2, 0, 0, 0, 230), batch=self.lbls, ) lbl(u'牌堆底', 50, 122) lbl(u'牌堆顶', 50, 277) lbl(u'请拖动调整牌的位置', w//2, h-25) parent = self.parent self.x, self.y = (parent.width - w)//2, (parent.height - h)//2 self.width, self.height = w, h self.update() self.rpc = rpc = RanProphetControl(parent=self, x=100, y=60) for i, c in enumerate(cards): cs = CardSprite(c, parent=rpc) cs.associated_card = c rpc.init() btn = Button(parent=self, caption=u'调整完成', x=w-120, y=15, width=100, height=30) @btn.event def on_click(*a): up, down = self.rpc.get_result() up = [c.associated_card for c in up] down = [c.associated_card for c in down] ilet.set_result(up, down) ilet.done() end_transaction(self.trans) b = BigProgressBar(parent=self, x=100, y=15, width=250) b.value = LinearInterp(1.0, 0.0, ilet.timeout, on_done=on_click)