コード例 #1
0
ファイル: MegacoolShare.cs プロジェクト: megacool/unity-demo
    public MegacoolShare(Megacool.MegacoolSentShareOpenedEvent e)
    {
        ReferralCode = new MegacoolReferralCode(e.userId, e.shareId);
        State        = (MegacoolShareState)e.state;
        CreatedAt    = FromUnixTime(e.createdAt).ToLocalTime();
        UpdatedAt    = FromUnixTime(e.updatedAt).ToLocalTime();

        if (e.url != null)
        {
            Url = new Uri(e.url, UriKind.Relative);
        }

        Data = new Dictionary <string, string>()
        {
            { "receiverUserId", e.receiverUserId }
        };
    }
コード例 #2
0
ファイル: MegacoolEvent.cs プロジェクト: megacool/unity-demo
    public MegacoolEvent(Megacool.MegacoolSentShareOpenedEvent e)
    {
        Share        = new MegacoolShare(e);
        Type         = MegacoolEventType.SentShareOpened;
        FirstSession = e.isFirstSession != 0;

        if (e.eventDataLength > 0)
        {
            byte[] bytes = new byte[e.eventDataLength];
            Marshal.Copy(e.eventDataBytes, bytes, 0, e.eventDataLength);

            Data = MegacoolThirdParty_MiniJSON.Json.Deserialize(System.Text.Encoding.UTF8.GetString(bytes)) as Dictionary <string, object>;
        }
        else
        {
            Data = new Dictionary <string, object>();
        }
    }