void Start()
    {
        spawner = FindObjectOfType <WhaleSpawner>();
        fade    = FindObjectOfType <FadeOutAndIn>();

        EventBroadcaster.registerHandler <WhaleHasDiedEvent>(this);
    }
        public async Task Broadcast_CanBroadcastEvent_ToMultipleHandlers()
        {
            var invokedCt = 0;
            var eventName = "Test.Event";
            var handler1  = new Mock <IEventHandler>();

            handler1.Setup(x => x.EventName).Returns(eventName);
            handler1.Setup(x => x.Handle)
            .Returns(args =>
            {
                invokedCt++;
                return(Task.CompletedTask);
            });

            var handler2 = new Mock <IEventHandler>();

            handler2.Setup(x => x.EventName).Returns(eventName);
            handler2.Setup(x => x.Handle)
            .Returns(args =>
            {
                invokedCt++;
                return(Task.CompletedTask);
            });
            var broadcaster = new EventBroadcaster(new List <IEventHandler> {
                handler1.Object, handler2.Object
            });

            await broadcaster.BroadcastAsync(eventName, "testarg");

            Assert.AreEqual(invokedCt, 2);
        }
        public async Task <ActionResult <ProductOut> > AddNewProduct(ProductIn productIN)
        {
            try
            {
                ProductDTO productDTO = new ProductDTO(productIN);
                m_Context.Products.Add(productDTO);
                await m_Context.SaveChangesAsync();

                productDTO = m_HttpController.CreatedAtAction("GetProduct", new { id = productDTO.ID }, productDTO).Value as ProductDTO;

                // Save image with IformFile
                UpdateImage(productDTO, productIN);

                await m_HttpController.PutProduct(productDTO.ID, productDTO);

                // Fire New product added event
                Event_NewProductAdded e = new Event_NewProductAdded(productDTO.ID);
                EventBroadcaster.Get().BroadcastEvent(e);

                return(new ProductOut(m_Context, productDTO));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                throw;
            }
        }
        public void SavePurchase()
        {
            if (GetTable().Rows.Count <= 0)
            {
                return;
            }

            if (m_UIControl.cb_vendorName.SelectedIndex < 0)
            {
                m_UIControl.lbl_vendorError.Text = "Please select vendor!";
                return;
            }
            var vendorId = DataService.GetVendorDataController().GetByName(m_UIControl.cb_vendorName.Text.Trim()).ID;

            string productIds        = string.Empty;
            string productQuantities = string.Empty;
            string buyingPrices      = string.Empty;
            string discounts         = string.Empty;

            int i = 0;

            for (i = 0; i < GetTable().Rows.Count - 1; ++i)
            {
                productIds        += int.Parse(GetTable().Rows[i].Cells["PurchaseTable_ProductId"].Value.ToString()) + ",";
                buyingPrices      += double.Parse(GetTable().Rows[i].Cells["PurchaseTable_PurchasePrice"].Value.ToString()) + ",";
                productQuantities += int.Parse(GetTable().Rows[i].Cells["PurchaseTable_Quantity"].Value.ToString()) + ",";
                discounts         += int.Parse(GetTable().Rows[i].Cells["PurchaseTable_DiscountRate"].Value.ToString()) + ",";
            }
            productIds        += int.Parse(GetTable().Rows[i].Cells["PurchaseTable_ProductId"].Value.ToString());
            buyingPrices      += double.Parse(GetTable().Rows[i].Cells["PurchaseTable_PurchasePrice"].Value.ToString());
            productQuantities += int.Parse(GetTable().Rows[i].Cells["PurchaseTable_Quantity"].Value.ToString());
            discounts         += int.Parse(GetTable().Rows[i].Cells["PurchaseTable_DiscountRate"].Value.ToString());

            PurchasePost purchasePost = new PurchasePost
            {
                PurchaseDateTime  = m_UIControl.purchase_dateTime.Value,
                VendorID          = vendorId,
                ProductIDs        = productIds,
                ProductQuantities = productQuantities,
                BuyingPrices      = buyingPrices,
                Discounts         = discounts
            };

            var purchase = DataService.GetPurchaseDataController().Post(purchasePost);

            //Update stock details
            UpdateStockDetails();

            if (purchase == null)
            {
                MessageBox.Show("Purchase entry failed! Please try saving again.");
                return;
            }
            MessageBox.Show("Purchase entry saved successfully!");
            ResetUIControls();

            Event_NewEntryAdded e = new Event_NewEntryAdded(DBEntityType.PURCHASE, purchase.ID);

            EventBroadcaster.Get().BroadcastEvent(e);
        }
        public void UpdateCategory()
        {
            m_UIControl.lbl_CategoryError.Text = string.Empty;
            if (!Validate())
            {
                MessageBox.Show("Name cannot be empty!");
                return;
            }
            var category = DataService.GetCategoryDataController().GetByName(m_UIControl.tb_categoryName.Text);

            if (category != null)
            {
                m_UIControl.lbl_CategoryError.Text = "Category with same name already exists!";
                return;
            }
            CategoryPost categoryPost = new CategoryPost();

            categoryPost.ID          = int.Parse(m_UIControl.tb_ID.Text);
            categoryPost.Name        = m_UIControl.tb_categoryName.Text;
            categoryPost.Description = m_UIControl.tb_categoryDescription.Text;

            m_Category = DataService.GetCategoryDataController().Put(categoryPost);

            string message = (m_Category == null) ? "Failed to Update Category Details!" : "Category Details updated successfully!";

            MessageBox.Show(m_UIControl, message);

            // fire category update event
            Event_EntryUpdated e = new Event_EntryUpdated(DBEntityType.CATEGORY, m_Category.ID);

            EventBroadcaster.Get().BroadcastEvent(e);

            m_UIControl.Close();
        }
