Ejemplo n.º 1
0
        /// <summary>
        /// Find a single model definition by name.  Returns null if not found.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static ROTModelDefinition getModelDefinition(String name)
        {
            if (!defsLoaded)
            {
                loadDefs();
            }
            ROTModelDefinition data = null;

            baseModelData.TryGetValue(name, out data);
            return(data);
        }
Ejemplo n.º 2
0
 public ModelDefinitionLayoutOptions(ROTModelDefinition def, ModelLayoutData[] layouts)
 {
     this.definition = def;
     if (definition == null)
     {
         error("Model definition was null when creating model layout options!");
     }
     this.layouts = layouts;
     if (this.layouts == null || this.layouts.Length < 1)
     {
         throw new InvalidOperationException("ERROR: No valid layout data specified.");
     }
 }
Ejemplo n.º 3
0
 public ModelDefinitionLayoutOptions(ROTModelDefinition def)
 {
     definition = def;
     if (definition == null)
     {
         error("Model definition was null when creating model layout options!");
     }
     layouts = ROTModelLayout.findLayouts(new string[] { "default" });
     if (this.layouts == null || this.layouts.Length < 1)
     {
         throw new InvalidOperationException("ERROR: No valid layout data specified.");
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Create a group of model definition layout options by model definition name, with default (single position) layouts.
        /// </summary>
        /// <param name="names"></param>
        /// <returns></returns>
        public static ModelDefinitionLayoutOptions[] getModelDefinitionLayouts(string[] names)
        {
            List <ModelDefinitionLayoutOptions> defs = new List <ModelDefinitionLayoutOptions>();
            int len = names.Length;

            for (int i = 0; i < len; i++)
            {
                ROTModelDefinition def = getModelDefinition(names[i]);
                if (def != null)
                {
                    defs.Add(new ModelDefinitionLayoutOptions(def));
                }
                else
                {
                    error("Could not locate model defintion for name: " + names[i]);
                }
            }
            return(defs.ToArray());
        }
Ejemplo n.º 5
0
        private static void loadDefs()
        {
            if (defsLoaded)
            {
                return;
            }
            defsLoaded = true;
            ConfigNode[]       modelDatas = GameDatabase.Instance.GetConfigNodes("ROT_MODEL");
            ROTModelDefinition data;

            foreach (ConfigNode node in modelDatas)
            {
                data = new ROTModelDefinition(node);
                log("Loading model definition data for name: " + data.name + " with model URL: " + data.modelName);
                if (baseModelData.ContainsKey(data.name))
                {
                    error("Model defs already contains def for name: " + data.name + ".  Please check your configs as this is an error.  The duplicate entry was found in the config node of:\n" + node);
                    continue;
                }
                baseModelData.Add(data.name, data);
            }
        }