A() { Type t = GetType(); if (!all_shared.TryGetValue(t, out Shared) { Shared = new SharedType(); all_shared.Add(t, Shared); } }
//public float attackForce = 0; public float GetData(SharedType type) { switch (type) { case SharedType.HP: return(hp); case SharedType.MP: return(mp); } return(0); }
static void Main(string[] args) { var fixedmap = new FixedAddressTypesMap(0x0032e2000); var holder = fixedmap.GetOrAddType <SharedType>(); var testobject = new SharedType(); Console.WriteLine(testobject.ToString()); using (var sender = new SharedMemoryManager <SharedType>(typeof(SharedType).FullName, 1024)) using (var reciever = new SharedMemoryManager <string>(typeof(string).FullName, 1024)) { var tosend = new SharedType(); tosend.SetX(100); holder.AsSharedType(tosend); sender.ShareObject(tosend); var obj = reciever.ReceiveObject(); Console.WriteLine("{0}", obj); Console.ReadKey(); } }
public ISharedResponse ReturnValue(SharedType Type) { return(Cache[Type]); }