コード例 #1
0
        public static FontMapper GetFontMapper(out MapperInfo info)
        {
            FontMapper mapper = null;

            info = MapperInfo.NotFound;
            Object[] fontMappers = Object.FindObjectsOfType(typeof(FontMapper));

            // traverse mappers
            foreach (Object o in fontMappers)
            {
                mapper = (FontMapper)o;
                //if (mapper.Id == CreateFontMapperCommand.FontMapperId)
                if (mapper.Default)
                {
                    if (!mapper.enabled)
                    {
                        info = MapperInfo.MapperNotEnabled;
                        break;
                    }

                    if (null == mapper.Font)
                    {
                        info = MapperInfo.FontNotAttached;
                        break;
                    }

                    info = MapperInfo.Ok;
                    break;
                }
            }
            return(mapper);
        }
コード例 #2
0
        private static void Initialize()
        {
            //_instance.font = FontMapper.IsMapping("pixel") ? FontMapper.Get("pixel") : FontMapper.GetDefault();

            //Debug.Log("LabelStyle initializer");

            _style = new ProgramaticStyle
            {
                Style     = _instance,
                Alignment = TextAnchor.MiddleLeft,
                Padding   = new RectOffset(6, 8, 4, 4),
                Font      = FontMapper.GetWithFallback("pixel").Font
            };

            //_style.Font = CoreSkinMapper.Instance.System.font;
            //_style.Font = FontMapper.GetDefault();

            const int w = (Weight + 1) * 2;

            //_style.FixedWidth = 100;
            //_style.FixedHeight = 100;
            _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);

            //_style.FontSize = 8;
            _style.NormalTextColor = Color.black;
            _style.NormalGraphics  = new Rect(w, w, new Fill(new Color(1, 1, 1, 0)));

            _style.Commit();
        }
コード例 #3
0
        //public const string FontMapperId = "default_font_mapper";

        public void Run()
        {
            GameObject go = GameObjectUtil.CreateGameObjectAtPath(FontMapperPath);

            /**
             * 1. FontMapper
             * */
            FontMapper m = (FontMapper)go.AddComponent(typeof(FontMapper));

            m.Id      = DipSwitches.DefaultFontMapperId;
            m.Default = true; // is the default font at the same time

            EditorUtility.DisplayDialog("Info", string.Format(@"Creating the default font mapper at ""{0}""

Please attach the default font to the font mapper.

Then create the Stage again.", FontMapperPath), "OK");

            EditorGUIUtility.PingObject(m);
            Selection.objects = new Object[] { m };

            /**
             * 3. Re-scan the hierarchy
             * */
            HierarchyViewDecorator.Instance.ReScan();
        }
コード例 #4
0
        //private const int Weight = 2;

        private static void Initialize()
        {
            //_instance.font = FontMapper.IsMapping("pixel") ? FontMapper.Get("pixel") : FontMapper.GetDefault();

            //Debug.Log("LabelStyle initializer");

            _style = new ProgramaticStyle
            {
                Style = _instance,

                // changed from MiddleLeft on 20131006 because of the
                // button skin layout (having label left aligned because of using Left, Right..)
                // should check the AbsoluteLayout why it doesn't take horizonral and vertical align as priority
                //Alignment = TextAnchor.MiddleLeft,
                Alignment = TextAnchor.MiddleLeft,
                //Padding = new RectOffset(6, 6, 4, 4),
                Font = FontMapper.GetWithFallback("pixel").Font,
                //Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1),
                NormalTextColor = Color.white,
                TextClipping    = TextClipping.Clip // clip!
                                                    //TextClipping = TextClipping.Overflow
            };

            _style.Commit();
        }
コード例 #5
0
        private static void Initialize()
        {
            //Debug.Log("FormHeadingStyle initializer");

            _style = new ProgramaticStyle
            {
                Style     = _instance,
                Alignment = TextAnchor.MiddleCenter,
                Padding   = new RectOffset(10, 10, 10, 10),
                Font      = FontMapper.GetDefault().Font,
                Border    = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1),
                //FontSize = 30,
                FontStyle       = FontStyle.Italic,
                NormalTextColor = new Color(1f, 0.7f, 0f, 1)
            };

            //_style.Font = CoreSkinMapper.Instance.System.font;

            //const int w = (Weight + 1)*2;

            //_style.FixedWidth = 100;
            //_style.FixedHeight = 100;

            //_style.NormalGraphics = new Rect(w, w,
            //                                 new Fill(new Color(0.3f, 0.3f, 0.3f, 0.2f))
            //    );

            _style.Commit();
        }
コード例 #6
0
        private static void Initialize()
        {
            //_instance.font = FontMapper.IsMapping("pixel") ? FontMapper.Get("pixel") : FontMapper.GetDefault();

            //Debug.Log("TooltipStyle initializer");

            _style           = new ProgramaticStyle();
            _style.Style     = _instance;
            _style.Alignment = TextAnchor.MiddleLeft;
            _style.Padding   = new RectOffset(6, 6, 4, 4);

            //_style.Font = CoreSkinMapper.Instance.System.font;
            //_style.Font = FontMapper.GetDefault();
            _style.Font = FontMapper.GetWithFallback("pixel").Font;

            const int w = (Weight + 1) * 2;

            //_style.FixedWidth = 100;
            //_style.FixedHeight = 100;
            _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);

            //_style.FontSize = 8;
            _style.NormalTextColor = Color.black;
            _style.NormalGraphics  = new Rect(w, w, new Fill(new Color(0.9f, 0.9f, 0.3f, 1)), new Stroke(1)
            {
                Color = Color.black
            });

            _style.Commit();
        }
コード例 #7
0
        private static void Initialize()
        {
            //Debug.Log("InspectorOverlayLabelStyle initializer");

            _style = new ProgramaticStyle
            {
                Style     = _instance,
                Alignment = TextAnchor.MiddleCenter,
                Padding   = new RectOffset(6, 6, 3, 4),
                Font      = FontMapper.GetWithFallback("pixel").Font
            };

            //_style.Font = FontMapper.GetDefault();
            //Debug.Log("Initialized * " + _style.Font);

            /*if (FontMapper.IsMapping("pixel"))
             *  _style.Font = FontMapper.Get("pixel");*/

            const int w = (Weight + 1) * 2;

            _style.Border          = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);
            _style.NormalTextColor = Color.white;                           // we'll tint it from outside
            _style.NormalGraphics  = new Rect(w, w, new Fill(Color.white)); // we'll tint it from outside

            _style.Commit();
        }
コード例 #8
0
        private static void Initialize()
        {
            //_instance.font = FontMapper.IsMapping("pixel") ? FontMapper.Get("pixel") : FontMapper.GetDefault();

            //Debug.Log("LabelStyle initializer");

            _style = new ProgramaticStyle
            {
                Style     = _instance,
                Alignment = TextAnchor.MiddleLeft,
                Padding   = new RectOffset(7, 7, 7, 7),
                Font      = FontMapper.GetDefault().Font,
                Border    = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1),
                //FontSize = 8,
                NormalTextColor = Color.white             // new Color(0.3f, 0.3f, 0.3f, 1f)
            };

            //_style.Font = CoreSkinMapper.Instance.System.font;
            //_style.Font = FontMapper.GetDefault();

            //const int w = (Weight + 1)*2;

            //_style.FixedWidth = 100;
            //_style.FixedHeight = 100;

            //_style.NormalGraphics = new Rect(w, w, new Fill(new Color(0.3f, 0.4f, 0.9f, 1f)));

            _style.Commit();
        }
コード例 #9
0
        internal static void Check()
        {
            MapperInfo info;

            //SceneInitializer.Init();

            FontMapper mapper = SceneInitializer.GetFontMapper(out info);

            if (!mapper)
            {
                EditorSettings.InspectorEnabled = false;
                EditorUtility.DisplayDialog("eDriven.Gui Info", @"Inspector overlay needs a default font for drawing, but no default font mapper found in the scene.

Inspector overlay will be disabled until the mapper is created in the scene.", "OK");

                EditorSettings.InspectorEnabled = false;
                return;
            }

            if (null == mapper.Font)
            {
                Selection.activeGameObject = mapper.gameObject;
                EditorGUIUtility.PingObject(mapper);

                EditorSettings.InspectorEnabled = false;
                EditorUtility.DisplayDialog("eDriven.Gui Info", string.Format(@"Inspector overlay needs a default font for drawing.

The default mapper has been found, but with no font attached.

Inspector overlay will be disabled until the font is attached."), "OK");
                //The mapper ""{0}"" has been found, but with no font attached. // , CreateFontMapperCommand.FontMapperId

                EditorSettings.InspectorEnabled = false;
            }
        }
コード例 #10
0
        private static void Initialize()
        {
            _instance.name = "CheckBoxStyle";
            _instance.font = FontMapper.GetDefault().Font;

            _style = new ProgramaticStyle
            {
                Font          = FontMapper.GetDefault().Font,
                Style         = _instance,
                Alignment     = TextAnchor.MiddleCenter,
                ContentOffset = new Vector2(-1, -1) // fix bad Unity offset
                                                    //Padding = new RectOffset(6, 6, 3, 3) // no GUIStyle padding
            };

            const int w = (Weight + 1) * 2;

            //_style.FixedWidth = 100;
            //_style.FixedHeight = 100;
            _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);

            //_style.FontSize = 8;
            _style.NormalTextColor = new Color(0.1f, 0.1f, 0.1f, 1);
            _style.NormalGraphics  = new Rect(w, w,
                                              new Fill(Color.white), // RgbColor.FromHex(0xC0C0C0).ToColor()
                                              new Stroke(Weight)
            {
                Color = ColorMixer.FromHex(0x404040).ToColor()
            }
                                              );
            _style.HoverTextColor = new Color(0.1f, 0.1f, 0.1f, 1);
            _style.HoverGraphics  = new Rect(w, w,
                                             new Fill(new Color(1f, 1f, 1f, 1f)),
                                             new Stroke(Weight)
            {
                Color = Color.grey
            }
                                             );
            _style.ActiveTextColor = new Color(0.1f, 0.1f, 0.1f, 1);
            _style.ActiveGraphics  = new Rect(w, w,
                                              new Fill(ColorMixer.FromHex(0x808080).ToColor()),
                                              new Stroke(Weight)
            {
                Color = ColorMixer.FromHex(0xD3D3D3).ToColor()
            }
                                              );

            //_style.OnNormalTextColor = Color.white;
            //_style.OnNormalGraphics = new Rect(w, w,
            //                                   new Fill(RgbColor.FromHex(0x808080).ToColor()),
            //                                   new Stroke(RgbColor.FromHex(0xD3D3D3).ToColor(), Weight)
            //     );

            _style.Commit();

            //_style.FixedHeight = 20;
            //_style.FixedWidth = 100;
        }
コード例 #11
0
        private static void Initialize()
        {
            _instance.name = "PagerButtonStyle";
            _instance.font = FontMapper.GetDefault().Font;

            _style = new ProgramaticStyle
            {
                Font      = FontMapper.GetDefault().Font,
                Style     = _instance,
                Alignment = TextAnchor.MiddleCenter,
                Padding   = new RectOffset(6, 6, 6, 6)
            };

            const int w = (Weight + 1) * 2;

            _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);

            //_style.FontSize = 8;
            _style.NormalTextColor = new Color(0.1f, 0.1f, 0.1f, 1);
            _style.NormalGraphics  = new Rect(w, w,
                                              new Fill(ColorMixer.FromHex(0xC0C0C0).ToColor()),
                                              new Stroke(Weight)
            {
                Color = ColorMixer.FromHex(0x404040).ToColor()
            }
                                              );
            _style.HoverTextColor = new Color(0.1f, 0.1f, 0.1f, 1);
            _style.HoverGraphics  = new Rect(w, w,
                                             new Fill(new Color(1f, 1f, 1f, 1f)),
                                             new Stroke(Weight)
            {
                Color = Color.grey
            }
                                             );
            _style.ActiveTextColor = new Color(0.1f, 0.1f, 0.1f, 1);
            _style.ActiveGraphics  = new Rect(w, w,
                                              new Fill(ColorMixer.FromHex(0x808080).ToColor()),
                                              new Stroke(Weight)
            {
                Color = ColorMixer.FromHex(0xD3D3D3).ToColor()
            }
                                              );

            _style.OnNormalTextColor = Color.white;
            _style.OnNormalGraphics  = new Rect(w, w,
                                                new Fill(ColorMixer.FromHex(0x808080).ToColor()),
                                                new Stroke(Weight)
            {
                Color = ColorMixer.FromHex(0xD3D3D3).ToColor()
            }
                                                );

            _style.FixedHeight = 25;
            _style.FixedWidth  = 25;

            _style.Commit();
        }
コード例 #12
0
        private static void Initialize()
        {
            _instance.name = "TabButtonStyle";
            _instance.font = FontMapper.GetDefault().Font;

            _style = new ProgramaticStyle
            {
                Font      = FontMapper.GetDefault().Font,
                Style     = _instance,
                Alignment = TextAnchor.MiddleCenter,
                Padding   = new RectOffset(6, 6, 3, 3)
            };

            const int w = (Weight + 1) * 2;

            //_style.FixedWidth = 100;
            //_style.FixedHeight = 100;
            _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);

            //_style.FontSize = 8;
            _style.NormalTextColor = Color.black; // Color.white;
            _style.NormalGraphics  = new Rect(w, w,
                                                  //new Fill(RgbColor.FromHex(0x965FFF).ToColor()),
                                              new Fill(ColorMixer.FromHex(0xc0c0c0).ToColor()),
                                              new Stroke(Weight)
            {
                Color = Color.grey
            }
                                              );
            //_style.HoverTextColor = new Color(0.1f, 0.1f, 0.1f, 1);
            //_style.HoverGraphics = new Rect(w, w,
            //                                new Fill(new Color(1f, 1f, 1f, 1f)),
            //                                new Stroke(Color.grey, Weight)
            //    );
            _style.ActiveTextColor = Color.white;
            _style.ActiveGraphics  = new Rect(w, w,
                                              new Fill(ColorMixer.FromHex(0xA97FFF).ToColor()),
                                              new Stroke(Weight)
            {
                Color = Color.grey
            }
                                              );

            //_style.OnNormalTextColor = Color.white;
            //_style.OnNormalGraphics = new Rect(w, w,
            //                                   new Fill(RgbColor.FromHex(0x808080).ToColor()),
            //                                   new Stroke(RgbColor.FromHex(0xD3D3D3).ToColor(), Weight)
            //     );

            //_style.ImagePosition = ImagePosition.ImageAbove;

            _style.ContentOffset = new Vector2(-3, 0);

            _style.Commit();
        }
