private void GetER() { if (!Tools.IsNullEmpty(qrCode_str) && qrCode_str.Length > 0) { share_bitmap = qrCode_str; topImage = PhoneManager.inst.Base64ToTexter2d(share_bitmap); erBg.texture = new NTexture(topImage); } else { lw = LoaderManager.inst.Load(shareUrl + ".jpg", (object w) => { if (this.group == null) { return; } topImage = (Texture2D)w; if (topImage != null) { if (this.group == null) { return; } erBg.texture = new NTexture(topImage); share_bitmap = Convert.ToBase64String(topImage.EncodeToJPG()); // Log.debug("topImage:" + topImage); // Log.debug("erBg" + erBg); LocalStore.SetLocal(LocalStore.LOCAL_QRCODE + userModel.uid, share_bitmap); } }); } }
public void SetSound(bool value) { this.isSound = value; LocalStore.SetLocal(LocalStore.LOCAL_SOUND, value.ToString()); if (sound != null) { if (this.isSound) { // if (!sound.isPlaying) // sound.Play (); } else { sound.Stop(); } } if (this.isSound) { Stage.inst.EnableSound(); } else { Stage.inst.DisableSound(); } }
public void CheckLanguage() { string lan = LocalStore.GetLocal(LocalStore.LOCAL_LANGUAGE); if (lan != "") { language = lan; } else { lan = Application.systemLanguage.ToString(); if (lan == SystemLanguage.Chinese.ToString() || lan == SystemLanguage.ChineseSimplified.ToString()) { language = "cn"; } else if (lan == SystemLanguage.ChineseTraditional.ToString()) { language = "tw"; } else if (lan == SystemLanguage.English.ToString()) { language = "en"; } else { language = "cn"; } LocalStore.SetLocal(LocalStore.LOCAL_LANGUAGE, language); } // Debug.LogError ("System Language - " + lan); }
private void SetIndexNum(string index) { string content = GetIndexNum(); content += index + ","; LocalStore.SetLocal("IndexNum", content); }
public static void QQ_auth_code(object re) { string code = (string)re; // string param = "code=" + code; string param = "pf=" + PlatForm.inst.pf; param += "|utype=" + Ex_Local.LOGIN_TYPE_QQ; param += "|ustr=" + code; // param += "|pwd=" + pwd; PlatForm.inst.GetSdk().Call(Ex_Local.TRACE, new string[] { "QQ_auth_code :: " + param }, null); NetHttp.inst.Send(NetBase.HTTP_LOGIN, param, (VoHttp v) => { Dictionary <string, object> user = (Dictionary <string, object>)v.data; ModelManager.inst.userModel.SetData(user); // LocalStore.SetLocal(LocalStore.LOCAL_TYPE, Ex_Local.LOGIN_TYPE_QQ); // LocalStore.SetUids(ModelManager.inst.userModel.uid, ModelManager.inst.userModel.uname, ModelManager.inst.userModel.pwd, Ex_Local.LOGIN_TYPE_QQ, headstr); // LocalStore.Set_QQ_Info(ModelManager.inst.userModel.uid, LocalStore.GetLocal(LocalStore.QQ_OPENID), LocalStore.GetLocal(LocalStore.QQ_TOKEN), LocalStore.GetLocal(LocalStore.QQ_DATE)); LocalStore.SetLocal(LocalStore.LOCAL_UID, ModelManager.inst.userModel.uid); LocalStore.SetLocal(LocalStore.LOCAL_PWD, ModelManager.inst.userModel.pwd); // LocalStore.SetLocal (LocalStore.LOCAL_UNAME,userModel.uname); LocalStore.SetLocal(LocalStore.OTHER_HEADIMG + ModelManager.inst.userModel.uid, LocalStore.GetLocal(LocalStore.OTHER_HEADIMG)); DispatchManager.inst.Dispatch(new MainEvent(MainEvent.RELOGIN_GAME)); }); }
public static void Headimg_getWX(object re) { // LocalStore.DelUids(LocalStore.GetLocal (LocalStore.LOCAL_UID)); LocalStore.SetUids(LocalStore.GetLocal(LocalStore.LOCAL_UID), LocalStore.GetLocal(LocalStore.LOCAL_UNAME), LocalStore.GetLocal(LocalStore.LOCAL_PWD), Ex_Local.LOGIN_TYPE_WEIXIN, ""); LocalStore.SetLocal(LocalStore.OTHER_HEADIMG + ModelManager.inst.userModel.uid, LocalStore.GetLocal(LocalStore.OTHER_HEADIMG)); DispatchManager.inst.Dispatch(new MainEvent(MainEvent.RELOGIN_GAME)); }
private void Update_headimg(string img) { // //lht这里需要判断平台的 账号是否绑定过了,是否能用平台账号绑定 // string param = ""; // switch (Type_Bingding) { // case Ex_Local.LOGIN_TYPE_QQ: // param = "openid=" + LocalStore.QQ_OPENID; // param += "|token=" + LocalStore.QQ_TOKEN; // param += "|data=" + LocalStore.QQ_DATE; // break; // case Ex_Local.LOGIN_TYPE_WEIXIN: // param = "openid=" + LocalStore.WX_OPENID; // param += "|token=" + LocalStore.WX_TOKEN; // param += "|data=" + ""; // break; // } // NetHttp.inst.Send(NetBase.HTTP_REGIST, param, (VoHttp v) => // { // Debug.Log(v.data); // if ((string)v.data != string.Empty) // { ViewManager.inst.ShowText(Tools.GetMessageById("13124")); //LocalStore.SetLocal(LocalStore.LOCAL_PWD, input_password.text); //LocalStore.SetLocal(LocalStore.LOCAL_TEL, input_phone.text); //userModel.tel = input_phone.text; //otherInfo["tel"] = input_phone.text; //LocalStore.DelUids(userModel.uid); //LocalStore.SetUids(userModel.uname, input_password.text, Ex_Local.LOGIN_TYPE_UNAME); //Dictionary<string, object> dc = new Dictionary<string, object>(); //dc.Add("value", ""); //dc.Add("tag", "account"); //DispatchGlobalEvent(new MainEvent(MainEvent.ROLE_UPDATE, dc)); //ViewManager.inst.CloseView(this); Dictionary <string, object> data = new Dictionary <string, object>(); data["head_key"] = img; NetHttp.inst.Send(NetBase.HTTP_CHOOSE_HEAD, data, (VoHttp vo) => { // userModel.type_login = Type_Bingding; userModel.UpdateData(vo.data); // // LocalStore.SetLocal(LocalStore.LOCAL_TYPE, userModel.type_login); // Dictionary <string, object> headIcon = (Dictionary <string, object>)userModel.head; head_Icon = head.GetChild("n0").asCom.GetChild("n0").asLoader; // head_Icon.url = ModelUser.GetHeadUrl(headIcon["use"].ToString()); Tools.SetLoaderButtonUrl(null, ModelUser.GetHeadUrl(headIcon["use"].ToString()), head_Icon); LocalStore.SetLocal(LocalStore.OTHER_HEADIMG + userModel.uid, LocalStore.GetLocal(LocalStore.OTHER_HEADIMG)); }); // } // }); // }
public override void Init() { noticeData = new List <object>(); Create(Config.VIEW_NOTICE, false, Tools.GetMessageById("14061")); //保存 LocalStore.SetLocal(LocalStore.NOTICE_VERSION, ModelManager.inst.userModel.notice_version); FindObject(); initData(); }
public void Login(string type, bool change = false) { string openId; if (type == LOGIN_TYPE_QQ) { Call(CALL_LOGIN_QQ_TOKEN, null, (object re) => { JsonData json = JsonMapper.ToObject((string)re); // string appId = DataManager.inst.systemSimple [DataManager.SHARE_QQ_ID].ToString (); openId = (string)json ["openid"]; string token = (string)json ["access_token"]; string date = ((int)json ["expires_in"]) + ""; LocalStore.SetLocal(LocalStore.QQ_OPENID, openId); LocalStore.SetLocal(LocalStore.QQ_TOKEN, token); LocalStore.SetLocal(LocalStore.QQ_DATE, date); // // Debug.Log("--lht--LOGIN_TYPE_QQ Login "+openId+" || "+token +" || "+date); // // QQ_head_get(openId,token); }); if (change) { Call(CALL_LOGIN_QQ, new string[] { "change" }, null); } else { Call(CALL_LOGIN_QQ, new string[] { "" }, null); } } else if (type == LOGIN_TYPE_WEIXIN) { if (change) { Call(CALL_LOGIN_WEIXIN, new string[] { "" }, null); //Weixin 授权 } else { openId = LocalStore.GetLocal(LocalStore.WX_OPENID); string token = LocalStore.GetLocal(LocalStore.WX_TOKEN); string re_token = LocalStore.GetLocal(LocalStore.WX_RE_TOKEN); if (openId.Length > 0 && token.Length > 0) { Call(CALL_AUTH_TOKEN_WEIXIN, null, WX_auth_token); NetHttp.inst.sendHttp_wx("https://api.weixin.qq.com/sns/auth?access_token=" + token + "&openid=" + openId); //weixin 验证 } else if (openId == "" || token == "") { Call(CALL_LOGIN_WEIXIN_CODE, null, WX_auth_code); Call(CALL_LOGIN_WEIXIN, new string[] { openId }, null); //Weixin 授权 } } } }
private void Send(string phone) { if (input_password.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("10011")); } else { if (phone.Equals(userModel.tel)) { ViewManager.inst.CloseView(this); } else { //userModel.Login(Ex_Local.LOGIN_TYPE_TEL, phone, input_password.text, () => userModel.Login(Ex_Local.LOGIN_TYPE_TEL, phone, input_password.text, () => { LocalStore.SetLocal(LocalStore.LOCAL_TYPE, Ex_Local.LOGIN_TYPE_TEL); // LocalStore.DelUids(userModel.uid); LocalStore.SetUids(userModel.uid, userModel.uname, userModel.pwd, Ex_Local.LOGIN_TYPE_TEL, phone); LocalStore.SetLocal(LocalStore.LOCAL_UID, userModel.uid); LocalStore.SetLocal(LocalStore.LOCAL_PWD, userModel.pwd); // LocalStore.SetLocal(LocalStore.LOCAL_UNAME, phone); // LocalStore.SetLocal(LocalStore.LOCAL_PWD, input_password.text); //ViewManager.inst.CloseView(this); //roleModel.otherInfo = null; //alertModel.isOpen = true; //roleModel.uids.Clear(); //ViewManager.inst.CloseScene(); //Dictionary<string, object> dd = new Dictionary<string, object>(); //dd["fuid"] = userModel.uid; // NetHttp.inst.Send(NetBase.HTTP_FUSERGET, dd, (VoHttp vo) => //{ // if (vo.data != null) // { // roleModel.tab_Role_Select1 = roleModel.tab_Role_CurSelect1; // roleModel.tab_Role_Select2 = roleModel.tab_Role_CurSelect2; // roleModel.tab_Role_Select3 = roleModel.tab_Role_CurSelect3; // roleModel.otherInfo = (Dictionary<string, object>)vo.data; // ViewManager.inst.ShowScene<MediatorRoleRoot>(); // } //}); DispatchManager.inst.Dispatch(new MainEvent(MainEvent.RELOGIN_GAME)); }, true); } } }
private void DelIndexNum(string index) { string context = GetIndexNum(); if (context != "") { string key = index + ","; if (context.IndexOf(key) != -1) { context = context.Replace(key, ""); } } LocalStore.DelLocal("IndexNum"); LocalStore.SetLocal("IndexNum", context); }
private void SetRed(string sid) { string str = LocalStore.GetLocal(LocalStore.LOCAL_SHIPRED); if (str == null) { str = ""; } if (str.IndexOf(sid) != -1) { return; } str += sid + "|"; LocalStore.SetLocal(LocalStore.LOCAL_SHIPRED, str); }
private void onListItemClick(int index) { if (index == 0) { _index = 0; LocalStore.SetLocal(LocalStore.LOCAL_SHOPRED, "0"); list1.numItems = listData.Count + 2; ViewManager.inst.ShowView <MediatorGetDayCardBox> (); } else { Dictionary <string, object> dic = (Dictionary <string, object>)listData [index + ""]; _index = (int)dic ["id"]; ViewManager.inst.ShowView <MediatorGetCardBox> (); } }
public IEnumerator httpTest(string url) { WWW www = new WWW(url); yield return(www); // Debug.Log ("--sendHttp_wx-- " + www.text); // Debug.Log ("--sendHttp_wx-- " + www.bytes.Length); // this.StopCoroutine("httpTest"); Tools.Clear(this.gameObject); // if (url.IndexOf("grant_type=authorization_code") > -1) { JsonData re = JsonMapper.ToObject(www.text); LocalStore.SetLocal(LocalStore.WX_OPENID, (string)re ["openid"]); LocalStore.SetLocal(LocalStore.WX_TOKEN, (string)re ["access_token"]); LocalStore.SetLocal(LocalStore.WX_RE_TOKEN, (string)re ["refresh_token"]); //{"access_token":"Y9W9n13FGy-tquOQw22-rXhONlfcMLd_KKhnN8qxdSo9xg0w0AAaT7AsoEwUiWUG1UaM1Ahf5UwFnhUyxY7Riqsh9mj42dRNTpvJo3diN9s","expires_in":7200,"refresh_token":"i_by8R_BiTkHCdxyMIQCQZo6MgkrNMkg3AzmCfNB2PjRt1YaTcAxxT4Hhw07UpPbqgn7oFAIlW6VIhOYGfZeUT8iOftK08Gz--4CdnnTbGU","openid":"o9zsEwc8Xql8WP6QSSeB3fZC2bqs","scope":"snsapi_userinfo","unionid":"oucfGvrYR6vmnj5W-T23qwpCrPTE"} //https://api.weixin.qq.com/sns/oauth2/refresh_token?appid=APPID&grant_type=refresh_token&refresh_token=REFRESH_TOKEN //https://api.weixin.qq.com/sns/auth?access_token=ACCESS_TOKEN&openid=OPENID //https://api.weixin.qq.com/sns/userinfo?access_token=ACCESS_TOKEN&openid=OPENID PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_AUTH_INFO_WEIXIN, www.text); } else if (url.IndexOf("grant_type=refresh_token") > -1) { PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_AUTH_RE_TOKEN_WEIXIN, www.text); } else if (url.IndexOf("sns/auth?") > -1) { PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_AUTH_TOKEN_WEIXIN, www.text); } else if (url.IndexOf("sns/userinfo?") > -1) { PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_AUTH_HEAD_WEIXIN, www.text); } else if (url.IndexOf("graph.qq.com/user/get_user_info?") > -1) { JsonData re = JsonMapper.ToObject(www.text); string headURL = (string)re["figureurl_qq_2"]; //100 PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_LOGIN_QQ_HEAD, headURL); } }
public void WX_auth_head_get(object re) { JsonData json = JsonMapper.ToObject((string)re); Debug.Log("--lht--headimgurl :: \n" + json.ToJson()); //{"openid":"o9zsEwc8Xql8WP6QSSeB3fZC2bqs","nickname":"\u5289\u6D77\u6FE4@Elvis","sex":1,"language":"zh_CN","city":"Chaoyang","province":"Beijing","country":"CN","headimgurl":"http://wx.qlogo.cn/mmopen/kZG1bNOzT8ROh4IQv8ENlicwB4dUmPObLhIuuVZibQps22JpqWOwDvrbG1HVleqCGaF2bF99KozJqaLnWfeGTHicAClY30IgD4H/0","privilege":[],"unionid":"oucfGvrYR6vmnj5W-T23qwpCrPTE"} string headURL = (string)json ["headimgurl"]; //http://wx.qlogo.cn/mmopen/kZG1bNOzT8ROh4IQv8ENlicwB4dUmPObLhIuuVZibQps22JpqWOwDvrbG1HVleqCGaF2bF99KozJqaLnWfeGTHicAClY30IgD4H/0 // http://wx.qlogo.cn/mmopen/kZG1bNOzT8ROh4IQv8ENlicwB4dUmPObLhIuuVZibQps22JpqWOwDvrbG1HVleqCGaF2bF99KozJqaLnWfeGTHicAClY396IgD4H/96 headURL = headURL.Substring(0, headURL.LastIndexOf("/")); headURL = headURL + "/96"; // headURL = headURL.Replace (headURL.Substring (headURL.LastIndexOf ("/") + 1), "96");//微信只用 96 尺寸的 LocalStore.SetLocal(LocalStore.OTHER_HEADIMG, headURL); LocalStore.DelLocal(LocalStore.HEADIMG + headURL); //删除缓存 PlatForm.inst.GetSdk().Dispatch(CALL_AUTH_HEAD_GET_WEIXIN, headURL); PlatForm.inst.GetSdk().Dispatch(CALL_LOGIN_PF, null); //这里可能需要服务器验证 }
public void SetMusic(bool value) { this.isMusic = value; LocalStore.SetLocal(LocalStore.LOCAL_MUSIC, value.ToString()); if (music != null) { if (this.isMusic) { if (!music.isPlaying) { music.Play(); } } else { music.Stop(); } } }
public static void setFreeWords(string name, string value, string free) { string str = LocalStore.GetLocal(name); int index = str.IndexOf(value); if (index != -1) { string cc = str.Substring(index, value.Length + 2); str = str.Replace(cc, value + "-" + free); } else { if (str != "") { str += "_"; } str += value + "-" + free; } LocalStore.SetLocal(name, str); }
void OnDestroy() { if (gameModel != null && gameModel.loginDoubel) { string idn = LocalStore.GetLocal(LocalStore.LOCAL_IDNUM); LocalStore.SetLocal(LocalStore.LOCAL_IDNUM, idn == "0" ? "1" : "0"); } NetSocket.inst.Close(); DispatchManager.inst.Unregister(MainEvent.RESTART_GAME, RESTART_GAME); DispatchManager.inst.Unregister(MainEvent.RELOGIN_GAME, RELOGIN_GAME); DispatchManager.inst.Unregister(MainEvent.SHOW_USER, SHOW_USER); DispatchManager.inst.Unregister(MainEvent.SOCKET_ERROR, SOCKET_ERROR); DispatchManager.inst.Unregister(MainEvent.FIGHT_RESULT, FIGHT_RESULT); DispatchManager.inst.Unregister(MainEvent.START_FIGHT, START_FIGHT); DispatchManager.inst.Unregister(MainEvent.CLOSE_FIGHT, CLOSE_FIGHT); DispatchManager.inst.Unregister(MainEvent.FIGHT_INIT_COMPLETE, FIGHT_INIT_COMPLETE); DispatchManager.inst.Unregister(MainEvent.FIGHT_QUIT, FIGHT_QUIT); DispatchManager.inst.Unregister(MainEvent.FIGHT_ING, FIGHT_ING); DispatchManager.inst.Unregister(MainEvent.SOCKET_CLOSE, SOCKET_CLOSE); }
protected override void preInit() { instance = this; this.enter_btn.onClick.AddListener(this.onEnterHandler); this.ready_btn.onClick.AddListener(this.onReadyHandler); this.roomId.onValueChanged.AddListener((e) => { FightMain.instance.roomId = this.roomId.text.ToString(); LocalStore.SetLocal("fight_room_id", FightMain.instance.roomId); }); this.add_user_btn.onClick.AddListener(() => { int a = int.Parse(this.add_user_text.text.Replace("加人", "")); this.add_user_text.text = "加人" + (a + 1); NetSocket socket = new NetSocket(); socket.Start(1, PlatForm.inst.SERVER4, 7777, 1000); socket.onConnect = () => { socket.onConnect = null; TimerManager.inst.Add(0, 1, (e) => { socket.Send(ConfigConstant.NET_C_USER_JOIN, new Dictionary <string, object> { { "room_id", FightMain.instance.roomId }, { "equal", FightMain.equal }, { "cards", PlayerData.instance.cardGroup.ToArray() }, { "teamIndex", Mathf.CeilToInt(UnityEngine.Random.value * 10000000) }, { "lv", 1 } }); socket.Close(); }); }; }); Text text = Tools.FindChild2("Text", this.change_mode_btn.gameObject).GetComponent <Text>(); this.change_mode_btn.onClick.AddListener(() => { if (text.text == "乱斗") { text.text = "组队"; FightMain.instance.mode = ConfigConstant.MODE_RADISH; } else { text.text = "乱斗"; FightMain.instance.mode = ConfigConstant.MODE_CHAOS; } }); }
public void SwitchLanguage(string name) { if (language == name) { return; } language = name; LocalStore.SetLocal(LocalStore.LOCAL_LANGUAGE, language); NetHttp.inst.Send(NetBase.HTTP_CHANGELAN, "lan=" + name, (VoHttp v) => { if (Convert.ToBoolean(v.data)) { NetHttp.inst.Send(NetBase.HTTP_CONFIG, "lan=" + name + "|key=return_msg", (VoHttp vo) => { DataManager.inst.Decode(vo.data); DispatchManager.inst.Dispatch(new MainEvent(MainEvent.RELOGIN_GAME)); }, '|', null, 60); } }); }
public void WX_auth_token_re(object re) { string str = (string)re; JsonData json = JsonMapper.ToObject(str); int code = 0; if (str.IndexOf("errcode") > -1) { code = (int)json ["errcode"]; string openId = LocalStore.GetLocal(LocalStore.WX_OPENID); Call(CALL_LOGIN_WEIXIN_CODE, null, WX_auth_code); Call(CALL_LOGIN_WEIXIN, new string[] { openId }, null); //Weixin 授权,重新授权 } else { LocalStore.SetLocal(LocalStore.WX_OPENID, (string)json ["openid"]); LocalStore.SetLocal(LocalStore.WX_TOKEN, (string)json ["access_token"]); LocalStore.SetLocal(LocalStore.WX_RE_TOKEN, (string)json ["refresh_token"]); // WX_auth_info(""); //拿用户信息 } }
private void Set_LocalData(Dictionary <string, object> pf, Dictionary <string, object> user) { LocalStore.SetLocal(LocalStore.LOCAL_TYPE, Type_Bingding); LocalStore.SetLocal(LocalStore.LOCAL_PWD, (string)user ["pwd"]); if (Type_Bingding == Ex_Local.LOGIN_TYPE_QQ) { LocalStore.Set_QQ_Info(userModel.uid, LocalStore.GetLocal(LocalStore.QQ_OPENID), LocalStore.GetLocal(LocalStore.QQ_TOKEN), LocalStore.GetLocal(LocalStore.QQ_DATE)); // LocalStore.DelUids(userModel.uid); LocalStore.SetUids(userModel.uid, userModel.uname, (string)user ["pwd"], Type_Bingding, LocalStore.GetLocal(LocalStore.OTHER_HEADIMG)); Update_headimg(headstr); } else if (Type_Bingding == Ex_Local.LOGIN_TYPE_WEIXIN) { LocalStore.Set_WX_Info(userModel.uid, (string)pf ["openid"], (string)pf ["access_token"], (string)pf ["refresh_token"]); PlatForm.inst.GetSdk().Call(Ex_Local.CALL_AUTH_HEAD_GET_WEIXIN, null, Headimg_getWX); //微信绑定之后才能拿到头像 PlatForm.inst.GetSdk().WX_auth_info(""); //微信 找头像 } }
public static void WX_auth_code(object re) { string code = (string)re; // string param = "code=" + code; string param = "pf=" + PlatForm.inst.pf; param += "|utype=" + Ex_Local.LOGIN_TYPE_WEIXIN; param += "|ustr=" + code; // param += "|pwd=" + pwd; // PlatForm.inst.GetSdk().Call(Ex_Local.TRACE,new string[]{"WX_auth_code :: "+param},null); NetHttp.inst.Send(NetBase.HTTP_LOGIN, param, (VoHttp v) => { Dictionary <string, object> user = (Dictionary <string, object>)v.data; ModelManager.inst.userModel.SetData(user); // LocalStore.SetLocal(LocalStore.LOCAL_TYPE, Ex_Local.LOGIN_TYPE_WEIXIN); // LocalStore.SetUids(ModelManager.inst.userModel.uid, ModelManager.inst.userModel.uname, ModelManager.inst.userModel.pwd, Ex_Local.LOGIN_TYPE_WEIXIN, ModelManager.inst.userModel.tel); // // LocalStore.Set_QQ_Info((string)user["uid"],LocalStore.GetLocal(LocalStore.QQ_OPENID),LocalStore.GetLocal(LocalStore.QQ_TOKEN),LocalStore.GetLocal(LocalStore.QQ_DATE)); if (user.ContainsKey("wx_data")) { Dictionary <string, object> pf = (Dictionary <string, object>)user["wx_data"]; LocalStore.Set_WX_Info(ModelManager.inst.userModel.uid, (string)pf ["openid"], (string)pf ["access_token"], (string)pf ["refresh_token"]); } LocalStore.SetLocal(LocalStore.LOCAL_UID, ModelManager.inst.userModel.uid); LocalStore.SetLocal(LocalStore.LOCAL_PWD, ModelManager.inst.userModel.pwd); // LocalStore.SetLocal (LocalStore.LOCAL_UNAME,userModel.uname); // PlatForm.inst.GetSdk().Call(Ex_Local.CALL_AUTH_HEAD_GET_WEIXIN, null, Headimg_getWX); //微信绑定之后才能拿到头像 PlatForm.inst.GetSdk().WX_auth_info(""); //微信 找头像 // DispatchManager.inst.Dispatch (new MainEvent (MainEvent.RELOGIN_GAME)); }); }
public void SetLove(bool love) { LocalStore.SetLocal(LocalStore.GUIDE_LOVE, "1"); }
// void Update(){ // Debug.LogError (Time.deltaTime); // } void sdk_callback(string value) { Debug.Log("---unity--CALLbACK....." + value); //Log: CALLbACK.....{ "funcId":"share_ok","msg":"0","isJson":0} Dictionary <string, object> dd = new Dictionary <string, object>(); if (value.IndexOf("{") > -1) { string fid = ""; //普通第三方json数据返回 JsonData re = JsonMapper.ToObject(value); if (((int)re ["isJson"]) == 1) { // trace.text += "\n -^-:" + re ["funcId"]; // trace.text += "\n -^-:" + re ["data"].ToJson (); fid = (string)re ["funcId"]; if (fid == FID_LOGIN_QQ_TOKEN) { //QQ 登陆返回 token PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_LOGIN_QQ_TOKEN, value); } else if (fid == FID_LOGIN_QQ_HEAD) { //QQ 登陆返回 头像//figureurl_qq_1//figureurl_qq_2 //{"ret":0,"msg":"","is_lost":0,"nickname":"三叔","gender":"男","province":"北京","city":"朝阳","figureurl":"http:\/\/qzapp.qlogo.cn\/qzapp\/101347709\/367F8C9525DC8690EC9DF1578F6714A1\/30","figureurl_1":"http:\/\/qzapp.qlogo.cn\/qzapp\/101347709\/367F8C9525DC8690EC9DF1578F6714A1\/50","figureurl_2":"http:\/\/qzapp.qlogo.cn\/qzapp\/101347709\/367F8C9525DC8690EC9DF1578F6714A1\/100","figureurl_qq_1":"http:\/\/q.qlogo.cn\/qqapp\/101347709\/367F8C9525DC8690EC9DF1578F6714A1\/40","figureurl_qq_2":"http:\/\/q.qlogo.cn\/qqapp\/101347709\/367F8C9525DC8690EC9DF1578F6714A1\/100","is_yellow_vip":"0","vip":"0","yellow_vip_level":"0","level":"0","is_yellow_year_vip":"0"} string headURL = (string)re["figureurl_qq_2"]; //40 LocalStore.DelLocal(LocalStore.HEADIMG + headURL); //删除缓存 LocalStore.SetLocal(LocalStore.OTHER_HEADIMG, headURL); PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_LOGIN_QQ_HEAD, headURL); // PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_LOGIN_PF,null);//这里可能需要服务器验证 } } else { PlatForm.inst.GetSdk().Dispatch("callback", value); //自定义 json数据 标准格式{isJson:0,function:"",msg:""}; // trace.text += "\n -->" + re ["funcId"] + "\n -->" + re ["other"]; fid = re ["funcId"].ToString(); if (fid == FID_get_photo_end) { string bitmap = (string)re ["msg"]; // byte[] b = System.Convert.FromBase64String (bitmap); PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_OPENPHOTO, bitmap); } else if (fid == FID_share_ok) { string msg = (string)re ["msg"]; // Debug.Log ("-->>lht 001-->>" + msg + " :: >> " + Ex_Local.CALL_FUN); PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_FUN, msg); } else if (fid == FID_LOGIN_WEIXIN_CODE) { //微信 code 返回 PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_LOGIN_WEIXIN_CODE, (string)re ["msg"]); } else if (fid == ERROR_NO_QQ) { // PlatForm.inst.GetSdk().Dispatch(Ex_Local.ERROR_NO_QQ, "0"); } else if (fid == ERROR_NO_WX) { // PlatForm.inst.GetSdk().Dispatch(Ex_Local.ERROR_NO_WX, "0"); } else if (fid == SCHEME_EVENT_JOIN) //有scheme 消息打开游戏 { } else if (fid == SCHEME_EVENT_JOIN_CHECK) { } #if UNITY_IOS else if (fid == FID_touch3d) { // PlatForm.inst.touch3dType = (string)re ["msg"]; PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_RE_TOUCH3D, (string)re ["msg"]); // Ex_Ios.c_test(); } else if (fid == Ex_Local.CALL_RE_TOUCH3D_GET) { PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_RE_TOUCH3D_GET, (string)re ["msg"]); } #endif //if (re["funcId"].ToString() == FID_copy_ok) //{ // dd["name"] = Ex_Local.CALL_COPYTO; // dd["value"] = (string)re["msg"]; // PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_COPYTO, dd); //} } } else { // trace.text += "\n" + str; // if (str.IndexOf ("GET_GEO_NELL") > -1) // { // string[] arr = str.Split (new string[]{ "," }, System.StringSplitOptions.None); // la = arr [1]; // lo = arr [2]; // sdk_callback (arr [0] + arr [1] + arr [2]); // } } }
private void InitView() { // InitTitle(Tools.GetMessageById("33104")); userModel = ModelManager.inst.userModel; input_pwd = this.GetChild("n4").asCom.GetChild("n1").asTextInput; //input_pwd.promptText = Tools.GetMessageById("13101"); input_pwd.maxLength = (int)DataManager.inst.systemSimple["password_num"]; input_pwd.restrict = Config.REG_NUMORABC; input_newpwd = this.GetChild("n3").asCom.GetChild("n1").asTextInput; //input_newpwd.promptText = Tools.GetMessageById("13099"); input_newpwd.maxLength = (int)DataManager.inst.systemSimple["password_num"]; input_newpwd.restrict = Config.REG_NUMORABC; GetChild("n8").asTextField.text = Tools.GetMessageById("13101") + ":"; GetChild("n9").asTextField.text = Tools.GetMessageById("13099") + ":"; btn_ok = this.GetChild("n0").asButton; btn_ok.text = Tools.GetMessageById("13079"); btn_ok.onClick.Add(() => { if (input_newpwd.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13037")); } else if (input_pwd.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13036")); } else { string pwd_ = Tools.MD5(input_pwd.text); if (!pwd_.Equals(userModel.pwd)) { ViewManager.inst.ShowText(Tools.GetMessageById("13143")); } else { // if (input_pwd.text.Equals(LocalStore.GetLocal(LocalStore.LOCAL_PWD))) // { string param = "old_pwd=" + input_pwd.text; param += "|pwd=" + input_newpwd.text; NetHttp.inst.Send(NetBase.HTTP_CHANGEPWD, param, (VoHttp v) => { //"25f9e794323b453885f5181f1b624d0b" if ((string)v.data != string.Empty) { string pwd = (string)v.data; LocalStore.SetLocal(LocalStore.LOCAL_PWD, pwd); userModel.pwd = v.data.ToString(); // LocalStore.DelUids(userModel.uid); LocalStore.SetUids(userModel.uid, userModel.uname, pwd, userModel.type_login, userModel.tel); Dictionary <string, object> dc = new Dictionary <string, object>(); dc.Add("value", ""); dc.Add("tag", "password"); DispatchGlobalEvent(new MainEvent(MainEvent.ROLE_UPDATE, dc)); ViewManager.inst.CloseView(this); } }); // } // else // { // ViewManager.inst.ShowText(Tools.GetMessageById("13067")); // } } } }); }
private void Send(string uid, string pwd, string type) { // if (pwd == "") // { // ViewManager.inst.ShowText(Tools.GetMessageById("10011")); // } // else // { Type_login = type; // if(type == Ex_Local.LOGIN_TYPE_QQ){ // PlatForm.inst.GetSdk ().Call (Ex_Local.CALL_LOGIN_QQ_HEAD,null,Headimg_get); // PlatForm.inst.GetSdk().Login(type,true); // } // else if(type == Ex_Local.LOGIN_TYPE_WEIXIN){ // PlatForm.inst.GetSdk ().Call (Ex_Local.CALL_AUTH_HEAD_GET_WEIXIN, null, Headimg_get); // PlatForm.inst.GetSdk().Login(type,true); // } // else{ // ViewManager.inst.ShowText(uInfo[1] + " || "+uInfo[0]+" || "+uInfo[2]); // userModel.Login(Ex_Local.LOGIN_TYPE_UID, uInfo[0], uInfo[2], () => // { // if (ulist.Contains(userModel.uid)) // LocalStore.DelUids(userModel.uid); // if (utype.Equals(Ex_Local.LOGIN_TYPE_UNAME)) // { // LocalStore.SetUids(userModel.uid,userModel.uname, userModel.pwd,userModel.type_login,userModel.tel); // } // else // { // LocalStore.SetUids(uname, input_password.text, Ex_Local.LOGIN_TYPE_UID); // } LocalStore.SetLocal(LocalStore.LOCAL_TYPE, Ex_Local.LOGIN_TYPE_UID); // // LocalStore.SetLocal(LocalStore.LOCAL_TYPE, userModel.type_login); // // ViewManager.inst.CloseView(); // roleModel.otherInfo = null; // alertModel.isOpen = true; // roleModel.uids.Clear(); // ViewManager.inst.CloseScene(); LocalStore.SetLocal(LocalStore.LOCAL_UID, uid); LocalStore.SetLocal(LocalStore.LOCAL_PWD, pwd); // DispatchManager.inst.Dispatch(new MainEvent(MainEvent.RELOGIN_GAME)); //this.DispatchGlobalEvent(new MainEvent(MainEvent.SHOW_USER, new object[] { userModel.uid, userModel.uid, roleModel.tab_Role_CurSelect1,roleModel.tab_Role_CurSelect2,roleModel.tab_Role_CurSelect3 })); // Dictionary<string, object> dd = new Dictionary<string, object>(); // dd["fuid"] = userModel.uid; // NetHttp.inst.Send(NetBase.HTTP_FUSERGET, dd, (VoHttp vo) => // { // if (vo.data != null) // { // roleModel.tab_Role_Select1 = roleModel.tab_Role_CurSelect1; // roleModel.tab_Role_Select2 = roleModel.tab_Role_CurSelect2; // roleModel.tab_Role_Select3 = roleModel.tab_Role_CurSelect3; // roleModel.otherInfo = (Dictionary<string, object>)vo.data; // ViewManager.inst.ShowScene<MediatorRoleRoot>(); // } // }); // }); // } }
private void InitItem() { // InitTitle(Tools.GetMessageById("33106")); input_password = this.GetChild("n5").asCom.GetChild("n1").asTextInput; input_password.promptText = ""; input_password.maxLength = (int)DataManager.inst.systemSimple["password_num"]; input_password.restrict = Config.REG_NUMORABC; input_phone = this.GetChild("n3").asCom.GetChild("n1").asTextInput; input_phone.maxLength = 11; input_phone.promptText = ""; input_code = this.GetChild("n4").asCom.GetChild("n1").asTextInput; input_code.maxLength = (int)DataManager.inst.systemSimple["code_num"]; input_code.promptText = ""; btn_send = this.GetChild("n6").asButton; GTextField phone = this.GetChild("n8").asTextField; phone.text = Tools.GetMessageById("13097") + ":"; GTextField passwd = this.GetChild("n9").asTextField; passwd.text = Tools.GetMessageById("13098") + ":"; GTextField code = this.GetChild("n10").asTextField; code.text = Tools.GetMessageById("13084") + ":"; btn_send.text = Tools.GetMessageById("13077"); btn_send.onClick.Add(() => { if (input_phone.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13035")); } else { string param = "tel_num=" + input_phone.text; NetHttp.inst.Send(NetBase.HTTP_VALIDATE, param, (VoHttp v) => { Debug.Log(v.data);//true if ((bool)v.data) { ViewManager.inst.ShowText(Tools.GetMessageById("13049")); timer = ModelManager.inst.gameModel.time; btn_send.touchable = false; btn_send.grayed = true; TimerManager.inst.Add(1f, 0, Timer); } }); } }); btn_ok = this.GetChild("n7").asButton; btn_ok.text = Tools.GetMessageById("13079"); btn_ok.onClick.Add(() => { if (input_password.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("10011")); } else if (input_code.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13034")); } else if (input_phone.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13035")); } else { string param = "sign=" + input_code.text; // param += "|uname=" + userModel.uname; param += "|pwd=" + input_password.text; NetHttp.inst.Send(NetBase.HTTP_REGIST, param, (VoHttp v) => { // Debug.Log(v.data); if ((string)v.data != string.Empty) { ViewManager.inst.ShowText(Tools.GetMessageById("13124")); // LocalStore.SetLocal(LocalStore.LOCAL_UID, userModel.uid); LocalStore.SetLocal(LocalStore.LOCAL_PWD, (string)v.data); LocalStore.SetLocal(LocalStore.LOCAL_TYPE, Ex_Local.LOGIN_TYPE_TEL); LocalStore.SetLocal(LocalStore.LOCAL_TEL, input_phone.text); // userModel.tel = Ex_Local.LOGIN_TYPE_TEL + "|" + input_phone.text; otherInfo["tel"] = userModel.tel; // // LocalStore.DelUids(userModel.uid); LocalStore.SetUids(userModel.uid, userModel.uname, (string)v.data, Ex_Local.LOGIN_TYPE_TEL, userModel.tel); // Dictionary <string, object> dc = new Dictionary <string, object>(); dc.Add("value", ""); dc.Add("tag", "account"); DispatchGlobalEvent(new MainEvent(MainEvent.ROLE_UPDATE, dc)); ViewManager.inst.CloseView(this); } }); } }); }
private void InitItem() { // InitTitle(Tools.GetMessageById("33105")); input_phone = this.GetChild("n4").asCom.GetChild("n1").asTextInput; input_phone.maxLength = 11; //input_phone.promptText = Tools.GetMessageById("13086")+":"; input_code = this.GetChild("n5").asCom.GetChild("n1").asTextInput; input_code.maxLength = (int)DataManager.inst.systemSimple["code_num"]; //input_code.promptText = Tools.GetMessageById("13098"); GetChild("n8").asTextField.text = Tools.GetMessageById("13140") + ":"; GetChild("n9").asTextField.text = Tools.GetMessageById("13098") + ":"; btn_send = this.GetChild("n6").asButton; btn_send.text = Tools.GetMessageById("13077"); btn_send.onClick.Add(() => { if (input_phone.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13035")); } else { if (input_phone.text.Equals(Tools.GetUserTel(userModel.tel)[1])) { ViewManager.inst.ShowText(Tools.GetMessageById("13142")); } else { string param = "tel_num=" + input_phone.text; NetHttp.inst.Send(NetBase.HTTP_VALIDATE, param, (VoHttp v) => { // Debug.Log(v.data);//true // if ((bool)v.data) // { ViewManager.inst.ShowText(Tools.GetMessageById("13049")); timer = ModelManager.inst.gameModel.time; btn_send.touchable = false; btn_send.grayed = true; TimerManager.inst.Add(1f, 0, Timer); // } }); } } }); btn_ok = this.GetChild("n7").asButton; btn_ok.text = Tools.GetMessageById("13079"); btn_ok.onClick.Add(() => { if (input_code.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13034")); } else if (input_phone.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13035")); } else { string param = "sign=" + input_code.text; NetHttp.inst.Send(NetBase.HTTP_REGIST, param, (VoHttp v) => { // Debug.Log(v.data); // if ((bool)v.data) // { LocalStore.SetLocal(LocalStore.LOCAL_UID, userModel.uid); LocalStore.SetLocal(LocalStore.LOCAL_PWD, (string)v.data); LocalStore.SetLocal(LocalStore.LOCAL_TYPE, Ex_Local.LOGIN_TYPE_TEL); LocalStore.SetLocal(LocalStore.LOCAL_TEL, input_phone.text); // userModel.tel = Ex_Local.LOGIN_TYPE_TEL + "|" + input_phone.text; // LocalStore.DelUids(userModel.uid); LocalStore.SetUids(userModel.uid, userModel.uname, (string)v.data, Ex_Local.LOGIN_TYPE_TEL, userModel.tel); // Dictionary <string, object> dc = new Dictionary <string, object>(); dc.Add("value", ""); dc.Add("tag", "chphone"); DispatchGlobalEvent(new MainEvent(MainEvent.ROLE_UPDATE, dc)); ViewManager.inst.CloseView(this); // } }); } }); }
// private void OnSendHandler (VoHttp vo) // { // int addExp = (int)(((Dictionary<string,object>)vo.data) ["add_exp"]); // Dictionary<string,object> d = new Dictionary<string, object> (); // d.Add (Config.ASSET_EXP, addExp); // ViewManager.inst.ShowIcon (d,()=>{ // ModelManager.inst.userModel.UpdateData (vo.data); // DispatchManager.inst.Dispatch (new MainEvent (MainEvent.RED_UPDATE)); // }); // } public void Login(string type, string uid, string pwd, Action fun, bool isChange = false) { string param = "pf=" + PlatForm.inst.pf; string loginType = type; if (loginType == "") { // LocalStore.SetLocal (LocalStore.LOCAL_TYPE, Ex_Local.LOGIN_TYPE_UID);// } else { if (type == Ex_Local.LOGIN_TYPE_TEL || type == Ex_Local.LOGIN_TYPE_QQ || type == Ex_Local.LOGIN_TYPE_WEIXIN) { if (!isChange) { loginType = Ex_Local.LOGIN_TYPE_UID; } } param += "|utype=" + loginType; param += "|ustr=" + uid; param += "|pwd=" + pwd; } string idn; // if (ModelManager.inst.gameModel.loginDoubel) // { // param = "pf=" + PlatForm.inst.pf; // idn = LocalStore.GetLocal (LocalStore.LOCAL_IDNUM); // string[] ids; // if (idn == "") // { // idn = "0"; // } // else // { // idn = idn == "0" ? "1" : "0"; // } // LocalStore.SetLocal (LocalStore.LOCAL_IDNUM, idn); // string idse = LocalStore.GetLocal (LocalStore.LOCAL_IDS + idn); // if (idse != "") // { // ids = idse.Split (','); // uid = ids [0].ToString (); // pwd = ids [1].ToString (); // param += "|utype="+Ex_Local.LOGIN_TYPE_UID; // param += "|ustr=" + uid; // param += "|pwd=" + pwd; // } // else // { // uid = ""; // pwd = ""; // } // } // ViewManager.inst.ShowAlert (type+ " - Login Params - " + param); // Debug.LogError ("Login-----"); NetHttp.inst.Send(NetBase.HTTP_LOGIN, param, (VoHttp v) => { Dictionary <string, object> re = (Dictionary <string, object>)v.data; this.SetData(re); //Debug.LogError("start" + ModelManager.inst.userModel.season["start_time"] + "%%%%%%%%%% end" + ModelManager.inst.userModel.season["end_time"]); if (this.country == 0) { PhoneManager.inst.GetGps(GetGps); } // if (type != "") { LocalStore.SetLocal(LocalStore.LOCAL_TYPE, type); } else { LocalStore.SetLocal(LocalStore.LOCAL_TYPE, Ex_Local.LOGIN_TYPE_UID); // } LocalStore.SetUids(this.uid, this.uname, this.pwd, Ex_Local.LOGIN_TYPE_UID, this.tel); // LocalStore.SetLocal(LocalStore.LOCAL_UID, this.uid); LocalStore.SetLocal(LocalStore.LOCAL_PWD, this.pwd); if (ModelManager.inst.gameModel.loginDoubel) { LocalStore.SetLocal(LocalStore.LOCAL_IDS + LocalStore.GetLocal(LocalStore.LOCAL_IDNUM), this.uid + "," + this.pwd); } if (!isChange) { Main.inst.Socket_Close(); Main.inst.Socket_Start(); ModelManager.inst.Clear(); } if (fun != null) { fun(); } }, '|', (VoHttp vo) => { // if (vo.return_code.Equals ("10001") || vo.return_code.Equals ("10002") || vo.return_code.Equals ("10003")) // { // List<string[]> pList = new List<string[]> (); // List<string> uList = new List<string> (); // foreach (string[] v in pList) // { // uList.Add (v [0]); // } // if (uList.Contains (uid)) // LocalStore.DelUids (uid); if (!isChange) { LocalStore.SetLocal(LocalStore.LOCAL_UID, ""); LocalStore.SetLocal(LocalStore.LOCAL_TYPE, ""); LocalStore.SetLocal(LocalStore.LOCAL_PWD, ""); } // } // //检测头像是否不合格 // Tools.checkHead(); }); }