protected virtual void SetData(T data) { if (ReferenceEquals(data, null)) { Clear(); return; } _disposablesForSetData.DisposeAllAndClear(); _data = data; _data.TitleText.Subscribe(value => titleText.text = value) .AddTo(_disposablesForSetData); _data.SubmitText.Subscribe(submitButton.SetSubmitText) .AddTo(_disposablesForSetData); _data.Submittable.Subscribe(value => submitButton.SetSubmittable(value)) .AddTo(_disposablesForSetData); _data.InfoText.Subscribe(value => { if (informationText != null) { informationText.text = value; } }) .AddTo(_disposablesForSetData); itemView.SetData(_data.Item.Value); }
private void UpdateStageInformation(int stageId, int characterLevel) { var isSubmittable = false; if (!(_sharedViewModel.WorldInformation is null)) { if (!_sharedViewModel.WorldInformation.TryGetWorldByStageId(stageId, out var world)) { throw new ArgumentException(nameof(stageId)); } isSubmittable = world.IsPlayable(stageId); } var stageWaveSheet = Game.Game.instance.TableSheets.StageWaveSheet; stageWaveSheet.TryGetValue(stageId, out var stageWaveRow, true); titleText.text = $"Stage {GetStageIdString(stageWaveRow.StageId)}"; var monsterCount = stageWaveRow.TotalMonsterIds.Count; for (var i = 0; i < monstersAreaCharacterViews.Count; i++) { var characterView = monstersAreaCharacterViews[i]; if (i < monsterCount) { characterView.Show(); characterView.SetByCharacterId(stageWaveRow.TotalMonsterIds[i]); continue; } characterView.Hide(); } var stageSheet = Game.Game.instance.TableSheets.StageSheet; stageSheet.TryGetValue(stageId, out var stageRow, true); var rewardItemRows = stageRow.GetRewardItemRows(); var rewardItemCount = rewardItemRows.Count; for (var i = 0; i < rewardsAreaItemViews.Count; i++) { var itemView = rewardsAreaItemViews[i]; if (i < rewardItemCount) { itemView.Show(); itemView.SetData(rewardItemRows[i]); continue; } itemView.Hide(); } var exp = StageRewardExpHelper.GetExp(characterLevel, stageId); expText.text = $"EXP +{exp}"; submitButton.SetSubmittable(isSubmittable); buttonNotification.SetActive(stageId == Find <WorldMap>().StageIdToNotify); }
private void SubscribeState(States states) { titleText.gameObject.SetActive(true); contentText.gameObject.SetActive(false); passPhraseGroup.SetActive(false); retypeGroup.SetActive(false); loginGroup.SetActive(false); findPassphraseTitle.gameObject.SetActive(false); findPassphraseGroup.SetActive(false); accountGroup.SetActive(false); submitButton.SetSubmittable(false); findPassphraseButton.gameObject.SetActive(false); backToLoginButton.gameObject.SetActive(false); accountAddressText.gameObject.SetActive(false); accountAddressHolder.gameObject.SetActive(false); accountWarningText.gameObject.SetActive(false); retypeText.gameObject.SetActive(false); loginWarning.SetActive(false); findPrivateKeyWarning.SetActive(false); createSuccessGroup.SetActive(false); switch (states) { case States.Show: header.SetActive(true); contentText.gameObject.SetActive(true); incorrectText.gameObject.SetActive(false); correctText.gameObject.SetActive(false); strongText.gameObject.SetActive(false); weakText.gameObject.SetActive(false); accountGroup.SetActive(true); accountAddressHolder.gameObject.SetActive(true); passPhraseField.text = ""; retypeField.text = ""; loginField.text = ""; findPassphraseField.text = ""; submitButton.SetSubmitText(L10nManager.Localize("UI_GAME_SIGN_UP")); bg.SetActive(false); break; case States.CreatePassword: titleText.gameObject.SetActive(false); accountAddressText.gameObject.SetActive(true); submitButton.SetSubmitText(L10nManager.Localize("UI_GAME_START")); passPhraseGroup.SetActive(true); retypeGroup.SetActive(true); accountGroup.SetActive(true); passPhraseField.Select(); break; case States.CreateAccount: titleText.gameObject.SetActive(false); submitButton.SetSubmitText(L10nManager.Localize("UI_GAME_CREATE_PASSWORD")); createSuccessGroup.SetActive(true); passPhraseField.Select(); break; case States.ResetPassphrase: titleText.gameObject.SetActive(false); submitButton.SetSubmitText(L10nManager.Localize("UI_GAME_START")); passPhraseGroup.SetActive(true); retypeGroup.SetActive(true); accountGroup.SetActive(true); passPhraseField.Select(); break; case States.Login: header.SetActive(false); titleText.gameObject.SetActive(false); submitButton.SetSubmitText(L10nManager.Localize("UI_GAME_START")); loginGroup.SetActive(true); accountGroup.SetActive(true); findPassphraseButton.gameObject.SetActive(true); loginField.Select(); accountAddressText.gameObject.SetActive(true); bg.SetActive(true); break; case States.FindPassphrase: titleText.gameObject.SetActive(false); findPassphraseTitle.gameObject.SetActive(true); findPassphraseGroup.SetActive(true); backToLoginButton.gameObject.SetActive(true); submitButton.SetSubmitText(L10nManager.Localize("UI_OK")); findPassphraseField.Select(); break; case States.Failed: var upper = _prevState.ToString().ToUpper(); var format = L10nManager.Localize($"UI_LOGIN_{upper}_FAIL"); titleText.text = string.Format(format, _prevState); contentText.gameObject.SetActive(true); var contentFormat = L10nManager.Localize($"UI_LOGIN_{upper}_CONTENT"); contentText.text = string.Format(contentFormat); submitButton.SetSubmitText(L10nManager.Localize("UI_OK")); break; default: throw new ArgumentOutOfRangeException(nameof(states), states, null); } UpdateSubmitButton(); }
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); } } }