예제 #1
0
        //----------------------------------------------------------------
        public Base_Event PopEvent()
        {
            //base_event = null;
            //获取队列首元素;
            if (_firstqueue.Count != 0)
            {
                //优先获取第一优先级队列;
                base_event = _firstqueue.Dequeue();
            }
            else
            {
                if (_secondqueue.Count != 0)
                {
                    base_event = _secondqueue.Dequeue();
                }
                else
                {
                    base_event = null;
                }
            }

            if (base_event != null)
            {
                return(base_event);
            }
            else
            {
                return(null);
            }
        }
예제 #2
0
        public override void Execute()
        {
            //事件接口;
            //-----------------------------------------------------------------------
            _cardOfKickTheDoorAtPresent = CoreDataObserver.GetInstance().Get_CardOfKickTheDoorAtPresent();//获取当前的踢门牌;
            if (_cardOfKickTheDoorAtPresent != null && _cardOfKickTheDoorAtPresent.GetCardType() == CardType.DebuffCard)
            {
                //当前卡牌确实为诅咒卡;
                List <string> function = null;
                Base_Event    events   = null;
                function = _cardOfKickTheDoorAtPresent.GetDebuffCard().GetCurse();
                if (function != null)
                {
                    foreach (string i in function)
                    {
                        //通过字符串从EventTable中获取对应的事件类型,制造出对应的事件;(注意:先将事件类型与对应的字符串注册到EventTable中);
                        events = EventFactory.GetInstance().GetEvent(i);
                        events.SetCard(_cardOfKickTheDoorAtPresent);              //为此事件添加父类card;
                        EventQueue.GetInstance().PushEventForSecondqueue(events); //向事件队列中添加事件;
                    }
                }
            }
            else
            {
                //出错并不是诅咒卡;
                Console.WriteLine("此卡牌不是诅咒卡或者当前踢门卡为空");
                return;
            }



            //-----------------------------------------------------------------------
        }
예제 #3
0
 //----------------------------------------------------------------
 public void PushEventForSecondqueue(Base_Event baseevent)
 {
     //向第二优先级队列中插入元素;
     if (baseevent != null)
     {
         _secondqueue.Enqueue(baseevent);
     }
 }
예제 #4
0
 //----------------------------------------------------------------
 public void PushEventForFirstqueue(Base_Event baseevent)
 {
     //向第一优先级队列中插入元素;
     if (baseevent != null)
     {
         _firstqueue.Enqueue(baseevent);
     }
 }
예제 #5
0
 IEnumerator Processing()
 {
     while (true)
     {
         baseevent = EventQueue.GetInstance().PopEvent();
         if (baseevent != null)
         {
             baseevent.Execute();
         }
         yield return(new WaitForSeconds(0.5f));
     }
 }
예제 #6
0
        //----------------------------------------------------------------
        public Base_Event GetEvent(string fp_string)
        {
            switch (EventTable.GetInstance().GetEventType(fp_string))
            {
            case EventType.None:
                //----------------------------------------------------
                //base_event=new  ******
                //----------------------------------------------------
                break;

            case EventType.Debuff_CreatEventOne:
                //----------------------------------------------------
                base_event = new Debuff_CreatEventOne();
                //----------------------------------------------------
                break;

            case EventType.GetACardOfKickTheDoor:
                //----------------------------------------------------
                base_event = new GetACardOfKickTheDoor();
                //----------------------------------------------------
                break;

            case EventType.Magic_CreatEvent:
                //----------------------------------------------------
                base_event = new Magic_CreatEvent();
                //----------------------------------------------------
                break;

            case EventType.PushAttackEnemyCards:
                //-----------------------------------------------------
                base_event = new PushAttackEnemyCards();
                break;

            //------------------------------------------------------
            case EventType.GetMonsterCardAndPushItToList:
                base_event = new GetMonsterCardAndPushItToList();
                break;

            //------------------------------------------------------
            case EventType.SetACardOfKickTheDoor:
                base_event = new SetACardOfKickTheDoor();
                break;
            //------------------------------------------------------

            case EventType.ChangeMomentType_CombatPhase:
                base_event = new ChangeMomentType_CombatPhase();
                break;

            //------------------------------------------------------
            case EventType.TestOneEvent:
                base_event = new TestOneEvent();
                break;

            //------------------------------------------------------
            case EventType.TestTwoEvent:
                base_event = new TestOneEvent();
                break;

            //------------------------------------------------------
            case EventType.TestThreeEvent:
                base_event = new TestOneEvent();
                break;

            default:
                break;
            }
            //----------------------------------------------------
            if (base_event != null)
            {
                return(base_event);
            }
            else
            {
                return(null);
            }
            //----------------------------------------------------
        }
예제 #7
0
 //----------------------------------------------------------------
 private EventFactory()
 {
     base_event = null;
 }
예제 #8
0
 //----------------------------------------------------------------
 private EventQueue()
 {
     _firstqueue  = new Queue <Base_Event>();
     _secondqueue = new Queue <Base_Event>();
     base_event   = null;
 }
예제 #9
0
 //----------------------------------------------------------------
 void Start()
 {
     baseevent = null;
 }