private static void SaveTimeline(GuildTimelineData timelineData, string path) { var src = new StringBuilder(); foreach (var unit in timelineData.playerGroupData.playerData.playrCharacters) { src.AppendLine($"print(\"calibrate for {unit.GetUnitName()}\");"); src.AppendLine($"autopcr.calibrate({unit.unitId});"); } src.AppendLine("autopcr.setOffset(2, 0); --offset calibration"); var offset = 0; foreach (var ub in timelineData.allUnitStateChangeDic .Where(tuple => timelineData.playerGroupData.playerData.playrCharacters.Any(c => c.unitId == tuple.Key)) .SelectMany(pair => pair.Value.Where(data => data.changStateTo == Elements.UnitCtrl.ActionState.SKILL_1) .Select(data => new Tuple <int, int>(pair.Key, data.currentFrameCount))) .OrderBy(tuple => tuple.Item2)) { src.AppendLine($"autopcr.waitFrame({offset + ub.Item2}); autopcr.press({ub.Item1});"); offset += CacheGetUbTime(ub.Item1); } File.WriteAllText(path, src.ToString()); }
public static void OutputGuildTimeLine(GuildTimelineData timelineData, string defaultName) { try { OpenFileName openFileName = new OpenFileName(); openFileName.structSize = Marshal.SizeOf(openFileName); openFileName.filter = "Lua scripts(*.lua)\0*.lua\0"; openFileName.file = new string(new char[256]); openFileName.maxFile = openFileName.file.Length; openFileName.fileTitle = new string(new char[64]); openFileName.maxFileTitle = openFileName.fileTitle.Length; openFileName.initialDir = Application.dataPath; openFileName.title = "选择保存Lua脚本路径"; openFileName.defExt = "lua"; openFileName.file = defaultName; openFileName.flags = 530952; var flag = DllTest.GetSaveFileName(openFileName); var text = openFileName.file.Replace("\\", "/"); if (flag) { SaveTimeline(timelineData, text); } } catch (Exception e) { MainManager.Instance.WindowConfigMessage(e.ToString(), null); } }
private static void SaveTimeline(GuildTimelineData timelineData, string path) { var src = new StringBuilder(); foreach (var unit in timelineData.playerGroupData.playerData.playrCharacters) { src.AppendLine($"print(\"calibrate for {characters[unit.unitId / 100].First()}\");"); src.AppendLine($"autopcr.calibrate({unit.unitId});"); } src.AppendLine("autopcr.setOffset(2, 0); --offset calibration"); var offset = 0; foreach (var ub in timelineData.playerGroupData.UBExecTimeData .SelectMany((list, i) => list .Select(data => new Tuple <int, int>(timelineData.playerGroupData.playerData.playrCharacters[i].unitId, (int)Math.Round(60 * (90 - data))))) .OrderBy(tuple => tuple.Item2)) { src.AppendLine($"autopcr.waitFrame({offset + ub.Item2}); autopcr.press({ub.Item1});"); offset += CacheGetUbTime(ub.Item1); } File.WriteAllText(path, src.ToString()); }