Exemple #1
0
 public TransitionItem()
 {
     easeType   = Ease.OutQuad;
     value      = new TransitionValue();
     startValue = new TransitionValue();
     endValue   = new TransitionValue();
 }
Exemple #2
0
 public void Copy(TransitionValue source)
 {
     this.f1 = source.f1;
     this.f2 = source.f2;
     this.f3 = source.f3;
     this.f4 = source.f4;
     this.b1 = source.b1;
     this.b2 = source.b2;
 }
Exemple #3
0
        public TransitionItem_ColorFilter()
        {
            value      = new TransitionValue();
            startValue = new TransitionValue();
            endValue   = new TransitionValue();

            getter = () => { return(value.AsVec4); };
            setter = (x) => { value.AsVec4 = x; };
        }
Exemple #4
0
        public TransitionItem_Float()
        {
            value      = new TransitionValue();
            startValue = new TransitionValue();
            endValue   = new TransitionValue();

            getter = () => { return(value.f1); };
            setter = (x) => { value.f1 = x; };
        }
Exemple #5
0
        public TransitionItem_Vector2()
        {
            value      = new TransitionValue();
            startValue = new TransitionValue();
            endValue   = new TransitionValue();

            getter = () => { return(value.AsVec2); };
            setter = (x) => { value.AsVec2 = x; };
        }
 static public int get_f3(IntPtr l)
 {
     try {
         FairyGUI.TransitionValue self = (FairyGUI.TransitionValue)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.f3);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #7
0
 public void Copy(TransitionValue source)
 {
     this.f1 = source.f1;
     this.f2 = source.f2;
     this.f3 = source.f3;
     this.i  = source.i;
     this.c  = source.c;
     this.b  = source.b;
     this.s  = source.s;
     this.b1 = source.b1;
     this.b2 = source.b2;
 }
 static public int constructor(IntPtr l)
 {
     try {
         FairyGUI.TransitionValue o;
         o = new FairyGUI.TransitionValue();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_f2(IntPtr l)
 {
     try {
         FairyGUI.TransitionValue self = (FairyGUI.TransitionValue)checkSelf(l);
         System.Single            v;
         checkType(l, 2, out v);
         self.f2 = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int Copy(IntPtr l)
 {
     try {
         FairyGUI.TransitionValue self = (FairyGUI.TransitionValue)checkSelf(l);
         FairyGUI.TransitionValue a1;
         checkType(l, 2, out a1);
         self.Copy(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_c(IntPtr l)
 {
     try {
         FairyGUI.TransitionValue self = (FairyGUI.TransitionValue)checkSelf(l);
         UnityEngine.Color        v;
         checkType(l, 2, out v);
         self.c = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #12
0
        public TransitionItem(Transition owner, TransitionActionType type)
        {
            this.type  = type;
            easeType   = Ease.OutQuad;
            value      = new TransitionValue();
            startValue = new TransitionValue();
            endValue   = new TransitionValue();

            if (type == TransitionActionType.Shake)
            {
                onShake = (object param) => { owner.ShakeItem(this); }
            }
            ;
            else if (type == TransitionActionType.Transition)
            {
                onPlayComplete = () => { owner.PlayTransComplete(this); }
            }
            ;
        }
Exemple #13
0
        void ApplyValue(TransitionItem item, TransitionValue value)
        {
            item.target._gearLocked = true;

            switch (item.type)
            {
            case TransitionActionType.XY:
                if (item.target == _owner)
                {
                    float f1, f2;
                    if (!value.b1)
                    {
                        f1 = item.target.x;
                    }
                    else
                    {
                        f1 = value.f1 + _ownerBaseX;
                    }
                    if (!value.b2)
                    {
                        f2 = item.target.y;
                    }
                    else
                    {
                        f2 = value.f2 + _ownerBaseY;
                    }
                    item.target.SetXY(f1, f2);
                }
                else
                {
                    if (!value.b1)
                    {
                        value.f1 = item.target.x;
                    }
                    if (!value.b2)
                    {
                        value.f2 = item.target.y;
                    }
                    item.target.SetXY(value.f1, value.f2);
                }
                if (invalidateBatchingEveryFrame)
                {
                    _owner.InvalidateBatchingState();
                }
                break;

            case TransitionActionType.Size:
                if (!value.b1)
                {
                    value.f1 = item.target.width;
                }
                if (!value.b2)
                {
                    value.f2 = item.target.height;
                }
                item.target.SetSize(value.f1, value.f2);
                if (invalidateBatchingEveryFrame)
                {
                    _owner.InvalidateBatchingState();
                }
                break;

            case TransitionActionType.Pivot:
                item.target.SetPivot(value.f1, value.f2);
                if (invalidateBatchingEveryFrame)
                {
                    _owner.InvalidateBatchingState();
                }
                break;

            case TransitionActionType.Alpha:
                item.target.alpha = value.f1;
                break;

            case TransitionActionType.Rotation:
                item.target.rotation = value.f1;
                if (invalidateBatchingEveryFrame)
                {
                    _owner.InvalidateBatchingState();
                }
                break;

            case TransitionActionType.Scale:
                item.target.SetScale(value.f1, value.f2);
                if (invalidateBatchingEveryFrame)
                {
                    _owner.InvalidateBatchingState();
                }
                break;

            case TransitionActionType.Skew:
                item.target.skew = new Vector2(value.f1, value.f2);
                if (invalidateBatchingEveryFrame)
                {
                    _owner.InvalidateBatchingState();
                }
                break;

            case TransitionActionType.Color:
                ((IColorGear)item.target).color = value.c;
                break;

            case TransitionActionType.Animation:
                if (!value.b1)
                {
                    value.i = ((IAnimationGear)item.target).frame;
                }
                ((IAnimationGear)item.target).frame   = value.i;
                ((IAnimationGear)item.target).playing = value.b;
                break;

            case TransitionActionType.Visible:
                item.target.visible = value.b;
                break;

            case TransitionActionType.Transition:
                Transition trans = ((GComponent)item.target).GetTransition(value.s);
                if (trans != null)
                {
                    if (value.i == 0)
                    {
                        trans.Stop(false, true);
                    }
                    else if (trans.playing)
                    {
                        trans._totalTimes = value.i == -1 ? int.MaxValue : value.i;
                    }
                    else
                    {
                        item.completed = false;
                        _totalTasks++;
                        if (_reversed)
                        {
                            trans.PlayReverse(value.i, 0, () => { __playTransComplete(item); });
                        }
                        else
                        {
                            trans.Play(value.i, 0, () => { __playTransComplete(item); });
                        }
                        if (_timeScale != 1)
                        {
                            trans.timeScale = _timeScale;
                        }
                    }
                }
                break;

            case TransitionActionType.Sound:
                AudioClip sound = UIPackage.GetItemAssetByURL(value.s) as AudioClip;
                if (sound != null)
                {
                    Stage.inst.PlayOneShotSound(sound, value.f1);
                }
                break;

            case TransitionActionType.Shake:
                item.startValue.f1 = 0;                         //offsetX
                item.startValue.f2 = 0;                         //offsetY
                item.startValue.f3 = item.value.f2;             //shakePeriod
                Timers.inst.AddUpdate(item.__Shake, this);
                _totalTasks++;
                item.completed = false;
                break;

            case TransitionActionType.ColorFilter:
                ColorFilter cf = item.target.filter as ColorFilter;
                if (cf == null)
                {
                    cf = new ColorFilter();
                    item.target.filter = cf;
                    item.filterCreated = true;
                }
                else
                {
                    cf.Reset();
                }
                cf.AdjustBrightness(value.f1);
                cf.AdjustContrast(value.f2);
                cf.AdjustSaturation(value.f3);
                cf.AdjustHue(value.f4);
                break;
            }

            item.target._gearLocked = false;
        }
Exemple #14
0
 public void Copy(TransitionValue source)
 {
     this.f1 = source.f1;
     this.f2 = source.f2;
     this.f3 = source.f3;
     this.i = source.i;
     this.c = source.c;
     this.b = source.b;
     this.s = source.s;
     this.b1 = source.b1;
     this.b2 = source.b2;
 }
Exemple #15
0
        void DecodeValue(TransitionItem item, string str, TransitionValue value)
        {
            string[] arr;
            switch (item.type)
            {
            case TransitionActionType.XY:
            case TransitionActionType.Size:
            case TransitionActionType.Pivot:
            case TransitionActionType.Skew:
                arr = str.Split(',');
                if (arr[0] == "-")
                {
                    value.b1 = false;
                }
                else
                {
                    value.f1 = float.Parse(arr[0]);
                    value.b1 = true;
                }
                if (arr[1] == "-")
                {
                    value.b2 = false;
                }
                else
                {
                    value.f2 = float.Parse(arr[1]);
                    value.b2 = true;
                }
                break;

            case TransitionActionType.Alpha:
                value.f1 = float.Parse(str);
                break;

            case TransitionActionType.Rotation:
                value.f1 = int.Parse(str);
                break;

            case TransitionActionType.Scale:
                arr      = str.Split(',');
                value.f1 = float.Parse(arr[0]);
                value.f2 = float.Parse(arr[1]);
                break;

            case TransitionActionType.Color:
                value.AsColor = ToolSet.ConvertFromHtmlColor(str);
                break;

            case TransitionActionType.Animation:
                arr = str.Split(',');
                if (arr[0] == "-")
                {
                    ((TransitionItem_Animation)item).frame = -1;
                }
                else
                {
                    ((TransitionItem_Animation)item).frame = int.Parse(arr[0]);
                }
                ((TransitionItem_Animation)item).playing = arr[1] == "p";
                break;

            case TransitionActionType.Visible:
                ((TransitionItem_Visible)item).visible = str == "true";
                break;

            case TransitionActionType.Sound:
                arr = str.Split(',');
                ((TransitionItem_Sound)item).sound = arr[0];
                if (arr.Length > 1)
                {
                    int intv = int.Parse(arr[1]);
                    if (intv == 100 || intv == 0)
                    {
                        ((TransitionItem_Sound)item).volume = 1;
                    }
                    else
                    {
                        ((TransitionItem_Sound)item).volume = (float)intv / 100f;
                    }
                }
                else
                {
                    ((TransitionItem_Sound)item).volume = 1;
                }
                break;

            case TransitionActionType.Transition:
                arr = str.Split(',');
                ((TransitionItem_Transition)item).transName = arr[0];
                if (arr.Length > 1)
                {
                    ((TransitionItem_Transition)item).transRepeat = int.Parse(arr[1]);
                }
                else
                {
                    ((TransitionItem_Transition)item).transRepeat = 1;
                }
                break;

            case TransitionActionType.Shake:
                arr = str.Split(',');
                ((TransitionItem_Shake)item).shakeAmplitude = float.Parse(arr[0]);
                ((TransitionItem_Shake)item).shakePeriod    = float.Parse(arr[1]);
                break;

            case TransitionActionType.ColorFilter:
                arr      = str.Split(',');
                value.f1 = float.Parse(arr[0]);
                value.f2 = float.Parse(arr[1]);
                value.f3 = float.Parse(arr[2]);
                value.f4 = float.Parse(arr[3]);
                break;
            }
        }
Exemple #16
0
        void DecodeValue(TransitionActionType type, string str, TransitionValue value)
        {
            string[] arr;
            switch (type)
            {
                case TransitionActionType.XY:
                case TransitionActionType.Size:
                case TransitionActionType.Pivot:
                    arr = str.Split(jointChar0);
                    if (arr[0] == "-")
                    {
                        value.b1 = false;
                    }
                    else
                    {
                        value.f1 = float.Parse(arr[0]);
                        value.b1 = true;
                    }
                    if (arr[1] == "-")
                    {
                        value.b2 = false;
                    }
                    else
                    {
                        value.f2 = float.Parse(arr[1]);
                        value.b2 = true;
                    }
                    break;

                case TransitionActionType.Alpha:
                    value.f1 = float.Parse(str);
                    break;

                case TransitionActionType.Rotation:
                    value.i = int.Parse(str);
                    break;

                case TransitionActionType.Scale:
                    arr = str.Split(jointChar0);
                    value.f1 = float.Parse(arr[0]);
                    value.f2 = float.Parse(arr[1]);
                    break;

                case TransitionActionType.Color:
                    value.c = ToolSet.ConvertFromHtmlColor(str);
                    break;

                case TransitionActionType.Animation:
                    arr = str.Split(jointChar0);
                    if (arr[0] == "-")
                    {
                        value.b1 = false;
                    }
                    else
                    {
                        value.i = int.Parse(arr[0]);
                        value.b1 = true;
                    }
                    value.b = arr[1] == "p";
                    break;

                case TransitionActionType.Visible:
                    value.b = str == "true";
                    break;

                case TransitionActionType.Controller:
                    value.s = str;
                    break;

                case TransitionActionType.Sound:
                    arr = str.Split(jointChar0);
                    value.s = arr[0];
                    if (arr.Length > 1)
                    {
                        int intv = int.Parse(arr[1]);
                        if (intv == 100 || intv == 0)
                            value.f1 = 1;
                        else
                            value.f1 = (float)intv / 100f;
                    }
                    else
                        value.f1 = 1;
                    break;

                case TransitionActionType.Transition:
                    arr = str.Split(jointChar0);
                    value.s = arr[0];
                    if (arr.Length > 1)
                        value.i = int.Parse(arr[1]);
                    else
                        value.i = 1;
                    break;

                case TransitionActionType.Shake:
                    arr = str.Split(jointChar0);
                    value.f1 = float.Parse(arr[0]);
                    value.f2 = float.Parse(arr[1]);
                    break;
            }
        }
Exemple #17
0
        void ApplyValue(TransitionItem item, TransitionValue value)
        {
            item.target._gearLocked = true;

            switch (item.type)
            {
                case TransitionActionType.XY:
                    if (item.target == _owner)
                    {
                        float f1, f2;
                        if (!value.b1)
                            f1 = item.target.x;
                        else
                            f1 = value.f1 + _ownerBaseX;
                        if (!value.b2)
                            f2 = item.target.y;
                        else
                            f2 = value.f2 + _ownerBaseY;
                        item.target.SetXY(f1, f2);
                    }
                    else
                    {
                        if (!value.b1)
                            value.f1 = item.target.x;
                        if (!value.b2)
                            value.f2 = item.target.y;
                        item.target.SetXY(value.f1, value.f2);
                    }
                    break;

                case TransitionActionType.Size:
                    if (!value.b1)
                        value.f1 = item.target.width;
                    if (!value.b2)
                        value.f2 = item.target.height;
                    item.target.SetSize(value.f1, value.f2);
                    break;

                case TransitionActionType.Pivot:
                    item.target.SetPivot(value.f1, value.f2);
                    break;

                case TransitionActionType.Alpha:
                    item.target.alpha = value.f1;
                    break;

                case TransitionActionType.Rotation:
                    item.target.rotation = value.i;
                    break;

                case TransitionActionType.Scale:
                    item.target.SetScale(value.f1, value.f2);
                    break;

                case TransitionActionType.Color:
                    ((IColorGear)item.target).color = value.c;
                    break;

                case TransitionActionType.Animation:
                    if (!value.b1)
                        value.i = ((IAnimationGear)item.target).frame;
                    ((IAnimationGear)item.target).frame = value.i;
                    ((IAnimationGear)item.target).playing = value.b;
                    break;

                case TransitionActionType.Visible:
                    item.target.visible = value.b;
                    break;

                case TransitionActionType.Controller:
                    string[] arr = value.s.Split(jointChar0);
                    foreach (string str in arr)
                    {
                        string[] arr2 = str.Split(jointChar2);
                        Controller cc = ((GComponent)item.target).GetController(arr2[0]);
                        if (cc != null)
                        {
                            string str2 = arr2[1];
                            if (str2[0] == '$')
                            {
                                str2 = str.Substring(1);
                                cc.selectedPage = str2;
                            }
                            else
                                cc.selectedIndex = int.Parse(str2);
                        }
                    }
                    break;

                case TransitionActionType.Transition:
                    Transition trans = ((GComponent)item.target).GetTransition(value.s);
                    if (trans != null)
                    {
                        if (value.i == 0)
                            trans.Stop(false, true);
                        else if (trans.playing)
                            trans._totalTimes = value.i == -1 ? int.MaxValue : value.i;
                        else
                        {
                            item.completed = false;
                            _totalTasks++;
                            if (_reversed)
                                trans.PlayReverse(value.i, 0, () => { __playTransComplete(item); });
                            else
                                trans.Play(value.i, 0, () => { __playTransComplete(item); });
                        }
                    }
                    break;

                case TransitionActionType.Sound:
                    AudioClip sound = UIPackage.GetItemAssetByURL(value.s) as AudioClip;
                    if (sound != null)
                        Stage.inst.PlayOneShotSound(sound, value.f1);
                    break;

                case TransitionActionType.Shake:
                    item.startValue.f1 = 0; //offsetX
                    item.startValue.f2 = 0; //offsetY
                    item.startValue.f3 = item.value.f2;//shakePeriod
                    Timers.inst.AddUpdate(item.__Shake, this);
                    _totalTasks++;
                    item.completed = false;
                    break;
            }

            item.target._gearLocked = false;
        }
Exemple #18
0
        void DecodeValue(TransitionActionType type, string str, TransitionValue value)
        {
            string[] arr;
            switch (type)
            {
            case TransitionActionType.XY:
            case TransitionActionType.Size:
            case TransitionActionType.Pivot:
                arr = str.Split(',');
                if (arr[0] == "-")
                {
                    value.b1 = false;
                }
                else
                {
                    value.f1 = float.Parse(arr[0]);
                    value.b1 = true;
                }
                if (arr[1] == "-")
                {
                    value.b2 = false;
                }
                else
                {
                    value.f2 = float.Parse(arr[1]);
                    value.b2 = true;
                }
                break;

            case TransitionActionType.Alpha:
                value.f1 = float.Parse(str);
                break;

            case TransitionActionType.Rotation:
                value.i = int.Parse(str);
                break;

            case TransitionActionType.Scale:
                arr      = str.Split(',');
                value.f1 = float.Parse(arr[0]);
                value.f2 = float.Parse(arr[1]);
                break;

            case TransitionActionType.Color:
                value.c = ToolSet.ConvertFromHtmlColor(str);
                break;

            case TransitionActionType.Animation:
                arr = str.Split(',');
                if (arr[0] == "-")
                {
                    value.b1 = false;
                }
                else
                {
                    value.i  = int.Parse(arr[0]);
                    value.b1 = true;
                }
                value.b = arr[1] == "p";
                break;

            case TransitionActionType.Visible:
                value.b = str == "true";
                break;

            case TransitionActionType.Controller:
                value.s = str;
                break;

            case TransitionActionType.Sound:
                arr     = str.Split(',');
                value.s = arr[0];
                if (arr.Length > 1)
                {
                    int intv = int.Parse(arr[1]);
                    if (intv == 100 || intv == 0)
                    {
                        value.f1 = 1;
                    }
                    else
                    {
                        value.f1 = (float)intv / 100f;
                    }
                }
                else
                {
                    value.f1 = 1;
                }
                break;

            case TransitionActionType.Transition:
                arr     = str.Split(',');
                value.s = arr[0];
                if (arr.Length > 1)
                {
                    value.i = int.Parse(arr[1]);
                }
                else
                {
                    value.i = 1;
                }
                break;

            case TransitionActionType.Shake:
                arr      = str.Split(',');
                value.f1 = float.Parse(arr[0]);
                value.f2 = float.Parse(arr[1]);
                break;
            }
        }
Exemple #19
0
        internal void ApplyValue(TransitionItem item, TransitionValue value)
        {
            item.target._gearLocked = true;

            switch (item.type)
            {
            case TransitionActionType.XY:
                if (item.target == _owner)
                {
                    float f1, f2;
                    if (!value.b1)
                    {
                        f1 = item.target.x;
                    }
                    else
                    {
                        f1 = value.f1 + _ownerBaseX;
                    }
                    if (!value.b2)
                    {
                        f2 = item.target.y;
                    }
                    else
                    {
                        f2 = value.f2 + _ownerBaseY;
                    }
                    item.target.SetXY(f1, f2);
                }
                else
                {
                    if (!value.b1)
                    {
                        value.f1 = item.target.x;
                    }
                    if (!value.b2)
                    {
                        value.f2 = item.target.y;
                    }
                    item.target.SetXY(value.f1, value.f2);
                }
                if (invalidateBatchingEveryFrame)
                {
                    _owner.InvalidateBatchingState(true);
                }
                break;

            case TransitionActionType.Size:
                if (!value.b1)
                {
                    value.f1 = item.target.width;
                }
                if (!value.b2)
                {
                    value.f2 = item.target.height;
                }
                item.target.SetSize(value.f1, value.f2);
                if (invalidateBatchingEveryFrame)
                {
                    _owner.InvalidateBatchingState(true);
                }
                break;

            case TransitionActionType.Pivot:
                item.target.SetPivot(value.f1, value.f2);
                if (invalidateBatchingEveryFrame)
                {
                    _owner.InvalidateBatchingState(true);
                }
                break;

            case TransitionActionType.Alpha:
                item.target.alpha = value.f1;
                break;

            case TransitionActionType.Rotation:
                item.target.rotation = value.f1;
                if (invalidateBatchingEveryFrame)
                {
                    _owner.InvalidateBatchingState(true);
                }
                break;

            case TransitionActionType.Scale:
                item.target.SetScale(value.f1, value.f2);
                if (invalidateBatchingEveryFrame)
                {
                    _owner.InvalidateBatchingState(true);
                }
                break;

            case TransitionActionType.Skew:
                item.target.skew = value.AsVec2;
                if (invalidateBatchingEveryFrame)
                {
                    _owner.InvalidateBatchingState(true);
                }
                break;

            case TransitionActionType.Color:
                ((IColorGear)item.target).color = value.AsColor;
                break;

            case TransitionActionType.Animation:
                if (((TransitionItem_Animation)item).frame >= 0)
                {
                    ((IAnimationGear)item.target).frame = ((TransitionItem_Animation)item).frame;
                }
                ((IAnimationGear)item.target).playing = ((TransitionItem_Animation)item).playing;
                break;

            case TransitionActionType.Visible:
                item.target.visible = ((TransitionItem_Visible)item).visible;
                break;

            case TransitionActionType.Transition:
                Transition trans = ((GComponent)item.target).GetTransition(((TransitionItem_Transition)item).transName);
                if (trans != null)
                {
                    int tranRepeat = ((TransitionItem_Transition)item).transRepeat;
                    if (tranRepeat == 0)
                    {
                        trans.Stop(false, true);
                    }
                    else if (trans.playing)
                    {
                        trans._totalTimes = tranRepeat;
                    }
                    else
                    {
                        item.completed = false;
                        _totalTasks++;
                        if (_reversed)
                        {
                            trans.PlayReverse(tranRepeat, 0, ((TransitionItem_Transition)item).playCompleteDelegate);
                        }
                        else
                        {
                            trans.Play(tranRepeat, 0, ((TransitionItem_Transition)item).playCompleteDelegate);
                        }
                        if (_timeScale != 1)
                        {
                            trans.timeScale = _timeScale;
                        }
                    }
                }
                break;

            case TransitionActionType.Sound:
                ((TransitionItem_Sound)item).Play();
                break;

            case TransitionActionType.Shake:
                ((TransitionItem_Shake)item).Start();
                _totalTasks++;
                item.completed = false;
                break;

            case TransitionActionType.ColorFilter:
                ((TransitionItem_ColorFilter)item).SetFilter();
                break;
            }

            item.target._gearLocked = false;
        }
Exemple #20
0
 public TransitionItem()
 {
     easeType = Ease.OutQuad;
     value = new TransitionValue();
     startValue = new TransitionValue();
     endValue = new TransitionValue();
 }
Exemple #21
0
        void ApplyValue(TransitionItem item, TransitionValue value)
        {
            item.target._gearLocked = true;

            switch (item.type)
            {
            case TransitionActionType.XY:
                if (item.target == _owner)
                {
                    float f1, f2;
                    if (!value.b1)
                    {
                        f1 = item.target.x;
                    }
                    else
                    {
                        f1 = value.f1 + _ownerBaseX;
                    }
                    if (!value.b2)
                    {
                        f2 = item.target.y;
                    }
                    else
                    {
                        f2 = value.f2 + _ownerBaseY;
                    }
                    item.target.SetXY(f1, f2);
                }
                else
                {
                    if (!value.b1)
                    {
                        value.f1 = item.target.x;
                    }
                    if (!value.b2)
                    {
                        value.f2 = item.target.y;
                    }
                    item.target.SetXY(value.f1, value.f2);
                }
                break;

            case TransitionActionType.Size:
                if (!value.b1)
                {
                    value.f1 = item.target.width;
                }
                if (!value.b2)
                {
                    value.f2 = item.target.height;
                }
                item.target.SetSize(value.f1, value.f2);
                break;

            case TransitionActionType.Pivot:
                item.target.SetPivot(value.f1, value.f2);
                break;

            case TransitionActionType.Alpha:
                item.target.alpha = value.f1;
                break;

            case TransitionActionType.Rotation:
                item.target.rotation = value.i;
                break;

            case TransitionActionType.Scale:
                item.target.SetScale(value.f1, value.f2);
                break;

            case TransitionActionType.Color:
                ((IColorGear)item.target).color = value.c;
                break;

            case TransitionActionType.Animation:
                if (!value.b1)
                {
                    value.i = ((IAnimationGear)item.target).frame;
                }
                ((IAnimationGear)item.target).frame   = value.i;
                ((IAnimationGear)item.target).playing = value.b;
                break;

            case TransitionActionType.Visible:
                item.target.visible = value.b;
                break;

            case TransitionActionType.Controller:
                string[] arr = value.s.Split(',');
                foreach (string str in arr)
                {
                    string[]   arr2 = str.Split('=');
                    Controller cc   = ((GComponent)item.target).GetController(arr2[0]);
                    if (cc != null)
                    {
                        string str2 = arr2[1];
                        if (str2[0] == '$')
                        {
                            str2            = str.Substring(1);
                            cc.selectedPage = str2;
                        }
                        else
                        {
                            cc.selectedIndex = int.Parse(str2);
                        }
                    }
                }
                break;

            case TransitionActionType.Transition:
                Transition trans = ((GComponent)item.target).GetTransition(value.s);
                if (trans != null)
                {
                    if (value.i == 0)
                    {
                        trans.Stop(false, true);
                    }
                    else if (trans.playing)
                    {
                        trans._totalTimes = value.i == -1 ? int.MaxValue : value.i;
                    }
                    else
                    {
                        item.completed = false;
                        _totalTasks++;
                        if (_reversed)
                        {
                            trans.PlayReverse(value.i, 0, () => { __playTransComplete(item); });
                        }
                        else
                        {
                            trans.Play(value.i, 0, () => { __playTransComplete(item); });
                        }
                    }
                }
                break;

            case TransitionActionType.Sound:
                AudioClip sound = UIPackage.GetItemAssetByURL(value.s) as AudioClip;
                if (sound != null)
                {
                    Stage.inst.PlayOneShotSound(sound, value.f1);
                }
                break;

            case TransitionActionType.Shake:
                item.startValue.f1 = 0;                         //offsetX
                item.startValue.f2 = 0;                         //offsetY
                item.startValue.f3 = item.value.f2;             //shakePeriod
                Timers.inst.AddUpdate(item.__Shake, this);
                _totalTasks++;
                item.completed = false;
                break;
            }

            item.target._gearLocked = false;
        }
Exemple #22
0
        void ApplyValue(TransitionItem item, TransitionValue value)
        {
            item.target._gearLocked = true;

            switch (item.type)
            {
                case TransitionActionType.XY:
                    if (item.target == _owner)
                    {
                        float f1, f2;
                        if (!value.b1)
                            f1 = item.target.x;
                        else
                            f1 = value.f1 + _ownerBaseX;
                        if (!value.b2)
                            f2 = item.target.y;
                        else
                            f2 = value.f2 + _ownerBaseY;
                        item.target.SetXY(f1, f2);
                    }
                    else
                    {
                        if (!value.b1)
                            value.f1 = item.target.x;
                        if (!value.b2)
                            value.f2 = item.target.y;
                        item.target.SetXY(value.f1, value.f2);
                    }
                    if (invalidateBatchingEveryFrame)
                        _owner.InvalidateBatchingState();
                    break;

                case TransitionActionType.Size:
                    if (!value.b1)
                        value.f1 = item.target.width;
                    if (!value.b2)
                        value.f2 = item.target.height;
                    item.target.SetSize(value.f1, value.f2);
                    if (invalidateBatchingEveryFrame)
                        _owner.InvalidateBatchingState();
                    break;

                case TransitionActionType.Pivot:
                    item.target.SetPivot(value.f1, value.f2);
                    if (invalidateBatchingEveryFrame)
                        _owner.InvalidateBatchingState();
                    break;

                case TransitionActionType.Alpha:
                    item.target.alpha = value.f1;
                    break;

                case TransitionActionType.Rotation:
                    item.target.rotation = value.f1;
                    if (invalidateBatchingEveryFrame)
                        _owner.InvalidateBatchingState();
                    break;

                case TransitionActionType.Scale:
                    item.target.SetScale(value.f1, value.f2);
                    if (invalidateBatchingEveryFrame)
                        _owner.InvalidateBatchingState();
                    break;

                case TransitionActionType.Skew:
                    item.target.skew = new Vector2(value.f1, value.f2);
                    if (invalidateBatchingEveryFrame)
                        _owner.InvalidateBatchingState();
                    break;

                case TransitionActionType.Color:
                    ((IColorGear)item.target).color = value.c;
                    break;

                case TransitionActionType.Animation:
                    if (!value.b1)
                        value.i = ((IAnimationGear)item.target).frame;
                    ((IAnimationGear)item.target).frame = value.i;
                    ((IAnimationGear)item.target).playing = value.b;
                    break;

                case TransitionActionType.Visible:
                    item.target.visible = value.b;
                    break;

                case TransitionActionType.Transition:
                    Transition trans = ((GComponent)item.target).GetTransition(value.s);
                    if (trans != null)
                    {
                        if (value.i == 0)
                            trans.Stop(false, true);
                        else if (trans.playing)
                            trans._totalTimes = value.i == -1 ? int.MaxValue : value.i;
                        else
                        {
                            item.completed = false;
                            _totalTasks++;
                            if (_reversed)
                                trans.PlayReverse(value.i, 0, () => { __playTransComplete(item); });
                            else
                                trans.Play(value.i, 0, () => { __playTransComplete(item); });
                            if (_timeScale != 1)
                                trans.timeScale = _timeScale;
                        }
                    }
                    break;

                case TransitionActionType.Sound:
                    AudioClip sound = UIPackage.GetItemAssetByURL(value.s) as AudioClip;
                    if (sound != null)
                        Stage.inst.PlayOneShotSound(sound, value.f1);
                    break;

                case TransitionActionType.Shake:
                    item.startValue.f1 = 0; //offsetX
                    item.startValue.f2 = 0; //offsetY
                    item.startValue.f3 = item.value.f2;//shakePeriod
                    Timers.inst.AddUpdate(item.__Shake, this);
                    _totalTasks++;
                    item.completed = false;
                    break;

                case TransitionActionType.ColorFilter:
                    ColorFilter cf = item.target.filter as ColorFilter;
                    if (cf == null)
                    {
                        cf = new ColorFilter();
                        item.target.filter = cf;
                        item.filterCreated = true;
                    }
                    else
                    {
                        cf.Reset();
                    }
                    cf.AdjustBrightness(value.f1);
                    cf.AdjustContrast(value.f2);
                    cf.AdjustSaturation(value.f3);
                    cf.AdjustHue(value.f4);
                    break;
            }

            item.target._gearLocked = false;
        }