Update() 개인적인 메소드

交给Command,这里不想关心发给谁。
private Update ( ) : void
리턴 void
예제 #1
0
    // Update is called once per frame
    void Update()
    {
        //Logger.i("update");
        Timer.Update();

        NetworkManager.Update();
    }
예제 #2
0
        private static void StartBackgroundThread()
        {
            new Thread(() =>
            {
                try
                {
                    double lastTick = 0d;
                    var worldTick   = new Stopwatch();

                    while (!Shutdown)
                    {
                        worldTick.Restart();

                        NetworkManager.Update(lastTick);

                        Thread.Sleep(1);
                        lastTick = (double)worldTick.ElapsedTicks / Stopwatch.Frequency;
                    }
                }
                catch (Exception exception)
                {
                    log.Error(exception);
                }
            }).Start();
        }
예제 #3
0
        public static void Initialise()
        {
            new Thread(() =>
            {
                var sw          = new Stopwatch();
                double lastTick = 0d;

                while (true)
                {
                    sw.Restart();

                    NetworkManager.Update(lastTick);
                    SocialManager.Update(lastTick);
                    MapManager.Update();

                    Thread.Sleep(1);
                    lastTick = (double)sw.ElapsedTicks / Stopwatch.Frequency;

                    #if DEBUG
                    Console.Title = $"{WorldServer.Title} (Update Time: {lastTick})";
                    #endif
                }
            })
            {
                IsBackground = true
            }.Start();
        }
예제 #4
0
        public override void Update(GameTime gameTime, ref States state, ref Character player)
        {
            networkManager.Update();

            if (userInterfaceManager.ReadyCheckRect.Contains(MouseKeyboardManager.MousePosition.ToPoint()) && MouseKeyboardManager.LeftClick)
            {
                userInterfaceManager.Ready = !userInterfaceManager.Ready;
                networkManager.SendReadyTag(userInterfaceManager.Ready);
            }
            bool start = true;

            for (int i = 0; i < networkManager.Players.Count; i++)
            {
                if (!networkManager.Players[i].Ready)
                {
                    start = false;
                    break;
                }
            }
            if (start)
            {
                state = States.FFA;
            }

            if (userInterfaceManager.CharacterChangeRect.Contains(MouseKeyboardManager.MousePosition.ToPoint()) && MouseKeyboardManager.LeftClick)
            {
                state = States.CharacterSelection;
                userInterfaceManager.Ready = false;
            }
        }
예제 #5
0
파일: Dunkel.cs 프로젝트: rfaa-se/dunkel
        private void UpdateFixed()
        {
            _networkManager.Update();
            _gameState.Update();

            Window.Title = $"Dunkel | TPS:{_ticksPerSecond} | FPS:{_frameRater.Fps} | TICK:{_world.CurrentTick}";
        }
예제 #6
0
        private static void Main()
        {
            string location = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);

            LogManager.Configuration = new XmlLoggingConfiguration(Path.Combine(location, "nlog.config"));

            Directory.SetCurrentDirectory(location);

            Console.Title = Title;
            log.Info("Initialising...");

            try
            {
                ConfigManager.Initialise(Path.Combine(Directory.GetCurrentDirectory(), "Config.json"));
                PacketManager.Initialise();
                DatabaseManager.Initialise();
                DungeonTileManager.Initialise();
                NetworkManager.Initialise();

                WorldManager.Initialise(lastTick =>
                {
                    NetworkManager.Update(lastTick);
                    FellowshipManager.Update(lastTick);
                    ChannelManager.Update(lastTick);
                });

                log.Info("Ready!");
            }
            catch (Exception exception)
            {
                log.Error(exception);
            }
        }
