我已经在Eclipse for Android开发中为我的AVD制作了一些自定义皮肤,我想我已经完成了整个布局文件,除了布局部分中的“event”参数。当我看到像
这样的东西时事件EV_SW:0:1
......这是什么意思?
答案 0 :(得分:0)
我认为它指的是硬件“开关”。第一个数字是交换机ID,第二个数字表示交换机是打开还是关闭。
对于仿真器,开关编号0用于控制设备是处于纵向还是横向模式。
答案 1 :(得分:0)
与创建AVD皮肤相关的documentation包含对Android Emulator Skin File Specification
的引用在此规范中是引用事件的部分。作为示例,它专门提供了EV_SW的详细信息:0
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class BeeCoinScore: MonoBehaviour
{
public static BeeCoinScore instance;
public static int coin = 0;
public int currentCoin = 0;
string totalCoinKey = "totalCoin";
Text CoinScore; // Reference to the Text component.
void Awake ()
{
// Set up the reference.
CoinScore = GetComponent <Text> ();
}
public void Start(){
//Get the highScore from player prefs if it is there, 0 otherwise.
coin = PlayerPrefs.GetInt(totalCoinKey, 0);
}
public void AddBeeCoinScore (int _point) {
coin += _point;
GetComponent<Text> ().text = "Bee Coins: " + coin;
}
public void TakeBeeCoinScore (int _point) {
coin -= _point;
GetComponent<Text> ().text = "Bee Coins: " + coin;
}
void Update ()
{
// Set the displayed text to be the word "Score" followed by the score value.
CoinScore.text = "Bee Coins: " + coin;
}
void OnDisable(){
PlayerPrefs.SetInt(totalCoinKey, coin);
PlayerPrefs.Save();
}
}