Пример #1
0
        private static void Reset()
        {
            if (!isInitialized)
            {
                return;
            }

            isInitialized = false;

            Menu.CloseAll();

            ClientComponentObjectPlacementHelper.DestroyInstanceIfExist();

            if (HUDLayoutControl.Instance is not null)
            {
                Api.Client.UI.LayoutRootChildren.Remove(HUDLayoutControl.Instance);
            }

            if (ChatPanel.Instance is not null)
            {
                Api.Client.UI.LayoutRootChildren.Remove(ChatPanel.Instance);
            }

            ResetCallback?.Invoke();

            ClientContainersExchangeManager.Reset();

            ClientCurrentCharacterContainersHelper.Reset();

            sceneObjectInputComponents?.Destroy();
            sceneObjectInputComponents = null;

            gameplayInputContext?.Stop();
            gameplayInputContext = null;
        }
Пример #2
0
        /// <summary>
        /// Construct a view for the given model.
        /// </summary>
        /// <param name="m">Model object for which to make a view</param>
        /// <param name="reset">Function to call when the view needs to be re-initiated</param>
        /// <param name="close">Function to call when the user clicks a close button</param>
        public AstrogationView(AstrogationModel m, ResetCallback reset, UnityAction close)
            : base(
                FlightGlobals.ActiveVessel != null ? mainWindowMinWidthWithVessel : mainWindowMinWidthWithoutVessel,
                mainWindowMinHeight,
                mainWindowSpacing,
                mainWindowPadding,
                TextAnchor.UpperCenter
                )
        {
            model         = m;
            resetCallback = reset;
            closeCallback = close;

            int width = FlightGlobals.ActiveVessel != null ? RowWidthWithVessel : RowWidthWithoutVessel;

            if (Settings.Instance.ShowSettings)
            {
                AddChild(new SettingsView(resetCallback, width));
            }
            else if (!ErrorCondition)
            {
                createHeaders();
                createRows();
                AddChild(new DialogGUIHorizontalLayout(
                             width, 10,
                             0, wrenchPadding,
                             TextAnchor.UpperRight,
                             new DialogGUILabel(getMessage, notificationStyle, true, true)
                             ));
            }
        }
Пример #3
0
        /// <summary>
        /// Construct a view for the given model.
        /// </summary>
        /// <param name="m">Model object for which to make a view</param>
        /// <param name="reset">Function to call when the view needs to be re-initiated</param>
        public AstrogationView(AstrogationModel m, ResetCallback reset)
            : base(
                mainWindowMinWidth,
                mainWindowMinHeight,
                mainWindowSpacing,
                mainWindowPadding,
                TextAnchor.UpperCenter
                )
        {
            model         = m;
            resetCallback = reset;

            if (!ErrorCondition)
            {
                createHeaders();
                createRows();
            }
            AddChild(new DialogGUIHorizontalLayout(
                         RowWidth, 10,
                         0, wrenchPadding,
                         TextAnchor.UpperRight,
                         new DialogGUILabel(getMessage, notificationStyle, true, true),
                         iconButton(settingsIcon, settingsStyle, "Settings", toggleSettingsVisible)
                         ));
            if (Settings.Instance.ShowSettings)
            {
                AddChild(new SettingsView(resetCallback));
            }
        }
Пример #4
0
 /// <summary>
 /// Constructs a <see cref="SubtitleRenderer"/> instance.
 /// </summary>
 public SubtitleRenderer(Action onTextureInvalidated)
 {
     _onTextureInvalidated = onTextureInvalidated;
     _subtitles            = new LinkedList <Subtitle>();
     //instance.textCallBack = new TextSubtitleCallback(instance.OnTextSubtitle);
     _resetCallBack         = Reset;
     _updateTimeoutCallBack = UpdateTimeout;
     _device = SkinContext.Device;
 }
Пример #5
0
    public void Initialize(int maxAD, int remainAD, int maxPoint, int remainPoint, int cost, ResetCallback callback)
    {
        this.cost     = cost;
        this.callback = callback;

        text_ADCount.text    = $"{remainAD}/{maxAD}";
        text_PointCount.text = $"{remainPoint}/{maxPoint}";
        text_PointPrice.text = cost.ToString();

        btn_AD.interactable    = remainAD > 0;
        btn_Point.interactable = remainPoint > 0;

        gameObject.SetActive(true);
    }
Пример #6
0
        /// <summary>
        /// Constructs a <see cref="SubtitleRenderer"/> instance.
        /// </summary>
        public SubtitleRenderer(Action onTextureInvalidated)
        {
            string absolutePlatformDir;

            if (!NativeMethods.SetPlatformSearchDirectories(out absolutePlatformDir))
            {
                throw new Exception("Error adding dll probe path");
            }

            _onTextureInvalidated = onTextureInvalidated;
            _subtitles            = new LinkedList <Subtitle>();
            //instance.textCallBack = new TextSubtitleCallback(instance.OnTextSubtitle);
            _resetCallBack         = Reset;
            _updateTimeoutCallBack = UpdateTimeout;
            _device = SkinContext.Device;
            _sprite = new Sprite(_device);
        }
Пример #7
0
 /// <summary>
 /// Constructs a <see cref="SubtitleRenderer"/> instance.
 /// </summary>
 public SubtitleRenderer(Action onTextureInvalidated)
 {
   _onTextureInvalidated = onTextureInvalidated;
   _subtitles = new LinkedList<Subtitle>();
   //instance.textCallBack = new TextSubtitleCallback(instance.OnTextSubtitle);
   _resetCallBack = Reset;
   _updateTimeoutCallBack = UpdateTimeout;
   _device = SkinContext.Device;
 }
Пример #8
0
 private void _cSwishTimer_Complete(object sender)
 {
     ResetCallback rs = new ResetCallback(StopSwishTimer);
     this.Invoke(rs);
 }