示例#1
0
    public bool CheckNpc()
    {
        if (InstructorNpcId <= 0 || TraineeNpcId <= 0)
        {
            return(false);
        }
        CSPersonnel instructorP = m_MgCreator.GetNpc(InstructorNpcId);

        if (instructorP == null)
        {
            return(false);
        }
        if (instructorP.Occupation != CSConst.potTrainer)
        {
            InstructorList.Remove(instructorP.ID);
            instructorP.trainerType = ETrainerType.none;
            InstructorNpcId         = -1;
            return(false);
        }
        CSPersonnel traineeP = m_MgCreator.GetNpc(TraineeNpcId);

        if (traineeP == null)
        {
            return(false);
        }
        if (traineeP.Occupation != CSConst.potTrainer)
        {
            TraineeList.Remove(traineeP.ID);
            traineeP.trainerType = ETrainerType.none;
            TraineeNpcId         = -1;
            return(false);
        }
        return(true);
    }
示例#2
0
    public override void RemoveWorker(CSPersonnel npc)
    {
        base.RemoveWorker(npc);
        if (InstructorNpcId == npc.ID)
        {
            if (m_Counter != null)
            {
                StopCounter();
            }
            TraineeNpcId = -1;
        }

        if (TraineeNpcId == npc.ID)
        {
            if (m_Counter != null)
            {
                StopCounter();
            }
            TraineeNpcId = -1;
        }
        InstructorList.Remove(npc.ID);
        TraineeList.Remove(npc.ID);

        UpdateUI();
    }
示例#3
0
    public bool AddInstructor(CSPersonnel p)
    {
        if (InstructorList.Contains(p.ID))
        {
            return(true);
        }
        if (InstructorList.Count >= MAX_INSTRUCTOR_NUM)
        {
            return(false);
        }
        if (TraineeNpcId == p.ID)
        {
            if (m_Counter != null)
            {
                StopCounter();
            }
            TraineeNpcId = -1;
        }
        TraineeList.Remove(p.ID);
        InstructorList.Add(p.ID);
        p.trainerType = ETrainerType.Instructor;

        UpdateUI();
        return(true);
    }