private static Base GetCharaNpc(ChaStatusComponent statusComponent)
        {
            var heroine = statusComponent.heroine;

            // Staff or event character
            if (heroine == null)
            {
                return(_actionScene.fixChara);
            }

            var heroineNpc = _actionScene.npcList.FirstOrDefault(npc => heroine == npc.heroine);

            if (heroineNpc != null)
            {
                return(heroineNpc);
            }

            Logger.LogError("Could not find NPC belonging to " + heroine.parameter.fullname);
            return(null);
        }
        private static void CreateButtons(ChaStatusScene __instance, ChaStatusComponent ___cmpMale)
        {
            try
            {
                if (_actionScene == null)
                {
                    _actionScene = FindObjectOfType <ActionScene>();
                }

                if (_template == null)
                {
                    var go = new GameObject(ButtonName + "_template");
                    go.transform.SetParent(_actionScene.transform, false);

                    var image          = go.AddComponent <Image>();
                    var texture2D      = ResourceUtils.GetEmbeddedResource("button.png").LoadTexture(TextureFormat.DXT5);
                    var spriteMoveIcon = Sprite.Create(texture2D, new Rect(0f, 0f, texture2D.width, texture2D.height), new Vector2(0.5f, 0.5f), 100f, 0U, SpriteMeshType.FullRect);
                    image.sprite = spriteMoveIcon;

                    var button = go.AddComponent <Button>();
                    button.targetGraphic = image;
                    var rt = go.GetComponent <RectTransform>();
                    rt.anchorMin = rt.anchorMax = new Vector2(0.97f, 0.73f);
                    rt.offsetMin = new Vector2(-40, -40);
                    rt.offsetMax = Vector2.zero;

                    go.SetActive(false);
                    _template = go;
                    DontDestroyOnLoad(go);
                }

                foreach (var chaStatusComponent in __instance.gameObject.GetComponentsInChildren <ChaStatusComponent>())
                {
                    if (chaStatusComponent == ___cmpMale)
                    {
                        continue;
                    }

                    // Do not show the button if character is on the same map as player
                    var npc = GetCharaNpc(chaStatusComponent);
                    if (npc == null || npc.mapNo == _actionScene.Player.mapNo)
                    {
                        continue;
                    }

                    var cardTr = chaStatusComponent.cmpStudentCard.transform;
                    var go     = GameObject.Instantiate(_template, cardTr, false);
                    go.name = ButtonName;

                    var button = go.GetComponent <Button>();
                    if (button != null)
                    {
                        button.onClick.AddListener(() => WarpToNpc(npc));
                    }
                    go.SetActive(true);
                }
            }
            catch (Exception e)
            {
                UnityEngine.Debug.LogException(e);
            }
        }