internal void SetFaction() { //StarIcons = new Dictionary<Guid, IDrawData>(); int i = 0; double startangle = 0;//Math.PI * 0.5; float angleIncrease = (float)Math.Max(0.78539816339, 6.28318530718 / _state.StarSystemStates.Count); int startR = 200; int radInc = 5; foreach (var item in _state.StarSystemStates) { SystemMapRendering map = new SystemMapRendering(_window, _state); map.SetSystem(item.Value.StarSystem); RenderedMaps[item.Key] = map; //TODO: handle binary/multiple star systems better. var starEntity = item.Value.StarSystem.GetFirstEntityWithDataBlob <ECSLib.StarInfoDB>(); var orbitdb = starEntity.GetDataBlob <ECSLib.OrbitDB>(); starEntity = orbitdb.Root; //just incase it's a binary system and the entity we got was not the primary var starIcon = new StarIcon(starEntity); StarIcons[item.Key] = starIcon; var nameIcon = new NameIcon(item.Value.EntityStatesWithNames[starEntity.Guid], _state); _nameIcons[item.Key] = nameIcon; var x = (startR + radInc * i) * Math.Sin(startangle - angleIncrease * i); var y = (startR + radInc * i) * Math.Cos(startangle - angleIncrease * i); starIcon.WorldPosition = new ECSLib.Vector3(x, y, 0); nameIcon.WorldPosition = new ECSLib.Vector3(x, y, 0); map.GalacticMapPosition.X = x; map.GalacticMapPosition.Y = y; i++; } }
public void DrawNameIcons() { lock (_nameIcons) { List <NameIcon> nameIcons = new List <NameIcon>(); foreach (var item in _nameIcons.Values) { nameIcons.Add(item); //item.Draw(_uiState.rendererPtr, _uiState.Camera); } NameIcon.DrawAll(_state.rendererPtr, _state.Camera, nameIcons); } }
internal void DrawNameIcons() { var zoomlvl = _state.Camera.ZoomLevel; if (zoomlvl >= 2.0) { foreach (var kvp in RenderedMaps) { var sysid = kvp.Key; var sysmap = kvp.Value; if (sysid == _state.SelectedStarSysGuid) { sysmap.DrawNameIcons(); } } } else { lock (_nameIcons) { List <NameIcon> nameIcons = new List <NameIcon>(); foreach (var item in _nameIcons) { //if(_state.StarSystemStates[SelectedStarSysGuid].EntityStatesWithNames.ContainsKey(item.Key)){ if (item.Key == _state.SelectedStarSysGuid) { nameIcons.Add(item.Value); } //} //item.Value.Draw(_state.rendererPtr, _state.Camera); } NameIcon.DrawAll(_state.rendererPtr, _state.Camera, nameIcons); } } }