Exemple #1
0
 void OnEvent(int nEventId, object param)
 {
     Client.GameEventID eid = (Client.GameEventID)nEventId;
     if (eid == Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE)
     {
         Client.stEntityStopMove stopEntity = (Client.stEntityStopMove)param;
         OnPlayerStopMove(ref stopEntity, nEventId);
         return;
     }
 }
    /// <summary>
    /// 刷新npc任务状态表示
    /// </summary>
    /// <param name="taskId"></param>
    private void OnUpdateNpcTaskStatus(uint taskId, Client.GameEventID eventID)
    {
        long   uid    = 0;
        string icon   = "";
        bool   enable = false;

        switch (eventID)
        {
        case GameEventID.TASK_ACCEPT:
        case GameEventID.TASK_CANACCEPT:
        case GameEventID.TASK_DONING:
        case GameEventID.TASK_CANSUBMIT:
        {
            enable = RoleStateBarManager.TryGetQuestStatusIcon(taskId, out uid, out icon);
            if (eventID == GameEventID.TASK_ACCEPT)
            {
                table.QuestDataBase questDB = GameTableManager.Instance.GetTableItem <table.QuestDataBase>(taskId);
                if (questDB != null && questDB.dwBeginNpc != questDB.dwEndNpc)
                {
                    //交接任务不在同一个npc移除任务标示
                    Client.INPC npc = RoleStateBarManager.GetNPCByBaseID(questDB.dwBeginNpc);
                    if (null != npc)
                    {
                        UpdateNpcTaskStatus(npc.GetUID(), false);
                    }
                }
            }
        }
        break;

        case GameEventID.TASK_DELETE:
        case GameEventID.TASK_DONE:
        {
            table.QuestDataBase questDB = GameTableManager.Instance.GetTableItem <table.QuestDataBase>(taskId);
            if (questDB == null)
            {
                return;
            }
            Client.INPC npc = RoleStateBarManager.GetNPCByBaseID(questDB.dwEndNpc);
            if (null != npc)
            {
                uid = npc.GetUID();
            }
        }
        break;
        }
        if (uid != 0)
        {
            UpdateNpcTaskStatus(uid, enable, icon);
        }
    }
Exemple #3
0
    public void OnReceiveAllSuitData(stSendAllSuitPropertyUserCmd_S msg)
    {
        IPlayer player = MainPlayerHelper.GetMainPlayer();

        if (player == null)
        {
            Log.Error("收到所有时装数据 但是还没有主角创建");
            return;
        }
        uint userID = player.GetID();
        List <stSuitData> suitList = msg.data;
        string            suitName = "";

        for (int i = 0; i < suitList.Count; i++)
        {
            stSuitData     sd  = suitList[i];
            ClientSuitData csd = new ClientSuitData();
            csd.suitBaseID = sd.base_id;
            csd.leftTime   = sd.time;
            Client.GameEventID eventtype = Client.GameEventID.Unknow;
            if (sd.status == SuitStatus.SuitStatus_Common)
            {
                csd.suitState = SuitState.HasBuy;
                AddSuitData(userID, sd.base_id, csd);
                //直接装备
                if (msg.type == SuitOPType.SuitOPType_Buy || msg.type == SuitOPType.SuitOPType_Renew)
                {
                    stOpSuitPropertyUserCmd_C cmd = new stOpSuitPropertyUserCmd_C();
                    cmd.type = SuitOPType.SuitOPType_Equip;
                    //固定3当装备
                    cmd.suit_id = (sd.base_id << 16) + 3;
                    NetService.Instance.Send(cmd);
                }
            }
            else if (sd.status == SuitStatus.SuitStatus_Equip)
            {
                csd.suitState = SuitState.Equip;
                AddSuitData(userID, sd.base_id, csd);
            }
            else if (sd.status == SuitStatus.SuitStatus_Overdue)
            {
                csd.suitState = SuitState.NoEffect;
                AddSuitData(userID, sd.base_id, csd);
            }
            else if (sd.status == SuitStatus.SuitStatus_Acti)
            {
                csd.suitState = SuitState.Active;
                AddSuitData(userID, sd.base_id, csd);
            }
            else if (sd.status == SuitStatus.SuitStatus_UNActi)
            {
                csd.suitState = SuitState.Show;
                AddSuitData(userID, sd.base_id, csd);
            }
            table.SuitDataBase db = GameTableManager.Instance.GetTableItem <table.SuitDataBase>(sd.base_id, 1);
            if (db != null)
            {
                suitName = db.name;
            }

            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.UIEVENTFASHIONDATA, sd.base_id);
            //SendChangeBody((int)sd.type, sd.base_id, player);
        }

        ShowTips(msg.type, suitName);
    }
