Пример #1
0
    private void Update()
    {
        if (Input.GetKeyDown(interactKey))
        {
            if (target == null)
            {
                return;
            }

            FoodBox food = target.GetComponent <FoodBox>();
            if (food != null && itemHolder == null)
            {
                food.Interact(this);
            }

            TableBox table = target.GetComponent <TableBox>();
            if (table != null)
            {
                table.Interact(itemHolder, this);
            }

            ResultPost resultPost = target.GetComponent <ResultPost>();
            if (resultPost != null)
            {
                resultPost.Interact(itemHolder, this);
            }

            //TrashCan trashCan = target.GetComponent<TrashCan>();
            //if (trashCan != null)
            //{
            //    trashCan.Interact(crop, this);
            //}
        }
    }
Пример #2
0
        public void TestFoodBoxSetUp()
        {
            FoodBox foodBox = new FoodBox();

            foodBox.SetText("title", "desc", null);
            Assert.AreEqual(foodBox.Title.Text, "title");
            Assert.AreEqual(foodBox.Desc.Text, "desc");
        }
Пример #3
0
        public void TestResizeFoodBox()
        {
            FoodBox foodBox = new FoodBox();

            foodBox.ReSize();
            Assert.AreEqual(foodBox.Size, new Size(620, 300));
            Assert.AreEqual(foodBox.StartPosition, FormStartPosition.CenterScreen);
        }
Пример #4
0
        public void TestFoodBoxInit()
        {
            FoodBox foodBox = new FoodBox();

            foodBox.Initialize();
            Assert.AreEqual(foodBox.FormBorderStyle, FormBorderStyle.None);
            Assert.AreEqual(foodBox.BackColor, Color.White);
        }
Пример #5
0
        private static void Main()
        {
            IVisitee foodBox = new FoodBox();

            BeforeBeingVisited(foodBox);
            foodBox.Accept(new SaltVisitor());
            foodBox.Accept(new PepperVisitor());
            AfterBeingVisited(foodBox);
        }
Пример #6
0
        public void TestSetFoodBox()
        {
            FoodBox _foodBtn      = new FoodBox();
            Panel   foodContainer = new Panel();
            Results result        = Results.Failed;

            try
            {
                foodContainer.Width = 500;
                int buttonSize = (int)(foodContainer.Width / 5);
                _foodBtn.Name                          = "food1";
                _foodBtn.Location                      = new Point(0, 0);
                _foodBtn.Width                         = buttonSize - 2;
                _foodBtn.Height                        = buttonSize - 2;
                _foodBtn.Visible                       = true;
                _foodBtn.Picture.Location              = new Point(5, 5);
                _foodBtn.Picture.Width                 = _foodBtn.Width - 10;
                _foodBtn.Picture.Height                = _foodBtn.Height - 90;
                _foodBtn.Picture.BackgroundImage       = null;
                _foodBtn.Picture.BackgroundImageLayout = ImageLayout.Zoom;
                _foodBtn.Picture.Cursor                = Cursors.Hand;
                _foodBtn.Title.Text                    = "title";
                _foodBtn.Title.Location                = new Point(5, _foodBtn.Picture.Height + 10);
                _foodBtn.Title.Width                   = _foodBtn.Width - 5;
                _foodBtn.Title.Height                  = 30;
                _foodBtn.Title.Font                    = new System.Drawing.Font("Arial", 14);
                _foodBtn.Title.TextAlign               = ContentAlignment.MiddleCenter;
                _foodBtn.Title.ForeColor               = Color.DarkRed;
                _foodBtn.Desc.Text                     = "desc";
                _foodBtn.Desc.Location                 = new Point(5, _foodBtn.Picture.Height + 40);
                _foodBtn.Desc.Width                    = _foodBtn.Width;
                _foodBtn.Desc.Height                   = 50;
                _foodBtn.Desc.Font                     = new System.Drawing.Font("Arial", 14);
                _foodBtn.Desc.TextAlign                = ContentAlignment.MiddleCenter;
                _foodBtn.Desc.ForeColor                = Color.IndianRed;
                result = Results.Success;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                result = Results.Failed;
            }
            Assert.AreEqual(_foodBtn.Name, "food1");
            Assert.AreEqual(_foodBtn.Title.Text, "title");
            Assert.AreEqual(_foodBtn.Desc.Text, "desc");
            Assert.AreEqual(result, Results.Success);
        }
