JA_outcome_feedback.m 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. function [Par] = JA_outcome_feedback(Par, GD)
  2. if ~isempty(find(ismember(Par.outcome_feedback_trials, Par.tr), 1))
  3. game_type = GD.SBJ_wins_distribution(Par.final_design.Games{Par.tr});
  4. % set rigger for game number
  5. value = Par.final_design.Games{Par.tr};
  6. EEG_Trigger(Par.PP,Par.address,value);
  7. %% set parameters
  8. slide = prop2dim(Par.screen_dimensions, 0.1, 0);
  9. dimension = 60;
  10. combined = [];
  11. combined.string = 'O';
  12. combined.dimension = dimension;
  13. combined.position = Par.screen_dimensions(3:4)/2;
  14. combined.position(1) = combined.position(1) - round(slide(1)/2);
  15. text_CF = [];
  16. text_CF.string = 'O';
  17. text_CF.dimension = dimension;
  18. text_CF.position = Par.screen_dimensions(3:4)/2;
  19. text_CF.position(1) = text_CF.position(1) + slide(1);
  20. text_SBJ = [];
  21. text_SBJ.string = 'O';
  22. text_SBJ.dimension = dimension;
  23. text_SBJ.position = [0 Par.screen_dimensions(4)/2];
  24. text_SBJ.position(1) = text_SBJ.position(1) + slide(1);
  25. %%
  26. switch Par.relationship
  27. %%% non va bene!!!! il colore dipende anche da relationship
  28. case 'competitive'
  29. target_text_CF = text_CF;
  30. target_text_SBJ = text_SBJ;
  31. % in case SBJ wins --> CF loses and vice versa
  32. if game_type == 1
  33. target_text_CF.color = [1 0 0];
  34. target_text_SBJ.color = [0 1 0];
  35. else
  36. target_text_CF.color = [0 1 0];
  37. target_text_SBJ.color = [1 0 0];
  38. end
  39. case 'parallel'
  40. target_text_CF = text_CF;
  41. target_text_SBJ = text_SBJ;
  42. % no visual ffedback for CF
  43. if game_type == 1
  44. target_text_CF.color = [0 0 0];
  45. target_text_SBJ.color = [0 1 0];
  46. else
  47. target_text_CF.color = [0 0 0];
  48. target_text_SBJ.color = [1 0 0];
  49. end
  50. case 'joint'
  51. target_text_CF = combined;
  52. target_text_SBJ = combined;
  53. if game_type == 1
  54. target_text_CF.color = [0 1 0];
  55. target_text_SBJ.color = [0 1 0];
  56. else
  57. target_text_CF.color = [1 0 0];
  58. target_text_SBJ.color = [1 0 0];
  59. end
  60. case 'imagery'
  61. target_text_CF = text_CF;
  62. target_text_SBJ = text_SBJ;
  63. if game_type == 1
  64. target_text_CF.color = [0 0 0];
  65. target_text_SBJ.color = [0 1 0];
  66. else
  67. target_text_CF.color = [0 0 0];
  68. target_text_SBJ.color = [1 0 0];
  69. end
  70. end
  71. % if wahsout show nothing
  72. if strcmp(GD.games_distribution_names(Par.final_design.Games{Par.tr}), 'wash_out')
  73. target_text_CF.color = [0 0 0];
  74. target_text_SBJ.color = [0 0 0];
  75. end
  76. %% draw on the screen with text
  77. Screen('FillRect', Par.window, [0 0 0], Par.screen_dimensions);
  78. Screen('TextSize', Par.window, dimension); % prova 20
  79. DrawFormattedText(Par.window, target_text_CF.string, target_text_CF.position(1),...
  80. target_text_CF.position(2), target_text_CF.color);
  81. DrawFormattedText(Par.window, target_text_SBJ.string, target_text_SBJ.position(1),...
  82. target_text_SBJ.position(2), target_text_SBJ.color);
  83. [Par.VBL] = Screen(Par.window, 'Flip');
  84. % leave it on the screen for 2 seconds
  85. WaitSecs(5);
  86. % Ready screen
  87. Screen('FillRect', Par.window, [0 0 0], Par.screen_dimensions);
  88. Screen('TextSize', Par.window, dimension); % prova 20
  89. DrawFormattedText(Par.window, 'Pronti', 'center',...
  90. 'center', [1 1 1]);
  91. % wait for someone allowing going on
  92. % KbStrokeWait;
  93. [Par.VBL] = Screen(Par.window, 'Flip');
  94. % leave it on the screen for 2 seconds
  95. WaitSecs(1);
  96. else % in case is not a last Game trials go ahead
  97. return
  98. end
  99. end