Ejemplo n.º 1
0
 public static bool TryParse(string s, out WindowLocation loc)
 {
     string[] parts = s.Split('/');
     loc = new WindowLocation();
     return((parts.Length == 6) &&
            long.TryParse(parts[0], out loc.BlockId) &&
            int.TryParse(parts[1], out loc.SurfaceId) &&
            float.TryParse(parts[2], out loc.Area.Position.X) &&
            float.TryParse(parts[3], out loc.Area.Position.Y) &&
            float.TryParse(parts[4], out loc.Area.Size.X) &&
            float.TryParse(parts[5], out loc.Area.Size.Y));
 }
Ejemplo n.º 2
0
        void Load(MyIni state)
        {
            WindowLocation  loc;
            List <MyIniKey> keys = new List <MyIniKey>();

            state.GetKeys(ID, keys);
            PendingScreens.Clear();
            foreach (var key in keys)
            {
                if (WindowLocation.TryParse(key.Name, out loc))
                {   //we store a would-be window into a buffer - we will create it once we find that text surface again.
                    string value = state.Get(key).ToString();
                    int    idx   = value.IndexOf('\n');
                    if (idx < 0)
                    {
                        PendingScreens.Add(new MyTuple <WindowLocation, string, string>(loc, value, string.Empty));
                    }
                    else
                    {
                        PendingScreens.Add(new MyTuple <WindowLocation, string, string>(loc, value.Substring(0, idx), value.Substring(idx + 1)));
                    }
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>Constructor - only to be used by screen manager.</summary>
 public Window(WindowLocation loc, IMyTextSurface surface, object data, IHasOutput job)
 {
     Location = loc; Surface = surface; Data = data; Job = job;
 }