Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.qnszt.android.akasztofa.activities;
- import org.json.JSONObject;
- import org.qnszt.android.akasztofa.R;
- import org.qnszt.android.akasztofa.program.Game;
- import org.qnszt.android.json.Json;
- import org.qnszt.android.json.JsonManager;
- import android.app.Activity;
- import android.os.Bundle;
- import android.text.Editable;
- import android.text.TextWatcher;
- import android.view.View;
- import android.widget.EditText;
- import android.widget.TextView;
- import android.widget.Toast;
- public class MegfejtoActivity extends Activity {
- TextView tvWrong;
- TextView tv;
- EditText et;
- TextView tvcsakprobahoz;
- TextView eletlab;
- String input;
- boolean game;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_megfejto);
- tvcsakprobahoz = (TextView) findViewById(R.id.textView3);
- tvWrong = (TextView) findViewById(R.id.tvWrong);
- tv = (TextView) findViewById(R.id.textView2);
- tv.setText(Game.state);
- et = (EditText) findViewById(R.id.editText1);
- eletlab = (TextView) findViewById(R.id.eletLab);
- //eletlab.setText(""+Game.lives);
- eletlab.setText(String.valueOf(Game.lives));
- game = true;
- et.addTextChangedListener(new TextWatcher() {
- public void afterTextChanged(Editable s) {
- }
- public void beforeTextChanged(CharSequence s, int start,
- int count, int after) {
- }
- public void onTextChanged(CharSequence s, int start,
- int before, int count) {
- eletlab.setText(String.valueOf(Game.lives));
- if (et.getText().toString().length() == 1 && game) {
- char c = et.getText().toString().charAt(0);
- if (Game.addChar(c)) {
- tv.setText(Game.state);
- } else {
- Game.throwToast(MegfejtoActivity.this, "EZT A BETŰT MÁR TIPPELTED");
- }
- if (Game.endGame()) {
- game = false;
- //JsonManager.setContext(MegfejtoActivity.this);
- if (Game.lives == 0) {
- Toast.makeText(MegfejtoActivity.this,"vesztettél", Toast.LENGTH_LONG).show();
- //Json json = JsonManager.createJson("", "", "page", "guest", "", "vereseg");
- } else {
- Toast.makeText(MegfejtoActivity.this,"nyertél", Toast.LENGTH_LONG).show();
- //Json json = JsonManager.createJson("", "", "page", "guest", "", "gyozelem");
- }
- //JSONObject answer = JsonManager.sendJson(json);
- }
- et.setText("");
- tvWrong.setText(Game.wrong);
- }
- }
- });
- }
- private void json(String cn, String cpw, String p, String un, String upw, String m) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement