/// <summary> /// Tries to register this ability. /// </summary> /// <returns>True if the ability registered properly.</returns> public bool TryRegister() { if (!Registered.Contains(this)) { Registered.Add(this); Init(); Log.Debug($"{Name} has been successfully registered.", CustomRoles.Instance.Config.Debug); return(true); } Log.Warn($"Couldn't register {Name} as it already exists."); return(false); }
public static void Register(uint id, Vector2f size, double weight, Vector2f colliderOffset, bool isSolid, bool isStatic, string texture, string filename) { if (id == 0) { throw new ArgumentException("0x0000 is reserved ID."); } Func <Vector2f, GameObject> constructor = position => new GameObject(id, position, size, weight, colliderOffset, isSolid, isStatic); builder.Add(id, constructor); BindedTextures.Add(id, texture); if (NewTextureBinded != null) { NewTextureBinded(id, texture); } Registered.Add(id, filename.Substring(0, filename.Length - 4)); }
static Exchange() { string directoryName = Path.GetDirectoryName(Application.ExecutablePath) + "\\Icons"; if (!Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } Registered.Add(PoloniexExchange.Default); Registered.Add(BittrexExchange.Default); Registered.Add(BinanceExchange.Default); Registered.Add(BitmexExchange.Default); //Registered.Add(BitFinexExchange.Default); //Registered.Add(new YobitExchange()); foreach (Exchange exchange in Registered) { exchange.Load(); } }
/// <summary> /// Tries to register this role. /// </summary> /// <returns>True if the role registered properly.</returns> public bool TryRegister() { if (!Registered.Contains(this)) { if (Registered.Any(r => r.Id == Id)) { Log.Warn($"{Name} has tried to register with the same Role ID as another role: {Id}. It will not be registered!"); return(false); } Registered.Add(this); Init(); Log.Debug($"{Name} ({Id}) has been successfully registered.", CustomRoles.Instance.Config.Debug); return(true); } Log.Warn($"Couldn't register {Name} ({Id}) [{Role}] as it already exists."); return(false); }