コード例 #1
0
    internal static void HandleInput(MySolarMapRenderer renderer, MyGuiInput input, bool receivedFocusInThisUpdate)
    {
        if (input.IsNewKeyPress(Keys.NumPad7))
        {
            center = renderer.GetTargetSector();
        }

        if (input.IsNewKeyPress(Keys.NumPad9))
        {
            point = renderer.GetTargetSector();
        }

        if (input.IsNewKeyPress(Keys.NumPad8))
        {
            System.Diagnostics.Debug.WriteLine(string.Format("MyFactions.AddFactionArea(MyMwcObjectBuilder_FactionEnum.China, new MyMwcVector3Int({0}), new MyMwcVector3Int({1}));", center, point));
            MyFactions.AddFactionArea(MyMwcObjectBuilder_FactionEnum.China, center, point);
        }

        if (input.IsNewKeyPress(Keys.NumPad4))
        {
            Debug.WriteLine(MyFactions.GetFactionBySector(renderer.GetTargetSector()));
        }
    }
コード例 #2
0
        public MyGuiScreenSolarSystemMap(MyGuiScreenBase parent, MyMwcSectorIdentifier currentSector)
            : base(new Vector2(0.5f, 0.5f), null, Vector2.One)
        {
            m_parent = parent;
            m_enableBackgroundFade = false;
            DrawMouseCursor = true;
            m_currentSector = currentSector;
            m_closeOnEsc = true;

            Static = this;

            MySolarSystemGenerator generator = new MySolarSystemGenerator(UNIVERSE_SEED);
            generator.Generate(1024);

            m_data = generator.SolarSystemData;
            m_solarMapRender = new MySolarMapRenderer();
            m_solarMapRender.PlayerSector = currentSector.Position;

            //MyMinerGame.SwitchPause();
            m_particlesEnabled = TransparentGeometry.Particles.MyParticlesManager.Enabled;
            TransparentGeometry.Particles.MyParticlesManager.Enabled = false;

            //AddCaption(MyTextsWrapperEnum.SolarSystemMap);

            MySolarSystemMapNavigationMark playerNavigationMark =
                new MySolarSystemMapNavigationMark(
                    currentSector.Position,
                    "",
                    null,
                    MyHudConstants.SOLAR_MAP_PLAYER_MARKER_COLOR,
                    MyTransparentMaterialEnum.SolarMapPlayer)
                    {
                        VerticalLineColor = MyHudConstants.SOLAR_MAP_PLAYER_MARKER_COLOR.ToVector4(),
                        DirectionalTexture = MyHudTexturesEnum.DirectionIndicator_green,
                        Offset = new Vector3(0, 0.0f, 0),
                        Text = MyClientServer.LoggedPlayer.GetDisplayName().ToString(),
                        Importance = 50
                    };
            m_data.NavigationMarks.Add(playerNavigationMark);

            if (MyGuiScreenGamePlay.Static.IsEditorStoryActive() || MyGuiScreenGamePlay.Static.GetPreviousGameType() == MyGuiScreenGamePlayType.EDITOR_STORY)
            {
                // Loads all marks, we want it for editor
                LoadMarks(false);
            }
            else
            {
                // Load only active marks
                MyMissions.AddSolarMapMarks(m_data);
            }

            if (MyMissions.ActiveMission != null)
            {
                MyMissions.ActiveMission.AddSolarMapMarks(m_data);
            }

            m_travelButton = new MyGuiControlButton(this, new Vector2(0.0f, 0.40f),
                new Vector2(650f / 1600f, 120f / 1200f),
                MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyGuiManager.GetTravelButtonTexture(),
                MyGuiManager.GetTravelButtonTexture(),
                MyGuiManager.GetTravelButtonTexture(),
                MyTextsWrapperEnum.Travel,
                MyGuiConstants.BACK_BUTTON_TEXT_COLOR,
                MyGuiConstants.BACK_BUTTON_TEXT_SCALE,
                MyGuiControlButtonTextAlignment.CENTERED,
                OnTravelClick,
                false,
                MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                true,
                false);
            m_travelButton.TextOffset = new Vector2(0, -0.0030f);
            m_travelButton.Visible = false;
            Controls.Add(m_travelButton);

            // target sector 0, 0, 0
            // distance is 1.7 sectors from camera
            Vector3 sector;

            var mostImportantMark = m_data.NavigationMarks.GetMostImportant();
            if (mostImportantMark != null) {
                sector = new Vector3(mostImportantMark.Sector.X, mostImportantMark.Sector.Y, mostImportantMark.Sector.Z);
            } else {
                sector = new Vector3(currentSector.Position.X, currentSector.Position.Y, currentSector.Position.Z);
            }

            sector.Y = 0;

            m_camera = new MySolarSystemMapCamera(sector * MySolarSystemMapCamera.SECTOR_SIZE_GAMEUNITS, 10000000.0f * MySolarSystemMapCamera.SECTOR_SIZE_GAMEUNITS);
            m_camera.MinDistanceToTarget = 1.7f * MySolarSystemMapCamera.SECTOR_SIZE_GAMEUNITS;
            m_camera.MaxDistanceToTarget = 1.2f * MySolarSystemUtils.MillionKmToSectors(MyBgrCubeConsts.NEPTUNE_POSITION.Length()) * MySolarSystemMapCamera.SECTOR_SIZE_GAMEUNITS;
            m_camera.MaxSector = MySolarSystemUtils.MillionKmToSectors(MyBgrCubeConsts.NEPTUNE_POSITION.Length());

            MyGuiManager.FullscreenHudEnabled = true;
        }