ColorToInt() 개인적인 메소드

private ColorToInt ( Color c ) : int
c Color
리턴 int
예제 #1
0
    /// <summary>
    /// Save all serialized values in editor prefs.
    /// This is necessary because static values get wiped out as soon as scripts get recompiled.
    /// </summary>

    static void Save()
    {
        EditorPrefs.SetInt("NGUI Widget Type", (int)mType);
        EditorPrefs.SetInt("NGUI Color", NGUIMath.ColorToInt(mColor));
        EditorPrefs.SetBool("NGUI ScrollCL", mScrollCL);
        EditorPrefs.SetInt("NGUI Scroll Dir", (int)mScrollDir);

        SaveString("NGUI Sprite", mSprite);
        SaveString("NGUI Sliced", mSliced);
        SaveString("NGUI Tiled", mTiled);
        SaveString("NGUI Filled", mFilled);
        SaveString("NGUI Button", mButton);
        SaveString("NGUI Image 0", mImage0);
        SaveString("NGUI Image 1", mImage1);
        SaveString("NGUI Image 2", mImage2);
        SaveString("NGUI CheckBG", mCheckBG);
        SaveString("NGUI Check", mCheck);
        SaveString("NGUI SliderBG", mSliderBG);
        SaveString("NGUI SliderFG", mSliderFG);
        SaveString("NGUI SliderTB", mSliderTB);
        SaveString("NGUI InputBG", mInputBG);
        SaveString("NGUI ListFG", mListFG);
        SaveString("NGUI ListBG", mListBG);
        SaveString("NGUI ListHL", mListHL);
        SaveString("NGUI ScrollBG", mScrollBG);
        SaveString("NGUI ScrollFG", mScrollFG);
    }
예제 #2
0
 static public int ColorToInt_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
         UnityEngine.Color a1;
         checkType(l, 1, out a1);
         var ret = NGUIMath.ColorToInt(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
 }
    public void SetHair(int sex, int hair_style_id, int hair_color_id)
    {
        //IL_0023: Unknown result type (might be due to invalid IL or missing references)
        hairModelID = MonoBehaviourSingleton <GlobalSettingsManager> .I.playerVisual.GetHairModelID(sex, hair_style_id);

        hairColor = NGUIMath.ColorToInt(MonoBehaviourSingleton <GlobalSettingsManager> .I.playerVisual.GetHairColor(hair_color_id));
    }
예제 #4
0
    /// <summary>
    /// Save all serialized values in player prefs.
    /// This is necessary because static values get wiped out as soon as scripts get recompiled.
    /// </summary>

    static void Save()
    {
        PlayerPrefs.SetInt("NGUI Widget Type", (int)mType);
        PlayerPrefs.SetInt("NGUI Color", NGUIMath.ColorToInt(mColor));

        SaveString("NGUI Particle", mParticle);
        SaveString("NGUI Sprite", mSprite);
        SaveString("NGUI Sliced", mSliced);
        SaveString("NGUI ColorSprite", mColorSprite);
        SaveString("NGUI Tiled", mTiled);
        SaveString("NGUI Filled", mFilled);
        SaveString("NGUI Button", mButton);
        SaveString("NGUI Image 0", mImage0);
        SaveString("NGUI Image 1", mImage1);
        SaveString("NGUI Image 2", mImage2);
        SaveString("NGUI Image 3", mImage3);
        SaveString("NGUI CheckBG", mCheckBG);
        SaveString("NGUI Check", mCheck);
        SaveString("NGUI SliderBG", mSliderBG);
        SaveString("NGUI SliderFG", mSliderFG);
        SaveString("NGUI SliderTB", mSliderTB);
        SaveString("NGUI InputBG", mInputBG);
        SaveString("NGUI ListFG", mListFG);
        SaveString("NGUI ListBG", mListBG);
        SaveString("NGUI ListHL", mListHL);

        PlayerPrefs.Save();
    }
