Search in sources :

Example 1 with GameConfig

use of com.zimincom.mafiaonline.item.GameConfig in project 2017-01-HUDI-MAC-CHAR by NHNNEXT.

the class GameRoomActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_game_room);
    ButterKnife.bind(this);
    toolbar.setTitle("입장대기중");
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    gson = new Gson();
    mafiaRemoteService = ServiceGenerator.createService(MafiaRemoteService.class, getBaseContext());
    bgm = MediaPlayer.create(getBaseContext(), day);
    bgm.setLooping(true);
    bgm.start();
    gConfigs = new ArrayList<>();
    gConfigs.add(new GameConfig(5, GameConfig.GameState.WAITING, "시작 대기중입니다."));
    gConfigs.add(new GameConfig(60, GameConfig.GameState.DAY, "의심되는 플레이어를 선택하세요"));
    gConfigs.add(new GameConfig(5, GameConfig.GameState.WAITING, "결과 처리중입니다."));
    gConfigs.add(new GameConfig(30, GameConfig.GameState.NIGHT, "역할에 따라 선택하세요."));
    gConfigs.add(new GameConfig(5, GameConfig.GameState.WAITING, "결과 처리중입니다."));
    ArrayList<User> users = new ArrayList<>();
    messages = new ArrayList<>();
    intent = getIntent();
    user = (User) intent.getSerializableExtra("user");
    roomId = intent.getStringExtra("roomId");
    userName = intent.getStringExtra("userName");
    enterRoom(roomId);
    playerAdapter = new PlayerAdapter(getBaseContext(), users, R.layout.item_player, userName, " ", gameHandler);
    GridLayoutManager gridLayoutManager = new GridLayoutManager(getBaseContext(), 4);
    gridLayoutManager.setOrientation(GridLayoutManager.VERTICAL);
    playerListView.setLayoutManager(gridLayoutManager);
    playerListView.setItemAnimator(new DefaultItemAnimator());
    playerListView.setAdapter(playerAdapter);
    messageAdapter = new MessageAdapter(getBaseContext(), messages, R.layout.my_chat, userName);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getBaseContext(), LinearLayoutManager.VERTICAL, false);
    messageContainer.setLayoutManager(linearLayoutManager);
    messageContainer.setItemAnimator(new DefaultItemAnimator());
    messageContainer.setAdapter(messageAdapter);
    slidingLayout.addPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() {

        @Override
        public void onPanelSlide(View panel, float slideOffset) {
            getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
        }

        @Override
        public void onPanelStateChanged(View panel, SlidingUpPanelLayout.PanelState previousState, SlidingUpPanelLayout.PanelState newState) {
        }
    });
    sendButton.setOnClickListener(this);
    slideButton.setOnClickListener(this);
}
Also used : MessageAdapter(com.zimincom.mafiaonline.adapter.MessageAdapter) User(com.zimincom.mafiaonline.item.User) PlayerAdapter(com.zimincom.mafiaonline.adapter.PlayerAdapter) SlidingUpPanelLayout(com.sothree.slidinguppanel.SlidingUpPanelLayout) MafiaRemoteService(com.zimincom.mafiaonline.remote.MafiaRemoteService) ArrayList(java.util.ArrayList) Gson(com.google.gson.Gson) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) BindView(butterknife.BindView) View(android.view.View) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) GameConfig(com.zimincom.mafiaonline.item.GameConfig) GridLayoutManager(android.support.v7.widget.GridLayoutManager)

Aggregations

DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)1 GridLayoutManager (android.support.v7.widget.GridLayoutManager)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 Gson (com.google.gson.Gson)1 SlidingUpPanelLayout (com.sothree.slidinguppanel.SlidingUpPanelLayout)1 MessageAdapter (com.zimincom.mafiaonline.adapter.MessageAdapter)1 PlayerAdapter (com.zimincom.mafiaonline.adapter.PlayerAdapter)1 GameConfig (com.zimincom.mafiaonline.item.GameConfig)1 User (com.zimincom.mafiaonline.item.User)1 MafiaRemoteService (com.zimincom.mafiaonline.remote.MafiaRemoteService)1 ArrayList (java.util.ArrayList)1