/// <summary>
        /// Represents a debug/release mode check.
        /// </summary>
        private void performDebugCheck()
        {
            // Written, 28.12.2018

#if DEBUG
            if (isReleaseVersion)
            {
                ModUI.ShowMessage("<color=orange>Warning</color>: Debug Configuration invaild. Was this intentional Tommo? (dev message)" +
                                  "\r\n" +
                                  "\r\nRelease version: " + isReleaseVersion +
                                  "\r\nDebug Config: True",
                                  "<color=orange>Warning</color>: <b>Incorrect Debug/Releaase Configuration</b>");
            }
#else
            if (!isReleaseVersion)
            {
                ModUI.ShowMessage("<color=orange>Warning</color>: Release Configuration invaild" +
                                  "\r\nWas this intentional Tommo? (dev message)" +
                                  "\r\n" +
                                  "\r\nRelease version: " + isReleaseVersion +
                                  "\r\nDebug Config: False",
                                  "<color=orange>Warning</color>: <b>Incorrect Release/Debug Configuration</b>");
            }
#endif
        }
        private void CheckForOldFiles()
        {
            int filesDeletedCounter = 0;

            if (File.Exists(old_dllFilePath))
            {
                filesDeletedCounter++; File.Delete(old_dllFilePath);
            }
            if (File.Exists(old_xmlFilePath))
            {
                filesDeletedCounter++; File.Delete(old_xmlFilePath);
            }
            if (File.Exists(old_assetsBundleFilePath))
            {
                filesDeletedCounter++; File.Delete(old_assetsBundleFilePath);
            }

            if (filesDeletedCounter > 0)
            {
                ModUI.ShowMessage(
                    $"Old api files have been deleted\n" +
                    $"{filesDeletedCounter} of {3} have been deleted\n" +
                    $"If you did an update before it is now finished", "ScrewablePartAPI Updater");
            }
        }
Beispiel #3
0
 public static void ResetPosition()
 {
     if (Application.loadedLevelName == "MainMenu")
     {
         ModUI.ShowMessage("Please use this when you are in game!", "Reset CD positions");
     }
     else
     {
         Quaternion e = Quaternion.Euler(new Vector3(0, 0, 0));
         foreach (GameObject go in GameObject.FindObjectsOfType <GameObject>())
         {
             if (go.activeSelf)
             {
                 if (go.name == "cd(item4)")
                 {
                     if (!go.GetComponent <CD>().inPlayer&& !go.GetComponent <CD>().inCase)
                     {
                         go.transform.position = new Vector3(-9.76f, 0.17f, 6.47f);
                         go.transform.rotation = e;
                     }
                 }
                 else if (go.name == "cd case(item4)")
                 {
                     go.transform.position = new Vector3(-9.76f, 0.17f, 6.47f);
                     go.transform.rotation = e;
                 }
                 else if (go.name == "CD Rack(item4)")
                 {
                     go.transform.position = new Vector3(-9.76f, 0.17f, 6.47f);
                     go.transform.rotation = e;
                 }
             }
         }
     }
 }
        /// <summary>
        /// Performs a check to see if the mod loader version is the same as the currently supported version.
        /// </summary>
        private void performModLoaderVersionCheck()
        {
            // Written, 03.08.2018

            // Modloader supported version check.
            if (SUPPORTED_MODLOADER_VERSION != ModLoader.MSCLoader_Ver)
            {
                if (!MoControlsSaveData.loadedSaveData.playerSeenMscLoaderVersionError)
                {
                    ModUI.ShowMessage(
                        String.Format("<b>[{0} <color=orange>v{1}]</color></b> - NOTE: modloader v{2} may not be <color=orange>compatible</color>.\r\nSupported " +
                                      "modloader version is <color=orange>v{3}</color>.",
                                      Name, Version, ModLoader.MSCLoader_Ver, SUPPORTED_MODLOADER_VERSION), "ModLoader Version not supported.");
                    MoControlsSaveData.loadedSaveData.playerSeenMscLoaderVersionError = true;
                    MoControlsSaveData.loadedSaveData.saveSettings();
                }
                print("<color=orange>Warning</color> <color=grey>Supported modloader version is <b>v" + SUPPORTED_MODLOADER_VERSION + "</b>; you're running version <b>" + ModLoader.MSCLoader_Ver + "</b>. May not be compatible with current version.</color>.", DebugTypeEnum.partial);
            }
            else
            {
                print("<color=grey>Running supported modloader version, <color=green>" + SUPPORTED_MODLOADER_VERSION + "</color></color>", DebugTypeEnum.full);
                if (MoControlsSaveData.loadedSaveData.playerSeenMscLoaderVersionError)
                {
                    MoControlsSaveData.loadedSaveData.playerSeenMscLoaderVersionError = false;
                    MoControlsSaveData.loadedSaveData.saveSettings();
                }
            }
        }
