Example #1
0
 private void GameEnd()
 {
     StartTimer.Stop();
     NameBox.Show();
     AskName.Show();
     DisplayVictory.Show();
     SubmitButton.Show();
 }
Example #2
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);
                }
            }
        }