uint32_t WriteCreateAction(NetOutgoingMessage inOutputStream, int inNetworkId, uint32_t inDirtyState)
        {
            //need object
            NetGameObject gameObject = NetworkManagerServer.sInstance.GetGameObject(inNetworkId);

            //need 4 cc
            inOutputStream.Write(gameObject.GetClassId());
            return(gameObject.Write(inOutputStream, inDirtyState));
        }
        public int Write(NetOutgoingMessage inOutputStream, ReplicationManagerTransmissionData ioTransmissinData, int inRestartedNetworkId, byte inWorldId)
        {
            int  count = 0;
            bool skip  = (inRestartedNetworkId != 0);
            //run through each replication command and do something...
            List <int> removeObject = null;

            foreach (var pair in mNetworkIdToReplicationCommand)
            {
                ReplicationCommand replicationCommand = pair.Value;
                if (replicationCommand.HasDirtyState())
                {
                    // 이전에 중단 되었던 network ID 부터 재개
                    if (skip)
                    {
                        if (inRestartedNetworkId == pair.Key)
                        {
                            skip = false;
                        }
                        else
                        {
                            continue;
                        }
                    }

                    int networkId                = pair.Key;
                    ReplicationAction action     = replicationCommand.GetAction();
                    NetGameObject     gameObject = NetworkManagerServer.sInstance.GetGameObject(networkId, inWorldId);
                    if (gameObject == null && action != ReplicationAction.RA_Destroy)
                    {
                        if (removeObject == null)
                        {
                            removeObject = new List <int>();
                        }

                        removeObject.Add(networkId);
                        continue;
                    }

                    // 최대로 동기화 할수 있는 개수 초과시 중단
                    ++count;
                    if (count > max_replication_count)
                    {
                        return(pair.Key);
                    }



                    //well, first write the network id...
                    inOutputStream.Write((uint)networkId, NetGameObject.NetworkIdSize);
                    //Log.Information($"write networkId:{networkId}, classId:{gameObject?.GetClassId()}, action:{action}");

                    //only need 2 bits for action...
                    inOutputStream.Write(action);

                    uint32_t writtenState = 0;
                    uint32_t dirtyState   = replicationCommand.GetDirtyState();

                    //now do what?
                    switch (action)
                    {
                    case ReplicationAction.RA_Create:
                    {
                        inOutputStream.Write(gameObject.GetClassId());
                        writtenState = gameObject.Write(inOutputStream, dirtyState);
                    }
                    break;

                    case ReplicationAction.RA_Update:
                    {
                        writtenState = gameObject.Write(inOutputStream, dirtyState);
                    }
                    break;

                    case ReplicationAction.RA_Destroy:
                    {
                        //don't need anything other than state!
                        writtenState = dirtyState;
                    }
                    break;
                    }

                    ioTransmissinData.AddTransmission(networkId, action, writtenState, inWorldId);

                    //let's pretend everything was written- don't make this too hard
                    replicationCommand.ClearDirtyState(writtenState);
                }
            }

            if (removeObject != null)
            {
                foreach (var key in removeObject)
                {
                    mNetworkIdToReplicationCommand.Remove(key);
                }
            }
            return(0);
        }