Play() public méthode

public Play ( ) : void
Résultat void
Exemple #1
0
    //创建获得金币
    public void ShowGetGold(int gold)
    {
        Debug.Log("------------ShowGetGold------------");
        GComponent words = UIPackage.CreateObject("GameUI", "HurtInfo").asCom;
        WordsInfo  wd    = AddWordsInfo(words);

        wd.RandomX(-30, 30);

        //words.z = 0;
        //1,直接加到GRoot显示出来
        GRoot.inst.AddChild(words);
        GRoot.inst.SetChildIndex(words, 1);
        words.GetChild("num").asTextField.text            = "" + gold;
        words.GetChild("num").asTextField.color           = new Color(245 / 255.0f, 218 / 255.0f, 0);
        words.GetChild("num").asTextField.shadowOffset    = new Vector2(1, 1);
        words.GetChild("num").asTextField.textFormat.bold = true;
        FairyGUI.Transition trans = words.GetTransition("getgold");
        trans.Play();
        trans.SetHook("over", () => {
            RemoveWordsInfo(wd);
        });

        //音效
        AudioManager.Am.Play3DSound(AudioManager.Sound_Gold, this.Mode.transform.position);
    }
    void __play(GComponent target)
    {
        _btnGroup.visible = false;
        GRoot.inst.AddChild(target);
        FairyGUI.Transition t = target.GetTransition("t0");

        t.Play(() =>
        {
            _btnGroup.visible = true;
            GRoot.inst.RemoveChild(target);
        });
    }
