コード例 #1
0
ファイル: Login_Account.cs プロジェクト: wangjie0707/Temp_01
        public static bool CheckCurrUserIsChange()
        {
            PlayUserHistory user_History = GetUserUser_HistoryByIndex(0);

            if (user_History != null)
            {
                if (PlayerComponent.This.MainPlayer.ChangingPlayerInfo == null)
                {
                    PlayerComponent.This.MainPlayer.ChangingPlayerInfo = PlayerComponent.This.MainPlayer.PlayerInfo;
                }

                PlayerComponent.This.MainPlayer.ChangingPlayerInfo.NickName       = user_History.NickName;
                PlayerComponent.This.MainPlayer.ChangingPlayerInfo.AuthorizedSKey = user_History.AuthorizedSKey;
                PlayerComponent.This.MainPlayer.ChangingPlayerInfo.UserID         = user_History.UserID;
                PlayerComponent.This.MainPlayer.ChangingPlayerInfo.DateTime       = user_History.DateTime;
                PlayerComponent.This.MainPlayer.ChangingPlayerInfo.LoginType      = user_History.LoginType;

                //如果切换登录的用户相同,则返回false
                if (PlayerComponent.This.MainPlayer.ChangingPlayerInfo.UserID == PlayerComponent.This.MainPlayer.PlayerInfo.UserID)
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #2
0
ファイル: Login_Account.cs プロジェクト: wangjie0707/Temp_01
        public static PlayUserHistory GetUserUser_History(string key)
        {
            PlayUserHistory user_History = null;

            if (PlayerComponent.This.HistoryUserDic.TryGetValue(key, out user_History))
            {
                return(user_History);
            }

            return(null);
        }
コード例 #3
0
        protected override void RenderDropdownList()
        {
            base.RenderDropdownList();

            _list.RemoveChildrenToPool();

            int cnt = _items.Length;

            try
            {
                for (int i = 0; i < cnt; i++)
                {
                    GObject item = _list.AddItemFromPool();
                    item.text = _items[i];

                    CBox_SelectNumber_item cBox_Account_ = item.asButton as CBox_SelectNumber_item;

                    PlayUserHistory user_History = Login_Account.GetUserUser_History(item.text);

                    if (user_History != null)
                    {
                        cBox_Account_.m_Text_Date.SetVar("date", Utility.Text.Format("{0}-{1}", user_History.DateTime.Month.ToString(), user_History.DateTime.Day.ToString())).FlushVars();

                        switch (user_History.LoginType)
                        {
                        case LoginType.QucikLogin:
                            //[b] 游客账号:[/b] {guest=9999x001}
                            cBox_Account_.m_Text_Number_Item.SetGTextByCode("Text_Number_Item_002");

                            cBox_Account_.m_Text_Number_Item.SetVar("guest", user_History.NickName).FlushVars();

                            //设置图标
                            cBox_Account_.m_Text_Icon.SetGTextByCode(user_History.LoginType.ToString());
                            break;

                        case LoginType.MobilePhone:
                            //[b] 手机号:[/b] {phone=13588737213}
                            cBox_Account_.m_Text_Number_Item.SetGTextByCode("Text_Number_Item_001");

                            cBox_Account_.m_Text_Number_Item.SetVar("phone", user_History.NickName).FlushVars();

                            cBox_Account_.m_Text_Icon.SetGTextByCode(user_History.LoginType.ToString());
                            break;

                        case LoginType.Apple:
                            break;

                        case LoginType.NS:
                            break;

                        case LoginType.Instagram:
                            break;

                        case LoginType.Twitter:
                            break;

                        case LoginType.Facebook:
                            break;

                        case LoginType.Others:
                            break;

                        default:
                            break;
                        }

                        user_History.selectedIndex = i;
                    }
                }
            }
            catch (System.Exception)
            {
            }
        }
コード例 #4
0
ファイル: Login_Account.cs プロジェクト: wangjie0707/Temp_01
        public static void SetHistoryUser(Player player)
        {
            string historyUserStr = SettingComponent.This.GetString(GlobalData.CookieSets.Cookie_Users);

            Dictionary <string, PlayUserHistory> valuePairs = null;

            List <PlayUserHistory> pairs = new List <PlayUserHistory>();

            try
            {
                if (!string.IsNullOrEmpty(historyUserStr))
                {
                    valuePairs = JsonHelper.FromJson <Dictionary <string, PlayUserHistory> >(historyUserStr);

                    IEnumerator <PlayUserHistory> iter = valuePairs.Values.GetEnumerator();

                    while (iter.MoveNext())
                    {
                        if (iter.Current.UserID != player.PlayerInfo.UserID && iter.Current.UserID != 0)
                        {
                            pairs.Insert(pairs.Count, iter.Current);
                        }
                    }
                }
            }
            catch (Exception)
            {
            }

            if (pairs.Count >= 8)
            {
                pairs.RemoveRange(8, pairs.Count - 8);
            }

            PlayUserHistory user = new PlayUserHistory();

            user.UserID         = player.PlayerInfo.UserID;
            user.AuthorizedSKey = player.PlayerInfo.AuthorizedSKey;
            user.DateTime       = DateTime.Now;
            user.LoginType      = player.PlayerInfo.LoginType;

            switch (player.PlayerInfo.LoginType)
            {
            case LoginType.QucikLogin:
                //游客账号
                user.NickName.SetStringByCode("X0001");
                break;

            case LoginType.MobilePhone:

                break;

            case LoginType.Apple:
                break;

            case LoginType.NS:
                break;

            case LoginType.Instagram:
                break;

            case LoginType.Twitter:
                break;

            case LoginType.Facebook:
                break;

            case LoginType.Others:
                break;

            default:
                break;
            }

            pairs.Insert(0, user);

            if (PlayerComponent.This.HistoryUserDic == null)
            {
                PlayerComponent.This.HistoryUserDic = new Dictionary <string, PlayUserHistory>();
            }

            PlayerComponent.This.HistoryUserDic.Clear();

            foreach (var pair in pairs)
            {
                if (pair.UserID != 0)
                {
                    PlayerComponent.This.HistoryUserDic.Add(pair.UserID.ToString(), pair);
                }
            }

            string userListSave = JsonHelper.ToJson(PlayerComponent.This.HistoryUserDic);

            Log.Info("userListSave save:" + userListSave);

            SettingComponent.This.SetString(GlobalData.CookieSets.Cookie_Users, userListSave);
        }