slides have animations for def->pro and pro->def
This commit is contained in:
parent
c911fa00b0
commit
4a823abf32
105
gameview.py
105
gameview.py
@ -345,6 +345,9 @@ class AOCharMovie(QtGui.QLabel):
|
|||||||
self.xx = x
|
self.xx = x
|
||||||
self.yy = y
|
self.yy = y
|
||||||
super(AOCharMovie, self).move(x, y)
|
super(AOCharMovie, self).move(x, y)
|
||||||
|
|
||||||
|
def move_slide(self, x):
|
||||||
|
super(AOCharMovie, self).move(x, self.y())
|
||||||
|
|
||||||
def set_flipped(self, flip):
|
def set_flipped(self, flip):
|
||||||
self.m_flipped = flip
|
self.m_flipped = flip
|
||||||
@ -860,6 +863,11 @@ class gui(QtGui.QWidget):
|
|||||||
self.court.resize(VIEWPORT_W, VIEWPORT_H)
|
self.court.resize(VIEWPORT_W, VIEWPORT_H)
|
||||||
|
|
||||||
self.slide_available = False
|
self.slide_available = False
|
||||||
|
self.slide_has_overlay = False
|
||||||
|
self.slide_kind = 0 # 0 = def-pro, 1 = def-wit, 2 = pro-wit
|
||||||
|
self.slide_direction = 0 # 0 = left to right, 1 = right to left
|
||||||
|
self.slide_stage = 0 # 0 = start, 1 = show wit, 2 = end
|
||||||
|
|
||||||
self.slide_bg = QtGui.QLabel(self.viewport)
|
self.slide_bg = QtGui.QLabel(self.viewport)
|
||||||
self.slide_bg_animation = QtCore.QPropertyAnimation(self.slide_bg, "geometry")
|
self.slide_bg_animation = QtCore.QPropertyAnimation(self.slide_bg, "geometry")
|
||||||
self.slide_bg_animation.finished.connect(self.slide_done)
|
self.slide_bg_animation.finished.connect(self.slide_done)
|
||||||
@ -873,19 +881,12 @@ class gui(QtGui.QWidget):
|
|||||||
self.sidechar = AOCharMovie(self.viewport)
|
self.sidechar = AOCharMovie(self.viewport)
|
||||||
self.sidechar.hide()
|
self.sidechar.hide()
|
||||||
|
|
||||||
self.slide_has_overlay = False
|
|
||||||
self.slide_overlay = QtGui.QLabel(self.viewport)
|
self.slide_overlay = QtGui.QLabel(self.viewport)
|
||||||
self.slide_overlay_animation = QtCore.QPropertyAnimation(self.slide_overlay, "geometry")
|
self.slide_overlay_animation = QtCore.QPropertyAnimation(self.slide_overlay, "geometry")
|
||||||
self.slide_overlay.hide()
|
self.slide_overlay.hide()
|
||||||
|
|
||||||
self.bench = QtGui.QLabel(self.viewport)
|
self.bench = QtGui.QLabel(self.viewport)
|
||||||
self.bench.resize(VIEWPORT_W, VIEWPORT_H)
|
self.bench.resize(VIEWPORT_W, VIEWPORT_H)
|
||||||
bench = QtGui.QPixmap(AOpath + 'background/default/defensedesk.png')
|
|
||||||
court = QtGui.QPixmap(AOpath + 'background/default/defenseempty.png')
|
|
||||||
if not court.isNull():
|
|
||||||
self.court.setPixmap(court.scaled(VIEWPORT_W, VIEWPORT_H, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
|
|
||||||
if not bench.isNull():
|
|
||||||
self.bench.setPixmap(bench.scaled(VIEWPORT_W, VIEWPORT_H, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation))
|
|
||||||
|
|
||||||
self.effectview = AOMovie(self.viewport)
|
self.effectview = AOMovie(self.viewport)
|
||||||
self.effectview.resize(VIEWPORT_W, VIEWPORT_H)
|
self.effectview.resize(VIEWPORT_W, VIEWPORT_H)
|
||||||
@ -2325,21 +2326,52 @@ class gui(QtGui.QWidget):
|
|||||||
self.slide_has_overlay = False
|
self.slide_has_overlay = False
|
||||||
|
|
||||||
self.bench.show()
|
self.bench.show()
|
||||||
self.chatbox.hide()
|
|
||||||
self.char.hide()
|
|
||||||
|
|
||||||
if reset:
|
if reset:
|
||||||
|
self.chatbox.hide()
|
||||||
|
self.char.hide()
|
||||||
self.set_scene(True)
|
self.set_scene(True)
|
||||||
|
|
||||||
def do_slide(self):
|
def do_slide(self, kind = 0, direction = 1):
|
||||||
self.setBackground("default")
|
self.setBackground("default") # testing only
|
||||||
|
|
||||||
slide_time = 1000
|
slide_time = 1000
|
||||||
self.bench.hide()
|
self.bench.hide()
|
||||||
|
|
||||||
self.slide_bg.show()
|
self.slide_bg.show()
|
||||||
bg_start = QtCore.QRect(0, 0, self.slide_bg.width(), VIEWPORT_H)
|
|
||||||
bg_end = QtCore.QRect(-bg_start.size().width() + VIEWPORT_W, bg_start.top(), bg_start.size().width(), VIEWPORT_H)
|
def_pos = QtCore.QRect(0, 0, self.slide_bg.width(), VIEWPORT_H)
|
||||||
|
pro_pos = QtCore.QRect(-def_pos.size().width() + VIEWPORT_W, def_pos.top(), def_pos.size().width(), VIEWPORT_H)
|
||||||
|
wit_pos = QtCore.QRect(0, 0, self.slide_bg.width(), VIEWPORT_H)
|
||||||
|
|
||||||
|
self.slide_kind = kind
|
||||||
|
self.slide_direction = direction
|
||||||
|
self.slide_stage = 0
|
||||||
|
|
||||||
|
if kind == 0:
|
||||||
|
if direction == 0:
|
||||||
|
bg_start = def_pos
|
||||||
|
bg_end = pro_pos
|
||||||
|
else:
|
||||||
|
bg_start = pro_pos
|
||||||
|
bg_end = def_pos
|
||||||
|
elif kind == 1:
|
||||||
|
slide_time /= 2
|
||||||
|
if direction == 0:
|
||||||
|
bg_start = def_pos
|
||||||
|
bg_end = wit_pos
|
||||||
|
else:
|
||||||
|
bg_start = wit_pos
|
||||||
|
bg_end = def_pos
|
||||||
|
elif kind == 2:
|
||||||
|
slide_time /= 2
|
||||||
|
if direction == 0:
|
||||||
|
bg_start = wit_pos
|
||||||
|
bg_end = pro_pos
|
||||||
|
else:
|
||||||
|
bg_start = pro_pos
|
||||||
|
bg_end = wit_pos
|
||||||
|
|
||||||
self.slide_bg_animation.setStartValue(bg_start)
|
self.slide_bg_animation.setStartValue(bg_start)
|
||||||
self.slide_bg_animation.setEndValue(bg_end)
|
self.slide_bg_animation.setEndValue(bg_end)
|
||||||
self.slide_bg_animation.setDuration(slide_time)
|
self.slide_bg_animation.setDuration(slide_time)
|
||||||
@ -2354,15 +2386,44 @@ class gui(QtGui.QWidget):
|
|||||||
self.slide_overlay_animation.setEasingCurve(QtCore.QEasingCurve.InOutQuad)
|
self.slide_overlay_animation.setEasingCurve(QtCore.QEasingCurve.InOutQuad)
|
||||||
self.slide_overlay_animation.start()
|
self.slide_overlay_animation.start()
|
||||||
|
|
||||||
def slide_done(self):
|
|
||||||
print "---------------------"
|
|
||||||
self.slide_bg.hide()
|
|
||||||
self.slide_overlay.hide()
|
|
||||||
|
|
||||||
def slide_changed(self):
|
def slide_changed(self):
|
||||||
x = self.slide_bg_animation.currentValue().toRect().x()
|
x = self.slide_bg_animation.currentValue().toRect().x()
|
||||||
if x < -648:
|
|
||||||
print "half"
|
if self.slide_kind == 0:
|
||||||
|
if self.slide_direction == 0:
|
||||||
|
if self.slide_stage == 0:
|
||||||
|
if x > -VIEWPORT_W:
|
||||||
|
self.char.move_slide(x)
|
||||||
|
else:
|
||||||
|
self.slide_stage = 1
|
||||||
|
elif self.slide_stage == 1:
|
||||||
|
if x <= -VIEWPORT_W and x >= -self.slide_bg.width() + self.slide_bg.width() / 2:
|
||||||
|
self.char.move_slide(x + self.slide_bg.width() / 2 - VIEWPORT_W / 2)
|
||||||
|
else:
|
||||||
|
self.slide_stage = 2
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
self.char.move_slide(x + self.slide_bg.width() - VIEWPORT_W)
|
||||||
|
else:
|
||||||
|
if self.slide_stage == 0:
|
||||||
|
if x < -self.slide_bg.width() + self.slide_bg.width() / 2:
|
||||||
|
self.char.move_slide(x + self.slide_bg.width() - VIEWPORT_W)
|
||||||
|
else:
|
||||||
|
self.slide_stage = 1
|
||||||
|
elif self.slide_stage == 1:
|
||||||
|
if x <= -VIEWPORT_W and x >= -self.slide_bg.width() + self.slide_bg.width() / 2:
|
||||||
|
self.char.move_slide(x + self.slide_bg.width() / 2 - VIEWPORT_W / 2)
|
||||||
|
else:
|
||||||
|
self.slide_stage = 2
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
self.char.move_slide(x)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def slide_done(self):
|
||||||
|
self.slide_bg.hide()
|
||||||
|
self.slide_overlay.hide()
|
||||||
|
|
||||||
def netmsg_hp(self, type, health):
|
def netmsg_hp(self, type, health):
|
||||||
if type == 1:
|
if type == 1:
|
||||||
@ -2386,8 +2447,6 @@ class gui(QtGui.QWidget):
|
|||||||
m_chatmessage[n_string] = p_contents[n_string]
|
m_chatmessage[n_string] = p_contents[n_string]
|
||||||
else:
|
else:
|
||||||
m_chatmessage[n_string] = ""
|
m_chatmessage[n_string] = ""
|
||||||
|
|
||||||
print m_chatmessage
|
|
||||||
|
|
||||||
f_char_id = int(m_chatmessage[CHAR_ID])
|
f_char_id = int(m_chatmessage[CHAR_ID])
|
||||||
|
|
||||||
@ -3217,7 +3276,7 @@ class gui(QtGui.QWidget):
|
|||||||
audio.pausehandle(self.music)
|
audio.pausehandle(self.music)
|
||||||
else:
|
else:
|
||||||
error = audio.getbasserror()
|
error = audio.getbasserror()
|
||||||
print "[audio] Couldn't play music. Error", error
|
#print "[audio] Couldn't play music. Error", error
|
||||||
# Here comes the evil HTTPS hack for XP systems, but it also allows us to download and play modules and midis, because, why not?
|
# Here comes the evil HTTPS hack for XP systems, but it also allows us to download and play modules and midis, because, why not?
|
||||||
musext = os.path.splitext(basename(musl))[-1]
|
musext = os.path.splitext(basename(musl))[-1]
|
||||||
if musext in ['.mid', '.midi']:
|
if musext in ['.mid', '.midi']:
|
||||||
|
Loading…
Reference in New Issue
Block a user