-
Notifications
You must be signed in to change notification settings - Fork 0
/
CONST.py
129 lines (108 loc) · 2.45 KB
/
CONST.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
class CARD_COLOR:
RED = 'R'
BLUE = 'B'
YELLOW = 'Y'
GREEN = 'G'
UNIVERSAL = 'U'
CARD_COLOR_DICT = {
CARD_COLOR.RED: '红',
CARD_COLOR.BLUE: '蓝',
CARD_COLOR.YELLOW: '黄',
CARD_COLOR.GREEN: '绿',
CARD_COLOR.UNIVERSAL: '黑'
}
class CARD_CONTENT:
N_0 = '0'
N_1 = '1'
N_2 = '2'
N_3 = '3'
N_4 = '4'
N_5 = '5'
N_6 = '6'
N_7 = '7'
N_8 = '8'
N_9 = '9'
BLOCK = '10'
REVERSE = '11'
ADD2 = '12'
CHANGE = '13'
ADD4 = '14'
CARD_CONTENT_DICT = {
CARD_CONTENT.N_0: '0',
CARD_CONTENT.N_1: '1',
CARD_CONTENT.N_2: '2',
CARD_CONTENT.N_3: '3',
CARD_CONTENT.N_4: '4',
CARD_CONTENT.N_5: '5',
CARD_CONTENT.N_6: '6',
CARD_CONTENT.N_7: '7',
CARD_CONTENT.N_8: '8',
CARD_CONTENT.N_9: '9',
CARD_CONTENT.BLOCK: '×',
CARD_CONTENT.REVERSE: '↙↗',
CARD_CONTENT.ADD2: '+2',
CARD_CONTENT.CHANGE: '⊕',
CARD_CONTENT.ADD4: '+4'
}
CARD_CONTENT_DRAW_REVISE = {
CARD_CONTENT.N_0: 1,
CARD_CONTENT.N_1: 1,
CARD_CONTENT.N_2: 1,
CARD_CONTENT.N_3: 1,
CARD_CONTENT.N_4: 1,
CARD_CONTENT.N_5: 1,
CARD_CONTENT.N_6: 1,
CARD_CONTENT.N_7: 1,
CARD_CONTENT.N_8: 1,
CARD_CONTENT.N_9: 1,
CARD_CONTENT.BLOCK: 2,
CARD_CONTENT.REVERSE: 4,
CARD_CONTENT.ADD2: 2,
CARD_CONTENT.CHANGE: 2,
CARD_CONTENT.ADD4: 2
}
class CARD_CODE:
# 获取卡牌的编号(颜色, 内容)
@staticmethod
def get_card_code(color, content):
return color, content
# QUANTITY
DATA_PACK_MAX_SIZE = 2048
# MD5 SALT
PREFIX_SALT = 'prefix_salt'
SUFFIX_SALT = 'suffix_salt'
# SERVER
MATCH_SERVER_ADDR = "127.0.0.1"
MATCH_SERVER_PORT = 20000
# CLIENT
CLIENT_GAME_ADDR = ""
CLIENT_GAME_PORT = 23000
# ENCODE
RSA = 'rsa'
# JSON KEY
J_USERNAME = 'username'
J_PASSWORD = 'password'
J_CLIENT_ADDR = 'client_addr'
J_CLIENT_PORT = 'client_port'
J_PLAYER_NUM = 'player_num'
J_DIRECTION = 'direction'
J_PLAYERS_LIST = 'players_list'
J_HAND_CARD_NUM_LIST = 'hand_card_num_list'
J_HAND_CARD = 'hand_card'
J_CARD_CODE = 'card_code'
J_GUIDE_COLOR = 'guide_color'
J_ERROR_CARD_CODE = 'error_card_code'
J_ALLOW_TO_DISCARD = 'allow_to_discard'
J_THE_FIRST_GUIDE = 'the_first_guide'
J_RSA_PUBLIC_KEY = 'rsa_public_key'
J_RSA_PRIVATE_KEY = 'rsa_private_key'
# CARD
CARD_COLOR_INDEX = 0
CARD_CONTENT_INDEX = 1
# CLIENT UI
UI_DISCARD_USER = '#'
UI_NORMAL_USER = '-'
FPS = FRAMES_PER_SECOND = 3
CARD_DRAW_LENGTH = 6
CARD_GAP = 3
CARD_COLOR_CENTER_GAP = 2