public override void OnInitialize()
        {
            ManualGeneratorMenu.SetDims(ruleElements, -200, 0.5f, 0, 0.1f, 400, 0, 0, 0.8f);
            ManualGeneratorMenu.SetDims(scrollBar, 232, 0.5f, 0, 0.1f, 32, 0, 0, 0.8f);
            ruleElements.SetScrollbar(scrollBar);
            Append(ruleElements);
            Append(scrollBar);

            ManualGeneratorMenu.SetDims(NewGuaranteed, -200, 0.5f, -50, 0.1f, 32, 0, 32, 0);
            NewGuaranteed.OnClick += (n, m) => ruleElements.Add(new GuaranteedRuleElement());
            Append(NewGuaranteed);

            ManualGeneratorMenu.SetDims(NewChance, -160, 0.5f, -50, 0.1f, 32, 0, 32, 0);
            NewChance.OnClick += (n, m) => ruleElements.Add(new ChanceRuleElement());
            Append(NewChance);

            ManualGeneratorMenu.SetDims(NewPool, -120, 0.5f, -50, 0.1f, 32, 0, 32, 0);
            NewPool.OnClick += (n, m) => ruleElements.Add(new PoolRuleElement());
            Append(NewPool);

            ManualGeneratorMenu.SetDims(NewPoolChance, -80, 0.5f, -50, 0.1f, 32, 0, 32, 0);
            NewPoolChance.OnClick += (n, m) => ruleElements.Add(new PoolChanceRuleElement());
            Append(NewPoolChance);

            ManualGeneratorMenu.SetDims(closeButton, 200 - 32, 0.5f, -50, 0.1f, 32, 0, 32, 0);
            closeButton.OnClick += (n, m) => Visible = false;
            Append(closeButton);
        }
Ejemplo n.º 2
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            if (!updateNeeded)
            {
                return;
            }

            updateNeeded = false;
            if (!loading)
            {
                uIPanel.RemoveChild(uILoader);
            }

            filter = filterTextBox.currentString;
            modList.Clear();
            modList.AddRange(items.Where(item => item.PassFilters()));
            bool hasNoModsFoundNotif = modList.HasChild(uINoModsFoundText);

            if (modList.Count <= 0 && !hasNoModsFoundNotif)
            {
                modList.Add(uINoModsFoundText);
            }
            else if (hasNoModsFoundNotif)
            {
                modList.RemoveChild(uINoModsFoundText);
            }

            uIElement.RemoveChild(updateAllButton);
            if (SpecialModPackFilter == null && items.Count(x => x.update && !x.updateIsDowngrade) > 0)
            {
                uIElement.Append(updateAllButton);
            }
        }
