コード例 #1
0
        public LOLModel GetModel(String name)
        {
            LOLModel result = null;

            if (models.ContainsKey(name) == true)
            {
                result = models[name];
            }

            return(result);
        }
コード例 #2
0
        private bool StoreAnimations(ref LOLModel model, Logger logger)
        {
            bool result = true;

            Dictionary <String, String> animationStrings =
                new Dictionary <String, String>();

            // Sanity
            if (animationLists.ContainsKey(model.animationList) == true)
            {
                result = ANMListReader.Read(model.skinNumber - 1, // indexing in animations.list assumes the original skin to be -1
                                            animationLists[model.animationList], ref animationStrings, logger);
            }
            else
            {
                logger.Error("Unable to find animation list: " + model.animationList);
            }

            if (result == true)
            {
                // Store the animations in the model.
                foreach (var a in animationStrings)
                {
                    if (animations.ContainsKey(a.Value) == true)
                    {
                        if (model.animations.ContainsKey(a.Key) == false)
                        {
                            model.animations.Add(a.Key, animations[a.Value]);
                        }
                        else
                        {
                            logger.Error("Duplicate animation: " + a.Key);
                        }
                    }
                    else
                    {
                        logger.Error("Unable to find animation: " + a.Value);
                    }
                }
            }

            return(result);
        }
コード例 #3
0
        private bool StoreModel(ModelDefinition def, out LOLModel model, Logger logger)
        {
            model               = new LOLModel();
            model.skinNumber    = def.skin;
            model.animationList = def.anmListKey.ToLower();

            // Find the skn.
            if (skns.ContainsKey(def.skn))
            {
                model.skn = skns[def.skn];
            }
            else
            {
                logger.Error("Unable to find skn file: " + def.skn);
                return(false);
            }

            // Find the skl.
            if (skls.ContainsKey(def.skl))
            {
                model.skl = skls[def.skl];
            }
            else
            {
                logger.Error("Unable to find skl file: " + def.skl);
                return(false);
            }

            // Find the texture.
            if (textures.ContainsKey(def.tex))
            {
                model.texture = textures[def.tex];
            }
            else
            {
                logger.Error("Unable to find texture file: " + def.tex);
                return(false);
            }

            return(true);
        }
コード例 #4
0
        private bool StoreModel(ModelDefinition def, out LOLModel model, Logger logger)
        {
            model = new LOLModel();
            model.skinNumber = def.skin;
            model.animationList = def.anmListKey.ToLower();

            // Find the skn.
            if (skns.ContainsKey(def.skn))
            {
                model.skn = skns[def.skn];
            }
            else
            {
                logger.Error("Unable to find skn file: " + def.skn);
                return false;
            }

            // Find the skl.
            if (skls.ContainsKey(def.skl))
            {
                model.skl = skls[def.skl];
            }
            else
            {
                logger.Error("Unable to find skl file: " + def.skl);
                return false;
            }

            // Find the texture.
            if (textures.ContainsKey(def.tex))
            {
                model.texture = textures[def.tex];
            }
            else
            {
                logger.Error("Unable to find texture file: " + def.tex);
                return false;
            }

            return true;
        }
コード例 #5
0
        private bool StoreAnimations(ref LOLModel model, Logger logger)
        {
            bool result = true;

            Dictionary<String, String> animationStrings =
                new Dictionary<String, String>();

            // Sanity
            if (animationLists.ContainsKey(model.animationList) == true)
            {
                result = ANMListReader.Read(model.skinNumber - 1, // indexing in animations.list assumes the original skin to be -1
                    animationLists[model.animationList], ref animationStrings, logger);
            }
            else
            {
                logger.Error("Unable to find animation list: " + model.animationList);
            }

            if (result == true)
            {
                // Store the animations in the model.
                foreach (var a in animationStrings)
                {
                    if (animations.ContainsKey(a.Value) == true)
                    {
                        if (model.animations.ContainsKey(a.Key) == false)
                        {
                            model.animations.Add(a.Key, animations[a.Value]);
                        }
                        else
                        {
                            logger.Error("Duplicate animation: " + a.Key);
                        }
                    }
                    else
                    {
                        logger.Error("Unable to find animation: " + a.Value);
                    }
                }
            }

            return result;
        }