예제 #1
0
파일: RoleAction.cs 프로젝트: profiles/Fish
    //bool HandleGetRoleActionInfoFinish(NetCmdBase obj)
    //{
    //    LC_Cmd_GetRoleActionInfoFinish ncb = (LC_Cmd_GetRoleActionInfoFinish)obj;

    //    //CheckIsExistsFinishItem();

    //    return true;
    //}
    //bool HandleActionAllEventFinish(NetCmdBase obj)
    //{
    //    LC_Cmd_ActionAllEventFinish ncb = (LC_Cmd_ActionAllEventFinish)obj;
    //    RoleActionBase pAction = GetAction(ncb.ActionID);
    //    if (pAction == null)
    //    {
    //        SendGetActionInfoByServer(ncb.ActionID);
    //        return true;
    //    }
    //    pAction.SetActionIsFinish();
    //    return true;
    //}
    bool HandleGetActionReward(NetCmdBase obj)
    {
        LC_Cmd_GetActionReward ncb = (LC_Cmd_GetActionReward)obj;

        RoleActionBase           pBase   = GetAction(ncb.ActionID);
        tagActionOnceRewardEvent pReward = null;

        if (pBase != null)
        {
            foreach (tagActionEventConfig var in pBase.pConfig.EventMap.Values)
            {
                if ((var.ID & pBase.pActionInfo.ActionStates) == 0)
                {
                    //为完成的条件
                    pReward = new tagActionOnceRewardEvent(ncb.ActionID, var.ID, var.RewardID);
                    break;
                }
            }
        }

        m_ActionMap.Remove(ncb.ActionID);//将任务移除掉
        // CheckIsExistsFinishItem();
        tagOnceActionChangeEvent pEvent = new tagOnceActionChangeEvent(ncb.ActionID);

        MsgEventHandle.HandleMsg(pEvent);

        if (pReward != null)
        {
            MsgEventHandle.HandleMsg(pReward);

            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Action_GetReward_Sucess);
            MsgEventHandle.HandleMsg(pUOM);
        }
        return(true);
    }
예제 #2
0
파일: RoleAction.cs 프로젝트: profiles/Fish
    bool HandleChangeActionInfo(NetCmdBase obj)
    {
        LC_Cmd_GetOnceActionInfo ncb     = (LC_Cmd_GetOnceActionInfo)obj;
        RoleActionBase           pAction = GetAction(ncb.ActionInfo.ActionID);

        if (pAction == null)
        {
            //直接添加
            tagActionConfig pConfig = null;
            if (!FishConfig.Instance.m_ActionInfo.m_ActionMap.TryGetValue(ncb.ActionInfo.ActionID, out pConfig))
            {
                return(false);
            }
            pAction = CreateAction((EventTargetType)pConfig.EventID);
            if (pAction == null || !pAction.OnInit(ncb.ActionInfo, this))
            {
                return(false);
            }
            m_ActionMap.Add(ncb.ActionInfo.ActionID, pAction);
            //  CheckIsExistsFinishItem();
            tagOnceActionChangeEvent pEvent = new tagOnceActionChangeEvent(ncb.ActionInfo.ActionID);
            MsgEventHandle.HandleMsg(pEvent);
            return(true);
        }
        else
        {
            UInt32 ID = (ncb.ActionInfo.ActionStates ^ pAction.pActionInfo.ActionStates);

            pAction.pActionInfo = ncb.ActionInfo;

            // CheckIsExistsFinishItem();
            tagOnceActionChangeEvent pEvent = new tagOnceActionChangeEvent(ncb.ActionInfo.ActionID);
            MsgEventHandle.HandleMsg(pEvent);

            RoleActionBase pBase = GetAction(ncb.ActionInfo.ActionID);
            if (pBase != null && pBase.pConfig.EventMap.ContainsKey(ID))
            {
                tagActionEventConfig     pEventConfig = pBase.pConfig.EventMap[ID];
                tagActionOnceRewardEvent pReward      = new tagActionOnceRewardEvent(ncb.ActionInfo.ActionID, ID, pEventConfig.RewardID);
                MsgEventHandle.HandleMsg(pReward);

                tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Action_GetReward_Sucess);
                MsgEventHandle.HandleMsg(pUOM);
            }
            //pAction.ChangeActionErrorInfo(ncb.ActionInfo);
        }
        return(true);
    }