Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
Kagami-src committed Jul 26, 2014
1 parent 517c3de commit 3736bd5
Show file tree
Hide file tree
Showing 13 changed files with 338 additions and 248 deletions.
4 changes: 2 additions & 2 deletions MerusutoChristina/.classpath
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
3 changes: 1 addition & 2 deletions MerusutoChristina/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.kagami.merusuto.MainActivity"
android:label="@string/app_name" >
android:name="com.kagami.merusuto.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
402 changes: 201 additions & 201 deletions MerusutoChristina/assets/data/list.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions MerusutoChristina/note.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
http://dbcj6kgtik9tl.cloudfront.net/toto_image_s3/unity/unit/unit_large_345.Android.unity3d?nocache=7
Binary file removed MerusutoChristina/res/drawable-mdpi/ic_launcher.png
Binary file not shown.
Binary file modified MerusutoChristina/res/drawable-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
3 changes: 2 additions & 1 deletion MerusutoChristina/res/layout/cell_contentlist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_below="@+id/name"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/margin_m"
android:scaleType="fitStart"
android:src="@drawable/p0" />

<LinearLayout
Expand Down
17 changes: 16 additions & 1 deletion MerusutoChristina/res/menu/main.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.kagami.merusuto.MainActivity" >

<item
android:showAsAction="always|withText"
android:title="排序">
<menu>
<item
android:id="@+id/menu_sort_maxlvdps"
android:title="0觉满级单体DPS"/>
<item
android:id="@+id/menu_sort_multmaxlvdps"
android:title="0觉满级多体DPS"/>
<item
android:id="@+id/menu_sort_maxlvlife"
android:title="0觉满级生命"/>

</menu>
</item>
<item
android:showAsAction="always|withText"
android:title="稀有度">
Expand Down
54 changes: 52 additions & 2 deletions MerusutoChristina/src/com/kagami/merusuto/ListContentFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;

Expand Down Expand Up @@ -39,6 +41,15 @@ public void search(){
mAdapter.search(mRare, mElement);
mAdapter.notifyDataSetChanged();
}
public void sortByMaxLvDPS(){
mAdapter.sortByMaxLvDPS();
}
public void sortByMaxLvLife(){
mAdapter.sortByMaxLvLife();
}
public void sortByMultMaxLvDPS(){
mAdapter.sortByMultMaxLvDPS();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Expand Down Expand Up @@ -98,6 +109,45 @@ public void search(int rare,int element){
&&(element==0||item.element==element))
mDisplayData.add(item);
}
public void sortByMaxLvDPS(){
Collections.sort(mDisplayData, new Comparator<UnitItem>() {

@Override
public int compare(UnitItem lhs, UnitItem rhs) {
if(lhs.getMaxLvDPS()<rhs.getMaxLvDPS())
return 1;
else
return -1;
}
});
notifyDataSetChanged();
}
public void sortByMultMaxLvDPS(){
Collections.sort(mDisplayData, new Comparator<UnitItem>() {

@Override
public int compare(UnitItem lhs, UnitItem rhs) {
if(lhs.getMultMaxLvDPS()<rhs.getMultMaxLvDPS())
return 1;
else
return -1;
}
});
notifyDataSetChanged();
}
public void sortByMaxLvLife(){
Collections.sort(mDisplayData, new Comparator<UnitItem>() {

@Override
public int compare(UnitItem lhs, UnitItem rhs) {
if(lhs.getMaxLvLife()<rhs.getMaxLvLife())
return 1;
else
return -1;
}
});
notifyDataSetChanged();
}
@Override
public int getCount() {
// TODO Auto-generated method stub
Expand Down Expand Up @@ -128,8 +178,8 @@ public View getView(int position, View convertView, ViewGroup parent) {
pic=BitmapFactory.decodeStream(getResources().getAssets().open("icon/"+getItemId(position)+".png"));

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
// do nothing
//e.printStackTrace();
}
if(pic==null)
holder.pic.setImageResource(R.drawable.p0);
Expand Down
59 changes: 23 additions & 36 deletions MerusutoChristina/src/com/kagami/merusuto/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
package com.kagami.merusuto;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringReader;

import org.json.JSONObject;

import android.app.Activity;
import android.app.ActionBar;
import android.app.Fragment;
import android.os.Bundle;
import android.util.JsonReader;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.os.Build;

public class MainActivity extends Activity {

Expand All @@ -26,7 +12,7 @@ public class MainActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

getActionBar().setDisplayShowTitleEnabled(false);
if (savedInstanceState == null) {
mContentFragment=new ListContentFragment();
getFragmentManager().beginTransaction()
Expand All @@ -51,66 +37,67 @@ public boolean onOptionsItemSelected(MenuItem item) {
switch (id) {
case R.id.menu_rare0:
mContentFragment.setRare(0);
mContentFragment.search();
break;
case R.id.menu_rare1:
mContentFragment.setRare(1);
mContentFragment.search();
break;
case R.id.menu_rare2:
mContentFragment.setRare(2);
mContentFragment.search();
break;
case R.id.menu_rare3:
mContentFragment.setRare(3);
mContentFragment.search();
break;
case R.id.menu_rare4:
mContentFragment.setRare(4);
mContentFragment.search();
break;
case R.id.menu_rare5:
mContentFragment.setRare(5);
mContentFragment.search();
break;
case R.id.menu_e0:
mContentFragment.setElement(0);
mContentFragment.search();
break;
case R.id.menu_e1:
mContentFragment.setElement(1);
mContentFragment.search();
break;
case R.id.menu_e2:
mContentFragment.setElement(2);
mContentFragment.search();
break;
case R.id.menu_e3:
mContentFragment.setElement(3);
mContentFragment.search();
break;
case R.id.menu_e4:
mContentFragment.setElement(4);
mContentFragment.search();
break;
case R.id.menu_e5:
mContentFragment.setElement(5);
mContentFragment.search();
break;
case R.id.menu_sort_maxlvdps:
mContentFragment.sortByMaxLvDPS();
break;
case R.id.menu_sort_multmaxlvdps:
mContentFragment.sortByMultMaxLvDPS();
break;
case R.id.menu_sort_maxlvlife:
mContentFragment.sortByMaxLvLife();
break;
default:
break;
}
mContentFragment.search();
return super.onOptionsItemSelected(item);
}

/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {

public PlaceholderFragment() {
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container,
false);
JSONObject js=Utils.readData(getActivity());
Log.d("kagami", js.toString());


return rootView;
}
}


}
40 changes: 40 additions & 0 deletions MerusutoChristina/src/com/kagami/merusuto/UnitItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,45 @@ public String getTypeString(){
}
return "成长:"+text;
}

public int getMaxLvDPS(){
float f=0;
switch (type) {
case 1:
f=1.9f;
break;
case 2:
f=2.0f;
break;
case 3:
f=2.1f;
break;
default:
break;
}
return (int)(atk*f/5.0f/quick);
}

public int getMaxLvLife(){
float f=0;
switch (type) {
case 1:
f=1.9f;
break;
case 2:
f=2.0f;
break;
case 3:
f=2.1f;
break;
default:
break;
}
return (int)(life*f);
}

public int getMultMaxLvDPS(){
return getMaxLvDPS()*num;
}

}
3 changes: 0 additions & 3 deletions MerusutoChristina/src/com/kagami/merusuto/Utils.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package com.kagami.merusuto;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import org.json.JSONObject;

import android.content.Context;

public class Utils {
Expand Down

0 comments on commit 3736bd5

Please sign in to comment.