summaryrefslogtreecommitdiff
path: root/NET/worlds/console/BBWObjClickedCommand.java
blob: 7c925f57843e37291f0bdf2831e449953d070a19 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*    */ package NET.worlds.console;
/*    */ 
/*    */ import NET.worlds.scape.DeepEnumeration;
/*    */ import NET.worlds.scape.MouseDownEvent;
/*    */ import NET.worlds.scape.MouseDownHandler;
/*    */ import NET.worlds.scape.Pilot;
/*    */ import NET.worlds.scape.Room;
/*    */ import NET.worlds.scape.SuperRoot;
/*    */ import java.io.DataInputStream;
/*    */ import java.io.DataOutputStream;
/*    */ import java.io.IOException;
/*    */ 
/*    */ public class BBWObjClickedCommand extends BlackBoxCommand
/*    */ {
/*    */   private String objUrl;
/*    */   int x;
/*    */   int y;
/*    */   char key;
/*    */   
/*    */   public BBWObjClickedCommand()
/*    */   {
/* 22 */     this.commandType = 4;
/*    */   }
/*    */   
/*    */   public BBWObjClickedCommand(String obj, char pkey, int px, int py) {
/* 26 */     this();
/* 27 */     this.objUrl = new String(obj);
/* 28 */     this.key = pkey;
/* 29 */     this.x = px;
/* 30 */     this.y = py;
/*    */   }
/*    */   
/*    */   public boolean execute()
/*    */   {
/* 35 */     MouseDownHandler target = null;
/* 36 */     if (Pilot.getActive() == null) {
/* 37 */       return false;
/*    */     }
/* 39 */     Room r = Pilot.getActive().getRoom();
/* 40 */     if (r == null) {
/* 41 */       return false;
/*    */     }
/* 43 */     DeepEnumeration<?> de = new DeepEnumeration();
/* 44 */     r.getChildren(de);
/* 45 */     while (de.hasMoreElements()) {
/* 46 */       Object o = de.nextElement();
/* 47 */       if (((o instanceof MouseDownHandler)) && 
/* 48 */         (((SuperRoot)o).getName().equals(this.objUrl))) {
/* 49 */         target = (MouseDownHandler)o;
/* 50 */         break;
/*    */       }
/*    */     }
/*    */     
/*    */ 
/* 55 */     if (target == null) {
/* 56 */       doCallback(false);
/* 57 */       return false;
/*    */     }
/*    */     
/* 60 */     MouseDownEvent e = new MouseDownEvent(0, null, this.key, this.x, this.y);
/* 61 */     target.handle(e);
/* 62 */     doCallback(true);
/* 63 */     return true;
/*    */   }
/*    */   
/*    */   public void save(DataOutputStream dos) throws IOException
/*    */   {
/* 68 */     super.save(dos);
/* 69 */     dos.writeInt(this.x);
/* 70 */     dos.writeInt(this.y);
/* 71 */     dos.writeChar(this.key);
/* 72 */     dos.writeUTF(this.objUrl);
/*    */   }
/*    */   
/*    */   public void load(DataInputStream dis) throws IOException
/*    */   {
/* 77 */     super.load(dis);
/* 78 */     this.x = dis.readInt();
/* 79 */     this.y = dis.readInt();
/* 80 */     this.key = dis.readChar();
/* 81 */     this.objUrl = dis.readUTF();
/*    */   }
/*    */ }


/* Location:              C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\BBWObjClickedCommand.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */