mirror of
https://git.aaro.dev/VRCBoard/vrcboard-udon.git
synced 2026-03-17 01:09:45 +00:00
All checks were successful
Create Unity Package / package (push) Successful in 8s
50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
|
|
using UdonSharp;
|
|
using UnityEngine;
|
|
using VRC.SDKBase;
|
|
using VRC.Udon;
|
|
using UnityEngine.Serialization;
|
|
using VRC.SDK3.Data;
|
|
|
|
namespace VRCBoard.Components
|
|
{
|
|
public abstract class VRCBoardImageBaseComponent : VRCBoardBaseComponent
|
|
{
|
|
[Header("Uploader ID (only applies to images of 'shared' or 'instance' type)")]
|
|
public string uploaderIdOverride;
|
|
internal string GetUploader(string imageId)
|
|
{
|
|
string uploaderId = "";
|
|
if (string.IsNullOrEmpty(uploaderIdOverride))
|
|
{
|
|
GetImageAtlasTexture(imageId, null, out Texture2D albedoTexture, out int albedoAtlasPosition, out int albedoAtlasSize, out string albedoType);
|
|
if (albedoType == null)
|
|
{
|
|
//Debug.LogError("Failed to get image type for albedo image");
|
|
return "";
|
|
}
|
|
string _mainType = albedoType;
|
|
if (_mainType == "shared")
|
|
{
|
|
uploaderId = GetRandomUploader(imageId);
|
|
}
|
|
else if (_mainType == "global")
|
|
{
|
|
uploaderId = "null";
|
|
}
|
|
else
|
|
{
|
|
uploaderId = manager._VRCBoardIdFromName(manager.InstanceOwner);
|
|
}
|
|
|
|
//Debug.Log("image uploader: " + uploaderId);
|
|
} else
|
|
{
|
|
uploaderId = uploaderIdOverride;
|
|
}
|
|
return uploaderId;
|
|
}
|
|
}
|
|
|
|
}
|