private void AddButton(CitizenWorldInfoPanel infoPanel, out UIButton button, Vector3 offSet)
        {
            button = UiUtils.CreateToggleButton(infoPanel.component, offSet, UIAlignAnchor.BottomLeft, (component, e) =>
            {
                InstanceID instanceID = InstanceHelper.GetInstanceID(infoPanel);

                var citizen = CitizenManager.instance.m_citizens.m_buffer[instanceID.Citizen];

                try
                {
                    if (CitizenPanelWrapper == null || instanceID.Citizen != SelectedCitizen)
                    {
                        CitizenPanelWrapper = citizen.GenerateCitizenPanel(instanceID.Citizen);
                    }
                    else
                    {
                        CitizenPanelWrapper.isVisible = false;
                        UiUtils.DeepDestroy(CitizenPanelWrapper);
                    }
                }
                catch (Exception ex)
                {
                    Debug.Log($"{ex.Message} - {ex.StackTrace}");
                }

                if (component.hasFocus)
                {
                    component.Unfocus();
                }
            });
        }
        public void AddPanelButton()
        {
            if (_isButtonInitialized)
            {
                return;
            }

            CitizenWorldInfoPanel =
                GameObject.Find("(Library) CitizenWorldInfoPanel").GetComponent <CitizenWorldInfoPanel>();

            if (CitizenWorldInfoPanel == null)
            {
                return;
            }

            AddButton(CitizenWorldInfoPanel, out _citizenCustomizeButton, new Vector3(240f, -31f, 0f));

            _isButtonInitialized = true;
        }
        void Update()
        {
            if (!initialized)
            {
                citizenVehicleInfoPanel = GameObject.Find("(Library) CitizenVehicleWorldInfoPanel").GetComponent <CitizenVehicleWorldInfoPanel>();

                citizenVehicleInfoPanel.Find <UITextField>("VehicleName").width = 200;

                citizenVehicleCameraButton = CreateCameraButton
                                             (
                    citizenVehicleInfoPanel.component,
                    (component, param) =>
                {
                    InstanceID instance = Util.ReadPrivate <CitizenVehicleWorldInfoPanel, InstanceID>(citizenVehicleInfoPanel, "m_InstanceID");
                    FPSCamera.instance.vehicleCamera.SetFollowInstance(instance.Vehicle);

                    if (FPSCamera.instance.hideUIComponent != null && FPSCamera.instance.config.integrateHideUI)
                    {
                        FPSCamera.instance.hideUIComponent.SendMessage("Hide");
                    }
                }
                                             );

                //

                cityServiceVehicleInfoPanel = GameObject.Find("(Library) CityServiceVehicleWorldInfoPanel").GetComponent <CityServiceVehicleWorldInfoPanel>();
                cityServiceVehicleInfoPanel.Find <UITextField>("VehicleName").width = 200;

                cityServiceVehicleCameraButton = CreateCameraButton
                                                 (
                    cityServiceVehicleInfoPanel.component,
                    (component, param) =>
                {
                    InstanceID instance = Util.ReadPrivate <CityServiceVehicleWorldInfoPanel, InstanceID>(cityServiceVehicleInfoPanel, "m_InstanceID");
                    FPSCamera.instance.vehicleCamera.SetFollowInstance(instance.Vehicle);

                    if (FPSCamera.instance.hideUIComponent != null && FPSCamera.instance.config.integrateHideUI)
                    {
                        FPSCamera.instance.hideUIComponent.SendMessage("Hide");
                    }
                }
                                                 );

                //

                publicTransportVehicleInfoPanel = GameObject.Find("(Library) PublicTransportVehicleWorldInfoPanel").GetComponent <PublicTransportVehicleWorldInfoPanel>();
                publicTransportVehicleInfoPanel.Find <UITextField>("VehicleName").width = 200;

                publicTransportCameraButton = CreateCameraButton
                                              (
                    publicTransportVehicleInfoPanel.component,
                    (component, param) =>
                {
                    InstanceID instance = Util.ReadPrivate <PublicTransportVehicleWorldInfoPanel, InstanceID>(publicTransportVehicleInfoPanel, "m_InstanceID");
                    FPSCamera.instance.vehicleCamera.SetFollowInstance(instance.Vehicle);

                    if (FPSCamera.instance.hideUIComponent != null && FPSCamera.instance.config.integrateHideUI)
                    {
                        FPSCamera.instance.hideUIComponent.SendMessage("Hide");
                    }
                }
                                              );


                //

                citizenInfoPanel = GameObject.Find("(Library) CitizenWorldInfoPanel").GetComponent <CitizenWorldInfoPanel>();
                citizenInfoPanel.Find <UITextField>("PersonName").width = 180;

                citizenCameraButton = CreateCameraButton
                                      (
                    citizenInfoPanel.component,
                    (component, param) =>
                {
                    InstanceID instance = Util.ReadPrivate <CitizenWorldInfoPanel, InstanceID>(citizenInfoPanel, "m_InstanceID");
                    FPSCamera.instance.citizenCamera.SetFollowInstance(instance.Citizen);

                    if (FPSCamera.instance.hideUIComponent != null && FPSCamera.instance.config.integrateHideUI)
                    {
                        FPSCamera.instance.hideUIComponent.SendMessage("Hide");
                    }
                }
                                      );

                //

                initialized = true;
            }
        }
        void Update()
        {
            if (!initialized)
            {
                citizenVehicleInfoPanel = GameObject.Find("(Library) CitizenVehicleWorldInfoPanel").GetComponent<CitizenVehicleWorldInfoPanel>();

                citizenVehicleInfoPanel.Find<UITextField>("VehicleName").width = 200;

                citizenVehicleCameraButton = CreateCameraButton
                (
                    citizenVehicleInfoPanel.component,
                    (component, param) =>
                    {
                        InstanceID instance = Util.ReadPrivate<CitizenVehicleWorldInfoPanel, InstanceID>(citizenVehicleInfoPanel, "m_InstanceID");
                        FPSCamera.instance.vehicleCamera.SetFollowInstance(instance.Vehicle);

                        if (FPSCamera.instance.hideUIComponent != null && FPSCamera.instance.config.integrateHideUI)
                        {
                            FPSCamera.instance.hideUIComponent.SendMessage("Hide");
                        }
                    }
                );

                //

                cityServiceVehicleInfoPanel = GameObject.Find("(Library) CityServiceVehicleWorldInfoPanel").GetComponent<CityServiceVehicleWorldInfoPanel>();
                cityServiceVehicleInfoPanel.Find<UITextField>("VehicleName").width = 200;

                cityServiceVehicleCameraButton = CreateCameraButton
                (
                    cityServiceVehicleInfoPanel.component,
                    (component, param) =>
                    {
                        InstanceID instance = Util.ReadPrivate<CityServiceVehicleWorldInfoPanel, InstanceID>(cityServiceVehicleInfoPanel, "m_InstanceID");
                        FPSCamera.instance.vehicleCamera.SetFollowInstance(instance.Vehicle);

                        if (FPSCamera.instance.hideUIComponent != null && FPSCamera.instance.config.integrateHideUI)
                        {
                            FPSCamera.instance.hideUIComponent.SendMessage("Hide");
                        }
                    }
                );

                //

                publicTransportVehicleInfoPanel = GameObject.Find("(Library) PublicTransportVehicleWorldInfoPanel").GetComponent<PublicTransportVehicleWorldInfoPanel>();
                publicTransportVehicleInfoPanel.Find<UITextField>("VehicleName").width = 200;

                publicTransportCameraButton = CreateCameraButton
                (
                    publicTransportVehicleInfoPanel.component,
                    (component, param) =>
                    {
                        InstanceID instance = Util.ReadPrivate<PublicTransportVehicleWorldInfoPanel, InstanceID>(publicTransportVehicleInfoPanel, "m_InstanceID");
                        FPSCamera.instance.vehicleCamera.SetFollowInstance(instance.Vehicle);

                        if (FPSCamera.instance.hideUIComponent != null && FPSCamera.instance.config.integrateHideUI)
                        {
                            FPSCamera.instance.hideUIComponent.SendMessage("Hide");
                        }
                    }
                );


                //

                citizenInfoPanel = GameObject.Find("(Library) CitizenWorldInfoPanel").GetComponent<CitizenWorldInfoPanel>();
                citizenInfoPanel.Find<UITextField>("PersonName").width = 180;

                citizenCameraButton = CreateCameraButton
                (
                    citizenInfoPanel.component,
                    (component, param) =>
                    {
                        InstanceID instance = Util.ReadPrivate<CitizenWorldInfoPanel, InstanceID>(citizenInfoPanel, "m_InstanceID");
                        FPSCamera.instance.citizenCamera.SetFollowInstance(instance.Citizen);

                        if (FPSCamera.instance.hideUIComponent != null && FPSCamera.instance.config.integrateHideUI)
                        {
                            FPSCamera.instance.hideUIComponent.SendMessage("Hide");
                        }
                    }
                );

                //

                initialized = true;
            }
        }