示例#1
0
    IEnumerator TestUnload()
    {
        ZLog.D(this, "start coroutine");
        yield return(new WaitForSeconds(_waitSenconds));

        this.DoUnload();
    }
示例#2
0
    void ClickCall(object[] args)
    {
        string req = _component.iptFight.text;

        _download.AddPostData(_url, Encoding.UTF8.GetBytes(req), OnDownloadOk);
        ZLog.D(this, "click button req {0}", req);
    }
示例#3
0
 // Use this for initialization
 void Start()
 {
     //if (Debug.isDebugBuild)
     //    Debug.Log("This is a debug build!");
     ZLog.D(this, "hello");
     ZLog.D(this, "hello message");
     CnUIMgr.Instance.LoadPanelShow <SimplePanel>("panel");
 }
示例#4
0
 public LuaWebSocket(LuaTable sp)
 {
     ZLog.D(null, "in LuaWebSocket");
     Init(this, LuaMain.Ins);
     LuaMain.Ins.quitDl += OnQuit;
     scriptEnv           = sp;
     Register();
 }
示例#5
0
    // Use this for initialization
    void Start()
    {
        ZLog.D(this, "start socket order {0}", this.ZOrder);

        _component._btn1.transform.Find("Text").GetComponent <Text>().text = "connect";
        SetClickEventOnce(_component._btn1, ClickBtnConnet, new object[] { "cnt" });


        _component._btn2.transform.Find("Text").GetComponent <Text>().text = "disconnect";
        SetClickEventOnce(_component._btn2, ClickDisconnet, new object[] { "dis" });

        _component._btn3.transform.Find("Text").GetComponent <Text>().text = "ping";
        SetClickEventOnce(_component._btn3, ClickBtnSendPing, new object[] { "ping" });

        _component._text.text = "init";

        _ws = new ZbyWebSocket(this, this);
    }
示例#6
0
    // Use this for initialization
    void Start()
    {
        ZLog.D(this, "start socket order {0}", this.ZOrder);

        _component._btn1.transform.Find("Text").GetComponent <Text>().text = "connect";
        SetClickEventOnce(_component._btn1, ClickBtnConnet, new object[] { "cnt" });


        _component._btn2.transform.Find("Text").GetComponent <Text>().text = "disconnect";
        SetClickEventOnce(_component._btn2, ClickDisconnet, new object[] { "dis" });

        _component._text.text = "init";

        _socket = new Chat_Socket(this);

        _socket.ChatEvent    += OnRecvChat;
        _socket.ConnectEvent += OnConnetEvent;
        _socket.DisEvent     += OnDisconnectEvent;
    }
示例#7
0
    bool HandleMsg(P32M32Header header, byte[] body, int handleCount)
    {
        ByteBuffer bb = new ByteBuffer(body);

        switch (header.cmd)
        {
        case 3:
        {
            string name    = bb.ReadString();
            string content = bb.ReadString();
            string show    = string.Format("recv [{0}]:{1}", name, content);
            ZLog.D(null, show);
            if (null != ChatEvent)
            {
                ChatEvent(show);
            }
            break;
        }
        }
        return(true);
    }
示例#8
0
    // Start is called before the first frame update
    void Start()
    {
        ZLog.D(this, "start");
        StringBuilder sb = new StringBuilder();

        sb.AppendFormat("absoluteURL:{0}\n", Application.absoluteURL);
        sb.AppendFormat("dataPath:{0}\n", Application.dataPath);
        sb.AppendFormat("consoleLogPath:{0}\n", Application.consoleLogPath);
        sb.AppendFormat("persistentDataPath:{0}\n", Application.persistentDataPath);
        sb.AppendFormat("streamingAssetsPath:{0}\n", Application.streamingAssetsPath);
        sb.AppendFormat("temporaryCachePath:{0}\n", Application.temporaryCachePath);
        sb.AppendFormat("UserDocumentPath:{0}\n", OSTools.GetUserDocumentPath());


        _component.iptFight.text = sb.ToString();
        Text txt = _component.btnSend.GetComponentInChildren <Text>();

        txt.text = "加载配置";
        SetClickEventOnce(_component.btnSend, ClickCall, null);
        //_component.btnSend.Text = "hello";
    }
