Esempio n. 1
0
 public PlayerModel(int lifes)
 {
     ProgressLevelIndex = new IntReactiveProperty(0);
     Lifes          = new IntReactiveProperty(lifes);
     LevelModelList = new List <LevelModel>();
     LevelModel     = new ReactiveCollection <LevelModel>(LevelModelList);
 }
Esempio n. 2
0
    public Character( StatExpressionsInfo statExpressions, CharacterPlanetPawn pawn, IInputSource inputSource, CharacterStatus status, CharacterStateController stateController, CharacterStateController weaponStateController, int teamId, CharacterInfo info )
    {
        this.statExpressions = statExpressions;
        this.status = status;
        this.health = new IntReactiveProperty( this.status.maxHealth.Value );
        this.pawn = pawn;
        this.inputSource = inputSource;
        this.stateController = stateController;
        this.weaponStateController = weaponStateController;
        this.teamId = teamId;
        this.info = info;
        this.inventory = new BasicInventory( this );

        pawn.SetCharacter( this );

        this.stateController.Initialize( this );
        this.weaponStateController.Initialize( this );

        var inputSourceDisposable = inputSource as IDisposable;
        if ( inputSourceDisposable != null ) {

            _compositeDisposable.Add( inputSourceDisposable );
        }

        Observable.EveryUpdate().Subscribe( OnUpdate ).AddTo( _compositeDisposable );
        status.moveSpeed.Subscribe( UpdatePawnSpeed ).AddTo( _compositeDisposable );
        health.Subscribe( OnHealthChange );//.AddTo( _compositeDisposable );

        instances.Add( this );
    }
Esempio n. 3
0
    public void ExecuteUnequip(int bodySlotIndex)
    {
        _unitSlotCompoundIndex = _unitController.SelectedUnit.BodySlots[bodySlotIndex]._CompoundIndex;
        _lifeCompounds         = _planetController.SelectedPlanet.Life.Compounds;

        Unequip();
    }
Esempio n. 4
0
    private void Awake()
    {
        UIPopUpHeart.SetUILobby(this);


        HeartArray = new GameObject[TOTAL_HEARTCOUNT];
        HeartArray = SceneMainLobby.HeartArray;

        mUserData = new UserData();


        mTime = new IntReactiveProperty();
        mTime.Subscribe((time) =>
        {
            Total_Timer = time;
            Min         = Total_Timer / 60;
            Sec         = Total_Timer % 60;

            SceneMainLobby.m_Timecontrol.text = string.Format("{0} :{1:D2}", Min, Sec);
        });

        if (CUILobby.instance == null)
        {
            CUILobby.instance = this;
        }
    }
Esempio n. 5
0
        public CardModel(IOwner owner, ICardTemplate template)
            : base(owner)
        {
            Template = template;

            _player   = new ReactiveProperty <IPlayerModel>(owner as IPlayerModel);
            _power    = new IntReactiveProperty(Template.Power);
            _health   = new IntReactiveProperty(Template.Health);
            _manaCost = new IntReactiveProperty(Template.ManaCost);

            _items     = new ReactiveCollection <IItemModel>(Template.Items);
            _abilities = new ReactiveCollection <EAbility>(Template.Abilities);
            _effects   = new ReactiveCollection <IEffectModel>(Template.Effects);

            _health.Subscribe(h => { if (h <= 0)
                                     {
                                         Die();
                                     }
                              });
            _effects.ObserveAdd().Subscribe(e => Info($"Added Effect {e} from {this}")).AddTo(this);
            _items.ObserveAdd().Subscribe(e => Info($"Added Item {e} from {this}")).AddTo(this);
            _abilities.ObserveAdd().Subscribe(e => Info($"Added Ability {e} from {this}")).AddTo(this);
            _effects.ObserveRemove().Subscribe(e => Info($"Removed Effect {e} from {this}")).AddTo(this);
            _items.ObserveRemove().Subscribe(e => Info($"Removed Item {e} from {this}")).AddTo(this);
            _abilities.ObserveRemove().Subscribe(e => Info($"Removed Ability {e} from {this}")).AddTo(this);
        }