Esempio n. 6
0
        public void UpdateProductDetails()
        {
            if (!ValidateProductDetails())
            {
                return;
            }

            string barcode = m_UIControl.tf_ProductDetails_Barcode.Text.Trim();

            if (CheckIfBarcodeAlreadyInUse(barcode))
            {
                m_UIControl.lbl_Error.Text = "This Barcode is already in use!";
                return;
            }

            string name = m_UIControl.tf_ProductDetails_ProductName.Text.Trim();

            if (CheckIfProductNameAlreadyInUse(name))
            {
                m_UIControl.lbl_Error.Text = "This Name is already in use!";
                return;
            }

            ProductGet existingProduct = m_Product;

            ProductPost product = new ProductPost(existingProduct);

            product.ID             = int.Parse(m_UIControl.tf_ProductDetails_ProductID.Text.Trim());
            product.Barcode        = barcode;
            product.Name           = name;
            product.Description    = m_UIControl.tf_ProductDetails_Description.Text.Trim();
            product.Unit           = ProductUnit.GetUnitFromText(m_UIControl.cb_Unit.Text);
            product.RetailPrice    = int.Parse(m_UIControl.tf_ProductDetails_RetailPrice.Text.Trim());
            product.WholeSalePrice = int.Parse(m_UIControl.tf_ProductDetails_WholesalePrice.Text.Trim());
            product.Discount       = double.Parse(m_UIControl.tf_ProductDetails_Discount.Text.Trim());
            product.CGST           = double.Parse(m_UIControl.tf_ProductDetails_CGST.Text.Trim());
            product.SGST           = double.Parse(m_UIControl.tf_ProductDetails_SGST.Text.Trim());

            string categoryName = m_UIControl.cb_ProductDetails_Category.Text.Trim();

            product.CategoryID = DataService.GetCategoryDataController().GetByName(categoryName).ID;

            bool imageModified = false;

            if (m_UIControl.pictureBox_ProductImage.Tag != null)
            {
                product.ImagePath = m_UIControl.pictureBox_ProductImage.Tag.ToString();
                imageModified     = true;
            }

            m_Product = DataService.GetProductDataController().Put(product, imageModified);
            string message = (m_Product == null) ? "Failed to Update Product Details!" : "Product Details updated successfully!";

            MessageBox.Show(m_UIControl, message);

            // fire entry updated event
            Event_EntryUpdated e = new Event_EntryUpdated(DBEntityType.PRODUCT, m_Product.ID);

            EventBroadcaster.Get().BroadcastEvent(e);
        }
 public void OnNotify(Event ievent)
 {
     if (((KeyPressedEvent)ievent).key == Keys.key.Escape)
     {
         EventBroadcaster.GetBroadcaster().ChangeEvent(null, false);
     }
 }
        public void UpdateVendor()
        {
            if (!ValidateVendorDetails())
            {
                return;
            }
            VendorPost vendorPost = new VendorPost();

            vendorPost.ID           = int.Parse(m_UIControl.tb_vendorId.Text.Trim());
            vendorPost.CompanyName  = m_UIControl.tb_companyName.Text.Trim();
            vendorPost.Address      = m_UIControl.tb_address.Text.Trim();
            vendorPost.Email        = m_UIControl.tb_email.Text.Trim();
            vendorPost.MobileNumber = m_UIControl.tb_mobileNumber.Text.Trim();
            vendorPost.City         = m_UIControl.tb_city.Text.Trim();
            vendorPost.State        = m_UIControl.tb_state.Text.Trim();

            var vendorGet = DataService.GetVendorDataController().Put(vendorPost);

            if (vendorGet == null)
            {
                Assert.Do("Failed to edit vendor");
                return;
            }
            MessageBox.Show("Vendor Updated Successfully");
            ResetTextBoxes();
            m_UIControl.DialogResult = DialogResult.OK;

            // fire vendor updated event
            Event_EntryUpdated e = new Event_EntryUpdated(DBEntityType.VENDOR, vendorGet.ID);

            EventBroadcaster.Get().BroadcastEvent(e);
        }
