Exemplo n.º 1
0
        protected override void Start()
        {
            base.Start();
            if (!(HighLogic.LoadedSceneIsFlight || HighLogic.LoadedScene == GameScenes.TRACKSTATION))
            {
                return;
            }
            Debug.Log($"[RACN UI] Start() in {HighLogic.LoadedScene}");
            configWindow        = gameObject.AddComponent <NetUIConfigurationWindow>();
            configWindow.parent = this;

            if (MapView.fetch is MapView map)
            {
                Texture2D defaultTex = GameDatabase.Instance.GetTexture(icon, false);
                foreach (RACommNetHome home in GameObject.FindObjectsOfType <RACommNetHome>())
                {
                    MapUI.GroundStationSiteNode gs = new MapUI.GroundStationSiteNode(home.Comm as RACommNode);
                    SiteNode  siteNode             = SiteNode.Spawn(gs);
                    Texture2D stationTexture       = (GameDatabase.Instance.GetTexture(home.icon, false) is Texture2D tex) ? tex : defaultTex;
                    siteNode.wayPoint.node.SetIcon(Sprite.Create(stationTexture, new Rect(0, 0, stationTexture.width, stationTexture.height), new Vector2(0.5f, 0.5f), 100f));
                    //                    MapView.fetch.siteNodes.Add(SiteNode.Spawn(gs));
                }

//                RAOrbitRenderer.ReplaceOrbitRenderers();
            }
            RATelemetryUpdate.Install();
        }
Exemplo n.º 2
0
        private void WindowGUI(int ID)
        {
            GUILayout.BeginVertical();
            RACommNetScenario scen = RACommNetScenario.Instance as RACommNetScenario;

            VesselCounts(out int vessels, out int groundStations, out int antennas, out string net);
            GUILayout.Label($"{RACommNetScenario.assembly.GetName().Name} v{RACommNetScenario.info.FileVersion}");
            GUILayout.Label($"{net}");

            GUILayout.BeginHorizontal();
            GUILayout.Label($"Vessels: {vessels}");
            GUILayout.Label($"GroundStations: {groundStations}");
            GUILayout.Label($"Antennas/vessel: {(float)antennas / vessels:F1}");
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Name", GUILayout.ExpandWidth(true));
            GUILayout.Label("Iterations", GUILayout.ExpandWidth(true));
            GUILayout.Label("Avg Time (ms)", GUILayout.ExpandWidth(true));
            GUILayout.Label("Runs/sec", GUILayout.ExpandWidth(true));
            GUILayout.EndHorizontal();
            foreach (KeyValuePair <string, MetricsElement> kvp in scen.metrics.data)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label($"{kvp.Key}", GUILayout.ExpandWidth(true));
                GUILayout.Label($"{kvp.Value.iterations}");
                GUILayout.Label($"{kvp.Value.hysteresisTime:F4}");
                GUILayout.Label($"{kvp.Value.iterations / Time.timeSinceLevelLoad:F1}");
                GUILayout.EndHorizontal();
            }

            GUILayout.EndVertical();
            if (MapView.fetch is MapView map && MapView.MapIsEnabled)
            {
                MapUI.NetUIConfigurationWindow win = scen.UI.configWindow;
                if (GUILayout.Button($"{(win.showUI ? "Hide" : "Show")} Config Window"))
                {
                    if (win.showUI)
                    {
                        win.HideWindow();
                    }
                    else
                    {
                        win.ShowWindow();
                    }
                }
            }

            if (antennaConsoleGO is null && GUILayout.Button("Launch Control Console"))
            {
                antennaConsoleGO = new GameObject();
                antennaConsoleGO.AddComponent(typeof(RemoteAntennaControlUI));
            }