Esempio n. 6
0
        public void Bind(StuffItem item, StuffItemInfo info = null)
        {
            this._info   = info ?? ItemNodeUI.GetItemInfo(item);
            this.isTrash = this._info.isTrash;
            this.isNone  = this._info.isNone;
            if (this.isNone)
            {
                this.isTrash = false;
                if (Object.op_Inequality((Object)this._stackCountText, (Object)null))
                {
                    ((Behaviour)this._stackCountText).set_enabled(false);
                }
            }
            ((ReactiveProperty <string>) this._name).set_Value(this._info.Name);
            if (Object.op_Inequality((Object)this._iconImage, (Object)null))
            {
                Resources.ItemIconTables.SetIcon(Resources.ItemIconTables.IconCategory.Item, this._info.IconID, this._iconImage, true);
                if (Object.op_Equality((Object)this._iconImage.get_sprite(), (Object)null))
                {
                    ((Behaviour)this._iconImage).set_enabled(false);
                }
            }
            this._rarelity.set_Value(this._info.Rarelity);
            IntReactiveProperty rate = this._rate;
            int?nullable             = item is MerchantData.VendorItem vendorItem ? new int?(vendorItem.Rate) : new int?();
            int num = !nullable.HasValue ? this._info.Rate : nullable.Value;

            ((ReactiveProperty <int>)rate).set_Value(num);
            this._rarelitySprite.set_Value(this._rarelities.GetElement <Sprite>((int)this._info.Grade));
            this._item = item;
            ((ReactiveProperty <int>) this._stackCount).set_Value(this._item.Count);
        }
Esempio n. 7
0
 /// <summary>
 /// パラメータ初期化
 /// </summary>
 public void Init()
 {
     TimeLimit = new FloatReactiveProperty(60.0f);
     Score     = new IntReactiveProperty(0);
     NowCount  = 0;
     GameStart = new BoolReactiveProperty(false);
 }
Esempio n. 8
0
    public void Initialize(int left, int bombNum, int bombStackSize)
    {
        visualEffect     = GetComponent <VisualEffect>();
        circleCollider2D = GetComponent <CircleCollider2D>();

        this.left          = new IntReactiveProperty(left);
        this.bombNum       = bombNum;
        this.bombStackSize = bombStackSize;

        gameCamera = GameObject.Find("Main Camera").GetComponent <Camera>();

        this.UpdateAsObservable()
        .Where(_ => status == Status.Alive)
        .Subscribe(_ => Move());

        this.UpdateAsObservable()
        .Where(_ => status == Status.Alive)
        .Where(_ => Input.GetMouseButton(0))
        .SampleFrame(4)
        .Subscribe(_ => Shot());

        this.UpdateAsObservable()
        .Where(_ => status == Status.Alive)
        .Subscribe(_ => BombCheck());

        this.OnTriggerEnter2DAsObservable()
        .Subscribe(gameObject => OnTriggerEnter(gameObject));
    }
Esempio n. 9
0
    private void Awake()
    {
        activeManagerIndex = new IntReactiveProperty();
        globalLevelIndex   = new IntReactiveProperty();

        onProgress         = new UnityEvent();
        onFinishRepetition = new UnityEvent();
        onMistake          = new UnityEvent();

        if (circleManagerTemplate != null)
        {
            InstantiateCircleManagers();
        }

        if (lineManager != null)
        {
            InitializeLineManager();
        }

        globalLevelIndex.Subscribe(index => PushSequencesToManagers(index));
        globalLevelIndex.Subscribe(_ => numVisibleManagers = CountVisibleManagers());

        activeManagerIndex.Subscribe(i => SetExclusiveActiveManager(i));

#if UNITY_EDITOR
        DrumGameLineEditor lineEditor = GetComponentInChildren <DrumGameLineEditor>();
        if (lineEditor != null)
        {
            lineEditor.SetRefreshDelegate(RefreshCurrentLevel);
        }
#endif
    }
