示例#1
0
        public override void OnLoad(ConfigNode node)
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                return;
            }
            this.node = node;
            LoadChutes();
            if (node.HasNode("SIZE"))
            {
                sizes = new List <SizeNode>(node.GetNodes("SIZE").Select(n => new SizeNode(n)));
                sizeLib.AddSizes(this.part.name, sizes);
            }

            //Top node original location
            if (this.part.findAttachNode("top") != null)
            {
                top = this.part.findAttachNode("top").originalPosition.y;
            }

            //Bottom node original location
            if (this.part.findAttachNode("bottom") != null)
            {
                bottom = this.part.findAttachNode("bottom").originalPosition.y;
            }

            //Original part size
            if (debut == 0)
            {
                debut = this.part.transform.GetChild(0).localScale.y;
            }
        }
示例#2
0
        public override void OnLoad(ConfigNode node)
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                return;
            }
            this.node = node;
            LoadChutes();
            if (this.node.HasNode("SIZE"))
            {
                this.sizes = new List <SizeNode>(this.node.GetNodes("SIZE").Select(n => new SizeNode(n)));
                this.sizeLib.AddSizes(this.part.name, this.sizes);
            }

            //Top node original location
            AttachNode a;

            if (this.part.TryGetAttachNodeById("top", out a))
            {
                this.top = a.originalPosition.y;
            }

            //Bottom node original location
            if (this.part.TryGetAttachNodeById("bottom", out a))
            {
                this.bottom = a.originalPosition.y;
            }

            //Original part size
            if (this.debut == 0)
            {
                this.debut = this.part.transform.GetChild(0).localScale.y;
            }
        }
示例#3
0
        public override void OnLoad(ConfigNode node)
        {
            if (!CompatibilityChecker.IsAllCompatible() || !this.part.Modules.Contains("RealChuteModule") || ((IntPtr.Size == 8) && (Environment.OSVersion.Platform == PlatformID.Win32NT)))
            {
                return;
            }
            this.node = node;
            LoadChutes();
            if (node.HasNode("SIZE"))
            {
                sizes = new List <SizeNode>(node.GetNodes("SIZE").Select(n => new SizeNode(n)));
                sizeLib.AddSizes(this.part.name, sizes);
            }

            //Top node original location
            if (this.part.findAttachNode("top") != null)
            {
                top = this.part.findAttachNode("top").originalPosition.y;
            }

            //Bottom node original location
            if (this.part.findAttachNode("bottom") != null)
            {
                bottom = this.part.findAttachNode("bottom").originalPosition.y;
            }

            //Original part size
            if (debut == 0)
            {
                debut = this.part.transform.GetChild(0).localScale.y;
            }
        }
示例#4
0
        private void Update()
        {
            if (!CompatibilityChecker.IsAllCompatible() || !HighLogic.LoadedSceneIsFlight)
            {
                return;
            }

            //Makes the chute icon blink if failed
            if (this.failedTimer.isRunning)
            {
                double time = this.failedTimer.elapsed.TotalSeconds;
                if (time <= 2.5)
                {
                    if (!this.displayed)
                    {
                        ScreenMessages.PostScreenMessage("Parachute deployment failed.", 2.5f, ScreenMessageStyle.UPPER_CENTER);
                        if (this.part.ShieldedFromAirstream)
                        {
                            ScreenMessages.PostScreenMessage("Reason: parachute is in fairings", 2.5f, ScreenMessageStyle.UPPER_CENTER);
                        }
                        else if (groundStop)
                        {
                            ScreenMessages.PostScreenMessage("Reason: stopped on the ground.", 2.5f, ScreenMessageStyle.UPPER_CENTER);
                        }
                        else if (atmPressure == 0)
                        {
                            ScreenMessages.PostScreenMessage("Reason: in space.", 2.5f, ScreenMessageStyle.UPPER_CENTER);
                        }
                        else
                        {
                            ScreenMessages.PostScreenMessage("Reason: too high.", 2.5f, ScreenMessageStyle.UPPER_CENTER);
                        }
                        this.displayed = true;
                    }
                    if (time < 0.5 || (time >= 1 && time < 1.5) || time >= 2)
                    {
                        this.part.stackIcon.SetIconColor(XKCDColors.Red);
                    }
                    else
                    {
                        this.part.stackIcon.SetIconColor(XKCDColors.White);
                    }
                }
                else
                {
                    this.displayed = false;
                    this.part.stackIcon.SetIconColor(XKCDColors.White);
                    this.failedTimer.Reset();
                }
            }

            this.disarm.active = (this.armed || this.showDisarm);
            bool canDeploy = (!this.staged && this.parachutes.Exists(p => p.deploymentState != DeploymentStates.CUT));

            this.deploy.active             = canDeploy;
            this.arm.active                = (!this.settings.autoArm && canDeploy);
            this.repack.guiActiveUnfocused = this.canRepack;
            this.cut.active                = this.anyDeployed;
        }
