Exemple #1
0
        private void bgSetListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (bgSetListBox.SelectedItem == null)
            {
                return;
            }
            bgImageContainer.Controls.Clear();
            WzImage bgSetImage = Program.InfoManager.BackgroundSets[(string)bgSetListBox.SelectedItem];

            if (!bgSetImage.Parsed)
            {
                bgSetImage.ParseImage();
            }
            if (aniBg.Checked)
            {
                IWzImageProperty aniProp = bgSetImage["ani"];
                if (aniProp == null || aniProp.WzProperties == null)
                {
                    return;
                }
                foreach (WzSubProperty aniBgProp in aniProp.WzProperties)
                {
                    if (aniBgProp.HCTag == null)
                    {
                        aniBgProp.HCTag = BackgroundInfo.Load(aniBgProp, (string)bgSetListBox.SelectedItem, true, aniBgProp.Name);
                    }
                    KoolkLVItem aniItem = bgImageContainer.createItem(((BackgroundInfo)aniBgProp.HCTag).Image, aniBgProp.Name, true);
                    aniItem.Tag        = aniBgProp.HCTag;
                    aniItem.MouseDown += new MouseEventHandler(bgItem_Click);
                    aniItem.MouseUp   += new MouseEventHandler(item_MouseUp);
                }
            }
            else
            {
                IWzImageProperty backProp = bgSetImage["back"];
                foreach (WzCanvasProperty backBg in backProp.WzProperties)
                {
                    if (backBg.HCTag == null)
                    {
                        backBg.HCTag = BackgroundInfo.Load(backBg, (string)bgSetListBox.SelectedItem, false, backBg.Name);
                    }
                    KoolkLVItem aniItem = bgImageContainer.createItem(((BackgroundInfo)backBg.HCTag).Image, backBg.Name, true);
                    aniItem.Tag        = backBg.HCTag;
                    aniItem.MouseDown += new MouseEventHandler(bgItem_Click);
                    aniItem.MouseUp   += new MouseEventHandler(item_MouseUp);
                }
            }
        }
Exemple #2
0
        private static 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  = InfoTool.GetBool(bgProp["f"]);
                string         bS    = InfoTool.GetString(bgProp["bS"]);
                bool           ani   = InfoTool.GetBool(bgProp["ani"]);
                string         no    = InfoTool.GetInt(bgProp["no"]).ToString();
                WzImage        bsImg = Program.InfoManager.BackgroundSets[bS];
                if (bsImg == null)
                {
                    continue;
                }
                IWzImageProperty bgInfoProp = bsImg[ani ? "ani" : "back"][no];
                if (bgInfoProp.HCTag == null)
                {
                    bgInfoProp.HCTag = BackgroundInfo.Load(bgInfoProp, bS, ani, no);
                }
                BackgroundInfo bgInfo = (BackgroundInfo)bgInfoProp.HCTag;
                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, false));
            }
        }