Skip to content

Commit 3736bd5

Browse files
committed
up
1 parent 517c3de commit 3736bd5

File tree

13 files changed

+338
-248
lines changed

13 files changed

+338
-248
lines changed

MerusutoChristina/.classpath

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
3-
<classpathentry kind="src" path="src"/>
4-
<classpathentry kind="src" path="gen"/>
53
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
64
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
75
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
6+
<classpathentry kind="src" path="src"/>
7+
<classpathentry kind="src" path="gen"/>
88
<classpathentry kind="output" path="bin/classes"/>
99
</classpath>

MerusutoChristina/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
android:label="@string/app_name"
1515
android:theme="@style/AppTheme" >
1616
<activity
17-
android:name="com.kagami.merusuto.MainActivity"
18-
android:label="@string/app_name" >
17+
android:name="com.kagami.merusuto.MainActivity" >
1918
<intent-filter>
2019
<action android:name="android.intent.action.MAIN" />
2120

MerusutoChristina/assets/data/list.json

Lines changed: 201 additions & 201 deletions
Large diffs are not rendered by default.

MerusutoChristina/note.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
http://dbcj6kgtik9tl.cloudfront.net/toto_image_s3/unity/unit/unit_large_345.Android.unity3d?nocache=7
-617 Bytes
Binary file not shown.
Loading
Binary file not shown.

MerusutoChristina/res/layout/cell_contentlist.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@
2828
<ImageView
2929
android:id="@+id/imageView1"
3030
android:layout_width="wrap_content"
31-
android:layout_height="wrap_content"
31+
android:layout_height="match_parent"
3232
android:layout_below="@+id/name"
3333
android:layout_centerVertical="true"
3434
android:layout_marginLeft="@dimen/margin_m"
35+
android:scaleType="fitStart"
3536
android:src="@drawable/p0" />
3637

3738
<LinearLayout

MerusutoChristina/res/menu/main.xml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
<menu xmlns:android="http://schemas.android.com/apk/res/android"
22
xmlns:tools="http://schemas.android.com/tools"
33
tools:context="com.kagami.merusuto.MainActivity" >
4-
4+
<item
5+
android:showAsAction="always|withText"
6+
android:title="排序">
7+
<menu>
8+
<item
9+
android:id="@+id/menu_sort_maxlvdps"
10+
android:title="0觉满级单体DPS"/>
11+
<item
12+
android:id="@+id/menu_sort_multmaxlvdps"
13+
android:title="0觉满级多体DPS"/>
14+
<item
15+
android:id="@+id/menu_sort_maxlvlife"
16+
android:title="0觉满级生命"/>
17+
18+
</menu>
19+
</item>
520
<item
621
android:showAsAction="always|withText"
722
android:title="稀有度">

MerusutoChristina/src/com/kagami/merusuto/ListContentFragment.java

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import java.io.IOException;
44
import java.util.ArrayList;
5+
import java.util.Collections;
6+
import java.util.Comparator;
57
import java.util.Iterator;
68
import java.util.List;
79

