public void LoadBackgrounds(WzImage mapImage, Board mapBoard)
        {
            WzSubProperty bgParent = (WzSubProperty)mapImage["back"];
            WzSubProperty bgProp;
            int           i = 0;

            while ((bgProp = (WzSubProperty)bgParent[(i++).ToString()]) != null)
            {
                int            x      = InfoTool.GetInt(bgProp["x"]);
                int            y      = InfoTool.GetInt(bgProp["y"]);
                int            rx     = InfoTool.GetInt(bgProp["rx"]);
                int            ry     = InfoTool.GetInt(bgProp["ry"]);
                int            cx     = InfoTool.GetInt(bgProp["cx"]);
                int            cy     = InfoTool.GetInt(bgProp["cy"]);
                int            a      = InfoTool.GetInt(bgProp["a"]);
                BackgroundType type   = (BackgroundType)InfoTool.GetInt(bgProp["type"]);
                bool           front  = InfoTool.GetBool(bgProp["front"]);
                bool?          flip_t = InfoTool.GetOptionalBool(bgProp["f"]);
                bool           flip   = flip_t.HasValue ? flip_t.Value : false;
                string         bS     = InfoTool.GetString(bgProp["bS"]);
                bool           ani    = InfoTool.GetBool(bgProp["ani"]);
                string         no     = InfoTool.GetInt(bgProp["no"]).ToString();
                BackgroundInfo bgInfo = BackgroundInfo.Get(bS, ani, no);
                if (bgInfo == null)
                {
                    continue;
                }
                IList list = front ? mapBoard.BoardItems.FrontBackgrounds : mapBoard.BoardItems.BackBackgrounds;
                list.Add((BackgroundInstance)bgInfo.CreateInstance(mapBoard, x, y, i, rx, ry, cx, cy, type, a, front, flip));
            }
        }
示例#2
0
        private void bgSetListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (bgSetListBox.SelectedItem == null)
            {
                return;
            }
            bgImageContainer.Controls.Clear();

            WzImageProperty parentProp = Program.InfoManager.BackgroundSets[(string)bgSetListBox.SelectedItem][aniBg.Checked ? "ani" : "back"];

            if (parentProp == null || parentProp.WzProperties == null)
            {
                return;
            }
            foreach (WzImageProperty prop in parentProp.WzProperties)
            {
                BackgroundInfo bgInfo = BackgroundInfo.Get((string)bgSetListBox.SelectedItem, aniBg.Checked, prop.Name);
                if (bgInfo == null)
                {
                    continue;
                }
                ImageViewer item = bgImageContainer.Add(bgInfo.Image, prop.Name, true);
                item.Tag        = bgInfo;
                item.MouseDown += new MouseEventHandler(bgItem_Click);
                item.MouseUp   += new MouseEventHandler(ImageViewer.item_MouseUp);
                item.MaxHeight  = UserSettings.ImageViewerHeight;
                item.MaxWidth   = UserSettings.ImageViewerWidth;
            }
        }
示例#3
0
 public BackgroundInstance(Board board, SerializationForm json)
     : base(board, json)
 {
     flip     = json.flip;
     _a       = json.a;
     _cx      = json.cx;
     _cy      = json.cy;
     _rx      = json.rx;
     _ry      = json.ry;
     _front   = json.front;
     _type    = json.type;
     baseInfo = BackgroundInfo.Get(json.bs, json.ani, json.no);
 }
示例#4
0
        /// <summary>
        /// On image selection changed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bgSetListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (bgSetListBox.SelectedItem == null)
            {
                return;
            }
            bgImageContainer.Controls.Clear();

            string             path;
            BackgroundInfoType infoType = BackgroundInfoType.Animation;

            if (radioButton_spine.Checked)
            {
                infoType = BackgroundInfoType.Spine;
                path     = "spine";
            }
            else if (aniBg.Checked)
            {
                infoType = BackgroundInfoType.Animation;
                path     = "ani";
            }
            else
            {
                infoType = BackgroundInfoType.Background;
                path     = "back";
            }

            WzImageProperty parentProp = Program.InfoManager.BackgroundSets[(string)bgSetListBox.SelectedItem][path];

            if (parentProp == null || parentProp.WzProperties == null)
            {
                return;
            }

            foreach (WzImageProperty prop in parentProp.WzProperties)
            {
                BackgroundInfo bgInfo = BackgroundInfo.Get((string)bgSetListBox.SelectedItem, infoType, prop.Name);
                if (bgInfo == null)
                {
                    continue;
                }

                ImageViewer item = bgImageContainer.Add(bgInfo.Image, prop.Name, true);
                item.Tag        = bgInfo;
                item.MouseDown += new MouseEventHandler(bgItem_Click);
                item.MouseUp   += new MouseEventHandler(ImageViewer.item_MouseUp);
                item.MaxHeight  = UserSettings.ImageViewerHeight;
                item.MaxWidth   = UserSettings.ImageViewerWidth;
            }
        }
示例#5
0
        public BackgroundInstance(Board board, SerializationForm json)
            : base(board, json)
        {
            flip              = json.flip;
            _a                = json.a;
            _cx               = json.cx;
            _cy               = json.cy;
            _rx               = json.rx;
            _ry               = json.ry;
            _front            = json.front;
            _type             = json.type;
            _screenMode       = json.screenMode;
            _spineAni         = json.spineAni;
            _spineRandomStart = json.spineRandomStart;

            baseInfo = BackgroundInfo.Get(board.ParentControl.GraphicsDevice, json.bs, json.backgroundInfoType, json.no);
        }