public void Start() { DontDestroyOnLoad(this.gameObject); SFMgr = new SFManager(InitParams); if (SFMgr.IsSFInitialized()) { GamePad = new SFGamepad(SFMgr); GamePad.Init(); //SFMgr.InstallDelegates(); InitParams.Print(); #if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR GL.IssuePluginEvent(0); #elif UNITY_IPHONE || UNITY_ANDROID UnityRenderEvent(0); #endif GL.InvalidateState(); } // Figure out if gamepad is connected. GamepadConnected = false; if (Input.GetJoystickNames().Length != 0) { GamepadConnected = true; } }
public RTTMovie(SFManager sfmgr, SFMovieCreationParams cp) : base(sfmgr, cp) { SFMgr = sfmgr; this.SetFocus(true); InstanceList.Add(this); }
public override void Init(SFGFxMovieManager _parent, SFManager _sfMgr, SFMovieCreationParams _cp) { base.Init(_parent, _sfMgr, _cp); GameSettingsXmlModel = GameSettingsXmlManager.Instance.GameSettingsModel; bSaveHandle = true; e = Event.current; }
public SFMovieCreationParams CreateMovieCreationParams(string swfName, Byte[] swfBytes, Color32 bgColor, bool overrideBackgroundColor) { int ox = 0; int oy = 0; int width = 0; int height = 0; GetViewport(ref ox, ref oy, ref width, ref height); Int32 length = 0; IntPtr pDataUnManaged = IntPtr.Zero; if (swfBytes != null) { length = swfBytes.Length; } if (length > 0) { pDataUnManaged = new IntPtr(); pDataUnManaged = Marshal.AllocCoTaskMem((int)length); Marshal.Copy(swfBytes, 0, pDataUnManaged, (int)length); } String swfPath = SFManager.GetScaleformContentPath() + swfName; return(new SFMovieCreationParams(swfPath, ox, oy, width, height, pDataUnManaged, length, false, bgColor, overrideBackgroundColor, ScaleModeType.SM_ShowAll, true)); }
public override void Init(SFGFxMovieManager _parent, SFManager _sfMgr, SFMovieCreationParams _cp) { base.Init(_parent, _sfMgr, _cp); this.SetFocus(true); // SetViewport(0, 0, 500, 600); }
public Movie(SFManager sfmgr, SFMovieCreationParams creationParams) { if (sfmgr == null) { MovieID = 0; return; } MovieName = creationParams.MovieName; ViewPort.OX = creationParams.OX; ViewPort.OY = creationParams.OY; ViewPort.Width = creationParams.Width; ViewPort.Height = creationParams.Height; pDataUnmanaged = creationParams.pData; MovieID = 0; // Assigned when the C++ Movie is created. MarkForRelease = false; SFMgr = sfmgr; IsFocused = false; AdvanceWhenGamePaused = false; IsAutoManageViewport = creationParams.IsAutoManageViewport; TheScaleModeType = creationParams.TheScaleModeType; int cpSize = Marshal.SizeOf(typeof(SFMovieCreationParams)); IntPtr pdata = Marshal.AllocCoTaskMem(cpSize); Marshal.StructureToPtr(creationParams, pdata, false); MovieID = SF_CreateMovie(pdata); Marshal.DestroyStructure(pdata, typeof(SFMovieCreationParams)); if (MovieID != -1) { SFMgr.AddMovie(this); } }
public override void Init(SFGFxMovieManager _parent, SFManager _sfMgr, SFMovieCreationParams _cp) { base.Init(_parent, _sfMgr, _cp); MobaSchemesManager = GameMobaSchemesManager.Instance; bIsFloat = true; }
protected virtual void Start() { if (!Application.isPlaying) { return; } SF_SetKey(Key.Key); //For GL based platforms - Sets a number to use for Unity specific texture management. Adjust this number if //you start to experience black and/or missing textures. SF_SetTextureCount(500); DontDestroyOnLoad(this.gameObject); SFMgr = new SFManager(InitParams); if (SFMgr.IsSFInitialized()) { InitParams.Print(); GL.IssuePluginEvent(0); GL.InvalidateState(); } Movie = createMovie(); if (WhenToRender == RenderTime.EndOfFrame) { StartCoroutine("CallPluginAtEndOfFrame"); } }
// Use this for initialization public MenuMovie(SFCamera parent, SFManager sfmgr, SFMovieCreationParams cp) : base(sfmgr, cp) { this.parent = parent; SFMgr = sfmgr; this.SetFocus(true); }
///////////////////////////////////////////////////////////////// public override void Init(SFGFxMovieManager _parent, SFManager _sfMgr, SFMovieCreationParams _cp) //:base(_sfMgr, _cp) { base.Init(_parent, _sfMgr, _cp); SFMgr = _sfMgr; EntityFactory.SetEntityNumPropHandler(OnCommand_UpdateNumProp); }
public RenderTextureDemo(SFManager sfmgr, SFMovieCreationParams cp) : base(sfmgr, cp) { SFMgr = sfmgr; this.SetFocus(true); instance = this; }
public override void Init(SFGFxMovieManager _parent, SFManager _sfMgr, SFMovieCreationParams _cp) { base.Init(_parent, _sfMgr, _cp); MyInvokeQ = new InvokeQ(); bCanSyncTickCount = true; EventManager.Subscibe(this, EVENT.ENTITY_SHOW_HERO, 0); }
public ScaleformMovie(ScaleformLayer layer, SFManager sfmgr, SFMovieCreationParams creationParams) : base(sfmgr, creationParams) { Layer = layer; SFManager = sfmgr; SetFocus(true); }
public static SFMovieCreationParams CreateRTTMovieCreationParams(string swfName, int RTToX, int RTToY, RenderTexture texture, Color32 clearColor) { // Used for Android only Int32 length = 0; IntPtr pDataUnManaged = IntPtr.Zero; String SwfPath = SFManager.GetScaleformContentPath() + swfName; return(new SFMovieCreationParams(SwfPath, RTToX, RTToY, texture.width, texture.height, pDataUnManaged, length, false, texture, clearColor, true, ScaleModeType.SM_ShowAll, true)); }
public override void Init(SFGFxMovieManager _parent, SFManager _sfMgr, SFMovieCreationParams _cp) { base.Init(_parent, _sfMgr, _cp); bCanSyncTickCount = true; _propertyValue.Add(ENTITY_PROPERTY.PROPERTY_PA, 0); _propertyValue.Add(ENTITY_PROPERTY.PROPERTY_MA, 0); _propertyValue.Add(ENTITY_PROPERTY.PROPERTY_PD, 0); _propertyValue.Add(ENTITY_PROPERTY.PROPERTY_MD, 0); _propertyValue.Add(ENTITY_PROPERTY.PROPERTY_AF, 0); _propertyValue.Add(ENTITY_PROPERTY.PROPERTY_PCT_COOL_REDUCE, 0); _propertyValue.Add(ENTITY_PROPERTY.PROPERTY_CRC, 0); _propertyValue.Add(ENTITY_PROPERTY.PROPERTY_SD, 0); }
public override void Init(SFGFxMovieManager _parent, SFManager _sfMgr, SFMovieCreationParams _cp) { bCanSyncTickCount = true; base.Init(_parent, _sfMgr, _cp); SFGFxMovieManager.Instance.AddMovieToIgnoreHitTestList(this); //TimerManager.SetTimer(this, (int)EN_GameHud_Timer.ENGT_Pointer, 0.5f); //EventManager.Subscibe(this, EVENT.ENTITY_SHOW_HERO, 0); }
public ScaleformMovie(SFManager sfmgr, SFMovieCreationParams cp) : base(sfmgr, cp) { beginValues = new Value[3]; moveValues = new Value[3]; endValues = new Value[1]; cancelValues = new Value[1]; SetFocus(true); }
public override void Init(SFGFxMovieManager _parent, SFManager _sfMgr, SFMovieCreationParams _cp) { _instance = this; base.Init(_parent, _sfMgr, _cp); InitAspectRatio(); if (UBBPropertyInstance == null) { Trace.LogError("获取UBBProperty单实例失败"); return; } UBBPropertyInstance.PropertyUBB(); }
public Value GetObject() { int SFValueSize = Marshal.SizeOf(typeof(Value)); IntPtr ptr2 = Marshal.AllocCoTaskMem(SFValueSize); SF_GetObject(this, ptr2); // This value will be garbage collected as well. Value val = SFManager.GetValueData(ptr2); Marshal.FreeCoTaskMem(ptr2); return(val); }
public static SFMovieCreationParams CreateMovieCreationParams(string swfName, Color32 bgColor, bool overrideBackgroundColor) { Int32 length = 0; int ox = 0; int oy = 0; int width = 0; int height = 0; IntPtr pDataUnManaged = IntPtr.Zero; String swfPath = SFManager.GetScaleformContentPath() + swfName; GetViewport(ref ox, ref oy, ref width, ref height); return(new SFMovieCreationParams(swfPath, ox, oy, width, height, pDataUnManaged, length, false, bgColor, overrideBackgroundColor, ScaleModeType.SM_ShowAll, true)); }
protected void Start() { if (Application.isPlaying) { //DontDestroyOnLoad(gameObject); SFMgr = new SFManager(InitParams); SFMgr.Init(); // SFMgr.InstallDelegates(); GL.IssuePluginEvent(0); GL.InvalidateState(); Movie = createMovie(); StartCoroutine(CallPluginAtEndOfFrames()); } }
public void Update() { RenderTexture rtt = (GetComponent("Camera") as Camera).targetTexture; SFCamera camera = Component.FindObjectOfType(typeof(SFCamera)) as SFCamera; if (camera) { SFManager sfManager = camera.GetSFManager(); Movie movie = sfManager.GetTopMovie(); if (movie != null) { #if !(UNITY_3_5) Debug.Log("GetNativeTexturePtr: " + rtt.GetNativeTexturePtr()); sfManager.ReplaceTexture(movie.GetID(), "texture1", rtt); #endif } } }
/// <summary> /// Loads the file into memory as a Byte array. /// </summary> /// <returns> /// Byte array with file contents. /// </returns> /// <param name='filename'> /// A filename relative to the StreamingAssets folder. /// </param> static public Byte[] LoadFileToMemory(string filename) { string filePath = System.IO.Path.Combine(Application.streamingAssetsPath, filename); #if UNITY_ANDROID if (filePath.Contains("jar:file://")) { WWW url = new WWW(filePath); // wait until 'download' finishes while (!url.isDone) { } return(url.bytes); } else #endif { Byte[] fileBytes = null; filePath = SFManager.GetScaleformContentPath() + filename; try { fileBytes = System.IO.File.ReadAllBytes(filePath); //using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read)) //{ // using (BinaryReader reader = new BinaryReader(fileStream)) // { // fileBytes = reader.ReadBytes((int)fileStream.Length); // } //} return(fileBytes); } catch (Exception e) { Debug.Log(String.Format("Loading file failed with message = '{0}'", e.Message)); } } return(null); }
public bool CreateRenderMovie(SFCamera camera, Type movieClassType) { #if !(UNITY_4_0 || UNITY_4_1) && UNITY_STANDALONE_WIN if (SystemInfo.graphicsDeviceVersion[0] == 'D') { return(false); } #endif if (RenderTexture == null) { Debug.Log("RenderTexture is null, failure to create RenderMovie. Check if you specified all the parameters properly."); return(false); } if (RTTMovie == null || RTTMovie.MovieID == 0) { if (camera) { Debug.Log("Creating movie"); SFMovieCreationParams creationParams = SFCamera.CreateRTTMovieCreationParams(SwfName, OriginX, OriginY, RenderTexture, ClearColor); creationParams.TheScaleModeType = ScaleModeType.SM_ExactFit; creationParams.IsInitFirstFrame = true; creationParams.IsAutoManageViewport = false; // Has the user specified a movie subclass? if (movieClassType != null) { SFManager sfMgr = camera.GetSFManager(); RTTMovie = Activator.CreateInstance(movieClassType, sfMgr, creationParams) as Movie; if (RTTMovie != null) { RTTMovie.SetRTT(this); } return(true); } } } return(false); }
public override void Init(SFGFxMovieManager _parent, SFManager _sfMgr, SFMovieCreationParams _cp) { base.Init(_parent, _sfMgr, _cp); SFGFxMovieManager.Instance.AddMovieToIgnoreHitTestList(this); }
public void OnSFManagerDied() { // The SFManager just died, set our reference to null. SFMgr = null; }
public override void Init(SFGFxMovieManager _parent, SFManager _sfMgr, SFMovieCreationParams _cp) { base.Init(_parent, _sfMgr, _cp); // this.TheScaleModeType = ScaleModeType.SM_ShowAll; }
public override void Init(SFGFxMovieManager _parent, SFManager _sfMgr, SFMovieCreationParams _cp) { base.Init(_parent, _sfMgr, _cp); bCanSyncTickCount = true; }
/// <summary> /// Movie constructor, moviedef is created automatically. /// </summary> /// <param name="sfmgr">Scaleform manager.</param> /// <param name="creationParams">Movie creation parameters.</param> public Movie(SFManager sfmgr, SFMovieCreationParams creationParams) { if(sfmgr == null) { MovieID = 0; return; } //1. Set parameters like name and viewport MovieName = creationParams.MovieName; ViewPort.OX = creationParams.OX; ViewPort.OY = creationParams.OY; ViewPort.Width = creationParams.Width; ViewPort.Height = creationParams.Height; pDataUnmanaged = creationParams.pData; Depth = creationParams.Depth; // Rendering order. Movie with Depth + 1 will render on top of Movie with Depth MovieID = 0; // Assigned when the C++ Movie is created. MarkForRelease = false; SFMgr = sfmgr; IsFocused = false; AdvanceWhenGamePaused = false; IsAutoManageViewport = creationParams.IsAutoManageViewport; TheScaleModeType = creationParams.TheScaleModeType; int cpSize = Marshal.SizeOf(typeof(SFMovieCreationParams)); IntPtr pCreationParams = Marshal.AllocCoTaskMem(cpSize); Marshal.StructureToPtr(creationParams, pCreationParams, false); MovieID = SF_CreateMovie(pCreationParams); if(MovieID == 0) { return; } //3. Add into SFManager SFMgr.AddMovie(this); }
public override void Init(SFGFxMovieManager _parent, SFManager _sfMgr, SFMovieCreationParams _cp) { base.Init(_parent, _sfMgr, _cp); }
private void Awake() { rb = GetComponent <Rigidbody>(); SoundManager = GameObject.Find("SFManager").gameObject.transform.GetComponent <SFManager>(); PausedData = GameObject.Find("MenuPause").GetComponent <MenuPause>(); }
public SFGamepad(SFManager sfMgr) { SFMgr = sfMgr; }