void GenerateItem(AgentTrust a) { AgentButton scrollItem = Instantiate(_agentButton); scrollItem.transform.SetParent(_scrollContent.transform, false); scrollItem._agentTrust = a; }
private void OnAgentButtonListenerPressed (AgentButton button, InterruptPort port, AgentButtonState state, DateTime time) { var previousPressedButtons = GetPressedButtons (); m_ButtonToStateMap[button] = state; var currentPressedButtons = GetPressedButtons (); if (OnButtonStateChange == null) return; // no listeners OnButtonStateChange (previousPressedButtons, currentPressedButtons, button, state, time); }
public void StopListeningTo (AgentButton b) { if (!m_WatchedButtons.Contains (b)) return; // already not watching lock (m_Lock) { if (!m_WatchedButtons.Contains (b)) return; // already not watching m_WatchedButtons.Remove (b); var ip = (InterruptPort) m_InterruptPortIdToInterruptPortMap[(Cpu.Pin) b]; if (ip == null) return; m_InterruptPortIdToInterruptPortMap.Remove ((Cpu.Pin) b); ip.OnInterrupt -= m_InterruptHandler; ip.Dispose (); } }
public bool IsListeningTo (AgentButton button) { return m_WatchedButtons.Contains (button); }
public void StartListeningTo (AgentButton b) { if (m_WatchedButtons.Contains (b)) return; // already being watched lock (m_Lock) { if (m_WatchedButtons.Contains (b)) return; // already being watched m_WatchedButtons[b] = b; var ip = new InterruptPort ((Cpu.Pin) b, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth); m_InterruptPortIdToInterruptPortMap[ip.Id] = ip; ip.OnInterrupt += m_InterruptHandler; } }