private void Update_OnTick(Timer t) { if (Engine.m_Ingame && m_Active) { Mobile player = World.Player; if (player != null) { Item backpack = player.Backpack; if (backpack != null) { m_Valid = true; int num = 0; int width = 0; for (int i = 0; i < m_List.Length; i++) { m_List[i].Update(backpack); m_List[i].Y = num; num += m_List[i].Height - 1; if (m_List[i].Width > width) { width = m_List[i].Width; } } for (int j = 0; j < m_List.Length; j++) { m_List[j].Width = width; } this.X = (Engine.ScreenWidth - width) + 1; return; } } } m_Valid = false; }
public AutoTargetSession(object entity, TargetAction action) { this.m_Entity = entity; this.m_Action = action; this.m_Timer = new Timer(new OnTick(Engine.AutoTarget_Expire), 0x9c4, 1); this.m_Timer.SetTag("Session", this); this.m_Timer.Start(false); }
public void UpdatePosition() { double normalized = this.m_Sync.Normalized; if (normalized >= 1.0) { if (this.m_Timer == null) { this.m_Timer = new Timer(new OnTick(this.Delete_OnTick), 0, 1); this.m_Timer.Start(false); } } else { if (normalized >= 0.5) { this.Alpha = (float) (1.0 - ((normalized - 0.5) * 2.0)); } int xWorld = Renderer.m_xWorld; int yWorld = Renderer.m_yWorld; int zWorld = Renderer.m_zWorld; int x = this.m_Mobile.X; int y = this.m_Mobile.Y; int z = this.m_Mobile.Z; x -= xWorld; y -= yWorld; z -= zWorld; int num8 = (Engine.GameWidth >> 1) + ((x - y) * 0x16); int num9 = (((Engine.GameHeight >> 1) + 0x16) + ((x + y) * 0x16)) - (z * 4); num8 += Engine.GameX; num9 += Engine.GameY; if (this.m_Mobile.Walking.Count > 0) { WalkAnimation animation = (WalkAnimation) this.m_Mobile.Walking.Peek(); int xOffset = 0; int yOffset = 0; int fOffset = 0; if (animation.Snapshot(ref xOffset, ref yOffset, ref fOffset)) { num8 += xOffset; num9 += yOffset; } } num8 -= Renderer.m_xScroll; num9 -= Renderer.m_yScroll; this.X = (num8 - (((base.Image.xMax - base.Image.xMin) + 1) / 2)) - base.Image.xMin; this.Y = (num9 - 30) - ((int) (normalized * 40.0)); base.Scissor(new Clipper(Engine.GameX, Engine.GameY, Engine.GameWidth, Engine.GameHeight)); } }
public GObjectProperties(int number, object o, ObjectPropertyList propList) : base(0, 0, 2, 20) { this.m_Object = o; base.m_CanDrag = false; this.m_Timer = new Timer(new OnTick(this.Roll_OnTick), 0); this.m_Timer.Start(false); int length = propList.Properties.Length; if ((length == 0) && (number != -1)) { length = 1; } this.SetList(number, propList); this.m_WidthDuration = this.m_TotalWidth * 0.000625; this.m_HeightDuration = length * 0.0125; this.m_Sync = new TimeSync(this.m_WidthDuration + this.m_HeightDuration); }
public void AddTimer(Timer t) { Engine.AddTimer(t); }
public void RemoveTimer(Timer t) { Engine.RemoveTimer(t); }
public void Update_OnTick(Timer t) { Profiles.Save(); GMenuItem item = this.m_Shard.Menu; if (item == null) { Engine.UpdateSmartLoginMenu(); } else { for (int i = 0; i < this.m_Shard.Characters.Length; i++) { GMenuItem item2 = this.m_Shard.Characters[i].Menu; if (item2 == null) { item.Add(this.m_Shard.Characters[i].Menu = item2 = new GPlayCharacterMenu(this.m_Shard.Characters[i])); } else { item2.Text = this.m_Shard.Characters[i].Name; } } Gump[] gumpArray = item.Children.ToArray(); for (int j = 0; j < gumpArray.Length; j++) { GPlayCharacterMenu child = gumpArray[j] as GPlayCharacterMenu; if ((child != null) && !this.m_Shard.Contains(child.Character)) { item.Remove(child); } } } }
protected void Roll_OnTick(Timer t) { double num; double elapsed = this.m_Sync.Elapsed; if (elapsed < this.m_WidthDuration) { num = elapsed / this.m_WidthDuration; this.Width = 2 + ((int) (num * (this.m_TotalWidth - 2))); this.Height = this.m_CompactHeight; } else { num = (elapsed - this.m_WidthDuration) / this.m_HeightDuration; if (num >= 1.0) { if (this.m_Timer != null) { this.m_Timer.Stop(); } this.m_Timer = null; this.Width = this.m_TotalWidth; this.Height = this.m_TotalHeight; } else { this.Width = this.m_TotalWidth; this.Height = this.m_CompactHeight + ((int) (num * (this.m_TotalHeight - this.m_CompactHeight))); } } Engine.Redraw(); }
public static void RemoveTimer(Timer t) { m_Interop.RemoveTimer(t); }
protected void Roll_OnTick(Timer t) { double normalized = this.m_Sync.Normalized; this.Height = this.m_From + ((int) ((this.m_To - this.m_From) * normalized)); Engine.Redraw(); if (normalized >= 1.0) { this.m_Timer.Stop(); if (this.m_Expanding) { this.m_Expanded = true; this.m_Expanding = false; this.m_Compacted = false; this.m_Compacting = false; } else if (this.m_Compacting) { this.m_Expanded = false; this.m_Expanding = false; this.m_Compacted = true; this.m_Compacting = false; } else { this.m_Expanded = false; this.m_Expanding = false; this.m_Compacted = false; this.m_Compacting = false; } } }
/// <summary> /// Create a new timer /// </summary> /// <param name="parameter"></param> public static void timer(string parameter) { try { if (!parameter.Contains(" ")) { Core.SystemForm.Chat.scrollback.InsertText(messages.get("command-wrong", Core.SelectedLanguage, new List<string> { "2" }), Client.ContentLine.MessageStyle.Message); } int time = 0; string tm = parameter.Substring(0, parameter.IndexOf(" ", StringComparison.Ordinal)); string command = parameter.Substring(parameter.IndexOf(" ", StringComparison.Ordinal) + 1); if (int.TryParse(tm, out time)) { Timer timer = new Timer(time, command); lock (Core.TimerDB) { Core.TimerDB.Add(timer); } timer.Execute(); } } catch (Exception fail) { Core.handleException(fail); } }
private static void CharacterList(PacketReader pvSrc) { bool flag; byte num = pvSrc.ReadByte(); Cursor.Hourglass = false; Engine.CharacterCount = num; string[] strArray = Engine.CharacterNames = new string[5]; int num2 = 0; for (int i = 0; i < 5; i++) { Engine.CharacterNames[i] = strArray[i] = pvSrc.ReadString(60); if (strArray[i].Length > 0) { num2++; } } pvSrc.ReadString(60); int num4 = pvSrc.ReadByte(); while (--num4 >= 0) { byte num5 = pvSrc.ReadByte(); string str = pvSrc.ReadString(0x1f); string str2 = pvSrc.ReadString(0x1f); } if (!pvSrc.Finished) { int num6 = pvSrc.ReadInt32(); Engine.ServerFeatures.SingleChar = (num6 & 4) != 0; Engine.ServerFeatures.ContextMenus = (num6 & 8) != 0; Engine.ServerFeatures.AOS = (num6 & 0x20) != 0; if ((num6 & 4) != 0) { flag = num2 < 1; } else { flag = num2 < 5; } } else { flag = num2 < 5; } if (Engine.m_QuickLogin) { CharacterProfile charProfile = Engine.m_QuickEntry.CharProfile; if (charProfile != null) { ShardProfile shard = charProfile.Shard; for (int j = 0; j < 5; j++) { string name = Engine.CharacterNames[j]; if (name.Length > 0) { CharacterProfile profile3 = null; for (int k = 0; (profile3 == null) && (k < shard.Characters.Length); k++) { if (shard.Characters[k].Index == j) { profile3 = shard.Characters[k]; } } if (profile3 != null) { profile3.Name = name; } else { shard.AddCharacter(new CharacterProfile(shard, name, j)); } } else { CharacterProfile character = null; for (int m = 0; (character == null) && (m < shard.Characters.Length); m++) { if (shard.Characters[m].Index == j) { character = shard.Characters[m]; } } if (character != null) { shard.RemoveCharacter(character); } } } Array.Sort(shard.Characters, new CharacterComparer()); Timer timer = new Timer(new OnTick(PacketHandlers.Update_OnTick), 0, 1); timer.SetTag("shard", shard); timer.Start(false); } QuickLogin.Add(Engine.m_QuickEntry); Network.Send(new PCharSelect(Engine.m_QuickEntry.CharName, Engine.m_QuickEntry.CharID)); if (Animations.IsLoading) { Gumps.Desktop.Children.Clear(); xGumps.Display("AnimationLoad"); do { Engine.DrawNow(); } while (!Animations.WaitLoading()); } Gumps.Desktop.Children.Clear(); xGumps.Display("EnterBritannia"); Engine.DrawNow(); } else { xGumps.SetVariable("CharSlotAvailable", flag ? "1" : "0"); Gumps.Desktop.Children.Clear(); xGumps.Display("CharacterList"); int index = 0; int num11 = 0; while (index < 5) { if (strArray[index].Length > 0) { xGumps.SetVariable("CharName", strArray[index]); xGumps.SetVariable("CharDisplayIndex", num11++.ToString()); xGumps.SetVariable("CharIndex", index.ToString()); xGumps.Display("CharacterEntry", "CharacterList"); } index++; } } }
private void Delete_OnTick(Timer t) { Gumps.Destroy(this); }
/// <summary> /// Установка процедуры проверки подключения /// </summary> /// <param name="Period">Период проверки</param> /// <param name="Client">Клиент для подключения</param> public static void SetUpConnectionChecker(int Period, IClientModel Client) { TimerClient = Client; ConnectionCheckerTimer = new Timer(OnTimer, null, 60 * 1000, Period); }
public GQuickLogin() : base(0, 0, 200, 20) { this.m_CompactHeight = 20; this.m_ExpandedHeight = Engine.GameHeight / 2; base.m_CanDrag = false; this.m_Timer = new Timer(new OnTick(this.Roll_OnTick), 0); GLabel toAdd = new GLabel("Quick Login", Engine.GetUniFont(0), Hues.Default, 2, 2); this.Height = toAdd.Height + 4; this.m_CompactHeight = base.m_Height; base.m_Children.Add(toAdd); toAdd.Center(); QuickLogin.Load(); int count = QuickLogin.Entries.Count; if (count == 0) { base.Visible = false; } else { if (count > 12) { count = 12; } int num2 = (2 + toAdd.Height) + 4; if (count == 0) { num2 -= 2; } OnClick onClick = new OnClick(Engine.QuickLogin_OnClick); Clipper clipper = new Clipper(base.m_X + 1, base.m_Y + 1, base.m_Width - 2, base.m_Height - 2); for (int i = 0; i < count; i++) { Entry entry = (Entry) QuickLogin.Entries[i]; GTextButton button = new GTextButton(entry.CharName, Engine.GetUniFont(0), Hues.Load(0x58), Hues.Load(0x35), 2, 2, onClick); base.m_Children.Add(button); button.Center(); button.Y = num2; button.Scissor(clipper); button.SetTag("Index", i); num2 += button.Height; int num4 = 0; bool flag = false; for (int j = 0; j < count; j++) { Entry entry2 = (Entry) QuickLogin.Entries[j]; if (entry2.CharName == entry.CharName) { if (j <= i) { num4++; } if (j != i) { flag = true; } } } if (flag) { button.Tooltip = new Tooltip(string.Format("{0}\n{1}", num4, entry.ServerName)); } else { button.Tooltip = new Tooltip(entry.ServerName); } } if (count != 0) { num2 += 2; } if (num2 > 480) { num2 = 480; } this.m_ExpandedHeight = num2; } }
public static void AddTimer(Timer t) { m_Interop.AddTimer(t); }
protected void Fade_OnTick(Timer t) { if (this.m_Sync != null) { double normalized = this.m_Sync.Normalized; base.Alpha = this.m_FadeFrom + ((float) ((this.m_FadeTo - this.m_FadeFrom) * normalized)); if (normalized >= 1.0) { this.m_Sync = null; if (this.State == FadeState.F2O) { this.State = FadeState.Opaque; } else if (this.State == FadeState.O2F) { this.State = FadeState.Faded; } } } else { t.Delete(); this.m_Timer = null; } }
public void Update_OnTick(Timer t) { Profiles.Save(); GMenuItem item = this.m_Account.Menu; if ((item == null) || ((item == this.m_Server.Menu) && (this.m_Account.Shards.Length != 1))) { Engine.UpdateSmartLoginMenu(); } else if (this.m_Account.Shards.Length > 1) { for (int i = 0; i < this.m_Account.Shards.Length; i++) { GMenuItem item2 = this.m_Account.Shards[i].Menu; if (item2 == null) { item.Add(this.m_Account.Shards[i].Menu = item2 = new GShardMenu(this.m_Account.Shards[i])); } else { item2.Text = this.m_Account.Shards[i].Name; } } Gump[] gumpArray = item.Children.ToArray(); for (int j = 0; j < gumpArray.Length; j++) { GShardMenu child = gumpArray[j] as GShardMenu; if ((child != null) && !this.m_Account.Contains(child.Shard)) { item.Remove(child); } } } }