Пример #1
0
        public static void AddTextures()
        {
            var textureMapping = new ItemTypesServer.TextureMapping(new JSONNode());

            textureMapping.AlbedoPath = GameLoader.TEXTURE_FOLDER_PANDA + "/albedo/MachinistBenchTop.png";
            textureMapping.NormalPath = GameLoader.TEXTURE_FOLDER_PANDA + "/normal/MachinistBenchTop.png";
            textureMapping.HeightPath = GameLoader.TEXTURE_FOLDER_PANDA + "/height/MachinistBenchTop.png";

            ItemTypesServer.SetTextureMapping(GameLoader.NAMESPACE + "MachinistBenchTop", textureMapping);
        }
Пример #2
0
        public static void AddTextures()
        {
            var textureMapping = new ItemTypesServer.TextureMapping(new JSONNode());

            textureMapping.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "AdvancedCraftingTableTop.png";
            textureMapping.NormalPath = GameLoader.BLOCKS_NORMAL_PATH + "AdvancedCraftingTableTop.png";
            textureMapping.HeightPath = GameLoader.BLOCKS_HEIGHT_PATH + "AdvancedCraftingTableTop.png";

            ItemTypesServer.SetTextureMapping(GameLoader.NAMESPACE + "AdvancedCraftingTableTop", textureMapping);
        }
Пример #3
0
        public static void AddCarpetTextures(string key)
        {
            var textureMapping = new ItemTypesServer.TextureMapping(new JSONNode());

            textureMapping.AlbedoPath   = GameLoader.BLOCKS_ALBEDO_PATH + key + ".png";
            textureMapping.NormalPath   = "gamedata/textures/materials/blocks/normal/carpet.png";
            textureMapping.EmissivePath = "gamedata/textures/materials/blocks/emissiveMaskAlpha/neutral.png";
            textureMapping.HeightPath   = "gamedata/textures/materials/blocks/heightSmoothnessSpecularity/carpet.png";

            ItemTypesServer.SetTextureMapping(GameLoader.NAMESPACE + "." + key, textureMapping);
        }
Пример #4
0
        public static void AddTextures()
        {
            var GateLeverTextureMapping = new ItemTypesServer.TextureMapping(new JSONNode());

            GateLeverTextureMapping.AlbedoPath = GameLoader.TEXTURE_FOLDER_PANDA + "/albedo/Lever.png";

            ItemTypesServer.SetTextureMapping(GameLoader.NAMESPACE + ".GateLever", GateLeverTextureMapping);

            var GateTextureMapping = new ItemTypesServer.TextureMapping(new JSONNode());

            GateTextureMapping.AlbedoPath = GameLoader.TEXTURE_FOLDER_PANDA + "/albedo/gate.png";

            ItemTypesServer.SetTextureMapping(GameLoader.NAMESPACE + ".Gate", GateTextureMapping);
        }
Пример #5
0
        public static void AddTextures()
        {
            var GateLeverTextureMapping = new ItemTypesServer.TextureMapping(new JSONNode());

            GateLeverTextureMapping.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "Lever.png";

            ItemTypesServer.SetTextureMapping(GameLoader.NAMESPACE + ".GateLever", GateLeverTextureMapping);

            var GateTextureMapping = new ItemTypesServer.TextureMapping(new JSONNode());

            GateTextureMapping.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "gate.png";

            ItemTypesServer.SetTextureMapping(GameLoader.NAMESPACE + ".Gate", GateTextureMapping);
        }
