Exemple #1
0
        private static ObjectInfo Load(WzSubProperty parentObject, string oS, string l0, string l1, string l2)
        {
            WzCanvasProperty frame1 = (WzCanvasProperty)WzInfoTools.GetRealProperty(parentObject["0"]);
            ObjectInfo       result = new ObjectInfo(
                frame1.GetLinkedWzCanvasBitmap(),
                WzInfoTools.PointFToSystemPoint(frame1.GetCanvasOriginPosition()),
                oS,
                l0,
                l1,
                l2,
                parentObject);
            WzImageProperty chairs    = parentObject["seat"];
            WzImageProperty ropes     = frame1["rope"];
            WzImageProperty ladders   = frame1["ladder"];
            WzImageProperty footholds = frame1["foothold"];

            result.footholdOffsets = ParsePropToOffsetMap(footholds);
            result.ropeOffsets     = ParsePropToOffsetMap(ropes);
            result.ladderOffsets   = ParsePropToOffsetMap(ladders);
            if (chairs != null)
            {
                result.chairOffsets = ParsePropToOffsetList(chairs);
            }
            return(result);
        }
        /// <summary>
        /// Load background from WzImageProperty
        /// </summary>
        /// <param name="parentObject"></param>
        /// <param name="spineParentObject"></param>
        /// <param name="bS"></param>
        /// <param name="type"></param>
        /// <param name="no"></param>
        /// <returns></returns>
        private static BackgroundInfo Load(WzImageProperty parentObject, string bS, BackgroundInfoType type, string no)
        {
            WzCanvasProperty frame0;

            if (type == BackgroundInfoType.Animation)
            {
                frame0 = (WzCanvasProperty)WzInfoTools.GetRealProperty(parentObject["0"]);
            }
            else if (type == BackgroundInfoType.Spine)
            {
                // TODO: make a preview of the spine image ffs
                WzCanvasProperty spineCanvas = (WzCanvasProperty)parentObject["0"];
                if (spineCanvas != null)
                {
                    Bitmap bitmap   = spineCanvas.GetLinkedWzCanvasBitmap();
                    PointF origin__ = spineCanvas.GetCanvasOriginPosition();

                    return(new BackgroundInfo(parentObject, bitmap, WzInfoTools.PointFToSystemPoint(origin__), bS, type, no, parentObject));
                }
                else
                {
                    PointF origin_ = new PointF();
                    return(new BackgroundInfo(parentObject, Properties.Resources.placeholder, WzInfoTools.PointFToSystemPoint(origin_), bS, type, no, parentObject));
                }
            }
            else
            {
                frame0 = (WzCanvasProperty)WzInfoTools.GetRealProperty(parentObject);
            }

            PointF origin = frame0.GetCanvasOriginPosition();

            return(new BackgroundInfo(frame0, frame0.GetLinkedWzCanvasBitmap(), WzInfoTools.PointFToSystemPoint(origin), bS, type, no, parentObject));
        }
Exemple #3
0
        private static BackgroundInfo Load(WzImageProperty parentObject, string bS, bool ani, string no)
        {
            WzCanvasProperty frame0 = ani ? (WzCanvasProperty)WzInfoTools.GetRealProperty(parentObject["0"]) : (WzCanvasProperty)WzInfoTools.GetRealProperty(parentObject);

            PointF origin = frame0.GetCanvasOriginPosition();

            return(new BackgroundInfo(frame0.GetLinkedWzCanvasBitmap(), WzInfoTools.PointFToSystemPoint(origin), bS, ani, no, parentObject));
        }
