123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- using UnityEngine;
- using FairyGUI.Utils;
- namespace FairyGUI
- {
-
-
-
- public class GMovieClip : GObject, IAnimationGear, IColorGear
- {
- MovieClip _content;
- EventListener _onPlayEnd;
- public GMovieClip()
- {
- }
- override protected void CreateDisplayObject()
- {
- _content = new MovieClip();
- _content.gOwner = this;
- _content.ignoreEngineTimeScale = true;
- displayObject = _content;
- }
-
-
-
- public EventListener onPlayEnd
- {
- get { return _onPlayEnd ?? (_onPlayEnd = new EventListener(this, "onPlayEnd")); }
- }
-
-
-
- public bool playing
- {
- get { return _content.playing; }
- set
- {
- _content.playing = value;
- UpdateGear(5);
- }
- }
-
-
-
- public int frame
- {
- get { return _content.frame; }
- set
- {
- _content.frame = value;
- UpdateGear(5);
- }
- }
-
-
-
- public Color color
- {
- get { return _content.color; }
- set
- {
- _content.color = value;
- UpdateGear(4);
- }
- }
-
-
-
- public FlipType flip
- {
- get { return _content.graphics.flip; }
- set { _content.graphics.flip = value; }
- }
-
-
-
- public Material material
- {
- get { return _content.material; }
- set { _content.material = value; }
- }
-
-
-
- public string shader
- {
- get { return _content.shader; }
- set { _content.shader = value; }
- }
-
-
-
- public float timeScale
- {
- get { return _content.timeScale; }
- set { _content.timeScale = value; }
- }
-
-
-
- public bool ignoreEngineTimeScale
- {
- get { return _content.ignoreEngineTimeScale; }
- set { _content.ignoreEngineTimeScale = value; }
- }
-
-
-
- public void Rewind()
- {
- _content.Rewind();
- }
-
-
-
-
- public void SyncStatus(GMovieClip anotherMc)
- {
- _content.SyncStatus(anotherMc._content);
- }
-
-
-
-
- public void Advance(float time)
- {
- _content.Advance(time);
- }
-
-
-
-
-
-
-
-
- public void SetPlaySettings(int start, int end, int times, int endAt)
- {
- ((MovieClip)displayObject).SetPlaySettings(start, end, times, endAt);
- }
- override public void ConstructFromResource()
- {
- this.gameObjectName = packageItem.name;
-
- PackageItem contentItem = packageItem.getBranch();
- sourceWidth = contentItem.width;
- sourceHeight = contentItem.height;
- initWidth = sourceWidth;
- initHeight = sourceHeight;
- contentItem = contentItem.getHighResolution();
- contentItem.Load();
- _content.interval = contentItem.interval;
- _content.swing = contentItem.swing;
- _content.repeatDelay = contentItem.repeatDelay;
- _content.frames = contentItem.frames;
- SetSize(sourceWidth, sourceHeight);
- }
- override public void Setup_BeforeAdd(ByteBuffer buffer, int beginPos)
- {
- base.Setup_BeforeAdd(buffer, beginPos);
- buffer.Seek(beginPos, 5);
- if (buffer.ReadBool())
- _content.color = buffer.ReadColor();
- _content.graphics.flip = (FlipType)buffer.ReadByte();
- _content.frame = buffer.ReadInt();
- _content.playing = buffer.ReadBool();
- }
- }
- }
|