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
    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);
    }
Esempio n. 3
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);
        }