| 
					
				 | 
			
			
				@@ -5,6 +5,7 @@ using UI.ActivityHuaRongDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using FairyGUI; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.Threading.Tasks; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.Threading; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using System; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -13,7 +14,14 @@ namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private UI_ActivityHuaRongDaoUI _ui; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public class Grid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            public Vector2 pos; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            public Vector2 pos; // UI坐标 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            public int num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public class GridInfo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            public int col; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            public int row; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             public int num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -21,9 +29,10 @@ namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private readonly int _gridNum = 3; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private List<GObject> _items; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private bool _gameStart; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private HuarongRoadGame cfg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private CancellationTokenSource cancellationTokenSource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private GObject blankItem; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private HuarongRoadGame _cfg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private int _activityID; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private CancellationTokenSource _cancellationTokenSource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private GObject _blankItem; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public override void Dispose() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -42,35 +51,42 @@ namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             packageName = UI_ActivityHuaRongDaoUI.PACKAGE_NAME; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _ui = UI_ActivityHuaRongDaoUI.Create(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             viewCom = _ui.target; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            isfullScreen = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("quanping_moren_bg"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             isReturnView = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _ui.m_item.target.visible = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _ui.m_btnBack.onClick.Add(OnBtnBackClick); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_btnLookPic.onClick.Add(OnClickBtnShowOriginPic); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_btnHidePic.onClick.Add(OnClickBtnHideOriginPic); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_state.onChanged.Add(OnChangeLookOriginState); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //_ui.m_btnLookPic.onClick.Add(OnClickBtnShowOriginPic); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //_ui.m_btnHidePic.onClick.Add(OnClickBtnHideOriginPic); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _ui.m_btnRefresh.onClick.Add(OnClickBtnRefresh); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             InitGridInfo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             CreateItems(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 初始化空白处图片 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (blankItem == null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (_blankItem == null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                blankItem = UIPackage.CreateObject("ActivityHuaRongDao", "item"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                _ui.target.AddChild(blankItem); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _blankItem = UIPackage.CreateObject("ActivityHuaRongDao", "item"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _ui.target.AddChild(_blankItem); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_maskTouch.onTouchBegin.Add(TouchBegin); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_maskTouch.onTouchEnd.Add(TouchEnd); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         protected override void OnShown() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             base.OnShown(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            cfg = (HuarongRoadGame)viewData; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            object[] arr = viewData as object[]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _cfg = (HuarongRoadGame)arr[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _activityID = (int)arr[1]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            blankItem.visible = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _gameStart = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            cancellationTokenSource = new CancellationTokenSource(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Task task = StartAnimation(cancellationTokenSource.Token); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            RefreshData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _cancellationTokenSource = new CancellationTokenSource(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Task task = StartAnimation(_cancellationTokenSource.Token); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 倒计时相关 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //ResetCountdown(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -193,7 +209,7 @@ namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Vector2 lastPos = zeroPos; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             while (num < configStep) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                int n = Random.Range(0, 4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                int n = UnityEngine.Random.Range(0, 4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Vector2 tempPos = zeroPos + dirArr[n]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (tempPos != lastPos && tempPos.x >= 0 && tempPos.y >= 0 && tempPos.x < _gridNum && tempPos.y < _gridNum) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -224,7 +240,8 @@ namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     _items[itemIndex].position = _gridArr[i, j].pos; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     UI_item item = UI_item.Proxy(_items[itemIndex]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     item.m_index.text = _gridArr[i, j].num.ToString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    item.m_icon.url = string.Format("ui://ActivityHuaRongDao/hrd_1-{0}", _gridArr[i, j].num + 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    int groupID = _cfg.resArr[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    item.m_icon.url = ResPathUtil.GetMiniGamePicPath(HuarongRoadCfgArray.Instance.GetCfgsByid(groupID)[_gridArr[i, j].num].resName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     _items[itemIndex].data = _gridArr[i, j].num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     UI_item.ProxyEnd(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     ++itemIndex; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -241,7 +258,9 @@ namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 GObject gObject = UIPackage.CreateObject("ActivityHuaRongDao", "item"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 gObject.name = "item" + i; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                gObject.onClick.Add(OnItemClick); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //gObject.onClick.Add(OnItemClick); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //gObject.onTouchEnd.Add(TouchEnd); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //gObject.onTouchBegin.Add(TouchBegin); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 _ui.m_items.target.AddChild(gObject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 UI_item item = UI_item.Proxy(gObject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 _items.Add(gObject); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -249,97 +268,134 @@ namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private void OnItemClick(EventContext eventContext) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private void ControlMenuItemVisual(bool show = true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            GObject obj = eventContext.sender as GObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            int num = (int)obj.data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Grid newGrid = CheckCanMove(num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (newGrid != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                _ui.m_items.target.touchable = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                obj.TweenMove(newGrid.pos, 0.1f).OnComplete(() => 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    _ui.m_items.target.touchable = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (CheckWin()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        _ui.m_maskGlobal.visible = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Win(cancellationTokenSource.Token); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_btnBack.visible = show; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_btnLookPic.visible = show; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_btnHidePic.visible = show; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_btnRefresh.visible = show; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private Vector2 inputPos = new Vector2(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private void TouchBegin(EventContext context) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            inputPos.x = context.inputEvent.x; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            inputPos.y = context.inputEvent.y; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private Grid CheckCanMove(int num) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private void TouchEnd(EventContext context) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            int indexX = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            int indexY = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            GridInfo numGrid = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            GridInfo nullGrid = new GridInfo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 找到格子 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 找到空格子 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (int i = 0; i < _gridNum; i++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 for (int j = 0; j < _gridNum; j++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (_gridArr[i, j].num == num) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (_gridArr[i, j].num == 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        indexX = i; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        indexY = j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        nullGrid.row = i; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        nullGrid.col = j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 判断格子四个方向是否有空格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (CheckHaveNullGrid(indexX - 1, indexY) || CheckHaveNullGrid(indexX, indexY - 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                || CheckHaveNullGrid(indexX + 1, indexY) || CheckHaveNullGrid(indexX, indexY + 1)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 左 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if ((context.inputEvent.x - inputPos.x) < 0 && Mathf.Abs(context.inputEvent.x - inputPos.x) > Mathf.Abs(context.inputEvent.y - inputPos.y)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return UpdateGridInfo(num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                numGrid = CheckHaveNumGrid(nullGrid.row, nullGrid.col + 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 右 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if ((context.inputEvent.x - inputPos.x) > 0 && Mathf.Abs(context.inputEvent.x - inputPos.x) > Mathf.Abs(context.inputEvent.y - inputPos.y)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                numGrid = CheckHaveNumGrid(nullGrid.row, nullGrid.col - 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 上 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if ((context.inputEvent.y - inputPos.y) < 0 && Mathf.Abs(context.inputEvent.y - inputPos.y) > Mathf.Abs(context.inputEvent.x - inputPos.x)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                numGrid = CheckHaveNumGrid(nullGrid.row + 1, nullGrid.col); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 下 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if ((context.inputEvent.y - inputPos.y) > 0 && Mathf.Abs(context.inputEvent.y - inputPos.y) > Mathf.Abs(context.inputEvent.x - inputPos.x)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                numGrid = CheckHaveNumGrid(nullGrid.row - 1, nullGrid.col); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (numGrid != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                int num = numGrid.num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Grid grid = UpdateGridInfo(numGrid, nullGrid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                MoveItem(grid, num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private bool CheckHaveNullGrid(int indexX, int indexY) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private void MoveItem(Grid newGrid, int changeNum) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (indexX >= 0 && indexX < _gridNum) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for(int i = 0; i < _items.Count; i++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (indexY >= 0 && indexY < _gridNum) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                GObject obj = _items[i]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                int num = (int)obj.data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(num == changeNum) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return _gridArr[indexX, indexY].num == 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    _ui.m_maskGlobal.visible = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    obj.TweenMove(newGrid.pos, 0.1f).OnComplete(() => 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        _ui.m_maskGlobal.visible = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (CheckWin()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            ControlMenuItemVisual(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Win(_cancellationTokenSource.Token); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private Grid UpdateGridInfo(int num) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 查看空白格附近是否存在数字格 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="indexX"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="indexY"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private GridInfo CheckHaveNumGrid(int indexX, int indexY) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Vector2 nullGridindex = new Vector2(-1, 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Vector2 numGridindex = new Vector2(-1, 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            for (int i = 0; i < _gridNum; i++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (indexX >= 0 && indexX < _gridNum) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                for (int j = 0; j < _gridNum; j++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (indexY >= 0 && indexY < _gridNum) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (_gridArr[i, j].num == num) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        numGridindex = new Vector2(i, j); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    else if (_gridArr[i, j].num == 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        nullGridindex = new Vector2(i, j); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (numGridindex.x != -1 && nullGridindex.x != -1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    GridInfo grid = new GridInfo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    grid.row = indexX; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    grid.col = indexY; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    grid.num = _gridArr[indexX, indexY].num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return grid; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _gridArr[(int)numGridindex.x, (int)numGridindex.y].num = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _gridArr[(int)nullGridindex.x, (int)nullGridindex.y].num = num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 交换数字格和空白格的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="numGrid"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="nullGrid"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private Grid UpdateGridInfo(GridInfo numGrid, GridInfo nullGrid) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _gridArr[numGrid.row, numGrid.col].num = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _gridArr[nullGrid.row, nullGrid.col].num = numGrid.num; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return _gridArr[(int)nullGridindex.x, (int)nullGridindex.y]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return _gridArr[nullGrid.row, nullGrid.col]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private bool CheckWin() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -383,43 +439,29 @@ namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private async Task Win(CancellationToken cancellationToken) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            await Task.Delay(200, cancellationToken); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            blankItem.visible = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            blankItem.position = _gridArr[0, 0].pos; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            UI_item item = UI_item.Proxy(blankItem); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            item.m_icon.url = string.Format("ui://ActivityHuaRongDao/hrd_1-{0}", 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            UI_item.ProxyEnd(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            await Task.Delay(400, cancellationToken); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 关卡推进 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            int passLevel = cfg.resArr[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ActivityHuaRongDaoEntryView.curLevel = Mathf.Max(passLevel, ActivityHuaRongDaoEntryView.curLevel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            EventAgent.DispatchEvent(ConstMessage.ACTIVITY_HUARONGDAO_UPDATE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 弹出成功界面 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ViewManager.Show<ActivityHuaRongDaoSuccessView>(cfg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private int countDownNum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private void Countdown(object param) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_seconds.text = countDownNum.ToString() + "s"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            --countDownNum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 请求游戏结束协议 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            await MiniGameProxy.ReqMiniGameEnd(_cfg.id, _cfg.type, 0, true, _activityID, false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (countDownNum < 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // 成功动画 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_showMask.Play(async () => 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                _ui.m_tips.visible = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Timers.inst.Remove(Countdown); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _ui.m_hideMask.Play(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 _gameStart = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private void ResetCountdown() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            countDownNum = 3; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_tips.visible = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Timers.inst.Remove(Countdown); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                await Task.Delay(400, cancellationToken); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 刷新华容道入口界面UI 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                EventAgent.DispatchEvent(ConstMessage.ACTIVITY_HUARONGDAO_UPDATE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 弹出成功界面 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ViewManager.Show<ActivityHuaRongDaoSuccessView>(_cfg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            await Task.Delay(200, cancellationToken); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _blankItem.visible = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _blankItem.position = _gridArr[0, 0].pos; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            UI_item item = UI_item.Proxy(_blankItem); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int groupID = _cfg.resArr[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            item.m_icon.url = ResPathUtil.GetMiniGamePicPath(HuarongRoadCfgArray.Instance.GetCfgsByid(groupID)[0].resName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            UI_item.ProxyEnd(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private void OnBtnBackClick() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -477,10 +519,10 @@ namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 await Task.Delay(200, cancellationToken); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                numList = GetArrByConfigStep(cfg.step); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                numList = GetArrByConfigStep(_cfg.step); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 while (CheckListCorrect(numList)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    numList = GetArrByConfigStep(cfg.step); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    numList = GetArrByConfigStep(_cfg.step); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 SetGridInfo(numList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 InitItems(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -492,14 +534,22 @@ namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private void RefreshData() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _blankItem.visible = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _gameStart = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_state.selectedIndex = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ControlMenuItemVisual(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 取消异步函数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public void StopMyAsyncFunction() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (cancellationTokenSource != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (_cancellationTokenSource != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                cancellationTokenSource.Cancel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                cancellationTokenSource.Dispose(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                cancellationTokenSource = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _cancellationTokenSource.Cancel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _cancellationTokenSource.Dispose(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _cancellationTokenSource = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -524,28 +574,27 @@ namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     items[itemIndex].position = _gridArr[i, j].pos; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     UI_item item = UI_item.Proxy(items[itemIndex]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     item.m_index.text = _gridArr[i, j].num.ToString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    item.m_icon.url = string.Format("ui://ActivityHuaRongDao/hrd_1-{0}", _gridArr[i, j].num + 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //item.m_icon.url = string.Format("ui://ActivityHuaRongDao/hrd_1-{0}", _gridArr[i, j].num + 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    int groupID = _cfg.resArr[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    item.m_icon.url = ResPathUtil.GetMiniGamePicPath(HuarongRoadCfgArray.Instance.GetCfgsByid(groupID)[_gridArr[i, j].num].resName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     UI_item.ProxyEnd(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     ++itemIndex; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private void OnClickBtnShowOriginPic() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_items.target.visible = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_itemsOrigin.target.visible = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private void OnClickBtnHideOriginPic() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private void OnChangeLookOriginState() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_items.target.visible = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_itemsOrigin.target.visible = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            bool look = (_ui.m_state.selectedIndex == 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_maskTouch.touchable = !look; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_items.target.visible = !look; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_itemsOrigin.target.visible = look; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private void OnClickBtnRefresh() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            StartAnimation(cancellationTokenSource.Token); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_state.selectedIndex = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            StartAnimation(_cancellationTokenSource.Token); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |