Example #1
0
        void RestartButton_Click(object sender, EventArgs e)
        {
            matched      = 0;
            timePassed   = 0;
            NameBox.Text = "";
            StartTimer.Start();
            NameBox.Hide();
            AskName.Hide();
            DisplayVictory.Hide();
            SubmitButton.Hide();

            Deck deck = new Deck();

            PictureBox[] boxes = new PictureBox[] { pictureBox1, pictureBox2, pictureBox3, pictureBox4, pictureBox5, pictureBox6, pictureBox7, pictureBox8, pictureBox9, pictureBox10, pictureBox11, pictureBox12, pictureBox13, pictureBox14, pictureBox15, pictureBox16 };


            totalCards = boxes.Count();
            foreach (PictureBox pictureBox in boxes)
            {
                Card card = deck.Deal();
                pictureBox.Image = card.CurrentImage;
                pictureBox.Tag   = card;
                pictureBox.Show();
            }
        }
Example #2
0
        public GameForm()
        {
            InitializeComponent();

            Deck deck = new Deck();

            boxes = new PictureBox[] { pictureBox1, pictureBox2, pictureBox3, pictureBox4, pictureBox5, pictureBox6, pictureBox7, pictureBox8, pictureBox9, pictureBox10, pictureBox11, pictureBox12, pictureBox13, pictureBox14, pictureBox15, pictureBox16 };
            StartTimer.Start();
            totalCards = boxes.Count();
            NameBox.Hide();
            AskName.Hide();
            DisplayVictory.Hide();
            SubmitButton.Hide();

            foreach (PictureBox pictureBox in boxes)
            {
                Card card = deck.Deal();
                pictureBox.Image = card.CurrentImage;
                pictureBox.Tag   = card;
            }
        }
Example #3
0
        private void UpdateView()
        {
            if (_quest is null)
            {
                Hide();
                return;
            }

            var isReceived = false;

            titleText.text   = _quest.GetTitle();
            contentText.text = _quest.GetContent();

            var text            = _quest.GetProgressText();
            var showProgressBar = !string.IsNullOrEmpty(text);

            progressText.gameObject.SetActive(showProgressBar);
            progressBar.gameObject.SetActive(showProgressBar);
            if (showProgressBar)
            {
                progressText.text = text;
                progressBar.value = _quest.Progress;
            }

            if (_quest.Complete)
            {
                if (_quest.isReceivable)
                {
                    background.color   = Color.white;
                    fillImage.color    = ColorHelper.HexToColorRGB("ffffff");
                    titleText.color    = ColorHelper.HexToColorRGB("ffa78b");
                    contentText.color  = ColorHelper.HexToColorRGB("955c4a");
                    progressText.color = ColorHelper.HexToColorRGB("e0a491");
                    receiveButton.Show();
                    receiveButton.SetSubmittable(true);
                }
                else
                {
                    isReceived         = true;
                    fillImage.color    = ColorHelper.HexToColorRGB("282828");
                    background.color   = ColorHelper.HexToColorRGB("7b7b7b");
                    titleText.color    = ColorHelper.HexToColorRGB("614037");
                    contentText.color  = ColorHelper.HexToColorRGB("38251e");
                    progressText.color = ColorHelper.HexToColorRGB("282828");
                    receiveButton.Hide();
                }
            }
            else
            {
                background.color   = Color.white;
                fillImage.color    = ColorHelper.HexToColorRGB("ffffff");
                titleText.color    = ColorHelper.HexToColorRGB("ffa78b");
                contentText.color  = ColorHelper.HexToColorRGB("955c4a");
                progressText.color = ColorHelper.HexToColorRGB("e0a491");
                receiveButton.Show();
                receiveButton.SetSubmittable(false);
            }

            var itemMap = _quest.Reward.ItemMap;

            for (var i = 0; i < rewardViews.Length; i++)
            {
                if (i < itemMap.Count)
                {
                    var pair       = itemMap.ElementAt(i);
                    var rewardView = rewardViews[i];
                    rewardView.ignoreOne = true;
                    var row = Game.Game.instance.TableSheets.MaterialItemSheet.Values.First(
                        itemRow => itemRow.Id == pair.Key);
                    var item          = ItemFactory.CreateMaterial(row);
                    var countableItem = new CountableItem(item, pair.Value);
                    countableItem.Dimmed.Value = isReceived;
                    rewardView.SetData(countableItem);
                    rewardView.iconImage.rectTransform.sizeDelta *= 0.7f;
                    rewardView.gameObject.SetActive(true);
                }
                else
                {
                    rewardViews[i].gameObject.SetActive(false);
                }
            }
        }