コード例 #13
0
ファイル: TextAreaStyle.cs プロジェクト: onamoni/edriven-gui
        private static void Initialize()
        {
            _style = new ProgramaticStyle
            {
                Style        = _instance,
                Alignment    = TextAnchor.UpperLeft,
                Padding      = new RectOffset(6, 6, 6, 6),
                WordWrap     = true,
                TextClipping = TextClipping.Clip,
                Font         = FontMapper.GetDefault().Font
            };

            int w = (Weight + 1) * 2;

            //_style.FixedWidth = 100;
            //_style.FixedHeight = 100;
            _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);

            //_style.Font = FontMapper.Get("pixel");
            //_style.FontSize = 8;
            _style.NormalTextColor = Color.black; //Color.grey;
            _style.NormalGraphics  = new Rect(w, w,
                                              new Fill(Color.white),
                                              //new Fill(new Color(0.9f, 0.9f, 0.9f, 1f)),
                                              new Stroke(Weight)
            {
                Color = Color.black
            }
                                              );
            _style.HoverTextColor = Color.black;
            _style.HoverGraphics  = new Rect(w, w,
                                             new Fill(Color.white),
                                             new Stroke(Weight)
            {
                Color = Color.black
            }
                                             );
            _style.ActiveTextColor = Color.black;
            _style.ActiveGraphics  = new Rect(w, w,
                                              new Fill(Color.white),
                                              new Stroke(Weight)
            {
                Color = Color.black
            }
                                              );
            //_style.FocusedGraphics = new Rect(w, w,
            //                                  new Fill(Color.blue),
            //                                  new Stroke(Color.yellow, Weight)
            //    );

            _style.WordWrap  = true;
            _style.Alignment = TextAnchor.UpperLeft;

            _style.Commit();
        }
