Exemplo n.º 1
0
    void OnStepClicked(GameObject arg)
    {
        TutorStepItem step = arg.GetComponent <TutorStepItem>();

        currentStepIndex = step.itemId;

        UpdateStep();

        UpdateStepImage();
    }
Exemplo n.º 2
0
    void UpdateStep()
    {
        DeleteAllChildren(stepPanel.transform);
        float clipSizeY = stepPanel.clipRange.w;

        float y         = clipSizeY / 2;
        float selectedY = 0f;

        for (int i = 0; i < tutorData.lessons[currentLessonIndex].steps.Count; i++)
        {
            TutorStepData step = tutorData.lessons[currentLessonIndex].steps[i];

            TutorStepItem item = CreateStepItem(stepPanel.transform);

            item.Text   = step.name.ToLocalizationString() + "\n" + step.description.ToLocalizationString();
            item.itemId = i;

            UIButtonMessage btnMsg = item.GetComponent <UIButtonMessage>();
            btnMsg.functionName = "OnStepClicked";
            btnMsg.target       = gameObject;

            y -= item.Size.y / 2;
            item.transform.localPosition = new Vector3(0f, y, 0f);

            if (i == currentStepIndex)
            {
                currentStepLabel.text = "STEP:" + (i + 1) + "/" + tutorData.lessons[currentLessonIndex].steps.Count;
                item.Selected();
                selectedY = y;
            }

            y -= (item.Size.y / 2 + 10);
        }

        UIDraggablePanel dragPanel = stepPanel.GetComponent <UIDraggablePanel>();

        dragPanel.ResetPosition();
        float relativeY = selectedY / (y + clipSizeY / 2 + 10);

        //dragPanel.SetDragAmount(0f, (84 - selectedY - 85) / (84-y-10-170), false);
        dragPanel.SetDragAmount(0f, relativeY, false);
    }