コード例 #1
0
        void OnUpdateRunning(int current_time_int)
        {
            current_time_int -= m_state_start_time;
            int delta_ms = current_time_int - m_last_update_time;

            if (delta_ms < 0)
            {
                return;
            }
            m_sync_client.Update(current_time_int);
            List <Command> commands = m_sync_client.GetOutputCommands();

            if (commands.Count > 0)
            {
                NetworkMessages_SyncCommands msg = new NetworkMessages_SyncCommands();
                msg.PlayerPstid = m_local_player_pstid;
                for (int i = 0; i < commands.Count; ++i)
                {
                    msg.AddCommand(commands[i]);
                }
                m_network.SendToServer(msg);
                m_sync_client.ClearOutputCommand();
            }
            m_render_world.OnUpdate(delta_ms, current_time_int);
            m_last_update_time = current_time_int;
        }
コード例 #2
0
        public void OnUpdate(int current_time_int)
        {
            if (m_state != TestCombatServerState.Running)
            {
                return;
            }
            int current_time = current_time_int - m_start_time;
            int delta_ms     = current_time - m_last_update_time;

            if (delta_ms < 0)
            {
                return;
            }
            m_sync_server.Update(current_time);
            List <Command> commands = m_sync_server.GetOutputCommands();

            if (commands.Count > 0)
            {
                NetworkMessages_SyncCommands msg = new NetworkMessages_SyncCommands();
                for (int i = 0; i < commands.Count; ++i)
                {
                    msg.AddCommand(commands[i]);
                }
                m_network.SendToClient(msg);
                m_sync_server.ClearOutputCommand();
            }
            m_last_update_time = current_time;
        }
コード例 #3
0
        public void OnNetworkMessage_SyncCommands(NetworkMessages_SyncCommands msg)
        {
            List <Command> commands = msg.m_commands;

            for (int i = 0; i < commands.Count; ++i)
            {
                m_combat_client.GetSyncClient().PushServerCommand(commands[i]);
            }
        }
コード例 #4
0
        void OnUpdateGameOver(int current_time_int)
        {
            m_sync_client.Stop();
            List <Command> commands = m_sync_client.GetOutputCommands();

            if (commands.Count > 0)
            {
                NetworkMessages_SyncCommands msg = new NetworkMessages_SyncCommands();
                msg.PlayerPstid = m_local_player_pstid;
                for (int i = 0; i < commands.Count; ++i)
                {
                    msg.AddCommand(commands[i]);
                }
                m_network.SendToServer(msg);
                m_sync_client.ClearOutputCommand();
            }
            m_state = TestCombatClientState.Ending;
            NetworkMessages_GameOver msg2 = new NetworkMessages_GameOver();

            msg2.PlayerPstid = m_local_player_pstid;
            msg2.m_crc       = m_logic_world.GetCRC();
            m_network.SendToServer(msg2);
        }