コード例 #1
0
    private void Awake()
    {
        GameSceneManager mGameSceneManager = FindObjectOfType <GameSceneManager>();

        RayConfig.LRRayConfig rayConfig = ((RayConfig)Resources.Load(ConstString.Path.RAY_CONFIG)).GetLRRayConfig;
        LRRay                lRRay      = new LRRay(transform, rayConfig);
        RaycastHit           lHitInfo;
        RaycastHit           rHitInfo;
        BoolReactiveProperty lHit = new BoolReactiveProperty();
        BoolReactiveProperty rHit = new BoolReactiveProperty();

        this.UpdateAsObservable()
        .Where(_ => mGameSceneManager.SceneState == SceneState.REPLAY)
        .Subscribe(_ =>
        {
            lHit.Value = lRRay.LBoxRay(out lHitInfo);
            rHit.Value = lRRay.RBoxRay(out rHitInfo);
        });

        this.OnCollisionEnterAsObservable()
        .Where(_ => mGameSceneManager.SceneState == SceneState.REPLAY)
        .Subscribe(_ =>
        {
            foreach (ContactPoint point in _.contacts)
            {
                Instantiate(mParticle, point.point, Quaternion.identity);
            }
        });
    }
コード例 #2
0
        protected override void Awake()
        {
            base.Awake();

            var button = GetComponent <Button>();

            var open = new BoolReactiveProperty(false);

            open.Subscribe(isOpen =>
            {
                m_Tray.gameObject.SetActive(isOpen);
                m_ClickAwayRect.gameObject.SetActive(isOpen);
            })
            .AddTo(this);

            button.OnPointerClickAsObservable()
            .Subscribe(ignored => { open.Value = !open.Value; })
            .AddTo(this);

            m_Controller.color.Subscribe(color =>
            {
                var sprite = Array.Find(m_Colors,
                                        c => c.name == Enum.GetName(typeof(CatalogueColorEnum), color).ToLower());
                m_Image.sprite = sprite;
                open.Value     = false;
            }).AddTo(this);

            m_ClickAwayRect.OnPointerClickAsObservable()
            .Subscribe(ignored => { open.Value = false; })
            .AddTo(this);
        }
コード例 #3
0
        public ReactiveProperty <bool> SubscribeGallowImage()
        {
            var boolReactiveProperty = new BoolReactiveProperty(false);

            IsGallowPartVisible.Add(boolReactiveProperty);
            return(boolReactiveProperty);
        }
コード例 #4
0
 /// <summary>
 /// パラメータ初期化
 /// </summary>
 public void Init()
 {
     TimeLimit = new FloatReactiveProperty(60.0f);
     Score     = new IntReactiveProperty(0);
     NowCount  = 0;
     GameStart = new BoolReactiveProperty(false);
 }
コード例 #5
0
        private void Awake()
        {
            IsFull = new BoolReactiveProperty();

            Rows      = new List <IEnumerable <GridSlot> >();
            Cols      = new List <IEnumerable <GridSlot> >();
            Diagonals = new List <IEnumerable <GridSlot> >();

            //rows
            Rows = Rows.Append(Slots.Take(3));
            Rows = Rows.Append(Slots.Skip(3).Take(3));
            Rows = Rows.Append(Slots.Skip(6).Take(3));

            //cols
            Cols = Cols.Append(Slots.ByIndexes(0, 3, 6));
            Cols = Cols.Append(Slots.ByIndexes(1, 4, 7));
            Cols = Cols.Append(Slots.ByIndexes(2, 5, 8));

            //diagonals
            Diagonals = Diagonals.Append(Slots.ByIndexes(0, 4, 8));
            Diagonals = Diagonals.Append(Slots.ByIndexes(2, 4, 6));

            //display rows, cols, diagonals for debug purpose
            Debug.LogFormat("Rows: [{0}]", Rows.Aggregate("", (current, row) => current + "(" + string.Join(",", row.Select(s => s.name)) + ")"));
            Debug.LogFormat("Cols: [{0}]", Cols.Aggregate("", (current, col) => current + "(" + string.Join(",", col.Select(s => s.name)) + ")"));
            Debug.LogFormat("Diagonals: [{0}]", Diagonals.Aggregate("", (current, diagonal) => current + "(" + string.Join(",", diagonal.Select(s => s.name)) + ")"));
        }
