Exemple #1
0
    public static void PlayTweenScaleReverse(GameObject go)
    {
        TweenScale ts = MonoExtendUtil.GetOrAddComponent <TweenScale>(go);

        ts.enabled = true;
        ts.PlayReverse();
    }
Exemple #2
0
    /// <summary>
    /// 停止牌桌倒计时
    /// </summary>
    /// <param name="go">Go.</param>
    /// <param name="str">String.</param>
    public static void StopLabelCount(GameObject go, string str)
    {
        LabelCount lc = MonoExtendUtil.GetOrAddComponent <LabelCount>(go);

        lc.label.text = str;
        lc.enabled    = false;
    }
Exemple #3
0
    public static void ChangeTextureName(GameObject go, string name)
    {
        UITexture ut = MonoExtendUtil.GetOrAddComponent <UITexture>(go);

        Debugger.Log(name);
        Debugger.Log(ut.mainTexture);
        // ut.name= name;
    }
Exemple #4
0
    public static void PlayTweenScale(GameObject go)
    {
        TweenScale tp = MonoExtendUtil.GetOrAddComponent <TweenScale>(go);

        tp.ResetToBeginning();
        tp.enabled = true;
        tp.Play();
    }
Exemple #5
0
    /// <summary>
    /// 牌桌倒计时
    /// </summary>
    /// <param name="go">Go.</param>
    /// <param name="start">开始Date.</param>
    /// <param name="stop">结束Date.</param>
    /// <param name="speed">间隔速度.</param>
    public static void SetCountLabelTime(GameObject go, int start, int stop, int speed)
    {
        LabelCount lc = MonoExtendUtil.GetOrAddComponent <LabelCount>(go);

        lc.enabled   = false;
        lc.startTime = start;
        lc.stopTime  = stop;
        lc.speed     = speed;
        lc.enabled   = true;
    }
Exemple #6
0
    public static void SetUILabelTextLength(GameObject go, string text, int value)
    {
        if (go == null)
        {
            return;
        }
        UILabel uiLable = MonoExtendUtil.GetOrAddComponent <UILabel>(go);

        uiLable.text = text.PadLeft(value, '0');
    }
Exemple #7
0
    public static void SetUILabelText(GameObject go, string text)
    {
        if (go == null)
        {
            return;
        }
        UILabel uiLable = MonoExtendUtil.GetOrAddComponent <UILabel>(go);

        uiLable.text = text;
    }
Exemple #8
0
    /// <summary>
    /// 更改UISprite图片名称
    /// </summary>
    /// <param name="go">Go.</param>
    public static void ChangeSpriteName(GameObject go, string name)
    {
        UISprite us = MonoExtendUtil.GetOrAddComponent <UISprite>(go);

        us.spriteName = name;
        UIButton bt = go.GetComponent <UIButton>();

        if (bt != null)
        {
            bt.normalSprite = name;
        }
    }
Exemple #9
0
    public static void PlayTweenScale(GameObject go, Vector3 vFrom, Vector3 vTo, float time1, float time2)
    {
        TweenScale ts = MonoExtendUtil.GetOrAddComponent <TweenScale>(go);

        ts.from     = vFrom;
        ts.to       = vTo;
        ts.duration = time1;
        ts.delay    = time2;
        ts.style    = UITweener.Style.Once;
        ts.enabled  = true;
        ts.PlayForward();
    }
Exemple #10
0
    public static void PlayTweenPosition(GameObject go, Vector3 vFrom, Vector3 vTo, float time, LuaFunction luafun)
    {
        TweenPosition tp = MonoExtendUtil.GetOrAddComponent <TweenPosition>(go);

        tp.from     = vFrom;
        tp.to       = vTo;
        tp.duration = time;
        tp.ResetToBeginning();
        tp.style   = UITweener.Style.Once;
        tp.enabled = true;

        EventDelegate callBack = new EventDelegate(delegate
        {
            if (luafun != null)
            {
                luafun.Call();
            }
        });

        callBack.oneShot = true;
        tp.onFinished.Add(callBack);

        tp.PlayForward();
    }
Exemple #11
0
    /// <summary>
    /// 获取当前物体层次
    /// </summary>
    /// <returns>The depth.</returns>
    /// <param name="go">Go.</param>
    public static int GetDepth(GameObject go)
    {
        UISprite us = MonoExtendUtil.GetOrAddComponent <UISprite>(go);

        return(us.depth);
    }
Exemple #12
0
    public static void SnapSprite(GameObject go)
    {
        UISprite us = MonoExtendUtil.GetOrAddComponent <UISprite>(go);

        us.MakePixelPerfect();
    }
Exemple #13
0
    /// <summary>
    /// 刷新UIgrid内节点的位置
    /// </summary>
    /// <returns><c>true</c>, if grid was updated, <c>false</c> otherwise.</returns>
    /// <param name="go">Go.</param>
    public static void UpdateGrid(GameObject go)
    {
        UIGrid ug = MonoExtendUtil.GetOrAddComponent <UIGrid>(go);

        ug.Reposition();
    }
Exemple #14
0
    /// <summary>
    /// 设置图片进度条显示进度.
    /// </summary>
    /// <param name="f">F.</param>
    public static void SetSpriteFillAmount(GameObject go, float f)
    {
        UISprite sp = MonoExtendUtil.GetOrAddComponent <UISprite>(go);

        sp.fillAmount = f;
    }
Exemple #15
0
    /// <summary>
    /// 设置图片层次
    /// </summary>
    /// <param name="go">Go.</param>
    /// <param name="depth">Depth.</param>
    public static void SetDepth(GameObject go, int depth)
    {
        UISprite us = MonoExtendUtil.GetOrAddComponent <UISprite>(go);

        us.depth = depth;
    }
Exemple #16
0
    /// <summary>
    /// 刷新UItable内节点的位置
    /// </summary>
    /// <returns><c>true</c>, if table was updated, <c>false</c> otherwise.</returns>
    /// <param name="go">Go.</param>
    public static void UpdateTable(GameObject go)
    {
        UITable ug = MonoExtendUtil.GetOrAddComponent <UITable>(go);

        ug.Reposition();
    }
Exemple #17
0
 private void StartLooper()
 {
     looper          = MonoExtendUtil.GetOrAddComponent <LuaLooper>(gameObject);
     looper.luaState = LuaState;
 }