コード例 #1
0
 public void FilterCards(Entity mountedModule, ModuleBehaviourType slotType)
 {
     if (this.currentTankPartItem != null)
     {
         ModuleCardItemUIComponent[] componentsInChildren = base.GetComponentsInChildren <ModuleCardItemUIComponent>(true);
         bool flag = false;
         ModuleCardItemUIComponent[] componentArray2 = componentsInChildren;
         int index = 0;
         while (true)
         {
             if (index < componentArray2.Length)
             {
                 ModuleCardItemUIComponent component = componentArray2[index];
                 if (!component.gameObject.activeSelf || !component.GetComponent <ToggleListItemComponent>().Toggle.isOn)
                 {
                     index++;
                     continue;
                 }
                 flag = (component.Type == slotType) && (((component.TankPart != TankPartModuleType.WEAPON) || (this.currentTankPartItem.Type != TankPartItem.TankPartItemType.Turret)) ? ((component.TankPart == TankPartModuleType.TANK) && (this.currentTankPartItem.Type == TankPartItem.TankPartItemType.Hull)) : true);
             }
             foreach (ModuleCardItemUIComponent component2 in componentsInChildren)
             {
                 bool flag2 = ((component2.TankPart != TankPartModuleType.WEAPON) || (this.currentTankPartItem.Type != TankPartItem.TankPartItemType.Turret)) ? ((component2.TankPart == TankPartModuleType.TANK) && (this.currentTankPartItem.Type == TankPartItem.TankPartItemType.Hull)) : true;
                 component2.gameObject.SetActive(flag2);
                 if (flag2 && (((mountedModule != null) && ReferenceEquals(component2.ModuleEntity, mountedModule)) || ((mountedModule == null) && (!flag && (component2.Type == slotType)))))
                 {
                     component2.GetComponent <ToggleListItemComponent>().Toggle.isOn = true;
                     flag = true;
                 }
             }
             this.upgradeModuleTrigger.Triggered();
             return;
         }
     }
 }
コード例 #2
0
        private void SetModuleLevel(ModuleCardItemUIComponent moduleCardItemUi, ModuleUpgradeLevelComponent moduleUpgradeLevel, ModuleCardsCompositionComponent moduleCardsComposition, Optional <ModuleCardNode> moduleCards)
        {
            int level = (int)moduleUpgradeLevel.Level;

            moduleCardItemUi.Level = level + 1;
            List <ModulePrice> upgradePrices = moduleCardsComposition.UpgradePrices;

            moduleCardItemUi.MaxCardsCount = (level >= upgradePrices.Count) ? 0 : upgradePrices[level].Cards;
            moduleCardItemUi.CardsCount    = !moduleCards.IsPresent() ? 0 : ((int)moduleCards.Get().userItemCounter.Count);
        }
コード例 #3
0
 public ModuleCardItemUIComponent GetCard(long marketItemGroupId)
 {
     foreach (ModuleCardsTierUI rui in this.tiersUi)
     {
         ModuleCardItemUIComponent card = rui.GetCard(marketItemGroupId);
         if (card != null)
         {
             return(card);
         }
     }
     return(null);
 }
コード例 #4
0
        private void SelectMountedModuleCard(ModuleCardItemUIComponent moduleCardItemUi, ModuleGroupComponent userModuleGroup, Optional <SelectedSlotWithModuleNode> selectedSlot)
        {
            ToggleListItemComponent component = moduleCardItemUi.GetComponent <ToggleListItemComponent>();

            if (selectedSlot.IsPresent() && (selectedSlot.Get().moduleGroup.Key == userModuleGroup.Key))
            {
                component.Toggle.isOn = true;
            }
            else if (component.Toggle.isOn)
            {
                component.OnValueChangedListener();
            }
        }
コード例 #5
0
        public void AddCard(Entity entity)
        {
            int index = Mathf.Min(entity.GetComponent <ModuleTierComponent>().TierNumber, this.tiersUi.Length - 1);
            ModuleCardItemUIComponent moduleCardItem = Instantiate <ModuleCardItemUIComponent>(this.moduleCardItemUiComponentPrefab);

            this.tiersUi[index].AddCard(moduleCardItem);
            if (entity.HasComponent <ModuleCardItemUIComponent>())
            {
                entity.RemoveComponent <ModuleCardItemUIComponent>();
            }
            if (entity.HasComponent <ToggleListItemComponent>())
            {
                entity.RemoveComponent <ToggleListItemComponent>();
            }
            entity.AddComponent(moduleCardItem);
            entity.AddComponent(moduleCardItem.GetComponent <ToggleListItemComponent>());
        }
コード例 #6
0
 public void AddCard(ModuleCardItemUIComponent moduleCardItem)
 {
     moduleCardItem.transform.SetParent(base.transform, false);
     this.SortCards();
 }