예제 #7
0
        private static void Main()
        {
            Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));

            Console.Title = Title;
            log.Info("Initialising...");

            ConfigurationManager <WorldServerConfiguration> .Initialise("WorldServer.json");

            DatabaseManager.Initialise(ConfigurationManager <WorldServerConfiguration> .Config.Database);

            GameTableManager.Initialise();
            MapManager.Initialise();
            SearchManager.Initialise();
            EntityManager.Initialise();
            EntityCommandManager.Initialise();
            GlobalMovementManager.Initialise();

            AssetManager.Initialise();
            GlobalSpellManager.Initialise();
            ServerManager.Initialise();

            ResidenceManager.Initialise();

            // make sure the assigned realm id in the configuration file exists in the database
            RealmId = ConfigurationManager <WorldServerConfiguration> .Config.RealmId;
            if (ServerManager.Servers.All(s => s.Model.Id != RealmId))
            {
                throw new ConfigurationException($"Realm id {RealmId} in configuration file doesn't exist in the database!");
            }

            MessageManager.Initialise();
            SocialManager.Initialise();
            CommandManager.Initialise();
            NetworkManager <WorldSession> .Initialise(ConfigurationManager <WorldServerConfiguration> .Config.Network);

            WorldManager.Initialise(lastTick =>
            {
                NetworkManager <WorldSession> .Update(lastTick);
                MapManager.Update(lastTick);
                ResidenceManager.Update(lastTick);
                BuybackManager.Update(lastTick);
            });

            using (WorldServerEmbeddedWebServer.Initialise())
            {
                log.Info("Ready!");

                while (true)
                {
                    Console.Write(">> ");
                    string line = Console.ReadLine();
                    if (!CommandManager.HandleCommand(new ConsoleCommandContext(), line, false))
                    {
                        Console.WriteLine("Invalid command");
                    }
                }
            }
        }
예제 #8
0
 public override void Update()
 {
     base.Update();
     NetworkManager?.Update();
     GameWorld.Update();
     _interfaceController.Update();
     _camera.Update(_myPlayer.GameArea.AreaWidth * GameWorld.TileSize, _myPlayer.GameArea.AreaHeight * GameWorld.TileSize);
 }
예제 #9
0
 public void Update(long dt)
 {
     NetworkManager.Update(dt);
     if (Program.currentKey == ConsoleKey.A)
     {
         NetworkManager.Send(NETWORK_NAME, ProtocolManager.PACKET_USER_QCMD_LOGIN("user", "password"));
     }
 }
예제 #10
0
    static int Update(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        NetworkManager obj  = (NetworkManager)LuaScriptMgr.GetNetObjectSelf(L, 1, "NetworkManager");
        float          arg0 = (float)LuaScriptMgr.GetNumber(L, 2);

        obj.Update(arg0);
        return(0);
    }
예제 #11
0
        private static void Main()
        {
            Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));

            Console.Title = Title;
            log.Info("Initialising...");

            ConfigurationManager <WorldServerConfiguration> .Initialise("WorldServer.json");

            DatabaseManager.Initialise(ConfigurationManager <WorldServerConfiguration> .Config.Database);

            GameTableManager.Initialise();

            EntityManager.Initialise();
            EntityCommandManager.Initialise();

            AssetManager.Initialise();
            ServerManager.Initialise();

            MessageManager.Initialise();
            CommandManager.Initialise();
            NetworkManager <WorldSession> .Initialise(ConfigurationManager <WorldServerConfiguration> .Config.Network);

            WorldManager.Initialise(lastTick =>
            {
                NetworkManager <WorldSession> .Update(lastTick);
                MapManager.Update(lastTick);
            });

            log.Info("Ready!");

            while (true)
            {
                Console.Write(">> ");
                string line = Console.ReadLine();
                CommandManager.ParseCommand(line, out string command, out string[] parameters);

                CommandHandlerDelegate handler = CommandManager.GetCommandHandler(command);
                if (handler != null)
                {
                    try
                    {
                        handler.Invoke(null, parameters);
                    }
                    catch (Exception exception)
                    {
                        log.Error(exception);
                    }
                }
                else
                {
                    Console.WriteLine("Invalid command!");
                }
            }
        }