Ejemplo n.º 3
0
        public override void OnActivate()
        {
            scrollPanel.Append(uiLoader);
            modPacks.Clear();
            Task.Factory
            .StartNew(delegate {
                mods = ModOrganizer.FindMods().Select(m => m.Name).ToArray();

                Directory.CreateDirectory(ModPacksDirectory);
                return(Directory.GetFiles(ModPacksDirectory, "*.json", SearchOption.TopDirectoryOnly));
            })
            .ContinueWith(task => {
                foreach (string modPackPath in task.Result)
                {
                    try {
                        if (!IsValidModpackName(Path.GetFileNameWithoutExtension(modPackPath)))
                        {
                            throw new Exception();
                        }
                        string[] modPackMods = JsonConvert.DeserializeObject <string[]>(File.ReadAllText(modPackPath));
                        modPacks.Add(new UIModPackItem(Path.GetFileNameWithoutExtension(modPackPath), modPackMods));
                    }
                    catch {
                        var badModPackMessage = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModPackMalformed", Path.GetFileName(modPackPath)))
                        {
                            Width  = { Percent = 1 },
                            Height = { Pixels = 50, Percent = 0 }
                        };
                        modPacks.Add(badModPackMessage);
                    }
                }
                scrollPanel.RemoveChild(uiLoader);
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
Ejemplo n.º 4
0
        private void OnItemChanged(Item item)
        {
            _infoList.Clear();

            // Check if there's a material with the item type as a valid item
            if (!TerrarianWeaponry.Instance.RegisteredMaterials.TryGetValue(item.type, out BaseMaterial material))
            {
                return;
            }

            // Create a new empty item info
            ItemInfo itemInfo = new ItemInfo();

            if (material.Modifier != null)
            {
                _infoList.Add(new UIText($"Modifier: {material.Modifier}"));
            }

            // Modify the stats of the item info, with a default modifier
            material.ModifyStats(ref itemInfo, 1f);

            // Get all modified fields and make a new UIText for them
            foreach (string modifiedField in itemInfo.GetModifiedFields())
            {
                _infoList.Add(new UIText(modifiedField));
            }
        }
        //These handle adding/removing the elements and items from the appropriate lists, as well as re-sizing the element.
        public void AddItem(Item item)
        {
            var loot = rule.AddItem(item);

            var element = new LootElement(loot, rule.UsesWeight);

            lootElements.Add(element);
            lootElements.Height.Set(lootElements.Height.Pixels + element.Height.Pixels + 4, 0);
            Height.Set(Height.Pixels + element.Height.Pixels + 4, 0);
        }
Ejemplo n.º 6
0
 protected override void InitTitleInfo(UIList titleList, EUICampType campType)
 {
     titleList.Add <BlastRecordInfo>(new GroupRecordViewData()
     {
         CanResque = _adapter.CanRescue, IsTitle = true, NeedShow = true, CampType = campType
     });
 }
Ejemplo n.º 7
0
        private void AddSortOption(string title, MouseEvent onclick)
        {
            var option = new UITextOption(title);

            option.OnClick += onclick;
            list.Add(option);
        }
Ejemplo n.º 8
0
 /// <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 SelectableText SelectOptionProp(string selfValueHeaderDictText)
        {
            self.value       = selfValueHeaderDictText;
            selList.elemNum += 1;

            float         loc        = selList.loc - 1f / (1f + selList.elemNum);
            UITextPhrase  textHead   = new UITextPhrase(loc, self.value);
            List <string> newEntries = opdict[self.value].ToList();

            newEntries.Add(OptionsDict.SelectableList.removeTag);
            SelectableText selTex = new SelectableText(textHead, infoPanel, selList, self.value, newEntries, false);

            uilist.Add(textHead);
            thisAsSel        = new Selectable(selTex);
            selTex.thisAsSel = thisAsSel;

            infoPanel.selectables.Add(thisAsSel);
            targetUIdesc.ClearCurrent();

            if (newEntries.Count > 1)
            {
                if (selList.which.Equals(OptionsDict.Phase2.positive) || selList.which.Equals(OptionsDict.Phase3.positive))
                {
                    thisAsSel.SetValue(newEntries[1]);
                }
                else if (selList.which.Equals(OptionsDict.Phase2.negative) || selList.which.Equals(OptionsDict.Phase3.negative))
                {
                    thisAsSel.SetValue(newEntries[Math.Max(0, (newEntries.Count - 1) * 3 / 4 - 1)]);
                }
            }


            return(selTex);
        }
Ejemplo n.º 10
0
        internal void UpdateItemsList()
        {
            if (!updateNeededItems)
            {
                return;
            }
            updateNeededItems = false;

            lootItemsList.Clear();

            float total = 0;

            foreach (var spawn in LootTool.loots)
            {
                total += spawn.Value;
            }
            money.coins = 0;
            if (total > 0)
            {
                foreach (var spawn in LootTool.loots)
                {
                    if (spawn.Key == ItemID.CopperCoin)
                    {
                        money.coins = (int)(spawn.Value / (float)LootTool.NumberLootExperiments);
                        continue;
                    }
                    UILootInfo lootInfo = new UILootInfo(spawn.Key, spawn.Value / (float)LootTool.NumberLootExperiments);
                    lootItemsList.Add(lootInfo);
                }
            }
        }
Ejemplo n.º 11
0
 public static void AddRange(this UIList list, IEnumerable <UIElement> range)
 {
     foreach (var it in range)
     {
         list.Add(it);
     }
 }
Ejemplo n.º 12
0
 private void TryAddingList(LocalizedText title, ref int currentGroupIndex, int maxEmotesPerRow, List <int> emoteIds)
 {
     if (emoteIds != null && emoteIds.Count != 0)
     {
         _list.Add(new EmotesGroupListItem(title, currentGroupIndex++, maxEmotesPerRow, emoteIds.ToArray()));
     }
 }
Ejemplo n.º 13
0
        private void CaluculateButton_OnClick(UIMouseEvent evt, UIElement listeningElement)
        {
            Main.NewText("Calculating....");

            SpawnTool.CalculateSpawns();

            checklistList.Clear();

            float total = 0;

            foreach (var spawn in SpawnTool.spawns)
            {
                total += spawn.Value;
            }

            if (total > 0)
            {
                foreach (var spawn in SpawnTool.spawns)
                {
                    UINPCSpawnInfo spawnInfo = new UINPCSpawnInfo(spawn.Key, spawn.Value / total);
                    checklistList.Add(spawnInfo);
                }
            }

            Main.NewText($"spawnRate: {SpawnTool.spawnRate}");
            Main.NewText($"maxSpawns: {SpawnTool.maxSpawns}");
            //Main.NewText($"activeNPCs: {Main.LocalPlayer.activeNPCs}");
        }
Ejemplo n.º 14
0
        public override void OnActivate()
        {
            _myPublishedMods.Clear();
            string text = Language.GetTextValue("tModLoader.MenuModBrowser") + " " + Language.GetTextValue("tModLoader.MBOfflineWithReason", Language.GetTextValue("tModLoader.MBUnknown"));

            TextPanel.SetText(text, 0.8f, true);
            string response = string.Empty;

            try {
                ServicePointManager.Expect100Continue = false;
                string url    = "http://javid.ddns.net/tModLoader/listmymods.php";
                var    values = new NameValueCollection
                {
                    { "steamid64", ModLoader.SteamID64 },
                    { "modloaderversion", BuildInfo.versionedName },
                    { "passphrase", ModLoader.modBrowserPassphrase },
                };
                byte[] result = IO.UploadFile.UploadFiles(url, null, values);
                response = Encoding.UTF8.GetString(result);
            }
            catch (WebException e) {
                if (e.Status == WebExceptionStatus.Timeout)
                {
                    TextPanel.SetText(Language.GetTextValue("tModLoader.MenuModBrowser") + " " + Language.GetTextValue("tModLoader.MBOfflineWithReason", Language.GetTextValue("tModLoader.MBBusy")), 0.8f, true);
                    return;
                }
                TextPanel.SetText(Language.GetTextValue("tModLoader.MenuModBrowser") + " " + Language.GetTextValue("tModLoader.MBOfflineWithReason", ""), 0.8f, true);
                return;
            }
            catch (Exception e) {
                UIModBrowser.LogModBrowserException(e);
                return;
            }
            try {
                JArray a;
                try {
                    a = JArray.Parse(response);
                }
                catch (Exception e) {
                    throw new Exception($"Manage Published Error Response: {response}", e);
                }

                foreach (JObject o in a.Children <JObject>())
                {
                    var modItem = new UIModManageItem(
                        (string)o["displayname"],
                        (string)o["name"],
                        (string)o["version"],
                        (string)o["author"],
                        (int)o["downloads"],
                        (int)o["downloadsversion"],
                        (string)o["modloaderversion"]
                        );
                    _myPublishedMods.Add(modItem);
                }
            }
            catch (Exception e) {
                UIModBrowser.LogModBrowserException(e);
            }
        }
Ejemplo n.º 15
0
        /*public bool ThoriumModDownedScout
         * {
         *      get { return ThoriumMod.ThoriumWorld.downedScout; }
         * }
         * public bool CalamityDS => CalamityMod.CalamityWorld.downedDesertScourge;*/

        internal void UpdateCheckboxes()
        {
            checklistList.Clear();

            foreach (BossInfo boss in BossChecklist.bossTracker.allBosses)
            {
                boss.hidden = BossChecklistWorld.HiddenBosses.Contains(boss.name);
                if (boss.available() && (!boss.hidden || showHidden))
                {
                    if (showCompleted || !boss.downed())
                    {
                        if (boss.type == BossChecklistType.Event && !showEvent)
                        {
                            continue;
                        }
                        if (boss.type == BossChecklistType.MiniBoss && !showMiniBoss)
                        {
                            continue;
                        }
                        UIBossCheckbox box = new UIBossCheckbox(boss);
                        checklistList.Add(box);
                    }
                }
            }

            //if (BossChecklist.instance.thoriumLoaded)
            //{
            //	if (ThoriumModDownedScout)
            //	{
            //		// Add items here
            //	}
            //}
        }
Ejemplo n.º 16
0
        internal void LoadList()
        {
            Clear();

            var path = Localizer.downloadMgr.GetCacheFilePath("index.json");

            if (!File.Exists(path))
            {
                return;
            }

            using (var fs = new FileStream(path, FileMode.Open))
            {
                using (var sr = new StreamReader(fs))
                {
                    var index = JsonConvert.DeserializeObject <Index>(sr.ReadToEnd());

                    foreach (var item in index.Items)
                    {
                        var browserItem = new UIBrowserItem(item);
                        if (browserItem.item != null)
                        {
                            textList.Add(browserItem);
                        }
                    }
                }
            }
        }
Ejemplo n.º 17
0
        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;
            }
        }
Ejemplo n.º 18
0
 protected virtual void InitTitleInfo(UIList titleList, EUICampType campType)
 {
     titleList.Add <GroupRecordInfo>(new GroupRecordViewData()
     {
         IsTitle = true, NeedShow = true
     });
 }
Ejemplo n.º 19
0
        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);
        }
