예제 #1
0
 def OnConnect(self, evt):
     if self.list.GetCount() > 0:
         dlg = wx.TextEntryDialog(self,
                                  'Enter WI-FI Password?',
                                  'Connect',
                                  style=wx.TE_PASSWORD | wx.OK | wx.CANCEL)
         dlg.CenterOnParent()
         if dlg.ShowModal() == wx.ID_OK:
             self.g1.Pulse()
             var = dlg.GetValue()
             if len(var) < 8:
                 new = wx.MessageDialog(
                     self,
                     'Password must be 8 or more characters! Please reconnect',
                     'Alert!', wx.OK | wx.ICON_INFORMATION)
                 new.ShowModal()
             else:
                 self.g1.Pulse()
                 new = Network()
                 new.Stop()
                 ssid = self.list.GetStringSelection()
                 key = dlg.GetValue()
                 state = new.Connect(ssid, key)
                 if state == 0:
                     new = wx.MessageDialog(
                         self,
                         'Password not correct or network not found again!',
                         'Error Connecting!', wx.OK | wx.ICON_INFORMATION)
                     new.ShowModal()
                 else:
                     self.g1.Pulse()
                     time.sleep(3)
                     new = Network()
                     ip = new.GetJoinIP()
                     reactor.connectTCP(str(ip), 8000, ClientFactory())
예제 #2
0
GameMusicChannel = pygame.mixer.Channel(2)
#Winner apple sould:
WinnerAppleSound = pygame.mixer.Sound("SNEK_Sounds/WinningApple.wav")

#Set game music volume lower:
GameMusicChannel.set_volume(0.2)


#System functions:
def terminate():
    pygame.quit()
    sys.exit()


Network = Network()
Player = Network.Connect()

while True:
    Sneks, game = Network.Get()
    if Player == 1:
        MeSnek = Sneks[1]
        OtherSnek = Sneks[0]
    else:
        MeSnek = Sneks[0]
        OtherSnek = Sneks[1]

    GameWidth, GameHeight = game.GetBoard()
    Window = pygame.display.set_mode((GameWidth, GameHeight), 0, 32)

    TicksPerSec = game.GetTPS()