void Awake() { if (instance == null) { instance = this; } // Use this if you wish to make the mod trigger cheat mode ingame. // Set this true if your mod effects physics or allows mods that you can't normally do. isCheat = false; // Set this to whether the mod is currently enabled or not. // Usually you want this to be true by default. // Register the mod to PTF, that way it will be able to be configured using PTF ingame. modEnabled = Config.Bind(modEnabledDef, true, new ConfigDescription("Enable Mod")); modEnabled.SettingChanged += onEnableDisable; harmony = new Harmony("org.bepinex.plugins.ConsoleCinematicCamera"); harmony.PatchAll(Assembly.GetExecutingAssembly()); Logger.LogInfo("Console Initiated."); // ConsoleCommands.Init(); PolyTechMain.registerMod(this); }
void Awake() { this.repositoryUrl = "https://github.com/Conqu3red/Template-Mod/"; // repo to check for updates from if (instance == null) { instance = this; } // Use this if you wish to make the mod trigger cheat mode ingame. // Set this true if your mod effects physics or allows mods that you can't normally do. isCheat = false; modEnabled = Config.Bind("Template Mod", "modEnabled", true, "Enable Mod"); modEnabled.SettingChanged += onEnableDisable; harmony = new Harmony("org.bepinex.plugins.TemplateMod"); harmony.PatchAll(Assembly.GetExecutingAssembly()); this.authors = new string[] { "Conqu3red" }; // just a log statement Logger.LogInfo("aaa"); PolyTechMain.registerMod(this); }
public void onCheatsChanged(object sender, ListChangedEventArgs e) { if (e.ListChangedType == ListChangedType.ItemDeleted) { return; } PolyTechMod mod = cheatMods[cheatMods.Count - 1]; string nameAndVers = $"{mod.Info.Metadata.Name} v{mod.Info.Metadata.Version}"; Logger.LogInfo("Registered cheat mod: " + nameAndVers); }
public void Awake() { moddedWatermark = Config.Bind(moddedWatermarkDef, watermarks.polytech, new ConfigDescription("Selected Watermark")); vanillaWatermark = Config.Bind(vanillaWatermarkDef, watermarks.polytech, new ConfigDescription("Selected Watermark")); modEnabled = Config.Bind(modEnabledDef, true, new ConfigDescription("Enable Mod")); modEnabled.SettingChanged += onEnableDisable; forceCheat = Config.Bind(forceCheatDef, false, new ConfigDescription("Force Cheat Flag")); forceCheat.SettingChanged += onForceCheatToggle; sandboxEverywhere = Config.Bind(sandboxEverywhereDef, false, new ConfigDescription("Allow sandbox resource editor and scene changer in any level (enables cheat flag)")); sandboxEverywhere.SettingChanged += sandboxEverywhereToggle; globalToggleHotkey = Config.Bind(globalToggleHotkeyDef, new BepInEx.Configuration.KeyboardShortcut(KeyCode.BackQuote, KeyCode.LeftAlt), new ConfigDescription("Keybind used to toggle mods without opening the config menu.")); leaderboardProtMin = Config.Bind(leaderboardProtMinDef, 71, new ConfigDescription("Minimum value allowed to upload to leaderboard. 71 is the minimum to protect from automatic shadowbans.")); leaderboardProtMin.SettingChanged += onLeaderboardProtChange; leaderboardCheck = Config.Bind(leaderboardCheckDef, false, new ConfigDescription("If checked, the game will confirm with the user before uploading scores to the leaderboard.")); leaderboardBlock = Config.Bind(leaderboardBlockDef, false, new ConfigDescription("If checked, the game will never upload a score to the leaderboard.")); noncheatMods.ListChanged += onCosmeticsChanged; cheatMods.ListChanged += onCheatsChanged; enabledCheatTweaks = 0 + (forceCheat.Value ? 1 : 0) + (sandboxEverywhere.Value ? 1 : 0); this.modCheated = false; this.repositoryUrl = "https://github.com/PolyTech-Modding/PolyTechFramework/"; Harmony.CreateAndPatchAll(typeof(PolyTechMain)); PolyTechUtils.setModdedSimSpeeds(); PolyTechUtils.setReplaysModded(); PolyTechUtils.setVersion(); this.ptfLogger = Logger; Logger.LogInfo($"Loaded {PluginName} v{PluginVersion}"); this.isCheat = false; this.isEnabled = modEnabled.Value; ptfInstance = this; this.authors = new string[] { "MoonlitJolty", "Conqu3red", "Razboy20", "Tran Fox", "nitsuga5124" }; registerMod(this); }
/// <summary> /// Add a new type converter for a given type. /// If a different converter is already added, this call is ignored and false is returned. /// </summary> public static bool AddConverter(Type type, TypeConverter converter) { if (type == null) { throw new ArgumentNullException(nameof(type)); } if (converter == null) { throw new ArgumentNullException(nameof(converter)); } if (CanConvert(type)) { Logger.LogWarning("Tried to add a TomlConverter when one already exists for type " + type.FullName); return(false); } TypeConverters.Add(type, converter); return(true); }
private void ChatWindow(int id) { try { // should reset scroll position to bottom when a message is received GUIStyle myCustomStyle = new GUIStyle(GUI.skin.GetStyle("label")) { wordWrap = true }; chatScrollPosition = GUILayout.BeginScrollView(chatScrollPosition, GUILayout.MaxHeight(ChatRect.height - 10)); GUILayout.Label(ChatValues.chatLog, myCustomStyle, GUILayout.Width(175)); GUILayout.EndScrollView(); GUI.SetNextControlName("sendMessageField"); ChatValues.chatMessage = GUILayout.TextField(ChatValues.chatMessage, GUILayout.Width(175)); //Logger.LogInfo(GUI.GetNameOfFocusedControl()); Event e = Event.current; if (e.keyCode == KeyCode.Return && GUI.GetNameOfFocusedControl() == "sendMessageField" && ChatValues.chatMessage != "" && clientEnabled) { string message = ChatValues.chatMessage; ChatValues.chatMessage = ""; Logger.LogInfo("send"); ChatMessageModel chatMessage = new ChatMessageModel { message = message, username = "", nameColor = mouseColor.Value }; communication.SendRequest( new MessageModel { type = LobbyMessaging.ChatMessage, content = chatMessage.Serialize() }.Serialize() ); } GUI.DragWindow(); } catch (ArgumentException ex) { instance.Logger.LogError(ex.Message); } }
private static void LazyLoadConverters() { try { LazyTomlConverterLoader.AddUnityEngineConverters(); } catch (Exception ex) { Logger.LogWarning("Failed to load UnityEngine Toml converters - " + ex.Message); } }