示例#5
0
 public override string GetInfo()
 {
     if (!CompatibilityChecker.IsAllCompatible() || !this.isTweakable || !this.part.Modules.Contains("RealChuteModule"))
     {
         return(string.Empty);
     }
     return("This RealChute part can be tweaked from the Action Groups window.");
 }
示例#6
0
 private void OnGUI()
 {
     //Handles GUI rendering
     if (CompatibilityChecker.IsAllCompatible() && (HighLogic.LoadedSceneIsFlight || HighLogic.LoadedSceneIsEditor) && this.visible && !this.hid)
     {
         GUI.skin    = HighLogic.Skin;
         this.window = GUILayout.Window(this.id, this.window, Window, "RealChute Info Window " + RCUtils.AssemblyVersion);
     }
 }
示例#7
0
 public override void OnSave(ConfigNode node)
 {
     if (!CompatibilityChecker.IsAllCompatible())
     {
         return;
     }
     //Saves the templates to the persistence or craft file
     this.chutes.ForEach(c => node.AddNode(c.Save()));
 }
示例#8
0
 public override void OnSave(ConfigNode node)
 {
     if (!CompatibilityChecker.IsAllCompatible())
     {
         return;
     }
     //Saves the parachutes to the persistence
     this.parachutes.ForEach(p => node.AddNode(p.Save()));
 }
示例#9
0
 public override void OnActive()
 {
     if (!CompatibilityChecker.IsAllCompatible() || ((IntPtr.Size == 8) && (Environment.OSVersion.Platform == PlatformID.Win32NT)))
     {
         return;
     }
     //Activates the part
     ActivateRC();
 }
示例#10
0
 public override void OnSave(ConfigNode node)
 {
     if (!CompatibilityChecker.IsAllCompatible() || ((IntPtr.Size == 8) && (Environment.OSVersion.Platform == PlatformID.Win32NT)))
     {
         return;
     }
     //Saves the parachutes to the persistence
     parachutes.ForEach(p => node.AddNode(p.Save()));
 }
示例#11
0
 private void OnGUI()
 {
     //Rendering manager
     if (!CompatibilityChecker.IsAllCompatible())
     {
         return;
     }
     this.editorGUI.RenderGUI();
 }
示例#12
0
        private void OnGUI()
        {
            //Rendering manager
            if (!CompatibilityChecker.IsAllCompatible() || ((IntPtr.Size == 8) && (Environment.OSVersion.Platform == PlatformID.Win32NT)) || !this.isTweakable || !this.part.Modules.Contains("RealChuteModule"))
            {
                return;
            }

            editorGUI.RenderGUI();
        }
示例#13
0
 private void OnDestroy()
 {
     if (!CompatibilityChecker.IsAllCompatible() || (!HighLogic.LoadedSceneIsFlight && !HighLogic.LoadedSceneIsEditor) || ((IntPtr.Size == 8) && (Environment.OSVersion.Platform == PlatformID.Win32NT)))
     {
         return;
     }
     //Hide/show UI event removal
     GameEvents.onHideUI.Remove(HideUI);
     GameEvents.onShowUI.Remove(ShowUI);
 }
示例#14
0
 private void OnDestroy()
 {
     if (!CompatibilityChecker.IsAllCompatible() || (!HighLogic.LoadedSceneIsFlight && !HighLogic.LoadedSceneIsEditor))
     {
         return;
     }
     //Hide/show UI event removal
     GameEvents.onHideUI.Remove(HideUI);
     GameEvents.onShowUI.Remove(ShowUI);
 }
示例#15
0
        private void OnGUI()
        {
            if (!CompatibilityChecker.IsAllCompatible() || !this.showing)
            {
                return;
            }

            GUI.skin    = HighLogic.Skin;
            this.window = GUILayout.Window(this.id, this.window, Window, "RealChute Settings " + RCUtils.AssemblyVersion);
        }
