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));
    }
    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));
        });
    }
Exemple #3
0
    private void Headimg_getWX(object re)
    {
//		LocalStore.DelUids(userModel.uid);
        LocalStore.SetUids(userModel.uid, userModel.uname, LocalStore.GetLocal(LocalStore.LOCAL_PWD), Type_Bingding, LocalStore.GetLocal(LocalStore.OTHER_HEADIMG));

        Update_headimg((string)re);
    }
    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);
            }
        }
    }
Exemple #5
0
    private void ChangeOnHandler(VoHttp vo)
    {
        if ((bool)vo.data == true)
        {
//			Debug.LogError ();
//			if (GuideManager.inst.Check ("5:0")) {
//				GuideManager.inst.Next ();
//				DispatchManager.inst.Dispatch (new MainEvent (MainEvent.GUIDE_UPDATE_OK, null));
//			}
            ViewManager.inst.ShowText(Tools.GetMessageById("13114"));
            ModelManager.inst.userModel.uname = ModelManager.inst.userModel.unameTrue = txt.text;
            ModelManager.inst.userModel.sex   = sex;
            ViewManager.inst.CloseView(this);
            LocalStore.SetUids(ModelManager.inst.userModel.uid, ModelManager.inst.userModel.uname, ModelManager.inst.userModel.pwd, ModelManager.inst.userModel.type_login, ModelManager.inst.userModel.tel);
            this.DispatchGlobalEvent(new MainEvent(MainEvent.USER_UPDATE));
            //
            DispatchManager.inst.Dispatch(new MainEvent(MainEvent.GUIDE_UPDATE_OVER, null));              //引导全部结束
        }
    }
Exemple #6
0
    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));
        });
    }
Exemple #8
0
    private void FindObject()
    {
        input_name = this.GetChild("n5").asCom.GetChild("n1").asTextInput;
        //input_name.maxLength = (int)DataManager.inst.systemSimple ["name_num"];
        input_name.onChanged.Add(() => {
            input_name.text = Tools.GetStringByLength(input_name.text, (int)DataManager.inst.systemSimple["name_num"]);
            input_name.text = Tools.StrReplace(input_name.text);
        });
        GetChild("n8").asTextField.text = Tools.GetMessageById("13100") + ":";

        btn_ok      = this.GetChild("n0").asButton;
        btn_ok.text = Tools.GetMessageById("13079");
        btn_ok.onClick.Add(() =>
        {
            if (input_name.text == "")
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("13033"));
            }
            //else if (input_code.text == "")
            //{
            //	ViewManager.inst.ShowText (Tools.GetMessageById ("13034"));
            //}
            else if (userModel.tel == "")
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("13035"));
            }
            else
            {
                input_name.text = input_name.text.Trim();
                if (FilterManager.inst.Exec(input_name.text).IndexOf('*') != -1)
                {
                    ViewManager.inst.ShowText(Tools.GetMessageById("13139"));
                }
                else
                {
                    input_name.text = input_name.text;
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic["uname"] = input_name.text;
                    dic["sex"]   = ModelManager.inst.userModel.sex;
                    //dic ["sign"] = input_code.text;
                    NetHttp.inst.Send(NetBase.HTTP_CHANGE_NAME, dic, (VoHttp v) =>
                    {
                        if ((bool)v.data)
                        {
                            ViewManager.inst.ShowText(Tools.GetMessageById("13144"));
                            //                        string passWord = "";
                            //						List<string[]> list = LocalStore.GetUids ();
                            //						foreach (string[] arr in list)
                            //						{
                            //							if (arr [0].ToString ()==userModel.uid)
                            //							{
                            //								passWord = arr [2].ToString ();
                            //								break;
                            //							}
                            //						}

                            userModel.uname    = userModel.unameTrue = input_name.text;
                            otherInfo["uname"] = input_name.text;
                            //						LocalStore.DelUids (userModel.uid);
                            //						if (!Tools.IsNullEmpty (passWord))
                            //						{
                            LocalStore.SetUids(userModel.uid, input_name.text, userModel.pwd, userModel.type_login, userModel.tel);
                            //						}
                            //						LocalStore.SetLocal (LocalStore.LOCAL_UNAME, input_name.text);

                            Dictionary <string, object> dc = new Dictionary <string, object>();
                            dc.Add("value", "");
                            dc.Add("tag", "uname");
                            DispatchGlobalEvent(new MainEvent(MainEvent.ROLE_UPDATE, dc));
                            ViewManager.inst.CloseView(this);
                        }
                    });
                }
            }
        });
    }
    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"));
                    //                }
                }
            }
        });
    }
