示例#1
0
    public Canvas LoadCanvas()
    {
        Canvas ret = null;

        do
        {
            string     path = "GUIRoot";
            GameObject go   = this.FindUIRes(path);
            if (null == go)
            {
                ZLog.E(null, "no canvas {0}", path);
                break;
            }

            GameObject ins = GameObject.Instantiate(go) as GameObject;
            if (ins == null)
            {
                ZLog.E(null, "{0} Instantiate canvas fail", path);
                break;
            }
            ins.name = path;
            var cs = ins.transform.Find("Canvas");
            ZLog.I(null, "Load{0} ok", path);
            ret = cs.GetComponent <Canvas>();
        }while(false);
        return(ret);
    }
示例#2
0
    static public LuaTable CreateIns(GameObject go, LuaTable lua_class, LuaTable param)
    {
        LuaTable ret = null;

        do
        {
            LuaNormalBehaiour mb = go.AddComponent <LuaNormalBehaiour>();
            if (null == mb)
            {
                ZLog.E(go, "create {0} err", lua_class);
                break;
            }
            ret = mb.OnCreate(lua_class, param);
        }while(false);
        return(ret);
    }
示例#3
0
    static public LuaTable Attach(GameObject go, string stript_name, LuaTable param)
    {
        LuaTable ret = null;

        do
        {
            LuaNormalBehaiour mb = go.AddComponent <LuaNormalBehaiour>();
            if (null == mb)
            {
                ZLog.E(go, "create {0} err", stript_name);
                break;
            }
            ret = mb.OnLoad(stript_name, param);
        }while(false);
        return(ret);
    }
示例#4
0
    public override bool DoInit()
    {
        bool ret = false;

        do
        {
            _btn1 = GetElement <Button>("Btn1");
            if (null == _btn1)
            {
                ZLog.E(Trans, "no Btn1");
                break;
            }

            _btn2 = GetElement <Button>("Btn2");
            if (null == _btn2)
            {
                ZLog.E(Trans, "no Btn2");
                break;
            }

            _btn3 = GetElement <Button>("Btn3");
            if (null == _btn2)
            {
                ZLog.E(Trans, "no Btn3");
                break;
            }

            _btn4 = GetElement <Button>("Btn4");
            if (null == _btn2)
            {
                ZLog.E(Trans, "no Btn4");
                break;
            }

            _text = GetElement <Text>("Text");
            if (null == _text)
            {
                ZLog.E(Trans, "no text");
                break;
            }
            ret = true;
        } while (false);
        return(ret);
    }
示例#5
0
    public bool  InitZipFile(string zipfile)
    {
        bool ret = false;

        do
        {
            if (_luaZip != null)
            {
                ZLog.E(null, "cant reinit zipfile ");
                break;
            }

            if (!File.Exists(zipfile))
            {
                ZLog.E(null, "zipfile {0} not exist", zipfile);
                break;
            }
            _luaZip = new ZipFile(zipfile);
            ret     = true;
        }while(false);
        return(ret);
    }
示例#6
0
    public override bool DoInit()
    {
        bool ret = false;

        do
        {
            btnCall = GetElement <Button>("btnCall");
            if (null == btnCall)
            {
                ZLog.E(Trans, "no btnCall");
                break;
            }

            iptMethod = GetElement <InputField>("iptMethod");
            if (null == iptMethod)
            {
                ZLog.E(Trans, "no iptMethod");
                break;
            }

            iptParam = GetElement <InputField>("iptParam");
            if (null == iptParam)
            {
                ZLog.E(Trans, "no iptParam");
                break;
            }

            txtResult = GetElement <Text>("txtResult");
            if (null == txtResult)
            {
                ZLog.E(Trans, "no txtResult");
                break;
            }

            ret = true;
        } while (false);
        return(ret);
    }
示例#7
0
    public override bool DoInit()
    {
        bool ret = false;

        do
        {
            btnSend = GetElement <Button>("btnSend");
            if (null == btnSend)
            {
                ZLog.E(Trans, "no btnSend");
                break;
            }

            iptFight = GetElement <InputField>("iptFight");
            if (null == iptFight)
            {
                ZLog.E(Trans, "no iptFight");
                break;
            }

            ret = true;
        } while (false);
        return(ret);
    }
示例#8
0
 public void OnErr(ErrorEventArgs e)
 {
     ZLog.E(this, "Err:[{0}] {1}", e.Message, e.Exception);
 }
示例#9
0
    //void OnErr(ErrorEventArgs e)

    public void OnDisconnect(int reason, string str)
    {
        ZLog.E(this, "disconnect [{0}] {1}", reason, str);
    }