Skip to content

Commit

Permalink
commit PR #8 by @LaercioMBR manually oops
Browse files Browse the repository at this point in the history
  • Loading branch information
shiburizu committed Apr 14, 2022
1 parent 3ffab9c commit 9c71190
Show file tree
Hide file tree
Showing 6 changed files with 194 additions and 21 deletions.
75 changes: 54 additions & 21 deletions Concerto.kv
Original file line number Diff line number Diff line change
Expand Up @@ -1002,30 +1002,63 @@
<GameModal>:
modal_txt: modal_txt
close_btn: close_btn
p1_char_guide: p1_char_guide
p2_char_guide: p2_char_guide
size_hint: None,None
size: 400,180
size: 400,200
auto_dismiss: False
background_color: '#343B88'
BoxLayout:
padding: 20,20
orientation: 'vertical'
Label:
id: modal_txt
background_color: (0, 0, 0, 0)
text_size: self.size
halign: 'center'
valign: 'top'
Button:
id: close_btn
font_name: 'res/texgyreheros-bolditalic.otf'
background_color: (255, 0, 0, 0.2)
outline_width: 1
on_press:
self.background_color = (100, 0, 0, 0.9)
on_release:
self.background_color = (255, 0, 0, 0.2)
size_hint: (0.5,0.4)
pos_hint: {'center_x': 0.5}
GridLayout:
padding: [30,15]
spacing: [0,0]
cols: 1
GridLayout:
padding: [0,5]
cols: 1
Label:
id: modal_txt
background_color: (0, 0, 0, 0)
halign: 'center'
valign: 'top'
size: self.texture_size
text_size: self.size
size_hint_y: 0.60
Button:
id: close_btn
font_name: 'res/texgyreheros-bolditalic.otf'
background_color: (255, 0, 0, 0.2)
outline_width: 1
on_press:
self.background_color = (100, 0, 0, 0.9)
on_release:
self.background_color = (255, 0, 0, 0.2)
size_hint_y: 0.20
BoxLayout:
padding: [0,0]
orientation:'horizontal'
size_hint_y: 0.20
Button:
id: p1_char_guide
disabled: True
font_name: 'res/texgyreheros-bolditalic.otf'
background_color: (255, 0, 0, 0.2)
opacity: 0
outline_width: 1
on_press:
self.background_color = (100, 0, 0, 0.9)
on_release:
self.background_color = (255, 0, 0, 0.2)
Button:
id: p2_char_guide
disabled: True
font_name: 'res/texgyreheros-bolditalic.otf'
background_color: (255, 0, 0, 0.2)
opacity: 0
outline_width: 1
on_press:
self.background_color = (100, 0, 0, 0.9)
on_release:
self.background_color = (255, 0, 0, 0.2)

<ProgressModal>:
modal_txt: modal_txt
Expand Down
10 changes: 10 additions & 0 deletions ui/lobbyscreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
import logging


from mbaacc import MOON
from ui.playerwiki import *


class LobbyScreen(ConcertoScreen):
player_list = ObjectProperty(None) # layout for idle players
challenge_list = ObjectProperty(None) # layout for challenges
Expand Down Expand Up @@ -345,6 +349,9 @@ def confirm(self, obj, r, d, p, n, t=None, *args):
self.opponent = n
self.active_pop.modal_txt.text += "\nConnected to: %s, %s Delay & %s Rollback" % (
n, d.text, r.text)

self.active_pop = fill_wiki_button(self,self.active_pop)

p.dismiss()
if t != None: #if accepting, run MBAA check
threading.Thread(target=self.wait_for_MBAA, args=[t]).start()
Expand Down Expand Up @@ -384,6 +391,9 @@ def watch_match(self, obj=None, name="", ip="", *args):
caster.start()
popup = GameModal('Watching %s' % name,'Stop watching')
popup.bind_btn(partial(self.dismiss, p=popup))

popup = fill_wiki_button(self,popup)

popup.open()
self.active_pop = popup
self.app.offline_mode = 'Spectating' #needs to be an offline mode for lobby multitasking
Expand Down
2 changes: 2 additions & 0 deletions ui/modals.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
class GameModal(ModalView):
modal_txt = ObjectProperty(None)
close_btn = ObjectProperty(None)
p1_char_guide = ObjectProperty(None)
p2_char_guide = ObjectProperty(None)

def __init__(self,msg='',btntext='Dismiss',btnaction=None):
super().__init__()
Expand Down
7 changes: 7 additions & 0 deletions ui/offlinescreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
from ui.modals import GameModal
import threading

from functools import partial
import webbrowser
import logging
from ui.playerwiki import *

class OfflineScreen(ConcertoScreen):

def __init__(self,CApp):
Expand Down Expand Up @@ -45,6 +50,8 @@ def standalone(self, *args):
def offline_pop(self, mode, tip=""):
popup = GameModal('Starting %s mode...\n\n%s' % (mode,tip),"Stand by...")
popup.close_btn.disabled = True
popup.remove_widget(popup.p1_char_guide)
popup.remove_widget(popup.p2_char_guide)
popup.open()
self.active_pop = popup
self.app.offline_mode = mode
11 changes: 11 additions & 0 deletions ui/onlinescreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import config
import requests

from ui.playerwiki import *

class OnlineScreen(ConcertoScreen):