示例#16
0
 private void Awake()
 {
     if (!CompatibilityChecker.IsAllCompatible() || instance != null)
     {
         Destroy(this); return;
     }
     instance = this;
     DontDestroyOnLoad(this);
     print("[RealChute]: Running RealChute " + RCUtils.assemblyVersion);
 }
示例#17
0
        private void OnGUI()
        {
            //Rendering manager
            if (!CompatibilityChecker.IsAllCompatible())
            {
                return;
            }

            GUI.skin = HighLogic.Skin;
            this.editorGUI.RenderGUI();
        }
示例#18
0
 private void OnGUI()
 {
     if (!CompatibilityChecker.IsAllCompatible() || ((IntPtr.Size == 8) && (Environment.OSVersion.Platform == PlatformID.Win32NT)))
     {
         return;
     }
     if (this.showing && this.visible)
     {
         this.window = GUILayout.Window(this.id, this.window, Window, "RealChute Settings " + RCUtils.assemblyVersion, skins.window);
     }
 }
示例#19
0
        private void Awake()
        {
            if (!CompatibilityChecker.IsAllCompatible() || ((IntPtr.Size == 8) && (Environment.OSVersion.Platform == PlatformID.Win32NT)) || instance != null)
            {
                Destroy(this); return;
            }
            instance = this;
            DontDestroyOnLoad(this);

            print("[RealChute]: Running RealChute " + RCUtils.assemblyVersion);
        }
示例#20
0
 private void OnGUI()
 {
     if (!CompatibilityChecker.IsAllCompatible())
     {
         return;
     }
     if (this.showing && this.visible)
     {
         this.window = GUILayout.Window(this.id, this.window, Window, "RealChute Settings " + RCUtils.assemblyVersion, this.skins.window);
     }
 }
示例#21
0
 public override string GetInfo()
 {
     if (!CompatibilityChecker.IsAllCompatible() || !this.isTweakable || ((IntPtr.Size == 8) && (Environment.OSVersion.Platform == PlatformID.Win32NT)))
     {
         return(string.Empty);
     }
     else if (this.part.Modules.Contains("RealChuteModule"))
     {
         return("This RealChute part can be tweaked from the Action Groups window.");
     }
     return(string.Empty);
 }
示例#22
0
        public override void OnLoad(ConfigNode node)
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                return;
            }
            //Gets the materials
            this.node = node;
            LoadParachutes();
            float chuteMass = parachutes.Sum(p => p.mat.areaDensity * p.deployedArea);

            this.part.mass = caseMass + chuteMass;
        }
示例#23
0
 private void Awake()
 {
     if (!CompatibilityChecker.IsAllCompatible())
     {
         //Removes RealChute parts from being seen if incompatible
         PartLoader.LoadedPartsList.Where(p => p.moduleInfos.Exists(m => m.moduleName == "RealChute"))
         .ForEach(p => p.category = PartCategories.none);
     }
     else
     {
         GameEvents.onGUIEditorToolbarReady.Add(AddFilter);
     }
 }
示例#24
0
        private void Update()
        {
            //Updating of size if possible
            if (!CompatibilityChecker.IsAllCompatible() || ((IntPtr.Size == 8) && (Environment.OSVersion.Platform == PlatformID.Win32NT)))
            {
                return;
            }
            if ((!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight))
            {
                return;
            }

            if (sizes.Count > 0 && this.part.transform.GetChild(0).localScale != Vector3.Scale(originalSize, sizes[size].size))
            {
                UpdateScale(this.part, rcModule);
            }

            //If unselected
            if (!HighLogic.LoadedSceneIsEditor || !EditorLogic.fetch || EditorLogic.fetch.editorScreen != EditorLogic.EditorScreen.Actions || !this.part.Modules.Contains("RealChuteModule"))
            {
                this.editorGUI.visible = false;
                return;
            }

            //Checks if the part is selected
            if (actionPanel.GetSelectedParts().Contains(this.part))
            {
                this.editorGUI.visible = true;
            }
            else
            {
                this.editorGUI.visible = false;
                chutes.ForEach(c => c.materialsVisible = false);
                this.editorGUI.failedVisible           = false;
                this.editorGUI.successfulVisible       = false;
            }
            //Checks if size must update
            if (sizes.Count > 0 && lastSize != size)
            {
                UpdateScale(this.part, rcModule);
            }
            //Checks if case texture must update
            if (this.textures.caseNames.Length > 0 && lastCaseID != caseID)
            {
                UpdateCaseTexture(this.part, rcModule);
            }
            chutes.ForEach(c => c.SwitchType());
        }
