forked from sin365/AxibugEmuOnline
UI 迭代
This commit is contained in:
parent
4ca885d9fc
commit
2f5b5d9841
@ -388,6 +388,8 @@ GameObject:
|
|||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 2303118795734916657}
|
- component: {fileID: 2303118795734916657}
|
||||||
|
- component: {fileID: 6792036789108903940}
|
||||||
|
- component: {fileID: 4997733671603798451}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: viewport
|
m_Name: viewport
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -415,6 +417,44 @@ RectTransform:
|
|||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 0, y: 0}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!222 &6792036789108903940
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3462611600707696275}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!114 &4997733671603798451
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3462611600707696275}
|
||||||
|
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: 0}
|
||||||
|
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: 0}
|
||||||
|
m_Type: 0
|
||||||
|
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 &3811189825355447390
|
--- !u!1 &3811189825355447390
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -134,7 +134,7 @@ MonoBehaviour:
|
|||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 734025543935719296}
|
m_GameObject: {fileID: 734025543935719296}
|
||||||
m_Enabled: 1
|
m_Enabled: 0
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
@ -281,7 +281,7 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Material: {fileID: 0}
|
m_Material: {fileID: 0}
|
||||||
m_Color: {r: 1, g: 0.4577373, b: 0, a: 1}
|
m_Color: {r: 1, g: 0.45882356, b: 0, a: 1}
|
||||||
m_RaycastTarget: 1
|
m_RaycastTarget: 1
|
||||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
m_Maskable: 1
|
m_Maskable: 1
|
||||||
@ -353,7 +353,7 @@ MonoBehaviour:
|
|||||||
Descript: {fileID: 3380485461544738227}
|
Descript: {fileID: 3380485461544738227}
|
||||||
Root: {fileID: 8754483333502849411}
|
Root: {fileID: 8754483333502849411}
|
||||||
ShadowIcon: {fileID: 2619187604372594158}
|
ShadowIcon: {fileID: 2619187604372594158}
|
||||||
InfoNode: {fileID: 6788248266412682264}
|
InfoNode: {fileID: 0}
|
||||||
SubMenuItemGroup: {fileID: 0}
|
SubMenuItemGroup: {fileID: 0}
|
||||||
SelectScale: 1
|
SelectScale: 1
|
||||||
UnSelectScale: 1
|
UnSelectScale: 1
|
||||||
|
@ -21,9 +21,12 @@ namespace AxibugEmuOnline.Client.ClientCore
|
|||||||
public static AppEmu emu;
|
public static AppEmu emu;
|
||||||
public static RomLib nesRomLib;
|
public static RomLib nesRomLib;
|
||||||
public static HttpAPI httpAPI;
|
public static HttpAPI httpAPI;
|
||||||
|
public static CacheManager CacheMgr;
|
||||||
|
|
||||||
private static CoroutineRunner coRunner;
|
private static CoroutineRunner coRunner;
|
||||||
|
|
||||||
|
public static string PersistentDataPath => Application.persistentDataPath;
|
||||||
|
|
||||||
[RuntimeInitializeOnLoadMethod]
|
[RuntimeInitializeOnLoadMethod]
|
||||||
static void Init()
|
static void Init()
|
||||||
{
|
{
|
||||||
@ -37,6 +40,7 @@ namespace AxibugEmuOnline.Client.ClientCore
|
|||||||
netgame = new AppNetGame();
|
netgame = new AppNetGame();
|
||||||
httpAPI = new HttpAPI();
|
httpAPI = new HttpAPI();
|
||||||
nesRomLib = new RomLib(EnumPlatform.NES);
|
nesRomLib = new RomLib(EnumPlatform.NES);
|
||||||
|
CacheMgr = new CacheManager();
|
||||||
|
|
||||||
var go = new GameObject("[AppAxibugEmuOnline]");
|
var go = new GameObject("[AppAxibugEmuOnline]");
|
||||||
GameObject.DontDestroyOnLoad(go);
|
GameObject.DontDestroyOnLoad(go);
|
||||||
|
95
AxibugEmuOnline.Client/Assets/Script/Manager/CacheManager.cs
Normal file
95
AxibugEmuOnline.Client/Assets/Script/Manager/CacheManager.cs
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Networking;
|
||||||
|
|
||||||
|
namespace AxibugEmuOnline.Client
|
||||||
|
{
|
||||||
|
public class CacheManager
|
||||||
|
{
|
||||||
|
static readonly string CacheDirPath = $"{AppAxibugEmuOnline.PersistentDataPath}/Caches";
|
||||||
|
static readonly string TextureCacheDirPath = $"{CacheDirPath}/Texture";
|
||||||
|
|
||||||
|
public void GetSpriteCache(string url, Action<Sprite, string> callback)
|
||||||
|
{
|
||||||
|
GetCacheData(url, TextureCacheDirPath, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerator DownloadFromURL(string url, string path, Action<byte[]> callback)
|
||||||
|
{
|
||||||
|
var request = UnityWebRequest.Get($"{AppAxibugEmuOnline.httpAPI.DownSite}/{url}");
|
||||||
|
yield return request.SendWebRequest();
|
||||||
|
|
||||||
|
if (request.result == UnityWebRequest.Result.Success)
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(path);
|
||||||
|
File.WriteAllBytes($"{path}/{url.GetHashCode()}", request.downloadHandler.data);
|
||||||
|
callback.Invoke(request.downloadHandler.data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
callback.Invoke(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Dictionary<string, object> cachesInMemory = new Dictionary<string, object>();
|
||||||
|
void GetCacheData<T>(string url, string path, Action<T, string> callback) where T : class
|
||||||
|
{
|
||||||
|
if (cachesInMemory.TryGetValue(url, out var cacheObj) && cacheObj is T obj)
|
||||||
|
{
|
||||||
|
callback.Invoke(obj, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileName = $"{url.GetHashCode()}";
|
||||||
|
byte[] rawData = null;
|
||||||
|
|
||||||
|
var filePath = $"{path}/{fileName}";
|
||||||
|
if (File.Exists(filePath))
|
||||||
|
{
|
||||||
|
rawData = File.ReadAllBytes(filePath);
|
||||||
|
var @out = RawDataConvert<T>(rawData);
|
||||||
|
cachesInMemory[url] = @out;
|
||||||
|
callback.Invoke(@out, url);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AppAxibugEmuOnline.StartCoroutine(DownloadFromURL(url, path, (data) =>
|
||||||
|
{
|
||||||
|
var @out = RawDataConvert<T>(data);
|
||||||
|
cachesInMemory[url] = @out;
|
||||||
|
callback.Invoke(@out, url);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Type t_texture2d = typeof(Texture2D);
|
||||||
|
Type t_sprite = typeof(Sprite);
|
||||||
|
Type t_byteArray = typeof(byte[]);
|
||||||
|
Type t_object = typeof(object);
|
||||||
|
|
||||||
|
T RawDataConvert<T>(byte[] data) where T : class
|
||||||
|
{
|
||||||
|
var vt = typeof(T);
|
||||||
|
|
||||||
|
if (vt == t_texture2d || vt == t_sprite)
|
||||||
|
{
|
||||||
|
Texture2D texture = new Texture2D(2, 2);
|
||||||
|
texture.LoadImage(data);
|
||||||
|
|
||||||
|
if (vt == t_texture2d) return texture as T;
|
||||||
|
else return Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f)) as T;
|
||||||
|
}
|
||||||
|
else if (vt == t_byteArray)
|
||||||
|
{
|
||||||
|
return data as T;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return data as T;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new NotImplementedException($"{vt.Name}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 03fa430ca22517548b510b71d54ab2d6
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -16,7 +16,7 @@ namespace AxibugEmuOnline.Client
|
|||||||
private EnumPlatform platform;
|
private EnumPlatform platform;
|
||||||
|
|
||||||
/// <summary> 指示该Rom文件的存放路径 </summary>
|
/// <summary> 指示该Rom文件的存放路径 </summary>
|
||||||
public string LocalFilePath => $"{CoreSupporter.PersistentDataPath}/RemoteRoms/{platform}/{fileName}";
|
public string LocalFilePath => $"{AppAxibugEmuOnline.PersistentDataPath}/RemoteRoms/{platform}/{fileName}";
|
||||||
/// <summary> 指示该Rom文件是否已下载完毕 </summary>
|
/// <summary> 指示该Rom文件是否已下载完毕 </summary>
|
||||||
public bool RomReady => hasLocalFile;
|
public bool RomReady => hasLocalFile;
|
||||||
/// <summary> 指示是否正在下载Rom文件 </summary>
|
/// <summary> 指示是否正在下载Rom文件 </summary>
|
||||||
@ -30,6 +30,8 @@ namespace AxibugEmuOnline.Client
|
|||||||
public string Alias => webData.romName;
|
public string Alias => webData.romName;
|
||||||
/// <summary> 描述 </summary>
|
/// <summary> 描述 </summary>
|
||||||
public string Descript => webData.desc;
|
public string Descript => webData.desc;
|
||||||
|
/// <summary> 小图URL </summary>
|
||||||
|
public string ImageURL => webData.imgUrl;
|
||||||
|
|
||||||
/// <summary> 文件名 </summary>
|
/// <summary> 文件名 </summary>
|
||||||
public string FileName => fileName;
|
public string FileName => fileName;
|
||||||
|
@ -8,14 +8,6 @@ namespace AxibugEmuOnline.Client
|
|||||||
{
|
{
|
||||||
public class CoreSupporter : ISupporterImpl
|
public class CoreSupporter : ISupporterImpl
|
||||||
{
|
{
|
||||||
public static string PersistentDataPath
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Application.persistentDataPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Stream OpenRom(string fname)
|
public Stream OpenRom(string fname)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -48,7 +40,7 @@ namespace AxibugEmuOnline.Client
|
|||||||
|
|
||||||
public void SaveSRAMToFile(byte[] sramContent, string romName)
|
public void SaveSRAMToFile(byte[] sramContent, string romName)
|
||||||
{
|
{
|
||||||
string sramDirectoryPath = $"{Application.persistentDataPath}/sav";
|
string sramDirectoryPath = $"{AppAxibugEmuOnline.PersistentDataPath}/sav";
|
||||||
Directory.CreateDirectory(sramDirectoryPath);
|
Directory.CreateDirectory(sramDirectoryPath);
|
||||||
romName = Path.GetFileNameWithoutExtension(romName);
|
romName = Path.GetFileNameWithoutExtension(romName);
|
||||||
File.WriteAllBytes($"{sramDirectoryPath}/{romName}.sav", sramContent);
|
File.WriteAllBytes($"{sramDirectoryPath}/{romName}.sav", sramContent);
|
||||||
@ -56,7 +48,7 @@ namespace AxibugEmuOnline.Client
|
|||||||
|
|
||||||
public void SaveDISKToFile(byte[] diskFileContent, string romName)
|
public void SaveDISKToFile(byte[] diskFileContent, string romName)
|
||||||
{
|
{
|
||||||
string diskFileDirectoryPath = $"{Application.persistentDataPath}/dsv";
|
string diskFileDirectoryPath = $"{AppAxibugEmuOnline.PersistentDataPath}/dsv";
|
||||||
Directory.CreateDirectory(diskFileDirectoryPath);
|
Directory.CreateDirectory(diskFileDirectoryPath);
|
||||||
romName = Path.GetFileNameWithoutExtension(romName);
|
romName = Path.GetFileNameWithoutExtension(romName);
|
||||||
File.WriteAllBytes($"{diskFileDirectoryPath}/{romName}.dsv", diskFileContent);
|
File.WriteAllBytes($"{diskFileDirectoryPath}/{romName}.dsv", diskFileContent);
|
||||||
@ -66,14 +58,14 @@ namespace AxibugEmuOnline.Client
|
|||||||
|
|
||||||
public void PrepareDirectory(string directPath)
|
public void PrepareDirectory(string directPath)
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory($"{Application.persistentDataPath}/{directPath}");
|
Directory.CreateDirectory($"{AppAxibugEmuOnline.PersistentDataPath}/{directPath}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveFile(byte[] fileData, string directPath, string fileName)
|
public void SaveFile(byte[] fileData, string directPath, string fileName)
|
||||||
{
|
{
|
||||||
PrepareDirectory(directPath);
|
PrepareDirectory(directPath);
|
||||||
|
|
||||||
var fileFullpath = $"{Application.persistentDataPath}/{directPath}/{fileName}";
|
var fileFullpath = $"{AppAxibugEmuOnline.PersistentDataPath}/{directPath}/{fileName}";
|
||||||
File.WriteAllBytes(fileFullpath, fileData);
|
File.WriteAllBytes(fileFullpath, fileData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +73,7 @@ namespace AxibugEmuOnline.Client
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var data = File.ReadAllBytes($"{Application.persistentDataPath}/{directPath}/{fileName}");
|
var data = File.ReadAllBytes($"{AppAxibugEmuOnline.PersistentDataPath}/{directPath}/{fileName}");
|
||||||
if (data == null) return null;
|
if (data == null) return null;
|
||||||
return new MemoryStream(data);
|
return new MemoryStream(data);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using VirtualNes.Core;
|
using VirtualNes.Core;
|
||||||
@ -7,7 +8,7 @@ namespace AxibugEmuOnline.Client
|
|||||||
{
|
{
|
||||||
public class NesControllerMapper
|
public class NesControllerMapper
|
||||||
{
|
{
|
||||||
private static readonly string ConfigFilePath = $"{Application.persistentDataPath}/NES/ControllerMapper.json";
|
private static readonly string ConfigFilePath = $"{AppAxibugEmuOnline.PersistentDataPath}/NES/ControllerMapper.json";
|
||||||
|
|
||||||
public MapperSetter Player1 = new MapperSetter();
|
public MapperSetter Player1 = new MapperSetter();
|
||||||
public MapperSetter Player2 = new MapperSetter();
|
public MapperSetter Player2 = new MapperSetter();
|
||||||
@ -49,7 +50,7 @@ namespace AxibugEmuOnline.Client
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var json = File.ReadAllText($"{Application.persistentDataPath}/Nes/ControllerMapper.json");
|
var json = File.ReadAllText($"{AppAxibugEmuOnline.PersistentDataPath}/Nes/ControllerMapper.json");
|
||||||
s_setting = JsonUtility.FromJson<NesControllerMapper>(json);
|
s_setting = JsonUtility.FromJson<NesControllerMapper>(json);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace AxibugEmuOnline.Client
|
||||||
|
{
|
||||||
|
[RequireComponent(typeof(CanvasGroup))]
|
||||||
|
public class AutoRaycastCanvasGroup : MonoBehaviour
|
||||||
|
{
|
||||||
|
private CanvasGroup canvasGroup;
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
if (canvasGroup == null) canvasGroup = gameObject.GetComponent<CanvasGroup>();
|
||||||
|
|
||||||
|
canvasGroup.blocksRaycasts = canvasGroup.alpha == 0 ? false : true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4215c9d5a613e24428c8c705464719e3
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -32,6 +32,7 @@ namespace AxibugEmuOnline.Client.UI
|
|||||||
base.Start();
|
base.Start();
|
||||||
|
|
||||||
m_runtimeMenuUICanvas = m_runtimeMenuUI.Select(menu => menu.gameObject.AddComponent<CanvasGroup>()).ToList();
|
m_runtimeMenuUICanvas = m_runtimeMenuUI.Select(menu => menu.gameObject.AddComponent<CanvasGroup>()).ToList();
|
||||||
|
m_runtimeMenuUICanvas.ForEach(canv => canv.gameObject.AddComponent<AutoRaycastCanvasGroup>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,26 +39,30 @@ namespace AxibugEmuOnline.Client.UI
|
|||||||
|
|
||||||
if (ShadowIcon != null) ShadowIcon.gameObject.SetActive(false);
|
if (ShadowIcon != null) ShadowIcon.gameObject.SetActive(false);
|
||||||
|
|
||||||
InfoNode.alpha = 0;
|
if (InfoNode != null) InfoNode.alpha = 0;
|
||||||
if (ShadowIcon != null) ShadowIcon.gameObject.SetActiveEx(false);
|
if (ShadowIcon != null) ShadowIcon.gameObject.SetActiveEx(false);
|
||||||
if (SubMenuItemGroup != null) SubMenuItemGroup.SetSelect(false);
|
if (SubMenuItemGroup != null) SubMenuItemGroup.SetSelect(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetData(MenuData data)
|
public void SetData(MenuData data)
|
||||||
{
|
{
|
||||||
SetBaseInfo(data.Name, data.Description, data.Icon);
|
SetBaseInfo(data.Name, data.Description);
|
||||||
|
SetIcon(data.Icon);
|
||||||
if (SubMenuItemGroup != null) SubMenuItemGroup.Init(data.SubMenus);
|
if (SubMenuItemGroup != null) SubMenuItemGroup.Init(data.SubMenus);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void SetBaseInfo(string name, string descript, Sprite icon)
|
protected void SetBaseInfo(string name, string descript)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
if (Icon != null) Icon.sprite = icon;
|
|
||||||
if (ShadowIcon != null) ShadowIcon.sprite = icon;
|
|
||||||
if (Txt != null) Txt.text = name;
|
if (Txt != null) Txt.text = name;
|
||||||
if (Descript != null) Descript.text = descript;
|
if (Descript != null) Descript.text = descript;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void SetIcon(Sprite icon)
|
||||||
|
{
|
||||||
|
if (Icon != null) Icon.sprite = icon;
|
||||||
|
if (ShadowIcon != null) ShadowIcon.sprite = icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetSelectState(bool selected)
|
public void SetSelectState(bool selected)
|
||||||
@ -75,7 +79,7 @@ namespace AxibugEmuOnline.Client.UI
|
|||||||
progressTween = DOTween.To(() => m_progress, (x) => m_progress = x, m_select ? 1 : 0, 5)
|
progressTween = DOTween.To(() => m_progress, (x) => m_progress = x, m_select ? 1 : 0, 5)
|
||||||
.SetSpeedBased().OnUpdate(() =>
|
.SetSpeedBased().OnUpdate(() =>
|
||||||
{
|
{
|
||||||
InfoNode.alpha = m_progress;
|
if (InfoNode != null) InfoNode.alpha = m_progress;
|
||||||
|
|
||||||
Root.localScale = Vector3.one * Mathf.Lerp(UnSelectScale, SelectScale, m_progress);
|
Root.localScale = Vector3.one * Mathf.Lerp(UnSelectScale, SelectScale, m_progress);
|
||||||
});
|
});
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
using AxibugEmuOnline.Client.UI;
|
using AxibugEmuOnline.Client.UI;
|
||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -17,15 +18,14 @@ namespace AxibugEmuOnline.Client
|
|||||||
|
|
||||||
public void SetData(object data)
|
public void SetData(object data)
|
||||||
{
|
{
|
||||||
SetSelectState(true);
|
|
||||||
|
|
||||||
m_romfile = (RomFile)data;
|
m_romfile = (RomFile)data;
|
||||||
|
m_romfile.OnInfoFilled += OnRomInfoFilled;
|
||||||
|
m_romImage.sprite = null;
|
||||||
|
|
||||||
UpdateView();
|
UpdateView();
|
||||||
|
|
||||||
if (!m_romfile.InfoReady)
|
if (!m_romfile.InfoReady)
|
||||||
{
|
{
|
||||||
m_romfile.OnInfoFilled += OnRomInfoFilled;
|
|
||||||
m_romlib.BeginFetchRomInfo(m_romfile);
|
m_romlib.BeginFetchRomInfo(m_romfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,7 +38,6 @@ namespace AxibugEmuOnline.Client
|
|||||||
public void Release()
|
public void Release()
|
||||||
{
|
{
|
||||||
m_romfile.OnInfoFilled -= OnRomInfoFilled;
|
m_romfile.OnInfoFilled -= OnRomInfoFilled;
|
||||||
SetSelectState(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRomInfoFilled()
|
private void OnRomInfoFilled()
|
||||||
@ -50,11 +49,17 @@ namespace AxibugEmuOnline.Client
|
|||||||
{
|
{
|
||||||
if (!m_romfile.InfoReady)
|
if (!m_romfile.InfoReady)
|
||||||
{
|
{
|
||||||
SetBaseInfo(string.Empty, string.Empty, null);
|
SetBaseInfo(string.Empty, string.Empty);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetBaseInfo(m_romfile.Alias, m_romfile.Descript, null);
|
SetBaseInfo(m_romfile.Alias, m_romfile.Descript);
|
||||||
|
AppAxibugEmuOnline.CacheMgr.GetSpriteCache(m_romfile.ImageURL, (img, url) =>
|
||||||
|
{
|
||||||
|
if (url != m_romfile.ImageURL) return;
|
||||||
|
|
||||||
|
m_romImage.sprite = img;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user