fixed objection sounds + separate label for pillow animations in aomovie
This commit is contained in:
parent
0efebb6135
commit
66a6e4a77f
@ -6,9 +6,12 @@ from pybass_constants import *
|
|||||||
|
|
||||||
audio.init()
|
audio.init()
|
||||||
|
|
||||||
mus = "http://files.catbox.moe/nyp4xo.mp3"
|
Miles = unicode("Miles")
|
||||||
|
|
||||||
music = audio.loadURLhandle(mus, 0, BASS_STREAM_BLOCK)
|
mus = "base/characters/"+str(Miles)+"/holdit.wav"
|
||||||
|
|
||||||
|
music = audio.loadhandle(False, mus, 0, 0, 0)
|
||||||
|
#music = audio.loadURLhandle(mus, 0, BASS_STREAM_BLOCK)
|
||||||
print "Trying to play", mus
|
print "Trying to play", mus
|
||||||
|
|
||||||
if music:
|
if music:
|
||||||
|
36
gameview.py
36
gameview.py
@ -319,15 +319,15 @@ class AOCharMovie(QtGui.QLabel):
|
|||||||
self.m_movie.stop()
|
self.m_movie.stop()
|
||||||
self.m_movie.setFileName(gif_path)
|
self.m_movie.setFileName(gif_path)
|
||||||
self.m_movie.start()
|
self.m_movie.start()
|
||||||
|
|
||||||
elif self.use_pillow == 1: # apng
|
elif self.use_pillow == 1: # apng
|
||||||
self.pillow_frames = images.load_apng(apng_path)
|
self.pillow_frames = images.load_apng(apng_path)
|
||||||
if len(self.pillow_frames) > 1: self.pillow_timer.start(int(self.pillow_frames[0][1] * self.pillow_speed))
|
if len(self.pillow_frames) > 1:
|
||||||
|
self.pillow_timer.start(int(self.pillow_frames[0][1] * self.pillow_speed))
|
||||||
self.set_pillow_frame()
|
self.set_pillow_frame()
|
||||||
|
|
||||||
elif self.use_pillow == 2: # webp
|
elif self.use_pillow == 2: # webp
|
||||||
self.pillow_frames = images.load_webp(webp_path)
|
self.pillow_frames = images.load_webp(webp_path)
|
||||||
if len(self.pillow_frames) > 1: self.pillow_timer.start(int(self.pillow_frames[0][1] * self.pillow_speed))
|
if len(self.pillow_frames) > 1:
|
||||||
|
self.pillow_timer.start(int(self.pillow_frames[0][1] * self.pillow_speed))
|
||||||
self.set_pillow_frame()
|
self.set_pillow_frame()
|
||||||
|
|
||||||
self.show()
|
self.show()
|
||||||
@ -468,6 +468,10 @@ class AOMovie(QtGui.QLabel):
|
|||||||
self.pillow_timer = QtCore.QTimer(self)
|
self.pillow_timer = QtCore.QTimer(self)
|
||||||
self.pillow_timer.setSingleShot(True)
|
self.pillow_timer.setSingleShot(True)
|
||||||
self.pillow_timer.timeout.connect(self.pillow_frame_change)
|
self.pillow_timer.timeout.connect(self.pillow_frame_change)
|
||||||
|
|
||||||
|
self.pillow_label = QtGui.QLabel(self)
|
||||||
|
self.pillow_label.setGeometry(0, 0, VIEWPORT_W, VIEWPORT_H)
|
||||||
|
self.pillow_label.hide()
|
||||||
|
|
||||||
def move(self, x, y):
|
def move(self, x, y):
|
||||||
self.xx = x
|
self.xx = x
|
||||||
@ -478,8 +482,6 @@ class AOMovie(QtGui.QLabel):
|
|||||||
self.play_once = once
|
self.play_once = once
|
||||||
|
|
||||||
def play(self, p_image, p_char=""):
|
def play(self, p_image, p_char=""):
|
||||||
self.stop()
|
|
||||||
|
|
||||||
gif_path = p_image
|
gif_path = p_image
|
||||||
pillow_modes = {".gif": 0, ".apng": 1, ".webp": 2}
|
pillow_modes = {".gif": 0, ".apng": 1, ".webp": 2}
|
||||||
|
|
||||||
@ -498,19 +500,24 @@ class AOMovie(QtGui.QLabel):
|
|||||||
if exists(f):
|
if exists(f):
|
||||||
gif_path = f
|
gif_path = f
|
||||||
break
|
break
|
||||||
|
|
||||||
self.use_pillow = pillow_modes[os.path.splitext(gif_path)[1]]
|
self.use_pillow = pillow_modes[os.path.splitext(gif_path)[1]]
|
||||||
|
|
||||||
if not self.use_pillow:
|
if not self.use_pillow:
|
||||||
self.m_movie.setFileName(gif_path)
|
self.m_movie.setFileName(gif_path)
|
||||||
self.m_movie.start()
|
self.m_movie.start()
|
||||||
elif self.use_pillow == 1: # apng
|
elif self.use_pillow == 1: # apng
|
||||||
|
self.pillow_label.show()
|
||||||
self.pillow_frames = images.load_apng(gif_path)
|
self.pillow_frames = images.load_apng(gif_path)
|
||||||
if len(self.pillow_frames) > 1: self.pillow_timer.start(int(self.pillow_frames[0][1] * self.pillow_speed))
|
if len(self.pillow_frames) > 1:
|
||||||
|
self.pillow_timer.start(int(self.pillow_frames[0][1] * self.pillow_speed))
|
||||||
self.set_pillow_frame()
|
self.set_pillow_frame()
|
||||||
elif self.use_pillow == 2: # webp
|
elif self.use_pillow == 2: # webp
|
||||||
|
self.pillow_label.show()
|
||||||
self.pillow_loops = 0
|
self.pillow_loops = 0
|
||||||
self.pillow_frames, self.webp_loops = images.load_webp(gif_path)
|
self.pillow_frames, self.webp_loops = images.load_webp(gif_path)
|
||||||
if len(self.pillow_frames) > 1: self.pillow_timer.start(int(self.pillow_frames[0][1] * self.pillow_speed))
|
if len(self.pillow_frames) > 1:
|
||||||
|
self.pillow_timer.start(int(self.pillow_frames[0][1] * self.pillow_speed))
|
||||||
self.set_pillow_frame()
|
self.set_pillow_frame()
|
||||||
|
|
||||||
self.show()
|
self.show()
|
||||||
@ -520,6 +527,8 @@ class AOMovie(QtGui.QLabel):
|
|||||||
self.pillow_frame = 0
|
self.pillow_frame = 0
|
||||||
self.pillow_timer.stop()
|
self.pillow_timer.stop()
|
||||||
self.m_movie.stop()
|
self.m_movie.stop()
|
||||||
|
self.pillow_label.clear()
|
||||||
|
self.pillow_label.hide()
|
||||||
self.hide()
|
self.hide()
|
||||||
|
|
||||||
@QtCore.pyqtSlot(int)
|
@QtCore.pyqtSlot(int)
|
||||||
@ -556,7 +565,7 @@ class AOMovie(QtGui.QLabel):
|
|||||||
f_img = f_img.scaled(VIEWPORT_W, VIEWPORT_H, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation)
|
f_img = f_img.scaled(VIEWPORT_W, VIEWPORT_H, QtCore.Qt.KeepAspectRatioByExpanding, QtCore.Qt.FastTransformation)
|
||||||
|
|
||||||
f_pixmap = QtGui.QPixmap.fromImage(f_img)
|
f_pixmap = QtGui.QPixmap.fromImage(f_img)
|
||||||
self.setPixmap(f_pixmap)
|
self.pillow_label.setPixmap(f_pixmap)
|
||||||
|
|
||||||
class ZoomLines(QtGui.QLabel):
|
class ZoomLines(QtGui.QLabel):
|
||||||
|
|
||||||
@ -1001,7 +1010,7 @@ class gui(QtGui.QWidget):
|
|||||||
self.takethatbtn = buttons.Objections(self, 170+ 516 - 20, 312 + 40, 3)
|
self.takethatbtn = buttons.Objections(self, 170+ 516 - 20, 312 + 40, 3)
|
||||||
self.objectbtn = buttons.Objections(self, 90+ 516 - 10, 312 + 40, 2)
|
self.objectbtn = buttons.Objections(self, 90+ 516 - 10, 312 + 40, 2)
|
||||||
self.holditbtn = buttons.Objections(self, 10+ 516, 312 + 40, 1)
|
self.holditbtn = buttons.Objections(self, 10+ 516, 312 + 40, 1)
|
||||||
self.objectsnd = None
|
self.objectsnd = 0
|
||||||
self.defensebar = buttons.PenaltyBars(self, 1)
|
self.defensebar = buttons.PenaltyBars(self, 1)
|
||||||
self.prosecutionbar = buttons.PenaltyBars(self, 2)
|
self.prosecutionbar = buttons.PenaltyBars(self, 2)
|
||||||
self.defensebar.moveBar(265 + 164, 164 + 304)
|
self.defensebar.moveBar(265 + 164, 164 + 304)
|
||||||
@ -2421,6 +2430,11 @@ class gui(QtGui.QWidget):
|
|||||||
audio.playhandle(self.realizationsnd, True)
|
audio.playhandle(self.realizationsnd, True)
|
||||||
|
|
||||||
def playObjectionSnd(self, charname, objection):
|
def playObjectionSnd(self, charname, objection):
|
||||||
|
try:
|
||||||
|
charname = str(charname)
|
||||||
|
except:
|
||||||
|
print "WARNING: Can't play objection sound if charname is unicode yet"
|
||||||
|
|
||||||
if self.objectsnd:
|
if self.objectsnd:
|
||||||
if audio.handleisactive(self.objectsnd):
|
if audio.handleisactive(self.objectsnd):
|
||||||
audio.stophandle(self.objectsnd)
|
audio.stophandle(self.objectsnd)
|
||||||
|
Loading…
Reference in New Issue
Block a user