示例#1
0
        public void Initialize()
        {
            ClearChildren();

            GridLayout panelLayout = new GridLayout(GUI, this, 10, 10);
            GroupBox   employeeBox = new GroupBox(GUI, panelLayout, "Employees");
            GridLayout boxLayout   = new GridLayout(GUI, employeeBox, 8, 4);
            ScrollView scrollView  = new ScrollView(GUI, boxLayout);

            EmployeeSelector = new ListSelector(GUI, scrollView)
            {
                Label         = "",
                DrawPanel     = false,
                Mode          = ListItem.SelectionMode.Selector,
                LocalBounds   = new Rectangle(0, 0, 256, Faction.Minions.Count * 24),
                WidthSizeMode = SizeMode.Fit
            };

            boxLayout.SetComponentPosition(scrollView, 0, 1, 3, 6);
            panelLayout.SetComponentPosition(employeeBox, 0, 0, 3, 10);

            foreach (CreatureAI creature in Faction.Minions)
            {
                EmployeeSelector.AddItem(creature.Stats.FullName);
            }


            EmployeeSelector.OnItemSelected += EmployeeSelector_OnItemSelected;

            Button hireButton = new Button(GUI, boxLayout, "Hire new", GUI.DefaultFont, Button.ButtonMode.ToolButton,
                                           GUI.Skin.GetSpecialFrame(GUISkin.Tile.ZoomIn))
            {
                ToolTip = "Hire new employees"
            };

            boxLayout.SetComponentPosition(hireButton, 0, 7, 2, 1);

            hireButton.OnClicked += hireButton_OnClicked;

            CurrentMinionBox = new GroupBox(GUI, panelLayout, "");

            GridLayout minionLayout = new GridLayout(GUI, CurrentMinionBox, 10, 10);

            CurrentMinionPanel       = new MinionPanel(GUI, minionLayout, Faction.Minions.FirstOrDefault());
            CurrentMinionPanel.Fire += CurrentMinionPanel_Fire;
            minionLayout.EdgePadding = 0;
            minionLayout.SetComponentPosition(CurrentMinionPanel, 0, 1, 10, 9);

            panelLayout.SetComponentPosition(CurrentMinionBox, 3, 0, 4, 10);

            if (Faction.Minions.Count > 0)
            {
                OnMinionSelected(Faction.Minions[0]);
            }
        }
示例#2
0
        public void Initialize()
        {
            ClearChildren();

            GridLayout panelLayout = new GridLayout(GUI, this, 10, 10);
            GroupBox employeeBox = new GroupBox(GUI, panelLayout, "Employees");
            GridLayout boxLayout = new GridLayout(GUI, employeeBox, 8, 4);
            ScrollView scrollView = new ScrollView(GUI, boxLayout);
            EmployeeSelector = new ListSelector(GUI, scrollView)
            {
                Label = "",
                DrawPanel = false,
                Mode = ListItem.SelectionMode.Selector,
                LocalBounds = new Rectangle(0, 0, 256, Faction.Minions.Count * 24),
                WidthSizeMode = SizeMode.Fit
            };

            boxLayout.SetComponentPosition(scrollView, 0, 1, 3, 6);
            panelLayout.SetComponentPosition(employeeBox, 0, 0, 3, 10);

            foreach (CreatureAI creature in Faction.Minions)
            {
                EmployeeSelector.AddItem(creature.Stats.FullName);
            }

            EmployeeSelector.OnItemSelected += EmployeeSelector_OnItemSelected;

            Button hireButton = new Button(GUI, boxLayout, "Hire new", GUI.DefaultFont, Button.ButtonMode.ToolButton,
                GUI.Skin.GetSpecialFrame(GUISkin.Tile.ZoomIn))
            {
                ToolTip = "Hire new employees"
            };

            boxLayout.SetComponentPosition(hireButton, 0, 7, 2, 1);

            hireButton.OnClicked += hireButton_OnClicked;

            CurrentMinionBox = new GroupBox(GUI, panelLayout, "");

            GridLayout minionLayout = new GridLayout(GUI, CurrentMinionBox, 10, 10);
            CurrentMinionPanel = new MinionPanel(GUI, minionLayout, Faction.Minions.FirstOrDefault());
            CurrentMinionPanel.Fire += CurrentMinionPanel_Fire;
            minionLayout.EdgePadding = 0;
            minionLayout.SetComponentPosition(CurrentMinionPanel, 0, 1, 10, 9);

            panelLayout.SetComponentPosition(CurrentMinionBox, 3, 0, 4, 10);

            if (Faction.Minions.Count > 0)
            {
                OnMinionSelected(Faction.Minions[0]);
            }
        }