public FactoryLoaderEventArgs(bool success, int width, int height, machineMap factory)
 {
     this.success = success;
     this.height  = height;
     this.width   = width;
     this.factory = factory;
 }
        /*  ---------------------------- 2D ---------------------------- */
        private void initGrid()
        {
            machineMap machines = ClientServerUtil.getInstance().getFactory();

            if (machines == null || machines.map == null)
            {
                return;
            }
            foreach (machineMapEntry machine in machines.map)
            {
                string   instanceID = machine.key;
                int      classID    = getClassIdFromItemId(instanceID);
                position pos        = machine.value;
                GridItem newItem    = new GridItem();
                Image    img        = icons.getImage(classID);
                newItem.Content = img;

#if DEBUG
                Console.WriteLine("MainWindow.initGrid: instanceID = " + instanceID);
                Console.WriteLine("MainWindow.initGrid: classID = " + classID);
#endif

                Size s = GridC.GetTileSize();
                newItem.Width      = s.Width;
                newItem.Height     = s.Height;
                newItem.Angle      = getAngleFromDirection(pos.direction);
                newItem.instanceId = instanceID;
                GridC.placeItem(newItem, pos.x, pos.y);
            }
        }
Exemplo n.º 3
0
        /* --------------------- INIT & CLEAR ---------------------------*/

        public void InitFactoryGrid(machineMap machines)
        {
            ClearAndDeselectAllItems();
            ClearGrid();

            if (machines == null || machines.map == null)
            {
                return;
            }
            foreach (machineMapEntry machine in machines.map)
            {
                string     instanceID = machine.key;
                int        classID    = HelperFunctions.GetClassIdFromItemId(instanceID);
                position   pos        = machine.value;
                Point3D    point      = TransformServerToClientCoords(new Point3D(pos.x, pos.y, 0));
                GridItem3D newItem    = CreateGridItem3D(classID, point, pos.direction.ToString());

                newItem.instanceId = instanceID;
                PlaceItem(newItem);
            }
            SetItemOffset();
        }
 public SimulationLoaderEventArgs(bool success, int width, int height, machineMap factory)
 {
     this.success = success;
     this.height = height;
     this.width = width;
     this.factory = factory;
 }
        /* --------------------- INIT & CLEAR ---------------------------*/
        public void InitFactoryGrid(machineMap machines)
        {
            ClearAndDeselectAllItems();
            ClearGrid();

            if (machines == null || machines.map == null)
            {
                return;
            }
            foreach (machineMapEntry machine in machines.map)
            {
                string instanceID = machine.key;
                int classID = HelperFunctions.GetClassIdFromItemId(instanceID);
                position pos = machine.value;
                Point3D point = TransformServerToClientCoords(new Point3D(pos.x, pos.y, 0));
                GridItem3D newItem = CreateGridItem3D(classID, point, pos.direction.ToString());

                newItem.instanceId = instanceID;
                PlaceItem(newItem);

            }
            SetItemOffset();
        }