public void Awake()
        {
            ReferenceCollector rc = this.GetEntity <UI>().GameObject.GetComponent <ReferenceCollector>();

            GameObject quitButton   = rc.Get <GameObject>("QuitButton");
            GameObject readyButton  = rc.Get <GameObject>("ReadyButton");
            GameObject multiplesObj = rc.Get <GameObject>("Multiples");

            multiples = multiplesObj.GetComponent <Text>();
            //绑定事件
            quitButton.GetComponent <Button>().onClick.Add(OnQuit);
            readyButton.GetComponent <Button>().onClick.Add(OnReady);

            //默认隐藏UI
            multiplesObj.SetActive(false);
            readyButton.SetActive(false);
            rc.Get <GameObject>("Desk").SetActive(false);

            //添加玩家面板
            GameObject gamersPanel = rc.Get <GameObject>("Gamers");

            GamersPanel.Enqueue(gamersPanel.Get <GameObject>("Local"));
            GamersPanel.Enqueue(gamersPanel.Get <GameObject>("Left"));
            GamersPanel.Enqueue(gamersPanel.Get <GameObject>("Right"));
        }
        public void ExecuteAllMessage_Basic()
        {
            var q = new EQueue <MyMessage>();

            for (var i = 0; i < 10; i++)
            {
                q.Enqueue(new MyMessage(i + 1));
            }
            var stateResults = q.ExecuteAllMessages();

            DS.Assert.AreEqual(DS.List(MessageExecution.Succeeded, MessageExecution.Succeeded, MessageExecution.Succeeded, MessageExecution.Succeeded, MessageExecution.Succeeded, MessageExecution.Succeeded, MessageExecution.Succeeded, MessageExecution.Succeeded, MessageExecution.Succeeded, MessageExecution.Succeeded), stateResults);

            Assert.AreEqual(00, q.Count);
            Assert.AreEqual(10, stateResults.Count);
            Assert.AreEqual(10, q.SucceededMessages.Count);
            Assert.AreEqual(00, q.FailedMessages.Count);
            Assert.AreEqual(00, q.FailedMessages.Count);

            for (var i = 0; i < 10; i++)
            {
                var m = q.SucceededMessages.Dequeue();
                Assert.AreEqual(MessageState.Processed, m.State);
                Assert.IsTrue(m.EndProcessed >= m.StartProcessed);
                Assert.IsTrue(m.Dequeued >= m.Queued);
            }
        }
Beispiel #3
0
        public override void Unspawn(IPoolObject obj)
        {
            if (null == obj)
            {
                return;
            }

            obj.OnUnspawn();
            mQueue.Enqueue((T)obj);
        }
Beispiel #4
0
        public void Unspawn(T obj)
        {
            if (null == obj)
            {
                return;
            }

            obj.OnUnspawn();
            mQueue.Enqueue(obj);
        }
        public void PersisteOneMessage()
        {
            var q = new EQueue <MyMessage>(new jsonDb.FileSystemStore());

            q.Enqueue(new MyMessage(0));
        }