Beispiel #1
0
        public override void Cleanup()
        {
            if (selectionView_ != null)
            {
                selectionView_.OnSelectableHover    -= HandleSelectableHover;
                selectionView_.OnSelectableSelected -= HandleSelectableSelected;
                ObjectPoolManager.Recycle(selectionView_);
                selectionView_ = null;
            }

            // we're not selecting skins right now
            selectingSkinMap_[Player_] = false;
            OnSelectedSkinsDirty.Invoke();
        }
Beispiel #2
0
        protected override void Init()
        {
            if (string.IsNullOrEmpty(Player_.Nickname))
            {
                Player_.Nickname = RegisteredPlayers.GetDefaultNicknameFor(Player_);
            }

            if (Player_.Skin == null)
            {
                Player_.Skin = RegisteredPlayersUtil.GetBestRandomSkin();
            }

            GameObject     skinSelectionContainer = GameObjectUtil.FindRequired("SkinSelectionContainer");
            SkinSelectable currentSelectable      = skinSelectionContainer.GetComponentsInChildren <SkinSelectable>().First(s => s.Skin == Player_.Skin);

            selectionView_ = ObjectPoolManager.CreateView <ElementSelectionView>(GamePrefabs.Instance.ElementSelectionViewPrefab);
            selectionView_.Init(Player_, skinSelectionContainer, startSelectable: currentSelectable);
            selectionView_.OnSelectableHover    += HandleSelectableHover;
            selectionView_.OnSelectableSelected += HandleSelectableSelected;

            // we're selecting skins right now
            selectingSkinMap_[Player_] = true;
            OnSelectedSkinsDirty.Invoke();
        }