Esempio n. 9
0
    // Use this for initialization
    void Start()
    {
        image = GetComponent <Image>();

        EventBroadcaster.registerHandler <WhaleSpawned>(this);
        EventBroadcaster.registerHandler <WhaleMovedFirst>(this);
    }
Esempio n. 10
0
    private void DisplayRingDropRule()
    {
        // Display message about ring sizes and order
        Parameters p = new Parameters();

        p.PutExtra("message", "Whoops! You can only drop a ring onto a larger one!");
        EventBroadcaster.PostEvent(EventNames.DisplayMessage, p);
    }
Esempio n. 11
0
        public DisplayManager(EventBroadcaster eventBroadcaster)
        {
            this.eventBroadcaster      = eventBroadcaster;
            eventBroadcaster.ViewMode += ChangeCurrentViewMode;

            Initialize();
            CompleteRefresh();
        }
Esempio n. 12
0
        public Market(EventBroadcaster eventBroadcaster)
        {
            this.eventBroadcaster = eventBroadcaster;

            eventBroadcaster.MarketBuy       += PrintMarketBuy;
            eventBroadcaster.MarketSell      += PrintMarketSell;
            eventBroadcaster.MarketInventory += PrintMarketInventory;
            subscribed = true;
        }
Esempio n. 13
0
 public static StateManager GetStateManager()
 {
     if (_statemanager == null)
     {
         _statemanager = new StateManager();
         EventBroadcaster.GetBroadcaster().RegisterListener(_statemanager);
     }
     return(_statemanager);
 }
Esempio n. 14
0
        public HeadsUpDisplay(EventBroadcaster eventBroadcaster)
        {
            this.eventBroadcaster = eventBroadcaster;

            eventBroadcaster.FuelCells += PrintFuelCells;
            eventBroadcaster.Location  += PrintLocation;
            eventBroadcaster.Balance   += PrintBalance;
            eventBroadcaster.Warp      += PrintWarpFactor;
            eventBroadcaster.ResetDays += PrintResetDays;
        }
