에 추가 I는 다음과 같습니다 몇 가지 코드가 있습니다는 요소는 또 다른 사전 (C 번호 + XNA)
public static class Control
{
public static Dictionary<PlayerIndex, GamePadState> gamePadState = new Dictionary<PlayerIndex,GamePadState>();
public static Dictionary<PlayerIndex, GamePadState> oldGamePadState = new Dictionary<PlayerIndex, GamePadState>();
public static void UpdateControlls()
{
gamePadState.Clear();
foreach (PlayerIndex pIndex in pIndexArray)
{ gamePadState.Add(pIndex,GamePad.GetState(pIndex)); }
}
}
내가 디버그에있는 코드를 보면서을 나는 oldGamePadState.Add (...)를 호출하지 않았지만, gamePadState.Add (...);라고도 불렀다.
이 경우인지 확인하려면'.Add()'줄에 중단 점을 넣고 Object.ReferenceEquals()를 평가하십시오 (http://msdn.microsoft.com/en-us/library/system.object .referenceequals.aspx)를 사용하여 두 사전 참조가 같은지 확인하십시오. – Bevan