Beispiel #1
0
    public void OnRoleCatchByLottery(Byte FishTypeID, CatchedData cd)
    {
        //if (PlayerRole.Instance.RoleInfo.RoleMe.GetLotteryFishSum() >= FishConfig.Instance.m_LotteryConfig.MaxLotteryFishSum)
        //    return;
        UInt16 rateIndex = 1;

        if (cd.CatchType == (Byte)CatchedType.CATCHED_BULLET || cd.CatchType == (Byte)CatchedType.CATCHED_LASER)
        {
            rateIndex = BulletSetting.BulletRate[SceneRuntime.PlayerMgr.MySelf.RateIndex];
        }
        else if (cd.CatchType == (Byte)CatchedType.CATCHED_SKILL)
        {
            rateIndex = SkillSetting.SkillDataList[cd.SubType].multiple;
        }
        UInt32 Score = FishConfig.Instance.m_LotteryConfig.GetFishLotteryScore(FishTypeID) * rateIndex;

        if (Score == 0)
        {
            return;
        }
        if (PlayerRole.Instance.RoleInfo.RoleMe.GetLotteryFishSum() < Byte.MaxValue)
        {
            PlayerRole.Instance.RoleInfo.RoleMe.SetLotteryFishSum(Convert.ToByte(PlayerRole.Instance.RoleInfo.RoleMe.GetLotteryFishSum() + 1));
        }
        PlayerRole.Instance.RoleInfo.RoleMe.SetLotteryScore(PlayerRole.Instance.RoleInfo.RoleMe.GetLotteryScore() + Score);

        tagLotteryScoreChangeEvent pEventLottery = new tagLotteryScoreChangeEvent();

        MsgEventHandle.HandleMsg(pEventLottery);
    }
Beispiel #2
0
    bool HandleGetLotteryReward(NetCmdBase obj)
    {
        LC_Cmd_GetLotteryReward ncb = (LC_Cmd_GetLotteryReward)obj;

        if (ncb.Result)
        {
            //玩家领取奖励成功了
            if (!FishConfig.Instance.m_LotteryConfig.LotteryMap.ContainsKey(ncb.LotteryID))
            {
                return(false);
            }
            //扣除玩家积分
            PlayerRole.Instance.RoleInfo.RoleMe.SetLotteryScore(0);
            PlayerRole.Instance.RoleInfo.RoleMe.SetLotteryFishSum(0);

            tagLotteryScoreChangeEvent pEventLottery = new tagLotteryScoreChangeEvent();
            MsgEventHandle.HandleMsg(pEventLottery);
            //提示
            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Lottery_Sucess);//系统错误
            MsgEventHandle.HandleMsg(pUOM);
            //告诉玩家 事件
            tagLotteryResultEvent pEvent = new tagLotteryResultEvent(ncb.LotteryID, ncb.Result, ncb.RewardID);
            MsgEventHandle.HandleMsg(pEvent);
            return(true);
        }
        else
        {
            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Lottery_Failed_3);//系统错误
            MsgEventHandle.HandleMsg(pUOM);

            tagLotteryResultEvent pEvent = new tagLotteryResultEvent(ncb.LotteryID, ncb.Result, ncb.RewardID);
            MsgEventHandle.HandleMsg(pEvent);
            return(true);
        }
    }