Esempio n. 1
0
        public static void Attach(KScreen screen)
        {
            if (screen == null || screen.name == "SimpleInfoScreen")
            {
                return;
            }

            DraggablePanel panel = screen.FindOrAddUnityComponent <DraggablePanel>();

            if (panel == null)
            {
                return;
            }

            panel.Screen = screen;

            var rect = panel.GetComponentInParent <RectTransform>();

            if (rect == null)
            {
                return;
            }

            panel.DefaultPosition = rect.anchoredPosition;

            State.Common.Logger.LogDebug("Attached to KScreen", screen.displayName);
        }
Esempio n. 2
0
        // TODO: call when position is set by game
        public static void SetPositionFromFile(KScreen screen)
        {
            DraggablePanel panel = screen.FindOrAddUnityComponent <DraggablePanel>();

            if (panel != null && panel.LoadPosition(out Vector2 newPosition))
            {
                panel.SetPosition(newPosition);
            }
        }
Esempio n. 3
0
        public static void Attach(KScreen screen)
        {
            DraggablePanel panel = screen.FindOrAddUnityComponent <DraggablePanel>();

            if (panel == null)
            {
                return;
            }

            panel.Screen = screen;
        }
Esempio n. 4
0
        public static void Attach(KScreen screen)
        {
            DraggablePanel panel = screen.FindOrAddUnityComponent <DraggablePanel>();

            if (panel == null)
            {
                return;
            }

            panel.Screen = screen;

            if (Debugging)
            {
                Debug.Log("DraggablePanel: Attached to KScreen" + screen.displayName);
            }
        }
Esempio n. 5
0
        // TODO: call when position is set by game
        public static void SetPositionFromFile(KScreen screen)
        {
            DraggablePanel panel = screen.FindOrAddUnityComponent <DraggablePanel>();

            if (panel == null)
            {
                State.Common.Logger.LogDebug("Can't FindOrAddUnityComponent");

                return;
            }

            if (panel.LoadPosition(out Vector2 newPosition))
            {
                panel.SetPosition(newPosition);

                State.Common.Logger.Log($"Loaded position: {newPosition} for {screen.name}");
            }
        }
Esempio n. 6
0
        // TODO: call when position is set by game
        public static void SetPositionFromFile(KScreen screen)
        {
            if (Debugging)
            {
                Debug.Log("DraggablePanel: SetPositionFromFile enter");
            }

            DraggablePanel panel = screen.FindOrAddUnityComponent <DraggablePanel>();

            if (panel != null)
            {
                if (panel.LoadPosition(out Vector2 newPosition))
                {
                    panel.SetPosition(newPosition);
                    Debug.Log("DraggablePanel: Loaded position: " + newPosition);
                }
            }
            else if (Debugging)
            {
                Debug.Log("DraggablePanel: Can't FindOrAddUnityComponent");
            }
        }
Esempio n. 7
0
 public static void Prefix(KScreen __instance)
 {
     DraggablePanel.Attach(__instance);
 }
Esempio n. 8
0
 public static void Postfix(KScreen __instance)
 {
     DraggablePanel.SetPositionFromFile(__instance);
 }