Esempio n. 15
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Debug.LogWarning("Be aware!!! Another Instance already exists!");
     }
 }
Esempio n. 16
0
 public void OnNotify(Event ievent)
 {
     if ((ievent as KeyPressedEvent)?.key == Keys.key.Space)
     {
         EventBroadcaster.GetBroadcaster().ChangeEvent(new RunningState(), true);
     }
     else if ((ievent as KeyPressedEvent).key == Keys.key.Escape)
     {
         EventBroadcaster.GetBroadcaster().ChangeEvent(new EndState(), false);
     }
 }
Esempio n. 17
0
    // Use this for initialization
    void Start()
    {
        audio = GameObject.Find("WhaleNoises").GetComponent <AudioSource> ();
        GetComponent <TrailRenderer> ().enabled = false;
        body         = GetComponent <Rigidbody2D> ();
        state        = WhaleState.Sitting;
        timeAllotted = 0;
        currentAngle = 0;
        isPastCoast  = false;

        EventBroadcaster.broadcastEvent(new WhaleSpawned());
    }
Esempio n. 18
0
        public Game()
        {
            Thread consoleResizeListner = new Thread(ConsoleResizeListner);

            eventBroadcaster = new EventBroadcaster();
            input            = new UserInput();
            display          = new DisplayManager(eventBroadcaster);
            gm = new GameManager(eventBroadcaster);

            eventBroadcaster.MenuState += ChangeMenuState;
            eventBroadcaster.GameState += ChangeGameState;

            consoleResizeListner.Start();
        }
Esempio n. 19
0
 public void OnNotify(Event ievent)
 {
     if (ievent is KeyPressedEvent)
     {
         if (((KeyPressedEvent)ievent).key == Keys.key.Escape)
         {
             EventBroadcaster.GetBroadcaster().ChangeEvent(null, false);
         }
         else
         {
             EventBroadcaster.GetBroadcaster().ChangeEvent(new PlayerOnStickState(), true);
         }
     }
 }
    public static void Main(string[] args)
    {
        var broadcaster = new EventBroadcaster();
        var listners    = new List <EventListner>();

        for (int i = 1; i < 10; i++)
        {
            var listner = new EventListner(i.ToString(CultureInfo.InvariantCulture));
            listner.ListenTo(broadcaster);
            listners.Add(listner);
        }
        broadcaster.DoLongRunningOperationAndRaiseFinishedEvent();
        Console.WriteLine("Waiting for operation to complete");
        Console.ReadLine();
    }
        public void UpdateCustomer()
        {
            m_UIControl.lbl_customerErrorText.Text = string.Empty;

            if (!ValidateCustomerDetails())
            {
                return;
            }

            string name         = m_UIControl.tb_customerName.Text.Trim();
            string mobileNumber = m_UIControl.tb_customerMobileNumber.Text.Trim();

            if (CheckIfCustomerNameAlreadyExists(name))
            {
                m_UIControl.lbl_customerErrorText.Text = "Customer with the same Name already exists!";
                return;
            }

            if (CheckIfMobileNumberAlreadyExists(mobileNumber))
            {
                m_UIControl.lbl_customerErrorText.Text = "Customer with the same Mobile Number already exists!";
                return;
            }

            CustomerPost customerPost = new CustomerPost();

            customerPost.ID            = int.Parse(m_UIControl.tb_customerId.Text.Trim());
            customerPost.Name          = name;
            customerPost.MobileNumber  = mobileNumber;
            customerPost.Email         = m_UIControl.tb_customerEmail.Text.Trim();;
            customerPost.TotalAmount   = double.Parse(m_UIControl.tb_customerTotalPurchaseAmount.Text.Trim());
            customerPost.PendingAmount = double.Parse(m_UIControl.tb_customerPendingAmount.Text.Trim());

            m_Customer = DataService.GetCustomerDataController().Put(customerPost);
            if (m_Customer == null)
            {
                m_UIControl.DialogResult = DialogResult.No;
                return;
            }
            m_UIControl.DialogResult = DialogResult.Yes;
            ResetTextBoxes();

            // fire customer updated event
            Event_EntryUpdated e = new Event_EntryUpdated(DBEntityType.CUSTOMER, m_Customer.ID);

            EventBroadcaster.Get().BroadcastEvent(e);
        }
        private void btn_saveCategory_Click(object sender, EventArgs eventArgs)
        {
            if (!ValidateUI())
            {
                return;
            }

            lbl_CategoryError.Text = string.Empty;
            string name = tb_categoryName.Text.Trim();
            string desc = tb_categoryDescription.Text.Trim();

            var category = DataService.GetCategoryDataController().GetByName(name);

            if (category != null)
            {
                lbl_CategoryError.Text = "Category with same name already exists!";
                return;
            }
            CategoryPost categoryPost = new CategoryPost();

            categoryPost.Name        = name;
            categoryPost.Description = desc;

            m_Category = DataService.GetCategoryDataController().Post(categoryPost);
            if (m_Category == null)
            {
                Assert.Do("Failed to add category!");
                DialogResult = DialogResult.Cancel;
                return;
            }


            // broadcast new entry added event
            Event_NewEntryAdded e = new Event_NewEntryAdded(DBEntityType.CATEGORY, m_Category.ID);

            EventBroadcaster.Get().BroadcastEvent(e);
            MessageBox.Show("Category Added successfully!");

            ResetAll();

            if (!checkBox_AddAnotherCategory.Checked)
            {
                DialogResult = DialogResult.OK;
                Close();
            }
        }