Пример #6
0
        public static void AfterSelectedWorld()
        {
            Pipliz.Log.Write(string.Format("Started loading door texture mappings..."));
            JSONNode jsonTextureMapping;

            JSON.Deserialize(Path.Combine(DoorsDirectory, "doorstexturemapping.json"), out jsonTextureMapping, true);
            if (jsonTextureMapping.NodeType == NodeType.Object)
            {
                foreach (KeyValuePair <string, JSONNode> textureEntry in jsonTextureMapping.LoopObject())
                {
                    try {
                        foreach (string suffix in new string[] { "", OPEN_SUFFIX })
                        {
                            ItemTypesServer.TextureMapping textureMapping = new ItemTypesServer.TextureMapping(new JSONNode());
                            string textureTypeValue;
                            if (textureEntry.Value.TryGetAs <string> ("albedo", out textureTypeValue) && !textureTypeValue.Equals("neutral"))
                            {
                                string realTextureTypeValue = MultiPath.Combine(DoorsDirectory, "textures", "albedo", textureTypeValue + ".png");
                                Pipliz.Log.Write(string.Format("Rewriting {0} texture path from '{1}' to '{2}'", "albedo", textureTypeValue, realTextureTypeValue));
                                textureMapping.AlbedoPath = realTextureTypeValue;
                            }
                            if (textureEntry.Value.TryGetAs <string> ("normal", out textureTypeValue) && !textureTypeValue.Equals("neutral"))
                            {
                                string realTextureTypeValue = MultiPath.Combine(DoorsDirectory, "textures", "normal", textureTypeValue + ".png");
                                Pipliz.Log.Write(string.Format("Rewriting {0} texture path from '{1}' to '{2}'", "normal", textureTypeValue, realTextureTypeValue));
                                textureMapping.NormalPath = realTextureTypeValue;
                            }
                            if (textureEntry.Value.TryGetAs <string> ("emissive", out textureTypeValue) && !textureTypeValue.Equals("neutral"))
                            {
                                string realTextureTypeValue = MultiPath.Combine(DoorsDirectory, "textures", "emissive", textureTypeValue + ".png");
                                Pipliz.Log.Write(string.Format("Rewriting {0} texture path from '{1}' to '{2}'", "emissive", textureTypeValue, realTextureTypeValue));
                                textureMapping.EmissivePath = realTextureTypeValue;
                            }
                            if (textureEntry.Value.TryGetAs <string> ("height", out textureTypeValue) && !textureTypeValue.Equals("neutral"))
                            {
                                string realTextureTypeValue = MultiPath.Combine(DoorsDirectory, "textures", "height", textureTypeValue + ".png");
                                Pipliz.Log.Write(string.Format("Rewriting {0} texture path from '{1}' to '{2}'", "height", textureTypeValue, realTextureTypeValue));
                                textureMapping.HeightPath = realTextureTypeValue;
                            }
                            string realkey = MOD_PREFIX + textureEntry.Key + suffix;
                            Pipliz.Log.Write(string.Format("Adding texture mapping for '{0}'", realkey));
                            ItemTypesServer.SetTextureMapping(realkey, textureMapping);
                        }
                    } catch (Exception exception) {
                        Pipliz.Log.WriteError(string.Format("Exception while loading from {0}; {1}", "doorstexturemapping.json", exception.Message));
                    }
                }
            }
        }
Пример #7
0
        public static void AddTextures()
        {
            var textureMapping = new ItemTypesServer.TextureMapping(new JSONNode());

            textureMapping.AlbedoPath = GameLoader.TEXTURE_FOLDER_PANDA + "/albedo/HerbalistBench.png";
            textureMapping.NormalPath = GameLoader.TEXTURE_FOLDER_PANDA + "/normal/HerbalistBench.png";
            textureMapping.HeightPath = GameLoader.TEXTURE_FOLDER_PANDA + "/height/HerbalistBench.png";

            ItemTypesServer.SetTextureMapping(JOB_ITEM_KEY, textureMapping);
            ItemTypesServer.SetTextureMapping(HERB1_NAME, new ItemTypesServer.TextureMapping(new JSONNode())
            {
                AlbedoPath = GameLoader.TEXTURE_FOLDER_PANDA + "/albedo/herbs.png"
            });

            ItemTypesServer.SetTextureMapping(HERB2_NAME, new ItemTypesServer.TextureMapping(new JSONNode())
            {
                AlbedoPath = GameLoader.TEXTURE_FOLDER_PANDA + "/albedo/herbs.png"
            });
        }
