Пример #1
0
        void Start()
        {
            Person person = new Person();

            person.Name = "Bob";

            var apple = new Apple();

            person.Eat(apple);

            var cookie = new Cookie();

            person.Eat(cookie);

            var donut = new Donut();

            person.Eat(donut);

            var pancake = new Pancake();

            person.Eat(pancake);

            var sandwich = new Sandwich();

            person.Eat(sandwich);

            var steak = new Steak();

            person.Eat(steak);
        }
Пример #2
0
        void SetText()
        {
            UkName.Text = Settings.MobileSettings.main_name;
            if (!string.IsNullOrWhiteSpace(Settings.Person.companyPhone))
            {
                LabelPhone.Text = "+" + Settings.Person.companyPhone.Replace("+", "");
            }
            else
            {
                IconViewLogin.IsVisible = false;
                LabelPhone.IsVisible    = false;
            }
            Color hexColor = (Color)Application.Current.Resources["MainColor"];

            IconViewLogin.SetAppThemeColor(IconView.ForegroundProperty, hexColor, Color.White);

            Pancake.SetAppThemeColor(PancakeView.BorderColorProperty, hexColor, Color.Transparent);
            PancakeViewIcon.SetAppThemeColor(PancakeView.BorderColorProperty, hexColor, Color.Transparent); { if (AppInfo.PackageName == "rom.best.saburovo" || AppInfo.PackageName == "sys_rom.ru.tsg_saburovo")
                                                                                                              {
                                                                                                                  PancakeViewIcon.Padding = new Thickness(0);
                                                                                                              }
            }
            //LabelTech.SetAppThemeColor(Label.TextColorProperty, hexColor, Color.White);
            //IconViewTech.SetAppThemeColor(IconView.ForegroundProperty, hexColor, Color.White);
        }
Пример #3
0
    // called from the batter when it collides with the fryingPan.
    public void BatterCollision(Vector3 collisionPosition, float batterQt)
    {
        Quaternion quaternion = new Quaternion();

        quaternion.eulerAngles = new Vector3(0, 90, 0);

        // create a new pancake if we are not already reciving batter :)
        if (!currentPancake)
        {
            currentPancake = Instantiate(pancake_prefab, collisionPosition, quaternion);
            currentPancake.transform.parent = transform;
            currentPancake.SetStartPosition(collisionPosition);
            currentPancake.SetCurrentPan(this);
        }
        else if (currentPancake && currentPancake.GetCurrentState() != PancakeState.Mixture)            // consume any current pancakes in the pan that are not raw.
        {
            Pancake oldPancake = currentPancake;
            currentPancake = Instantiate(pancake_prefab, collisionPosition, quaternion);
            currentPancake.transform.parent = transform;
            currentPancake.SetStartPosition(collisionPosition);
            oldPancake.transform.parent = currentPancake.transform;
            currentPancake.SetCurrentPan(this);
        }

        currentPancake.AddBatter(batterQt, 0.25f);              // 0.25f is the spwan intervals of batter from jug.
    }
Пример #4
0
    // Check if order was good
    public bool CheckOrder(Pancake orderSubmission)
    {
        // Make a copy of topping list from submission and requested pancakes
        List <PancakeToppings> submissionList = orderSubmission.toppings;
        List <PancakeToppings> requestedList  = requestedPancake.toppings;

        // Assume the order is messed up
        bool Success = false;

        // Check submission against requested and set Success to false if match failed
        // One missed topping a fail
        for (int i = 0; i < requestedList.Count; i++)
        {
            if (!submissionList.Contains(requestedList[i]))
            {
                Success = false;
            }
            else
            {
                Success = true;
            }
        }

        return(Success);
    }
Пример #5
0
    // Update is called once per frame
    void Update()
    {
        InputValues inputs = InputHandler.GetInputs();

        float x_pos = /*pan.position.x + */ ((inputs.pans_x[panId] / 180f) * range);
        float z_pos = /*pan.position.z + */ ((inputs.pans_y[panId] / 180f) * range);

        transform.localPosition = new Vector3(z_pos, x_pos, 0);

        // only find the pancakes cloest vert points if the we have titled enought to afect the batter
        //if ( Vector3.Distance( Vector3.zero, transform.localPosition ) < minRange ) return;

        if (debug)
        {
            print("In Range od manip");
        }

        //TODO: check if the pancake is in a batter/mixture state
        Pancake pancake = fryingPan.GetCurrentPancakes();

        if (pancake != null)
        {
            PancakeMeshControler pancakeMesh = pancake.GetComponent <PancakeMeshControler>();

            if (pancakeMesh != null)
            {
                ManipulatePancakeVert(pancake.transform, pancakeMesh);
            }
        }
    }
Пример #6
0
        void SetText()
        {
            UkName.Text = Settings.MobileSettings.main_name;
            if (!string.IsNullOrWhiteSpace(Settings.Person.companyPhone))
            {
                LabelPhone.Text = "+" + Settings.Person.companyPhone.Replace("+", "");
            }
            else
            {
                IconViewLogin.IsVisible = false;
                LabelPhone.IsVisible    = false;
            }
            LabelTitle.Text = _pollInfo.Name;

            FrameBtnNext.BackgroundColor   = (Color)Application.Current.Resources["MainColor"];
            FrameBtnFinish.BackgroundColor = (Color)Application.Current.Resources["MainColor"];

            Color hexColor = (Color)Application.Current.Resources["MainColor"];

            IconViewLogin.SetAppThemeColor(IconView.ForegroundProperty, hexColor, Color.White);
            //IconViewTech.SetAppThemeColor(IconView.ForegroundProperty, hexColor, Color.Black);
            Pancake.SetAppThemeColor(PancakeView.BorderColorProperty, hexColor, Color.Transparent);
            PancakeViewIcon.SetAppThemeColor(PancakeView.BorderColorProperty, hexColor, Color.Transparent); if (Device.RuntimePlatform == Device.iOS)
            {
                if (AppInfo.PackageName == "rom.best.saburovo" || AppInfo.PackageName == "sys_rom.ru.tsg_saburovo")
                {
                    PancakeViewIcon.Padding = new Thickness(0);
                }
            }
            //LabelTech.SetAppThemeColor(Label.TextColorProperty, hexColor, Color.Black);
            Color unselect = hexColor.AddLuminosity(0.3);

            FrameBack.SetAppThemeColor(Frame.BackgroundColorProperty, unselect, Color.FromHex("#4A4A4A"));
            StackLayoutIndicator.SetAppThemeColor(StackLayout.BackgroundColorProperty, unselect, Color.White);
        }
