public void SetTabWeaponConfig()
    {
        SelectedVehicle = FindObjectOfType <DoV_CombatVehicle>();

        SelectedVehicle.Vehicle.VehicleWeapons.ForEach(weaponconfig =>
        {
            var newWeaponConfigButton   = Instantiate(WeaponButtonTemplate);
            var newWeaponConfigTemplate = Instantiate(WeaponConfigTemplate);



            newWeaponConfigButton.GetComponentInChildren <Text>().text = weaponconfig.Name;

            DrawWeapons(weaponconfig, newWeaponConfigTemplate);
            UnityEngine.Events.UnityAction action1 = () => { newWeaponConfigTemplate.SetActive(false); };
            newWeaponConfigButton.GetComponent <UnityEngine.UI.Button>().onClick.AddListener(action1);//find the button and set
            newWeaponConfigButton.transform.SetParent(WeaponButtonContainer.transform);

            newWeaponConfigTemplate.transform.SetParent(WeaponPanelList.transform);
        });


        WeaponConfigTemplate.SetActive(false);
        WeaponButtonTemplate.SetActive(false);
    }
Example #2
0
    public void SetSelectedUnitUI(DoV_Vehicle DoV)
    {
        SelectedUnitName.text              = DoV.Name;
        SelectedDisplayName.text           = DoV.DisplayName;
        SelectedType.texture               = DoV.ClassIcon;
        SelectedCountryFlag.texture        = DoV.CountryOfOriginFlag;
        SelectedVehicleMapNATOIcon.texture = DoV.MapIcon;
        var statsPanel    = FindObjectOfType <StatsInfoPanel>();
        var statsCube     = FindObjectOfType <StatsCubePanel>();
        var sensorPanel   = FindObjectOfType <SensorPanel>();
        var weaponsconfig = FindObjectOfType <WeaponsConfigPanel>();


        sensorPanel.Vehicle               = statsCube.Vehicle = statsPanel.Vehicle = DoV;
        SelectedDoV_Vehicle               = DoV;
        SelectedDoV_CombatVehicle         = FindObjectOfType <DoV_CombatVehicle>();
        SelectedDoV_CombatVehicle.Vehicle = DoV;

        statsCube.SetStats(DoV);
        statsPanel.SetStats();
        sensorPanel.SetSensorPanel();
        weaponsconfig.SetTabWeaponConfig();
        VehicleListPanel.SetActive(false);
    }