Bläddra i källkod

修复红叉bug

baowen 3 dagar sedan
förälder
incheckning
c537cfe22e
1 ändrade filer med 29 tillägg och 0 borttagningar
  1. 29 0
      assets/hall/script/BaseZhaocha.ts

+ 29 - 0
assets/hall/script/BaseZhaocha.ts

@@ -101,6 +101,30 @@ export class BaseZhaocha extends Component {
                 })
             }
         }, this)
+        this.node.on(Node.EventType.MOUSE_UP,(event: EventTouch) => {
+            if (this.bool_cantouch == false) return
+            this.bool_cantouch = false
+            this.scheduleOnce(() => {
+                this.bool_cantouch = true
+            }, 0.1)
+            if (this.bool_needshowX) {
+                // AudioManager.instance.playBundleAudio("false")
+                // let worldpos = event.getUILocation()
+                let scpos = event.getLocation()
+                let wopos = this.cam.screenToWorld(new Vec3(scpos.x, scpos.y, 0))
+                // let localpos = this.arr_node_allitem[0].parent.getComponent(UITransform).convertToNodeSpaceAR(new Vec3(worldpos.x, worldpos.y))
+                let localPos1 = this.cam.convertToUINode(wopos,this.arr_node_allitem[0].parent)
+                let localpos = new Vec3(localPos1.x,localPos1.y)
+                LayerMgr.instance.ShowPrefab(BundleName.hall, "prefab/x", (node) => {
+                    node.parent = this.arr_node_allitem[0].parent
+                    node.setPosition(localpos)
+                    this.scheduleOnce(() => {
+                        node?.destroy()
+                    }, 0.3)
+                })
+            }
+        }, this)
+
 
         EventMgr.ins.addEventListener("game_tishi", this.ShowTishi, this)
 
@@ -156,6 +180,11 @@ export class BaseZhaocha extends Component {
         }
     }
 
+    onClickOver()
+    {
+        
+    }
+
     getNullItem() {
         // for (let index = 0; index < this.sv_cha.content.children.length; index++) {
         //     if (this.sv_cha.content.children[index].children.length == 0) {