Эх сурвалжийг харах

添加头像选择界面的自动定位

leiyasi 1 жил өмнө
parent
commit
1920566b8b

+ 9 - 12
GameClient/Assets/Game/HotUpdate/Views/RoleInfo/ChangeHeadView.cs

@@ -95,7 +95,7 @@ namespace GFGGame
                 if (result)
                 {
                     OnTabChange();
-                    PromptController.Instance.ShowFloatTextPrompt("保存成功");
+                    PromptController.Instance.ShowFloatTextPrompt("头像设置成功");
                 }
             }
             else
@@ -109,9 +109,10 @@ namespace GFGGame
                 if (result)
                 {
                     OnTabChange();
-                    PromptController.Instance.ShowFloatTextPrompt("保存成功");
+                    PromptController.Instance.ShowFloatTextPrompt("头像框设置成功");
                 }
             }
+            
         }
 
         private void RenderListItem(int index, GObject obj)
@@ -130,10 +131,6 @@ namespace GFGGame
             {
                 ItemProxy.ReqSetItemRead(headId).Coroutine();
             }
-            if (headId == RoleDataManager.headId)
-            {
-                _ui.m_list.selectedIndex = index;
-            }
             item.target.data = headId;
             UI_ListHeadItem.ProxyEnd();
         }
@@ -157,10 +154,6 @@ namespace GFGGame
             {
                 ItemProxy.ReqSetItemRead(headBorderId).Coroutine();
             }
-            if (headBorderId == RoleDataManager.headBorderId)
-            {
-                _ui.m_listBorder.selectedIndex = index;
-            }
             item.target.data = headBorderId;
             UI_ListHeadBorderItem.ProxyEnd();
         }
@@ -190,7 +183,9 @@ namespace GFGGame
             if (_ui.m_c1.selectedIndex == 0)
             {
                 _ui.m_list.numItems = _headCfgs.Count;
-                _ui.m_list.scrollPane.ScrollTop();
+                int selectedIndex = _headCfgs.FindIndex(x => x.id == _selectHeadId);
+                _ui.m_list.ScrollToView(selectedIndex);
+                _ui.m_list.selectedIndex = selectedIndex;
             }
             else
             {
@@ -200,7 +195,9 @@ namespace GFGGame
                     UpdateRedDot();
                 }
                 _ui.m_listBorder.numItems = _headBorderCfgs.Count;
-                _ui.m_listBorder.scrollPane.ScrollTop();
+                int selectedIndex = _headBorderCfgs.FindIndex(x => x.id == _selectHeadBorderId);
+                _ui.m_listBorder.ScrollToView(selectedIndex);
+                _ui.m_listBorder.selectedIndex = selectedIndex;
             }
             UpdateView();
         }