Пример #7
0
        async void SetText()
        {
            UkName.Text = Settings.MobileSettings.main_name;
            if (!string.IsNullOrWhiteSpace(Settings.Person.companyPhone))
            {
                LabelPhone.Text = "+" + Settings.Person.companyPhone.Replace("+", "");
            }
            else
            {
                IconViewLogin.IsVisible = false;
                LabelPhone.IsVisible    = false;
            }
            LabelTitle.Text = _announcementInfo.Header;
            LabelDate.Text  = _announcementInfo.Created;
            LabelText.Text  = _announcementInfo.Text;
            FrameBtnQuest.BackgroundColor = (Color)Application.Current.Resources["MainColor"];
            int announcementInfoAdditionalServiceId = _announcementInfo.AdditionalServiceId;

            if (announcementInfoAdditionalServiceId != -1)
            {
                _additional = Settings.GetAdditionalService(announcementInfoAdditionalServiceId);
                byte[] imageByte = await _server.GetPhotoAdditional(announcementInfoAdditionalServiceId.ToString());

                if (imageByte != null)
                {
                    Stream stream = new MemoryStream(imageByte);
                    ImageAdd.Source    = ImageSource.FromStream(() => { return(stream); });
                    ImageAdd.IsVisible = true;

                    var openAdditional = new TapGestureRecognizer();
                    openAdditional.Tapped += async(s, e) =>
                    {
                        await Navigation.PushAsync(new AdditionalOnePage(_additional));
                    };
                    ImageAdd.GestureRecognizers.Add(openAdditional);
                }
            }

            if (_announcementInfo.QuestionGroupID != -1)
            {
                _polls = Settings.GetPollInfo(_announcementInfo.QuestionGroupID);
                FrameBtnQuest.IsVisible = true;
            }

            Color hexColor = (Color)Application.Current.Resources["MainColor"];

            IconViewLogin.SetAppThemeColor(IconView.ForegroundProperty, hexColor, Color.White);

            Pancake.SetAppThemeColor(PancakeView.BorderColorProperty, hexColor, Color.Transparent);
            PancakeViewIcon.SetAppThemeColor(PancakeView.BorderColorProperty, hexColor, Color.Transparent); if (Device.RuntimePlatform == Device.iOS)
            {
                if (AppInfo.PackageName == "rom.best.saburovo" || AppInfo.PackageName == "sys_rom.ru.tsg_saburovo")
                {
                    PancakeViewIcon.Padding = new Thickness(0);
                }
            }
            //LabelTech.SetAppThemeColor(Label.TextColorProperty, hexColor, Color.Black);
            //IconViewTech.SetAppThemeColor(IconView.ForegroundProperty, hexColor, Color.Black);
        }
Пример #8
0
        static void Main(string[] args)
        {
            /*
             * Warning! do not program hungry. Strange results may occur.
             */

            hr();
            con("Prepare for Lunch!");
            hr();

            /*
             * We are creating a new instance of some food. We could use DI here
             * instead since Food accepts an IDispenser interface.
             */
            var foodDispenser = new FoodDispenser();
            var food          = new Food(foodDispenser, "candy bar");

            hr();
            con(food.Vend());
            hr();

            /*
             * We are creating a new instance of a drink. We could use DI here
             * instead since Food accepts an IDispenser interface.
             */
            var drinkDispenser = new DrinkDispenser();
            var drink          = new Drink(drinkDispenser, "Tang");

            hr();
            con(drink.Vend());
            hr();

            /*
             * With a pancake we already know it should be dispensed by a
             * FoodDispenser and will have a product name of "pancake".
             * This allows us to simplify the Pancake concrete implementation
             * without modifying the FoodDispenser logic thus creating a bridge
             * to the appropriate logic.
             */
            var pancake = new Pancake();

            hr();
            con(pancake.Vend());
            hr();

            /*
             * We can do the same for chocolate milk but we equip it with
             * a DrinkDispenser implementation instead. Note the use of a
             * Lambda operator on the overridden Vend method in ChocolateMilk
             * to further simplify our class.
             */
            var chocolateMilk = new ChocolateMilk();

            hr();
            con(chocolateMilk.Vend());
            hr();
        }
