using System; /* Socket组件-用户 */ public class UserComp : JCUnityLib.Singleton { public void getUserInfo(System.Action cb) { UserPlayer.ins.call("userComp.getUserInfo", null, cb); } public void saveUserInfo(UserInfo userInfo) { UserPlayer.ins.call("userComp.saveUserInfo", userInfo); } public void saveMac() { string mac = LoginMgr.myUserInfo.mac; if (string.IsNullOrEmpty(mac)) return; int type = AimHandler.ins.DeviceType; if (type > 0) { UserPlayer.ins.call("userComp.saveMac2", mac, type); } else { Action cb = (Newtonsoft.Json.Linq.JToken o) => { string gyrStr = o.Value("gyr"); string magStr = o.Value("mag"); AimHandler.ins.InitGyr(gyrStr); AimHandler.ins.InitMag(magStr); }; UserPlayer.ins.call("userComp.saveMac", new object[]{mac}, cb); } } public void saveCalibrateRecord(string record) { string mac = BluetoothAim.ins.curMac; if (string.IsNullOrEmpty(mac)) { SideTipView.ShowTip("没有Mac无法上传九轴数据", UnityEngine.Color.yellow); throw new Exception("没有Mac无法上传九轴数据"); } int type = AimHandler.ins.DeviceType; if (type > 0) { UserPlayer.ins.call("userComp.saveCalibrateRecord", type, record, mac); } } #region 被服务端调用的函数 public void onResumeCalibrateRecord(string record) { AimHandler.ins.ResumeCalibrateRecord(record); } #endregion }