private void EditPage() { ((namingBar.children[1] as EHorizontalLayout).children[0] as ETextInputField).Content( window.selectedPage == -1 ? "" : window.database.pages[this.window.selectedPage].pageName ); namingBar.ActivateTab(1); }
void UpdatePageList() { EditorUIBase GenPageEntry(int index) { var disp = new EHorizontalLayout() + new EText().Content(index.ToString()).Width(20) + new EText().BindContent(() => { if (window.database.pages.Count > index) { return(window.database.pages[index].pageName); } else { return("OUT OF SCOPE!"); } }).RelativeSize(true); var tabs = new ESwitchTab(); var element = tabs //Unselected + (new EButton().OnClicked((EButton b) => { SelectPageEntry(index); }) + disp ) //Selected + (new ECascade() + disp + new EBox() ) ; element.OnConstruct(window); return(element); } if (dbPageList.children.Count < window.database.pages.Count) { for (int i = dbPageList.children.Count; i < window.database.pages.Count; i++) { dbPageList.children.Add(GenPageEntry(i)); } } else if (window.database.pages.Count < dbPageList.children.Count) { dbPageList.children.RemoveRange(window.database.pages.Count, dbPageList.children.Count - window.database.pages.Count); } for (int i = 0; i < dbPageList.children.Count; i++) { ESwitchTab entry = (dbPageList.children[i] as ESwitchTab); if (window.selectedPage == i) { if (entry.ActivatedTab() == 0) { entry.ActivateTab(1); } } else { entry.ActivateTab(0); } } }
public NewCompTab(ComponentEditorWindow window) { RelativeSize(true); this.window = window; aimingAngleField = new ETextInputField().OnInputUpdate((ETextInputField f, string val) => { compAim.aimingAngle = Convert.ToSingle(val); }).RelativeSize(true); horizontalRotationSpeedField = new ETextInputField().OnInputUpdate((ETextInputField f, string val) => { compAim.horizontalRotationSpeed = Convert.ToSingle(val); }).RelativeSize(true); verticalRotationSpeedField = new ETextInputField().OnInputUpdate((ETextInputField f, string val) => { compAim.verticalRotationSpeed = Convert.ToSingle(val); }).RelativeSize(true); List <string> aimingTypes = new List <string>(Enum.GetNames(typeof(ComponentAimingType))); aimingTypes.Insert(0, "Disable aiming"); var aimConfig = new ESwitchTab().RelativeSize(true).OnActivateTab((ESwitchTab tab, int i) => { }) + new EBox().Content(new GUIContent("Aiming disabled")) + (new EVerticalLayout() + (new EHorizontalLayout() + (new EText("Aiming angle resolution").RelativeSize(true)) + aimingAngleField ) + (new EHorizontalLayout() + (new EText("Horizontal rotation speed").RelativeSize(true)) + horizontalRotationSpeedField ) + (new EHorizontalLayout() + (new EText("Vertical rotation speed").RelativeSize(true)) + verticalRotationSpeedField ) ); children.Add(new EVerticalLayout().RelativeSize(true) //Name input field //Name viability status + (new EHorizontalLayout() //Component type + (new ETextInputField().OnInputUpdate((ETextInputField f, string val) => SetName(val))).RelativeSize(true).Width(3) + new EPopup().RelativeSize(true).Width(1) .Content(Enum.GetNames(typeof(ComponentType))) .OnSelectionChange((EPopup p, int i) => { SetType(i); }) ) + (new EText().BindContent(() => { return(CheckNameViability() ? "All good" : "!! Naming conflict !!"); })) //Component aiming mechanism + new EPopup() .Content(aimingTypes.ToArray()) .OnSelectionChange((EPopup p, int i) => { if (i == 0) { aimConfig.ActivateTab(0); } else { aimConfig.ActivateTab(1); } SetAimType(i); }) + aimConfig ); children.Add( new EHorizontalLayout() + (new EButton().RelativeSize(true).OnClicked((EButton b) => CreateComponent()) + new EText("Create")) + (new EButton().RelativeSize(true).OnClicked((EButton b) => window.OpenDBEditTab()) + new EText("Cancel")) ); }
internal void OpenCompEditTab() { tabs.ActivateTab(2); }