コード例 #1
0
        public SFManager(SFInitParams initParams)
        {
            SFInitParams2 initParams2    = new SFInitParams2(initParams);
            int           initParamsSize = Marshal.SizeOf(typeof(SFInitParams2));
            int           sfValueSize    = Marshal.SizeOf(typeof(Value));

            // initParams2.Print();
            IntPtr pdata = Marshal.AllocCoTaskMem(initParamsSize);

            Marshal.StructureToPtr(initParams2, pdata, false);
            String version = Application.unityVersion;

            SFInitialized = false;
            if (SF_Init(pdata, initParamsSize, version) == -1)
            {
                UnityEngine.Debug.Log("Error in Scaleform Manager Initialization. There could be a problem with marshaling structure members");
                return;
            }
            SF_LoadFontConfig(GetScaleformContentPath() + "FontConfig/");
            AllocateSharedData();
            SF_SetSharedData(pCommandOffset, pCommandQueue, 0);
            SF_SetSharedData(pValueOffset, pValueQueue, 1);
            SF_SetSharedData(pASOutputOffset, pASOutput, 2);

            Marshal.DestroyStructure(pdata, typeof(SFInitParams));

            SFMovieList = new List <Movie>();

            MarkForReleaseIDs    = new List <long>();
            MarkForReleaseValues = new List <IntPtr>();
            LifecycleEventsList  = new List <SFLifecycleEvent>();
            pValues_PreAllocated = Marshal.AllocCoTaskMem(sfValueSize * NumPreAllocatedValues);

            SFKey.CreateKeyDictionary();
            SFInitialized = true;
        }
コード例 #2
0
 public SFManager(SFInitParams initParams)
 {
     SFInitParams2 initParams2   = new SFInitParams2(initParams);
     int initParamsSize          = Marshal.SizeOf(typeof(SFInitParams2));
     int sfValueSize             = Marshal.SizeOf(typeof(Value));
     
     // initParams2.Print();
     IntPtr pdata = Marshal.AllocCoTaskMem(initParamsSize);
     Marshal.StructureToPtr(initParams2, pdata, false);
     String version = Application.unityVersion;
     SFInitialized = false;
     if (SF_Init(pdata, initParamsSize, version) == -1)
     {
         UnityEngine.Debug.Log("Error in Scaleform Manager Initialization. There could be a problem with marshaling structure members");
         return;
     }
     SF_LoadFontConfig(GetScaleformContentPath() + "FontConfig/");
     AllocateSharedData();
     SF_SetSharedData(pCommandOffset, pCommandQueue, 0);
     SF_SetSharedData(pValueOffset, pValueQueue, 1);  
     SF_SetSharedData(pASOutputOffset, pASOutput, 2);
     
     Marshal.DestroyStructure(pdata, typeof(SFInitParams));
     
     SFMovieList = new List<Movie>();
     
     MarkForReleaseIDs           = new List<long>();
     MarkForReleaseValues        = new List<IntPtr>();
     LifecycleEventsList         = new List<SFLifecycleEvent>();
     pValues_PreAllocated        = Marshal.AllocCoTaskMem(sfValueSize * NumPreAllocatedValues);
     
     SFKey.CreateKeyDictionary();
     SFInitialized = true;
 }