more demo playing stuff
This commit is contained in:
parent
237524c1d4
commit
23c66eea44
43
gameview.py
43
gameview.py
@ -1385,6 +1385,7 @@ class gui(QtGui.QWidget):
|
||||
self.selectedplayer = -1
|
||||
self.myflip = 0
|
||||
self.playsfx = 1
|
||||
self.demo_playing = False
|
||||
|
||||
self.slide_enabled = bool(get_option("General", "slide", False))
|
||||
self.slide_available = False
|
||||
@ -1491,7 +1492,11 @@ class gui(QtGui.QWidget):
|
||||
self.setJudgeButtons()
|
||||
self.icchat_focus()
|
||||
|
||||
if self.demo_playing:
|
||||
return
|
||||
|
||||
server_is_2_8 = "additive" in self.features and "looping_sfx" in self.features and "effects" in self.features
|
||||
|
||||
if server_is_2_8:
|
||||
self.tcp.send("SP#"+self.charside+"#%") # all hail new AO 2.8 packet
|
||||
else:
|
||||
@ -2131,12 +2136,6 @@ class gui(QtGui.QWidget):
|
||||
area = item.text().split('\n')[0]
|
||||
self.sendMC(area)
|
||||
|
||||
def onDemoClick(self, item):
|
||||
self.tcpthread.stop()
|
||||
self.demoplayer.start(item.text())
|
||||
self.demoslider.setVisible(True)
|
||||
self.icchatinput.setVisible(False)
|
||||
|
||||
def sendMC(self, content):
|
||||
if "cccc_ic_support" in self.features and self.showname:
|
||||
self.tcp.send('MC#' + content + '#' + str(self.mychar) + '#' + self.showname + '#%')
|
||||
@ -2562,6 +2561,8 @@ class gui(QtGui.QWidget):
|
||||
t = time.localtime()
|
||||
logcharname = f_char
|
||||
|
||||
timestamp = "[%d:%.2d " % (t[3], t[4]) if not self.demo_playing else ""
|
||||
|
||||
if f_char.lower() != self.charlist[f_char_id][0].lower():
|
||||
logcharname = self.charlist[f_char_id][0] + ' (' + f_char.decode("utf-8") + ')'
|
||||
|
||||
@ -2574,7 +2575,7 @@ class gui(QtGui.QWidget):
|
||||
logcharname += " (???)"
|
||||
|
||||
if evidence == -1:
|
||||
self.icLog.append('[%d:%.2d] %s: %s' % (t[3], t[4], logcharname, chatmsg))
|
||||
self.icLog.append(timestamp + '%s: %s' % (logcharname, chatmsg))
|
||||
else:
|
||||
eviname = '(NULL) %d' % evidence
|
||||
try:
|
||||
@ -2582,7 +2583,7 @@ class gui(QtGui.QWidget):
|
||||
except:
|
||||
pass
|
||||
|
||||
self.icLog.append('[%d:%.2d] %s: %s\n%s presented an evidence: %s' % (t[3], t[4], logcharname, chatmsg, f_char, eviname.strip()))
|
||||
self.icLog.append(timestamp + '%s: %s\n%s presented an evidence: %s' % (logcharname, chatmsg, f_char, eviname.strip()))
|
||||
|
||||
self.is_additive = (m_chatmessage[ADDITIVE] == "1")
|
||||
|
||||
@ -3516,6 +3517,21 @@ class gui(QtGui.QWidget):
|
||||
if self.onscreen_timer_times == [0, 0, 0, 0, 0]:
|
||||
self.onscreen_timer.stop()
|
||||
|
||||
def onDemoClick(self, item):
|
||||
self.playerList.clear()
|
||||
self.stopMusic()
|
||||
self.icLog.clear()
|
||||
self.ooclog.clear()
|
||||
if not self.demo_playing:
|
||||
for widget in [self.oocinput, self.callmodbtn, self.changechar, self.oocnameinput, self.ooclogin, self.gametab_evidence, self.gametab_msgqueue, self.gametab_iniswap, self.gametab_mute, self.gametab_pair, self.gametab_misc, self.gametab_players, self.gametab_music, self.emotedropdown, self.posdropdown, self.flipbutton, self.sfxbutton, self.nointerruptbtn, self.effectdropdown, self.slidebutton, self.deskbtn, self.additivebtn, self.areaitems, self.shownameedit, self.colordropdown]:
|
||||
widget.setEnabled(False)
|
||||
self.demoslider.setVisible(True)
|
||||
self.icchatinput.setVisible(False)
|
||||
self.tcpthread.stop()
|
||||
self.demo_playing = True
|
||||
|
||||
self.demoplayer.start(item.text())
|
||||
|
||||
def demoSeek(self, time):
|
||||
self.demoplayer.seek(time)
|
||||
|
||||
@ -3709,6 +3725,7 @@ class TCP_Thread(QtCore.QThread):
|
||||
color.setHsv(rainbow, 255, 255)
|
||||
while True:
|
||||
if self.stop_now:
|
||||
self.parent.tcp.close()
|
||||
self.quit()
|
||||
return
|
||||
|
||||
@ -3890,6 +3907,7 @@ def handle_packets(caller, total):
|
||||
music = decode_ao_str(network[1])
|
||||
charid = int(network[2])
|
||||
t = time.localtime()
|
||||
timestamp = "[%d:%.2d " % (t[3], t[4]) if not caller.parent.demo_playing else ""
|
||||
if charid != -1:
|
||||
try:
|
||||
name = caller.parent.charlist[charid][0]
|
||||
@ -3898,9 +3916,9 @@ def handle_packets(caller, total):
|
||||
|
||||
if len(network) > 3 and network[3]:
|
||||
name += " ("+network[3].decode("utf-8")+")"
|
||||
caller.IC_Log.emit('[%d:%.2d] %s changed the music to %s' % (t[3], t[4], name, music))
|
||||
caller.IC_Log.emit(timestamp + '%s changed the music to %s' % (name, music))
|
||||
else:
|
||||
caller.IC_Log.emit('[%d:%.2d] The music was changed to %s' % (t[3], t[4], music))
|
||||
caller.IC_Log.emit(timestamp + 'The music was changed to %s' % music)
|
||||
caller.parent.playMusic(music)
|
||||
|
||||
elif header == 'BN':
|
||||
@ -4058,6 +4076,11 @@ def handle_packets(caller, total):
|
||||
|
||||
caller.timerUpdate.emit(command, timer_id, time_ms)
|
||||
|
||||
# For demos
|
||||
elif header == 'SC':
|
||||
del network[0]
|
||||
caller.parent.charlist = [ [char.split('&')[0].decode('utf-8'), 0, "male", True ] for char in network ]
|
||||
|
||||
class PresentButton(QtGui.QLabel):
|
||||
|
||||
def __init__(self, gamegui, parent):
|
||||
|
Loading…
Reference in New Issue
Block a user