Esempio n. 1
0
    void InitSteps()
    {
        stepList.Clear();

        int i = 0;

        while (true)
        {
            Transform step_trans = transform.FindChild("" + i);
            if (step_trans)
            {
                TeachStep step = step_trans.GetComponent <TeachStep>();
                if (!step)
                {
                    Debug.LogError(string.Format("Cannnot find TeachStep componet in teachgroup:{0} idx:{1}",
                                                 gameObject.name, i));
                }
                stepList.Add(step);
            }
            else
            {
                break;
            }
            ++i;
        }

        if (stepList.Count == 0 || stepList.Count != transform.childCount)
        {
            Debug.LogError(string.Format("TeachStepCount {0} != TeachGroup:{1} child count!", stepList.Count, gameObject.name));
        }
    }
Esempio n. 2
0
    // 开启新教学
    public void StartTeach(int teach_id)
    {
        isTeaching      = true;
        isFinishedGroup = false;

        teachingID      = teach_id;
        teachingStepIdx = 0;

        curTeachGroup = TeachGroupMgr.Instance.GetTeachGroup(teachingID);
        curTeachStep  = CreateTeachStep(teachingStepID);
        curTeachStep.OnStart();

        interruptTeachID     = teachingID;
        interruptTeachStepID = teachingStepID;

        Debug.LogError("-------------StartTeach:" + teach_id);
    }
Esempio n. 3
0
    void NextTeachStep()
    {
        if (curTeachStep != null)
        {
            curTeachStep.OnOver();
        }

        teachingStepIdx += 1;
        if (teachingStepIdx >= teachStepList.Count)
        {
            // Teach finished
            isTeaching                 = false;
            isFinishedGroup            = true;
            finishedStates[teachingID] = true;

            interruptTeachID     = -1;
            interruptTeachStepID = -1;
            finishedTeachID      = teachingID;

            // Gate finished
            finishedStates[teachingID] = true;
            CustomPrefs.SetFinishedTeachID(teachingID);

            // TODO:by Teng.和服务器交互
            Debuger.LogError(string.Format("Teach {0} finished!", teachingID));

            if (IsLastTeachIdx(teachingID))
            {
                isFinishedAll = true;
            }
            else
            {
                DetectNewTeach();
            }
        }
        else
        {
            curTeachStep = CreateTeachStep(teachingStepID);
            curTeachStep.OnStart();
        }
    }