Exemplo n.º 1
0
 public static void InitRankList()
 {
     if (CacheSet.ArenaRankCache.FindAll().Count == 0)
     {
         PlayerLogic   player = new PlayerLogic();
         HeroTeamLogic ht     = new HeroTeamLogic();
         for (int i = 0; i < GameConsts.Arena.RobotCount; i++)
         {
             player.AddRobot();
             PlayerHeroLogic ph = new PlayerHeroLogic();
             ph.SetUser(player.MyPlayer.Id);
             ht.SetUser(player.MyPlayer.Id);
             var heros = new int[] { 1, 2, 5 };//GameUtils.RandomChoose(1, 4, GameConsts.Hero.MaxHeroTeamCount);
             foreach (int heroId in heros)
             {
                 ph.AddNewHero(heroId);
                 ph.MyHeros.Heros[heroId].HeroLv = player.MyPlayer.Level;
             }
             List <int> heroTeam = new List <int>();
             heroTeam.AddRange(heros);
             ht.AssignHero(heroTeam);
             AddNewPlayer(player.MyPlayer.Id);
             PlayerArena pa = new PlayerArena();
             pa.UserId  = player.MyPlayer.Id;
             pa.EnemyId = 0;
             CacheSet.PlayerArenaCache.Add(pa);
         }
     }
 }
Exemplo n.º 2
0
 public void SetUser(int userId)
 {
     m_UserId = userId;
     m_Arena  = CacheSet.PlayerArenaCache.FindKey(userId.ToString(), userId);
     if (m_Arena == null)
     {
         m_Arena                 = new PlayerArena();
         m_Arena.UserId          = userId;
         m_Arena.WinCount        = 0;
         m_Arena.ArenaTokenCount = 0;
         m_Arena.ChallengeCount  = GameConsts.Arena.DailyChallengeCount;
         for (int i = 0; i < GameConfigs.GetInt("Offline_Arena_Liveness_Reward_Count", 3); i++)
         {
             m_Arena.ClaimedLivenessRewardFlag.Add(false);
         }
         CacheSet.PlayerArenaCache.Add(m_Arena);
         ArenaRankLogic.AddNewPlayer(userId);
     }
 }