Inheritance: UnityEngine.EventSystems.UIBehaviour, ICanvasElement
Beispiel #1
0
 protected override void Awake()
 {
     if (this.m_TargetGraphic == null)
     {
         this.m_TargetGraphic = base.GetComponent<Graphic>();
     }
 }
Beispiel #2
0
 void Awake()
 {
     if (m_Target == null)
     {
         m_Target = GetComponent <Graphic>();
     }
 }
 /// <summary>
 /// 
 /// <para>
 /// Deregister the given Graphic from a Canvas.
 /// </para>
 /// 
 /// </summary>
 /// <param name="c">Canvas.</param><param name="graphic">Graphic to deregister.</param>
 public static void UnregisterGraphicForCanvas(Canvas c, Graphic graphic)
 {
   IndexedSet<Graphic> indexedSet;
   if ((Object) c == (Object) null || !GraphicRegistry.instance.m_Graphics.TryGetValue(c, out indexedSet))
     return;
   indexedSet.Remove(graphic);
 }
Beispiel #4
0
        public void SetEffectComponentToAllChildGraphics(Transform target)
        {
            List <UnityEngine.UI.Graphic> graphics = ListPool <UnityEngine.UI.Graphic> .Get();

            try
            {
                GetComponentsInChildren(true, graphics);

                for (int i = 0, count = graphics.Count; i < count; ++i)
                {
                    UnityEngine.UI.Graphic g = graphics[i];

                    if (g.GetComponent <EffectComponent>() == null)
                    {
                        EffectComponent effect;
#if !UNITY_EDITOR
                        effect = g.gameObject.AddComponent <EffectComponent>();
#else
                        effect = Undo.AddComponent <EffectComponent>(g.gameObject);
#endif
                        effect.SetParent(this);
                        effect.SetDirty(false);
                    }
                }
            }
            finally
            {
                ListPool <UnityEngine.UI.Graphic> .Release(graphics);
            }
        }
        /// <summary>Tweens an Graphic's alpha color to the given value.
        /// Also stores the image as the tween's target so it can be used for filtered operations</summary>
        /// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
        public static TweenerCore <Color, Color, ColorOptions> DOFade(this UnityEngine.UI.Graphic target, float endValue, float duration)
        {
            TweenerCore <Color, Color, ColorOptions> t = DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration);

            t.SetTarget(target);
            return(t);
        }
Beispiel #6
0
        /// <summary>
        /// 快速设置图片的内容
        /// </summary>
        /// <param name="image"></param>
        /// <param name="graph"></param>
        public static void SetPictureOrLoadColor(Data.ImgNode image, UnityEngine.UI.Graphic graph)
        {
            graph.color = image.color;
            switch (image.type)
            {
            case ImgType.Image:
                ((UnityEngine.UI.Image)graph).sprite = image.sprite;
                break;

            case ImgType.Texture:
                ((UnityEngine.UI.RawImage)graph).texture = image.texture;
                break;

            case ImgType.Label:
                var myText = (UnityEngine.UI.Text)graph;
                myText.text     = image.text;
                myText.fontSize = image.fontSize;
                break;

            case ImgType.AtlasImage:
                ((UnityEngine.UI.Image)graph).sprite = image.sprite;
                break;

            default:
                break;
            }
        }
Beispiel #7
0
 public static void SetAlpha(UnityEngine.UI.Graphic graphic, float alpha)
 {
     if (graphic.color.a != alpha)
     {
         graphic.color = new Color(graphic.color.r, graphic.color.g, graphic.color.b, alpha);
     }
 }
Beispiel #8
0
		protected override void Start() {

			base.Start();

			this.targetGraphic = this.GetComponent<Graphic>();

		}
 protected override void ApplyStyle(Graphic graphic)
 {
     if (ElementData != null)
     {
         graphic.color = ElementData.Color;
     }
 }
Beispiel #10
0
		public virtual void Apply(Graphic element)
		{
			element.color = element is Text ? fontColor : color;
			pb_Reflection.SetValue(element, "font", font);
			pb_Reflection.SetValue(element, "image", image);
			pb_Reflection.SetValue(element, "sprite", sprite);
		}
Beispiel #11
0
 private void GraphicComponentCreated(UnityEngine.UI.Graphic c, JSON.Object obj)
 {
     if (obj.ContainsKey("fadeIn"))
     {
         c.canvasRenderer.SetAlpha(0f);
         c.CrossFadeAlpha(1f, obj.GetFloat("fadeIn", 0), true);
     }
 }
        void Update()
        {
            if (Graphic == null)
                Graphic = GetComponent<Graphic>();

            if (Graphic != null)
                ApplyStyle(Graphic);
        }
 /// <summary>
 /// <para>Deregister the given Graphic from a Canvas.</para>
 /// </summary>
 /// <param name="c">Canvas.</param>
 /// <param name="graphic">Graphic to deregister.</param>
 public static void UnregisterGraphicForCanvas(Canvas c, Graphic graphic)
 {
     IndexedSet<Graphic> set;
     if ((c != null) && instance.m_Graphics.TryGetValue(c, out set))
     {
         set.Remove(graphic);
     }
 }
        IEnumerator FadeOutMask(Graphic g)
        {
            g.CrossFadeAlpha(0f, fadeDuration, true);

            yield return new WaitForSeconds(fadeDuration);

            g.gameObject.SetActive(false);
        }
Beispiel #15
0
 //エフェクト用の色が変化したとき
 internal virtual void OnEffectColorsChange(AdvEffectColor color)
 {
     UnityEngine.UI.Graphic graphic = GetComponent <UnityEngine.UI.Graphic>();
     if (graphic != null)
     {
         graphic.color = color.MulColor;
     }
 }
 /// <summary>
 /// Refresh Gradient Color on playing.
 /// </summary>
 public void Refresh ()
 {
     if (graphic == null) {
         graphic = GetComponent<Graphic> ();
     }
     if (graphic != null) {
         graphic.SetVerticesDirty ();
     }
 }
Beispiel #17
0
        // Update is called once per frame
        void Update() {
            if (target == null)
                return;

            if (_self == null)
                _self = GetComponent<Graphic>();

            _self.color = target.color;
        }
Beispiel #18
0
        public static void EnableGray(UnityEngine.UI.Graphic Master, bool Enabled)
        {
            if (Master == null)
            {
                return;
            }

            Master.material = Enabled ? GrayMaterial_ : null;
        }
 /// <summary>
 /// 
 /// <para>
 /// Track a Graphic.
 /// </para>
 /// 
 /// </summary>
 /// <param name="g"/>
 public static void TrackGraphic(Graphic g)
 {
   if (!GraphicRebuildTracker.s_Initialized)
   {
     CanvasRenderer.onRequestRebuild += new CanvasRenderer.OnRequestRebuild(GraphicRebuildTracker.OnRebuildRequested);
     GraphicRebuildTracker.s_Initialized = true;
   }
   GraphicRebuildTracker.m_Tracked.AddUnique(g);
 }
        public static void TrackGraphic(Graphic g)
        {
            if (!s_Initialized)
            {
                CanvasRenderer.onRequestRebuild += OnRebuildRequested;
                s_Initialized = true;
            }

            m_Tracked.Add(g);
        }
Beispiel #21
0
 void Start()
 {
     if (!_Started)
     {
         _Started = true;
         if (target == null) target = transform;
         gfx = target.GetComponent<Graphic>();
         _Col = gfx.color;
     }
 }
Beispiel #22
0
	    private void CacheUIRenderers()
		{
	        if (IsUseCanvasGroup())
	            InitCanvasGroup();
	        else
	        {
	            _graphic = GetComponent<Graphic>();
                _startAlpha = _graphic.color.a;
	        }
		}
 public static IEnumerator BlinkUICoroutine(Graphic graphic, int times = 3, float speed = .03f)
 {
     for (var i = 0; i < times; i++)
     {
         graphic.enabled = false;
         yield return new WaitForSeconds(speed);
         graphic.enabled = true;
         yield return new WaitForSeconds(speed);
     }
 }
 public void SetCharacterData(CharacterMatchData data)
 {
     if (data == null)
         return;
     PlayerNumber = data.PlayerNumber;
     if (_graphic == null)
         _graphic = GetComponent<Graphic>();
     if (_graphic)
         _graphic.color = AdjustedColor;
 }
Beispiel #25
0
        public static void UnregisterGraphicForCanvas(Canvas c, Graphic graphic)
        {
            if (c == null)
                return;

            IndexedSet<Graphic> graphics;
            if (instance.m_Graphics.TryGetValue(c, out graphics))
            {
                graphics.Remove(graphic);
            }
        }
        /// <summary>Tweens a Graphic's color to the given value,
        /// in a way that allows other DOBlendableColor tweens to work together on the same target,
        /// instead than fight each other as multiple DOColor would do.
        /// Also stores the Graphic as the tween's target so it can be used for filtered operations</summary>
        /// <param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
        public static Tweener DOBlendableColor(this UnityEngine.UI.Graphic target, Color endValue, float duration)
        {
            endValue = endValue - target.color;
            Color to = new Color(0, 0, 0, 0);

            return(DOTween.To(() => to, x => {
                Color diff = x - to;
                to = x;
                target.color += diff;
            }, endValue, duration)
                   .Blendable().SetTarget(target));
        }
 protected void Start()
 {
     UnityEngine.UI.Graphic graphic = GetComponent <Graphic>();
     if (graphic)
     {
         _material = graphic.material;
         if (string.IsNullOrEmpty(property) == false)
         {
             _propertyInt = Shader.PropertyToID(property);
         }
     }
 }
Beispiel #28
0
 /**
  * Sets the alpha value
  */
 public void SetGraphicOpacity(Graphic graphic, float newOpacity)
 {
     if(graphic != null)
     {
         graphic.color = new Color(
             graphic.color.r,
             graphic.color.g,
             graphic.color.b,
             newOpacity
         );
     }
 }
Beispiel #29
0
        public static IEnumerator ShowUI(UnityEngine.UI.Graphic ui, float time, float targetAlpha = 1)
        {
            var color = ui.color;

            color.a = 0;
            ui.gameObject.SetActive(true);
            foreach (var t in TimerNormalized(time))
            {
                color.a  = t * targetAlpha;
                ui.color = color;
                yield return(null);
            }
        }
Beispiel #30
0
        protected override void ApplyStyle(Graphic graphic)
        {
            var text = graphic as Text;

            if (text != null && TextData != null)
            {
                text.fontSize = TextData.TextSize;
                text.lineSpacing = TextData.LineSpacing;

                if (TextData.Color != null)
                    text.color = TextData.Color.Color;
            }
        }
Beispiel #31
0
    public static void CrossFadeAlphaFixed(this UnityEngine.UI.Graphic img, float alpha, float duration, bool ignoreTimeScale)
    {
        //Make the alpha 1
        Color fixedColor = img.color;

        fixedColor.a = 1;
        img.color    = fixedColor;

        //Set the 0 to zero then duration to 0
        img.CrossFadeAlpha(0f, 0f, true);

        //Finally perform CrossFadeAlpha
        img.CrossFadeAlpha(alpha, duration, ignoreTimeScale);
    }
        public static void TrackGraphic(Graphic g)
        {
            if (!s_Initialized)
            {
                CanvasRenderer.onRequestRebuild += OnRebuildRequested;
                s_Initialized = true;
            }

            for (int i = 0; i < m_Tracked.Count; i++)
            {
                if (m_Tracked[i] == g)
                    return;
            }
            m_Tracked.Add(g);
        }
 static public int SetColor24_(IntPtr l)
 {
     try
     {
         UnityEngine.UI.Graphic self = (UnityEngine.UI.Graphic)checkSelf(l);
         int i;
         checkType(l, 2, out i);
         self.color = ColorUtil.ColorToC3B(i);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e)
     {
         return(error(l, e));
     }
 }
Beispiel #34
0
        public static IEnumerator HideUI(UnityEngine.UI.Graphic ui, float time, bool deactive = false)
        {
            var color = ui.color;

            color.a = 1;
            foreach (var t in TimerNormalized(time))
            {
                color.a  = 1 - t;
                ui.color = color;
                yield return(null);
            }

            if (deactive)
            {
                ui.gameObject.SetActive(false);
            }
        }
 /// <summary>
 /// 
 /// <para>
 /// Store a link between the given canvas and graphic in the registry.
 /// </para>
 /// 
 /// </summary>
 /// <param name="c">Canvas to register.</param><param name="graphic">Graphic to register.</param>
 public static void RegisterGraphicForCanvas(Canvas c, Graphic graphic)
 {
   if ((Object) c == (Object) null)
     return;
   IndexedSet<Graphic> indexedSet;
   GraphicRegistry.instance.m_Graphics.TryGetValue(c, out indexedSet);
   if (indexedSet != null)
   {
     indexedSet.AddUnique(graphic);
   }
   else
   {
     indexedSet = new IndexedSet<Graphic>();
     indexedSet.Add(graphic);
     GraphicRegistry.instance.m_Graphics.Add(c, indexedSet);
   }
 }
Beispiel #36
0
        public static void RegisterGraphicForCanvas(Canvas c, Graphic graphic)
        {
            if (c == null)
                return;

            List<Graphic> graphics;
            instance.m_Graphics.TryGetValue(c, out graphics);

            if (graphics != null)
            {
                if (!graphics.Contains(graphic))
                    graphics.Add(graphic);
                return;
            }

            graphics = new List<Graphic> {graphic};
            instance.m_Graphics.Add(c, graphics);
        }
        // -------------------
        public void ExecuteAction(ActionType action)
        {
            UnityEngine.UI.Graphic
                targetGr = this.GetActionGraphic(action);


            // Play a sound effect...

            if ((action == ActionType.LEFT_STAB) || (action == ActionType.RIGHT_STAB))
            {
                this.PlaySound(this.soundStab);
            }

            else if ((action == ActionType.DODGE_LEFT) || (action == ActionType.DODGE_RIGHT))
            {
                this.PlaySound(this.soundDodge);
            }

            else
            {
                this.PlaySound(this.soundSlash);
            }

            // Play animation...

            if (this.animator != null)
            {
                this.SetActionTriggerState(action);
            }


            // Show and fade out graphic...

            if (targetGr != null)
            {
                Color c = targetGr.color;
                c.a            = 1.0f;
                targetGr.color = c;

                targetGr.CrossFadeAlpha(1, 0, true);
                targetGr.CrossFadeAlpha(0, this.fadeDur, true);
            }
        }
 /// <summary>
 /// <para>Store a link between the given canvas and graphic in the registry.</para>
 /// </summary>
 /// <param name="c">Canvas to register.</param>
 /// <param name="graphic">Graphic to register.</param>
 public static void RegisterGraphicForCanvas(Canvas c, Graphic graphic)
 {
     if (c != null)
     {
         IndexedSet<Graphic> set;
         instance.m_Graphics.TryGetValue(c, out set);
         if (set != null)
         {
             set.AddUnique(graphic);
         }
         else
         {
             set = new IndexedSet<Graphic> {
                 graphic
             };
             instance.m_Graphics.Add(c, set);
         }
     }
 }
Beispiel #39
0
        public static void RegisterGraphicForCanvas(Canvas c, Graphic graphic)
        {
            if (c == null)
                return;

            IndexedSet<Graphic> graphics;
            instance.m_Graphics.TryGetValue(c, out graphics);

            if (graphics != null)
            {
                graphics.AddUnique(graphic);
                return;
            }

            // Dont need to AddUnique as we know its the only item in the list
            graphics = new IndexedSet<Graphic>();
            graphics.Add(graphic);
            instance.m_Graphics.Add(c, graphics);
        }
 static public int CrossFadeColor(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 5)
         {
             UnityEngine.UI.Graphic self = (UnityEngine.UI.Graphic)checkSelf(l);
             UnityEngine.Color      a1;
             checkType(l, 2, out a1);
             System.Single a2;
             checkType(l, 3, out a2);
             System.Boolean a3;
             checkType(l, 4, out a3);
             System.Boolean a4;
             checkType(l, 5, out a4);
             self.CrossFadeColor(a1, a2, a3, a4);
             return(0);
         }
         else if (argc == 6)
         {
             UnityEngine.UI.Graphic self = (UnityEngine.UI.Graphic)checkSelf(l);
             UnityEngine.Color      a1;
             checkType(l, 2, out a1);
             System.Single a2;
             checkType(l, 3, out a2);
             System.Boolean a3;
             checkType(l, 4, out a3);
             System.Boolean a4;
             checkType(l, 5, out a4);
             System.Boolean a5;
             checkType(l, 6, out a5);
             self.CrossFadeColor(a1, a2, a3, a4, a5);
             return(0);
         }
         return(error(l, "No matched override function to call"));
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
    static int CrossFadeColor(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("UnityEngine.UI.Graphic.Register");
#endif
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 5)
            {
                UnityEngine.UI.Graphic obj  = (UnityEngine.UI.Graphic)ToLua.CheckObject <UnityEngine.UI.Graphic>(L, 1);
                UnityEngine.Color      arg0 = ToLua.ToColor(L, 2);
                float arg1 = (float)LuaDLL.luaL_checknumber(L, 3);
                bool  arg2 = LuaDLL.luaL_checkboolean(L, 4);
                bool  arg3 = LuaDLL.luaL_checkboolean(L, 5);
                obj.CrossFadeColor(arg0, arg1, arg2, arg3);
                return(0);
            }
            else if (count == 6)
            {
                UnityEngine.UI.Graphic obj  = (UnityEngine.UI.Graphic)ToLua.CheckObject <UnityEngine.UI.Graphic>(L, 1);
                UnityEngine.Color      arg0 = ToLua.ToColor(L, 2);
                float arg1 = (float)LuaDLL.luaL_checknumber(L, 3);
                bool  arg2 = LuaDLL.luaL_checkboolean(L, 4);
                bool  arg3 = LuaDLL.luaL_checkboolean(L, 5);
                bool  arg4 = LuaDLL.luaL_checkboolean(L, 6);
                obj.CrossFadeColor(arg0, arg1, arg2, arg3, arg4);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.UI.Graphic.CrossFadeColor"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
 static public int CrossFadeColor__Color__Single__Boolean__Boolean__Boolean(IntPtr l)
 {
     try {
         UnityEngine.UI.Graphic self = (UnityEngine.UI.Graphic)checkSelf(l);
         UnityEngine.Color      a1;
         checkType(l, 2, out a1);
         System.Single a2;
         checkType(l, 3, out a2);
         System.Boolean a3;
         checkType(l, 4, out a3);
         System.Boolean a4;
         checkType(l, 5, out a4);
         System.Boolean a5;
         checkType(l, 6, out a5);
         self.CrossFadeColor(a1, a2, a3, a4, a5);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #43
0
    static int DOBlendableColor(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(UnityEngine.UI.Text), typeof(LuaTable), typeof(float)))
        {
            UnityEngine.UI.Text arg0 = (UnityEngine.UI.Text)LuaScriptMgr.GetLuaObject(L, 1);
            Color arg1            = LuaScriptMgr.GetColor(L, 2);
            float arg2            = (float)LuaDLL.lua_tonumber(L, 3);
            DG.Tweening.Tweener o = DG.Tweening.ShortcutExtensions46.DOBlendableColor(arg0, arg1, arg2);
            LuaScriptMgr.PushObject(L, o);
            return(1);
        }
        else if (count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(UnityEngine.UI.Image), typeof(LuaTable), typeof(float)))
        {
            UnityEngine.UI.Image arg0 = (UnityEngine.UI.Image)LuaScriptMgr.GetLuaObject(L, 1);
            Color arg1            = LuaScriptMgr.GetColor(L, 2);
            float arg2            = (float)LuaDLL.lua_tonumber(L, 3);
            DG.Tweening.Tweener o = DG.Tweening.ShortcutExtensions46.DOBlendableColor(arg0, arg1, arg2);
            LuaScriptMgr.PushObject(L, o);
            return(1);
        }
        else if (count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(UnityEngine.UI.Graphic), typeof(LuaTable), typeof(float)))
        {
            UnityEngine.UI.Graphic arg0 = (UnityEngine.UI.Graphic)LuaScriptMgr.GetLuaObject(L, 1);
            Color arg1            = LuaScriptMgr.GetColor(L, 2);
            float arg2            = (float)LuaDLL.lua_tonumber(L, 3);
            DG.Tweening.Tweener o = DG.Tweening.ShortcutExtensions46.DOBlendableColor(arg0, arg1, arg2);
            LuaScriptMgr.PushObject(L, o);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: DG.Tweening.ShortcutExtensions46.DOBlendableColor");
        }

        return(0);
    }
Beispiel #44
0
    static int UnregisterDirtyMaterialCallback(IntPtr L)
    {
        L.ChkArgsCount(2);
        UnityEngine.UI.Graphic         obj  = (UnityEngine.UI.Graphic)L.ChkUnityObjectSelf(1, "UnityEngine.UI.Graphic");
        UnityEngine.Events.UnityAction arg0 = null;
        LuaTypes funcType2 = L.Type(2);

        if (funcType2 != LuaTypes.LUA_TFUNCTION)
        {
            arg0 = (UnityEngine.Events.UnityAction)L.ChkUserData(2, typeof(UnityEngine.Events.UnityAction));
        }
        else
        {
            LuaFunction func = L.ChkLuaFunction(2);
            arg0 = () =>
            {
                func.Call();
            };
        }

        obj.UnregisterDirtyMaterialCallback(arg0);
        return(0);
    }
    static int UnregisterDirtyMaterialCallback(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        UnityEngine.UI.Graphic         obj  = (UnityEngine.UI.Graphic)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UnityEngine.UI.Graphic");
        UnityEngine.Events.UnityAction arg0 = null;
        LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

        if (funcType2 != LuaTypes.LUA_TFUNCTION)
        {
            arg0 = (UnityEngine.Events.UnityAction)LuaScriptMgr.GetNetObject(L, 2, typeof(UnityEngine.Events.UnityAction));
        }
        else
        {
            LuaFunction func = LuaScriptMgr.GetLuaFunction(L, 2);
            arg0 = () =>
            {
                func.Call();
            };
        }

        obj.UnregisterDirtyMaterialCallback(arg0);
        return(0);
    }
    static int get_color(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name color");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index color on a nil value");
            }
        }

        LuaScriptMgr.Push(L, obj.color);
        return(1);
    }
Beispiel #47
0
    static int get_raycastTarget(IntPtr L)
    {
        object o = L.ToUserData(1);

        UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o;

        if (obj == null)
        {
            LuaTypes types = L.Type(1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name raycastTarget");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index raycastTarget on a nil value");
            }
        }

        L.PushBoolean(obj.raycastTarget);
        return(1);
    }
Beispiel #48
0
    static int get_rectTransform(IntPtr L)
    {
        object o = L.ToUserData(1);

        UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o;

        if (obj == null)
        {
            LuaTypes types = L.Type(1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name rectTransform");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index rectTransform on a nil value");
            }
        }

        L.PushLightUserData(obj.rectTransform);
        return(1);
    }
Beispiel #49
0
    static int get_color(IntPtr L)
    {
        object o = L.ToUserData(1);

        UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o;

        if (obj == null)
        {
            LuaTypes types = L.Type(1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name color");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index color on a nil value");
            }
        }

        L.PushUData(obj.color);
        return(1);
    }
Beispiel #50
0
    static int get_materialForRendering(IntPtr L)
    {
        object o = L.ToUserData(1);

        UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o;

        if (obj == null)
        {
            LuaTypes types = L.Type(1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name materialForRendering");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index materialForRendering on a nil value");
            }
        }

        L.PushLightUserData(obj.materialForRendering);
        return(1);
    }
    static int set_raycastTarget(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name raycastTarget");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index raycastTarget on a nil value");
            }
        }

        obj.raycastTarget = LuaScriptMgr.GetBoolean(L, 3);
        return(0);
    }
    static int set_material(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        UnityEngine.UI.Graphic obj = (UnityEngine.UI.Graphic)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name material");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index material on a nil value");
            }
        }

        obj.material = (Material)LuaScriptMgr.GetUnityObject(L, 3, typeof(Material));
        return(0);
    }
Beispiel #53
0
    static int CrossFadeColor(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 5 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.UI.Graphic), typeof(UnityEngine.Color), typeof(float), typeof(bool), typeof(bool)))
            {
                UnityEngine.UI.Graphic obj  = (UnityEngine.UI.Graphic)ToLua.ToObject(L, 1);
                UnityEngine.Color      arg0 = ToLua.ToColor(L, 2);
                float arg1 = (float)LuaDLL.lua_tonumber(L, 3);
                bool  arg2 = LuaDLL.lua_toboolean(L, 4);
                bool  arg3 = LuaDLL.lua_toboolean(L, 5);
                obj.CrossFadeColor(arg0, arg1, arg2, arg3);
                return(0);
            }
            else if (count == 6 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.UI.Graphic), typeof(UnityEngine.Color), typeof(float), typeof(bool), typeof(bool), typeof(bool)))
            {
                UnityEngine.UI.Graphic obj  = (UnityEngine.UI.Graphic)ToLua.ToObject(L, 1);
                UnityEngine.Color      arg0 = ToLua.ToColor(L, 2);
                float arg1 = (float)LuaDLL.lua_tonumber(L, 3);
                bool  arg2 = LuaDLL.lua_toboolean(L, 4);
                bool  arg3 = LuaDLL.lua_toboolean(L, 5);
                bool  arg4 = LuaDLL.lua_toboolean(L, 6);
                obj.CrossFadeColor(arg0, arg1, arg2, arg3, arg4);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.UI.Graphic.CrossFadeColor"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Beispiel #54
0
 static public int CrossFadeAlpha(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.UI.Graphic self = (UnityEngine.UI.Graphic)checkSelf(l);
         System.Single          a1;
         checkType(l, 2, out a1);
         System.Single a2;
         checkType(l, 3, out a2);
         System.Boolean a3;
         checkType(l, 4, out a3);
         self.CrossFadeAlpha(a1, a2, a3);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
		protected void Awake()
		{
			// Check if the text component is set
			if (this.targetGraphic == null)
				this.targetGraphic = this.GetComponent<Graphic>();
		}
        /// <summary>
        /// Starts a color tween.
        /// </summary>
        /// <param name="target">Target.</param>
        /// <param name="targetColor">Target color.</param>
        /// <param name="duration">Duration.</param>
        private void StartColorTween(Graphic target, Color targetColor, float duration)
        {
            if (target == null)
                return;

            if (!Application.isPlaying || duration == 0f)
            {
                target.canvasRenderer.SetColor(targetColor);
            }
            else
            {
                target.CrossFadeColor(targetColor, duration, true, true);
            }
        }
 public UnityUIQTEControls(Graphic[] qteIndicators)
 {
     this.qteIndicators = qteIndicators;
 }
 protected abstract void ApplyStyle(Graphic graphic);
 protected override void Reset()
 {
   this.m_TargetGraphic = this.GetComponent<Graphic>();
 }
 protected override void Awake()
 {
   if (!((UnityEngine.Object) this.m_TargetGraphic == (UnityEngine.Object) null))
     return;
   this.m_TargetGraphic = this.GetComponent<Graphic>();
 }