-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShrineActivity.java
92 lines (76 loc) · 3.19 KB
/
ShrineActivity.java
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
90
91
92
package ca.spiralmachines.limbscyberpunk;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import org.w3c.dom.Text;
public class ShrineActivity extends AppCompatActivity {
Button backButton;
Context context;
DatabaseHelper databaseHelper;
private Button dialogOkayButton;
private Text dialogText;
private TextView dialogTextView;
Button getLimbsButton;
private Dialog messageDialog;
Character playerCharacter;
private void givePlayerLimbs() {
Limb limb = LimbFactory.limb000(this.context, this.playerCharacter.getId());
this.playerCharacter.getSpareLimbs().add(limb);
limb = LimbFactory.limb001(this.context, this.playerCharacter.getId());
this.playerCharacter.getSpareLimbs().add(limb);
limb = LimbFactory.limb002(this.context, this.playerCharacter.getId());
this.playerCharacter.getSpareLimbs().add(limb);
limb = LimbFactory.limb003(this.context, this.playerCharacter.getId());
this.playerCharacter.getSpareLimbs().add(limb);
limb = LimbFactory.limb004(this.context, this.playerCharacter.getId());
this.playerCharacter.getSpareLimbs().add(limb);
this.databaseHelper.saveCharacter(this.playerCharacter);
this.dialogTextView.setText("You now have new Limbs.");
this.messageDialog.show();
}
private void startActivitySequence(Intent paramIntent) {
startActivity(paramIntent);
finish();
overridePendingTransition(17432576, 17432577);
}
protected void onCreate(Bundle paramBundle) {
super.onCreate(paramBundle);
setContentView(2131492897);
this.context = (Context)this;
DatabaseHelper databaseHelper = new DatabaseHelper(this.context);
this.databaseHelper = databaseHelper;
this.playerCharacter = databaseHelper.getCharacter(1);
this.getLimbsButton = (Button)findViewById(2131296347);
this.backButton = (Button)findViewById(2131296351);
Dialog dialog = new Dialog(this.context);
this.messageDialog = dialog;
dialog.setContentView(2131492914);
this.dialogOkayButton = (Button)this.messageDialog.findViewById(2131296349);
this.dialogTextView = (TextView)this.messageDialog.findViewById(2131296678);
this.messageDialog.setCancelable(true);
this.getLimbsButton.setOnClickListener(new View.OnClickListener() {
final ShrineActivity this$0;
public void onClick(View param1View) {
ShrineActivity.this.givePlayerLimbs();
}
});
this.backButton.setOnClickListener(new View.OnClickListener() {
final ShrineActivity this$0;
public void onClick(View param1View) {
Intent intent = new Intent(ShrineActivity.this.context, PlayActivity.class);
ShrineActivity.this.startActivitySequence(intent);
}
});
this.dialogOkayButton.setOnClickListener(new View.OnClickListener() {
final ShrineActivity this$0;
public void onClick(View param1View) {
ShrineActivity.this.messageDialog.dismiss();
}
});
}
}