Exemple #1
0
 public Player()
 {
     Name       = "Вася";
     Fraction   = new NamedFraction("Player");
     Renderer   = new TextureRenderer("mage2");
     Controller = new BufferController();
     Abilities.Add(new HealMeditation());
 }
Exemple #2
0
 public override bool OnEnter()
 {
     m_BufferCrl = CurrCtrl.GetComponentInChildren <BufferController> ();
     CurrCtrl.GetComponentInChildren <BeiJi> ().canRelive         = true;
     CurrCtrl.GetComponentInChildren <BeiJi> ().reliveProbability = CurrArgs.m_fValue1;
     CurrCtrl.GetComponentInChildren <BeiJi> ().reliveHP          = CurrArgs.m_fValue2;
     return(true);
 }
	public HeroData()
	{
		property = new HeroProperty ();
        equipmentList = new EquipmentList();
        realmList = new HeroRealm();
		skillList = new SkillManager();
		bufferController = new BufferController();
		battle = -1;
        level = 1;
	}
Exemple #4
0
 public override bool OnEnter()
 {
     if (CurrArgs.m_bUsePercent)
     {
         CurrCtrl.GetComponentInChildren <HealthState> ().AddHp((int)(CurrCtrl.GetComponentInChildren <HealthState> ().FullHp *CurrArgs.m_fValue1));
     }
     else
     {
         CurrCtrl.GetComponentInChildren <HealthState> ().AddHp((int)(CurrArgs.m_fValue1));
     }
     lastTime    = CurrArgs.m_ContinuousTime;
     m_BufferCrl = CurrCtrl.GetComponentInChildren <BufferController> ();
     return(true);
 }
Exemple #5
0
 public override bool OnEnter()
 {
     m_BufferCrl = CurrCtrl.GetComponentInChildren <BufferController> ();
     CurrCtrl.GetComponentInChildren <HealthState> ().AddDefenseEvent((int)-CurrArgs.m_fValue1, 0, 0);
     if (CurrArgs.m_iBufferUI == 1)
     {
         sunderArmorBuff = Resources.Load("MonsterResources/MonsterBuffs/MonsterSunderArmorBuff") as GameObject;
         GameObject temp1 = GameObject.Instantiate(sunderArmorBuff, CurrCtrl.GetComponent <MonsterMessage> ().monsterBody.transform.position, Quaternion.identity) as GameObject;
         temp1.transform.localScale = new Vector3(m_BufferCrl.buffScale, m_BufferCrl.buffScale, 1f);
         temp1.transform.position   = new Vector3(temp1.transform.position.x + m_BufferCrl.xDis, temp1.transform.position.y + m_BufferCrl.yDis, temp1.transform.position.z);
         temp1.transform.SetParent(CurrCtrl.GetComponent <MonsterMessage> ().monsterBody.transform);
     }
     return(true);
 }
Exemple #6
0
 public override bool OnEnter()
 {
     m_BufferCrl = CurrCtrl.GetComponentInChildren <BufferController>();
     hs          = CurrCtrl.GetComponentInChildren <HealthState>();
     hs.HuDun    = (int)CurrArgs.m_fValue1;
     lastHuDun   = hs.HuDun;
     if (CurrArgs.m_iBufferUI == 1)
     {
         shieldBuff = Resources.Load("MonsterResources/MonsterBuffs/MonsterShieldBuff1") as GameObject;
         temp       = Object.Instantiate(shieldBuff, CurrCtrl.GetComponent <MonsterMessage>().monsterFoot.transform.position, CurrCtrl.transform.rotation) as GameObject;
         temp.transform.SetParent(CurrCtrl.GetComponent <MonsterMessage>().monsterFoot.transform);
         temp.transform.localScale = new Vector3(m_BufferCrl.buffScale, m_BufferCrl.buffScale, 1f);
     }
     return(true);
 }
 public override bool OnEnter()
 {
     m_BufferCrl = CurrCtrl.GetComponentInChildren <BufferController> ();
     CurrCtrl.GetComponentInChildren <HealthState> ().AddSpeedEvent(0, CurrArgs.m_fValue1);
     CurrCtrl.GetComponentInChildren <HealthState> ().ADDAttackNumEvent((int)CurrArgs.m_fValue2, 0, 0, 0, 0);
     if (CurrArgs.m_iBufferUI == 1)
     {
         rageBuff = Resources.Load("MonsterResources/MonsterBuffs/MonsterRageBuff") as GameObject;
         temp     = GameObject.Instantiate(rageBuff, CurrCtrl.GetComponent <MonsterMessage> ().monsterFoot.transform.position, Quaternion.identity) as GameObject;
         if (CurrCtrl.transform.rotation.y != 0f)
         {
             temp.transform.rotation = new Quaternion(0f, 180f, 0f, 0f);
         }
         temp.transform.SetParent(CurrCtrl.GetComponent <MonsterMessage> ().monsterFoot.transform);
         temp.transform.localScale = new Vector3(m_BufferCrl.buffScale, m_BufferCrl.buffScale, 1f);
         temp.transform.position   = new Vector3(temp.transform.position.x + m_BufferCrl.xDis, temp.transform.position.y + m_BufferCrl.yDis, temp.transform.position.z);
     }
     return(true);
 }
 public override bool OnEnter()
 {
     lastTime    = CurrArgs.m_ContinuousTime;
     m_BufferCrl = CurrCtrl.GetComponentInChildren <BufferController> ();
     if (CurrArgs.m_iBufferUI == 1)
     {
         bleedBuff = Resources.Load("MonsterResources/MonsterBuffs/MonsterFiringBuff") as GameObject;
         temp      = GameObject.Instantiate(bleedBuff, CurrCtrl.GetComponent <MonsterMessage> ().monsterBody.transform.position, Quaternion.identity) as GameObject;
         if (CurrCtrl.transform.rotation.y != 0f)
         {
             temp.transform.rotation = new Quaternion(0f, 180f, 0f, 0f);
         }
         temp.transform.SetParent(CurrCtrl.GetComponent <MonsterMessage> ().monsterBody.transform);
         temp.transform.position   = new Vector3(temp.transform.position.x + m_BufferCrl.xDis, temp.transform.position.y + m_BufferCrl.yDis, temp.transform.position.z);
         temp.transform.localScale = new Vector3(m_BufferCrl.buffScale, m_BufferCrl.buffScale, 1f);
     }
     CurrCtrl.GetComponentInChildren <BeiJi> ().OnSubHp(CurrArgs.m_iValue1, new Color(1f, 0.5f, 0f, 1f));
     return(true);
 }
