示例#1
0
        public void AddState(string name, IGameState state)
        {
            EnsureStateLoaded(state);

            States.AddOrUpdate(name, state, (s, gamestate) =>
            {
                return(state);
            });
        }
示例#2
0
 private static HookState GetCurrentState()
 {
     if (States.ContainsKey(Thread.CurrentThread.ManagedThreadId))
     {
         States.TryGetValue(Thread.CurrentThread.ManagedThreadId, out var result);
         return(result);
     }
     else
     {
         var newEntry = new HookState()
         {
             Thread = Thread.CurrentThread,
             Buffer = new byte[8],
             Asm    = new DSAsmCaller()
         };
         States.AddOrUpdate(Thread.CurrentThread.ManagedThreadId, x => newEntry, (k, v) => v);
         return(newEntry);
     }
 }