Пример #7
0
    void ObtainBox(FoodBox box)
    {
        //EffectSoundMgr.Instance.PlayBoxSound();
        var index         = RandomUtility.Random0ToMax(Config.SkillSettings.DataCollection.Count);
        var skillSettings = Config.SkillSettings.Get(index);

        if (skillSettings == null)
        {
            return;
        }
        var replaceSkillIndex = _holdSkills.FindIndex(h => h.ID == skillSettings.ID);

        if (replaceSkillIndex != -1)
        {
            if (_holdSkills[replaceSkillIndex].Quality < skillSettings.Quality)
            {
                _holdSkills[replaceSkillIndex] = skillSettings;
                EffectSoundMgr.Instance.PlaySkillLevelUpSound();
            }
            else
            {
                EffectSoundMgr.Instance.PlayAddInvalidSound();
            }
        }
        else
        {
            if (_holdSkills.Count < UnitInfo.SkillCount)
            {
                EffectSoundMgr.Instance.PlayAddSkillSound();
                _holdSkills.Add(skillSettings);
                var skillPrefab = BattleScene.Instance.GetPrefabBySkillID(skillSettings.ID);
                if (skillPrefab != null)
                {
                    var go = skillPrefab.SkillEffect.Show(transform, transform.position, true);
                    if (!_holdSkillPrefabs.ContainsKey(skillSettings.ID))
                    {
                        _holdSkillPrefabs.Add(skillSettings.ID, go);
                    }
                }
            }
            else
            {
                EffectSoundMgr.Instance.PlayAddInvalidSound();
            }
        }
    }
