private void AddInCollection(CollectionAddEvent <T> addEvent)
        {
            T obj = addEvent.Value;

            obj.gameObject.SetActive(false);
            obj.Reset();
        }
Exemple #2
0
        private void PieceAdded(CollectionAddEvent <IPieceModel> add)
        {
            var pieceAgent = Registry.New <IPieceAgent>(add.Value);

            pieceAgent.SetOwner(add.Value.Owner.Value);
            _pieces.Insert(add.Index, pieceAgent);
        }
Exemple #3
0
 private void Add(CollectionAddEvent <ICardAgent> add)
 {
     Verbose(5, $"HandView: Add {add.Value} @{add.Index}");
     _cards.Insert(add.Index, CreateViewFromAgent(add.Value));
     Redraw();
     Assert.IsTrue(IsValid);
 }
 private void AddInCollection(CollectionAddEvent <Info> addEvent)
 {
     addEvent.Value.Health.Life
     .Where(x => x <= 0)
     .DelayFrame(0, FrameCountType.EndOfFrame)
     .Subscribe(_ => m_Enemies.Remove(addEvent.Value));
 }
    public void OnSelectedMonsterAdded(CollectionAddEvent<MonsterModel> addEvent)
    {
        MonsterModel model = addEvent.Value;
        model.isSelected.Value = true;

        this.selectDone.Value = this.selectedMosnters.Count >= 3;
    }
Exemple #6
0
        private void OnAnimalAddToGroup(CollectionAddEvent <EntityRemoteDataModel> obj)
        {
            var model = (AnimalRemoteDataModel)obj.Value;

            _animalViews[model.RemoteData.Id].AnimalState = EAnimalState.Follow;

            CalculateSpeedAndMove();
        }
    public void OnSelectedMonsterAdded(CollectionAddEvent <MonsterModel> addEvent)
    {
        MonsterModel model = addEvent.Value;

        model.isSelected.Value = true;

        this.selectDone.Value = this.selectedMosnters.Count >= 3;
    }
 // when an object is added to the selection
 public void selectionAdded(CollectionAddEvent <WARGridObject> gridObject)
 {
     // for each cell under the object
     foreach (var cellId in findCellsUnderObject(gridObject.Value))
     {
         // set the cell to be highlighted
         cells[cellId].highlighted.Value = true;
     }
 }
Exemple #9
0
        void PieceAdded(CollectionAddEvent <IPieceAgent> add)
        {
            var agent = add.Value;
            var view  = ViewRegistry.FromPrefab <IPieceView>(PieceViewPrefab);

            view.SetAgent(ArbiterView.CurrentPlayerView, agent);
            view.GameObject.transform.SetParent(PiecesRoot);
            _pieces.Add(view);
        }
Exemple #10
0
        /// <summary>
        /// At this point, the piece can and will be added to the board.
        ///
        /// Determine the consequences of that.
        /// </summary>
        /// <param name="add">The piece added</param>
        private void PieceAdded(CollectionAddEvent <IPieceAgent> add)
        {
            var agent = add.Value;
            var view  = ViewRegistry.FromPrefab <IPieceView>(PieceViewPrefab, agent);

            view.GameObject.transform.SetParent(PiecesRoot);
            _pieces.Add(view);
            // TODO Agent.Model.TestForCheck(agent.Model.Color);
        }
Exemple #11
0
        private void AddInCollection(CollectionAddEvent <Info> addEvent)
        {
            Pools.IPooled astView = m_Pool.GetObject();
            astView.Bind(addEvent.Value);
            var pos = addEvent.Value.Positioning;

            pos.Position
            .Where(CheckExitFromZone)
            .Select(_ => addEvent.Value)
            .Subscribe(z => m_Bullets.Remove(z));
        }
        void PlaceObjectOnCell(CollectionAddEvent <WARGridObject> gridObject)
        {
            // if the passed object is not a WARGridObject
            if (gridObject.Value == null)
            {
                Debug.LogError("Tried to add a non-WARGridObject to a cell.");
                return;
            }

            gridObject.Value.transform.position = gameObject.transform.position;
        }
    /// <summary>
    /// Raises the deck monster add event.
    /// </summary>
    /// <param name="model">Model.</param>
    /// <param name="index">Index.</param>
    public MonsterThumbView OnDeckMonsterAdd(CollectionAddEvent<MonsterModel> addEvent)
    {
        GameObject monsterThumbObj = Instantiate (monsterThumbPrefab) as GameObject;

        MonsterThumbView thumbView = monsterThumbObj.GetComponent<MonsterThumbView> ();
        thumbView.InitializeView (addEvent.Value);

        thumbView.gameObject.SetActive (true);
        thumbView.transform.Translate (new Vector3 (150f * addEvent.Index, 0, 0));
        monsterThumbObj.transform.SetParent (this.transform, false);

        return thumbView;
    }
Exemple #14
0
    /// <summary>
    /// Raises the deck monster add event.
    /// </summary>
    /// <param name="model">Model.</param>
    /// <param name="index">Index.</param>
    public MonsterThumbView OnDeckMonsterAdd(CollectionAddEvent <MonsterModel> addEvent)
    {
        GameObject monsterThumbObj = Instantiate(monsterThumbPrefab) as GameObject;

        MonsterThumbView thumbView = monsterThumbObj.GetComponent <MonsterThumbView> ();

        thumbView.InitializeView(addEvent.Value);

        thumbView.gameObject.SetActive(true);
        thumbView.transform.Translate(new Vector3(150f * addEvent.Index, 0, 0));
        monsterThumbObj.transform.SetParent(this.transform, false);

        return(thumbView);
    }
