/// <summary> /// 将一个新构造的UI加入UI列表中 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="_UI"></param> static public void AddUI <T>(T _UI) where T : iUI { if (_UI != null && !UIList.Contains(_UI)) { UIList.Add(_UI); } }
public override void OnInitialize() { allEvilAvailable = new UIList(); List <ModBiome> allEvil = BiomeLibs.Biomes.Values.Where(i => i.BiomeAlt == BiomeAlternative.evilAlt).ToList(); scrollbar = new UIScrollbar(); scrollbar.Top.Set(-5, 0f); scrollbar.HAlign = 1f; Add(GenerateButton("Corruption")); Add(GenerateButton("Crimson")); foreach (var biome in allEvil) { Add(GenerateButton(biome)); } Add(GenerateButton("Random")); allEvilAvailable.Width.Set(800, 0f); allEvilAvailable.Height.Set(400, 0f); allEvilAvailable.Left.Set(Main.screenWidth / 2 - 400, 0f); allEvilAvailable.Top.Set(Main.screenHeight / 2 - 200, 0f); allEvilAvailable.SetScrollbar(scrollbar); Width.Set(Main.screenWidth, 0f); Height.Set(Main.screenHeight, 0f); Left.Set(0, 0f); Top.Set(0, 0f); Append(allEvilAvailable); Append(scrollbar); }
/// <summary> /// 从UI列表中取得一个UI /// </summary> /// <typeparam name="T"></typeparam> /// <param name="_label"></param> /// <returns></returns> static public T GetUI <T>(iLabel _label = null) where T : iUI { if (_label == null) { foreach (var item in UIList) { if (item.GetType() == typeof(T)) { return((T)item); } } return(CreateUI <T>()); } else { var _result = UIList.Find(_target => _target.ID == _label.ID || _target.Name == _label.Name); if (_result == null) { return(CreateUI <T>()); } else { return((T)_result); } } }
public void InitializePage() { this.RemoveAllChildren(); UIElement element = new UIElement(); element.Width.Set(590f, 0.0f); element.Top.Set(220f, 0.0f); element.Height.Set(-220f, 1f); element.HAlign = 0.5f; this._outerContainer = element; this.Append(element); UIPanel uiPanel = new UIPanel(); uiPanel.Width.Set(0.0f, 1f); uiPanel.Height.Set(-110f, 1f); uiPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f; uiPanel.PaddingTop = 0.0f; element.Append((UIElement)uiPanel); this._container = (UIElement)uiPanel; UIList uiList = new UIList(); uiList.Width.Set(-25f, 1f); uiList.Height.Set(-50f, 1f); uiList.Top.Set(50f, 0.0f); uiList.HAlign = 0.5f; uiList.ListPadding = 14f; uiPanel.Append((UIElement)uiList); this._list = uiList; UIScrollbar scrollbar = new UIScrollbar(); scrollbar.SetView(100f, 1000f); scrollbar.Height.Set(-20f, 1f); scrollbar.HAlign = 1f; scrollbar.VAlign = 1f; scrollbar.Top = StyleDimension.FromPixels(-5f); uiList.SetScrollbar(scrollbar); this._scrollBar = scrollbar; UITextPanel <LocalizedText> uiTextPanel = new UITextPanel <LocalizedText>(Language.GetText("UI.Back"), 0.7f, true); uiTextPanel.Width.Set(-10f, 0.5f); uiTextPanel.Height.Set(50f, 0.0f); uiTextPanel.VAlign = 1f; uiTextPanel.HAlign = 0.5f; uiTextPanel.Top.Set(-45f, 0.0f); uiTextPanel.OnMouseOver += new UIElement.MouseEvent(this.FadedMouseOver); uiTextPanel.OnMouseOut += new UIElement.MouseEvent(this.FadedMouseOut); uiTextPanel.OnClick += new UIElement.MouseEvent(this.GoBackClick); uiTextPanel.SetSnapPoint("Back", 0, new Vector2?(), new Vector2?()); element.Append((UIElement)uiTextPanel); this._backPanel = (UIElement)uiTextPanel; int currentGroupIndex = 0; this.TryAddingList(Language.GetText("UI.EmoteCategoryGeneral"), ref currentGroupIndex, 10, this.GetEmotesGeneral()); this.TryAddingList(Language.GetText("UI.EmoteCategoryRPS"), ref currentGroupIndex, 10, this.GetEmotesRPS()); this.TryAddingList(Language.GetText("UI.EmoteCategoryItems"), ref currentGroupIndex, 11, this.GetEmotesItems()); this.TryAddingList(Language.GetText("UI.EmoteCategoryBiomesAndEvents"), ref currentGroupIndex, 8, this.GetEmotesBiomesAndEvents()); this.TryAddingList(Language.GetText("UI.EmoteCategoryTownNPCs"), ref currentGroupIndex, 9, this.GetEmotesTownNPCs()); this.TryAddingList(Language.GetText("UI.EmoteCategoryCritters"), ref currentGroupIndex, 7, this.GetEmotesCritters()); this.TryAddingList(Language.GetText("UI.EmoteCategoryBosses"), ref currentGroupIndex, 8, this.GetEmotesBosses()); }
private void SetupList(UIList list, DealingCharacterItems dealingItems, List <UICharacterItem> uiList) { CacheItemSelectionManager.DeselectSelectedUI(); List <CharacterItem> filterItems = new List <CharacterItem>(); foreach (DealingCharacterItem dealingItem in dealingItems) { CharacterItem characterItem = dealingItem.characterItem; filterItems.Add(characterItem); } uiList.Clear(); list.Generate(filterItems, (index, characterItem, ui) => { UICharacterItem uiCharacterItem = ui.GetComponent <UICharacterItem>(); uiCharacterItem.Setup(new CharacterItemTuple(characterItem, characterItem.level, InventoryType.NonEquipItems), null, -1); uiCharacterItem.Show(); uiList.Add(uiCharacterItem); }); CacheItemSelectionManager.Clear(); foreach (UICharacterItem tempDealingItemUI in tempDealingItemUIs) { CacheItemSelectionManager.Add(tempDealingItemUI); } foreach (UICharacterItem tempAnotherDealingItemUI in tempAnotherDealingItemUIs) { CacheItemSelectionManager.Add(tempAnotherDealingItemUI); } }
public SelectableText(UITextPhrase self, InfoPanel infoPanel, SelectableList selList, string header, List <string> properties, bool isOption = true) { this.opdict = infoPanel.opdict; this.uilist = infoPanel.uielem; this.selList = selList; this.infoPanel = infoPanel; target = header; values = properties != null?properties.ToList() : new List <string>(); if (values.Count > 1 || (values.Count == 1 && values[0].Equals(OptionsDict.SelectableList.removeTag))) { values.Insert(0, "# " + header); } this.self = self; this.targetUIdesc = infoPanel.uidesc; if (properties != null && properties.Count > 0) { if (isOption) { self.OnClick += SelectOption; } else { self.OnClick += select; } self.OnMouseOver += ChangeToGrey; self.OnMouseOut += ChangeToWhite; } }
public void InitializePage() { RemoveAllChildren(); UIElement uIElement = new UIElement(); uIElement.Width.Set(590f, 0f); uIElement.Top.Set(220f, 0f); uIElement.Height.Set(-220f, 1f); uIElement.HAlign = 0.5f; _outerContainer = uIElement; Append(uIElement); UIPanel uIPanel = new UIPanel(); uIPanel.Width.Set(0f, 1f); uIPanel.Height.Set(-110f, 1f); uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f; uIPanel.PaddingTop = 0f; uIElement.Append(uIPanel); _container = uIPanel; UIList uIList = new UIList(); uIList.Width.Set(-25f, 1f); uIList.Height.Set(-50f, 1f); uIList.Top.Set(50f, 0f); uIList.HAlign = 0.5f; uIList.ListPadding = 14f; uIPanel.Append(uIList); _list = uIList; UIScrollbar uIScrollbar = new UIScrollbar(); uIScrollbar.SetView(100f, 1000f); uIScrollbar.Height.Set(-20f, 1f); uIScrollbar.HAlign = 1f; uIScrollbar.VAlign = 1f; uIScrollbar.Top = StyleDimension.FromPixels(-5f); uIList.SetScrollbar(uIScrollbar); _scrollBar = uIScrollbar; UITextPanel <LocalizedText> uITextPanel = new UITextPanel <LocalizedText>(Language.GetText("UI.Back"), 0.7f, large: true); uITextPanel.Width.Set(-10f, 0.5f); uITextPanel.Height.Set(50f, 0f); uITextPanel.VAlign = 1f; uITextPanel.HAlign = 0.5f; uITextPanel.Top.Set(-45f, 0f); uITextPanel.OnMouseOver += FadedMouseOver; uITextPanel.OnMouseOut += FadedMouseOut; uITextPanel.OnClick += GoBackClick; uITextPanel.SetSnapPoint("Back", 0); uIElement.Append(uITextPanel); _backPanel = uITextPanel; int currentGroupIndex = 0; TryAddingList(Language.GetText("UI.EmoteCategoryGeneral"), ref currentGroupIndex, 10, GetEmotesGeneral()); TryAddingList(Language.GetText("UI.EmoteCategoryRPS"), ref currentGroupIndex, 10, GetEmotesRPS()); TryAddingList(Language.GetText("UI.EmoteCategoryItems"), ref currentGroupIndex, 11, GetEmotesItems()); TryAddingList(Language.GetText("UI.EmoteCategoryBiomesAndEvents"), ref currentGroupIndex, 8, GetEmotesBiomesAndEvents()); TryAddingList(Language.GetText("UI.EmoteCategoryTownNPCs"), ref currentGroupIndex, 9, GetEmotesTownNPCs()); TryAddingList(Language.GetText("UI.EmoteCategoryCritters"), ref currentGroupIndex, 7, GetEmotesCritters()); TryAddingList(Language.GetText("UI.EmoteCategoryBosses"), ref currentGroupIndex, 8, GetEmotesBosses()); }
//////////////// public override void OnInitializeMe() { this.InitializeHeader(); //// var modListPanel = new UIPanel(); modListPanel.Top.Set(24f, 0f); modListPanel.Width.Set(0f, 1f); modListPanel.Height.Set(480f, 0f); modListPanel.HAlign = 0f; modListPanel.SetPadding(4f); //modListPanel.PaddingTop = 0.0f; modListPanel.BackgroundColor = this.Theme.ListBgColor; modListPanel.BorderColor = this.Theme.ListEdgeColor; this.Append((UIElement)modListPanel); this.PlayerStatList = new UIList(); this.PlayerStatList.Width.Set(-25f, 1f); this.PlayerStatList.Height.Set(0f, 1f); this.PlayerStatList.HAlign = 0f; this.PlayerStatList.ListPadding = 4f; this.PlayerStatList.SetPadding(0f); modListPanel.Append((UIElement)this.PlayerStatList); this.Scrollbar = new UIHideableScrollbar(this.PlayerStatList, true); this.Scrollbar.Top.Set(8f, 0f); this.Scrollbar.Height.Set(-16f, 1f); this.Scrollbar.SetView(100f, 1000f); this.Scrollbar.HAlign = 1f; modListPanel.Append((UIElement)this.Scrollbar); this.PlayerStatList.SetScrollbar(this.Scrollbar); }
private void AddCustomAchievements(On.Terraria.GameContent.UI.States.UIAchievementsMenu.orig_InitializePage orig, UIAchievementsMenu self) { orig(self); Type typ = self.GetType(); FieldInfo elementInfo = typ.GetField("_achievementElements", BindingFlags.NonPublic | BindingFlags.Instance); FieldInfo achieveInfo = typ.GetField("_achievementsList", BindingFlags.NonPublic | BindingFlags.Instance); FieldInfo childrenInfo = typeof(UIElement).GetField("Elements", BindingFlags.NonPublic | BindingFlags.Instance); FieldInfo lockInfo = typeof(UIAchievementListItem).GetField("_locked", BindingFlags.NonPublic | BindingFlags.Instance); List <UIElement> children = (List <UIElement>)childrenInfo.GetValue(self); UIElement element = children.FirstOrDefault(c => c is UIElement); List <UIElement> children2 = (List <UIElement>)childrenInfo.GetValue(element); UIElement panel = children2.FirstOrDefault(c => c is UIPanel); List <UIElement> children3 = (List <UIElement>)childrenInfo.GetValue(panel); UIElement scrollbar = children3.FirstOrDefault(c => c is UIScrollbar); List <UIAchievementListItem> elements = (List <UIAchievementListItem>)elementInfo.GetValue(self); UIList achievements = (UIList)achieveInfo.GetValue(self); foreach (ModAchievement achieve in Achievements) { //lockInfo.SetValue(achieve, (achieve as ModAchievement).Unlocked); elements.Add(achieve); achievements.Add(achieve); } elementInfo.SetValue(self, elements); achieveInfo.SetValue(self, achievements); achievements.SetScrollbar(scrollbar as UIScrollbar); }
public InfoPanel(UIList uielem, UIListDescription uidesc, OptionsDict opdict) { this.uielem = uielem; this.uidesc = uidesc; this.opdict = opdict; selectables = new List <Selectable>(); }
public static void AddRange(this UIList list, IEnumerable <UIElement> range) { foreach (var it in range) { list.Add(it); } }
public UITinker() { Top.Set(300, 0f); Left.Set(100, 0f); Height.Set(500, 0f); Width.Set(200, 0f); var tt = new DragableUIPanel(); tt.Draggable = false; tt.Top.Set(50, 0); tt.Left.Set(10, 0); tt.Width.Set(180, 0); tt.Height.Set(400, 0); tt.BackgroundColor = new Color(100, 44, 25); Append(tt); list = new UIList(); tt.Append(list); //list.Top.Set(50, 0); //list.Left.Set(10, 0); list.Width.Set(180, 0); list.Height.Set(400, 0); var el = new UITextPanel <LocalizedText>(Language.GetText("UI.Back"), 0.7f); el.HAlign = 0.5f; el.Top.Set(-45f, 0.0f); el.Left.Set(-10f, 0.0f); el.SetPadding(15f); list.Add(el); //Append(list); }
public override void OnInitialize() { var element = new UIElement(); element.Width.Set(0.0f, 0.8f); element.MaxWidth.Set(650f, 0.0f); element.Top.Set(220f, 0.0f); element.Height.Set(-220f, 1f); element.HAlign = 0.5f; var uiPanel = new UIPanel(); uiPanel.Width.Set(0.0f, 1f); uiPanel.Height.Set(-110f, 1f); uiPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f; element.Append((UIElement)uiPanel); this._containerPanel = uiPanel; this._worldList = new UIList(); this._worldList.Width.Set(-25f, 1f); this._worldList.Height.Set(0.0f, 1f); this._worldList.ListPadding = 5f; uiPanel.Append((UIElement)this._worldList); var scrollbar = new UIScrollbar(); scrollbar.SetView(100f, 1000f); scrollbar.Height.Set(0.0f, 1f); scrollbar.HAlign = 1f; uiPanel.Append((UIElement)scrollbar); this._worldList.SetScrollbar(scrollbar); var uiTextPanel1 = new UITextPanel <LocalizedText>(Language.GetText("UI.SelectWorld"), 0.8f, true); uiTextPanel1.HAlign = 0.5f; uiTextPanel1.Top.Set(-35f, 0.0f); uiTextPanel1.SetPadding(15f); uiTextPanel1.BackgroundColor = new Color(73, 94, 171); element.Append((UIElement)uiTextPanel1); var uiTextPanel2 = new UITextPanel <LocalizedText>(Language.GetText("UI.Back"), 0.7f, true); uiTextPanel2.Width.Set(-10f, 0.5f); uiTextPanel2.Height.Set(50f, 0.0f); uiTextPanel2.VAlign = 1f; uiTextPanel2.Top.Set(-45f, 0.0f); uiTextPanel2.OnMouseOver += new UIElement.MouseEvent(this.FadedMouseOver); uiTextPanel2.OnMouseOut += new UIElement.MouseEvent(this.FadedMouseOut); uiTextPanel2.OnClick += new UIElement.MouseEvent(this.GoBackClick); element.Append((UIElement)uiTextPanel2); this._backPanel = uiTextPanel2; var uiTextPanel3 = new UITextPanel <LocalizedText>(Language.GetText("UI.New"), 0.7f, true); uiTextPanel3.CopyStyle((UIElement)uiTextPanel2); uiTextPanel3.HAlign = 1f; uiTextPanel3.OnMouseOver += new UIElement.MouseEvent(this.FadedMouseOver); uiTextPanel3.OnMouseOut += new UIElement.MouseEvent(this.FadedMouseOut); uiTextPanel3.OnClick += new UIElement.MouseEvent(this.NewWorldClick); element.Append((UIElement)uiTextPanel3); this._newPanel = uiTextPanel3; this.Append(element); }
public void SetActive(UIList ui, bool state) { if (uiDic.ContainsKey(ui)) { uiDic[ui].SetActive(state); } }
public void SetActive(UIList name, bool state) { if (_uiDic.ContainsKey(name)) { _uiDic[name].gameObject.SetActive(state); } }
public void CallEvent(UIList name, string func, object value = null) { if (_uiDic.ContainsKey(name)) { _uiDic[name].SendMessage(func, value, SendMessageOptions.DontRequireReceiver); } }
protected override void InitTitleInfo(UIList titleList, EUICampType campType) { titleList.Add <BlastRecordInfo>(new GroupRecordViewData() { CanResque = _adapter.CanRescue, IsTitle = true, NeedShow = true, CampType = campType }); }
private void Init() { partsUIList = FindComponent <UIList>("PartsGroup"); partsUIList.OnceInit = () => { Transform line = partsUIList.transform.GetChild(0); if (line == null) { return; } line.SetAsLastSibling(); }; attrUIList = FindComponent <UIList>("AttrGroup"); attrUIList.OnceInit = () => { Transform line = attrUIList.transform.GetChild(0); if (line == null) { return; } line.SetAsLastSibling(); }; mRt = ViewInstance.transform as RectTransform; }
public override void OnInitialize() { uIElement = new UIElement(); uIElement.Width.Set(0f, 0.8f); uIElement.MaxWidth.Set(600f, 0f); uIElement.Top.Set(220f, 0f); uIElement.Height.Set(-220f, 1f); uIElement.HAlign = 0.5f; uIPanel = new UIPanel(); uIPanel.Width.Set(0f, 1f); uIPanel.Height.Set(-110f, 1f); uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f; uIPanel.PaddingTop = 0f; uIElement.Append(uIPanel); modList = new UIList(); modList.Width.Set(-25f, 1f); modList.Height.Set(-50f, 1f); modList.Top.Set(50f, 0f); modList.ListPadding = 5f; uIPanel.Append(modList); backButton = new UITextPanel <string>("Back"); backButton.OnClick += BackClick; backButton.OnMouseOver += UICommon.FadedMouseOver; backButton.OnMouseOut += UICommon.FadedMouseOut; uIPanel.Append(backButton); Append(uIElement); LoadModList(); }
public ListData(GameObject root, UIListItemBase handler, UIList rootMgr) { m_ObjectRoot = root; m_Handler = handler; m_Handler.m_ObjectRoot = root; m_Handler.m_RootMgr = rootMgr; }
public override void Click(UIMouseEvent evt) { ManualGeneratorMenu.selected = this; ManualGeneratorMenu.multiIndex = 0; if (!Generator.StructureDataCache.ContainsKey(Path)) { Generator.LoadFile(Path, StructureHelper.Instance, true); } if (Generator.StructureDataCache[Path].ContainsKey("Structures")) { ManualGeneratorMenu.multiMode = true; var count = Generator.StructureDataCache[Path].Get <List <TagCompound> >("Structures").Count; Height.Set(36 + 36 * count, 0); UIList list = new UIList(); for (int k = 0; k < count; k++) { list.Add(new MultiSelectionEntry(k)); } list.Width.Set(300, 0); list.Height.Set(36 * count, 0); list.Left.Set(50, 0); list.Top.Set(36, 0); Append(list); } else { ManualGeneratorMenu.multiMode = false; } }
public Inspecter(EditorState editor) : base(editor) { _inspecterPanel = new UIPanel() { Pivot = new Vector2(0, 0), AnchorPoint = new Vector2(0, 0), Position = new Vector2(5, 5), SizeFactor = new Vector2(1, 1), Size = new Vector2(-10, -9), }; _inspectorList = new UIList() { AnchorPoint = new Vector2(0, 0), Pivot = new Vector2(0, 0), SizeFactor = new Vector2(1f, 1f), Size = new Vector2(-10f, -10f), Position = new Vector2(5f, 5f), }; var scrollBar1 = new UIScrollBarV() { Name = "ScrollBar", AnchorPoint = new Vector2(1, 0.5f), Pivot = new Vector2(1, 0.5f), }; _inspectorList.SetScrollBarV(scrollBar1); _inspecterPanel.AppendChild(_inspectorList); AppendChild(_inspecterPanel); }
//////////////// public void CheckVersion(string modName, BasicModInfo modInfo, UIList modsUiModList, Version modVersion) { //LogHelpers.Log( "modInfo.Count:"+modInfo.Count+ ", name:"+name+", vers:"+vers); if (modInfo.Version == modVersion) { return; } UIPanel uiModItem = null; foreach (UIElement modItem in modsUiModList._items) { object mod; TmodFile modFile; if (!ReflectionHelpers.Get(modItem, "_mod", out mod) || mod == null) { LogHelpers.Warn("Could not get mod for version check from mod list item " + modItem.ToString()); continue; } if (!ReflectionHelpers.Get(mod, "modFile", out modFile) || modFile == null) { LogHelpers.Warn("Could not get mod file for version check from mod " + mod.ToString() + "'s list item " + modItem.ToString()); continue; } if (modFile.name == modName) { uiModItem = (UIPanel)modItem; break; } } if (uiModItem != null) { Version newModVersion = modInfo.Version; string msg = newModVersion.ToString() + " On Mod Browser"; //LogHelpers.Log( " name: "+name+", uiModItem: " + uiModItem.GetOuterDimensions().ToRectangle() ); var txt = new UIText(msg, 0.8f, true); txt.Top.Set(24f, 0f); txt.Left.Set(-184f, 0.5f); if (newModVersion > modVersion) { txt.TextColor = Color.Gold; } else { txt.SetText(msg, 0.6f, true); txt.TextColor = Color.Gray; } uiModItem.Append(txt); uiModItem.Recalculate(); uiModItem.Parent?.Recalculate(); uiModItem.Parent?.Parent?.Recalculate(); uiModItem.Parent?.Parent?.Parent?.Recalculate(); } }
/// <summary> /// Applies a sorting method for the collectibles list /// </summary> /// <param name="list"></param> /// <param name="mode"></param> public static void ApplySort(ref UIList list, CollectibleSortingMode mode) { switch (mode) { default: case CollectibleSortingMode.Normal: list.UpdateOrder(); break; case CollectibleSortingMode.NamesAsc: list._items.Sort((x, y) => (x as CollectibleUIPanel).itemPanel.item.name.CompareTo((y as CollectibleUIPanel).itemPanel.item.name)); break; case CollectibleSortingMode.NamesDesc: list._items.Sort((x, y) => (y as CollectibleUIPanel).itemPanel.item.name.CompareTo((x as CollectibleUIPanel).itemPanel.item.name)); break; case CollectibleSortingMode.UnitAsc: list._items.Sort((x, y) => (x as CollectibleUIPanel)._stack.CompareTo((y as CollectibleUIPanel)._stack)); break; case CollectibleSortingMode.UnitDesc: list._items.Sort((x, y) => (y as CollectibleUIPanel)._stack.CompareTo((x as CollectibleUIPanel)._stack)); break; } CurrentCollectibleSortMode = mode; }
public void CallEvent(UIList ui, string funcName, Sprite[] images) { if (_uiDic.ContainsKey(ui)) { _uiDic[ui].SendMessage(funcName, images, SendMessageOptions.DontRequireReceiver); } }
protected virtual void InitTitleInfo(UIList titleList, EUICampType campType) { titleList.Add <GroupRecordInfo>(new GroupRecordViewData() { IsTitle = true, NeedShow = true }); }
public void CallEvent(UIList ui, string funcName, object obj = null) { if (_uiDic.ContainsKey(ui)) { _uiDic[ui].SendMessage(funcName, obj, SendMessageOptions.DontRequireReceiver); } }
public void SetActive(UIList ui, bool state) { if (_uiDic.ContainsKey(ui)) { _uiDic[ui].gameObject.SetActive(state); } }
//private UITextPanel<string> buttonOMF; public override void OnInitialize() { uIElement = new UIElement(); uIElement.Width.Set(0f, 0.8f); uIElement.MaxWidth.Set(600f, 0f); uIElement.Top.Set(220f, 0f); uIElement.Height.Set(-220f, 1f); uIElement.HAlign = 0.5f; uIPanel = new UIPanel(); uIPanel.Width.Set(0f, 1f); uIPanel.Height.Set(-110f, 1f); uIPanel.BackgroundColor = UICommon.MainPanelBackground; uIPanel.PaddingTop = 0f; uIElement.Append(uIPanel); modList = new UIList(); modList.Width.Set(-25f, 1f); modList.Height.Set(-50f, 1f); modList.Top.Set(50f, 0f); modList.ListPadding = 5f; uIPanel.Append(modList); UIScrollbar uIScrollbar = new UIScrollbar(); uIScrollbar.SetView(100f, 1000f); uIScrollbar.Height.Set(-50f, 1f); uIScrollbar.Top.Set(50f, 0f); uIScrollbar.HAlign = 1f; uIPanel.Append(uIScrollbar); modList.SetScrollbar(uIScrollbar); UITextPanel <string> uIHeaderTexTPanel = new UITextPanel <string>(Language.GetTextValue("tModLoader.ModsModsList"), 0.8f, true); uIHeaderTexTPanel.HAlign = 0.5f; uIHeaderTexTPanel.Top.Set(-35f, 0f); uIHeaderTexTPanel.SetPadding(15f); uIHeaderTexTPanel.BackgroundColor = UICommon.DefaultUIBlue; uIElement.Append(uIHeaderTexTPanel); buttonB = new UITextPanel <string>(Language.GetTextValue("UI.Back"), 1f, false); buttonB.Width.Set(-10f, 1f / 3f); buttonB.Height.Set(25f, 0f); buttonB.VAlign = 1f; buttonB.Top.Set(-20f, 0f); buttonB.WithFadedMouseOver(); buttonB.OnClick += BackClick; uIElement.Append(buttonB); //buttonOMF = new UITextPanel<string>(Language.GetTextValue("tModLoader.ModsOpenModsFolder"), 1f, false); //buttonOMF.CopyStyle(buttonB); //buttonOMF.HAlign = 0.5f; //buttonOMF.OnMouseOver += UICommon.FadedMouseOver; //buttonOMF.OnMouseOut += UICommon.FadedMouseOut; //buttonOMF.OnClick += OpenModsFolder; //uIElement.Append(buttonOMF); Append(uIElement); }
private void SetupList(UIList list, DealingCharacterItems dealingItems, List <UICharacterItem> uiList) { ItemSelectionManager.DeselectSelectedUI(); var filterItems = new List <CharacterItem>(); foreach (var dealingItem in dealingItems) { var characterItem = new CharacterItem(); characterItem.dataId = dealingItem.dataId; characterItem.level = dealingItem.level; characterItem.amount = dealingItem.amount; characterItem.durability = dealingItem.durability; filterItems.Add(characterItem); } uiList.Clear(); list.Generate(filterItems, (index, characterItem, ui) => { var uiCharacterItem = ui.GetComponent <UICharacterItem>(); uiCharacterItem.Setup(new CharacterItemTuple(characterItem, characterItem.level, string.Empty), null, -1); uiCharacterItem.Show(); uiList.Add(uiCharacterItem); }); ItemSelectionManager.Clear(); foreach (var tempDealingItemUI in tempDealingItemUIs) { ItemSelectionManager.Add(tempDealingItemUI); } foreach (var tempAnotherDealingItemUI in tempAnotherDealingItemUIs) { ItemSelectionManager.Add(tempAnotherDealingItemUI); } }
public static Rect ListScreenPos(UIList list) { Vector3 _position = GetPosition (list.ListAnchor); Vector3 _localPosition = GetlocalPosition (list.ListAnchor); Rect _rect = new Rect (0, _position.y, _position.x + 10, _localPosition.x); return _rect; }
// Changer de filtre/catégorie internal static void SelectPartCategory(bool dirScrolling, List<PartCategorizer.Category> categories, int index, UIList list) { if (QSettings.Instance.EnableWheelBlockTopEnd) { if (dirScrolling && index == 0) { return; } if (!dirScrolling && index == categories.Count - 1) { return; } } PartCategorizer.Category _category = (dirScrolling ? PrevCategory (categories, index) : NextCategory (categories, index)); UIRadioButton _btn = _category.button.activeButton; _btn.SetState (UIRadioButton.State.True, UIRadioButton.CallType.APPLICATION, null, true); //PartListTooltipsTWEAK (false); QuickScroll.Log ("SelectPartCategory " + (dirScrolling ? "Prev" : "Next"), "QCategory"); }