Пример #9
0
        async void SetText()
        {
            UkName.Text = Settings.MobileSettings.main_name;
            if (!string.IsNullOrWhiteSpace(Settings.Person.companyPhone))
            {
                LabelPhone.Text = "+" + Settings.Person.companyPhone.Replace("+", "");
            }
            else
            {
                IconViewLogin.IsVisible = false;
                LabelPhone.IsVisible    = false;
            }
            LabelTitle.Text = newsInfo.Header;
            LabelDate.Text  = newsInfo.Created;
            newsInfoFull    = await _server.GetNewsFull(newsInfo.ID.ToString());

            //LabelText.Text = newsInfoFull.Text;
            //LabelText.FormattedText = (FormattedString)(new HtmlTextConverter()).Convert(newsInfoFull.Text, null);

            //var new_text = System.Text.RegularExpressions.Regex.Replace(newsInfoFull.Text, @"width=\""[0-9]*\""", "width=\"100%\"");

            //newsInfoFull.Text = System.Text.RegularExpressions.Regex.Replace(new_text, @"height=\""[0-9]*\""", "");
            MainText.Source = new HtmlWebViewSource {
                Html = newsInfoFull.Text
            };
            MainText.FlowDirection = FlowDirection.MatchParent;
            MainText.Navigated    += (s, e) =>
            {
                if (!navigated)
                {
                    (s as WebView).Source = new UrlWebViewSource()
                    {
                        Url = e.Url
                    };
                    navigated = true;
                }
            };
            Color hexColor = (Color)Application.Current.Resources["MainColor"];

            IconViewLogin.SetAppThemeColor(IconView.ForegroundProperty, hexColor, Color.White);
            Pancake.SetAppThemeColor(PancakeView.BorderColorProperty, hexColor, Color.Transparent);
            PancakeViewIcon.SetAppThemeColor(PancakeView.BorderColorProperty, hexColor, Color.Transparent); { if (AppInfo.PackageName == "rom.best.saburovo" || AppInfo.PackageName == "sys_rom.ru.tsg_saburovo")
                                                                                                              {
                                                                                                                  PancakeViewIcon.Padding = new Thickness(0);
                                                                                                              }
            }
            //LabelTech.SetAppThemeColor(Label.TextColorProperty, hexColor, Color.Black);
            //IconViewTech.SetAppThemeColor(IconView.ForegroundProperty, hexColor, Color.Black);
            if (Xamarin.Essentials.Connectivity.NetworkAccess != Xamarin.Essentials.NetworkAccess.Internet)
            {
                Device.BeginInvokeOnMainThread(async() => await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorNoInternet, "OK"));
                return;
            }

            Files.IsVisible = newsInfoFull.HasImage;
        }
Пример #10
0
        private static int SideDesc(Pancake pancake, Pancake pancake1)
        {
            double s = pancake1.Side - pancake.Side;

            if (s == 0)
            {
                s = pancake1.Top - pancake.Top;
            }
            return((s > 0) ? 1 : ((s < 0) ? -1 : 0));
        }
Пример #11
0
        public ViewResult BonusRound()
        {
            User    nommer    = new User("Nom", "Nommingtons");
            Pancake panqueque = new Pancake("Panqueue", true);

            BonusRoundWrapper ToDisplay = new BonusRoundWrapper();

            ToDisplay.User    = nommer;
            ToDisplay.Pancake = panqueque;
            return(View(ToDisplay));
        }
Пример #12
0
    // Constructor with a simple pancake request
    public Order(Pancake request, int _orderNumber)
    {
        // Keep a copy of Pancake Order
        requestedPancake = request;

        // Keep track of _orderNumber
        orderNumber = _orderNumber;

        // Setup timer for Order
        SetupTimer();
    }
Пример #13
0
        void Start()
        {
            Person person = new Person();
            person.Name = "Bob";

            var cookie = new Cookie();
            person.Eat(cookie);
            
            var pancake = new Pancake();
            person.Eat(pancake);
        }
Пример #14
0
    public void RegisterPancake(Pancake pancakeToReg)
    {
        // can not reg a raw pancake. this is delta with in batterCollision.
        if (pancakeToReg.GetCurrentState() == PancakeState.Mixture)
        {
            return;
        }

        currentPancake = pancakeToReg;
        currentPancake.transform.parent = transform;
        currentPancake.SetCurrentPan(this);
    }