コード例 #6
0
        public SettingsModel(SavegameService savegameService)
        {
            var settings = savegameService.Settings;

            IsMusicMuted   = settings.IsMusicMuted;
            IsEffectsMuted = settings.IsEffectsMuted;
        }
コード例 #7
0
ファイル: GameManager.cs プロジェクト: RLefrancoise/TicTacToe
        private void Awake()
        {
            CurrentPlayer = new ReactiveProperty <PlayerType>();
            IsGameStarted = new BoolReactiveProperty();
            IsGameOver    = new BoolReactiveProperty();

            WinTheGame = IsGameOver.Select(_ => IsGameOver.Value).ToReactiveCommand <WinnerType>();
        }
コード例 #8
0
ファイル: GameModel.cs プロジェクト: einsof/HOTest
 public GameModel()
 {
     Seconds          = new IntReactiveProperty(0);
     Objects          = new List <ObjectModel>();
     Stars            = new IntReactiveProperty(0);
     ObjectsCollected = new IntReactiveProperty(0);
     Completed        = new BoolReactiveProperty(false);
 }
コード例 #9
0
    public override void Initialize(DrumSequence firstSequence, int selfIndex, OnSequenceComplete sequenceCallback, List <Color> colorMap)
    {
        this.selfIndex           = selfIndex;
        sequenceCompleteCallback = sequenceCallback;

        uiParent = transform.GetChild(0).gameObject;

        mainCamera             = Camera.main;
        originalCameraPosition = mainCamera.transform.localPosition;

        segmentHighlighter.Initialize();

        prompts = new List <DrumGamePrompt>();
        promptPrefab.SetActive(false);

        this.colorMap = colorMap;

        reactiveSequence = new ReactiveProperty <DrumSequence>(firstSequence);
        sequenceIndex    = new IntReactiveProperty(0);

        isVisible = new BoolReactiveProperty();
        isActive  = new BoolReactiveProperty();

        isActive.Subscribe(active => ToggleActivePromptHighlight(active));
        isActive.Subscribe(active => firstFrameActive = active);
        isActive.Subscribe(active => SetCamToOriginOnDisable(active));

        isVisible.Subscribe(visible => SetVisibility(visible));

        reactiveSequence.Subscribe(sequence => SetHiddenState(sequence));
        reactiveSequence.Subscribe(sequence => SpawnAndArrangePrompts(sequence));
        reactiveSequence.Subscribe(sequence => LabelDrumPrompts(sequence));
        reactiveSequence.Subscribe(sequence => ColorDrumPrompts(sequence));
        reactiveSequence.Subscribe(sequence => SetRepeatsValue(sequence));
        reactiveSequence.Subscribe(delegate { if (cameraZoomingOutCoroutine != null)
                                              {
                                                  StopCoroutine(cameraZoomingOutCoroutine);
                                              }
                                   });
        if (lineEditor != null)
        {
            reactiveSequence.Subscribe(sequence => lineEditor.SetSequence(sequence));
        }

        sequenceIndex.Subscribe(index => SetPromptHighlight(index));
        sequenceIndex.Subscribe(index => AnimateCameraFollow(index));

        var toggleEditStream = Observable.EveryUpdate().Where(_ => Input.GetKeyDown(toggleEditingKey));

        toggleEditStream.Subscribe(_ => editing = !editing);
        toggleEditStream.Subscribe(_ => lineEditor.isEditing.Value = editing);
        toggleEditStream.Subscribe(_ => Debug.Log($"Line mode Editing set to {editing}"));

        if (lineEditor != null)
        {
            lineEditor.SetPromptsRef(prompts);
        }
    }
コード例 #10
0
    public void Test_Rx()
    {
        //Arrange
        var rx         = new BoolReactiveProperty();
        var gameObject = new GameObject();

        rx.Select(b => b.ToString()).RepeatUntilDestroy(gameObject).Subscribe(Debug.Log);
        rx.Value = true;
        rx.Value = true;
    }
コード例 #11
0
ファイル: ModelBase.cs プロジェクト: facybenbook/Chess2
 protected ModelBase(IOwner owner)
 {
     LogSubject = this;
     LogPrefix  = "Model";
     _owner     = new ReactiveProperty <IOwner>(owner);
     _destroyed = new BoolReactiveProperty(false);
     Verbosity  = Parameters.DefaultLogVerbosity;
     ShowStack  = Parameters.DefaultShowTraceStack;
     ShowSource = Parameters.DefaultShowTraceSource;
 }
