SetHook() 공개 메소드

public SetHook ( string label, TransitionHook callback ) : void
label string
callback TransitionHook
리턴 void
    static int SetHook(IntPtr L)
    {
        try
        {
            ToLua.CheckArgsCount(L, 3);
            FairyGUI.Transition obj      = (FairyGUI.Transition)ToLua.CheckObject(L, 1, typeof(FairyGUI.Transition));
            string arg0                  = ToLua.CheckString(L, 2);
            FairyGUI.TransitionHook arg1 = null;
            LuaTypes funcType3           = LuaDLL.lua_type(L, 3);

            if (funcType3 != LuaTypes.LUA_TFUNCTION)
            {
                arg1 = (FairyGUI.TransitionHook)ToLua.CheckObject(L, 3, typeof(FairyGUI.TransitionHook));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 3);
                arg1 = DelegateFactory.CreateDelegate(typeof(FairyGUI.TransitionHook), func) as FairyGUI.TransitionHook;
            }

            obj.SetHook(arg0, arg1);
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #2
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);
    }
 static public int SetHook(IntPtr l)
 {
     try {
         FairyGUI.Transition self = (FairyGUI.Transition)checkSelf(l);
         System.String       a1;
         checkType(l, 2, out a1);
         FairyGUI.TransitionHook a2;
         LuaDelegation.checkDelegate(l, 3, out a2);
         self.SetHook(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #4
0
 static int SetHook(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         FairyGUI.Transition obj      = (FairyGUI.Transition)ToLua.CheckObject <FairyGUI.Transition>(L, 1);
         string arg0                  = ToLua.CheckString(L, 2);
         FairyGUI.TransitionHook arg1 = (FairyGUI.TransitionHook)ToLua.CheckDelegate <FairyGUI.TransitionHook>(L, 3);
         obj.SetHook(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #5
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();
        });
    }
예제 #6
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);
        });
    }
예제 #7
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);
        }
    }
예제 #8
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);
            });
        }
    }