예제 #1
0
        /// <summary>
        /// Initalize variables, set default phase and UI configurations.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainForm_Load(object sender, EventArgs e)
        {
            slots = new Button[3] {
                Slot1, Slot2, Slot3
            };
            buttons = new Button[3] {
                LeftButton, RightButton, CenterButton
            };
            Phase        = new PhaseConfig();
            Looks        = new LooksConfig();
            CurrentPhase = 0;
            UpdateEngine();
            UpdateLooks();

            // attempt to connect socket
            try
            {
                socket.Bind(new IPEndPoint(IPAddress.Any, 25565));
                socket.Blocking = false;
                socket.Listen(1);
                SocketAsyncEventArgs connectArgs = new SocketAsyncEventArgs();
                connectArgs.Completed += ConnectCompleted;
                socket.AcceptAsync(connectArgs);
            }
            catch (Exception ex) { Console.WriteLine(ex.Message); }
        }
예제 #2
0
        /// <summary>
        /// Returns a string representation of this object that can then be exported to a text file.
        /// </summary>
        /// <param name="config"></param>
        /// <returns></returns>
        public string Serialize(PhaseConfig config)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("SlotValues,SlotsSeconds,ButtonPresses,ButtonSeconds,ReinforcementType");
            for (int t = 0; t < NumTrials; t++)
            {
                sb.AppendLine(
                    SerializeSlots(SlotOutcomes[t]) + ","
                    + SlotsTime[t] + ","
                    + ButtonsPressed[t] + ","
                    + ButtonTime[t] + ","
                    + TrialResults[t] + ","
                    );
            }
            return(sb.ToString());
        }
예제 #3
0
 /// <summary>
 /// Public constructor for a modifying PhaseConfig
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="phase"></param>
 public PhaseConfigForm(MainForm sender, PhaseConfig phase)
 {
     InitializeComponent();
     parent  = sender;
     current = phase;
 }
예제 #4
0
 /// <summary>
 /// Public constructor for new PhaseConfig
 /// </summary>
 /// <param name="sender"></param>
 public PhaseConfigForm(MainForm sender)
 {
     InitializeComponent();
     parent  = sender;
     current = new PhaseConfig();
 }