Esempio n. 10
0
 public UserSave()
 {
     Coins         = new IntReactiveProperty(250);
     AppLanguage   = Enumerators.Language.NONE;
     ShopEnumTypes = new List <int>();
     //RefitViewData = new RefitViewData();
 }
Esempio n. 11
0
 public override void OnInputMoveDirection(MoveDirection moveDir)
 {
     if (moveDir != null)
     {
         if (moveDir != 2)
         {
             return;
         }
         IntReactiveProperty selectedId = this._selectedID;
         ((ReactiveProperty <int>)selectedId).set_Value(((ReactiveProperty <int>)selectedId).get_Value() + 1);
         if (((ReactiveProperty <int>) this._selectedID).get_Value() <= 1)
         {
             return;
         }
         ((ReactiveProperty <int>) this._selectedID).set_Value(0);
     }
     else
     {
         IntReactiveProperty selectedId = this._selectedID;
         ((ReactiveProperty <int>)selectedId).set_Value(((ReactiveProperty <int>)selectedId).get_Value() - 1);
         if (((ReactiveProperty <int>) this._selectedID).get_Value() >= 0)
         {
             return;
         }
         ((ReactiveProperty <int>) this._selectedID).set_Value(1);
     }
 }
Esempio n. 12
0
 private void Awake()
 {
     currentTurn = new IntReactiveProperty(0);
     food        = new IntReactiveProperty(initialFood);
     foodToGrow  = new IntReactiveProperty(0);
     money       = new IntReactiveProperty(initialMoney);
     draws       = new IntReactiveProperty(initialDraw);
 }
Esempio n. 13
0
 public GameModel()
 {
     Seconds          = new IntReactiveProperty(0);
     Objects          = new List <ObjectModel>();
     Stars            = new IntReactiveProperty(0);
     ObjectsCollected = new IntReactiveProperty(0);
     Completed        = new BoolReactiveProperty(false);
 }
Esempio n. 14
0
 internal void Setup(CompoundJSON compound, IntReactiveProperty amount)
 {
     disposables.Clear();
     Compound = compound;
     _controlMessage.Index = compound.Index;
     amount.Subscribe(_ => OnAmountChange(_)).AddTo(disposables);
     Icon.Setup(compound);
 }
Esempio n. 15
0
        public ProfileModel(SavegameService savegameService)
        {
            var profile = savegameService.Profile;

            Currency     = profile.Currency;
            BestDistance = profile.BestDistance;
            RoundsPlayed = profile.RoundsPlayed;
        }
Esempio n. 16
0
    public CharacterStatus( StatExpressionsInfo expressionsInfo )
    {
        strength = new IntReactiveProperty( 0 );
        agility = new IntReactiveProperty( 0 );

        maxHealth = CreateCalculator( expressionsInfo.healthExpression ).Select( _ => (int)_ ).ToReactiveProperty();
        moveSpeed = CreateCalculator( expressionsInfo.moveSpeedExpression ).Select( _ => (float)_ ).ToReactiveProperty();
    }
Esempio n. 17
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);
        }
    }
        private void Awake()
        {
            photonView = GetComponent <PhotonView>();

            for (var i = 0; i < 2; i++)
            {
                _score[i] = new IntReactiveProperty(0);
            }
        }
Esempio n. 19
0
 public CharacterStatus(int hitPoint, int attack, int defense, int evasion, int critical, AbnormalStateResistance abnormalStateResistance)
 {
     this.hitPoint = new IntReactiveProperty(hitPoint);
     this.attack   = new IntReactiveProperty(attack);
     this.defense  = new IntReactiveProperty(defense);
     this.evasion  = new IntReactiveProperty(evasion);
     this.critical = new IntReactiveProperty(critical);
     this.abnormalStateResistance = abnormalStateResistance;
 }
