Bladeren bron

change scripts for custom button and back button

Jidongchen 3 jaren geleden
bovenliggende
commit
938fae0f9b

+ 146 - 26
Assets/GameMain/Scripts/UI/UICustom.cs

@@ -81,7 +81,10 @@ namespace MetaClient
         [Header("历史记录用于回退")]
         [SerializeField]
         private List<string> histroy;
-       
+
+        //用来判断是否是例如颜色框 滑块 调色板等额外的弹窗;
+        private bool histroyextra;
+
         private int part = 0;
 
 
@@ -154,10 +157,104 @@ namespace MetaClient
             Debug.Log(scrollbar.value);
         }
 
+        public void BackBtnFun()
+        {
+            if (histroyextra)
+            {
+                BackExtraFun();
+                histroyextra = false;
+                return;
+            }
+            switch (this.histroy.Count)
+            {
+                case 0:
+                    Debug.Log("返回上一层");
+                    break;
+                case 1:
+                    Debug.Log("返回选择捏脸/身体/服装");
+                    histroy.RemoveAt(histroy.Count - 1);
+                    Back_OneFun();
+                    break;
+                case 2:
+                    Debug.Log("进入选择界面");
+                    histroy.RemoveAt(histroy.Count - 1);
+                    Back_TwoFun();
+                    break;
+                default:
+                    Debug.Log("进入自定义或颜色");
+                    histroy.RemoveAt(histroy.Count - 1);
+                    Back_ThreeFun();
+                    break;
+
+            }
+        }
+        void Back_OneFun() {
+            ViewSetFalse();
+            toolView.SetActive(true);
+            //toolView.SetActive(true);
+            //bodyView.SetActive(false);
+            //nieLianView.SetActive(false);
+            //clothView.SetActive(false);
+        }
+
+        void BackExtraFun()
+        {
+            rightView.SetActive(true);
+            scrollbar.gameObject.SetActive(false);
+        }
+        void ViewSetFalse()
+        {
+            toolView.SetActive(false);
+            bodyView.SetActive(false);
+            nieLianView.SetActive(false);
+            clothView.SetActive(false);
+        }
+
+        void BackView_Extra(GameObject _obj,bool _bo) {
+            ViewSetFalse();
+           _obj.SetActive(_bo);
+            ViewSetChildTrue(_obj,_bo);
+        }
+
+        void ViewSetChildTrue(GameObject _obj,bool _bo)
+        {
+            _obj.transform.GetChild(0).gameObject.SetActive(_bo);
+            _obj.transform.GetChild(0).gameObject.SetActive(_bo);
+            _obj.transform.GetChild(2).gameObject.SetActive(!_bo);
+        }
+        void Back_TwoFun()
+        {
+            int _choose = int.Parse(histroy[1]);
+            switch ((ECustomStyple)_choose)
+            {
+                case ECustomStyple.Body:
+                    BackView_Extra(bodyView, true);
+                    break;
+                case ECustomStyple.Cloth:
+                    BackView_Extra(clothView, true);
+                    break;
+                case ECustomStyple.None:
+                    break;
+                case ECustomStyple.NieLian:
+                    BackView_Extra(nieLianView, true);
+                    break;
+            }
+            //toolView.SetActive(true);
+            //bodyView.SetActive(false);
+            //nieLianView.SetActive(false);
+            //clothView.SetActive(false);
+        }
+        void Back_ThreeFun()
+        {
+            toolView.SetActive(true);
+            bodyView.SetActive(false);
+            nieLianView.SetActive(false);
+            clothView.SetActive(false);
+        }
+
         /// <summary>
         /// 修改滑块
         /// </summary>
-
         public void SetValue(int _part,ECustomStyple eCustomStyple)
         {
 
@@ -181,8 +278,8 @@ namespace MetaClient
             //    return;
             //}
             whitebg.SetActive(true);
- 
 
+            this.eCustomStyple = eCustomStyple;
 
          
             //ECustomStyple _eCustomStyple = (ECustomStyple)int.Parse(_objects[0].ToString());
@@ -290,13 +387,18 @@ namespace MetaClient
             //等有捏脸表时改为捏脸
             IDataTable<DRCustomBody> _data = GameEntry.DataTable.GetDataTable<DRCustomBody>();
             _bodydata = GameEntry.DataTable.GetDataTable<DRCustomBody>();
-            int cengji = ziDingYi ? 0 : 1;
-            if (ziDingYi)
-            {    
-                GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
-                _obj.transform.SetParent(_objPar.transform);
-                UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
-                ChangeUICustom(_uICustomBtn, parentid, eCustomStyple);
+            int cengji = ziDingYi ?1:0;
+            if (!ziDingYi)
+            {
+
+                CreateZDYFun(parentid, _objPar);
+
+                //GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
+                //_obj.transform.SetParent(_objPar.transform);
+                //UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
+                //ChangeUICustom(_uICustomBtn, parentid, eCustomStyple);
+
+
                 //_uICustomBtn.id =parentid;
                 //_uICustomBtn.eCustomStyple = eCustomStyple;
                 //_obj.SetActive(true);
@@ -306,7 +408,7 @@ namespace MetaClient
             for (int i = 0; i < dRCustomBodies.Length; i++)
             {
                 Debug.Log(dRCustomBodies[i].Id);
-                if (dRCustomBodies[i].ParentStyple == parentid)
+                if (dRCustomBodies[i].ParentStyple == parentid&&dRCustomBodies[i].Cengji==cengji)
                 {
                     CreateButtonFun(dRCustomBodies[i].Icon, dRCustomBodies[i].Part, dRCustomBodies[i].Name, _objPar, dRCustomBodies[i].Id, dRCustomBodies[i].ButtonStyple, ECustomStyple.Body);
                 }
@@ -321,13 +423,18 @@ namespace MetaClient
             //等有服装时改为服装
             IDataTable<DRCustomBody> _data = GameEntry.DataTable.GetDataTable<DRCustomBody>();
             _bodydata = GameEntry.DataTable.GetDataTable<DRCustomBody>();
-            int cengji = ziDingYi ? 0 : 1;
-            if (ziDingYi)
+            int cengji = ziDingYi ?1:0;
+            if (!ziDingYi)
             {
-                GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
-                _obj.transform.SetParent(_objPar.transform);
-                UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
-                ChangeUICustom(_uICustomBtn, parentid, eCustomStyple);
+
+                CreateZDYFun(parentid, _objPar);
+
+                //GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
+                //_obj.transform.SetParent(_objPar.transform);
+                //UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
+                //ChangeUICustom(_uICustomBtn, parentid, eCustomStyple);
+
+
                 //_uICustomBtn.id = parentid;
                 //_uICustomBtn.eCustomStyple = eCustomStyple;
                 //_obj.SetActive(true);
@@ -337,7 +444,7 @@ namespace MetaClient
             for (int i = 0; i < dRCustomBodies.Length; i++)
             {
                 Debug.Log(dRCustomBodies[i].Id);
-                if (dRCustomBodies[i].ParentStyple == parentid)
+                if (dRCustomBodies[i].ParentStyple == parentid && dRCustomBodies[i].Cengji == cengji)
                 {
                     CreateButtonFun(dRCustomBodies[i].Icon, dRCustomBodies[i].Part, dRCustomBodies[i].Name, _objPar, dRCustomBodies[i].Id, dRCustomBodies[i].ButtonStyple, ECustomStyple.Body);
                 }
@@ -345,7 +452,13 @@ namespace MetaClient
           //  ChangeListBotton(_objPar);
         }
 
-
+        private void CreateZDYFun(int parentid,GameObject _objPar)
+        {
+            GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
+            _obj.transform.SetParent(_objPar.transform);
+            UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
+            ChangeUICustom(_uICustomBtn, parentid, eCustomStyple);
+        }
 
         public void ChangeUICustom(UICustomBtn uICustomBtn,int id, ECustomStyple eCustomStyple) 
         {
@@ -366,13 +479,19 @@ namespace MetaClient
             RemoveAllChildren(_objPar);
             IDataTable<DRCustomBody> _data = GameEntry.DataTable.GetDataTable<DRCustomBody>();
             _bodydata = GameEntry.DataTable.GetDataTable<DRCustomBody>();
-            int cengji = ziDingYi ? 0 : 1;
-            if (ziDingYi)
+            int cengji = ziDingYi ?1:0;
+            if (!ziDingYi)
             {
-                GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
-                _obj.transform.SetParent(_objPar.transform);
-                UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
-                ChangeUICustom(_uICustomBtn, parentid, eCustomStyple);
+
+                CreateZDYFun(parentid, _objPar);
+
+
+                //GameObject _obj = GameObject.Instantiate(ziDingYiBtn);
+                //_obj.transform.SetParent(_objPar.transform);
+                //UICustomBtn _uICustomBtn = _obj.GetComponent<UICustomBtn>();
+                //ChangeUICustom(_uICustomBtn, parentid, eCustomStyple);
+
+
                 //_uICustomBtn.id = parentid;
                 //_uICustomBtn.eCustomStyple = eCustomStyple;
                 //_obj.SetActive(true);
@@ -382,7 +501,7 @@ namespace MetaClient
             for (int i = 0; i < dRCustomBodies.Length; i++)
             {
                 Debug.Log(dRCustomBodies[i].Id);
-                if (dRCustomBodies[i].ParentStyple == parentid)
+                if (dRCustomBodies[i].ParentStyple == parentid && dRCustomBodies[i].Cengji == cengji)
                 {
                     CreateButtonFun(dRCustomBodies[i].Icon, dRCustomBodies[i].Part, dRCustomBodies[i].Name, _objPar, dRCustomBodies[i].Id, dRCustomBodies[i].ButtonStyple, ECustomStyple.Body);
                 }
@@ -528,6 +647,7 @@ namespace MetaClient
         Scroll,
         TiaoSe,
         NorButton,
+        Back
     }
     public enum ENieLianStyple {
         None,

+ 3 - 0
Assets/GameMain/Scripts/UI/UICustomBtn.cs

@@ -62,6 +62,9 @@ namespace MetaClient
                 case EButtonStyple.NorButton:
                     CreatImgListFun();
                     break;
+                case EButtonStyple.Back:
+
+                    break;
             }
 
 

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


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


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


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


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


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


+ 92 - 0
Assets/GameMain/UI/UISprites/CustomRole/jingjian.png.meta

@@ -0,0 +1,92 @@
+fileFormatVersion: 2
+guid: 1108590e681998042b48076d7d60ef61
+TextureImporter:
+  internalIDToNameTable: []
+  externalObjects: {}
+  serializedVersion: 11
+  mipmaps:
+    mipMapMode: 0
+    enableMipMap: 1
+    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: 0
+    wrapV: 0
+    wrapW: 0
+  nPOTScale: 1
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 0
+  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: 0
+  spriteTessellationDetail: -1
+  textureType: 0
+  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
+  spriteSheet:
+    serializedVersion: 2
+    sprites: []
+    outline: []
+    physicsShape: []
+    bones: []
+    spriteID: 
+    internalID: 0
+    vertices: []
+    indices: 
+    edges: []
+    weights: []
+    secondaryTextures: []
+  spritePackingTag: 
+  pSDRemoveMatte: 0
+  pSDShowRemoveMatteOption: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

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


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


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

@@ -0,0 +1,128 @@
+fileFormatVersion: 2
+guid: c4b5766b8e896cb449ee7c2435feff48
+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: