Пример #1
0
 private TileInfo newVariant(TileInfo parent, XmlNode node)
 {
     TileInfo info = new TileInfo();
     info.name = (node.Attributes["name"] == null) ? parent.name : node.Attributes["name"].Value;
     info.color = (node.Attributes["color"] == null) ? parent.color : parseColor(node.Attributes["color"].Value);
     info.transparent = (node.Attributes["letLight"] == null) ? parent.transparent : true;
     info.solid = (node.Attributes["solid"] == null) ? parent.solid : true;
     info.light = (node.Attributes["light"] == null) ? parent.light : parseDouble(node.Attributes["light"].Value);
     info.lightR = (node.Attributes["lightr"] == null) ? parent.lightR : parseDouble(node.Attributes["lightr"].Value);
     info.lightG = (node.Attributes["lightg"] == null) ? parent.lightG : parseDouble(node.Attributes["lightg"].Value);
     info.lightB = (node.Attributes["lightb"] == null) ? parent.lightB : parseDouble(node.Attributes["lightb"].Value);
     info.u = (node.Attributes["u"] == null) ? -1 : parseInt(node.Attributes["u"].Value);
     info.v = (node.Attributes["v"] == null) ? -1 : parseInt(node.Attributes["v"].Value);
     info.minu = (node.Attributes["minu"] == null) ? -1 : parseInt(node.Attributes["minu"].Value);
     info.maxu = (node.Attributes["maxu"] == null) ? -1 : parseInt(node.Attributes["maxu"].Value);
     info.minv = (node.Attributes["minv"] == null) ? -1 : parseInt(node.Attributes["minv"].Value);
     info.maxv = (node.Attributes["maxv"] == null) ? -1 : parseInt(node.Attributes["maxv"].Value);
     info.variants = new List<TileInfo>();
     if (node.HasChildNodes)
         for (int i = 0; i < node.ChildNodes.Count; i++)
             info.variants.Add(newVariant(info, node.ChildNodes[i]));
     return info;
 }
Пример #2
0
        private void addVariants(ArrayList quickItems, TileInfo info)
        {
            // LOOK_AT_ME: I don't know what that method does, but it was highlighting lots of blocks on start and so making highlight looks ugly

            //foreach (TileInfo v in info.variants)
            //{
            //    if (v.name != info.name)
            //    {
            //        v.isHilighting = true;
            //        quickItems.Add(new HTile(v.name,v));
            //    }
            //    addVariants(quickItems, v);
            //}
        }
Пример #3
0
 private TileInfo find(TileInfo info, Int16 u, Int16 v)
 {
     foreach (TileInfo vars in info.variants)
     {
         // must match *all* restrictions... and we take the first match we find.
         if ((vars.u < 0 || vars.u == u) &&
             (vars.v < 0 || vars.v == v) &&
             (vars.minu < 0 || vars.minu <= u) &&
             (vars.minv < 0 || vars.minv <= v) &&
             (vars.maxu < 0 || vars.maxu > u) &&
             (vars.maxv < 0 || vars.maxv > v))
             return find(vars, u, v); //check for sub-variants
     }
     // if we get here, there are no variants that match
     return info;
 }
Пример #4
0
 private void loadInfo(TileInfo info, XmlNode node)
 {
     info.name = node.Attributes["name"].Value;
     info.color = parseColor(node.Attributes["color"].Value);
     info.hasExtra = node.Attributes["hasExtra"] != null;
     info.light = (node.Attributes["light"] == null) ? 0.0 : parseDouble(node.Attributes["light"].Value);
     info.lightR = (node.Attributes["lightr"] == null) ? 0.0 : parseDouble(node.Attributes["lightr"].Value);
     info.lightG = (node.Attributes["lightg"] == null) ? 0.0 : parseDouble(node.Attributes["lightg"].Value);
     info.lightB = (node.Attributes["lightb"] == null) ? 0.0 : parseDouble(node.Attributes["lightb"].Value);
     info.transparent = node.Attributes["letLight"] != null;
     info.solid = node.Attributes["solid"] != null;
     info.isStone = node.Attributes["isStone"] != null;
     info.isGrass = node.Attributes["isGrass"] != null;
     info.canMerge = node.Attributes["merge"] != null;
     if (node.Attributes["blend"] != null)
         info.blend = parseInt(node.Attributes["blend"].Value);
     else
         info.blend = -1;
     info.variants = new List<TileInfo>();
     if (node.HasChildNodes)
         for (int i = 0; i < node.ChildNodes.Count; i++)
             info.variants.Add(newVariant(info, node.ChildNodes[i]));
 }
Пример #5
0
 public TileInfos(XmlNodeList nodes)
 {
     info = new TileInfo[nodes.Count];
     for (int i = 0; i < nodes.Count; i++)
     {
         int id = Convert.ToInt32(nodes[i].Attributes["num"].Value);
         info[id] = new TileInfo();
         loadInfo(info[id], nodes[i]);
     }
 }
Пример #6
0
 public HTile(string name, TileInfo info)
 {
     this.name = name;
     Info = info;
 }
Пример #7
0
 private void hiliteVariants(TileInfo info)
 {
     foreach (TileInfo v in info.variants)
     {
         v.isHilighting = true;
         hiliteVariants(v);
     }
 }
Пример #8
0
 private void addVariants(ArrayList quickItems, TileInfo info)
 {
     foreach (TileInfo v in info.variants)
     {
         if (v.name != info.name)
         {
             v.isHilighting = true;
             quickItems.Add(new HTile(v.name, v));
         }
         addVariants(quickItems, v);
     }
 }
Пример #9
0
 private void AddVariants(ArrayList tiles, TileInfo info)
 {
     foreach (TileInfo v in info.variants)
     {
         if (v.name != info.name)
         {
             v.isHilighting = false;
             tiles.Add(new HTile(v.name, v));
         }
         AddVariants(tiles, v);
     }
 }