예제 #12
0
    // Update is called once per frame
    void Update()
    {
        NetworkManager.Update();

        if (m_Handler != null)
        {
            if (m_Handler.IsReceived())
            {
                m_Handler.ReqStopMove(0);
            }
        }
    }
예제 #13
0
    public void Update()
    {
        UnityEngine.Profiling.Profiler.BeginSample("Update::Tick");
        if (TheRoom != null)
        {
            TheRoom.Tick();
        }
        UnityEngine.Profiling.Profiler.EndSample();

        UnityEngine.Profiling.Profiler.BeginSample("Update::Update");
        networkManager.Update();
        UnityEngine.Profiling.Profiler.EndSample();
    }
예제 #14
0
 static int Update(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         NetworkManager obj  = (NetworkManager)ToLua.CheckObject <NetworkManager>(L, 1);
         float          arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
         obj.Update(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #15
0
    static void Main()
    {
        DebugLoggerSubscriber.Initialize();

        var networkManager = new NetworkManager(Constants.APPLICATION_NAME);
        var world          = new World();

        while (_isRunning)
        {
            networkManager.Update();
            // playerManager.Update()?
            // creatureManager.Update();
            // world update??
        }
    }
예제 #16
0
        private static void Main()
        {
            Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));

            Console.Title = Title;
            log.Info("Initialising...");

            ConfigurationManager <WorldServerConfiguration> .Initialise("WorldServer.json");

            DatabaseManager.Initialise(ConfigurationManager <WorldServerConfiguration> .Config.Database);

            GameTableManager.Initialise();

            EntityManager.Initialise();
            EntityCommandManager.Initialise();

            AssetManager.Initialise();
            ServerManager.Initialise();

            MessageManager.Initialise();
            SocialManager.Initialise();
            CommandManager.Initialise();
            NetworkManager <WorldSession> .Initialise(ConfigurationManager <WorldServerConfiguration> .Config.Network);

            WorldManager.Initialise(lastTick =>
            {
                NetworkManager <WorldSession> .Update(lastTick);
                MapManager.Update(lastTick);
            });

            using (WorldServerEmbeddedWebServer.Initialise())
            {
                log.Info("Ready!");

                while (true)
                {
                    Console.Write(">> ");
                    string line = Console.ReadLine();
                    if (!CommandManager.HandleCommand(new ConsoleCommandContext(), line, false))
                    {
                        Console.WriteLine("Invalid command");
                    }
                }
            }
        }
예제 #17
0
        private static void Main()
        {
            Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));

            Console.Title = Title;
            log.Info("Initialising...");

            ConfigurationManager <StsServerConfiguration> .Initialise("StsServer.json");

            DatabaseManager.Initialise(ConfigurationManager <StsServerConfiguration> .Config.Database);
            MessageManager.Initialise();
            NetworkManager <StsSession> .Initialise(ConfigurationManager <StsServerConfiguration> .Config.Network);

            WorldManager.Initialise(lastTick =>
            {
                NetworkManager <StsSession> .Update(lastTick);
            });

            log.Info("Ready!");
        }
예제 #18
0
파일: NetworkTest.cs 프로젝트: niuniuzhu/RC
        public NetworkTest()
        {
            NetworkManager.AddPacketTypes();
            NetworkManager.CreateServer(SERVER_NAME, NetworkManager.PType.Tcp, 10);
            NetworkManager.AddServerEventHandler(SERVER_NAME, this.ProcessServerEvent);
            NetworkManager.StartServer(SERVER_NAME, 2551);

            NetworkManager.CreateClient(CLIENT_NAME, NetworkManager.PType.Tcp);
            NetworkManager.AddClientEventHandler(CLIENT_NAME, this.ProcessClientEvent);
            NetworkManager.Connect(CLIENT_NAME, "127.0.0.1", 2551);

            int i = 300;

            while (i > 0)
            {
                NetworkManager.Update(10);
                Thread.Sleep(10);
                --i;
            }
            NetworkManager.Dispose();
        }