Ejemplo n.º 20
0
        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);
        }
Ejemplo n.º 21
0
        private void UpdateInfo(BasePart part)
        {
            _selectedPart = part;

            if (part == null)
            {
                // If the part is null, use an empty texture
                var texture = new Texture2D(Main.instance.GraphicsDevice, 1, 1);
                _partInfoImage.SetImage(texture);
                // Calculate the scale so that it fits inside the top 20 pixels
                _partInfoImage.ImageScale = 20f / texture.Height;

                // Clear the name and description
                _partInfoName.SetText("");
                _partInfoDescription.Clear();

                return;
            }

            // Get the texture of the first valid material
            TextureInfo textureInfo = part.ValidMaterials.First().textureInfo;
            Texture2D   realTexture = TerrarianWeaponry.Instance.GetTexture(textureInfo.Texture);

            _partInfoImage.SetImage(realTexture);
            // Calculate the scale so that it fits inside the top 20 pixels
            _partInfoImage.ImageScale = 20f / realTexture.Height;
            _partInfoImage.Left       = new StyleDimension(0, 0);
            _partInfoImage.Top        = realTexture.Height > 20
                                ? new StyleDimension(0, 0)
                                : new StyleDimension(5, 0);

            // Set the tool name
            _partInfoName.SetText(part.PartName);

            // Set the description
            _partInfoDescription.Clear();

            // Add a line that shows the cost of the part
            _partInfoDescription.Add(new UIText($"Cost: {part.MaterialCost}"));

            var wrappedText = MiscUtils.WrapText(part.Description);

            foreach (string text in wrappedText)
            {
                _partInfoDescription.Add(new UIText(text));
            }
        }
