コード例 #1
0
        private void AddVehicleCustomizeButton(VehicleWorldInfoPanel infoPanel, out UIButton button, Vector3 offset)
        {
            button = UiUtils.CreateToggleButton(infoPanel.component, offset, UIAlignAnchor.BottomLeft, (component, e) =>
            {
                InstanceID instanceID = InstanceHelper.GetInstanceID(infoPanel);

                SelectedInstanceID = instanceID;

                var vehicle = VehicleManager.instance.m_vehicles.m_buffer[instanceID.Vehicle].Info;

                try
                {
                    if (VehiclePanelWrapper == null || vehicle != SelectedVehicle)
                    {
                        VehiclePanelWrapper = vehicle.GenerateVehiclePanel();
                    }
                    else
                    {
                        VehiclePanelWrapper.isVisible = false;
                        UiUtils.DeepDestroy(VehiclePanelWrapper);
                    }
                }
                catch (Exception ex)
                {
                    Debug.Log($"{ex.Message} - {ex.StackTrace}");
                }

                if (component.hasFocus)
                {
                    component.Unfocus();
                }
            });
        }
コード例 #2
0
        public static void Postfix(VehicleWorldInfoPanel __instance, ref string __result)
        {
            InstanceID instanceID = InstanceHelper.GetInstanceID(__instance);

            var vehicle = VehicleManager.instance.m_vehicles.m_buffer[instanceID.Vehicle].Info;

            if (CustomizeItExtendedVehicleTool.instance.CustomVehicleNames.TryGetValue(vehicle.name,
                                                                                       out NameProperties props) && props.DefaultName && !props.Unaffected.Contains(instanceID.Vehicle))
            {
                __result = props.CustomName;
            }
        }
コード例 #3
0
        public static void Postfix(VehicleWorldInfoPanel __instance, string text)
        {
            InstanceID instanceID = InstanceHelper.GetInstanceID(__instance);

            var vehicle = VehicleManager.instance.m_vehicles.m_buffer[instanceID.Vehicle].Info;


            if (!CustomizeItExtendedTool.instance.CustomBuildingNames.TryGetValue(vehicle.name, out var nameProps))
            {
                return;
            }

            if (!nameProps.Unaffected.Contains(instanceID.Vehicle))
            {
                nameProps.Unaffected.Add(instanceID.Vehicle);
            }

            if (!CustomizeItExtendedMod.Settings.SavePerCity)
            {
                CustomizeItExtendedMod.Settings.Save();
            }
        }