Ejemplo n.º 1
0
        public IDisposable ObserveValue <TSource, TProperty>(TSource source,
                                                             Func <TSource, TProperty> propertySelector,
                                                             string eventName,
                                                             Func <TProperty, bool> nextAction) where TSource : class
        {
            var disposeable = ObserveExtensions
                              .ObserveEveryValueChanged(source, propertySelector)
                              .Sample(TimeSpan.FromSeconds(1))
                              .Subscribe(p => HandleEvent(nextAction.Invoke(p), eventName)).AddTo(disposables);

            return(disposeable);
        }
Ejemplo n.º 2
0
        private void StartLoad()
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            TitleLoadScene.\u003CStartLoad\u003Ec__AnonStorey1 loadCAnonStorey1 = new TitleLoadScene.\u003CStartLoad\u003Ec__AnonStorey1();
            // ISSUE: reference to a compiler-generated field
            loadCAnonStorey1.\u0024this = this;
            // ISSUE: reference to a compiler-generated field
            loadCAnonStorey1.isAutoFileExists = Singleton <Game> .Instance.Data.AutoData != null;
            // ISSUE: reference to a compiler-generated field
            this.infoAutoItem.objSave.SetActiveIfDifferent(loadCAnonStorey1.isAutoFileExists);
            // ISSUE: reference to a compiler-generated field
            this.infoAutoItem.objInitialize.SetActiveIfDifferent(!loadCAnonStorey1.isAutoFileExists);
            // ISSUE: reference to a compiler-generated field
            if (loadCAnonStorey1.isAutoFileExists)
            {
                this.infoAutoItem.txtTitle.set_text(Singleton <Game> .Instance.Data.AutoData.Name);
                this.infoAutoItem.txtDay.set_text(Singleton <Game> .Instance.Data.AutoData.SaveTime.ToShortDateString());
                this.infoAutoItem.txtTime.set_text(Singleton <Game> .Instance.Data.AutoData.SaveTime.ToLongTimeString());
            }
            // ISSUE: reference to a compiler-generated field
            ((Selectable)this.infoAutoItem.btnEntry).set_interactable(loadCAnonStorey1.isAutoFileExists);
            // ISSUE: reference to a compiler-generated field
            this.infoAutoItem.isData = loadCAnonStorey1.isAutoFileExists;
            this.infoAutoItem.num    = 0;
            // ISSUE: method pointer
            this.infoAutoItem.action.listActionEnter.Add(new UnityAction((object)loadCAnonStorey1, __methodptr(\u003C\u003Em__0)));
            // ISSUE: method pointer
            this.infoAutoItem.action.listActionExit.Add(new UnityAction((object)loadCAnonStorey1, __methodptr(\u003C\u003Em__1)));
            // ISSUE: reference to a compiler-generated method
            ObservableExtensions.Subscribe <Unit>((IObservable <M0>)UnityUIComponentExtensions.OnClickAsObservable(this.infoAutoItem.btnEntry), (Action <M0>) new Action <Unit>(loadCAnonStorey1.\u003C\u003Em__2));
            // ISSUE: reference to a compiler-generated method
            UnityUIComponentExtensions.SubscribeToInteractable((IObservable <bool>)ObserveExtensions.ObserveEveryValueChanged <TitleLoadScene, bool>((M0)this, (Func <M0, M1>) new Func <TitleLoadScene, bool>(loadCAnonStorey1.\u003C\u003Em__3), (FrameCountType)0, false), (Selectable)this.infoAutoItem.btnEntry);
            this.lstSaveInfo.Clear();
            this.lstSaveInfo.Add(this.infoAutoItem);
            List <Transform> transformList = new List <Transform>();

            for (int index = 0; index < this.objSaveContentParent.get_transform().get_childCount(); ++index)
            {
                transformList.Add(this.objSaveContentParent.get_transform().GetChild(index));
            }
            this.objSaveContentParent.get_transform().DetachChildren();
            using (List <Transform> .Enumerator enumerator = transformList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Object.Destroy((Object)enumerator.Current);
                }
            }
            for (int key = 0; key < this.drawFileNum; ++key)
            {
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: variable of a compiler-generated type
                TitleLoadScene.\u003CStartLoad\u003Ec__AnonStorey2 loadCAnonStorey2 = new TitleLoadScene.\u003CStartLoad\u003Ec__AnonStorey2();
                // ISSUE: reference to a compiler-generated field
                loadCAnonStorey2.\u003C\u003Ef__ref\u00241 = loadCAnonStorey1;
                GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.nodeSaveButton);
                gameObject.get_transform().SetParent(this.objSaveContentParent.get_transform(), false);
                // ISSUE: reference to a compiler-generated field
                loadCAnonStorey2.info = (TitleSaveItemInfo)gameObject.GetComponent <TitleSaveItemInfo>();
                // ISSUE: reference to a compiler-generated field
                if (!Object.op_Implicit((Object)loadCAnonStorey2.info))
                {
                    Object.Destroy((Object)gameObject);
                }
                else
                {
                    // ISSUE: reference to a compiler-generated field
                    loadCAnonStorey2.isFileExists = Singleton <Game> .Instance.Data.WorldList.ContainsKey(key);

                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: reference to a compiler-generated field
                    loadCAnonStorey2.info.objSave.SetActiveIfDifferent(loadCAnonStorey2.isFileExists);
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: reference to a compiler-generated field
                    loadCAnonStorey2.info.objInitialize.SetActiveIfDifferent(!loadCAnonStorey2.isFileExists);
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: reference to a compiler-generated field
                    loadCAnonStorey2.info.isData = loadCAnonStorey2.isFileExists;
                    // ISSUE: reference to a compiler-generated field
                    loadCAnonStorey2.info.num = key + 1;
                    // ISSUE: reference to a compiler-generated field
                    if (loadCAnonStorey2.isFileExists)
                    {
                        WorldData world = Singleton <Game> .Instance.Data.WorldList[key];
                        // ISSUE: reference to a compiler-generated field
                        loadCAnonStorey2.info.txtTitle.set_text(world.Name);
                        // ISSUE: reference to a compiler-generated field
                        loadCAnonStorey2.info.txtDay.set_text(world.SaveTime.ToShortDateString());
                        // ISSUE: reference to a compiler-generated field
                        loadCAnonStorey2.info.txtTime.set_text(world.SaveTime.ToLongTimeString());
                    }
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: method pointer
                    loadCAnonStorey2.info.action.listActionEnter.Add(new UnityAction((object)loadCAnonStorey2, __methodptr(\u003C\u003Em__0)));
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: method pointer
                    loadCAnonStorey2.info.action.listActionExit.Add(new UnityAction((object)loadCAnonStorey2, __methodptr(\u003C\u003Em__1)));
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: reference to a compiler-generated method
                    ObservableExtensions.Subscribe <Unit>((IObservable <M0>)UnityUIComponentExtensions.OnClickAsObservable(loadCAnonStorey2.info.btnEntry), (Action <M0>) new Action <Unit>(loadCAnonStorey2.\u003C\u003Em__2));
                    // ISSUE: reference to a compiler-generated field
                    UnityUIComponentExtensions.SubscribeToInteractable((IObservable <bool>)ObserveExtensions.ObserveEveryValueChanged <TitleLoadScene, bool>((M0)this, (Func <M0, M1>)(_ => !Singleton <Scene> .Instance.IsNowLoadingFade), (FrameCountType)0, false), (Selectable)loadCAnonStorey2.info.btnEntry);
                    // ISSUE: reference to a compiler-generated field
                    this.lstSaveInfo.Add(loadCAnonStorey2.info);
                }
            }
            // ISSUE: reference to a compiler-generated method
            ObservableExtensions.Subscribe <Unit>((IObservable <M0>)UnityUIComponentExtensions.OnClickAsObservable(this.btnLoadUIClose), (Action <M0>) new Action <Unit>(loadCAnonStorey1.\u003C\u003Em__4));
            ObservableExtensions.Subscribe <PointerEventData>((IObservable <M0>)ObservableTriggerExtensions.OnPointerEnterAsObservable((UIBehaviour)this.btnLoadUIClose), (Action <M0>)(_ => Singleton <Resources> .Instance.SoundPack.Play(SoundPack.SystemSE.Select)));
            IObservable <Unit> observable1 = (IObservable <Unit>)Observable.Where <Unit>(Observable.Where <Unit>((IObservable <M0>)ObservableTriggerExtensions.UpdateAsObservable((UnityEngine.Component) this), (Func <M0, bool>)(_ => Object.op_Equality((Object)Singleton <Game> .Instance.ExitScene, (Object)null) && Object.op_Equality((Object)Singleton <Game> .Instance.Config, (Object)null))), (Func <M0, bool>)(_ => !Singleton <Scene> .Instance.IsNowLoadingFade));
            IObservable <Unit> observable2 = (IObservable <Unit>)Observable.Where <Unit>((IObservable <M0>)observable1, (Func <M0, bool>)(_ => Input.GetMouseButtonDown(1)));

            // ISSUE: reference to a compiler-generated method
            // ISSUE: reference to a compiler-generated method
            // ISSUE: reference to a compiler-generated method
            ObservableExtensions.Subscribe <Unit>(Observable.Where <Unit>(Observable.Where <Unit>((IObservable <M0>)observable2, (Func <M0, bool>) new Func <Unit, bool>(loadCAnonStorey1.\u003C\u003Em__5)), (Func <M0, bool>) new Func <Unit, bool>(loadCAnonStorey1.\u003C\u003Em__6)), (Action <M0>) new Action <Unit>(loadCAnonStorey1.\u003C\u003Em__7));
            // ISSUE: reference to a compiler-generated method
            // ISSUE: reference to a compiler-generated method
            ObservableExtensions.Subscribe <Unit>(Observable.Where <Unit>((IObservable <M0>)observable2, (Func <M0, bool>) new Func <Unit, bool>(loadCAnonStorey1.\u003C\u003Em__8)), (Action <M0>) new Action <Unit>(loadCAnonStorey1.\u003C\u003Em__9));
            // ISSUE: reference to a compiler-generated method
            // ISSUE: reference to a compiler-generated method
            ObservableExtensions.Subscribe <Unit>(Observable.Where <Unit>((IObservable <M0>)observable2, (Func <M0, bool>) new Func <Unit, bool>(loadCAnonStorey1.\u003C\u003Em__A)), (Action <M0>) new Action <Unit>(loadCAnonStorey1.\u003C\u003Em__B));
            // ISSUE: reference to a compiler-generated method
            // ISSUE: reference to a compiler-generated method
            ObservableExtensions.Subscribe <Unit>(Observable.Where <Unit>(Observable.Where <Unit>((IObservable <M0>)observable1, (Func <M0, bool>) new Func <Unit, bool>(loadCAnonStorey1.\u003C\u003Em__C)), (Func <M0, bool>)(_ => Input.GetKeyDown((KeyCode)(int)sbyte.MaxValue))), (Action <M0>) new Action <Unit>(loadCAnonStorey1.\u003C\u003Em__D));
        }
Ejemplo n.º 3
0
 public static void FocusAdd(
     this Component component,
     bool isTabKey,
     Func <bool> isFocus,
     Func <int> next,
     Func <Tuple <bool, int> > direct,
     int firstIndex,
     params Selectable[] sels)
 {
     if (((IList <Selectable>)sels).IsNullOrEmpty <Selectable>())
     {
         Debug.LogError((object)"FocusRegister Selection None");
     }
     else
     {
         Selectable lastCurrent = sels.SafeGet <Selectable>(firstIndex);
         ObservableExtensions.Subscribe <Selectable>((IObservable <M0>)Observable.Select <GameObject, Selectable>((IObservable <M0>)ObserveExtensions.ObserveEveryValueChanged <Component, GameObject>((M0)component, (Func <M0, M1>)(_ => EventSystem.get_current().get_currentSelectedGameObject()), (FrameCountType)0, false), (Func <M0, M1>)(go => Object.op_Inequality((Object)go, (Object)null) ? (Selectable)go.GetComponent <Selectable>() : (Selectable)null)), (Action <M0>)(sel =>
         {
             if (((IEnumerable <Selectable>)sels).Contains <Selectable>(sel))
             {
                 lastCurrent = sel;
             }
             else
             {
                 if (!isFocus() || !Object.op_Inequality((Object)lastCurrent, (Object)null))
                 {
                     return;
                 }
                 lastCurrent.Select();
             }
         }));
         Action <int, bool> focus = (Action <int, bool>)((index, isDirect) =>
         {
             bool flag = index >= 0;
             if (!isDirect)
             {
                 index += sels.Check <Selectable>((Func <Selectable, bool>)(v => Object.op_Equality((Object)v, (Object)lastCurrent)));
             }
             MathfEx.LoopValue(ref index, 0, sels.Length - 1);
             if (!sels[index].IsInteractable() && ((IEnumerable <Selectable>)sels).Any <Selectable>((Func <Selectable, bool>)(p => p.IsInteractable())))
             {
                 if (!flag)
                 {
                     index = Mathf.Min(sels.Length, index + 1);
                 }
                 IEnumerable <int> ints1 = Enumerable.Range(index, sels.Length - index);
                 IEnumerable <int> ints2 = Enumerable.Range(0, index);
                 index = (!flag ? ints2.Reverse <int>().Concat <int>(ints1.Reverse <int>()) : ints1.Concat <int>(ints2)).FirstOrDefault <int>((Func <int, bool>)(i => sels[i].IsInteractable()));
             }
             sels[index].Select();
         });
         if (isTabKey)
         {
             ObservableExtensions.Subscribe <Unit>(Observable.Where <Unit>(Observable.Where <Unit>((IObservable <M0>)ObservableTriggerExtensions.UpdateAsObservable(component), (Func <M0, bool>)(_ => isFocus())), (Func <M0, bool>)(_ => Input.GetKeyDown((KeyCode)9))), (Action <M0>)(_ => focus(Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303) ? -1 : 1, false)));
         }
         if (!next.IsNullOrEmpty())
         {
             ObservableExtensions.Subscribe <Unit>(Observable.Where <Unit>((IObservable <M0>)ObservableTriggerExtensions.UpdateAsObservable(component), (Func <M0, bool>)(_ => isFocus())), (Action <M0>)(_ =>
             {
                 int num = next();
                 if (num == 0)
                 {
                     return;
                 }
                 focus(num, false);
             }));
         }
         if (direct.IsNullOrEmpty())
         {
             return;
         }
         ObservableExtensions.Subscribe <Unit>(Observable.Where <Unit>((IObservable <M0>)ObservableTriggerExtensions.UpdateAsObservable(component), (Func <M0, bool>)(_ => isFocus())), (Action <M0>)(_ =>
         {
             Tuple <bool, int> tuple = direct();
             if (!tuple.Item1)
             {
                 return;
             }
             focus(tuple.Item2, true);
         }));
     }
 }
