Exemplo n.º 1
0
    //////////////////////////////////////////////////////////////////////////
    //对话相关接口
    //////////////////////////////////////////////////////////////////////////
    // 弹出最近对话框 --寻路完响应
    public void AutoDialog(int nMissionID)
    {
        Tab_MissionBase MissionBase = TableManager.GetMissionBaseByID(nMissionID, 0);

        if (MissionBase == null)
        {
            LogModule.ErrorLog("Can not find missionBase {0}", nMissionID);
            return;
        }

        Obj_NPC TargetNpc = null;

        foreach (string strName in Singleton <ObjManager> .GetInstance().ObjPools.Keys)
        {
            Obj_Character objChar = Singleton <ObjManager> .GetInstance().ObjPools[strName] as Obj_Character;

            if (null == objChar)
            {
                return;
            }

            if (objChar.BaseAttr.RoleBaseID == MissionBase.AcceptDataID ||
                objChar.BaseAttr.RoleBaseID == MissionBase.CompleteDataID)
            {
                TargetNpc = objChar as Obj_NPC;
                break;
            }
        }
        if (TargetNpc == null)
        {
            LogModule.ErrorLog("Can not find TargetNPC of ID: {0} or {1}", MissionBase.AcceptDataID, MissionBase.CompleteDataID);
            return;
        }

        if (null != Singleton <ObjManager> .GetInstance().MainPlayer)
        {
            Singleton <ObjManager> .GetInstance().MainPlayer.OnSelectTarget(TargetNpc.gameObject);
        }
        if (!TargetNpc.IsHaveMission(nMissionID))
        {
            LogModule.ErrorLog("Do not have mission {0}", nMissionID);
            return;
        }

        Show(TargetNpc);
    }
Exemplo n.º 2
0
    /// <summary>
    /// 显示对话框
    /// </summary>
    /// <param name='bMission'>
    /// 是否是任务
    /// </param>
    /// <param name='nDialogId'>
    /// 任务ID/对白ID
    /// </param>
    public static void ShowMissionDialogUI(int nMissionID)
    {
        Tab_MissionBase table = TableManager.GetMissionBaseByID(nMissionID, 0);

        if (table != null)
        {
            // NPC 距离判断
            Obj_NPC TargetNpc = Singleton <DialogCore> .GetInstance().CareNPC;

            if (TargetNpc == null)
            {
//				LogModule.ErrorLog("Can not find DialogCore's CareNPC");
                return;
            }

            if (!TargetNpc.IsHaveMission(nMissionID))
            {
                LogModule.ErrorLog("NPC {0} do not have mission {1}", TargetNpc.name, nMissionID);
                return;
            }

            // 是否已接取
            bool         isHaveMission = GameManager.gameManager.MissionManager.IsHaveMission(nMissionID);
            MissionState misState      = (MissionState)GameManager.gameManager.MissionManager.GetMissionState(nMissionID);
            if (isHaveMission && misState != MissionState.Mission_Failed)
            {
                if (MissionState.Mission_Completed == misState)
                {
                    if (table.CompleteDataID == TargetNpc.BaseAttr.RoleBaseID)
                    {
                        ShowMissionDialogUI(nMissionID, MissionInfoController.MissionUIType.TYPE_COMPLETE);
                    }
                    else
                    {
                        // cunyi
                        LogModule.ErrorLog("Mission {0} completeDataID {1} dos not match with targetNPC's roleBaseID {2}", nMissionID, table.CompleteDataID, TargetNpc.BaseAttr.RoleBaseID);
                    }
                }
                else
                {
                    // cunyi
                    LogModule.ErrorLog("Mission {0} 's state {1} is not complete", nMissionID, misState);
                }
            }
            else
            {
                bool isCanAcceptMission = GameManager.gameManager.MissionManager.CanAcceptMission(nMissionID);
                if (isCanAcceptMission)
                {
                    if (table.AcceptDataID == TargetNpc.BaseAttr.RoleBaseID)
                    {
                        ShowMissionDialogUI(nMissionID, MissionInfoController.MissionUIType.TYPE_ACCETP);
                    }
                    else
                    {
                        // cunyi
                        LogModule.ErrorLog("Mission {0} acceptDataID {1} dos not match with targetNPC's roleBaseID {2}", nMissionID, table.AcceptDataID, TargetNpc.BaseAttr.RoleBaseID);
                    }
                }
                else
                {
                    // cunyi
                    LogModule.ErrorLog("Can not accept mission {0}", nMissionID);
                }
            }
        }
        else
        {
            LogModule.ErrorLog("Can not find missionID {0} in Tab_MissionBase", nMissionID);
        }
    }