예제 #19
0
        protected override void Update(GameTime gameTime)
        {
            netManager.Update();
            if (Keyboard.GetState().IsKeyDown(Keys.F11))
            {
                graphics.ToggleFullScreen();
            }



            if (nextScene != null)
            {
                currentScene = nextScene;
                nextScene    = null;
            }

            currentScene.Update(gameTime);
            currentScene.FixedUpdate(gameTime);

            base.Update(gameTime);
        }
예제 #20
0
        public override void Update(GameTime gameTime, ref States state, ref Character unused)
        {
            if (MouseKeyboardManager.Clicked(Keys.P))
            {
                if (state == States.Pause)
                {
                    state = States.FFA;
                }
                else
                {
                    state = States.Pause;
                }
            }
            if (playerManager.GameOverCheck())
            {
                if (networkManager.Players.FirstOrDefault(p => p.Username == networkManager.Username).Score >= 3)
                {
                    state          = States.Win;
                    Game1.LocalWin = true;
                }
                else
                {
                    state          = States.Win;
                    Game1.LocalWin = false;
                }
            }

            networkManager.Active = networkManager.Status == NetConnectionStatus.Connected;

            networkManager.Update();
            playerManager.UpdatePlayer();
            abilityManager.Update(player);
            userInterfaceManagerHealth.UpdateGameplayLoop();
            MouseKeyboardManager.Update();

            currentLevel.Update();
        }
예제 #21
0
 public void Update(long deltaTime)
 {
     NetworkManager.Update(deltaTime);
 }
예제 #22
0
 private void Update()
 {
     m_gameManager.UpdateGame();
     m_networkManager.Update();
 }
예제 #23
0
 // Update is called once per frame
 void Update()
 {
     NetworkManager.Update();
     NetworkAlert.Update();
     HeartBeat.Update(Time.deltaTime);
 }
        //////////////////////////////////////////////////////////////////////////////

        #region IUpdatable

        public override void Update(float delta)
        {
            base.Update(delta);
            networkManager.Update(delta);
        }
예제 #25
0
 void Update()
 {
     _network.Update();
 }
예제 #26
0
 private void Update()
 {
     _networkManager.Update();
 }
예제 #27
0
 void Update()
 {
     _network.Update(); // 네트워크만 예외로
 }
