future 1 år sedan
förälder
incheckning
328105075f

+ 15 - 12
assets/resources/prefab/run/scene_page.prefab

@@ -165,8 +165,8 @@
     },
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": -959.9999999999999,
-      "y": -959.9999999999999,
+      "x": -960,
+      "y": -960,
       "z": 0
     },
     "_lrot": {
@@ -221,8 +221,8 @@
     },
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": -959.9999999999999,
-      "y": -959.9999999999999,
+      "x": 0,
+      "y": 0,
       "z": 0
     },
     "_lrot": {
@@ -262,8 +262,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 1919.9999999999998,
-      "height": 1919.9999999999998
+      "width": 1920,
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -402,8 +402,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 1919.9999999999998,
-      "height": 1919.9999999999998
+      "width": 1920,
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -758,8 +758,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 1919.9999999999998,
-      "height": 1919.9999999999998
+      "width": 1920,
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -908,8 +908,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 1919.9999999999998,
-      "height": 1919.9999999999998
+      "width": 1920,
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -970,6 +970,9 @@
     "__prefab": {
       "__id__": 47
     },
+    "scroll_view": {
+      "__id__": 2
+    },
     "content": {
       "__id__": 4
     },

+ 3 - 1
assets/script/edit/scroll_scene.ts

@@ -66,7 +66,9 @@ export class scroll_scene extends Component {
       
                     break;
                 case config.attributes_list_type.is_interaction:
-                    this.node.getComponent(ScrollView).enabled = this.m_att.is_interaction;
+                    if(this.node.getComponent(ScrollView)!=null) {
+                        this.node.getComponent(ScrollView).enabled = this.m_att.is_interaction;
+                    }
                 break;
                 
 

+ 16 - 1
assets/script/run/scene_page.ts

@@ -1,4 +1,4 @@
-import { _decorator, Color, Component, instantiate, misc, Node, Prefab, Size, Sprite, tween, Tween, UIOpacity, UITransform, Vec3, Widget } from 'cc';
+import { _decorator, Color, Component, instantiate, misc, Node, Prefab, ScrollView, Size, Sprite, tween, Tween, UIOpacity, UITransform, Vec3, Widget } from 'cc';
 import { ani_frame, att_ani_data, attributes_data, event_item, event_item_delete_drag_other, guo_ju_qing_dai_dao_ju, scene_item_data, widget_item_data, zhao_xi_jie_data, zhao_xi_jie_item_data } from '../../data/data';
 import { config } from '../config';
 import { tools } from '../tools';
@@ -18,6 +18,7 @@ class BindTarget{
 }
 @ccclass('scene_page')
 export class scene_page extends Component {
+    @property(Node) scroll_view:Node = null;
     @property(Node) content:Node = null;
     @property(Node) maskView:Node  = null;
     @property(Prefab) widget_click_prefab:Prefab = null;
@@ -353,6 +354,20 @@ export class scene_page extends Component {
 
     }
 
+    public startScrollTouch(){
+        if(this.maskView!=null){
+            this.scroll_view.getComponent(ScrollView).horizontal = true
+            this.scroll_view.getComponent(ScrollView).vertical = true
+        }
+    }
+
+    public stopScrollTouch(){
+        if(this.maskView!=null){
+            this.scroll_view.getComponent(ScrollView).horizontal = false
+            this.scroll_view.getComponent(ScrollView).vertical = false
+        }
+    }
+
     private getAniById(id:number){
         if(this.mAnimationList.length>0){
             for (let index = 0; index < this.mAnimationList.length; index++) {

+ 9 - 0
assets/script/run/widget/widget_base.ts

@@ -4,6 +4,7 @@ import { gameManager } from '../gameManager';
 import { ClientEvent } from '../../clientEvent';
 import { config } from '../../config';
 import { tools } from '../../tools';
+import { scene_page } from '../scene_page';
 const { ccclass, property } = _decorator;
 class BindTarget{
     color : Color;
@@ -269,6 +270,14 @@ export class widget_base extends Component {
         }
         return this.mIsShow;
     }
+    public getScenePage():scene_page {
+        if(this.node.parent.name=="content"){
+            let parent = this.node.parent.parent.parent.parent
+            let c_scene_page = parent.getComponent(scene_page)
+            return c_scene_page                   
+        }
+        return null
+    }
     protected registeredEvent(){
 
     }

+ 13 - 0
assets/script/run/widget/widget_drag.ts

@@ -43,6 +43,8 @@ export class widget_drag extends widget_base {
             let p = new Vec3(et.getUILocation().x,et.getUILocation().y)
             let n_p = this.node.parent.getComponent(UITransform).convertToNodeSpaceAR(p)
             this.node.position = new Vec3(n_p.x,n_p.y);
+
+            this.setScenePageScroll(false)
         })
         this.node.on(Node.EventType.TOUCH_MOVE,(et:EventTouch)=>{
             if(!this.mIsActive) return
@@ -53,9 +55,20 @@ export class widget_drag extends widget_base {
 
         this.node.on(Node.EventType.TOUCH_END,()=>{
             this.onEndEvent()
+
+            this.setScenePageScroll(true)
         })
     }
 
+    private setScenePageScroll(is_scroll:boolean) {
+        let scene_page = this.getScenePage()
+        if(scene_page==null) return
+        if(is_scroll) {
+            scene_page.startScrollTouch()
+        } else {
+            scene_page.stopScrollTouch()
+        }
+    }
 
     private onEndEvent(){
         if(!this.mIsActive) return