Exemple #15
0
        private void AddInCollection(CollectionAddEvent <Info> addEvent)
        {
            Pools.IPooled astView = m_Pool.GetObject();
            astView.Bind(addEvent.Value);
            var pos = addEvent.Value.Positioning;

            pos.Position
            .Where(CheckExitFromZone)
            .Select(_ => addEvent.Value)
            .Subscribe(z => m_Enemies.Remove(z));
            pos.Position
            .Where(_ => !pos.FarFromBorder)
            .Select(_ => pos)
            .Subscribe(CheckFarFromUpperBorder);
            pos.Rotation.Value = Quaternion.Euler(GetRandomAngle(), GetRandomAngle(), GetRandomAngle());
        }
Exemple #16
0
        private void OnMovieAdd(CollectionAddEvent <MovieDataModel> addEvent)
        {
            if (!_reactiveDisposible.ContainsKey(addEvent.Value))
            {
                _reactiveDisposible.Add(addEvent.Value,
                                        addEvent.Value.Poster.Subscribe(sprite =>
                {
                    if (sprite != null)
                    {
                        SignalBus.Fire(new AddMovieToGridSignal(addEvent.Value));

                        // Test
//                            if (addEvent.Index == 1)
//                            {
//                                Observable.Timer(TimeSpan.FromSeconds(3)).Subscribe((l =>
//                                {
//                                    _remoteDataModel.QueryResult.Remove(addEvent.Value);
//                                })).AddTo(Disposables);
//
//                            }
                    }
                }));
            }
        }
Exemple #17
0
 public void OnShaftAdd(CollectionAddEvent <ShaftRemoteDataModel> evt)
 {
     SetupShaft(evt.Value);
 }
Exemple #18
0
 private void OnPopupAdd(CollectionAddEvent <PopupData> popupAddEventData)
 {
     _view.AddPopup(popupAddEventData.Value);
 }
Exemple #19
0
 private void OnAdd(CollectionAddEvent <string> obj)
 {
     Debug.Log($"Add {obj.Value} to Collection");
 }
 public virtual void OnAdd_CurrentBullets(CollectionAddEvent <BulletViewModel> e)
 {
 }
 public void EntityAdded(CollectionAddEvent <ActiveEffect> collectionAddEvent)
 {
     CreateViewForEffect(collectionAddEvent.Value);
 }
Exemple #22
0
 public virtual void OnAdd_DefaultCollection2(CollectionAddEvent <int> e)
 {
 }
Exemple #23
0
 public virtual void OnAdd_DefaultCollection1(CollectionAddEvent <string> e)
 {
 }
Exemple #24
0
 private void OnMovieAddToStack(CollectionAddEvent <MovieDataModel> addEvent)
 {
     OnMovieRemove(addEvent.Value);
 }
Exemple #25
0
 private void Add(CollectionAddEvent <int> add)
 {
     _index  = add.Index;
     _added += add.Value;
 }
        public virtual ApplicationResult Apply(KSEQOperation <T> op, bool quiet = false)
        {
            switch (op.op)
            {
            case KSEQOperationTypes.Insert:
                if (m_Removed.Contains(op.id))
                {
                    break;
                }

                var indexAdded = Add(op.id, op.value);
                if (!quiet)
                {
                    var collectionAddEvent = new CollectionAddEvent <T>(indexAdded, op.value);
                    collectionAdd?.OnNext(collectionAddEvent);
                    countChanged?.OnNext(m_AtomList.Count);
                    if (op.replicaId == replicaId)
                    {
                        collectionThisReplicaAdded?.OnNext(collectionAddEvent);
                    }
                }

                return(new ApplicationResult()
                {
                    applied = true,
                    index = indexAdded
                });

            case KSEQOperationTypes.Remove:
                if (m_Removed.Contains(op.id))
                {
                    break;
                }

                m_Removed.Add(op.id);
                var indexRemoved = IndexOf(op.id);
                if (indexRemoved < 0)
                {
                    break;
                }

                var oldValue = m_AtomList[indexRemoved];
                m_AtomList.RemoveAt(indexRemoved);
                if (!quiet)
                {
                    var collectionRemoveEvent = new CollectionRemoveEvent <T>(indexRemoved, oldValue.value);
                    collectionRemove?.OnNext(collectionRemoveEvent);
                    countChanged?.OnNext(m_AtomList.Count);
                    if (op.replicaId == replicaId)
                    {
                        collectionThisReplicaRemoved?.OnNext(collectionRemoveEvent);
                    }
                }

                return(new ApplicationResult()
                {
                    applied = true,
                    index = indexRemoved
                });
            }

            return(new ApplicationResult()
            {
            });
        }
Exemple #27
0
 private void Add(CollectionAddEvent <ICardModel> add)
 {
     Verbose(10, $"HandAgent: Add {add.Value} @{add.Index}");
     _cards.Insert(add.Index, Registry.New <ICardAgent>(add.Value));
 }
 public virtual void OnAdd_IntList(CollectionAddEvent <int> e)
 {
 }
 private void OnUserAdded(CollectionAddEvent <UserModel> add)
 {
     m_presenters[add.Index].Show(add.Value);
 }
 private void AddToCollection(CollectionAddEvent <Info> addEvent)
 {
     addEvent.Value.BulletMono.BindCollision(OnCollision);
 }
Exemple #31
0
 private void OnAddAoPackage(CollectionAddEvent <AoPackage> aoPackageAddEvent)
 {
     RegisterAoPackage(aoPackageAddEvent.Value);
 }
Exemple #32
0
 public virtual void OnAdd_Numbers(CollectionAddEvent <int> e)
 {
 }