//public void Init(MenuMode mode, GameObject ContainerForSpawnedItems, string InstructionName = null)
    //{
    //    _mode = mode;
    //    _instructionManager = InstructionManager.Instance;
    //    this.ContainerForSpawnedItems = ContainerForSpawnedItems;

    //    if (_mode == MenuMode.Record || _mode == MenuMode.Edit)
    //    {
    //        if(_mode == MenuMode.Edit)
    //        {
    //            _instructionManager.LoadInstruction(InstructionName);
    //            LoadStep(_instructionManager.GetCurrentStep());
    //        }
    //        else
    //        {
    //            _instructionManager.CreateNewInstruction(InstructionName, DateTime.Now);
    //        }

    //        NextStepButton.SetActive(true);

    //        Keyboard.TextTyped.AddListener(NewText);
    //    }
    //    else
    //    {
    //        _instructionManager.LoadInstruction(InstructionName);

    //        InsertTextButton.SetActive(false);
    //        FinishButton.SetActive(false);

    //        LoadStep(_instructionManager.GetCurrentStep());
    //        if (!_instructionManager.NextStepAvailabe())
    //        {
    //            NextStepButton.SetActive(false);
    //        }
    //    }
    //    PreviousStepButton.SetActive(false);

    //}

    /// <summary>
    /// goes into the next step of the instruction or adds a new steps if current steps is the last one
    /// </summary>
    public void NextStep()
    {
        // is this alway necessary?
        _instructionManager.Save();

        ClearItems();

        if (!_instructionManager.NextStepAvailabe() && (_mode == MenuMode.Record /*||_mode == MenuMode.Edit*/))
        {
            _instructionManager.AddStep();

            PhotoVideoPanelController.Reset(_instructionManager.GetCurrentMediaFiles());
            InstructionText.text = "Description:";
        }
        else
        {
            _instructionManager.StepForward();
            LoadStep(_instructionManager.GetCurrentStep());

            if (!_instructionManager.NextStepAvailabe() && _mode == MenuMode.Replay)
            {
                NextStepButton.SetActive(false);
            }
        }

        // this should be alway true
        if (_instructionManager.PreviousStepAvailabe())
        {
            PreviousStepButton.SetActive(true);
        }

        SetStepCounterText();
    }
Esempio n. 2
0
    public void Init(MenuMode mode, GameObject ContainerForSpawnedItems)
    {
        _mode = mode;
        _instructionManager           = InstructionManager.Instance;
        this.ContainerForSpawnedItems = ContainerForSpawnedItems;
        string tmpName = InstructionManager.Instance.Instruction.Name;

        if (tmpName.Length > 27)
        {
            tmpName = tmpName.Substring(0, 27) + "...";
        }

        InstructionNameLabel.text = tmpName;

        if (_mode == MenuMode.Record /*|| _mode == MenuMode.Edit*/)
        {
            LoadStep(_instructionManager.GetCurrentStep());
            //if (_mode == MenuMode.Edit)
            //{

            //}
            //else
            //{
            //    //_instructionManager.CreateNewInstruction(InstructionName, DateTime.Now);
            //}

            NextStepButton.SetActive(true);
            HomeButton.SetActive(false);
            Keyboard.TextTyped.AddListener(NewText);
        }
        else
        {
            InsertTextButton.SetActive(false);
            ExportButton.SetActive(false);
            HomeButton.SetActive(false);

            LoadStep(_instructionManager.GetCurrentStep());
            if (!_instructionManager.NextStepAvailabe())
            {
                NextStepButton.SetActive(false);
                HomeButton.SetActive(true);
            }
        }
        PreviousStepButton.SetActive(false);
    }