示例#25
0
 private void OnGUI()
 {
     //Handles GUI rendering
     if (!CompatibilityChecker.IsAllCompatible() || ((IntPtr.Size == 8) && (Environment.OSVersion.Platform == PlatformID.Win32NT)))
     {
         return;
     }
     if (HighLogic.LoadedSceneIsFlight || HighLogic.LoadedSceneIsEditor)
     {
         //Info window visibility
         if (this.visible && !this.hid)
         {
             this.window = GUILayout.Window(this.ID, this.window, Window, "RealChute Info Window " + RCUtils.assemblyVersion, skins.window);
         }
     }
 }
示例#26
0
        public override void OnLoad(ConfigNode node)
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                return;
            }
            this.node = node;
            LoadParachutes();
            float chuteMass = this.parachutes.Sum(p => p.chuteMass);

            this.part.mass = this.caseMass + chuteMass;
            if (HighLogic.LoadedScene == GameScenes.LOADING)
            {
                PersistentManager.instance.AddNode <RealChuteModule>(this.part.name, node);
            }
        }
示例#27
0
 private void OnGUI()
 {
     //Handles GUI rendering
     if (!CompatibilityChecker.IsAllCompatible())
     {
         return;
     }
     if (HighLogic.LoadedSceneIsFlight || HighLogic.LoadedSceneIsEditor)
     {
         //Info window visibility
         if (this.visible && !this.hid)
         {
             this.window = GUILayout.Window(this.ID, this.window, Window, "RealChute Info Window " + RCUtils.assemblyVersion, this.skins.window);
         }
     }
 }
示例#28
0
 public override void OnLoad(ConfigNode node)
 {
     if (!CompatibilityChecker.IsAllCompatible())
     {
         return;
     }
     this.node = node;
     LoadParachutes();
     if (HighLogic.LoadedScene == GameScenes.LOADING)
     {
         PersistentManager.Instance.AddNode <RealChuteModule>(this.part.name, node);
     }
     else
     {
         UpdateMass();
     }
 }
示例#29
0
        public override void OnLoad(ConfigNode node)
        {
            if (!CompatibilityChecker.IsAllCompatible() || ((IntPtr.Size == 8) && (Environment.OSVersion.Platform == PlatformID.Win32NT)))
            {
                return;
            }
            //Gets the materials
            this.node = node;
            LoadParachutes();
            float chuteMass = parachutes.Sum(p => p.mat.areaDensity * p.deployedArea);

            this.part.mass = caseMass + chuteMass;

            if (HighLogic.LoadedSceneIsFlight && staged || parachutes.All(p => p.deploymentState == DeploymentStates.CUT))
            {
                StartCoroutine(UpdateOnReload());
            }
        }
示例#30
0
        private void Update()
        {
            //Updating of size if possible
            if (!CompatibilityChecker.IsAllCompatible() || (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight))
            {
                return;
            }

            if (this.sizes.Count > 0 && this.part.transform.GetChild(0).localScale != Vector3.Scale(this.originalSize, this.sizes[this.size].size))
            {
                UpdateScale(this.part, this.rcModule);
            }

            //If unselected
            if (!HighLogic.LoadedSceneIsEditor || !EditorLogic.fetch || EditorLogic.fetch.editorScreen != EditorScreen.Actions)
            {
                this.editorGUI.visible = false;
                return;
            }

            //Checks if the part is selected
            if (this.actionPanel.GetSelectedParts().Contains(this.part))
            {
                this.editorGUI.visible = true;
            }
            else
            {
                this.editorGUI.visible = false;
                this.chutes.ForEach(c => c.templateGUI.materialsVisible = false);
                this.editorGUI.failedVisible     = false;
                this.editorGUI.successfulVisible = false;
            }
            //Checks if size must update
            if (this.sizes.Count > 0 && this.lastSize != this.size)
            {
                UpdateScale(this.part, this.rcModule);
            }
            //Checks if case texture must update
            if (this.textures.cases.Count > 0 && this.lastCaseID != this.caseID)
            {
                UpdateCaseTexture(this.part, this.rcModule);
            }
            this.chutes.ForEach(c => c.SwitchType());
        }