Android Open Source - TheFirstMyth02 Game Main Activity






From Project

Back to project page TheFirstMyth02.

License

The source code is released under:

MIT License

If you think the Android project TheFirstMyth02 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.game.fengshen;
import com.androidquery.AQuery;
import com.example.fengshen.R;
import com.game.base.BaseInfo;
import com.game.commen.AStar;
import com.game.commen.ActionToDo;
import com.game.commen.GetImgCommen;
import com.game.data.RoleData;
import com.game.renwu.SpiritMain;
/*from  w w  w .j  ava  2s.c  o m*/
import dalvik.system.*;
import android.os.Bundle;
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.Toast;

public class GameMainActivity extends Activity {

  int lastnpc = 0;
  private final static int CWJ_HEAP_SIZE = 6* 1024* 1024 ;
  private static AQuery aq ;
  private boolean showflag =false;
  private boolean showflagliao =false;
  private boolean showflagjineng =false;
  
  public void main222(){
        int[][] map=new int[][]{// ????
                {1,1,1,1,0,1,1,1,1,1},
                {1,1,1,1,0,1,1,1,1,1},
                {1,1,1,1,0,1,1,1,1,1},
                {1,1,1,1,0,1,1,1,1,1},
                {1,1,1,1,0,1,1,1,1,1},
                {1,1,1,1,1,1,1,1,1,1}
        };
        AStar aStar=new AStar(map, 6, 10);
        int flag=aStar.search(4, 0, 3, 8);
        if(flag==-1){
          tip("??????????");
        }else if(flag==0){
          tip("?????");
        }else{
            for(int x=0;x<6;x++){
                for(int y=0;y<10;y++){
                    if(map[x][y]==1){
                      tip("?");
                    }else if(map[x][y]==0){
                      tip("?");
                    }else if(map[x][y]==-1){
                      tip("?");
                    }
                }
                System.out.println();
            }
            for(int i=0; i<aStar.maps.length; i+=2){
              tip(aStar.maps[i]+"");
              tip(aStar.maps[i+1]+"");
            }
        }
    }
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    // ?????
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_game_main);
    // ???????-?????????????????
    aq = new AQuery(this);

    aq.id(R.id.jineng_feijian).clicked(new OnClickListener() {
      
      @Override
      public void onClick(View v) {
        // TODO Auto-generated method stuba
        if(BaseInfo.getAttack_X()>0&&BaseInfo.getAttack_X()>0)
        {
//          GameView.jineng1.flag=0;
          GameView.paodong=ActionToDo.??;
//          GameView.sprirt_xiaohua.flaggongji=0;
//          GameView.feijian.flag=0;
        }
        else
        {
          tip("????????????");
        }
      }
    });
      
    VMRuntime.getRuntime().setMinimumHeapSize(CWJ_HEAP_SIZE);

    
    
    aq.id(R.id.tool_liao).clicked(new OnClickListener() {
      
      @Override
      public void onClick(View arg0) {
        // TODO Auto-generated method stub
        if (showflagliao == false) {
          jy_open2();
          aq.id(R.id.tool_liao).image(R.drawable.js_yingbutton);
          showflagliao = true;
        } else {
          jy_close2();
          aq.id(R.id.tool_liao).image(R.drawable.js_liaobutton);
          showflagliao = false;
        }
      }
    });
    
    aq.id(R.id.tool_jineng).clicked(new OnClickListener() {
      
      @Override
      public void onClick(View arg0) {
        // TODO Auto-generated method stub
        if (showflagjineng == false) {
          jy_open3();
          showflagjineng = true;
        } else {
          jy_close3();
          showflagjineng = false;
        }
      }
    });
    
    aq.id(R.id.bt_fasong).clicked(new OnClickListener() {
      
      @Override
      public void onClick(View v) {
        // TODO Auto-generated method stub
        String str = aq.id(R.id.et_input).getText().toString().trim();
//        GameView.role_xiaohua.setTalkAbout(str);
//        GameView.sprirt_xiaohua.talkflag=0;
        aq.id(R.id.et_input).text("");
      }
    });
    
    LinearLayout mt = (LinearLayout)findViewById(R.id.mt);
    GameView gv = new GameView(this);
    //CustomView1 cv = new CustomView1(GameMainActivity.this);
    mt.addView(gv);
  }


  
  
  public void jy_open2() {
    Animation an5 = AnimationUtils.loadAnimation(GameMainActivity.this,
        R.anim.weimu_right);
    aq.id(R.id.ll_liaotian).animate(an5);
    aq.id(R.id.ll_liaotian).visible();
  }

  public void jy_close2() {
    Animation an5 = AnimationUtils.loadAnimation(GameMainActivity.this,
        R.anim.weimu_right2);
    aq.id(R.id.ll_liaotian).animate(an5);
    aq.id(R.id.ll_liaotian).gone();
  }
  
  public void jy_open3() {
    Animation an5 = AnimationUtils.loadAnimation(GameMainActivity.this,
        R.anim.weimu_right);
    aq.id(R.id.ll_jineng).animate(an5);
    aq.id(R.id.ll_jineng).visible();
  }

  public void jy_close3() {
    Animation an5 = AnimationUtils.loadAnimation(GameMainActivity.this,
        R.anim.weimu_right2);
    aq.id(R.id.ll_jineng).animate(an5);
    aq.id(R.id.ll_jineng).gone();
  }
  
  public void tip(String str)
  {
    Toast.makeText(GameMainActivity.this,str, Toast.LENGTH_SHORT).show();
  }
  
  
}




Java Source Code List

.Test.java
com.game.base.BaseInfo.java
com.game.base.GameBackGround.java
com.game.base.GameChapterBaseSet_Shentan.java
com.game.base.GameMap.java
com.game.base.PubSet.java
com.game.commen.AStarMap.java
com.game.commen.AStarNode.java
com.game.commen.AStar.java
com.game.commen.ActionToDo.java
com.game.commen.BitmapTouchChecker.java
com.game.commen.BitmapUtil.java
com.game.commen.Direction.java
com.game.commen.EffectName.java
com.game.commen.GameXmlcommen.java
com.game.commen.GetImgCommen.java
com.game.commen.IrregularButton.java
com.game.commen.MapName.java
com.game.commen.Paintforziti.java
com.game.commen.ToDo.java
com.game.data.BaseInfo.java
com.game.data.RoleData_Main.java
com.game.data.RoleData.java
com.game.data.StroyTipData.java
com.game.effect.SpecialEffect.java
com.game.fengshen.GameActivity.java
com.game.fengshen.GameMainActivity.java
com.game.fengshen.GameView.java
com.game.fengshen.MoveTest.java
com.game.renwu.Objs.java
com.game.renwu.SpiritMain.java
com.game.renwu.Spirit_Main.java
com.game.renwu.Spirit_NPC.java
com.game.renwu.Spirit.java
com.game.renwu.Spiritgirl.java
com.game.stroy.MainStroy.java
com.game.tip.PublicTips.java