Esempio n. 20
0
    async void Start()
    {
        countButton
        .OnClickAsObservable()
        .Subscribe(_ => { Debug.Log("click"); });

        var count = new IntReactiveProperty(0);

        countButton
        .OnClickAsObservable()
        .Subscribe(_ => count.Value++);

        count.SubscribeToText(countText);

        checkToggle
        .OnValueChangedAsObservable()
        .Subscribe(b => checkText.gameObject.SetActive(b));

        slider
        .OnValueChangedAsObservable()
        .SubscribeToText(sliderValueText);

        dropdown.options.Add(new Dropdown.OptionData("hoge"));
        dropdown.OnValueChangedAsObservable()
        .Select(index => dropdown.options[index].text)
        .SubscribeToText(dropdownText);
        input
        // .OnValueChangedAsObservable()
        .OnEndEditAsObservable()
        .SubscribeToText(inputText);

        if (TouchScreenKeyboard.isSupported)
        {
            keyboradButton.OnClickAsObservable().Subscribe(async _ =>
            {
                if (kb != null)
                {
                    Debug.Log("already open");
                    return;
                }
                kb = TouchScreenKeyboard.Open("", TouchScreenKeyboardType.Default, false, false, false, false, "message...");
                Debug.Log($"after open. kb={kb}, status={kb.status}, {kb.text}");
                await UniTask.WaitUntil(() => kb != null && kb.status != TouchScreenKeyboard.Status.Visible);
                Debug.Log($"after input. kb={kb}, status={kb.status}, {kb.text}, {kb.wasCanceled}");
                if (kb.status == TouchScreenKeyboard.Status.Done)
                {
                    inputText.text = kb.text;
                }

                kb = null;
            });
        }
        else
        {
            Debug.Log("TouchScreenKeyboard not supported");
        }
    }
    private void Initialize()
    {
        initializeController.PlayerInit(player1);
        initializeController.PlayerInit(player2);

        _playerTurn = new IntReactiveProperty(1);
        player1Camera.SetActive(true);
        GameState = GameState.select;
    }
Esempio n. 22
0
        public UpgradesModel(SavegameService savegameService)
        {
            var upgrades = savegameService.Upgrades;

            MaxVelocityLevel = upgrades.MaxVelocityLevel;
            KickForceLevel   = upgrades.KickForceLevel;
            ShootForceLevel  = upgrades.ShootForceLevel;
            ShootCountLevel  = upgrades.ShootCountLevel;
        }
Esempio n. 23
0
        private bool TryDeductCost(IntReactiveProperty currency, int cost)
        {
            if (currency.Value < cost)
            {
                return(false);
            }

            currency.Value -= cost;
            return(true);
        }
Esempio n. 24
0
 private void Awake()
 {
     CurrentHealth = new IntReactiveProperty {
         Value = _maxHealth
     };
     OnDeath      = new Subject <GameObject>();
     _audioSource = Camera.main.GetComponent <AudioSource>();
     _sprite      = GetComponent <SpriteRenderer>();
     Defense      = 0;
 }
Esempio n. 25
0
        //  public int Current => current;
        public void Init(int @base = -1, int?current = null, int?min = null)
        {
            this.basee   = @base == -1 ? this.basee : @base;
            adds         = new List <PropertyNode <int> >();
            mores        = new List <PropertyNode <int> >();
            this.current = new IntReactiveProperty();
            this.min     = min.HasValue?min.Value : 0;

            OnValueChanged();
            this.current.Value = current.HasValue?current.Value : max;
        }
Esempio n. 26
0
        public override void Setup(IEventSystem eventSystem, IPoolManager poolManager, GroupFactory groupFactory)
        {
            base.Setup(eventSystem, poolManager, groupFactory);

            Score = new IntReactiveProperty();

            EventSystem.OnEvent <DeathEvent> ().Where(_ => !_.Target.HasComponent <InputComponent> ()).Subscribe(_ =>
            {
                Score.Value++;
            }).AddTo(this);
        }
