示例#1
0
    private bool HandleResetRoleMonth(NetCmdBase obj)
    {
        LC_Cmd_ResetMonthInfo ncb = (LC_Cmd_ResetMonthInfo)obj;

        if (ncb.dwUserID == PlayerRole.Instance.RoleInfo.RoleMe.GetUserID())
        {
            tagUserOperationEvent pUOM = new tagUserOperationEvent((ncb.Result ? UserOperateMessage.UOM_Month_ResetMonth_Sucess : UserOperateMessage.UOM_Month_ResetMonth_Failed_6));
            MsgEventHandle.HandleMsg(pUOM);

            if (ncb.MonthID != PlayerRole.Instance.RoleInfo.RoleMe.GetMonthID() || !ncb.Result)
            {
                return(true);
            }

            PlayerRole.Instance.RoleInfo.RoleMe.SetMonthGlobel(FishConfig.Instance.m_MatchInfo.m_MonthMap[ncb.MonthID].InitMonthGlobel);
            PlayerRole.Instance.RoleInfo.RoleMe.SetMonthScore(0);
            PlayerRole.Instance.RoleInfo.RoleMe.SetMonthAddGlobelNum(0);

            tagMonthChangeEvent pEvent = new tagMonthChangeEvent(ncb.dwUserID);
            MsgEventHandle.HandleMsg(pEvent);
        }
        else
        {
            if (ncb.MonthID != PlayerRole.Instance.RoleInfo.RoleMe.GetMonthID() || !ncb.Result)
            {
                return(true);
            }

            TableRole pRole = PlayerRole.Instance.TableManager.GetTableRole(ncb.dwUserID);
            if (pRole != null)
            {
                pRole.SetMonthGlobel(FishConfig.Instance.m_MatchInfo.m_MonthMap[ncb.MonthID].InitMonthGlobel);
                pRole.SetMonthScore(0);
                pRole.SetMonthAddGlobelNum(0);

                tagMonthChangeEvent pEvent = new tagMonthChangeEvent(ncb.dwUserID);
                MsgEventHandle.HandleMsg(pEvent);
            }
        }
        return(true);
    }
示例#2
0
    private bool HandleChangeUserAddMonthGlobelNum(NetCmdBase obj) //玩家续币成功的时候
    {
        LC_Cmd_ChangeUserAddMonthGlobelNum ncb = (LC_Cmd_ChangeUserAddMonthGlobelNum)obj;

        //桌子上一个玩家进行续币了 修改数据
        if (ncb.dwUserID == PlayerRole.Instance.RoleInfo.RoleMe.GetUserID())
        {
            //if (PlayerRole.Instance.RoleInfo.RoleMe.GetGlobel() <= FishConfig.Instance.m_MatchInfo.m_MonthMap[PlayerRole.Instance.RoleInfo.RoleMe.GetMonthID()].m_ConvertMap[(Byte)(PlayerRole.Instance.RoleInfo.RoleMe.GetMonthAddGlobelNum() + 1)].LostGlobel)
            //    PlayerRole.Instance.RoleInfo.RoleMe.SetGlobel(0);
            //else
            //    PlayerRole.Instance.RoleInfo.RoleMe.SetGlobel(PlayerRole.Instance.RoleInfo.RoleMe.GetGlobel() - FishConfig.Instance.m_MatchInfo.m_MonthMap[PlayerRole.Instance.RoleInfo.RoleMe.GetMonthID()].m_ConvertMap[(Byte)(PlayerRole.Instance.RoleInfo.RoleMe.GetMonthAddGlobelNum() + 1)].LostGlobel);
            if (!FishConfig.Instance.m_MatchInfo.m_MonthMap.ContainsKey(PlayerRole.Instance.RoleInfo.RoleMe.GetMonthID()))
            {
                return(true);
            }
            if (!FishConfig.Instance.m_MatchInfo.m_MonthMap[PlayerRole.Instance.RoleInfo.RoleMe.GetMonthID()].m_ConvertMap.ContainsKey((Byte)(PlayerRole.Instance.RoleInfo.RoleMe.GetMonthAddGlobelNum() + 1)))
            {
                return(true);
            }
            PlayerRole.Instance.RoleInfo.RoleMe.SetMonthGlobel(PlayerRole.Instance.RoleInfo.RoleMe.GetMonthGlobel() + FishConfig.Instance.m_MatchInfo.m_MonthMap[PlayerRole.Instance.RoleInfo.RoleMe.GetMonthID()].m_ConvertMap[(Byte)(PlayerRole.Instance.RoleInfo.RoleMe.GetMonthAddGlobelNum() + 1)].AddMonthGlobel);
            PlayerRole.Instance.RoleInfo.RoleMe.SetMonthAddGlobelNum(Convert.ToByte(PlayerRole.Instance.RoleInfo.RoleMe.GetMonthAddGlobelNum() + 1));

            tagRoleChangeEvent pRoleEvent = new tagRoleChangeEvent();
            MsgEventHandle.HandleMsg(pRoleEvent);

            tagMonthChangeEvent pEvent = new tagMonthChangeEvent(ncb.dwUserID);
            MsgEventHandle.HandleMsg(pEvent);

            tagMatchContiueGoldEvent pContinueEvent = new tagMatchContiueGoldEvent();
            MsgEventHandle.HandleMsg(pContinueEvent);

            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Month_AddMonthGlobel_Sucess);
            MsgEventHandle.HandleMsg(pUOM);
        }
        else
        {
            TableRole pRole = PlayerRole.Instance.TableManager.GetTableRole(ncb.dwUserID);
            if (pRole != null)
            {
                //if (pRole.GetGlobel() <= FishConfig.Instance.m_MatchInfo.m_MonthMap[pRole.GetMonthID()].m_ConvertMap[(Byte)(pRole.GetMonthAddGlobelNum() + 1)].LostGlobel)
                //    pRole.SetGlobel(0);
                //else
                //    pRole.SetGlobel(pRole.GetGlobel() - FishConfig.Instance.m_MatchInfo.m_MonthMap[pRole.GetMonthID()].m_ConvertMap[(Byte)(pRole.GetMonthAddGlobelNum() + 1)].LostGlobel);
                if (!FishConfig.Instance.m_MatchInfo.m_MonthMap.ContainsKey(pRole.GetMonthID()))
                {
                    return(true);
                }
                if (!FishConfig.Instance.m_MatchInfo.m_MonthMap[PlayerRole.Instance.RoleInfo.RoleMe.GetMonthID()].m_ConvertMap.ContainsKey((Byte)(pRole.GetMonthAddGlobelNum() + 1)))
                {
                    return(true);
                }
                pRole.SetMonthGlobel(pRole.GetMonthGlobel() + FishConfig.Instance.m_MatchInfo.m_MonthMap[pRole.GetMonthID()].m_ConvertMap[(Byte)(pRole.GetMonthAddGlobelNum() + 1)].AddMonthGlobel);
                pRole.SetMonthAddGlobelNum(Convert.ToByte(pRole.GetMonthAddGlobelNum() + 1));

                tagRoleChangeEvent pRoleEvent = new tagRoleChangeEvent();
                MsgEventHandle.HandleMsg(pRoleEvent);

                tagMonthChangeEvent pEvent = new tagMonthChangeEvent(ncb.dwUserID);
                MsgEventHandle.HandleMsg(pEvent);
            }
        }
        return(true);
    }