コード例 #14
0
        private static void Initialize()
        {
            _style = new ProgramaticStyle
            {
                Style     = _instance,
                Alignment = TextAnchor.MiddleLeft,
                Padding   = new RectOffset(10, 10, 4, 4),
                Font      = FontMapper.GetDefault().Font
            };

            //_style.Font = CoreSkinMapper.Instance.System.font;

            const int w = (Weight + 1) * 2;

            //_style.FixedWidth = 100;
            //_style.FixedHeight = 100;
            _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);

            //_style.FontSize = 8;
            _style.NormalTextColor = Color.grey;
            _style.NormalGraphics  = new Rect(w, w,
                                              new Fill(new Color(0.9f, 0.9f, 0.9f, 1f)),
                                              new Stroke(Weight)
            {
                Color = Color.grey
            }
                                              );
            _style.HoverTextColor = Color.black;
            _style.HoverGraphics  = new Rect(w, w,
                                             new Fill(Color.white),
                                             new Stroke(Weight)
            {
                Color = Color.black
            }
                                             );
            _style.ActiveTextColor = Color.black;
            _style.ActiveGraphics  = new Rect(w, w,
                                              new Fill(Color.white),
                                              new Stroke(Weight)
            {
                Color = Color.black
            }
                                              );
            //_style.FocusedGraphics = new Rect(w, w,
            //                                  new Fill(Color.blue),
            //                                  new Stroke(Color.yellow, Weight)
            //    );

            _style.FixedWidth  = 320;
            _style.FixedHeight = 25;

            _style.Commit();
        }
コード例 #15
0
        private static void Initialize()
        {
            _style = new ProgramaticStyle
            {
                Style           = _instance,
                Alignment       = TextAnchor.MiddleCenter,
                Font            = FontMapper.GetWithFallback("pixel").Font,
                NormalTextColor = Color.white,
                TextClipping    = TextClipping.Clip
            };

            _style.Commit();
        }
コード例 #16
0
        private static void Initialize()
        {
            _style = new ProgramaticStyle
            {
                Style           = _instance,
                Alignment       = TextAnchor.MiddleLeft,
                Padding         = new RectOffset(12, 12, 6, 6),
                Font            = FontMapper.Get("olney").Font,
                FontSize        = 40,
                NormalTextColor = Color.white
            };

            _style.Commit();
        }