Esempio n. 27
0
 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);
 }
Esempio n. 28
0
    void Start()
    {
        currentValue = new IntReactiveProperty(destinationValue);

        unitAngle = 360.0f / unitBase;

        angles = new Vector3[cylinders.Length];
        for (int i = 0; i < angles.Length; i++)
        {
            angles[i] = cylinders[i].localRotation.eulerAngles;
        }
    }
Esempio n. 29
0
 private void Awake()
 {
     TurnCount = new IntReactiveProperty {
         Value = 1
     };
     CurrentPhase = new ReactiveProperty <Phase> {
         Value = Phase.PlayerMove
     };
     EnemyMoves  = new Dictionary <Rigidbody2D, Vector2>();
     Shots       = new List <GameObject>();
     Disposables = new List <GameObject>();
 }
Esempio n. 30
0
    public Model()
    {
        index       = new IntReactiveProperty();
        currentData = new ReactiveProperty <Data> ();
        _datas      = new List <Data> ();

        index.Do(_ => {
            Debug.LogError("Change index");
        }).Subscribe(_ => {
            currentData.Value = _datas.ElementAtOrDefault(_);
        });
    }
Esempio n. 31
0
        private void AddButton(IntReactiveProperty prop, string desc)
        {
            var button = Instantiate(_buttonPrefab, _upgradeParent);

            if (button != null)
            {
                var element = button.GetComponent <UpgradeMenuElement>();
                if (element != null)
                {
                    element.Bind(prop, desc, _gameData);
                }
            }
        }
Esempio n. 32
0
    public void ExecuteEquip(int compoundIndex, int bodySlotIndex)
    {
        _unitSlotCompoundIndex = _unitController.SelectedUnit.BodySlots[bodySlotIndex]._CompoundIndex;
        _lifeCompounds         = _planetController.SelectedPlanet.Life.Compounds;

        Unequip();

        //EQUIP
        _unitSlotCompoundIndex.Value = compoundIndex;
        _lifeCompounds[compoundIndex].Value--;

        ApplyCompoundEffects(_compounds[compoundIndex], 1);
    }
Esempio n. 33
0
    // Use this for initialization
    void Start()
    {
        PlayerOneScore = new IntReactiveProperty(0);
        PlayerTwoScore = new IntReactiveProperty(0);
        PlayerOneName = new StringReactiveProperty("Player A");
        PlayerTwoName = new StringReactiveProperty("Player B");

        PlayerOneScore.Subscribe( score => PlayerOneScoreDisplay.text = score.ToString());
        PlayerTwoScore.Subscribe( score => PlayerTwoScoreDisplay.text = score.ToString());
        PlayerOneName.Subscribe( name => PlayerOneNameDisplay.text = name);
        PlayerTwoName.Subscribe( name => PlayerTwoNameDisplay.text = name);

        PlayerOneGoal
            .OnTriggerEnter2DAsObservable ()
            .Where (collision => collision.gameObject.CompareTag("Puck"))
            .Subscribe (_ => PlayerTwoScore.Value += 1);

        PlayerTwoGoal
            .OnTriggerEnter2DAsObservable ()
            .Where (collision => collision.gameObject.CompareTag("Puck"))
            .Subscribe (_ => PlayerOneScore.Value += 1);

        PlayerOneGoal
            .OnTriggerExit2DAsObservable ()
            .Merge (PlayerTwoGoal.OnTriggerExit2DAsObservable())
            .Where (ev => ev.gameObject.CompareTag("Puck"))
            .Delay (TimeSpan.FromSeconds (0.5))
            .Subscribe(ev => {
                ev.gameObject
                   .OnDestroyAsObservable ()
                   .Delay (TimeSpan.FromSeconds (1))
                   .Subscribe (_ => Instantiate (PuckPrefab));

                ev.gameObject.SetActive (false);
                Destroy (ev.gameObject);
            });
    }