Ejemplo n.º 1
0
 protected override void ValueToUI()
 {
     using (Dictionary <Transform, VoiceSetting.SetData> .ValueCollection.Enumerator enumerator = this.dic.Values.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             VoiceSetting.SetData current = enumerator.Current;
             current.toggle.set_isOn(current.sd.Mute);
             current.slider.set_value((float)current.sd.Volume);
         }
     }
 }
Ejemplo n.º 2
0
 private void AddEvent(VoiceSetting.SetData data)
 {
     ObservableExtensions.Subscribe <bool>(UnityEventExtensions.AsObservable <bool>((UnityEvent <M0>)data.toggle.onValueChanged), (Action <M0>)(isOn =>
     {
         data.sd.Mute = isOn;
         ((Behaviour)data.image).set_enabled(!isOn);
         this.EnterSE();
     }));
     UnityUIComponentExtensions.SubscribeToInteractable((IObservable <bool>)Observable.Select <bool, bool>((IObservable <M0>)UnityUIComponentExtensions.OnValueChangedAsObservable(data.toggle), (Func <M0, M1>)(b => !b)), (Selectable)data.slider);
     ObservableExtensions.Subscribe <int>((IObservable <M0>)Observable.Select <float, int>(UnityEventExtensions.AsObservable <float>((UnityEvent <M0>)data.slider.get_onValueChanged()), (Func <M0, M1>)(value => (int)value)), (Action <M0>)(value => data.sd.Volume = value));
     ObservableExtensions.Subscribe <PointerEventData>(Observable.Where <PointerEventData>((IObservable <M0>)ObservableTriggerExtensions.OnPointerDownAsObservable((UIBehaviour)data.slider), (Func <M0, bool>)(_ => Input.GetMouseButtonDown(0))), (Action <M0>)(_ => this.EnterSE()));
 }
Ejemplo n.º 3
0
 private bool Add(int key, Transform trans)
 {
     if (this.dic.ContainsKey(trans))
     {
         return(false);
     }
     VoiceSetting.SetData data = new VoiceSetting.SetData()
     {
         sd     = Singleton <Manager.Voice> .Instance._Config.chara[key].sound,
         slider = (Slider)((Component)trans).GetComponentInChildren <Slider>(),
         toggle = (Toggle)((Component)trans).GetComponentInChildren <Toggle>(),
         image  = (Image)((Component)trans).GetComponentInChildren <Image>()
     };
     this.AddEvent(data);
     this.dic.Add(trans, data);
     return(true);
 }