添加关卡配置自动上传云控的逻辑

main
ZhuoZhou 2025-06-18 18:46:59 +08:00
parent db6850dd21
commit b7207e4464
2 changed files with 66 additions and 55 deletions

View File

@ -247,7 +247,7 @@ def update_main_level_db(platform, mode):
error = "" error = ""
gameplay_list = mainPlayType.debug_enable_main_play_type_list if mode == config.mode.debug.value else mainPlayType.release_enable_main_play_type_list gameplay_list = mainPlayType.debug_enable_main_play_type_list if mode == config.mode.debug.value else mainPlayType.release_enable_main_play_type_list
for gameplay in gameplay_list: for gameplay in gameplay_list:
google_sheet_file = sheet_helper.get_sheet_table(config.sheet_level_config, f"{gameplay}_main_db") google_sheet_file = sheet_helper.get_sheet_table(config.sheet_level_config, f"{gameplay}_db")
if google_sheet_file is None: if google_sheet_file is None:
print(f"{gameplay}玩法目前没有配置关卡表") print(f"{gameplay}玩法目前没有配置关卡表")
continue continue
@ -270,12 +270,12 @@ def update_main_level_db(platform, mode):
col_find_num = i + 1 col_find_num = i + 1
elif value == "配置合法性": elif value == "配置合法性":
col_valid = i + 1 col_valid = i + 1
elif value == "GamePlayType": # elif value == "GamePlayType":
col_game_play_type = i + 1 # col_game_play_type = i + 1
elif value == "GamePlayParam": elif value == "GamePlayParam":
col_game_play_param = i + 1 col_game_play_param = i + 1
elif value == "GameElements": # elif value == "GameElements":
col_game_elements = i + 1 # col_game_elements = i + 1
if col_level == -1 or col_asset_id == -1 or col_asset_name == -1 or col_a_g == -1 or col_i_g == -1 \ if col_level == -1 or col_asset_id == -1 or col_asset_name == -1 or col_a_g == -1 or col_i_g == -1 \
or col_find_num == -1 or col_valid == -1: or col_find_num == -1 or col_valid == -1:
config.notification_helper.append_msg(f"{gameplay}玩法目前配置关卡表格式不正确") config.notification_helper.append_msg(f"{gameplay}玩法目前配置关卡表格式不正确")
@ -310,13 +310,13 @@ def update_main_level_db(platform, mode):
continue continue
one_level_data = {} one_level_data = {}
level_id = row_datas[col_asset_name - 1] level_id = row_datas[col_asset_name - 1]
game_play_type = row_datas[col_game_play_type - 1] # game_play_type = row_datas[col_game_play_type - 1]
if len(game_play_type) == 0: # if len(game_play_type) == 0:
game_play_type = "normal" # game_play_type = "normal"
game_play_param = row_datas[col_game_play_param - 1] game_play_param = row_datas[col_game_play_param - 1]
if len(game_play_param) == 0: if len(game_play_param) == 0:
game_play_param = "" game_play_param = ""
game_elements_param = row_datas[col_game_elements - 1] if col_game_elements > 0 else '' # game_elements_param = row_datas[col_game_elements - 1] if col_game_elements > 0 else ''
level_type = gameplay level_type = gameplay
level_map_name = "" level_map_name = ""
level_thum_name = "" level_thum_name = ""
@ -324,45 +324,45 @@ def update_main_level_db(platform, mode):
one_level_data["LevelMapName"] = level_map_name one_level_data["LevelMapName"] = level_map_name
one_level_data["LevelType"] = level_type one_level_data["LevelType"] = level_type
one_level_data["LevelThumName"] = level_thum_name one_level_data["LevelThumName"] = level_thum_name
one_level_data["GamePlayType"] = game_play_type # one_level_data["GamePlayType"] = game_play_type
one_level_data["GamePlayParam"] = game_play_param one_level_data["GamePlayParam"] = game_play_param
one_level_data["GameElements"] = game_elements_param # one_level_data["GameElements"] = game_elements_param
if gameplay not in levels_data_dic: if gameplay not in levels_data_dic:
levels_data_dic[gameplay] = [] levels_data_dic[gameplay] = []
levels_data_dic[gameplay].append(one_level_data) levels_data_dic[gameplay].append(one_level_data)
record_levels[level_id] = True record_levels[level_id] = True
# debug模式还要获取其他未配置但可以上线地关卡数据 # debug模式还要获取其他未配置但可以上线地关卡数据
if mode == config.mode.debug.value: # if mode == config.mode.debug.value:
sheet_asset = sheet_helper.get_sheet_table(config.sheet_level_config, f"{gameplay}资源表") # sheet_asset = sheet_helper.get_sheet_table(config.sheet_level_config, f"{gameplay}资源表")
if sheet_asset is None: # if sheet_asset is None:
print(f"{gameplay}玩法目前没有资源表") # print(f"{gameplay}玩法目前没有资源表")
continue # continue
sheet_asset_datas = sheet_asset.get_all_values(major_dimension='ROWS') # sheet_asset_datas = sheet_asset.get_all_values(major_dimension='ROWS')
for i, row_datas in enumerate(sheet_asset_datas): # for i, row_datas in enumerate(sheet_asset_datas):
if i == 0: # if i == 0:
continue # continue
asset_name = row_datas[1] # asset_name = row_datas[1]
game_play_type = "normal" # # game_play_type = "normal"
if gameplay in levels_data_dic and asset_name in record_levels: # # if gameplay in levels_data_dic and asset_name in record_levels:
continue # # continue
level_id = asset_name # level_id = asset_name
level_type = gameplay # level_type = gameplay
level_map_name = "" # level_map_name = ""
level_thum_name = "" # level_thum_name = ""
game_play_param = "" # game_play_param = ""
game_elements_param = "" # # game_elements_param = ""
one_level_data = {} # one_level_data = {}
one_level_data["LevelId"] = level_id # one_level_data["LevelId"] = level_id
one_level_data["LevelType"] = level_type # one_level_data["LevelType"] = level_type
one_level_data["LevelMapName"] = level_map_name # one_level_data["LevelMapName"] = level_map_name
one_level_data["LevelThumName"] = level_thum_name # one_level_data["LevelThumName"] = level_thum_name
one_level_data["GamePlayType"] = game_play_type # # one_level_data["GamePlayType"] = game_play_type
one_level_data["GamePlayParam"] = game_play_param # one_level_data["GamePlayParam"] = game_play_param
one_level_data["GameElements"] = game_elements_param # # one_level_data["GameElements"] = game_elements_param
if gameplay not in levels_data_dic: # if gameplay not in levels_data_dic:
levels_data_dic[gameplay] = [] # levels_data_dic[gameplay] = []
levels_data_dic[gameplay].append(one_level_data) # levels_data_dic[gameplay].append(one_level_data)
if len(levels_data_dic) <= 0: if len(levels_data_dic) <= 0:
print(f"没有任何可上线关卡数据") print(f"没有任何可上线关卡数据")
@ -381,7 +381,7 @@ def update_main_level_db(platform, mode):
# 更新Remote Config # 更新Remote Config
condition = config.remote_condition_android if platform == "Android" else config.remote_condition_ios condition = config.remote_condition_android if platform == "Android" else config.remote_condition_ios
value = f"{config.cdn}/Configs/{config_json_filename}?generation={generation}" value = f"{config.cdn}/Configs/{config_json_filename}?generation={generation}"
firebase_helper.update_remote_config(config.remote_group_level_config, condition, config.remote_key_main_db, firebase_helper.update_remote_config(None, condition, config.remote_key_main_db,
f"main_{mode}", value) f"main_{mode}", value)
return value return value
@ -422,12 +422,12 @@ def update_main_country_level_db(platform, mode, all_country_list):
col_find_num = i + 1 col_find_num = i + 1
elif value == "配置合法性": elif value == "配置合法性":
col_valid = i + 1 col_valid = i + 1
elif value == "GamePlayType": # elif value == "GamePlayType":
col_game_play_type = i + 1 # col_game_play_type = i + 1
elif value == "GamePlayParam": elif value == "GamePlayParam":
col_game_play_param = i + 1 col_game_play_param = i + 1
elif value == "GameElements": # elif value == "GameElements":
col_game_elements = i + 1 # col_game_elements = i + 1
if col_level == -1 or col_asset_id == -1 or col_asset_name == -1 or col_a_g == -1 or col_i_g == -1 \ if col_level == -1 or col_asset_id == -1 or col_asset_name == -1 or col_a_g == -1 or col_i_g == -1 \
or col_find_num == -1 or col_valid == -1: or col_find_num == -1 or col_valid == -1:
config.notification_helper.append_msg(f"{gameplay}玩法目前配置关卡表格式不正确") config.notification_helper.append_msg(f"{gameplay}玩法目前配置关卡表格式不正确")
@ -462,13 +462,13 @@ def update_main_country_level_db(platform, mode, all_country_list):
continue continue
one_level_data = {} one_level_data = {}
level_id = row_datas[col_asset_name - 1] level_id = row_datas[col_asset_name - 1]
game_play_type = row_datas[col_game_play_type - 1] # game_play_type = row_datas[col_game_play_type - 1]
if len(game_play_type) == 0: # if len(game_play_type) == 0:
game_play_type = "normal" # game_play_type = "normal"
game_play_param = row_datas[col_game_play_param - 1] game_play_param = row_datas[col_game_play_param - 1]
if len(game_play_param) == 0: if len(game_play_param) == 0:
game_play_param = "" game_play_param = ""
game_elements_param = row_datas[col_game_elements - 1] if col_game_elements > 0 else '' # game_elements_param = row_datas[col_game_elements - 1] if col_game_elements > 0 else ''
level_type = gameplay level_type = gameplay
level_map_name = "" level_map_name = ""
level_thum_name = "" level_thum_name = ""
@ -476,9 +476,9 @@ def update_main_country_level_db(platform, mode, all_country_list):
one_level_data["LevelMapName"] = level_map_name one_level_data["LevelMapName"] = level_map_name
one_level_data["LevelType"] = level_type one_level_data["LevelType"] = level_type
one_level_data["LevelThumName"] = level_thum_name one_level_data["LevelThumName"] = level_thum_name
one_level_data["GamePlayType"] = game_play_type # one_level_data["GamePlayType"] = game_play_type
one_level_data["GamePlayParam"] = game_play_param one_level_data["GamePlayParam"] = game_play_param
one_level_data["GameElements"] = game_elements_param # one_level_data["GameElements"] = game_elements_param
if gameplay not in levels_data_dic: if gameplay not in levels_data_dic:
levels_data_dic[gameplay] = [] levels_data_dic[gameplay] = []
levels_data_dic[gameplay].append(one_level_data) levels_data_dic[gameplay].append(one_level_data)

View File

@ -224,10 +224,21 @@ class FirebaseHelper:
if online_txt != None and online_txt != "": if online_txt != None and online_txt != "":
online_json = json.loads(online_txt) online_json = json.loads(online_txt)
keys = "" keys = ""
if condition is None:
keys = f"parameterGroups/{group}/parameters/{main_key}/defaultValue/value" if group is not None and group != "":
keys = f"parameterGroups/{group}/parameters/"
else: else:
keys = f"parameterGroups/{group}/parameters/{main_key}/conditionalValues/{condition}/value" keys = f"parameters/"
if condition is not None and condition != "":
keys = keys + f"{main_key}/conditionalValues/{condition}/value"
else:
keys = keys + f"{main_key}/defaultValue/value"
# if condition is None:
# keys = f"parameterGroups/{group}/parameters/{main_key}/defaultValue/value"
# else:
# keys = f"parameterGroups/{group}/parameters/{main_key}/conditionalValues/{condition}/value"
if is_string is False: if is_string is False:
self.check_or_create_json_field(online_json, keys, sub_key, value) self.check_or_create_json_field(online_json, keys, sub_key, value)