Exemple #10
0
    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);
                    }
                });
            }
        });
    }
Exemple #11
0
    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);

//                    }
                });
            }
        });
    }
Exemple #12
0
    //	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();
        });
    }
Exemple #13
0
    private void InitView()
    {
//        InitTitle(Tools.GetMessageById("33102"));

        GTextField text1 = GetChild("n8").asTextField;
        GTextField text2 = GetChild("n9").asTextField;
        GTextField text3 = GetChild("n10").asTextField;

        text1.text = Tools.GetMessageById("13097") + ":";
        text2.text = Tools.GetMessageById("13098") + ":";
        text3.text = Tools.GetMessageById("13099") + ":";


        input_phone           = this.GetChild("n2").asCom.GetChild("n1").asTextInput;
        input_phone.maxLength = 11;
        //input_phone.promptText = Tools.GetMessageById("13097");
        input_code           = this.GetChild("n5").asCom.GetChild("n1").asTextInput;
        input_code.maxLength = (int)DataManager.inst.systemSimple["code_num"];
        //input_code.promptText = Tools.GetMessageById("13098");
        input_password = this.GetChild("n4").asCom.GetChild("n1").asTextInput;
        //input_password.promptText = Tools.GetMessageById("13099");
        input_password.maxLength = (int)DataManager.inst.systemSimple["password_num"];
        input_password.restrict  = Config.REG_NUMORABC;
        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
            {
                string param = "tel_num=" + input_phone.text;
                NetHttp.inst.Send(NetBase.HTTP_GETBACKSIGN, 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("13159");
        btn_ok.onClick.Add(() => {
            if (input_phone.text == "")
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("13035"));
            }
            else if (input_password.text == "")
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("10011"));
            }
            else if (input_code.text == "")
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("13034"));
            }
            else
            {
                string param = "tel_num=" + input_phone.text;
                param       += "|pwd=" + input_password.text;
                param       += "|sign=" + input_code.text;
                NetHttp.inst.Send(NetBase.HTTP_CHANGEGETBACKPWD, param, (VoHttp v) =>
                {
                    Dictionary <string, object> re = (Dictionary <string, object>)v.data;
                    userModel.SetData(re);
//                    LocalStore.SetLocal(LocalStore.LOCAL_UNAME, re["uname"].ToString());
                    LocalStore.SetLocal(LocalStore.LOCAL_UID, userModel.uid);
                    LocalStore.SetLocal(LocalStore.LOCAL_PWD, userModel.pwd);                             //re["pwd"].ToString()
//                    List<string[]> plist=LocalStore.GetUids();
//                    List<string> uList = new List<string>();
//                    foreach(string[] dic in plist)
//                    {
//                        uList.Add(dic[0]);
//                    }
//					if (uList.Contains(re["uid"].ToString()))
//						LocalStore.DelUids(userModel.uid);
                    LocalStore.SetUids(userModel.uid, userModel.uname, userModel.pwd, userModel.type_login, userModel.tel);
//                    ViewManager.inst.CloseView(this);
//                    roleModel.uids.Clear();
//					ViewManager.inst.ShowScene<MediatorMain>();
                    DispatchManager.inst.Dispatch(new MainEvent(MainEvent.RELOGIN_GAME));
                });
            }
        });
    }