Ejemplo n.º 1
0
    public static WorkoutData Copy(WorkoutData workoutDataToCopy)
    {
        WorkoutData copiedWorkout = new WorkoutData();

        copiedWorkout.name                    = workoutDataToCopy.name;
        copiedWorkout.workoutType             = workoutDataToCopy.workoutType;
        copiedWorkout.secondsBetweenExercises = workoutDataToCopy.secondsBetweenExercises;
        copiedWorkout.hasTenSecTimer          = workoutDataToCopy.hasTenSecTimer;
        copiedWorkout.exerciseData            = new List <ExerciseData> ();

        foreach (ExerciseData exercise in workoutDataToCopy.exerciseData)
        {
            ExerciseData copiedExercise = ExerciseData.Copy(
                exercise.name,
                exercise.secondsToCompleteSet,
                exercise.totalInitialSets,
                exercise.totalSets,
                exercise.repsPerSet,
                exercise.weight,
                exercise.exerciseType
                );

            copiedWorkout.exerciseData.Add(copiedExercise);
        }

        return(copiedWorkout);
    }
Ejemplo n.º 2
0
    public void AddWorkoutFromPlanPanel()
    {
        WorkoutData copiedWorkout = new WorkoutData();

        copiedWorkout.name                    = workoutData.name;
        copiedWorkout.workoutType             = workoutData.workoutType;
        copiedWorkout.secondsBetweenExercises = workoutData.secondsBetweenExercises;
        copiedWorkout.exerciseData            = new List <ExerciseData> ();

        foreach (ExerciseData exercise in workoutData.exerciseData)
        {
            ExerciseData copiedExercise = ExerciseData.Copy(
                exercise.name,
                exercise.secondsToCompleteSet,
                exercise.totalInitialSets,
                exercise.totalSets,
                exercise.repsPerSet,
                exercise.weight,
                exercise.exerciseType
                );

            copiedWorkout.exerciseData.Add(copiedExercise);
        }

        WorkoutHUD.Instance.AddWorkoutPanel(copiedWorkout, false);
        WorkoutManager.Instance.Save();
    }
Ejemplo n.º 3
0
    void CreateWorkoutPanel()
    {
        WorkoutData copiedWorkout = new WorkoutData();

        copiedWorkout.name                    = currentWorkoutData.name;
        copiedWorkout.workoutType             = currentWorkoutData.workoutType;
        copiedWorkout.secondsBetweenExercises = currentWorkoutData.secondsBetweenExercises;
        copiedWorkout.exerciseData            = new List <ExerciseData> ();

        foreach (ExerciseData exercise in copiedWorkout.exerciseData)
        {
            ExerciseData copiedExercise = ExerciseData.Copy(
                exercise.name,
                exercise.secondsToCompleteSet,
                exercise.totalInitialSets,
                exercise.totalSets,
                exercise.repsPerSet,
                exercise.weight,
                exercise.exerciseType
                );

            copiedWorkout.exerciseData.Add(copiedExercise);
        }

        WorkoutHUD.Instance.AddWorkoutPanel(copiedWorkout, false);
        SoundManager.Instance.PlayButtonPressSound();
        WorkoutManager.Instance.Save();

        Hide();

        Canvas.ForceUpdateCanvases();
        WorkoutHUD.Instance.workoutsScrollRect.verticalScrollbar.value = 0f;
        Canvas.ForceUpdateCanvases();
    }
Ejemplo n.º 4
0
    public void CopyAndInit(ExerciseData exerciseToCopy, bool isCreatingNewExercise, bool shouldAutoSelectInputField)
    {
        ExerciseData copiedExercise = ExerciseData.Copy(
            exerciseToCopy.name,
            exerciseToCopy.secondsToCompleteSet,
            exerciseToCopy.totalInitialSets,
            exerciseToCopy.totalSets,
            exerciseToCopy.repsPerSet,
            exerciseToCopy.weight,
            exerciseToCopy.exerciseType
            );

        currentExerciseMenuItem      = null;
        currentExerciseData          = copiedExercise;
        _exerciseNameInputField.text = copiedExercise.name;
        _setsRow.Init(this);
        _repsRow.Init(this);
        _weightRow.Init(this);
        _secondsRow.Init(this);
        Show();

        if (fitBoyAnimator != null)
        {
            fitBoyAnimator.Init(copiedExercise.exerciseType);
        }

        this.isCreatingNewExercise = isCreatingNewExercise;

        if (shouldAutoSelectInputField)
        {
            _exerciseNameInputField.Select();
        }
    }
