private static List <StageEnum> GetMyMarkerStage(MyMarkerModel markerModel) { var res = new List <StageEnum>(); if (markerModel.player1_required) { res.Add(StageEnum.Player1); } if (markerModel.player2_required) { res.Add(StageEnum.Player2); } if (markerModel.point1_required) { if (markerModel.point2_required) { res.Add(StageEnum.PointAndDest); } else { res.Add(StageEnum.Point); } } return(res); }
/// <summary> /// Распарсить правила создания маркеров из файла "marker_rules.txt" ресурсов. /// </summary> private static void ParseMarkerRules() { var marker_rules = Properties.Resources.marker_rules; markerModels = new List <MyMarkerModel>(); var lines = marker_rules.Split('\n'); foreach (var line in lines) { if (string.IsNullOrEmpty(line)) { continue; } var parts = line.Split(new string[] { ",\t" }, StringSplitOptions.None); if (parts.Length < 10) { continue; } var i = 0; var include = parts[i]; i++; if (include != "x") { continue; } var idstr = parts[i]; i++; var id = 0; if (int.TryParse(idstr, out id) == false) { continue; } var action_id_str = parts[i]; i++; var action_id = 0; if (int.TryParse(action_id_str, out action_id) == false) { continue; } var action_type_str = parts[i]; i++; var action_type = 0; if (int.TryParse(action_type_str, out action_type) == false) { continue; } var win_str = parts[i]; i++; var win = 0; if (int.TryParse(win_str, out win) == false) { if (string.IsNullOrEmpty(win_str) == false) { continue; } } var name = parts[i]; i++; var name_eng = parts[i]; i++; //player opponent point dest var player = parts[i] == "v" ? true : false; i++; var opponent = parts[i] == "v" ? true : false; i++; var point = parts[i] == "v" ? true : false; i++; var dest = parts[i] == "v" ? true : false; i++; var markerModel = new MyMarkerModel(id, action_id, action_type, win, name, name_eng, player, opponent, point, dest); markerModels.Add(markerModel); //x, 100601, 1, 6, 1, Выброс(+), , v, v, , , , , Выброс удачный, , , } }