/** * 用户登录回复 */ public object loginAck(byte[] data) { UserLoginAck loginAction = UserLoginAck.Parser.ParseFrom(data); PrefsUtil.Set(PrefsUtil.ServiceId, loginAction.ServiceId); Debug.Log("登录成功!"); return(loginAction); }
/** * 开关按钮 */ public void optionItemClick(int index) { switch (index) { case 1: // Music { Text MusicStatusText = settingView.Find <Text>("Option_Music/Status"); Image MusicStatusImg = settingView.Find <Image>("Option_Music/Button"); if (PrefsUtil.GetInt("setting_music") > 0) { PrefsUtil.Set("setting_music", 0); MusicStatusText.text = "关"; MusicStatusImg.SetLocalImage("Textures/main/setting_btn_close"); } else { PrefsUtil.Set("setting_music", 1); MusicStatusText.text = "开"; MusicStatusImg.SetLocalImage("Textures/main/setting_btn_open"); } break; } case 2: // Sound { Text SoundStatusText = settingView.Find <Text>("Option_Sound/Status"); Image SoundStatusImg = settingView.Find <Image>("Option_Sound/Button"); if (PrefsUtil.GetInt("setting_sound") > 0) { PrefsUtil.Set("setting_sound", 0); SoundStatusText.text = "关"; SoundStatusImg.SetLocalImage("Textures/main/setting_btn_close"); } else { PrefsUtil.Set("setting_sound", 1); SoundStatusText.text = "开"; SoundStatusImg.SetLocalImage("Textures/main/setting_btn_open"); } break; } case 3: // Vibrate { Text VibrateStatusText = settingView.Find <Text>("Option_Vibrate/Status"); Image VibrateStatusImg = settingView.Find <Image>("Option_Vibrate/Button"); if (PrefsUtil.GetInt("setting_vibrate") > 0) { PrefsUtil.Set("setting_vibrate", 0); VibrateStatusText.text = "关"; VibrateStatusImg.SetLocalImage("Textures/main/setting_btn_close"); } else { PrefsUtil.Set("setting_vibrate", 1); VibrateStatusText.text = "开"; VibrateStatusImg.SetLocalImage("Textures/main/setting_btn_open"); } break; } } }