You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

56 lines
1.9 KiB

using Amazon;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq.Expressions;
using System.Reflection;
using System.Text.RegularExpressions;
using UltraCombos.Upload;
using UnityEditor;
using UnityEngine;
namespace UltraCombos.Upload
{
[CustomEditor(typeof(AwsS3Uploader))]
public class AwsS3UploaderEditor : UploaderEditor
{
SerializedProperty regionSystemName;
List<RegionEndpoint> regions = new List<RegionEndpoint>();
string[] regionNames;
string[] regionSystemNames;
/*
protected override void GetURLInternal(string filePath, string filePathWithTag, out string url_display, out string url)
{
var uploader = target as AwsS3Uploader;
url_display = uploader.GetURL2(filePathWithTag, false);
url = uploader.GetURL2( filePath, true);
}
*/
protected override void OnEnable()
{
base.OnEnable();
FindProperty(() => regionSystemName);
regions.AddRange(RegionEndpoint.EnumerableAllRegions);
regionNames = new string[regions.Count];
regionSystemNames = new string[regions.Count];
for (int i = 0; i < regionNames.Length; ++i)
{
regionNames[i] = regions[i].DisplayName;
regionSystemNames[i] = regions[i].SystemName;
}
}
protected override void OnInspectorGUIBody()
{
//Region
var choiceIndex = 0;
for (int i = 0; i < regionNames.Length; ++i)
{
if (regionSystemName.stringValue == regionSystemNames[i])
choiceIndex = i;
}
choiceIndex = EditorGUILayout.Popup("Region", choiceIndex, regionNames);
regionSystemName.stringValue = regionSystemNames[choiceIndex];
}
}
}