Exemplo n.º 1
0
        internal static Rect[] CalculateSimulatorCutoutsRelative(SimulationDevice device)
        {
            var orientation = GetGameViewOrientation();
            var cutouts     = device.Screens.FirstOrDefault().orientations[orientation].cutouts;

            if (cutouts is null)
            {
                return(new Rect[0]);
            }
            var screenSize = new Vector2(device.Screens.FirstOrDefault().width, device.Screens.FirstOrDefault().height);

            if (orientation == ScreenOrientation.Landscape)
            {
                var swap = screenSize.x;
                screenSize.x = screenSize.y;
                screenSize.y = swap;
            }

            System.Collections.Generic.List <Rect> rects = new System.Collections.Generic.List <Rect>();
            foreach (var cutout in cutouts)
            {
                rects.Add(GetRectRelativeToScreenSize(cutout, screenSize));
            }
            return(rects.ToArray());
        }
Exemplo n.º 2
0
        internal static Rect CalculateSimulatorSafeAreaRelative(SimulationDevice device)
        {
            var firstScreen = device.Screens.FirstOrDefault();

            // Should not happen, but just to be safe.
            if (firstScreen == null)
            {
                return(default);
Exemplo n.º 3
0
        internal static Rect CalculateSimulatorSafeAreaRelative(SimulationDevice device)
        {
            var orientation = GetGameViewOrientation();
            var safe        = device.Screens.FirstOrDefault().orientations[orientation].safeArea;
            var screenSize  = new Vector2(device.Screens.FirstOrDefault().width, device.Screens.FirstOrDefault().height);

            if (orientation == ScreenOrientation.Landscape)
            {
                var swap = screenSize.x;
                screenSize.x = screenSize.y;
                screenSize.y = swap;
            }
            return(GetRectRelativeToScreenSize(safe, screenSize));
        }
    public void Export()
    {
        device = new SimulationDevice();

        device.Meta = new MetaData();
        device.Meta.friendlyName = export.GetComponentInChildren <InputField>().text;

        device.SystemInfo = new SystemInfoData()
        {
            GraphicsDependentData = new GraphicsDependentSystemInfoData[1] {
                new GraphicsDependentSystemInfoData()
            }
        };
        foreach (var property in typeof(SystemInfo).GetProperties(BindingFlags.Public | BindingFlags.Static))
        {
            var prop = typeof(SystemInfoData).GetField(property.Name);
            if (prop != null)
            {
                prop.SetValue(device.SystemInfo, property.GetValue(null));
            }
            else
            {
                prop = typeof(GraphicsDependentSystemInfoData).GetField(property.Name);
                if (prop != null)
                {
                    prop.SetValue(device.SystemInfo.GraphicsDependentData[0], property.GetValue(null));
                }
            }
        }

        device.Screens = new ScreenData[1];
        for (int i = 0; i < device.Screens.Length; i++)
        {
            var screen = new ScreenData();
            screen.width  = Screen.width;
            screen.height = Screen.height;
            //screen.navigationBarHeight = 0;
            screen.orientations = new Dictionary <ScreenOrientation, OrientationDependentData>();
            screen.dpi          = Screen.dpi;
            device.Screens[i]   = screen;
            StartCoroutine(screenData(screen));
        }

        menu = Menu.Extracting;
    }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            int nomberdevices = 1;

            Device[] devices = new Device[nomberdevices];

            for (int i = 0; i < nomberdevices; i++)
            {
                devices[i] = new SimulationDevice();
            }

            foreach (Device device in devices)
            {
                tentative = tentative + 1;
                Data data = device.FactoryMethod();
                Console.WriteLine("Device created {0}", data.GetType().Name);
            }
        }