Пример #8
0
        public static void AddTextures()
        {
            var textureMapping = new ItemTypesServer.TextureMapping(new JSONNode());

            textureMapping.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "AirTurret.png";
            textureMapping.NormalPath = GameLoader.BLOCKS_NORMAL_PATH + "Turret.png";
            textureMapping.HeightPath = GameLoader.BLOCKS_HEIGHT_PATH + "Turret.png";

            ItemTypesServer.SetTextureMapping(AIRTURRET_NAMESPACE + "sides", textureMapping);

            var earthTexture = new ItemTypesServer.TextureMapping(new JSONNode());

            earthTexture.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "EarthTurret.png";
            earthTexture.NormalPath = GameLoader.BLOCKS_NORMAL_PATH + "Turret.png";
            earthTexture.HeightPath = GameLoader.BLOCKS_HEIGHT_PATH + "Turret.png";

            ItemTypesServer.SetTextureMapping(EARTHTURRET_NAMESPACE + "sides", earthTexture);

            var fireTexture = new ItemTypesServer.TextureMapping(new JSONNode());

            fireTexture.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "FireTurret.png";
            fireTexture.NormalPath = GameLoader.BLOCKS_NORMAL_PATH + "Turret.png";
            fireTexture.HeightPath = GameLoader.BLOCKS_HEIGHT_PATH + "Turret.png";

            ItemTypesServer.SetTextureMapping(FIRETURRET_NAMESPACE + "sides", fireTexture);

            var waterTexture = new ItemTypesServer.TextureMapping(new JSONNode());

            waterTexture.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "WaterTurret.png";
            waterTexture.NormalPath = GameLoader.BLOCKS_NORMAL_PATH + "Turret.png";
            waterTexture.HeightPath = GameLoader.BLOCKS_HEIGHT_PATH + "Turret.png";

            ItemTypesServer.SetTextureMapping(WATERTURRET_NAMESPACE + "sides", waterTexture);

            var voidTexture = new ItemTypesServer.TextureMapping(new JSONNode());

            voidTexture.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "VoidTurret.png";
            voidTexture.NormalPath = GameLoader.BLOCKS_NORMAL_PATH + "Turret.png";
            voidTexture.HeightPath = GameLoader.BLOCKS_HEIGHT_PATH + "Turret.png";

            ItemTypesServer.SetTextureMapping(VOIDTURRET_NAMESPACE + "sides", voidTexture);
        }
Пример #9
0
 /// <summary>
 /// Returns this item as a ItemTypeServer.TextureMapping struct. (Note this will strip name, ID, and namespace properties.)
 /// </summary>
 /// <returns>ItemTypeServer.TextureMapping struct</returns>
 protected ItemTypesServer.TextureMapping asTextureMapping()
 {
     ItemTypesServer.TextureMapping thisMapping = new ItemTypesServer.TextureMapping(new Pipliz.JSON.JSONNode());
     if (this.AlbedoPath != null)
     {
         thisMapping.AlbedoPath = this.AlbedoPath;
     }
     if (this.NormalPath != null)
     {
         thisMapping.NormalPath = this.NormalPath;
     }
     if (this.EmissivePath != null)
     {
         thisMapping.EmissivePath = this.EmissivePath;
     }
     if (this.HeightPath != null)
     {
         thisMapping.HeightPath = this.HeightPath;
     }
     return(thisMapping);
 }