예제 #28
0
    static public void Main()
    {
        byte[] byteArr = new byte[] {
            0x32, 0xb9, 0x3a, 0xf1, // SECRET
            0x00, 0x00, 0x00, 0x96, // X
            0x00, 0x00, 0x00, 0xfa, // Y
            0x00, 0xc8,             // DX
            0x04, 0x03,             // DY
            0x64                    // HP
        };

        Console.Write("Packet: ");
        PrintArray(ref byteArr);

        Console.WriteLine("secret: {0}\nx: {1}\ny: {2}\ndx: {3}\ndy: {4}\nhp: {5}",
                          Packet.getInt32(ref byteArr, 0, 0 * 8),
                          Packet.getInt32(ref byteArr, 0, 4 * 8),
                          Packet.getInt32(ref byteArr, 0, 8 * 8),
                          Packet.getInt16(ref byteArr, 0, 12 * 8),
                          Packet.getInt16(ref byteArr, 0, 14 * 8),
                          Packet.getByte(ref byteArr, 0, 16 * 8));


        /** Here starts a normal "receive"-packet parseing
         */
        byte[] pR = new byte[] {
            0x70,                   // COMMAND
            0x00, 0x01,             // ID
            0x00, 0x00, 0x00, 0x78, // X
            0x00, 0x00, 0x00, 0xc8, // Y
            0x00, 0x00,             // DX
            0x00, 0x00,             // DY
            0x64,                   // HP

            0x70,                   // COMMAND
            0x00, 0x00,             // ID
            0x00, 0x00, 0x00, 0x96, // X
            0x00, 0x00, 0x00, 0xfa, // Y
            0x00, 0xc8,             // DX
            0x04, 0x03,             // DY
            0x64                    // HP
        };

        for (int offset = 0; offset < pR.Length;)
        {
            switch (pR[offset++])
            {
            case 0x70:
                Console.WriteLine("Player: {0}x{1} -> {2}x{3} with {4}% hp",
                                  Packet.PlayerResponse.getX(ref pR, offset),
                                  Packet.PlayerResponse.getY(ref pR, offset),
                                  Packet.PlayerResponse.getDX(ref pR, offset),
                                  Packet.PlayerResponse.getDY(ref pR, offset),
                                  Packet.PlayerResponse.getHP(ref pR, offset)
                                  );
                offset += Packet.PlayerResponse.nextOffset(ref pR, offset);
                break;

            default:
                Console.WriteLine("Unknown command found({0})", (char)pR[offset]);
                return;
            }
        }

        byte[] br = new byte[]
        {
            0xAB, 0xF3, 0x3F, 0x40, 0xC0  // 1010 1011 - 1111 11111 - 1111 1111 - 0100 0000
        };
        byte[] brO = new byte[] {
            0xFF, 0xFF, 0xFF, 0xFF, 0xFF
        };
        Console.WriteLine("brO = " + string.Join(" ", brO.Select(x => Convert.ToString(x, 2).PadLeft(8, '0')).ToArray()));
        Packet.setInt32(ref brO, 0, 2, unchecked ((Int32)0xAFCCFD03));
        Console.WriteLine("br  = " + string.Join(" ", br.Select(x => Convert.ToString(x, 2).PadLeft(8, '0')).ToArray()));
        Console.WriteLine("brO = " + string.Join(" ", brO.Select(x => Convert.ToString(x, 2).PadLeft(8, '0')).ToArray()));
        Console.WriteLine("2 % 8 = " + 2 % 8);
        Console.WriteLine("Read= " + Convert.ToString(Packet.getInt32(ref brO, 0, 2), 2));

        Packet.setInt32(ref brO, 0, 2, unchecked ((Int32)0x00001120));
        /* Console.WriteLine("br  = " + string.Join(" ", br.Select( x => Convert.ToString( x, 2 ).PadLeft( 8, '0' ) ).ToArray())); */
        Console.WriteLine("brO = " + string.Join("", brO.Select(x => Convert.ToString(x, 2).PadLeft(8, '0')).ToArray()));
        Console.WriteLine("Read= --" + Convert.ToString(
                              Packet.getInt32(ref brO, 0, 2),
                              2).PadLeft(32, '0'));

        if (Packet.getInt32(ref brO, 0, 2) != 0x00001120)
        {
            Console.WriteLine("Ints do not match");
        }

        /* if (true) return; */

        for (int i = 0; i <= 18; i++)
        {
            checkByte(i);
        }

        for (int i = 0; i <= 15; i++)
        {
            checkInt16(i);
        }

        checkInt32(7);

        if (true)
        {
            return;
        }
        Console.WriteLine("----- Running Johnnys NetworkManager.cs -----");
        NetworkManager nm = new NetworkManager();

        nm.playerPrefab  = new UnityEngine.GameObject();
        nm.playerManager = new UnityEngine.GameObject();
        nm.Connect("127.0.0.1", 9999);
        nm.login();
        while (true)
        {
            nm.Update();
        }
    }
예제 #29
0
 void Update()
 {
     NetworkManager.Update();
 }
예제 #30
0
 private void Update()
 {
     m_EventManager.Update();
     m_NetworkManager.Update();
 }
예제 #31
0
 private static void RunServer(NetworkManager network)
 {
     network.Start();
     while (shutdown == false)
         network.Update();
     network.Shutdown("Bye! (Server Shutdown)");
     Console.WriteLine("Server shut down successfully.");
 }