private bool SetSetting_FuzzyByte(string name, string value) { if (!name.Contains("hud")) { return(false); } ByteSettingName setting = ByteSettingName.None; if (name.Contains("enemy") || name.Contains("enemies")) { setting = ByteSettingName.EnemiesOnHUD; } else if (name.Contains("neutral")) { setting = ByteSettingName.NeutralOnHUD; } else if (name.Contains("faction")) { setting = ByteSettingName.FactionOnHUD; } else if (name.Contains("owner")) { setting = ByteSettingName.OwnerOnHUD; } else if (name.Contains("missile")) { setting = ByteSettingName.MissileOnHUD; } else if (name.Contains("interval") || name.Contains("update")) { setting = ByteSettingName.UpdateIntervalHUD; } if (setting == ByteSettingName.None) { return(false); } Logger.DebugLog(setting + " variation: " + name); byte y; if (byte.TryParse(value, out y)) { SetSetting(setting, y, true); } else { Logger.DebugLog("failed to parse as byte: " + value, Rynchodon.Logger.severity.INFO); MyAPIGateway.Utilities.ShowMessage("ARMS", "Not a byte: \"" + value + '"'); } return(true); }
public static void SetSetting(ByteSettingName name, byte value, bool notify = false) { if (notify) { MyAPIGateway.Utilities.ShowMessage("ARMS", "Set " + name + " to " + value); } if (Instance.ByteSettings[name].Value == value) { return; } Logger.DebugLog("Setting " + name + " to " + value, Rynchodon.Logger.severity.DEBUG); Instance.ByteSettings[name].Value = value; }
private void SendSettingToServer(ByteSettingName name) { byte[] message = new byte[10]; int pos = 0; ByteConverter.AppendBytes(PlayerID, message, ref pos); ByteConverter.AppendBytes((byte)name, message, ref pos); ByteConverter.AppendBytes(GetSetting(name), message, ref pos); if (!MyAPIGateway.Multiplayer.SendMessageToServer(ModID, message, true)) myLogger.alwaysLog("message failed", "SendSettingToServer()", Logger.severity.ERROR); else myLogger.debugLog("sent setting: " + name + " to server", "SendSettingToServer()"); }
public void SetSetting(ByteSettingName name, byte value) { if (ByteSettings[name].Value == value) return; myLogger.debugLog("Setting " + name + " to " + value, "SetSetting()", Logger.severity.DEBUG); ByteSettings[name].Value = value; if (Local) { SendSettingToServer(name); writeAll(); } }
public byte GetSetting(ByteSettingName name) { return ByteSettings[name].Value; }
public static void SetSetting(ByteSettingName name, byte value, bool notify = false) { if (notify) MyAPIGateway.Utilities.ShowMessage("ARMS", "Set " + name + " to " + value); if (Instance.ByteSettings[name].Value == value) return; Instance.myLogger.debugLog("Setting " + name + " to " + value, Logger.severity.DEBUG); Instance.ByteSettings[name].Value = value; }
public static byte GetSetting(ByteSettingName name) { return Instance.ByteSettings[name].Value; }
public static byte GetSetting(ByteSettingName name) { return(Instance.ByteSettings[name].Value); }