예제 #1
0
        public FormDialogTask(DialogTask t)
        {
            InitializeComponent();
            comboBoxEndButton.DataSource = ButtonEndCondition.ButtonText;

            task = t;
            textBoxName.Text = task.Name;
            textBoxDisplayText.Text = task.DisplayText;

            // End Condition Loading
            if (task.endCondition.GetType() == typeof(ButtonEndCondition))
            {
                buttonEnd = (ButtonEndCondition)task.endCondition;
                timeEnd = new TimeLimitEndCondition();
                comboBoxEndCondition.SelectedIndex = 0;

            }
            else
            {
                buttonEnd = new ButtonEndCondition();
                timeEnd = (TimeLimitEndCondition)task.endCondition;
                comboBoxEndCondition.SelectedIndex = 1;
            }
            numericUpDownEndSeconds.Value = (decimal)timeEnd.TimeLimit;
            comboBoxEndButton.SelectedIndex = (int)buttonEnd.Button;
        }
예제 #2
0
 private void buttonCreate_Click(object sender, EventArgs e)
 {
     Task newTask;
     Form newTaskForm;
     switch (listBoxTasks.SelectedIndex)
     {
         case 0:
             newTask = new DialogTask();
             newTaskForm = new FormDialogTask((DialogTask) newTask);
             break;
         case 1:
             newTask = new Task2D();
             newTaskForm = new Form2DTask((Task2D) newTask);
             break;
         case 2:
             newTask = new RepeatTask();
             newTaskForm = new FormRepeatTask((RepeatTask) newTask);
             break;
         default:
             return;
     }
     this.Visible = false;
     newTaskForm.Tag = this.Tag;
     DialogResult result = newTaskForm.ShowDialog();
     if (result == DialogResult.OK)
     {
         //if the task name is left empty then set it to a generic name based on the task type
         if (newTask.Name == null || newTask.Name.Length == 0)
         {
             switch (listBoxTasks.SelectedIndex)
             {
                 case 0:
                     newTask.Name = "Dialog Task";
                     break;
                 case 1:
                     newTask.Name = "2D Task";
                     break;
                 case 2:
                     newTask.Name = "Repeat Task";
                     break;
                 default:
                     newTask.Name = "Task Name";
                     return;
             }
         }
         therapy.addTask(newTask);
         this.DialogResult = DialogResult.OK;
     }
     else
         this.DialogResult = DialogResult.Cancel;
     this.Close();
 }
예제 #3
0
 public DialogTask(DialogTask d)
 {
     Name = "copy of" + d.Name;
     displayText = d.displayText;
     endCondition = d.endCondition.returnNew();
 }
예제 #4
0
파일: Game.cs 프로젝트: naegelyd/therawii
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            WiiUse.Poll();

            // Allows the game to exit
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                this.Exit();
            }

            // Toggle Full-screen with Alt-Enter
            KeyboardState keyState = Keyboard.GetState();
            if ((keyState.IsKeyDown(Keys.RightAlt) ||
                 keyState.IsKeyDown(Keys.LeftAlt)) &&
                 keyState.IsKeyDown(Keys.Enter))
            {
                if (!justWentFullScreen)
                {
                    graphics.ToggleFullScreen();
                    justWentFullScreen = true;
                }
            }
            else
            {
                justWentFullScreen = false;
            }
            // Do we exit
            if (therapy.tasks.isComplete() && goodbye == null)
            {
                goodbye = new DialogTask();
                goodbye.endCondition = new TimeLimitEndCondition();
                ((TimeLimitEndCondition)goodbye.endCondition).TimeLimit = (double)2.0;
                ((TimeLimitEndCondition)goodbye.endCondition).Type = TimeLimitType.TotalTime;
                goodbye.DisplayText = "Therapy Complete!";
                goodbye.Name = "Complete";
                goodbye.Initialize(this.graphics, this.Content, this.spriteBatch, PREFERRED_WIDTH, PREFERRED_HEIGHT, this.session, Vector3.Zero);
                goodbye.textBox.Initialize(goodbye.DisplayText, this.Content, this.spriteBatch, PREFERRED_WIDTH, PREFERRED_HEIGHT);
            }
            if (goodbye != null)
            {
                if (goodbye.isComplete())
                    this.Exit();
                else
                    goodbye.Update(gameTime);
            }
            else
            {
                // Update Current task
                therapy.tasks.Update(gameTime);
            }
            base.Update(gameTime);
        }