예제 #5
0
    static public string EncodeColor(Color32 col32)
    {
        Color col = new Color(col32.r / 255f, col32.g / 255f, col32.b / 255f, col32.a / 255f);
        int   i   = 0xFFFFFF & (NGUIMath.ColorToInt(col) >> 8);

        return(NGUIMath.DecimalToHex(i));
    }
    public void SetFace(int sex, int face_type_id, int skin_color_id)
    {
        //IL_0023: Unknown result type (might be due to invalid IL or missing references)
        faceModelID = MonoBehaviourSingleton <GlobalSettingsManager> .I.playerVisual.GetFaceModelID(sex, face_type_id);

        skinColor = NGUIMath.ColorToInt(MonoBehaviourSingleton <GlobalSettingsManager> .I.playerVisual.GetSkinColor(skin_color_id));
    }
예제 #7
0
        public static string ConvertColor2Str(Color color)
        {
            StringBuilder colorStr = new StringBuilder(9);

            colorStr.Append('[');
            colorStr.Append(NGUIMath.DecimalToHex24(NGUIMath.ColorToInt(color)));
            colorStr.Append(']');
            return(colorStr.ToString());
        }
예제 #8
0
    /// <summary>
    /// The reverse of ParseColor -- encodes a color in RrGgBb format.
    /// </summary>

    static public string EncodeColor(Color c)
    {
#if UNITY_FLASH
        // int.ToString(format) doesn't seem to be supported on Flash as of 3.5.0 -- it simply silently crashes
        return("FFFFFF");
#else
        int i = 0xFFFFFF & (NGUIMath.ColorToInt(c) >> 8);
        return(i.ToString("X6"));
#endif
    }