コード例 #12
0
 public TodoModel(
     string _title,
     bool _completed = false,
     bool _editing   = false
     )
 {
     title     = new StringReactiveProperty(_title);
     completed = new BoolReactiveProperty(_completed);
     editing   = new BoolReactiveProperty(_editing);
 }
コード例 #13
0
        private void Start()
        {
            List <Color> baseTextMeshColor = ((IEnumerable <TextMeshProUGUI>) this.targetTextMesh).Select <TextMeshProUGUI, Color>((Func <TextMeshProUGUI, Color>)(t => ((Graphic)t).get_color())).ToList <Color>();
            List <Color> baseTextColor     = ((IEnumerable <Text>) this.targetText).Select <Text, Color>((Func <Text, Color>)(t => ((Graphic)t).get_color())).ToList <Color>();
            List <Color> baseImageColor    = ((IEnumerable <Image>) this.targetImage).Select <Image, Color>((Func <Image, Color>)(t => ((Graphic)t).get_color())).ToList <Color>();

            Color[] baseRawImageColor       = ((IEnumerable <RawImage>) this.targetRawImage).Select <RawImage, Color>((Func <RawImage, Color>)(t => ((Graphic)t).get_color())).ToArray <Color>();
            BoolReactiveProperty isInteract = new BoolReactiveProperty(((Selectable)this.flagButton).get_interactable());

            ObservableExtensions.Subscribe <bool>((IObservable <M0>)isInteract, (Action <M0>)(isOn =>
            {
                ColorBlock colors       = ((Selectable)this.flagButton).get_colors();
                List <Color> colorList1 = new List <Color>((IEnumerable <Color>)baseTextMeshColor);
                List <Color> colorList2 = new List <Color>((IEnumerable <Color>)baseTextColor);
                List <Color> colorList3 = new List <Color>((IEnumerable <Color>)baseImageColor);
                List <Color> colorList4 = new List <Color>((IEnumerable <Color>)baseRawImageColor);
                if (!isOn)
                {
                    for (int index = 0; index < this.targetTextMesh.Count; ++index)
                    {
                        colorList1[index] = new Color(Mathf.Clamp01((float)(colorList1[index].r * ((ColorBlock) ref colors).get_disabledColor().r)), Mathf.Clamp01((float)(colorList1[index].g * ((ColorBlock) ref colors).get_disabledColor().g)), Mathf.Clamp01((float)(colorList1[index].b * ((ColorBlock) ref colors).get_disabledColor().b)), Mathf.Clamp01((float)(colorList1[index].a * ((ColorBlock) ref colors).get_disabledColor().a)));
                    }
                    for (int index = 0; index < this.targetText.Count; ++index)
                    {
                        colorList2[index] = new Color(Mathf.Clamp01((float)(colorList2[index].r * ((ColorBlock) ref colors).get_disabledColor().r)), Mathf.Clamp01((float)(colorList2[index].g * ((ColorBlock) ref colors).get_disabledColor().g)), Mathf.Clamp01((float)(colorList2[index].b * ((ColorBlock) ref colors).get_disabledColor().b)), Mathf.Clamp01((float)(colorList2[index].a * ((ColorBlock) ref colors).get_disabledColor().a)));
                    }
                    for (int index = 0; index < this.targetImage.Count; ++index)
                    {
                        colorList3[index] = new Color(Mathf.Clamp01((float)(colorList3[index].r * ((ColorBlock) ref colors).get_disabledColor().r)), Mathf.Clamp01((float)(colorList3[index].g * ((ColorBlock) ref colors).get_disabledColor().g)), Mathf.Clamp01((float)(colorList3[index].b * ((ColorBlock) ref colors).get_disabledColor().b)), Mathf.Clamp01((float)(colorList3[index].a * ((ColorBlock) ref colors).get_disabledColor().a)));
                    }
                    for (int index = 0; index < this.targetRawImage.Count; ++index)
                    {
                        colorList4[index] = new Color(Mathf.Clamp01((float)(colorList4[index].r * ((ColorBlock) ref colors).get_disabledColor().r)), Mathf.Clamp01((float)(colorList4[index].g * ((ColorBlock) ref colors).get_disabledColor().g)), Mathf.Clamp01((float)(colorList4[index].b * ((ColorBlock) ref colors).get_disabledColor().b)), Mathf.Clamp01((float)(colorList4[index].a * ((ColorBlock) ref colors).get_disabledColor().a)));
                    }
                }
                for (int index = 0; index < this.targetTextMesh.Count; ++index)
                {
                    ((Graphic)this.targetTextMesh[index]).set_color(colorList1[index]);
                }
                for (int index = 0; index < this.targetText.Count; ++index)
                {
                    ((Graphic)this.targetText[index]).set_color(colorList2[index]);
                }
                for (int index = 0; index < this.targetImage.Count; ++index)
                {
                    ((Graphic)this.targetImage[index]).set_color(colorList3[index]);
                }
                for (int index = 0; index < this.targetRawImage.Count; ++index)
                {
                    ((Graphic)this.targetRawImage[index]).set_color(colorList4[index]);
                }
            }));
            ObservableExtensions.Subscribe <Unit>((IObservable <M0>)ObservableTriggerExtensions.OnEnableAsObservable((UnityEngine.Component) this), (Action <M0>)(_ => ((ReactiveProperty <bool>)isInteract).set_Value(((Selectable)this.flagButton).get_interactable())));
            ObservableExtensions.Subscribe <bool>(Observable.DistinctUntilChanged <bool>((IObservable <M0>)Observable.Select <Unit, bool>((IObservable <M0>)ObservableTriggerExtensions.UpdateAsObservable((UnityEngine.Component) this), (Func <M0, M1>)(_ => ((Selectable)this.flagButton).get_interactable()))), (Action <M0>)(interactable => ((ReactiveProperty <bool>)isInteract).set_Value(interactable)));
        }
コード例 #14
0
ファイル: PlayerCharacter.cs プロジェクト: vcow/schatzsucher
 public PlayerCharacter(IInput input, string id, int numLives = 1, float health = 1f,
                        Vector2Int?position = null, bool isActive = false, bool isMainPlayer = true)
 {
     Input         = input;
     _id           = id;
     _isMainPlayer = isMainPlayer;
     NumLives      = new IntReactiveProperty(numLives);
     Health        = new FloatReactiveProperty(health);
     Position      = new ReactiveProperty <Vector2Int>(position ?? Vector2Int.zero);
     IsActive      = new BoolReactiveProperty(isActive);
 }
コード例 #15
0
ファイル: RPLink.cs プロジェクト: zwlstc1092/ZFramework-1
        public static BoolReactiveProperty GetRp(string name, bool initialValueIfEmpty = true)
        {
            BoolReactiveProperty boolrp = null;

            if (!mBoolRpDic.TryGetValue(name, out boolrp))
            {
                boolrp = new BoolReactiveProperty(initialValueIfEmpty);
                mBoolRpDic.Add(name, boolrp);
            }
            return(boolrp);
        }
コード例 #16
0
ファイル: CPlayerCharacter3D.cs プロジェクト: Chrisdbhr/CDK
        protected override void OnEnable()
        {
            base.OnEnable();

            this._enableSlideRx         = new ReactiveProperty <bool>(true);
            this._isTouchingTheGroundRx = new BoolReactiveProperty(true);
            this._isOnFreeFall          = new BoolReactiveProperty(false);
            this._distanceOnFreeFall    = new FloatReactiveProperty();


            // can slide
            this._enableSlideRx.TakeUntilDisable(this).DistinctUntilChanged().Subscribe(canSlide => {
                // stopped sliding
                if (!canSlide && this.CurrentMovState == CMovState.Sliding)
                {
                    this.SetMovementState(CMovState.Walking);
                }
            });

            #region <<---------- Fall ---------->>

            this._isTouchingTheGroundRx.TakeUntilDisable(this).DistinctUntilChanged().Subscribe(isTouchingTheGround => {
                if (isTouchingTheGround && this._animator != null)
                {
                    if (this._debug)
                    {
                        Debug.Log($"<color={"#D76787"}>{this.name}</color> touched the ground, velocityY: '{this.Velocity.y}', {nameof(this._distanceOnFreeFall)}: '{this._distanceOnFreeFall.Value}', {nameof(this._lastYPositionCharWasNotFalling)}: '{this._lastYPositionCharWasNotFalling}'");
                    }
                    int fallAnimIndex = 0;
                    if (this._distanceOnFreeFall.Value >= 6f)
                    {
                        fallAnimIndex = 2;
                    }
                    else if (this._distanceOnFreeFall.Value >= 2f)
                    {
                        fallAnimIndex = 1;
                    }
                    this._animator.SetInteger(ANIM_FALL_LANDING_ANIM_INDEX, fallAnimIndex);
                }
                this.MovementMomentumXZ = isTouchingTheGround ? Vector3.zero : this.GetMyVelocityXZ();
            });

            this._isOnFreeFall.TakeUntilDisable(this).DistinctUntilChanged().Subscribe(isFallingNow => {
                this._animator.CSetBoolSafe(this.ANIM_CHAR_IS_FALLING, isFallingNow);
                this._distanceOnFreeFall.Value = 0f;
            });

            this._distanceOnFreeFall.TakeUntilDisable(this).DistinctUntilChanged().Subscribe(distanceOnFreeFall => {
                this._animator.CSetFloatSafe(this.ANIM_DISTANCE_ON_FREE_FALL, distanceOnFreeFall);
            });

            #endregion <<---------- Fall ---------->>
        }
コード例 #17
0
ファイル: UserInput.cs プロジェクト: alexppc/MysteryTagTest
    public void SetUIShootProperty(BoolReactiveProperty prop)
    {
#if !UNITY_EDITOR
        if (m_UIShoot != null)
        {
            m_UIShoot.Dispose();
        }
#endif
        m_UIShoot = prop;
#if !UNITY_EDITOR
        m_UIShoot.Subscribe(ChangeShootState);
#endif
    }
コード例 #18
0
    private void Awake()
    {
        mainCamera = Camera.main;

        undoIndexStack = new Stack <int>();
        redoIndexStack = new Stack <int>();
        undoCoordStack = new Stack <Vector3>();
        redoCoordStack = new Stack <Vector3>();

        isEditing = new BoolReactiveProperty();

        isEditing.Subscribe(DropPromptWhenEditEnds);
    }
コード例 #19
0
        public SceneTransitionService()
        {
            _currentScene = new ReactiveProperty <Scenes>(Scenes.Init);
            CurrentScene  = _currentScene.ToReadOnlyReactiveProperty();

            _state = new ReactiveProperty <TransitionState>(TransitionState.None);
            State  = _state.ToReadOnlyReactiveProperty();

            _isLoading = new BoolReactiveProperty(false);
            IsLoading  = _isLoading.ToReadOnlyReactiveProperty();

            SetupSubscriptions();
            SceneManager.sceneLoaded += OnSceneLoaded;
        }
コード例 #20
0
        private void Start()
        {
            var isOpen  = new BoolReactiveProperty(false);
            var command = new ReactiveCommand <string>(isOpen);

            _ = WaitCommandAsync(command);

            // isOpen = false なので何も起きない
            command.Execute("Not work!");

            // ReactiveCommandを有効化
            isOpen.Value = true;

            // isOpen = true なのでコマンド実行
            command.Execute("Work!");
        }
コード例 #21
0
    private void Awake()
    {
        _animator       = transform.GetComponent <Animator>();
        _canvas         = transform.GetComponent <CanvasGroup>();
        _appStateBroker = AppStateBroker.Instance;
        _teamManager    = TeamManager.Instance;
        _timWindow      = BindTimeWindow(Lane);
        _inputModule    = InputModule.Instance;

        OnClientAdded(Initialize).AddTo(gameObject);
        Off();

        _playerData = BindPlayerData(Lane);

        OnTimeWindowClosed().AddTo(gameObject);
    }
コード例 #22
0
 protected CardCollectionModelBase(IPlayerModel owner)
     : base(owner)
 {
     SetOwner(owner);
     _numCards = new IntReactiveProperty(0);
     _empty    = new BoolReactiveProperty(true);
     _maxxed   = new BoolReactiveProperty(false);
     _Cards    = new ReactiveCollection <ICardModel>();
     _Cards.ObserveCountChanged().Subscribe(n =>
     {
         _numCards.Value = n;
         _maxxed.Value   = n == MaxCards;
         _empty.Value    = n == 0;
     }
                                            );
 }
コード例 #23
0
    private void Awake()
    {
        if (instance != null)
        {
            throw new Exception("Only one App allowed!");
        }
        instance = this;
        inGame.Init(this);
        endOfDay.Init(this);
        stateMachine = new StateMachine <App>();
        if (SoundManager.Instance == null)
        {
            Instantiate(soundManagerPrefab);
        }

        EndOfDayActive = new BoolReactiveProperty(false);
    }
コード例 #24
0
ファイル: Bomb.cs プロジェクト: 5h00T/SShooting
    void Awake()
    {
        visualEffect = GetComponent <VisualEffect>();

        isComplete = new BoolReactiveProperty(false);

        // Start内でStopが動かない
        // visualEffect.SendEvent("OnStop");
        // visualEffect.Stop();
        // visualEffect.pause = true;

        /*
         * Observable.NextFrame()
         *  .Subscribe(_ => visualEffect.Stop());
         */

        MainRoutine();
    }
コード例 #25
0
ファイル: UniRXTest.cs プロジェクト: Fusa-F/UniRx-train
    /// <summary> TriggerイベントのObservable化 </summary>
    private void SampleTriggerEvent()
    {
        bool mOnWall = false;
        ReactiveProperty <bool> OnWall = new BoolReactiveProperty(false);
        var sub = new Subject <Unit>();

        //フラグが有効な間、上向きに力を加える
        this.FixedUpdateAsObservable()
        .Where(_ => mOnWall)
        .Subscribe(_ => print("壁に触れているか: " + OnWall.Value));

        this.OnTriggerEnter2DAsObservable()
        .Where(other => other.gameObject.tag == "Wall")
        .Subscribe(_ => mOnWall = true);

        this.OnTriggerExit2DAsObservable()
        .Where(other => other.gameObject.tag == "Wall")
        .Subscribe(_ => mOnWall = false);
    }
コード例 #26
0
    private void Awake()
    {
        GameSceneManager     gameSceneManager = FindObjectOfType <GameSceneManager>();
        BoolReactiveProperty isDrift          = new BoolReactiveProperty(false);
        Vector3 prePos    = Vector3.zero;
        Vector3 direction = Vector3.zero;

        if (mSmokes.Length <= 0)
        {
            return;
        }

        this.UpdateAsObservable()
        .Where(_ => gameSceneManager.SceneState == SceneState.REPLAY)
        .Subscribe(_ =>
        {
            direction = transform.position - prePos;
            if (direction.magnitude < IGNORE_LENGTH)
            {
                isDrift.Value = false;
                return;
            }
            prePos          = transform.position;
            float slipAngle = Vector3.Angle(direction, transform.forward);
            isDrift.Value   = slipAngle > SMOKE_ANGLE && slipAngle < IGNORE_ANGLE;
        })
        .AddTo(gameObject);

        this.OnEnableAsObservable().Subscribe(_ => StopParticles(mSmokes));

        isDrift
        .Where(_ => gameSceneManager.SceneState == SceneState.REPLAY)
        .Where(_ => _)
        .Subscribe(_ => { PlayParticles(mSmokes); })
        .AddTo(gameObject);

        isDrift
        .Where(_ => gameSceneManager.SceneState == SceneState.REPLAY)
        .Where(_ => !_)
        .Subscribe(_ => { StopParticles(mSmokes); })
        .AddTo(gameObject);
    }
コード例 #27
0
    private IntReactiveProperty repeatsRemaining; //iterations left before advancing levelIndex

    public override void Initialize(DrumSequence firstSequence, int selfIndex, OnSequenceComplete sequenceCallback, List <Color> colorMap)
    {
        this.selfIndex           = selfIndex;
        sequenceCompleteCallback = sequenceCallback;

        uiParent = transform.GetChild(0).gameObject;

        prompts = new List <DrumGamePrompt>();
        promptPrefab.SetActive(false);

        this.colorMap = colorMap;

        arcHighlighter.Initialize();

        reactiveSequence = new ReactiveProperty <DrumSequence>(firstSequence);
        repeatsRemaining = new IntReactiveProperty(reactiveSequence.Value.repetitions);
        sequenceIndex    = new IntReactiveProperty(0);

        isVisible = new BoolReactiveProperty();
        isActive  = new BoolReactiveProperty();

        isActive.Subscribe(active => ToggleActivePromptHighlight(active));
        isActive.Subscribe(active => firstFrameActive = active);
        isVisible.Subscribe(visible => SetVisibility(visible));

        reactiveSequence.Subscribe(sequence => SetHiddenState(sequence));
        reactiveSequence.Subscribe(sequence => SpawnAndArrangePrompts(sequence));
        reactiveSequence.Subscribe(sequence => LabelDrumPrompts(sequence));
        reactiveSequence.Subscribe(sequence => ColorDrumPrompts(sequence));
        reactiveSequence.Subscribe(sequence => SetRepeatsValue(sequence));
        reactiveSequence.Subscribe(sequence => arcHighlighter.DrawArcs(sequence.keys.Count));

        sequenceIndex.Subscribe(index => SetPromptHighlight(index));

        repeatsRemaining.Subscribe(remaining => SetRepeatsText(remaining));

        baseX = highlightPivotT.rotation.eulerAngles.x;
        baseY = highlightPivotT.rotation.eulerAngles.y;
    }
コード例 #28
0
        public CBlockingEventsManager()
        {
            this.RetainedObjects = new HashSet <Object>();

            // on menu
            this._isOnMenuRx?.Dispose();
            this._isOnMenuRx = new BoolReactiveProperty();
            this._isOnMenuRx.Subscribe(onMenu => {
                Debug.Log($"<color={"#4fafb6"}>IsOnMenuEvent: {onMenu}</color>");
                this._onMenu?.Invoke(onMenu);
            });

            // playing cutscene
            this._isPlayingCutsceneRx?.Dispose();
            this._isPlayingCutsceneRx = new BoolReactiveProperty();
            this._isPlayingCutsceneRx.Subscribe(isPlayingCutscene => {
                Debug.Log($"<color={"#cc5636"}>IsPlayingCutscene: {isPlayingCutscene}</color>");
                this._onPlayCutscene?.Invoke(isPlayingCutscene);
            });

            // is doing blocking action
            this._isDoingBlockingAction = null;
            this._isDoingBlockingAction = new CRetainable();
            this._isDoingBlockingAction.IsRetainedRx.Subscribe(retained => {
                this._onDoingBlockingAction?.Invoke(retained);
            });

            // blocking Event Happening
            Observable.CombineLatest(
                this._isOnMenuRx,
                this._isPlayingCutsceneRx,
                this._isDoingBlockingAction.IsRetainedRx,
                (isOnMenu, isPlayingCutscene, isDoingBlockingAction) => isOnMenu || isPlayingCutscene || isDoingBlockingAction)
            .Subscribe(blockingEventHappening => {
                Debug.Log($"<color={"#b62a24"}>IsBlockingEventHappening changed to: {blockingEventHappening}</color>");
                this._isAnyBlockingEventHappening = blockingEventHappening;
                this._onAnyBlockingEventHappening?.Invoke(blockingEventHappening);
            });
        }
コード例 #29
0
            public static void MakerUiHideLagFix(CustomControl __instance)
            {
                var customControl = Traverse.Create(__instance);

                var hideFrontUi = customControl.Field("_hideFrontUI");
                var oldHide     = hideFrontUi.GetValue <BoolReactiveProperty>();

                oldHide.Dispose();
                var newHide = new BoolReactiveProperty(false);

                hideFrontUi.SetValue(newHide);

                var cvsSpace         = customControl.Field("cvsSpace").GetValue <Canvas>();
                var objFrontUiGroup  = customControl.Field("objFrontUIGroup").GetValue <GameObject>();
                var frontCanvasGroup = objFrontUiGroup.GetComponent <CanvasGroup>();

                //Modified code from CustomControl.Start -> _hideFrontUI.Subscribe anonymous method
                newHide.Subscribe(hideFront =>
                {
                    if (__instance.saveMode)
                    {
                        return;
                    }

                    //Instead of enabling/disabling the CanvasGroup Gameobject, just hide it and make it non-interactive
                    //This way we get the same effect but for no cost for load/unload
                    frontCanvasGroup.alpha          = hideFront ? 0f : 1f;
                    frontCanvasGroup.interactable   = !hideFront;
                    frontCanvasGroup.blocksRaycasts = !hideFront;

                    if (cvsSpace)
                    {
                        cvsSpace.enabled = !hideFront;
                    }
                    __instance.ChangeMainCameraRect(!hideFront ? CustomControl.MainCameraMode.Custom : CustomControl.MainCameraMode.View);
                });
            }
コード例 #30
0
ファイル: Game.cs プロジェクト: ly774508966/Alensia
 public Game()
 {
     _timeScale = new FloatReactiveProperty(1);
     _paused    = new BoolReactiveProperty();
 }