Exemple #3
0
        void __addedToStage()
        {
            int cnt = _transitions.Count;

            for (int i = 0; i < cnt; ++i)
            {
                Transition trans = _transitions[i];
                if (trans.autoPlay)
                {
                    trans.Play(trans.autoPlayRepeat, trans.autoPlayDelay, null);
                }
            }
        }
 void __play4()
 {
     _btnGroup.visible = false;
     _g4.x             = GRoot.inst.width - _g4.width - 20;
     _g4.y             = 100;
     GRoot.inst.AddChild(_g4);
     FairyGUI.Transition t = _g4.GetTransition("t0");
     t.Play(3, 0, () =>
     {
         _btnGroup.visible = true;
         GRoot.inst.RemoveChild(_g4);
     });
 }
    static int Play(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                FairyGUI.Transition obj = (FairyGUI.Transition)ToLua.CheckObject <FairyGUI.Transition>(L, 1);
                obj.Play();
                return(0);
            }
            else if (count == 2)
            {
                FairyGUI.Transition           obj  = (FairyGUI.Transition)ToLua.CheckObject <FairyGUI.Transition>(L, 1);
                FairyGUI.PlayCompleteCallback arg0 = (FairyGUI.PlayCompleteCallback)ToLua.CheckDelegate <FairyGUI.PlayCompleteCallback>(L, 2);
                obj.Play(arg0);
                return(0);
            }
            else if (count == 4)
            {
                FairyGUI.Transition obj = (FairyGUI.Transition)ToLua.CheckObject <FairyGUI.Transition>(L, 1);
                int   arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
                float arg1 = (float)LuaDLL.luaL_checknumber(L, 3);
                FairyGUI.PlayCompleteCallback arg2 = (FairyGUI.PlayCompleteCallback)ToLua.CheckDelegate <FairyGUI.PlayCompleteCallback>(L, 4);
                obj.Play(arg0, arg1, arg2);
                return(0);
            }
            else if (count == 6)
            {
                FairyGUI.Transition obj = (FairyGUI.Transition)ToLua.CheckObject <FairyGUI.Transition>(L, 1);
                int   arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
                float arg1 = (float)LuaDLL.luaL_checknumber(L, 3);
                float arg2 = (float)LuaDLL.luaL_checknumber(L, 4);
                float arg3 = (float)LuaDLL.luaL_checknumber(L, 5);
                FairyGUI.PlayCompleteCallback arg4 = (FairyGUI.PlayCompleteCallback)ToLua.CheckDelegate <FairyGUI.PlayCompleteCallback>(L, 6);
                obj.Play(arg0, arg1, arg2, arg3, arg4);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.Transition.Play"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
        override protected void Enter(Controller controller)
        {
            Transition trans = controller.parent.GetTransition(transitionName);

            if (trans != null)
            {
                if (_currentTransition != null && _currentTransition.playing)
                {
                    trans.ChangePlayTimes(playTimes);
                }
                else
                {
                    trans.Play(playTimes, delay, null);
                }
                _currentTransition = trans;
            }
        }
Exemple #7
0
    public static void NoticeWordsAnim(string word, Google.Protobuf.Collections.RepeatedField <string> p, string anim, int pos = 1)
    {
        // pos 1上 2中 3下
        var showpos = Tool.GetPosition(0.5f, 0.2f);

        if (pos == 1)
        {
            showpos = Tool.GetPosition(0.5f, 0.2f);
        }
        else if (pos == 2)
        {
            showpos = Tool.GetPosition(0.5f, 0.5f);
        }
        else if (pos == 3)
        {
            showpos = Tool.GetPosition(0.5f, 0.8f);
        }
        GComponent words = UIPackage.CreateObject("GameUI", "NoticeWords").asCom;

        //1,直接加到GRoot显示出来
        GRoot.inst.AddChild(words);
        //GRoot.inst.SetChildIndex(words, 1);
        words.xy = showpos;// Tool.GetPosition(0.5f, 0.2f);
        //var root = words.GetComponent<FairyGUI.UIPanel>().ui;

        words.GetChild("word").asTextField.text = word;// noticewords.Words;

        if (p != null && p.Count > 0)
        {
            int index = 1;
            foreach (var item in p)
            {
                Debug.Log("---------------NoticeWords:" + item);
                words.GetChild("word").asTextField.SetVar("p" + index, item);
                index++;
            }
            words.GetChild("word").asTextField.FlushVars();
        }


        FairyGUI.Transition trans = words.GetTransition(anim);
        trans.Play();
        trans.SetHook("over", () => {
            words.Dispose();
        });
    }
    void __play5()
    {
        _btnGroup.visible = false;
        _g5.x             = 20;
        _g5.y             = GRoot.inst.height - _g5.height - 100;
        GRoot.inst.AddChild(_g5);
        FairyGUI.Transition t = _g5.GetTransition("t0");
        _startValue = 10000;
        int add = UnityEngine.Random.Range(1000, 3000);

        _endValue = _startValue + add;
        _g5.GetChild("value").text     = "" + _startValue;
        _g5.GetChild("add_value").text = "" + add;
        t.Play(() =>
        {
            _btnGroup.visible = true;
            GRoot.inst.RemoveChild(_g5);
        });
    }
 static public int Play(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             FairyGUI.Transition self = (FairyGUI.Transition)checkSelf(l);
             self.Play();
             pushValue(l, true);
             return(1);
         }
         else if (argc == 2)
         {
             FairyGUI.Transition           self = (FairyGUI.Transition)checkSelf(l);
             FairyGUI.PlayCompleteCallback a1;
             LuaDelegation.checkDelegate(l, 2, out a1);
             self.Play(a1);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 4)
         {
             FairyGUI.Transition self = (FairyGUI.Transition)checkSelf(l);
             System.Int32        a1;
             checkType(l, 2, out a1);
             System.Single a2;
             checkType(l, 3, out a2);
             FairyGUI.PlayCompleteCallback a3;
             LuaDelegation.checkDelegate(l, 4, out a3);
             self.Play(a1, a2, a3);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #10
0
    //创建miss
    public void ShowMiss()
    {
        Debug.Log("------------ShowMiss------------");
        //var words = (GameObject)(GameObject.Instantiate(Resources.Load("UIPref/HurtWords")));
        //words.transform.parent = m_Mode.transform.parent;
        //words.transform.position = m_Mode.transform.position + new Vector3(0, m_MeshHeight, -0.1f);
        GComponent words = UIPackage.CreateObject("GameUI", "HurtInfo").asCom;
        WordsInfo  wd    = AddWordsInfo(words);

        wd.RandomX(-30, 30);

        //words.z = 0;
        //1,直接加到GRoot显示出来
        GRoot.inst.AddChild(words);
        GRoot.inst.SetChildIndex(words, 1);
        //var root = words.GetComponent<FairyGUI.UIPanel>().ui;
        words.GetChild("num").asTextField.text  = "miss";
        words.GetChild("num").asTextField.color = new Color(1.0f, 1.0f, 1.0f);
        FairyGUI.Transition trans = words.GetTransition("up");
        trans.Play();
        trans.SetHook("over", () => {
            RemoveWordsInfo(wd);
        });
    }
Exemple #11
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 #12
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 #13
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 #14
0
    //创建伤害数字
    public void CreateHurtWords(Protomsg.MsgPlayerHurt hurt)
    {
        //Vector2 pt = World2FairyUIPoint();
        //pt.x += UnityEngine.Random.Range(-30, 30);
        //如果是加钻石
        //Debug.Log("------CreateHurtWords:" + hurt);
        if (hurt.GetDiamond > 0)
        {
            ShowGetDiamond(hurt.GetDiamond);
            return;
        }

        //如果是加金币
        if (hurt.GetGold > 0)
        {
            ShowGetGold(hurt.GetGold);
            return;
        }



        GComponent words = UIPackage.CreateObject("GameUI", "HurtInfo").asCom;
        WordsInfo  wd    = AddWordsInfo(words);

        wd.RandomX(-30, 30);

        //1,直接加到GRoot显示出来
        GRoot.inst.AddChild(words);
        GRoot.inst.SetChildIndex(words, 1);
        //words.xy = pt;
        words.GetChild("num").asTextField.text = hurt.HurtAllValue + "";
        if (this == GameScene.Singleton.GetMyMainUnit())
        {
            //自己受伤
            if (hurt.HurtAllValue < 0)
            {
                FairyGUI.Transition trans = words.GetTransition("down");
                trans.Play();
                trans.SetHook("over", () => {
                    RemoveWordsInfo(wd);
                });
            }
            else//加血
            {
                words.GetChild("num").asTextField.color = new Color(0.1f, 1.0f, 0.1f);
                FairyGUI.Transition trans = words.GetTransition("up");
                trans.Play();
                trans.SetHook("over", () => {
                    RemoveWordsInfo(wd);
                    //GameObject.Destroy(words);
                });
            }
        }
        else
        {
            //伤害别人
            if (hurt.IsCrit != 1)
            {
                words.GetChild("num").asTextField.color = new Color(1.0f, 1.0f, 1.0f);
            }
            FairyGUI.Transition trans = words.GetTransition("up");
            trans.Play();
            trans.SetHook("over", () => {
                RemoveWordsInfo(wd);
                //words.Dispose();
                //GameObject.Destroy(words);
            });
        }
    }
Exemple #15
0
    public static void PaoMaDeng(string word, Google.Protobuf.Collections.RepeatedField <string> p)
    {
        //处理文字
        Dictionary <string, string> pa = new Dictionary <string, string>();

        if (p != null && p.Count > 0)
        {
            int index = 1;
            foreach (var item in p)
            {
                pa["p" + index] = item;
                index++;
            }
        }
        word = Tool.ParseTemplate(word, pa);

        if (PaoMaDengCom == null)
        {
            PaoMaDengCom = UIPackage.CreateObject("GameUI", "PaoMaDeng").asCom;
            GRoot.inst.AddChild(PaoMaDengCom);
            PaoMaDengCom.xy = Tool.GetPosition(0.5f, 0.2f);

            PaoMaDengCom.GetChild("word").asTextField.text = word;


            FairyGUI.Transition trans = PaoMaDengCom.GetTransition("move2left");

            var speed    = 200.0f;
            var distanse = 800 + PaoMaDengCom.GetChild("word").width;
            var time     = distanse / speed;
            trans.SetValue("over", -PaoMaDengCom.GetChild("word").width, 5);
            trans.SetDuration("start", time);

            trans.Play();
            LastPlayTime = GetTime();
            trans.SetHook("over", () => {
                PaoMaDengCom.Dispose();
                PaoMaDengCom = null;
            });
        }
        else
        {
            var lasttext = PaoMaDengCom.GetChild("word").asTextField.text;
            PaoMaDengCom.GetChild("word").asTextField.text = " ";
            for (;;)
            {
                if (PaoMaDengCom.GetChild("word").width >= 800)
                {
                    break;
                }
                PaoMaDengCom.GetChild("word").asTextField.text += " ";
            }
            var space = PaoMaDengCom.GetChild("word").asTextField.text;
            PaoMaDengCom.GetChild("word").asTextField.text = lasttext + space + word;
            FairyGUI.Transition trans = PaoMaDengCom.GetTransition("move2left");
            //trans.SetPaused(true);
            var speed    = 200.0f;
            var distanse = 800 + PaoMaDengCom.GetChild("word").width;
            Debug.Log("distanse:" + distanse);
            var time = distanse / speed;
            trans.SetValue("over", -PaoMaDengCom.GetChild("word").width, 5);
            trans.SetDuration("start", time);
            trans.SetHook("over", null);

            trans.Play(1, 0, (float)(GetTime() - LastPlayTime), time, null);
            trans.SetHook("over", () => {
                PaoMaDengCom.Dispose();
                PaoMaDengCom = null;
            });
            //trans.SetPaused(false);
        }
    }
    static int Play(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.Transition)))
            {
                FairyGUI.Transition obj = (FairyGUI.Transition)ToLua.ToObject(L, 1);
                obj.Play();
                return(0);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.Transition), typeof(FairyGUI.PlayCompleteCallback)))
            {
                FairyGUI.Transition           obj  = (FairyGUI.Transition)ToLua.ToObject(L, 1);
                FairyGUI.PlayCompleteCallback arg0 = null;
                LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

                if (funcType2 != LuaTypes.LUA_TFUNCTION)
                {
                    arg0 = (FairyGUI.PlayCompleteCallback)ToLua.ToObject(L, 2);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 2);
                    arg0 = DelegateFactory.CreateDelegate(typeof(FairyGUI.PlayCompleteCallback), func) as FairyGUI.PlayCompleteCallback;
                }

                obj.Play(arg0);
                return(0);
            }
            else if (count == 4 && TypeChecker.CheckTypes(L, 1, typeof(FairyGUI.Transition), typeof(int), typeof(float), typeof(FairyGUI.PlayCompleteCallback)))
            {
                FairyGUI.Transition obj = (FairyGUI.Transition)ToLua.ToObject(L, 1);
                int   arg0 = (int)LuaDLL.lua_tonumber(L, 2);
                float arg1 = (float)LuaDLL.lua_tonumber(L, 3);
                FairyGUI.PlayCompleteCallback arg2 = null;
                LuaTypes funcType4 = LuaDLL.lua_type(L, 4);

                if (funcType4 != LuaTypes.LUA_TFUNCTION)
                {
                    arg2 = (FairyGUI.PlayCompleteCallback)ToLua.ToObject(L, 4);
                }
                else
                {
                    LuaFunction func = ToLua.ToLuaFunction(L, 4);
                    arg2 = DelegateFactory.CreateDelegate(typeof(FairyGUI.PlayCompleteCallback), func) as FairyGUI.PlayCompleteCallback;
                }

                obj.Play(arg0, arg1, arg2);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.Transition.Play"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Exemple #17
0
 public void PlayEffect(float delay)
 {
     this.visible = false;
     _trans.Play(1, delay, null);
 }