예제 #1
0
        private void UpdateScoreboard(HUD hud, FieldInfo fieldInfo)
        {
            ScoreboardController scoreboardController = hud.scoreboardPanel.GetComponent <ScoreboardController>();

            if (scoreboardController != null)
            {
                UIElementAllocator <ScoreboardStrip> elements = (UIElementAllocator <ScoreboardStrip>) typeof(ScoreboardController)
                                                                .GetField("stripAllocator", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(scoreboardController);

                if (elements != null)
                {
                    List <ScoreboardStrip> scoreboardStrips = (List <ScoreboardStrip>) typeof(UIElementAllocator <ScoreboardStrip>)
                                                              .GetField("elementControllerComponentsList", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(elements);

                    foreach (ScoreboardStrip scoreboardStrip in scoreboardStrips)
                    {
                        if (scoreboardStrip == null)
                        {
                            continue;
                        }

                        if (fieldInfo != null)
                        {
                            List <ItemIcon> itemIcons = (List <ItemIcon>)fieldInfo.GetValue(scoreboardStrip.itemInventoryDisplay);

                            foreach (ItemIcon itemIcon in itemIcons)
                            {
                                if (itemIcon != null && itemIcon.GetComponent <DropItemController>() == null)
                                {
                                    DropItemController dropItemController = itemIcon.gameObject.AddComponent <DropItemController>();
                                    Inventory          inventory          = (Inventory)typeof(ItemInventoryDisplay).GetField("inventory", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(scoreboardStrip.itemInventoryDisplay);
                                    dropItemController.Inventory            = inventory;
                                    dropItemController.ItemIcon             = itemIcon;
                                    dropItemController.SendDropItemToServer = SendDropItemRequest;
                                }
                            }
                        }

                        EquipmentIcon equipmentIcon = scoreboardStrip.equipmentIcon;

                        if (equipmentIcon != null && equipmentIcon.GetComponent <DropItemController>() == null)
                        {
                            if (equipmentIcon.targetInventory == null)
                            {
                                continue;
                            }
                            EquipmentIndex equipmentIndex = (equipmentIcon.displayAlternateEquipment) ? equipmentIcon.targetInventory.alternateEquipmentIndex : equipmentIcon.targetInventory.currentEquipmentIndex;

                            if (equipmentIndex != EquipmentIndex.None)
                            {
                                DropItemController dropItemController = equipmentIcon.gameObject.AddComponent <DropItemController>();
                                dropItemController.Inventory                 = equipmentIcon.targetInventory;
                                dropItemController.EquipmentIcon             = equipmentIcon;
                                dropItemController.SendDropEquipmentToServer = SendDropEquipmentRequest;
                            }
                        }
                    }
                }
            }
        }
        private void Start()
        {
            buttonHistory      = GetComponent <HGButtonHistory>();
            characterSelectBar = GetComponent <CharacterSelectBarController>();
            eventSystemLocator = GetComponent <MPEventSystemLocator>();
            GatherCharacterSelectBarInfo();

            survivorIconControllers = new UIElementAllocator <SurvivorIconController>(iconContainer, choiceButtonPrefab);

            StartCoroutine(StartDelayCoroutine());
        }