/** * Actualiza la informaciĆ³n de la ventana "Positions(0/0)". * @return void */ public void UpdatePositionLog() { int nSync = 0; string auxLog = ""; string auxSyncLog = ""; // Get positions name and sync state for (int i = 0; i < targetControl.Count(); i++) { TargetModel model = targetControl.GetTarget(i).GetComponent <TargetModel>(); auxLog += model.GetName() + "\n"; if (!model.GetSync()) { auxSyncLog += "No sync" + "\n"; } else { auxSyncLog += "\n"; nSync++; } } // Write positions name positionLog.text = auxLog; // Write positions sync state positionSyncLog.text = auxSyncLog; // Fix containers to fit names AdjustContent(positionLog.gameObject, contentPositionLog); // Count data UpdateCountData(nSync, targetControl.Count()); }
/** * Guarda las posiciones actuales y sus datos en el fichero "backup.txt". (normal|relative) name x y z p r (relativeTo). * @return void */ public void Save() { string[] lines = new string[targetControl.Count()]; // Get positions data for (int i = 0; i < targetControl.Count(); i++) { string aux = ""; TargetModel target = targetControl.GetTarget(i).GetComponent <TargetModel>(); // Relative position? if (target.GetRelativeTo() == null) { aux += NORMAL + " "; aux += target.GetName() + " "; aux += target.GetPositionInScorbot().x + " "; aux += target.GetPositionInScorbot().y + " "; aux += target.GetPositionInScorbot().z + " "; aux += target.GetPitch() + " "; aux += target.GetRoll(); } else { aux += RELATIVE + " "; aux += target.GetName() + " "; aux += target.GetRelativePosInScorbot().x + " "; aux += target.GetRelativePosInScorbot().y + " "; aux += target.GetRelativePosInScorbot().z + " "; aux += target.GetRelativeP() + " "; aux += target.GetRelativeR() + " "; aux += target.GetRelativeTo().GetComponent <TargetModel>().GetName(); } lines[i] = aux; } // Overwrite everything System.IO.File.WriteAllLines(BACKUP_FILE, lines); gameController.backupFileOutput.text = "File saved."; }