Esempio n. 23
0
 public void OnNotify(Event ievent)
 {
     if (ievent is KeyPressedEvent)
     {
         if (((KeyPressedEvent)ievent).key == Keys.key.Left || ((KeyPressedEvent)ievent).key == Keys.key.Right)
         {
             StickManager.GetStick().StickUpdate(((KeyPressedEvent)ievent).key);
         }
         else if (((KeyPressedEvent)ievent).key == Keys.key.Up)
         {
             EventBroadcaster.GetBroadcaster().ChangeEvent(new PlayerInAirState(), false);
         }
         else if (((KeyPressedEvent)ievent).key == Keys.key.Escape)
         {
             EventBroadcaster.GetBroadcaster().ChangeEvent(null, false);
         }
     }
 }
Esempio n. 24
0
    public void HandleOnButtonPressed()
    {
        if (toggleDisabled)
        {
            IsOn          = !IsOn;
            button.colors = IsOn ? defaultNormalColor : disabledNormalColor;

            if (!string.IsNullOrEmpty(eventName))
            {
                Parameters p = new Parameters();
                p.PutExtra("on", IsOn);
                EventBroadcaster.PostEvent(eventName, p);
            }

            if (onButtonToggleEvent != null)
            {
                onButtonToggleEvent.Invoke(IsOn);
            }
        }
    }
        public void SaveTransaction()
        {
            TransactionPost transactionPost = new TransactionPost
            {
                CustomerID          = m_TransactionSession.GetCustomer().ID,
                TransactionDateTime = DateTime.Now,
                TotalPrice          = double.Parse(m_TransactionSession.amountDue),
                TotalTax            = double.Parse(m_TransactionSession.totalTax)
            };
            string productIds      = string.Empty;
            string productQuantity = string.Empty;
            string buyingPrices    = string.Empty;
            string discounts       = string.Empty;

            foreach (var entry in m_TransactionSession.GetRowEntries())
            {
                var product = entry.Product;
                productIds      += product.ID + ",";
                productQuantity += entry.Quantity + ",";
                buyingPrices    += product.RetailPrice + ",";
                discounts       += product.Discount + ",";
            }

            //Removing last comma
            transactionPost.ProductIDs      = productIds.Substring(0, productIds.Length - 1);
            transactionPost.ProductQuantity = productQuantity.Substring(0, productQuantity.Length - 1);
            transactionPost.BuyingPrices    = buyingPrices.Substring(0, buyingPrices.Length - 1);
            transactionPost.Discounts       = discounts.Substring(0, discounts.Length - 1);

            var transaction = DataService.GetTransactionDataController().Post(transactionPost);

            UpdateCustomerDetails();
            UpdateStockDetails();

            // fire new transaction added event
            Event_NewEntryAdded e = new Event_NewEntryAdded(DBEntityType.TRANSACTION, transaction.ID);

            EventBroadcaster.Get().BroadcastEvent(e);
        }
        public VendorGet AddNewVendor()
        {
            if (!ValidateVendorDetails())
            {
                return(null);
            }

            VendorPost vendor = new VendorPost();

            vendor.CompanyName  = m_UIControl.tb_companyName.Text.Trim();
            vendor.Address      = m_UIControl.tb_address.Text.Trim();
            vendor.Email        = m_UIControl.tb_email.Text.Trim();
            vendor.MobileNumber = m_UIControl.tb_mobileNumber.Text.Trim();
            vendor.City         = m_UIControl.tb_city.Text.Trim();
            vendor.State        = m_UIControl.tb_state.Text.Trim();

            var vendorGet = DataService.GetVendorDataController().Post(vendor);

            if (vendorGet == null)
            {
                Assert.Do("Failed to add vendor");
                return(null);
            }

            MessageBox.Show("Vendor Added Successfully");
            ResetTextBoxes();

            Event_NewEntryAdded e = new Event_NewEntryAdded(DBEntityType.VENDOR, vendorGet.ID);

            EventBroadcaster.Get().BroadcastEvent(e);

            if (!m_UIControl.checkBox_AddAnotherVendor.Checked)
            {
                m_UIControl.DialogResult = DialogResult.OK;
                m_UIControl.Close();
            }

            return(vendorGet);
        }
Esempio n. 27
0
        public void GetKey()
        {
            Event ievent;

            if (System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.Space))
            {
                ievent = new KeyPressedEvent(Keys.key.Space);
                EventBroadcaster.GetBroadcaster().BroadcastEvent(ievent);
            }
            else if (System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.Escape))
            {
                ievent = new KeyPressedEvent(Keys.key.Escape);
                EventBroadcaster.GetBroadcaster().BroadcastEvent(ievent);
            }
            else if (System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.Left))
            {
                ievent = new KeyPressedEvent(Keys.key.Left);
                EventBroadcaster.GetBroadcaster().BroadcastEvent(ievent);
            }
            else if (System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.Right))
            {
                ievent = new KeyPressedEvent(Keys.key.Right);
                EventBroadcaster.GetBroadcaster().BroadcastEvent(ievent);
            }
            else if (System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.Up))
            {
                ievent = new KeyPressedEvent(Keys.key.Up);
                EventBroadcaster.GetBroadcaster().BroadcastEvent(ievent);
            }
            else if (System.Windows.Input.Keyboard.IsKeyDown(System.Windows.Input.Key.Escape))
            {
                if (System.Windows.Input.Keyboard.IsKeyUp(System.Windows.Input.Key.Escape))
                {
                    ievent = new KeyReleasedEvent(Keys.key.Escape);
                    EventBroadcaster.GetBroadcaster().BroadcastEvent(ievent);
                }
            }
        }
Esempio n. 28
0
        public void SaveCustomer()
        {
            m_UIControl.lbl_customerErrorText.Text = string.Empty;
            if (!ValidateCustomerDetails())
            {
                return;
            }

            CustomerPost customerPost = new CustomerPost();

            customerPost.Email         = m_UIControl.tb_customerEmail.Text.Trim();
            customerPost.Name          = m_UIControl.tb_CustomerName.Text.Trim();
            customerPost.MobileNumber  = m_UIControl.tb_customerMobile.Text.Trim();
            customerPost.PendingAmount = 0;
            m_Customer = DataService.GetCustomerDataController().Post(customerPost);

            m_UIControl.DialogResult = (m_Customer == null) ? DialogResult.No : DialogResult.Yes;

            // fire customer added event
            Event_NewEntryAdded e = new Event_NewEntryAdded(DBEntityType.CUSTOMER, m_Customer.ID);

            EventBroadcaster.Get().BroadcastEvent(e);
        }
        public async Task Broadcast_CanBroadcastEvent_ToSingleHandler()
        {
            object[] passedArgouments = null;
            var      eventName        = "Test.Event";
            var      handler          = new Mock <IEventHandler>();

            handler.Setup(x => x.EventName).Returns(eventName);
            handler.Setup(x => x.Handle)
            .Returns(args =>
            {
                passedArgouments = args;
                return(Task.CompletedTask);
            });
            var broadcaster = new EventBroadcaster(new List <IEventHandler> {
                handler.Object
            });

            await broadcaster.BroadcastAsync(eventName, new object[] { "arg1" });

            Assert.IsNotNull(passedArgouments);
            Assert.AreEqual(passedArgouments.Count(), 1);
            Assert.AreEqual(passedArgouments[0], "arg1");
        }
Esempio n. 30
0
        public void HandleCollision()
        {
            //int listNumber = 0, moodieNumber = 0, flag = 0;
            //for (listNumber = 0; listNumber < targets.MoodieList.Count; listNumber++)
            //{
            //    flag = 0;
            //    for (moodieNumber = 0; moodieNumber < targets.MoodieList[listNumber].Count; moodieNumber++)
            //    {
            //        if (listNumber == targets.MoodieList.Count - 1 || listNumber != targets.MoodieList.Count - 1 &&
            //            targets.MoodieList[listNumber + 1][moodieNumber].getShowFlag() == false)
            //        {
            //            if (targets.MoodieList[listNumber][moodieNumber].GetYCoordinate() >= player.GetPlayerY() - 36 &&
            //                Enumerable.Range(player.GetPlayerX() - 50, player.GetPlayerX() + 50).Contains(targets.MoodieList[listNumber][moodieNumber].GetXCoordinate()) &&
            //                targets.MoodieList[listNumber][moodieNumber].getShowFlag() == true)
            //            {

            //                if (targets.MoodieList[listNumber][moodieNumber].GetType() == player.GetType())
            //                {
            //                    rowNumber = listNumber;
            //                    columnNumber = moodieNumber;
            //                    EventBroadcaster.GetBroadcaster().ChangeEvent(new PlayerCollideState(), false);
            //                    flag = 1;
            //                    break;

            //                }
            //                else
            //                {
            //                    EventBroadcaster.GetBroadcaster().ChangeEvent(new PlayerOnStickState(), false);
            //                }
            //            }

            //        }
            //    }
            //    if (flag == 1)
            //        break;
            //}



            int listnumber = targets.MoodieList.Count - 1;

            while (listnumber >= 0)
            {
                int moodieNumber = player.GetPlayerX() / 50;

                if (targets.MoodieList[listnumber][moodieNumber].getShowFlag() == true &&
                    targets.MoodieList[listnumber][moodieNumber].GetType() == player.GetType())
                {
                    RowNumber    = listnumber;
                    ColumnNumber = moodieNumber;
                    EventBroadcaster.GetBroadcaster().ChangeEvent(new PlayerCollideState(), false);
                    break;
                }
                else if (targets.MoodieList[listnumber][moodieNumber].getShowFlag() == false)
                {
                    listnumber--;
                }
                else if (targets.MoodieList[listnumber][moodieNumber].getShowFlag() == true &&
                         targets.MoodieList[listnumber][moodieNumber].GetType() != player.GetType())
                {
                    EventBroadcaster.GetBroadcaster().ChangeEvent(new PlayerOnStickState(), false);
                    break;
                }
            }
            EventBroadcaster.GetBroadcaster().ChangeEvent(new PlayerOnStickState(), false);
        }