Exemple #4
0
        public static PortalInfo Load(WzCanvasProperty parentObject)
        {
            PortalInfo portal = new PortalInfo(
                parentObject.Name,
                parentObject.GetLinkedWzCanvasBitmap(),
                WzInfoTools.PointFToSystemPoint(parentObject.GetCanvasOriginPosition()), parentObject);

            Program.InfoManager.Portals.Add(portal.type, portal);
            return(portal);
        }
        /// <summary>
        /// Load background from WzImageProperty
        /// </summary>
        /// <param name="graphicsDevice">The graphics device that the backgroundInfo is to be rendered on (loading spine)</param>
        /// <param name="parentObject"></param>
        /// <param name="spineParentObject"></param>
        /// <param name="bS"></param>
        /// <param name="type"></param>
        /// <param name="no"></param>
        /// <returns></returns>
        private static BackgroundInfo Load(GraphicsDevice graphicsDevice, WzImageProperty parentObject, string bS, BackgroundInfoType type, string no)
        {
            WzCanvasProperty frame0;

            if (type == BackgroundInfoType.Animation)
            {
                frame0 = (WzCanvasProperty)WzInfoTools.GetRealProperty(parentObject["0"]);
            }
            else if (type == BackgroundInfoType.Spine)
            {
                // TODO: make a preview of the spine image ffs
                WzCanvasProperty spineCanvas = (WzCanvasProperty)parentObject["0"];
                if (spineCanvas != null)
                {
                    // Load spine
                    WzSpineAnimationItem wzSpineAnimationItem = null;
                    if (graphicsDevice != null) // graphicsdevice needed to work.. assuming that it is loaded by now before BackgroundPanel
                    {
                        WzImageProperty spineAtlasProp = ((WzSubProperty)parentObject).WzProperties.FirstOrDefault(
                            wzprop => wzprop is WzStringProperty property && property.IsSpineAtlasResources);
                        if (spineAtlasProp != null)
                        {
                            WzStringProperty stringObj = (WzStringProperty)spineAtlasProp;
                            wzSpineAnimationItem = new WzSpineAnimationItem(stringObj);

                            wzSpineAnimationItem.LoadResources(graphicsDevice);
                        }
                    }

                    // Preview Image
                    Bitmap bitmap = spineCanvas.GetLinkedWzCanvasBitmap();

                    // Origin
                    PointF origin__ = spineCanvas.GetCanvasOriginPosition();

                    return(new BackgroundInfo(parentObject, bitmap, WzInfoTools.PointFToSystemPoint(origin__), bS, type, no, parentObject, wzSpineAnimationItem));
                }
                else
                {
                    PointF origin_ = new PointF();
                    return(new BackgroundInfo(parentObject, Properties.Resources.placeholder, WzInfoTools.PointFToSystemPoint(origin_), bS, type, no, parentObject, null));
                }
            }
            else
            {
                frame0 = (WzCanvasProperty)WzInfoTools.GetRealProperty(parentObject);
            }

            PointF origin = frame0.GetCanvasOriginPosition();

            return(new BackgroundInfo(frame0, frame0.GetLinkedWzCanvasBitmap(), WzInfoTools.PointFToSystemPoint(origin), bS, type, no, parentObject, null));
        }
        private void ExtractPNGFromImage(WzImage image)
        {
            WzCanvasProperty reactorImage = WzInfoTools.GetReactorImage(image);

            if (reactorImage != null)
            {
                Image  = reactorImage.GetLinkedWzCanvasBitmap();
                Origin = WzInfoTools.PointFToSystemPoint(reactorImage.GetCanvasOriginPosition());
            }
            else
            {
                Image  = new Bitmap(1, 1);
                Origin = new System.Drawing.Point();
            }
        }
Exemple #7
0
        private void ExtractPNGFromImage(WzImage image)
        {
            WzCanvasProperty npcImage = WzInfoTools.GetNpcImage(image);

            if (npcImage != null)
            {
                Image = npcImage.GetLinkedWzCanvasBitmap();
                if (Image.Width == 1 && Image.Height == 1)
                {
                    Image = global::HaCreator.Properties.Resources.placeholder;
                }
                Origin = WzInfoTools.PointFToSystemPoint(npcImage.GetCanvasOriginPosition());
            }
            else
            {
                Image  = new Bitmap(1, 1);
                Origin = new System.Drawing.Point();
            }
        }
        private static TileInfo Load(WzCanvasProperty parentObject, string tS, string u, string no, int?mag)
        {
            WzImageProperty zProp  = parentObject["z"];
            int             z      = zProp == null ? 0 : InfoTool.GetInt(zProp);
            TileInfo        result = new TileInfo(
                parentObject.GetLinkedWzCanvasBitmap(),
                WzInfoTools.PointFToSystemPoint(parentObject.GetCanvasOriginPosition()),
                tS, u, no, mag.HasValue ? mag.Value : 1, z, parentObject);
            WzConvexProperty footholds = (WzConvexProperty)parentObject["foothold"];

            if (footholds != null)
            {
                foreach (WzVectorProperty foothold in footholds.WzProperties)
                {
                    result.footholdOffsets.Add(WzInfoTools.VectorToXNAPoint(foothold));
                }
            }
            if (UserSettings.FixFootholdMispositions)
            {
                FixFootholdMispositions(result);
            }
            return(result);
        }