Exemple #9
0
        public override int Read(byte[] buffer, int offset, int count)
        {
            if (_streamToCompress == null)
            {
                throw new ObjectDisposedException(typeof(ZipOutputStream).Name);
            }
            if (buffer == null)
            {
                throw new ArgumentNullException("buffer");
            }
            if (offset < 0)
            {
                throw new ArgumentOutOfRangeException("offset", "Cannot be negative.");
            }
            if (count < 0)
            {
                throw new ArgumentOutOfRangeException("count", "Cannot be negative.");
            }
            if (offset + count > buffer.Length)
            {
                throw new ArgumentException("The sum of offset and count is greater than the byte array length.");
            }

            _bufferController = new BufferController(buffer, offset, count);
            _backlogs         = _bufferController.Append(_backlogs).ToList();
            while (_bufferController.Availability > 0 && !_eof)
            {
                var bytesRead = _streamToCompress.Read(_buffer, 0, _buffer.Length);
                if (bytesRead == 0)
                {
                    CompressedStream.CloseEntry();
                    CompressedStream.Close();
                    _eof = true;
                }
                else
                {
                    CompressedStream.Write(_buffer, 0, bytesRead);
                    CompressedStream.Flush();
                }
            }
            return(_bufferController.Count);
        }
 public override bool OnEnter()
 {
     m_BufferCrl = CurrCtrl.GetComponentInChildren <BufferController> ();
     CurrCtrl.GetComponentInChildren <HealthState> ().AddSpeedEvent(0, -CurrArgs.m_fValue1);
     if (CurrArgs.m_iBufferUI == 1)
     {
         speedBuff = Resources.Load("MonsterResources/MonsterBuffs/MonsterSlowDownBuff") as GameObject;
         temp      = GameObject.Instantiate(speedBuff, CurrCtrl.GetComponent <MonsterMessage> ().monsterFoot.transform.position, Quaternion.identity) as GameObject;
         temp.transform.SetParent(CurrCtrl.GetComponent <MonsterMessage> ().monsterFoot.transform);
         temp.transform.localScale = new Vector3(m_BufferCrl.buffScale, m_BufferCrl.buffScale, 1f);
         temp.transform.position   = new Vector3(temp.transform.position.x + m_BufferCrl.xDis, temp.transform.position.y + m_BufferCrl.yDis, temp.transform.position.z);
     }
     else if (CurrArgs.m_iBufferUI == 2)
     {
         speedBuff = Resources.Load("MonsterResources/MonsterBuffs/MonsterCrystalBuff") as GameObject;
         temp      = GameObject.Instantiate(speedBuff, CurrCtrl.GetComponent <MonsterMessage> ().monsterBody.transform.position, Quaternion.identity) as GameObject;
         temp.transform.SetParent(CurrCtrl.GetComponent <MonsterMessage> ().monsterBody.transform);
         temp.transform.localScale = new Vector3(m_BufferCrl.buffScale, m_BufferCrl.buffScale, 1f);
         temp.transform.position   = new Vector3(temp.transform.position.x + m_BufferCrl.xDis, temp.transform.position.y + m_BufferCrl.yDis, temp.transform.position.z);
     }
     return(true);
 }
        public void should_publish_data_when_added()
        {
            const int writeCount = 999;
            var consumedValue = 0L;
            var mre = new ManualResetEvent(false);
            var consumeHandler = new ConsumeEventHandler(writeCount, mre);
            _doubleBuffer = new BufferController<Event<long>>(1000, evnt =>
                {
                    consumedValue = evnt.Value;
                    consumeHandler.OnNext(evnt);
                });

            new Thread(() => _doubleBuffer.Start()).Start();

            for (int data = 0; data <= writeCount; data++)
            {
                _doubleBuffer.Add(new Event<long>(data));
            }

            mre.WaitOne();
            Assert.AreEqual(writeCount, consumeHandler.CurrentValue);
        }
        private byte[] ReadInternal(BufferController bufferController)
        {
            switch (_state)
            {
            case CompositeReaderState.RootAggregateOpeningTag:
                _state = _streams.Length > 0 ? CompositeReaderState.MessagePartWrapperOpeningTag : CompositeReaderState.RootAggregateClosingTag;
                return(bufferController.Append(Encoding.UTF8.GetBytes(ROOT_START_TAG)));

            case CompositeReaderState.MessagePartWrapperOpeningTag:
                _state         = CompositeReaderState.MessagePartContent;
                _currentStream = _streams[_currentStreamIndex];
                return(bufferController.Append(Encoding.UTF8.GetBytes(string.Format(CultureInfo.InvariantCulture, INPUT_MESSAGE_PART_START_TAG, _currentStreamIndex))));

            case CompositeReaderState.MessagePartContent:
                // TODO skip possible XmlDeclaration at top of stream
                // TODO convert convert the bytes that have been read to UTF8 if _currentStream is not UTF8
                var bytesRead = bufferController.Append(_currentStream.Read);
                if (bytesRead == 0)
                {
                    _state = CompositeReaderState.MessagePartWrapperClosingTag;
                }
                return(null);

            case CompositeReaderState.MessagePartWrapperClosingTag:
                var bytes = bufferController.Append(Encoding.UTF8.GetBytes(string.Format(CultureInfo.InvariantCulture, INPUT_MESSAGE_PART_END_TAG, _currentStreamIndex)));
                _state = ++_currentStreamIndex < _streams.Length
                                                ? _state = CompositeReaderState.MessagePartWrapperOpeningTag
                                                : CompositeReaderState.RootAggregateClosingTag;
                return(bytes);

            case CompositeReaderState.RootAggregateClosingTag:
                _readCompleted = true;
                return(bufferController.Append(Encoding.UTF8.GetBytes(ROOT_END_TAG)));

            default:
                throw new InvalidOperationException(string.Format("Unexpected state value: {0}.", _state));
            }
        }