コード例 #17
0
        ///<summary>
        /// Note: sanity check done outside (in DefaultValuesFactory class)
        ///</summary>
        ///<returns></returns>
        public object GetDefault()
        {
            /* XOR! */
            //if (null == ProxyType ^ !string.IsNullOrEmpty(ProxyMemberName))
            //    throw new Exception("When using proxy, both ProxyType and ProxyMemberName have to be defined: " + GetType());

            try
            {
                /**
                 * 1. Proxy takes precedence
                 * */
                if (null != ProxyType)
                {
                    return(string.IsNullOrEmpty(ProxyMemberName) ?
                           StyleProxyReader.GetProxySingleton(ProxyType) :
                           StyleProxyReader.GetProxyMemberValue(ProxyType, ProxyMemberName));
                }

                /**
                 * 2. Color
                 * */
                if (IsValidColor())
                {
                    return(ColorMixer.FromHexAndAlpha((int)Default, 1f).ToColor());
                }

                /**
                 * 3. Font
                 * */
                if (IsValidFont())
                {
                    var fontMapperId = Default as string;
                    /* Use the font mapper */
                    return(string.IsNullOrEmpty(fontMapperId) ?
                           FontMapper.GetDefault().Font :                  // get default font
                           FontMapper.GetWithFallback(fontMapperId).Font); // get named font
                }

                /**
                 * 3. Default value
                 * */
                return(Default);
            }
            catch (Exception ex)
            {
                throw new Exception("Problem processing style attribute " + Name + ": ", ex);
            }
        }
コード例 #18
0
ファイル: ButtonSkin4.cs プロジェクト: onamoni/edriven-gui
 private GUIStyle GetLabelStyle()
 {
     if (null == _labelStyle)
     {
         _labelStyle = new GUIStyle();
         ProgramaticStyle style = new ProgramaticStyle
         {
             Style           = _labelStyle,
             Alignment       = TextAnchor.MiddleCenter,
             Font            = FontMapper.GetWithFallback("pixel").Font,
             NormalTextColor = Color.white
         };
         style.Commit();
     }
     return(_labelStyle);
 }
コード例 #19
0
        private static void Initialize()
        {
            const int w = (Weight + 1) * 2;

            _style = new ProgramaticStyle
            {
                Style           = _instance,
                Alignment       = TextAnchor.MiddleCenter,
                Padding         = new RectOffset(6, 6, 3, 4),
                Font            = FontMapper.GetWithFallback("pixel").Font,
                Border          = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1),
                NormalTextColor = Color.white,                          // we'll tint it from outside
                NormalGraphics  = new Rect(w, w, new Fill(Color.white)) // we'll tint it from outside
            };

            _style.Commit();
        }
コード例 #20
0
        private static void Initialize()
        {
            _style = new ProgramaticStyle
            {
                Style     = _instance,
                Alignment = TextAnchor.MiddleLeft,
                Padding   = new RectOffset(6, 6, 4, 4),
                Font      = FontMapper.GetWithFallback("pixel").Font
            };

            const int w = (Weight + 1) * 2;

            _style.Border          = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);
            _style.NormalTextColor = Color.white;
            _style.NormalGraphics  = new Rect(w, w, new Fill(ColorMixer.FromHex(0x1261c1).ToColor()));

            _style.Commit();
        }
コード例 #21
0
        private void ProcessFontMappers(int instanceid)
        {
            if (!_fontMapperIds.Contains(instanceid))
            {
                GameObject obj    = (GameObject)EditorUtility.InstanceIDToObject(instanceid);
                FontMapper mapper = obj.GetComponent <FontMapper>();
                if (null != mapper)
                {
#if DEBUG
                    if (DebugMode)
                    {
                        Debug.Log(string.Format("Found eDriven font mapper: {0} [{1}]", mapper, instanceid));
                    }
#endif
                    _fontMapperIds.Add(instanceid);
                }
            }
        }