Ejemplo n.º 22
0
        public override void OnActivate()
        {
            scrollPanel.Append(uiLoader);
            modListList.Clear();
            if (SynchronizationContext.Current == null)
            {
                SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());
            }
            Task.Factory
            .StartNew(delegate
            {
                mods = ModOrganizer.FindMods().Select(m => m.Name).ToArray();
                return(FindModLists());
            })
            .ContinueWith(task =>
            {
                string[] modListsFullPath = task.Result;
                foreach (string modListFilePath in modListsFullPath)
                {
                    try
                    {
                        string[] mods = { };
                        //string path = ModListSaveDirectory + Path.DirectorySeparatorChar + modListFilePath + ".json";

                        if (File.Exists(modListFilePath))
                        {
                            using (StreamReader r = new StreamReader(modListFilePath))
                            {
                                string json = r.ReadToEnd();

                                mods = JsonConvert.DeserializeObject <string[]>(json);
                            }
                        }
                        UIModPackItem modItem = new UIModPackItem(Path.GetFileNameWithoutExtension(modListFilePath), mods);
                        modListList.Add(modItem);
                    }
                    catch
                    {
                        UIAutoScaleTextTextPanel <string> badModPackMessage = new UIAutoScaleTextTextPanel <string>(Language.GetTextValue("tModLoader.ModPackMalformed", Path.GetFileName(modListFilePath)));
                        badModPackMessage.Width.Set(0, 1);
                        badModPackMessage.Height.Set(50, 0);
                        modListList.Add(badModPackMessage);
                    }
                }
                scrollPanel.RemoveChild(uiLoader);
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
Ejemplo n.º 23
0
        public override void OnActivate()
        {
            myPublishedMods.Clear();
            uITextPanel.SetText("My Published Mods", 0.8f, true);
            string response = "";

            try
            {
                System.Net.ServicePointManager.Expect100Continue = false;
                string          url    = "http://javid.ddns.net/tModLoader/listmymods.php";
                IO.UploadFile[] files  = new IO.UploadFile[0];
                var             values = new NameValueCollection
                {
                    { "steamid64", ModLoader.SteamID64 },
                    { "modloaderversion", ModLoader.versionedName },
                    { "passphrase", ModLoader.modBrowserPassphrase },
                };
                byte[] result = IO.UploadFile.UploadFiles(url, files, values);
                response = System.Text.Encoding.UTF8.GetString(result);
            }
            catch (WebException e)
            {
                if (e.Status == WebExceptionStatus.Timeout)
                {
                    uITextPanel.SetText("Mod Browser OFFLINE (Busy)", 0.8f, true);
                    return;
                }
                uITextPanel.SetText("Mod Browser OFFLINE.", 0.8f, true);
                return;
            }
            catch (Exception e)
            {
                ErrorLogger.LogModBrowserException(e);
                return;
            }
            try
            {
                JArray a = JArray.Parse(response);

                foreach (JObject o in a.Children <JObject>())
                {
                    UIModManageItem modItem = new UIModManageItem(
                        (string)o["displayname"],
                        (string)o["name"],
                        (string)o["version"],
                        (string)o["author"],
                        (string)o["downloads"],
                        (string)o["downloadsversion"],
                        (string)o["modloaderversion"]
                        );
                    myPublishedMods.Add(modItem);
                }
            }
            catch (Exception e)
            {
                ErrorLogger.LogModBrowserException(e);
                return;
            }
        }
Ejemplo n.º 24
0
        private void OnItemChanged()
        {
            reforgeList.Clear();
            if (reforgeSlot.item.IsAir)
            {
                return;
            }

            Item controlItem = reforgeSlot.item.Clone();

            if (!ItemLoader.PreReforge(controlItem))
            {
                return;
            }
            controlItem.netDefaults(reforgeSlot.item.netID);
            controlItem = controlItem.CloneWithModdedDataFrom(reforgeSlot.item);

            UIReforgeLabel reforgeLabel;
            List <byte>    tempSelected = new List <byte>();
            bool           isArmor      = false;

            for (byte i = 1; i < ModPrefix.PrefixCount; i++)
            {
                Item tempItem = controlItem.Clone();

                isArmor = ModCompat.ArmorPrefix(tempItem);
                if (isArmor && !tempItem.accessory)
                {
                    tempItem.accessory = true;
                }

                if (!tempItem.CanApplyPrefix(i))
                {
                    continue;
                }

                tempItem.Prefix(i);
                if (isArmor)
                {
                    ModCompat.ApplyArmorPrefix(tempItem, i);
                }

                if (tempItem.prefix != i)
                {
                    continue;
                }

                reforgeLabel              = new UIReforgeLabel(tempItem);
                reforgeLabel.OnMouseDown += ChoseReforge;
                reforgeLabel.SetPadding(10);
                if (selectedPrefixes.Contains(i))
                {
                    reforgeLabel.selected = true;
                    tempSelected.Add(i);
                }
                reforgeList.Add(reforgeLabel);
            }
            selectedPrefixes = tempSelected;
        }
Ejemplo n.º 25
0
 public void LoadModList()
 {
     foreach (var mod in ModLoader.LoadedMods)
     {
         var modBox = new UITextPanel <string>(mod.Name);
         modList.Add(modBox);
     }
 }
Ejemplo n.º 26
0
 internal void AddQuestButton(UIElement element, float offY)
 {
     element.Left.Set(0, 0);
     element.Top.Set(offY, 0);
     element.Width.Set(186, 0);
     element.Height.Set(28, 0);
     quests.Add(element);
 }
Ejemplo n.º 27
0
 internal void AddEntryButton(UIElement element, float offY)
 {
     element.Left.Set(0, 0);
     element.Top.Set(offY, 0);
     element.Width.Set(120, 0);
     element.Height.Set(28, 0);
     ClickableEntries.Add(element);
 }
Ejemplo n.º 28
0
 public void Add(UIElement ui)
 {
     if (_uiList == null)
     {
         _uiList = new UIList <UIElement>();
     }
     _uiList.Add(this, ui);
 }
Ejemplo n.º 29
0
        public override void OnActivate()
        {
            myPublishedMods.Clear();
            uITextPanel.SetText("My Published Mods", 0.8f, true);
            String xmlText = "";

            try
            {
                System.Net.ServicePointManager.Expect100Continue = false;
                string          url    = "http://javid.ddns.net/tModLoader/listmymods.php";
                IO.UploadFile[] files  = new IO.UploadFile[0];
                var             values = new NameValueCollection
                {
                    { "steamid64", Steamworks.SteamUser.GetSteamID().ToString() },
                    { "modloaderversion", ModLoader.versionedName },
                    { "passphrase", ModLoader.modBrowserPassphrase },
                };
                byte[] result = IO.UploadFile.UploadFiles(url, files, values);
                xmlText = System.Text.Encoding.UTF8.GetString(result, 0, result.Length);
            }
            catch (WebException e)
            {
                if (e.Status == WebExceptionStatus.Timeout)
                {
                    uITextPanel.SetText("Mod Browser OFFLINE (Busy)", 0.8f, true);
                    return;
                }
                uITextPanel.SetText("Mod Browser OFFLINE.", 0.8f, true);
                return;
            }
            catch (Exception e)
            {
                ErrorLogger.LogModBrowserException(e);
                return;
            }
            try
            {
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.LoadXml(xmlText);
                foreach (XmlNode xmlNode in xmlDoc.DocumentElement)
                {
                    string          displayname      = xmlNode.SelectSingleNode("displayname").InnerText;
                    string          name             = xmlNode.SelectSingleNode("name").InnerText;
                    string          version          = xmlNode.SelectSingleNode("version").InnerText;
                    string          author           = xmlNode.SelectSingleNode("author").InnerText;
                    string          downloads        = xmlNode.SelectSingleNode("downloads").InnerText;
                    string          downloadsversion = xmlNode.SelectSingleNode("downloadsversion").InnerText;
                    string          modloaderversion = xmlNode.SelectSingleNode("modloaderversion").InnerText;
                    UIModManageItem modItem          = new UIModManageItem(displayname, name, version, author, downloads, downloadsversion, modloaderversion);
                    myPublishedMods.Add(modItem);
                }
            }
            catch (Exception e)
            {
                ErrorLogger.LogModBrowserException(e);
                return;
            }
        }
Ejemplo n.º 30
0
        public void PopulateList()
        {
            var imprint = new InfusionRecipieEntry(ItemType <AstralImprint>());

            imprint.Width.Set(100, 0);
            imprint.Height.Set(32, 0);
            imprint.Left.Set(12, 0);
            options.Add(imprint);
        }