Пример #10
0
        private static void AddTextureMapping(string path, string sub)
        {
            Logger.Log("Update texture mappings...");

            if (JSON.Deserialize(path + "/UpdateTextures.json", out JSONNode jsonTextureMapping, false))
            {
                if (jsonTextureMapping.NodeType == NodeType.Object)
                {
                    foreach (KeyValuePair <string, JSONNode> textureEntry in jsonTextureMapping.LoopObject())
                    {
                        try
                        {
                            string albedoPath   = null;
                            string normalPath   = null;
                            string emissivePath = null;
                            string heightPath   = null;

                            foreach (string textureType in new string[] { "albedo", "normal", "emissive", "height" })
                            {
                                string textureTypeValue     = textureEntry.Value.GetAs <string>(textureType);
                                string realTextureTypeValue = textureTypeValue;

                                if (!textureTypeValue.Equals("neutral"))
                                {
                                    if (textureTypeValue.StartsWith(VANILLA_PREFIX))
                                    {
                                        realTextureTypeValue = realTextureTypeValue.Substring(VANILLA_PREFIX.Length);
                                    }
                                    else
                                    {
                                        realTextureTypeValue = GameLoader.TextureFolder + "/" + textureType + "/" + sub + textureTypeValue + ".png";

                                        switch (textureType.ToLowerInvariant())
                                        {
                                        case "albedo":
                                            albedoPath = realTextureTypeValue;
                                            break;

                                        case "normal":
                                            normalPath = realTextureTypeValue;
                                            break;

                                        case "emissive":
                                            emissivePath = realTextureTypeValue;
                                            break;

                                        case "height":
                                            heightPath = realTextureTypeValue;
                                            break;
                                        }
                                    }
                                }
                                textureEntry.Value.SetAs(textureType, realTextureTypeValue);
                            }

                            var textureMapping = new ItemTypesServer.TextureMapping(textureEntry.Value);

                            if (albedoPath != null)
                            {
                                textureMapping.AlbedoPath = albedoPath;
                            }

                            if (normalPath != null)
                            {
                                textureMapping.NormalPath = normalPath;
                            }

                            if (emissivePath != null)
                            {
                                textureMapping.EmissivePath = emissivePath;
                            }

                            if (heightPath != null)
                            {
                                textureMapping.HeightPath = heightPath;
                            }

                            string realkey;
                            if (!textureEntry.Key.StartsWith(VANILLA_PREFIX))
                            {
                                realkey = Blocks.MOD_NAMESPACE + "." + textureEntry.Key;
                            }
                            else
                            {
                                realkey = textureEntry.Key.Substring(VANILLA_PREFIX.Length);
                            }

                            ItemTypesServer.SetTextureMapping(realkey, textureMapping);
                            Logger.Log("TextureMapping loaded for..." + realkey);
                        }
                        catch (Exception exception)
                        {
                            Logger.Log("Exception while loading from {0}; {1}", "texturemapping.json", exception.Message);
                        }
                    }
                }
                else
                {
                    Logger.Log("Expected json object in {0}, but got {1} instead", "texturemapping.json", jsonTextureMapping.NodeType);
                }
            }
        }
 public static void AfterSelectedWorld()
 {
     foreach (string fullDirPath in Directory.GetDirectories(BlocksDirectory))
     {
         string packageName = Path.GetFileName(fullDirPath);
         if (packageName.Equals("examples"))
         {
             continue;
         }
         Pipliz.Log.Write(string.Format("Started loading '{0}' texture mappings...", packageName));
         JSONNode jsonTextureMapping;
         if (Pipliz.JSON.JSON.Deserialize(MultiPath.Combine(BlocksDirectory, packageName, "texturemapping.json"), out jsonTextureMapping, false))
         {
             if (jsonTextureMapping.NodeType == NodeType.Object)
             {
                 foreach (KeyValuePair <string, JSONNode> textureEntry in jsonTextureMapping.LoopObject())
                 {
                     try {
                         string albedoPath   = null;
                         string normalPath   = null;
                         string emissivePath = null;
                         string heightPath   = null;
                         foreach (string textureType in new string[] { "albedo", "normal", "emissive", "height" })
                         {
                             string textureTypeValue     = textureEntry.Value.GetAs <string> (textureType);
                             string realTextureTypeValue = textureTypeValue;
                             if (!textureTypeValue.Equals("neutral"))
                             {
                                 if (textureTypeValue.StartsWith(VANILLA_PREFIX))
                                 {
                                     realTextureTypeValue = realTextureTypeValue.Substring(VANILLA_PREFIX.Length);
                                 }
                                 else
                                 {
                                     realTextureTypeValue = MultiPath.Combine(BlocksDirectory, packageName, "textures", textureType, textureTypeValue + ".png");
                                     if (textureType.Equals("albedo"))
                                     {
                                         albedoPath = realTextureTypeValue;
                                     }
                                     else if (textureType.Equals("normal"))
                                     {
                                         normalPath = realTextureTypeValue;
                                     }
                                     else if (textureType.Equals("emissive"))
                                     {
                                         emissivePath = realTextureTypeValue;
                                     }
                                     else if (textureType.Equals("height"))
                                     {
                                         heightPath = realTextureTypeValue;
                                     }
                                 }
                                 Pipliz.Log.Write(string.Format("Rewriting {0} texture path from '{1}' to '{2}'", textureType, textureTypeValue, realTextureTypeValue));
                             }
                             textureEntry.Value.SetAs(textureType, realTextureTypeValue);
                         }
                         var textureMapping = new ItemTypesServer.TextureMapping(textureEntry.Value);
                         if (albedoPath != null)
                         {
                             textureMapping.AlbedoPath = albedoPath;
                         }
                         if (normalPath != null)
                         {
                             textureMapping.NormalPath = normalPath;
                         }
                         if (emissivePath != null)
                         {
                             textureMapping.EmissivePath = emissivePath;
                         }
                         if (heightPath != null)
                         {
                             textureMapping.HeightPath = heightPath;
                         }
                         string realkey = MOD_PREFIX + packageName + "." + textureEntry.Key;
                         Pipliz.Log.Write(string.Format("Adding texture mapping for '{0}'", realkey));
                         ItemTypesServer.SetTextureMapping(realkey, textureMapping);
                     } catch (Exception exception) {
                         Pipliz.Log.WriteError(string.Format("Exception while loading from {0}; {1}", "texturemapping.json", exception.Message));
                     }
                 }
             }
             else
             {
                 Pipliz.Log.WriteError(string.Format("Expected json object in {0}, but got {1} instead", "texturemapping.json", jsonTextureMapping.NodeType));
             }
         }
     }
 }