Esempio n. 1
0
        public void OnGUI()
        {
            EditorGUILayout.LabelField("公告栏时间戳", "" + PrefsUtil.GetLong(BillboardPanel.BillboardTimestampKey, 0));
            // EditorGUILayout.LabelField("公告栏已读", PrefsUtil.GetBool(BillboardPanel.BillboardReadFlagKey, false) ? "是" : "否");
            EditorGUILayout.LabelField("公告栏内容:");
            var content = PrefsUtil.GetString(BillboardPanel.BillboardContentKey, null);

            if (!string.IsNullOrEmpty(content))
            {
                EditorGUILayout.LabelField(content);
            }

            if (GUILayout.Button("清空公告板记录"))
            {
                PrefsUtil.DeleteKey(BillboardPanel.BillboardContentKey);
                PrefsUtil.DeleteKey(BillboardPanel.BillboardTimestampKey);
                // PrefsUtil.DeleteKey(BillboardPanel.BillboardReadFlagKey);
                PrefsUtil.Flush();
            }

            if (GUILayout.Button("清空配置"))
            {
                PlayerPrefs.DeleteAll();
                PlayerPrefs.Save();
            }
        }
Esempio n. 2
0
        public override void Initialize(IAppContext context, float time)
        {
            var network      = NetworkType.NetworkTypeOf(Application.internetReachability);
            var remoteAPI    = context.GetRemoteAPI();
            var configHolder = context.GetConfigHolder();
            var dialog       = context.GetDialogManager();

            var clientVersion = PrefsUtil.GetInt(TestLoginRecord.TestClientVersion, 0);
            var platform      = PrefsUtil.GetInt(TestLoginRecord.TestPlatform, 0);
            var saleChannel   = PrefsUtil.GetString(TestLoginRecord.TestSaleChannel, null);
            var product       = PrefsUtil.GetString(TestLoginRecord.TestProduct, null);

            // 发送ClientVersion命令。
            remoteAPI.GetVersionData(
                clientVersion,
                // 如果传给服务器端的是null,则服务器端会设置成默认的渠道。
                // 所以不必担心,直接使用SaleChannel。
                saleChannel,
                product,
                platform,
                network,
                SystemInfo.deviceModel,
                GetDeviceId(context)
                );
        }
Esempio n. 3
0
        /**
         * 用户登录
         */
        public void loginReq()
        {
            UserLoginReq loginReq = new UserLoginReq();

            loginReq.UserId      = UserManager.Instance().authModel.user_id;
            loginReq.UniqueId    = "888";
            loginReq.Token       = UserManager.Instance().authModel.token;
            loginReq.ConnectTo   = PrefsUtil.GetString(PrefsUtil.ServiceId);
            loginReq.IsReconnect = 0;

            NetCore.Instance.Send(Api.ENetMsgId.user_login_req, loginReq);
        }