Ejemplo n.º 4
0
        public static Tuple <Selectable, SelectUI> SelectSE(
            this Selectable selectable)
        {
            SelectUI selectUI = ((Component)selectable).GetOrAddComponent <SelectUI>();

            ObservableExtensions.Subscribe <bool>(Observable.Where <bool>(Observable.TakeUntilDestroy <bool>((IObservable <M0>)ObserveExtensions.ObserveEveryValueChanged <Selectable, bool>((M0)selectable, (Func <M0, M1>)(_ => selectUI.IsSelect && selectable.IsInteractable()), (FrameCountType)0, false), (Component)selectable), (Func <M0, bool>)(sel => sel)), (Action <M0>)(_ => Illusion.Game.Utils.Sound.Play(SystemSE.sel)));
            return(Tuple.Create <Selectable, SelectUI>(selectable, selectUI));
        }
Ejemplo n.º 5
0
 private void Start()
 {
     DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <float>((IObservable <M0>)ObserveExtensions.ObserveEveryValueChanged <Camera, float>((M0)this.mainCamera, (Func <M0, M1>)(_c => _c.get_fieldOfView()), (FrameCountType)0, false), (Action <M0>)(_f => this.targetCamera.set_fieldOfView(_f))), (Component)this);
     DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <float>((IObservable <M0>)ObserveExtensions.ObserveEveryValueChanged <Camera, float>((M0)this.mainCamera, (Func <M0, M1>)(_c => _c.get_nearClipPlane()), (FrameCountType)0, false), (Action <M0>)(_f => this.targetCamera.set_nearClipPlane(_f))), (Component)this);
     DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <float>((IObservable <M0>)ObserveExtensions.ObserveEveryValueChanged <Camera, float>((M0)this.mainCamera, (Func <M0, M1>)(_c => _c.get_farClipPlane()), (FrameCountType)0, false), (Action <M0>)(_f => this.targetCamera.set_farClipPlane(_f))), (Component)this);
 }