コード例 #22
0
        private static void Initialize()
        {
            _style = new ProgramaticStyle
            {
                Style        = _instance,
                Alignment    = TextAnchor.MiddleLeft,
                Padding      = new RectOffset(6, 6, 6, 6),
                Font         = FontMapper.GetWithFallback("pixel").Font,
                TextClipping = TextClipping.Clip
            };

            int w = (Weight + 1) * 2;

            _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);

            _style.NormalTextColor = Color.black; //Color.grey;
            _style.NormalGraphics  = new Rect(w, w,
                                              new Fill(Color.white),
                                              new Stroke(Weight)
            {
                Color = Color.black
            }
                                              );
            _style.HoverTextColor = Color.black;
            _style.HoverGraphics  = new Rect(w, w,
                                             new Fill(Color.white),
                                             new Stroke(Weight)
            {
                Color = Color.black
            }
                                             );
            _style.ActiveTextColor = Color.black;
            _style.ActiveGraphics  = new Rect(w, w,
                                              new Fill(Color.white),
                                              new Stroke(Weight)
            {
                Color = Color.black
            }
                                              );

            _style.Commit();
        }
        public void PlayModeStartedSlot(object[] parameters)
        {
#if DEBUG
            if (DebugMode)
            {
                Debug.Log("PlayModeChangeProcessorHandlingDesignerOverlay->PlayModeStartedSlot");
            }
#endif
            //_changesCached = false;

            if (EditorSettings.InspectorEnabled && Application.isEditor && Application.isPlaying /* && null == DesignerOverlay.Instance*/)
            {
                //if (FontMapper.IsMapping(DipSwitches.DefaultFontMapperId))
                if (null != FontMapper.GetDefault())
                {
                    // ReSharper disable once UnusedVariable
                    DesignerOverlay.Attach();
                    //overlay.Font = FontMapper.GetWithFallback(DipSwitches.DefaultFontMapperId).Font; // set font
                }
            }
        }
コード例 #24
0
        private static void Initialize()
        {
            _instance.name = "GreenButtonStyle";
            _instance.font = FontMapper.GetDefault().Font;

            _style = new ProgramaticStyle
            {
                Font      = FontMapper.GetDefault().Font,
                Style     = _instance,
                Alignment = TextAnchor.MiddleCenter,
                Padding   = new RectOffset(6, 6, 3, 3)
            };

            const int w = (Weight + 1) * 2;

            //_style.FixedWidth = 100;
            //_style.FixedHeight = 100;
            _style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);

            //_style.FontSize = 8;
            _style.NormalTextColor = Color.black;
            _style.NormalGraphics  = new Rect(w, w,
                                              new Fill(Green),
                                              new Stroke(Weight)
            {
                Color = Color.black
            }
                                              );

            _style.HoverTextColor = Color.black;
            _style.HoverGraphics  = new Rect(w, w,
                                             new Fill(ColorMixer.FromHex(0x14FF99).ToColor()),
                                             new Stroke(Weight)
            {
                Color = Color.black
            }
                                             );

            _style.Commit();
        }
コード例 #25
0
        private static void Initialize()
        {
            _instance.name = "GroupBackgroundStyle";

            _style = new ProgramaticStyle
            {
                Style     = _instance,
                Alignment = TextAnchor.MiddleCenter,
                Font      = FontMapper.GetDefault().Font
            };

            const int w = (Weight + 1) * 2;

            _style.Border  = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);
            _style.Padding = new RectOffset(2, 2, 2, 2);

            //_style.FontSize = 8;
            _style.NormalTextColor = new Color(0.85f, 0.85f, 0.85f, 1);
            _style.NormalGraphics  = new Rect(w, w, new Fill(new Color(1, 1, 1, 1)) /*, new Stroke(Color.grey, Weight)*/);

            _style.Commit();
        }
コード例 #26
0
        private static void Initialize()
        {
            _style = new ProgramaticStyle
            {
                Style     = _instance,
                Alignment = TextAnchor.MiddleCenter,
                Font      = FontMapper.GetDefault().Font
            };

            const int w = (Weight + 1) * 2;

            _style.Border  = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);
            _style.Padding = new RectOffset(2, 2, 2, 2);

            //_style.FontSize = 8;
            _style.NormalTextColor = Color.white;
            _style.NormalGraphics  = new Rect(w, w, new Fill(new Color(0.2f, 0.2f, 0.2f, 0.75f)));

            //_style.TextClipping = TextClipping.Overflow;
            _style.WordWrap = true;

            _style.Commit();
        }
