HexToColor() private method

private HexToColor ( uint val ) : Color
val uint
return Color
コード例 #1
0
    public void SetRankingInfo(RankingInfo info, int top, bool self = false)
    {
        mInfo = info;
        if (top < 3)
        {
            UIAtlasHelper.SetSpriteImage(mIcon, "common:top" + (top + 1).ToString());
            mIcon.gameObject.SetActive(true);
            mIconLabel.gameObject.SetActive(false);
            mName.color = NGUIMath.HexToColor(0xfcff00ff);
        }
        else
        {
            mIconLabel.text = (top + 1).ToString();
            mIcon.gameObject.SetActive(false);
            mIconLabel.gameObject.SetActive(true);
            mName.color = NGUIMath.HexToColor(0xffffffff);
        }

        mName.text = "Lv." + mInfo.level.ToString() + "  " + mInfo.name;

        mGrade.text      = info.grade.ToString();
        mArenaPoint.text = info.score.ToString();

        if (self)
        {
            mSelectBK.gameObject.SetActive(true);
            mSelfSprite.gameObject.SetActive(true);
        }
        else
        {
            mSelectBK.gameObject.SetActive(false);
            mSelfSprite.gameObject.SetActive(false);
        }
    }
コード例 #2
0
        public Color GetColor(GameEnums.Quality quality)
        {
            var c = Color.white;

            switch (quality)
            {
            case GameEnums.Quality.BROKEN:
                c = new Color(0.4f, 0.2f, 0.2f);
                break;

            case GameEnums.Quality.DAMAGED:
                c = new Color(0.4f, 0.4f, 0.4f);
                break;

            case GameEnums.Quality.NORMAL:
                c = new Color(1.0f, 1.0f, 1.0f);
                break;

            case GameEnums.Quality.GOOD:
                c = NGUIMath.HexToColor(0x00baffff);
                break;

            case GameEnums.Quality.EPIC:
                c = NGUIMath.HexToColor(0x9600ffff);
                break;
            }

            return(c);
        }