Пример #15
0
    void OnMouseDown()
    {
        aimingMode = true;
        Spatula    = this.gameObject.transform.Find("Spatula").gameObject;
        //Spatula = this.transform.Find("Spatula").gameObject;
        pancake = Instantiate(prefabPancake) as GameObject;
        pancake.transform.position = launchPos;
        //projectile.GetComponent<Rigidbody> ().isKinematic = true;

        pancakeRigidbody             = pancake.GetComponentInChildren <Rigidbody> ();
        pancakeRigidbody.isKinematic = true;

        pancakeScript = pancake.GetComponent <Pancake> ();
    }
Пример #16
0
    public void UnregisterPancake(Pancake pancakeToUnreg)
    {
        //can not remove a pan if its raw or not there :)
        if (!currentPancake || currentPancake && currentPancake.GetCurrentState() == PancakeState.Mixture)
        {
            return;
        }

        //Set the temperature back to 0, sinc it is no longer in the pan
        currentPancake.SetTemperature(0);
        currentPancake.transform.parent = null;
        currentPancake.SetCurrentPan(null);
        currentPancake = null;
    }
Пример #17
0
    // Constructor with pancake request under a specified time frame
    public Order(Pancake request, int _orderNumber, float orderTimerCount)
    {
        // Keep a copy of Pancake Order
        requestedPancake = request;

        // Specified order time
        pancakePreparationTime = orderTimerCount;

        // Keep track of _orderNumber
        orderNumber = _orderNumber;

        // Setup timer for Order
        SetupTimer();
    }
Пример #18
0
        public static PancakeStack GenerateStack(int amount, int _height, int width)
        {
            PancakeStack stack = new PancakeStack();
            Random       rnd   = new Random();

            int height = (_height / amount);

            for (int i = 0; i < amount; i++)
            {
                int     w       = rnd.Next(0, width);
                Pancake pancake = new Pancake(w, height);
                stack.Pancakes.Add(pancake);
            }

            return(stack);
        }
Пример #19
0
 static void Main(string[] args)
 {
     using (var io = new FileIO("../A-large"))
     {
         while (io.Active())
         {
             int[] args1    = io.ReadInts();
             int   N        = args1[0];
             int   K        = args1[1];
             var   pancakes = new Pancake[N];
             for (int i = 0; i < N; ++i)
             {
                 pancakes[i] = new Pancake(io.ReadDoubles());
             }
             io.Write(Solve(N, K, pancakes.OrderByDescending(pancake => pancake.R * pancake.H).ToArray()));
         }
     }
 }
    void AddOrder()
    {
        //get a single order, random amount of toppings, and keep track of toppings already added
        int numToppings = rnd.Next(1, 6);

        Pancake    newPancakeOrder  = new Pancake();
        List <int> previousToppings = new List <int>(numToppings);

        for (int i = 0; i < numToppings; i++)
        {
            int topping = rnd.Next(0, 5);
            while (true)
            {
                if (!previousToppings.Contains(topping))
                {
                    break;
                }
                else
                {
                    topping = rnd.Next(0, 5);
                }
            }
            newPancakeOrder.AddTopping((PancakeToppings)topping);
            previousToppings.Add(topping);
        }

        // Increase Order Number
        orderCounter++;

        // Add Order
        // Create order instance
        // Change order time as necessary
        Order newOrder = new Order(newPancakeOrder, orderCounter, orderTime);

        pancakeOrders.Add(newOrder);
        BindToOrderGameobject(newOrder);
        newOrder.StartOrder();
    }
Пример #21
0
 public Pancake(Pancake p)
 {
     length = p.length;
 }
Пример #22
0
 public MappleSyrup(Pancake pancake)
     : base(pancake)
 {
     Description = "Mapple syrup";
 }
Пример #23
0
 public void Eat(Pancake pancake) =>
 Act($"Ate {pancake}");
Пример #24
0
 // Use this for initialization
 void Start()
 {
     thisPancake = new Pancake();
 }
Пример #25
0
 public CherryCream(Pancake pancake)
 {
     _panCake = pancake;
 }
Пример #26
0
 public WhippedCream(Pancake pancake)
     : base(pancake)
 {
     Description = "Whipped cream";
 }
 public StrawberryCream(Pancake pancake)
 {
     _panCake = pancake;
 }
Пример #28
0
 public MixedBerries(Pancake pancake)
     : base(pancake)
 {
     Description = "Mixed berries";
 }
Пример #29
0
 public Nutella(Pancake pancake)
     : base(pancake)
 {
     Description = "Nutella";
 }
Пример #30
0
        public TechSendPage(bool isVisibleApp = true)
        {
            InitializeComponent();
            NavigationPage.SetHasNavigationBar(this, false);

            switch (Device.RuntimePlatform)
            {
            case Device.iOS:
                int statusBarHeight = DependencyService.Get <IStatusBar>().GetHeight();
                Pancake.Padding = new Thickness(0, statusBarHeight, 0, 0);
                //BackgroundColor = Color.White;
                break;

            default:
                break;
            }

            UkName.Text = Settings.MobileSettings.main_name;
            StackLayoutApp.IsVisible = isVisibleApp;
            if (Settings.Person.IsDispatcher || !Settings.AppIsVisible)
            {
                StackLayoutApp.IsVisible = false;
            }
            EntryPhone.Text = Settings.Person.Phone;
            LabelInfo.Text  =
                AppResources.TechAdditionalText1 +
                Settings.MobileSettings.main_name + AppResources.TechAdditionalText2;
            BtnApp.Text = AppResources.TechAdditionalText3 + Settings.MobileSettings.main_name;
            var backClick = new TapGestureRecognizer();

            backClick.Tapped += async(s, e) => { ClosePage(); };
            BackStackLayout.GestureRecognizers.Add(backClick);
            var appOpen = new TapGestureRecognizer();

            appOpen.Tapped += async(s, e) =>
            {
                if (isVisibleApp)
                {
                    if (Settings.Person.Accounts.Count > 0)
                    {
                        if (Settings.TypeApp.Count > 0)
                        {
                            await Navigation.PushAsync(new NewAppPage());
                        }
                        else
                        {
                            await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorAppsNoTypes, "OK");
                        }
                    }
                    else
                    {
                        await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorAppsNoIdent, "OK");
                    }
                }
            };
            FrameBtnApp.GestureRecognizers.Add(appOpen);

            var send = new TapGestureRecognizer();

            send.Tapped += async(s, e) =>
            {
                string phone = EntryPhone.Text
                               .Replace("+", "")
                               .Replace(" ", "")
                               .Replace("(", "")
                               .Replace(")", "")
                               .Replace("-", "");
                ;
                string email = EntryEmail.Text;

                string text = EntryText.Text;
                if (phone.Length < 11)
                {
                    await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorTechNumberFormat, "OK");

                    return;
                }

                if (email.Equals(""))
                {
                    await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorEnterEmail, "OK");

                    return;
                }

                if (text.Equals(""))
                {
                    await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorTechDesc, "OK");

                    return;
                }

                await SendTechTask();
            };
            FrameBtnLogin.GestureRecognizers.Add(send);
            Color hexColor = (Color)Application.Current.Resources["MainColor"];

            IconViewLogin.SetAppThemeColor(IconView.ForegroundProperty, hexColor, Color.White);
            Pancake.SetAppThemeColor(PancakeView.BorderColorProperty, hexColor, Color.Transparent);
            PancakeViewIcon.SetAppThemeColor(PancakeView.BorderColorProperty, hexColor, Color.Transparent); { if (AppInfo.PackageName == "rom.best.saburovo" || AppInfo.PackageName == "sys_rom.ru.tsg_saburovo")
                                                                                                              {
                                                                                                                  PancakeViewIcon.Padding = new Thickness(0);
                                                                                                              }
            }
            Frame.SetAppThemeColor(MaterialFrame.BorderColorProperty, hexColor, Color.White);
            BindingContext = this;
        }