public void Deserialize(GenericReader reader) { state = PVPEventState.Setting; m_maker = reader.ReadMobile(); m_stone = (PVPStone)reader.ReadItem(); m_nom = reader.ReadString(); m_map = PVPMap.Deserialize(reader); m_teams = PVPTeamArrangement.Deserialize(reader, this); m_mode = PVPMode.Deserialize(reader, this); m_debutEvent = reader.ReadDateTime(); state = (PVPEventState)reader.ReadInt(); debutTimer = new WaitingTimer(this); if (state >= PVPEventState.Preparing) { // Event commencé : Despawn et effaçage. teams.DespawnAll(); StopEvent(); } else if (m_debutEvent < DateTime.Now) { // Event surpassé : Effaçage. StopEvent(); } else { // Event non débuté : Reboot. debutTimer.Start(); } }
public void Serialize(GenericWriter writer) { writer.Write(m_maker); writer.Write(m_stone); writer.Write(m_nom); PVPMap.Serialize(writer, m_map); // Important d'avoir la map avant le teamArrangement. PVPTeamArrangement.Serialize(writer, m_teams); PVPMode.Serialize(writer, m_mode); writer.Write(m_debutEvent); writer.Write((int)state); // Important de mettre le state à la fin. }
public static void Serialize(GenericWriter writer, PVPMap map) { if (map != null) { for (int i = 0; i < MapList.Count; i++) { if (MapList[i] == map) { writer.Write(i); break; } } } else { writer.Write(-1); } }
private PVPEvent(Mobile maker, PVPStone stone) { debutTimer = new WaitingTimer(this); state = PVPEventState.Setting; m_maker = maker; m_stone = stone; m_nom = ""; m_map = null; m_mode = null; m_teams = null; m_debutEvent = DateTime.Now; if (m_InstancesList == null) { m_InstancesList = new ArrayList(); } m_InstancesList.Add(this); }