Ejemplo n.º 5
0
    void HandleAddWorkoutPressed()
    {
        _backButton.gameObject.SetActive(false);
        _addWorkoutButton.gameObject.SetActive(false);

        WorkoutData copiedWorkout = new WorkoutData();

        copiedWorkout.name                    = currentWorkoutData.name;
        copiedWorkout.workoutType             = currentWorkoutData.workoutType;
        copiedWorkout.secondsBetweenExercises = currentWorkoutData.secondsBetweenExercises;
        copiedWorkout.exerciseData            = new List <ExerciseData> ();

        foreach (ExerciseData exercise in currentWorkoutData.exerciseData)
        {
            ExerciseData copiedExercise = ExerciseData.Copy(
                exercise.name,
                exercise.secondsToCompleteSet,
                exercise.totalInitialSets,
                exercise.totalSets,
                exercise.repsPerSet,
                exercise.weight,
                exercise.exerciseType
                );

            copiedWorkout.exerciseData.Add(copiedExercise);
        }

        WorkoutHUD.Instance.AddWorkoutPanel(copiedWorkout, false);
        SoundManager.Instance.PlayButtonPressSound();
        WorkoutManager.Instance.Save();

        AddPanel.Instance.Exit();

//		Canvas.ForceUpdateCanvases ();
//		WorkoutHUD.Instance.workoutsScrollRect.verticalScrollbar.value = 0f;
//		Canvas.ForceUpdateCanvases ();
    }
Ejemplo n.º 6
0
    void Duplicate()
    {
        if (WorkoutHUD.Instance.currentMode == Mode.ViewingWorkouts)
        {
            WorkoutPanel workoutPanelToCopy      = WorkoutManager.Instance.workoutHUD.selectedPanel.GetComponent <WorkoutPanel> ();
            int          workoutPanelToCopyIndex = workoutPanelToCopy.transform.GetSiblingIndex();
            WorkoutData  copiedWorkout           = WorkoutData.Copy(workoutPanelToCopy.workoutData);
            WorkoutPanel newWorkoutPanel         = WorkoutHUD.Instance.AddWorkoutPanel(copiedWorkout, false);
            newWorkoutPanel.transform.SetSiblingIndex(workoutPanelToCopyIndex + 1);
            SaveExercisePanelOrder();
            WorkoutManager.Instance.Save();
            Confirm();
        }
        else
        {
            ExerciseMenuItem exerciseMenuItemToCopy = WorkoutManager.Instance.workoutHUD.selectedPanel.GetComponent <ExerciseMenuItem> ();
            int exerciseMenuItemToCopyIndex         = exerciseMenuItemToCopy.transform.GetSiblingIndex();

            print("exerciseMenuItemToCopy.exerciseData.name" + exerciseMenuItemToCopy.exerciseData.name);

            ExerciseData copiedExercise = ExerciseData.Copy(
                exerciseMenuItemToCopy.exerciseData.name,
                exerciseMenuItemToCopy.exerciseData.secondsToCompleteSet,
                exerciseMenuItemToCopy.exerciseData.totalInitialSets,
                exerciseMenuItemToCopy.exerciseData.totalSets,
                exerciseMenuItemToCopy.exerciseData.repsPerSet,
                exerciseMenuItemToCopy.exerciseData.weight,
                exerciseMenuItemToCopy.exerciseData.exerciseType
                );

            ExerciseMenuItem newExerciseMenuItem = WorkoutHUD.Instance.AddExercisePanel(null, copiedExercise, false);
            newExerciseMenuItem.transform.SetSiblingIndex(exerciseMenuItemToCopyIndex + 1);
            SaveExercisePanelOrder();
            WorkoutManager.Instance.Save();
            Confirm();
        }
    }
Ejemplo n.º 7
0
    void CreateExerciseMenuItem()
    {
        ExerciseData copiedExercise = ExerciseData.Copy(
            currentExerciseData.name,
            currentExerciseData.secondsToCompleteSet,
            currentExerciseData.totalInitialSets,
            currentExerciseData.totalSets,
            currentExerciseData.repsPerSet,
            currentExerciseData.weight,
            currentExerciseData.exerciseType
            );

        WorkoutManager.Instance.ActiveWorkout.exerciseData.Add(copiedExercise);
        WorkoutHUD.Instance.AddExercisePanel(null, copiedExercise, false);
        SoundManager.Instance.PlayButtonPressSound();
        Header.Instance.SetUpForExercisesMenu(WorkoutManager.Instance.ActiveWorkout);
        WorkoutManager.Instance.Save();

        Hide();

        Canvas.ForceUpdateCanvases();
        WorkoutHUD.Instance.exercisesScrollRect.verticalScrollbar.value = 0f;
        Canvas.ForceUpdateCanvases();
    }