Esempio n. 1
0
        public bool HandleKeyUpEvent(UnityEngine.Event ev)
        {
            if (!IsSFInitialized())
            {
                return(false);
            }

            bool handled = false;

            SFKey.Code cd = SFKey.GetSFKeyCode(ev.keyCode);
            SFKeyModifiers.Modifiers modifiers = SFKey.GetSFModifiers(ev.modifiers);
            for (int i = 0; i < SFMovieList.Count; i++) // Loop through List with for
            {
                if (SFMovieList[i].HandleKeyEvent(cd, modifiers, 0))
                {
                    handled = true;
                }
            }
            return(handled);
        }
Esempio n. 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;
        }
 public UnityButtonToSFKey(String unityButton, SFKey.Code sfKeyCode)
 {
     UnityButton = unityButton;
     SFKeyCode	= sfKeyCode;
 }
    // Overload for handling keyup event from GamePad
    public bool HandleKeyUpEvent(SFKey.Code code, SFKeyModifiers.Modifiers mod = 0, int keyboardIndex = 0)
    {
        if (!IsSFInitialized())
        {
            return false;
        }

        bool handled = false;
        for (int i = 0; i < SFMovieList.Count; i++) // Loop through List with for
        {
            if (SFMovieList[i].HandleKeyEvent(code, mod, 0, keyboardIndex))
            {
                handled = true;
            }
        }

        return handled;
    }