def __init__(self, CApp):
Expand Down Expand Up @@ -96,6 +98,9 @@ def start_broadcast(self):
caster.start()
popup = GameModal('Broadcasting %s mode...\n' % self.broadcast_pop.mode_type.text,'Stop Playing')
popup.bind_btn(partial(self.dismiss, p=popup))

popup = fill_wiki_button(self,popup)

popup.open()
self.active_pop = popup
self.app.offline_mode = 'Broadcasting %s' % self.broadcast_pop.mode_type.text
Expand Down Expand Up @@ -127,6 +132,9 @@ def watch(self, ip=None):
caster.start()
popup = GameModal(msg='Watching IP: %s' % ip,btntext='Stop watching')
popup.bind_btn(partial(self.dismiss,p=popup))

popup = fill_wiki_button(self,popup)

popup.open()
self.active_pop = popup
self.app.offline_mode = 'Spectating' #needs to be an offline mode for lobby multitasking
Expand All @@ -138,6 +146,9 @@ def confirm(self, obj, r, d, p, n, *args):
self.active_pop.modal_txt.text += "\nConnected to: %s, %s Delay & %s Rollback" % (
n, d.text, r.text)
p.dismiss()

self.active_pop = fill_wiki_button(self,self.active_pop)

except ValueError:
pass

Expand Down
110 changes: 110 additions & 0 deletions ui/playerwiki.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
from functools import partial
import logging
import webbrowser

CHARACTER_WIKI = {
0 : "Sion_Eltnam_Atlasia",
1 : "Arcueid_Brunestud",
2 : "Ciel",
3 : "Akiha_Tohno",
4 : "Hisui_%26_Kohaku",
5 : "Hisui",
6 : "Kohaku",
7 : "Shiki_Tohno",
8 : "Miyako_Arima",
9 : "Warachia",
10 : "Nero_Chaos",
11 : "Sion_TATARI",
12 : "Red_Arcueid",
13 : "Akiha_Vermillion",
14 : "Mech-Hisui",
15 : "Shiki_Nanaya",
17 : "Satsuki_Yumiduka",
18 : "Len",
19 : "Powerd_Ciel",
20 : "Neco-Arc",
22 : "Aoko_Aozaki",
23 : "White_Len",
25 : "Neco-Arc_Chaos",
28 : "Kouma_Kishima",
29 : "Akiha_Tohno_(Seifuku)",
30 : "Riesbyfe_Stridberg",
31 : "Roa",
#32 : "Dust of Osiris", # "Is it neccesary if boss characters are never selectable? Why only Dust and not every other boss then?
33 : "Shiki_Ryougi",
34 : "Neco_%26_Mech",
35 : "Koha_%26_Mech",
51 : "Archetype:_Earth"
}

MOON_WIKI = {
0 : 'Crescent_Moon',
1 : 'Full_Moon',
2 : 'Half_Moon'
}


def fill_wiki_button(self,popup):
popup.p1_char_guide.text = 'P1 Wiki'
popup.p1_char_guide.bind(on_release=partial(
open_char_wiki, self,"p1"))
popup.p1_char_guide.disabled = False
popup.p1_char_guide.opacity = 1

popup.p2_char_guide.text = 'P2 Wiki'
popup.p2_char_guide.bind(on_release=partial(
open_char_wiki, self,"p2"))
popup.p2_char_guide.disabled = False
popup.p2_char_guide.opacity = 1

return popup

def open_char_wiki(self, *args):
url_wiki = 'https://wiki.gbl.gg/w/Melty_Blood/MBAACC'
url_player_wiki = url_wiki

#not_active_game_modes = [65535 , 3, 2, 13, 11, 25]
#STARTUP / OPENING / TITLE / LOADING_DEMO / HIGH_SCORES / MAIN

active_game_modes = [8 , 1 , 5]
#LOADING / IN_GAME / RETRY
character_select = 20
try:
char='char'
moon='moon'

if (args.count('p1') >= 1 ):
player_char='p1' + char
player_moon='p1' + moon
player = " Player 1 "
if (args.count('p2') >= 1):
player_char='p2' + char
player_moon='p2' + moon
player = " Player 2 "

if player:
if(self.app.game.stats and player_char):
state = self.app.game.stats['state']
if state :
if(state == character_select or active_game_modes.count(state) >= 1):
char_key = self.app.game.stats[player_char]
char = CHARACTER_WIKI.get(char_key)

if char:
link_add = '/' + str(char) #Adds the character link to the url_player_wiki, so if was openned now it would direct to the Characters general page
player = str(player) + " || character " + str(char)

# IF a players IS on an ''active'' game mode(Playing, Loading up to play, Play Again screen), opening the specific Char/Moon combination is the more valuable alternative.
# BUT, IF a player IS NOT on an active game mode(like Character Select), having an general guide/overview of the character and all of their moons is the more useful alternative.
if(active_game_modes.count(state) >= 1):
moon_key = self.app.game.stats[player_moon]
moon = MOON_WIKI.get(moon_key)
if moon:
link_add = str(link_add) + '/' + str(moon)
player = str(player) + " || moon " + str(moon)

url_player_wiki = str(url_player_wiki) + str(link_add) #
webbrowser.open(str(url_player_wiki))# Opens whatever the current link is.
except:
logging.warning("Some error occurred while trying to open the Wiki page of one of the Players Character/Moon combination.")
webbrowser.open(str(url_wiki))#When any unexpected error occurs, just opens the default main page of the wiki

0 comments on commit 9c71190

Please sign in to comment.