private void PaintBtn_Click(object sender, EventArgs e) { if (sectorSelected && parent.pop.curTerrain != null) { var curSector = parent.pop.curTerrain._sectorArray[selectedX][selectedY]; var curPlanet = parent.pop.curPlanet; PlanetObj.planet_type planetType = PlanetObj.planet_type.tUnknown; if (curPlanet != null) { planetType = curPlanet.planetType; } bool updated = true; switch (planetType) { case PlanetObj.planet_type.tRock: case PlanetObj.planet_type.tGasGiant: case PlanetObj.planet_type.tSubGasGiant: case PlanetObj.planet_type.tSubSubGasGiant: case PlanetObj.planet_type.tAsteroids: case PlanetObj.planet_type.tVenusian: updated = false; break; case PlanetObj.planet_type.tTerrestrial: case PlanetObj.planet_type.t1Face: if (curSector.surfaceType == SectorObj.SurfaceType.Rock) { curSector.surfaceType = SectorObj.SurfaceType.Grass; } else if (curSector.surfaceType == SectorObj.SurfaceType.Grass) { curSector.surfaceType = SectorObj.SurfaceType.Dirt; } else if (curSector.surfaceType == SectorObj.SurfaceType.Dirt) { curSector.surfaceType = SectorObj.SurfaceType.Ice; } else if (curSector.surfaceType == SectorObj.SurfaceType.Ice) { curSector.surfaceType = SectorObj.SurfaceType.Water; } else if (curSector.surfaceType == SectorObj.SurfaceType.Water) { curSector.surfaceType = SectorObj.SurfaceType.Rock; } updated = true; break; case PlanetObj.planet_type.tMartian: if (curSector.surfaceType == SectorObj.SurfaceType.Rock) { curSector.surfaceType = SectorObj.SurfaceType.Dirt; } else if (curSector.surfaceType == SectorObj.SurfaceType.Dirt) { curSector.surfaceType = SectorObj.SurfaceType.Ice; } else if (curSector.surfaceType == SectorObj.SurfaceType.Ice) { curSector.surfaceType = SectorObj.SurfaceType.Rock; } updated = true; break; case PlanetObj.planet_type.tWater: if (curSector.surfaceType == SectorObj.SurfaceType.Rock) { curSector.surfaceType = SectorObj.SurfaceType.Grass; } else if (curSector.surfaceType == SectorObj.SurfaceType.Grass) { curSector.surfaceType = SectorObj.SurfaceType.Dirt; } else if (curSector.surfaceType == SectorObj.SurfaceType.Dirt) { curSector.surfaceType = SectorObj.SurfaceType.Water; } else if (curSector.surfaceType == SectorObj.SurfaceType.Water) { curSector.surfaceType = SectorObj.SurfaceType.Ice; } break; case PlanetObj.planet_type.tIce: if (curSector.surfaceType == SectorObj.SurfaceType.Rock) { curSector.surfaceType = SectorObj.SurfaceType.Ice; } else if (curSector.surfaceType == SectorObj.SurfaceType.Ice) { curSector.surfaceType = SectorObj.SurfaceType.Rock; } break; case PlanetObj.planet_type.tUnknown: if (curSector.surfaceType == SectorObj.SurfaceType.Rock) { curSector.surfaceType = SectorObj.SurfaceType.Grass; } else if (curSector.surfaceType == SectorObj.SurfaceType.Grass) { curSector.surfaceType = SectorObj.SurfaceType.Dirt; } else if (curSector.surfaceType == SectorObj.SurfaceType.Dirt) { curSector.surfaceType = SectorObj.SurfaceType.Ice; } else if (curSector.surfaceType == SectorObj.SurfaceType.Ice) { curSector.surfaceType = SectorObj.SurfaceType.Water; } else if (curSector.surfaceType == SectorObj.SurfaceType.Water) { curSector.surfaceType = SectorObj.SurfaceType.Gas; } else if (curSector.surfaceType == SectorObj.SurfaceType.Gas) { curSector.surfaceType = SectorObj.SurfaceType.Unknown; } else if (curSector.surfaceType == SectorObj.SurfaceType.Unknown) { curSector.surfaceType = SectorObj.SurfaceType.Rock; } updated = true; break; } if (updated) { curSector.dirty = true; View sectorView = gridView.FindViewWithTag(curSector.Id); if (sectorView != null) { var imageView = sectorView.FindViewById <ImageView>(Resource.Id.backgroundImage); Koush.UrlImageViewHelper.SetUrlDrawable(imageView, curSector.DefaultUrl, Resource.Drawable.Icon); } isDirty = true; } } }