示例#1
0
        //Should never run on a client.
        public void CloseMap()
        {
            //PathOfModifiers.Instance.Logger.Info($"CloseMap: {Main.netMode}");
            if (!CanClose())
            {
                return;
            }

            timeLeft = 0;

            Items.Map mapModItem = ((Items.Map)mapItem.modItem);
            Rectangle dimensions = new Rectangle(bounds.Value.X + 1, bounds.Value.Y + 1, bounds.Value.Width - 2, bounds.Value.Height - 2);

            var map = mapModItem.map;

            map.Close();

            MapBorder.RemoveActiveBounds(bounds.Value);

            SendToClients();
        }
示例#2
0
        //Should never run on a client.
        public void OpenMap()
        {
            //PathOfModifiers.Instance.Logger.Info($"OpenMap: {Main.netMode}");
            if (!CanOpen())
            {
                return;
            }

            //TODO: Set timeLeft somewhere else(map settings/config)
            timeLeft = 10 * 60 * 60;

            Items.Map mapModItem = ((Items.Map)mapItem.modItem);
            Rectangle dimensions = new Rectangle(bounds.Value.X + 1, bounds.Value.Y + 1, bounds.Value.Width - 2, bounds.Value.Height - 2);

            var map = mapModItem.map;

            map.Open(dimensions);

            MapBorder.AddActiveBounds(bounds.Value);

            SendToClients();
        }