コード例 #27
0
 /**
  * Constructor for PDFGraphics2D.
  *
  */
 PdfGraphics2D(PdfContentByte cb, float width, float height, FontMapper fontMapper)
 {
     super();
     this.transform  = new AffineTransform();
     this.baseFonts  = new HashMap();
     this.fontMapper = fontMapper;
     this.kids       = new ArrayList();
     if (this.fontMapper == null)
     {
         this.fontMapper = new DefaultFontMapper();
     }
     paint      = Color.black;
     background = Color.white;
     setFont(new Font("sanserif", Font.PLAIN, 12));
     stroke  = new BasicStroke(1);
     this.cb = cb;
     cb.saveState();
     this.width  = width;
     this.height = height;
     clip        = new Area(new Rectangle2D.Float(0, 0, width, height));
     clip(clip);
     cb.saveState();
 }
コード例 #28
0
        private static void Initialize()
        {
            _instance.name = "ButtonSingleStateStyle";
            _instance.font = FontMapper.GetDefault().Font;

            _style = new ProgramaticStyle
            {
                Font          = FontMapper.GetDefault().Font,
                Style         = _instance,
                Alignment     = TextAnchor.MiddleCenter,
                ContentOffset = new Vector2(-1, -1)              // fix bad Unity offset
            };

            const int w = (Weight + 1) * 2;

            _style.Border         = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);
            _style.NormalGraphics = new Rect(w, w,
                                             new Fill(Color.white),
                                             new Stroke(Weight)
            {
                Color = ColorMixer.FromHex(0x404040).ToColor()
            });
            _style.Commit();
        }
コード例 #29
0
        private static void Initialize()
        {
            //Debug.Log("FormItemLabelStyle initializer");

            _style = new ProgramaticStyle
            {
                Style     = _instance,
                Alignment = TextAnchor.MiddleLeft,
                Padding   = new RectOffset(4, 4, 7, 4),
                Font      = FontMapper.GetDefault().Font,
                //FontSize = 8,
                NormalTextColor = new Color(0.2f, 0.2f, 0.2f, 1)
            };

            //_style.Font = CoreSkinMapper.Instance.System.font;

            //const int w = (Weight + 1)*2;

            //_style.FixedWidth = 100;
            //_style.FixedHeight = 100;
            //_style.Border = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1);

            _style.Commit();
        }
コード例 #30
0
ファイル: ImageStyle.cs プロジェクト: iwaken71/ActivityGame
        private static void Initialize()
        {
            //_instance.font = FontMapper.IsMapping("pixel") ? FontMapper.Get("pixel") : FontMapper.GetDefault();

            //Debug.Log("ImageStyle initializer");

            const int w = (Weight + 1) * 2;

            _style = new ProgramaticStyle
            {
                Style          = _instance,
                Alignment      = TextAnchor.MiddleLeft,
                Padding        = new RectOffset(Weight, Weight, Weight, Weight),
                Margin         = new RectOffset(0, 0, 0, 0),
                Font           = FontMapper.GetWithFallback("pixel").Font,
                Border         = new RectOffset(Weight + 1, Weight + 1, Weight + 1, Weight + 1),
                NormalGraphics = new Rect(w, w,
                                          new Fill(ColorMixer.FromHex(0xC0C0C0).ToColor()),
                                          new Stroke(Weight)
                {
                    Color = ColorMixer.FromHex(0x404040).ToColor()
                }
                                          )
            };
            //_style.Font = CoreSkinMapper.Instance.System.font;
            //_style.Font = FontMapper.GetDefault();


            //_style.FixedWidth = 100;
            //_style.FixedHeight = 100;

            //_style.FontSize = 8;
            //_style.NormalTextColor = Color.white;

            _style.Commit();
        }