Beispiel #1
0
    // GUIOVERLAY INTERFACE

    protected override void OnViewInit()
    {
        m_Instance = this;

        base.OnViewInit();

        CloudUser.authenticationChanged += OnAuthenticationChanged;

        m_Chat         = RegisterComponent <ScreenComponentChat>();
        m_Chat.MaxRows = MAX_ROWS;

        m_FriendList = GuiBaseUtils.GetControl <GUIBase_List>(Layout, "FriendList");
        InitGuiLines();
    }
Beispiel #2
0
    // =========================================================================================================================
    // === internal gui delegates ==============================================================================================
    void Delegate_OnFriendAction(string inFriendName, E_FriendAction inAction)
    {
        switch (inAction)
        {
        case E_FriendAction.Select:
            break;

        case E_FriendAction.ShowStats:
        {
            PlayerPersistantInfo        ppi  = null;
            List <PlayerPersistantInfo> ppis = new List <PlayerPersistantInfo>();
            foreach (var friend in m_Friends)
            {
                PlayerPersistantInfo temp = new PlayerPersistantInfo();
                temp.Name       = friend.Nickname;
                temp.PrimaryKey = friend.PrimaryKey;
                temp.InitPlayerDataFromStr(JsonMapper.ToJson(friend.PPIData));

                ppis.Add(temp);

                if (friend.PrimaryKey == inFriendName)
                {
                    ppi = temp;
                }
            }

            if (ppi != null)
            {
                GuiScreenPlayerStats.UserPPIs = ppis.ToArray();
                GuiScreenPlayerStats.UserPPI  = ppi;
                m_Owner.Owner.ShowScreen("PlayerStats");
            }
        }
        break;

        case E_FriendAction.SendMail:
            m_Owner.Owner.ShowPopup("SendMail", inFriendName, null);
            break;

        case E_FriendAction.Chat:
            if (GuiScreenChatFriends.StartChat(inFriendName) == true)
            {
                m_Owner.Owner.ShowScreen("Chat:1", true);
            }
            break;

        case E_FriendAction.Remove:
        {
            string text = string.Format(TextDatabase.instance[02040235], GuiBaseUtils.FixNameForGui(inFriendName));
            m_Owner.Owner.ShowPopup("ConfirmDialog",
                                    TextDatabase.instance[02040234],
                                    text,
                                    (inPopup, inResult) =>
                {
                    if (inResult == E_PopupResultCode.Ok)
                    {
                        GameCloudManager.friendList.RemoveFriend(inFriendName);
                    }
                });
        }
        break;

        default:
            break;
        }
    }