Add Discord GameSDK.
This commit is contained in:
12
Assets/Plugins/DiscordGameSDK/ActivityManager.cs
Normal file
12
Assets/Plugins/DiscordGameSDK/ActivityManager.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
public partial class ActivityManager
|
||||
{
|
||||
public void RegisterCommand()
|
||||
{
|
||||
RegisterCommand(null);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Plugins/DiscordGameSDK/ActivityManager.cs.meta
Normal file
11
Assets/Plugins/DiscordGameSDK/ActivityManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4bce5beb292181a43b6427b71e8a7e93
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
9
Assets/Plugins/DiscordGameSDK/Constants.cs
Normal file
9
Assets/Plugins/DiscordGameSDK/Constants.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
static class Constants
|
||||
{
|
||||
public const string DllName = "discord_game_sdk";
|
||||
}
|
||||
}
|
11
Assets/Plugins/DiscordGameSDK/Constants.cs.meta
Normal file
11
Assets/Plugins/DiscordGameSDK/Constants.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 62db490eb0dffd64785623624a77cfd4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
4421
Assets/Plugins/DiscordGameSDK/Core.cs
Normal file
4421
Assets/Plugins/DiscordGameSDK/Core.cs
Normal file
File diff suppressed because it is too large
Load Diff
11
Assets/Plugins/DiscordGameSDK/Core.cs.meta
Normal file
11
Assets/Plugins/DiscordGameSDK/Core.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 492875a0b937d86409c5dddd1d597026
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
3
Assets/Plugins/DiscordGameSDK/DiscordGameSDK.asmdef
Normal file
3
Assets/Plugins/DiscordGameSDK/DiscordGameSDK.asmdef
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"name": "DiscordGameSDK"
|
||||
}
|
7
Assets/Plugins/DiscordGameSDK/DiscordGameSDK.asmdef.meta
Normal file
7
Assets/Plugins/DiscordGameSDK/DiscordGameSDK.asmdef.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5686e5ee69d0e084c843d61c240d7fdb
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
53
Assets/Plugins/DiscordGameSDK/ImageManager.cs
Normal file
53
Assets/Plugins/DiscordGameSDK/ImageManager.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
#if UNITY_EDITOR || UNITY_STANDALONE
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
public partial struct ImageHandle
|
||||
{
|
||||
static public ImageHandle User(Int64 id)
|
||||
{
|
||||
return User(id, 128);
|
||||
}
|
||||
|
||||
static public ImageHandle User(Int64 id, UInt32 size)
|
||||
{
|
||||
return new ImageHandle
|
||||
{
|
||||
Type = ImageType.User,
|
||||
Id = id,
|
||||
Size = size,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public partial class ImageManager
|
||||
{
|
||||
public void Fetch(ImageHandle handle, FetchHandler callback)
|
||||
{
|
||||
Fetch(handle, false, callback);
|
||||
}
|
||||
|
||||
public byte[] GetData(ImageHandle handle)
|
||||
{
|
||||
var dimensions = GetDimensions(handle);
|
||||
var data = new byte[dimensions.Width * dimensions.Height * 4];
|
||||
GetData(handle, data);
|
||||
return data;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR || UNITY_STANDALONE
|
||||
public Texture2D GetTexture(ImageHandle handle)
|
||||
{
|
||||
var dimensions = GetDimensions(handle);
|
||||
var texture = new Texture2D((int)dimensions.Width, (int)dimensions.Height, TextureFormat.RGBA32, false, true);
|
||||
texture.LoadRawTextureData(GetData(handle));
|
||||
texture.Apply();
|
||||
return texture;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
11
Assets/Plugins/DiscordGameSDK/ImageManager.cs.meta
Normal file
11
Assets/Plugins/DiscordGameSDK/ImageManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3cfde4503bedc444807a916e1ad2960
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
26
Assets/Plugins/DiscordGameSDK/LobbyManager.cs
Normal file
26
Assets/Plugins/DiscordGameSDK/LobbyManager.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
public partial class LobbyManager
|
||||
{
|
||||
public IEnumerable<User> GetMemberUsers(Int64 lobbyID)
|
||||
{
|
||||
var memberCount = MemberCount(lobbyID);
|
||||
var members = new List<User>();
|
||||
for (var i = 0; i < memberCount; i++)
|
||||
{
|
||||
members.Add(GetMemberUser(lobbyID, GetMemberUserId(lobbyID, i)));
|
||||
}
|
||||
return members;
|
||||
}
|
||||
|
||||
public void SendLobbyMessage(Int64 lobbyID, string data, SendLobbyMessageHandler handler)
|
||||
{
|
||||
SendLobbyMessage(lobbyID, Encoding.UTF8.GetBytes(data), handler);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Plugins/DiscordGameSDK/LobbyManager.cs.meta
Normal file
11
Assets/Plugins/DiscordGameSDK/LobbyManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d49d4d1d5cee72b40a22bf6f6bdd0309
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
20
Assets/Plugins/DiscordGameSDK/StorageManager.cs
Normal file
20
Assets/Plugins/DiscordGameSDK/StorageManager.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
public partial class StorageManager
|
||||
{
|
||||
public IEnumerable<FileStat> Files()
|
||||
{
|
||||
var fileCount = Count();
|
||||
var files = new List<FileStat>();
|
||||
for (var i = 0; i < fileCount; i++)
|
||||
{
|
||||
files.Add(StatAt(i));
|
||||
}
|
||||
return files;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Plugins/DiscordGameSDK/StorageManager.cs.meta
Normal file
11
Assets/Plugins/DiscordGameSDK/StorageManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 75e55be5cce5be14ca292ed00ff90a43
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
32
Assets/Plugins/DiscordGameSDK/StoreManager.cs
Normal file
32
Assets/Plugins/DiscordGameSDK/StoreManager.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
public partial class StoreManager
|
||||
{
|
||||
public IEnumerable<Entitlement> GetEntitlements()
|
||||
{
|
||||
var count = CountEntitlements();
|
||||
var entitlements = new List<Entitlement>();
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
entitlements.Add(GetEntitlementAt(i));
|
||||
}
|
||||
return entitlements;
|
||||
}
|
||||
|
||||
public IEnumerable<Sku> GetSkus()
|
||||
{
|
||||
var count = CountSkus();
|
||||
var skus = new List<Sku>();
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
skus.Add(GetSkuAt(i));
|
||||
}
|
||||
return skus;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Plugins/DiscordGameSDK/StoreManager.cs.meta
Normal file
11
Assets/Plugins/DiscordGameSDK/StoreManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f28abb9e0c9477541bba93c5c21a7111
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user