Selaa lähdekoodia

Add ChooseChange

Jidongchen 3 vuotta sitten
vanhempi
commit
1244d39fd2

+ 133 - 0
Assets/GameMain/Scripts/UI/ColorPick.cs

@@ -0,0 +1,133 @@
+using UnityEngine;
+using System.Collections;
+using UnityEngine.UI;
+namespace MetaClient
+{
+    public class ColorPick : MonoBehaviour
+    {
+
+        public Image Saturation;
+        public Image Hue;
+        public Image Paint;
+        public RectTransform Point_Stauration;
+        public RectTransform Point_Hue;
+        private Sprite Saturation_Sprite;
+        private Sprite Hue_Sprite;
+        private Color32 currentHue = Color.red;
+        public Text colorText;
+        public UICustom uICustom;
+        private void Awake()
+        {
+        }
+        private void Start()
+        {
+            UpdateStauration();
+            UpdateHue();
+        }
+        float sWidth = 200, sHeight = 200;
+        //更新饱和度
+        private void UpdateStauration()
+        {
+            Saturation_Sprite = Sprite.Create(new Texture2D((int)sWidth, (int)sHeight), new Rect(0, 0, sWidth, sHeight), new Vector2(0, 0));
+            for (int y = 0; y <= sHeight; y++)
+            {
+                for (int x = 0; x < sWidth; x++)
+                {
+                    var pixColor = GetSaturation(currentHue, x / sWidth, y / sHeight);
+                    Saturation_Sprite.texture.SetPixel(x, ((int)sHeight - y), pixColor);
+                }
+            }
+            Saturation_Sprite.texture.Apply();
+            Saturation.sprite = Saturation_Sprite;
+        }
+        //更新色泽度
+        private void UpdateHue()
+        {
+            float w = 50, h = 50;
+            Hue_Sprite = Sprite.Create(new Texture2D((int)w, (int)h), new Rect(0, 0, w, h), new Vector2(0, 0));
+            for (int y = 0; y <= h; y++)
+            {
+                for (int x = 0; x < w; x++)
+                {
+                    var pixColor = GetHue(y / h);
+                    Hue_Sprite.texture.SetPixel(x, ((int)h - y), pixColor);
+                }
+            }
+            Hue_Sprite.texture.Apply();
+            Hue.sprite = Hue_Sprite;
+        }
+        private Vector2 clickPoint = Vector2.zero;
+        public void OnStaurationClick(ColorPickClick sender)
+        {
+            var size2 = Saturation.rectTransform.sizeDelta / 2;
+            var pos = Vector2.zero;
+            pos.x = Mathf.Clamp(sender.ClickPoint.x, -size2.x, size2.x);
+            pos.y = Mathf.Clamp(sender.ClickPoint.y, -size2.y, size2.y);
+            Point_Stauration.anchoredPosition = clickPoint = pos;
+
+            UpdateColor();
+        }
+        public void UpdateColor()
+        {
+            var size2 = Saturation.rectTransform.sizeDelta / 2;
+            var pos = clickPoint;
+            pos += size2;
+            var color = GetSaturation(currentHue, pos.x / Saturation.rectTransform.sizeDelta.x, 1 - pos.y / Saturation.rectTransform.sizeDelta.y);
+            Paint.color = color;
+            int r = Mathf.RoundToInt(color.r * 255.0f);
+            int g = Mathf.RoundToInt(color.g * 255.0f);
+            int b = Mathf.RoundToInt(color.b * 255.0f);
+            int a = Mathf.RoundToInt(color.a * 255.0f);
+            string theHexColor = string.Format("{0:X2}{1:X2}{2:X2}{3:X2}", r, g, b, a);
+            colorText.text = theHexColor + "";
+            uICustom.ColorChange(new Vector3(color.r, color.g, color.b));
+        }
+        
+
+
+
+
+
+
+        public void OnHueClick(ColorPickClick sender)
+        {
+            var h = Hue.rectTransform.sizeDelta.y / 2.0f;
+            var y = Mathf.Clamp(sender.ClickPoint.y, -h, h);
+            Point_Hue.anchoredPosition = new Vector2(0, y);
+            y += h;
+            currentHue = GetHue(1 - y / Hue.rectTransform.sizeDelta.y);
+            UpdateStauration();
+            UpdateColor();
+        }
+        private static Color GetSaturation(Color color, float x, float y)
+        {
+            Color newColor = Color.white;
+            for (int i = 0; i < 3; i++)
+            {
+                if (color[i] != 1)
+                {
+                    newColor[i] = (1 - color[i]) * (1 - x) + color[i];
+                }
+            }
+            newColor *= (1 - y);
+            newColor.a = 1;
+            return newColor;
+        }
+        //B,r,G,b,R,g //大写是升,小写是降
+        private readonly static int[] hues = new int[] { 2, 0, 1, 2, 0, 1 };
+        private readonly static Color[] colors = new Color[] { Color.red, Color.blue, Color.blue, Color.green, Color.green, Color.red };
+        private readonly static float c = 1.0f / hues.Length;
+        private static Color GetHue(float y)
+        {
+            y = Mathf.Clamp01(y);
+            var index = (int)(y / c);
+            var h = hues[index];
+            var newColor = colors[index];
+            float less = (y - index * c) / c;
+            newColor[h] = index % 2 == 0 ? less : 1 - less;
+            return newColor;
+        }
+    }
+}
+
+

