public void OnCallbackReceived(object sender, Samp.Client.OnCallbackReceivedEventArgs args)
        {
            args.Data.Pos = 0; // Note: THIS IS REQUIRED; a method that previously subscribed to OnCallbackReceived could have left it at any arbitrary position in the data buffer

            if (String.Compare(args.CallbackName, "OnPlayerCommandText") == 0)
            {
                int playerid = args.Data.ReadInt32();
                string cmdtext = args.Data.ReadString();

                OnPlayerCommandText(playerid, cmdtext);
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            string ing, kitchen;

            Console.Write("Enter Country (SA/US): ");
            kitchen = Console.ReadLine();
            Console.Write("Do you want to create a Taco or Burrito? ");
            ing = Console.ReadLine();
            Console.WriteLine();
            Console.WriteLine();

            if (kitchen == "SA" || kitchen == "sa")
            {
                if (ing == "Taco" || ing == "taco")
                {
                    Taco saTaco = new Taco(new SAIngredientFactory());
                    Console.WriteLine($"SA Taco: {saTaco.DescribeTaco()}");
                }
                else if (ing == "Burrito" || ing == "burrito")
                {
                    Burrito saBurrito = new Burrito(new SAIngredientFactory());
                    Console.WriteLine($"SA Burrito: {saBurrito.DescribeBurrito()}");
                }
            }
            else if (kitchen == "US" || kitchen == "us")
            {
                if (ing == "Taco" || ing == "taco")
                {
                    Taco usTaco = new Taco(new USIngredientFactory());
                    Console.WriteLine($"US Taco: {usTaco.DescribeTaco()}");
                }
                else if (ing == "Burrito" || ing == "burrito")
                {
                    Burrito usBurrito = new Burrito(new USIngredientFactory());
                    Console.WriteLine($"US Burrito: {usBurrito.DescribeBurrito()}");
                }
            }

            Ingredient yes = new Burrito(new SAIngredientFactory());

            yes = new Chicken(yes);
            yes = new Mutton(yes);
            yes = new Samp(yes);
            //yes = new Beef(yes);
            //yes = new BlackBeans(yes);
            Console.WriteLine(yes.GetDiscription() + " \tFinal Price: " + yes.Cost().ToString("C"));



            Console.ReadLine();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            // Configure Observer pattern
            ConcreteKitchen sKitchen    = new ConcreteKitchen();
            ConcreteKitchen sIngredient = new ConcreteKitchen();

            // Sets the predefined observers available
            sKitchen.Attach(new ConcreteObserver(sKitchen, "Kitchen"));
            sIngredient.Attach(new ConcreteObserver(sIngredient, "Ingredient"));

            string ing, kitchen;

            Console.Write("Enter Country (SA/US): ");
            kitchen = Console.ReadLine();

            switch (kitchen)
            {
            // Changes the Kitchen observer to be kitchen location
            case "US": sKitchen.SubjectState = "US Kitchen"; break;

            case "us": sKitchen.SubjectState = "US Kitchen"; break;

            case "SA": sKitchen.SubjectState = "SA Kitchen"; break;

            case "sa": sKitchen.SubjectState = "SA Kitchen"; break;
            }
            //Goes through Subject class to ConcreteObserver class to output in the console window
            sKitchen.Notify();

            //Setting the Ingredient
            Console.Write("Choose Ingredient Taco/Burrito: ");
            ing = Console.ReadLine();
            switch (ing)
            {
            // Changes the Ingredient observer to be an ingredient type
            case "Taco": sIngredient.SubjectState = "Taco"; break;

            case "taco": sIngredient.SubjectState = "Taco"; break;

            case "Burrito": sIngredient.SubjectState = "Burrito"; break;

            case "burrito": sIngredient.SubjectState = "Burrito"; break;
            }
            //Goes through Subject class to ConcreteObserver class to output in the console window
            sIngredient.Notify();


            Console.WriteLine();
            Console.WriteLine();

            if (kitchen == "SA" || kitchen == "sa" || kitchen == "Sa")
            {
                if (ing == "Taco" || ing == "taco" || ing == "TACO")
                {
                    Taco saTaco = new Taco(new SAIngredientFactory());
                    Console.WriteLine($"SA Taco: {saTaco.DescribeTaco()}");
                    // ---------------------------- observer testing
                    Ingredient newIngredientSA = new Taco(new SAIngredientFactory());
                    string     userInputSA     = "Yes";
                    string     chosenFillingSA;
                    while (userInputSA == "Yes" || userInputSA == "yes" || userInputSA == "YES")
                    {
                        Console.Write("What filling do you want to add to your ingredient? ");
                        chosenFillingSA = Console.ReadLine();
                        switch (chosenFillingSA)
                        {
                        case "Chicken":
                        case "chicken":
                            newIngredientSA = new Chicken(newIngredientSA);
                            break;

                        case "Mutton":
                        case "mutton":
                            newIngredientSA = new Mutton(newIngredientSA);
                            break;

                        case "Samp":
                        case "samp":
                            newIngredientSA = new Samp(newIngredientSA);
                            break;

                        case "Cheddar Cheese":
                        case "cheddar cheese":
                        case "Cheddar cheese":
                            newIngredientSA = new CheddarCheese(newIngredientSA);
                            break;

                        case "Sliced Avocados":
                        case "sliced avocados":
                        case "Sliced avocados":
                            newIngredientSA = new SlicedAvocados(newIngredientSA);
                            break;

                        case "Jasmin Rice":
                        case "jasmin rice":
                        case "Jasmin rice":
                            newIngredientSA = new JasminRice(newIngredientSA);
                            break;

                        case "Refried Beans":
                        case "Refried beans":
                        case "refried beans":
                            newIngredientSA = new RefriedBeans(newIngredientSA);
                            break;

                        case "Smooth Cream Cheese":
                        case "smooth cream cheese":
                        case "Smooth Cream cheese":
                            newIngredientSA = new SmoothCreamCheese(newIngredientSA);
                            break;

                        case "Relish":
                        case "relish":
                            newIngredientSA = new Relish(newIngredientSA);
                            break;

                        case "Jalapeno Chilies":
                        case "jalapeno chilies":
                        case "Jalapeno chilies":
                            newIngredientSA = new JalapenoChilies(newIngredientSA);
                            break;
                        }// end switch
                        Console.Write("Do you want to add another filling to your ingredient? ");
                        userInputSA = Console.ReadLine();
                    } // end while loop
                    Console.WriteLine();
                    Console.WriteLine(newIngredientSA.GetDiscription() + " \tFinal Price: " + newIngredientSA.Cost().ToString("C"));
                    Console.WriteLine();
                    // ---------------------------- end observer testing
                }
                else if (ing == "Burrito" || ing == "burrito" || ing == "BURRITO")
                {
                    Burrito saBurrito = new Burrito(new SAIngredientFactory());
                    Console.WriteLine($"SA Burrito: {saBurrito.DescribeBurrito()}");
                    // ---------------------------- observer testing
                    Ingredient newIngredientSA = new Burrito(new SAIngredientFactory());
                    string     userInputSA     = "Yes";
                    string     chosenFillingSA;
                    while (userInputSA == "Yes" || userInputSA == "yes" || userInputSA == "YES")
                    {
                        Console.Write("What filling do you want to add to your ingredient? ");
                        chosenFillingSA = Console.ReadLine();
                        switch (chosenFillingSA)
                        {
                        case "Chicken":
                        case "chicken":
                            newIngredientSA = new Chicken(newIngredientSA);
                            break;

                        case "Mutton":
                        case "mutton":
                            newIngredientSA = new Mutton(newIngredientSA);
                            break;

                        case "Samp":
                        case "samp":
                            newIngredientSA = new Samp(newIngredientSA);
                            break;

                        case "Cheddar Cheese":
                        case "cheddar cheese":
                        case "Cheddar cheese":
                            newIngredientSA = new CheddarCheese(newIngredientSA);
                            break;

                        case "Sliced Avocados":
                        case "sliced avocados":
                        case "Sliced avocados":
                            newIngredientSA = new SlicedAvocados(newIngredientSA);
                            break;

                        case "Jasmin Rice":
                        case "jasmin rice":
                        case "Jasmin rice":
                            newIngredientSA = new JasminRice(newIngredientSA);
                            break;

                        case "Refried Beans":
                        case "Refried beans":
                        case "refried beans":
                            newIngredientSA = new RefriedBeans(newIngredientSA);
                            break;

                        case "Smooth Cream Cheese":
                        case "smooth cream cheese":
                        case "Smooth Cream cheese":
                            newIngredientSA = new SmoothCreamCheese(newIngredientSA);
                            break;

                        case "Relish":
                        case "relish":
                            newIngredientSA = new Relish(newIngredientSA);
                            break;

                        case "Jalapeno Chilies":
                        case "jalapeno chilies":
                        case "Jalapeno chilies":
                            newIngredientSA = new JalapenoChilies(newIngredientSA);
                            break;
                        }// end switch
                        Console.Write("Do you want to add another filling to your ingredient? ");
                        userInputSA = Console.ReadLine();
                    } // end while loop
                    Console.WriteLine();
                    Console.WriteLine(newIngredientSA.GetDiscription() + " \tFinal Price: " + newIngredientSA.Cost().ToString("C"));
                    Console.WriteLine();
                    // ---------------------------- end observer testing
                }
            }
            else if (kitchen == "US" || kitchen == "us" || kitchen == "Us")
            {
                if (ing == "Taco" || ing == "taco" || ing == "TACO")
                {
                    Taco usTaco = new Taco(new USIngredientFactory());
                    Console.WriteLine($"US Taco: {usTaco.DescribeTaco()}");
                    // ---------------------- observer testing start
                    Ingredient newIngredientUS = new Taco(new USIngredientFactory());
                    string     userInputUS     = "Yes";
                    string     chosenFillingUS;
                    while (userInputUS == "Yes" || userInputUS == "yes" || userInputUS == "YES")
                    {
                        Console.Write("What filling do you want to add to your ingredient? ");
                        chosenFillingUS = Console.ReadLine();
                        switch (chosenFillingUS)
                        {
                        case "Turkey":
                        case "turkey":
                            newIngredientUS = new Turkey(newIngredientUS);
                            break;

                        case "Beef":
                        case "beef":
                            newIngredientUS = new Beef(newIngredientUS);
                            break;

                        case "Chickpeas":
                        case "chickpeas":
                            newIngredientUS = new Chickpeas(newIngredientUS);
                            break;

                        case "Pepper Jack Cheese":
                        case "pepper jack cheese":
                        case "Pepper jack cheese":
                            newIngredientUS = new PepperJackCheese(newIngredientUS);
                            break;

                        case "Guacamole":
                        case "guacomole":
                            newIngredientUS = new Guacamole(newIngredientUS);
                            break;

                        case "Basmati Rice":
                        case "basmati rice":
                        case "Basmati rice":
                            newIngredientUS = new BasmatiRice(newIngredientUS);
                            break;

                        case "Black Beans":
                        case "black beans":
                        case "Black beans":
                            newIngredientUS = new BlackBeans(newIngredientUS);
                            break;

                        case "Chunky Cream Cheese":
                        case "chunky cream cheese":
                        case "Chunky Cream cheese":
                            newIngredientUS = new ChunkyCreamCheese(newIngredientUS);
                            break;

                        case "Salsa":
                        case "salsa":
                            newIngredientUS = new Salsa(newIngredientUS);
                            break;

                        case "Habanero Chilies":
                        case "habanero chilies":
                        case "Habanero chilies":
                            newIngredientUS = new HabaneroChilies(newIngredientUS);
                            break;
                        }// end switch
                        Console.Write("Do you want to add another filling to your ingredient? ");
                        userInputUS = Console.ReadLine();
                    } // end while loop
                    Console.WriteLine();
                    Console.WriteLine(newIngredientUS.GetDiscription() + " \tFinal Price: " + newIngredientUS.Cost().ToString("C"));
                    Console.WriteLine();
                    // ---------------------- observer testing end
                }
                else if (ing == "Burrito" || ing == "burrito" || ing == "BURRITO")
                {
                    Burrito usBurrito = new Burrito(new USIngredientFactory());
                    Console.WriteLine($"US Burrito: {usBurrito.DescribeBurrito()}");
                    // ---------------------- observer testing start
                    Ingredient newIngredientUS = new Burrito(new USIngredientFactory());
                    string     userInputUS     = "Yes";
                    string     chosenFillingUS;
                    while (userInputUS == "Yes" || userInputUS == "yes" || userInputUS == "YES")
                    {
                        Console.Write("What filling do you want to add to your ingredient? ");
                        chosenFillingUS = Console.ReadLine();
                        switch (chosenFillingUS)
                        {
                        case "Turkey":
                        case "turkey":
                            newIngredientUS = new Turkey(newIngredientUS);
                            break;

                        case "Beef":
                        case "beef":
                            newIngredientUS = new Beef(newIngredientUS);
                            break;

                        case "Chickpeas":
                        case "chickpeas":
                            newIngredientUS = new Chickpeas(newIngredientUS);
                            break;

                        case "Pepper Jack Cheese":
                        case "pepper jack cheese":
                        case "Pepper jack cheese":
                            newIngredientUS = new PepperJackCheese(newIngredientUS);
                            break;

                        case "Guacamole":
                        case "guacomole":
                            newIngredientUS = new Guacamole(newIngredientUS);
                            break;

                        case "Basmati Rice":
                        case "basmati rice":
                        case "Basmati rice":
                            newIngredientUS = new BasmatiRice(newIngredientUS);
                            break;

                        case "Black Beans":
                        case "black beans":
                        case "Black beans":
                            newIngredientUS = new BlackBeans(newIngredientUS);
                            break;

                        case "Chunky Cream Cheese":
                        case "chunky cream cheese":
                        case "Chunky Cream cheese":
                            newIngredientUS = new ChunkyCreamCheese(newIngredientUS);
                            break;

                        case "Salsa":
                        case "salsa":
                            newIngredientUS = new Salsa(newIngredientUS);
                            break;

                        case "Habanero Chilies":
                        case "habanero chilies":
                        case "Habanero chilies":
                            newIngredientUS = new HabaneroChilies(newIngredientUS);
                            break;
                        }// end switch
                        Console.Write("Do you want to add another filling to your ingredient? ");
                        userInputUS = Console.ReadLine();
                    } // end while loop
                    Console.WriteLine();
                    Console.WriteLine(newIngredientUS.GetDiscription() + " \tFinal Price: " + newIngredientUS.Cost().ToString("C"));
                    Console.WriteLine();
                    // ---------------------- observer testing end
                }
            }

            Console.ReadLine();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            string ing, kitchen;

            Console.Write("Enter Country (SA/US): ");
            kitchen = Console.ReadLine();
            Console.Write("Do you want to create a Taco or Burrito? ");
            ing = Console.ReadLine();
            Console.WriteLine();
            Console.WriteLine();

            if (kitchen == "SA" || kitchen == "sa")
            {
                if (ing == "Taco" || ing == "taco")
                {
                    Taco saTaco = new Taco(new SAIngredientFactory());
                    Console.WriteLine($"SA Taco: {saTaco.DescribeTaco()}");
                }
                else if (ing == "Burrito" || ing == "burrito")
                {
                    Burrito saBurrito = new Burrito(new SAIngredientFactory());
                    Console.WriteLine($"SA Burrito: {saBurrito.DescribeBurrito()}");
                }
            }
            else if (kitchen == "US" || kitchen == "us")
            {
                if (ing == "Taco" || ing == "taco")
                {
                    Taco usTaco = new Taco(new USIngredientFactory());
                    Console.WriteLine($"US Taco: {usTaco.DescribeTaco()}");
                }
                else if (ing == "Burrito" || ing == "burrito")
                {
                    Burrito usBurrito = new Burrito(new USIngredientFactory());
                    Console.WriteLine($"US Burrito: {usBurrito.DescribeBurrito()}");
                }
            }

            //----------------------------------- Adding fillings to ingredient for SA Taco kitchen, for burrito just change Taco to burrito in next line

            Ingredient newIngredientSA = new Taco(new SAIngredientFactory());
            string     userInputSA     = "Yes";
            string     chosenFillingSA;

            while (userInputSA == "Yes" || userInputSA == "yes" || userInputSA == "YES")
            {
                Console.Write("What filling do you want to add to your ingredient? ");
                chosenFillingSA = Console.ReadLine();
                switch (chosenFillingSA)
                {
                case "Chicken":
                case "chicken":
                    newIngredientSA = new Chicken(newIngredientSA);
                    break;

                case "Mutton":
                case "mutton":
                    newIngredientSA = new Mutton(newIngredientSA);
                    break;

                case "Samp":
                case "samp":
                    newIngredientSA = new Samp(newIngredientSA);
                    break;

                case "Chedder Cheese":
                case "chedder cheese":
                case "Chedder cheese":
                    newIngredientSA = new CheddarCheese(newIngredientSA);
                    break;

                case "Sliced Avocados":
                case "sliced avocados":
                case "Sliced avocados":
                    newIngredientSA = new SlicedAvocados(newIngredientSA);
                    break;

                case "Jasmin Rice":
                case "jasmin rice":
                case "Jasmin rice":
                    newIngredientSA = new JasminRice(newIngredientSA);
                    break;

                case "Refried Beans":
                case "Refried beans":
                case "refried beans":
                    newIngredientSA = new RefriedBeans(newIngredientSA);
                    break;

                case "Smooth Cream Cheese":
                case "smooth cream cheese":
                case "Smooth Cream cheese":
                    newIngredientSA = new SmoothCreamCheese(newIngredientSA);
                    break;

                case "Relish":
                case "relish":
                    newIngredientSA = new Relish(newIngredientSA);
                    break;

                case "Jalapeno Chilies":
                case "jalapeno chilies":
                case "Jalapeno chilies":
                    newIngredientSA = new JalapenoChilies(newIngredientSA);
                    break;
                }// end switch
                Console.Write("Do you want to add another filling to your ingredient? ");
                userInputSA = Console.ReadLine();
            } // end while loop
            Console.WriteLine();
            Console.WriteLine(newIngredientSA.GetDiscription() + " \tFinal Price: " + newIngredientSA.Cost().ToString("C"));
            Console.WriteLine();



            //----------------------------------- Adding fillings to ingredient for US Taco kitchen, for burrito just change Taco to Burrito in next line

            Ingredient newIngredientUS = new Taco(new USIngredientFactory());
            string     userInputUS     = "Yes";
            string     chosenFillingUS;

            while (userInputUS == "Yes" || userInputUS == "yes" || userInputUS == "YES")
            {
                Console.Write("What filling do you want to add to your ingredient? ");
                chosenFillingUS = Console.ReadLine();
                switch (chosenFillingUS)
                {
                case "Turkey":
                case "turkey":
                    newIngredientUS = new Turkey(newIngredientUS);
                    break;

                case "Beef":
                case "beef":
                    newIngredientUS = new Beef(newIngredientUS);
                    break;

                case "Chickpeas":
                case "chickpeas":
                    newIngredientUS = new Chickpeas(newIngredientUS);
                    break;

                case "Pepper Jack Cheese":
                case "pepper jack cheese":
                case "Pepper jack cheese":
                    newIngredientUS = new PepperJackCheese(newIngredientUS);
                    break;

                case "Guacamole":
                case "guacomole":
                    newIngredientUS = new Guacamole(newIngredientUS);
                    break;

                case "Basmati Rice":
                case "basmati rice":
                case "Basmati rice":
                    newIngredientUS = new BasmatiRice(newIngredientUS);
                    break;

                case "Black Beans":
                case "black beans":
                case "Black beans":
                    newIngredientUS = new BlackBeans(newIngredientUS);
                    break;

                case "Chunky Cream Cheese":
                case "chunky cream cheese":
                case "Chunky Cream cheese":
                    newIngredientUS = new ChunkyCreamCheese(newIngredientUS);
                    break;

                case "Salsa":
                case "salsa":
                    newIngredientUS = new Salsa(newIngredientUS);
                    break;

                case "Habanero Chilies":
                case "habanero chilies":
                case "Habanero chilies":
                    newIngredientUS = new HabaneroChilies(newIngredientUS);
                    break;
                }// end switch
                Console.Write("Do you want to add another filling to your ingredient? ");
                userInputUS = Console.ReadLine();
            } // end while loop
            Console.WriteLine();
            Console.WriteLine(newIngredientUS.GetDiscription() + " \tFinal Price: " + newIngredientUS.Cost().ToString("C"));
            Console.WriteLine();

            Console.ReadLine();
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            string ServerIp = Samp.GetServerIP();

            Console.WriteLine($"Current server ip: {ServerIp}");
            string hostname = Samp.GetServerHostname();

            Console.WriteLine($"Current hostname: {hostname}");

            bool inChat = Samp.IsInChat();

            Console.WriteLine($"You're with chat window opened: {inChat}");

            string username = Samp.GetUsername();

            Console.WriteLine($"Your current username is {username}");

            int health = Samp.GetPlayerHealth();

            Console.WriteLine($"Your current health: {health}");
            Samp.SetPlayerHealth(10);
            Console.WriteLine($"Health changed to 10");

            int armor = Samp.GetPlayerArmor();

            Console.WriteLine($"Current armor: {armor}");
            Samp.SetPlayerArmor(15);
            Console.WriteLine("Armor changed to 15");

            int money = Samp.GetPlayerMoney();

            Console.WriteLine($"Your current money {money}");
            Samp.SetPlayerMoney(2500);
            Console.WriteLine("Money changed to 2500");

            int interiorId = Samp.GetPlayerInteriorId();

            Console.WriteLine($"You current interior id: {interiorId}");

            bool isPlayerInVehicle = Samp.IsPlayerInAnyVehicle();

            Console.WriteLine($"You're in vehicle: {isPlayerInVehicle}");
            if (isPlayerInVehicle)
            {
                bool isPlayerDriver = Samp.IsPlayerDriver();
                Console.WriteLine($"You're the driver: {isPlayerDriver}");

                float carHealth = Samp.GetVehicleHealth();
                Console.WriteLine($"Current vehicle health: {carHealth}");

                int vType = Samp.GetVehicleType();
                Console.WriteLine($"Current vehicle type: {vType}");

                int model = Samp.GetVehicleModelId();
                Console.WriteLine($"Current vehicle model id: {model}");

                string vehicleName = Samp.GetVehicleModelName();
                Console.WriteLine($"Current vehicle model name: {vehicleName}");

                bool vehicleOn = Samp.IsVehicleEngineStateON();
                Console.WriteLine($"Current vehicle is on: {vehicleOn}");
            }

            float[] Coords = Samp.GetCoordinates();
            Console.WriteLine($"Coordinates: X: {Coords[0]} Y: {Coords[1]} Z: {Coords[2]}");

            bool cpActive = Samp.IsCheckpointActive();

            Console.WriteLine($"Is checkpoint active: {cpActive}");

            if (cpActive)
            {
                float[] cpCoords = Samp.GetCheckpointCoordinates();
                Console.WriteLine($"Checkpoint Coordinates: X: {cpCoords[0]} Y: {cpCoords[1]} Z: {cpCoords[2]}");
            }

            string lastMsg = Samp.GetLastChatMessage();

            if (!String.IsNullOrEmpty(lastMsg))
            {
                Console.WriteLine($"Last chat message: {lastMsg}");
            }

            Console.ReadKey();
        }