예제 #1
0
        public void SetReferencePart(bool on)
        {
            bool editmode = false;

            foreach (ReferenceImage image in _referenceImages)
            {
                if (image.editModeOn)
                {
                    editmode = true; break;
                }
            }

            if (on && _referencePart == null)
            {
                _designer.AddPart(_fuselage, new Vector2());
                _referencePart      = (PartScript)_designer.CraftScript.Data.Assembly.Parts.Last().PartScript;
                _referencePart.name = "DesignerToolsRefPart";
                _designer.SelectPart(_referencePart, null, false);
            }
            else if (!on && _referencePart != null)
            {
                if (!editmode)
                {
                    _designer.SelectPart(_referencePart, null, false);
                    _designer.DeleteSelectedParts();
                    _referencePart = null;
                }
            }
            _designer.AllowPartSelection = !editmode;
        }
예제 #2
0
        /// <summary>
        /// Initialises this instance.
        /// </summary>
        private void EnsureInitialised()
        {
            if (!_inited)
            {
                // get flight program
                flightProgramScript = PartScript.GetModifier <FlightProgramScript>();
                if (flightProgramScript == null)
                {
                    Debug.LogError("Logger script has no flight program: deactivating");
                    enabled = false;
                    return;
                }

                server = new LoggerServer(Data.Hostname, Data.Port);

                _inited = true;
            }
        }
예제 #3
0
        public void OnLayoutRebuilt(IXmlLayoutController xmlLayoutController)
        {
            OrthoSize = DesignerCamera.orthographicSize;
            //_MouseDrag = new MouseDrag (_Designer.GizmoCamera);
            Mod.Instance.ViewToolsUI = this;

            _controller         = xmlLayoutController;
            _XmlLayout          = (XmlLayout)_controller.XmlLayout;
            _ZoomPanel          = _XmlLayout.GetElementById("ZoomPanel");
            _ImageSelector      = _XmlLayout.GetElementById("ImageSelector");
            _ViewToolsPin       = _XmlLayout.GetElementById("ViewToolsPin");
            _ImageConfirmButton = _XmlLayout.GetElementById("ImageConfirmButton");
            _XmlLayout.GetElementById("FolderPathText").SetAndApplyAttribute("text", "Folder location : " + _Path);

            if (DesignerCamera.orthographic == true)
            {
                XmlElement OrthoToggle = _XmlLayout.GetElementById("OrthoToggle");
                OrthoToggle.SetAndApplyAttribute("isOn", "true");
                _ZoomPanel.SetActive(true);
                OrthoViewActive = true;
            }

            UpdateReferenceImages(Mod.Instance._ReferenceImages);

            _DesignerParts = Game.Instance.CachedDesignerParts;
            foreach (DesignerPart part in _DesignerParts.Parts)
            {
                if (part.PartTypes.First().Id == "Fuselage1")
                {
                    _Fuselage = part;
                }
            }

            foreach (PartData part in _Designer.CraftScript.Data.Assembly.Parts)
            {
                PartScript _part = (PartScript)part.PartScript;
                if (_part.name == "DesignerToolsRefPart")
                {
                    _Designer.SelectPart(_part, null, false);
                    _Designer.DeleteSelectedParts();
                }
            }
        }
        /// <summary>
        /// Finds the color to be used for the smoke trails based off the Trim 1 paint color for the part.
        /// </summary>
        /// <returns>The color to be used for the smoke trails.</returns>
        private Color LookupColor()
        {
            try
            {
                var part           = PartScript.GetComponentInParent(this);
                var materialId     = part.Part.MaterialIds[1];
                var themeMaterials = part.Aircraft.Theme.Theme.Materials;
                foreach (var material in themeMaterials)
                {
                    if (material.Id == materialId)
                    {
                        return(material.Color);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.LogError("Unable to look up color for the smoke trail particles");
                Debug.LogException(ex);
            }

            return(Color.grey);
        }