Beispiel #5
0
 public static void OpenOutputLog()
 {
     if (File.Exists(Application.dataPath + "/output_log.txt"))
     {
         Process.Start(Application.dataPath + "/output_log.txt");
     }
     else
     {
         ModUI.ShowMessage("File \"output_log.txt\" doesn't exist.", "MOP");
     }
 }
Beispiel #6
0
 public static void Open()
 {
     if (File.Exists(Directory.GetCurrentDirectory() + "/MOP_LOG.txt"))
     {
         Process.Start(Directory.GetCurrentDirectory() + "/MOP_LOG.txt");
     }
     else
     {
         ModUI.ShowMessage("No MOP log has been found, because no crash log has been generated yet.", "MOP");
     }
 }
Beispiel #7
0
 public void AddToCart(ShopItems item)
 {
     if (shoppingCart.ContainsKey(item))
     {
         if (item.details.multiplePurchases)
         {
             shoppingCart[item] += 1;
         }
         else
         {
             ModUI.ShowMessage("This item can be bought only once", "Information");
         }
     }
     else if (item.purchashed)
     {
         ModUI.ShowMessage("You already bought this item", "Information");
     }
     else
     {
         shoppingCart.Add(item, 1);
     }
     UpdateCart();
 }
        private void InstallVersion(string version, bool disableAutoUpdater = false)
        {
            if (ModLoader.GetCurrentScene() != CurrentScene.MainMenu)
            {
                ModUI.ShowMessage("Updating/Changing version is only supported in main menu.", "Update installation stopped");
                return;
            }
            if (disableAutoUpdater)
            {
                ignoreUpdatesSetting.Value = true;
            }

            try
            {
                using (var client = new WebClient())
                {
                    client.DownloadFile(GetUpdateDownloadUrl(version), GetVersionDownloadPath(version));
                }
            }
            catch
            {
                ModConsole.Error($"Error occurred while trying to download the update file for v{version}");
            }

            if (File.Exists(GetVersionDownloadPath(version)))
            {
                RenameFileToOld(dllFilePath, old_dllFilePath);
                RenameFileToOld(xmlFilePath, old_xmlFilePath);
                RenameFileToOld(assetsBundleFilePath, old_assetsBundleFilePath);
                ExtractNewFiles(version);
            }
            else
            {
                ModConsole.Error("Update file was downloaded but not found in the expected folder");
            }
            File.Delete(GetVersionDownloadPath(version));
        }
Beispiel #9
0
 private void FinishOrder()
 {
     if (shoppingCart.Count == 0)
     {
         ModUI.ShowMessage("Your shopping cart is empty", "Shopping cart");
     }
     else if (totalPrice > Math.Round(PlayMakerGlobals.Instance.Variables.FindFsmFloat("PlayerMoney").Value, 1))
     {
         ModUI.ShowMessage("You are too poor for this order!", "Poor man");
     }
     else
     {
         foreach (var cartItems in shoppingCart)
         {
             PurchaseInfo pi = new PurchaseInfo
             {
                 gameObject = cartItems.Key.gameObject,
                 qty        = cartItems.Value
             };
             cartItems.Key.action(pi);
             cartItems.Key.purchashed = true;
         }
         shoppingCart.Clear();
         PlayMakerGlobals.Instance.Variables.FindFsmFloat("PlayerMoney").Value -= totalPrice;
         UpdateCart();
         HideCatalog();
         if (!fleetariLast)
         {
             teimoCashSound.Play();
         }
         else
         {
             fleetariCashSound.Play();
         }
     }
 }
Beispiel #10
0
 public static void ResetPosition()
 {
     if (Application.loadedLevelName == "MainMenu")
     {
         ModUI.ShowMessage("Please use this when you are in game!", "Reset CD positions");
     }
     else
     {
         for (int i = 0; i < listOfCases.Count; i++)
         {
             if (!listOfCases[i].activeSelf)
             {
                 continue;
             }
             listOfCases[i].transform.position         = new Vector3(-10f, 0.16f, 6.28f);
             listOfCases[i].transform.localEulerAngles = Vector3.zero;
         }
         for (int i = 0; i < listOfCDs.Count; i++)
         {
             if (!listOfCDs[i].activeSelf)
             {
                 continue;
             }
             if (!listOfCDs[i].GetComponent <CD>().inPlayer&& !listOfCDs[i].GetComponent <CD>().inCase)
             {
                 listOfCDs[i].transform.position         = new Vector3(-10.1f, 0.16f, 6.28f);
                 listOfCDs[i].transform.localEulerAngles = Vector3.zero;
             }
         }
         if (rack10.activeSelf)
         {
             rack10.transform.position = new Vector3(-10.2f, 0.17f, 6.47f);
             rack10.transform.transform.localEulerAngles = Vector3.zero;
         }
     }
 }