Example #1
0
        public static void Init_Place()
        {
            Data = new Dictionary <string, PlaceEnterty>();
            XmlDocument xd = new XmlDocument();

            xd.Load("./Data/place.xml");
            XmlNode     xn  = xd.SelectSingleNode("placeinfo");
            XmlNodeList xnl = xn.ChildNodes;

            foreach (XmlNode xx in xnl)
            {
                PlaceEnterty me = new PlaceEnterty();
                me.Key  = xx.Attributes["key"].Value.ToString();
                me.Name = xx.Attributes["name"].Value.ToString();

                foreach (XmlNode xx2 in xx.ChildNodes)
                {
                    float x   = Convert.ToSingle(xx2.Attributes["x"].Value);
                    float y   = Convert.ToSingle(xx2.Attributes["y"].Value);
                    int   rrr = Convert.ToInt32(xx2.Attributes["r"].Value);
                    int   ggg = Convert.ToInt32(xx2.Attributes["g"].Value);
                    int   bbb = Convert.ToInt32(xx2.Attributes["b"].Value);
                    int   tor = Convert.ToInt32(xx2.Attributes["tor"].Value);
                    me.Attrs.Add(new PlaceAttr(x, y, rrr, ggg, bbb, tor));
                }
                Data.Add(me.Key, me);
            }
        }
Example #2
0
        public string GetCurrentPlace()
        {
            PlaceEnterty pe = _Gm.GetCurrPlace();

            if (pe != null)
            {
                return(pe.Key);
            }
            else
            {
                return(null);
            }
        }
Example #3
0
        public PlaceEnterty WaitToPlaces(string[] plcs, int ms = 500, int max = 5)
        {
            PlaceEnterty pe = null;

            while (max-- > 0)
            {
                pe = CheckPlaces(plcs);
                Thread.Sleep(ms);
                if (pe == null)
                {
                    continue;
                }
                else
                {
                    break;
                }
            }
            return(pe);
        }
Example #4
0
 public string WaitForPlaces(LuaInterface.LuaTable tbl, int ms = 500, int max = 5)
 {
     try
     {
         List <string> lst = new List <string>();
         foreach (var x in tbl.Values)
         {
             lst.Add(x.ToString());
         }
         PlaceEnterty pe = _Gm.WaitToPlaces(lst.ToArray(), ms, max);
         if (pe == null)
         {
             return(null);
         }
         return(pe.Key);
     }
     catch (KeyNotFoundException ex)
     {
         throw new Exception("WaitForPlaces,错误无法找到指定地点!");
     }
 }
Example #5
0
 public string CheckPlaces(LuaInterface.LuaTable strs)
 {
     try
     {
         List <string> lst = new List <string>();
         foreach (var x in strs.Values)
         {
             lst.Add(x.ToString());
         }
         PlaceEnterty pe = _Gm.CheckPlaces(lst.ToArray());
         if (pe == null)
         {
             return(null);
         }
         return(pe.Key);
     }
     catch (KeyNotFoundException ex)
     {
         throw new Exception("CheckPlaces,错误无法找到指定地点!");
     }
 }