private void Awake() { tgeSelect.group = transform.parent.GetComponent <ToggleGroup>(); Name.SubscribeToText(txtName).AddTo(gameObject); Name.Subscribe(x => { inputName.text = x; }).AddTo(gameObject); btnEditor.OnClickAsObservable().Subscribe(x => { inputName.gameObject.SetActive(true); inputName.ActivateInputField(); }).AddTo(gameObject); }
public override void OnRegister() { base.OnRegister(); // Init view view.init(); loadingRandomPhrase.SubscribeToText(view.random_phrase); loadProgress.Subscribe(x => view.progress_bar.value = x); StartCoroutine("GenerateRandomPhrase"); // We are ready to load game data // Listen for when all the data will be ready loadCompleteSignal.AddListener(OnLoadComplete); // The signal carry the handle where we want to be notified on progress loadGameDataSignal.Dispatch(loadProgress); }
private void OnLoadComplete(List <MonsterDataModel> monsters, Dictionary <string, ElementDataModel> elements, Dictionary <string, Texture2D> images) { // Header of the view localizationService.GetString("complete_title").Subscribe(x => view.popup_title_text.text = x.ToUpper()); speedUpButtonText = new StringReactiveProperty(localizationService.GetString("speedup_button").Value); hearthText = new StringReactiveProperty(localizationService.GetString("complete_heart").Value.ToUpper()); popupText = new StringReactiveProperty(localizationService.GetString("complete_message").Value); hearthText.SubscribeToText(view.heart_root_text); view.OnSpendGemsClick += OnSpendGemsClick; view.OnClosePopupClick += OnClosePopupClick; }
public override void OnRegister() { base.OnRegister(); // Init view view.init(); loadCompleteSignal.AddListener(OnLoadComplete); startBreedingSignal.AddListener(OnBreedingStart); breedingSpeededUpSignal.AddListener(OnBreedingSpeededUp); popupDismissed.AddListener(OnPopupDismissed); //Bind RX properties to view leftMonsterTex.Subscribe(tex => view.left_monster_image.texture = tex); rightMonsterTex.Subscribe(tex => view.right_monster_image.texture = tex); leftMonsterName.SubscribeToText(view.left_monster_name_text); rightMonsterName.SubscribeToText(view.right_monster_name_text); leftMonsterDescription.SubscribeToText(view.left_monster_description); rightMonsterDescription.SubscribeToText(view.right_monster_description); }