# from source import server import server if __name__ == "__main__": host = 'localhost' port = 50001 data_size = 1024 server = server.GameServer(host, port, data_size) server.handle_connection()
LOG = logging.getLogger() if __name__ == "__main__": # Create ui ui = gui.MainWindow() # Set icon # https://cdn2.iconfinder.com/data/icons/games-and-sports-vol-2/32/Game_sports_calculate_counting_crosswords_numbers_sudoku-512.png #ui.tk.call('wm', # 'iconphoto', # ui._w, # Image("photo", file="icon.png")) # Create game game = s.Game() # Pre-set server with game server = s.GameServer(game) # Create client # TODO: remove syncIO dependency for GUI sync_io = SyncConsoleAppenderRawInputReader() client = c.Client(sync_io) # Set UI for client client.set_gui(ui) ui.set_client(client) # Give to UI possibility to host a server ui.set_server(server) # Start the app ui.mainloop()
import os import sys import tornado.web import tornado.websocket import tornado.ioloop import json import random import server from message import * server_name = ["Wahaha", "Gahaha", "Papapa", "Wuwuwu", "Yinyinyin"] ws_host = 'localhost:7777' ioloop = tornado.ioloop.IOLoop.instance() server = server.GameServer(ioloop, 5) class IndexHandler(tornado.web.RequestHandler): def get(self): self.render("index.html", rooms=server.get_room_list()) class GameHandler(tornado.web.RequestHandler): def post(self, room_id): username = self.get_argument("username") self.render("panel.html", room_id=room_id, username=username, host=ws_host)
#!/usr/bin/python3 import server if __name__ == '__main__': s = server.GameServer() s.start()
def main(): game_server = server.GameServer() game_server.start()