Exemplo n.º 1
0
 public void StartLoading()
 {
     if (base.GameState == eGameState.Prepared)
     {
         this.m_gameState = eGameState.Loading;
         base.ClearWaitTimer();
         if (this.m_npcID != 0 && base.RoomType == eRoomType.Match)
         {
             NpcInfo npc = NPCInfoMgr.GetNpcInfoById(this.m_npcID);
             base.AddLoadingFile(2, npc.ResourcesPath, npc.ModelID);
         }
         base.SendStartLoading(60);
         base.AddAction(new WaitPlayerLoadingAction(this, 65000));
     }
 }
Exemplo n.º 2
0
 public static bool ReLoad()
 {
     try
     {
         Dictionary <int, NpcInfo> dictionary = NPCInfoMgr.LoadFromDatabase();
         if (dictionary != null && dictionary.Count > 0)
         {
             Interlocked.Exchange <Dictionary <int, NpcInfo> >(ref NPCInfoMgr.m_npcs, dictionary);
         }
         return(true);
     }
     catch (Exception exception)
     {
         NPCInfoMgr.log.Error("NPCInfoMgr", exception);
     }
     return(false);
 }
Exemplo n.º 3
0
 public void StartGame()
 {
     if (base.GameState == eGameState.Loading)
     {
         this.m_gameState = eGameState.Playing;
         base.ClearWaitTimer();
         base.SendSyncLifeTime();
         List <Player> list   = base.GetAllFightPlayers();
         MapPoint      mapPos = MapMgr.GetMapRandomPos(this.m_map.Info.ID);
         GSPacketIn    pkg    = new GSPacketIn(91);
         pkg.WriteByte(99);
         pkg.WriteInt(list.Count);
         foreach (Player p in list)
         {
             p.Reset();
             Point pos = base.GetPlayerPoint(mapPos, p.Team);
             p.SetXY(pos);
             this.AddPlayer(p);
             p.StartFalling(true);
             p.StartGame();
             pkg.WriteInt(p.Id);
             pkg.WriteInt(p.X);
             pkg.WriteInt(p.Y);
             pkg.WriteInt(p.Direction);
             pkg.WriteInt(p.Blood);
         }
         base.SendToAll(pkg);
         if (this.m_npcID != 0 && base.RoomType == eRoomType.Match)
         {
             SimpleNpc npc    = new SimpleNpc(this.physicalId++, this, NPCInfoMgr.GetNpcInfoById(this.m_npcID), 1, -1, 0);
             Point     npcPos = base.GetPlayerPoint(mapPos, 3);
             npc.Reset();
             npc.SetXY(npcPos);
             this.AddLiving(npc);
             npc.StartFalling(false);
             npc.IsNoHole = true;
         }
         base.WaitTime(list.Count * 1000);
         base.OnGameStarted();
     }
 }
Exemplo n.º 4
0
        public static bool ReLoad()
        {
            bool result;

            try
            {
                Dictionary <int, NpcInfo> tempNpc = NPCInfoMgr.LoadFromDatabase();
                if (tempNpc != null && tempNpc.Count > 0)
                {
                    Interlocked.Exchange <Dictionary <int, NpcInfo> >(ref NPCInfoMgr.m_npcs, tempNpc);
                }
                result = true;
                return(result);
            }
            catch (Exception e)
            {
                NPCInfoMgr.log.Error("NPCInfoMgr", e);
            }
            result = false;
            return(result);
        }
Exemplo n.º 5
0
 public static bool Init()
 {
     return(NPCInfoMgr.ReLoad());
 }