示例#1
0
 public void loadDanmu()
 {
     //address就是文件名。。。
     //这里client会有一个延迟
     danmuList   = client.askDanmuList(BitmapPlayer.address);
     loadedDanmu = 1;
 }
示例#2
0
 public DanmuPlayer(ref DanmakuCurtain a, ref Client client_, ref Grid curtain_)
 {
     dmkCurt     = a;
     curtain     = curtain_;
     client      = client_;
     danmuList   = null;
     loadedDanmu = 0;
 }
        public override DanmuList askDanmuList(string name)
        {
            //server直接读本地就行
            String[]  tmp   = name.Split('\\');
            DanmuList danmu = new DanmuList();

            danmu.readFromFile(tmp[tmp.Length - 1]);
            danmuList = danmu;
            return(danmu);
        }
示例#4
0
        //只有server在监听这个=。=
        public void listen_danmu_server()
        {
            if (Client.isServer == 0)
            {
                return;
            }
            while (true)
            {
                Package pack = conn.recv();
                if (pack == null)
                {
                    continue;
                }
                if (pack.type == "danmu_ask")
                {
                    /*
                     * header:
                     * [0]filename
                     *
                     * return:
                     * data -> serialized danmulist
                     */
                    DanmuList danmuList = new DanmuList();

                    String[] tmp = pack.header[0].Split('\\');

                    danmuList.readFromFile(tmp[tmp.Length - 1]);

                    MemoryStream    stream    = new MemoryStream();
                    BinaryFormatter formatter = new BinaryFormatter();
                    formatter.Serialize(stream, danmuList);

                    byte[] data = stream.ToArray();

                    Package pack_resp = new Package("danmu_resp");
                    pack_resp.data = data;
                    Connector conn_resp = Client.find_conn(Client.conn_danmu_client, pack.from);

                    conn_resp.send(pack_resp);
                }
                else if (pack.type == "danmu_add")
                {
                    /*
                     * header:
                     * [0] filename
                     * [1] num
                     * [2] content
                     *
                     * no need to resp
                     */
                    DanmuList.appendDanmu(Int32.Parse(pack.header[1]), pack.header[2], pack.header[0]);
                }
            }
        }
示例#5
0
 public void stop()
 {
     danmuList = null;
     play.Abort();
 }
 public override void addDamnu(int num, string content)
 {
     //server直接在本地add
     String[] tmp = BitmapPlayer.address.Split('\\');
     DanmuList.appendDanmu(num, content, Local.ref_addr + @"danmu\" + tmp[tmp.Length - 1]);
 }