Esempio n. 1
0
    //private bool HandleMonthPlayerSumFinish(NetCmdBase obj)
    //{
    //    LC_Cmd_GetMonthRoleSumFinish ncb = (LC_Cmd_GetMonthRoleSumFinish)obj;

    //    //IsLoadMonthPlayerSum = true;

    //    tagMonthSignUpSumChangeEvent pEvent = new tagMonthSignUpSumChangeEvent();
    //    MsgEventHandle.HandleMsg(pEvent);

    //    return true;
    //}
    private bool HandleSetRoleMonthInfo(NetCmdBase obj)
    {
        LC_Cmd_SetRoleMonthInfo ncb = (LC_Cmd_SetRoleMonthInfo)obj;

        if (ncb.dwUserID == PlayerRole.Instance.RoleInfo.RoleMe.GetUserID())
        {
            PlayerRole.Instance.RoleInfo.RoleMe.SetMonthGlobel(Convert.ToUInt32(PlayerRole.Instance.RoleInfo.RoleMe.GetMonthGlobel() + ncb.MonthGlobel));
            PlayerRole.Instance.RoleInfo.RoleMe.SetMonthScore(Convert.ToUInt32(PlayerRole.Instance.RoleInfo.RoleMe.GetMonthScore() + ncb.MonthSocre));

            tagMonthChangeEvent pEvent = new tagMonthChangeEvent(ncb.dwUserID);
            MsgEventHandle.HandleMsg(pEvent);
        }
        else
        {
            TableRole pRole = PlayerRole.Instance.TableManager.GetTableRole(ncb.dwUserID);
            if (pRole != null)
            {
                pRole.SetMonthGlobel(Convert.ToUInt32(pRole.GetMonthGlobel() + ncb.MonthGlobel));
                pRole.SetMonthScore(Convert.ToUInt32(pRole.GetMonthScore() + ncb.MonthSocre));

                tagMonthChangeEvent pEvent = new tagMonthChangeEvent(ncb.dwUserID);
                MsgEventHandle.HandleMsg(pEvent);
            }
        }
        return(true);
    }
Esempio n. 2
0
        public bool OnAddUserGlobelByCatchedData(Byte Seat, int GlobelSum) //修改指定位置上玩家的金币 或者是积分 必须是 与鱼群相关的
        {
            //因为捕获鱼 添加金币
            Seat = SceneRuntime.ClientToServerSeat(Seat);
            bool IsInMonth = (PlayerRole.Instance.RoleInfo.RoleMe.GetMonthID() != 0);

            if (PlayerRole.Instance.RoleInfo.RoleMe.GetSeat() == Seat)
            {
                if (PlayerRole.Instance.RoleInfo.RoleMe == null)
                {
                    return(false);
                }
                if (IsInMonth)
                {
                    if (GlobelSum >= 0)
                    {
                        PlayerRole.Instance.RoleInfo.RoleMe.SetMonthScore(
                            Convert.ToUInt32(PlayerRole.Instance.RoleInfo.RoleMe.GetMonthScore() + GlobelSum));
                    }
                    else
                    {
                        if (PlayerRole.Instance.RoleInfo.RoleMe.GetMonthGlobel() < GlobelSum * -1)
                        {
                            return(false);
                        }
                        PlayerRole.Instance.RoleInfo.RoleMe.SetMonthGlobel(
                            Convert.ToUInt32(PlayerRole.Instance.RoleInfo.RoleMe.GetMonthGlobel() + GlobelSum));
                    }
                    //tagMonthChangeEvent pEvent = new tagMonthChangeEvent(PlayerRole.Instance.RoleInfo.RoleMe.GetUserID());
                    //MsgEventHandle.HandleMsg(pEvent);
                    tagMatchScoreAddEvent pEvent =
                        new tagMatchScoreAddEvent(PlayerRole.Instance.RoleInfo.RoleMe.GetUserID());
                    //MsgEventHandle.HandleMsg(pEvent);
                    IEvent evnt = new Event(EventMsg.UPDATE_PLAYSCORE);
                    EventManager.Instance.DispatchEvent(evnt);
                    return(true);
                }
                else
                {
                    if (GlobelSum < 0 && PlayerRole.Instance.RoleInfo.RoleMe.GetGlobel() < -1 * GlobelSum)
                    {
                        return(false);
                    }
                    PlayerRole.Instance.RoleInfo.RoleMe.SetGlobel(
                        Convert.ToUInt32(PlayerRole.Instance.RoleInfo.RoleMe.GetGlobel() + GlobelSum));
                    tagRoleChangeEvent pEvent = new tagRoleChangeEvent();
                    //MsgEventHandle.HandleMsg(pEvent);
                    return(true);
                }
            }
            else
            {
                if (IsInMonth)
                {
                    TableRole pTableRole = PlayerRole.Instance.TableManager.GetTableRole(Seat);
                    if (pTableRole == null)
                    {
                        return(false);
                    }
                    if (GlobelSum >= 0)
                    {
                        pTableRole.SetMonthScore(Convert.ToUInt32(pTableRole.GetMonthScore() + GlobelSum));
                    }
                    else
                    {
                        if (pTableRole.GetMonthGlobel() < GlobelSum * -1)
                        {
                            return(false);
                        }
                        pTableRole.SetMonthGlobel(Convert.ToUInt32(pTableRole.GetMonthGlobel() + GlobelSum));
                    }
                    tagMonthChangeEvent pEvent = new tagMonthChangeEvent(pTableRole.GetUserID());
                    //MsgEventHandle.HandleMsg(pEvent);
                    return(true);
                }
                else
                {
                    if (GlobelSum < 0 && PlayerRole.Instance.TableManager.GetTableRole(Seat).GetGlobel() < -1 * GlobelSum)
                    {
                        return(false);
                    }
                    TableRole pTableRole = PlayerRole.Instance.TableManager.GetTableRole(Seat);
                    if (pTableRole == null)
                    {
                        return(false);
                    }
                    pTableRole.SetGlobel(Convert.ToUInt32(pTableRole.GetGlobel() + GlobelSum));

                    tagTableChangeEvent pEvent = new tagTableChangeEvent(pTableRole.GetUserID());
                    //MsgEventHandle.HandleMsg(pEvent);
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 3
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);
    }