| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using System;
- /* Socket组件-用户 */
- public class UserComp : JCUnityLib.Singleton<UserComp>
- {
- public void getUserInfo(System.Action<UserInfo> 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<Newtonsoft.Json.Linq.JToken> cb = (Newtonsoft.Json.Linq.JToken o) => {
- string gyrStr = o.Value<string>("gyr");
- string magStr = o.Value<string>("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 = LoginMgr.myUserInfo.mac;
- if (string.IsNullOrEmpty(mac)) return;
- 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
- }
|