示例#9
0
    void ClickBtnConnet(object[] args)
    {
        //ZLog.D(this, "click connect args {0}", args[0]);
        string luazip = Application.streamingAssetsPath + "/core.zip";

        using (ZipFile zip = new ZipFile(luazip))
        {
            foreach (ZipEntry entry in zip)
            {
                //ZipFile zipFile = new ZipFile(zipFile.GetInputStream(entry));
                ZLog.D(this, entry.Name);
                using (var stream = zip.GetInputStream(entry))
                {
                    byte[] buffer = new byte[entry.Size];
                    stream.Read(buffer, 0, buffer.Length);
                    ZLog.D(this, "{0}", Encoding.UTF8.GetString(buffer));
                    break;
                    // return true;
                }
            }
        }
    }
示例#10
0
 void ClickBtnConnet(object[] args)
 {
     ZLog.D(this, "click connect args {0}", args[0]);
     _ws.Open(_url);//"ws://localhost:8000/ws"
 }
示例#11
0
 void ClickDisconnet(object[] args)
 {
     ZLog.D(this, "click connect args {0}", args[0]);
     _socket.Close();
 }
示例#12
0
 void ClickCall(object[] args)
 {
     ZLog.D(null, "click button");
     this.DoUnload();
 }
示例#13
0
 public override void OnLoad(params object[] args)
 {
     ZLog.D(null, "onload order {0}", this.ZOrder);
     SetClickEventOnce(_component._btn1, ClickCall, new object[] { "Call java" });
 }
示例#14
0
 //
 public override void OnLoad(params object[] args)
 {
     _waitSenconds = (float)args[0];
     ZLog.D(this, "onload order {0}", this.ZOrder);
 }
示例#15
0
 void ClickBtnSendPing(object[] args)
 {
     ZLog.D(this, "click connect args {0}", args[0]);
     //_ws.ping();
 }
示例#16
0
 // Use this for initialization
 void Start()
 {
     ZLog.D(this, "start order {0}", this.ZOrder);
     this.StartCoroutine("TestUnload");
 }
示例#17
0
 public override void OnLoad(params object[] args)
 {
     ZLog.D(this, "onload order {0}", this.ZOrder);
 }
示例#18
0
 public override void OnTop(CnPanelObj topview) //从后层变到顶层
 {
     ZLog.D(this, "OnTop order {0}", this.ZOrder);
 }
示例#19
0
 void ClickCall(object[] args)
 {
     _method = _component.iptMethod.text;
     _param  = _component.iptParam.text;
     ZLog.D(this, "click button method {0}({1})", _method, _param);
 }
示例#20
0
 public override bool OnUnload()
 {
     ZLog.D(this, "onunload order {0}", this.ZOrder);
     return(true);
 }
示例#21
0
 void OnDownloadOk(WWW www, DownloadData urlData)
 {
     ZLog.D(this, "recv {0}", Encoding.UTF8.GetString(www.bytes));
 }
示例#22
0
 // Start is called before the first frame update
 void Start()
 {
     ZLog.D(this, "in start url {0}", _url);
     SetClickEventOnce(_component.btnSend, ClickCall, new object[] { "Call java" });
     _download = this.gameObject.AddComponent <DownloadQueue>();
 }
示例#23
0
 void ClickBtnConnet(object[] args)
 {
     ZLog.D(this, "click connect args {0}", args[0]);
     _socket.Connect(Host, Port);
 }
示例#24
0
 public override void OnLoad(params object[] args)
 {
     ZLog.D(this, "onload order {0} url {1}", this.ZOrder, args[0]);
     _url = args[0] as String;
 }
示例#25
0
 public override void OnLoad(params object[] args)
 {
     ZLog.D(this, "onload order {0} ip {1}:{2}", this.ZOrder, args[0], args[1]);
     Host = args[0] as String;
     Port = (int)args[1];
 }
示例#26
0
 void Awake()
 {
     ZLog.D(this, "awake");
 }
示例#27
0
 public override void OnBehind(CnPanelObj topview) //从顶层移到后一层
 {
     ZLog.D(this, "OnBehind order {0}", this.ZOrder);
 }
示例#28
0
 // Start is called before the first frame update
 void Start()
 {
     ZLog.D(this, "in start url {0}", _url);
     SetClickEventOnce(_component.btnSend, ClickCall, new object[] { "Call java" });
     _ws = new ZbyWebSocket(this, this);
 }
示例#29
0
 public override void OnLoad(params object[] args)
 {
     _url = args[0] as string;
     ZLog.D(this, "onload order {0}", this.ZOrder);
 }
示例#30
0
 // Use this for initialization
 void Start()
 {
     ZLog.D(this, "start order {0}", this.ZOrder);
     SetClickEventOnce(_component.btnCall, ClickCall, new object[] { "Call java" });
 }