@@ -39,6 +41,15 @@ public void search(){
3941
mAdapter.search(mRare, mElement);
4042
mAdapter.notifyDataSetChanged();
4143
}
44+
public void sortByMaxLvDPS(){
45+
mAdapter.sortByMaxLvDPS();
46+
}
47+
public void sortByMaxLvLife(){
48+
mAdapter.sortByMaxLvLife();
49+
}
50+
public void sortByMultMaxLvDPS(){
51+
mAdapter.sortByMultMaxLvDPS();
52+
}
4253
@Override
4354
public View onCreateView(LayoutInflater inflater, ViewGroup container,
4455
Bundle savedInstanceState) {
@@ -98,6 +109,45 @@ public void search(int rare,int element){
98109
&&(element==0||item.element==element))
99110
mDisplayData.add(item);
100111
}
112+
public void sortByMaxLvDPS(){
113+
Collections.sort(mDisplayData, new Comparator<UnitItem>() {
114+
115+
@Override
116+
public int compare(UnitItem lhs, UnitItem rhs) {
117+
if(lhs.getMaxLvDPS()<rhs.getMaxLvDPS())
118+
return 1;
119+
else
120+
return -1;
121+
}
122+
});
123+
notifyDataSetChanged();
124+
}
125+
public void sortByMultMaxLvDPS(){
126+
Collections.sort(mDisplayData, new Comparator<UnitItem>() {
127+
128+
@Override
129+
public int compare(UnitItem lhs, UnitItem rhs) {
130+
if(lhs.getMultMaxLvDPS()<rhs.getMultMaxLvDPS())
131+
return 1;
132+
else
133+
return -1;
134+
}
135+
});
136+
notifyDataSetChanged();
137+
}
138+
public void sortByMaxLvLife(){
139+
Collections.sort(mDisplayData, new Comparator<UnitItem>() {
140+
141+
@Override
142+
public int compare(UnitItem lhs, UnitItem rhs) {
143+
if(lhs.getMaxLvLife()<rhs.getMaxLvLife())
144+
return 1;
145+
else
146+
return -1;
147+
}
148+
});
149+
notifyDataSetChanged();
150+
}
101151
@Override
102152
public int getCount() {
103153
// TODO Auto-generated method stub
@@ -128,8 +178,8 @@ public View getView(int position, View convertView, ViewGroup parent) {
128178
pic=BitmapFactory.decodeStream(getResources().getAssets().open("icon/"+getItemId(position)+".png"));
129179

130180
} catch (IOException e) {
131-
// TODO Auto-generated catch block
132-
e.printStackTrace();
181+
// do nothing
182+
//e.printStackTrace();
133183
}
134184
if(pic==null)
135185
holder.pic.setImageResource(R.drawable.p0);
Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,9 @@
11
package com.kagami.merusuto;
22

3-
import java.io.IOException;
4-
import java.io.InputStreamReader;
5-
import java.io.StringReader;
6-
7-
import org.json.JSONObject;
8-
93
import android.app.Activity;
10-
import android.app.ActionBar;
11-
import android.app.Fragment;
124
import android.os.Bundle;
13-
import android.util.JsonReader;
14-
import android.util.Log;
15-
import android.view.LayoutInflater;
165
import android.view.Menu;
176
import android.view.MenuItem;
18-
import android.view.View;
19-
import android.view.ViewGroup;
20-
import android.os.Build;
217

228
public class MainActivity extends Activity {
239

@@ -26,7 +12,7 @@ public class MainActivity extends Activity {
2612
protected void onCreate(Bundle savedInstanceState) {
2713
super.onCreate(savedInstanceState);
2814
setContentView(R.layout.activity_main);
29-
15+
getActionBar().setDisplayShowTitleEnabled(false);
3016
if (savedInstanceState == null) {
3117
mContentFragment=new ListContentFragment();
3218
getFragmentManager().beginTransaction()
@@ -51,66 +37,67 @@ public boolean onOptionsItemSelected(MenuItem item) {
5137
switch (id) {
5238
case R.id.menu_rare0:
5339
mContentFragment.setRare(0);
40+
mContentFragment.search();
5441
break;
5542
case R.id.menu_rare1:
5643
mContentFragment.setRare(1);
44+
mContentFragment.search();
5745
break;
5846
case R.id.menu_rare2:
5947
mContentFragment.setRare(2);
48+
mContentFragment.search();
6049
break;
6150
case R.id.menu_rare3:
6251
mContentFragment.setRare(3);
52+
mContentFragment.search();
6353
break;
6454
case R.id.menu_rare4:
6555
mContentFragment.setRare(4);
56+
mContentFragment.search();
6657
break;
6758
case R.id.menu_rare5:
6859
mContentFragment.setRare(5);
60+
mContentFragment.search();
6961
break;
7062
case R.id.menu_e0:
7163
mContentFragment.setElement(0);
64+
mContentFragment.search();
7265
break;
7366
case R.id.menu_e1:
7467
mContentFragment.setElement(1);
68+
mContentFragment.search();
7569
break;
7670
case R.id.menu_e2:
7771
mContentFragment.setElement(2);
72+
mContentFragment.search();
7873
break;
7974
case R.id.menu_e3:
8075
mContentFragment.setElement(3);
76+
mContentFragment.search();
8177
break;
8278
case R.id.menu_e4:
8379
mContentFragment.setElement(4);
80+
mContentFragment.search();
8481
break;
8582
case R.id.menu_e5:
8683
mContentFragment.setElement(5);
84+
mContentFragment.search();
85+
break;
86+
case R.id.menu_sort_maxlvdps:
87+
mContentFragment.sortByMaxLvDPS();
88+
break;
89+
case R.id.menu_sort_multmaxlvdps:
90+
mContentFragment.sortByMultMaxLvDPS();
91+
break;
92+
case R.id.menu_sort_maxlvlife:
93+
mContentFragment.sortByMaxLvLife();
8794
break;
8895
default:
8996
break;
9097
}
91-
mContentFragment.search();
9298
return super.onOptionsItemSelected(item);
9399
}
94100

95-
/**
96-
* A placeholder fragment containing a simple view.
97-
*/
98-
public static class PlaceholderFragment extends Fragment {
99-
100-
public PlaceholderFragment() {
101-
}
102-
103-
@Override
104-
public View onCreateView(LayoutInflater inflater, ViewGroup container,
105-
Bundle savedInstanceState) {
106-
View rootView = inflater.inflate(R.layout.fragment_main, container,
107-
false);
108-
JSONObject js=Utils.readData(getActivity());
109-
Log.d("kagami", js.toString());
110-
111-
112-
return rootView;
113-
}
114-
}
101+
115102

116103
}

MerusutoChristina/src/com/kagami/merusuto/UnitItem.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,45 @@ public String getTypeString(){
7070
}
7171
return "成长:"+text;
7272
}
73+
74+
public int getMaxLvDPS(){
75+
float f=0;
76+
switch (type) {
77+
case 1:
78+
f=1.9f;
79+
break;
80+
case 2:
81+
f=2.0f;
82+
break;
83+
case 3:
84+
f=2.1f;
85+
break;
86+
default:
87+
break;
88+
}
89+
return (int)(atk*f/5.0f/quick);
90+
}
91+
92+
public int getMaxLvLife(){
93+
float f=0;
94+
switch (type) {
95+
case 1:
96+
f=1.9f;
97+
break;
98+
case 2:
99+
f=2.0f;
100+
break;
101+
case 3:
102+
f=2.1f;
103+
break;
104+
default:
105+
break;
106+
}
107+
return (int)(life*f);
108+
}
109+
110+
public int getMultMaxLvDPS(){
111+
return getMaxLvDPS()*num;
112+
}
73113

74114
}

MerusutoChristina/src/com/kagami/merusuto/Utils.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
package com.kagami.merusuto;
22

33
import java.io.BufferedReader;
4-
import java.io.IOException;
54
import java.io.InputStreamReader;
6-
75
import org.json.JSONObject;
8-
96
import android.content.Context;
107

118
public class Utils {

0 commit comments

Comments
 (0)