Esempio n. 1
0
        private void Start()
        {
            this.pool = MonoBehaviourPool <ItemPickupPopup> .Factory(
                this.itemPopupPrefab, UIManager.Instance.PopupContainer, 2);

            InventoryComponent.AnyItemPicked += OnItemPickup;
        }
Esempio n. 2
0
        private void Start()
        {
            this.pool = MonoBehaviourPool <BestiaryUnlockPopup> .Factory(
                this.popupPrefab, UIManager.Instance.PopupContainer, 2);

            CharacterManager.BestiaryUpdated += OnBestiaryUpdated;
        }
Esempio n. 3
0
        protected override void OnInitialize()
        {
            if (this.recipes.Count == 0)
            {
                return;
            }

            this.recipePool = MonoBehaviourPool <CraftViewRecipeRow> .Factory(
                this.recipeRowPrefab, this.recipeRowContainer);

            this.resultTooltip.Initialize();

            this.inventory.ItemPicked            += OnItemPicked;
            this.inventory.ItemRemoved           += OnItemRemoved;
            this.inventory.ItemStackCountChanged += OnItemStackCountChanged;

            this.recipePanel.Initialize(this.inventory);
            this.recipePanel.CraftButtonClicked += OnCraftButtonClicked;

            this.searchInput.onValueChanged.AddListener(OnSearchInputChanged);
            this.closeButton.PointerUp += OnCloseButtonPointerUp;

            this.continueButton.PointerUp += OnContinueButtonPointerUp;

            CreateCategoryTabs();
            RefreshRecipes(this.recipes);
        }
Esempio n. 4
0
        public void Start()
        {
            characterPool = new MonoBehaviourPool <Button>(
                characterPrefab,
                poolRoot,
                poolCapacity,

                (character) =>
            {
                character.gameObject.SetActive(true);
                character.gameObject.transform.SetAsLastSibling();
                character.image.color = skinColor.Next();
                character.onClick.AddListener(
                    new UnityEngine.Events.UnityAction(() => characterPool.ReleaseObject(character)));
            },

                (character) =>
            {
                character.onClick.RemoveAllListeners();
                character.gameObject.SetActive(false);
            });

            skinColor = Generator
                        .UniformRandomFloat()
                        .Select(t => Color.Lerp(color1, color2, t));
        }
Esempio n. 5
0
        private void Start()
        {
            this.pool = MonoBehaviourPool <MasteryLevelupPopup> .Factory(
                this.masteryPopupPrefab, UIManager.Instance.PopupContainer, 2);

            Mastery.AnyMasteryLevelUp += OnAnyMasteryLevelUp;
        }
Esempio n. 6
0
        public void Initialize()
        {
            if (this.isInitialized)
            {
                return;
            }

            this.price = Instantiate(this.pricePrefab, this.container);
            this.price.Initialize();

            this.differencePool = MonoBehaviourPool <ItemTooltipDifference> .Factory(this.differencePrefab, this.container);

            this.socketPool = MonoBehaviourPool <ItemTooltipSocket> .Factory(this.socketPrefab, this.container);

            this.costPool = MonoBehaviourPool <SkillTooltipCost> .Factory(this.costPrefab, this.container);

            this.textPool = MonoBehaviourPool <CustomText> .Factory(this.textPrefab, this.container);

            this.separatorPool = GameObjectPool.Factory(this.separatorPrefab, this.container);

            this.rectTransform       = GetComponent <RectTransform>();
            this.parentRectTransform = this.rectTransform.parent.GetComponent <RectTransform>();

            CharacterManager.CharacterSelected += OnCharacterSelected;
            this.character = CharacterManager.Instance.Character;

            this.isInitialized = true;
        }
Esempio n. 7
0
        private void Start()
        {
            this.pool = MonoBehaviourPool <RecipeUnlockPopup> .Factory(
                this.recipeUnlockPopup, UIManager.Instance.PopupContainer, 2);

            Character.RecipeUnlocked += OnRecipeUnlocked;
        }
Esempio n. 8
0
        protected override void OnInitialize()
        {
            this.itemPool = MonoBehaviourPool <MailboxItem> .Factory(this.itemPrefab, this.itemContainer);

            this.closeButton.PointerUp    += Hide;
            this.previousButton.PointerUp += OnPreviousButtonPointerUp;
            this.nextButton.PointerUp     += OnNextButtonPointerUp;
        }
Esempio n. 9
0
        private void Start()
        {
            Instance.Hide();

            this.closeButton.PointerUp += Hide;

            this.actionViewPool = MonoBehaviourPool <DialogueActionView> .Factory(
                this.actionViewPrefab, this.actionViewContainer, 5);
        }
Esempio n. 10
0
    public T GetInstanceFromPool(Transform parent = null)
    {
        if (pool == null)
        {
            pool = new MonoBehaviourPool <T>(this);
        }
        T result = pool.GetPooledObject(parent);

        result.OnSpawn();
        return(result);
    }
Esempio n. 11
0
        protected override void OnInitialize()
        {
            this.itemPool = MonoBehaviourPool <ItemListRow> .Factory(this.itemPrefab, this.itemContainer);

            this.characterPanel.Initialize(this.character);
            this.equipmentPanel.Initialize(this.equipment);
            this.inventoryPanel.Initialize(this.inventory);
            this.inventoryPanel.ItemRightClicked += OnInventoryItemRightClicked;

            this.gambleButton.PointerUp += OnGambleButtonClicked;
            this.closeButton.PointerUp  += Hide;
        }
