コード例 #1
0
 private void Update()
 {
     if (!this.inited)
     {
         this.hMappingHandle = ZyShareMem.OpenFileMapping(4, false, this.memName);
         if (this.hMappingHandle == IntPtr.Zero)
         {
             Debug.Log("打开共享内存失败:");
             return;
         }
         this.hVoid = ZyShareMem.MapViewOfFile(this.hMappingHandle, 4u, 0u, 0u, (uint)Marshal.SizeOf(this.m_gameSharedDef));
         if (this.hVoid == IntPtr.Zero)
         {
             Debug.Log("文件映射失败——读共享内存");
             return;
         }
         //Debug.Log("共享内存Run");
         this.inited = true;
     }
     if (this.inited)
     {
         this.m_gameSharedDef = (GameSharedDef)this.ReadFromMemory(this.m_gameSharedDef.GetType());
         this.m_vectorAngExp  = this.m_gameSharedDef.Angle;
         //Debug.Log("游戏状态:" + m_gameSharedDef.GameStatus);
         //Debug.Log("读取角度 X:" + m_vectorAngExp.X + " Y:" + m_vectorAngExp.Y + " Z:" + m_vectorAngExp.Z);
     }
 }
コード例 #2
0
 private void Awake()
 {
     CLMemory.m_Instance             = this;
     this.m_vectorAngExp             = default(VectorAngExp);
     this.m_vectorAngExp.X           = 0f;
     this.m_vectorAngExp.Y           = 0f;
     this.m_vectorAngExp.Z           = 0f;
     this.m_gameSharedDef            = default(GameSharedDef);
     this.m_gameSharedDef.Angle      = this.m_vectorAngExp;
     this.m_gameSharedDef.GameStatus = 0;
 }