コード例 #1
0
        /// <exception cref="System.IO.IOException"></exception>
        public virtual void WriteBlobTo(Transaction trans, BlobImpl blob)
        {
            MsgBlob msg = (MsgBlob)Msg.ReadBlob.GetWriterForInt(trans, (int)GetID(blob));

            msg._blob = blob;
            ProcessBlobMessage(msg);
        }
コード例 #2
0
ファイル: BlobProcessor.cs プロジェクト: pondyond/db4o
 internal virtual void Add(MsgBlob msg)
 {
     lock (queue)
     {
         queue.Add(msg);
     }
 }
コード例 #3
0
    public void AddNewBlob(MatchMsg msg, bool bHome)
    {
        MsgBlob msgBlob = new MsgBlob();

        GameObject newBtn = NGUITools.AddChild(gameObject, m_goBlob);

        TweenAlpha.Begin(newBtn, m_dispearTime, 0.0f);

        newBtn.SetActive(true);
        msgBlob.goBtn = newBtn;
        msgBlob.msg   = msg;
        msgBlob.bHome = bHome;

        UILabel uiLabel = newBtn.GetComponentInChildren <UILabel>();

        uiLabel.text = msg.pop_text;

        if (m_goBlobs.Count == 3)
        {
            MsgBlob lastMsgBlob = m_goBlobs[2];
            m_goBlobs.Remove(lastMsgBlob);
            Destroy(lastMsgBlob.goBtn);
        }
        m_goBlobs.Insert(0, msgBlob);
        m_bNeedRefresh = true;
    }
コード例 #4
0
        /// <exception cref="System.IO.IOException"></exception>
        public virtual void ReadBlobFrom(Transaction trans, BlobImpl blob)
        {
            MsgBlob msg = null;

            lock (Lock())
            {
                Store(blob);
                int id = (int)GetID(blob);
                msg       = (MsgBlob)Msg.WriteBlob.GetWriterForInt(trans, id);
                msg._blob = blob;
                blob.SetStatus(Status.Queued);
            }
            ProcessBlobMessage(msg);
        }
コード例 #5
0
 internal virtual void ProcessBlobMessage(MsgBlob msg)
 {
     lock (_blobLock)
     {
         bool needStart = _blobTask == null || _blobTask.IsTerminated();
         if (needStart)
         {
             _blobTask = new BlobProcessor(this);
         }
         _blobTask.Add(msg);
         if (needStart)
         {
             ThreadPool().StartLowPriority("Blob processor task", _blobTask);
         }
     }
 }
コード例 #6
0
ファイル: BlobProcessor.cs プロジェクト: pondyond/db4o
 public virtual void Run()
 {
     try
     {
         var     socket = stream.CreateParallelSocket();
         MsgBlob msg    = null;
         // no blobLock synchronisation here, since our first msg is valid
         lock (queue)
         {
             msg = (MsgBlob)queue.Next();
         }
         while (msg != null)
         {
             msg.Write(socket);
             msg.ProcessClient(socket);
             lock (stream._blobLock)
             {
                 lock (queue)
                 {
                     msg = (MsgBlob)queue.Next();
                 }
                 if (msg == null)
                 {
                     terminated = true;
                     Msg.CloseSocket.Write(socket);
                     try
                     {
                         socket.Close();
                     }
                     catch (Exception)
                     {
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         Runtime.PrintStackTrace(e);
     }
 }
コード例 #7
0
    void Update()
    {
        if (m_bNeedRefresh)
        {
            if (m_goBlobs.Count > 1)
            {
                for (int idx = 1; idx != m_goBlobs.Count; ++idx)
                {
                    MsgBlob    msgblob = m_goBlobs[idx];
                    GameObject blob    = msgblob.goBtn;
                    Vector3    target  = blob.transform.localPosition;

                    if (msgblob.bHome)
                    {
                        target.x -= m_blobWitdh;
                    }
                    else
                    {
                        target.x += m_blobWitdh;
                    }


                    TweenPosition.Begin(blob, m_moveTime, target).method = UITweener.Method.EaseOut;
                }
            }

            foreach (MsgBlob msgBlob in m_goBlobs)
            {
                if (msgBlob.bHome)
                {
                    continue;
                }
                UISprite uiBlob = msgBlob.goBtn.GetComponent <UISprite>();
                uiBlob.flip = UIBasicSprite.Flip.Horizontally;
            }

            m_bNeedRefresh = false;
        }
    }