diff --git a/AboutGame.md b/AboutGame.md index 01e9b87..690750f 100644 --- a/AboutGame.md +++ b/AboutGame.md @@ -82,7 +82,7 @@ ex.大致图像 -#### 三、软件需求 +#### 三、待完善的软件需求 子菜单:选择单机还是联网 @@ -94,3 +94,35 @@ ex.大致图像 ### 网络版开发v2.0 +#### 一、增加需求 + +> 基于游戏服务器,加入联网通信功能 +> +> 主要工作: +> +> 1.实现socket通信 +> +> 2.JSON数据解析以及封装——协议见“游戏服务器及通信协议.pdf” +> +> 3.多线程编程——建议把通信模块实现为一个单独的新线程,主程序和通信模块之间需要交互,超时判断(来自服务器,接受并处理) +> +> 4.游戏逻辑调整 + +一些约定: + +1.红0蓝1 通信协议中的side=0;红棋先手 + +2.棋子约定 chessman 0到6 + +3.服务器配置文件config.txt可改 + +客户端: + ++ 申请加入对战 -> 先后手规则 + ++ 过程中可以叫停游戏或者主动退出游戏(弃权) + + + + + diff --git a/SafariChess_Gamev1.0.py b/SafariChess_Gamev1.0.py index 69e3591..ee0db8d 100644 --- a/SafariChess_Gamev1.0.py +++ b/SafariChess_Gamev1.0.py @@ -54,12 +54,12 @@ def drawBoard(screen):#绘制棋盘:格子,河流,陷阱,巢穴 #colors = [(255, 255, 255), (0, 0, 0)] for row in range(DIMENSION_ROWS): for column in range(DIMENSION_COLUMNS): - pg.draw.rect(screen, pg.Color(10,100,10), pg.Rect(bias_left+column * SIZE, bias_top+row * SIZE, SIZE, SIZE)) + pg.draw.rect(screen, pg.Color(199,237,204), pg.Rect(bias_left+column * SIZE, bias_top+row * SIZE, SIZE, SIZE)) pg.draw.rect(screen, pg.Color(90,150,75), pg.Rect((column * SIZE) + bias_left+3, (row * SIZE) + 3+bias_top, SIZE - 4, SIZE - 4)) #画河流 for row in [1,2,4,5]: for column in [3,4,5]: - pg.draw.rect(screen, pg.Color(5,5,100),pg.Rect((column * SIZE) +bias_left+3, (row * SIZE) +bias_top +3, SIZE,SIZE)) + pg.draw.rect(screen, pg.Color(67,142,219),pg.Rect((column * SIZE) +bias_left+2, (row * SIZE) +bias_top +3, SIZE-2,SIZE-2)) #画陷阱 for row in [2,4]: @@ -164,12 +164,14 @@ Please type one of the numbers below to choose a playing mode: def showGameOverText(screen, text): #游戏结束,出现的文字 text是字符串“Left Win”或“Right Win” font = pg.font.SysFont("comicsansms", 32) - text_object = font.render(text, True, pg.Color("red")) + text_object = font.render(text, True, pg.Color("grey")) + text_location = pg.Rect(0, 0, BOARD_WIDTH, BOARD_HEIGHT).move(BOARD_WIDTH / 2 - text_object.get_width() / 2, BOARD_HEIGHT / 2 - text_object.get_height() / 2) screen.blit(text_object, text_location) - text_object = font.render(text, False, pg.Color('black')) - screen.blit(text_object, text_location.move(5, 5)) + text_object = font.render(text, False, pg.Color('red')) + screen.blit(text_object, text_location.move(-2 , -2)) + def MainMenu(): #显示主菜单