Esempio n. 12
0
        public static MonoBehaviourPool <T> GetMonoBehaviourPool <T>(T prefab) where T : MonoBehaviour
        {
            var type = typeof(T);

            lock (Lock)
            {
                if (!MonoPools.ContainsKey(type))
                {
                    MonoPools[type] = new MonoBehaviourPool <T>(prefab);
                }
                return((MonoBehaviourPool <T>)MonoPools[type]);
            }
        }
Esempio n. 13
0
        private void Start()
        {
            HealthComponent.AnyEntityDamaged        += OnEntityDamaged;
            HealthComponent.AnyEntityHealed         += OnEntityHealed;
            HealthComponent.AnyEntityInvulnerable   += OnAnyEntityInvulnerable;
            BehavioursComponent.AnyBehaviourApplied += OnBehaviourApplied;
            BehavioursComponent.AnyBehaviourImmune  += OnAnyBehaviourImmune;

            this.pool = MonoBehaviourPool <FloatingText> .Factory(
                this.floatingTextPrefab, UIManager.Instance.GameplayCanvas.transform);

            Episode.AnyEpisodeStopped += OnAnyEpisodeStopped;
        }
Esempio n. 14
0
        private void RecreateRelics(IEnumerable <Relic> relics)
        {
            if (this.relicViewPool == null)
            {
                this.relicViewPool = MonoBehaviourPool <RelicView> .Factory(this.relicPrefab, this.relicContainer);
            }

            this.relicViewPool.DespawnAll();

            foreach (var relic in relics)
            {
                CreateRelic(relic);
            }
        }
Esempio n. 15
0
        public void Initialize()
        {
            if (this.isInitialized)
            {
                return;
            }

            this.isInitialized = true;

            this.textPool = MonoBehaviourPool <CustomText> .Factory(this.textPrefab, this.container);

            this.setPool = MonoBehaviourPool <SkillTooltipSet> .Factory(this.setPrefab, this.container);

            this.separatorPool = GameObjectPool.Factory(this.separatorPrefab, this.container);

            this.rectTransform       = GetComponent <RectTransform>();
            this.parentRectTransform = this.rectTransform.parent.GetComponent <RectTransform>();
        }
Esempio n. 16
0
        protected override void OnInitialize()
        {
            this.ingredientPool = MonoBehaviourPool <CraftViewIngredient> .Factory(this.ingredientPrefab, this.ingredientContainer);

            this.rowPool = MonoBehaviourPool <ItemForgingRow> .Factory(this.rowPrefab, this.rowContainer);

            this.characterPanel.Initialize(this.character);
            this.equipmentPanel.Initialize(this.equipment);
            this.inventoryPanel.Initialize(this.inventory);
            this.inventoryPanel.ItemRightClicked += OnInventoryItemRightClicked;

            this.itemSlot.Construct(this.inventory.CreateEmptyItem());
            this.itemSlot.ItemDroppedIn              += OnItemDroppedIn;
            this.itemSlot.ItemDroppedOut             += OnItemDroppedOut;
            this.itemSlot.InventoryItem.RightClicked += OnItemRightClicked;

            this.upgradeButton.PointerUp += OnUpgradeButtonClicked;
            this.closeButton.PointerUp   += Hide;
        }
Esempio n. 17
0
        public void Construct(List <UnitData> units)
        {
            this.behaviourPool = MonoBehaviourPool <BehaviourView> .Factory(
                this.behaviourPrefab, this.behaviourContainer);

            this.spellbookSlotPool = MonoBehaviourPool <SpellbookSlot> .Factory(
                this.spellbookSlotPrefab, this.spellbookSlotContainer);

            this.propertyRowPool = MonoBehaviourPool <CharacterInfoRow> .Factory(
                this.propertyRowPrefab, this.propertyRowContainer);

            this.attributeRowPool = MonoBehaviourPool <BestiaryAttributeRow> .Factory(
                this.attributeRowPrefab, this.attributeRowContainer);

            this.propertyRowSeparatorPool = GameObjectPool.Factory(
                this.propertyRowSeparatorPrefab, this.propertyRowContainer);

            var grouped = units.OrderBy(u => u.Environment.Index).GroupBy(u => u.Environment.Id);

            foreach (var group in grouped)
            {
                Instantiate(this.unitRowTitlePrefab, this.unitRowContainer)
                .ChangeTitle(I18N.Instance.Get(group.First().Environment.NameKey));

                foreach (var unit in group.OrderBy(u => u.NameKey))
                {
                    var unitRow = Instantiate(this.unitRowPrefab, this.unitRowContainer);
                    unitRow.Clicked += OnUnitRowClicked;
                    unitRow.Construct(unit);
                }
            }

            var firstRow = this.unitRowContainer.GetComponentsInChildren <BestiaryUnitRow>().FirstOrDefault();

            if (firstRow == null)
            {
                return;
            }

            OnUnitRowClicked(firstRow);
        }
Esempio n. 18
0
 public void Initialize()
 {
     this.itemPool = MonoBehaviourPool <InventoryItem> .Factory(this.itemPrefab, this.itemContainer);
 }
Esempio n. 19
0
 public void Initialize()
 {
     this.currencyPool = MonoBehaviourPool <CurrencyView> .Factory(this.currencyPrefab, transform);
 }
Esempio n. 20
0
 public void OnAwake()
 {
     _effectPool = new EffectsPool(new GameObject("EffectsPool").transform);
 }