风暴英雄排位排位的偏好调整和个人积分调整扣分是啥意思

Android(58)
& & & & 偏好设置(SharedPreferences)提供了一种以键值对(K-V)的形式保存并读取持久数据的方式;
偏好设置的本质是使用xml文件保存数据,但开发人员无须考虑xml文件的解析问题,仅需像使用Map一样使用偏好设置即可;
偏好设置属于应用程序私有,仅应用程序自身可访问;
偏好设置一般用于保存用户信息、用户设置等数据量较小的数据;
偏好设置的文件保存在/data/data/应用程序包名/shared_prefs/文件夹下;
在Android系统中,使用SharedPreferences接口的对象实现偏好设置的读取与写入;
使用ContextWrapper类定义的getSharedPreferences()方法即可获取SharedPreferences接口的对象;
方法签名:
& &public SharedPreferences getSharedPreferences(String name,int mode)
在写入偏好设置时,需要使用Editor对象,通过SharedPreferences的edit()方法即可获取该对象;
通过Editor的put系列方法即可写入数据,例如putString(String key,Stringvalue);
写入完成后,应该调用Editor的commit()方法提交,以完成写入过程。
& & & & & & & & & & & & &&SharedPreferences sp = getSharedPreferences();
Editor editor = sp.edit();
editor.putString(&username&,&hello&);
editor.putInt(&age&,34);
& & & & & &&在获取到SharedPreferences对象之后,直接调用get系列方法即可获取所需的数据,例如String getString(String key,String defValue);
& & & & 代码:
& &SharedPreferences sp = getSharedPreferences();
& &String username = sp.getString(&username&,null);
& &int age = sp.getInt(&age&,45);
& & & & & 使用偏好设置来保存数据:
& & & & & & &
&布局设置:
&LinearLayout xmlns:android=&/apk/res/android&
xmlns:tools=&/tools&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:orientation=&vertical& &
&LinearLayout
android:layout_width=&wrap_content&
android:layout_height=&wrap_content&
android:layout_marginTop=&40dp&
android:orientation=&horizontal& &
android:id=&@+id/tv_1&
android:layout_width=&wrap_content&
android:layout_height=&wrap_content&
android:text=&用户名:&
android:textSize=&18sp& /&
android:id=&@+id/name&
android:layout_width=&259dp&
android:layout_height=&wrap_content&
android:hint=&请输入用户名&
android:ems=&10& /&
&/LinearLayout&
&LinearLayout
android:layout_width=&wrap_content&
android:layout_height=&wrap_content&
android:layout_marginTop=&20dp&
android:orientation=&horizontal& &
android:layout_width=&wrap_content&
android:layout_height=&wrap_content&
android:text=&年
android:textSize=&18sp& /&
android:id=&@+id/age&
android:layout_width=&254dp&
android:layout_height=&wrap_content&
android:hint=&请输入年龄&
android:ems=&10& /&
&/LinearLayout&
android:id=&@+id/submit&
android:layout_width=&wrap_content&
android:layout_height=&wrap_content&
android:layout_marginLeft=&30dp&
android:layout_marginTop=&20dp&
android:onClick=&save&
android:text=&保存& /&
&/LinearLayout&
MainActivity:
package com.example.
import android.app.A
import android.content.SharedP
import android.content.SharedPreferences.E
import android.os.B
import android.view.V
import android.widget.EditT
import android.widget.T
public class MainActivity extends Activity {
private EditText user_
private EditText user_
private String FileName = &config&;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
user_name = (EditText)findViewById(R.id.name);
user_age = (EditText)findViewById(R.id.age);
* 从目标文件中获取相应的信息之后,将信息显示到控件里边
SharedPreferences sp
= getSharedPreferences(FileName, MODE_PRIVATE);
String username = sp.getString(&username&, null);
int age = sp.getInt(&age&, -1);
if(username != null){
user_name.setText(username);
if(age != -1){
user_age.setText(age + &&);
* 将信息保存在目标文件夹中
public void save(View view){
String username = user_name.getText().toString();
int age = Integer.valueOf(user_age.getText().toString());
SharedPreferences sp = getSharedPreferences(FileName, MODE_PRIVATE);
Editor editor = sp.edit();
editor.putString(&username&, username);
editor.putInt(&age&, age);
Toast.makeText(this, &保存成功!!&, Toast.LENGTH_LONG).show();
&偏好设置实现软件的引导界面:
主界面不需要设置:
GuideActivity
& &package com.example.
import android.app.A
import android.content.I
import android.content.SharedP
import android.content.SharedPreferences.E
import android.graphics.PointF;
import android.os.B
import android.view.M
import android.view.MenuI
import android.view.MotionE
import android.view.V
import android.view.animation.A
import android.view.animation.AnimationU
import android.widget.ImageS
import android.widget.ImageV
import android.widget.ImageView.ScaleT
import android.widget.ViewSwitcher.ViewF
public class GuideActivity extends Activity {
private ImageSwitcher mImageS
private int[] mImgResI
private int mCurrentImageI
private PointF mDownPoint = new PointF();
private Animation right_Left_In, right_Left_Out, left_Right_In,
left_Right_O
private String FileN
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_guide);
SharedPreferences sp = getSharedPreferences(FileName, MODE_PRIVATE);
String isFirst = sp.getString(&isFirstRunning&, null);
if (isFirst != null) {
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
mImageSwitcher = (ImageSwitcher) findViewById(R.id.imageSwitcher);
mImgResIds = new int[] { R.drawable.er, R.drawable.qw, R.drawable.ty,
R.drawable.xc };
mImageSwitcher.setFactory(new ViewFactory() {
public View makeView() {
// TODO Auto-generated method stub
ImageView v = new ImageView(getApplicationContext());
v.setScaleType(ScaleType.FIT_XY);
v.setImageResource(mImgResIds[mCurrentImageIndex]);
right_Left_In = AnimationUtils
.loadAnimation(this, R.anim.right_left_in);
right_Left_Out = AnimationUtils.loadAnimation(this,
R.anim.right__left_out);
left_Right_In = AnimationUtils
.loadAnimation(this, R.anim.left_right_in);
left_Right_Out = AnimationUtils.loadAnimation(this,
R.anim.left_right_out);
public boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
mDownPoint.x = event.getX();
case MotionEvent.ACTION_UP:
if (event.getX() - mDownPoint.x & 10) {
if (mCurrentImageIndex &= 1) {
mCurrentImageIndex--;
((ImageView) mImageSwitcher.getNextView())
.setImageResource(mImgResIds[mCurrentImageIndex]);
mImageSwitcher.setInAnimation(left_Right_In);
mImageSwitcher.setOutAnimation(left_Right_Out);
mImageSwitcher.showNext();
if (mCurrentImageIndex == mImgResIds.length - 1) {
findViewById(R.id.btn).setVisibility(View.VISIBLE);
if (mDownPoint.x - event.getX() & 10) {
if (mCurrentImageIndex & mImgResIds.length - 1) {
mCurrentImageIndex++;
((ImageView) mImageSwitcher.getNextView())
.setImageResource(mImgResIds[mCurrentImageIndex]);
mImageSwitcher.setInAnimation(right_Left_In);
mImageSwitcher.setOutAnimation(right_Left_Out);
mImageSwitcher.showNext();
if (mCurrentImageIndex == mImgResIds.length - 1) {
findViewById(R.id.btn).setVisibility(View.VISIBLE);
return super.onTouchEvent(event);
public void startMain(View view) {
SharedPreferences sp = getSharedPreferences(FileName, MODE_PRIVATE);
Editor editor = sp.edit();
editor.putString(&isFirstRunning&, &false&);
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
&RelativeLayout xmlns:android=&/apk/res/android&
xmlns:tools=&/tools&
android:layout_width=&match_parent&
android:layout_height=&match_parent&
&ImageSwitcher
android:id=&@+id/imageSwitcher&
android:layout_width=&match_parent&
android:layout_height=&match_parent&
&/ImageSwitcher&
android:id=&@+id/btn&
android:layout_width=&wrap_content&
android:layout_height=&wrap_content&
android:onClick=&startMain&
android:layout_centerHorizontal=&true&
android:layout_alignParentBottom=&true&
android:layout_marginBottom=&50dp&
android:visibility=&gone&
android:text=&开始体验&
&/RelativeLayout&
动画设置:
left_right_in.xml
&?xml version=&1.0& encoding=&utf-8&?&
&set xmlns:android=&/apk/res/android&&
&translate
android:duration=&1500&
android:fromXDelta=&-100%&
android:toXDelta=&0&/&
left_right_out.xml
&?xml version=&1.0& encoding=&utf-8&?&
&set xmlns:android=&/apk/res/android&&
&translate
android:duration=&1500&
android:fromXDelta=&0&
android:toXDelta=&100%&
right__left_out.xml
&?xml version=&1.0& encoding=&utf-8&?&
&set xmlns:android=&/apk/res/android&&
&translate
android:duration=&1500&
android:fromXDelta=&0&
android:toXDelta=&-100%&/&
right_left_in.xml
&?xml version=&1.0& encoding=&utf-8&?&
&set xmlns:android=&/apk/res/android&&
&translate
android:duration=&1500&
android:fromXDelta=&100%&
android:toXDelta=&0&/&
不要忘了在AndroidMainfest.xml中将第一个界面配置为GuideActivity。
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:296554次
积分:6855
积分:6855
排名:第3199名
原创:389篇
转载:20篇
评论:56条
文章:32篇
阅读:114573
文章:27篇
阅读:19420
文章:37篇
阅读:15044
文章:28篇
阅读:22280
(1)(5)(2)(4)(12)(7)(6)(20)(12)(12)(15)(6)(9)(8)(58)(9)(5)(5)(16)(20)(9)(13)(14)(10)(3)(6)(18)(34)(27)(5)(16)(22)[杂谈] [杂谈] 有大神知道个人得分调整和偏好调整是什么鬼么
正常一局200,扣了我8分。。[cnarmory 阿纳克洛斯 凌灬鈤]
偏好调整一般是指对面或者自己连续几盘掏出同样的英雄,被系统认定那个英雄是你的得意英雄,就会有扣分,给对面加分,个人得分调整就是以前老版MMR有差距给补正那套
选了个架子芦苇,居然被扣了一分[s:ac:哼]
[quote][pid=76043,1]Reply[/pid] [b]Post by [uid=598728]吴有人[/uid] ( 20:16):[/b]偏好调整一般是指对面或者自己连续几盘掏出同样的英雄,被系统认定那个英雄是你的得意英雄,就会有扣分,给对面加分,个人得分调整就是以前老版MMR有差距给补正那套[/quote]那是指你的队伍更有可能赢,MMR更高像你这么说那些常年玩一个英雄的以后就不加分了
[quote][pid=76043,1]Reply[/pid] [b]Post by [uid=]SuperTacos[/uid] ( 21:01):[/b]那是指你的队伍更有可能赢,MMR更高像你这么说那些常年玩一个英雄的以后就不加分了[/quote]扣分有上限的啊,怎么可能无限叠下去。。。
我知道隔壁有随机上9k的m-god,还有绝活上8k的w33。没想到风暴居然也有随机上宗师和绝活上宗师两种。2333
[quote][pid=76043,1]Reply[/pid] [b]Post by [uid=598728]吴有人[/uid] ( 21:17):[/b]扣分有上限的啊,怎么可能无限叠下去。。。[/quote]上限是多少?赢一场200分,假设一个人胜率60%,上限只要达到20分,这个人就一辈子别想升级了?不知道你们为什么老把这些调整分联想成跟英雄有关

我要回帖

更多关于 风暴英雄偏好英雄 的文章

 

随机推荐