コード例 #1
0
ファイル: Action2400.cs プロジェクト: JoeChen999/scut
        public override bool TakeAction()
        {
            PlayerCosmosCrackLogic pcc = new PlayerCosmosCrackLogic().SetUser(m_UserId);
            var playerCosmosCrack      = pcc.GetCosmosCrackInstanceInfo();

            m_ResponsePacket.UsedRoundCount = playerCosmosCrack.PassedRoundCount;
            foreach (var instance in playerCosmosCrack.ChosenInstance)
            {
                PBCosmosCrackInstanceInfo instanceInfo = new PBCosmosCrackInstanceInfo()
                {
                    InstanceType = instance.Key,
                    RewardLevel  = instance.Value.RewardLevel
                };
                foreach (var item in instance.Value.RewardItem)
                {
                    instanceInfo.Rewards.Add(new PBItemInfo()
                    {
                        Type  = item.Key,
                        Count = item.Value
                    });
                }
                m_ResponsePacket.InstanceInfos.Add(instanceInfo);
            }
            return(true);
        }
コード例 #2
0
        public override bool TakeAction()
        {
            var         allActivities = CacheSet.ActivityTable.GetAllData();
            PlayerLogic p             = new PlayerLogic();

            p.SetUser(m_UserId);
            foreach (var activity in allActivities)
            {
                PBActivityInfo activityInfo = new PBActivityInfo();
                activityInfo.Id     = activity.Id;
                activityInfo.Status = LobbyServerUtils.GetActivityStatus(activity, p.MyPlayer.Level);
                if (activityInfo.Status == (int)ActivityStatusType.Hidden)
                {
                    continue;
                }
                switch ((ActivityType)activity.Id)
                {
                case ActivityType.TurnOverChess:
                    PlayerChessLogic pc = new PlayerChessLogic();
                    pc.SetUser(m_UserId);
                    activityInfo.Progress   = pc.MyChess.Count == 0 ? 0 : 1;
                    activityInfo.CountLimit = 1;
                    break;

                case ActivityType.OfflineArena:
                    PlayerArenaLogic pa = new PlayerArenaLogic();
                    pa.SetUser(m_UserId);
                    activityInfo.Progress   = pa.MyArena.ChallengeCount;
                    activityInfo.CountLimit = GameConsts.Arena.DailyChallengeCount;
                    break;

                case ActivityType.GearFoundry:
                    PlayerFoundryLogic pf = new PlayerFoundryLogic();
                    pf.SetUser(m_UserId);
                    activityInfo.Progress   = pf.GetProgress();
                    activityInfo.CountLimit = 1;
                    break;

                case ActivityType.CosmosCrack:
                    PlayerCosmosCrackLogic pcc = new PlayerCosmosCrackLogic();
                    pcc.SetUser(m_UserId);
                    var cosmosInfo = pcc.GetCosmosCrackInstanceInfo();
                    activityInfo.Progress   = cosmosInfo == null ? 0 : cosmosInfo.PassedRoundCount;
                    activityInfo.CountLimit = cosmosInfo == null ? 0 : GameConfigs.GetInt("Cosmos_Crack_Round_Limit", 10);
                    break;

                default:
                    ErrorCode = (int)ErrorType.CannotOpenChance;
                    ErrorInfo = "invalid activity type";
                    return(false);
                }
                m_ResponsePacket.ActivityInfo.Add(activityInfo);
            }
            return(true);
        }
コード例 #3
0
ファイル: Action2402.cs プロジェクト: JoeChen999/scut
        public override bool TakeAction()
        {
            PlayerInstanceLogic pi = new PlayerInstanceLogic();

            pi.SetUser(m_UserId);
            pi.LeaveInstance();
            if (!m_RequestPacket.Win)
            {
                m_ResponsePacket.Win          = false;
                m_ResponsePacket.InstanceType = m_RequestPacket.InstanceType;
                return(true);
            }
            PlayerCosmosCrackLogic pcc = new PlayerCosmosCrackLogic().SetUser(m_UserId);

            m_ResponsePacket.RewardLevel = pcc.GetCosmosCrackInstanceInfo().ChosenInstance[m_RequestPacket.InstanceType].RewardLevel;
            var rewards           = pcc.LeaveInstance(m_RequestPacket.InstanceType);
            PlayerPackageLogic pp = new PlayerPackageLogic();

            pp.SetUser(m_UserId);
            PBReceivedItems receivedItems;

            pp.GetItems(rewards, ReceiveItemMethodType.None, out receivedItems);
            m_ResponsePacket.ReceivedItems = receivedItems;
            m_ResponsePacket.Win           = true;
            m_ResponsePacket.InstanceType  = m_RequestPacket.InstanceType;
            PlayerLogic p = new PlayerLogic();

            p.SetUser(m_UserId);
            m_ResponsePacket.PlayerInfo = new PBPlayerInfo()
            {
                Id                = m_UserId,
                Coin              = p.MyPlayer.Coin,
                Money             = p.MyPlayer.Money,
                Energy            = p.MyPlayer.Energy,
                Spirit            = p.MyPlayer.Spirit,
                MeridianEnergy    = p.MyPlayer.StarEnergy,
                DragonStripeToken = p.MyPlayer.DragonStripeToken
            };
            return(true);
        }