Пример #1
0
        public UInt32 GetPlayerGlobelBySeat(Byte Seat)
        {
            Seat = SceneRuntime.ClientToServerSeat(Seat);
            RoleBase pRole = null;

            if (PlayerRole.Instance.RoleInfo.RoleMe.GetSeat() == Seat)
            {
                pRole = PlayerRole.Instance.RoleInfo.RoleMe;
            }
            else
            {
                // pRole = PlayerRole.Instance.TableManager.GetTableRole(Seat);
            }
            if (pRole == null)
            {
                return(0);
            }
            bool IsInMonth = (PlayerRole.Instance.RoleInfo.RoleMe.GetMonthID() != 0);

            if (IsInMonth)
            {
                return(pRole.GetMonthGlobel());
            }
            else
            {
                return(pRole.GetGlobel());
            }
        }
Пример #2
0
    public UInt32 GetPlayerSocreBySeat(Byte Seat)
    {
        Seat = SceneRuntime.ClientToServerSeat(Seat);
        //或者指定位置玩家的积分
        bool IsInMonth = (PlayerRole.Instance.RoleInfo.RoleMe.GetMonthID() != 0);

        if (!IsInMonth)
        {
            return(0);
        }
        RoleBase pRole = null;

        if (PlayerRole.Instance.RoleInfo.RoleMe.GetSeat() == Seat)
        {
            pRole = PlayerRole.Instance.RoleInfo.RoleMe;
        }
        else
        {
            pRole = PlayerRole.Instance.TableManager.GetTableRole(Seat);
        }
        if (pRole == null)
        {
            return(0);
        }
        return(pRole.GetMonthScore());
    }
Пример #3
0
    //切换到指定倍率
    public void ChangeDestRate(byte rateIndex)
    {
        NetCmdChangeRateType ncb = new NetCmdChangeRateType();

        ncb.SetCmdType(NetCmdType.CMD_CHANGE_RATE_TYPE);
        ncb.Seat      = SceneRuntime.ClientToServerSeat(m_PlayerMgr.MyClientSeat);
        ncb.RateIndex = rateIndex;
        Send <NetCmdChangeRateType>(ncb);
    }
Пример #4
0
    //切换到指定类型 的炮
    public void ChangeDestLauncher(byte launcherType)
    {
        NetCmdChangeLauncherType ncb = new NetCmdChangeLauncherType();

        ncb.SetCmdType(NetCmdType.CMD_CHANGE_LAUNCHER_TYPE);
        ncb.Seat         = SceneRuntime.ClientToServerSeat(m_PlayerMgr.MyClientSeat);
        ncb.LauncherType = launcherType;
        Send <NetCmdChangeLauncherType>(ncb);
    }
Пример #5
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);
        }
Пример #6
0
        public void HandeCatchFishData(CatchedData cd) //捕获鱼的结果
        {
            if (cd == null)                            //判断是否是自己
            {
                return;
            }
            int Exp = 0;

            if (SceneRuntime.ClientToServerSeat(cd.ClientSeat) == PlayerRole.Instance.RoleInfo.RoleMe.GetSeat())
            {
                if (cd.FishList.Count > 0)
                {
                    for (int i = 0; i < cd.FishList.Count; ++i)
                    {
                        //添加经验
                        Exp += FishSetting.FishDataList[cd.FishList[i].FishType].Gold;

                        if (PlayerRole.Instance.RoleInfo.RoleMe.GetMonthID() == 0 &&
                            PlayerRole.Instance.RoleInfo.RoleMe.GetSeat() != 0xff) //在桌子里 并且不在比赛之中
                        //PlayerRole.Instance.RoleLottery.OnRoleCatchByLottery(cd.FishList[i].FishType, cd);

                        {
                            if (PlayerRole.Instance.RoleInfo.RoleMe.GetMonthID() == 0)
                            {
                                HandleEvent(EventTargetType.ET_CatchFish, cd.FishList[i].FishType, 1);
                            }
                        }

                        /*if (PlayerRole.Instance.RoleInfo.RoleMe.GetMonthID() == 0 &&
                         *  PlayerRole.Instance.RoleInfo.RoleMe.GetSeat() != 0xff) //在桌子里 并且不在比赛之中
                         *  RoleGameData.OnHandleCatchFish(cd.FishList[i].FishType); //捕获指定的鱼*/
                    }
                }
                if (cd.CatchType == (Byte)CatchedType.CATCHED_BULLET ||
                    cd.CatchType == (Byte)CatchedType.CATCHED_LASER)  //技能不算开炮获得金币
                {
                    if (PlayerRole.Instance.RoleInfo.RoleMe.GetMonthID() == 0)
                    {
                        HandleEvent(EventTargetType.ET_LauncherGlobel, Convert.ToUInt32(cd.GoldNum), 1); //一炮获得多少金币
                    }
                }
                if (cd.CatchType == (Byte)CatchedType.CATCHED_SKILL)
                {
                    HandleEvent(EventTargetType.ET_UseSkill, cd.SubType, 1);
                }
            }
            if (PlayerRole.Instance.RoleInfo.RoleMe.GetMonthID() == 0 &&
                PlayerRole.Instance.RoleInfo.RoleMe.GetSeat() != 0xff) //在桌子里 并且不在比赛之中
            {
                PlayerRole.Instance.OnAddUserExp(Exp);
            }
            //根据位置 获得桌子上玩家的对象
            //Byte Seat = SceneRuntime.ClientToServerSeat(cd.ClientSeat);
            //bool IsInMonth = (PlayerRole.Instance.RoleInfo.RoleMe.GetMonthID() != 0);
            ////如果在战场的话 进行处理
            //RoleBase pRole = null;
            //if (PlayerRole.Instance.RoleInfo.RoleMe.GetSeat() == Seat)
            //    pRole = PlayerRole.Instance.RoleInfo.RoleMe;
            //else
            //{
            //    pRole = PlayerRole.Instance.TableManager.GetTableRole(Seat);
            //}
            //if (pRole == null)
            //    return;
            //添加金币
            //if (IsInMonth)
            //{
            //    pRole.SetMonthScore((UInt32)(pRole.GetMonthScore() + cd.GoldNum));

            //    tagMonthChangeEvent pEvent = new tagMonthChangeEvent(pRole.GetUserID());
            //    MsgEventHandle.HandleMsg(pEvent);
            //}
            //else
            //{
            //    pRole.SetGlobel((UInt32)(pRole.GetGlobel() + cd.GoldNum));

            //    if(pRole == PlayerRole.Instance.RoleInfo.RoleMe)
            //    {
            //        tagRoleChangeEvent pEvent = new tagRoleChangeEvent();
            //        MsgEventHandle.HandleMsg(pEvent);
            //    }
            //    else
            //    {
            //        tagTableChangeEvent pEvent = new tagTableChangeEvent(pRole.GetUserID());
            //        MsgEventHandle.HandleMsg(pEvent);
            //    }
            //}
        }
Пример #7
0
 public void HandleLaunchBullet(Byte Seat, byte bulletType, byte rateIndex)
 {
     //计算需要扣除的金币的数量
     Seat = SceneRuntime.ClientToServerSeat(Seat);//客户端转服务器端的位置
 }