Ejemplo n.º 1
0
        private HUDComponentDrawer GetDrawer(HUDComponent com)
        {
            HUDComponentDrawer drawer = null;

            if (!drawers.TryGetValue(com, out drawer))
            {
                if (com is HUDSprite)
                {
                    drawer = new HUDSpriteDrawer();
                    drawer.Init(new SerializedObject(com as HUDSprite));
                    drawers.Add(com, drawer);
                }
                else if (com is HUDText)
                {
                    drawer = new HUDTextDrawer();
                    drawer.Init(new SerializedObject(com as HUDText));
                    drawers.Add(com, drawer);
                }
                else if (com is HUDProgressBar)
                {
                    drawer = new HUDProgressBarDrawer();
                    drawer.Init(new SerializedObject(com as HUDProgressBar));
                    drawers.Add(com, drawer);
                }
            }

            return(drawer);
        }
Ejemplo n.º 2
0
        public void Init(SerializedObject t)
        {
            taret = t;
            taret.Update();
            var bg = t.FindProperty("background");

            bg_drawer = new HUDSpriteDrawer();
            bg_drawer.Init(new SerializedObject(bg.objectReferenceValue));
            var bar = t.FindProperty("progressbar");

            bar_drawer = new HUDSpriteDrawer();
            s_bar      = new SerializedObject(bar.objectReferenceValue);
            bar_drawer.Init(s_bar);

            SerializedProperty sp = s_bar.FindProperty("sprite");

            value = sp.FindPropertyRelative("progress_value");
        }