Assets/GameMain/Scripts/UIColorMix/ColorPick.cs.meta → Assets/GameMain/Scripts/UI/ColorPick.cs.meta


+ 37 - 0
Assets/GameMain/Scripts/UI/ColorPickClick.cs

@@ -0,0 +1,37 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.EventSystems;
+using System;
+using UnityEngine.UI;
+namespace MetaClient
+{
+    public class ColorPickClick : MonoBehaviour, IPointerDownHandler, IDragHandler
+    {
+        // Start is called before the first frame update
+        void Start()
+        {
+
+        }
+        public Button.ButtonClickedEvent Click;
+
+        public Vector3 ClickPoint { get; set; }
+        public void OnPointerDown(PointerEventData eventData)
+        {
+            var rect = transform as RectTransform;
+            ClickPoint = rect.InverseTransformPoint(eventData.position);
+            Click.Invoke();
+        }
+        public void OnDrag(PointerEventData eventData)
+        {
+            var rect = transform as RectTransform;
+            ClickPoint = rect.InverseTransformPoint(eventData.position);
+            Click.Invoke();
+        }
+        // Update is called once per frame
+        void Update()
+        {
+
+        }
+    }
+}

Assets/GameMain/Scripts/UIColorMix/ColorPickClick.cs.meta → Assets/GameMain/Scripts/UI/ColorPickClick.cs.meta


+ 5 - 0
Assets/GameMain/Scripts/UI/UIColorData.cs

@@ -8,5 +8,10 @@ namespace MetaClient
         public ECustomStyple eCustomStyple;
         public int id;
         public Vector3 v3;
+        public UIColorData(ECustomStyple _eCustomStyple,int _id,Vector3 _v3) {
+            this.eCustomStyple = _eCustomStyple;
+            this.id = _id;
+            this.v3 = _v3;
+        }
     }
 }

+ 96 - 24
Assets/GameMain/Scripts/UI/UICustom.cs

@@ -66,7 +66,7 @@ namespace MetaClient
         [Header("颜色演示预制体")]
         public GameObject colItem;
 
-
+        private bool hasColorChoose = false;
         public float tween_leftMax = 0;
         public float tween_leftMin = -250;
 
@@ -79,7 +79,7 @@ namespace MetaClient
         private float tweenTime = 0.5f;
         //private float tweenTime = 10;
         //private float tweenLeastTime = 0;
-
+        private GameObject nowChooseColorObj;
         public bool isTween = false;
         [Header("选择界面分支")]
         [SerializeField]
@@ -95,7 +95,7 @@ namespace MetaClient
         private int id = -1;
         private GameObject nowPickOnImg=null;
 
-
+        private Vector3 colorV3 = new Vector3(0, 0, 0);
         //[Header("接受到的数据")]
         //[SerializeField]
         private IDataTable<DRCustomBody> _bodydata;
@@ -107,6 +107,49 @@ namespace MetaClient
             _bodydata = GameEntry.DataTable.GetDataTable<DRCustomBody>();
             
         }
+        public void ColorChange(Vector3 _v3) {
+            colorV3 = _v3;
+        }
+        public void SaveColorChange()
+        {
+            var a = new UIColorData(eCustomStyple,id,colorV3);
+           String str = JsonUtility.ToJson(a);
+            // var obj = JsonUtility.FromJson<PartData>(str);
+
+            SaveColorAdd(3);
+            SaveColorAdd(2);
+
+
+            GameEntry.Setting.SetString("savecolor"+eCustomStyple+"/"+id+"/"+1, str);
+            GameEntry.Setting.Save();
+            ChooseColorChange();
+            //GameEntry.Setting.HasSetting("savecolor");
+            //GameEntry.Setting.GetString("");
+        }
+        public void SaveColorAdd(int _Index)
+        {
+            if (GameEntry.Setting.HasSetting("savecolor" + eCustomStyple + "/" + id + "/"+_Index))
+            {
+                String _saveStr=GameEntry.Setting.GetString("savecolor" + eCustomStyple + "/" + id + "/" + (_Index-1));
+                GameEntry.Setting.SetString("savecolor" + eCustomStyple + "/" + id + "/" +_Index, _saveStr);
+            }
+        }
+        public void ColorHuaDong(Vector3 _v3)
+        {
+            colorV3 = _v3;
+        }
+        public void ChooseColorChange()
+        {
+            Debug.Log(nowChooseColorObj.transform.parent.name);
+            if (nowChooseColorObj!=null)
+            {
+                Image _img=nowChooseColorObj.transform.GetComponent<Image>();
+                _img.color = new Color(colorV3.x,colorV3.y,colorV3.z);
+            }
+        }
+
+
+
 
         protected override void OnClose(bool isShutdown, object userData)
         {
@@ -114,7 +157,7 @@ namespace MetaClient
         }
 
 