Exemple #13
0
        private byte[] ReadInternal(BufferController bufferController)
        {
            switch (_state)
            {
            case CompositeXmlStreamState.RootAggregateOpeningTag:
                _state = _streams.Length > 0 ? CompositeXmlStreamState.MessagePartWrapperOpeningTag : CompositeXmlStreamState.RootAggregateClosingTag;
                return(bufferController.Append(Encoding.UTF8.GetBytes(ROOT_START_TAG)));

            case CompositeXmlStreamState.MessagePartWrapperOpeningTag:
                _state         = CompositeXmlStreamState.MessagePartContent;
                _currentStream = _streams[_currentStreamIndex];
                return(bufferController.Append(Encoding.UTF8.GetBytes(string.Format(CultureInfo.InvariantCulture, INPUT_MESSAGE_PART_START_TAG, _currentStreamIndex))));

            case CompositeXmlStreamState.MessagePartContent:
                var bytesRead = bufferController.Append(_currentStream.Read);
                if (bytesRead == 0)
                {
                    _state = CompositeXmlStreamState.MessagePartWrapperClosingTag;
                }
                return(null);

            case CompositeXmlStreamState.MessagePartWrapperClosingTag:
                var bytes = bufferController.Append(Encoding.UTF8.GetBytes(string.Format(CultureInfo.InvariantCulture, INPUT_MESSAGE_PART_END_TAG, _currentStreamIndex)));
                _state = ++_currentStreamIndex < _streams.Length
                                                ? _state = CompositeXmlStreamState.MessagePartWrapperOpeningTag
                                                : CompositeXmlStreamState.RootAggregateClosingTag;
                return(bytes);

            case CompositeXmlStreamState.RootAggregateClosingTag:
                ReadCompleted = true;
                return(bufferController.Append(Encoding.UTF8.GetBytes(ROOT_END_TAG)));

            default:
                throw new InvalidOperationException($"Unexpected state value: {_state}.");
            }
        }
Exemple #14
0
 public override bool OnEnter()
 {
     m_BufferCrl = CurrCtrl.GetComponentInChildren <BufferController> ();
     CurrCtrl.GetComponentInChildren <BeiJi> ().isInvincible = true;
     return(true);
 }
	void Awake(){
		bufferController = new BufferController();
		Init();
	}
Exemple #16
0
 public override bool OnEnter()
 {
     m_BufferCrl = CurrCtrl.GetComponentInChildren <BufferController> ();
     CurrCtrl.GetComponentInChildren <HealthState>().AddAttackRateNumEvent(0, 0, CurrArgs.m_fValue1, 0);
     return(true);
 }
Exemple #17
0
 public override bool OnEnter()
 {
     m_BufferCrl = CurrCtrl.GetComponentInChildren <BufferController> ();
     CurrCtrl.GetComponentInChildren <BeiJi> ().ChangeInvincibleInfo(true, CurrArgs.m_bValue1, CurrArgs.m_iValue1, CurrArgs.m_bValue2);
     return(true);
 }