private void BuildFactionDetails(ModSideDfnXML sideInfo) { ClearSubWidgets(); PanelScrollableWidget panelFactionDetails = UIManager.Instance.CreateScrollablePanel("panelFactionDetails", 0.7f, 0.92f); panelFactionDetails.ChangeRow(UI.ValueType.Abosulte, 0.03f); //next/prev panelFactionDetails.AddRow(UI.ValueType.Abosulte, 0.05f); //faction name panelFactionDetails.AddRow(UI.ValueType.Auto); //faction mesh panelFactionDetails.AddRow(UI.ValueType.Abosulte, 0.03f); //ruler panelFactionDetails.AddRow(UI.ValueType.Auto); //faction occupy lands panelFactionDetails.AddRow(UI.ValueType.Auto); //faction vassals panelFactionDetails.AddRow(UI.ValueType.Abosulte, 0.03f); //empty row panelFactionDetails.AddRow(UI.ValueType.Abosulte, 0.03f); //foreign relations panelFactionDetails.Padding.PaddingLeft = 0.01f; SimpleStaticTextWidget txtFactionName = new SimpleStaticTextWidget("txtFactionName", GameString.FromString(sideInfo.ID, sideInfo.Name).ToString(), 0, false, ColourValue.Black, 150); panelFactionDetails.AddWidget(2, 1, txtFactionName, AlignMode.Center); PanelMaterialWidget coatOfArmsPanel = new PanelMaterialWidget("coatOfArmsPanel", sideInfo.COA); coatOfArmsPanel.Width = 0.3f; coatOfArmsPanel.Height = 0.3f; panelFactionDetails.AddWidget(3, 1, coatOfArmsPanel, AlignMode.Center, AlignMode.Center, DockMode.Center); string chaID = GameSlotManager.Instance.GetSlot(sideInfo.ID, "slot_faction_leader"); var chaData = world.ModData.CharacterInfos.Where(o => o.ID == chaID).FirstOrDefault(); GameRegisterManager.Instance.SetRegisterValue("reg0", GameString.FromString(sideInfo.ID, sideInfo.Name).ToString()); GameRegisterManager.Instance.SetRegisterValue("reg1", GameString.FromString(chaData.ID, chaData.Name).ToString()); SimpleStaticTextWidget txtFactionRulerInfo = new SimpleStaticTextWidget("txtFactionRulerInfo", GameString.FromString("@{reg0} is ruled by {reg1}").ToString(), 0, false, ColourValue.Black); txtFactionRulerInfo.Width = txtFactionName.TextWidth; txtFactionRulerInfo.Height = txtFactionName.TextHeight; panelFactionDetails.AddWidget(4, 1, txtFactionRulerInfo); SimpleStaticTextWidget txtOccupiedLands = new SimpleStaticTextWidget("txtOccupiedLands", GameString.FromString("@It occupies none").ToString(), 0, false, ColourValue.Black); panelFactionDetails.AddWidget(5, 1, txtOccupiedLands); SimpleStaticTextWidget txtVassalInfos = new SimpleStaticTextWidget("txtVassalInfos", GameString.FromString("@Its vassals are none").ToString(), 0, false, ColourValue.Black); panelFactionDetails.AddWidget(6, 1, txtVassalInfos); SimpleStaticTextWidget txtForeignRelationship = new SimpleStaticTextWidget("txtForeignRelationship", GameString.FromString("@Foreign relations:").ToString(), 0, false, ColourValue.Black); panelFactionDetails.AddWidget(8, 1, txtForeignRelationship); subWidgets.Add(panelFactionDetails); }
private void CreateModCard(Mod mod, int currentRow, int currentCol) { PanelWidget modPreviewWidget = new PanelWidget("mod_panel_" + mod.name_id, 0, 0.3f, 0, 0, 2, 1, false); modPreviewWidget.ChangeRow(UI.ValueType.Percent, 100); modPreviewWidget.ChangeRow(UI.ValueType.Abosulte, 0.3f, 2); modPreviewWidget.Material = "SdkTrays/MiniTray"; browserMainPanel.ChangeRow(UI.ValueType.Abosulte, modPreviewWidget.Height, currentRow); browserMainPanel.AddWidget(currentRow, currentCol, modPreviewWidget, AlignMode.Center, AlignMode.Center, DockMode.Fill); PanelMaterialWidget pictureWidget = new PanelMaterialWidget("mod_pic_" + mod.name_id, "error.png"); modPreviewWidget.AddWidget(1, 1, pictureWidget, AlignMode.Center, AlignMode.Center, DockMode.Fill); PanelWidget modInfoWidget = new PanelWidget("mod_info_panel_" + mod.name_id, 0, 0, 0, 0, 1, 2, false); modInfoWidget.ChangeCol(UI.ValueType.Percent, 80); modInfoWidget.ChangeCol(UI.ValueType.Percent, 20, 2); modPreviewWidget.AddWidget(2, 1, modInfoWidget, AlignMode.Center, AlignMode.Center, DockMode.Fill); SimpleStaticTextWidget modNameWidget = new SimpleStaticTextWidget("mod_text_" + mod.name_id, mod.name, 0.2f, false, new Mogre.ColourValue()); modInfoWidget.AddWidget(1, 1, modNameWidget, AlignMode.Left, AlignMode.Center, DockMode.Fill, 1, 1, false); SimpleButtonWidget btnModSubscribeWidget = new SimpleButtonWidget("btnModSubscribeWidget_" + mod.name_id, "Subscribe", 0.8f, 0.7f); btnModSubscribeWidget.OnClick += (o) => { OnScreenEventChanged?.Invoke(btnModSubscribeWidget.Name, null); }; IBackendTask downloadModThumbTask = new DownloadBackendTask(mod.logo.original, "./Media/Engine/Download/" + mod.name_id + "_thumb.png"); BackendTaskManager.Instance.EnqueueTask(downloadModThumbTask); BackendTaskManager.Instance.TaskEnded += (o) => { pictureWidget.ChangeTexture(o.ToString()); }; modInfoWidget.AddWidget(1, 2, btnModSubscribeWidget, AlignMode.Center, AlignMode.Center); }