Example #1
0
        public override void Update(GameTime gameTime)
        {
            if (Main.player[Main.myPlayer].GetModPlayer <ResearchPlayer>().destroyingItem != realItem)
            {
                realItem = item = Main.player[Main.myPlayer].GetModPlayer <ResearchPlayer>().destroyingItem;
            }
            ResearchUI ui = ((ResearchFrom14)ModLoader.GetMod("ResearchFrom14")).ui;

            if (realItem == null || realItem.IsAir)
            {
                ui.totalText.SetText("");
            }
            else
            {
                int totalR = ResearchTable.GetTotalResearch(realItem);
                if (totalR > 0)
                {
                    ui.totalText.TextColor = Color.White;
                    ui.totalText.SetText("" + Math.Min(Main.player[Main.myPlayer].GetModPlayer <ResearchPlayer>().GetResearchedAmount(realItem), totalR) + "/" + totalR);
                }
                else
                {
                    ui.totalText.TextColor = Color.Red;
                    ui.totalText.SetText("Unresearchable!");
                }
            }

            base.Update(gameTime);
        }
 static void Postfix(ResearchUI __instance)
 {
     if (updateUI)
     {
         ResearchUIUpdater.UpdateUI(__instance.optionContainer.gameObject);
         ResearchUIUpdater.UpdateContentSize(__instance.optionContainer.gameObject);
         MethodInfo localizationManagerOnOnLocalizeEventInfo = typeof(ResearchUI).GetMethod("LocalizationManagerOnOnLocalizeEvent", BindingFlags.NonPublic | BindingFlags.Instance);
         localizationManagerOnOnLocalizeEventInfo.Invoke(__instance, null);
         updateUI = false;
     }
 }
Example #3
0
 static void Postfix(ResearchUI __instance)
 {
     if (updateUI)
     {
         MethodInfo addOptionInfo = typeof(ResearchUI).GetMethod("AddOption", BindingFlags.NonPublic | BindingFlags.Instance);
         foreach (GreatLibrary.ResearchDef researchDef in researchDefs)
         {
             addOptionInfo.Invoke(__instance, new object[] { researchDef.upgrade });
         }
         updateUI = false;
     }
 }
Example #4
0
                static void Postfix(ResearchUI __instance)
                {
                    FieldInfo   optionMapInfo       = typeof(ResearchUI).GetField("optionMap", BindingFlags.NonPublic | BindingFlags.Instance);
                    IDictionary optionMapDictionary = (IDictionary)optionMapInfo.GetValue(__instance);

                    foreach (object upgradeTypeObject in optionMapDictionary.Keys)
                    {
                        Player.UpgradeType upgradeType     = (Player.UpgradeType)upgradeTypeObject;
                        Transform          optionTransform = (Transform)optionMapDictionary[upgradeTypeObject];
                        researchTranslation = optionTransform.GetChild(0).GetComponent <TMPro.TextMeshProUGUI>().text;
                        OnGetResearchTranslation.Invoke(upgradeType);
                        optionTransform.GetChild(0).GetComponent <TMPro.TextMeshProUGUI>().text = researchTranslation;
                    }
                }
        public override void Load()
        {
            try
            {
                Instance = this;

                TagSerializer.AddSerializer(new WireSerializer());
                TagSerializer.AddSerializer(new HeatPipeSerializer());

                //Main.OnPreDraw += PreDraw;
                //Main.OnPostDraw += PostDraw;

                if (!Main.dedServ)
                {
                    wireTexture     = ModLoader.GetTexture("DawnOfIndustryCore/Textures/Tiles/BasicWire");
                    heatPipeTexture = ModLoader.GetTexture("DawnOfIndustryCore/Textures/Tiles/HeatPipe");

                    inTexture      = ModLoader.GetTexture("DawnOfIndustryCore/Textures/Tiles/ConnectionIn");
                    outTexture     = ModLoader.GetTexture("DawnOfIndustryCore/Textures/Tiles/ConnectionOut");
                    bothTexture    = ModLoader.GetTexture("DawnOfIndustryCore/Textures/Tiles/ConnectionBoth");
                    blockedTexture = ModLoader.GetTexture("DawnOfIndustryCore/Textures/Tiles/ConnectionBlocked");

                    textureBlueprint = ModLoader.GetTexture(UIPath + "Blueprint");
                    lightningCap     = ModLoader.GetTexture(TexturePath + "LightningCap");
                    lightningSegment = ModLoader.GetTexture(TexturePath + "LightningSegment");

                    ResearchUI = new ResearchUI();
                    ResearchUI.Activate();
                    IResearchUI = new UserInterface();
                    IResearchUI.SetState(ResearchUI);

                    try
                    {
                        Platform.Current.SetWindowUnicodeTitle(Main.instance.Window, "Terraria: Dawn of Industry");
                    }
                    catch (Exception ex)
                    {
                        this.Log($"Failed to change title:\n{ex}");
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLogger.Log(ex);
            }
        }
Example #6
0
 public override void Load()
 {
     base.Load();
     ResearchTable.ClearTable();
     invalidSetDefaults.Clear();
     if (!Main.dedServ)
     {
         purchaseUI = new UserInterface();
         ui         = new ResearchUI();
         ui.Activate();
         purchaseUI.SetState(ui);
         hotkey   = RegisterHotKey("Open or Close ResearchUI", "Add");
         prefixUI = new UserInterface();
         preUI    = new PrefixUI();
         preUI.Activate();
         prefixUI.SetState(preUI);
         preHotkey = RegisterHotKey("Open or Close Prefix Assignment", "Subtract");
     }
 }