初始化
This commit is contained in:
3
UnityGame/Assets/Scripts/ThirdParty/YIUIFramework/Plugins/.LoopScrollRect/Extend.meta
vendored
Normal file
3
UnityGame/Assets/Scripts/ThirdParty/YIUIFramework/Plugins/.LoopScrollRect/Extend.meta
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95a3ff7f87754ac9b754edb88a8dd18f
|
||||
timeCreated: 1684231887
|
||||
@@ -0,0 +1,34 @@
|
||||
using Sirenix.OdinInspector;
|
||||
|
||||
namespace UnityEngine.UI
|
||||
{
|
||||
public abstract partial class LoopScrollRect
|
||||
{
|
||||
[SerializeField]
|
||||
[LabelText("缓存父级对象")]
|
||||
internal RectTransform u_CacheRect;
|
||||
|
||||
[SerializeField]
|
||||
[LabelText("最大可点击数")]
|
||||
[MinValue(1)]
|
||||
internal int u_MaxClickCount = 1;
|
||||
|
||||
[SerializeField]
|
||||
[LabelText("自动取消上一个选择")]
|
||||
[MinValue(1)]
|
||||
internal bool u_AutoCancelLast = true;
|
||||
|
||||
[SerializeField]
|
||||
[LabelText("重复点击则取消")]
|
||||
internal bool u_RepetitionCancel;
|
||||
|
||||
internal int u_StartLine => StartLine; //可见的第一行
|
||||
internal int u_CurrentLines => CurrentLines; //滚动中的当前行数
|
||||
internal int u_TotalLines => TotalLines; //总数
|
||||
internal int u_EndLine => Mathf.Min(u_StartLine + u_CurrentLines, u_TotalLines); //可见的最后一行
|
||||
internal int u_ContentConstraintCount => contentConstraintCount; //限制 行/列 数
|
||||
internal float u_ContentSpacing => contentSpacing; //间隔
|
||||
internal int u_ItemStart => itemTypeStart; //当前显示的第一个的Index
|
||||
internal int u_ItemEnd => itemTypeEnd; //当前显示的最后一个index 被+1了注意
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1dafb5ec7aa14af1bbefeb1f5c0d25e6
|
||||
timeCreated: 1684240446
|
||||
152
UnityGame/Assets/Scripts/ThirdParty/YIUIFramework/Plugins/.LoopScrollRect/Extend/YIUILoopScroll.cs
vendored
Normal file
152
UnityGame/Assets/Scripts/ThirdParty/YIUIFramework/Plugins/.LoopScrollRect/Extend/YIUILoopScroll.cs
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
//------------------------------------------------------------
|
||||
// Author: 亦亦
|
||||
// Mail: 379338943@qq.com
|
||||
// Data: 2023年2月12日
|
||||
//------------------------------------------------------------
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace YIUIFramework
|
||||
{
|
||||
public partial class YIUILoopScroll<TData, TItemRenderer>: LoopScrollPrefabAsyncSource, LoopScrollDataSource
|
||||
where TItemRenderer : UIBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 列表项渲染器
|
||||
/// </summary>
|
||||
/// <param name="index">数据的索引</param>
|
||||
/// <param name="data">数据项</param>
|
||||
/// <param name="item">显示对象</param>
|
||||
/// <param name="select">是否被选中</param>
|
||||
public delegate void ListItemRenderer(int index, TData data, TItemRenderer item, bool select);
|
||||
|
||||
private ListItemRenderer m_ItemRenderer;
|
||||
private UIBindVo m_BindVo;
|
||||
private IList<TData> m_Data;
|
||||
|
||||
private LoopScrollRect m_Owner;
|
||||
private ObjAsyncCache<TItemRenderer> m_UIBasePool;
|
||||
private Dictionary<Transform, TItemRenderer> m_ItemTransformDic = new Dictionary<Transform, TItemRenderer>();
|
||||
private Dictionary<Transform, int> m_ItemTransformIndexDic = new Dictionary<Transform, int>();
|
||||
|
||||
public YIUILoopScroll(
|
||||
LoopScrollRect owner,
|
||||
ListItemRenderer itemRenderer)
|
||||
{
|
||||
var data = UIBindHelper.GetBindVoByType<TItemRenderer>();
|
||||
if (data == null) return;
|
||||
m_ItemTransformDic.Clear();
|
||||
m_ItemTransformIndexDic.Clear();
|
||||
m_BindVo = data.Value;
|
||||
m_ItemRenderer = itemRenderer;
|
||||
m_UIBasePool = new ObjAsyncCache<TItemRenderer>(OnCreateItemRenderer);
|
||||
m_Owner = owner;
|
||||
m_Owner.prefabSource = this;
|
||||
m_Owner.dataSource = this;
|
||||
InitCacheParent();
|
||||
InitClearContent();
|
||||
}
|
||||
|
||||
#region Private
|
||||
|
||||
private void InitCacheParent()
|
||||
{
|
||||
if (m_Owner.u_CacheRect != null)
|
||||
{
|
||||
m_Owner.u_CacheRect.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
var cacheObj = new GameObject("Cache");
|
||||
var cacheRect = cacheObj.GetOrAddComponent<RectTransform>();
|
||||
m_Owner.u_CacheRect = cacheRect;
|
||||
cacheRect.SetParent(m_Owner.transform, false);
|
||||
cacheObj.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
//不应该初始化时有内容 所有不管是什么全部摧毁
|
||||
private void InitClearContent()
|
||||
{
|
||||
var count = Content.childCount;
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var child = Content.GetChild(0);
|
||||
Object.DestroyImmediate(child.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private TItemRenderer GetItemRendererByDic(Transform tsf)
|
||||
{
|
||||
if (m_ItemTransformDic.TryGetValue(tsf, out var value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
Debug.LogError($"{tsf.name} 没找到这个关联对象 请检查错误");
|
||||
return null;
|
||||
}
|
||||
|
||||
private void AddItemRendererByDic(Transform tsf, TItemRenderer item)
|
||||
{
|
||||
m_ItemTransformDic.TryAdd(tsf, item);
|
||||
}
|
||||
|
||||
private int GetItemIndex(Transform tsf)
|
||||
{
|
||||
return m_ItemTransformIndexDic.GetValueOrDefault(tsf, -1);
|
||||
}
|
||||
|
||||
private void ResetItemIndex(Transform tsf, int index)
|
||||
{
|
||||
m_ItemTransformIndexDic[tsf] = index;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LoopScrollRect Interface
|
||||
|
||||
private async UniTask<TItemRenderer> OnCreateItemRenderer()
|
||||
{
|
||||
var uiBase = await YIUIFactory.InstantiateAsync<TItemRenderer>(m_BindVo);
|
||||
AddItemRendererByDic(uiBase.OwnerRectTransform, uiBase);
|
||||
return AddOnClickEvent(uiBase);
|
||||
}
|
||||
|
||||
public async UniTask<GameObject> GetObject(int index)
|
||||
{
|
||||
var uiBase = await m_UIBasePool.Get();
|
||||
return uiBase.OwnerGameObject;
|
||||
}
|
||||
|
||||
public void ReturnObject(Transform transform)
|
||||
{
|
||||
var uiBase = GetItemRendererByDic(transform);
|
||||
if (uiBase == null) return;
|
||||
m_UIBasePool.Put(uiBase);
|
||||
ResetItemIndex(transform, -1);
|
||||
transform.SetParent(m_Owner.u_CacheRect, false);
|
||||
}
|
||||
|
||||
public void ProvideData(Transform transform, int index)
|
||||
{
|
||||
var uiBase = GetItemRendererByDic(transform);
|
||||
if (uiBase == null) return;
|
||||
ResetItemIndex(transform, index);
|
||||
var select = m_OnClickItemHashSet.Contains(index);
|
||||
if (m_Data == null)
|
||||
{
|
||||
Debug.LogError($"当前没有设定数据 m_Data == null");
|
||||
return;
|
||||
}
|
||||
|
||||
m_ItemRenderer?.Invoke(index, m_Data[index], uiBase, select);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ecbeceb50fb342d6960d03203f971d89
|
||||
timeCreated: 1684288929
|
||||
@@ -0,0 +1,139 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace YIUIFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// 对外可调用API
|
||||
/// </summary>
|
||||
public partial class YIUILoopScroll<TData, TItemRenderer>
|
||||
{
|
||||
//设置数据 然后刷新
|
||||
//不管是要修改数据长度 还是数据变更了 都用此方法刷新
|
||||
public async UniTask SetDataRefresh(IList<TData> data)
|
||||
{
|
||||
m_Data = data;
|
||||
m_Owner.totalCount = data.Count;
|
||||
await RefillCells();
|
||||
}
|
||||
|
||||
//所有数据全部刷新 全部显示 不基于无限循环了
|
||||
//适用于数据量很少的情况 需要动态显示的
|
||||
public async UniTask SetDataRefreshShowAll(IList<TData> data)
|
||||
{
|
||||
m_Data = data;
|
||||
m_Owner.totalCount = data.Count;
|
||||
await RefillCells(0,99999);
|
||||
await ScrollToCellWithinTime(0,0);
|
||||
}
|
||||
|
||||
//刷新时默认选中某个索引数据
|
||||
//注意这里相当于+=操作 如果你会频繁调用这个方法
|
||||
//又想每次刷新选中不同的索引
|
||||
//那么你应该先自行调用一次 ClearSelect
|
||||
public async UniTask SetDataRefresh(IList<TData> data, int index)
|
||||
{
|
||||
SetDefaultSelect(index);
|
||||
await SetDataRefresh(data);
|
||||
}
|
||||
|
||||
//同上 请看注释 注意使用方式
|
||||
public async UniTask SetDataRefresh(IList<TData> data, List<int> index)
|
||||
{
|
||||
SetDefaultSelect(index);
|
||||
await SetDataRefresh(data);
|
||||
}
|
||||
|
||||
//如果 < 0 则表示这个对象在对象池里
|
||||
public int GetItemIndex(TItemRenderer item)
|
||||
{
|
||||
return GetItemIndex(item.OwnerRectTransform);
|
||||
}
|
||||
|
||||
//只能获取当前可见的对象
|
||||
public TItemRenderer GetItemByIndex(int index, bool log = true)
|
||||
{
|
||||
if (index < ItemStart || index >= ItemEnd) return null;
|
||||
var childIndex = index - ItemStart;
|
||||
if (childIndex < 0 || childIndex >= Content.childCount)
|
||||
{
|
||||
if (log)
|
||||
{
|
||||
Debug.LogError($"索引错误 请检查 index:{index} Start:{ItemStart} childIndex:{childIndex} childCount:{Content.childCount}");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
var transform = Content.GetChild(childIndex);
|
||||
var uiBase = GetItemRendererByDic(transform);
|
||||
return uiBase;
|
||||
}
|
||||
|
||||
//判断某个对象是否被选中
|
||||
public bool IsSelect(TItemRenderer item)
|
||||
{
|
||||
return m_OnClickItemHashSet.Contains(GetItemIndex(item));
|
||||
}
|
||||
|
||||
//就获取目前显示的这几个数据
|
||||
public List<TData> GetShowData()
|
||||
{
|
||||
var listData = new List<TData>();
|
||||
|
||||
for (var i = ItemStart; i < ItemEnd; i++)
|
||||
{
|
||||
listData.Add(m_Data[i]);
|
||||
}
|
||||
|
||||
return listData;
|
||||
}
|
||||
|
||||
#region 点击相关 获取被选中目标..
|
||||
|
||||
//获取当前所有被选择的索引
|
||||
public List<int> GetSelectIndex()
|
||||
{
|
||||
return m_OnClickItemQueue.ToList();
|
||||
}
|
||||
|
||||
//只能得到当前可见的 不可见的拿不到
|
||||
public List<TItemRenderer> GetSelectItem()
|
||||
{
|
||||
var selectList = new List<TItemRenderer>();
|
||||
foreach (var index in GetSelectIndex())
|
||||
{
|
||||
var item = GetItemByIndex(index);
|
||||
if (item != null)
|
||||
{
|
||||
selectList.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
return selectList;
|
||||
}
|
||||
|
||||
//获取所有被选择的数据
|
||||
public List<TData> GetSelectData()
|
||||
{
|
||||
var selectList = new List<TData>();
|
||||
foreach (var index in GetSelectIndex())
|
||||
{
|
||||
selectList.Add(m_Data[index]);
|
||||
}
|
||||
|
||||
return selectList;
|
||||
}
|
||||
|
||||
//移除某个选中的目标 然后刷新
|
||||
public async UniTask RemoveSelectIndexRefresh(int index)
|
||||
{
|
||||
RemoveSelectIndex(index);
|
||||
await RefreshCells();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d03accccee69468dbc99efeb392c1211
|
||||
timeCreated: 1684310524
|
||||
@@ -0,0 +1,77 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace YIUIFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// 快捷方法/属性
|
||||
/// </summary>
|
||||
public partial class YIUILoopScroll<TData, TItemRenderer>
|
||||
{
|
||||
public int TotalCount => m_Owner.totalCount; //总数
|
||||
public RectTransform Content => m_Owner.content;
|
||||
public RectTransform CacheRect => m_Owner.u_CacheRect;
|
||||
public int StartLine => m_Owner.u_StartLine; //可见的第一行
|
||||
public int CurrentLines => m_Owner.u_CurrentLines; //滚动中的当前行数
|
||||
public int TotalLines => m_Owner.u_TotalLines; //总数
|
||||
public int EndLine => Mathf.Min(StartLine + CurrentLines, TotalLines); //可见的最后一行
|
||||
public int ContentConstraintCount => m_Owner.u_ContentConstraintCount; //限制 行/列 数
|
||||
public float ContentSpacing => m_Owner.u_ContentSpacing; //间隔
|
||||
public int ItemStart => m_Owner.u_ItemStart; //当前显示的第一个的Index
|
||||
public int ItemEnd => m_Owner.u_ItemEnd; //当前显示的最后一个index 被+1了注意
|
||||
|
||||
//在开始时用startItem填充单元格,同时清除现有的单元格
|
||||
public async UniTask RefillCells(int startItem = 0, float contentOffset = 0)
|
||||
{
|
||||
await m_Owner.RefillCells(startItem, contentOffset);
|
||||
}
|
||||
|
||||
//在结束时重新填充endItem中的单元格,同时清除现有的单元格
|
||||
public async UniTask RefillCellsFromEnd(int endItem = 0, bool alignStart = false)
|
||||
{
|
||||
await m_Owner.RefillCellsFromEnd(endItem, alignStart);
|
||||
}
|
||||
|
||||
public async UniTask RefreshCells()
|
||||
{
|
||||
await m_Owner.RefreshCells();
|
||||
}
|
||||
|
||||
public void ClearCells()
|
||||
{
|
||||
m_Owner.ClearCells();
|
||||
}
|
||||
|
||||
public int GetFirstItem(out float offset)
|
||||
{
|
||||
return m_Owner.GetFirstItem(out offset);
|
||||
}
|
||||
|
||||
public int GetLastItem(out float offset)
|
||||
{
|
||||
return m_Owner.GetLastItem(out offset);
|
||||
}
|
||||
|
||||
private int GetValidIndex(int index)
|
||||
{
|
||||
return Mathf.Clamp(index, 0, TotalCount - 1);
|
||||
}
|
||||
|
||||
public async UniTask ScrollToCell(int index, float speed)
|
||||
{
|
||||
if (TotalCount <= 0) return;
|
||||
await m_Owner.ScrollToCell(GetValidIndex(index), speed);
|
||||
}
|
||||
|
||||
public async UniTask ScrollToCellWithinTime(int index, float time)
|
||||
{
|
||||
if (TotalCount <= 0) return;
|
||||
await m_Owner.ScrollToCellWithinTime(GetValidIndex(index), time);
|
||||
}
|
||||
|
||||
public void StopMovement()
|
||||
{
|
||||
m_Owner.StopMovement();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6ade2fde49f0414a9c45e2875d361f45
|
||||
timeCreated: 1684303900
|
||||
@@ -0,0 +1,229 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using YIUIBind;
|
||||
|
||||
namespace YIUIFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// 额外点击相关
|
||||
/// </summary>
|
||||
public partial class YIUILoopScroll<TData, TItemRenderer>
|
||||
{
|
||||
/// <summary>
|
||||
/// 列表元素被点击的事件
|
||||
/// </summary>
|
||||
public delegate void OnClickItemEvent(int index, TData data, TItemRenderer item, bool select);
|
||||
|
||||
private bool m_OnClickInit; //是否已初始化
|
||||
private string m_ItemClickEventName; //ui中的点击UIEventP0
|
||||
private OnClickItemEvent m_OnClickItemEvent; //点击回调
|
||||
private Queue<int> m_OnClickItemQueue = new Queue<int>(); //当前所有已选择 遵循先进先出 有序
|
||||
private HashSet<int> m_OnClickItemHashSet = new HashSet<int>(); //当前所有已选择 无序 为了更快查找
|
||||
private int m_MaxClickCount = 1; //可选最大数量 >=2 就是复选 最小1
|
||||
private bool m_RepetitionCancel = true; //重复选择 则取消选择
|
||||
private bool m_AutoCancelLast = true; //当选择操作最大数量过后 自动取消第一个选择的 否则选择无效
|
||||
|
||||
public YIUILoopScroll<TData, TItemRenderer> SetOnClickInfo(
|
||||
string itemClickEventName,
|
||||
OnClickItemEvent onClickItemEvent)
|
||||
{
|
||||
if (m_OnClickInit)
|
||||
{
|
||||
Debug.LogError($"OnClick 相关只能初始化一次 且不能修改");
|
||||
return this;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(itemClickEventName))
|
||||
{
|
||||
Debug.LogError($"必须有事件名称");
|
||||
return this;
|
||||
}
|
||||
|
||||
if (onClickItemEvent == null)
|
||||
{
|
||||
Debug.LogError($"必须有点击事件");
|
||||
return this;
|
||||
}
|
||||
|
||||
m_MaxClickCount = Mathf.Max(1, m_Owner.u_MaxClickCount);
|
||||
m_ItemClickEventName = itemClickEventName;
|
||||
m_OnClickItemEvent = onClickItemEvent;
|
||||
m_RepetitionCancel = m_Owner.u_RepetitionCancel;
|
||||
m_OnClickInit = true;
|
||||
m_AutoCancelLast = m_Owner.u_AutoCancelLast;
|
||||
m_OnClickItemQueue.Clear();
|
||||
m_OnClickItemHashSet.Clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
//reset=吧之前选择的都取消掉 讲道理应该都是true
|
||||
//false出问题自己查
|
||||
public void ClearSelect(bool reset = true)
|
||||
{
|
||||
if (reset)
|
||||
{
|
||||
var selectCount = m_OnClickItemHashSet.Count;
|
||||
for (var i = 0; i < selectCount; i++)
|
||||
{
|
||||
OnClickItemQueuePeek();
|
||||
}
|
||||
}
|
||||
|
||||
m_OnClickItemQueue.Clear();
|
||||
m_OnClickItemHashSet.Clear();
|
||||
}
|
||||
|
||||
//动态改变 自动取消上一个选择的
|
||||
public void ChangeAutoCancelLast(bool autoCancelLast)
|
||||
{
|
||||
m_AutoCancelLast = autoCancelLast;
|
||||
}
|
||||
|
||||
//动态改变 重复选择 则取消选择
|
||||
public void ChangeRepetitionCancel(bool repetitionCancel)
|
||||
{
|
||||
m_RepetitionCancel = repetitionCancel;
|
||||
}
|
||||
|
||||
//动态改变 最大可选数量
|
||||
public void ChangeMaxClickCount(int count, bool reset = true)
|
||||
{
|
||||
ClearSelect(reset);
|
||||
m_MaxClickCount = Mathf.Max(1, count);
|
||||
}
|
||||
|
||||
//传入对象 选中目标
|
||||
public void OnClickItem(TItemRenderer item)
|
||||
{
|
||||
var index = GetItemIndex(item);
|
||||
if (index < 0)
|
||||
{
|
||||
Debug.LogError($"无法选中一个不在显示中的对象");
|
||||
return;
|
||||
}
|
||||
|
||||
var select = OnClickItemQueueEnqueue(index);
|
||||
OnClickItem(index, item, select);
|
||||
}
|
||||
|
||||
//传入索引 选中目标
|
||||
public void OnClickItem(int index)
|
||||
{
|
||||
if (index < 0 || index >= m_Data.Count)
|
||||
{
|
||||
Debug.LogError($"索引越界{index} 0 - {m_Data.Count}");
|
||||
return;
|
||||
}
|
||||
|
||||
var item = GetItemByIndex(index, false);
|
||||
var select = OnClickItemQueueEnqueue(index);
|
||||
if (item != null)
|
||||
{
|
||||
OnClickItem(index, item, select);
|
||||
}
|
||||
}
|
||||
|
||||
private bool OnClickItemQueueEnqueue(int index)
|
||||
{
|
||||
if (m_OnClickItemHashSet.Contains(index))
|
||||
{
|
||||
if (m_RepetitionCancel)
|
||||
{
|
||||
RemoveSelectIndex(index);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_OnClickItemQueue.Count >= m_MaxClickCount)
|
||||
{
|
||||
if (m_AutoCancelLast)
|
||||
{
|
||||
OnClickItemQueuePeek();
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
OnClickItemHashSetAdd(index);
|
||||
m_OnClickItemQueue.Enqueue(index);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void SetDefaultSelect(int index)
|
||||
{
|
||||
OnClickItemQueueEnqueue(index);
|
||||
}
|
||||
|
||||
private void SetDefaultSelect(List<int> indexs)
|
||||
{
|
||||
foreach (var index in indexs)
|
||||
{
|
||||
SetDefaultSelect(index);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnClickItem(int index, TItemRenderer item, bool select)
|
||||
{
|
||||
m_OnClickItemEvent?.Invoke(index, m_Data[index], item, select);
|
||||
}
|
||||
|
||||
private TItemRenderer AddOnClickEvent(TItemRenderer uiBase)
|
||||
{
|
||||
if (!m_OnClickInit) return uiBase;
|
||||
|
||||
var eventTable = uiBase.m_EventTable;
|
||||
if (eventTable == null)
|
||||
{
|
||||
Debug.LogError($"目标item 没有 event表 请检查");
|
||||
return uiBase;
|
||||
}
|
||||
|
||||
var uEventClickItem = eventTable.FindEvent<UIEventP0>(m_ItemClickEventName);
|
||||
if (uEventClickItem == null)
|
||||
{
|
||||
Debug.LogError($"当前监听的事件未找到 请检查 {typeof (TItemRenderer).Name} 中是否有这个事件 {m_ItemClickEventName}");
|
||||
}
|
||||
else
|
||||
{
|
||||
uEventClickItem.Add(() => { OnClickItem(uiBase); });
|
||||
}
|
||||
|
||||
return uiBase;
|
||||
}
|
||||
|
||||
private void OnClickItemQueuePeek()
|
||||
{
|
||||
var index = m_OnClickItemQueue.Dequeue();
|
||||
OnClickItemHashSetRemove(index);
|
||||
if (index < ItemStart || index >= ItemEnd) return;
|
||||
var item = GetItemByIndex(index);
|
||||
if (item != null)
|
||||
OnClickItem(index, item, false);
|
||||
}
|
||||
|
||||
private void OnClickItemHashSetAdd(int index)
|
||||
{
|
||||
m_OnClickItemHashSet.Add(index);
|
||||
}
|
||||
|
||||
private void OnClickItemHashSetRemove(int index)
|
||||
{
|
||||
m_OnClickItemHashSet.Remove(index);
|
||||
}
|
||||
|
||||
private void RemoveSelectIndex(int index)
|
||||
{
|
||||
var list = m_OnClickItemQueue.ToList();
|
||||
list.Remove(index);
|
||||
m_OnClickItemQueue = new Queue<int>(list);
|
||||
OnClickItemHashSetRemove(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8dc0b35a94db4faaba5a440147536be3
|
||||
timeCreated: 1684309606
|
||||
8
UnityGame/Assets/Scripts/ThirdParty/YIUIFramework/Plugins/.LoopScrollRect/Runtime.meta
vendored
Normal file
8
UnityGame/Assets/Scripts/ThirdParty/YIUIFramework/Plugins/.LoopScrollRect/Runtime.meta
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec0ddcd49b026ab4fb6b7d49fd693e57
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,179 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace UnityEngine.UI
|
||||
{
|
||||
[AddComponentMenu("UI/Loop Horizontal Scroll Rect", 50)]
|
||||
[DisallowMultipleComponent]
|
||||
public class LoopHorizontalScrollRect : LoopScrollRect
|
||||
{
|
||||
LoopHorizontalScrollRect()
|
||||
{
|
||||
direction = LoopScrollRectDirection.Horizontal;
|
||||
}
|
||||
|
||||
protected override float GetSize(RectTransform item, bool includeSpacing)
|
||||
{
|
||||
float size = includeSpacing ? contentSpacing : 0;
|
||||
if (m_GridLayout != null)
|
||||
{
|
||||
size += m_GridLayout.cellSize.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
size += LayoutUtility.GetPreferredWidth(item);
|
||||
}
|
||||
size *= m_Content.localScale.x;
|
||||
return size;
|
||||
}
|
||||
|
||||
protected override float GetDimension(Vector2 vector)
|
||||
{
|
||||
return -vector.x;
|
||||
}
|
||||
|
||||
protected override float GetAbsDimension(Vector2 vector)
|
||||
{
|
||||
return vector.x;
|
||||
}
|
||||
|
||||
protected override Vector2 GetVector(float value)
|
||||
{
|
||||
return new Vector2(-value, 0);
|
||||
}
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
if (m_Content)
|
||||
{
|
||||
GridLayoutGroup layout = m_Content.GetComponent<GridLayoutGroup>();
|
||||
if (layout != null && layout.constraint != GridLayoutGroup.Constraint.FixedRowCount)
|
||||
{
|
||||
Debug.LogError($"[LoopScrollRect] {this.gameObject.name} 不支持的GridLayoutGroup约束 必须使用 FixedRowCount",this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override async UniTask<(bool,Bounds,Bounds)> UpdateItems(Bounds viewBounds, Bounds contentBounds)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
// special case: handling move several page in one frame
|
||||
if ((viewBounds.size.x < contentBounds.min.x - viewBounds.max.x) && itemTypeEnd > itemTypeStart)
|
||||
{
|
||||
float currentSize = contentBounds.size.x;
|
||||
float elementSize = (currentSize - contentSpacing * (CurrentLines - 1)) / CurrentLines;
|
||||
ReturnToTempPool(false, itemTypeEnd - itemTypeStart);
|
||||
itemTypeEnd = itemTypeStart;
|
||||
|
||||
int offsetCount = Mathf.FloorToInt((contentBounds.min.x - viewBounds.max.x) / (elementSize + contentSpacing));
|
||||
if (totalCount >= 0 && itemTypeStart - offsetCount * contentConstraintCount < 0)
|
||||
{
|
||||
offsetCount = Mathf.FloorToInt((float)(itemTypeStart) / contentConstraintCount);
|
||||
}
|
||||
itemTypeStart -= offsetCount * contentConstraintCount;
|
||||
if (totalCount >= 0)
|
||||
{
|
||||
itemTypeStart = Mathf.Max(itemTypeStart, 0);
|
||||
}
|
||||
itemTypeEnd = itemTypeStart;
|
||||
|
||||
float offset = offsetCount * (elementSize + contentSpacing);
|
||||
m_Content.anchoredPosition -= new Vector2(offset + (reverseDirection ? currentSize : 0), 0);
|
||||
contentBounds.center -= new Vector3(offset + currentSize / 2, 0, 0);
|
||||
contentBounds.size = Vector3.zero;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if ((viewBounds.min.x - contentBounds.max.x > viewBounds.size.x) && itemTypeEnd > itemTypeStart)
|
||||
{
|
||||
int maxItemTypeStart = -1;
|
||||
if (totalCount >= 0)
|
||||
{
|
||||
maxItemTypeStart = Mathf.Max(0, totalCount - (itemTypeEnd - itemTypeStart));
|
||||
maxItemTypeStart = (maxItemTypeStart / contentConstraintCount) * contentConstraintCount;
|
||||
}
|
||||
float currentSize = contentBounds.size.x;
|
||||
float elementSize = (currentSize - contentSpacing * (CurrentLines - 1)) / CurrentLines;
|
||||
ReturnToTempPool(true, itemTypeEnd - itemTypeStart);
|
||||
// TODO: fix with contentConstraint?
|
||||
itemTypeStart = itemTypeEnd;
|
||||
|
||||
int offsetCount = Mathf.FloorToInt((viewBounds.min.x - contentBounds.max.x) / (elementSize + contentSpacing));
|
||||
if (maxItemTypeStart >= 0 && itemTypeStart + offsetCount * contentConstraintCount > maxItemTypeStart)
|
||||
{
|
||||
offsetCount = Mathf.FloorToInt((float)(maxItemTypeStart - itemTypeStart) / contentConstraintCount);
|
||||
}
|
||||
itemTypeStart += offsetCount * contentConstraintCount;
|
||||
if (totalCount >= 0)
|
||||
{
|
||||
itemTypeStart = Mathf.Max(itemTypeStart, 0);
|
||||
}
|
||||
itemTypeEnd = itemTypeStart;
|
||||
|
||||
float offset = offsetCount * (elementSize + contentSpacing);
|
||||
m_Content.anchoredPosition += new Vector2(offset + (reverseDirection ? 0 : currentSize), 0);
|
||||
contentBounds.center += new Vector3(offset + currentSize / 2, 0, 0);
|
||||
contentBounds.size = Vector3.zero;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (viewBounds.max.x > contentBounds.max.x - m_ContentRightPadding)
|
||||
{
|
||||
float size = await NewItemAtEnd(), totalSize = size;
|
||||
while (size > 0 && viewBounds.max.x > contentBounds.max.x - m_ContentRightPadding + totalSize)
|
||||
{
|
||||
size = await NewItemAtEnd();
|
||||
totalSize += size;
|
||||
}
|
||||
if (totalSize > 0)
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (viewBounds.min.x < contentBounds.min.x + m_ContentLeftPadding)
|
||||
{
|
||||
float size = await NewItemAtStart(), totalSize = size;
|
||||
while (size > 0 && viewBounds.min.x < contentBounds.min.x + m_ContentLeftPadding - totalSize)
|
||||
{
|
||||
size = await NewItemAtStart();
|
||||
totalSize += size;
|
||||
}
|
||||
if (totalSize > 0)
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (viewBounds.max.x < contentBounds.max.x - threshold - m_ContentRightPadding)
|
||||
{
|
||||
float size = DeleteItemAtEnd(), totalSize = size;
|
||||
while (size > 0 && viewBounds.max.x < contentBounds.max.x - threshold - m_ContentRightPadding - totalSize)
|
||||
{
|
||||
size = DeleteItemAtEnd();
|
||||
totalSize += size;
|
||||
}
|
||||
if (totalSize > 0)
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (viewBounds.min.x > contentBounds.min.x + threshold + m_ContentLeftPadding)
|
||||
{
|
||||
float size = DeleteItemAtStart(), totalSize = size;
|
||||
while (size > 0 && viewBounds.min.x > contentBounds.min.x + threshold + m_ContentLeftPadding + totalSize)
|
||||
{
|
||||
size = DeleteItemAtStart();
|
||||
totalSize += size;
|
||||
}
|
||||
if (totalSize > 0)
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
{
|
||||
ClearTempPool();
|
||||
}
|
||||
|
||||
return (changed,viewBounds,contentBounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab7b38d60c9f6a944831d24146f39793
|
||||
timeCreated: 1439395663
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,179 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace UnityEngine.UI
|
||||
{
|
||||
[AddComponentMenu("UI/Loop Horizontal Scroll Rect(MultiPrefab)", 52)]
|
||||
[DisallowMultipleComponent]
|
||||
public class LoopHorizontalScrollRectMulti : LoopScrollRectMulti
|
||||
{
|
||||
LoopHorizontalScrollRectMulti()
|
||||
{
|
||||
direction = LoopScrollRectDirection.Horizontal;
|
||||
}
|
||||
|
||||
protected override float GetSize(RectTransform item, bool includeSpacing)
|
||||
{
|
||||
float size = includeSpacing ? contentSpacing : 0;
|
||||
if (m_GridLayout != null)
|
||||
{
|
||||
size += m_GridLayout.cellSize.x;
|
||||
}
|
||||
else
|
||||
{
|
||||
size += LayoutUtility.GetPreferredWidth(item);
|
||||
}
|
||||
size *= m_Content.localScale.x;
|
||||
return size;
|
||||
}
|
||||
|
||||
protected override float GetDimension(Vector2 vector)
|
||||
{
|
||||
return -vector.x;
|
||||
}
|
||||
|
||||
protected override float GetAbsDimension(Vector2 vector)
|
||||
{
|
||||
return vector.x;
|
||||
}
|
||||
|
||||
protected override Vector2 GetVector(float value)
|
||||
{
|
||||
return new Vector2(-value, 0);
|
||||
}
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
if (m_Content)
|
||||
{
|
||||
GridLayoutGroup layout = m_Content.GetComponent<GridLayoutGroup>();
|
||||
if (layout != null && layout.constraint != GridLayoutGroup.Constraint.FixedRowCount)
|
||||
{
|
||||
Debug.LogError($"[LoopScrollRect] {this.gameObject.name} 不支持的GridLayoutGroup约束 必须使用 FixedRowCount",this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override async UniTask<(bool,Bounds,Bounds)> UpdateItems(Bounds viewBounds, Bounds contentBounds)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
// special case: handling move several page in one frame
|
||||
if ((viewBounds.size.x < contentBounds.min.x - viewBounds.max.x) && itemTypeEnd > itemTypeStart)
|
||||
{
|
||||
float currentSize = contentBounds.size.x;
|
||||
float elementSize = (currentSize - contentSpacing * (CurrentLines - 1)) / CurrentLines;
|
||||
ReturnToTempPool(false, itemTypeEnd - itemTypeStart);
|
||||
itemTypeEnd = itemTypeStart;
|
||||
|
||||
int offsetCount = Mathf.FloorToInt((contentBounds.min.x - viewBounds.max.x) / (elementSize + contentSpacing));
|
||||
if (totalCount >= 0 && itemTypeStart - offsetCount * contentConstraintCount < 0)
|
||||
{
|
||||
offsetCount = Mathf.FloorToInt((float)(itemTypeStart) / contentConstraintCount);
|
||||
}
|
||||
itemTypeStart -= offsetCount * contentConstraintCount;
|
||||
if (totalCount >= 0)
|
||||
{
|
||||
itemTypeStart = Mathf.Max(itemTypeStart, 0);
|
||||
}
|
||||
itemTypeEnd = itemTypeStart;
|
||||
|
||||
float offset = offsetCount * (elementSize + contentSpacing);
|
||||
m_Content.anchoredPosition -= new Vector2(offset + (reverseDirection ? currentSize : 0), 0);
|
||||
contentBounds.center -= new Vector3(offset + currentSize / 2, 0, 0);
|
||||
contentBounds.size = Vector3.zero;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if ((viewBounds.min.x - contentBounds.max.x > viewBounds.size.x) && itemTypeEnd > itemTypeStart)
|
||||
{
|
||||
int maxItemTypeStart = -1;
|
||||
if (totalCount >= 0)
|
||||
{
|
||||
maxItemTypeStart = Mathf.Max(0, totalCount - (itemTypeEnd - itemTypeStart));
|
||||
maxItemTypeStart = (maxItemTypeStart / contentConstraintCount) * contentConstraintCount;
|
||||
}
|
||||
float currentSize = contentBounds.size.x;
|
||||
float elementSize = (currentSize - contentSpacing * (CurrentLines - 1)) / CurrentLines;
|
||||
ReturnToTempPool(true, itemTypeEnd - itemTypeStart);
|
||||
// TODO: fix with contentConstraint?
|
||||
itemTypeStart = itemTypeEnd;
|
||||
|
||||
int offsetCount = Mathf.FloorToInt((viewBounds.min.x - contentBounds.max.x) / (elementSize + contentSpacing));
|
||||
if (maxItemTypeStart >= 0 && itemTypeStart + offsetCount * contentConstraintCount > maxItemTypeStart)
|
||||
{
|
||||
offsetCount = Mathf.FloorToInt((float)(maxItemTypeStart - itemTypeStart) / contentConstraintCount);
|
||||
}
|
||||
itemTypeStart += offsetCount * contentConstraintCount;
|
||||
if (totalCount >= 0)
|
||||
{
|
||||
itemTypeStart = Mathf.Max(itemTypeStart, 0);
|
||||
}
|
||||
itemTypeEnd = itemTypeStart;
|
||||
|
||||
float offset = offsetCount * (elementSize + contentSpacing);
|
||||
m_Content.anchoredPosition += new Vector2(offset + (reverseDirection ? 0 : currentSize), 0);
|
||||
contentBounds.center += new Vector3(offset + currentSize / 2, 0, 0);
|
||||
contentBounds.size = Vector3.zero;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (viewBounds.max.x > contentBounds.max.x - m_ContentRightPadding)
|
||||
{
|
||||
float size = await NewItemAtEnd(), totalSize = size;
|
||||
while (size > 0 && viewBounds.max.x > contentBounds.max.x - m_ContentRightPadding + totalSize)
|
||||
{
|
||||
size = await NewItemAtEnd();
|
||||
totalSize += size;
|
||||
}
|
||||
if (totalSize > 0)
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (viewBounds.min.x < contentBounds.min.x + m_ContentLeftPadding)
|
||||
{
|
||||
float size = await NewItemAtStart(), totalSize = size;
|
||||
while (size > 0 && viewBounds.min.x < contentBounds.min.x + m_ContentLeftPadding - totalSize)
|
||||
{
|
||||
size = await NewItemAtStart();
|
||||
totalSize += size;
|
||||
}
|
||||
if (totalSize > 0)
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (viewBounds.max.x < contentBounds.max.x - threshold - m_ContentRightPadding)
|
||||
{
|
||||
float size = DeleteItemAtEnd(), totalSize = size;
|
||||
while (size > 0 && viewBounds.max.x < contentBounds.max.x - threshold - m_ContentRightPadding - totalSize)
|
||||
{
|
||||
size = DeleteItemAtEnd();
|
||||
totalSize += size;
|
||||
}
|
||||
if (totalSize > 0)
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (viewBounds.min.x > contentBounds.min.x + threshold + m_ContentLeftPadding)
|
||||
{
|
||||
float size = DeleteItemAtStart(), totalSize = size;
|
||||
while (size > 0 && viewBounds.min.x > contentBounds.min.x + threshold + m_ContentLeftPadding + totalSize)
|
||||
{
|
||||
size = DeleteItemAtStart();
|
||||
totalSize += size;
|
||||
}
|
||||
if (totalSize > 0)
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
{
|
||||
ClearTempPool();
|
||||
}
|
||||
|
||||
return (changed,viewBounds,contentBounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0aa64ab4e86f574469b5d4fda2e9c85f
|
||||
timeCreated: 1439395663
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,10 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace UnityEngine.UI
|
||||
{
|
||||
public interface LoopScrollDataSource
|
||||
{
|
||||
void ProvideData(Transform transform, int idx);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be1ddd0ddf17846f0b38566071ee623e
|
||||
timeCreated: 1500356133
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,10 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace UnityEngine.UI
|
||||
{
|
||||
public interface LoopScrollMultiDataSource
|
||||
{
|
||||
void ProvideData(Transform transform, int index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8730c6d35f93cb946b80539f595b48c1
|
||||
timeCreated: 1500356133
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,11 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace UnityEngine.UI
|
||||
{
|
||||
public interface LoopScrollPrefabAsyncSource
|
||||
{
|
||||
UniTask<GameObject> GetObject(int index);
|
||||
|
||||
void ReturnObject(Transform trans);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4cea3807a046c4500be20219e5c46432
|
||||
timeCreated: 1500356133
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace UnityEngine.UI
|
||||
{
|
||||
public abstract partial class LoopScrollRect : LoopScrollRectBase
|
||||
{
|
||||
[HideInInspector]
|
||||
[NonSerialized]
|
||||
public LoopScrollDataSource dataSource = null;
|
||||
|
||||
protected override void ProvideData(Transform transform, int index)
|
||||
{
|
||||
dataSource.ProvideData(transform, index);
|
||||
}
|
||||
|
||||
protected override async UniTask<RectTransform> GetFromTempPool(int itemIdx)
|
||||
{
|
||||
RectTransform nextItem = null;
|
||||
if (deletedItemTypeStart > 0)
|
||||
{
|
||||
deletedItemTypeStart--;
|
||||
nextItem = m_Content.GetChild(0) as RectTransform;
|
||||
nextItem.SetSiblingIndex(itemIdx - itemTypeStart + deletedItemTypeStart);
|
||||
}
|
||||
else if (deletedItemTypeEnd > 0)
|
||||
{
|
||||
deletedItemTypeEnd--;
|
||||
nextItem = m_Content.GetChild(m_Content.childCount - 1) as RectTransform;
|
||||
nextItem.SetSiblingIndex(itemIdx - itemTypeStart + deletedItemTypeStart);
|
||||
}
|
||||
else
|
||||
{
|
||||
nextItem = (await prefabSource.GetObject(itemIdx)).transform as RectTransform;
|
||||
nextItem.transform.SetParent(m_Content, false);
|
||||
nextItem.gameObject.SetActive(true);
|
||||
}
|
||||
ProvideData(nextItem, itemIdx);
|
||||
return nextItem;
|
||||
}
|
||||
|
||||
protected override void ReturnToTempPool(bool fromStart, int count)
|
||||
{
|
||||
if (fromStart)
|
||||
deletedItemTypeStart += count;
|
||||
else
|
||||
deletedItemTypeEnd += count;
|
||||
}
|
||||
|
||||
protected override void ClearTempPool()
|
||||
{
|
||||
Debug.Assert(m_Content.childCount >= deletedItemTypeStart + deletedItemTypeEnd);
|
||||
if (deletedItemTypeStart > 0)
|
||||
{
|
||||
for (int i = deletedItemTypeStart - 1; i >= 0; i--)
|
||||
{
|
||||
prefabSource.ReturnObject(m_Content.GetChild(i));
|
||||
}
|
||||
deletedItemTypeStart = 0;
|
||||
}
|
||||
if (deletedItemTypeEnd > 0)
|
||||
{
|
||||
int t = m_Content.childCount - deletedItemTypeEnd;
|
||||
for (int i = m_Content.childCount - 1; i >= t; i--)
|
||||
{
|
||||
prefabSource.ReturnObject(m_Content.GetChild(i));
|
||||
}
|
||||
deletedItemTypeEnd = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ec983a492fb0204bacc07738659994f
|
||||
timeCreated: 1439395663
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
2343
UnityGame/Assets/Scripts/ThirdParty/YIUIFramework/Plugins/.LoopScrollRect/Runtime/LoopScrollRectBase.cs
vendored
Normal file
2343
UnityGame/Assets/Scripts/ThirdParty/YIUIFramework/Plugins/.LoopScrollRect/Runtime/LoopScrollRectBase.cs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 33aaabb8aa0854047a50d2d2b0c6f1a5
|
||||
timeCreated: 1439395663
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace UnityEngine.UI
|
||||
{
|
||||
public abstract class LoopScrollRectMulti : LoopScrollRectBase
|
||||
{
|
||||
[HideInInspector]
|
||||
[NonSerialized]
|
||||
public LoopScrollMultiDataSource dataSource = null;
|
||||
|
||||
protected override void ProvideData(Transform transform, int index)
|
||||
{
|
||||
dataSource.ProvideData(transform, index);
|
||||
}
|
||||
|
||||
// Multi Data Source cannot support TempPool
|
||||
protected override async UniTask<RectTransform> GetFromTempPool(int itemIdx)
|
||||
{
|
||||
RectTransform nextItem = (await prefabSource.GetObject(itemIdx)).transform as RectTransform;
|
||||
nextItem.transform.SetParent(m_Content, false);
|
||||
nextItem.gameObject.SetActive(true);
|
||||
|
||||
ProvideData(nextItem, itemIdx);
|
||||
return nextItem;
|
||||
}
|
||||
|
||||
protected override void ReturnToTempPool(bool fromStart, int count)
|
||||
{
|
||||
Debug.Assert(m_Content.childCount >= count);
|
||||
if (fromStart)
|
||||
{
|
||||
for (int i = count - 1; i >= 0; i--)
|
||||
{
|
||||
prefabSource.ReturnObject(m_Content.GetChild(i));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int t = m_Content.childCount - count;
|
||||
for (int i = m_Content.childCount - 1; i >= t; i--)
|
||||
{
|
||||
prefabSource.ReturnObject(m_Content.GetChild(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ClearTempPool()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1bb4b17b11dd527499b49566928fed17
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,11 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace UnityEngine.UI
|
||||
{
|
||||
// optional class for better scroll support
|
||||
public interface LoopScrollSizeHelper
|
||||
{
|
||||
Vector2 GetItemsSize(int itemsCount);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 34053817472810d49a0a82b79338dde5
|
||||
timeCreated: 1500356133
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,177 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace UnityEngine.UI
|
||||
{
|
||||
[AddComponentMenu("UI/Loop Vertical Scroll Rect", 51)]
|
||||
[DisallowMultipleComponent]
|
||||
public class LoopVerticalScrollRect : LoopScrollRect
|
||||
{
|
||||
LoopVerticalScrollRect()
|
||||
{
|
||||
direction = LoopScrollRectDirection.Vertical;
|
||||
}
|
||||
|
||||
protected override float GetSize(RectTransform item, bool includeSpacing)
|
||||
{
|
||||
float size = includeSpacing ? contentSpacing : 0;
|
||||
if (m_GridLayout != null)
|
||||
{
|
||||
size += m_GridLayout.cellSize.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
size += LayoutUtility.GetPreferredHeight(item);
|
||||
}
|
||||
size *= m_Content.localScale.y;
|
||||
return size;
|
||||
}
|
||||
|
||||
protected override float GetDimension(Vector2 vector)
|
||||
{
|
||||
return vector.y;
|
||||
}
|
||||
|
||||
protected override float GetAbsDimension(Vector2 vector)
|
||||
{
|
||||
return vector.y;
|
||||
}
|
||||
|
||||
protected override Vector2 GetVector(float value)
|
||||
{
|
||||
return new Vector2(0, value);
|
||||
}
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
if (m_Content)
|
||||
{
|
||||
GridLayoutGroup layout = m_Content.GetComponent<GridLayoutGroup>();
|
||||
if (layout != null && layout.constraint != GridLayoutGroup.Constraint.FixedColumnCount)
|
||||
{
|
||||
Debug.LogError($"[LoopScrollRect] {this.gameObject.name} 不支持的GridLayoutGroup约束 必须使用 FixedColumnCount",this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override async UniTask<(bool,Bounds,Bounds)> UpdateItems(Bounds viewBounds, Bounds contentBounds)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
// special case: handling move several page in one frame
|
||||
if ((viewBounds.size.y < contentBounds.min.y - viewBounds.max.y) && itemTypeEnd > itemTypeStart)
|
||||
{
|
||||
int maxItemTypeStart = -1;
|
||||
if (totalCount >= 0)
|
||||
{
|
||||
maxItemTypeStart = Mathf.Max(0, totalCount - (itemTypeEnd - itemTypeStart));
|
||||
}
|
||||
float currentSize = contentBounds.size.y;
|
||||
float elementSize = (currentSize - contentSpacing * (CurrentLines - 1)) / CurrentLines;
|
||||
ReturnToTempPool(true, itemTypeEnd - itemTypeStart);
|
||||
itemTypeStart = itemTypeEnd;
|
||||
|
||||
int offsetCount = Mathf.FloorToInt((contentBounds.min.y - viewBounds.max.y) / (elementSize + contentSpacing));
|
||||
if (maxItemTypeStart >= 0 && itemTypeStart + offsetCount * contentConstraintCount > maxItemTypeStart)
|
||||
{
|
||||
offsetCount = Mathf.FloorToInt((float)(maxItemTypeStart - itemTypeStart) / contentConstraintCount);
|
||||
}
|
||||
itemTypeStart += offsetCount * contentConstraintCount;
|
||||
if (totalCount >= 0)
|
||||
{
|
||||
itemTypeStart = Mathf.Max(itemTypeStart, 0);
|
||||
}
|
||||
itemTypeEnd = itemTypeStart;
|
||||
|
||||
float offset = offsetCount * (elementSize + contentSpacing);
|
||||
m_Content.anchoredPosition -= new Vector2(0, offset + (reverseDirection ? 0 : currentSize));
|
||||
contentBounds.center -= new Vector3(0, offset + currentSize / 2, 0);
|
||||
contentBounds.size = Vector3.zero;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if ((viewBounds.min.y - contentBounds.max.y > viewBounds.size.y) && itemTypeEnd > itemTypeStart)
|
||||
{
|
||||
float currentSize = contentBounds.size.y;
|
||||
float elementSize = (currentSize - contentSpacing * (CurrentLines - 1)) / CurrentLines;
|
||||
ReturnToTempPool(false, itemTypeEnd - itemTypeStart);
|
||||
itemTypeEnd = itemTypeStart;
|
||||
|
||||
int offsetCount = Mathf.FloorToInt((viewBounds.min.y - contentBounds.max.y) / (elementSize + contentSpacing));
|
||||
if (totalCount >= 0 && itemTypeStart - offsetCount * contentConstraintCount < 0)
|
||||
{
|
||||
offsetCount = Mathf.FloorToInt((float)(itemTypeStart) / contentConstraintCount);
|
||||
}
|
||||
itemTypeStart -= offsetCount * contentConstraintCount;
|
||||
if (totalCount >= 0)
|
||||
{
|
||||
itemTypeStart = Mathf.Max(itemTypeStart, 0);
|
||||
}
|
||||
itemTypeEnd = itemTypeStart;
|
||||
|
||||
float offset = offsetCount * (elementSize + contentSpacing);
|
||||
m_Content.anchoredPosition += new Vector2(0, offset + (reverseDirection ? currentSize : 0));
|
||||
contentBounds.center += new Vector3(0, offset + currentSize / 2, 0);
|
||||
contentBounds.size = Vector3.zero;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
// issue #149: new item before delete
|
||||
if (viewBounds.min.y < contentBounds.min.y + m_ContentBottomPadding)
|
||||
{
|
||||
float size = await NewItemAtEnd(), totalSize = size;
|
||||
while (size > 0 && viewBounds.min.y < contentBounds.min.y + m_ContentBottomPadding - totalSize)
|
||||
{
|
||||
size = await NewItemAtEnd();
|
||||
totalSize += size;
|
||||
}
|
||||
if (totalSize > 0)
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (viewBounds.max.y > contentBounds.max.y - m_ContentTopPadding)
|
||||
{
|
||||
float size = await NewItemAtStart(), totalSize = size;
|
||||
while (size > 0 && viewBounds.max.y > contentBounds.max.y - m_ContentTopPadding + totalSize)
|
||||
{
|
||||
size = await NewItemAtStart();
|
||||
totalSize += size;
|
||||
}
|
||||
if (totalSize > 0)
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (viewBounds.min.y > contentBounds.min.y + threshold + m_ContentBottomPadding)
|
||||
{
|
||||
float size = DeleteItemAtEnd(), totalSize = size;
|
||||
while (size > 0 && viewBounds.min.y > contentBounds.min.y + threshold + m_ContentBottomPadding + totalSize)
|
||||
{
|
||||
size = DeleteItemAtEnd();
|
||||
totalSize += size;
|
||||
}
|
||||
if (totalSize > 0)
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (viewBounds.max.y < contentBounds.max.y - threshold - m_ContentTopPadding)
|
||||
{
|
||||
float size = DeleteItemAtStart(), totalSize = size;
|
||||
while (size > 0 && viewBounds.max.y < contentBounds.max.y - threshold - m_ContentTopPadding - totalSize)
|
||||
{
|
||||
size = DeleteItemAtStart();
|
||||
totalSize += size;
|
||||
}
|
||||
if (totalSize > 0)
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
{
|
||||
ClearTempPool();
|
||||
}
|
||||
|
||||
return (changed,viewBounds,contentBounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce71017a2903f7c4c9a699e438d0b897
|
||||
timeCreated: 1439395663
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,176 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace UnityEngine.UI
|
||||
{
|
||||
[AddComponentMenu("UI/Loop Vertical Scroll Rect(MultiPrefab)", 53)]
|
||||
[DisallowMultipleComponent]
|
||||
public class LoopVerticalScrollRectMulti : LoopScrollRectMulti
|
||||
{
|
||||
LoopVerticalScrollRectMulti()
|
||||
{
|
||||
direction = LoopScrollRectDirection.Vertical;
|
||||
}
|
||||
protected override float GetSize(RectTransform item, bool includeSpacing)
|
||||
{
|
||||
float size = includeSpacing ? contentSpacing : 0;
|
||||
if (m_GridLayout != null)
|
||||
{
|
||||
size += m_GridLayout.cellSize.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
size += LayoutUtility.GetPreferredHeight(item);
|
||||
}
|
||||
size *= m_Content.localScale.y;
|
||||
return size;
|
||||
}
|
||||
|
||||
protected override float GetDimension(Vector2 vector)
|
||||
{
|
||||
return vector.y;
|
||||
}
|
||||
|
||||
protected override float GetAbsDimension(Vector2 vector)
|
||||
{
|
||||
return vector.y;
|
||||
}
|
||||
|
||||
protected override Vector2 GetVector(float value)
|
||||
{
|
||||
return new Vector2(0, value);
|
||||
}
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
if (m_Content)
|
||||
{
|
||||
GridLayoutGroup layout = m_Content.GetComponent<GridLayoutGroup>();
|
||||
if (layout != null && layout.constraint != GridLayoutGroup.Constraint.FixedColumnCount)
|
||||
{
|
||||
Debug.LogError($"[LoopScrollRect] {this.gameObject.name} 不支持的GridLayoutGroup约束 必须使用 FixedColumnCount",this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override async UniTask<(bool,Bounds,Bounds)> UpdateItems(Bounds viewBounds, Bounds contentBounds)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
// special case: handling move several page in one frame
|
||||
if ((viewBounds.size.y < contentBounds.min.y - viewBounds.max.y) && itemTypeEnd > itemTypeStart)
|
||||
{
|
||||
int maxItemTypeStart = -1;
|
||||
if (totalCount >= 0)
|
||||
{
|
||||
maxItemTypeStart = Mathf.Max(0, totalCount - (itemTypeEnd - itemTypeStart));
|
||||
}
|
||||
float currentSize = contentBounds.size.y;
|
||||
float elementSize = (currentSize - contentSpacing * (CurrentLines - 1)) / CurrentLines;
|
||||
ReturnToTempPool(true, itemTypeEnd - itemTypeStart);
|
||||
itemTypeStart = itemTypeEnd;
|
||||
|
||||
int offsetCount = Mathf.FloorToInt((contentBounds.min.y - viewBounds.max.y) / (elementSize + contentSpacing));
|
||||
if (maxItemTypeStart >= 0 && itemTypeStart + offsetCount * contentConstraintCount > maxItemTypeStart)
|
||||
{
|
||||
offsetCount = Mathf.FloorToInt((float)(maxItemTypeStart - itemTypeStart) / contentConstraintCount);
|
||||
}
|
||||
itemTypeStart += offsetCount * contentConstraintCount;
|
||||
if (totalCount >= 0)
|
||||
{
|
||||
itemTypeStart = Mathf.Max(itemTypeStart, 0);
|
||||
}
|
||||
itemTypeEnd = itemTypeStart;
|
||||
|
||||
float offset = offsetCount * (elementSize + contentSpacing);
|
||||
m_Content.anchoredPosition -= new Vector2(0, offset + (reverseDirection ? 0 : currentSize));
|
||||
contentBounds.center -= new Vector3(0, offset + currentSize / 2, 0);
|
||||
contentBounds.size = Vector3.zero;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if ((viewBounds.min.y - contentBounds.max.y > viewBounds.size.y) && itemTypeEnd > itemTypeStart)
|
||||
{
|
||||
float currentSize = contentBounds.size.y;
|
||||
float elementSize = (currentSize - contentSpacing * (CurrentLines - 1)) / CurrentLines;
|
||||
ReturnToTempPool(false, itemTypeEnd - itemTypeStart);
|
||||
itemTypeEnd = itemTypeStart;
|
||||
|
||||
int offsetCount = Mathf.FloorToInt((viewBounds.min.y - contentBounds.max.y) / (elementSize + contentSpacing));
|
||||
if (totalCount >= 0 && itemTypeStart - offsetCount * contentConstraintCount < 0)
|
||||
{
|
||||
offsetCount = Mathf.FloorToInt((float)(itemTypeStart) / contentConstraintCount);
|
||||
}
|
||||
itemTypeStart -= offsetCount * contentConstraintCount;
|
||||
if (totalCount >= 0)
|
||||
{
|
||||
itemTypeStart = Mathf.Max(itemTypeStart, 0);
|
||||
}
|
||||
itemTypeEnd = itemTypeStart;
|
||||
|
||||
float offset = offsetCount * (elementSize + contentSpacing);
|
||||
m_Content.anchoredPosition += new Vector2(0, offset + (reverseDirection ? currentSize : 0));
|
||||
contentBounds.center += new Vector3(0, offset + currentSize / 2, 0);
|
||||
contentBounds.size = Vector3.zero;
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (viewBounds.min.y < contentBounds.min.y + m_ContentBottomPadding)
|
||||
{
|
||||
float size = await NewItemAtEnd(), totalSize = size;
|
||||
while (size > 0 && viewBounds.min.y < contentBounds.min.y + m_ContentBottomPadding - totalSize)
|
||||
{
|
||||
size = await NewItemAtEnd();
|
||||
totalSize += size;
|
||||
}
|
||||
if (totalSize > 0)
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (viewBounds.max.y > contentBounds.max.y - m_ContentTopPadding)
|
||||
{
|
||||
float size = await NewItemAtStart(), totalSize = size;
|
||||
while (size > 0 && viewBounds.max.y > contentBounds.max.y - m_ContentTopPadding + totalSize)
|
||||
{
|
||||
size = await NewItemAtStart();
|
||||
totalSize += size;
|
||||
}
|
||||
if (totalSize > 0)
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (viewBounds.min.y > contentBounds.min.y + threshold + m_ContentBottomPadding)
|
||||
{
|
||||
float size = DeleteItemAtEnd(), totalSize = size;
|
||||
while (size > 0 && viewBounds.min.y > contentBounds.min.y + threshold + m_ContentBottomPadding + totalSize)
|
||||
{
|
||||
size = DeleteItemAtEnd();
|
||||
totalSize += size;
|
||||
}
|
||||
if (totalSize > 0)
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (viewBounds.max.y < contentBounds.max.y - threshold - m_ContentTopPadding)
|
||||
{
|
||||
float size = DeleteItemAtStart(), totalSize = size;
|
||||
while (size > 0 && viewBounds.max.y < contentBounds.max.y - threshold - m_ContentTopPadding - totalSize)
|
||||
{
|
||||
size = DeleteItemAtStart();
|
||||
totalSize += size;
|
||||
}
|
||||
if (totalSize > 0)
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
{
|
||||
ClearTempPool();
|
||||
}
|
||||
|
||||
return (changed,viewBounds,contentBounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a4ae502f584e1924d83adb15f18817dc
|
||||
timeCreated: 1439395663
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
UnityGame/Assets/Scripts/ThirdParty/YIUIFramework/Plugins/.LoopScrollRect/YIUIEditor.meta
vendored
Normal file
8
UnityGame/Assets/Scripts/ThirdParty/YIUIFramework/Plugins/.LoopScrollRect/YIUIEditor.meta
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b10ceda9bec25b14ea5e190eb9bb0341
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,72 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEditor;
|
||||
|
||||
[CustomEditor(typeof(LoopScrollRect), true)]
|
||||
public class LoopScrollRectInspector : Editor
|
||||
{
|
||||
int index = 0;
|
||||
float speed = 1000, time = 1;
|
||||
public override void OnInspectorGUI ()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
EditorGUILayout.Space();
|
||||
|
||||
LoopScrollRect scroll = (LoopScrollRect)target;
|
||||
GUI.enabled = Application.isPlaying;
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
if (GUILayout.Button("刷新"))
|
||||
{
|
||||
scroll.RefreshCells();
|
||||
}
|
||||
|
||||
/*if(GUILayout.Button("Clear"))
|
||||
{
|
||||
scroll.ClearCells();
|
||||
}
|
||||
if(GUILayout.Button("Refill"))
|
||||
{
|
||||
scroll.RefillCells();
|
||||
}
|
||||
if(GUILayout.Button("RefillFromEnd"))
|
||||
{
|
||||
scroll.RefillCellsFromEnd();
|
||||
}*/
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUIUtility.labelWidth = 45;
|
||||
float w = (EditorGUIUtility.currentViewWidth - 100) / 2;
|
||||
index = EditorGUILayout.IntField(" 索引", index, GUILayout.Width(w));
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUIUtility.labelWidth = 60;
|
||||
speed = EditorGUILayout.FloatField(" 滚动速度", speed, GUILayout.Width(w));
|
||||
if(GUILayout.Button("滚动跳转", GUILayout.Width(130)))
|
||||
{
|
||||
if (scroll.totalCount <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
index = Mathf.Clamp(index, 0, scroll.totalCount - 1);
|
||||
scroll.ScrollToCell(index, speed);
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUIUtility.labelWidth = 60;
|
||||
time = EditorGUILayout.FloatField(" 滚动时间", time, GUILayout.Width(w));
|
||||
if(GUILayout.Button("时间跳转", GUILayout.Width(130)))
|
||||
{
|
||||
if (scroll.totalCount <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
index = Mathf.Clamp(index, 0, scroll.totalCount - 1);
|
||||
scroll.ScrollToCellWithinTime(index, time);
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 216d44a40b90b944db6c5f4624768e58
|
||||
timeCreated: 1439395663
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aab5397936f14293852acded0b6b4d92
|
||||
timeCreated: 1684375102
|
||||
@@ -0,0 +1,60 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace YIUIFramework.Editor
|
||||
{
|
||||
internal static class YIUILoopScrollMenuItem
|
||||
{
|
||||
[MenuItem("GameObject/YIUI/LoopScroll/Horizontal", false, 10001)]
|
||||
private static void CreateLoopScrollHorizontal()
|
||||
{
|
||||
CreateLoopScroll("LoopScrollHorizontal");
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/YIUI/LoopScroll/Horizontal Reverse", false, 10002)]
|
||||
private static void CreateLoopScrollHorizontalReverse()
|
||||
{
|
||||
CreateLoopScroll("LoopScrollHorizontalReverse");
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/YIUI/LoopScroll/Horizontal Group", false, 10003)]
|
||||
private static void CreateLoopScrollHorizontalGroup()
|
||||
{
|
||||
CreateLoopScroll("LoopScrollHorizontalGroup");
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/YIUI/LoopScroll/Vertical", false, 10011)]
|
||||
private static void CreateLoopScrollVertical()
|
||||
{
|
||||
CreateLoopScroll("LoopScrollVertical");
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/YIUI/LoopScroll/Vertical Reverse", false, 10012)]
|
||||
private static void CreateLoopScrollVerticalReverse()
|
||||
{
|
||||
CreateLoopScroll("LoopScrollVerticalReverse");
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/YIUI/LoopScroll/Vertical Group", false, 10013)]
|
||||
private static void CreateLoopScrollVerticalGroup()
|
||||
{
|
||||
CreateLoopScroll("LoopScrollVerticalGroup");
|
||||
}
|
||||
|
||||
private static void CreateLoopScroll(string name)
|
||||
{
|
||||
var activeObject = Selection.activeObject as GameObject;
|
||||
if (activeObject == null)
|
||||
{
|
||||
UnityTipsHelper.ShowError($"请选择一个对象 右键创建");
|
||||
return;
|
||||
}
|
||||
|
||||
var path = $"{UIStaticHelper.UIFrameworkPath}/Plugins/LoopScrollRect/YIUIEditor/TemplatePrefabs/{name}.prefab";
|
||||
|
||||
Selection.activeObject = UIMenuItemHelper.CloneGameObjectByPath(path, activeObject.transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: efebe07a330249839602e80042884d80
|
||||
timeCreated: 1684390506
|
||||
@@ -0,0 +1,167 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace UnityEngine.UI
|
||||
{
|
||||
public static class SGDefaultControls
|
||||
{
|
||||
#region code from DefaultControls.cs
|
||||
public struct Resources
|
||||
{
|
||||
public Sprite standard;
|
||||
public Sprite background;
|
||||
public Sprite inputField;
|
||||
public Sprite knob;
|
||||
public Sprite checkmark;
|
||||
public Sprite dropdown;
|
||||
public Sprite mask;
|
||||
}
|
||||
|
||||
private const float kWidth = 160f;
|
||||
private const float kThickHeight = 30f;
|
||||
private const float kThinHeight = 20f;
|
||||
//private static Vector2 s_ThickElementSize = new Vector2(kWidth, kThickHeight);
|
||||
//private static Vector2 s_ThinElementSize = new Vector2(kWidth, kThinHeight);
|
||||
//private static Vector2 s_ImageElementSize = new Vector2(100f, 100f);
|
||||
//private static Color s_DefaultSelectableColor = new Color(1f, 1f, 1f, 1f);
|
||||
//private static Color s_PanelColor = new Color(1f, 1f, 1f, 0.392f);
|
||||
private static Color s_TextColor = new Color(50f / 255f, 50f / 255f, 50f / 255f, 1f);
|
||||
|
||||
// Helper methods at top
|
||||
|
||||
private static GameObject CreateUIElementRoot(string name, Vector2 size)
|
||||
{
|
||||
GameObject child = new GameObject(name);
|
||||
RectTransform rectTransform = child.AddComponent<RectTransform>();
|
||||
rectTransform.sizeDelta = size;
|
||||
return child;
|
||||
}
|
||||
|
||||
static GameObject CreateUIObject(string name, GameObject parent)
|
||||
{
|
||||
GameObject go = new GameObject(name);
|
||||
go.AddComponent<RectTransform>();
|
||||
SetParentAndAlign(go, parent);
|
||||
return go;
|
||||
}
|
||||
|
||||
private static void SetDefaultTextValues(Text lbl)
|
||||
{
|
||||
// Set text values we want across UI elements in default controls.
|
||||
// Don't set values which are the same as the default values for the Text component,
|
||||
// since there's no point in that, and it's good to keep them as consistent as possible.
|
||||
lbl.color = s_TextColor;
|
||||
}
|
||||
|
||||
private static void SetDefaultColorTransitionValues(Selectable slider)
|
||||
{
|
||||
ColorBlock colors = slider.colors;
|
||||
colors.highlightedColor = new Color(0.882f, 0.882f, 0.882f);
|
||||
colors.pressedColor = new Color(0.698f, 0.698f, 0.698f);
|
||||
colors.disabledColor = new Color(0.521f, 0.521f, 0.521f);
|
||||
}
|
||||
|
||||
private static void SetParentAndAlign(GameObject child, GameObject parent)
|
||||
{
|
||||
if (parent == null)
|
||||
return;
|
||||
|
||||
child.transform.SetParent(parent.transform, false);
|
||||
SetLayerRecursively(child, parent.layer);
|
||||
}
|
||||
|
||||
private static void SetLayerRecursively(GameObject go, int layer)
|
||||
{
|
||||
go.layer = layer;
|
||||
Transform t = go.transform;
|
||||
for (int i = 0; i < t.childCount; i++)
|
||||
SetLayerRecursively(t.GetChild(i).gameObject, layer);
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static GameObject CreateLoopHorizontalScrollRect(DefaultControls.Resources resources)
|
||||
{
|
||||
GameObject root = CreateUIElementRoot("Loop Horizontal Scroll Rect", new Vector2(400, 200));
|
||||
GameObject cache = CreateUIObject("Cache", root);
|
||||
cache.SetActive(false);
|
||||
GameObject content = CreateUIObject("Content", root);
|
||||
|
||||
RectTransform contentRT = content.GetComponent<RectTransform>();
|
||||
contentRT.anchorMin = new Vector2(0, 0.5f);
|
||||
contentRT.anchorMax = new Vector2(0, 0.5f);
|
||||
contentRT.sizeDelta = new Vector2(0, 200);
|
||||
contentRT.pivot = new Vector2(0, 0.5f);
|
||||
|
||||
// Setup UI components.
|
||||
|
||||
LoopHorizontalScrollRect scrollRect = root.AddComponent<LoopHorizontalScrollRect>();
|
||||
scrollRect.content = contentRT;
|
||||
scrollRect.viewport = null;
|
||||
scrollRect.horizontalScrollbar = null;
|
||||
scrollRect.verticalScrollbar = null;
|
||||
scrollRect.horizontal = true;
|
||||
scrollRect.vertical = false;
|
||||
scrollRect.horizontalScrollbarVisibility = LoopScrollRect.ScrollbarVisibility.Permanent;
|
||||
scrollRect.verticalScrollbarVisibility = LoopScrollRect.ScrollbarVisibility.Permanent;
|
||||
scrollRect.horizontalScrollbarSpacing = 0;
|
||||
scrollRect.verticalScrollbarSpacing = 0;
|
||||
scrollRect.u_CacheRect = cache.transform as RectTransform;
|
||||
root.AddComponent<RectMask2D>();
|
||||
|
||||
HorizontalLayoutGroup layoutGroup = content.AddComponent<HorizontalLayoutGroup>();
|
||||
layoutGroup.childAlignment = TextAnchor.MiddleLeft;
|
||||
layoutGroup.childForceExpandWidth = false;
|
||||
layoutGroup.childForceExpandHeight = true;
|
||||
|
||||
ContentSizeFitter sizeFitter = content.AddComponent<ContentSizeFitter>();
|
||||
sizeFitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||
sizeFitter.verticalFit = ContentSizeFitter.FitMode.Unconstrained;
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
public static GameObject CreateLoopVerticalScrollRect(DefaultControls.Resources resources)
|
||||
{
|
||||
GameObject root = CreateUIElementRoot("Loop Vertical Scroll Rect", new Vector2(200, 400));
|
||||
GameObject cache = CreateUIObject("Cache", root);
|
||||
cache.SetActive(false);
|
||||
GameObject content = CreateUIObject("Content", root);
|
||||
|
||||
RectTransform contentRT = content.GetComponent<RectTransform>();
|
||||
contentRT.anchorMin = new Vector2(0.5f, 1);
|
||||
contentRT.anchorMax = new Vector2(0.5f, 1);
|
||||
contentRT.sizeDelta = new Vector2(200, 0);
|
||||
contentRT.pivot = new Vector2(0.5f, 1);
|
||||
|
||||
// Setup UI components.
|
||||
|
||||
LoopVerticalScrollRect scrollRect = root.AddComponent<LoopVerticalScrollRect>();
|
||||
scrollRect.content = contentRT;
|
||||
scrollRect.viewport = null;
|
||||
scrollRect.horizontalScrollbar = null;
|
||||
scrollRect.verticalScrollbar = null;
|
||||
scrollRect.horizontal = false;
|
||||
scrollRect.vertical = true;
|
||||
scrollRect.horizontalScrollbarVisibility = LoopScrollRect.ScrollbarVisibility.Permanent;
|
||||
scrollRect.verticalScrollbarVisibility = LoopScrollRect.ScrollbarVisibility.Permanent;
|
||||
scrollRect.horizontalScrollbarSpacing = 0;
|
||||
scrollRect.verticalScrollbarSpacing = 0;
|
||||
scrollRect.u_CacheRect = cache.transform as RectTransform;
|
||||
|
||||
root.AddComponent<RectMask2D>();
|
||||
|
||||
VerticalLayoutGroup layoutGroup = content.AddComponent<VerticalLayoutGroup>();
|
||||
layoutGroup.childAlignment = TextAnchor.UpperCenter;
|
||||
layoutGroup.childForceExpandWidth = true;
|
||||
layoutGroup.childForceExpandHeight = false;
|
||||
|
||||
ContentSizeFitter sizeFitter = content.AddComponent<ContentSizeFitter>();
|
||||
sizeFitter.horizontalFit = ContentSizeFitter.FitMode.Unconstrained;
|
||||
sizeFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||
|
||||
return root;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e2cfa47387224a4eb069fc6dc8ac8b3
|
||||
timeCreated: 1476279563
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,153 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UnityEditor.UI
|
||||
{
|
||||
internal static class SGMenuOptions
|
||||
{
|
||||
#region code from MenuOptions.cs
|
||||
private const string kUILayerName = "UI";
|
||||
|
||||
private const string kStandardSpritePath = "UI/Skin/UISprite.psd";
|
||||
private const string kBackgroundSpritePath = "UI/Skin/Background.psd";
|
||||
private const string kInputFieldBackgroundPath = "UI/Skin/InputFieldBackground.psd";
|
||||
private const string kKnobPath = "UI/Skin/Knob.psd";
|
||||
private const string kCheckmarkPath = "UI/Skin/Checkmark.psd";
|
||||
private const string kDropdownArrowPath = "UI/Skin/DropdownArrow.psd";
|
||||
private const string kMaskPath = "UI/Skin/UIMask.psd";
|
||||
|
||||
static private DefaultControls.Resources s_StandardResources;
|
||||
|
||||
static private DefaultControls.Resources GetStandardResources()
|
||||
{
|
||||
if (s_StandardResources.standard == null)
|
||||
{
|
||||
s_StandardResources.standard = AssetDatabase.GetBuiltinExtraResource<Sprite>(kStandardSpritePath);
|
||||
s_StandardResources.background = AssetDatabase.GetBuiltinExtraResource<Sprite>(kBackgroundSpritePath);
|
||||
s_StandardResources.inputField = AssetDatabase.GetBuiltinExtraResource<Sprite>(kInputFieldBackgroundPath);
|
||||
s_StandardResources.knob = AssetDatabase.GetBuiltinExtraResource<Sprite>(kKnobPath);
|
||||
s_StandardResources.checkmark = AssetDatabase.GetBuiltinExtraResource<Sprite>(kCheckmarkPath);
|
||||
s_StandardResources.dropdown = AssetDatabase.GetBuiltinExtraResource<Sprite>(kDropdownArrowPath);
|
||||
s_StandardResources.mask = AssetDatabase.GetBuiltinExtraResource<Sprite>(kMaskPath);
|
||||
}
|
||||
return s_StandardResources;
|
||||
}
|
||||
|
||||
private static void SetPositionVisibleinSceneView(RectTransform canvasRTransform, RectTransform itemTransform)
|
||||
{
|
||||
// Find the best scene view
|
||||
SceneView sceneView = SceneView.lastActiveSceneView;
|
||||
if (sceneView == null && SceneView.sceneViews.Count > 0)
|
||||
sceneView = SceneView.sceneViews[0] as SceneView;
|
||||
|
||||
// Couldn't find a SceneView. Don't set position.
|
||||
if (sceneView == null || sceneView.camera == null)
|
||||
return;
|
||||
|
||||
// Create world space Plane from canvas position.
|
||||
Vector2 localPlanePosition;
|
||||
Camera camera = sceneView.camera;
|
||||
Vector3 position = Vector3.zero;
|
||||
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRTransform, new Vector2(camera.pixelWidth / 2, camera.pixelHeight / 2), camera, out localPlanePosition))
|
||||
{
|
||||
// Adjust for canvas pivot
|
||||
localPlanePosition.x = localPlanePosition.x + canvasRTransform.sizeDelta.x * canvasRTransform.pivot.x;
|
||||
localPlanePosition.y = localPlanePosition.y + canvasRTransform.sizeDelta.y * canvasRTransform.pivot.y;
|
||||
|
||||
localPlanePosition.x = Mathf.Clamp(localPlanePosition.x, 0, canvasRTransform.sizeDelta.x);
|
||||
localPlanePosition.y = Mathf.Clamp(localPlanePosition.y, 0, canvasRTransform.sizeDelta.y);
|
||||
|
||||
// Adjust for anchoring
|
||||
position.x = localPlanePosition.x - canvasRTransform.sizeDelta.x * itemTransform.anchorMin.x;
|
||||
position.y = localPlanePosition.y - canvasRTransform.sizeDelta.y * itemTransform.anchorMin.y;
|
||||
|
||||
Vector3 minLocalPosition;
|
||||
minLocalPosition.x = canvasRTransform.sizeDelta.x * (0 - canvasRTransform.pivot.x) + itemTransform.sizeDelta.x * itemTransform.pivot.x;
|
||||
minLocalPosition.y = canvasRTransform.sizeDelta.y * (0 - canvasRTransform.pivot.y) + itemTransform.sizeDelta.y * itemTransform.pivot.y;
|
||||
|
||||
Vector3 maxLocalPosition;
|
||||
maxLocalPosition.x = canvasRTransform.sizeDelta.x * (1 - canvasRTransform.pivot.x) - itemTransform.sizeDelta.x * itemTransform.pivot.x;
|
||||
maxLocalPosition.y = canvasRTransform.sizeDelta.y * (1 - canvasRTransform.pivot.y) - itemTransform.sizeDelta.y * itemTransform.pivot.y;
|
||||
|
||||
position.x = Mathf.Clamp(position.x, minLocalPosition.x, maxLocalPosition.x);
|
||||
position.y = Mathf.Clamp(position.y, minLocalPosition.y, maxLocalPosition.y);
|
||||
}
|
||||
|
||||
itemTransform.anchoredPosition = position;
|
||||
itemTransform.localRotation = Quaternion.identity;
|
||||
itemTransform.localScale = Vector3.one;
|
||||
}
|
||||
|
||||
private static void PlaceUIElementRoot(GameObject element, MenuCommand menuCommand)
|
||||
{
|
||||
GameObject parent = menuCommand.context as GameObject;
|
||||
if (parent == null || parent.GetComponentInParent<Canvas>() == null)
|
||||
{
|
||||
parent = GetOrCreateCanvasGameObject();
|
||||
}
|
||||
|
||||
string uniqueName = GameObjectUtility.GetUniqueNameForSibling(parent.transform, element.name);
|
||||
element.name = uniqueName;
|
||||
Undo.RegisterCreatedObjectUndo(element, "Create " + element.name);
|
||||
Undo.SetTransformParent(element.transform, parent.transform, "Parent " + element.name);
|
||||
GameObjectUtility.SetParentAndAlign(element, parent);
|
||||
if (parent != menuCommand.context) // not a context click, so center in sceneview
|
||||
SetPositionVisibleinSceneView(parent.GetComponent<RectTransform>(), element.GetComponent<RectTransform>());
|
||||
|
||||
Selection.activeGameObject = element;
|
||||
}
|
||||
|
||||
static public GameObject CreateNewUI()
|
||||
{
|
||||
// Root for the UI
|
||||
var root = new GameObject("Canvas");
|
||||
root.layer = LayerMask.NameToLayer(kUILayerName);
|
||||
Canvas canvas = root.AddComponent<Canvas>();
|
||||
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
|
||||
root.AddComponent<CanvasScaler>();
|
||||
root.AddComponent<GraphicRaycaster>();
|
||||
Undo.RegisterCreatedObjectUndo(root, "Create " + root.name);
|
||||
|
||||
// if there is no event system add one...
|
||||
// CreateEventSystem(false);
|
||||
return root;
|
||||
}
|
||||
|
||||
// Helper function that returns a Canvas GameObject; preferably a parent of the selection, or other existing Canvas.
|
||||
static public GameObject GetOrCreateCanvasGameObject()
|
||||
{
|
||||
GameObject selectedGo = Selection.activeGameObject;
|
||||
|
||||
// Try to find a gameobject that is the selected GO or one if its parents.
|
||||
Canvas canvas = (selectedGo != null) ? selectedGo.GetComponentInParent<Canvas>() : null;
|
||||
if (canvas != null && canvas.gameObject.activeInHierarchy)
|
||||
return canvas.gameObject;
|
||||
|
||||
// No canvas in selection or its parents? Then use just any canvas..
|
||||
canvas = Object.FindObjectOfType(typeof(Canvas)) as Canvas;
|
||||
if (canvas != null && canvas.gameObject.activeInHierarchy)
|
||||
return canvas.gameObject;
|
||||
|
||||
// No canvas in the scene at all? Then create a new one.
|
||||
return SGMenuOptions.CreateNewUI();
|
||||
}
|
||||
#endregion
|
||||
|
||||
//[MenuItem("GameObject/UI/Loop Horizontal Scroll Rect", false, 2151)]
|
||||
static public void AddLoopHorizontalScrollRect(MenuCommand menuCommand)
|
||||
{
|
||||
GameObject go = SGDefaultControls.CreateLoopHorizontalScrollRect(GetStandardResources());
|
||||
PlaceUIElementRoot(go, menuCommand);
|
||||
}
|
||||
|
||||
//[MenuItem("GameObject/UI/Loop Vertical Scroll Rect", false, 2152)]
|
||||
static public void AddLoopVerticalScrollRect(MenuCommand menuCommand)
|
||||
{
|
||||
GameObject go = SGDefaultControls.CreateLoopVerticalScrollRect(GetStandardResources());
|
||||
PlaceUIElementRoot(go, menuCommand);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c4b63bf28f5af0e42a464ac316fef603
|
||||
timeCreated: 1476279563
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a5eb9d393989f74d85d096585aabd75
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,499 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &377482173851048015
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 377482173851048014}
|
||||
- component: {fileID: 377482173851048011}
|
||||
- component: {fileID: 377482173851048008}
|
||||
- component: {fileID: 377482173851048009}
|
||||
m_Layer: 5
|
||||
m_Name: Scrollbar
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &377482173851048014
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482173851048015}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 377482175135811975}
|
||||
m_Father: {fileID: 377482175139720711}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 20}
|
||||
m_SizeDelta: {x: 0, y: 20}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!222 &377482173851048011
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482173851048015}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &377482173851048008
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482173851048015}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &377482173851048009
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482173851048015}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2a4db7a114972834c8e4117be1d82ba3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Highlighted
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 377482174608031191}
|
||||
m_HandleRect: {fileID: 377482174608031188}
|
||||
m_Direction: 0
|
||||
m_Value: 0.5
|
||||
m_Size: 1
|
||||
m_NumberOfSteps: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!1 &377482174608031189
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 377482174608031188}
|
||||
- component: {fileID: 377482174608031190}
|
||||
- component: {fileID: 377482174608031191}
|
||||
m_Layer: 5
|
||||
m_Name: Handle
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &377482174608031188
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482174608031189}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 377482175135811975}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 20, y: 20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &377482174608031190
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482174608031189}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &377482174608031191
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482174608031189}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &377482175135811972
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 377482175135811975}
|
||||
m_Layer: 5
|
||||
m_Name: Sliding Area
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &377482175135811975
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482175135811972}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 377482174608031188}
|
||||
m_Father: {fileID: 377482173851048014}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: -20, y: -20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &377482175139720708
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 377482175139720711}
|
||||
- component: {fileID: 377482175139720707}
|
||||
- component: {fileID: 377482175139720710}
|
||||
- component: {fileID: 2194522068270585223}
|
||||
- component: {fileID: 1685925623842724004}
|
||||
m_Layer: 5
|
||||
m_Name: LoopScrollHorizontal
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &377482175139720711
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482175139720708}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 2944010825801937176}
|
||||
- {fileID: 2528263556036525198}
|
||||
- {fileID: 377482173851048014}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 800, y: 200}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &377482175139720707
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482175139720708}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &377482175139720710
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482175139720708}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ab7b38d60c9f6a944831d24146f39793, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
totalCount: 0
|
||||
reverseDirection: 0
|
||||
m_Content: {fileID: 2528263556036525198}
|
||||
m_Horizontal: 1
|
||||
m_Vertical: 0
|
||||
m_MovementType: 1
|
||||
m_Elasticity: 0.1
|
||||
m_Inertia: 1
|
||||
m_DecelerationRate: 0.135
|
||||
m_ScrollSensitivity: 1
|
||||
m_Viewport: {fileID: 0}
|
||||
m_HorizontalScrollbar: {fileID: 377482173851048009}
|
||||
m_VerticalScrollbar: {fileID: 0}
|
||||
m_HorizontalScrollbarVisibility: 0
|
||||
m_VerticalScrollbarVisibility: 0
|
||||
m_HorizontalScrollbarSpacing: 0
|
||||
m_VerticalScrollbarSpacing: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
u_CacheRect: {fileID: 2944010825801937176}
|
||||
u_MaxClickCount: 0
|
||||
u_AutoCancelLast: 1
|
||||
u_RepetitionCancel: 0
|
||||
--- !u!114 &2194522068270585223
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482175139720708}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10917, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &1685925623842724004
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482175139720708}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3312d7739989d2b4e91e6319e9a96d76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Softness: {x: 0, y: 0}
|
||||
--- !u!1 &687899640995594819
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2528263556036525198}
|
||||
- component: {fileID: 4758884583503891720}
|
||||
- component: {fileID: 3802119832537081549}
|
||||
- component: {fileID: 5686605502064695307}
|
||||
m_Layer: 5
|
||||
m_Name: Content
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2528263556036525198
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 687899640995594819}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 377482175139720711}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!222 &4758884583503891720
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 687899640995594819}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3802119832537081549
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 687899640995594819}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_HorizontalFit: 2
|
||||
m_VerticalFit: 0
|
||||
--- !u!114 &5686605502064695307
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 687899640995594819}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 0
|
||||
m_Spacing: 0
|
||||
m_ChildForceExpandWidth: 0
|
||||
m_ChildForceExpandHeight: 0
|
||||
m_ChildControlWidth: 1
|
||||
m_ChildControlHeight: 0
|
||||
m_ChildScaleWidth: 0
|
||||
m_ChildScaleHeight: 0
|
||||
m_ReverseArrangement: 0
|
||||
--- !u!1 &7603218058490998505
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2944010825801937176}
|
||||
- component: {fileID: 4030035667177924516}
|
||||
m_Layer: 5
|
||||
m_Name: Cache
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!224 &2944010825801937176
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7603218058490998505}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 377482175139720711}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4030035667177924516
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7603218058490998505}
|
||||
m_CullTransparentMesh: 1
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d61eabc3b257cbd46b7ae8dbeeed428f
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,497 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &3757451907269055877
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4883066074865906977}
|
||||
- component: {fileID: 165501369898959941}
|
||||
m_Layer: 5
|
||||
m_Name: Cache
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!224 &4883066074865906977
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3757451907269055877}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2498195783868019258}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &165501369898959941
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3757451907269055877}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &3816580505820914275
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6403036537983289743}
|
||||
- component: {fileID: 6913990258279739407}
|
||||
- component: {fileID: 2053195067611193042}
|
||||
- component: {fileID: 5707422383085050976}
|
||||
m_Layer: 5
|
||||
m_Name: Scrollbar
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6403036537983289743
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3816580505820914275}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 3521364413507528459}
|
||||
m_Father: {fileID: 2498195783868019258}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 20}
|
||||
m_SizeDelta: {x: 0, y: 20}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!222 &6913990258279739407
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3816580505820914275}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &2053195067611193042
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3816580505820914275}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &5707422383085050976
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3816580505820914275}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2a4db7a114972834c8e4117be1d82ba3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Highlighted
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 4648661493751553129}
|
||||
m_HandleRect: {fileID: 5647034306577193437}
|
||||
m_Direction: 0
|
||||
m_Value: 0.5
|
||||
m_Size: 1
|
||||
m_NumberOfSteps: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!1 &3889580765378403165
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5647034306577193437}
|
||||
- component: {fileID: 2056691569093567360}
|
||||
- component: {fileID: 4648661493751553129}
|
||||
m_Layer: 5
|
||||
m_Name: Handle
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &5647034306577193437
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3889580765378403165}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3521364413507528459}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 20, y: 20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2056691569093567360
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3889580765378403165}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &4648661493751553129
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3889580765378403165}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &4547120548636933368
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2498195783868019258}
|
||||
- component: {fileID: 1708626114036360317}
|
||||
- component: {fileID: 3844381672355545242}
|
||||
- component: {fileID: 7250878883315465444}
|
||||
- component: {fileID: 5816562826567455012}
|
||||
m_Layer: 5
|
||||
m_Name: LoopScrollHorizontalGroup
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2498195783868019258
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4547120548636933368}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 4883066074865906977}
|
||||
- {fileID: 7599690702158517826}
|
||||
- {fileID: 6403036537983289743}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 800, y: 200}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1708626114036360317
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4547120548636933368}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3844381672355545242
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4547120548636933368}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ab7b38d60c9f6a944831d24146f39793, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
totalCount: 0
|
||||
reverseDirection: 0
|
||||
m_Content: {fileID: 7599690702158517826}
|
||||
m_Horizontal: 1
|
||||
m_Vertical: 0
|
||||
m_MovementType: 1
|
||||
m_Elasticity: 0.1
|
||||
m_Inertia: 1
|
||||
m_DecelerationRate: 0.135
|
||||
m_ScrollSensitivity: 1
|
||||
m_Viewport: {fileID: 0}
|
||||
m_HorizontalScrollbar: {fileID: 5707422383085050976}
|
||||
m_VerticalScrollbar: {fileID: 0}
|
||||
m_HorizontalScrollbarVisibility: 0
|
||||
m_VerticalScrollbarVisibility: 0
|
||||
m_HorizontalScrollbarSpacing: 0
|
||||
m_VerticalScrollbarSpacing: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
u_CacheRect: {fileID: 4883066074865906977}
|
||||
u_MaxClickCount: 0
|
||||
u_AutoCancelLast: 1
|
||||
u_RepetitionCancel: 0
|
||||
--- !u!114 &7250878883315465444
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4547120548636933368}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10917, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &5816562826567455012
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4547120548636933368}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3312d7739989d2b4e91e6319e9a96d76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Softness: {x: 0, y: 0}
|
||||
--- !u!1 &5316358212215361454
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3521364413507528459}
|
||||
m_Layer: 5
|
||||
m_Name: Sliding Area
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3521364413507528459
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5316358212215361454}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 5647034306577193437}
|
||||
m_Father: {fileID: 6403036537983289743}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: -20, y: -20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &7536463013162236194
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7599690702158517826}
|
||||
- component: {fileID: 4034322366547625551}
|
||||
- component: {fileID: 3606832534099381179}
|
||||
- component: {fileID: 1029217604729860071}
|
||||
m_Layer: 5
|
||||
m_Name: Content
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &7599690702158517826
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7536463013162236194}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2498195783868019258}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!222 &4034322366547625551
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7536463013162236194}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3606832534099381179
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7536463013162236194}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_HorizontalFit: 2
|
||||
m_VerticalFit: 0
|
||||
--- !u!114 &1029217604729860071
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7536463013162236194}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8a8695521f0d02e499659fee002a26c2, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 0
|
||||
m_StartCorner: 0
|
||||
m_StartAxis: 0
|
||||
m_CellSize: {x: 100, y: 100}
|
||||
m_Spacing: {x: 0, y: 0}
|
||||
m_Constraint: 2
|
||||
m_ConstraintCount: 2
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e21ba6f5fefce474080315a6bfc9f38a
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,499 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &377482173851048015
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 377482173851048014}
|
||||
- component: {fileID: 377482173851048011}
|
||||
- component: {fileID: 377482173851048008}
|
||||
- component: {fileID: 377482173851048009}
|
||||
m_Layer: 5
|
||||
m_Name: Scrollbar
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &377482173851048014
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482173851048015}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 377482175135811975}
|
||||
m_Father: {fileID: 377482175139720711}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 20}
|
||||
m_SizeDelta: {x: 0, y: 20}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!222 &377482173851048011
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482173851048015}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &377482173851048008
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482173851048015}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &377482173851048009
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482173851048015}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2a4db7a114972834c8e4117be1d82ba3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Highlighted
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 377482174608031191}
|
||||
m_HandleRect: {fileID: 377482174608031188}
|
||||
m_Direction: 0
|
||||
m_Value: 0.5
|
||||
m_Size: 1
|
||||
m_NumberOfSteps: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!1 &377482174608031189
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 377482174608031188}
|
||||
- component: {fileID: 377482174608031190}
|
||||
- component: {fileID: 377482174608031191}
|
||||
m_Layer: 5
|
||||
m_Name: Handle
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &377482174608031188
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482174608031189}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 377482175135811975}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 20, y: 20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &377482174608031190
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482174608031189}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &377482174608031191
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482174608031189}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &377482175135811972
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 377482175135811975}
|
||||
m_Layer: 5
|
||||
m_Name: Sliding Area
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &377482175135811975
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482175135811972}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 377482174608031188}
|
||||
m_Father: {fileID: 377482173851048014}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: -20, y: -20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &377482175139720708
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 377482175139720711}
|
||||
- component: {fileID: 377482175139720707}
|
||||
- component: {fileID: 377482175139720710}
|
||||
- component: {fileID: 2194522068270585223}
|
||||
- component: {fileID: 1685925623842724004}
|
||||
m_Layer: 5
|
||||
m_Name: LoopScrollHorizontalReverse
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &377482175139720711
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482175139720708}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 2944010825801937176}
|
||||
- {fileID: 2528263556036525198}
|
||||
- {fileID: 377482173851048014}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 800, y: 200}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &377482175139720707
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482175139720708}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &377482175139720710
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482175139720708}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ab7b38d60c9f6a944831d24146f39793, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
totalCount: 0
|
||||
reverseDirection: 1
|
||||
m_Content: {fileID: 2528263556036525198}
|
||||
m_Horizontal: 1
|
||||
m_Vertical: 0
|
||||
m_MovementType: 1
|
||||
m_Elasticity: 0.1
|
||||
m_Inertia: 1
|
||||
m_DecelerationRate: 0.135
|
||||
m_ScrollSensitivity: 1
|
||||
m_Viewport: {fileID: 0}
|
||||
m_HorizontalScrollbar: {fileID: 377482173851048009}
|
||||
m_VerticalScrollbar: {fileID: 0}
|
||||
m_HorizontalScrollbarVisibility: 0
|
||||
m_VerticalScrollbarVisibility: 0
|
||||
m_HorizontalScrollbarSpacing: 0
|
||||
m_VerticalScrollbarSpacing: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
u_CacheRect: {fileID: 2944010825801937176}
|
||||
u_MaxClickCount: 0
|
||||
u_AutoCancelLast: 1
|
||||
u_RepetitionCancel: 0
|
||||
--- !u!114 &2194522068270585223
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482175139720708}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10917, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &1685925623842724004
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 377482175139720708}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3312d7739989d2b4e91e6319e9a96d76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Softness: {x: 0, y: 0}
|
||||
--- !u!1 &687899640995594819
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2528263556036525198}
|
||||
- component: {fileID: 4758884583503891720}
|
||||
- component: {fileID: 3802119832537081549}
|
||||
- component: {fileID: 5686605502064695307}
|
||||
m_Layer: 5
|
||||
m_Name: Content
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2528263556036525198
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 687899640995594819}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 377482175139720711}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 1, y: 1}
|
||||
--- !u!222 &4758884583503891720
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 687899640995594819}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3802119832537081549
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 687899640995594819}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_HorizontalFit: 2
|
||||
m_VerticalFit: 0
|
||||
--- !u!114 &5686605502064695307
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 687899640995594819}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 2
|
||||
m_Spacing: 0
|
||||
m_ChildForceExpandWidth: 0
|
||||
m_ChildForceExpandHeight: 0
|
||||
m_ChildControlWidth: 1
|
||||
m_ChildControlHeight: 0
|
||||
m_ChildScaleWidth: 0
|
||||
m_ChildScaleHeight: 0
|
||||
m_ReverseArrangement: 0
|
||||
--- !u!1 &7603218058490998505
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2944010825801937176}
|
||||
- component: {fileID: 4030035667177924516}
|
||||
m_Layer: 5
|
||||
m_Name: Cache
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!224 &2944010825801937176
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7603218058490998505}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 377482175139720711}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4030035667177924516
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7603218058490998505}
|
||||
m_CullTransparentMesh: 1
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b1465a5a15ae504c9971abebfef00ef
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,499 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &3069861309087383393
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3069861309087383398}
|
||||
- component: {fileID: 3069861309087383418}
|
||||
- component: {fileID: 3069861309087383399}
|
||||
- component: {fileID: 2595369304746376112}
|
||||
- component: {fileID: 2305587912261935690}
|
||||
m_Layer: 5
|
||||
m_Name: LoopScrollVertical
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3069861309087383398
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309087383393}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 6015035341057997378}
|
||||
- {fileID: 3069861309194926433}
|
||||
- {fileID: 3069861309685593319}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 200, y: 800}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3069861309087383418
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309087383393}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3069861309087383399
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309087383393}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ce71017a2903f7c4c9a699e438d0b897, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
totalCount: 0
|
||||
reverseDirection: 0
|
||||
m_Content: {fileID: 3069861309194926433}
|
||||
m_Horizontal: 0
|
||||
m_Vertical: 1
|
||||
m_MovementType: 1
|
||||
m_Elasticity: 0.1
|
||||
m_Inertia: 1
|
||||
m_DecelerationRate: 0.135
|
||||
m_ScrollSensitivity: 1
|
||||
m_Viewport: {fileID: 0}
|
||||
m_HorizontalScrollbar: {fileID: 0}
|
||||
m_VerticalScrollbar: {fileID: 3069861309685593316}
|
||||
m_HorizontalScrollbarVisibility: 0
|
||||
m_VerticalScrollbarVisibility: 0
|
||||
m_HorizontalScrollbarSpacing: 0
|
||||
m_VerticalScrollbarSpacing: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
u_CacheRect: {fileID: 6015035341057997378}
|
||||
u_MaxClickCount: 1
|
||||
u_AutoCancelLast: 1
|
||||
u_RepetitionCancel: 0
|
||||
--- !u!114 &2595369304746376112
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309087383393}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10917, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &2305587912261935690
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309087383393}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3312d7739989d2b4e91e6319e9a96d76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Softness: {x: 0, y: 0}
|
||||
--- !u!1 &3069861309194926432
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3069861309194926433}
|
||||
- component: {fileID: 3069861309194926458}
|
||||
- component: {fileID: 3069861309194926439}
|
||||
- component: {fileID: 3069861309194926438}
|
||||
m_Layer: 5
|
||||
m_Name: Content
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3069861309194926433
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309194926432}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3069861309087383398}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!222 &3069861309194926458
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309194926432}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3069861309194926439
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309194926432}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_HorizontalFit: 0
|
||||
m_VerticalFit: 2
|
||||
--- !u!114 &3069861309194926438
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309194926432}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 0
|
||||
m_Spacing: 0
|
||||
m_ChildForceExpandWidth: 0
|
||||
m_ChildForceExpandHeight: 0
|
||||
m_ChildControlWidth: 0
|
||||
m_ChildControlHeight: 1
|
||||
m_ChildScaleWidth: 0
|
||||
m_ChildScaleHeight: 0
|
||||
m_ReverseArrangement: 0
|
||||
--- !u!1 &3069861309685593318
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3069861309685593319}
|
||||
- component: {fileID: 3069861309685593338}
|
||||
- component: {fileID: 3069861309685593317}
|
||||
- component: {fileID: 3069861309685593316}
|
||||
m_Layer: 5
|
||||
m_Name: Scrollbar
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3069861309685593319
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309685593318}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 3069861310358867049}
|
||||
m_Father: {fileID: 3069861309087383398}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -20, y: 0}
|
||||
m_SizeDelta: {x: 20, y: 0}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!222 &3069861309685593338
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309685593318}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3069861309685593317
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309685593318}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &3069861309685593316
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309685593318}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2a4db7a114972834c8e4117be1d82ba3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Highlighted
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 3069861309914269586}
|
||||
m_HandleRect: {fileID: 3069861309914269597}
|
||||
m_Direction: 3
|
||||
m_Value: 0.5
|
||||
m_Size: 1
|
||||
m_NumberOfSteps: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!1 &3069861309914269596
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3069861309914269597}
|
||||
- component: {fileID: 3069861309914269587}
|
||||
- component: {fileID: 3069861309914269586}
|
||||
m_Layer: 5
|
||||
m_Name: Handle
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3069861309914269597
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309914269596}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3069861310358867049}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 20, y: 20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3069861309914269587
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309914269596}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3069861309914269586
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309914269596}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &3069861310358867048
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3069861310358867049}
|
||||
m_Layer: 5
|
||||
m_Name: Sliding Area
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3069861310358867049
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861310358867048}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 3069861309914269597}
|
||||
m_Father: {fileID: 3069861309685593319}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: -20, y: -20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &8709431348704126583
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6015035341057997378}
|
||||
- component: {fileID: 510531013751947595}
|
||||
m_Layer: 5
|
||||
m_Name: Cache
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!224 &6015035341057997378
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8709431348704126583}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3069861309087383398}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &510531013751947595
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8709431348704126583}
|
||||
m_CullTransparentMesh: 1
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fec9b76588a204245913b66995f570fe
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,497 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &203580730528226306
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4533297909197154109}
|
||||
m_Layer: 5
|
||||
m_Name: Sliding Area
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &4533297909197154109
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 203580730528226306}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 22514934473440333}
|
||||
m_Father: {fileID: 8717937108154569404}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: -20, y: -20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &783883006472874978
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 22514934473440333}
|
||||
- component: {fileID: 2470483579434241257}
|
||||
- component: {fileID: 1172337098852020336}
|
||||
m_Layer: 5
|
||||
m_Name: Handle
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &22514934473440333
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 783883006472874978}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4533297909197154109}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 20, y: 20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2470483579434241257
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 783883006472874978}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1172337098852020336
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 783883006472874978}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &2237254390670031969
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3856670404030934875}
|
||||
- component: {fileID: 8498117759163332923}
|
||||
- component: {fileID: 3344210218025749400}
|
||||
- component: {fileID: 2144002625728885285}
|
||||
m_Layer: 5
|
||||
m_Name: Content
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3856670404030934875
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2237254390670031969}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1967631541930331953}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!222 &8498117759163332923
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2237254390670031969}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3344210218025749400
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2237254390670031969}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_HorizontalFit: 0
|
||||
m_VerticalFit: 2
|
||||
--- !u!114 &2144002625728885285
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2237254390670031969}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8a8695521f0d02e499659fee002a26c2, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 0
|
||||
m_StartCorner: 0
|
||||
m_StartAxis: 0
|
||||
m_CellSize: {x: 100, y: 100}
|
||||
m_Spacing: {x: 0, y: 0}
|
||||
m_Constraint: 1
|
||||
m_ConstraintCount: 2
|
||||
--- !u!1 &3047327391613824014
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1967631541930331953}
|
||||
- component: {fileID: 1832456679767534427}
|
||||
- component: {fileID: 6845486866936952799}
|
||||
- component: {fileID: 289121536638722911}
|
||||
- component: {fileID: 921255620171908061}
|
||||
m_Layer: 5
|
||||
m_Name: LoopScrollVerticalGroup
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1967631541930331953
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3047327391613824014}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 8490295764488050793}
|
||||
- {fileID: 3856670404030934875}
|
||||
- {fileID: 8717937108154569404}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 200, y: 800}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1832456679767534427
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3047327391613824014}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &6845486866936952799
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3047327391613824014}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ce71017a2903f7c4c9a699e438d0b897, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
totalCount: 0
|
||||
reverseDirection: 0
|
||||
m_Content: {fileID: 3856670404030934875}
|
||||
m_Horizontal: 0
|
||||
m_Vertical: 1
|
||||
m_MovementType: 1
|
||||
m_Elasticity: 0.1
|
||||
m_Inertia: 1
|
||||
m_DecelerationRate: 0.135
|
||||
m_ScrollSensitivity: 1
|
||||
m_Viewport: {fileID: 0}
|
||||
m_HorizontalScrollbar: {fileID: 0}
|
||||
m_VerticalScrollbar: {fileID: 5705770504748576846}
|
||||
m_HorizontalScrollbarVisibility: 0
|
||||
m_VerticalScrollbarVisibility: 0
|
||||
m_HorizontalScrollbarSpacing: 0
|
||||
m_VerticalScrollbarSpacing: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
u_CacheRect: {fileID: 8490295764488050793}
|
||||
u_MaxClickCount: 1
|
||||
u_AutoCancelLast: 1
|
||||
u_RepetitionCancel: 0
|
||||
--- !u!114 &289121536638722911
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3047327391613824014}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10917, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &921255620171908061
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3047327391613824014}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3312d7739989d2b4e91e6319e9a96d76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Softness: {x: 0, y: 0}
|
||||
--- !u!1 &3633013081488794627
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8490295764488050793}
|
||||
- component: {fileID: 4800953182147805584}
|
||||
m_Layer: 5
|
||||
m_Name: Cache
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!224 &8490295764488050793
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3633013081488794627}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1967631541930331953}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4800953182147805584
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3633013081488794627}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &4483252700524350982
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8717937108154569404}
|
||||
- component: {fileID: 4233234351627088345}
|
||||
- component: {fileID: 5331222396568424247}
|
||||
- component: {fileID: 5705770504748576846}
|
||||
m_Layer: 5
|
||||
m_Name: Scrollbar
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &8717937108154569404
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4483252700524350982}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 4533297909197154109}
|
||||
m_Father: {fileID: 1967631541930331953}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -20, y: 0}
|
||||
m_SizeDelta: {x: 20, y: 0}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!222 &4233234351627088345
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4483252700524350982}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &5331222396568424247
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4483252700524350982}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &5705770504748576846
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4483252700524350982}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2a4db7a114972834c8e4117be1d82ba3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Highlighted
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 1172337098852020336}
|
||||
m_HandleRect: {fileID: 22514934473440333}
|
||||
m_Direction: 3
|
||||
m_Value: 0.5
|
||||
m_Size: 1
|
||||
m_NumberOfSteps: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 566b79d2ed28eae4b964e5bb967740a4
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,499 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &3069861309087383393
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3069861309087383398}
|
||||
- component: {fileID: 3069861309087383418}
|
||||
- component: {fileID: 3069861309087383399}
|
||||
- component: {fileID: 2595369304746376112}
|
||||
- component: {fileID: 2305587912261935690}
|
||||
m_Layer: 5
|
||||
m_Name: LoopScrollVerticalReverse
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3069861309087383398
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309087383393}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 6015035341057997378}
|
||||
- {fileID: 3069861309194926433}
|
||||
- {fileID: 3069861309685593319}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 200, y: 800}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3069861309087383418
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309087383393}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3069861309087383399
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309087383393}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ce71017a2903f7c4c9a699e438d0b897, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
totalCount: 0
|
||||
reverseDirection: 1
|
||||
m_Content: {fileID: 3069861309194926433}
|
||||
m_Horizontal: 0
|
||||
m_Vertical: 1
|
||||
m_MovementType: 1
|
||||
m_Elasticity: 0.1
|
||||
m_Inertia: 1
|
||||
m_DecelerationRate: 0.135
|
||||
m_ScrollSensitivity: 1
|
||||
m_Viewport: {fileID: 0}
|
||||
m_HorizontalScrollbar: {fileID: 0}
|
||||
m_VerticalScrollbar: {fileID: 3069861309685593316}
|
||||
m_HorizontalScrollbarVisibility: 0
|
||||
m_VerticalScrollbarVisibility: 0
|
||||
m_HorizontalScrollbarSpacing: 0
|
||||
m_VerticalScrollbarSpacing: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
u_CacheRect: {fileID: 6015035341057997378}
|
||||
u_MaxClickCount: 1
|
||||
u_AutoCancelLast: 1
|
||||
u_RepetitionCancel: 0
|
||||
--- !u!114 &2595369304746376112
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309087383393}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10917, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &2305587912261935690
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309087383393}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3312d7739989d2b4e91e6319e9a96d76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Softness: {x: 0, y: 0}
|
||||
--- !u!1 &3069861309194926432
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3069861309194926433}
|
||||
- component: {fileID: 3069861309194926458}
|
||||
- component: {fileID: 3069861309194926439}
|
||||
- component: {fileID: 3069861309194926438}
|
||||
m_Layer: 5
|
||||
m_Name: Content
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3069861309194926433
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309194926432}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3069861309087383398}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!222 &3069861309194926458
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309194926432}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3069861309194926439
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309194926432}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_HorizontalFit: 0
|
||||
m_VerticalFit: 2
|
||||
--- !u!114 &3069861309194926438
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309194926432}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 0
|
||||
m_Spacing: 0
|
||||
m_ChildForceExpandWidth: 0
|
||||
m_ChildForceExpandHeight: 0
|
||||
m_ChildControlWidth: 0
|
||||
m_ChildControlHeight: 1
|
||||
m_ChildScaleWidth: 0
|
||||
m_ChildScaleHeight: 0
|
||||
m_ReverseArrangement: 0
|
||||
--- !u!1 &3069861309685593318
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3069861309685593319}
|
||||
- component: {fileID: 3069861309685593338}
|
||||
- component: {fileID: 3069861309685593317}
|
||||
- component: {fileID: 3069861309685593316}
|
||||
m_Layer: 5
|
||||
m_Name: Scrollbar
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3069861309685593319
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309685593318}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 3069861310358867049}
|
||||
m_Father: {fileID: 3069861309087383398}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -20, y: 0}
|
||||
m_SizeDelta: {x: 20, y: 0}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!222 &3069861309685593338
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309685593318}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3069861309685593317
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309685593318}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &3069861309685593316
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309685593318}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2a4db7a114972834c8e4117be1d82ba3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Highlighted
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 3069861309914269586}
|
||||
m_HandleRect: {fileID: 3069861309914269597}
|
||||
m_Direction: 3
|
||||
m_Value: 0.5
|
||||
m_Size: 1
|
||||
m_NumberOfSteps: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!1 &3069861309914269596
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3069861309914269597}
|
||||
- component: {fileID: 3069861309914269587}
|
||||
- component: {fileID: 3069861309914269586}
|
||||
m_Layer: 5
|
||||
m_Name: Handle
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3069861309914269597
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309914269596}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3069861310358867049}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 20, y: 20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3069861309914269587
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309914269596}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &3069861309914269586
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861309914269596}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &3069861310358867048
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3069861310358867049}
|
||||
m_Layer: 5
|
||||
m_Name: Sliding Area
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &3069861310358867049
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3069861310358867048}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 3069861309914269597}
|
||||
m_Father: {fileID: 3069861309685593319}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: -20, y: -20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &8709431348704126583
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6015035341057997378}
|
||||
- component: {fileID: 510531013751947595}
|
||||
m_Layer: 5
|
||||
m_Name: Cache
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!224 &6015035341057997378
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8709431348704126583}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3069861309087383398}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &510531013751947595
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8709431348704126583}
|
||||
m_CullTransparentMesh: 1
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ab3e937348e9ad4aa44451fdfcc77ed
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
UnityGame/Assets/Scripts/ThirdParty/YIUIFramework/Plugins/I2Localization.meta
vendored
Normal file
8
UnityGame/Assets/Scripts/ThirdParty/YIUIFramework/Plugins/I2Localization.meta
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 982bd9f88338ee64b82354346c7c6d1c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
UnityGame/Assets/Scripts/ThirdParty/YIUIFramework/Plugins/I2Localization/Editor.meta
vendored
Normal file
8
UnityGame/Assets/Scripts/ThirdParty/YIUIFramework/Plugins/I2Localization/Editor.meta
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c123c665b73ed7c4999162c0d009550d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
753
UnityGame/Assets/Scripts/ThirdParty/YIUIFramework/Plugins/I2Localization/Editor/EditorTools.cs
vendored
Normal file
753
UnityGame/Assets/Scripts/ThirdParty/YIUIFramework/Plugins/I2Localization/Editor/EditorTools.cs
vendored
Normal file
@@ -0,0 +1,753 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace I2.Loc
|
||||
{
|
||||
public class GUITools
|
||||
{
|
||||
static public Color White = Color.white;
|
||||
static public Color LightGray = Color.Lerp(Color.gray, Color.white, 0.5f);
|
||||
static public Color DarkGray = Color.Lerp(Color.gray, Color.white, 0.2f);
|
||||
static public Color LightYellow = Color.Lerp(Color.yellow, Color.white, 0.5f);
|
||||
|
||||
static public GUILayoutOption DontExpandWidth = GUILayout.ExpandWidth(false);
|
||||
static public GUIContent EmptyContent = new GUIContent ();
|
||||
|
||||
static List<Action> mDelayedEditorCallbacks = new List<Action>();
|
||||
|
||||
#region Delayed Editor Callback
|
||||
|
||||
public static void DelayedCall( Action action )
|
||||
{
|
||||
if (mDelayedEditorCallbacks.Count == 0)
|
||||
EditorApplication.update += OnDelayedCall;
|
||||
|
||||
mDelayedEditorCallbacks.Add(action);
|
||||
}
|
||||
|
||||
static void OnDelayedCall()
|
||||
{
|
||||
EditorApplication.update -= OnDelayedCall;
|
||||
var calls = mDelayedEditorCallbacks.ToArray();
|
||||
mDelayedEditorCallbacks.Clear();
|
||||
|
||||
foreach (var call in calls)
|
||||
call();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Header
|
||||
public delegate void fnOnToggled(bool enabled);
|
||||
static public bool DrawHeader (string text, string key, bool ShowToggle=false, bool ToggleState=false, fnOnToggled OnToggle = null, string HelpURL=default(string), Color disabledColor = default(Color))
|
||||
{
|
||||
bool state = EditorPrefs.GetBool(key, false);
|
||||
|
||||
bool newState = DrawHeader (text, state, ShowToggle, ToggleState, OnToggle, HelpURL, disabledColor);
|
||||
|
||||
if (state!=newState) EditorPrefs.SetBool(key, newState);
|
||||
return newState;
|
||||
}
|
||||
|
||||
static public bool DrawHeader (string text, bool state, bool ShowToggle=false, bool ToggleState=false, fnOnToggled OnToggle = null, string HelpURL=default(string), Color disabledColor = default(Color), bool allowCollapsing = true)
|
||||
{
|
||||
GUIStyle Style = new GUIStyle(EditorStyles.foldout);
|
||||
Style.richText = true;
|
||||
EditorStyles.foldout.richText = true;
|
||||
if (state)
|
||||
{
|
||||
//GUI.backgroundColor=DarkGray;
|
||||
GUILayout.BeginVertical(LocalizeInspector.GUIStyle_OldTextArea/*, GUILayout.Height(1)*/);
|
||||
GUILayout.BeginHorizontal();
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
if (allowCollapsing)
|
||||
state = GUILayout.Toggle(state, text, Style, GUILayout.ExpandWidth(true));
|
||||
else
|
||||
GUILayout.Label(text, GUILayout.ExpandWidth(true));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(HelpURL))
|
||||
{
|
||||
if (GUILayout.Button (Icon_Help, EditorStyles.label, GUILayout.ExpandWidth(false)))
|
||||
Application.OpenURL(HelpURL);
|
||||
}
|
||||
if (ShowToggle)
|
||||
{
|
||||
GUI.changed = false;
|
||||
bool newBool = GUILayout.Toggle(ToggleState, "", "OL Toggle", GUILayout.ExpandWidth(false));
|
||||
if (GUI.changed && OnToggle!=null)
|
||||
OnToggle(newBool);
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space(2);
|
||||
|
||||
//GUI.backgroundColor = Color.white;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ShowToggle && !ToggleState)
|
||||
GUI.color = disabledColor;
|
||||
|
||||
GUILayout.BeginHorizontal("Box");
|
||||
//GUILayout.BeginHorizontal(EditorStyles.toolbar);
|
||||
state = GUILayout.Toggle(state, text, Style, GUILayout.ExpandWidth(true));
|
||||
if (ShowToggle)
|
||||
{
|
||||
GUI.changed = false;
|
||||
bool newBool = GUILayout.Toggle(ToggleState, "", "OL Toggle", GUILayout.ExpandWidth(false));
|
||||
if (GUI.changed && OnToggle!=null)
|
||||
OnToggle(newBool);
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
GUI.color = White;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
static public void CloseHeader()
|
||||
{
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
public static void OnGUI_Footer(string pluginName, string pluginVersion, string helpURL, string documentationURL, string assetStoreURL)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
string versionTip = "";
|
||||
/*if (I2Analytics.HasNewVersion(pluginName))
|
||||
{
|
||||
versionTip = "There is a new version of " + pluginName + ".\nClick here for more details";
|
||||
if (GUILayout.Button(new GUIContent("", versionTip), EditorStyles.label, GUILayout.Width(25)))
|
||||
I2AboutWindow.DoShowScreen();
|
||||
|
||||
var rect = GUILayoutUtility.GetLastRect();
|
||||
rect.yMin = rect.yMax - 25;
|
||||
rect.xMax = rect.xMin + 25;
|
||||
rect.y += 3;
|
||||
GUITools.DrawSkinIcon(rect, "CN EntryWarnIcon", "CN EntryWarn");
|
||||
}*/
|
||||
|
||||
if (GUILayout.Button(new GUIContent("v" + pluginVersion, versionTip), EditorStyles.miniLabel))
|
||||
{
|
||||
Application.OpenURL(assetStoreURL);
|
||||
//I2AboutWindow.DoShowScreen();
|
||||
}
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
if (GUILayout.Button("Ask a Question", EditorStyles.miniLabel))
|
||||
Application.OpenURL(helpURL);
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
if (GUILayout.Button("Documentation", EditorStyles.miniLabel))
|
||||
Application.OpenURL(documentationURL);
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Content
|
||||
|
||||
static public void BeginContents ()
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal(LocalizeInspector.GUIStyle_OldTextArea, GUILayout.MinHeight(10f));
|
||||
GUILayout.Space(2f);
|
||||
EditorGUILayout.BeginVertical();
|
||||
GUILayout.Space(2f);
|
||||
}
|
||||
|
||||
static public void EndContents () { EndContents(true); }
|
||||
static public void EndContents ( bool closeHeader )
|
||||
{
|
||||
GUILayout.Space(2f);
|
||||
EditorGUILayout.EndVertical();
|
||||
GUILayout.Space(3f);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
if (closeHeader) CloseHeader();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Tabs
|
||||
|
||||
static public void DrawTabs( SerializedProperty mProperty, GUIStyle Style=null, int height=25 )
|
||||
{
|
||||
int curIndex = mProperty.enumValueIndex;
|
||||
int newIndex = DrawTabs( curIndex, mProperty.enumNames, Style, height);
|
||||
|
||||
if (curIndex!=newIndex)
|
||||
mProperty.enumValueIndex = newIndex;
|
||||
}
|
||||
|
||||
static public int DrawTabs( int Index, string[] Tabs, GUIStyle Style=null, int height=25, bool expand = true)
|
||||
{
|
||||
GUIStyle MyStyle = new GUIStyle(Style!=null?Style:GUI.skin.FindStyle("dragtab"));
|
||||
MyStyle.fixedHeight=0;
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
for (int i=0; i<Tabs.Length; ++i)
|
||||
{
|
||||
int idx = Tabs[i].IndexOf('|');
|
||||
if (idx>0)
|
||||
{
|
||||
string text = Tabs[i].Substring(0, idx);
|
||||
string tooltip = Tabs[i].Substring(idx+1);
|
||||
if ( GUILayout.Toggle(Index==i, new GUIContent(text, tooltip), MyStyle, GUILayout.Height(height), GUILayout.ExpandWidth(expand)) && Index!=i)
|
||||
{
|
||||
Index=i;
|
||||
GUI.FocusControl(string.Empty);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( GUILayout.Toggle(Index==i, Tabs[i], MyStyle, GUILayout.Height(height), GUILayout.ExpandWidth(expand)) && Index!=i)
|
||||
{
|
||||
Index=i;
|
||||
GUI.FocusControl(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
return Index;
|
||||
}
|
||||
|
||||
static public void DrawShadowedTabs( SerializedProperty mProperty, GUIStyle Style=null, int height=25, bool expand=true )
|
||||
{
|
||||
int curIndex = mProperty.enumValueIndex;
|
||||
int newIndex = DrawShadowedTabs( curIndex, mProperty.enumNames, height, expand);
|
||||
|
||||
if (curIndex!=newIndex)
|
||||
mProperty.enumValueIndex = newIndex;
|
||||
}
|
||||
|
||||
static public int DrawShadowedTabs( int Index, string[] Tabs, int height = 25, bool expand=true )
|
||||
{
|
||||
GUI.backgroundColor=Color.Lerp (Color.gray, Color.white, 0.2f);
|
||||
GUILayout.BeginVertical(LocalizeInspector.GUIStyle_OldTextArea, GUILayout.Height(1));
|
||||
GUI.backgroundColor=Color.white;
|
||||
GUILayout.Space(2);
|
||||
Index = DrawTabs( Index, Tabs, height: height, expand:expand );
|
||||
GUILayout.EndVertical();
|
||||
return Index;
|
||||
}
|
||||
|
||||
static public int DrawTabs( int Index, Texture2D[] Tabs, GUIStyle Style, int height )
|
||||
{
|
||||
GUIStyle MyStyle = new GUIStyle(Style!=null?Style:GUI.skin.FindStyle("dragtab"));
|
||||
MyStyle.fixedHeight=0;
|
||||
|
||||
//width = Mathf.Max (width, height * Tabs[0].width/(float)Tabs[0].height);
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
float width = (EditorGUIUtility.currentViewWidth-(MyStyle.border.left+MyStyle.border.right)*(Tabs.Length-1)) / Tabs.Length;
|
||||
for (int i=0; i<Tabs.Length; ++i)
|
||||
{
|
||||
if ( GUILayout.Toggle(Index==i, Tabs[i], MyStyle, GUILayout.Height(height), GUILayout.Width(width)) && Index!=i)
|
||||
{
|
||||
Index=i;
|
||||
GUI.changed = true;
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
return Index;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Object Array
|
||||
|
||||
static public bool DrawObjectsArray( SerializedProperty PropArray, bool allowDuplicates=false, bool allowResources=false, bool allowSceneObj=false, Object testAdd=null, Object testReplace=null, int testReplaceIndex=-1, int testDeleteIndex=-1 )
|
||||
{
|
||||
bool hasChanged = false;
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
int DeleteElement = -1, MoveUpElement = -1;
|
||||
|
||||
for (int i=0, imax=PropArray.arraySize; i<imax; ++i)
|
||||
{
|
||||
SerializedProperty Prop = PropArray.GetArrayElementAtIndex(i);
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
//--[ Delete Button ]-------------------
|
||||
if (GUILayout.Button("X", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)) || i == testDeleteIndex)
|
||||
DeleteElement = i;
|
||||
|
||||
GUILayout.Space(2);
|
||||
//--[ Object ]--------------------------
|
||||
GUILayout.BeginHorizontal(EditorStyles.toolbar);
|
||||
GUI.changed = false;
|
||||
Object Obj = EditorGUILayout.ObjectField( Prop.objectReferenceValue, typeof(Object), allowSceneObj, GUILayout.ExpandWidth(true));
|
||||
if (testReplaceIndex == i)
|
||||
{
|
||||
Obj = testReplace;
|
||||
GUI.changed = true;
|
||||
}
|
||||
|
||||
if (!allowResources && Obj != null)
|
||||
{
|
||||
var path = AssetDatabase.GetAssetPath(Obj);
|
||||
if (path != null && path.Contains("/Resources/"))
|
||||
Obj = null;
|
||||
}
|
||||
|
||||
if (Obj==null)
|
||||
DeleteElement = i;
|
||||
else
|
||||
if (GUI.changed && (allowDuplicates || !ObjectsArrayHasReference(PropArray, Obj)))
|
||||
{
|
||||
Prop.objectReferenceValue = Obj;
|
||||
hasChanged = true;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
//--[ MoveUp Button ]-------------------
|
||||
if (i==0)
|
||||
{
|
||||
if (imax>1)
|
||||
GUILayout.Space (18);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GUILayout.Button( "\u25B2", EditorStyles.toolbarButton, GUILayout.Width(18)))
|
||||
MoveUpElement = i;
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
GUILayout.BeginHorizontal(EditorStyles.toolbar);
|
||||
Object NewObj = EditorGUILayout.ObjectField( null, typeof(Object), allowSceneObj, GUILayout.ExpandWidth(true));
|
||||
if (testAdd != null)
|
||||
{
|
||||
NewObj = testAdd;
|
||||
}
|
||||
|
||||
if (!allowResources && NewObj != null)
|
||||
{
|
||||
var path = AssetDatabase.GetAssetPath(NewObj);
|
||||
if (path != null && path.Contains("/Resources/"))
|
||||
NewObj = null;
|
||||
}
|
||||
if (NewObj && (allowDuplicates || !ObjectsArrayHasReference(PropArray, NewObj)))
|
||||
{
|
||||
int Index = PropArray.arraySize;
|
||||
PropArray.InsertArrayElementAtIndex( Index );
|
||||
PropArray.GetArrayElementAtIndex(Index).objectReferenceValue = NewObj;
|
||||
hasChanged = true;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
if (DeleteElement>=0)
|
||||
{
|
||||
PropArray.DeleteArrayElementAtIndex( DeleteElement );
|
||||
//PropArray.DeleteArrayElementAtIndex( DeleteElement );
|
||||
hasChanged = true;
|
||||
}
|
||||
|
||||
if (MoveUpElement>=0)
|
||||
{
|
||||
PropArray.MoveArrayElement(MoveUpElement, MoveUpElement-1);
|
||||
hasChanged = true;
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
return hasChanged;
|
||||
}
|
||||
|
||||
static public bool ObjectsArrayHasReference(SerializedProperty PropArray, Object obj)
|
||||
{
|
||||
for (int i = 0, imax = PropArray.arraySize; i < imax; ++i)
|
||||
{
|
||||
SerializedProperty Prop = PropArray.GetArrayElementAtIndex(i);
|
||||
if (Prop.objectReferenceValue == obj)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Toggle
|
||||
|
||||
static public int ToggleToolbar( int Index, string[] Options )
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
for (int i=0; i<Options.Length; ++i)
|
||||
{
|
||||
if ( GUILayout.Toggle(Index==i, Options[i], EditorStyles.toolbarButton))
|
||||
Index=i;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
return Index;
|
||||
}
|
||||
|
||||
static public void ToggleToolbar( SerializedProperty EnumVar )
|
||||
{
|
||||
int index = ToggleToolbar( EnumVar.enumValueIndex, EnumVar.enumNames);
|
||||
if (EnumVar.enumValueIndex != index)
|
||||
EnumVar.enumValueIndex = index;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Misc
|
||||
|
||||
public static bool ObjectExistInScene( GameObject Obj )
|
||||
{
|
||||
return Obj.scene.IsValid() && Obj.scene.isLoaded;
|
||||
/* //if (Obj.transform.root != Obj.transform)
|
||||
// continue;
|
||||
|
||||
// We are only interested in GameObjects that are visible in the Hierachy panel and are persitent
|
||||
if ((Obj.hideFlags & (HideFlags.DontSave|HideFlags.HideInHierarchy)) > 0)
|
||||
return false;
|
||||
|
||||
// We are not interested in Prefab, unless they are Prefab Instances
|
||||
PrefabType pfType = PrefabUtility.GetPrefabType(Obj);
|
||||
if(pfType == PrefabType.Prefab || pfType == PrefabType.ModelPrefab)
|
||||
return false;
|
||||
|
||||
// If the database contains the object then its not an scene object,
|
||||
// but the previous test should get rid of them, so I will just comment this
|
||||
// unless an false positive object is found in the future
|
||||
//if (AssetDatabase.Contains(Obj))
|
||||
// return false;
|
||||
|
||||
return true;*/
|
||||
}
|
||||
|
||||
public static IEnumerable<GameObject> SceneRoots()
|
||||
{
|
||||
var prop = new HierarchyProperty(HierarchyType.GameObjects);
|
||||
var expanded = new int[0];
|
||||
while (prop.Next(expanded)) {
|
||||
yield return prop.pptrValue as GameObject;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<GameObject> SceneRootsList()
|
||||
{
|
||||
return new List<GameObject>(SceneRoots());
|
||||
}
|
||||
|
||||
public static IEnumerable<Transform> AllSceneObjects()
|
||||
{
|
||||
var queue = new Queue<Transform>();
|
||||
|
||||
foreach (var root in SceneRoots()) {
|
||||
var tf = root.transform;
|
||||
yield return tf;
|
||||
queue.Enqueue(tf);
|
||||
}
|
||||
|
||||
while (queue.Count > 0) {
|
||||
foreach (Transform child in queue.Dequeue()) {
|
||||
yield return child;
|
||||
queue.Enqueue(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetScenePath(Transform tr)
|
||||
{
|
||||
if (tr==null)
|
||||
return string.Empty;
|
||||
|
||||
string path = tr.name;
|
||||
while (tr.parent != null)
|
||||
{
|
||||
tr = tr.parent;
|
||||
path = tr.name + "/" + path;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
public static Transform FindObjectInEditor( string scenePath )
|
||||
{
|
||||
if (string.IsNullOrEmpty(scenePath))
|
||||
return null;
|
||||
|
||||
int index = scenePath.IndexOfAny("/\\".ToCharArray());
|
||||
string first = index<0 ? scenePath : scenePath.Substring(0, index);
|
||||
|
||||
foreach (var root in AllSceneObjects())
|
||||
if (root.name==first)
|
||||
{
|
||||
if (index<0)
|
||||
return root;
|
||||
|
||||
return root.Find(scenePath.Substring(index+1));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static GUIContent Icon_Help {
|
||||
get{
|
||||
if (mIconHelp == null)
|
||||
mIconHelp = EditorGUIUtility.IconContent("_Help");
|
||||
return mIconHelp;
|
||||
}
|
||||
}
|
||||
static GUIContent mIconHelp;
|
||||
|
||||
public static GUIStyle FindSkinStyle(string name)
|
||||
{
|
||||
var allStyles = GUI.skin.customStyles;
|
||||
for (int i = 0, imax = allStyles.Length; i < imax; ++i)
|
||||
{
|
||||
if (allStyles[i].name == name)
|
||||
return allStyles[i];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static void DrawSkinIcon(Rect rect, params string[] iconNames)
|
||||
{
|
||||
foreach (var icon in iconNames)
|
||||
{
|
||||
var style = FindSkinStyle(icon);
|
||||
if (style == null || style.normal == null || style.normal.background == null)
|
||||
continue;
|
||||
|
||||
GUI.DrawTexture(rect, style.normal.background);
|
||||
return;
|
||||
}
|
||||
//Debug.Log("unable to find icon");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Angle Drawer
|
||||
private static Vector2 mAngle_lastMousePosition;
|
||||
static Texture mAngle_TextureCircle;
|
||||
static Texture pAngle_TextureCircle {
|
||||
get{
|
||||
if (mAngle_TextureCircle) return mAngle_TextureCircle;
|
||||
mAngle_TextureCircle = GUI.skin.GetStyle("CN CountBadge").normal.background;
|
||||
return mAngle_TextureCircle;
|
||||
}
|
||||
}
|
||||
|
||||
public static float FloatAngle(Rect rect, float value)
|
||||
{
|
||||
return FloatAngle(rect, value, -1, -1, -1);
|
||||
}
|
||||
|
||||
public static float FloatAngle(Rect rect, float value, float snap)
|
||||
{
|
||||
return FloatAngle(rect, value, snap, -1, -1);
|
||||
}
|
||||
|
||||
public static float FloatAngle(Rect rect, float value, float snap, float min, float max)
|
||||
{
|
||||
int id = GUIUtility.GetControlID(FocusType.Passive, rect);
|
||||
|
||||
Rect knobRect = new Rect(rect.x, rect.y, rect.height, rect.height);
|
||||
|
||||
float delta;
|
||||
if (min != max)
|
||||
delta = (max - min) / 360;
|
||||
else
|
||||
delta = 1;
|
||||
|
||||
if (Event.current != null)
|
||||
{
|
||||
if (Event.current.type == EventType.MouseDown && knobRect.Contains(Event.current.mousePosition))
|
||||
{
|
||||
GUIUtility.hotControl = id;
|
||||
mAngle_lastMousePosition = Event.current.mousePosition;
|
||||
}
|
||||
else if (Event.current.type == EventType.MouseUp && GUIUtility.hotControl == id)
|
||||
GUIUtility.hotControl = -1;
|
||||
else if (Event.current.type == EventType.MouseDrag && GUIUtility.hotControl == id)
|
||||
{
|
||||
Vector2 move = mAngle_lastMousePosition - Event.current.mousePosition;
|
||||
value += delta * (-move.x - move.y);
|
||||
|
||||
if (snap > 0)
|
||||
{
|
||||
float mod = value % snap;
|
||||
|
||||
if (mod < delta * 3 || Mathf.Abs(mod - snap) < delta * 3)
|
||||
value = Mathf.Round(value / snap) * snap;
|
||||
}
|
||||
|
||||
mAngle_lastMousePosition = Event.current.mousePosition;
|
||||
GUI.changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (pAngle_TextureCircle) GUI.DrawTexture(knobRect, pAngle_TextureCircle);
|
||||
Matrix4x4 matrix = GUI.matrix;
|
||||
|
||||
if (min != max)
|
||||
GUIUtility.RotateAroundPivot(value * (360 / (max - min)), knobRect.center);
|
||||
else
|
||||
GUIUtility.RotateAroundPivot(value, knobRect.center);
|
||||
|
||||
knobRect.height = 5;
|
||||
knobRect.width = 5;
|
||||
if (pAngle_TextureCircle) GUI.DrawTexture(knobRect, pAngle_TextureCircle);
|
||||
GUI.matrix = matrix;
|
||||
|
||||
Rect label = new Rect(rect.x + rect.height, rect.y + rect.height / 2 - 9, rect.height, 18);
|
||||
value = EditorGUI.FloatField(label, value);
|
||||
|
||||
if (min != max)
|
||||
value = Mathf.Clamp(value, min, max);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public static float AngleCircle(Rect rect, float angle, float snap, float min, float max, Texture background=null, Texture knobLine=null)
|
||||
{
|
||||
Rect knobRect = new Rect(rect.x, rect.y, rect.height, rect.height);
|
||||
|
||||
float delta;
|
||||
if (min != max)
|
||||
delta = (max - min) / 360;
|
||||
else
|
||||
delta = 1;
|
||||
|
||||
if (Event.current != null && GUIUtility.hotControl<=0 && (Event.current.type==EventType.MouseDown || Event.current.type==EventType.MouseDrag) && knobRect.Contains(Event.current.mousePosition))
|
||||
{
|
||||
angle = Vector2.Angle( Vector2.right, Event.current.mousePosition-knobRect.center);
|
||||
if (Event.current.mousePosition.y<knobRect.center.y) angle = 360-angle;
|
||||
if (Event.current.alt || Event.current.control)
|
||||
snap = 5;
|
||||
if (snap > 0)
|
||||
{
|
||||
float mod = Mathf.Repeat(angle, snap);
|
||||
|
||||
if (mod < delta * 3 || Mathf.Abs(mod - snap) < delta * 3)
|
||||
angle = Mathf.Round(angle / snap) * snap;
|
||||
}
|
||||
|
||||
GUI.changed = true;
|
||||
}
|
||||
|
||||
if (background==null) background = pAngle_TextureCircle;
|
||||
if (background) GUI.DrawTexture (knobRect, background);
|
||||
|
||||
Matrix4x4 matrix = GUI.matrix;
|
||||
|
||||
if (min != max)
|
||||
GUIUtility.RotateAroundPivot(angle * (360 / (max - min))+90, knobRect.center);
|
||||
else
|
||||
GUIUtility.RotateAroundPivot(angle+90, knobRect.center);
|
||||
|
||||
float Radius = Mathf.Min (knobRect.width, knobRect.height) * 0.5f;
|
||||
knobRect.x = knobRect.x + 0.5f * knobRect.width - 4;
|
||||
knobRect.y += 2;
|
||||
knobRect.width = 8;
|
||||
knobRect.height = Radius+2;
|
||||
if (knobLine == null)
|
||||
knobLine = GUI.skin.FindStyle ("MeBlendPosition").normal.background;
|
||||
if (knobLine) GUI.DrawTexture(knobRect, knobLine);
|
||||
GUI.matrix = matrix;
|
||||
|
||||
return Mathf.Repeat(angle, 360);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Unity Version branching
|
||||
|
||||
public static string Editor_GetCurrentScene()
|
||||
{
|
||||
#if UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2
|
||||
return EditorApplication.currentScene;
|
||||
#else
|
||||
return SceneManager.GetActiveScene().path;
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void Editor_MarkSceneDirty()
|
||||
{
|
||||
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
|
||||
EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
|
||||
#else
|
||||
EditorApplication.MarkSceneDirty();
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void Editor_SaveScene()
|
||||
{
|
||||
#if UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2
|
||||
EditorApplication.SaveScene ();
|
||||
#else
|
||||
EditorSceneManager.SaveOpenScenes();
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void Editor_OpenScene( string sceneName )
|
||||
{
|
||||
#if UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2
|
||||
EditorApplication.OpenScene( sceneName );
|
||||
#else
|
||||
EditorSceneManager.OpenScene(sceneName);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Reflection
|
||||
static public object Reflection_InvokeMethod ( object instanceObject, string methodName, params object[] p_args )
|
||||
{
|
||||
BindingFlags _flags = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static;
|
||||
MethodInfo mi = instanceObject.GetType().GetMethods( _flags ).Where( x => x.Name==methodName ).FirstOrDefault();
|
||||
if (mi == null) return null;
|
||||
return mi.Invoke( instanceObject, p_args );
|
||||
}
|
||||
static public object Reflection_InvokeMethod ( Type targetType, string methodName, params object[] p_args )
|
||||
{
|
||||
BindingFlags _flags = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static;
|
||||
MethodInfo mi = targetType.GetMethods( _flags ).Where( x => x.Name==methodName ).FirstOrDefault();
|
||||
if (mi == null) return null;
|
||||
return mi.Invoke( null, p_args );
|
||||
}
|
||||
|
||||
|
||||
public static object s_RecycledEditor;
|
||||
public static string TextField ( Rect position, string text, int maxLength, GUIStyle style, int controlID )
|
||||
{
|
||||
if (s_RecycledEditor==null)
|
||||
{
|
||||
FieldInfo info = typeof(EditorGUI).GetField("s_RecycledEditor", BindingFlags.NonPublic | BindingFlags.Static);
|
||||
s_RecycledEditor = info.GetValue(null);
|
||||
}
|
||||
|
||||
if (s_RecycledEditor == null)
|
||||
return "";
|
||||
|
||||
return Reflection_InvokeMethod( typeof( EditorGUI ), "DoTextField", s_RecycledEditor, controlID, position, text, style, null, false, false, false, false ) as string;
|
||||
}
|
||||
|
||||
static public void RepaintInspectors()
|
||||
{
|
||||
EditorApplication.update -= RepaintInspectors;
|
||||
var assemblyEditor = Assembly.GetAssembly(typeof(Editor));
|
||||
var typeInspectorWindow = assemblyEditor.GetType("UnityEditor.InspectorWindow");
|
||||
typeInspectorWindow.GetMethod("RepaintAllInspectors", BindingFlags.NonPublic | BindingFlags.Static).Invoke(null, null);
|
||||
}
|
||||
|
||||
public static void ScheduleRepaintInspectors()
|
||||
{
|
||||
EditorApplication.update += RepaintInspectors;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df33c1000ac895241a433812e40a2096
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "I2Localization.Editor",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f",
|
||||
"GUID:066973baa5a5b4943a2744b71a191628"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6fde2318276ffa54ea24278440b996f0
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a500716e59f61824ba1fa6b418ce31a7
|
||||
folderAsset: yes
|
||||
timeCreated: 1461137613
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
using UnityEditor;
|
||||
|
||||
namespace I2.Loc
|
||||
{
|
||||
[CustomEditor(typeof(LanguageSourceAsset))]
|
||||
public class LanguageSourceAssetInspector : LocalizationEditor
|
||||
{
|
||||
void OnEnable()
|
||||
{
|
||||
var newSource = target as LanguageSourceAsset;
|
||||
SerializedProperty propSource = serializedObject.FindProperty("mSource");
|
||||
|
||||
Custom_OnEnable(newSource.mSource, propSource);
|
||||
}
|
||||
public override LanguageSourceData GetSourceData()
|
||||
{
|
||||
return (target as LanguageSourceAsset).mSource;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f03a75bf70a306a4fb36646f24c1c1f1
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,22 @@
|
||||
using UnityEditor;
|
||||
|
||||
namespace I2.Loc
|
||||
{
|
||||
[CustomEditor(typeof(LanguageSource))]
|
||||
public class LanguageSourceInspector : LocalizationEditor
|
||||
{
|
||||
void OnEnable()
|
||||
{
|
||||
var newSource = target as LanguageSource;
|
||||
SerializedProperty propSource = serializedObject.FindProperty("mSource");
|
||||
|
||||
Custom_OnEnable(newSource.mSource, propSource);
|
||||
}
|
||||
|
||||
public override LanguageSourceData GetSourceData()
|
||||
{
|
||||
return (target as LanguageSource).mSource;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a441ed994a43a0a4a9d33be67a8d3f15
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,199 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace I2.Loc
|
||||
{
|
||||
public abstract partial class LocalizationEditor : Editor
|
||||
{
|
||||
#region Variables
|
||||
|
||||
SerializedProperty mProp_Assets, mProp_Languages,
|
||||
mProp_Google_WebServiceURL, mProp_GoogleUpdateFrequency, mProp_GoogleUpdateDelay, mProp_Google_SpreadsheetKey, mProp_Google_SpreadsheetName, mProp_Google_Password,
|
||||
mProp_Spreadsheet_LocalFileName, mProp_Spreadsheet_LocalCSVSeparator, mProp_CaseInsensitiveTerms, mProp_Spreadsheet_LocalCSVEncoding,
|
||||
mProp_OnMissingTranslation, mProp_AppNameTerm, mProp_IgnoreDeviceLanguage, mProp_Spreadsheet_SpecializationAsRows, mProp_GoogleInEditorCheckFrequency,
|
||||
mProp_HighlightLocalizedTargets, mProp_GoogleLiveSyncIsUptoDate, mProp_AllowUnloadingLanguages, mProp_GoogleUpdateSynchronization;
|
||||
|
||||
public static LanguageSourceData mLanguageSource;
|
||||
public static Object mLanguageSourceObject;
|
||||
public static LocalizationEditor mLanguageSourceEditor;
|
||||
public static Editor mCurrentInspector;
|
||||
|
||||
static bool mIsParsing; // This is true when the editor is opening several scenes to avoid reparsing objects
|
||||
|
||||
#endregion
|
||||
|
||||
#region Variables GUI
|
||||
|
||||
GUIStyle Style_ToolBar_Big, Style_ToolBarButton_Big;
|
||||
|
||||
|
||||
public GUISkin CustomSkin;
|
||||
|
||||
static Vector3 mScrollPos_Languages;
|
||||
public static string mLanguages_NewLanguage = "";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Styles
|
||||
|
||||
public static GUIStyle Style_WrapTextField {
|
||||
get{
|
||||
if (mStyle_WrapTextField==null)
|
||||
{
|
||||
mStyle_WrapTextField = new GUIStyle(EditorStyles.textArea);
|
||||
mStyle_WrapTextField.wordWrap = true;
|
||||
mStyle_WrapTextField.fixedHeight = 0;
|
||||
}
|
||||
return mStyle_WrapTextField;
|
||||
}
|
||||
}
|
||||
static GUIStyle mStyle_WrapTextField;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Inspector
|
||||
|
||||
public void Custom_OnEnable( LanguageSourceData sourceData, SerializedProperty propSource)
|
||||
{
|
||||
bool ForceParse = mLanguageSource != sourceData;
|
||||
|
||||
mLanguageSource = sourceData;
|
||||
mLanguageSourceEditor = this;
|
||||
mCurrentInspector = this;
|
||||
|
||||
if (!LocalizationManager.Sources.Contains(mLanguageSource))
|
||||
LocalizationManager.UpdateSources();
|
||||
|
||||
mProp_Assets = propSource.FindPropertyRelative("Assets");
|
||||
mProp_Languages = propSource.FindPropertyRelative("mLanguages");
|
||||
mProp_Google_WebServiceURL = propSource.FindPropertyRelative("Google_WebServiceURL");
|
||||
mProp_GoogleUpdateFrequency = propSource.FindPropertyRelative("GoogleUpdateFrequency");
|
||||
mProp_GoogleUpdateSynchronization = propSource.FindPropertyRelative("GoogleUpdateSynchronization");
|
||||
mProp_GoogleInEditorCheckFrequency = propSource.FindPropertyRelative("GoogleInEditorCheckFrequency");
|
||||
mProp_GoogleUpdateDelay = propSource.FindPropertyRelative("GoogleUpdateDelay");
|
||||
mProp_Google_SpreadsheetKey = propSource.FindPropertyRelative("Google_SpreadsheetKey");
|
||||
mProp_Google_SpreadsheetName = propSource.FindPropertyRelative("Google_SpreadsheetName");
|
||||
mProp_Google_Password = propSource.FindPropertyRelative("Google_Password");
|
||||
mProp_CaseInsensitiveTerms = propSource.FindPropertyRelative("CaseInsensitiveTerms");
|
||||
mProp_Spreadsheet_LocalFileName = propSource.FindPropertyRelative("Spreadsheet_LocalFileName");
|
||||
mProp_Spreadsheet_LocalCSVSeparator = propSource.FindPropertyRelative("Spreadsheet_LocalCSVSeparator");
|
||||
mProp_Spreadsheet_LocalCSVEncoding = propSource.FindPropertyRelative("Spreadsheet_LocalCSVEncoding");
|
||||
mProp_Spreadsheet_SpecializationAsRows = propSource.FindPropertyRelative("Spreadsheet_SpecializationAsRows");
|
||||
mProp_OnMissingTranslation = propSource.FindPropertyRelative("OnMissingTranslation");
|
||||
mProp_AppNameTerm = propSource.FindPropertyRelative("mTerm_AppName");
|
||||
mProp_IgnoreDeviceLanguage = propSource.FindPropertyRelative("IgnoreDeviceLanguage");
|
||||
mProp_GoogleLiveSyncIsUptoDate = propSource.FindPropertyRelative("GoogleLiveSyncIsUptoDate");
|
||||
mProp_AllowUnloadingLanguages = propSource.FindPropertyRelative("_AllowUnloadingLanguages");
|
||||
|
||||
if (!mIsParsing)
|
||||
{
|
||||
if (string.IsNullOrEmpty(mLanguageSource.Google_SpreadsheetKey))
|
||||
mSpreadsheetMode = eSpreadsheetMode.Local;
|
||||
else
|
||||
mSpreadsheetMode = eSpreadsheetMode.Google;
|
||||
|
||||
mCurrentViewMode = mLanguageSource.mLanguages.Count>0 ? eViewMode.Keys : eViewMode.Languages;
|
||||
|
||||
UpdateSelectedKeys();
|
||||
|
||||
if (ForceParse || mParsedTerms.Count < mLanguageSource.mTerms.Count)
|
||||
{
|
||||
mSelectedCategories.Clear();
|
||||
ParseTerms(true, false, true);
|
||||
}
|
||||
}
|
||||
ScheduleUpdateTermsToShowInList();
|
||||
LoadSelectedCategories();
|
||||
//UpgradeManager.EnablePlugins();
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
//LocalizationManager.LocalizeAll();
|
||||
SaveSelectedCategories();
|
||||
mLanguageSourceEditor = null;
|
||||
if (mCurrentInspector==this) mCurrentInspector = null;
|
||||
}
|
||||
|
||||
|
||||
void UpdateSelectedKeys()
|
||||
{
|
||||
// Remove all keys that are not in this source
|
||||
string trans;
|
||||
for (int i=mSelectedKeys.Count-1; i>=0; --i)
|
||||
if (!mLanguageSource.TryGetTranslation(mSelectedKeys[i], out trans))
|
||||
mSelectedKeys.RemoveAt(i);
|
||||
|
||||
// Remove all Categories that are not in this source
|
||||
/*var mCateg = mLanguageSource.GetCategories();
|
||||
for (int i=mSelectedCategories.Count-1; i>=0; --i)
|
||||
if (!mCateg.Contains(mSelectedCategories[i]))
|
||||
mSelectedCategories.RemoveAt(i);
|
||||
if (mSelectedCategories.Count==0)
|
||||
mSelectedCategories = mCateg;*/
|
||||
|
||||
if (mSelectedScenes.Count==0)
|
||||
mSelectedScenes.Add (Editor_GetCurrentScene());
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
// Load Test:
|
||||
/*if (mLanguageSource.mTerms.Count<40000)
|
||||
{
|
||||
mLanguageSource.mTerms.Clear();
|
||||
for (int i=0; i<40020; ++i)
|
||||
mLanguageSource.AddTerm("ahh"+i.ToString("00000"), eTermType.Text, false);
|
||||
mLanguageSource.UpdateDictionary();
|
||||
}*/
|
||||
//Profiler.maxNumberOfSamplesPerFrame = -1; // REMOVE ---------------------------------------------------
|
||||
|
||||
mIsParsing = false;
|
||||
|
||||
//#if UNITY_5_6_OR_NEWER
|
||||
// serializedObject.UpdateIfRequiredOrScript();
|
||||
//#else
|
||||
// serializedObject.UpdateIfDirtyOrScript();
|
||||
//#endif
|
||||
|
||||
if (mLanguageSource.mTerms.Count<1000)
|
||||
Undo.RecordObject(target, "LanguageSource");
|
||||
|
||||
//GUI.backgroundColor = Color.Lerp (Color.black, Color.gray, 1);
|
||||
//GUILayout.BeginVertical(LocalizeInspector.GUIStyle_Background);
|
||||
//GUI.backgroundColor = Color.white;
|
||||
|
||||
if (GUILayout.Button("Language Source", LocalizeInspector.GUIStyle_Header))
|
||||
{
|
||||
Application.OpenURL(LocalizeInspector.HelpURL_Documentation);
|
||||
}
|
||||
|
||||
InitializeStyles();
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
//GUI.backgroundColor = Color.Lerp(GUITools.LightGray, Color.white, 0.5f);
|
||||
//GUILayout.BeginVertical(LocalizeInspector.GUIStyle_Background);
|
||||
//GUI.backgroundColor = Color.white;
|
||||
OnGUI_Main();
|
||||
//GUILayout.EndVertical();
|
||||
|
||||
GUILayout.Space (10);
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
GUITools.OnGUI_Footer("I2 Localization", LocalizationManager.GetVersion(), LocalizeInspector.HelpURL_forum, LocalizeInspector.HelpURL_Documentation, LocalizeInspector.HelpURL_AssetStore);
|
||||
|
||||
//GUILayout.EndVertical();
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
if (Event.current.type == EventType.Repaint)
|
||||
{
|
||||
mTestAction = eTest_ActionType.None;
|
||||
mTestActionArg = null;
|
||||
mTestActionArg2 = null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90c932abd0dc445448366dfe101408ba
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,107 @@
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
|
||||
namespace I2.Loc
|
||||
{
|
||||
[CustomEditor(typeof(LocalizationParamsManager))]
|
||||
public class LocalizationParamsManagerInspector : Editor
|
||||
{
|
||||
private ReorderableList mList;
|
||||
private SerializedProperty mProp_IsGlobalManager;
|
||||
|
||||
|
||||
private ReorderableList getList(SerializedObject serObject)
|
||||
{
|
||||
if (mList == null) {
|
||||
mList = new ReorderableList (serObject, serObject.FindProperty ("_Params"), true, true, true, true);
|
||||
mList.drawElementCallback = drawElementCallback;
|
||||
mList.drawHeaderCallback = drawHeaderCallback;
|
||||
mList.onAddCallback = addElementCallback;
|
||||
mList.onRemoveCallback = removeElementCallback;
|
||||
}
|
||||
else
|
||||
{
|
||||
mList.serializedProperty = serObject.FindProperty ("_Params");
|
||||
}
|
||||
return mList;
|
||||
}
|
||||
|
||||
private void addElementCallback( ReorderableList list )
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
var objParams = target as LocalizationParamsManager;
|
||||
objParams._Params.Add(new LocalizationParamsManager.ParamValue());
|
||||
list.index = objParams._Params.Count - 1;
|
||||
serializedObject.Update();
|
||||
}
|
||||
|
||||
private void removeElementCallback( ReorderableList list )
|
||||
{
|
||||
if (list.index < 0)
|
||||
return;
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
var objParams = target as LocalizationParamsManager;
|
||||
objParams._Params.RemoveAt(list.index);
|
||||
serializedObject.Update();
|
||||
}
|
||||
|
||||
private void drawHeaderCallback(Rect rect)
|
||||
{
|
||||
GUI.Label(rect, "Parameters:");
|
||||
}
|
||||
|
||||
private void drawElementCallback(Rect rect, int index, bool isActive, bool isFocused)
|
||||
{
|
||||
var serializedElement = mList.serializedProperty.GetArrayElementAtIndex (index);
|
||||
var content = new GUIContent ();
|
||||
|
||||
Rect r = rect; r.xMax = r.xMin+40;
|
||||
GUI.Label(r, "Name");
|
||||
|
||||
r = rect; r.xMax = (r.xMax + r.xMin)/2 - 2; r.xMin = r.xMin+40;
|
||||
EditorGUI.PropertyField (r, serializedElement.FindPropertyRelative ("Name"),content);
|
||||
|
||||
r = rect; r.xMin = (r.xMax + r.xMin) / 2 + 2; r.xMax = r.xMin+40;
|
||||
GUI.Label(r, "Value");
|
||||
|
||||
r = rect; r.xMin = (r.xMax + r.xMin)/2 + 2 + 40;
|
||||
EditorGUI.PropertyField (r, serializedElement.FindPropertyRelative ("Value"), content);
|
||||
}
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
mList = getList(serializedObject);
|
||||
mProp_IsGlobalManager = serializedObject.FindProperty("_IsGlobalManager");
|
||||
}
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
serializedObject.UpdateIfRequiredOrScript();
|
||||
#else
|
||||
serializedObject.UpdateIfDirtyOrScript();
|
||||
#endif
|
||||
|
||||
GUI.backgroundColor = Color.Lerp (Color.black, Color.gray, 1);
|
||||
GUILayout.BeginVertical(LocalizeInspector.GUIStyle_Background);
|
||||
GUI.backgroundColor = Color.white;
|
||||
|
||||
if (GUILayout.Button("Dynamic Parameters", LocalizeInspector.GUIStyle_Header))
|
||||
{
|
||||
Application.OpenURL(LocalizeInspector.HelpURL_Documentation);
|
||||
}
|
||||
|
||||
GUILayout.Space(5);
|
||||
mProp_IsGlobalManager.boolValue = EditorGUILayout.Popup(new GUIContent("Manager Type", "本地管理器只对同一个游戏对象中的本地化组件应用参数\nLocal Manager only apply parameters to the Localize component in the same GameObject\n\n全局管理器将参数应用于所有本地化组件\nGlobal Manager apply parameters to all Localize components"), mProp_IsGlobalManager.boolValue ? 1 : 0, new[] { new GUIContent("Local"), new GUIContent("Global") }) == 1;
|
||||
|
||||
|
||||
GUILayout.Space(5);
|
||||
mList.DoLayoutList();
|
||||
|
||||
//EditorGUILayout.PropertyField(serializedObject.FindProperty("_AutoRegister"), new GUIContent("Auto Register"));
|
||||
|
||||
GUILayout.EndVertical();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93f1f9aecf6f7ed40ad1a082c22c47e5
|
||||
timeCreated: 1468111539
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,131 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
|
||||
namespace I2.Loc
|
||||
{
|
||||
#if !UNITY_5_0 && !UNITY_5_1
|
||||
|
||||
[CustomEditor(typeof(LocalizeDropdown))]
|
||||
public class LocalizeDropdownInspector : Editor
|
||||
{
|
||||
private ReorderableList mList;
|
||||
|
||||
private List<string> terms;
|
||||
|
||||
private ReorderableList getList(SerializedObject serObject)
|
||||
{
|
||||
if (mList == null) {
|
||||
mList = new ReorderableList (serObject, serObject.FindProperty ("_Terms"), true, true, true, true);
|
||||
mList.drawElementCallback = drawElementCallback;
|
||||
mList.drawHeaderCallback = drawHeaderCallback;
|
||||
mList.onAddCallback = addElementCallback;
|
||||
mList.onRemoveCallback = removeElementCallback;
|
||||
}
|
||||
else
|
||||
{
|
||||
mList.serializedProperty = serObject.FindProperty ("_Terms");
|
||||
}
|
||||
return mList;
|
||||
}
|
||||
|
||||
private void addElementCallback( ReorderableList list )
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
var objParams = target as LocalizeDropdown;
|
||||
objParams._Terms.Add(string.Empty);
|
||||
|
||||
list.index = objParams._Terms.Count - 1;
|
||||
|
||||
serializedObject.Update();
|
||||
}
|
||||
|
||||
private void removeElementCallback( ReorderableList list )
|
||||
{
|
||||
if (list.index < 0)
|
||||
return;
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
var objParams = target as LocalizeDropdown;
|
||||
objParams._Terms.RemoveAt(list.index);
|
||||
|
||||
serializedObject.Update();
|
||||
}
|
||||
|
||||
private void drawHeaderCallback(Rect rect)
|
||||
{
|
||||
GUI.Label(rect, "Terms:");
|
||||
}
|
||||
|
||||
private void drawElementCallback(Rect rect, int index, bool isActive, bool isFocused)
|
||||
{
|
||||
var serializedElement = mList.serializedProperty.GetArrayElementAtIndex (index);
|
||||
|
||||
EditorGUI.BeginChangeCheck ();
|
||||
|
||||
var prvIndex = serializedElement.stringValue == "-" || serializedElement.stringValue == "" ? terms.Count - 1 :
|
||||
serializedElement.stringValue == " " ? terms.Count - 2 :
|
||||
terms.IndexOf(serializedElement.stringValue);
|
||||
|
||||
var newIndex = EditorGUI.Popup(rect, prvIndex, terms.ToArray());
|
||||
|
||||
if (EditorGUI.EndChangeCheck ())
|
||||
{
|
||||
if (newIndex == terms.Count - 1)
|
||||
serializedElement.stringValue = "-";
|
||||
else
|
||||
if (newIndex < 0 || newIndex == terms.Count - 2)
|
||||
serializedElement.stringValue = string.Empty;
|
||||
else
|
||||
serializedElement.stringValue = terms[newIndex];
|
||||
}
|
||||
}
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
mList = getList(serializedObject);
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
serializedObject.UpdateIfRequiredOrScript();
|
||||
#else
|
||||
serializedObject.UpdateIfDirtyOrScript();
|
||||
#endif
|
||||
terms = LocalizationManager.GetTermsList ();
|
||||
terms.Sort(StringComparer.OrdinalIgnoreCase);
|
||||
terms.Add("");
|
||||
terms.Add("<inferred from text>");
|
||||
terms.Add("<none>");
|
||||
|
||||
GUI.backgroundColor = Color.Lerp (Color.black, Color.gray, 1);
|
||||
GUILayout.BeginVertical(LocalizeInspector.GUIStyle_Background);
|
||||
GUI.backgroundColor = Color.white;
|
||||
|
||||
if (GUILayout.Button("Localize DropDown", LocalizeInspector.GUIStyle_Header))
|
||||
{
|
||||
Application.OpenURL(LocalizeInspector.HelpURL_Documentation);
|
||||
}
|
||||
|
||||
|
||||
GUILayout.Space(5);
|
||||
mList.DoLayoutList();
|
||||
|
||||
GUILayout.Space (10);
|
||||
|
||||
GUITools.OnGUI_Footer("I2 Localization", LocalizationManager.GetVersion(), LocalizeInspector.HelpURL_forum, LocalizeInspector.HelpURL_Documentation, LocalizeInspector.HelpURL_AssetStore);
|
||||
|
||||
EditorGUIUtility.labelWidth = 0;
|
||||
|
||||
|
||||
GUILayout.EndVertical();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
terms = null;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65bbef08e6e42d24d9834945c3769202
|
||||
timeCreated: 1468111539
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,896 @@
|
||||
//#define UGUI
|
||||
//#define NGUI
|
||||
//#define DFGUI
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace I2.Loc
|
||||
{
|
||||
[CustomEditor(typeof(Localize))]
|
||||
[CanEditMultipleObjects]
|
||||
public class LocalizeInspector : Editor
|
||||
{
|
||||
#region Variables
|
||||
|
||||
Localize mLocalize;
|
||||
SerializedProperty mProp_mTerm, mProp_mTermSecondary,
|
||||
mProp_TranslatedObjects, mProp_LocalizeOnAwake, mProp_AlwaysForceLocalize, mProp_AllowLocalizedParameters, mProp_AllowParameters,
|
||||
mProp_IgnoreRTL, mProp_MaxCharactersInRTL, mProp_CorrectAlignmentForRTL, mProp_IgnoreNumbersInRTL, mProp_TermSuffix, mProp_TermPrefix, mProp_SeparateWords,
|
||||
mProp_CallbackEvent;
|
||||
|
||||
|
||||
bool mAllowEditKeyName;
|
||||
string mNewKeyName = "";
|
||||
|
||||
string[] mTermsArray;
|
||||
|
||||
|
||||
public static string HelpURL_forum = "http://goo.gl/Uiyu8C";//http://www.inter-illusion.com/forum/i2-localization";
|
||||
public static string HelpURL_Documentation = "http://www.inter-illusion.com/assets/I2LocalizationManual/I2LocalizationManual.html";
|
||||
public static string HelpURL_Tutorials = "http://inter-illusion.com/tools/i2-localization";
|
||||
public static string HelpURL_ReleaseNotes = "http://inter-illusion.com/forum/i2-localization/26-release-notes";
|
||||
public static string HelpURL_AssetStore = "https://www.assetstore.unity3d.com/#!/content/14884";
|
||||
|
||||
public static LocalizeInspector mLocalizeInspector;
|
||||
#endregion
|
||||
|
||||
#region Inspector
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
mLocalize = (Localize)target;
|
||||
mLocalizeInspector = this;
|
||||
LocalizationEditor.mCurrentInspector = this;
|
||||
mProp_mTerm = serializedObject.FindProperty("mTerm");
|
||||
mProp_mTermSecondary = serializedObject.FindProperty("mTermSecondary");
|
||||
mProp_TranslatedObjects = serializedObject.FindProperty("TranslatedObjects");
|
||||
mProp_IgnoreRTL = serializedObject.FindProperty("IgnoreRTL");
|
||||
mProp_SeparateWords = serializedObject.FindProperty("AddSpacesToJoinedLanguages");
|
||||
mProp_MaxCharactersInRTL = serializedObject.FindProperty ("MaxCharactersInRTL");
|
||||
mProp_IgnoreNumbersInRTL = serializedObject.FindProperty("IgnoreNumbersInRTL");
|
||||
mProp_CorrectAlignmentForRTL = serializedObject.FindProperty ("CorrectAlignmentForRTL");
|
||||
mProp_LocalizeOnAwake = serializedObject.FindProperty("LocalizeOnAwake");
|
||||
mProp_AlwaysForceLocalize = serializedObject.FindProperty("AlwaysForceLocalize");
|
||||
mProp_TermSuffix = serializedObject.FindProperty("TermSuffix");
|
||||
mProp_TermPrefix = serializedObject.FindProperty("TermPrefix");
|
||||
mProp_CallbackEvent = serializedObject.FindProperty("LocalizeEvent");
|
||||
mProp_AllowLocalizedParameters = serializedObject.FindProperty("AllowLocalizedParameters");
|
||||
mProp_AllowParameters = serializedObject.FindProperty("AllowParameters");
|
||||
|
||||
|
||||
if (LocalizationManager.Sources.Count==0)
|
||||
LocalizationManager.UpdateSources();
|
||||
//LocalizationEditor.ParseTerms (true);
|
||||
|
||||
//mGUI_ShowReferences = (mLocalize.TranslatedObjects!=null && mLocalize.TranslatedObjects.Length>0);
|
||||
//mGUI_ShowCallback = (mLocalize.LocalizeCallBack.Target!=null);
|
||||
//mGUI_ShowTems = true;
|
||||
LocalizationEditor.mKeysDesc_AllowEdit = false;
|
||||
GUI_SelectedTerm = 0;
|
||||
mNewKeyName = mLocalize.Term;
|
||||
|
||||
if (mLocalize.Source != null)
|
||||
LocalizationEditor.mLanguageSource = mLocalize.Source.SourceData;
|
||||
else
|
||||
{
|
||||
if (LocalizationManager.Sources.Count==0)
|
||||
LocalizationManager.UpdateSources();
|
||||
LocalizationEditor.mLanguageSource = LocalizationManager.GetSourceContaining( mLocalize.Term );
|
||||
}
|
||||
|
||||
//UpgradeManager.EnablePlugins();
|
||||
LocalizationEditor.ApplyInferredTerm (mLocalize);
|
||||
RemoveUnusedReferences(mLocalize);
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
mLocalizeInspector = null;
|
||||
if (LocalizationEditor.mCurrentInspector == this) LocalizationEditor.mCurrentInspector = null;
|
||||
|
||||
|
||||
if (mLocalize == null)
|
||||
return;
|
||||
|
||||
//#if TextMeshPro
|
||||
//string previous = null;
|
||||
|
||||
//if (!Application.isPlaying && !string.IsNullOrEmpty(mLocalize.TMP_previewLanguage))
|
||||
//{
|
||||
// previous = LocalizationManager.CurrentLanguage;
|
||||
// LocalizationManager.PreviewLanguage( mLocalize.TMP_previewLanguage );
|
||||
//}
|
||||
//#endif
|
||||
|
||||
//mLocalize.OnLocalize();
|
||||
|
||||
// Revert the preview language
|
||||
// except when in TMPro and not changing to another GameObject (TMPro has a bug where any change causes the inspector to Disable and Enable)
|
||||
if (!mLocalize.mLocalizeTargetName.Contains("LocalizeTarget_TextMeshPro") || Selection.activeGameObject==null || !Selection.gameObjects.Contains(mLocalize.gameObject))
|
||||
{
|
||||
LocalizationManager.LocalizeAll();
|
||||
}
|
||||
|
||||
//#if TextMeshPro
|
||||
//if (!string.IsNullOrEmpty(previous))
|
||||
//{
|
||||
// LocalizationManager.PreviewLanguage(previous);
|
||||
// mLocalize.TMP_previewLanguage = null;
|
||||
//}
|
||||
//#endif
|
||||
|
||||
RemoveUnusedReferences(mLocalize);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GUI
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
Undo.RecordObject(target, "Localize");
|
||||
|
||||
//GUI.backgroundColor = Color.Lerp (Color.black, Color.gray, 1);
|
||||
//GUILayout.BeginVertical(GUIStyle_Background, GUILayout.Height(1));
|
||||
//GUI.backgroundColor = Color.white;
|
||||
|
||||
if (GUILayout.Button("Localize", GUIStyle_Header))
|
||||
{
|
||||
//Application.OpenURL(HelpURL_Documentation);
|
||||
}
|
||||
GUILayout.Space(-10);
|
||||
|
||||
LocalizationManager.UpdateSources();
|
||||
|
||||
if (LocalizationManager.Sources.Count==0)
|
||||
{
|
||||
EditorGUILayout.HelpBox("无法找到语言来源。\nUnable to find a Language Source.", MessageType.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(10);
|
||||
OnGUI_Target ();
|
||||
GUILayout.Space(10);
|
||||
OnGUI_Terms();
|
||||
|
||||
//if (mGUI_ShowTems || mGUI_ShowReferences) GUILayout.Space(5);
|
||||
|
||||
OnGUI_References();
|
||||
|
||||
if (mLocalize.mGUI_ShowReferences || mLocalize.mGUI_ShowCallback) GUILayout.Space(10);
|
||||
|
||||
//Localize loc = target as Localize;
|
||||
|
||||
//--[ Localize Callback ]----------------------
|
||||
EditorGUILayout.PropertyField(mProp_CallbackEvent, new GUIContent("On Localize Callback"));
|
||||
|
||||
//string HeaderTitle = "On Localize Call:";
|
||||
//if (!mLocalize.mGUI_ShowCallback && loc.LocalizeCallBack.Target!=null && !string.IsNullOrEmpty(loc.LocalizeCallBack.MethodName))
|
||||
// HeaderTitle = string.Concat(HeaderTitle, " <b>",loc.LocalizeCallBack.Target.name, ".</b><i>", loc.LocalizeCallBack.MethodName, "</i>");
|
||||
//mLocalize.mGUI_ShowCallback = GUITools.DrawHeader(HeaderTitle, mLocalize.mGUI_ShowCallback);
|
||||
//if (mLocalize.mGUI_ShowCallback)
|
||||
//{
|
||||
// GUITools.BeginContents();
|
||||
// DrawEventCallBack( loc.LocalizeCallBack, loc );
|
||||
// GUITools.EndContents();
|
||||
//}
|
||||
}
|
||||
OnGUI_Source ();
|
||||
|
||||
GUILayout.Space (10);
|
||||
|
||||
GUITools.OnGUI_Footer("I2 Localization", LocalizationManager.GetVersion(), HelpURL_forum, HelpURL_Documentation, HelpURL_AssetStore);
|
||||
|
||||
//GUILayout.EndVertical();
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
if (Event.current.type == EventType.Repaint)
|
||||
{
|
||||
LocalizationEditor.mTestAction = LocalizationEditor.eTest_ActionType.None;
|
||||
LocalizationEditor.mTestActionArg = null;
|
||||
LocalizationEditor.mTestActionArg2 = null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region References
|
||||
|
||||
void OnGUI_References()
|
||||
{
|
||||
if (mLocalize.mGUI_ShowReferences = GUITools.DrawHeader ("References", mLocalize.mGUI_ShowReferences))
|
||||
{
|
||||
GUITools.BeginContents();
|
||||
|
||||
bool canTest = Event.current.type == EventType.Repaint;
|
||||
|
||||
var testAddObj = canTest && LocalizationEditor.mTestAction == LocalizationEditor.eTest_ActionType.Button_Assets_Add ? (Object)LocalizationEditor.mTestActionArg : null;
|
||||
var testReplaceIndx = canTest && LocalizationEditor.mTestAction == LocalizationEditor.eTest_ActionType.Button_Assets_Replace ? (int)LocalizationEditor.mTestActionArg : -1;
|
||||
var testReplaceObj = canTest && LocalizationEditor.mTestAction == LocalizationEditor.eTest_ActionType.Button_Assets_Replace ? (Object)LocalizationEditor.mTestActionArg2 : null;
|
||||
var testDeleteIndx = canTest && LocalizationEditor.mTestAction == LocalizationEditor.eTest_ActionType.Button_Assets_Delete ? (int)LocalizationEditor.mTestActionArg : -1;
|
||||
|
||||
bool changed = GUITools.DrawObjectsArray( mProp_TranslatedObjects, false, false, true, testAddObj, testReplaceObj, testReplaceIndx, testDeleteIndx);
|
||||
if (changed)
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
foreach (var obj in serializedObject.targetObjects)
|
||||
(obj as Localize).UpdateAssetDictionary();
|
||||
}
|
||||
|
||||
GUITools.EndContents();
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveUnusedReferences(Localize cmp)
|
||||
{
|
||||
cmp.TranslatedObjects.RemoveAll(x => !IsUsingReference(LocalizationManager.GetTermData(cmp.Term), x) && !IsUsingReference(LocalizationManager.GetTermData(cmp.SecondaryTerm), x));
|
||||
if (cmp.TranslatedObjects.Count != cmp.mAssetDictionary.Count)
|
||||
cmp.UpdateAssetDictionary();
|
||||
}
|
||||
|
||||
bool IsUsingReference(TermData termData, Object obj )
|
||||
{
|
||||
if (obj == null || termData==null) return false;
|
||||
|
||||
string objName = obj.name;
|
||||
foreach (string translation in termData.Languages)
|
||||
{
|
||||
if (translation != null && translation.Contains(objName))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Terms
|
||||
|
||||
int GUI_SelectedTerm;
|
||||
void OnGUI_Terms()
|
||||
{
|
||||
if ((mLocalize.mGUI_ShowTems=GUITools.DrawHeader ("Terms", mLocalize.mGUI_ShowTems)))
|
||||
{
|
||||
//--[ tabs: Main and Secondary Terms ]----------------
|
||||
int oldTab = GUI_SelectedTerm;
|
||||
if (mLocalize.mLocalizeTarget!=null && mLocalize.mLocalizeTarget.CanUseSecondaryTerm())
|
||||
{
|
||||
GUI_SelectedTerm = GUITools.DrawTabs (GUI_SelectedTerm, new[]{"Main", "Secondary"});
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI_SelectedTerm = 0;
|
||||
GUITools.DrawTabs (GUI_SelectedTerm, new[]{"Main", ""});
|
||||
}
|
||||
|
||||
GUITools.BeginContents();
|
||||
|
||||
TermData termData = null;
|
||||
|
||||
if (GUI_SelectedTerm==0) termData = OnGUI_PrimaryTerm( oldTab!=GUI_SelectedTerm );
|
||||
else termData = OnGUI_SecondaryTerm(oldTab!=GUI_SelectedTerm);
|
||||
|
||||
GUITools.EndContents();
|
||||
|
||||
//--[ Modifier ]-------------
|
||||
if (mLocalize.Term != "-" && termData!=null && termData.TermType==eTermType.Text)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("Prefix:");
|
||||
EditorGUILayout.PropertyField(mProp_TermPrefix, GUITools.EmptyContent);
|
||||
GUILayout.Label("Suffix:");
|
||||
EditorGUILayout.PropertyField(mProp_TermSuffix, GUITools.EmptyContent);
|
||||
GUILayout.EndHorizontal();
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
EditorApplication.delayCall += () =>
|
||||
{
|
||||
if (targets != null)
|
||||
{
|
||||
foreach (var t in targets)
|
||||
if (t as Localize != null)
|
||||
(t as Localize).OnLocalize(true);
|
||||
}
|
||||
};
|
||||
}
|
||||
EditorGUI.BeginChangeCheck();
|
||||
int val = EditorGUILayout.Popup("Modifier", GUI_SelectedTerm == 0 ? (int)mLocalize.PrimaryTermModifier : (int)mLocalize.SecondaryTermModifier, Enum.GetNames(typeof(Localize.TermModification)));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
serializedObject.FindProperty(GUI_SelectedTerm == 0 ? "PrimaryTermModifier" : "SecondaryTermModifier").enumValueIndex = val;
|
||||
GUI.changed = false;
|
||||
}
|
||||
}
|
||||
|
||||
OnGUI_Options();
|
||||
//--[ OnAwake vs OnEnable ]-------------
|
||||
//GUILayout.BeginHorizontal();
|
||||
//mProp_LocalizeOnAwake.boolValue = GUILayout.Toggle(mProp_LocalizeOnAwake.boolValue, new GUIContent(" Pre-Localize on Awake", "Localizing on Awake could result in a lag when the level is loaded but faster later when objects are enabled. If false, it will Localize OnEnable, so will yield faster level load but could have a lag when screens are enabled"));
|
||||
//GUILayout.FlexibleSpace();
|
||||
//if (mLocalize.HasCallback())
|
||||
//{
|
||||
// GUI.enabled = false;
|
||||
// GUILayout.Toggle(true, new GUIContent(" Force Localize", "Enable this when the translations have parameters (e.g. Thew winner is {[WINNER}]) to prevent any optimization that could prevent updating the translation when the object is enabled"));
|
||||
// GUI.enabled = true;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// mProp_AlwaysForceLocalize.boolValue = GUILayout.Toggle(mProp_AlwaysForceLocalize.boolValue, new GUIContent(" Force Localize", "Enable this when the translations have parameters (e.g. Thew winner is {[WINNER}]) to prevent any optimization that could prevent updating the translation when the object is enabled"));
|
||||
//}
|
||||
//GUILayout.EndHorizontal();
|
||||
|
||||
//--[ Right To Left ]-------------
|
||||
if (!mLocalize.IgnoreRTL && mLocalize.Term!="-" && termData != null && termData.TermType == eTermType.Text)
|
||||
{
|
||||
GUILayout.BeginVertical("Box");
|
||||
//GUILayout.BeginHorizontal();
|
||||
// mProp_IgnoreRTL.boolValue = GUILayout.Toggle(mProp_IgnoreRTL.boolValue, new GUIContent(" Ignore Right To Left", "Arabic and other RTL languages require processing them so they render correctly, this toogle allows ignoring that processing (in case you are doing it manually during a callback)"));
|
||||
// GUILayout.FlexibleSpace();
|
||||
// mProp_SeparateWords.boolValue = GUILayout.Toggle(mProp_SeparateWords.boolValue, new GUIContent(" Separate Words", " Some languages (e.g. Chinese, Japanese and Thai) don't add spaces to their words (all characters are placed toguether), enabling this checkbox, will add spaces to all characters to allow wrapping long texts into multiple lines."));
|
||||
//GUILayout.EndHorizontal();
|
||||
{
|
||||
mProp_MaxCharactersInRTL.intValue = EditorGUILayout.IntField( new GUIContent("最大线长 Max line length", "如果语言是从右到左,那么长行将按此长度分割,并且RTL修复将应用于每行,则应将其设置为适合此文本宽度的最大字符数。0禁用每行修复\nIf the language is Right To Left, long lines will be split at this length and the RTL fix will be applied to each line, this should be set to the maximum number of characters that fit in this text width. 0 disables the per line fix"), mProp_MaxCharactersInRTL.intValue );
|
||||
GUILayout.BeginHorizontal();
|
||||
mProp_CorrectAlignmentForRTL.boolValue = GUILayout.Toggle(mProp_CorrectAlignmentForRTL.boolValue, new GUIContent(" 调整对齐 Adjust Alignment", "当从右到左语言时为右对齐,否则为左对齐\nRight-align when Right-To-Left Language, and Left-Align otherwise") );
|
||||
GUILayout.FlexibleSpace();
|
||||
mProp_IgnoreNumbersInRTL.boolValue = GUILayout.Toggle(mProp_IgnoreNumbersInRTL.boolValue, new GUIContent(" 忽略数字 Ignore Numbers", "将数字保留为拉丁字符,而不是转换它们\nPreserve numbers as latin characters instead of converting them"));
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
|
||||
////GUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
|
||||
void OnGUI_Options()
|
||||
{
|
||||
int mask = 0;
|
||||
if (mProp_LocalizeOnAwake.boolValue) mask |= 1 << 0;
|
||||
if (mProp_AlwaysForceLocalize.boolValue) mask |= 1 << 1;
|
||||
if (mProp_AllowParameters.boolValue) mask |= 1 << 2;
|
||||
if (mProp_AllowLocalizedParameters.boolValue) mask |= 1 << 3;
|
||||
if (mProp_SeparateWords.boolValue) mask |= 1 << 4;
|
||||
if (mProp_IgnoreRTL.boolValue) mask |= 1 << 5;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
mask = EditorGUILayout.MaskField(new GUIContent("Options"), mask, new []{
|
||||
"Localize On Awake",
|
||||
"Force Localize",
|
||||
"Allow Parameters",
|
||||
"Allow Localized Parameters",
|
||||
"Separate Words",
|
||||
"Ignore RTL"
|
||||
});
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
mProp_LocalizeOnAwake.boolValue = (mask & (1 << 0))> 0;
|
||||
mProp_AlwaysForceLocalize.boolValue = (mask & (1 << 1))> 0;
|
||||
mProp_AllowParameters.boolValue = (mask & (1 << 2))> 0;
|
||||
mProp_AllowLocalizedParameters.boolValue = (mask & (1 << 3))> 0;
|
||||
mProp_SeparateWords.boolValue = (mask & (1 << 4))> 0;
|
||||
mProp_IgnoreRTL.boolValue = (mask & (1 << 5))> 0;
|
||||
}
|
||||
}
|
||||
|
||||
TermData OnGUI_PrimaryTerm( bool OnOpen )
|
||||
{
|
||||
string Key = mLocalize.mTerm;
|
||||
if (string.IsNullOrEmpty(Key))
|
||||
{
|
||||
string SecondaryTerm;
|
||||
mLocalize.GetFinalTerms( out Key, out SecondaryTerm );
|
||||
}
|
||||
|
||||
if (OnOpen) mNewKeyName = Key;
|
||||
if ( OnGUI_SelectKey( ref Key, string.IsNullOrEmpty(mLocalize.mTerm)))
|
||||
mProp_mTerm.stringValue = Key;
|
||||
return LocalizationEditor.OnGUI_Keys_Languages( Key, mLocalize );
|
||||
}
|
||||
|
||||
TermData OnGUI_SecondaryTerm( bool OnOpen )
|
||||
{
|
||||
string Key = mLocalize.mTermSecondary;
|
||||
|
||||
if (string.IsNullOrEmpty(Key))
|
||||
{
|
||||
string ss;
|
||||
mLocalize.GetFinalTerms( out ss, out Key );
|
||||
}
|
||||
|
||||
if (OnOpen) mNewKeyName = Key;
|
||||
if ( OnGUI_SelectKey( ref Key, string.IsNullOrEmpty(mLocalize.mTermSecondary)))
|
||||
mProp_mTermSecondary.stringValue = Key;
|
||||
return LocalizationEditor.OnGUI_Keys_Languages( Key, mLocalize, false );
|
||||
}
|
||||
|
||||
bool OnGUI_SelectKey( ref string Term, bool Inherited ) // Inherited==true means that the mTerm is empty and we are using the Label.text instead
|
||||
{
|
||||
GUILayout.Space (5);
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
GUI.changed = false;
|
||||
mAllowEditKeyName = GUILayout.Toggle(mAllowEditKeyName, "Term:", EditorStyles.foldout, GUILayout.ExpandWidth(false));
|
||||
if (GUI.changed && mAllowEditKeyName) {
|
||||
mNewKeyName = Term;
|
||||
mTermsArray = null;
|
||||
}
|
||||
|
||||
bool bChanged = false;
|
||||
|
||||
if (mTermsArray==null || Term!="-" && Array.IndexOf(mTermsArray, Term)<0)
|
||||
UpdateTermsList(Term);
|
||||
|
||||
if (Inherited)
|
||||
GUI.contentColor = Color.Lerp (Color.gray, Color.yellow, 0.1f);
|
||||
|
||||
int Index = Term=="-" || Term=="" ? mTermsArray.Length-1 : Array.IndexOf( mTermsArray, Term );
|
||||
|
||||
GUI.changed = false;
|
||||
|
||||
int newIndex = EditorGUILayout.Popup( Index, mTermsArray);
|
||||
|
||||
GUI.contentColor = Color.white;
|
||||
if (/*newIndex != Index && newIndex>=0*/GUI.changed)
|
||||
{
|
||||
GUI.changed = false;
|
||||
if (mLocalize.Source != null && newIndex == mTermsArray.Length - 4) //< show terms from all sources >
|
||||
{
|
||||
mLocalize.Source = null;
|
||||
mTermsArray = null;
|
||||
}
|
||||
else
|
||||
if (newIndex == mTermsArray.Length - 2) //<inferred from text>
|
||||
mNewKeyName = Term = string.Empty;
|
||||
else
|
||||
if (newIndex == mTermsArray.Length - 1) //<none>
|
||||
mNewKeyName = Term = "-";
|
||||
else
|
||||
mNewKeyName = Term = mTermsArray[newIndex];
|
||||
|
||||
|
||||
if (GUI_SelectedTerm==0)
|
||||
mLocalize.SetTerm (mNewKeyName);
|
||||
else
|
||||
mLocalize.SetTerm (null, mNewKeyName);
|
||||
mAllowEditKeyName = false;
|
||||
bChanged = true;
|
||||
}
|
||||
|
||||
LanguageSourceData source = LocalizationManager.GetSourceContaining(Term);
|
||||
TermData termData = source.GetTermData(Term);
|
||||
if (termData!=null)
|
||||
{
|
||||
if (Inherited)
|
||||
bChanged = true; // if the term its inferred and a matching term its found, then use that
|
||||
eTermType NewType = (eTermType)EditorGUILayout.EnumPopup(termData.TermType, GUILayout.Width(90));
|
||||
if (termData.TermType != NewType)
|
||||
termData.TermType = NewType;
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
if (mAllowEditKeyName)
|
||||
{
|
||||
GUILayout.BeginHorizontal(GUILayout.Height (1));
|
||||
GUILayout.BeginHorizontal(EditorStyles.toolbar);
|
||||
if(mNewKeyName==null) mNewKeyName = string.Empty;
|
||||
|
||||
GUI.changed = false;
|
||||
mNewKeyName = EditorGUILayout.TextField(mNewKeyName, new GUIStyle("ToolbarSeachTextField"), GUILayout.ExpandWidth(true));
|
||||
if (GUI.changed)
|
||||
{
|
||||
mTermsArray = null; // regenerate this array to apply filtering
|
||||
GUI.changed = false;
|
||||
}
|
||||
|
||||
if (GUILayout.Button (string.Empty, string.IsNullOrEmpty(mNewKeyName) ? "ToolbarSeachCancelButtonEmpty" : "ToolbarSeachCancelButton", GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
mTermsArray = null; // regenerate this array to apply filtering
|
||||
mNewKeyName = string.Empty;
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
string ValidatedName = mNewKeyName;
|
||||
LanguageSourceData.ValidateFullTerm( ref ValidatedName );
|
||||
|
||||
bool CanUseNewName = source.GetTermData(ValidatedName)==null;
|
||||
GUI.enabled = !string.IsNullOrEmpty(mNewKeyName) && CanUseNewName;
|
||||
if (GUILayout.Button ("Create", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
mNewKeyName = ValidatedName;
|
||||
mTermsArray=null; // this recreates that terms array
|
||||
|
||||
LanguageSourceData Source = null;
|
||||
#if UNITY_EDITOR
|
||||
if (mLocalize.Source!=null)
|
||||
Source = mLocalize.Source.SourceData;
|
||||
#endif
|
||||
|
||||
if (Source==null)
|
||||
Source = LocalizationManager.Sources[0];
|
||||
Term = mNewKeyName;
|
||||
var data = Source.AddTerm( mNewKeyName, eTermType.Text, false );
|
||||
if (data.Languages.Length > 0)
|
||||
data.Languages[0] = mLocalize.GetMainTargetsText();
|
||||
Source.Editor_SetDirty();
|
||||
AssetDatabase.SaveAssets();
|
||||
mAllowEditKeyName = false;
|
||||
bChanged = true;
|
||||
GUIUtility.keyboardControl = 0;
|
||||
}
|
||||
GUI.enabled = termData!=null && !string.IsNullOrEmpty(mNewKeyName) && CanUseNewName;
|
||||
if (GUILayout.Button (new GUIContent("Rename","重命名源中的术语并更新当前场景中使用它的每个对象\nRenames the term in the source and updates every object using it in the current scene"), EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
mNewKeyName = ValidatedName;
|
||||
Term = mNewKeyName;
|
||||
mTermsArray=null; // this recreates that terms array
|
||||
mAllowEditKeyName = false;
|
||||
bChanged = true;
|
||||
LocalizationEditor.TermReplacements = new Dictionary<string, string>(StringComparer.Ordinal);
|
||||
LocalizationEditor.TermReplacements[ termData.Term ] = mNewKeyName;
|
||||
termData.Term = mNewKeyName;
|
||||
source.UpdateDictionary(true);
|
||||
LocalizationEditor.ReplaceTermsInCurrentScene();
|
||||
GUIUtility.keyboardControl = 0;
|
||||
EditorApplication.update += LocalizationEditor.DoParseTermsInCurrentScene;
|
||||
}
|
||||
GUI.enabled = true;
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
bChanged |= OnGUI_SelectKey_PreviewTerms ( ref Term);
|
||||
}
|
||||
|
||||
GUILayout.Space (5);
|
||||
return bChanged;
|
||||
}
|
||||
|
||||
void UpdateTermsList( string currentTerm )
|
||||
{
|
||||
List<string> Terms = mLocalize.Source==null ? LocalizationManager.GetTermsList() : mLocalize.Source.SourceData.GetTermsList();
|
||||
|
||||
// If there is a filter, remove all terms not matching that filter
|
||||
if (mAllowEditKeyName && !string.IsNullOrEmpty(mNewKeyName))
|
||||
{
|
||||
string Filter = mNewKeyName.ToUpper();
|
||||
for (int i=Terms.Count-1; i>=0; --i)
|
||||
if (!Terms[i].ToUpper().Contains(Filter) && Terms[i]!=currentTerm)
|
||||
Terms.RemoveAt(i);
|
||||
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(currentTerm) && currentTerm!="-" && !Terms.Contains(currentTerm))
|
||||
Terms.Add (currentTerm);
|
||||
|
||||
Terms.Sort(StringComparer.OrdinalIgnoreCase);
|
||||
Terms.Add("");
|
||||
if (mLocalize.Source != null)
|
||||
{
|
||||
Terms.Add("< Show Terms from all sources >");
|
||||
Terms.Add("");
|
||||
}
|
||||
Terms.Add("<inferred from text>");
|
||||
Terms.Add("<none>");
|
||||
|
||||
mTermsArray = Terms.ToArray();
|
||||
}
|
||||
|
||||
bool OnGUI_SelectKey_PreviewTerms ( ref string Term)
|
||||
{
|
||||
if (mTermsArray==null)
|
||||
UpdateTermsList(Term);
|
||||
|
||||
int nTerms = mTermsArray.Length;
|
||||
if (nTerms<=0)
|
||||
return false;
|
||||
|
||||
if (nTerms==1 && mTermsArray[0]==Term)
|
||||
return false;
|
||||
|
||||
bool bChanged = false;
|
||||
GUI.backgroundColor = Color.gray;
|
||||
GUILayout.BeginVertical (GUIStyle_OldTextArea);
|
||||
for (int i = 0, imax = Mathf.Min (nTerms, 3); i < imax; ++i)
|
||||
{
|
||||
ParsedTerm parsedTerm;
|
||||
int nUses = -1;
|
||||
if (LocalizationEditor.mParsedTerms.TryGetValue (mTermsArray [i], out parsedTerm))
|
||||
nUses = parsedTerm.Usage;
|
||||
|
||||
string FoundText = mTermsArray [i];
|
||||
if (nUses > 0)
|
||||
FoundText = string.Concat ("(", nUses, ") ", FoundText);
|
||||
|
||||
if (GUILayout.Button (FoundText, EditorStyles.miniLabel, GUILayout.MaxWidth(EditorGUIUtility.currentViewWidth - 70)))
|
||||
{
|
||||
if (mTermsArray[i] == "<inferred from text>")
|
||||
mNewKeyName = Term = string.Empty;
|
||||
else
|
||||
if (mTermsArray[i] == "<none>")
|
||||
mNewKeyName = Term = "-";
|
||||
else
|
||||
if (mTermsArray[i] != "< Show Terms from all sources >")
|
||||
mNewKeyName = Term = mTermsArray[i];
|
||||
|
||||
//mNewKeyName = Term = (mTermsArray [i]=="<inferred from text>" ? string.Empty : mTermsArray [i]);
|
||||
GUIUtility.keyboardControl = 0;
|
||||
mAllowEditKeyName = false;
|
||||
bChanged = true;
|
||||
}
|
||||
}
|
||||
if (nTerms > 3)
|
||||
GUILayout.Label ("...");
|
||||
GUILayout.EndVertical ();
|
||||
GUI.backgroundColor = Color.white;
|
||||
|
||||
return bChanged;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Target
|
||||
|
||||
void OnGUI_Target()
|
||||
{
|
||||
List<string> TargetTypes = new List<string>();
|
||||
int CurrentTarget = -1;
|
||||
|
||||
mLocalize.FindTarget();
|
||||
|
||||
foreach (var desc in LocalizationManager.mLocalizeTargets)
|
||||
{
|
||||
if (desc.CanLocalize(mLocalize))
|
||||
{
|
||||
TargetTypes.Add(desc.Name);
|
||||
|
||||
if (mLocalize.mLocalizeTarget!=null && desc.GetTargetType() == mLocalize.mLocalizeTarget.GetType())
|
||||
CurrentTarget = TargetTypes.Count - 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (CurrentTarget==-1)
|
||||
{
|
||||
CurrentTarget = TargetTypes.Count;
|
||||
TargetTypes.Add("None");
|
||||
}
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label ("Target:", GUILayout.Width (60));
|
||||
EditorGUI.BeginChangeCheck();
|
||||
int index = EditorGUILayout.Popup(CurrentTarget, TargetTypes.ToArray());
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
foreach (var obj in serializedObject.targetObjects)
|
||||
{
|
||||
var cmp = obj as Localize;
|
||||
if (cmp == null)
|
||||
continue;
|
||||
|
||||
if (cmp.mLocalizeTarget != null)
|
||||
DestroyImmediate(cmp.mLocalizeTarget);
|
||||
cmp.mLocalizeTarget = null;
|
||||
|
||||
foreach (var desc in LocalizationManager.mLocalizeTargets)
|
||||
{
|
||||
if (desc.Name == TargetTypes[index])
|
||||
{
|
||||
cmp.mLocalizeTarget = desc.CreateTarget(cmp);
|
||||
cmp.mLocalizeTargetName = desc.GetTargetType().ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
serializedObject.Update();
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Source
|
||||
|
||||
void OnGUI_Source()
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
ILanguageSource currentSource = mLocalize.Source;
|
||||
if (currentSource==null)
|
||||
{
|
||||
LanguageSourceData source = LocalizationManager.GetSourceContaining(mLocalize.Term);
|
||||
currentSource = source==null ? null : source.owner;
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Open Source", EditorStyles.toolbarButton, GUILayout.Width (100)))
|
||||
{
|
||||
Selection.activeObject = currentSource as Object;
|
||||
|
||||
string sTerm, sSecondary;
|
||||
mLocalize.GetFinalTerms( out sTerm, out sSecondary );
|
||||
if (GUI_SelectedTerm==1) sTerm = sSecondary;
|
||||
LocalizationEditor.mKeyToExplore = sTerm;
|
||||
}
|
||||
|
||||
GUILayout.Space (2);
|
||||
|
||||
GUILayout.BeginHorizontal(EditorStyles.toolbar);
|
||||
EditorGUI.BeginChangeCheck ();
|
||||
if (mLocalize.Source == null)
|
||||
{
|
||||
GUI.contentColor = Color.Lerp (Color.gray, Color.yellow, 0.1f);
|
||||
}
|
||||
Object obj = EditorGUILayout.ObjectField(currentSource as Object, typeof(Object), true);
|
||||
GUI.contentColor = Color.white;
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
ILanguageSource NewSource = obj as ILanguageSource;
|
||||
if (NewSource == null && obj as GameObject != null)
|
||||
{
|
||||
NewSource = (obj as GameObject).GetComponent<LanguageSource>();
|
||||
}
|
||||
|
||||
mLocalize.Source = NewSource;
|
||||
string sTerm, sSecondary;
|
||||
mLocalize.GetFinalTerms(out sTerm, out sSecondary);
|
||||
if (GUI_SelectedTerm == 1) sTerm = sSecondary;
|
||||
UpdateTermsList(sTerm);
|
||||
}
|
||||
|
||||
if (GUILayout.Button(new GUIContent("Detect", "找到包含所选术语的LanguageSource,术语列表现在将只显示该源中的术语。\nFinds the LanguageSource containing the selected term, the term list will now only show terms inside that source."), EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
string sTerm, sSecondary;
|
||||
mLocalize.GetFinalTerms(out sTerm, out sSecondary);
|
||||
if (GUI_SelectedTerm == 1) sTerm = sSecondary;
|
||||
|
||||
var data = LocalizationManager.GetSourceContaining(sTerm, false);
|
||||
mLocalize.Source = data==null ? null : data.owner;
|
||||
mTermsArray = null;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Event CallBack
|
||||
|
||||
//public void DrawEventCallBack( EventCallback CallBack, Localize loc )
|
||||
//{
|
||||
//if (CallBack==null)
|
||||
// return;
|
||||
|
||||
//GUI.changed = false;
|
||||
|
||||
//GUILayout.BeginHorizontal();
|
||||
//GUILayout.Label("Target:", GUILayout.ExpandWidth(false));
|
||||
//CallBack.Target = EditorGUILayout.ObjectField( CallBack.Target, typeof(MonoBehaviour), true) as MonoBehaviour;
|
||||
//GUILayout.EndHorizontal();
|
||||
|
||||
//if (CallBack.Target!=null)
|
||||
//{
|
||||
// GameObject GO = CallBack.Target.gameObject;
|
||||
// List<MethodInfo> Infos = new List<MethodInfo>();
|
||||
|
||||
// var targets = GO.GetComponents(typeof(MonoBehaviour));
|
||||
// foreach (var behavior in targets)
|
||||
// Infos.AddRange( behavior.GetType().GetMethods() );
|
||||
|
||||
// List<string> Methods = new List<string>();
|
||||
|
||||
// for (int i = 0, imax=Infos.Count; i<imax; ++i)
|
||||
// {
|
||||
// MethodInfo mi = Infos[i];
|
||||
|
||||
// if (IsValidMethod(mi))
|
||||
// Methods.Add (mi.Name);
|
||||
// }
|
||||
|
||||
// int Index = Methods.IndexOf(CallBack.MethodName);
|
||||
|
||||
// int NewIndex = EditorGUILayout.Popup(Index, Methods.ToArray(), GUILayout.ExpandWidth(true));
|
||||
// if (NewIndex!=Index)
|
||||
// CallBack.MethodName = Methods[ NewIndex ];
|
||||
//}
|
||||
//if (GUI.changed)
|
||||
//{
|
||||
// GUI.changed = false;
|
||||
// EditorUtility.SetDirty(loc);
|
||||
// //UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty() EditorApplication.MakeSceneDirty();
|
||||
//}
|
||||
//}
|
||||
|
||||
static bool IsValidMethod( MethodInfo mi )
|
||||
{
|
||||
if (mi.DeclaringType == typeof(MonoBehaviour) || mi.ReturnType != typeof(void))
|
||||
return false;
|
||||
|
||||
ParameterInfo[] Params = mi.GetParameters ();
|
||||
if (Params.Length == 0) return true;
|
||||
if (Params.Length > 1) return false;
|
||||
|
||||
if (Params [0].ParameterType.IsSubclassOf (typeof(Object))) return true;
|
||||
if (Params [0].ParameterType == typeof(Object)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Styles
|
||||
|
||||
public static GUIStyle GUIStyle_Header {
|
||||
get{
|
||||
if (mGUIStyle_Header==null)
|
||||
{
|
||||
mGUIStyle_Header = new GUIStyle("HeaderLabel");
|
||||
mGUIStyle_Header.fontSize = 25;
|
||||
mGUIStyle_Header.normal.textColor = Color.Lerp(Color.white, Color.gray, 0.5f);
|
||||
mGUIStyle_Header.fontStyle = FontStyle.BoldAndItalic;
|
||||
mGUIStyle_Header.alignment = TextAnchor.UpperCenter;
|
||||
}
|
||||
return mGUIStyle_Header;
|
||||
}
|
||||
}
|
||||
static GUIStyle mGUIStyle_Header;
|
||||
|
||||
public static GUIStyle GUIStyle_SubHeader {
|
||||
get{
|
||||
if (mGUIStyle_SubHeader==null)
|
||||
{
|
||||
mGUIStyle_SubHeader = new GUIStyle("HeaderLabel");
|
||||
mGUIStyle_SubHeader.fontSize = 13;
|
||||
mGUIStyle_SubHeader.fontStyle = FontStyle.Normal;
|
||||
mGUIStyle_SubHeader.margin.top = -50;
|
||||
mGUIStyle_SubHeader.alignment = TextAnchor.UpperCenter;
|
||||
}
|
||||
return mGUIStyle_SubHeader;
|
||||
}
|
||||
}
|
||||
static GUIStyle mGUIStyle_SubHeader;
|
||||
|
||||
public static GUIStyle GUIStyle_Background {
|
||||
get{
|
||||
if (mGUIStyle_Background==null)
|
||||
{
|
||||
mGUIStyle_Background = new GUIStyle(EditorStyles.textArea);
|
||||
mGUIStyle_Background.fixedHeight = 0;
|
||||
mGUIStyle_Background.overflow.left = 50;
|
||||
mGUIStyle_Background.overflow.right = 50;
|
||||
mGUIStyle_Background.overflow.top = -5;
|
||||
mGUIStyle_Background.overflow.bottom = 0;
|
||||
}
|
||||
return mGUIStyle_Background;
|
||||
}
|
||||
}
|
||||
static GUIStyle mGUIStyle_Background;
|
||||
|
||||
public static GUIStyle GUIStyle_OldTextArea
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mGUIStyle_OldTextArea == null)
|
||||
{
|
||||
mGUIStyle_OldTextArea = new GUIStyle(EditorStyles.textArea);
|
||||
mGUIStyle_OldTextArea.fixedHeight = 0;
|
||||
}
|
||||
return mGUIStyle_OldTextArea;
|
||||
}
|
||||
}
|
||||
static GUIStyle mGUIStyle_OldTextArea;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 675119279b2a30245801272112cfbe38
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,29 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace I2.Loc
|
||||
{
|
||||
[CustomEditor(typeof(ResourceManager))]
|
||||
public class ResourceManagerInspector : Editor
|
||||
{
|
||||
SerializedProperty mAssets;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
UpgradeManager.EnablePlugins();
|
||||
mAssets = serializedObject.FindProperty("Assets");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
GUILayout.Space(5);
|
||||
GUITools.DrawHeader("Assets:", true);
|
||||
GUITools.BeginContents();
|
||||
///GUILayout.Label ("Assets:");
|
||||
GUITools.DrawObjectsArray( mAssets );
|
||||
GUITools.EndContents();
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba2fdf8face79dd4f9e1ed80448db843
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace I2.Loc
|
||||
{
|
||||
[CustomEditor(typeof(SetLanguage))]
|
||||
public class SetLanguageInspector : Editor
|
||||
{
|
||||
public SetLanguage setLan;
|
||||
public SerializedProperty mProp_Language;
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
setLan = (SetLanguage)target;
|
||||
mProp_Language = serializedObject.FindProperty("_Language");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
string[] Languages;
|
||||
LanguageSource sourceObj = setLan.mSource;
|
||||
if (sourceObj == null)
|
||||
{
|
||||
LocalizationManager.UpdateSources();
|
||||
Languages = LocalizationManager.GetAllLanguages().ToArray();
|
||||
Array.Sort(Languages);
|
||||
}
|
||||
else
|
||||
{
|
||||
Languages = sourceObj.mSource.GetLanguages().ToArray();
|
||||
Array.Sort(Languages);
|
||||
}
|
||||
|
||||
int index = Array.IndexOf(Languages, mProp_Language.stringValue);
|
||||
|
||||
GUI.changed = false;
|
||||
index = EditorGUILayout.Popup("Language", index, Languages);
|
||||
if (GUI.changed)
|
||||
{
|
||||
if (index<0 || index>=Languages.Length)
|
||||
mProp_Language.stringValue = string.Empty;
|
||||
else
|
||||
mProp_Language.stringValue = Languages[index];
|
||||
GUI.changed = false;
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
GUILayout.Space(5);
|
||||
if (setLan.mSource==null) GUI.contentColor = Color.Lerp (Color.gray, Color.yellow, 0.1f);
|
||||
sourceObj = EditorGUILayout.ObjectField("Language Source:", sourceObj, typeof(LanguageSource), true) as LanguageSource;
|
||||
GUI.contentColor = Color.white;
|
||||
|
||||
if (GUI.changed)
|
||||
setLan.mSource = sourceObj;
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7af58b4da44670e47a509c59754e8c2b
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,164 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace I2.Loc
|
||||
{
|
||||
[CustomPropertyDrawer (typeof (TermsPopup))]
|
||||
public class TermsPopup_Drawer : PropertyDrawer
|
||||
{
|
||||
GUIContent[] mTerms_Context;
|
||||
int nFramesLeftBeforeUpdate;
|
||||
string mPrevFilter;
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var filter = ((TermsPopup)attribute).Filter;
|
||||
ShowGUICached(position, property, label, null, filter, ref mTerms_Context, ref nFramesLeftBeforeUpdate, ref mPrevFilter);
|
||||
}
|
||||
|
||||
public static bool ShowGUI(Rect position, SerializedProperty property, GUIContent label, LanguageSourceData source, string filter = "")
|
||||
{
|
||||
GUIContent[] terms=null;
|
||||
int framesLeftBeforeUpdate=0;
|
||||
string prevFilter = null;
|
||||
|
||||
return ShowGUICached(position, property, label, source, filter, ref terms, ref framesLeftBeforeUpdate, ref prevFilter);
|
||||
}
|
||||
|
||||
public static bool ShowGUICached(Rect position, SerializedProperty property, GUIContent label, LanguageSourceData source, string filter, ref GUIContent[] terms_Contexts, ref int framesBeforeUpdating, ref string prevFilter)
|
||||
{
|
||||
UpdateTermsCache(source, filter, ref terms_Contexts, ref framesBeforeUpdating, ref prevFilter);
|
||||
|
||||
label = EditorGUI.BeginProperty(position, label, property);
|
||||
|
||||
EditorGUI.BeginChangeCheck ();
|
||||
|
||||
var index = property.stringValue == "-" || property.stringValue == "" ? terms_Contexts.Length - 1 :
|
||||
property.stringValue == " " ? terms_Contexts.Length - 2 :
|
||||
GetTermIndex(terms_Contexts, property.stringValue);
|
||||
var newIndex = EditorGUI.Popup(position, label, index, terms_Contexts);
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
property.stringValue = newIndex < 0 || newIndex == terms_Contexts.Length - 1 ? string.Empty : terms_Contexts[newIndex].text;
|
||||
if (newIndex == terms_Contexts.Length - 1)
|
||||
property.stringValue = "-";
|
||||
else
|
||||
if (newIndex < 0 || newIndex == terms_Contexts.Length - 2)
|
||||
property.stringValue = string.Empty;
|
||||
else
|
||||
property.stringValue = terms_Contexts[newIndex].text;
|
||||
|
||||
EditorGUI.EndProperty();
|
||||
return true;
|
||||
}
|
||||
|
||||
EditorGUI.EndProperty();
|
||||
return false;
|
||||
}
|
||||
|
||||
static int GetTermIndex(GUIContent[] terms_Contexts, string term )
|
||||
{
|
||||
for (int i = 0; i < terms_Contexts.Length; ++i)
|
||||
if (terms_Contexts[i].text == term)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static void UpdateTermsCache(LanguageSourceData source, string filter, ref GUIContent[] terms_Contexts, ref int framesBeforeUpdating, ref string prevFilter)
|
||||
{
|
||||
framesBeforeUpdating--;
|
||||
if (terms_Contexts!=null && framesBeforeUpdating>0 && filter==prevFilter)
|
||||
{
|
||||
return;
|
||||
}
|
||||
framesBeforeUpdating = 60;
|
||||
prevFilter = filter;
|
||||
|
||||
var Terms = source == null ? LocalizationManager.GetTermsList() : source.GetTermsList();
|
||||
|
||||
if (string.IsNullOrEmpty(filter) == false)
|
||||
{
|
||||
Terms = Filter(Terms, filter);
|
||||
}
|
||||
|
||||
Terms.Sort(StringComparer.OrdinalIgnoreCase);
|
||||
Terms.Add("");
|
||||
Terms.Add("<inferred from text>");
|
||||
Terms.Add("<none>");
|
||||
|
||||
terms_Contexts = DisplayOptions(Terms);
|
||||
}
|
||||
|
||||
private static List<string> Filter(List<string> terms, string filter)
|
||||
{
|
||||
var filtered = new List<string>();
|
||||
for (var i = 0; i < terms.Count; i++)
|
||||
{
|
||||
var term = terms[i];
|
||||
if (term.Contains(filter))
|
||||
{
|
||||
filtered.Add(term);
|
||||
}
|
||||
}
|
||||
|
||||
return filtered;
|
||||
}
|
||||
|
||||
private static GUIContent[] DisplayOptions(IList<string> terms)
|
||||
{
|
||||
var options = new GUIContent[terms.Count];
|
||||
for (var i = 0; i < terms.Count; i++)
|
||||
{
|
||||
options[i] = new GUIContent(terms[i]);
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(LocalizedString))]
|
||||
public class LocalizedStringDrawer : PropertyDrawer
|
||||
{
|
||||
GUIContent[] mTerms_Context;
|
||||
int nFramesLeftBeforeUpdate;
|
||||
string mPrevFilter;
|
||||
|
||||
public override void OnGUI(Rect rect, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var termRect = rect; termRect.xMax -= 50;
|
||||
var termProp = property.FindPropertyRelative("mTerm");
|
||||
TermsPopup_Drawer.ShowGUICached(termRect, termProp, label, null, "", ref mTerms_Context, ref nFramesLeftBeforeUpdate, ref mPrevFilter);
|
||||
|
||||
var maskRect = rect; maskRect.xMin = maskRect.xMax - 30;
|
||||
var termIgnoreRTL = property.FindPropertyRelative("mRTL_IgnoreArabicFix");
|
||||
var termConvertNumbers = property.FindPropertyRelative("mRTL_ConvertNumbers");
|
||||
var termDontLocalizeParams = property.FindPropertyRelative("m_DontLocalizeParameters");
|
||||
int mask = (termIgnoreRTL.boolValue ? 0 : 1) +
|
||||
(termConvertNumbers.boolValue ? 0 : 2) +
|
||||
(termDontLocalizeParams.boolValue ? 0 : 4);
|
||||
|
||||
int newMask = EditorGUI.MaskField(maskRect, mask, new[] { "Arabic Fix", "Ignore Numbers in RTL", "Localize Parameters" });
|
||||
if (newMask != mask)
|
||||
{
|
||||
termIgnoreRTL.boolValue = (newMask & 1) == 0;
|
||||
termConvertNumbers.boolValue = (newMask & 2) == 0;
|
||||
termDontLocalizeParams.boolValue = (newMask & 4) == 0;
|
||||
}
|
||||
|
||||
var showRect = rect; showRect.xMin = termRect.xMax; showRect.xMax=maskRect.xMin;
|
||||
bool enabled = GUI.enabled;
|
||||
GUI.enabled = enabled & (!string.IsNullOrEmpty (termProp.stringValue) && termProp.stringValue!="-");
|
||||
if (GUI.Button (showRect, "?"))
|
||||
{
|
||||
var source = LocalizationManager.GetSourceContaining(termProp.stringValue);
|
||||
LocalizationEditor.mKeyToExplore = termProp.stringValue;
|
||||
Selection.activeObject = source.ownerObject;
|
||||
}
|
||||
GUI.enabled = enabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 51c22a426b92fa84cb6ca7b75176da8a
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ad136296e8e6e14eaa2726ac1992b6c
|
||||
folderAsset: yes
|
||||
timeCreated: 1461137613
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,308 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace I2.Loc
|
||||
{
|
||||
public partial class LocalizationEditor
|
||||
{
|
||||
|
||||
#region Variables
|
||||
|
||||
public enum eViewMode { ImportExport, Keys, Languages, Tools, References }
|
||||
public static eViewMode mCurrentViewMode = eViewMode.Keys;
|
||||
|
||||
public enum eSpreadsheetMode { Local, Google }
|
||||
public eSpreadsheetMode mSpreadsheetMode = eSpreadsheetMode.Google;
|
||||
|
||||
|
||||
public static string mLocalizationMsg = "";
|
||||
public static MessageType mLocalizationMessageType = MessageType.None;
|
||||
|
||||
// These variables are for executing action from Unity Tests
|
||||
public enum eTest_ActionType { None, Button_AddLanguageFromPopup, Button_AddLanguageManual,
|
||||
Button_AddTerm_InTermsList, Button_AddSelectedTerms,
|
||||
Button_RemoveSelectedTerms, Button_DeleteTerm,
|
||||
Button_SelectTerms_All, Button_SelectTerms_None, Button_SelectTerms_Used, Button_SelectTerms_Missing,
|
||||
Button_Term_Translate, Button_Term_TranslateAll, Button_Languages_TranslateAll,
|
||||
Button_Assets_Add, Button_Assets_Replace, Button_Assets_Delete,
|
||||
Button_GoogleSpreadsheet_RefreshList, Button_GoogleSpreadsheet_Export, Button_GoogleSpreadsheet_Import
|
||||
}
|
||||
public static eTest_ActionType mTestAction = eTest_ActionType.None;
|
||||
public static object mTestActionArg, mTestActionArg2;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Editor
|
||||
|
||||
/*[MenuItem("Window/Localization", false)]
|
||||
public static void OpenLocalizationEditor()
|
||||
{
|
||||
EditorWindow.GetWindow<LocalizationEditor>(false, "Localization", true);
|
||||
}*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region GUI
|
||||
|
||||
void InitializeStyles()
|
||||
{
|
||||
Style_ToolBar_Big = new GUIStyle(EditorStyles.toolbar);
|
||||
Style_ToolBar_Big.fixedHeight = Style_ToolBar_Big.fixedHeight*1.5f;
|
||||
|
||||
Style_ToolBarButton_Big = new GUIStyle(EditorStyles.toolbarButton);
|
||||
Style_ToolBarButton_Big.fixedHeight = Style_ToolBarButton_Big.fixedHeight*1.5f;
|
||||
}
|
||||
|
||||
|
||||
void OnGUI_Main()
|
||||
{
|
||||
OnGUI_Warning_SourceInScene();
|
||||
OnGUI_Warning_SourceInsidePluginsFolder();
|
||||
OnGUI_Warning_SourceNotUpToDate();
|
||||
|
||||
var prevViewMode = mCurrentViewMode;
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
//OnGUI_ToggleEnumBig( "Spreadsheets", ref mCurrentViewMode, eViewMode.ImportExport, GUI.skin.GetStyle("CN EntryWarn").normal.background, "External Spreadsheet File or Service" );
|
||||
OnGUI_ToggleEnumBig( "表格 Spreadsheets", ref mCurrentViewMode, eViewMode.ImportExport, null, "外部电子表格文件或服务\nExternal Spreadsheet File or Service" );
|
||||
OnGUI_ToggleEnumBig( "术语 Terms", ref mCurrentViewMode, eViewMode.Keys, null, null );
|
||||
OnGUI_ToggleEnumBig( "语言 Languages", ref mCurrentViewMode, eViewMode.Languages, null, null );
|
||||
OnGUI_ToggleEnumBig( "工具 Tools", ref mCurrentViewMode, eViewMode.Tools, null, null );
|
||||
OnGUI_ToggleEnumBig( "资源 Assets", ref mCurrentViewMode, eViewMode.References, null, null );
|
||||
GUILayout.EndHorizontal();
|
||||
//GUILayout.Space(10);
|
||||
|
||||
switch (mCurrentViewMode)
|
||||
{
|
||||
case eViewMode.ImportExport : OnGUI_ImportExport(); break;
|
||||
case eViewMode.Keys : OnGUI_KeysList(); break;
|
||||
case eViewMode.Languages : OnGUI_Languages(); break;
|
||||
case eViewMode.Tools : OnGUI_Tools(prevViewMode != mCurrentViewMode); break;
|
||||
case eViewMode.References : OnGUI_References(); break;
|
||||
}
|
||||
}
|
||||
|
||||
void OnGUI_ImportExport()
|
||||
{
|
||||
eSpreadsheetMode OldMode = mSpreadsheetMode;
|
||||
mSpreadsheetMode = (eSpreadsheetMode)GUITools.DrawShadowedTabs ((int)mSpreadsheetMode, new[]{"Local", "Google"});
|
||||
if (mSpreadsheetMode != OldMode)
|
||||
ClearErrors();
|
||||
|
||||
GUITools.BeginContents();
|
||||
switch (mSpreadsheetMode)
|
||||
{
|
||||
case eSpreadsheetMode.Local : OnGUI_Spreadsheet_Local(); break;
|
||||
case eSpreadsheetMode.Google : OnGUI_Spreadsheet_Google(); break;
|
||||
}
|
||||
GUITools.EndContents(false);
|
||||
}
|
||||
|
||||
void OnGUI_References()
|
||||
{
|
||||
EditorGUILayout.HelpBox("这些是由Terms引用的资产,而不是在Resources文件夹中 \nThese are the assets that are referenced by the Terms and not in the Resources folder", MessageType.Info);
|
||||
|
||||
bool canTest = Event.current.type == EventType.Repaint;
|
||||
|
||||
var testAddObj = canTest && mTestAction == eTest_ActionType.Button_Assets_Add ? (Object)mTestActionArg : null;
|
||||
var testReplaceIndx = canTest && mTestAction == eTest_ActionType.Button_Assets_Replace ? (int)mTestActionArg : -1;
|
||||
var testReplaceObj = canTest && mTestAction == eTest_ActionType.Button_Assets_Replace ? (Object)mTestActionArg2 : null;
|
||||
var testDeleteIndx = canTest && mTestAction == eTest_ActionType.Button_Assets_Delete ? (int)mTestActionArg : -1;
|
||||
|
||||
bool changed = GUITools.DrawObjectsArray( mProp_Assets, false, false, false, testAddObj, testReplaceObj, testReplaceIndx, testDeleteIndx);
|
||||
if (changed)
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
foreach (var obj in serializedObject.targetObjects)
|
||||
(obj as LanguageSource).mSource.UpdateAssetDictionary();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Misc
|
||||
|
||||
void OnGUI_ToggleEnumBig<Enum>( string text, ref Enum currentMode, Enum newMode, Texture texture, string tooltip) { OnGUI_ToggleEnum( text, ref currentMode, newMode, texture, tooltip, Style_ToolBarButton_Big); }
|
||||
void OnGUI_ToggleEnumSmall<Enum>( string text, ref Enum currentMode, Enum newMode, Texture texture, string tooltip) { OnGUI_ToggleEnum( text, ref currentMode, newMode, texture, tooltip, EditorStyles.toolbarButton); }
|
||||
void OnGUI_ToggleEnum<Enum>( string text, ref Enum currentMode, Enum newMode, Texture texture, string tooltip, GUIStyle style)
|
||||
{
|
||||
GUI.changed = false;
|
||||
if (GUILayout.Toggle( currentMode.Equals(newMode), new GUIContent(text, texture, tooltip), style, GUILayout.ExpandWidth(true)))
|
||||
{
|
||||
currentMode = newMode;
|
||||
if (GUI.changed)
|
||||
ClearErrors();
|
||||
}
|
||||
}
|
||||
|
||||
int OnGUI_FlagToogle( string Text, string tooltip, int flags, int bit )
|
||||
{
|
||||
bool State = (flags & bit)>0;
|
||||
bool NewState = GUILayout.Toggle(State, new GUIContent(Text, tooltip), "toolbarbutton");
|
||||
if (State!=NewState)
|
||||
{
|
||||
if (!NewState && flags==bit)
|
||||
return flags;
|
||||
|
||||
flags = NewState ? flags | bit : flags & ~bit;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
void OnGUI_SelectableToogleListItem( string Element, ref List<string> Selections, string Style )
|
||||
{
|
||||
bool WasEnabled = Selections.Contains(Element);
|
||||
bool IsEnabled = GUILayout.Toggle( WasEnabled, "", Style, GUILayout.ExpandWidth(false) );
|
||||
|
||||
if (IsEnabled && !WasEnabled)
|
||||
Selections.Add(Element);
|
||||
else
|
||||
if (!IsEnabled && WasEnabled)
|
||||
Selections.Remove(Element);
|
||||
}
|
||||
|
||||
void OnGUI_SelectableToogleListItem( Rect rect, string Element, ref List<string> Selections, string Style )
|
||||
{
|
||||
bool WasEnabled = Selections.Contains(Element);
|
||||
bool IsEnabled = GUI.Toggle( rect, WasEnabled, "", Style );
|
||||
|
||||
if (IsEnabled && !WasEnabled)
|
||||
Selections.Add(Element);
|
||||
else
|
||||
if (!IsEnabled && WasEnabled)
|
||||
Selections.Remove(Element);
|
||||
}
|
||||
|
||||
static bool InTestAction( eTest_ActionType testType )
|
||||
{
|
||||
return mTestAction == testType && Event.current.type == EventType.Repaint;
|
||||
}
|
||||
static bool TestButton(eTest_ActionType action, string text, GUIStyle style, params GUILayoutOption[] options)
|
||||
{
|
||||
return GUILayout.Button(text, style, options) || mTestAction == action && Event.current.type == EventType.Repaint;
|
||||
}
|
||||
|
||||
static bool TestButtonArg(eTest_ActionType action, object arg, string text, GUIStyle style, params GUILayoutOption[] options)
|
||||
{
|
||||
return GUILayout.Button(text, style, options) || mTestAction == action && (mTestActionArg==null || mTestActionArg.Equals(arg)) && Event.current.type == EventType.Repaint;
|
||||
}
|
||||
|
||||
|
||||
static bool TestButton(eTest_ActionType action, GUIContent text, GUIStyle style, params GUILayoutOption[] options)
|
||||
{
|
||||
return GUILayout.Button(text, style, options) || mTestAction == action && Event.current.type == EventType.Repaint;
|
||||
}
|
||||
|
||||
static bool TestButtonArg(eTest_ActionType action, object arg, GUIContent text, GUIStyle style, params GUILayoutOption[] options)
|
||||
{
|
||||
return GUILayout.Button(text, style, options) || mTestAction == action && (mTestActionArg == null || mTestActionArg.Equals(arg)) && Event.current.type == EventType.Repaint;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Error Management
|
||||
|
||||
static void OnGUI_ShowMsg()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(mLocalizationMsg))
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
EditorGUILayout.HelpBox(mLocalizationMsg, mLocalizationMessageType);
|
||||
|
||||
GUILayout.Space(-5);
|
||||
GUILayout.BeginVertical(GUILayout.Width(15), GUILayout.ExpandHeight(false));
|
||||
GUILayout.Space(15);
|
||||
if (GUILayout.Button("X", GUILayout.ExpandWidth(false)))
|
||||
ClearErrors();
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space(8);
|
||||
}
|
||||
}
|
||||
|
||||
static void ShowError ( string Error, bool ShowInConsole = true ) { ShowMessage ( Error, MessageType.Error, ShowInConsole ); }
|
||||
static void ShowInfo ( string Msg, bool ShowInConsole = false ) { ShowMessage ( Msg, MessageType.Info, ShowInConsole ); }
|
||||
static void ShowWarning( string Msg, bool ShowInConsole = true) { ShowMessage ( Msg, MessageType.Warning, ShowInConsole ); }
|
||||
|
||||
static void ShowMessage( string Msg, MessageType msgType, bool ShowInConsole )
|
||||
{
|
||||
if (string.IsNullOrEmpty(Msg))
|
||||
Msg = string.Empty;
|
||||
|
||||
mLocalizationMsg = Msg;
|
||||
mLocalizationMessageType = msgType;
|
||||
if (ShowInConsole)
|
||||
{
|
||||
switch (msgType)
|
||||
{
|
||||
case MessageType.Error : Debug.LogError(Msg); break;
|
||||
case MessageType.Warning : Debug.LogWarning(Msg); break;
|
||||
default : Debug.Log(Msg); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void ClearErrors()
|
||||
{
|
||||
GUI.FocusControl(null);
|
||||
|
||||
mLocalizationMsg = string.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Unity Version branching
|
||||
|
||||
public static string Editor_GetCurrentScene()
|
||||
{
|
||||
#if UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2
|
||||
return EditorApplication.currentScene;
|
||||
#else
|
||||
return SceneManager.GetActiveScene().path;
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void Editor_MarkSceneDirty()
|
||||
{
|
||||
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
|
||||
EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
|
||||
#else
|
||||
EditorApplication.MarkSceneDirty();
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void Editor_SaveScene(bool force=false)
|
||||
{
|
||||
if (force)
|
||||
Editor_MarkSceneDirty();
|
||||
|
||||
#if UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2
|
||||
EditorApplication.SaveScene ();
|
||||
#else
|
||||
EditorSceneManager.SaveOpenScenes();
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void Editor_OpenScene( string sceneName )
|
||||
{
|
||||
#if UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2
|
||||
if (string.IsNullOrEmpty(sceneName))
|
||||
EditorApplication.NewEmptyScene();
|
||||
else
|
||||
EditorApplication.OpenScene(sceneName);
|
||||
#else
|
||||
if (string.IsNullOrEmpty(sceneName))
|
||||
EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects, NewSceneMode.Single);
|
||||
else
|
||||
EditorSceneManager.OpenScene(sceneName);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ffd53aaaf6936407d8b087583b0626e9
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,477 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace I2.Loc
|
||||
{
|
||||
public partial class LocalizationEditor
|
||||
{
|
||||
#region Variables
|
||||
private List<string> mTranslationTerms = new List<string>();
|
||||
private Dictionary<string, TranslationQuery> mTranslationRequests = new Dictionary<string, TranslationQuery> ();
|
||||
private bool mAppNameTerm_Expanded;
|
||||
|
||||
private List<string> mLanguageCodePopupList;
|
||||
|
||||
#endregion
|
||||
|
||||
void OnGUI_Languages()
|
||||
{
|
||||
//GUILayout.Space(5);
|
||||
|
||||
OnGUI_ShowMsg();
|
||||
|
||||
OnGUI_LanguageList();
|
||||
|
||||
OnGUI_StoreIntegration();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label(new GUIContent("论翻译缺失 On Missing Translation:", "当一个术语还没有翻译成当前语言时,游戏中应该发生什么\nWhat should happen IN-GAME when a term is not yet translated to the current language?"), EditorStyles.boldLabel, GUILayout.Width(200));
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Space(7);
|
||||
EditorGUILayout.PropertyField(mProp_OnMissingTranslation, GUITools.EmptyContent, GUILayout.Width(165));
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label(new GUIContent("在运行时卸载语言 Unload Languages At Runtime:", "当玩游戏时,插件将卸载所有未使用的语言,只在需要时加载它们\nWhen playing the game, the plugin will unload all unused languages and only load them when needed"), EditorStyles.boldLabel, GUILayout.Width(200));
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Space(7);
|
||||
EditorGUILayout.PropertyField(mProp_AllowUnloadingLanguages, GUITools.EmptyContent, GUILayout.Width(165));
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
|
||||
|
||||
|
||||
string firstLanguage = "";
|
||||
if (mLanguageSource.mLanguages.Count > 0)
|
||||
firstLanguage = " (" + mLanguageSource.mLanguages [0].Name + ")";
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label(new GUIContent("默认语言:Default Language:", "当游戏开始时,这是将被使用的语言,直到玩家手动选择语言\nWhen the game starts this is the language that will be used until the player manually selects a language"), EditorStyles.boldLabel, GUILayout.Width(160));
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Space(7);
|
||||
|
||||
mProp_IgnoreDeviceLanguage.boolValue = EditorGUILayout.Popup(mProp_IgnoreDeviceLanguage.boolValue?1:0, new[]{"Device Language", "First in List"+firstLanguage}, GUILayout.ExpandWidth(true))==1;
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
#region GUI Languages
|
||||
|
||||
void OnGUI_LanguageList()
|
||||
{
|
||||
GUILayout.BeginHorizontal(EditorStyles.toolbar);
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Label ("Languages:", EditorStyles.miniLabel, GUILayout.ExpandWidth(false));
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Label ("Code:", EditorStyles.miniLabel);
|
||||
GUILayout.Space(170);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
//--[ Language List ]--------------------------
|
||||
|
||||
int IndexLanguageToDelete = -1;
|
||||
int LanguageToMoveUp = -1;
|
||||
int LanguageToMoveDown = -1;
|
||||
GUI.backgroundColor = Color.Lerp(GUITools.LightGray, Color.white, 0.5f);
|
||||
mScrollPos_Languages = GUILayout.BeginScrollView( mScrollPos_Languages, LocalizeInspector.GUIStyle_OldTextArea, GUILayout.MinHeight (200), /*GUILayout.MaxHeight(Screen.height),*/ GUILayout.ExpandHeight(false));
|
||||
GUI.backgroundColor = Color.white;
|
||||
|
||||
if (mLanguageCodePopupList == null || mLanguageCodePopupList.Count==0)
|
||||
{
|
||||
mLanguageCodePopupList = GoogleLanguages.GetLanguagesForDropdown("", "");
|
||||
mLanguageCodePopupList.Sort();
|
||||
mLanguageCodePopupList.Insert(0, string.Empty);
|
||||
}
|
||||
|
||||
for (int i=0, imax=mProp_Languages.arraySize; i<imax; ++i)
|
||||
{
|
||||
SerializedProperty Prop_Lang = mProp_Languages.GetArrayElementAtIndex(i);
|
||||
SerializedProperty Prop_LangName = Prop_Lang.FindPropertyRelative("Name");
|
||||
SerializedProperty Prop_LangCode = Prop_Lang.FindPropertyRelative("Code");
|
||||
SerializedProperty Prop_Flags = Prop_Lang.FindPropertyRelative("Flags");
|
||||
bool isLanguageEnabled = (Prop_Flags.intValue & (int)eLanguageDataFlags.DISABLED)==0;
|
||||
|
||||
GUI.color = isLanguageEnabled ? Color.white : new Color(1, 1, 1, 0.3f);
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
if (GUILayout.Button ("X", "toolbarbutton", GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
IndexLanguageToDelete = i;
|
||||
}
|
||||
|
||||
GUILayout.BeginHorizontal(EditorStyles.toolbar);
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
string LanName = EditorGUILayout.TextField(Prop_LangName.stringValue, GUILayout.ExpandWidth(true));
|
||||
if (EditorGUI.EndChangeCheck() && !string.IsNullOrEmpty(LanName))
|
||||
{
|
||||
Prop_LangName.stringValue = LanName;
|
||||
}
|
||||
|
||||
var currentCode = "[" + Prop_LangCode.stringValue + "]";
|
||||
|
||||
if (isLanguageEnabled)
|
||||
{
|
||||
int Index = Mathf.Max(0, mLanguageCodePopupList.FindIndex(c => c.Contains(currentCode)));
|
||||
EditorGUI.BeginChangeCheck();
|
||||
Index = EditorGUILayout.Popup(Index, mLanguageCodePopupList.ToArray(), EditorStyles.toolbarPopup, GUILayout.Width(60));
|
||||
if (EditorGUI.EndChangeCheck() && Index >= 0)
|
||||
{
|
||||
currentCode = mLanguageCodePopupList[Index];
|
||||
int i0 = currentCode.IndexOf("[");
|
||||
int i1 = currentCode.IndexOf("]");
|
||||
if (i0 >= 0 && i1 > i0)
|
||||
Prop_LangCode.stringValue = currentCode.Substring(i0 + 1, i1 - i0 - 1);
|
||||
else
|
||||
Prop_LangCode.stringValue = string.Empty;
|
||||
}
|
||||
var rect = GUILayoutUtility.GetLastRect();
|
||||
GUI.Label(rect, Prop_LangCode.stringValue, EditorStyles.toolbarPopup);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Label(Prop_LangCode.stringValue, EditorStyles.toolbarPopup, GUILayout.Width(60));
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUI.enabled = i<imax-1;
|
||||
if (GUILayout.Button( "\u25BC", EditorStyles.toolbarButton, GUILayout.Width(18))) LanguageToMoveDown = i;
|
||||
GUI.enabled = i>0;
|
||||
if (GUILayout.Button( "\u25B2", EditorStyles.toolbarButton, GUILayout.Width(18))) LanguageToMoveUp = i;
|
||||
|
||||
GUI.enabled = true;
|
||||
if (GUILayout.Button( new GUIContent("预览 Show", "预览该语言的所有本地化\nPreview all localizations into this language"), EditorStyles.toolbarButton, GUILayout.Width(35)))
|
||||
{
|
||||
LocalizationManager.SetLanguageAndCode( LanName, Prop_LangCode.stringValue, false, true);
|
||||
}
|
||||
|
||||
if (TestButtonArg( eTest_ActionType.Button_Languages_TranslateAll, i, new GUIContent("翻译 Translate", "翻译所有空词\nTranslate all empty terms"), EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
GUITools.DelayedCall( () => TranslateAllToLanguage(LanName));
|
||||
}
|
||||
GUI.enabled = true;
|
||||
GUI.color = Color.white;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
isLanguageEnabled = EditorGUILayout.Toggle(isLanguageEnabled, GUILayout.Width(15));
|
||||
|
||||
var r = GUILayoutUtility.GetLastRect();
|
||||
GUI.Label(r, new GUIContent("", "启用/禁用语言\nEnable/Disable the language.\n禁用语言可用于存储数据值或避免显示仍在开发中的语言\nDisabled languages can be used to store data values or to avoid showing Languages that are stil under development"));
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
Prop_Flags.intValue = (Prop_Flags.intValue & ~(int)eLanguageDataFlags.DISABLED) | (isLanguageEnabled ? 0 : (int)eLanguageDataFlags.DISABLED);
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
GUILayout.EndScrollView();
|
||||
|
||||
OnGUI_AddLanguage( mProp_Languages );
|
||||
|
||||
if (mConnection_WWW!=null || mConnection_Text.Contains("Translating"))
|
||||
{
|
||||
// Connection Status Bar
|
||||
int time = (int)(Time.realtimeSinceStartup % 2 * 2.5);
|
||||
string Loading = mConnection_Text + ".....".Substring(0, time);
|
||||
GUI.color = Color.gray;
|
||||
GUILayout.BeginHorizontal(LocalizeInspector.GUIStyle_OldTextArea);
|
||||
GUILayout.Label (Loading, EditorStyles.miniLabel);
|
||||
GUI.color = Color.white;
|
||||
if (GUILayout.Button("Cancel", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
GoogleTranslation.CancelCurrentGoogleTranslations ();
|
||||
StopConnectionWWW();
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
Repaint();
|
||||
}
|
||||
|
||||
if (IndexLanguageToDelete>=0)
|
||||
{
|
||||
if (EditorUtility.DisplayDialog ("确认删除 Confirm delete", "您确定要删除所选语言吗\nAre you sure you want to delete the selected language", "Yes", "Cancel"))
|
||||
{
|
||||
mLanguageSource.RemoveLanguage (mLanguageSource.mLanguages [IndexLanguageToDelete].Name);
|
||||
serializedObject.Update ();
|
||||
ParseTerms (true, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (LanguageToMoveUp>=0) SwapLanguages( LanguageToMoveUp, LanguageToMoveUp-1 );
|
||||
if (LanguageToMoveDown>=0) SwapLanguages( LanguageToMoveDown, LanguageToMoveDown+1 );
|
||||
}
|
||||
|
||||
void SwapLanguages( int iFirst, int iSecond )
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
LanguageSourceData Source = mLanguageSource;
|
||||
|
||||
SwapValues( Source.mLanguages, iFirst, iSecond );
|
||||
foreach (TermData termData in Source.mTerms)
|
||||
{
|
||||
SwapValues ( termData.Languages, iFirst, iSecond );
|
||||
SwapValues ( termData.Flags, iFirst, iSecond );
|
||||
}
|
||||
serializedObject.Update();
|
||||
}
|
||||
|
||||
void SwapValues( List<LanguageData> mList, int Index1, int Index2 )
|
||||
{
|
||||
LanguageData temp = mList[Index1];
|
||||
mList[Index1] = mList[Index2];
|
||||
mList[Index2] = temp;
|
||||
}
|
||||
void SwapValues( string[] mList, int Index1, int Index2 )
|
||||
{
|
||||
string temp = mList[Index1];
|
||||
mList[Index1] = mList[Index2];
|
||||
mList[Index2] = temp;
|
||||
}
|
||||
void SwapValues( byte[] mList, int Index1, int Index2 )
|
||||
{
|
||||
byte temp = mList[Index1];
|
||||
mList[Index1] = mList[Index2];
|
||||
mList[Index2] = temp;
|
||||
}
|
||||
|
||||
|
||||
void OnGUI_AddLanguage( SerializedProperty Prop_Languages)
|
||||
{
|
||||
//--[ Add Language Upper Toolbar ]-----------------
|
||||
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal(EditorStyles.toolbar);
|
||||
mLanguages_NewLanguage = EditorGUILayout.TextField("", mLanguages_NewLanguage, EditorStyles.toolbarTextField, GUILayout.ExpandWidth(true));
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUI.enabled = !string.IsNullOrEmpty (mLanguages_NewLanguage);
|
||||
if (TestButton(eTest_ActionType.Button_AddLanguageManual,"Add", EditorStyles.toolbarButton, GUILayout.Width(50)))
|
||||
{
|
||||
Prop_Languages.serializedObject.ApplyModifiedProperties();
|
||||
mLanguageSource.AddLanguage( mLanguages_NewLanguage, GoogleLanguages.GetLanguageCode(mLanguages_NewLanguage) );
|
||||
Prop_Languages.serializedObject.Update();
|
||||
mLanguages_NewLanguage = "";
|
||||
GUI.FocusControl(string.Empty);
|
||||
}
|
||||
GUI.enabled = true;
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
|
||||
//--[ Add Language Bottom Toolbar ]-----------------
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
//-- Language Dropdown -----------------
|
||||
string CodesToExclude = string.Empty;
|
||||
foreach (var LanData in mLanguageSource.mLanguages)
|
||||
CodesToExclude = string.Concat(CodesToExclude, "[", LanData.Code, "]");
|
||||
|
||||
List<string> Languages = GoogleLanguages.GetLanguagesForDropdown(mLanguages_NewLanguage, CodesToExclude);
|
||||
|
||||
GUI.changed = false;
|
||||
int index = EditorGUILayout.Popup(0, Languages.ToArray(), EditorStyles.toolbarDropDown);
|
||||
|
||||
if (GUI.changed && index>=0)
|
||||
{
|
||||
mLanguages_NewLanguage = GoogleLanguages.GetFormatedLanguageName( Languages[index] );
|
||||
}
|
||||
|
||||
|
||||
if (TestButton(eTest_ActionType.Button_AddLanguageFromPopup, "Add", EditorStyles.toolbarButton, GUILayout.Width(50)) && index>=0)
|
||||
{
|
||||
Prop_Languages.serializedObject.ApplyModifiedProperties();
|
||||
mLanguages_NewLanguage = GoogleLanguages.GetFormatedLanguageName(Languages[index]);
|
||||
|
||||
if (!string.IsNullOrEmpty(mLanguages_NewLanguage))
|
||||
mLanguageSource.AddLanguage(mLanguages_NewLanguage, GoogleLanguages.GetLanguageCode(mLanguages_NewLanguage));
|
||||
Prop_Languages.serializedObject.Update();
|
||||
|
||||
mLanguages_NewLanguage = "";
|
||||
GUI.FocusControl(string.Empty);
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
GUI.color = Color.white;
|
||||
}
|
||||
|
||||
|
||||
void TranslateAllToLanguage (string lanName)
|
||||
{
|
||||
if (!GoogleTranslation.CanTranslate ())
|
||||
{
|
||||
ShowError ("WebService设置不正确或需要重新安装。\nWebService is not set correctly or needs to be reinstalled");
|
||||
return;
|
||||
}
|
||||
ClearErrors();
|
||||
int LanIndex = mLanguageSource.GetLanguageIndex (lanName);
|
||||
string code = mLanguageSource.mLanguages [LanIndex].Code;
|
||||
string googleCode = GoogleLanguages.GetGoogleLanguageCode(code);
|
||||
if (string.IsNullOrEmpty(googleCode))
|
||||
{
|
||||
ShowError("Language '" + code + "' 不支持谷歌翻译 is not supported by google translate");
|
||||
return;
|
||||
}
|
||||
googleCode = code;
|
||||
|
||||
mTranslationTerms.Clear ();
|
||||
mTranslationRequests.Clear ();
|
||||
foreach (var termData in mLanguageSource.mTerms)
|
||||
{
|
||||
if (termData.TermType != eTermType.Text)
|
||||
continue;
|
||||
|
||||
if (!string.IsNullOrEmpty(termData.Languages[LanIndex]))
|
||||
continue;
|
||||
|
||||
string sourceCode, sourceText;
|
||||
FindTranslationSource( LanguageSourceData.GetKeyFromFullTerm(termData.Term), termData, code, null, out sourceText, out sourceCode );
|
||||
|
||||
mTranslationTerms.Add (termData.Term);
|
||||
|
||||
GoogleTranslation.CreateQueries(sourceText, sourceCode, googleCode, mTranslationRequests); // can split plurals into several queries
|
||||
}
|
||||
|
||||
if (mTranslationRequests.Count == 0)
|
||||
{
|
||||
StopConnectionWWW ();
|
||||
return;
|
||||
}
|
||||
|
||||
mConnection_WWW = null;
|
||||
mConnection_Text = "Translating"; if (mTranslationRequests.Count > 1) mConnection_Text += " (" + mTranslationRequests.Count + ")";
|
||||
mConnection_Callback = null;
|
||||
//EditorApplication.update += CheckForConnection;
|
||||
|
||||
GoogleTranslation.Translate (mTranslationRequests, OnLanguageTranslated);
|
||||
}
|
||||
|
||||
void OnLanguageTranslated( Dictionary<string, TranslationQuery> requests, string Error )
|
||||
{
|
||||
//Debug.Log (Result);
|
||||
|
||||
//if (Result.Contains("Service invoked too many times"))
|
||||
//{
|
||||
// TimeStartTranslation = EditorApplication.timeSinceStartup + 1;
|
||||
// EditorApplication.update += DelayedStartTranslation;
|
||||
// mConnection_Text = "Translating (" + mTranslationRequests.Count + ")";
|
||||
// return;
|
||||
//}
|
||||
|
||||
//if (!string.IsNullOrEmpty(Error))/* || !Result.Contains("<i2>")*/
|
||||
//{
|
||||
// Debug.LogError("WEB ERROR: " + Error);
|
||||
// ShowError ("Unable to access Google or not valid request");
|
||||
// return;
|
||||
//}
|
||||
|
||||
ClearErrors();
|
||||
StopConnectionWWW();
|
||||
|
||||
if (!string.IsNullOrEmpty(Error))
|
||||
{
|
||||
ShowError (Error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (requests.Values.Count == 0)
|
||||
return;
|
||||
|
||||
var langCode = requests.Values.First().TargetLanguagesCode [0];
|
||||
//langCode = GoogleLanguages.GetGoogleLanguageCode(langCode);
|
||||
int langIndex = mLanguageSource.GetLanguageIndexFromCode (langCode, false);
|
||||
//if (langIndex >= 0)
|
||||
{
|
||||
foreach (var term in mTranslationTerms)
|
||||
{
|
||||
var termData = mLanguageSource.GetTermData(term);
|
||||
if (termData == null)
|
||||
continue;
|
||||
if (termData.TermType != eTermType.Text)
|
||||
continue;
|
||||
//if (termData.Languages.Length <= langIndex)
|
||||
// continue;
|
||||
|
||||
string sourceCode, sourceText;
|
||||
FindTranslationSource(LanguageSourceData.GetKeyFromFullTerm(termData.Term), termData, langCode, null, out sourceText, out sourceCode);
|
||||
|
||||
string result = GoogleTranslation.RebuildTranslation(sourceText, mTranslationRequests, langCode); // gets the result from google and rebuilds the text from multiple queries if its is plurals
|
||||
|
||||
termData.Languages[langIndex] = result;
|
||||
}
|
||||
}
|
||||
|
||||
mTranslationTerms.Clear ();
|
||||
mTranslationRequests.Clear ();
|
||||
StopConnectionWWW ();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Store Integration
|
||||
|
||||
void OnGUI_StoreIntegration()
|
||||
{
|
||||
GUIStyle lstyle = new GUIStyle (EditorStyles.label);
|
||||
lstyle.richText = true;
|
||||
|
||||
GUILayout.BeginHorizontal ();
|
||||
GUILayout.Label (new GUIContent("Store Integration:", "设置商店来检测游戏的本地化,Android为每种语言添加字符串xml。Ios修改了Info列表\nSetups the stores to detect that the game has localization, Android adds strings.xml for each language. IOS modifies the Info.plist"), EditorStyles.boldLabel, GUILayout.Width(160));
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
GUILayout.Label( new GUIContent( "<color=green><size=16>\u2713</size></color> IOS", "Setups the stores to show in iTunes and the Appstore all the languages that this app supports, also localizes the app name if available" ), lstyle, GUILayout.Width( 90 ) );
|
||||
GUILayout.Label( new GUIContent( "<color=green><size=16>\u2713</size></color> Android", "Setups the stores to show in GooglePlay all the languages this app supports, also localizes the app name if available" ), lstyle, GUILayout.Width( 90 ) );
|
||||
GUILayout.EndHorizontal ();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
mAppNameTerm_Expanded = GUILayout.Toggle(mAppNameTerm_Expanded, new GUIContent( "应用名称翻译:\nApp Name translations:", "根据设备的语言,游戏应该如何命名\nHow should the game be named in the devices based on their language" ), EditorStyles.foldout, GUILayout.Width( 160 ) );
|
||||
|
||||
GUILayout.Label("", GUILayout.ExpandWidth(true));
|
||||
var rect = GUILayoutUtility.GetLastRect();
|
||||
TermsPopup_Drawer.ShowGUI( rect, mProp_AppNameTerm, GUITools.EmptyContent, mLanguageSource);
|
||||
|
||||
if (GUILayout.Button("New Term", EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
AddLocalTerm("App_Name");
|
||||
mProp_AppNameTerm.stringValue = "App_Name";
|
||||
mAppNameTerm_Expanded = true;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
if (mAppNameTerm_Expanded)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Space(10);
|
||||
|
||||
GUILayout.BeginVertical("Box");
|
||||
var termName = mProp_AppNameTerm.stringValue;
|
||||
if (!string.IsNullOrEmpty(termName))
|
||||
{
|
||||
var termData = LocalizationManager.GetTermData(termName);
|
||||
if (termData != null)
|
||||
OnGUI_Keys_Languages(mProp_AppNameTerm.stringValue, ref termData, null, true, mLanguageSource);
|
||||
}
|
||||
GUILayout.Space(10);
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("<b>Default App Name:</b>", lstyle, GUITools.DontExpandWidth);
|
||||
GUILayout.Label(Application.productName);
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 304783c1e95d94a598aecd17728c8556
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,717 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using I2.Loc.SimpleJSON;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
namespace I2.Loc
|
||||
{
|
||||
public partial class LocalizationEditor
|
||||
{
|
||||
#region Variables
|
||||
|
||||
public static Dictionary<string, string> mGoogleSpreadsheets = new Dictionary<string, string>(StringComparer.Ordinal);
|
||||
|
||||
public UnityWebRequest mConnection_WWW;
|
||||
|
||||
delegate void fnConnectionCallback(string Result, string Error);
|
||||
event fnConnectionCallback mConnection_Callback;
|
||||
//float mConnection_TimeOut;
|
||||
|
||||
string mConnection_Text = string.Empty;
|
||||
|
||||
string mWebService_Status;
|
||||
|
||||
#endregion
|
||||
|
||||
#region GUI
|
||||
|
||||
void OnGUI_Spreadsheet_Google()
|
||||
{
|
||||
GUILayout.Space(20);
|
||||
|
||||
#if UNITY_WEBPLAYER
|
||||
mConnection_Text = string.Empty;
|
||||
EditorGUILayout.HelpBox("在WebPlayer模式下不支持Google同步\nGoogle Synchronization is not supported when in WebPlayer mode." + mConnection_Text, MessageType.Info);
|
||||
|
||||
mProp_GoogleUpdateFrequency.enumValueIndex = mProp_GoogleUpdateFrequency.enumValueIndex; // to avoid the warning "unused"
|
||||
mProp_GoogleUpdateSynchronization.enumValueIndex = mProp_GoogleUpdateSynchronization.enumValueIndex;
|
||||
#else
|
||||
|
||||
OnGUI_GoogleCredentials();
|
||||
|
||||
OnGUI_ShowMsg();
|
||||
|
||||
if (string.IsNullOrEmpty(mProp_Google_WebServiceURL.stringValue))
|
||||
return;
|
||||
|
||||
if (mWebService_Status == "Offline")
|
||||
return;
|
||||
|
||||
GUILayout.Space(20);
|
||||
|
||||
GUI.backgroundColor = Color.Lerp(Color.gray, Color.white, 0.5f);
|
||||
GUILayout.BeginVertical(LocalizeInspector.GUIStyle_OldTextArea, GUILayout.Height (1));
|
||||
GUI.backgroundColor = Color.white;
|
||||
GUILayout.Space(10);
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label(new GUIContent(" Password", "This should match the value of the LocalizationPassword variable in the WebService Script in your Google Drive"), GUILayout.Width(108));
|
||||
mProp_Google_Password.stringValue = EditorGUILayout.TextField(mProp_Google_Password.stringValue, GUILayout.ExpandWidth(true));
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
OnGUI_GoogleSpreadsheetsInGDrive();
|
||||
GUILayout.EndVertical();
|
||||
|
||||
if (mConnection_WWW!=null)
|
||||
{
|
||||
// Connection Status Bar
|
||||
int time = (int)(Time.realtimeSinceStartup % 2 * 2.5);
|
||||
string Loading = mConnection_Text + ".....".Substring(0, time);
|
||||
GUI.color = Color.gray;
|
||||
GUILayout.BeginHorizontal(LocalizeInspector.GUIStyle_OldTextArea);
|
||||
GUILayout.Label (Loading, EditorStyles.miniLabel);
|
||||
GUI.color = Color.white;
|
||||
if (GUILayout.Button("Cancel", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)))
|
||||
StopConnectionWWW();
|
||||
GUILayout.EndHorizontal();
|
||||
Repaint();
|
||||
}
|
||||
//else
|
||||
// GUILayout.Space(10);
|
||||
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
GUILayout.Space(5);
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
LanguageSourceData.eGoogleUpdateFrequency GoogleUpdateFrequency = (LanguageSourceData.eGoogleUpdateFrequency)mProp_GoogleUpdateFrequency.enumValueIndex;
|
||||
GoogleUpdateFrequency = (LanguageSourceData.eGoogleUpdateFrequency)EditorGUILayout.EnumPopup("Auto Update Frequency", GoogleUpdateFrequency, GUILayout.ExpandWidth(true));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
mProp_GoogleUpdateFrequency.enumValueIndex = (int)GoogleUpdateFrequency;
|
||||
}
|
||||
|
||||
GUILayout.Space(10);
|
||||
GUILayout.Label("Delay:");
|
||||
mProp_GoogleUpdateDelay.floatValue = EditorGUILayout.FloatField(mProp_GoogleUpdateDelay.floatValue, GUILayout.Width(30));
|
||||
GUILayout.Label("secs");
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
var GoogleInEditorCheckFrequency = (LanguageSourceData.eGoogleUpdateFrequency)mProp_GoogleInEditorCheckFrequency.enumValueIndex;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
GoogleInEditorCheckFrequency = (LanguageSourceData.eGoogleUpdateFrequency)EditorGUILayout.EnumPopup(new GUIContent("In-Editor Check Frequency", "How often the editor will verify that the Spreadsheet is up-to-date with the LanguageSource. Having un-synchronized Spreadsheets can lead to issues when playing in the device as the download data will override the one in the build"), GoogleInEditorCheckFrequency, GUILayout.ExpandWidth(false));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
mProp_GoogleInEditorCheckFrequency.enumValueIndex = (int)GoogleInEditorCheckFrequency;
|
||||
}
|
||||
GUILayout.Space(122);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Label("Update Synchronization", GUILayout.Width(180));
|
||||
EditorGUI.BeginChangeCheck();
|
||||
LanguageSourceData.eGoogleUpdateSynchronization GoogleUpdateSynchronization = (LanguageSourceData.eGoogleUpdateSynchronization)mProp_GoogleUpdateSynchronization.enumValueIndex;
|
||||
GoogleUpdateSynchronization = (LanguageSourceData.eGoogleUpdateSynchronization)EditorGUILayout.EnumPopup(GoogleUpdateSynchronization, GUILayout.Width(178));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
mProp_GoogleUpdateSynchronization.enumValueIndex = (int)GoogleUpdateSynchronization;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Space(5);
|
||||
|
||||
GUI.changed = false;
|
||||
bool OpenDataSourceAfterExport = EditorPrefs.GetBool("I2Loc OpenDataSourceAfterExport", true);
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
OpenDataSourceAfterExport = GUILayout.Toggle(OpenDataSourceAfterExport, "Open Spreadsheet after Export");
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
if (GUI.changed)
|
||||
{
|
||||
GUI.changed = false;
|
||||
EditorPrefs.SetBool("I2Loc OpenDataSourceAfterExport", OpenDataSourceAfterExport);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
GUILayout.Space(5);
|
||||
}
|
||||
|
||||
void OnGUI_GoogleCredentials()
|
||||
{
|
||||
GUI.enabled = mConnection_WWW==null;
|
||||
|
||||
GUI.changed = false;
|
||||
|
||||
string WebServiceHelp = "The web service is a script running on the google drive where the spreadsheet you want to use is located.\nThat script allows the game to synchronize the localization even after the game is published.";
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label (new GUIContent("Web Service URL:", WebServiceHelp), GUILayout.Width(110));
|
||||
|
||||
GUI.SetNextControlName ("WebServiceURL");
|
||||
mProp_Google_WebServiceURL.stringValue = EditorGUILayout.TextField(mProp_Google_WebServiceURL.stringValue);
|
||||
|
||||
if (!string.IsNullOrEmpty(mWebService_Status))
|
||||
{
|
||||
if (mWebService_Status=="Online")
|
||||
{
|
||||
GUI.color = Color.green;
|
||||
GUILayout.Label( "", GUILayout.Width(17));
|
||||
Rect r = GUILayoutUtility.GetLastRect(); r.xMin += 3; r.yMin-= 3; r.xMax+= 2; r.yMax+=2;
|
||||
GUI.Label( r, new GUIContent("\u2713", "Online"), EditorStyles.whiteLargeLabel);
|
||||
GUI.color = Color.white;
|
||||
}
|
||||
else
|
||||
if (mWebService_Status=="Offline")
|
||||
{
|
||||
GUI.color = Color.red;
|
||||
GUILayout.Label( "", GUILayout.Width(17));
|
||||
Rect r = GUILayoutUtility.GetLastRect(); r.xMin += 3; r.yMin-= 3; r.xMax+= 2; r.yMax+=2;
|
||||
GUI.Label( r, new GUIContent("\u2717", mWebService_Status), EditorStyles.whiteLargeLabel);
|
||||
GUI.color = Color.white;
|
||||
}
|
||||
else
|
||||
if (mWebService_Status=="UnsupportedVersion")
|
||||
{
|
||||
Rect rect = GUILayoutUtility.GetLastRect();
|
||||
float Width = 15;
|
||||
rect.xMin = rect.xMax+1;
|
||||
rect.xMax = rect.xMin + rect.height;
|
||||
GUITools.DrawSkinIcon(rect, "CN EntryWarnIcon", "CN EntryWarn");
|
||||
GUI.Label(rect, new GUIContent("\u2717", "The current Google WebService is not supported.\nPlease, delete the WebService from the Google Drive and Install the latest version."));
|
||||
GUILayout.Space (Width);
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Space (118);
|
||||
if (GUILayout.Button(new GUIContent("Install", "This opens the Web Service Script and shows you steps to install and authorize it on your Google Drive"), EditorStyles.toolbarButton))
|
||||
{
|
||||
ClearErrors();
|
||||
Application.OpenURL("https://script.google.com/d/1zcsLSmq3Oddd8AsLuoKNDG1Y0eYBOHzyvGT7v94u1oN6igmsZb_PJzEm/newcopy"); // V5
|
||||
//Application.OpenURL("https://goo.gl/RBCO0o"); // V4:https://script.google.com/d/1T7e5_40NcgRyind-yeg4PAkHz9TNZJ22F4RcbOvCpAs03JNf1vKNNTZB/newcopy
|
||||
//Application.OpenURL("https://goo.gl/wFSbv2");// V3:https://script.google.com/d/1CxQDSXflsXRaH3M7xGfrIDrFwOIHWPsYTWi4mRZ_k77nyIInTgIk63Kd/newcopy");
|
||||
}
|
||||
if (GUILayout.Button("Verify", EditorStyles.toolbarButton))
|
||||
{
|
||||
ClearErrors();
|
||||
VerifyGoogleService(mProp_Google_WebServiceURL.stringValue);
|
||||
GUI.changed = false;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(mProp_Google_WebServiceURL.stringValue))
|
||||
{
|
||||
EditorGUILayout.HelpBox(WebServiceHelp, MessageType.Info);
|
||||
}
|
||||
|
||||
if (GUI.changed)
|
||||
{
|
||||
if (string.IsNullOrEmpty(mProp_Google_WebServiceURL.stringValue))
|
||||
{
|
||||
mProp_Google_SpreadsheetKey.stringValue = string.Empty;
|
||||
mProp_Google_SpreadsheetName.stringValue = string.Empty;
|
||||
}
|
||||
|
||||
|
||||
// If the web service changed then clear the cached spreadsheet keys
|
||||
mGoogleSpreadsheets.Clear();
|
||||
|
||||
GUI.changed = false;
|
||||
ClearErrors();
|
||||
}
|
||||
GUI.enabled = true;
|
||||
}
|
||||
|
||||
void OnGUI_GoogleSpreadsheetsInGDrive()
|
||||
{
|
||||
GUI.enabled = mConnection_WWW==null;
|
||||
|
||||
string[] Spreadsheets;
|
||||
string[] SpreadsheetsKey;
|
||||
if (mGoogleSpreadsheets.Count>0 || string.IsNullOrEmpty(mProp_Google_SpreadsheetKey.stringValue))
|
||||
{
|
||||
Spreadsheets = new List<string>(mGoogleSpreadsheets.Keys).ToArray();
|
||||
SpreadsheetsKey = new List<string>(mGoogleSpreadsheets.Values).ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
Spreadsheets = new[]{mProp_Google_SpreadsheetName.stringValue ?? string.Empty};
|
||||
SpreadsheetsKey = new[]{mProp_Google_SpreadsheetKey.stringValue ?? string.Empty};
|
||||
}
|
||||
int mSpreadsheetIndex = Array.IndexOf(SpreadsheetsKey, mProp_Google_SpreadsheetKey.stringValue);
|
||||
|
||||
//--[ Spreadsheets ]------------------
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Space(10);
|
||||
GUILayout.Label ("In Google Drive:", GUILayout.Width(100));
|
||||
|
||||
GUI.changed = false;
|
||||
GUI.enabled = Spreadsheets != null && Spreadsheets.Length>0;
|
||||
mSpreadsheetIndex = EditorGUILayout.Popup(mSpreadsheetIndex, Spreadsheets, EditorStyles.toolbarPopup);
|
||||
if (GUI.changed && mSpreadsheetIndex >= 0)
|
||||
{
|
||||
mProp_Google_SpreadsheetKey.stringValue = SpreadsheetsKey[mSpreadsheetIndex];
|
||||
mProp_Google_SpreadsheetName.stringValue = Spreadsheets[mSpreadsheetIndex];
|
||||
GUI.changed = false;
|
||||
}
|
||||
GUI.enabled = true;
|
||||
|
||||
GUI.enabled = !string.IsNullOrEmpty(mProp_Google_SpreadsheetKey.stringValue) && mConnection_WWW==null;
|
||||
if (GUILayout.Button("X", EditorStyles.toolbarButton,GUILayout.ExpandWidth(false)))
|
||||
mProp_Google_SpreadsheetKey.stringValue = string.Empty;
|
||||
GUI.enabled = true;
|
||||
GUILayout.Space(10);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Space(2);
|
||||
|
||||
//--[ Spreadsheets Operations ]------------------
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Space(114);
|
||||
if (GUILayout.Button("New", EditorStyles.toolbarButton,GUILayout.ExpandWidth(true)))
|
||||
Google_NewSpreadsheet();
|
||||
|
||||
GUI.enabled = !string.IsNullOrEmpty(mProp_Google_SpreadsheetKey.stringValue) && mConnection_WWW==null;
|
||||
if (GUILayout.Button("Open", EditorStyles.toolbarButton,GUILayout.ExpandWidth(true)))
|
||||
OpenGoogleSpreadsheet(mProp_Google_SpreadsheetKey.stringValue);
|
||||
GUI.enabled = mConnection_WWW==null;
|
||||
|
||||
GUILayout.Space(5);
|
||||
|
||||
if (TestButton(eTest_ActionType.Button_GoogleSpreadsheet_RefreshList, "Refresh", EditorStyles.toolbarButton,GUILayout.ExpandWidth(true)))
|
||||
EditorApplication.update+=Google_FindSpreadsheets;
|
||||
|
||||
GUILayout.Space(10);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Space(15);
|
||||
|
||||
if (!string.IsNullOrEmpty(mProp_Google_SpreadsheetKey.stringValue))
|
||||
OnGUI_GoogleButtons_ImportExport( mProp_Google_SpreadsheetKey.stringValue );
|
||||
|
||||
GUI.enabled = true;
|
||||
}
|
||||
|
||||
|
||||
private void OnGUI_ImportButtons()
|
||||
{
|
||||
eSpreadsheetUpdateMode Mode = SynchronizationButtons("Import");
|
||||
if (Mode != eSpreadsheetUpdateMode.None || InTestAction(eTest_ActionType.Button_GoogleSpreadsheet_Import))
|
||||
{
|
||||
if (mTestAction == eTest_ActionType.Button_GoogleSpreadsheet_Import)
|
||||
Mode = (eSpreadsheetUpdateMode)mTestActionArg;
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
var modeCopy = Mode;
|
||||
GUITools.DelayedCall(() => Import_Google(modeCopy));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnGUI_ExportButtons()
|
||||
{
|
||||
eSpreadsheetUpdateMode Mode = SynchronizationButtons("Export");
|
||||
if (Mode != eSpreadsheetUpdateMode.None || InTestAction(eTest_ActionType.Button_GoogleSpreadsheet_Export))
|
||||
{
|
||||
if (mTestAction == eTest_ActionType.Button_GoogleSpreadsheet_Export)
|
||||
Mode = (eSpreadsheetUpdateMode)mTestActionArg;
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
var modeCopy = Mode;
|
||||
GUITools.DelayedCall(() => Export_Google(modeCopy));
|
||||
}
|
||||
}
|
||||
|
||||
void OnGUI_GoogleButtons_ImportExport( string SpreadsheetKey )
|
||||
{
|
||||
GUI.enabled = !string.IsNullOrEmpty(SpreadsheetKey) && mConnection_WWW==null;
|
||||
|
||||
bool vertical = EditorGUIUtility.currentViewWidth < 450;
|
||||
|
||||
if (vertical)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
OnGUI_ImportButtons();
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
OnGUI_ExportButtons();
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
OnGUI_ImportButtons();
|
||||
GUILayout.FlexibleSpace();
|
||||
OnGUI_ExportButtons();
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
EditorGUIUtility.labelWidth += 10;
|
||||
EditorGUILayout.PropertyField(mProp_Spreadsheet_SpecializationAsRows, new GUIContent("Show Specializations as Rows", "true: Make each specialization a separate row (e.g. Term[VR]..., Term[Touch]....\nfalse: Merge specializations into same cell separated by [i2s_XXX]"));
|
||||
EditorGUIUtility.labelWidth -= 10;
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space(10);
|
||||
|
||||
|
||||
GUI.enabled = true;
|
||||
}
|
||||
|
||||
eSpreadsheetUpdateMode SynchronizationButtons( string Operation, bool ForceReplace = false )
|
||||
{
|
||||
eSpreadsheetUpdateMode Result = eSpreadsheetUpdateMode.None;
|
||||
GUILayout.BeginVertical(LocalizeInspector.GUIStyle_OldTextArea, GUILayout.Width (1));
|
||||
GUI.backgroundColor = Color.white;
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Label(Operation, EditorStyles.miniLabel);
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button( "替换 Replace", EditorStyles.toolbarButton, GUILayout.Width(100)))
|
||||
Result = eSpreadsheetUpdateMode.Replace;
|
||||
|
||||
if (ForceReplace) GUI.enabled = false;
|
||||
if (GUILayout.Button( "合并 Merge", EditorStyles.toolbarButton, GUILayout.Width(100)))
|
||||
Result = eSpreadsheetUpdateMode.Merge;
|
||||
|
||||
if (GUILayout.Button( "新建 Add New", EditorStyles.toolbarButton, GUILayout.Width(100)))
|
||||
Result = eSpreadsheetUpdateMode.AddNewTerms;
|
||||
GUI.enabled = mConnection_WWW==null;
|
||||
GUILayout.Space(1);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Space(2);
|
||||
GUILayout.EndVertical();
|
||||
|
||||
if (Result != eSpreadsheetUpdateMode.None)
|
||||
ClearErrors();
|
||||
|
||||
return Result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
void VerifyGoogleService( string WebServiceURL )
|
||||
{
|
||||
#if UNITY_WEBPLAYER
|
||||
ShowError ("Contacting google translation is not yet supported on WebPlayer" );
|
||||
#else
|
||||
StopConnectionWWW();
|
||||
mWebService_Status = null;
|
||||
mConnection_WWW = UnityWebRequest.Get(WebServiceURL + "?action=Ping");
|
||||
I2Utils.SendWebRequest(mConnection_WWW);
|
||||
mConnection_Callback = OnVerifyGoogleService;
|
||||
EditorApplication.update += CheckForConnection;
|
||||
mConnection_Text = "Verifying Web Service";
|
||||
//mConnection_TimeOut = Time.realtimeSinceStartup + 10;
|
||||
#endif
|
||||
}
|
||||
|
||||
void OnVerifyGoogleService( string Result, string Error )
|
||||
{
|
||||
if (Result.Contains("Authorization is required to perform that action"))
|
||||
{
|
||||
ShowWarning("You need to authorize the webservice before using it. Check the steps 4 and 5 in the WebService Script");
|
||||
mWebService_Status = "Offline";
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var data = JSON.Parse(Result).AsObject;
|
||||
int version = 0;
|
||||
if (!int.TryParse(data["script_version"], out version))
|
||||
version = 0;
|
||||
int requiredVersion = LocalizationManager.GetRequiredWebServiceVersion();
|
||||
|
||||
if (requiredVersion == version)
|
||||
{
|
||||
mWebService_Status = "Online";
|
||||
ClearErrors();
|
||||
}
|
||||
else
|
||||
{
|
||||
mWebService_Status = "UnsupportedVersion";
|
||||
ShowError("The current Google WebService is not supported.\nPlease, delete the WebService from the Google Drive and Install the latest version.");
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
ShowError("Unable to access the WebService");
|
||||
mWebService_Status = "Offline";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Export_Google( eSpreadsheetUpdateMode UpdateMode )
|
||||
{
|
||||
StopConnectionWWW();
|
||||
LanguageSourceData source = GetSourceData();
|
||||
mConnection_WWW = source.Export_Google_CreateWWWcall( UpdateMode );
|
||||
if (mConnection_WWW==null)
|
||||
{
|
||||
OnExported_Google(string.Empty, "WebPlayer can't contact Google");
|
||||
}
|
||||
else
|
||||
{
|
||||
mConnection_Callback = OnExported_Google;
|
||||
EditorApplication.update += CheckForConnection;
|
||||
mConnection_Text = "Uploading spreadsheet";
|
||||
//mConnection_TimeOut = Time.realtimeSinceStartup + 10;
|
||||
}
|
||||
}
|
||||
|
||||
void OnExported_Google( string Result, string Error )
|
||||
{
|
||||
// Checkf or error, but discard the "necessary data rewind wasn't possible" as thats not a real error, just a bug in Unity with POST redirects
|
||||
if (!string.IsNullOrEmpty(Error) && !Error.Contains("rewind"))
|
||||
{
|
||||
Debug.Log (Error);
|
||||
ShowError("Unable to access google");
|
||||
return;
|
||||
}
|
||||
|
||||
if (EditorPrefs.GetBool("I2Loc OpenDataSourceAfterExport", true) && !string.IsNullOrEmpty(GetSourceData().Google_SpreadsheetName))
|
||||
OpenGoogleSpreadsheet(GetSourceData().Google_SpreadsheetKey );
|
||||
mProp_GoogleLiveSyncIsUptoDate.boolValue = true;
|
||||
}
|
||||
|
||||
static void OpenGoogleSpreadsheet( string SpreadsheetKey )
|
||||
{
|
||||
ClearErrors();
|
||||
string SpreadsheetUrl = "https://docs.google.com/spreadsheet/ccc?key=" + SpreadsheetKey;
|
||||
Application.OpenURL(SpreadsheetUrl);
|
||||
}
|
||||
|
||||
public abstract LanguageSourceData GetSourceData();
|
||||
|
||||
|
||||
void Import_Google( eSpreadsheetUpdateMode UpdateMode )
|
||||
{
|
||||
StopConnectionWWW();
|
||||
LanguageSourceData source = GetSourceData();
|
||||
mConnection_WWW = source.Import_Google_CreateWWWcall(true, false);
|
||||
if (mConnection_WWW==null)
|
||||
{
|
||||
OnImported_Google(string.Empty, "Unable to import from google", eSpreadsheetUpdateMode.Replace);
|
||||
}
|
||||
else
|
||||
{
|
||||
mConnection_Callback=null;
|
||||
switch (UpdateMode)
|
||||
{
|
||||
case eSpreadsheetUpdateMode.Replace : mConnection_Callback += OnImported_Google_Replace; break;
|
||||
case eSpreadsheetUpdateMode.Merge : mConnection_Callback += OnImported_Google_Merge; break;
|
||||
case eSpreadsheetUpdateMode.AddNewTerms : mConnection_Callback += OnImported_Google_AddNewTerms; break;
|
||||
}
|
||||
EditorApplication.update += CheckForConnection;
|
||||
mConnection_Text = "Downloading spreadsheet";
|
||||
//mConnection_TimeOut = Time.realtimeSinceStartup + 10;
|
||||
}
|
||||
}
|
||||
|
||||
void OnImported_Google_Replace( string Result, string Error ) { OnImported_Google(Result, Error, eSpreadsheetUpdateMode.Replace); }
|
||||
void OnImported_Google_Merge( string Result, string Error ) { OnImported_Google(Result, Error, eSpreadsheetUpdateMode.Merge); }
|
||||
void OnImported_Google_AddNewTerms( string Result, string Error ) { OnImported_Google(Result, Error, eSpreadsheetUpdateMode.AddNewTerms); }
|
||||
|
||||
void OnImported_Google( string Result, string Error, eSpreadsheetUpdateMode UpdateMode )
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Error))
|
||||
{
|
||||
Debug.Log(Error);
|
||||
ShowError("Unable to access google");
|
||||
return;
|
||||
}
|
||||
LanguageSourceData source = GetSourceData();
|
||||
string ErrorMsg = source.Import_Google_Result(Result, UpdateMode);
|
||||
bool HasErrors = !string.IsNullOrEmpty(ErrorMsg);
|
||||
if (HasErrors)
|
||||
ShowError(ErrorMsg);
|
||||
|
||||
serializedObject.Update();
|
||||
ParseTerms(true, false, !HasErrors);
|
||||
mSelectedKeys.Clear ();
|
||||
mSelectedCategories.Clear();
|
||||
ScheduleUpdateTermsToShowInList();
|
||||
mLanguageSource.GetCategories(false, mSelectedCategories);
|
||||
|
||||
EditorUtility.SetDirty (target);
|
||||
AssetDatabase.SaveAssets();
|
||||
}
|
||||
|
||||
void CheckForConnection()
|
||||
{
|
||||
if (mConnection_WWW!=null && mConnection_WWW.isDone)
|
||||
{
|
||||
fnConnectionCallback callback = mConnection_Callback;
|
||||
string Result = string.Empty;
|
||||
string Error = mConnection_WWW.error;
|
||||
|
||||
if (string.IsNullOrEmpty(Error))
|
||||
{
|
||||
Result = Encoding.UTF8.GetString(mConnection_WWW.downloadHandler.data); //mConnection_WWW.text;
|
||||
}
|
||||
|
||||
StopConnectionWWW();
|
||||
if (callback!=null)
|
||||
callback(Result, Error);
|
||||
}
|
||||
/*else
|
||||
if (Time.realtimeSinceStartup > mConnection_TimeOut+30)
|
||||
{
|
||||
fnConnectionCallback callback = mConnection_Callback;
|
||||
StopConnectionWWW();
|
||||
if (callback!=null)
|
||||
callback(string.Empty, "Time Out");
|
||||
}*/
|
||||
}
|
||||
|
||||
void StopConnectionWWW()
|
||||
{
|
||||
EditorApplication.update -= CheckForConnection;
|
||||
mConnection_WWW = null;
|
||||
mConnection_Callback = null;
|
||||
mConnection_Text = string.Empty;
|
||||
}
|
||||
|
||||
#region New Spreadsheet
|
||||
|
||||
void Google_NewSpreadsheet()
|
||||
{
|
||||
#if UNITY_WEBPLAYER
|
||||
ShowError ("Contacting google translation is not yet supported on WebPlayer" );
|
||||
#else
|
||||
|
||||
ClearErrors();
|
||||
string SpreadsheetName;
|
||||
|
||||
LanguageSourceData source = GetSourceData();
|
||||
if (source.IsGlobalSource())
|
||||
SpreadsheetName = string.Format("{0} Localization", PlayerSettings.productName);
|
||||
else
|
||||
SpreadsheetName = string.Format("{0} {1} {2}", PlayerSettings.productName, Editor_GetCurrentScene(), source.ownerObject.name);
|
||||
|
||||
string query = mProp_Google_WebServiceURL.stringValue + "?action=NewSpreadsheet&name=" + Uri.EscapeDataString(SpreadsheetName) + "&password="+ Uri.EscapeDataString(mProp_Google_Password.stringValue);
|
||||
|
||||
mConnection_WWW = UnityWebRequest.Get(query);
|
||||
I2Utils.SendWebRequest(mConnection_WWW);
|
||||
mConnection_Callback = Google_OnNewSpreadsheet;
|
||||
EditorApplication.update += CheckForConnection;
|
||||
mConnection_Text = "Creating Spreadsheet";
|
||||
//mConnection_TimeOut = Time.realtimeSinceStartup + 10;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Google_OnNewSpreadsheet( string Result, string Error )
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Error))
|
||||
{
|
||||
ShowError("Unable to access google");
|
||||
return;
|
||||
}
|
||||
if (Result=="Wrong Password")
|
||||
{
|
||||
ShowError(Result);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var data = JSON.Parse(Result).AsObject;
|
||||
|
||||
string name = data["name"];
|
||||
string key = data["id"];
|
||||
|
||||
serializedObject.Update();
|
||||
mProp_Google_SpreadsheetKey.stringValue = key;
|
||||
mProp_Google_SpreadsheetName.stringValue = name;
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
mGoogleSpreadsheets[name] = key;
|
||||
|
||||
LanguageSourceData source = GetSourceData();
|
||||
if (source.mTerms.Count>0 || source.mLanguages.Count>0)
|
||||
Export_Google( eSpreadsheetUpdateMode.Replace );
|
||||
else
|
||||
if (EditorPrefs.GetBool("I2Loc OpenDataSourceAfterExport", true))
|
||||
OpenGoogleSpreadsheet( key );
|
||||
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
ShowError (e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region FindSpreadsheets
|
||||
|
||||
void Google_FindSpreadsheets()
|
||||
{
|
||||
ClearErrors();
|
||||
EditorApplication.update -= Google_FindSpreadsheets;
|
||||
string query = mProp_Google_WebServiceURL.stringValue + "?action=GetSpreadsheetList&password="+ Uri.EscapeDataString(mProp_Google_Password.stringValue);
|
||||
mConnection_WWW = UnityWebRequest.Get(query);
|
||||
I2Utils.SendWebRequest(mConnection_WWW);
|
||||
mConnection_Callback = Google_OnFindSpreadsheets;
|
||||
EditorApplication.update += CheckForConnection;
|
||||
mConnection_Text = "Accessing google";
|
||||
//mConnection_TimeOut = Time.realtimeSinceStartup + 10;
|
||||
}
|
||||
|
||||
void Google_OnFindSpreadsheets( string Result, string Error)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Error))
|
||||
{
|
||||
ShowError("Unable to access google");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Result=="Wrong Password")
|
||||
{
|
||||
ShowError(Result);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
mGoogleSpreadsheets.Clear();
|
||||
var data = JSON.Parse(Result).AsObject;
|
||||
foreach (KeyValuePair<string, JSONNode> element in data)
|
||||
mGoogleSpreadsheets[element.Key] = element.Value;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
ShowError (e.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 800caf7e364ec2947be099b4f9ed976d
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,335 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace I2.Loc
|
||||
{
|
||||
public partial class LocalizationEditor
|
||||
{
|
||||
enum eLocalSpreadsheeet { CSV, XLS, XLSX, NONE }
|
||||
|
||||
void OnGUI_Spreadsheet_Local()
|
||||
{
|
||||
GUILayout.Space(10);
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label ("File:", GUILayout.ExpandWidth(false));
|
||||
|
||||
mProp_Spreadsheet_LocalFileName.stringValue = EditorGUILayout.TextField(mProp_Spreadsheet_LocalFileName.stringValue);
|
||||
/*if (GUILayout.Button("...", "toolbarbutton", GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
string sFileName = mProp_Spreadsheet_LocalFileName.stringValue;
|
||||
|
||||
string sPath = string.Empty;
|
||||
try {
|
||||
sPath = System.IO.Path.GetDirectoryName(sFileName);
|
||||
}
|
||||
catch( System.Exception e){}
|
||||
|
||||
if (string.IsNullOrEmpty(sPath))
|
||||
sPath = Application.dataPath + "/";
|
||||
|
||||
sFileName = System.IO.Path.GetFileName(sFileName);
|
||||
if (string.IsNullOrEmpty(sFileName))
|
||||
sFileName = "Localization.csv";
|
||||
|
||||
string FullFileName = EditorUtility.SaveFilePanel("Select CSV File", sPath, sFileName, "csv");
|
||||
//string FullFileName = EditorUtility.OpenFilePanel("Select CSV, XLS or XLSX File", sFileName, "csv;*.xls;*.xlsx");
|
||||
|
||||
if (!string.IsNullOrEmpty(FullFileName))
|
||||
{
|
||||
Prop_LocalFileName.stringValue = TryMakingPathRelativeToProject(FullFileName);
|
||||
}
|
||||
}*/
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
//--[ Find current extension ]---------------
|
||||
eLocalSpreadsheeet CurrentExtension = eLocalSpreadsheeet.NONE;
|
||||
//string FileNameLower = Prop_LocalFileName.stringValue.ToLower();
|
||||
/*if (FileNameLower.EndsWith(".csv")) */CurrentExtension = eLocalSpreadsheeet.CSV;
|
||||
/*if (FileNameLower.EndsWith(".xls")) CurrentExtension = eLocalSpreadsheeet.XLS;
|
||||
if (FileNameLower.EndsWith(".xlsx")) CurrentExtension = eLocalSpreadsheeet.XLSX;*/
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
switch (CurrentExtension)
|
||||
{
|
||||
case eLocalSpreadsheeet.NONE :
|
||||
case eLocalSpreadsheeet.CSV :
|
||||
{
|
||||
string FileTypesDesc = "选择或拖动下列类型的文件:\nSelect or Drag any file of the following types:\n\n";
|
||||
FileTypesDesc+= "*.csv (逗号分隔值)(Comma Separated Values)\n";
|
||||
FileTypesDesc+= "*.txt (CSV文件重命名为txt)(CSV file renamed as txt)\n";
|
||||
//FileTypesDesc+= "\n*.xls (Excel 97-2003)";
|
||||
//FileTypesDesc+= "\n*.xlsx (Excel Open XML format)";
|
||||
EditorGUILayout.HelpBox(FileTypesDesc, MessageType.None);
|
||||
}
|
||||
break;
|
||||
case eLocalSpreadsheeet.XLS : EditorGUILayout.HelpBox("Excel 97-2003", MessageType.None); break;
|
||||
case eLocalSpreadsheeet.XLSX : EditorGUILayout.HelpBox("Excel Open XML format", MessageType.None); break;
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.EndVertical();
|
||||
|
||||
//--[ Allow Dragging files ]-----------------
|
||||
if (GUILayoutUtility.GetLastRect().Contains (Event.current.mousePosition) && IsValidDraggedLoadSpreadsheet())
|
||||
{
|
||||
if (Event.current.type == EventType.DragUpdated)
|
||||
DragAndDrop.visualMode = DragAndDropVisualMode.Link;
|
||||
|
||||
if (Event.current.type == EventType.DragPerform)
|
||||
{
|
||||
mProp_Spreadsheet_LocalFileName.stringValue = TryMakingPathRelativeToProject( DragAndDrop.paths[0] );
|
||||
DragAndDrop.AcceptDrag();
|
||||
Event.current.Use();
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
OnGUI_Spreadsheet_Local_ImportExport( CurrentExtension, mProp_Spreadsheet_LocalFileName.stringValue );
|
||||
|
||||
//if (Application.platform == RuntimePlatform.OSXEditor)
|
||||
|
||||
//-- CSV Separator ----------------
|
||||
GUI.changed = false;
|
||||
var CSV_Separator = mProp_Spreadsheet_LocalCSVSeparator.stringValue;
|
||||
if (string.IsNullOrEmpty (CSV_Separator))
|
||||
CSV_Separator = ",";
|
||||
|
||||
GUILayout.Space(10);
|
||||
GUILayout.BeginVertical("Box");
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("分隔符 Separator:");
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
if (GUILayout.Toggle(CSV_Separator==",", "逗号 Comma(,)") && CSV_Separator!=",")
|
||||
CSV_Separator = ",";
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
if (GUILayout.Toggle(CSV_Separator==";", "分号 Semicolon(;)") && CSV_Separator!=";")
|
||||
CSV_Separator = ";";
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
if (GUILayout.Toggle(CSV_Separator=="\t", "换行 TAB(\\t)") && CSV_Separator!="\t")
|
||||
CSV_Separator = "\t";
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
//--[ Encoding ]---------------
|
||||
var encodings = Encoding.GetEncodings ().OrderBy(e=>e.Name).ToArray();
|
||||
var encodingNames = encodings.Select(e=>e.Name).ToArray();
|
||||
|
||||
int idx = Array.IndexOf (encodingNames, mProp_Spreadsheet_LocalCSVEncoding.stringValue);
|
||||
if (idx == -1)
|
||||
idx = Array.IndexOf (encodingNames, "utf-8");
|
||||
EditorGUIUtility.labelWidth = 80;
|
||||
|
||||
idx = EditorGUILayout.Popup (" 编码 Encoding:", idx, encodingNames);
|
||||
if (GUILayout.Button("默认 Default", GUILayout.ExpandWidth(false)))
|
||||
idx = Array.IndexOf (encodingNames, "utf-8");
|
||||
|
||||
if (idx>=0 && mProp_Spreadsheet_LocalCSVEncoding.stringValue != encodings [idx].Name)
|
||||
mProp_Spreadsheet_LocalCSVEncoding.stringValue = encodings [idx].Name;
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.EndVertical();
|
||||
|
||||
if (GUI.changed)
|
||||
{
|
||||
mProp_Spreadsheet_LocalCSVSeparator.stringValue = CSV_Separator;
|
||||
}
|
||||
|
||||
GUILayout.Space(10);
|
||||
EditorGUILayout.HelpBox("在某些Mac Os上,Unity存在一个Bug,当在打开/保存文件对话框中选择CSV文件时,IDE会崩溃\nOn some Mac OS, there is a Unity Bug that makes the IDE crash when selecting a CSV file in the Open/Save File Dialog.\n只要点击文件,unity就会尝试预览内容并崩溃。\nJust by clicking the file, unity tries to preview the content and crashes.\n\n如果您的团队成员使用Mac,建议导入/导出扩展名为TXT的csV文件\nIf any of your the team members use Mac, its adviced to import/export the CSV Files with TXT extension.", MessageType.Warning);
|
||||
GUILayout.Space(10);
|
||||
|
||||
OnGUI_ShowMsg();
|
||||
}
|
||||
|
||||
bool IsValidDraggedLoadSpreadsheet()
|
||||
{
|
||||
if (DragAndDrop.paths==null || DragAndDrop.paths.Length!=1)
|
||||
return false;
|
||||
|
||||
string sPath = DragAndDrop.paths[0].ToLower();
|
||||
if (sPath.EndsWith(".csv")) return true;
|
||||
if (sPath.EndsWith(".txt")) return true;
|
||||
//if (sPath.EndsWith(".xls")) return true;
|
||||
//if (sPath.EndsWith(".xlsx")) return true;
|
||||
|
||||
/*int iChar = sPath.LastIndexOfAny( "/\\.".ToCharArray() );
|
||||
if (iChar<0 || sPath[iChar]!='.')
|
||||
return true;
|
||||
return false;*/
|
||||
return false;
|
||||
}
|
||||
|
||||
string TryMakingPathRelativeToProject( string FileName )
|
||||
{
|
||||
string ProjectPath = Application.dataPath.ToLower();
|
||||
string FileNameLower = FileName.ToLower();
|
||||
|
||||
if (FileNameLower.StartsWith(ProjectPath))
|
||||
FileName = FileName.Substring(ProjectPath.Length+1);
|
||||
else
|
||||
if (FileNameLower.StartsWith("assets/"))
|
||||
FileName = FileName.Substring("assets/".Length);
|
||||
return FileName;
|
||||
}
|
||||
|
||||
void OnGUI_Spreadsheet_Local_ImportExport( eLocalSpreadsheeet CurrentExtension, string File )
|
||||
{
|
||||
GUI.enabled = CurrentExtension!=eLocalSpreadsheeet.NONE;
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Space(10);
|
||||
|
||||
GUI.backgroundColor = Color.Lerp(Color.gray, Color.white, 0.5f);
|
||||
eSpreadsheetUpdateMode Mode = SynchronizationButtons("导入 Import");
|
||||
if ( Mode!= eSpreadsheetUpdateMode.None)
|
||||
Import_Local(File, CurrentExtension, Mode);
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
GUI.backgroundColor = Color.Lerp(Color.gray, Color.white, 0.5f);
|
||||
Mode = SynchronizationButtons("导出 Export", true);
|
||||
if ( Mode != eSpreadsheetUpdateMode.None)
|
||||
Export_Local(File, CurrentExtension, Mode);
|
||||
|
||||
GUILayout.Space(10);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
EditorGUIUtility.labelWidth += 10;
|
||||
EditorGUILayout.PropertyField(mProp_Spreadsheet_SpecializationAsRows, new GUIContent("将特殊转换为行 Show Specializations as Rows", "true:将每个专业化单独放在一行(例如Term[VR]…,任期(触摸)……\ntrue: Make each specialization a separate row (e.g. Term[VR]..., Term[Touch]....\nfalse:将专门化合并到由[i2s_xxx]分隔的相同单元格中\nfalse: Merge specializations into same cell separated by [i2s_XXX]"));
|
||||
EditorGUIUtility.labelWidth -= 10;
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
|
||||
GUI.enabled = true;
|
||||
}
|
||||
|
||||
void Import_Local( string File, eLocalSpreadsheeet CurrentExtension, eSpreadsheetUpdateMode UpdateMode )
|
||||
{
|
||||
try
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
serializedObject.Update();
|
||||
ClearErrors();
|
||||
|
||||
if (string.IsNullOrEmpty(File))
|
||||
File = Application.dataPath + "/Localization.csv";
|
||||
else
|
||||
if (!Path.IsPathRooted(File))
|
||||
File = string.Concat(Application.dataPath, "/", File);
|
||||
|
||||
// On Mac there is an issue with previewing CSV files, so its forced to only TXT
|
||||
if (Application.platform == RuntimePlatform.OSXEditor)
|
||||
File = EditorUtility.OpenFilePanel("Select a CSV file renamed as TXT", File, "txt");
|
||||
else
|
||||
File = EditorUtility.OpenFilePanel("Select a CSV file or a CSV file renamed as TXT", File, "csv;*.txt");
|
||||
//File = EditorUtility.OpenFilePanel("Select CSV, XLS or XLSX File", File, "csv;*.xls;*.xlsx");
|
||||
if (!string.IsNullOrEmpty(File))
|
||||
{
|
||||
mLanguageSource.Spreadsheet_LocalFileName = TryMakingPathRelativeToProject(File);
|
||||
switch (CurrentExtension)
|
||||
{
|
||||
case eLocalSpreadsheeet.CSV : Import_CSV(File, UpdateMode); break;
|
||||
}
|
||||
ParseTerms(true, false, true);
|
||||
EditorUtility.SetDirty (target);
|
||||
AssetDatabase.SaveAssets();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowError("Unable to import file");
|
||||
Debug.LogError(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
void Import_CSV( string FileName, eSpreadsheetUpdateMode UpdateMode )
|
||||
{
|
||||
LanguageSourceData source = GetSourceData();
|
||||
var encoding = Encoding.GetEncoding (mProp_Spreadsheet_LocalCSVEncoding.stringValue);
|
||||
if (encoding == null)
|
||||
encoding = Encoding.UTF8;
|
||||
string CSVstring = LocalizationReader.ReadCSVfile (FileName, encoding);
|
||||
|
||||
char Separator = mProp_Spreadsheet_LocalCSVSeparator.stringValue.Length>0 ? mProp_Spreadsheet_LocalCSVSeparator.stringValue[0] : ',';
|
||||
string sError = source.Import_CSV( string.Empty, CSVstring, UpdateMode, Separator);
|
||||
if (!string.IsNullOrEmpty(sError))
|
||||
ShowError(sError);
|
||||
|
||||
mSelectedCategories = source.GetCategories();
|
||||
}
|
||||
|
||||
void Export_Local( string File, eLocalSpreadsheeet CurrentExtension, eSpreadsheetUpdateMode UpdateMode )
|
||||
{
|
||||
try
|
||||
{
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
serializedObject.Update();
|
||||
ClearErrors();
|
||||
|
||||
string sPath = string.Empty;
|
||||
if (!Path.IsPathRooted(File))
|
||||
File = string.Concat(Application.dataPath, "/", File);
|
||||
|
||||
try {
|
||||
sPath = Path.GetDirectoryName(File);
|
||||
}
|
||||
catch( Exception){}
|
||||
|
||||
if (string.IsNullOrEmpty(sPath))
|
||||
sPath = Application.dataPath + "/";
|
||||
|
||||
File = Path.GetFileName(File);
|
||||
if (string.IsNullOrEmpty(File))
|
||||
File = "Localization.csv";
|
||||
|
||||
if (Application.platform == RuntimePlatform.OSXEditor)
|
||||
File = EditorUtility.SaveFilePanel("Select a CSV file renamed as TXT", sPath, File, "txt");
|
||||
else
|
||||
File = EditorUtility.SaveFilePanel("Select a CSV or TXT file", sPath, File, "csv;*.txt");
|
||||
if (!string.IsNullOrEmpty(File))
|
||||
{
|
||||
mLanguageSource.Spreadsheet_LocalFileName = TryMakingPathRelativeToProject(File);
|
||||
|
||||
char Separator = mProp_Spreadsheet_LocalCSVSeparator.stringValue.Length>0 ? mProp_Spreadsheet_LocalCSVSeparator.stringValue[0] : ',';
|
||||
var encoding = Encoding.GetEncoding (mProp_Spreadsheet_LocalCSVEncoding.stringValue);
|
||||
if (encoding == null)
|
||||
encoding = Encoding.UTF8;
|
||||
|
||||
switch (CurrentExtension)
|
||||
{
|
||||
case eLocalSpreadsheeet.CSV : Export_CSV(File, UpdateMode, Separator, encoding); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
ShowError("Unable to export file\nCheck it is not READ-ONLY and that\nits not opened in an external viewer");
|
||||
}
|
||||
}
|
||||
|
||||
public void Export_CSV( string FileName, eSpreadsheetUpdateMode UpdateMode, char Separator, Encoding encoding )
|
||||
{
|
||||
LanguageSourceData source = GetSourceData();
|
||||
|
||||
string CSVstring = source.Export_CSV(null, Separator, mProp_Spreadsheet_SpecializationAsRows.boolValue);
|
||||
File.WriteAllText (FileName, CSVstring, encoding);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fdca66efafe784661b464934cacff065
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,820 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace I2.Loc
|
||||
{
|
||||
public partial class LocalizationEditor
|
||||
{
|
||||
#region Variables
|
||||
|
||||
Vector2 mScrollPos_Keys = Vector2.zero;
|
||||
|
||||
public static string mKeyToExplore; // Key that should show all the language details
|
||||
static string KeyList_Filter = "";
|
||||
float mRowSize=-1;
|
||||
float ScrollHeight;
|
||||
float mTermList_MaxWidth = -1;
|
||||
|
||||
public static List<string> mSelectedKeys = new List<string>(); // Selected Keys in the list of mParsedKeys
|
||||
public static List<string> mSelectedCategories = new List<string>();
|
||||
|
||||
|
||||
public enum eFlagsViewKeys
|
||||
{
|
||||
Used = 1<<1,
|
||||
Missing = 1<<2,
|
||||
NotUsed = 1<<3
|
||||
}
|
||||
public static int mFlagsViewKeys = (int)eFlagsViewKeys.Used | (int)eFlagsViewKeys.NotUsed;
|
||||
|
||||
public static string mTermsList_NewTerm;
|
||||
Rect mKeyListFilterRect;
|
||||
|
||||
#endregion
|
||||
|
||||
#region GUI Key List
|
||||
|
||||
float ExpandedViewHeight;
|
||||
float TermsListHeight;
|
||||
|
||||
void OnGUI_KeysList(bool AllowExpandKey = true, float Height = 300.0f, bool ShowTools=true)
|
||||
{
|
||||
///if (mTermList_MaxWidth<=0)
|
||||
CalculateTermsListMaxWidth();
|
||||
|
||||
//--[ List Filters ]--------------------------------------
|
||||
|
||||
// The ID of this control is registered here to avoid losing focus when the terms list grows in the scrollbox
|
||||
// This control is drawn later on
|
||||
int KeyListFilterID = GUIUtility.GetControlID( FocusType.Keyboard );
|
||||
|
||||
OnGUI_ShowMsg();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUIStyle bstyle = new GUIStyle ("toolbarbutton");
|
||||
bstyle.fontSize = 15;
|
||||
if (GUILayout.Button (new GUIContent("\u21ea", "解析场景并更新缺少和未使用术语的术语列表\nParse Scene and update terms list with missing and unused terms"), bstyle, GUILayout.Width(40)))
|
||||
EditorApplication.update += DoParseTermsInCurrentSceneAndScripts;
|
||||
if (GUILayout.Button(new GUIContent("\u21bb", "刷新所有本地化对象的翻译\nRefresh the translation of all Localize objects"), bstyle, GUILayout.Width(40)))
|
||||
CallLocalizeAll();
|
||||
|
||||
GUILayout.Space (1);
|
||||
|
||||
var oldFlags = mFlagsViewKeys;
|
||||
mFlagsViewKeys = OnGUI_FlagToogle("使用 Used","显示已解析场景中引用的所有术语\nShows All Terms referenced in the parsed scenes", mFlagsViewKeys, (int)eFlagsViewKeys.Used);
|
||||
mFlagsViewKeys = OnGUI_FlagToogle("未使用 Not Used", "显示源中未使用的所有术语\nShows all Terms from the Source that are not been used", mFlagsViewKeys, (int)eFlagsViewKeys.NotUsed);
|
||||
mFlagsViewKeys = OnGUI_FlagToogle("未定义 Missing","显示所有已使用但未在源代码中定义的术语。\nShows all Terms Used but not defined in the Source", mFlagsViewKeys, (int)eFlagsViewKeys.Missing);
|
||||
if (oldFlags!=mFlagsViewKeys)
|
||||
ScheduleUpdateTermsToShowInList();
|
||||
|
||||
OnGUI_SelectedCategories();
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
/*//if (Event.current.type == EventType.Repaint)
|
||||
TermsListHeight = Screen.height - 400;
|
||||
Debug.Log(Event.current.type + " " + TermsListHeight + " " + Screen.height + " " + GUILayoutUtility.GetLastRect().yMax);
|
||||
|
||||
//TermsListHeight = Mathf.Min(Screen.height*0.5f, TermsListHeight);
|
||||
mScrollPos_Keys = GUILayout.BeginScrollView(mScrollPos_Keys, false, false, "horizontalScrollbar", "verticalScrollbar", LocalizeInspector.GUIStyle_OldTextArea, GUILayout.Height(TermsListHeight));
|
||||
for (int i = 0; i < 1000; ++i)
|
||||
GUILayout.Label("ahhh" + i);
|
||||
GUILayout.EndScrollView();
|
||||
|
||||
return;*/
|
||||
TermsListHeight = Mathf.Min(Screen.height*0.5f, TermsListHeight);
|
||||
|
||||
//--[ Keys List ]-----------------------------------------
|
||||
GUI.backgroundColor = Color.Lerp(GUITools.LightGray, Color.white, 0.5f);
|
||||
mScrollPos_Keys = GUILayout.BeginScrollView( mScrollPos_Keys, false, false, "horizontalScrollbar", "verticalScrollbar", LocalizeInspector.GUIStyle_OldTextArea ,GUILayout.Height(TermsListHeight)/*GUILayout.MinHeight(Height), GUILayout.MaxHeight(Screen.height), GUILayout.ExpandHeight(true)*/);
|
||||
GUI.backgroundColor = Color.white;
|
||||
|
||||
bool bAnyValidUsage = false;
|
||||
|
||||
mRowSize = EditorStyles.toolbar.fixedHeight;
|
||||
if (Event.current!=null && Event.current.type == EventType.Layout)
|
||||
ScrollHeight = mScrollPos_Keys.y;
|
||||
|
||||
float YPosMin = -ScrollHeight;
|
||||
int nSkip = 0;
|
||||
int nDraw = 0;
|
||||
|
||||
if (mShowableTerms.Count == 0 && Event.current.type == EventType.Layout)
|
||||
UpdateTermsToShownInList ();
|
||||
|
||||
float SkipSize = 0;
|
||||
foreach (var parsedTerm in mShowableTerms)
|
||||
{
|
||||
string sKey = parsedTerm.Term;
|
||||
string sCategory = parsedTerm.Category;
|
||||
string FullKey = parsedTerm.FullTerm;
|
||||
|
||||
int nUses = parsedTerm.Usage;
|
||||
bAnyValidUsage = bAnyValidUsage | (nUses>=0);
|
||||
|
||||
ShowTerm_termData = parsedTerm.termData;
|
||||
|
||||
// Skip lines outside the view -----------------------
|
||||
YPosMin += mRowSize;
|
||||
SkipSize += mRowSize;
|
||||
float YPosMax = YPosMin + mRowSize;
|
||||
bool isExpanded = AllowExpandKey && mKeyToExplore==FullKey;
|
||||
if (!isExpanded && (YPosMax<-2*mRowSize || YPosMin>/*Screen.height*/TermsListHeight+mRowSize))
|
||||
{
|
||||
if (YPosMin>TermsListHeight+mRowSize)
|
||||
break;
|
||||
|
||||
nSkip++;
|
||||
continue;
|
||||
}
|
||||
nDraw++;
|
||||
|
||||
//------------------------------------------------------
|
||||
|
||||
OnGUI_KeyHeader (sKey, sCategory, FullKey, nUses, YPosMin-mRowSize+mScrollPos_Keys.y);
|
||||
|
||||
//--[ Key Details ]-------------------------------
|
||||
|
||||
if (isExpanded)
|
||||
{
|
||||
GUILayout.Space(SkipSize);
|
||||
SkipSize = 0;
|
||||
OnGUI_KeyList_ShowKeyDetails();
|
||||
Rect rect = GUILayoutUtility.GetLastRect();
|
||||
if (rect.height>5)
|
||||
ExpandedViewHeight = rect.height;
|
||||
YPosMin += ExpandedViewHeight;
|
||||
}
|
||||
}
|
||||
SkipSize += (mShowableTerms.Count - nDraw-nSkip) * mRowSize;
|
||||
GUILayout.Space(SkipSize+2);
|
||||
if (mSelectedCategories.Count < mParsedCategories.Count)
|
||||
{
|
||||
SkipSize += 25;
|
||||
if (GUILayout.Button ("...", EditorStyles.label))
|
||||
{
|
||||
mSelectedCategories.Clear ();
|
||||
mSelectedCategories.AddRange (mParsedCategories);
|
||||
}
|
||||
}
|
||||
OnGUI_KeysList_AddKey();
|
||||
|
||||
GUILayout.Label("", GUILayout.Width(mTermList_MaxWidth+10+30), GUILayout.Height(1));
|
||||
|
||||
GUILayout.EndScrollView();
|
||||
|
||||
TermsListHeight = YPosMin + mRowSize + 25;//SkipSize+25;
|
||||
|
||||
//Rect ListRect = GUILayoutUtility.GetLastRect();
|
||||
//if (ListRect.height>5)
|
||||
// TermsListHeight = ListRect.height;
|
||||
//Debug.Log(nDraw + " " + nSkip + " " + Screen.height + " " + TermsListHeight);
|
||||
|
||||
OnGUI_Keys_ListSelection( KeyListFilterID ); // Selection Buttons
|
||||
|
||||
// if (!bAnyValidUsage)
|
||||
// EditorGUILayout.HelpBox("Use (Tools\\Parse Terms) to find how many times each of the Terms are used", UnityEditor.MessageType.Info);
|
||||
|
||||
if (ShowTools)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
GUI.enabled = mSelectedKeys.Count>0 || !string.IsNullOrEmpty(mKeyToExplore);
|
||||
if (TestButton (eTest_ActionType.Button_AddSelectedTerms, new GUIContent("添加 Add Terms", "向源中添加术语 Add terms to Source"), "Button", GUITools.DontExpandWidth)) AddTermsToSource();
|
||||
if (TestButton (eTest_ActionType.Button_RemoveSelectedTerms, new GUIContent("移除 Remove Terms", "从源中删除术语 Remove Terms from Source"), "Button", GUITools.DontExpandWidth)) RemoveTermsFromSource();
|
||||
|
||||
GUILayout.FlexibleSpace ();
|
||||
|
||||
if (GUILayout.Button ("改变类别 Change Category")) OpenTool_ChangeCategoryOfSelectedTerms();
|
||||
GUI.enabled = true;
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace ();
|
||||
bool newBool = GUILayout.Toggle(mLanguageSource.CaseInsensitiveTerms, "不区分大小写的术语 Case Insensitive Terms");
|
||||
if (newBool != mLanguageSource.CaseInsensitiveTerms)
|
||||
{
|
||||
mProp_CaseInsensitiveTerms.boolValue = newBool;
|
||||
}
|
||||
GUILayout.FlexibleSpace ();
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
//Debug.Log ("Draw: " + nDraw + " Skip: " + nSkip);
|
||||
}
|
||||
|
||||
static void ScheduleUpdateTermsToShowInList()
|
||||
{
|
||||
if (!mUpdateShowTermIsScheduled)
|
||||
{
|
||||
EditorApplication.update += UpdateTermsToShownInList;
|
||||
mUpdateShowTermIsScheduled = true;
|
||||
}
|
||||
}
|
||||
static bool mUpdateShowTermIsScheduled;
|
||||
static void UpdateTermsToShownInList()
|
||||
{
|
||||
EditorApplication.update -= UpdateTermsToShownInList;
|
||||
mUpdateShowTermIsScheduled = false;
|
||||
|
||||
mShowableTerms.Clear ();
|
||||
mSelectedCategories.Sort();
|
||||
foreach (KeyValuePair<string, ParsedTerm> kvp in mParsedTerms)
|
||||
{
|
||||
ParsedTerm parsedTerm = kvp.Value;
|
||||
if (ShouldShowTerm (parsedTerm.Term, parsedTerm.Category, parsedTerm.Usage, parsedTerm))
|
||||
mShowableTerms.Add(parsedTerm);
|
||||
}
|
||||
GUITools.RepaintInspectors();
|
||||
GUITools.ScheduleRepaintInspectors();
|
||||
}
|
||||
|
||||
void OnGUI_KeyHeader (string sKey, string sCategory, string FullKey, int nUses, float YPosMin)
|
||||
{
|
||||
//--[ Toggle ]---------------------
|
||||
GUI.Box(new Rect(2, YPosMin+2, 18, mRowSize), "", "Toolbar");
|
||||
OnGUI_SelectableToogleListItem (new Rect(2, YPosMin+3, 15, mRowSize), FullKey, ref mSelectedKeys, "OL Toggle");
|
||||
|
||||
bool bEnabled = mSelectedKeys.Contains (FullKey);
|
||||
//--[ Number of Objects using this key ]---------------------
|
||||
if (nUses >= 0)
|
||||
{
|
||||
if (nUses == 0)
|
||||
{
|
||||
GUI.color = Color.Lerp (Color.gray, Color.white, 0.5f);
|
||||
GUI.Label (new Rect(20, YPosMin+2, 30, mRowSize), nUses.ToString (), "toolbarbutton");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GUI.Button(new Rect(20, YPosMin + 2, 30, mRowSize), nUses.ToString(), "toolbarbutton"))
|
||||
{
|
||||
List<string> selection = new List<string>(mSelectedKeys);
|
||||
if (!selection.Contains(FullKey))
|
||||
selection.Add(FullKey);
|
||||
|
||||
List<GameObject> selGOs = new List<GameObject>();
|
||||
for (int i=0; i<selection.Count; ++i)
|
||||
selGOs.AddRange( FindObjectsUsingKey(selection[i]) );
|
||||
|
||||
|
||||
if (selGOs.Count > 0)
|
||||
Selection.objects = selGOs.ToArray();
|
||||
else
|
||||
ShowWarning("The selected Terms are not used in this Scene. Try opening other scenes");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.color = Color.Lerp (Color.red, Color.white, 0.6f);
|
||||
if (GUI.Button (new Rect(20, YPosMin+2, 30, mRowSize), "", "toolbarbutton"))
|
||||
{
|
||||
mCurrentToolsMode = eToolsMode.Parse;
|
||||
mCurrentViewMode = eViewMode.Tools;
|
||||
}
|
||||
}
|
||||
GUI.color = Color.white;
|
||||
|
||||
TermData termData = ShowTerm_termData!=null ? ShowTerm_termData : mLanguageSource.GetTermData (FullKey);
|
||||
bool bKeyIsMissing = termData == null;
|
||||
float MinX = 50;
|
||||
if (bKeyIsMissing)
|
||||
{
|
||||
Rect rect = new Rect(50, YPosMin+2, mRowSize, mRowSize+2);
|
||||
GUITools.DrawSkinIcon(rect, "CN EntryWarnIcon", "CN EntryWarn");
|
||||
GUI.Label (rect, new GUIContent ("", "This term is used in the scene, but its not localized in the Language Source"));
|
||||
MinX += rect.width;
|
||||
}
|
||||
else MinX += 3;
|
||||
|
||||
float listWidth = Mathf.Max(EditorGUIUtility.currentViewWidth / EditorGUIUtility.pixelsPerPoint, mTermList_MaxWidth);
|
||||
Rect rectKey = new Rect(MinX, YPosMin+2, listWidth-MinX, mRowSize);
|
||||
if (sCategory != LanguageSourceData.EmptyCategory)
|
||||
rectKey.width -= 130;
|
||||
if (mKeyToExplore == FullKey)
|
||||
{
|
||||
GUI.backgroundColor = Color.Lerp (Color.blue, Color.white, 0.8f);
|
||||
if (GUI.Button (rectKey, new GUIContent (sKey, EditorStyles.foldout.onNormal.background), LocalizeInspector.GUIStyle_OldTextArea))
|
||||
{
|
||||
mKeyToExplore = string.Empty;
|
||||
ScheduleUpdateTermsToShowInList();
|
||||
ClearErrors ();
|
||||
}
|
||||
GUI.backgroundColor = Color.white;
|
||||
}
|
||||
else
|
||||
{
|
||||
GUIStyle LabelStyle = EditorStyles.label;
|
||||
if (!bKeyIsMissing && !TermHasAllTranslations (mLanguageSource, termData))
|
||||
{
|
||||
LabelStyle = new GUIStyle (EditorStyles.label);
|
||||
LabelStyle.fontStyle = FontStyle.Italic;
|
||||
GUI.color = Color.Lerp (Color.white, Color.yellow, 0.5f);
|
||||
}
|
||||
if (!bEnabled)
|
||||
GUI.contentColor = Color.Lerp (Color.gray, Color.white, 0.3f);
|
||||
if (GUI.Button (rectKey, sKey, LabelStyle))
|
||||
{
|
||||
SelectTerm (FullKey);
|
||||
ClearErrors ();
|
||||
}
|
||||
if (!bEnabled)
|
||||
GUI.contentColor = Color.white;
|
||||
GUI.color = Color.white;
|
||||
}
|
||||
//--[ Category ]--------------------------
|
||||
if (sCategory != LanguageSourceData.EmptyCategory)
|
||||
{
|
||||
if (mKeyToExplore == FullKey)
|
||||
{
|
||||
rectKey.x = listWidth - 100-38-20;
|
||||
rectKey.width = 130;
|
||||
if (GUI.Button (rectKey, sCategory, EditorStyles.toolbarButton))
|
||||
OpenTool_ChangeCategoryOfSelectedTerms ();
|
||||
}
|
||||
else
|
||||
{
|
||||
GUIStyle stl = new GUIStyle(EditorStyles.miniLabel);
|
||||
stl.alignment = TextAnchor.MiddleRight;
|
||||
rectKey.width = 130;//EditorStyles.miniLabel.CalcSize(new GUIContent(sCategory)).x;
|
||||
rectKey.x = listWidth - rectKey.width - 38-20;
|
||||
|
||||
if (GUI.Button (rectKey, sCategory, stl))
|
||||
{
|
||||
SelectTerm (FullKey);
|
||||
ClearErrors ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CalculateTermsListMaxWidth()
|
||||
{
|
||||
mTermList_MaxWidth = EditorGUIUtility.currentViewWidth / EditorGUIUtility.pixelsPerPoint - 120;
|
||||
/*float maxWidth = Screen.width / 18;
|
||||
foreach (KeyValuePair<string, ParsedTerm> kvp in mParsedTerms)
|
||||
{
|
||||
var txt = kvp.Key;
|
||||
if (txt.Length > 100)
|
||||
txt = txt.Substring(0, 100);
|
||||
var size = EditorStyles.label.CalcSize(new GUIContent(txt));
|
||||
mTermList_MaxWidth = Mathf.Max (mTermList_MaxWidth, size.x);
|
||||
}*/
|
||||
}
|
||||
|
||||
bool TermHasAllTranslations( LanguageSourceData source, TermData data )
|
||||
{
|
||||
if (source==null) source = LocalizationManager.Sources[0];
|
||||
for (int i=0, imax=data.Languages.Length; i<imax; ++i)
|
||||
{
|
||||
bool isLangEnabled = source.mLanguages.Count>i ? source.mLanguages[i].IsEnabled() : true;
|
||||
if (string.IsNullOrEmpty(data.Languages[i]) && isLangEnabled)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnGUI_KeysList_AddKey()
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
GUI.color = Color.Lerp(Color.gray, Color.white, 0.5f);
|
||||
bool bWasEnabled = mTermsList_NewTerm!=null;
|
||||
bool bEnabled = !GUILayout.Toggle (!bWasEnabled, "+", EditorStyles.toolbarButton, GUILayout.Width(30));
|
||||
GUI.color = Color.white;
|
||||
|
||||
if (bWasEnabled && !bEnabled) mTermsList_NewTerm = null;
|
||||
if (!bWasEnabled && bEnabled) mTermsList_NewTerm = string.Empty;
|
||||
|
||||
if (bEnabled)
|
||||
{
|
||||
GUILayout.BeginHorizontal(EditorStyles.toolbar);
|
||||
mTermsList_NewTerm = EditorGUILayout.TextField(mTermsList_NewTerm, EditorStyles.toolbarTextField, GUILayout.ExpandWidth(true));
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
LanguageSourceData.ValidateFullTerm( ref mTermsList_NewTerm );
|
||||
if (string.IsNullOrEmpty(mTermsList_NewTerm) || mLanguageSource.ContainsTerm(mTermsList_NewTerm) || mTermsList_NewTerm=="-")
|
||||
GUI.enabled = false;
|
||||
|
||||
if (TestButton (eTest_ActionType.Button_AddTerm_InTermsList, "Create Key", "toolbarbutton", GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
AddLocalTerm(mTermsList_NewTerm);
|
||||
SelectTerm( mTermsList_NewTerm );
|
||||
ClearErrors();
|
||||
mTermsList_NewTerm = null;
|
||||
SetAllTerms_When_InferredTerms_IsInSource ();
|
||||
}
|
||||
GUI.enabled = true;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
void OpenTool_ChangeCategoryOfSelectedTerms()
|
||||
{
|
||||
mCurrentViewMode = eViewMode.Tools;
|
||||
mCurrentToolsMode = eToolsMode.Categorize;
|
||||
if (!string.IsNullOrEmpty(mKeyToExplore) && !mSelectedKeys.Contains(mKeyToExplore))
|
||||
mSelectedKeys.Add(mKeyToExplore);
|
||||
mSelectedKeys.Sort();
|
||||
}
|
||||
|
||||
void OnGUI_SelectedCategories()
|
||||
{
|
||||
if (mParsedCategories.Count == 0)
|
||||
return;
|
||||
|
||||
string text = "Categories";
|
||||
if (mSelectedCategories.Count() == 0)
|
||||
text = "无 Nothing";
|
||||
else
|
||||
if (mSelectedCategories.Count() == mParsedCategories.Count)
|
||||
text = "所有 Everything";
|
||||
else
|
||||
text = mSelectedCategories.Count + " categories";
|
||||
|
||||
if (GUILayout.Button(new GUIContent(text), "toolbarbutton", GUILayout.Width(100)))
|
||||
{
|
||||
var menu = new GenericMenu();
|
||||
|
||||
menu.AddItem(new GUIContent("所有 Everything"), false, () =>
|
||||
{
|
||||
mSelectedCategories.Clear();
|
||||
mSelectedCategories.AddRange(mParsedCategories);
|
||||
ScheduleUpdateTermsToShowInList();
|
||||
});
|
||||
menu.AddItem(new GUIContent("无 Nothing"), false, () =>
|
||||
{
|
||||
mSelectedCategories.Clear();
|
||||
ScheduleUpdateTermsToShowInList();
|
||||
});
|
||||
menu.AddSeparator("");
|
||||
|
||||
var parsedList = mParsedCategories.OrderBy(x=>x).ToList();
|
||||
for (int i=0, imax=parsedList.Count; i<imax ; ++i)
|
||||
{
|
||||
var category = parsedList[i];
|
||||
var nextCategory = i + 1 < imax ? parsedList[i + 1] : null;
|
||||
|
||||
bool isHeader = nextCategory != null && nextCategory.StartsWith(category + "/");
|
||||
|
||||
var displayName = category;
|
||||
var categoryRoot = category;
|
||||
if (isHeader)
|
||||
{
|
||||
categoryRoot += "/";
|
||||
var newCateg = !category.Contains('/') ? category : category.Substring(category.LastIndexOf('/') + 1);
|
||||
displayName = categoryRoot + newCateg;
|
||||
}
|
||||
|
||||
menu.AddItem(new GUIContent(displayName), !string.IsNullOrEmpty(mSelectedCategories.FirstOrDefault(x=>x.StartsWith(categoryRoot))), () =>
|
||||
{
|
||||
var CatHeader = category + "/";
|
||||
if (mSelectedCategories.Contains(category))
|
||||
{
|
||||
mSelectedCategories.Remove(category);
|
||||
|
||||
if (isHeader)
|
||||
{
|
||||
mSelectedCategories.RemoveAll(x => x.StartsWith(CatHeader));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mSelectedCategories.Add(category);
|
||||
if (isHeader)
|
||||
{
|
||||
mSelectedCategories.AddRange( parsedList.Where(x=>x.StartsWith(CatHeader)));
|
||||
}
|
||||
}
|
||||
ScheduleUpdateTermsToShowInList();
|
||||
});
|
||||
if (isHeader)
|
||||
{
|
||||
menu.AddSeparator(category+"/");
|
||||
}
|
||||
}
|
||||
|
||||
menu.ShowAsContext();
|
||||
}
|
||||
}
|
||||
|
||||
void SaveSelectedCategories()
|
||||
{
|
||||
if (mSelectedCategories.Count == 0) {
|
||||
EditorPrefs.DeleteKey ("I2 CategoryFilter");
|
||||
} else {
|
||||
var data = string.Join(",", mSelectedCategories.ToArray());
|
||||
EditorPrefs.SetString ("I2 CategoryFilter", data);
|
||||
}
|
||||
}
|
||||
|
||||
void LoadSelectedCategories()
|
||||
{
|
||||
var data = EditorPrefs.GetString ("I2 CategoryFilter", null);
|
||||
if (!string.IsNullOrEmpty(data))
|
||||
{
|
||||
mSelectedCategories.Clear ();
|
||||
mSelectedCategories.AddRange( data.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Bottom part of the Key list (buttons: All, None, Used,... to select the keys)
|
||||
void OnGUI_Keys_ListSelection ( int KeyListFilterID )
|
||||
{
|
||||
GUILayout.BeginHorizontal( "toolbarbutton" );
|
||||
|
||||
if (TestButton( eTest_ActionType.Button_SelectTerms_All, new GUIContent( "所有 All", "选择列表中的所有\nTerms Selects All Terms in the list" ), "toolbarbutton", GUILayout.ExpandWidth( false ) ))
|
||||
{
|
||||
mSelectedKeys.Clear();
|
||||
foreach (var kvp in mParsedTerms)
|
||||
if (ShouldShowTerm( kvp.Value.Term, kvp.Value.Category, kvp.Value.Usage ))
|
||||
mSelectedKeys.Add( kvp.Key );
|
||||
}
|
||||
if (GUILayout.Button( new GUIContent( "清除 None", "清除选区\nClears the selection" ), "toolbarbutton", GUILayout.ExpandWidth( false ) )) { mSelectedKeys.Clear(); }
|
||||
GUILayout.Space( 5 );
|
||||
|
||||
GUI.enabled = (mFlagsViewKeys & (int)eFlagsViewKeys.Used)>1;
|
||||
if (TestButton(eTest_ActionType.Button_SelectTerms_Used, new GUIContent( "选择 Used", "选择已解析场景中引用的所有Terms\nSelects All Terms referenced in the parsed scenes" ), "toolbarbutton", GUILayout.ExpandWidth( false ) ))
|
||||
{
|
||||
mSelectedKeys.Clear();
|
||||
foreach (var kvp in mParsedTerms)
|
||||
if (kvp.Value.Usage > 0 && ShouldShowTerm( kvp.Value.Term, kvp.Value.Category, kvp.Value.Usage ))
|
||||
mSelectedKeys.Add( kvp.Key );
|
||||
}
|
||||
GUI.enabled = (mFlagsViewKeys & (int)eFlagsViewKeys.NotUsed)>1;
|
||||
if (GUILayout.Button( new GUIContent( "未使用 Not Used", "从源中选择所有未使用的术语。\nSelects all Terms from the Source that are not been used" ), "toolbarbutton", GUILayout.ExpandWidth( false ) ))
|
||||
{
|
||||
mSelectedKeys.Clear();
|
||||
foreach (var kvp in mParsedTerms)
|
||||
if (kvp.Value.Usage == 0 && ShouldShowTerm( kvp.Value.Term, kvp.Value.Category, kvp.Value.Usage ))
|
||||
mSelectedKeys.Add( kvp.Key );
|
||||
}
|
||||
|
||||
GUI.enabled = (mFlagsViewKeys & (int)eFlagsViewKeys.Missing)>1;
|
||||
if (TestButton(eTest_ActionType.Button_SelectTerms_Missing, new GUIContent( "未定义 Missing", "选择所有已使用但未在源中定义的术语\nSelects all Terms Used but not defined in the Source" ), "toolbarbutton", GUILayout.ExpandWidth( false ) ))
|
||||
{
|
||||
mSelectedKeys.Clear();
|
||||
foreach (var kvp in mParsedTerms)
|
||||
if (!mLanguageSource.ContainsTerm( kvp.Key ) && ShouldShowTerm( kvp.Value.Term, kvp.Value.Category, kvp.Value.Usage ))
|
||||
mSelectedKeys.Add( kvp.Key );
|
||||
}
|
||||
GUI.enabled = true;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
// Terms Filter
|
||||
{
|
||||
//KeyList_Filter = EditorGUILayout.TextField(KeyList_Filter, GUI.skin.GetStyle("ToolbarSeachTextField"), GUILayout.ExpandWidth(true));
|
||||
GUILayout.Label( "", GUILayout.ExpandWidth( true ) );
|
||||
mKeyListFilterRect = GUILayoutUtility.GetLastRect();
|
||||
mKeyListFilterRect.xMax += 4;
|
||||
|
||||
KeyList_Filter = GUITools.TextField( mKeyListFilterRect, KeyList_Filter, 255, GUI.skin.GetStyle( "ToolbarSeachTextField" ), KeyListFilterID );
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (GUILayout.Button( string.Empty, string.IsNullOrEmpty( KeyList_Filter ) ? "ToolbarSeachCancelButtonEmpty" : "ToolbarSeachCancelButton", GUILayout.ExpandWidth( false ) ))
|
||||
{
|
||||
KeyList_Filter = string.Empty;
|
||||
EditorApplication.update += RepaintScene;
|
||||
GUI.FocusControl( "" );
|
||||
}
|
||||
|
||||
string filterHelp = "国际规则的选项:\n文本-显示所有匹配文本的键/类别\nc文本-显示文本类别的所有条款\nf文本-显示翻译中有“文本”的术语\n\nFiter Options:\ntext - shows all key/categories matching text\nc text - shows all terms of the text category\nf text - show terms having 'text' in their translations";
|
||||
GUILayout.Space(-5);
|
||||
GUI.contentColor = new Color(1, 1, 1, 0.5f);
|
||||
GUILayout.Label(new GUIContent(GUITools.Icon_Help.image, filterHelp), GUITools.DontExpandWidth);
|
||||
GUI.contentColor = GUITools.White;
|
||||
GUILayout.Space(-5);
|
||||
|
||||
|
||||
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
mShowableTerms.Clear();
|
||||
GUI.changed = false;
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Filtering
|
||||
|
||||
public bool ShouldShowTerm (string FullTerm)
|
||||
{
|
||||
ParsedTerm termData;
|
||||
if (!mParsedTerms.TryGetValue(FullTerm, out termData))
|
||||
return false;
|
||||
|
||||
return ShouldShowTerm (termData.Term, termData.Category, termData.Usage, termData);
|
||||
}
|
||||
|
||||
private static TermData ShowTerm_termData;
|
||||
public static bool ShouldShowTerm (string Term, string Category, int nUses, ParsedTerm parsedTerm=null )
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Category) && !mSelectedCategories.Contains(Category))
|
||||
return false;
|
||||
if (Term == "-")
|
||||
return false;
|
||||
|
||||
|
||||
var fullTerm = Term;
|
||||
if (!string.IsNullOrEmpty(Category) && Category != LanguageSourceData.EmptyCategory)
|
||||
fullTerm = Category + "/" + Term;
|
||||
|
||||
if (parsedTerm != null && parsedTerm.termData != null)
|
||||
ShowTerm_termData = parsedTerm.termData;
|
||||
else
|
||||
{
|
||||
ShowTerm_termData = mLanguageSource.GetTermData (fullTerm);
|
||||
if (parsedTerm!=null)
|
||||
parsedTerm.termData = ShowTerm_termData;
|
||||
}
|
||||
|
||||
|
||||
var filter = KeyList_Filter.Trim();
|
||||
bool useTranslation = filter.StartsWith("f ", StringComparison.OrdinalIgnoreCase);
|
||||
if (useTranslation)
|
||||
{
|
||||
if (ShowTerm_termData == null)
|
||||
return false;
|
||||
|
||||
filter = filter.Substring(2).Trim();
|
||||
if (!string.IsNullOrEmpty(filter))
|
||||
{
|
||||
bool hasFilter = false;
|
||||
for (int i = 0; i < ShowTerm_termData.Languages.Length; ++i)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(ShowTerm_termData.Languages[i]) && StringContainsFilter(ShowTerm_termData.Languages[i], filter))
|
||||
{
|
||||
hasFilter = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasFilter)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool onlyCategory = filter.StartsWith("c ", StringComparison.OrdinalIgnoreCase);
|
||||
if (onlyCategory)
|
||||
filter = filter.Substring(2).Trim();
|
||||
|
||||
if (!string.IsNullOrEmpty(filter))
|
||||
{
|
||||
bool matchesCategory = StringContainsFilter(Category, filter);
|
||||
bool matchesName = !onlyCategory && StringContainsFilter(Term, filter);
|
||||
|
||||
if (!matchesCategory && !matchesName)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool bIsMissing = ShowTerm_termData == null;
|
||||
if (nUses<0) return true;
|
||||
|
||||
if ((mFlagsViewKeys & (int)eFlagsViewKeys.Missing)>0 && bIsMissing) return true;
|
||||
if ((mFlagsViewKeys & (int)eFlagsViewKeys.Missing)==0 && bIsMissing) return false;
|
||||
|
||||
if ((mFlagsViewKeys & (int)eFlagsViewKeys.Used)>0 && nUses>0) return true;
|
||||
if ((mFlagsViewKeys & (int)eFlagsViewKeys.NotUsed)>0 && nUses==0) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool StringContainsFilter( string Term, string Filter )
|
||||
{
|
||||
if (string.IsNullOrEmpty(Filter) || string.IsNullOrEmpty(Term))
|
||||
return true;
|
||||
if (Term == "-")
|
||||
return false;
|
||||
Term = Term.ToLower();
|
||||
string[] Filters = Filter.ToLower().Split(";, ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
for (int i = 0, imax = Filters.Length; i < imax; ++i)
|
||||
if (Term.Contains(Filters[i]))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Add/Remove Keys to DB
|
||||
|
||||
void AddTermsToSource()
|
||||
{
|
||||
if (!string.IsNullOrEmpty (mKeyToExplore) && !mSelectedKeys.Contains(mKeyToExplore))
|
||||
mSelectedKeys.Add (mKeyToExplore);
|
||||
|
||||
for (int i=mSelectedKeys.Count-1; i>=0; --i)
|
||||
{
|
||||
string key = mSelectedKeys[i];
|
||||
|
||||
if (!ShouldShowTerm(key))
|
||||
continue;
|
||||
|
||||
AddLocalTerm(key);
|
||||
mSelectedKeys.RemoveAt(i);
|
||||
}
|
||||
SetAllTerms_When_InferredTerms_IsInSource ();
|
||||
}
|
||||
|
||||
void RemoveTermsFromSource()
|
||||
{
|
||||
if (mTestAction==eTest_ActionType.None && !EditorUtility.DisplayDialog("Confirm delete", "Are you sure you want to delete the selected terms", "Yes", "Cancel"))
|
||||
return;
|
||||
|
||||
if (!string.IsNullOrEmpty (mKeyToExplore) && !mSelectedKeys.Contains(mKeyToExplore))
|
||||
mSelectedKeys.Add (mKeyToExplore);
|
||||
|
||||
for (int i=mSelectedKeys.Count-1; i>=0; --i)
|
||||
{
|
||||
string key = mSelectedKeys[i];
|
||||
|
||||
if (!ShouldShowTerm(key))
|
||||
continue;
|
||||
|
||||
mLanguageSource.RemoveTerm(key);
|
||||
RemoveParsedTerm(key);
|
||||
mSelectedKeys.Remove(key);
|
||||
}
|
||||
|
||||
mKeyToExplore = string.Empty;
|
||||
mTermList_MaxWidth = -1;
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
mLanguageSource.Editor_SetDirty();
|
||||
|
||||
EditorApplication.update += DoParseTermsInCurrentScene;
|
||||
EditorApplication.update += RepaintScene;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Select Objects in Current Scene
|
||||
|
||||
|
||||
public static void SelectTerm( string Key, bool SwitchToKeysTab=false )
|
||||
{
|
||||
GUI.FocusControl(null);
|
||||
mKeyToExplore = Key;
|
||||
mKeysDesc_AllowEdit = false;
|
||||
if (SwitchToKeysTab)
|
||||
mCurrentViewMode = eViewMode.Keys;
|
||||
}
|
||||
|
||||
|
||||
void SelectObjectsUsingKey( string Key )
|
||||
{
|
||||
List<GameObject> SelectedObjs = FindObjectsUsingKey(Key);
|
||||
|
||||
if (SelectedObjs.Count>0)
|
||||
Selection.objects = SelectedObjs.ToArray();
|
||||
else
|
||||
ShowWarning("The selected Terms are not used in this Scene. Try opening other scenes");
|
||||
}
|
||||
|
||||
List<GameObject> FindObjectsUsingKey(string Key)
|
||||
{
|
||||
List<GameObject> SelectedObjs = new List<GameObject>();
|
||||
|
||||
Localize[] Locals = (Localize[])Resources.FindObjectsOfTypeAll(typeof(Localize));
|
||||
|
||||
if (Locals == null)
|
||||
return SelectedObjs;
|
||||
|
||||
for (int i = 0, imax = Locals.Length; i < imax; ++i)
|
||||
{
|
||||
Localize localize = Locals[i];
|
||||
if (localize == null || localize.gameObject == null || !GUITools.ObjectExistInScene(localize.gameObject))
|
||||
continue;
|
||||
|
||||
string Term, SecondaryTerm;
|
||||
localize.GetFinalTerms(out Term, out SecondaryTerm);
|
||||
|
||||
if (Key == Term || Key == SecondaryTerm)
|
||||
SelectedObjs.Add(localize.gameObject);
|
||||
}
|
||||
|
||||
return SelectedObjs;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
[MenuItem("Tools/I2 Localization/Refresh Localizations", false, 16)]
|
||||
public static void CallLocalizeAll()
|
||||
{
|
||||
LocalizationManager.LocalizeAll(true);
|
||||
HandleUtility.Repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9f0230a94fc864d5bb1f2261de16edce
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,785 @@
|
||||
//#define UGUI
|
||||
//#define NGUI
|
||||
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace I2.Loc
|
||||
{
|
||||
public partial class LocalizationEditor
|
||||
{
|
||||
#region Variables
|
||||
internal static bool mKeysDesc_AllowEdit;
|
||||
internal static string GUI_SelectedSpecialization
|
||||
{
|
||||
get{
|
||||
if (string.IsNullOrEmpty(mGUI_SelectedSpecialization))
|
||||
mGUI_SelectedSpecialization = EditorPrefs.GetString ("I2Loc Specialization", "Any");
|
||||
return mGUI_SelectedSpecialization;
|
||||
}
|
||||
set{
|
||||
if (value!=mGUI_SelectedSpecialization)
|
||||
EditorPrefs.SetString ("I2Loc Specialization", value);
|
||||
mGUI_SelectedSpecialization = value;
|
||||
}
|
||||
}
|
||||
internal static string mGUI_SelectedSpecialization;
|
||||
|
||||
internal static bool GUI_ShowDisabledLanguagesTranslation = true;
|
||||
|
||||
internal static int mShowPlural = -1;
|
||||
#endregion
|
||||
|
||||
#region Key Description
|
||||
|
||||
void OnGUI_KeyList_ShowKeyDetails()
|
||||
{
|
||||
GUI.backgroundColor = Color.Lerp(Color.blue, Color.white, 0.9f);
|
||||
GUILayout.BeginVertical(LocalizeInspector.GUIStyle_OldTextArea, GUILayout.Height(1));
|
||||
OnGUI_Keys_Languages(mKeyToExplore, null);
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
if (TestButton(eTest_ActionType.Button_DeleteTerm, "Delete", "Button", GUILayout.ExpandWidth(true)))
|
||||
{
|
||||
if (mTestAction != eTest_ActionType.None || EditorUtility.DisplayDialog("Confirm delete", "Are you sure you want to delete term '" + mKeyToExplore + "'", "Yes", "Cancel"))
|
||||
EditorApplication.update += DeleteCurrentKey;
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Rename"))
|
||||
{
|
||||
mCurrentViewMode = eViewMode.Tools;
|
||||
mCurrentToolsMode = eToolsMode.Merge;
|
||||
if (!mSelectedKeys.Contains(mKeyToExplore))
|
||||
mSelectedKeys.Add(mKeyToExplore);
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
GUI.backgroundColor = Color.white;
|
||||
}
|
||||
|
||||
void DeleteTerm( string Term, bool updateStructures = true )
|
||||
{
|
||||
mLanguageSource.RemoveTerm (Term);
|
||||
RemoveParsedTerm(Term);
|
||||
mSelectedKeys.Remove(Term);
|
||||
|
||||
if (Term==mKeyToExplore)
|
||||
mKeyToExplore = string.Empty;
|
||||
|
||||
if (updateStructures)
|
||||
{
|
||||
UpdateParsedCategories();
|
||||
mTermList_MaxWidth = -1;
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
mLanguageSource.Editor_SetDirty();
|
||||
ScheduleUpdateTermsToShowInList();
|
||||
}
|
||||
EditorApplication.update += RepaintScene;
|
||||
}
|
||||
|
||||
void RepaintScene()
|
||||
{
|
||||
EditorApplication.update -= RepaintScene;
|
||||
Repaint();
|
||||
}
|
||||
|
||||
void DeleteCurrentKey()
|
||||
{
|
||||
EditorApplication.update -= DeleteCurrentKey;
|
||||
DeleteTerm (mKeyToExplore);
|
||||
|
||||
mKeyToExplore = "";
|
||||
EditorApplication.update += DoParseTermsInCurrentScene;
|
||||
}
|
||||
|
||||
TermData AddLocalTerm( string Term, bool AutoSelect = true )
|
||||
{
|
||||
var data = AddTerm(Term, AutoSelect);
|
||||
if (data==null)
|
||||
return null;
|
||||
|
||||
mTermList_MaxWidth = -1;
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
mLanguageSource.Editor_SetDirty();
|
||||
return data;
|
||||
}
|
||||
|
||||
static TermData AddTerm(string Term, bool AutoSelect = true, eTermType termType = eTermType.Text)
|
||||
{
|
||||
if (Term == "-" || string.IsNullOrEmpty(Term))
|
||||
return null;
|
||||
|
||||
Term = I2Utils.GetValidTermName(Term, true);
|
||||
|
||||
TermData data = mLanguageSource.AddTerm(Term, termType);
|
||||
GetParsedTerm(Term);
|
||||
string sCategory = LanguageSourceData.GetCategoryFromFullTerm(Term);
|
||||
mParsedCategories.Add(sCategory);
|
||||
|
||||
if (AutoSelect)
|
||||
{
|
||||
if (!mSelectedKeys.Contains(Term))
|
||||
mSelectedKeys.Add(Term);
|
||||
|
||||
if (!mSelectedCategories.Contains(sCategory))
|
||||
mSelectedCategories.Add(sCategory);
|
||||
}
|
||||
ScheduleUpdateTermsToShowInList();
|
||||
mLanguageSource.Editor_SetDirty();
|
||||
return data;
|
||||
}
|
||||
|
||||
// this method shows the key description and the localization to each language
|
||||
public static TermData OnGUI_Keys_Languages( string Key, Localize localizeCmp, bool IsPrimaryKey=true )
|
||||
{
|
||||
if (Key==null)
|
||||
Key = string.Empty;
|
||||
|
||||
TermData termdata = null;
|
||||
|
||||
LanguageSourceData source = mLanguageSource;
|
||||
if (localizeCmp != null && localizeCmp.Source != null)
|
||||
source = localizeCmp.Source.SourceData;
|
||||
|
||||
if (source==null)
|
||||
source = LocalizationManager.GetSourceContaining(Key, false);
|
||||
|
||||
if (source==null)
|
||||
{
|
||||
if (localizeCmp == null)
|
||||
source = LocalizationManager.Sources[0];
|
||||
else
|
||||
source = LocalizationManager.GetSourceContaining(IsPrimaryKey ? localizeCmp.SecondaryTerm : localizeCmp.Term);
|
||||
}
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(Key))
|
||||
{
|
||||
EditorGUILayout.HelpBox( "选择要本地化的术语\nSelect a Term to Localize", MessageType.Info );
|
||||
return null;
|
||||
}
|
||||
|
||||
termdata = source.GetTermData(Key);
|
||||
if (termdata==null && localizeCmp!=null)
|
||||
{
|
||||
var realSource = LocalizationManager.GetSourceContaining(Key, false);
|
||||
if (realSource != null)
|
||||
{
|
||||
termdata = realSource.GetTermData(Key);
|
||||
source = realSource;
|
||||
}
|
||||
}
|
||||
if (termdata==null)
|
||||
{
|
||||
if (Key == "-")
|
||||
return null;
|
||||
EditorGUILayout.HelpBox( string.Format("Key '{0}' 没有本地化,还是使用不同的语言源\nis not Localized or it is in a different Language Source", Key), MessageType.Error );
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
if (GUILayout.Button("Add Term to Source"))
|
||||
{
|
||||
var termType = eTermType.Text;
|
||||
if (localizeCmp!=null && localizeCmp.mLocalizeTarget != null)
|
||||
{
|
||||
termType = IsPrimaryKey ? localizeCmp.mLocalizeTarget.GetPrimaryTermType(localizeCmp)
|
||||
: localizeCmp.mLocalizeTarget.GetSecondaryTermType(localizeCmp);
|
||||
}
|
||||
|
||||
AddTerm(Key, true, termType);
|
||||
}
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
//--[ Type ]----------------------------------
|
||||
if (localizeCmp==null)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label ("Type:", GUILayout.ExpandWidth(false));
|
||||
eTermType NewType = (eTermType)EditorGUILayout.EnumPopup(termdata.TermType, GUILayout.ExpandWidth(true));
|
||||
if (termdata.TermType != NewType)
|
||||
termdata.TermType = NewType;
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
|
||||
//--[ Description ]---------------------------
|
||||
|
||||
mKeysDesc_AllowEdit = GUILayout.Toggle(mKeysDesc_AllowEdit, "Description", EditorStyles.foldout, GUILayout.ExpandWidth(true));
|
||||
|
||||
if (mKeysDesc_AllowEdit)
|
||||
{
|
||||
string NewDesc = EditorGUILayout.TextArea( termdata.Description, Style_WrapTextField );
|
||||
if (NewDesc != termdata.Description)
|
||||
{
|
||||
termdata.Description = NewDesc;
|
||||
source.Editor_SetDirty();
|
||||
}
|
||||
}
|
||||
else
|
||||
EditorGUILayout.HelpBox( string.IsNullOrEmpty(termdata.Description) ? "没有描述 No description" : termdata.Description, MessageType.Info );
|
||||
|
||||
OnGUI_Keys_Language_SpecializationsBar (termdata, source);
|
||||
|
||||
OnGUI_Keys_Languages(Key, ref termdata, localizeCmp, IsPrimaryKey, source);
|
||||
return termdata;
|
||||
}
|
||||
|
||||
static void OnGUI_Keys_Languages( string Key, ref TermData termdata, Localize localizeCmp, bool IsPrimaryKey, LanguageSourceData source )
|
||||
{
|
||||
//--[ Languages ]---------------------------
|
||||
GUILayout.BeginVertical(LocalizeInspector.GUIStyle_OldTextArea, GUILayout.Height(1));
|
||||
|
||||
OnGUI_Keys_LanguageTranslations(Key, localizeCmp, IsPrimaryKey, ref termdata, source);
|
||||
|
||||
if (termdata.TermType == eTermType.Text)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
if (TestButton(eTest_ActionType.Button_Term_TranslateAll, "Translate All", "Button", GUILayout.Width(85)))
|
||||
{
|
||||
var termData = termdata;
|
||||
GUITools.DelayedCall(() => TranslateLanguage( Key, termData, localizeCmp, source));
|
||||
GUI.FocusControl(string.Empty);
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
OnGUI_TranslatingMessage();
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
static void TranslateLanguage( string Key, TermData termdata, Localize localizeCmp, LanguageSourceData source)
|
||||
{
|
||||
ClearErrors();
|
||||
string mainText = localizeCmp == null ? LanguageSourceData.GetKeyFromFullTerm(Key) : localizeCmp.GetMainTargetsText();
|
||||
|
||||
for (int i = 0; i < source.mLanguages.Count; ++i)
|
||||
if (source.mLanguages[i].IsEnabled() && string.IsNullOrEmpty(termdata.Languages[i]))
|
||||
{
|
||||
var langIdx = i;
|
||||
var term = termdata;
|
||||
var i2source = source;
|
||||
Translate(mainText, ref termdata, source.mLanguages[i].Code,
|
||||
(translation, error) =>
|
||||
{
|
||||
if (error != null)
|
||||
ShowError(error);
|
||||
else
|
||||
if (translation != null)
|
||||
{
|
||||
term.Languages[langIdx] = translation; //SetTranslation(langIdx, translation);
|
||||
i2source.Editor_SetDirty();
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
}
|
||||
|
||||
static void OnGUI_TranslatingMessage()
|
||||
{
|
||||
if (GoogleTranslation.IsTranslating())
|
||||
{
|
||||
// Connection Status Bar
|
||||
int time = (int)(Time.realtimeSinceStartup % 2 * 2.5);
|
||||
string Loading = "Translating" + ".....".Substring(0, time);
|
||||
GUI.color = Color.gray;
|
||||
GUILayout.BeginHorizontal(LocalizeInspector.GUIStyle_OldTextArea);
|
||||
GUILayout.Label(Loading, EditorStyles.miniLabel);
|
||||
GUI.color = Color.white;
|
||||
if (GUILayout.Button("Cancel", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
GoogleTranslation.CancelCurrentGoogleTranslations();
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
HandleUtility.Repaint ();
|
||||
}
|
||||
}
|
||||
|
||||
static void OnGUI_Keys_Language_SpecializationsBar(TermData termData, LanguageSourceData source)
|
||||
{
|
||||
var activeSpecializations = termData.GetAllSpecializations();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
var TabStyle = new GUIStyle(GUI.skin.FindStyle("dragtab"));
|
||||
TabStyle.fixedHeight = 0;
|
||||
|
||||
//var ss = GUI.skin.FindStyle("TL tab left");
|
||||
var TabOpenStyle = new GUIStyle(GUI.skin.FindStyle("minibuttonmid"));
|
||||
TabOpenStyle.margin.right = -1;
|
||||
var TabCloseStyle = new GUIStyle(EditorStyles.label);
|
||||
//var TabCloseStyle = new GUIStyle(GUI.skin.FindStyle("TL tab right"));
|
||||
TabCloseStyle.margin.left = -1;
|
||||
TabCloseStyle.padding.left=4;
|
||||
|
||||
//-- Specialization Tabs -----
|
||||
|
||||
var prevSpecialization = "Any";
|
||||
foreach (var specialization in SpecializationManager.Singleton.mSpecializations)
|
||||
{
|
||||
if (!activeSpecializations.Contains(specialization) && specialization != GUI_SelectedSpecialization)
|
||||
continue;
|
||||
|
||||
bool isActive = specialization == GUI_SelectedSpecialization;
|
||||
var labelContent = new GUIContent(specialization, "Specialization of the main translation (i.e. variants that show only on specific platforms or devices)\nThis allows using 'tap' instead of 'click' for touch devices.");
|
||||
|
||||
if (isActive && activeSpecializations.Count>1)
|
||||
{
|
||||
GUILayout.BeginHorizontal(TabOpenStyle);
|
||||
GUILayout.Toggle(isActive, labelContent, TabStyle, GUILayout.Height(20), GUILayout.ExpandWidth(false));
|
||||
//GUILayout.Label(labelContent, TabOpenStyle);
|
||||
if (specialization != "Any" && GUILayout.Button("x", TabCloseStyle, GUILayout.Width(15)))
|
||||
{
|
||||
termData.RemoveSpecialization(specialization);
|
||||
GUI_SelectedSpecialization = prevSpecialization;
|
||||
GUI.FocusControl(null);
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
else
|
||||
if (GUILayout.Toggle(isActive, labelContent, TabStyle, GUILayout.Height(25), GUILayout.ExpandWidth(false)) && !isActive)
|
||||
{
|
||||
GUI_SelectedSpecialization = specialization;
|
||||
GUI.FocusControl(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-- Add new Specialization -----
|
||||
int newIndex = EditorGUILayout.Popup(-1, SpecializationManager.Singleton.mSpecializations, "DropDown", GUILayout.Width(20));
|
||||
if (newIndex>=0)
|
||||
{
|
||||
string newSpecialization = SpecializationManager.Singleton.mSpecializations[newIndex];
|
||||
if (!activeSpecializations.Contains(newSpecialization))
|
||||
{
|
||||
for (int iLang = 0; iLang < source.mLanguages.Count; ++iLang)
|
||||
{
|
||||
string Translation = termData.GetTranslation(iLang, GUI_SelectedSpecialization, editMode: true);
|
||||
termData.SetTranslation(iLang, Translation, GUI_SelectedSpecialization);
|
||||
}
|
||||
GUI_SelectedSpecialization = newSpecialization;
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
|
||||
GUI_ShowDisabledLanguagesTranslation = GUILayout.Toggle(GUI_ShowDisabledLanguagesTranslation, new GUIContent("L", "Show Disabled Languages"), "Button", GUILayout.ExpandWidth(false));
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space(-3);
|
||||
}
|
||||
|
||||
static void OnGUI_Keys_LanguageTranslations (string Key, Localize localizeCmp, bool IsPrimaryKey, ref TermData termdata, LanguageSourceData source)
|
||||
{
|
||||
bool IsSelect = Event.current.type==EventType.MouseUp;
|
||||
for (int i=0; i< source.mLanguages.Count; ++ i)
|
||||
{
|
||||
bool forcePreview = false;
|
||||
bool isEnabledLanguage = source.mLanguages[i].IsEnabled();
|
||||
|
||||
if (!isEnabledLanguage)
|
||||
{
|
||||
if (!GUI_ShowDisabledLanguagesTranslation)
|
||||
continue;
|
||||
GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, 0.35f);
|
||||
}
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
if (GUILayout.Button(source.mLanguages[i].Name, EditorStyles.label, GUILayout.Width(100)))
|
||||
forcePreview = true;
|
||||
|
||||
|
||||
string Translation = termdata.GetTranslation(i, GUI_SelectedSpecialization, editMode:true);
|
||||
if (Translation == null) Translation = string.Empty;
|
||||
|
||||
// if (termdata.Languages[i] != termdata.Languages_Touch[i] && !string.IsNullOrEmpty(termdata.Languages[i]) && !string.IsNullOrEmpty(termdata.Languages_Touch[i]))
|
||||
// GUI.contentColor = GUITools.LightYellow;
|
||||
|
||||
if (termdata.TermType == eTermType.Text || termdata.TermType==eTermType.Child)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck ();
|
||||
string CtrName = "TranslatedText"+i;
|
||||
GUI.SetNextControlName(CtrName);
|
||||
|
||||
EditPluralTranslations (ref Translation, i, source.mLanguages[i].Code);
|
||||
//Translation = EditorGUILayout.TextArea(Translation, Style_WrapTextField, GUILayout.Width(Screen.width - 260 - (autoTranslated ? 20 : 0)));
|
||||
if (EditorGUI.EndChangeCheck ())
|
||||
{
|
||||
termdata.SetTranslation(i, Translation, GUI_SelectedSpecialization);
|
||||
source.Editor_SetDirty();
|
||||
forcePreview = true;
|
||||
}
|
||||
|
||||
if (localizeCmp!=null &&
|
||||
(forcePreview || /*GUI.changed || */GUI.GetNameOfFocusedControl()==CtrName && IsSelect))
|
||||
{
|
||||
if (IsPrimaryKey && string.IsNullOrEmpty(localizeCmp.Term))
|
||||
{
|
||||
localizeCmp.mTerm = Key;
|
||||
}
|
||||
|
||||
if (!IsPrimaryKey && string.IsNullOrEmpty(localizeCmp.SecondaryTerm))
|
||||
{
|
||||
localizeCmp.mTermSecondary = Key;
|
||||
}
|
||||
|
||||
string PreviousLanguage = LocalizationManager.CurrentLanguage;
|
||||
LocalizationManager.PreviewLanguage(source.mLanguages[i].Name);
|
||||
if (forcePreview || IsSelect)
|
||||
LocalizationManager.LocalizeAll();
|
||||
else
|
||||
localizeCmp.OnLocalize(true);
|
||||
LocalizationManager.PreviewLanguage(PreviousLanguage);
|
||||
EditorUtility.SetDirty(localizeCmp);
|
||||
}
|
||||
GUI.contentColor = Color.white;
|
||||
|
||||
//if (autoTranslated)
|
||||
//{
|
||||
// if (GUILayout.Button(new GUIContent("\u2713"/*"A"*/,"Translated by Google Translator\nClick the button to approve the translation"), EditorStyles.toolbarButton, GUILayout.Width(autoTranslated ? 20 : 0)))
|
||||
// {
|
||||
// termdata.Flags[i] &= (byte)(byte.MaxValue ^ (byte)(GUI_SelectedSpecialization==0 ? TranslationFlag.AutoTranslated_Normal : TranslationFlag.AutoTranslated_Touch));
|
||||
// }
|
||||
//}
|
||||
|
||||
if (termdata.TermType == eTermType.Text)
|
||||
{
|
||||
if (TestButtonArg(eTest_ActionType.Button_Term_Translate, i, new GUIContent("T", "Translate"), EditorStyles.toolbarButton, GUILayout.Width(20)))
|
||||
{
|
||||
var termData = termdata;
|
||||
var indx = i;
|
||||
var key = Key;
|
||||
GUITools.DelayedCall(()=>TranslateTerm(key, termData, source, indx));
|
||||
GUI.FocusControl(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string MultiSpriteName = string.Empty;
|
||||
|
||||
if (termdata.TermType==eTermType.Sprite && Translation.EndsWith("]", StringComparison.Ordinal)) // Handle sprites of type (Multiple): "SpritePath[SpriteName]"
|
||||
{
|
||||
int idx = Translation.LastIndexOf("[", StringComparison.Ordinal);
|
||||
int len = Translation.Length-idx-2;
|
||||
MultiSpriteName = Translation.Substring(idx+1, len);
|
||||
Translation = Translation.Substring(0, idx);
|
||||
}
|
||||
|
||||
Object Obj = null;
|
||||
|
||||
// Try getting the asset from the References section
|
||||
if (localizeCmp!=null)
|
||||
Obj = localizeCmp.FindTranslatedObject<Object>(Translation);
|
||||
if (Obj==null && source != null)
|
||||
Obj = source.FindAsset(Translation);
|
||||
|
||||
// If it wasn't in the references, Load it from Resources
|
||||
if (Obj==null && localizeCmp==null)
|
||||
Obj = ResourceManager.pInstance.LoadFromResources<Object>(Translation);
|
||||
|
||||
Type ObjType = typeof(Object);
|
||||
switch (termdata.TermType)
|
||||
{
|
||||
case eTermType.Font : ObjType = typeof(Font); break;
|
||||
case eTermType.Texture : ObjType = typeof(Texture); break;
|
||||
case eTermType.AudioClip : ObjType = typeof(AudioClip); break;
|
||||
case eTermType.GameObject : ObjType = typeof(GameObject); break;
|
||||
case eTermType.Sprite : ObjType = typeof(Sprite); break;
|
||||
case eTermType.Material : ObjType = typeof(Material); break;
|
||||
case eTermType.Mesh : ObjType = typeof(Mesh); break;
|
||||
#if NGUI
|
||||
case eTermType.UIAtlas : ObjType = typeof(UIAtlas); break;
|
||||
case eTermType.UIFont : ObjType = typeof(UIFont); break;
|
||||
#endif
|
||||
#if TK2D
|
||||
case eTermType.TK2dFont : ObjType = typeof(tk2dFont); break;
|
||||
case eTermType.TK2dCollection : ObjType = typeof(tk2dSpriteCollection); break;
|
||||
#endif
|
||||
|
||||
#if TextMeshPro
|
||||
case eTermType.TextMeshPFont : ObjType = typeof(TMP_FontAsset); break;
|
||||
#endif
|
||||
|
||||
#if SVG
|
||||
case eTermType.SVGAsset : ObjType = typeof(SVGImporter.SVGAsset); break;
|
||||
#endif
|
||||
|
||||
case eTermType.Object : ObjType = typeof(Object); break;
|
||||
}
|
||||
|
||||
if (Obj!=null && !string.IsNullOrEmpty(MultiSpriteName))
|
||||
{
|
||||
string sPath = AssetDatabase.GetAssetPath(Obj);
|
||||
Object[] objs = AssetDatabase.LoadAllAssetRepresentationsAtPath(sPath);
|
||||
Obj = null;
|
||||
for (int j=0, jmax=objs.Length; j<jmax; ++j)
|
||||
if (objs[j].name.Equals(MultiSpriteName))
|
||||
{
|
||||
Obj = objs[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool bShowTranslationLabel = Obj==null && !string.IsNullOrEmpty(Translation);
|
||||
if (bShowTranslationLabel)
|
||||
{
|
||||
GUI.backgroundColor=GUITools.DarkGray;
|
||||
GUILayout.BeginVertical(LocalizeInspector.GUIStyle_OldTextArea, GUILayout.Height(1));
|
||||
GUILayout.Space(2);
|
||||
|
||||
GUI.backgroundColor = Color.white;
|
||||
}
|
||||
|
||||
Object NewObj = EditorGUILayout.ObjectField(Obj, ObjType, true, GUILayout.ExpandWidth(true));
|
||||
if (Obj!=NewObj)
|
||||
{
|
||||
string sPath = null;
|
||||
if (NewObj != null)
|
||||
{
|
||||
sPath = AssetDatabase.GetAssetPath(NewObj);
|
||||
|
||||
mCurrentInspector.serializedObject.ApplyModifiedProperties();
|
||||
foreach (var cmp in mCurrentInspector.serializedObject.targetObjects)
|
||||
{
|
||||
AddObjectPath(ref sPath, cmp as Localize, NewObj);
|
||||
}
|
||||
mCurrentInspector.serializedObject.ApplyModifiedProperties();
|
||||
|
||||
if (HasObjectInReferences(NewObj, localizeCmp))
|
||||
sPath = NewObj.name;
|
||||
else
|
||||
if (termdata.TermType == eTermType.Sprite)
|
||||
sPath += "[" + NewObj.name + "]";
|
||||
}
|
||||
|
||||
termdata.SetTranslation(i, sPath, GUI_SelectedSpecialization);
|
||||
source.Editor_SetDirty();
|
||||
}
|
||||
|
||||
if (bShowTranslationLabel)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
GUI.color = Color.red;
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Label (Translation, EditorStyles.miniLabel);
|
||||
GUILayout.FlexibleSpace();
|
||||
GUI.color = Color.white;
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
GUI.color = Color.white;
|
||||
}
|
||||
}
|
||||
|
||||
private static void TranslateTerm(string Key, TermData termdata, LanguageSourceData source, int i)
|
||||
{
|
||||
string sourceText = null;
|
||||
string sourceLangCode = null;
|
||||
FindTranslationSource(Key, termdata, source.mLanguages[i].Code, null, out sourceText, out sourceLangCode);
|
||||
|
||||
var term = termdata;
|
||||
var specialization = GUI_SelectedSpecialization;
|
||||
var langIdx = i;
|
||||
var i2source = source;
|
||||
Translate(sourceText, ref termdata, source.mLanguages[i].Code, (translation, error) =>
|
||||
{
|
||||
term.SetTranslation(langIdx, translation, specialization);
|
||||
i2source.Editor_SetDirty();
|
||||
}, specialization);
|
||||
}
|
||||
|
||||
static void EditPluralTranslations( ref string translation, int langIdx, string langCode )
|
||||
{
|
||||
bool hasParameters = false;
|
||||
int paramStart = translation.IndexOf("{[");
|
||||
hasParameters = paramStart >= 0 && translation.IndexOf ("]}", paramStart) > 0;
|
||||
|
||||
if (mShowPlural == langIdx && string.IsNullOrEmpty (translation))
|
||||
mShowPlural = -1;
|
||||
|
||||
bool allowPlural = hasParameters || translation.Contains("[i2p_");
|
||||
|
||||
if (allowPlural)
|
||||
{
|
||||
if (GUILayout.Toggle (mShowPlural == langIdx, "", EditorStyles.foldout, GUILayout.Width (13)))
|
||||
mShowPlural = langIdx;
|
||||
else if (mShowPlural == langIdx)
|
||||
mShowPlural = -1;
|
||||
|
||||
GUILayout.Space (-5);
|
||||
}
|
||||
|
||||
string finalTranslation = "";
|
||||
bool unfolded = mShowPlural == langIdx;
|
||||
bool isPlural = allowPlural && translation.Contains("[i2p_");
|
||||
if (unfolded)
|
||||
GUILayout.BeginVertical ("Box");
|
||||
|
||||
ShowPluralTranslation("Plural", langCode, translation, ref finalTranslation, true, unfolded, unfolded|isPlural );
|
||||
ShowPluralTranslation("Zero", langCode, translation, ref finalTranslation, unfolded, true, true );
|
||||
ShowPluralTranslation("One", langCode, translation, ref finalTranslation, unfolded, true, true );
|
||||
ShowPluralTranslation("Two", langCode, translation, ref finalTranslation, unfolded, true, true );
|
||||
ShowPluralTranslation("Few", langCode, translation, ref finalTranslation, unfolded, true, true );
|
||||
ShowPluralTranslation("Many", langCode, translation, ref finalTranslation, unfolded, true, true );
|
||||
|
||||
if (unfolded)
|
||||
GUILayout.EndVertical ();
|
||||
|
||||
translation = finalTranslation;
|
||||
}
|
||||
|
||||
static void ShowPluralTranslation(string pluralType, string langCode, string translation, ref string finalTranslation, bool show, bool allowDelete, bool showTag )
|
||||
{
|
||||
string tag = "[i2p_" + pluralType + "]";
|
||||
int idx0 = translation.IndexOf (tag, StringComparison.OrdinalIgnoreCase);
|
||||
bool hasTranslation = idx0 >= 0 || pluralType=="Plural";
|
||||
if (idx0 < 0) idx0 = 0;
|
||||
else idx0 += tag.Length;
|
||||
|
||||
int idx1 = translation.IndexOf ("[i2p_", idx0, StringComparison.OrdinalIgnoreCase);
|
||||
if (idx1 < 0) idx1 = translation.Length;
|
||||
|
||||
var pluralTranslation = translation.Substring(idx0, idx1-idx0);
|
||||
var newTrans = pluralTranslation;
|
||||
|
||||
bool allowPluralForm = GoogleLanguages.LanguageHasPluralType (langCode, pluralType);
|
||||
|
||||
if (hasTranslation && !allowPluralForm) {
|
||||
newTrans = "";
|
||||
GUI.changed = true;
|
||||
}
|
||||
|
||||
if (show && allowPluralForm)
|
||||
{
|
||||
if (!hasTranslation)
|
||||
GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, 0.35f);
|
||||
|
||||
GUILayout.BeginHorizontal ();
|
||||
if (showTag)
|
||||
GUILayout.Label (pluralType, EditorStyles.miniLabel, GUILayout.Width(35));
|
||||
newTrans = EditorGUILayout.TextArea (pluralTranslation, Style_WrapTextField);
|
||||
|
||||
if (allowDelete && GUILayout.Button("X", EditorStyles.toolbarButton, GUILayout.Width(15)))
|
||||
{
|
||||
newTrans = string.Empty;
|
||||
GUI.changed = true;
|
||||
GUIUtility.keyboardControl = 0;
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal ();
|
||||
if (!hasTranslation)
|
||||
GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, 1);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty (newTrans))
|
||||
{
|
||||
if (hasTranslation || newTrans != pluralTranslation)
|
||||
{
|
||||
if (pluralType != "Plural")
|
||||
finalTranslation += tag;
|
||||
finalTranslation += newTrans;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*static public int DrawTranslationTabs( int Index )
|
||||
{
|
||||
GUIStyle MyStyle = new GUIStyle(GUI.skin.FindStyle("dragtab"));
|
||||
MyStyle.fixedHeight=0;
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
for (int i=0; i<Tabs.Length; ++i)
|
||||
{
|
||||
if ( GUILayout.Toggle(Index==i, Tabs[i], MyStyle, GUILayout.Height(height)) && Index!=i)
|
||||
Index=i;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
return Index;
|
||||
}*/
|
||||
|
||||
static bool HasObjectInReferences( Object obj, Localize localizeCmp )
|
||||
{
|
||||
if (localizeCmp!=null && localizeCmp.TranslatedObjects.Contains(obj))
|
||||
return true;
|
||||
|
||||
if (mLanguageSource!=null && mLanguageSource.Assets.Contains(obj))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void AddObjectPath( ref string sPath, Localize localizeCmp, Object NewObj )
|
||||
{
|
||||
if (I2Utils.RemoveResourcesPath (ref sPath))
|
||||
return;
|
||||
|
||||
// If its not in the Resources folder and there is no object reference already in the
|
||||
// Reference array, then add that to the Localization component or the Language Source
|
||||
if (HasObjectInReferences(NewObj, localizeCmp))
|
||||
return;
|
||||
|
||||
if (localizeCmp!=null)
|
||||
{
|
||||
localizeCmp.AddTranslatedObject(NewObj);
|
||||
EditorUtility.SetDirty(localizeCmp);
|
||||
}
|
||||
else
|
||||
if (mLanguageSource!=null)
|
||||
{
|
||||
mLanguageSource.AddAsset(NewObj);
|
||||
mLanguageSource.Editor_SetDirty();
|
||||
}
|
||||
}
|
||||
|
||||
static void Translate ( string Key, ref TermData termdata, string TargetLanguageCode, GoogleTranslation.fnOnTranslated onTranslated, string overrideSpecialization )
|
||||
{
|
||||
#if UNITY_WEBPLAYER
|
||||
ShowError ("Contacting google translation is not yet supported on WebPlayer" );
|
||||
#else
|
||||
|
||||
if (!GoogleTranslation.CanTranslate())
|
||||
{
|
||||
ShowError ("WebService is not set correctly or needs to be reinstalled");
|
||||
return;
|
||||
}
|
||||
|
||||
// Translate first language that has something
|
||||
// If no language found, translation will fallback to autodetect language from key
|
||||
|
||||
string sourceCode, sourceText;
|
||||
FindTranslationSource( Key, termdata, TargetLanguageCode, overrideSpecialization, out sourceText, out sourceCode );
|
||||
GoogleTranslation.Translate( sourceText, sourceCode, TargetLanguageCode, onTranslated );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static void FindTranslationSource( string Key, TermData termdata, string TargetLanguageCode, string forceSpecialization, out string sourceText, out string sourceLanguageCode )
|
||||
{
|
||||
sourceLanguageCode = "auto";
|
||||
sourceText = Key;
|
||||
|
||||
for (int i = 0, imax = termdata.Languages.Length; i < imax; ++i)
|
||||
{
|
||||
if (mLanguageSource.mLanguages[i].IsEnabled() && !string.IsNullOrEmpty(termdata.Languages[i]))
|
||||
{
|
||||
sourceText = forceSpecialization==null ? termdata.Languages[i] : termdata.GetTranslation(i, forceSpecialization, editMode:true);
|
||||
if (mLanguageSource.mLanguages[i].Code != TargetLanguageCode)
|
||||
{
|
||||
sourceLanguageCode = mLanguageSource.mLanguages[i].Code;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3efc8937ee2fcab49a6b6c1c9a1ed051
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,49 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace I2.Loc
|
||||
{
|
||||
public partial class LocalizationEditor
|
||||
{
|
||||
|
||||
#region Variables
|
||||
|
||||
Vector2 mScrollPos_BuildScenes = Vector2.zero;
|
||||
|
||||
static List<string> mSelectedScenes = new List<string>();
|
||||
|
||||
public enum eToolsMode { Parse, Categorize, Merge, NoLocalized, Script, CharSet }
|
||||
public eToolsMode mCurrentToolsMode = eToolsMode.Parse;
|
||||
|
||||
#endregion
|
||||
|
||||
#region GUI
|
||||
|
||||
void OnGUI_Tools( bool reset )
|
||||
{
|
||||
GUILayout.Space(10);
|
||||
eToolsMode OldMode = mCurrentToolsMode;
|
||||
mCurrentToolsMode = (eToolsMode)GUITools.DrawShadowedTabs ((int)mCurrentToolsMode, new[]{"解析Parse", "分类Categorize", "合并Merge", "无本地化 No Localized", "脚本Script", "字符CharSet"}, 30);
|
||||
if (mCurrentToolsMode != OldMode || reset)
|
||||
{
|
||||
ClearErrors();
|
||||
if (mCurrentToolsMode == eToolsMode.Script)
|
||||
SelectTermsFromScriptLocalization();
|
||||
OnGUI_ScenesList_SelectAllScenes(true);
|
||||
}
|
||||
|
||||
switch (mCurrentToolsMode)
|
||||
{
|
||||
case eToolsMode.Parse : OnGUI_Tools_ParseTerms(); break;
|
||||
case eToolsMode.Categorize : OnGUI_Tools_Categorize(); break;
|
||||
case eToolsMode.Merge : OnGUI_Tools_MergeTerms(); break;
|
||||
case eToolsMode.NoLocalized : OnGUI_Tools_NoLocalized(); break;
|
||||
case eToolsMode.Script : OnGUI_Tools_Script(); break;
|
||||
case eToolsMode.CharSet : OnGUI_Tools_CharSet(); break;
|
||||
}
|
||||
OnGUI_ShowMsg();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3fa4621ebd4134e1989b73eb3f7b864f
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,226 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace I2.Loc
|
||||
{
|
||||
public partial class LocalizationEditor
|
||||
{
|
||||
#region Variables
|
||||
|
||||
Vector2 mScrollPos_CategorizedKeys = Vector2.zero;
|
||||
string mNewCategory = string.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region GUI
|
||||
|
||||
void OnGUI_Tools_Categorize()
|
||||
{
|
||||
OnGUI_ScenesList(true);
|
||||
|
||||
GUI.backgroundColor = Color.Lerp (Color.gray, Color.white, 0.2f);
|
||||
GUILayout.BeginVertical(LocalizeInspector.GUIStyle_OldTextArea, GUILayout.Height(1));
|
||||
GUI.backgroundColor = Color.white;
|
||||
GUILayout.Space (5);
|
||||
|
||||
EditorGUILayout.HelpBox("此工具更改所选术语的类别并更新高亮显示的场景。\nThis tool changes the category of the selected Terms and updates the highlighted scenes", MessageType.Info);
|
||||
|
||||
GUILayout.Space (5);
|
||||
GUITools.CloseHeader();
|
||||
|
||||
OnGUI_Tools_Categorize_Terms();
|
||||
OnGUI_NewOrExistingCategory();
|
||||
}
|
||||
|
||||
void OnGUI_Tools_Categorize_Terms()
|
||||
{
|
||||
GUILayout.Label("Change Category of the following Terms:", EditorStyles.toolbarButton, GUILayout.ExpandWidth(true));
|
||||
|
||||
GUI.backgroundColor = Color.Lerp(GUITools.LightGray, Color.white, 0.5f);
|
||||
mScrollPos_CategorizedKeys = GUILayout.BeginScrollView( mScrollPos_CategorizedKeys, LocalizeInspector.GUIStyle_OldTextArea, GUILayout.Height ( 100));
|
||||
GUI.backgroundColor = Color.white;
|
||||
|
||||
if (mSelectedKeys.Count==0)
|
||||
{
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
//GUILayout.BeginVertical();
|
||||
EditorGUILayout.HelpBox("没有选择任何条款 No Terms has been selected", MessageType.Warning);
|
||||
/*if (GUILayout.Button("Select Terms", EditorStyles.toolbarButton, GUILayout.ExpandWidth(true)))
|
||||
mCurrentViewMode = eViewMode.Keys;*/
|
||||
//GUILayout.EndVertical();
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
}
|
||||
else
|
||||
{
|
||||
bool DoubleColumn = mSelectedKeys.Count>5;
|
||||
int HalfCount = Mathf.CeilToInt(mSelectedKeys.Count/2.0f);
|
||||
|
||||
for (int i=0, imax=mSelectedKeys.Count; i<imax; ++i)
|
||||
{
|
||||
if (DoubleColumn && i>=HalfCount) break;
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
OnGUI_CategorizedTerm(mSelectedKeys[i]);
|
||||
|
||||
if (DoubleColumn && i+HalfCount<mSelectedKeys.Count)
|
||||
OnGUI_CategorizedTerm(mSelectedKeys[i+HalfCount]);
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
GUILayout.EndScrollView();
|
||||
}
|
||||
|
||||
void OnGUI_CategorizedTerm( string Term )
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
string sKey, sCategory;
|
||||
LanguageSourceData.DeserializeFullTerm(Term, out sKey, out sCategory);
|
||||
if (!string.IsNullOrEmpty(sCategory))
|
||||
{
|
||||
GUI.color = Color.gray;
|
||||
GUILayout.Label(sCategory+"/");
|
||||
GUI.color = Color.white;
|
||||
}
|
||||
GUILayout.Label(sKey);
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
void OnGUI_NewOrExistingCategory()
|
||||
{
|
||||
//--[ Create Category ]------------------------
|
||||
GUILayout.BeginHorizontal();
|
||||
mNewCategory = GUILayout.TextField(mNewCategory, EditorStyles.toolbarTextField, GUILayout.ExpandWidth(true));
|
||||
if (GUILayout.Button("Create", "toolbarbutton", GUILayout.Width(60)))
|
||||
{
|
||||
EditorApplication.update += AssignCategoryToSelectedTerms;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
//--[ Existing Category ]------------------------
|
||||
int Index = 0;
|
||||
List<string> Categories = LocalizationManager.GetCategories();
|
||||
|
||||
for (int i=0, imax=Categories.Count; i<imax; ++i)
|
||||
if (Categories[i].ToLower().Contains(mNewCategory.ToLower()))
|
||||
{
|
||||
Index = i;
|
||||
break;
|
||||
}
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
int NewIndex = EditorGUILayout.Popup(Index, Categories.ToArray(), EditorStyles.toolbarPopup, GUILayout.ExpandWidth(true));
|
||||
if (NewIndex!=Index)
|
||||
mNewCategory = Categories[ NewIndex ];
|
||||
if (GUILayout.Button("Use", "toolbarbutton", GUILayout.Width(60)))
|
||||
{
|
||||
mNewCategory = Categories[ NewIndex ];
|
||||
EditorApplication.update += AssignCategoryToSelectedTerms;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Assigning Category
|
||||
|
||||
public static Dictionary<string, string> TermReplacements;
|
||||
|
||||
void AssignCategoryToSelectedTerms()
|
||||
{
|
||||
mIsParsing = true;
|
||||
|
||||
EditorApplication.update -= AssignCategoryToSelectedTerms;
|
||||
|
||||
mNewCategory = mNewCategory.Trim (LanguageSourceData.CategorySeparators);
|
||||
|
||||
if (mNewCategory==LanguageSourceData.EmptyCategory)
|
||||
mNewCategory = string.Empty;
|
||||
|
||||
TermReplacements = new Dictionary<string, string>(StringComparer.Ordinal);
|
||||
for (int i=mSelectedKeys.Count-1; i>=0; --i)
|
||||
{
|
||||
string sKey, sCategory;
|
||||
string OldTerm = mSelectedKeys[i];
|
||||
|
||||
LanguageSourceData.DeserializeFullTerm( OldTerm, out sKey, out sCategory );
|
||||
if (!string.IsNullOrEmpty(mNewCategory))
|
||||
sKey = string.Concat(mNewCategory, "/", sKey);
|
||||
|
||||
if (OldTerm == sKey)
|
||||
continue;
|
||||
|
||||
TermReplacements[ OldTerm ] = sKey;
|
||||
if (!mLanguageSource.ContainsTerm(sKey))
|
||||
{
|
||||
TermData termData = mLanguageSource.GetTermData( OldTerm );
|
||||
if (termData != null)
|
||||
termData.Term = sKey;
|
||||
else
|
||||
TermReplacements.Remove (OldTerm);
|
||||
mLanguageSource.Editor_SetDirty();
|
||||
}
|
||||
}
|
||||
if (TermReplacements.Count<=0)
|
||||
{
|
||||
ShowError ("Unable to assign category: Terms were not found in the selected LanguageSource");
|
||||
}
|
||||
else
|
||||
{
|
||||
mLanguageSource.UpdateDictionary(true);
|
||||
ExecuteActionOnSelectedScenes( ReplaceTermsInCurrentScene );
|
||||
ParseTerms(true, false, true);
|
||||
|
||||
if (string.IsNullOrEmpty(mNewCategory))
|
||||
mNewCategory = LanguageSourceData.EmptyCategory;
|
||||
if (!mSelectedCategories.Contains(mNewCategory))
|
||||
mSelectedCategories.Add (mNewCategory);
|
||||
//RemoveUnusedCategoriesFromSelected();
|
||||
ScheduleUpdateTermsToShowInList();
|
||||
}
|
||||
TermReplacements = null;
|
||||
mIsParsing = false;
|
||||
}
|
||||
|
||||
public static void ReplaceTermsInCurrentScene()
|
||||
{
|
||||
Localize[] Locals = (Localize[])Resources.FindObjectsOfTypeAll(typeof(Localize));
|
||||
|
||||
if (Locals==null)
|
||||
return;
|
||||
|
||||
bool changed = false;
|
||||
for (int i=0, imax=Locals.Length; i<imax; ++i)
|
||||
{
|
||||
Localize localize = Locals[i];
|
||||
if (localize==null || localize.gameObject==null || !GUITools.ObjectExistInScene(localize.gameObject))
|
||||
continue;
|
||||
|
||||
string NewTerm;
|
||||
if (TermReplacements.TryGetValue(localize.Term, out NewTerm))
|
||||
{
|
||||
localize.mTerm = NewTerm;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (TermReplacements.TryGetValue(localize.SecondaryTerm, out NewTerm))
|
||||
{
|
||||
localize.mTermSecondary = NewTerm;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (changed)
|
||||
Editor_SaveScene(true);
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 690f28955e250544a9bfaf741e4cced7
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,190 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace I2.Loc
|
||||
{
|
||||
public partial class LocalizationEditor
|
||||
{
|
||||
#region Variables
|
||||
|
||||
List<string> mCharSetTool_Languages = new List<string>();
|
||||
string mCharSet = string.Empty;
|
||||
bool mCharSetTool_CaseSensitive;
|
||||
|
||||
#endregion
|
||||
|
||||
#region GUI Generate Script
|
||||
|
||||
void OnGUI_Tools_CharSet()
|
||||
{
|
||||
bool computeSet = false;
|
||||
|
||||
// remove missing languages
|
||||
for (int i=mCharSetTool_Languages.Count-1; i>=0; --i)
|
||||
{
|
||||
if (mLanguageSource.GetLanguageIndex(mCharSetTool_Languages[i])<0)
|
||||
mCharSetTool_Languages.RemoveAt(i);
|
||||
}
|
||||
|
||||
GUILayout.BeginHorizontal (EditorStyles.toolbar);
|
||||
GUILayout.Label ("Languages:", EditorStyles.miniLabel, GUILayout.ExpandWidth(true));
|
||||
if (GUILayout.Button ("All", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
mCharSetTool_Languages.Clear ();
|
||||
mCharSetTool_Languages.AddRange (mLanguageSource.mLanguages.Select(x=>x.Name));
|
||||
computeSet = true;
|
||||
}
|
||||
if (GUILayout.Button ("None", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
mCharSetTool_Languages.Clear ();
|
||||
computeSet = true;
|
||||
}
|
||||
if (GUILayout.Button ("Invert", EditorStyles.toolbarButton, GUILayout.ExpandWidth(false)))
|
||||
{
|
||||
var current = mCharSetTool_Languages.ToList ();
|
||||
mCharSetTool_Languages.Clear ();
|
||||
mCharSetTool_Languages.AddRange (mLanguageSource.mLanguages.Select(x=>x.Name).Where(j=>!current.Contains(j)));
|
||||
computeSet = true;
|
||||
}
|
||||
|
||||
|
||||
GUILayout.EndHorizontal ();
|
||||
|
||||
//--[ Language List ]--------------------------
|
||||
|
||||
GUI.backgroundColor = Color.Lerp(GUITools.LightGray, Color.white, 0.5f);
|
||||
mScrollPos_Languages = GUILayout.BeginScrollView( mScrollPos_Languages, LocalizeInspector.GUIStyle_OldTextArea, GUILayout.MinHeight (100), GUILayout.MaxHeight(Screen.height), GUILayout.ExpandHeight(false));
|
||||
GUI.backgroundColor = Color.white;
|
||||
|
||||
for (int i=0, imax=mLanguageSource.mLanguages.Count; i<imax; ++i)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
var language = mLanguageSource.mLanguages[i].Name;
|
||||
bool hasLanguage = mCharSetTool_Languages.Contains(language);
|
||||
bool newValue = GUILayout.Toggle (hasLanguage, "", "OL Toggle", GUILayout.ExpandWidth(false));
|
||||
GUILayout.Label(language);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
if (hasLanguage != newValue)
|
||||
{
|
||||
if (newValue)
|
||||
mCharSetTool_Languages.Add(language);
|
||||
else
|
||||
mCharSetTool_Languages.Remove(language);
|
||||
|
||||
computeSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.EndScrollView();
|
||||
|
||||
//GUILayout.Space (5);
|
||||
|
||||
GUI.backgroundColor = Color.Lerp (Color.gray, Color.white, 0.2f);
|
||||
GUILayout.BeginVertical(LocalizeInspector.GUIStyle_OldTextArea, GUILayout.Height(1));
|
||||
GUI.backgroundColor = Color.white;
|
||||
|
||||
EditorGUILayout.HelpBox("此工具显示在所选语言中使用的所有字符\nThis tool shows all characters used in the selected languages", MessageType.Info);
|
||||
|
||||
GUILayout.Space (5);
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
GUI.changed = false;
|
||||
mCharSetTool_CaseSensitive = GUILayout.Toggle(mCharSetTool_CaseSensitive, "Case-Sensitive", GUILayout.ExpandWidth(false));
|
||||
if (GUI.changed)
|
||||
computeSet = true;
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space (5);
|
||||
|
||||
if (computeSet)
|
||||
UpdateCharSets();
|
||||
|
||||
int numUsedChars = string.IsNullOrEmpty (mCharSet) ? 0 : mCharSet.Length;
|
||||
GUILayout.Label ("Used Characters: (" + numUsedChars+")");
|
||||
EditorGUILayout.TextArea (mCharSet ?? "");
|
||||
GUILayout.BeginHorizontal ();
|
||||
GUILayout.FlexibleSpace ();
|
||||
if (GUILayout.Button ("Copy To Clipboard", GUITools.DontExpandWidth))
|
||||
EditorGUIUtility.systemCopyBuffer = mCharSet;
|
||||
GUILayout.EndHorizontal ();
|
||||
GUILayout.EndVertical ();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Generate Char Set
|
||||
|
||||
void UpdateCharSets ()
|
||||
{
|
||||
mCharSet = "";
|
||||
var sb = new HashSet<char> ();
|
||||
var LanIndexes = new List<int> ();
|
||||
for (int i=0; i<mLanguageSource.mLanguages.Count; ++i)
|
||||
if (mCharSetTool_Languages.Contains(mLanguageSource.mLanguages[i].Name))
|
||||
LanIndexes.Add(i);
|
||||
|
||||
foreach (var termData in mLanguageSource.mTerms)
|
||||
{
|
||||
for (int i=0; i<LanIndexes.Count; ++i)
|
||||
{
|
||||
int iLanguage = LanIndexes[i];
|
||||
bool isRTL = LocalizationManager.IsRTL( mLanguageSource.mLanguages[iLanguage].Code );
|
||||
AppendToCharSet( sb, termData.Languages[iLanguage], isRTL );
|
||||
}
|
||||
}
|
||||
var bytes = Encoding.UTF8.GetBytes( sb.ToArray().OrderBy(c => c).ToArray() );
|
||||
mCharSet = Encoding.UTF8.GetString(bytes);
|
||||
}
|
||||
|
||||
void AppendToCharSet( HashSet<char> sb, string text, bool isRTL )
|
||||
{
|
||||
if (string.IsNullOrEmpty (text))
|
||||
return;
|
||||
|
||||
text = RemoveTagsPrefix(text, "[i2p_");
|
||||
text = RemoveTagsPrefix(text, "[i2s_");
|
||||
|
||||
if (isRTL)
|
||||
text = RTLFixer.Fix( text );
|
||||
|
||||
foreach (char c in text)
|
||||
{
|
||||
if (!mCharSetTool_CaseSensitive)
|
||||
{
|
||||
sb.Add(char.ToLowerInvariant(c));
|
||||
sb.Add(char.ToUpperInvariant(c));
|
||||
}
|
||||
else
|
||||
sb.Add(c);
|
||||
}
|
||||
}
|
||||
|
||||
// Given "[i2p_" it removes all tags that start with that (e.g. [i2p_Zero] [i2p_One], etc)
|
||||
string RemoveTagsPrefix(string text, string tagPrefix)
|
||||
{
|
||||
int idx = 0;
|
||||
while (idx < text.Length)
|
||||
{
|
||||
idx = text.IndexOf(tagPrefix);
|
||||
if (idx < 0)
|
||||
break;
|
||||
|
||||
int idx2 = text.IndexOf(']', idx);
|
||||
if (idx2 < 0)
|
||||
break;
|
||||
|
||||
text = text.Remove(idx, idx2 - idx+1);
|
||||
}
|
||||
return text;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user