public override void Initialize() { World.Instance.ActiveMapRenderer.Visible = true; if (!Game.Components.Contains(World.Instance.ActiveMapRenderer)) { Game.Components.Add(World.Instance.ActiveMapRenderer); } World.Instance.ActiveCharacterRenderer.Visible = true; DateTime usageTracking = DateTime.Now; clockTimer = new Timer(threadState => { if ((DateTime.Now - usageTracking).TotalMinutes >= 1) { World.Instance.MainPlayer.ActiveCharacter.Stats.SetUsage(World.Instance.MainPlayer.ActiveCharacter.Stats.usage + 1); usageTracking = DateTime.Now; } string fmt = string.Format("{0,2:D2}:{1,2:D2}:{2,2:D2}", DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); lock (clockLock) clockLabel.Text = fmt; if (statusStartTime.HasValue && (DateTime.Now - statusStartTime.Value).TotalMilliseconds > 3000) { SetStatusLabel(""); m_statusRecentlySet = false; statusStartTime = null; } }, null, 0, 1000); //the draw orders are adjusted for child items in the constructor. //calling SetParent will break this. inventory = new EOInventory(pnlInventory, m_packetAPI); stats = new EOCharacterStats(pnlStats); stats.Initialize(); for (int i = 0; i < mainBtn.Length; ++i) { int offset = i; //prevent access to modified closure warning mainBtn[i].OnMouseOver += (o, e) => { if (!m_statusRecentlySet) { SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_BUTTON, DATCONST2.STATUS_LABEL_HUD_BUTTON_HOVER_FIRST + offset); m_statusRecentlySet = false; } }; } SessionStartTime = DateTime.Now; m_fnListener = new FunctionKeyListener(); Game.Components.Add(m_fnListener); base.Initialize(); }
protected override void Dispose(bool disposing) { if (disposing) { m_packetAPI.Dispose(); foreach (XNAButton btn in mainBtn) { btn.Close(); } newsTab.Dispose(); inventory.Dispose(); chatRenderer.Dispose(); stats.Dispose(); filler.Dispose(); if (modeTexture != null) { modeTexture.Dispose(); } SpriteBatch.Dispose(); pnlInventory.Close(); pnlActiveSpells.Close(); pnlPassiveSpells.Close(); pnlChat.Close(); pnlStats.Close(); pnlOnline.Close(); pnlParty.Close(); pnlSettings.Close(); chatTextBox.Dispose(); statusLabel.Dispose(); m_friendList.Dispose(); m_ignoreList.Dispose(); m_expInfo.Dispose(); m_questInfo.Dispose(); lock (clockLock) { clockTimer.Change(Timeout.Infinite, Timeout.Infinite); clockTimer.Dispose(); clockLabel.Dispose(); } if (m_muteTimer != null) { m_muteTimer.Change(Timeout.Infinite, Timeout.Infinite); m_muteTimer.Dispose(); m_muteTimer = null; } if (m_fnListener != null) { m_fnListener.Dispose(); m_fnListener = null; } } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (disposing) { m_packetAPI.Dispose(); foreach (XNAButton btn in mainBtn) btn.Close(); newsTab.Dispose(); inventory.Dispose(); chatRenderer.Dispose(); stats.Dispose(); filler.Dispose(); if (modeTexture != null) modeTexture.Dispose(); SpriteBatch.Dispose(); pnlInventory.Close(); pnlActiveSpells.Close(); pnlPassiveSpells.Close(); pnlChat.Close(); pnlStats.Close(); pnlOnline.Close(); pnlParty.Close(); pnlSettings.Close(); chatTextBox.Dispose(); statusLabel.Dispose(); m_friendList.Dispose(); m_ignoreList.Dispose(); m_expInfo.Dispose(); m_questInfo.Dispose(); lock (clockLock) { clockTimer.Change(Timeout.Infinite, Timeout.Infinite); clockTimer.Dispose(); clockLabel.Dispose(); } if (m_muteTimer != null) { m_muteTimer.Change(Timeout.Infinite, Timeout.Infinite); m_muteTimer.Dispose(); m_muteTimer = null; } if (m_fnListener != null) { m_fnListener.Dispose(); m_fnListener = null; } } base.Dispose(disposing); }
public override void Initialize() { World.Instance.ActiveMapRenderer.Visible = true; if (!Game.Components.Contains(World.Instance.ActiveMapRenderer)) Game.Components.Add(World.Instance.ActiveMapRenderer); World.Instance.ActiveCharacterRenderer.Visible = true; DateTime usageTracking = DateTime.Now; clockTimer = new Timer(threadState => { if ((DateTime.Now - usageTracking).TotalMinutes >= 1) { World.Instance.MainPlayer.ActiveCharacter.Stats.SetUsage(World.Instance.MainPlayer.ActiveCharacter.Stats.usage + 1); usageTracking = DateTime.Now; } string fmt = string.Format("{0,2:D2}:{1,2:D2}:{2,2:D2}", DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); lock(clockLock) clockLabel.Text = fmt; if (statusStartTime.HasValue && (DateTime.Now - statusStartTime.Value).TotalMilliseconds > 3000) { SetStatusLabel(""); m_statusRecentlySet = false; statusStartTime = null; } }, null, 0, 1000); //the draw orders are adjusted for child items in the constructor. //calling SetParent will break this. inventory = new EOInventory(pnlInventory, m_packetAPI); stats = new EOCharacterStats(pnlStats); stats.Initialize(); for (int i = 0; i < mainBtn.Length; ++i) { int offset = i; //prevent access to modified closure warning mainBtn[i].OnMouseOver += (o, e) => { if (!m_statusRecentlySet) { SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_BUTTON, DATCONST2.STATUS_LABEL_HUD_BUTTON_HOVER_FIRST + offset); m_statusRecentlySet = false; } }; } SessionStartTime = DateTime.Now; m_fnListener = new FunctionKeyListener(); Game.Components.Add(m_fnListener); base.Initialize(); }