예제 #9
0
 static public int ColorToInt_s(IntPtr l)
 {
     try {
         UnityEngine.Color a1;
         checkType(l, 1, out a1);
         var ret = NGUIMath.ColorToInt(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
예제 #10
0
 static public int ColorToInt_s(IntPtr l)
 {
     try {
         UnityEngine.Color a1;
         checkType(l, 1, out a1);
         var ret = NGUIMath.ColorToInt(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #11
0
    public static string EncodeColor(Color c)
    {
        int num = 16777215 & NGUIMath.ColorToInt(c) >> 8;

        return(num.ToString("X6"));
    }
예제 #12
0
    public static string EncodeColor(Color c)
    {
        int num = 0xffffff & (NGUIMath.ColorToInt(c) >> 8);

        return(num.ToString("X6"));
    }
예제 #13
0
    public static string EncodeColor(Color c)
    {
        int num = 0xffffff & (NGUIMath.ColorToInt(c) >> 8);

        return(NGUIMath.DecimalToHex(num));
    }
예제 #14
0
    public static string EncodeColor(Color c)
    {
        var num = 16777215 & (NGUIMath.ColorToInt(c) >> 8);

        return(NGUIMath.DecimalToHex(num));
    }
예제 #15
0
    /// <summary>
    /// The reverse of ParseColor -- encodes a color in RrGgBb format.
    /// </summary>

    static public string EncodeColor(Color c)
    {
        int i = 0xFFFFFF & (NGUIMath.ColorToInt(c) >> 8);

        return(NGUIMath.DecimalToHex(i));
    }
    /// <summary>
    /// Colors to hex string. exmp  0xFFFFFF
    /// </summary>
    /// <returns>The to hex string.</returns>
    /// <param name="color">Color.</param>
    public static string ColorToHexStr(Color color)
    {
        int i = 0xFFFFFF & (NGUIMath.ColorToInt(color) >> 8);

        return(NGUIMath.DecimalToHex24(i));
    }
예제 #17
0
    public static String EncodeColor(Color c)
    {
        Int32 num = 16777215 & NGUIMath.ColorToInt(c) >> 8;

        return(NGUIMath.DecimalToHex(num));
    }
예제 #18
0
 public unsafe static long $Invoke10(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(NGUIMath.ColorToInt(*(*(IntPtr *)args))));
 }
예제 #19
0
        public static bool cb(CSVReader csv_reader, EquipItemData data, ref uint key)
        {
            //IL_00d8: Unknown result type (might be due to invalid IL or missing references)
            //IL_00f7: Unknown result type (might be due to invalid IL or missing references)
            //IL_013c: Unknown result type (might be due to invalid IL or missing references)
            //IL_015b: Unknown result type (might be due to invalid IL or missing references)
            //IL_01b8: Unknown result type (might be due to invalid IL or missing references)
            //IL_01d7: Unknown result type (might be due to invalid IL or missing references)
            data.id = key;
            csv_reader.Pop(ref data.appVer);
            csv_reader.Pop(ref data.type);
            csv_reader.Pop(ref data.getType);
            csv_reader.Pop(ref data.eventId);
            csv_reader.Pop(ref data.name);
            csv_reader.Pop(ref data.rarity);
            csv_reader.Pop(ref data.modelID0);
            data.modelID1 = data.modelID0;
            csv_reader.Pop(ref data.modelID1);
            string value = string.Empty;
            int    num   = -1;

            csv_reader.Pop(ref value);
            if (value.Length > 1)
            {
                num = (int)Enum.Parse(typeof(ELEMENT_TYPE), value);
            }
            if (!(bool)csv_reader.PopColor24(ref data.modelColor0))
            {
                if (num != -1)
                {
                    data.modelColor0 = NGUIMath.ColorToInt(MonoBehaviourSingleton <GlobalSettingsManager> .I.playerVisual.GetModelElementColor(num));
                }
                else
                {
                    data.modelColor0 = NGUIMath.ColorToInt(MonoBehaviourSingleton <GlobalSettingsManager> .I.playerVisual.modelBaseColor);
                }
            }
            csv_reader.PopColor24(ref data.modelColor1);
            if (!(bool)csv_reader.PopColor24(ref data.modelColor2))
            {
                if (num != -1)
                {
                    data.modelColor2 = NGUIMath.ColorToInt(MonoBehaviourSingleton <GlobalSettingsManager> .I.playerVisual.GetModelElementColor2(num));
                }
                else
                {
                    data.modelColor2 = NGUIMath.ColorToInt(MonoBehaviourSingleton <GlobalSettingsManager> .I.playerVisual.modelBaseColor2);
                }
            }
            csv_reader.Pop(ref data.effectID);
            data.effectParam = 1f;
            csv_reader.Pop(ref data.effectParam);
            if (!(bool)csv_reader.PopColor24(ref data.effectColor))
            {
                if (num != -1)
                {
                    data.effectColor = NGUIMath.ColorToInt(MonoBehaviourSingleton <GlobalSettingsManager> .I.playerVisual.GetModelElementColor(num));
                }
                else
                {
                    data.effectColor = NGUIMath.ColorToInt(MonoBehaviourSingleton <GlobalSettingsManager> .I.playerVisual.modelBaseColor);
                }
            }
            csv_reader.Pop(ref data.__iconID);
            csv_reader.Pop(ref data.maxLv);
            csv_reader.Pop(ref data.growID);
            csv_reader.Pop(ref data.needId);
            csv_reader.Pop(ref data.needUniqueId);
            csv_reader.Pop(ref data.exceedID);
            csv_reader.Pop(ref data.shadowEvolveEquipItemId);
            csv_reader.Pop(ref data.baseAtk);
            csv_reader.Pop(ref data.baseDef);
            csv_reader.Pop(ref data.baseHp);
            data.atkElement = new int[6];
            data.defElement = new int[6];
            for (int i = 0; i < 6; i++)
            {
                csv_reader.Pop(ref data.atkElement[i]);
            }
            for (int j = 0; j < 6; j++)
            {
                csv_reader.Pop(ref data.defElement[j]);
            }
            List <SkillItemTable.SkillSlotData> list = new List <SkillItemTable.SkillSlotData>();
            int num2 = 0;
            int num3 = 0;

            for (int k = 0; k < 9; k++)
            {
                string value2 = string.Empty;
                uint   value3 = 0u;
                csv_reader.Pop(ref value2);
                csv_reader.Pop(ref value3);
                if (!string.IsNullOrEmpty(value2))
                {
                    SkillItemTable.SkillSlotData skillSlotData = new SkillItemTable.SkillSlotData();
                    skillSlotData.slotType = (SKILL_SLOT_TYPE)(int)Enum.Parse(typeof(SKILL_SLOT_TYPE), value2);
                    if (skillSlotData.slotType != 0)
                    {
                        skillSlotData.skill_id = value3;
                        list.Add(skillSlotData);
                        num3++;
                        if (value3 != 0)
                        {
                            num2++;
                        }
                    }
                }
            }
            data._skillSlot       = list.ToArray();
            data.fixedSkillLength = num2;
            data.maxSlot          = num3;
            int[] array  = new int[3];
            int[] array2 = new int[3];
            int[] array3 = new int[3];
            int   num4   = 0;

            for (int l = 0; l < 3; l++)
            {
                csv_reader.Pop(ref array[l]);
                csv_reader.Pop(ref array2[l]);
                csv_reader.Pop(ref array3[l]);
                if (array[l] != 0 && array2[l] != 0)
                {
                    num4++;
                }
            }
            data.fixedAbility = new EquipItem.Ability[num4];
            for (int m = 0; m < num4; m++)
            {
                data.fixedAbility[m]    = new EquipItem.Ability();
                data.fixedAbility[m].id = array[m];
                data.fixedAbility[m].pt = array2[m];
                data.fixedAbility[m].vr = (0 < array3[m]);
            }
            csv_reader.Pop(ref data.sale);
            csv_reader.Pop(ref data.listId);
            string value4 = string.Empty;

            csv_reader.Pop(ref value4);
            data.obtained = new Obtained(value4);
            if (!(bool)csv_reader.Pop(ref data.damageDistanceId))
            {
                if (data.type == EQUIPMENT_TYPE.ARROW)
                {
                    data.damageDistanceId = 0;
                }
                else
                {
                    data.damageDistanceId = -1;
                }
            }
            csv_reader.PopEnum(ref data.atkElementType, ELEMENT_TYPE.MAX);
            csv_reader.PopEnum(ref data.defElementType, ELEMENT_TYPE.MAX);
            csv_reader.Pop(ref data.isFormer);
            csv_reader.PopEnum(ref data.spAttackType, SP_ATTACK_TYPE.NONE);
            csv_reader.Pop(ref data.spAttackRate);
            csv_reader.Pop(ref data.evolveId);
            return(true);
        }
예제 #20
0
    override protected bool OnDrawProperties()
    {
        mLabel = mWidget as UILabel;
        if (GUILayout.Button("Font", GUILayout.Width(76f)))
        {
            ComponentSelectorNew.Show <Font>(OnSelectFont);
        }

        int fontSize = EditorGUILayout.IntField("FontSize:", mLabel.FontSize);

        if (fontSize != mLabel.FontSize)
        {
            RegisterUndo(); mLabel.FontSize = fontSize;
        }

        Font font = EditorGUILayout.ObjectField("", mLabel.TrueTypeFont, typeof(Font), false) as Font;

        if (font != mLabel.TrueTypeFont)
        {
            mLabel.TrueTypeFont = font;
        }

        EditorGUILayout.ObjectField("Material", mLabel.material, typeof(Material), false);

        if (mLabel.font == null)
        {
            return(false);
        }

        string text = EditorGUILayout.TextArea(mLabel.text, GUILayout.Height(100f));

        if (!text.Equals(mLabel.text))
        {
            RegisterUndo(); mLabel.text = text;
        }

        GUILayout.BeginHorizontal();
        {
            int len = EditorGUILayout.IntField("Line Width", mLabel.lineWidth, GUILayout.Width(120f));
            if (len != mLabel.lineWidth)
            {
                RegisterUndo(); mLabel.lineWidth = len;
            }

            bool multi = EditorGUILayout.Toggle("Multi-line", mLabel.multiLine, GUILayout.Width(100f));
            if (multi != mLabel.multiLine)
            {
                RegisterUndo(); mLabel.multiLine = multi;
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        {
            int len = EditorGUILayout.IntField("Fixed Chinese", mLabel.FixedWidthForChinese, GUILayout.Width(120f));
            if (len != mLabel.FixedWidthForChinese)
            {
                RegisterUndo(); mLabel.FixedWidthForChinese = len;
            }
        }
        GUILayout.EndHorizontal();

        int spaceingY = EditorGUILayout.IntField("LineSpacingY", mLabel.lineSpacingY);

        if (spaceingY != mLabel.lineSpacingY)
        {
            RegisterUndo(); mLabel.lineSpacingY = spaceingY;
        }

        int spaceingX = EditorGUILayout.IntField("FontSpacingX", mLabel.FontSpacingX);

        if (spaceingX != mLabel.FontSpacingX)
        {
            RegisterUndo(); mLabel.FontSpacingX = spaceingX;
        }

        GUILayout.BeginHorizontal();
        {
            bool password = EditorGUILayout.Toggle("Password", mLabel.password, GUILayout.Width(120f));
            if (password != mLabel.password)
            {
                RegisterUndo(); mLabel.password = password;
            }

            bool encoding = EditorGUILayout.Toggle("Encoding", mLabel.supportEncoding, GUILayout.Width(100f));
            if (encoding != mLabel.supportEncoding)
            {
                RegisterUndo(); mLabel.supportEncoding = encoding;
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        {
            UILabel.Effect effect = (UILabel.Effect)EditorGUILayout.EnumPopup("Effect", mLabel.effectStyle, GUILayout.Width(170f));
            if (effect != mLabel.effectStyle)
            {
                RegisterUndo(); mLabel.effectStyle = effect;
            }

            if (effect != UILabel.Effect.None)
            {
                Color c = EditorGUILayout.ColorField(mLabel.effectColor);
                if (mLabel.effectColor != c)
                {
                    RegisterUndo(); mLabel.effectColor = c;
                }
            }
        }
        GUILayout.EndHorizontal();
        FontStyle style = (FontStyle)EditorGUILayout.EnumPopup("FontStyle:", mLabel.FontStyle, GUILayout.Width(200f));

        if (style != mLabel.FontStyle)
        {
            RegisterUndo();
            mLabel.FontStyle = style;
        }

        GUILayout.BeginHorizontal();
        Color color = EditorGUILayout.ColorField("Top Color", mLabel.TopColor);

        uint colorIntValue = (uint)NGUIMath.ColorToInt(color);

        colorIntValue &= 0xFFFFFFFF;
        string colorRGBA  = colorIntValue.ToString("X8");
        string ncolorRGBA = EditorGUILayout.TextField("RGBA:", colorRGBA);

        if (ncolorRGBA != colorRGBA)
        {
            color = ColorOperation.GetColorFromRGBAStr(ncolorRGBA);
        }

        if (mLabel.TopColor != color)
        {
            NGUIEditorTools.RegisterUndo("Color Change", mLabel);
            mLabel.TopColor = color;
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        color = EditorGUILayout.ColorField("Bottom Color", mLabel.BottomColor);

        colorIntValue  = (uint)NGUIMath.ColorToInt(color);
        colorIntValue &= 0xFFFFFFFF;
        colorRGBA      = colorIntValue.ToString("X8");
        ncolorRGBA     = EditorGUILayout.TextField("RGBA:", colorRGBA);
        if (ncolorRGBA != colorRGBA)
        {
            color = ColorOperation.GetColorFromRGBAStr(ncolorRGBA);
        }

        if (mLabel.BottomColor != color)
        {
            NGUIEditorTools.RegisterUndo("Color Change", mLabel);
            mLabel.BottomColor = color;
        }
        GUILayout.EndHorizontal();

        return(true);
    }