public ManualTransmission() { IniFile ini = new IniFile(path); animdict = ini.Read("animdict", "MTSupport"); anim = ini.Read("anim", "MTSupport"); Tick += OnTick; mtlib = Dll.GetModuleHandle(@"Gears.asi"); if (mtlib == IntPtr.Zero) { Logger.Write(logpath, "Process not found!"); } else { Logger.Write(logpath, "Process present!"); } IsActive = CheckAddr <FnBool>(mtlib, "MT_IsActive"); AddIgnoreVehicle = CheckAddr <SetInt>(mtlib, "MT_AddIgnoreVehicle"); NeutralGear = CheckAddr <FnBool>(mtlib, "MT_NeutralGear"); ShiftMode = CheckAddr <GetInt>(mtlib, "MT_GetShiftMode"); if (IsActive == null || AddIgnoreVehicle == null || NeutralGear == null) { mtPresent = false; Logger.Write(logpath, "MTSupport disabled!"); } else { mtPresent = true; Logger.Write(logpath, "MTSupport initialized!"); } }
public AglContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, GetInt xoffset, GetInt yoffset) { Debug.Print("Share context: {0}", shareContext); Debug.Print("Window info: {0}", window); IntPtr shareContextRef = IntPtr.Zero; XOffset = xoffset; YOffset = yoffset; carbonWindow = window; if (shareContext is AglContext) { shareContextRef = ((AglContext)shareContext).Handle.Handle; } else if (shareContext is GraphicsContext) { ContextHandle shareHandle = shareContext != null ? (shareContext as IGraphicsContextInternal).Context : (ContextHandle)IntPtr.Zero; shareContextRef = shareHandle.Handle; } if (shareContextRef == IntPtr.Zero) { Debug.Print("No context sharing will take place."); } CreateContext(mode, carbonWindow, shareContextRef, true); }
public void Reset() { FloatUpdate = null; IntUpdate = null; V3Update = null; ItemPool.Despawn(_text.gameObject); }
public int Start(GetStr r, GetInt w, GetModule M) { Form1 forma = new Form1(r, w, M); forma.ShowDialog(); return(1); }
public Form1(GetStr r, GetInt w, GetModule getM) { getStr = r; getInt = w; getModule = getM; InitializeComponent(); }
public TDInt(object obj, PropertyInfo info) : base() { MemberInfo get = info.GetGetMethod(); _get = Delegate.CreateDelegate(typeof(TDInt.GetInt), obj, info.GetGetMethod()) as TDInt.GetInt; _set = Delegate.CreateDelegate(typeof(TDInt.SetInt), obj, info.GetSetMethod()) as TDInt.SetInt; }
private static void GetSum(GetInt getInt, List <float> list) { if (list == null) { return; } foreach (var item in list) { Console.WriteLine($"sum of float and random int: {item + getInt()}"); } }
private static void ShowNumbers(GetInt getInt, List <float> list) { if (list == null) { return; } Console.WriteLine(getInt()); foreach (var item in list) { Console.WriteLine(item); } }
public int GetValue() { if (InvokeRequired) { GetInt getInt = delegate() { return(base.Value); }; return((int)Invoke(getInt, null)); } else { return(base.Value); } }
public UnitAnimation Init(Animator unit, WeaponAnimator right, WeaponAnimator left, float index, AnimationCallbackCaster callback, GetInt get_id, GetBool rs) { GetIdle = get_id; GetRage = rs; WeaponAnimator_Left = left; WeaponAnimator_Right = right; unit_animator = unit; SetWeaponIndex(index); //No multicast so we dont need to remove listeners callback.OnAbilityTrigger = AbilityCallback; callback.OnWeaponHide = WeaponHide; callback.OnWeaponShow = WeaponShow; return(this); }
/// <summary> /// Gets a list of integer values using a callback function. /// </summary> /// <param name="n">Number of integers to get.</param> /// <param name="getInt">Function to be called to get each integer.</param> /// <returns>CSV list of integers.</returns> public static string GetIntList(int n, GetInt getInt) { if (n == 0) { return(null); } string list = ""; for (int i = 0; i < n; i++) { if (i > 0) { list += ","; } int?value = getInt(i); if (value != null) { list += value.Value.ToString(); } } return(list); }
public CarbonWindowInfo(IntPtr windowRef, bool ownHandle, bool isControl, GetInt getX, GetInt getY) : this(windowRef, ownHandle, isControl) { this.xOffset = getX; this.yOffset = getY; }
public TDInt(GetInt get, SetInt set) : base() { _get = get; _set = set; }
public Font(string path) { XmlDocument doc = new XmlDocument(); doc.Load(path); Name = doc.SelectSingleNode("/font/info").Attributes.GetNamedItem("face").Value; MaxSize = GetInt(doc.SelectSingleNode("/font/info"), "size"); LineHeight = GetInt(doc.SelectSingleNode("/font/common"), "lineHeight"); texturePages = new Texture2D[doc.SelectSingleNode("/font/pages").ChildNodes.Count]; Log($"Found {texturePages.Length} pages"); foreach (XmlNode node in doc.SelectNodes("/font/pages/page")) { string tn = node.Attributes.GetNamedItem("file").Value; int id = GetInt(node, "id"); string p = $"Fonts/{Name}/{Path.GetFileNameWithoutExtension(tn)}"; texturePages[id] = Engine.Instance.Content.Load <Texture2D>(p); } int charCount = GetInt(doc.SelectSingleNode("/font/chars"), "count"); glyphs = new Dictionary <char, GlyphData>(charCount); foreach (XmlNode node in doc.SelectNodes("/font/chars/char")) { char c = (char)GetInt(node, "id"); Rectangle rect = new Rectangle(GetInt(node, "x"), GetInt(node, "y"), GetInt(node, "width"), GetInt(node, "height")); Texture2D page = texturePages[GetInt(node, "page")]; Point offset = new Point(GetInt(node, "xoffset"), GetInt(node, "yoffset")); int xadvance = GetInt(node, "xadvance"); glyphs.Add(c, new GlyphData(c, page, rect, offset, xadvance)); } if (glyphs.ContainsKey('\r') && !glyphs.ContainsKey('\n')) { glyphs.Add('\n', glyphs['\r']); } Log($"Loaded {glyphs.Count} characters"); // 0xFFFD is the Unicode point for the missing character symbol. MissingCharacterGlyph = glyphs.ContainsKey((char)0xFFFD) ? glyphs[(char)0xFFFD] : glyphs[' ']; Log($"Assigned missing character glyph to {TextUtil.GetUnicodePoint(MissingCharacterGlyph.Character)}"); if (doc.SelectSingleNode("/font/kernings") != null) { int kerningCount = GetInt(doc.SelectSingleNode("/font/kernings"), "count"); kerningPairs = new Dictionary <string, int>(kerningCount); foreach (XmlNode node in doc.SelectNodes("/font/kernings/kerning")) { string pair = $"{(char)GetInt(node, "first")}{(char)GetInt(node, "second")}"; int kerning = GetInt(node, "amount"); kerningPairs.Add(pair, kerning); } Log($"Loaded {kerningPairs.Count} kerning pairs"); } else { kerningPairs = null; Log($"Font contained no kerning pairs."); } Log("Load complete."); }