future 1 year ago
parent
commit
3e63eb83b7

+ 8 - 5
assets/resources/prefab/run/scene_page.prefab

@@ -222,7 +222,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": -540,
-      "y": -959.9999999999999,
+      "y": -960,
       "z": 0
     },
     "_lrot": {
@@ -263,7 +263,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1919.9999999999998
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -403,7 +403,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1919.9999999999998
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -759,7 +759,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1919.9999999999998
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -909,7 +909,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1919.9999999999998
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -970,6 +970,9 @@
     "__prefab": {
       "__id__": 47
     },
+    "scroll_view": {
+      "__id__": 2
+    },
     "content": {
       "__id__": 4
     },

+ 2 - 2
assets/script/run/scene_layer.ts

@@ -24,7 +24,7 @@ export class scene_layer extends Component {
     private mAudioList:Map<string,Node> = new Map;
     private up_id_string = '_up'
     private next_id_string = '_next'
-    private is_show_cur_directionBtn:boolean = true; //是否显示当前方向按钮,默认显示
+    private is_show_cur_directionBtn:boolean = false; //是否显示当前方向按钮,默认隐藏
     protected start(): void {
         this.node.addComponent(AudioSource)
     }
@@ -50,7 +50,7 @@ export class scene_layer extends Component {
         this.mCurPage = 0
         this.mAudioList.clear()
         this.unscheduleAllCallbacks()
-        this.is_show_cur_directionBtn = true
+        this.is_show_cur_directionBtn = false
         ClientEvent.off(config.EventRun.NOTICE_EVENT,this.beActive.bind(this),this)
     }
 

+ 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