コード例 #3
0
 static public int HexToColor_s(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
         System.UInt32 a1;
         checkType(l, 1, out a1);
         var ret = NGUIMath.HexToColor(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     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
 }
コード例 #4
0
 static public int HexToColor_s(IntPtr l)
 {
     try {
         System.UInt32 a1;
         checkType(l, 1, out a1);
         var ret = NGUIMath.HexToColor(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
コード例 #5
0
 static public int HexToColor_s(IntPtr l)
 {
     try {
         System.UInt32 a1;
         checkType(l, 1, out a1);
         var ret = NGUIMath.HexToColor(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #6
0
    private void UpdateSetting()
    {
        int shoottype = SettingManager.Instance.GetShootType();

        if (shoottype == (int)SHOOT_TYPE.SHOOT_TYPE_NORMAL)
        {
            mSetting.gameObject.transform.localPosition = new Vector3(-46.0f, 0.0f, 0.0f);
            mLabel1.color = NGUIMath.HexToColor(0x81ffa5ff);
            mLabel2.color = NGUIMath.HexToColor(0xff2424ff);
        }
        else
        {
            mSetting.gameObject.transform.localPosition = new Vector3(45.0f, 0.0f, 0.0f);
            mLabel1.color = NGUIMath.HexToColor(0xff2424ff);
            mLabel2.color = NGUIMath.HexToColor(0x81ffa5ff);
        }
    }
コード例 #7
0
    /// <summary>
    /// 显示伤害信息板
    /// </summary>
    /// <param name="nType">伤害信息板类型 对应DamageBoardType表ID</param>
    /// <param name="nValue">显示的内容</param>
    public void ShowDamageBoard(int nType, string strValue, Vector3 pos, bool isProfessionSkill = true)
    {
        if (mCurType == DAMAGE_BOARD_TYPE.GPUBILLBOARD)
        {
            Debug.LogWarning(strValue);
            if (!PlayerPreferenceData.SystemDamageBoardEnable)
            {
                return;
            }
            if (!mIsInit)
            {
                mIsInit = true;
                GPUBillboardBuffer.Instance.Init();
                GPUBillboardBuffer.Instance.SetupBillboard(1000);
                Tab_DamageBoardType template = TableManager.GetDamageBoardTypeByID(7, 0);
                GPUBillboardBuffer.Instance.SetPosOffset(new Vector3(template.OriginX, template.OriginY));
                GPUBillboardBuffer.Instance.SetScaleParams(template.ScaleDelayTime, template.ScalePlusTime, template.ScaleMinusTime, template.TextSizeMax, template.TextSizeOver);
            }
            Tab_DamageBoardType tabDamageBoardType = TableManager.GetDamageBoardTypeByID(nType, 0);
            uint color = System.Convert.ToUInt32(tabDamageBoardType.TextColor + "ff", 16);

            DisplayNumerInputParam param = new DisplayNumerInputParam();
            param.RandomXInitialSpeedMin = tabDamageBoardType.VelocityX;
            param.RandomXInitialSpeedMax = tabDamageBoardType.VelocityX;

            param.RandomYInitialSpeedMin = tabDamageBoardType.VelocityY;
            param.RandomYInitialSpeedMax = tabDamageBoardType.VelocityY;

            param.RandomXaccelerationMin = tabDamageBoardType.AccelerationX;
            param.RandomXaccelerationMax = tabDamageBoardType.AccelerationX;

            param.RandomYaccelerationMin = tabDamageBoardType.AccelerationY;
            param.RandomYaccelerationMax = tabDamageBoardType.AccelerationY;

            param.FadeTime   = tabDamageBoardType.FadeTime;
            param.NormalTime = tabDamageBoardType.ShowTime;

            GPUBillboardBuffer.Instance.DisplayNumberRandom(
                strValue,
                tabDamageBoardType.TextSize * 0.2f * Vector3.one,
                pos,
                NGUIMath.HexToColor(color),
                tabDamageBoardType.TextSizeMax > 0, param);
        }
        else if (mCurType == DAMAGE_BOARD_TYPE.NGUI)
        {
            if (false == DebugHelper.m_bShowDamageBoard)
            {
                return;
            }

            if (DamageBoardType.ContainsKey(nType) == false)
            {
                return;
            }

            Tab_DamageBoardType tabDamageBoardType = DamageBoardType[nType][0];
            if (tabDamageBoardType == null)
            {
                tabDamageBoardType = DamageBoardType[0][0];
            }

            int nMaxNum = tabDamageBoardType.MaxNum;                    // 最大显示数量

            DamageBoard damageBoardInfo = null;
            if (m_DisabledDictionary[nType].Count > 0)
            {
                // 若DisabledDictionary对应list中有元素 则不创建新的信息板 直接使用旧的
                damageBoardInfo = m_DisabledDictionary[nType][m_DisabledDictionary[nType].Count - 1];
                damageBoardInfo.Reuse(pos);
                m_DisabledDictionary[nType].RemoveAt(m_DisabledDictionary[nType].Count - 1);
                m_EnabledDictionary[nType].Add(damageBoardInfo);
            }
            else
            {
                // 若DisabledDictionary对应list中没有元素
                if (m_EnabledDictionary[nType].Count < nMaxNum)
                {
                    // 若EnabledDictionary对应list数量未达到最大值 则直接创建
                    //damageBoardInfo = new DamageBoard();
                    //damageBoardInfo.Create(m_Font, gameObject.transform.position);
                    //m_EnabledDictionary[nType].Add(damageBoardInfo);
                    DamageBoardLoadInfo info = new DamageBoardLoadInfo(nType, strValue, pos, isProfessionSkill);
                    UIManager.LoadItem(UIInfo.DamageBoard, OnLoadDamageBoard, info);
                }
                else
                {
                    // 若EnabledDictionary对应list数量已达到最大值 则Remove第一个 再Add出来一个
                    damageBoardInfo = m_EnabledDictionary[nType][m_EnabledDictionary[nType].Count - 1];
                    damageBoardInfo.Reuse(pos);
                    m_EnabledDictionary[nType].RemoveAt(m_EnabledDictionary[nType].Count - 1);
                    m_EnabledDictionary[nType].Add(damageBoardInfo);
                }
            }

            if (null != damageBoardInfo)
            {
                damageBoardInfo.ActiveDamageBoard(nType, strValue, pos, isProfessionSkill);
            }
        }
    }
コード例 #8
0
 private Color HexStringToColor(string hexColor)
 {
     return(NGUIMath.HexToColor(Convert.ToUInt32(hexColor, 16)));
 }
コード例 #9
0
ファイル: PaoPaoUI.cs プロジェクト: fengmin0722/qiangzhan
 public void SetColor(uint color)
 {
     mLabel.color = NGUIMath.HexToColor(color);
 }