Exemple #1
0
        public static void SetObjectsAll(TileData data)
        {
            foreach (var kvp in all)
            {
                IOutlet <object> outlet  = kvp.Key;
                IPreview         preview = kvp.Value;

                preview.SetObject(outlet, data);
            }
        }
        public static void DrawPreview(IOutlet <object> outlet)
        {
            IPreview preview = PreviewManager.GetPreview(outlet);

            if (preview == null)
            {
                preview = PreviewManager.CreatePreview(outlet);
                if (preview == null)
                {
                    return;                                  //for unknown types
                }
                preview.SetObject(outlet, GraphWindow.current.mapMagic?.PreviewData);
            }

            //preview itself
            using (Cell.Full)
            {
                Color backColor = StylesCache.isPro ?
                                  new Color(0.33f, 0.33f, 0.33f, 1) :
                                  new Color(0.4f, 0.4f, 0.4f, 1);
                Draw.Rect(BackgroundColor);                  //background in case no preview, or preview object was not assigned

                if (preview != null)
                {
                    preview.DrawInGraph();
                }
            }

            //clock/na
            if (GraphWindow.current.mapMagic == null)
            {
                using (Cell.Full) Draw.Icon(UI.current.textures.GetTexture("MapMagic/PreviewNA"));
            }
            else if (preview.Stage == PreviewStage.Generating || (preview.Stage == PreviewStage.Blank && GraphWindow.current.mapMagic.IsGenerating()))
            {
                using (Cell.Full) Draw.Icon(UI.current.textures.GetTexture("MapMagic/PreviewSandClock"));
            }
            else if (preview.Stage == PreviewStage.Blank)
            {
                using (Cell.Full) Draw.Icon(UI.current.textures.GetTexture("MapMagic/PreviewNA"));
            }

            //terrain buttons
            if (preview != null)
            {
                using (Cell.Full)
                    TerrainWindowButtons(preview);
            }
        }