private void LateUpdate()
        {
            if (window == null)
            {
                return;
            }

            if (!SEP_Utilities.UIWindowReflectionLoaded)
            {
                return;
            }

            if (FlightGlobals.ActiveVessel == vessel)
            {
                return;
            }

            int l = Fields.Count;

            for (int i = 0; i < l; i++)
            {
                BaseField b = Fields[i];

                if (!b.guiActive)
                {
                    continue;
                }

                try
                {
                    window.GetType().InvokeMember("AddFieldControl", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.IgnoreReturn | BindingFlags.InvokeMethod, null, window, new object[] { b, part, this });
                }
                catch (Exception e)
                {
                    SEP_Utilities.log("Error in adding KSP Field to unfocused UI Part Action Window\n{0}", logLevels.error, e);
                    continue;
                }

                try
                {
                    var items = SEP_Utilities.UIActionListField(window).GetValue(window) as List <UIPartActionItem>;

                    int c = items.Count;

                    for (int j = 0; j < c; j++)
                    {
                        UIPartActionItem item = items[j];

                        if (item is UIPartActionLabel)
                        {
                            item.UpdateItem();
                        }
                    }
                }
                catch (Exception e)
                {
                    SEP_Utilities.log("Error in setting KSP Field on unfocused UI Part Action Window\n{0}", logLevels.error, e);
                }
            }
        }
        private void LateUpdate()
        {
            if (window == null)
            {
                return;
            }

            if (FlightGlobals.ActiveVessel == vessel)
            {
                return;
            }

            if (FlightDriver.Pause)
            {
                return;
            }

            if (!window.Pinned && !InputLockManager.IsAllLocked(ControlTypes.All))
            {
                int l = Fields.Count;

                for (int i = 0; i < l; i++)
                {
                    BaseField b = Fields[i];

                    if (!b.guiActive)
                    {
                        continue;
                    }

                    window.AddFieldControl(b, part, this);
                }
            }

            var items = window.ListItems;

            int c = items.Count;

            for (int j = 0; j < c; j++)
            {
                UIPartActionItem item = items[j];

                if (item is UIPartActionLabel)
                {
                    item.UpdateItem();
                }
            }
        }
        private void LateUpdate()
        {
            if (window == null)
            {
                return;
            }

            if (UIPartActionController.Instance == null)
            {
                return;
            }

            if (FlightGlobals.ActiveVessel == vessel)
            {
                return;
            }

            if (FlightDriver.Pause)
            {
                return;
            }

            int l = part.Resources.Count;

            for (int i = 0; i < l; i++)
            {
                PartResource r = part.Resources[i];

                window.AddResourceFlightControl(r);
            }

            var items = window.ListItems;

            int c = items.Count;

            for (int j = 0; j < c; j++)
            {
                UIPartActionItem item = items[j];

                if (item is UIPartActionResource)
                {
                    item.UpdateItem();
                }
            }

            window.PointerUpdate();
        }
Example #4
0
        private void LateUpdate()
        {
            if (window == null)
            {
                return;
            }

            if (UIPartActionController.Instance == null)
            {
                return;
            }

            if (!SEP_Utilities.UIWindowReflectionLoaded)
            {
                return;
            }

            if (FlightGlobals.ActiveVessel == vessel)
            {
                return;
            }

            bool update = false;

            int l = part.Resources.Count;

            for (int i = 0; i < l; i++)
            {
                PartResource r = part.Resources[i];

                try
                {
                    window.GetType().InvokeMember("AddResourceFlightControl", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.IgnoreReturn | BindingFlags.InvokeMethod, null, window, new object[] { r });
                    update = true;
                }
                catch (Exception e)
                {
                    SEP_Utilities.log("Error in adding EC Field to unfocused SEP UI Part Action Window\n{0}", logLevels.error, e);
                    continue;
                }

                try
                {
                    var items = SEP_Utilities.UIActionListField(window).GetValue(window) as List <UIPartActionItem>;

                    int c = items.Count;

                    for (int j = 0; j < c; j++)
                    {
                        UIPartActionItem item = items[j];

                        if (item is UIPartActionResource)
                        {
                            item.UpdateItem();
                        }
                    }
                }
                catch (Exception e)
                {
                    SEP_Utilities.log("Error in setting KSP Field on unfocused UI Part Action Window\n{0}", logLevels.error, e);
                }
            }

            if (update)
            {
                try
                {
                    window.GetType().InvokeMember("PointerUpdate", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.IgnoreReturn | BindingFlags.InvokeMethod, null, window, null);
                }
                catch (Exception e)
                {
                    SEP_Utilities.log("Error in updating unfocused UI Part Action Window position\n{0}", logLevels.error, e);
                }
            }
        }