Exemple #4
0
    void OnEvent(int nEventId, object param)
    {
        Client.GameEventID eid = (Client.GameEventID)nEventId;
        if (eid == Client.GameEventID.TASK_ACCEPT)
        {
            uint nTaskID = (uint)param;
            OnTaskAccept(nTaskID);
            return;
        }
        else if (eid == Client.GameEventID.TASK_CANSUBMIT)
        {
            Client.stTaskCanSubmit cs = (Client.stTaskCanSubmit)param;
            OnTaskCanCommit(cs.taskid);
        }
        else if (eid == Client.GameEventID.TASK_DONE)
        {
            Client.stTaskDone td = (Client.stTaskDone)param;
            OnTaskDone(td.taskid);
        }
        else if (eid == Client.GameEventID.TASK_DONING)
        {
            Client.stDoingTask dt = (Client.stDoingTask)param;
            DataManager.Manager <TaskDataManager>().DoingTaskID = dt.taskid;
            OnExecuteTask(dt.taskid);
        }
        else if (eid == Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE)
        {
            Client.stEntityStopMove stopEntity = (Client.stEntityStopMove)param;
            OnPlayerStopMove(ref stopEntity, nEventId);
            return;
        }
        else if (eid == Client.GameEventID.SKILLNONESTATE_ENTER)
        {
            Client.stSkillStateEnter sse = (Client.stSkillStateEnter)param;
            OnSkillPlayOver(ref sse, nEventId);
            return;
        }
        else if (eid == Client.GameEventID.ENTITYSYSTEM_CHANGE)
        {
            Client.stPlayerChange pc = (Client.stPlayerChange)param;

            if (!Client.ClientGlobal.Instance().IsMainPlayer(pc.uid))
            {
                return;
            }
            Engine.Utility.EventEngine.Instance().RemoveEventListener(nEventId, OnEvent);
            QuestTraceInfo questInfo = QuestTranceManager.Instance.GetQuestTraceInfo(m_nDoingTaskID);
            if (questInfo == null)
            {
                return;
            }
            m_bAddChangeListener = false;
            Engine.Utility.Log.Info("{0} 变身完毕 执行任务{1}", TAG, m_nDoingTaskID);
            ProcessTask(questInfo);
            m_nDoingTaskID = 0;
        }
        else if (eid == Client.GameEventID.ENTITYSYSTEM_RESTORE)
        {
            Client.stPlayerChange pc = (Client.stPlayerChange)param;
            if (!Client.ClientGlobal.Instance().IsMainPlayer(pc.uid))
            {
                return;
            }
            Engine.Utility.EventEngine.Instance().RemoveEventListener(nEventId, OnEvent);
            Engine.Utility.Log.Info("{0}变身回来 执行任务{1}", TAG, m_nDoingTaskID);
            OnTaskDone(m_nDoingTaskID);
            m_nDoingTaskID        = 0;
            m_bAddRestoreListener = false;
        }
    }
Exemple #5
0
 void OnEvent(int nEvent, object param)
 {
     Client.GameEventID ge = (Client.GameEventID)nEvent;
     if (ge == Client.GameEventID.TASK_DONING || ge == GameEventID.UIEVENTGUIDESHOWOUT || ge == GameEventID.SKILLSYSTEM_USESKILL)
     {
         ResetArrow();
         KillTimer();
     }
     else if (ge == GameEventID.STORY_PLAY_OVER)
     {
         ShowArrow();
     }
     else if (ge == GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE)
     {
         stEntityBeginMove move = (stEntityBeginMove)param;
         if (Client.ClientGlobal.Instance().IsMainPlayer(move.uid))
         {
             ResetArrow();
             KillTimer();
         }
     }
     else if (ge == GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE)
     {
         Client.stEntityStopMove stopEntity = (Client.stEntityStopMove)param;
         if (ClientGlobal.Instance().IsMainPlayer(stopEntity.uid))
         {
             if (CheckCondition())
             {
                 SetTime();
             }
         }
     }
     else if (ge == Client.GameEventID.UIEVENT_PANELFOCUSSTATUSCHANGED)
     {
         UIPanelManager.PanelFocusData fdata = (UIPanelManager.PanelFocusData)param;
         if (fdata.ID == PanelID.MissionAndTeamPanel)
         {
             if (fdata.GetFocus)
             {
                 if (CheckCondition())
                 {
                     SetTime();
                 }
             }
             else
             {
                 ResetArrow();
                 KillTimer();
             }
         }
     }
     else if (ge == Client.GameEventID.ENTITYSYSTEM_PROPUPDATE)
     {
         Client.stPropUpdate prop = (Client.stPropUpdate)param;
         if (Client.ClientGlobal.Instance().IsMainPlayer(prop.uid))
         {
             if (m_nignoreLevel <= MainPlayerHelper.GetPlayerLevel())
             {
                 RegisterEvent(false);
                 ResetArrow();
                 KillTimer();
             }
         }
     }
     else if (ge == GameEventID.SKILLNONESTATE_ENTER)
     {
         stSkillStateEnter state = (stSkillStateEnter)param;
         if (ClientGlobal.Instance().IsMainPlayer(state.uid))
         {
             if (CheckCondition())
             {
                 SetTime();
             }
         }
     }
     else if (ge == Client.GameEventID.COMBOT_ENTER_EXIT)
     {
         stCombotCopy cc = (stCombotCopy)param;
         if (cc.exit)
         {
             if (CheckCondition())
             {
                 SetTime();
             }
         }
         else if (cc.enter)
         {
             ResetArrow();
             KillTimer();
         }
     }
     else if (ge == GameEventID.SKILLGUIDE_PROGRESSSTART)
     {
         ResetArrow();
         KillTimer();
     }
     else if (ge == GameEventID.SKILLGUIDE_PROGRESSEND)
     {
         if (CheckCondition())
         {
             SetTime();
         }
     }
     else if (ge == Client.GameEventID.TASK_MAIN_ARROWHIDE)
     {
         ResetArrow();
         KillTimer();
     }
     else if (ge == Client.GameEventID.UIEVENTGUIDECOMPLETE || ge == Client.GameEventID.UIEVENTGUIDESKIP)
     {
         if (CheckCondition())
         {
             SetTime();
         }
     }
 }