Esempio n. 4
0
        public override void Show()
        {
            if (_tweener != null)
            {
                _tweener.Kill();
                _tweener = null;
            }

            if (Content)
            {
                if (!Content.gameObject.activeSelf)
                {
                    Content.gameObject.SetActive(true);
                }

                Content.localScale = new Vector3(0, 0, 1);
                if (ContentTxt)
                {
                    ContentTxt.text = null;
                }

                _tweener = Content
                           .DOScale(new Vector3(1, 1, 1), ShowAnimationTime)
                           .SetEase(Ease.OutBack)
                           .OnComplete(() =>
                {
                    if (ContentTxt)
                    {
                        ContentTxt.text = PrefsUtil.GetString(BillboardContentKey, "无内容");
                    }
                });
            }

            if (BgCover)
            {
                if (!BgCover.gameObject.activeSelf)
                {
                    BgCover.gameObject.SetActive(true);
                }

                BgCover.color = new Color(0, 0, 0, 0);
            }

            if (BgCover)
            {
                _bgTweener = BgCover
                             .DOFade(150f / 255f, ShowAnimationTime)
                             .SetEase(Ease.Linear);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 显示保存的公告。
        /// </summary>
        private void ShowSavedBillboard()
        {
            var read    = _billboardRead.Read();
            var content = PrefsUtil.GetString(BillboardContentKey, null);

            if (!read && !string.IsNullOrEmpty(content))
            {
                Show();
            }
            else
            {
                Hide();
            }
        }
Esempio n. 6
0
        private void OnEnable()
        {
            var dataRepository = GetDataRepository();

            _isSetTestClientVersion = dataRepository.GetContainer <bool>(DataKey.IsSetTestClientVersion);

            var clientVersion = PrefsUtil.GetInt(TestLoginRecord.TestClientVersion, 0);
            var saleChannel   = PrefsUtil.GetString(TestLoginRecord.TestSaleChannel, null);
            var product       = PrefsUtil.GetString(TestLoginRecord.TestProduct, null);
            var platform      = PrefsUtil.GetInt(TestLoginRecord.TestPlatform, 0);
            var lastUserName  = LoginRecord.LastVisitorUsername;
            var lastVisitorId = LoginRecord.LastVisitorId;

            if (!string.IsNullOrEmpty(saleChannel))
            {
                SaleChannel.text = saleChannel;
            }

            if (!string.IsNullOrEmpty(product))
            {
                Product.text = product;
            }

            if (!string.IsNullOrEmpty(lastUserName))
            {
                LastVisitorUsername.text = lastUserName;
            }

            if (!string.IsNullOrEmpty(lastVisitorId))
            {
                LasVisitorId.text = lastVisitorId;
            }

            if (clientVersion != 0)
            {
                ClientVersion.text = clientVersion + "";
            }

            if (platform != 0)
            {
                Platform.text = platform + "";
            }
        }
Esempio n. 7
0
        private void OnEnable()
        {
            var dataRepository = GetDataRepository();

            _isSetTestLogin = dataRepository.GetContainer <bool>(DataKey.IsSetTestPServer);

            var ip   = PrefsUtil.GetString(TestLoginRecord.PServerTestLoginIp, null);
            var port = PrefsUtil.GetInt(TestLoginRecord.PServerTestLoginPort, 0);

            if (!string.IsNullOrEmpty(ip))
            {
                Ip.text = ip;
            }

            if (port != 0)
            {
                Port.text = port + "";
            }
        }
        /// <summary>
        /// 连接指定的服务器。
        /// </summary>
        public bool Connect(Server server, AddressFamily addressFamily = AddressFamily.InterNetwork)
        {
            if (server == Server.PServer)
            {
                var ip   = PrefsUtil.GetString(TestLoginRecord.PServerTestLoginIp, null);
                var port = PrefsUtil.GetInt(TestLoginRecord.PServerTestLoginPort, 0);

                if (string.IsNullOrEmpty(ip) || port == 0)
                {
                    return(false);
                }
                var socketFactory = _context.GetSocketFactory();

                _socket = socketFactory.CreateSocket();
                return(_socket.Connect(ip, port, server, addressFamily));
            }

            return(false);
        }
Esempio n. 9
0
        private AssetVersion GetLastAssetVersion(string resourcePath)
        {
            var lastAssetVersion = PrefsUtil.GetString(resourcePath, "");

            if (string.IsNullOrEmpty(lastAssetVersion))
            {
                return(null);
            }

            try
            {
                var assetVersion = JsonUtility.FromJson <AssetVersion>(lastAssetVersion);

                return(assetVersion);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
Esempio n. 10
0
        /**
         * 用户重连
         */
        public void ReConnect(Action reConnectSuccessAction)
        {
            if (UserManager.Instance().authModel != null)
            {
                UserLoginReq loginReq = new UserLoginReq();
                loginReq.UserId      = UserManager.Instance().authModel.user_id;
                loginReq.UniqueId    = "3";
                loginReq.Token       = UserManager.Instance().authModel.token;
                loginReq.ConnectTo   = PrefsUtil.GetString(PrefsUtil.ServiceId);
                loginReq.IsReconnect = 0;

                NetCore.Instance.Send(Api.ENetMsgId.user_login_req, loginReq);
            }
            else
            {
                if (reConnectSuccessAction != null)
                {
                    // 没有登录时候调用
                    reConnectSuccessAction();
                }
            }
        }
Esempio n. 11
0
 /// <summary>
 /// 获取上一次登陆时候使用的地址。
 /// </summary>
 /// <returns></returns>
 private string GetLastHost()
 {
     return(PrefsUtil.GetString(LastHostKey, PIPConfig.DefaultHost));
 }
 private void OnEnable()
 {
     _content = PrefsUtil.GetString("InitAssetKey", "");
 }
Esempio n. 13
0
 public static string GetAuthCode()
 {
     return(PrefsUtil.GetString(WechatAuthCode, null));
 }
Esempio n. 14
0
 public static string GetOpenId()
 {
     return(PrefsUtil.GetString(WechatOpenId, null));
 }