Example #1
0
 //服务器初始化
 public void CreateMap()
 {
     //初始化地图
     GenerateItem.Generate(ReadConfig.instance.map1, ReadConfig.instance.itemCount1, ReadConfig.map1Width, ReadConfig.map1Hight, 1);
     GameMapManager.instance.CreateMap(ReadConfig.map1Width, ReadConfig.map1Hight, ReadConfig.instance.map1, ReadConfig.instance.itemMap1, ReadConfig.instance.groundMap1);
     ConsoleLog.instance.Info("初始化完毕");
 }
Example #2
0
        public void GameInit(object state)
        {
            SetNoLocationPlayers();

            if (Server.instance.whichGame == 2)
            {
                GenerateItem.Generate(ReadConfig.instance.map2, ReadConfig.instance.itemCount2, ReadConfig.map2Width, ReadConfig.map2Hight, 2);
                GameMapManager.instance.CreateMap(ReadConfig.map2Width, ReadConfig.map2Hight, ReadConfig.instance.map2, ReadConfig.instance.itemMap2, ReadConfig.instance.groundMap2);
            }
            else if (Server.instance.whichGame == 3)
            {
                GenerateItem.Generate(ReadConfig.instance.map3, ReadConfig.instance.itemCount3, ReadConfig.map3Width, ReadConfig.map3Hight, 3);
                GameMapManager.instance.CreateMap(ReadConfig.map3Width, ReadConfig.map3Hight, ReadConfig.instance.map3, ReadConfig.instance.itemMap3, ReadConfig.instance.groundMap3);
            }

            Server.instance.isGaming    = true;
            ServerUpdate.isSendLocation = true;
            SendStartAgain(Server.instance.whichGame);

            if (Server.instance.whichGame == 3)
            {
                chickenGameTimer = new Timer(new TimerCallback(Generate), null, ReadConfig.instance.chickenGameTime * 1000, Timeout.Infinite);
            }
            else if (Server.instance.whichGame == 2)
            {
                portalTimer = new Timer(new TimerCallback(GeneratePortal), null, ReadConfig.instance.portalGameTime * 1000, Timeout.Infinite);
            }
        }