Exemplo n.º 1
0
        public void SetComponentSynchInfo(Type type, StateUpdateObject[] data)
        {
            ComponentSynchronizationDataObject componentSynchObject = null;
            int index = 0;

            while (index < ComponentSyncInfo.Count && componentSynchObject == null)
            {
                if (ComponentSyncInfo[index].ComponentType == type)
                {
                    componentSynchObject = ComponentSyncInfo[index];
                }
                index++;
            }

            if (componentSynchObject != null) // Un ComponentSyncInfoDataObject a été trouvé !
            {
                // Ajout de tous les éléments du tableau de StateUpdateObject data à la
                // liste des StateUpdateObject de ce ComponentSyncInfoDataObject.
                foreach (StateUpdateObject dataObject in data)
                {
                    componentSynchObject.SetSynchInfo(dataObject.Type, dataObject.Information);
                }
            }
            else // Pas de ComponentSyncInfoDataObject trouvés ! On en crée un nouveau.
            {
                List <StateUpdateObject> dataList = new List <StateUpdateObject>();
                foreach (StateUpdateObject obj in data)
                {
                    dataList.Add(obj);
                }
                ComponentSynchronizationDataObject newSynchObject = new ComponentSynchronizationDataObject(type, dataList);
                ComponentSyncInfo.Add(newSynchObject);
            }
        }
Exemplo n.º 2
0
 public ComponentSynchronizationDataObject[] GetComponentSynchData()
 {
     return(ComponentSyncInfo.ToArray());
 }