예제 #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);
        }
예제 #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);
            }
        }
예제 #3
0
        public static void Attach(KScreen screen)
        {
            DraggablePanel panel = screen.FindOrAddUnityComponent <DraggablePanel>();

            if (panel == null)
            {
                return;
            }

            panel.Screen = screen;
        }
예제 #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);
            }
        }
예제 #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}");
            }
        }
예제 #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");
            }
        }
예제 #7
0
 public static void Prefix(KScreen __instance)
 {
     DraggablePanel.Attach(__instance);
 }
예제 #8
0
 public static void Postfix(KScreen __instance)
 {
     DraggablePanel.SetPositionFromFile(__instance);
 }