Example #1
0
        public static bool Prefix(ref string filename)
        {
            if (filename.Contains("custommachines"))
            {
                filename = $"{DSPAdvancedMiner.vertaFolder}/{filename}";

                DSPAdvancedMiner.logDebug("Loading my verta file " + filename);
            }

            return(true);
        }
Example #2
0
        public static void Postfix(ItemProto[,] ___protos)
        {
            DSPAdvancedMiner.logDebug("Patching UIBuildMenu");

            foreach (var kv in DSPAdvancedMiner.items)
            {
                int buildIndex = kv.Value.BuildIndex;
                if (buildIndex > 0)
                {
                    int num  = buildIndex / 100;
                    int num2 = buildIndex % 100;
                    if (num <= 12 && num2 <= 12)
                    {
                        ___protos[num, num2] = kv.Value;
                    }
                }
            }
        }
Example #3
0
        public static bool Prefix(ref string path, Type systemTypeInstance, ref UnityEngine.Object __result)
        {
            if (path.Contains("custommachines"))
            {
                DSPAdvancedMiner.logDebug("Loading my asset " + path);
                if (DSPAdvancedMiner.bundle.Contains(path + ".prefab") && systemTypeInstance == typeof(GameObject))
                {
                    Material[]         mats     = DSPAdvancedMiner.modelMats[path];
                    UnityEngine.Object myPrefab = DSPAdvancedMiner.bundle.LoadAsset(path + ".prefab");
                    if (myPrefab != null)
                    {
                        MeshRenderer[] renderers = ((GameObject)myPrefab).GetComponentsInChildren <MeshRenderer>();
                        foreach (MeshRenderer renderer in renderers)
                        {
                            Material[] newMats = new Material[renderer.sharedMaterials.Length];
                            for (int i = 0; i < newMats.Length; i++)
                            {
                                newMats[i] = mats[i];
                            }

                            renderer.sharedMaterials = newMats;
                        }
                    }

                    __result = myPrefab;
                    return(false);
                }

                if (DSPAdvancedMiner.bundle.Contains(path + ".png"))
                {
                    UnityEngine.Object mySprite = DSPAdvancedMiner.bundle.LoadAsset(path + ".png", systemTypeInstance);
                    __result = mySprite;
                    return(false);
                }
            }

            return(true);
        }