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));
            }
        }
Example #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));
            }
        }