-        public void ClickBotton(ECustomStyple eCustomStyple,int id,bool ziDingYi)
+        public void ClickBotton(ECustomStyple eCustomStyple,int id,bool ziDingYi,bool isColor)
         {
             if (isTween)
             {
@@ -124,7 +167,7 @@ namespace MetaClient
             leftView.transform.DOLocalMoveX(tween_leftMin, tweenTime).SetEase(Ease.InOutBack).OnComplete(()=> {
                 //whitebg.SetActive(bg);
                
-                 ClickBtnFun(eCustomStyple,id,ziDingYi);
+                 ClickBtnFun(eCustomStyple,id,ziDingYi,isColor);
                 leftView.transform.DOLocalMoveX(0, tweenTime).SetEase(Ease.InOutBack).OnComplete(() => {
                     isTween = false;
                     Debug.Log("222");
@@ -142,6 +185,7 @@ namespace MetaClient
         /// 调色界面打开
         /// </summary>
         public void TiaoSeViewOpenFun() {
+            HistoryAdd("Color");
             rightView.SetActive(false);
             colorView.SetActive(true);
 
@@ -151,8 +195,8 @@ namespace MetaClient
         /// </summary>
         public void TiaoSeBanOpenStyple(bool _bo)
         {
-            colorView.SetActive(_bo);
-            tiaoSeBanView.SetActive(!_bo);
+            colorView.SetActive(!_bo);
+            tiaoSeBanView.SetActive(_bo);
             
         }
 
@@ -161,6 +205,7 @@ namespace MetaClient
         /// </summary>
         public void TiaoSeSure()
         {
+            SaveColorChange();
             TiaoSeBanOpenStyple(false);
         }
         /// <summary>
@@ -350,7 +395,7 @@ namespace MetaClient
             else if (_strArrary[0] == "ziDingyi")
             {
                 int _chooseId = int.Parse(_strArrary[1]);
-                ClickBtnFun(eCustomStyple, _chooseId, false);
+                ClickBtnFun(eCustomStyple, _chooseId, false,hasColorChoose);
             }
             else
             {
@@ -427,11 +472,12 @@ namespace MetaClient
         /// <summary>
         /// 按钮点击事件
         /// </summary>
-        public void ClickBtnFun(ECustomStyple eCustomStyple,int id,bool zidingyi) {
+        public void ClickBtnFun(ECustomStyple eCustomStyple,int id,bool zidingyi,bool isColor) {
             //if (isTween)
             //{
             //    return;
             //}
+            hasColorChoose = isColor;
             whitebg.SetActive(true);
             scrollbar.gameObject.SetActive(false);
             this.eCustomStyple = eCustomStyple;
@@ -452,7 +498,7 @@ namespace MetaClient
                     //    ZiDingYiNeiLian(eCustomStyple, id, _nieLianXX.transform.GetChild(0).gameObject);
                     //    return;
                     //}
-                    CreateNieLianImg(id, zidingyi);
+                    CreateNieLianImg(id, zidingyi,isColor);
                     break;
                 case ECustomStyple.Body:
                     GameObject _bodyList = bodyView.transform.GetChild(0).gameObject;
@@ -464,7 +510,7 @@ namespace MetaClient
                     //    ZiDingYiBody(eCustomStyple, id, _bodyListXX.transform.GetChild(0).gameObject);
                     //    return;
                     //}
-                    CreateBodyImg(id, zidingyi);
+                    CreateBodyImg(id, zidingyi,isColor);
                     break;
                 case ECustomStyple.Cloth:
                     GameObject _clothList = clothView.transform.GetChild(0).gameObject;
@@ -476,7 +522,7 @@ namespace MetaClient
                     //    ZiDingYiCloth(eCustomStyple, id, _clothListXX.transform.GetChild(0).gameObject);
                     //    return;
                     //}
-                    CreateClothImg(id, zidingyi);
+                    CreateClothImg(id, zidingyi,isColor);
                     break;
             }
         }
@@ -531,13 +577,13 @@ namespace MetaClient
         //}
 
 
-        public void CreateNieLianImg(int parentid, bool ziDingYi)
+        public void CreateNieLianImg(int parentid, bool ziDingYi, bool isColor)
         {
 
 
 
 
-            GameObject _objPar = bodyView.transform.GetChild(2).GetChild(0).gameObject;
+            GameObject _objPar = nieLianView.transform.GetChild(2).GetChild(0).gameObject;
             RemoveAllChildren(_objPar);
             //等有捏脸表时改为捏脸
             IDataTable<DRCustomBody> _data = GameEntry.DataTable.GetDataTable<DRCustomBody>();
@@ -546,7 +592,7 @@ namespace MetaClient
             if (ziDingYi)
             {
 
-                CreateZDYFun(parentid, _objPar);
+                CreateZDYFun(parentid, _objPar,ziDingYiBtn);
 
                 //GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
                 //_obj.transform.SetParent(_objPar.transform);
@@ -558,7 +604,10 @@ namespace MetaClient
                 //_uICustomBtn.eCustomStyple = eCustomStyple;
                 //_obj.SetActive(true);
             }
-
+            if (isColor)
+            {
+                CreateColFun(parentid, _objPar,colItem);
+            }
             DRCustomBody[] dRCustomBodies = _bodydata.GetAllDataRows();
             for (int i = 0; i < dRCustomBodies.Length; i++)
             {
@@ -571,10 +620,10 @@ namespace MetaClient
           
              ChangeListBotton(_objPar);
         }
-        public void CreateClothImg(int parentid,bool ziDingYi)
+        public void CreateClothImg(int parentid,bool ziDingYi, bool isColor)
         {
 
-            GameObject _objPar = bodyView.transform.GetChild(2).GetChild(0).gameObject;
+            GameObject _objPar = clothView.transform.GetChild(2).GetChild(0).gameObject;
             RemoveAllChildren(_objPar);
             //等有服装时改为服装
             IDataTable<DRCustomBody> _data = GameEntry.DataTable.GetDataTable<DRCustomBody>();
@@ -583,7 +632,7 @@ namespace MetaClient
             if (ziDingYi)
             {
 
-                CreateZDYFun(parentid, _objPar);
+                CreateZDYFun(parentid, _objPar,ziDingYiBtn);
 
                 //GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
                 //_obj.transform.SetParent(_objPar.transform);
@@ -596,6 +645,11 @@ namespace MetaClient
                 //_obj.SetActive(true);
 
             }
+            if (isColor)
+            {
+                CreateColFun(parentid, _objPar, colItem);
+           
+            }
             DRCustomBody[] dRCustomBodies = _bodydata.GetAllDataRows();
             for (int i = 0; i < dRCustomBodies.Length; i++)
             {
@@ -608,14 +662,28 @@ namespace MetaClient
             ChangeListBotton(_objPar);
         }
 
-        private void CreateZDYFun(int parentid,GameObject _objPar)
+        private void CreateZDYFun(int parentid,GameObject _objPar,GameObject _clone)
         {
-            GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
+            GameObject _obj = GameObject.Instantiate(_clone);
             _obj.transform.SetParent(_objPar.transform);
             UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
             ChangeUICustom(_uICustomBtn, parentid, eCustomStyple);
         }
-
+        private void CreateColFun(int parentid, GameObject _objPar, GameObject _clone)
+        {
+            GameObject _obj = GameObject.Instantiate(_clone);
+            _obj.transform.SetParent(_objPar.transform);
+            UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
+            ChangeUICustom(_uICustomBtn, parentid, eCustomStyple);
+            nowChooseColorObj = _obj;
+        }
+        //private void CreateColorFun(int parentid, GameObject _objPar, GameObject _clone)
+        //{
+        //    GameObject _obj = GameObject.Instantiate(_clone);
+        //    _obj.transform.SetParent(_objPar.transform);
+        //    UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
+        //    ChangeUICustom(_uICustomBtn, parentid, eCustomStyple);
+        //}
         public void ChangeUICustom(UICustomBtn uICustomBtn,int id, ECustomStyple eCustomStyple) 
         {
             uICustomBtn.id = id;
@@ -630,7 +698,7 @@ namespace MetaClient
 
 
 
-        public void CreateBodyImg(int parentid,bool ziDingYi) {
+        public void CreateBodyImg(int parentid,bool ziDingYi, bool isColor) {
             GameObject _objPar = bodyView.transform.GetChild(2).GetChild(0).gameObject;
             RemoveAllChildren(_objPar);
             IDataTable<DRCustomBody> _data = GameEntry.DataTable.GetDataTable<DRCustomBody>();
@@ -639,7 +707,7 @@ namespace MetaClient
             if (ziDingYi)
             {
 
-                CreateZDYFun(parentid, _objPar);
+                CreateZDYFun(parentid, _objPar,ziDingYiBtn);
 
 
                 //GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
@@ -653,6 +721,10 @@ namespace MetaClient
                 //_obj.SetActive(true);
 
             }
+            if (isColor)
+            {
+                CreateColFun(parentid, _objPar, colItem);
+            }
             DRCustomBody[] dRCustomBodies = _bodydata.GetAllDataRows();
             for (int i = 0; i < dRCustomBodies.Length; i++)
             {

+ 2 - 1
Assets/GameMain/Scripts/UI/UICustomBtn.cs

@@ -89,6 +89,7 @@ namespace MetaClient
                     break;
                 case ETSStyple.Sure:
                     uICustom.TiaoSeSure();
+
                     //uICustom.
                     break;
                 case ETSStyple.Open:
@@ -130,7 +131,7 @@ namespace MetaClient
                 uICustom.HistoryAdd("ziDingyi" + "," + id + "");
                  //object[] _objects = new object[]{ eCustomStyple, id };
                 // uICustom.ClickBotton(_objects);
-                uICustom.ClickBotton(eCustomStyple, id,isZDYPart);
+                uICustom.ClickBotton(eCustomStyple, id,isZDYPart,isColor);
                 int _numIsZDYPart = isZDYPart ? 1 : 0;
                 //uICustom.HistoryAdd(eCustomStyple + "," + isZDYPart + "");
             }

+ 0 - 122
Assets/GameMain/Scripts/UIColorMix/ColorPick.cs

@@ -1,122 +0,0 @@
-using UnityEngine;
-using System.Collections;
-using UnityEngine.UI;
-public class ColorPick : MonoBehaviour
-{
-
- public Image Saturation;
-public Image Hue;
-public Image Paint;
- public RectTransform Point_Stauration;
-public RectTransform Point_Hue;
-private Sprite Saturation_Sprite;
-private Sprite Hue_Sprite;
- private Color32 currentHue = Color.red;
-    public Text colorText;
-private void Awake()
-    {
- }
-    private void Start()
-    {
-        UpdateStauration();
-        UpdateHue();
-    }
-    float sWidth = 200, sHeight = 200;
-    //更新饱和度
-    private void UpdateStauration()
-    {
-        Saturation_Sprite = Sprite.Create(new Texture2D((int)sWidth, (int)sHeight), new Rect(0, 0, sWidth, sHeight), new Vector2(0, 0));
-        for (int y = 0; y <= sHeight; y++)
-        {
-        for (int x = 0; x < sWidth; x++)
-         {
-                var pixColor = GetSaturation(currentHue, x / sWidth, y / sHeight);
-                Saturation_Sprite.texture.SetPixel(x, ((int)sHeight - y), pixColor);
-            }
-        }
-        Saturation_Sprite.texture.Apply();
-        Saturation.sprite = Saturation_Sprite;
-    }
-    //更新色泽度
-   private void UpdateHue()
-    {
-        float w = 50, h = 50;
-        Hue_Sprite = Sprite.Create(new Texture2D((int)w, (int)h), new Rect(0, 0, w, h), new Vector2(0, 0));
-        for (int y = 0; y <= h; y++)
-         {
-            for (int x = 0; x < w; x++)
-            {
-                var pixColor = GetHue(y / h);
-                Hue_Sprite.texture.SetPixel(x, ((int)h - y), pixColor);
-            }
-        }
-        Hue_Sprite.texture.Apply();
-        Hue.sprite = Hue_Sprite;
-    }
-    private Vector2 clickPoint = Vector2.zero;
-    public void OnStaurationClick(ColorPickClick sender)
-    {
-        var size2 = Saturation.rectTransform.sizeDelta / 2;
-        var pos = Vector2.zero;
-        pos.x = Mathf.Clamp(sender.ClickPoint.x, -size2.x, size2.x);
-        pos.y = Mathf.Clamp(sender.ClickPoint.y, -size2.y, size2.y);
-        Point_Stauration.anchoredPosition = clickPoint = pos;
-
-UpdateColor();
-    }
-    public void UpdateColor()
-    {
-        var size2 = Saturation.rectTransform.sizeDelta / 2;
-        var pos = clickPoint;
-        pos += size2;
-        var color = GetSaturation(currentHue, pos.x / Saturation.rectTransform.sizeDelta.x, 1 - pos.y / Saturation.rectTransform.sizeDelta.y);
-        Paint.color = color;
-        int r = Mathf.RoundToInt(color.r * 255.0f);
-        int g = Mathf.RoundToInt(color.g * 255.0f);
-        int b = Mathf.RoundToInt(color.b * 255.0f);
-        int a = Mathf.RoundToInt(color.a * 255.0f);
-        string theHexColor = string.Format("{0:X2}{1:X2}{2:X2}{3:X2}",r, g,b,a);
-        colorText.text = theHexColor + "";
-    }
-
-    public void OnHueClick(ColorPickClick sender)
-    {
-        var h = Hue.rectTransform.sizeDelta.y / 2.0f;
-        var y = Mathf.Clamp(sender.ClickPoint.y, -h, h);
-        Point_Hue.anchoredPosition = new Vector2(0, y);
-        y += h;
-        currentHue = GetHue(1 - y / Hue.rectTransform.sizeDelta.y);
-        UpdateStauration();
-        UpdateColor();
-    }
-    private static Color GetSaturation(Color color, float x, float y)
-    {
-        Color newColor = Color.white;
-        for (int i = 0; i < 3; i++)
-        {
-            if (color[i] != 1)
-            {
-                newColor[i] = (1 - color[i]) * (1 - x) + color[i];
-            }
-        }
-        newColor *= (1 - y);
-        newColor.a = 1;
-        return newColor;
-    }
-    //B,r,G,b,R,g //大写是升,小写是降
-    private readonly static int[] hues = new int[] { 2, 0, 1, 2, 0, 1 };
-    private readonly static Color[] colors = new Color[] { Color.red, Color.blue, Color.blue, Color.green, Color.green, Color.red };
-    private readonly static float c = 1.0f / hues.Length;
-    private static Color GetHue(float y)
-    {
-        y = Mathf.Clamp01(y);
-        var index = (int)(y / c);
-        var h = hues[index];
-        var newColor = colors[index];
-        float less = (y - index * c) / c;
-        newColor[h] = index % 2 == 0 ? less : 1 - less;
-        return newColor;
-    }
-}
-
-

+ 0 - 34
Assets/GameMain/Scripts/UIColorMix/ColorPickClick.cs

@@ -1,34 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.EventSystems;
-using System;
-using UnityEngine.UI;
-public class ColorPickClick : MonoBehaviour,IPointerDownHandler,IDragHandler
-{
-    // Start is called before the first frame update
-    void Start()
-    {
-        
-    }
-    public Button.ButtonClickedEvent Click;
-
-    public Vector3 ClickPoint { get; set; }
-    public void OnPointerDown(PointerEventData eventData)
-    {
-        var rect = transform as RectTransform;
-        ClickPoint = rect.InverseTransformPoint(eventData.position);
-        Click.Invoke();
-    }
-    public void OnDrag(PointerEventData eventData)
-    {
-        var rect = transform as RectTransform;
-        ClickPoint = rect.InverseTransformPoint(eventData.position);
-        Click.Invoke();
-    }
-    // Update is called once per frame
-    void Update()
-    {
-        
-    }
-}

+ 196 - 4
Assets/GameMain/UI/UIForms/CustomRole.prefab

@@ -318,6 +318,7 @@ MonoBehaviour:
   eTSStyple: 0
   isCreate: 1
   isZDYPart: 0
+  isColor: 0
 --- !u!114 &969039801
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -681,7 +682,7 @@ MonoBehaviour:
         m_Mode: 2
         m_Arguments:
           m_ObjectArgument: {fileID: 307491583}
-          m_ObjectArgumentAssemblyTypeName: ColorPickClick, Assembly-CSharp
+          m_ObjectArgumentAssemblyTypeName: MetaClient.ColorPickClick, Assembly-CSharp
           m_IntArgument: 0
           m_FloatArgument: 0
           m_StringArgument: 
@@ -1079,6 +1080,7 @@ MonoBehaviour:
   eTSStyple: 0
   isCreate: 1
   isZDYPart: 0
+  isColor: 0
 --- !u!114 &1617011046
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -1759,6 +1761,7 @@ MonoBehaviour:
   eTSStyple: 0
   isCreate: 1
   isZDYPart: 0
+  isColor: 0
 --- !u!114 &378539199
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -1941,6 +1944,7 @@ MonoBehaviour:
   eTSStyple: 0
   isCreate: 0
   isZDYPart: 0
+  isColor: 0
 --- !u!1 &788056142
 GameObject:
   m_ObjectHideFlags: 0
@@ -2155,6 +2159,7 @@ MonoBehaviour:
   eTSStyple: 3
   isCreate: 0
   isZDYPart: 0
+  isColor: 0
 --- !u!1 &840522405
 GameObject:
   m_ObjectHideFlags: 0
@@ -2894,6 +2899,7 @@ MonoBehaviour:
   eTSStyple: 0
   isCreate: 1
   isZDYPart: 0
+  isColor: 0
 --- !u!114 &817393583
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -3072,6 +3078,7 @@ MonoBehaviour:
   Point_Stauration: {fileID: 788056143}
   Point_Hue: {fileID: 1936106511}
   colorText: {fileID: 1191658826}
+  uICustom: {fileID: 1633349417}
 --- !u!222 &986032745
 CanvasRenderer:
   m_ObjectHideFlags: 0
@@ -3499,7 +3506,7 @@ MonoBehaviour:
         m_Mode: 2
         m_Arguments:
           m_ObjectArgument: {fileID: 1191884231}
-          m_ObjectArgumentAssemblyTypeName: ColorPickClick, Assembly-CSharp
+          m_ObjectArgumentAssemblyTypeName: MetaClient.ColorPickClick, Assembly-CSharp
           m_IntArgument: 0
           m_FloatArgument: 0
           m_StringArgument: 
@@ -4039,6 +4046,7 @@ MonoBehaviour:
   eTSStyple: 2
   isCreate: 0
   isZDYPart: 0
+  isColor: 0
 --- !u!1 &1441241190
 GameObject:
   m_ObjectHideFlags: 0
@@ -4400,6 +4408,7 @@ MonoBehaviour:
   eTSStyple: 0
   isCreate: 1
   isZDYPart: 1
+  isColor: 0
 --- !u!1 &1596525556
 GameObject:
   m_ObjectHideFlags: 0
@@ -4600,6 +4609,7 @@ MonoBehaviour:
   eTSStyple: 0
   isCreate: 0
   isZDYPart: 0
+  isColor: 0
 --- !u!1 &1669219676
 GameObject:
   m_ObjectHideFlags: 0
@@ -5105,6 +5115,7 @@ MonoBehaviour:
   eTSStyple: 0
   isCreate: 1
   isZDYPart: 0
+  isColor: 0
 --- !u!114 &25729863
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -5391,9 +5402,10 @@ MonoBehaviour:
   id: 0
   eButtonStyple: 2
   part: 0
-  eTSStyple: 0
+  eTSStyple: 1
   isCreate: 0
   isZDYPart: 0
+  isColor: 0
 --- !u!114 &1812341214
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -5533,6 +5545,7 @@ MonoBehaviour:
   eTSStyple: 0
   isCreate: 1
   isZDYPart: 0
+  isColor: 0
 --- !u!114 &1841796866
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -5672,6 +5685,7 @@ MonoBehaviour:
   eTSStyple: 0
   isCreate: 1
   isZDYPart: 0
+  isColor: 0
 --- !u!114 &15492327
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -6106,6 +6120,7 @@ GameObject:
   - component: {fileID: 5515995241951263415}
   - component: {fileID: 3674033136480510997}
   - component: {fileID: 1939353612}
+  - component: {fileID: 4603057719441660318}
   m_Layer: 5
   m_Name: tongkong
   m_TagString: Untagged
@@ -6212,6 +6227,27 @@ MonoBehaviour:
   m_OnClick:
     m_PersistentCalls:
       m_Calls: []
+--- !u!114 &4603057719441660318
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 2593306161924020123}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 92ed2ccb4917d65479290cf63dbc1d3f, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  uICustom: {fileID: 1633349417}
+  eCustomStyple: 1
+  id: 4
+  eButtonStyple: 3
+  part: 0
+  eTSStyple: 0
+  isCreate: 1
+  isZDYPart: 1
+  isColor: 1
 --- !u!1 &3178902926100071875
 GameObject:
   m_ObjectHideFlags: 0
@@ -6224,6 +6260,7 @@ GameObject:
   - component: {fileID: 4096192320265652467}
   - component: {fileID: 3296715759128348910}
   - component: {fileID: 2003966975}
+  - component: {fileID: 3085123634639591961}
   m_Layer: 5
   m_Name: faxing
   m_TagString: Untagged
@@ -6330,6 +6367,27 @@ MonoBehaviour:
   m_OnClick:
     m_PersistentCalls:
       m_Calls: []
+--- !u!114 &3085123634639591961
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 3178902926100071875}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 92ed2ccb4917d65479290cf63dbc1d3f, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  uICustom: {fileID: 1633349417}
+  eCustomStyple: 1
+  id: 1
+  eButtonStyple: 3
+  part: 0
+  eTSStyple: 0
+  isCreate: 1
+  isZDYPart: 1
+  isColor: 1
 --- !u!1 &3180815010443724346
 GameObject:
   m_ObjectHideFlags: 0
@@ -7285,6 +7343,7 @@ GameObject:
   - component: {fileID: 5323221619069775855}
   - component: {fileID: 5716178275579458296}
   - component: {fileID: 1037774675}
+  - component: {fileID: 883744085490641171}
   m_Layer: 5
   m_Name: yankuang
   m_TagString: Untagged
@@ -7391,6 +7450,27 @@ MonoBehaviour:
   m_OnClick:
     m_PersistentCalls:
       m_Calls: []
+--- !u!114 &883744085490641171
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 5487702084294534458}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 92ed2ccb4917d65479290cf63dbc1d3f, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  uICustom: {fileID: 1633349417}
+  eCustomStyple: 1
+  id: 3
+  eButtonStyple: 3
+  part: 0
+  eTSStyple: 0
+  isCreate: 1
+  isZDYPart: 1
+  isColor: 1
 --- !u!1 &5748545053184402040
 GameObject:
   m_ObjectHideFlags: 0
@@ -7403,6 +7483,7 @@ GameObject:
   - component: {fileID: 5512637743675136088}
   - component: {fileID: 7183633147254980049}
   - component: {fileID: 1205926406}
+  - component: {fileID: 6815820204761282168}
   m_Layer: 5
   m_Name: bizi
   m_TagString: Untagged
@@ -7509,6 +7590,27 @@ MonoBehaviour:
   m_OnClick:
     m_PersistentCalls:
       m_Calls: []
+--- !u!114 &6815820204761282168
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 5748545053184402040}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 92ed2ccb4917d65479290cf63dbc1d3f, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  uICustom: {fileID: 1633349417}
+  eCustomStyple: 1
+  id: 6
+  eButtonStyple: 3
+  part: 0
+  eTSStyple: 0
+  isCreate: 1
+  isZDYPart: 1
+  isColor: 1
 --- !u!1 &6003126087330071885
 GameObject:
   m_ObjectHideFlags: 0
@@ -7648,6 +7750,7 @@ MonoBehaviour:
   eTSStyple: 0
   isCreate: 0
   isZDYPart: 0
+  isColor: 0
 --- !u!1 &6035115271371984216
 GameObject:
   m_ObjectHideFlags: 0
@@ -7898,6 +8001,7 @@ GameObject:
   - component: {fileID: 1886375772645356070}
   - component: {fileID: 3918518874950261066}
   - component: {fileID: 1209848004}
+  - component: {fileID: 443178781361180710}
   m_Layer: 5
   m_Name: meimao
   m_TagString: Untagged
@@ -8004,6 +8108,27 @@ MonoBehaviour:
   m_OnClick:
     m_PersistentCalls:
       m_Calls: []
+--- !u!114 &443178781361180710
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 7124066042403080716}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 92ed2ccb4917d65479290cf63dbc1d3f, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  uICustom: {fileID: 1633349417}
+  eCustomStyple: 1
+  id: 5
+  eButtonStyple: 3
+  part: 0
+  eTSStyple: 0
+  isCreate: 1
+  isZDYPart: 1
+  isColor: 1
 --- !u!1 &7582375393325546160
 GameObject:
   m_ObjectHideFlags: 0
@@ -8303,6 +8428,7 @@ GameObject:
   - component: {fileID: 6880615389303931001}
   - component: {fileID: 662558865835010467}
   - component: {fileID: 2064204069}
+  - component: {fileID: 4217817219951845142}
   m_Layer: 5
   m_Name: lianxing
   m_TagString: Untagged
@@ -8409,6 +8535,27 @@ MonoBehaviour:
   m_OnClick:
     m_PersistentCalls:
       m_Calls: []
+--- !u!114 &4217817219951845142
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8132493438447289495}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 92ed2ccb4917d65479290cf63dbc1d3f, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  uICustom: {fileID: 1633349417}
+  eCustomStyple: 1
+  id: 2
+  eButtonStyple: 3
+  part: 0
+  eTSStyple: 0
+  isCreate: 1
+  isZDYPart: 1
+  isColor: 1
 --- !u!1 &8210909794227006718
 GameObject:
   m_ObjectHideFlags: 0
@@ -8421,6 +8568,7 @@ GameObject:
   - component: {fileID: 5118124123372598279}
   - component: {fileID: 2804514706962124450}
   - component: {fileID: 1000706358}
+  - component: {fileID: 8704406341597330284}
   m_Layer: 5
   m_Name: erduo
   m_TagString: Untagged
@@ -8527,6 +8675,27 @@ MonoBehaviour:
   m_OnClick:
     m_PersistentCalls:
       m_Calls: []
+--- !u!114 &8704406341597330284
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8210909794227006718}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 92ed2ccb4917d65479290cf63dbc1d3f, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  uICustom: {fileID: 1633349417}
+  eCustomStyple: 1
+  id: 7
+  eButtonStyple: 3
+  part: 0
+  eTSStyple: 0
+  isCreate: 1
+  isZDYPart: 1
+  isColor: 1
 --- !u!1 &8359233319713028392
 GameObject:
   m_ObjectHideFlags: 0
@@ -8595,7 +8764,7 @@ MonoBehaviour:
   m_OnCullStateChanged:
     m_PersistentCalls:
       m_Calls: []
-  m_Sprite: {fileID: 21300000, guid: d0ca39b623336474d8f76d3a147cf0c5, type: 3}
+  m_Sprite: {fileID: 21300000, guid: 58c014303c89ae445b4d54e9ce0f6203, type: 3}
   m_Type: 0
   m_PreserveAspect: 0
   m_FillCenter: 1
@@ -8625,6 +8794,7 @@ MonoBehaviour:
   eTSStyple: 4
   isCreate: 0
   isZDYPart: 0
+  isColor: 0
 --- !u!114 &7108929925837307999
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -9080,6 +9250,7 @@ GameObject:
   - component: {fileID: 5029799429571585495}
   - component: {fileID: 7946232057819381693}
   - component: {fileID: 930735934}
+  - component: {fileID: 5237522553528340056}
   m_Layer: 5
   m_Name: fuse
   m_TagString: Untagged
@@ -9186,6 +9357,27 @@ MonoBehaviour:
   m_OnClick:
     m_PersistentCalls:
       m_Calls: []
+--- !u!114 &5237522553528340056
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8902275294265289338}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 92ed2ccb4917d65479290cf63dbc1d3f, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  uICustom: {fileID: 1633349417}
+  eCustomStyple: 1
+  id: 8
+  eButtonStyple: 3
+  part: 0
+  eTSStyple: 0
+  isCreate: 1
+  isZDYPart: 1
+  isColor: 1
 --- !u!1 &9002796821760308659
 GameObject:
   m_ObjectHideFlags: 0

BIN
Assets/GameMain/UI/UISprites/CustomRole/yanseze.png


+ 128 - 0
Assets/GameMain/UI/UISprites/CustomRole/yanseze.png.meta

@@ -0,0 +1,128 @@
+fileFormatVersion: 2
+guid: 58c014303c89ae445b4d54e9ce0f6203
+TextureImporter:
+  internalIDToNameTable: []
+  externalObjects: {}
+  serializedVersion: 11
+  mipmaps:
+    mipMapMode: 0
+    enableMipMap: 0
+    sRGBTexture: 1
+    linearTexture: 0
+    fadeOut: 0
+    borderMipMap: 0
+    mipMapsPreserveCoverage: 0
+    alphaTestReferenceValue: 0.5
+    mipMapFadeDistanceStart: 1
+    mipMapFadeDistanceEnd: 3
+  bumpmap:
+    convertToNormalMap: 0
+    externalNormalMap: 0
+    heightScale: 0.25
+    normalMapFilter: 0
+  isReadable: 0
+  streamingMipmaps: 0
+  streamingMipmapsPriority: 0
+  grayScaleToAlpha: 0
+  generateCubemap: 6
+  cubemapConvolution: 0
+  seamlessCubemap: 0
+  textureFormat: 1
+  maxTextureSize: 2048
+  textureSettings:
+    serializedVersion: 2
+    filterMode: 1
+    aniso: 1
+    mipBias: 0
+    wrapU: 1
+    wrapV: 1
+    wrapW: 0
+  nPOTScale: 0
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 1
+  spriteExtrude: 1
+  spriteMeshType: 1
+  alignment: 0
+  spritePivot: {x: 0.5, y: 0.5}
+  spritePixelsToUnits: 100
+  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+  spriteGenerateFallbackPhysicsShape: 1
+  alphaUsage: 1
+  alphaIsTransparency: 1
+  spriteTessellationDetail: -1
+  textureType: 8
+  textureShape: 1
+  singleChannelComponent: 0
+  maxTextureSizeSet: 0
+  compressionQualitySet: 0
+  textureFormatSet: 0
+  applyGammaDecoding: 0
+  platformSettings:
+  - serializedVersion: 3
+    buildTarget: DefaultTexturePlatform
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 3
+    buildTarget: Standalone
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 3
+    buildTarget: iPhone
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 3
+    buildTarget: Android
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  spriteSheet:
+    serializedVersion: 2
+    sprites: []
+    outline: []
+    physicsShape: []
+    bones: []
+    spriteID: 5e97eb03825dee720800000000000000
+    internalID: 0
+    vertices: []
+    indices: 
+    edges: []
+    weights: []
+    secondaryTextures: []
+  spritePackingTag: 
+  pSDRemoveMatte: 0
+  pSDShowRemoveMatteOption: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: