ParseColor() static public method

Parse a RrGgBb color encoded in the string.
static public ParseColor ( string text, int offset ) : Color
text string
offset int
return Color
Ejemplo n.º 1
0
    private Transform mRoot;          //root

    /// <summary>
    /// 设置数据并显示
    /// </summary>
    /// <param name="data"></param>
    public void SetData(SendGetAgentBRInfo data, Transform root, bool isAgent = true)
    {
        mData = data;
        mRoot = root;
        float gold = isAgent ? data.gold : -data.gold;

        gold = float.Parse(gold.ToString("f2"));
        string timestr = data.time;

        mTime.text = timestr.Replace(" ", "\n");              //时间
        mName.text = data.nickName;                           //名字
        mNum.text  = gold > 0 ? "+" + gold : gold.ToString(); //数量
        mNum.color = gold > 0 ? NGUIText.ParseColor("46a30e") : NGUIText.ParseColor("d53535");
        //标记
        if (mTag == null)
        {
            return;
        }
        if (isAgent)//代理
        {
            mTag.text = gold <= 0 ? "打赏" : "获赏";
        }
        else
        {
            mTag.text = gold <= 0 ? "打赏" : "获赏";
        }
        mTag.color = mNum.color;
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 初始化Item
    /// </summary>
    /// <param name="con"></param>
    public void InitUIByConfig(GameGoldPatternConfigConfig con)
    {
        mConfig = con;
        Assets.LoadTexture(mConfig.icon, (t) =>
        {
            mBg.mainTexture = t;
        });

        mLv.text = con.lvName;
        //底分
        mBaseScore.text        = con.baseScore.ToString();
        mBaseScore.effectColor = NGUIText.ParseColor(con.effectColor, 0);
        mLimit.text            = con.minStr;
        mLimit_shadow.text     = con.minStr;
        mLimit.effectColor     = mBaseScore.effectColor;
        if (!string.IsNullOrEmpty(con.tittle))
        {
            mTipsRoot.gameObject.SetActive(true);
            mTips.text = con.tittle;
        }
        else
        {
            mTipsRoot.gameObject.SetActive(false);
        }
    }
Ejemplo n.º 3
0
 public override void OnUpdate()
 {
     if (_lastColor != colorString.Value)
     {
         _lastColor  = colorString.Value;
         color.Value = NGUIText.ParseColor(_lastColor, 0);
     }
 }
Ejemplo n.º 4
0
        public override void OnEnter()
        {
            _lastColor  = colorString.Value;
            color.Value = NGUIText.ParseColor(_lastColor, 0);

            if (!everyFrame)
            {
                Finish();
            }
        }
Ejemplo n.º 5
0
    static int ParseColor(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        string arg0 = LuaScriptMgr.GetLuaString(L, 1);
        int    arg1 = (int)LuaScriptMgr.GetNumber(L, 2);
        Color  o    = NGUIText.ParseColor(arg0, arg1);

        LuaScriptMgr.Push(L, o);
        return(1);
    }
Ejemplo n.º 6
0
    public UILabel mPoint;      //积分

    /// <summary>
    /// 设置数据并显示
    /// </summary>
    /// <param name="data"></param>
    public void SetData(MJRecordPlayerData data)
    {
        //头像
        Assets.LoadTexture(data.headUrl, (t) => { mHeadIcon.mainTexture = t; });
        //名字
        mName.text = data.nickName;
        //积分
        mPoint.text = data.score >= 0 ? ("+" + data.score) : data.score.ToString();
        //积分颜色
        mPoint.color = data.score >= 0 ? NGUIText.ParseColor("d53535") : NGUIText.ParseColor("46a30e");
    }
Ejemplo n.º 7
0
 /// <summary>
 /// 设置数量
 /// </summary>
 /// <param name="num"></param>
 private void InitNum(SendGetAgentBRTotal num)
 {
     if (num == null)
     {
         num = new SendGetAgentBRTotal();
     }
     mDayNum.text    = (num.today > 0 ? "+" + num.today : num.today.ToString()); //数量
     mDayNum.color   = num.today > 0 ? NGUIText.ParseColor("46a30e") : NGUIText.ParseColor("d53535");
     mWeekNum.text   = (num.weak > 0 ? "+" + num.weak : num.weak.ToString());    //数量
     mWeekNum.color  = num.weak > 0 ? NGUIText.ParseColor("46a30e") : NGUIText.ParseColor("d53535");
     mMonthNum.text  = (num.month > 0 ? "+" + num.month : num.month.ToString()); //数量
     mMonthNum.color = num.month > 0 ? NGUIText.ParseColor("46a30e") : NGUIText.ParseColor("d53535");
 }
Ejemplo n.º 8
0
    private int mMaxFanshu;            //封顶番数


    public void SetData(MJGameSettlementPlayerInfo info, int maxFanshu, bool isBigWinner)
    {
        mMaxFanshu = maxFanshu;

        {
            Assets.LoadIcon(info.headUrl, (t) =>
            {
                mIcon.mainTexture = t;
            });
        }

        if (info.isZhuang == true)
        {
            if (mZhuangSprite != null)
            {
                mZhuangSprite.gameObject.SetActive(true);
            }
        }
        else
        {
            if (mZhuangSprite != null)
            {
                mZhuangSprite.gameObject.SetActive(false);
            }
        }

        //名字
        //mName.text = GameUtils.GetClampText(info.nickName, mName);
        mName.text = info.nickName;
        //id
        mId.text = info.userId.ToString();
        //分数
        mPoint.text  = info.score >= 0 ? ("+" + info.score) : info.score.ToString();
        mPoint.color = info.score < 0 ? NGUIText.ParseColor("d53535") : NGUIText.ParseColor("46a30e");
        //胡牌细节
        mHuType.text = info.huDes;
        //牌型
        SetCard(info);
        //大赢家
        mBigWinner.SetActive(isBigWinner);
        //胡牌顺序
        if (info.huOrder > 0 && info.huOrder < 5)
        {
            mHuOrder.spriteName = "hu_" + info.huOrder;
            DelayRun((info.huOrder - 1) * 0.2f, () =>
            {
                mHuOrder.gameObject.SetActive(true);
            });
        }
    }
Ejemplo n.º 9
0
 static public int ParseColor_s(IntPtr l)
 {
     try {
         System.String a1;
         checkType(l, 1, out a1);
         System.Int32 a2;
         checkType(l, 2, out a2);
         var ret = NGUIText.ParseColor(a1, a2);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 10
0
 static int ParseColor(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         string            arg0 = ToLua.CheckString(L, 1);
         int               arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
         UnityEngine.Color o    = NGUIText.ParseColor(arg0, arg1);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Ejemplo n.º 11
0
    private static int ParseColor(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 2);
            string text   = ToLua.CheckString(L, 1);
            int    offset = (int)LuaDLL.luaL_checknumber(L, 2);
            Color  clr    = NGUIText.ParseColor(text, offset);
            ToLua.Push(L, clr);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Ejemplo n.º 12
0
    // Use this for initialization
    public virtual void Start()
    {
        //m_nHp = m_nFullHp = 100;
        //preValue = value = 1;
        GameObject child = NGUITools.AddChild(WndManager.GetWndRoot(), prefab);

        mText = child.GetComponentInChildren <HUDText>();

        if (null == forceTex)
        {
            forceTex = hp4;
        }

        //forceGrond.GetComponent<SpriteRenderer>().sprite.border
        // Make the UI follow the target
        child.AddComponent <UIFollowTarget>().target             = target;
        child.GetComponent <UIFollowTarget>().disableIfInvisible = false;

        if (mBaojiText != null)
        {
            child      = NGUITools.AddChild(WndManager.GetWndRoot(), mBaojiText.gameObject);
            mBaojiText = child.GetComponentInChildren <HUDText>();
            child.AddComponent <UIFollowTarget>().target             = target;
            child.GetComponent <UIFollowTarget>().disableIfInvisible = false;
        }
        if (mAngerText != null)
        {
            child      = NGUITools.AddChild(WndManager.GetWndRoot(), mAngerText.gameObject);
            mAngerText = child.GetComponentInChildren <HUDText>();
            child.AddComponent <UIFollowTarget>().target             = target;
            child.GetComponent <UIFollowTarget>().disableIfInvisible = false;
        }
        if (BuffText != null)
        {
            child    = NGUITools.AddChild(WndManager.GetWndRoot(), BuffText.gameObject);
            BuffText = child.GetComponentInChildren <HUDText>();
            child.AddComponent <UIFollowTarget>().target             = target;
            child.GetComponent <UIFollowTarget>().disableIfInvisible = false;
        }
        mColorBuff   = NGUIText.ParseColor("d3fe78", 0);
        mColorDebuff = NGUIText.ParseColor("ff5163", 0);
    }
Ejemplo n.º 13
0
 static public Color ParseColor(string text, int offset)
 {
     return(NGUIText.ParseColor(text, offset));
 }