Ejemplo n.º 1
0
        public void RaiseCustomEvent(string _sData)
        {
            try
            {
                int i = 0;
                ICustomEventHandler item = null;

                while (i < m_EventSubscribers.Count)
                {
                    try
                    {
                        item = m_EventSubscribers[i];

                        item.CustomEventRaised(_sData);

                        i++;
                    }
                    catch (Exception e)
                    {
                        Logger.WriteErrorLogOnly(e, "91551953-65e1-4afa-aed1-e15add1f2962");

                        m_EventSubscribers.Remove(item);
                    }
                }
            }
            catch (Exception exp)
            {
                Logger.WriteError(exp, "2b62c6da-e5e0-49ac-b9f8-847d5e039b83");
            }
        }
Ejemplo n.º 2
0
 public TakeOnQuestMenu(string name, IReader reader, IWriter writer, ITownsManager townsManager,
                        IPlayerManager playerManager, IRandomNumberGenerator randomNumberGenerator, ICustomEventHandler handler)
     : base(name, reader, writer)
 {
     this.townsManager          = townsManager;
     this.playerManager         = playerManager;
     this.randomNumberGenerator = randomNumberGenerator;
     this.handler      = handler;
     this.questFactory = new QuestFactory(this.townsManager.GetCurrentTown(), this.randomNumberGenerator,
                                          handler);
 }
Ejemplo n.º 3
0
 public Quest(string name, string description, int rewardExperiancePoints, int rewardMoney,
              ICustomEventHandler handler)
 {
     this.Name                   = name;
     this.Description            = description;
     this.RewardExperiancePoints = rewardExperiancePoints;
     this.RewardMoney            = rewardMoney;
     this.handler                = handler;
     QuestCompletionEvent       += handler.QuestCompletion;
     this.QuestCompetionItems    = new List <IQuestCompetionItem>();
 }
Ejemplo n.º 4
0
        //private static readonly Quest PoliceQuest = new Quest(1, "Police Quest",
        //    "Now you are in Police office.The police need you. Your mission, if you accept it, is to arrest three famous criminals. Go and find them. The mission will end up bringing three pairs of boots. You will receive boot, 50 experience and 500 money",
        //    50, 500);

        public PoliceOffice(ITownsManager townsManager, IPlayerManager playerManager,
                            IRandomNumberGenerator randomNumberGenerator, int id, string name, string description, int x, int y,
                            ICustomEventHandler handler, int sizeFactor = Constants.DefaultSizeFactor)
            : base(id, name, description, x, y, sizeFactor)
        {
            this.townsManager          = townsManager;
            this.playerManager         = playerManager;
            this.randomNumberGenerator = randomNumberGenerator;
            this.handler = handler;
            //this.QuestAvailableHere = PoliceQuest;
            //this.ItemRequeredToEnter = ItemToEnter;
            //this.QuestAvailableHere.RewardItem = new HeavyBoot(1, "PoliceBoots", 1, Rarity.Epic);
        }
 public void UnSubscribeFromEvernts()
 {
     try
     {
         if (m_EventSubscribers != null)
         {
             ICustomEventHandler caller = OperationContext.Current.GetCallbackChannel <ICustomEventHandler>();
             m_EventSubscribers.Remove(caller);
         }
     }
     catch (Exception exp)
     {
         Logger.WriteError(exp, "b89c3e29-de12-45bb-93fc-7c6bfaa9be58");
     }
 }
Ejemplo n.º 6
0
 public static void Execute(ICustomEventHandler handler, BaseEventData eventData)
 {
     handler.OnReceiveEvent (ExecuteEvents.ValidateEventData<CustomEventData>(eventData));
 }
Ejemplo n.º 7
0
 public QuestFactory(ITown town, IRandomNumberGenerator randomNumberGenerator, ICustomEventHandler handler)
 {
     this.town = town;
     this.randomNumberGenerator = randomNumberGenerator;
     this.handler = handler;
 }
 // call that does the mapping
 private static void Execute(ICustomEventHandler handler, BaseEventData eventData)
 {
     // The ValidateEventData makes sure the passed event data is of the correct type
     handler.OnCustomEvent(ExecuteEvents.ValidateEventData <PointerEventData> (eventData));
 }
Ejemplo n.º 9
0
 public BanditQuest(string name, string description, int rewardExperiancePoints, int rewardMoney,
                    ICustomEventHandler handler) : base(name, description, rewardExperiancePoints, rewardMoney, handler)
 {
 }