public ConfigurationManager() { stringControls = new List <StringInputControl>(); leftLayout = new VerticalLayout(VerticalLayout.VerticalAlign.Left); rightLayout = new VerticalLayout(VerticalLayout.VerticalAlign.Right); centerLayout = new VerticalLayout(VerticalLayout.VerticalAlign.Center); error = null; var configKeys = Configuration.GetAllKnownKeys(); for (int i = 0; i < configKeys.Count / 2; i++) { var stringControl = CreateConfigInput(configKeys[i]); leftLayout.Add(stringControl); stringControls.Add(stringControl); } for (int i = configKeys.Count / 2; i < configKeys.Count; i++) { var stringControl = CreateConfigInput(configKeys[i]); rightLayout.Add(stringControl); stringControls.Add(stringControl); } applyButton = new ButtonControl("Apply changes", ApplyChanges); centerLayout.Add(applyButton); centerLayout.Add(new ButtonControl("Save changes to file", SaveChanges)); centerLayout.Add(new ButtonControl("Exit", Exit)); AddControlLayout(leftLayout); AddControlLayout(rightLayout); AddControlLayout(centerLayout); }
public void ReBuildToDoItems() { var dataList = ToDoDataManager.Data.todoList; todosParent.children.Clear(); var groupsByDay = dataList.Where(item => item.state.Val == ToDoData.ToDoState.Done) .GroupBy(item => item.finishTime.Date) .OrderByDescending(item => item.Key); foreach (var group in groupsByDay) { TimeSpan totalTime = TimeSpan.Zero; foreach (var item in group) { totalTime += item.UsedTime; } todosParent.Add( new LabelView(group.Key.ToString("yyyy年MM月dd日 (共" + ToDoData.UsedTimeToString(totalTime) + ")")) .FontSize(20).TextLowCenter()); todosParent.Add(new SpaceView(4)); foreach (var item in group.OrderByDescending(val => val.finishTime)) { todosParent.Add(new ToDoListItemView(item, RemoveFromParent, true)); todosParent.Add(new SpaceView(4)); } } RefreshVisible(); }
public MainMenu() { menuLayout = new VerticalLayout(VerticalLayout.VerticalAlign.Center); menuLayout.Add(new ButtonControl("Start a competition", MenuSelectEvent)); //menuLayout.Add(new ButtonControl("Configuration Manager", MenuSelectEvent)); menuLayout.Add(new ButtonControl("Exit", MenuSelectEvent)); AddControlLayout(menuLayout); }
private VerticalLayout CreateNormalFacadeVertical(List <PanelSize> panelSizes, int from, int to, int floors, bool hasAttic, bool hasBalconies, float width, float remainder) { var vertical = new VerticalLayout(); //vertical.Add(CreateHorizontal(panelSizes, from, to, socleHeight, constructors[PanelType.Socle])); for (int floorIndex = 0; floorIndex < floors; floorIndex++) { if (floorIndex == 0) { vertical.Add(CreateGroundFloor(width - remainder)); } if (CurrentBuilding.FacadeType == BuildingFacadeType.HorizontalLineMiddle || CurrentBuilding.FacadeType == BuildingFacadeType.Cross) { //Middle row doesn't appear if (floorIndex == floors / 2) { vertical.Add(CreateHorizontal(panelSizes, from, to, floorHeight, constructors[PanelType.Wall])); } else { vertical.Add(CreateHorizontal(panelSizes, from, to, floorHeight, constructors[PanelType.Window])); } } else if (CurrentBuilding.FacadeType == BuildingFacadeType.HorizontalThickLineMiddle || CurrentBuilding.FacadeType == BuildingFacadeType.ThickCross) { //3 middle rows don't appear if (floorIndex == floors / 2 || floorIndex == floors / 2 - 1 || floorIndex == floors / 2 + 1) { vertical.Add(CreateHorizontal(panelSizes, from, to, floorHeight, constructors[PanelType.Wall])); } else { vertical.Add(CreateHorizontal(panelSizes, from, to, floorHeight, constructors[PanelType.Window])); } } else if (CurrentBuilding.FacadeType == BuildingFacadeType.SWithContGlass) { var indexes = GetSColumnIndexesForRow(panelSizes.Count, floors, floorIndex); vertical.Add(CreateHorizontal(panelSizes, from, to, floorHeight, constructors[PanelType.ContinuousWindow], indexes)); } else { vertical.Add(CreateHorizontal(panelSizes, from, to, floorHeight, constructors[PanelType.Window])); } // else // { // vertical.Add(CreateHorizontal(panelSizes, from, to, floorHeight, constructors[PanelType.Balcony])); // } } if (hasAttic) { vertical.Add(CreateHorizontal(panelSizes, from, to, atticHeight, constructors[PanelType.Attic])); } return(vertical); }
public CompetitionOptionsDisplay(ControllerSkeleton red, ControllerSkeleton blue) { this.red = red; this.blue = blue; layout = new VerticalLayout(VerticalLayout.VerticalAlign.Center); roundsNumberControl = new NumericControl(new NumericControl.NumericControlParameters("# of rounds", false, 1, 100000, 10, 1000)); millisecondControl = new NumericControl(new NumericControl.NumericControlParameters("Millisecond delay", false, 0, 10000, 5, 0)); showBoards = new CheckboxControl("Show ASCII boards"); layout.Add(roundsNumberControl); //layout.Add(new CheckboxControl("Play out rounds")); layout.Add(millisecondControl); layout.Add(showBoards); layout.Add(new ButtonControl("Confirm", ButtonConfirmEvent)); AddControlLayout(layout); }
public BotSelector() { LoadControllers(); redList = new VerticalLayout(VerticalLayout.VerticalAlign.Left); redList.SetDisplayLine(5); redGroup = new RadioButtonControlGroup(redList); foreach (var ctrl in selectableBots) { redGroup.AddRadioButton(ctrl.GetAttribute <NameAttribute>().Name); } blueList = new VerticalLayout(VerticalLayout.VerticalAlign.Right); blueList.SetDisplayLine(5); blueGroup = new RadioButtonControlGroup(blueList); foreach (var ctrl in selectableBots) { blueGroup.AddRadioButton(ctrl.GetAttribute <NameAttribute>().Name); } buttonConfirmLayout = new VerticalLayout(VerticalLayout.VerticalAlign.Center); buttonConfirmLayout.SetDisplayLine(6 + selectableBots.Count); buttonConfirmLayout.Add(new ButtonControl("Confirm", SelectionConfirm)); AddControlLayout(redList); AddControlLayout(blueList); AddControlLayout(buttonConfirmLayout); }
private VerticalLayout CreateEntranceVertical(float width, int floors, bool hasAttic) { var vertical = new VerticalLayout(); vertical.Add(Construct(commonConstructors[PanelType.Entrance], width, floorHeight)); for (int i = 0; i < floors - 1; i++) { vertical.Add(Construct(commonConstructors[PanelType.EntranceWindow], width, floorHeight)); } vertical.Add(Construct(PanelType.EntranceWallLast, width, socleHeight)); if (hasAttic) { vertical.Add(Construct(PanelType.Attic, width, atticHeight)); } return(vertical); }
// private ILayout PlanEntranceFacade(float facadeWidth, int floors, float entranceInterval, bool hasAttic, bool leftIsConvex, // bool rightIsConvex) // { // List<PanelSize> panelSizes = DivideFacade(facadeWidth, leftIsConvex, rightIsConvex, out float remainder); // //bool hasBalconies = RandomE.Chance(0.5f); // bool hasBalconies = false; // // commonConstructors[PanelType.Entrance] = constructors[PanelType.Entrance].GetRandom(); // commonConstructors[PanelType.EntranceWindow] = constructors[PanelType.EntranceWindow].GetRandom(); // commonConstructors[PanelType.Wall] = constructors[PanelType.Wall].GetRandom(); // // var horizontal = new HorizontalLayout(); // // bool hasRemainder = remainder > Geometry.Epsilon; // if (hasRemainder) // { // horizontal.Add(CreateBufferWallVertical(remainder/2, floors, hasAttic)); // } // // int entranceCount = Mathf.Max(Mathf.FloorToInt(facadeWidth/entranceInterval) - 1, 1); // int entranceIndexInterval = (panelSizes.Count - entranceCount)/(entranceCount + 1); // // int lastEntranceIndex = -1; // for (int i = 0; i < entranceCount; i++) // { // int entranceIndex = (i + 1)*entranceIndexInterval + i; // // horizontal.Add(CreateNormalFacadeVertical(panelSizes, lastEntranceIndex + 1, entranceIndex, floors, hasAttic, hasBalconies)); // // horizontal.Add(CreateEntranceVertical(sizeValues[panelSizes[entranceIndex]], floors, hasAttic)); // // if (i == entranceCount - 1) // { // horizontal.Add(CreateNormalFacadeVertical(panelSizes, entranceIndex + 1, panelSizes.Count, floors, hasAttic, hasBalconies)); // } // // lastEntranceIndex = entranceIndex; // } // if (hasRemainder) // { // horizontal.Add(CreateBufferWallVertical(remainder/2, floors, hasAttic)); // } // return horizontal; // } private VerticalLayout CreateBufferWallVertical(float width, int floors, bool hasAttic) { // var vertical = new VerticalLayout // { // Construct(constructors[PanelType.Socle], width, socleHeight), // CreateVertical(width, floorHeight, floors, constructors[PanelType.Wall].First()) // }; var vertical = new VerticalLayout(); vertical.Add(Construct(constructors[PanelType.Wall], width, floorHeight * (floors + 1))); if (hasAttic) { vertical.Add(Construct(constructors[PanelType.Attic], width, atticHeight)); } return(vertical); }
public ResultDisplay(MatchCore comp) { competition = comp; buttonLayout = new VerticalLayout(VerticalLayout.VerticalAlign.Center); buttonLayout.Add(new ButtonControl("Back to Main Menu", ButtonClick)); AddControlLayout(buttonLayout); }
private VerticalLayout CreateVertical(float width, float height, int floors, Func <ILayoutElement> constructor) { var verticalLayout = new VerticalLayout(); for (int i = 0; i < floors; i++) { verticalLayout.Add(Construct(constructor, width, height)); } return(verticalLayout); }
private VerticalLayout CreateNormalFacadeVertical(List <PanelSize> panelSizes, int from, int to, int floors, bool hasAttic, bool hasBalconies) { var vertical = new VerticalLayout(); vertical.Add(CreateHorizontal(panelSizes, from, to, socleHeight, constructors[PanelType.Socle])); for (int floorIndex = 0; floorIndex < floors; floorIndex++) { if (floorIndex == 0 || !hasBalconies) { vertical.Add(CreateHorizontal(panelSizes, from, to, floorHeight, constructors[PanelType.Window])); } else { vertical.Add(CreateHorizontal(panelSizes, from, to, floorHeight, constructors[PanelType.Balcony])); } } if (hasAttic) { vertical.Add(CreateHorizontal(panelSizes, from, to, atticHeight, constructors[PanelType.Attic])); } return(vertical); }
private VerticalLayout CreateBufferWallVertical(float width, int floors, bool hasAttic) { var vertical = new VerticalLayout { Construct(constructors[PanelType.Socle], width, socleHeight), CreateVertical(width, floorHeight, floors, commonConstructors[PanelType.Wall]) }; if (hasAttic) { vertical.Add(Construct(constructors[PanelType.Attic], width, atticHeight)); } return(vertical); }
new public void Add(VisualElement visualElement) { contentElement.Add(visualElement); }
protected override void InitUI(UIWidget layout) { EditorVerticalLayout innerLayout = new EditorVerticalLayout(); innerLayout.InnerSpace = 10; layout.Add(innerLayout); { EditorHorizontalLayout hLayout = new EditorHorizontalLayout(); hLayout.InnerSpace = 10; EditorPrefixLabel label = new EditorPrefixLabel(); label.Text = "Asset Path :"; hLayout.Add(label); bundleFolder.Text = "Open"; string bundles = FilePath.BundlesPath; bundleFolder.Filepath = Path.Combine(EditorAssets.Root, bundles).Replace("\\", "/"); hLayout.Add(bundleFolder); innerLayout.Add(hLayout); } { EditorHorizontalLayout hLayout = new EditorHorizontalLayout(); hLayout.InnerSpace = 10; EditorPrefixLabel label = new EditorPrefixLabel(); label.Text = "Out Path :"; hLayout.Add(label); outputFolder.Filepath = Path.Combine(EditorAssets.Root, "Output").Replace("\\", "/"); outputFolder.Text = "Open"; hLayout.Add(outputFolder); innerLayout.Add(hLayout); } { VerticalLayout vLayout = new VerticalLayout(); vLayout.InnerSpace = 10; EditorIntPopup popup = new EditorIntPopup(); popup.Text = "Choose Platform :"; popup.Value = platformIndex; popup.TriggerHandler = (Widget w) => { platformIndex = popup.Value; }; for (int i = 0; i < PlatformInfo.Count; i++) { popup.Add(new EditorIntPopup.DisplayItem(PlatformInfo[i].name, PlatformInfo[i].index)); } vLayout.Add(popup); GUIButton button = new GUIButton(); button.Text = "Pack"; button.TriggerHandler = (Widget w) => { Pack((Platform)PlatformInfo[platformIndex].value, PlatformInfo[platformIndex].name); }; vLayout.Add(button); innerLayout.Add(vLayout); } }