Пример #8
0
        public SettingsPage()
        {
            InitializeComponent();
            Current_Category.HeightRequest = 100;
            var user = Constants.current_user;

            if (user != null)
            {
                user_fname.Text         = user.data.first_name;
                user_lname.Text         = user.data.last_name;
                user_email.Text         = user.data.email;
                trendNotif.IsToggled    = user.data.settings.trend_notification;
                locationNotif.IsToggled = user.data.settings.location_notification;
                Points.Text             = user.data.points;
            }
            var position = 1;

            foreach (var cons in Constants.CurrentCategoryOrder)
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    await Task.Delay(300);
                    switch (position)
                    {
                    case (1):

                        var btn = new DragBtn
                        {
                            Text            = "Food",
                            ClassId         = "1",
                            FontSize        = 15,
                            BackgroundColor = Color.Transparent
                        };
                        Current_Category.Children.Add(btn, Constraint.RelativeToParent((parent) =>
                        {
                            return(0);
                        }), Constraint.RelativeToParent((parent) =>
                        {
                            return(0);
                        }), Constraint.RelativeToParent((parent) =>
                        {
                            return(.1);
                        }), Constraint.RelativeToParent((parent) =>
                        {
                            return(.1);
                        }));
                        if (cons == 1)
                        {
                            btn.CurrentDropBox = FoodBox;
                            btn.OnDragCompleted(FoodBox);
                            FoodBox.OnDraggableDropped(btn);
                        }
                        else if (cons == 2)
                        {
                            btn.CurrentDropBox = ServiceBox;
                            btn.OnDragCompleted(ServiceBox);
                            ServiceBox.OnDraggableDropped(btn);
                        }
                        else if (cons == 3)
                        {
                            btn.CurrentDropBox = CleanlinessBox;
                            btn.OnDragCompleted(CleanlinessBox);
                            CleanlinessBox.OnDraggableDropped(btn);
                        }
                        else if (cons == 4)
                        {
                            btn.CurrentDropBox = VibeBox;
                            btn.OnDragCompleted(VibeBox);
                            VibeBox.OnDraggableDropped(btn);
                        }
                        position++;


                        break;

                    case (2):

                        var btn2 = new DragBtn
                        {
                            Text            = "Service",
                            ClassId         = "2",
                            FontSize        = 15,
                            BackgroundColor = Color.Transparent
                        };
                        Current_Category.Children.Add(btn2, Constraint.RelativeToParent((parent) =>
                        {
                            return(0);
                        }), Constraint.RelativeToParent((parent) =>
                        {
                            return(.1);
                        }), Constraint.RelativeToParent((parent) =>
                        {
                            return(.1);
                        }), Constraint.RelativeToParent((parent) =>
                        {
                            return(.1);
                        }));
                        if (cons == 1)
                        {
                            btn2.CurrentDropBox = FoodBox;
                            btn2.OnDragCompleted(FoodBox);
                            FoodBox.OnDraggableDropped(btn2);
                        }
                        else if (cons == 2)
                        {
                            btn2.CurrentDropBox = ServiceBox;
                            btn2.OnDragCompleted(ServiceBox);
                            ServiceBox.OnDraggableDropped(btn2);
                        }
                        else if (cons == 3)
                        {
                            btn2.CurrentDropBox = CleanlinessBox;
                            btn2.OnDragCompleted(CleanlinessBox);
                            CleanlinessBox.OnDraggableDropped(btn2);
                        }
                        else if (cons == 4)
                        {
                            btn2.CurrentDropBox = VibeBox;
                            btn2.OnDragCompleted(VibeBox);
                            VibeBox.OnDraggableDropped(btn2);
                        }
                        position++;

                        break;

                    case (3):

                        var btn3 = new DragBtn
                        {
                            Text            = "Cleanliness",
                            ClassId         = "3",
                            FontSize        = 15,
                            BackgroundColor = Color.Transparent
                        };
                        Current_Category.Children.Add(btn3, Constraint.RelativeToParent((parent) =>
                        {
                            return(0);
                        }), Constraint.RelativeToParent((parent) =>
                        {
                            return(.1);
                        }), Constraint.RelativeToParent((parent) =>
                        {
                            return(.1);
                        }), Constraint.RelativeToParent((parent) =>
                        {
                            return(.1);
                        }));
                        if (cons == 1)
                        {
                            btn3.CurrentDropBox = FoodBox;
                            btn3.OnDragCompleted(FoodBox);
                            FoodBox.OnDraggableDropped(btn3);
                        }
                        else if (cons == 2)
                        {
                            btn3.CurrentDropBox = ServiceBox;
                            btn3.OnDragCompleted(ServiceBox);
                            ServiceBox.OnDraggableDropped(btn3);
                        }
                        else if (cons == 3)
                        {
                            btn3.CurrentDropBox = CleanlinessBox;
                            btn3.OnDragCompleted(CleanlinessBox);
                            CleanlinessBox.OnDraggableDropped(btn3);
                        }
                        else if (cons == 4)
                        {
                            btn3.CurrentDropBox = VibeBox;
                            btn3.OnDragCompleted(VibeBox);
                            VibeBox.OnDraggableDropped(btn3);
                        }
                        position++;

                        break;

                    case (4):
                        var btn4 = new DragBtn
                        {
                            Text            = "Vibe",
                            ClassId         = "4",
                            FontSize        = 15,
                            BackgroundColor = Color.Transparent
                        };
                        Current_Category.Children.Add(btn4, Constraint.RelativeToParent((parent) =>
                        {
                            return(0);
                        }), Constraint.RelativeToParent((parent) =>
                        {
                            return(.15);
                        }), Constraint.RelativeToParent((parent) =>
                        {
                            return(.1);
                        }), Constraint.RelativeToParent((parent) =>
                        {
                            return(.1);
                        }));
                        if (cons == 1)
                        {
                            btn4.CurrentDropBox = FoodBox;
                            btn4.OnDragCompleted(FoodBox);
                            FoodBox.OnDraggableDropped(btn4);
                        }
                        else if (cons == 2)
                        {
                            btn4.CurrentDropBox = ServiceBox;
                            btn4.OnDragCompleted(ServiceBox);
                            ServiceBox.OnDraggableDropped(btn4);
                        }
                        else if (cons == 3)
                        {
                            btn4.CurrentDropBox = CleanlinessBox;
                            btn4.OnDragCompleted(CleanlinessBox);
                            CleanlinessBox.OnDraggableDropped(btn4);
                        }
                        else if (cons == 4)
                        {
                            btn4.CurrentDropBox = VibeBox;
                            btn4.OnDragCompleted(VibeBox);
                            VibeBox.OnDraggableDropped(btn4);
                        }

                        position++;

                        break;
                    }
                });
            }
        }