예제 #1
0
    private void Start()
    {
        doctrineTab.SetActive(false);
        openDoctrineTabButton.onClick.AddListener(delegate { openDoctrineTab(); });

        App        app         = UnityEngine.Object.FindObjectOfType <App>();
        int        playerIndex = app.GetHumanIndex();
        Nation     player      = State.getNations()[playerIndex];
        int        rowIndex    = 0;
        LandForces landForces  = player.landForces;

        foreach (MyEnum.ArmyDoctrines doctrine in Enum.GetValues(typeof(MyEnum.ArmyDoctrines)))
        {
            TableRow row = doctrineTable.Rows[rowIndex];

            Button addButton = row.GetComponentInChildren <Button>();
            addButton.onClick.AddListener(delegate { addDoctrine(); });
            if (landForces.hasDoctrine(doctrine))
            {
                Toggle toggle = row.GetComponentInChildren <Toggle>();
                toggle.isOn = true;
            }
            rowIndex++;
        }
    }
예제 #2
0
    private void openDoctrineTab()
    {
        App        app         = UnityEngine.Object.FindObjectOfType <App>();
        int        playerIndex = app.GetHumanIndex();
        Nation     player      = State.getNations()[playerIndex];
        LandForces landForces  = player.landForces;
        int        rowIndex    = 0;

        foreach (MyEnum.ArmyDoctrines doctrine in Enum.GetValues(typeof(MyEnum.ArmyDoctrines)))
        {
            TableRow row = doctrineTable.Rows[rowIndex];

            Button addButton = row.GetComponentInChildren <Button>();
            if (landForces.hasDoctrine(doctrine))
            {
                Toggle toggle = row.GetComponentInChildren <Toggle>();
                toggle.isOn            = true;
                addButton.interactable = false;
            }
            rowIndex++;
        }
        doctrineTab.SetActive(true);
    }
예제 #3
0
    private void updateDoctrinePanel(Nation player)
    {
        int        rowIndex   = 0;
        LandForces landForces = player.landForces;

        foreach (MyEnum.ArmyDoctrines doctrine in Enum.GetValues(typeof(MyEnum.ArmyDoctrines)))
        {
            TableRow row = doctrineTable.Rows[rowIndex];

            Button addButton = row.Cells[3].GetComponentInChildren <Button>();

            if (landForces.hasDoctrine(doctrine))
            {
                Toggle toggle = row.GetComponentInChildren <Toggle>();
                toggle.isOn            = true;
                addButton.interactable = false;
            }
            if (PlayerCalculator.canMakeDevelopmentAction(player) == false)
            {
                addButton.interactable = false;
            }
            rowIndex++;
        }
    }