private void UpdateTile(Tile t, int worldId, int ActiveX, int ActiveY, int TileID) { switch (t.TypeObjet) { case TypeTile.Item: m_GestionItem.RetournerItems(); HugoLand.Item item = m_GestionItem.LstItems.FirstOrDefault(x => x.MondeId == worldId && x.x == ActiveX && x.y == ActiveY); if (item != null) { m_GestionItem.ModificationItem(t.Name, TileID, item.Id); } else { item = new HugoLand.Item() { Nom = t.Name, MondeId = worldId, x = ActiveX, y = ActiveY, ImageId = TileID, Description = t.Category + " " + t.Color }; m_GestionItem.CreerItemMonde(item); } break; case TypeTile.Monstre: m_GestionMonstre.RetournerMonstres(); int statPv = 0, statLevel = 0; float statAttkMax = 0f, statAttkMin = 0f; int.TryParse(txtLevel.Text, out statLevel); int.TryParse(txtPv.Text, out statPv); float.TryParse(txtAttkMax.Text, out statAttkMax); float.TryParse(txtAttkMin.Text, out statAttkMin); HugoLand.Monstre monstre = m_GestionMonstre.LstMonstres.FirstOrDefault(x => x.MondeId == worldId && x.x == ActiveX && x.y == ActiveY); if (monstre != null) { m_GestionMonstre.ModificationMonstre(t.Name, TileID, monstre.Id, statPv, statAttkMax, statAttkMin, statLevel); } else { monstre = new HugoLand.Monstre() { Nom = t.Name, MondeId = worldId, x = ActiveX, y = ActiveY, ImageId = TileID, }; m_GestionMonstre.CréerMonstre(monstre, statPv, statAttkMax, statAttkMin, statLevel); } break; case TypeTile.ObjetMonde: m_GestionObjetMonde.RetournerObjetMonde(); HugoLand.ObjetMonde objMonde = m_GestionObjetMonde.LstObjetMondes.FirstOrDefault(x => x.MondeId == worldId && x.x == ActiveX && x.y == ActiveY); if (objMonde != null) { m_GestionObjetMonde.ModificationObjetMonde(t.Name, TileID, objMonde.Id); } else { objMonde = new HugoLand.ObjetMonde() { Description = t.Name, MondeId = worldId, x = ActiveX, y = ActiveY, TypeObjet = TileID }; m_GestionObjetMonde.CreerObjetMonde(objMonde); } break; } }